diff options
Diffstat (limited to 'drivers')
292 files changed, 2428 insertions, 1300 deletions
diff --git a/drivers/acpi/acpi_ipmi.c b/drivers/acpi/acpi_ipmi.c index f40acef80269..a6977e12d574 100644 --- a/drivers/acpi/acpi_ipmi.c +++ b/drivers/acpi/acpi_ipmi.c | |||
| @@ -39,6 +39,7 @@ | |||
| 39 | #include <linux/ipmi.h> | 39 | #include <linux/ipmi.h> |
| 40 | #include <linux/device.h> | 40 | #include <linux/device.h> |
| 41 | #include <linux/pnp.h> | 41 | #include <linux/pnp.h> |
| 42 | #include <linux/spinlock.h> | ||
| 42 | 43 | ||
| 43 | MODULE_AUTHOR("Zhao Yakui"); | 44 | MODULE_AUTHOR("Zhao Yakui"); |
| 44 | MODULE_DESCRIPTION("ACPI IPMI Opregion driver"); | 45 | MODULE_DESCRIPTION("ACPI IPMI Opregion driver"); |
| @@ -57,7 +58,7 @@ struct acpi_ipmi_device { | |||
| 57 | struct list_head head; | 58 | struct list_head head; |
| 58 | /* the IPMI request message list */ | 59 | /* the IPMI request message list */ |
| 59 | struct list_head tx_msg_list; | 60 | struct list_head tx_msg_list; |
| 60 | struct mutex tx_msg_lock; | 61 | spinlock_t tx_msg_lock; |
| 61 | acpi_handle handle; | 62 | acpi_handle handle; |
| 62 | struct pnp_dev *pnp_dev; | 63 | struct pnp_dev *pnp_dev; |
| 63 | ipmi_user_t user_interface; | 64 | ipmi_user_t user_interface; |
| @@ -147,6 +148,7 @@ static void acpi_format_ipmi_msg(struct acpi_ipmi_msg *tx_msg, | |||
| 147 | struct kernel_ipmi_msg *msg; | 148 | struct kernel_ipmi_msg *msg; |
| 148 | struct acpi_ipmi_buffer *buffer; | 149 | struct acpi_ipmi_buffer *buffer; |
| 149 | struct acpi_ipmi_device *device; | 150 | struct acpi_ipmi_device *device; |
| 151 | unsigned long flags; | ||
| 150 | 152 | ||
| 151 | msg = &tx_msg->tx_message; | 153 | msg = &tx_msg->tx_message; |
| 152 | /* | 154 | /* |
| @@ -177,10 +179,10 @@ static void acpi_format_ipmi_msg(struct acpi_ipmi_msg *tx_msg, | |||
| 177 | 179 | ||
| 178 | /* Get the msgid */ | 180 | /* Get the msgid */ |
| 179 | device = tx_msg->device; | 181 | device = tx_msg->device; |
| 180 | mutex_lock(&device->tx_msg_lock); | 182 | spin_lock_irqsave(&device->tx_msg_lock, flags); |
| 181 | device->curr_msgid++; | 183 | device->curr_msgid++; |
| 182 | tx_msg->tx_msgid = device->curr_msgid; | 184 | tx_msg->tx_msgid = device->curr_msgid; |
| 183 | mutex_unlock(&device->tx_msg_lock); | 185 | spin_unlock_irqrestore(&device->tx_msg_lock, flags); |
| 184 | } | 186 | } |
| 185 | 187 | ||
| 186 | static void acpi_format_ipmi_response(struct acpi_ipmi_msg *msg, | 188 | static void acpi_format_ipmi_response(struct acpi_ipmi_msg *msg, |
| @@ -242,6 +244,7 @@ static void ipmi_msg_handler(struct ipmi_recv_msg *msg, void *user_msg_data) | |||
| 242 | int msg_found = 0; | 244 | int msg_found = 0; |
| 243 | struct acpi_ipmi_msg *tx_msg; | 245 | struct acpi_ipmi_msg *tx_msg; |
| 244 | struct pnp_dev *pnp_dev = ipmi_device->pnp_dev; | 246 | struct pnp_dev *pnp_dev = ipmi_device->pnp_dev; |
| 247 | unsigned long flags; | ||
| 245 | 248 | ||
| 246 | if (msg->user != ipmi_device->user_interface) { | 249 | if (msg->user != ipmi_device->user_interface) { |
| 247 | dev_warn(&pnp_dev->dev, "Unexpected response is returned. " | 250 | dev_warn(&pnp_dev->dev, "Unexpected response is returned. " |
| @@ -250,7 +253,7 @@ static void ipmi_msg_handler(struct ipmi_recv_msg *msg, void *user_msg_data) | |||
| 250 | ipmi_free_recv_msg(msg); | 253 | ipmi_free_recv_msg(msg); |
| 251 | return; | 254 | return; |
| 252 | } | 255 | } |
| 253 | mutex_lock(&ipmi_device->tx_msg_lock); | 256 | spin_lock_irqsave(&ipmi_device->tx_msg_lock, flags); |
| 254 | list_for_each_entry(tx_msg, &ipmi_device->tx_msg_list, head) { | 257 | list_for_each_entry(tx_msg, &ipmi_device->tx_msg_list, head) { |
| 255 | if (msg->msgid == tx_msg->tx_msgid) { | 258 | if (msg->msgid == tx_msg->tx_msgid) { |
| 256 | msg_found = 1; | 259 | msg_found = 1; |
| @@ -258,7 +261,7 @@ static void ipmi_msg_handler(struct ipmi_recv_msg *msg, void *user_msg_data) | |||
| 258 | } | 261 | } |
| 259 | } | 262 | } |
| 260 | 263 | ||
| 261 | mutex_unlock(&ipmi_device->tx_msg_lock); | 264 | spin_unlock_irqrestore(&ipmi_device->tx_msg_lock, flags); |
| 262 | if (!msg_found) { | 265 | if (!msg_found) { |
| 263 | dev_warn(&pnp_dev->dev, "Unexpected response (msg id %ld) is " | 266 | dev_warn(&pnp_dev->dev, "Unexpected response (msg id %ld) is " |
| 264 | "returned.\n", msg->msgid); | 267 | "returned.\n", msg->msgid); |
| @@ -378,6 +381,7 @@ acpi_ipmi_space_handler(u32 function, acpi_physical_address address, | |||
| 378 | struct acpi_ipmi_device *ipmi_device = handler_context; | 381 | struct acpi_ipmi_device *ipmi_device = handler_context; |
| 379 | int err, rem_time; | 382 | int err, rem_time; |
| 380 | acpi_status status; | 383 | acpi_status status; |
| 384 | unsigned long flags; | ||
| 381 | /* | 385 | /* |
| 382 | * IPMI opregion message. | 386 | * IPMI opregion message. |
| 383 | * IPMI message is firstly written to the BMC and system software | 387 | * IPMI message is firstly written to the BMC and system software |
| @@ -395,9 +399,9 @@ acpi_ipmi_space_handler(u32 function, acpi_physical_address address, | |||
| 395 | return AE_NO_MEMORY; | 399 | return AE_NO_MEMORY; |
| 396 | 400 | ||
| 397 | acpi_format_ipmi_msg(tx_msg, address, value); | 401 | acpi_format_ipmi_msg(tx_msg, address, value); |
| 398 | mutex_lock(&ipmi_device->tx_msg_lock); | 402 | spin_lock_irqsave(&ipmi_device->tx_msg_lock, flags); |
| 399 | list_add_tail(&tx_msg->head, &ipmi_device->tx_msg_list); | 403 | list_add_tail(&tx_msg->head, &ipmi_device->tx_msg_list); |
| 400 | mutex_unlock(&ipmi_device->tx_msg_lock); | 404 | spin_unlock_irqrestore(&ipmi_device->tx_msg_lock, flags); |
| 401 | err = ipmi_request_settime(ipmi_device->user_interface, | 405 | err = ipmi_request_settime(ipmi_device->user_interface, |
| 402 | &tx_msg->addr, | 406 | &tx_msg->addr, |
| 403 | tx_msg->tx_msgid, | 407 | tx_msg->tx_msgid, |
| @@ -413,9 +417,9 @@ acpi_ipmi_space_handler(u32 function, acpi_physical_address address, | |||
| 413 | status = AE_OK; | 417 | status = AE_OK; |
| 414 | 418 | ||
| 415 | end_label: | 419 | end_label: |
| 416 | mutex_lock(&ipmi_device->tx_msg_lock); | 420 | spin_lock_irqsave(&ipmi_device->tx_msg_lock, flags); |
| 417 | list_del(&tx_msg->head); | 421 | list_del(&tx_msg->head); |
| 418 | mutex_unlock(&ipmi_device->tx_msg_lock); | 422 | spin_unlock_irqrestore(&ipmi_device->tx_msg_lock, flags); |
| 419 | kfree(tx_msg); | 423 | kfree(tx_msg); |
| 420 | return status; | 424 | return status; |
| 421 | } | 425 | } |
| @@ -457,7 +461,7 @@ static void acpi_add_ipmi_device(struct acpi_ipmi_device *ipmi_device) | |||
| 457 | 461 | ||
| 458 | INIT_LIST_HEAD(&ipmi_device->head); | 462 | INIT_LIST_HEAD(&ipmi_device->head); |
| 459 | 463 | ||
| 460 | mutex_init(&ipmi_device->tx_msg_lock); | 464 | spin_lock_init(&ipmi_device->tx_msg_lock); |
| 461 | INIT_LIST_HEAD(&ipmi_device->tx_msg_list); | 465 | INIT_LIST_HEAD(&ipmi_device->tx_msg_list); |
| 462 | ipmi_install_space_handler(ipmi_device); | 466 | ipmi_install_space_handler(ipmi_device); |
| 463 | 467 | ||
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index fbdb82e70d10..611ce9061dc5 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c | |||
| @@ -1121,7 +1121,7 @@ int acpi_bus_register_driver(struct acpi_driver *driver) | |||
| 1121 | EXPORT_SYMBOL(acpi_bus_register_driver); | 1121 | EXPORT_SYMBOL(acpi_bus_register_driver); |
| 1122 | 1122 | ||
| 1123 | /** | 1123 | /** |
| 1124 | * acpi_bus_unregister_driver - unregisters a driver with the APIC bus | 1124 | * acpi_bus_unregister_driver - unregisters a driver with the ACPI bus |
| 1125 | * @driver: driver to unregister | 1125 | * @driver: driver to unregister |
| 1126 | * | 1126 | * |
| 1127 | * Unregisters a driver with the ACPI bus. Searches the namespace for all | 1127 | * Unregisters a driver with the ACPI bus. Searches the namespace for all |
diff --git a/drivers/ata/sata_promise.c b/drivers/ata/sata_promise.c index 958ba2a420c3..97f4acb54ad6 100644 --- a/drivers/ata/sata_promise.c +++ b/drivers/ata/sata_promise.c | |||
| @@ -2,7 +2,7 @@ | |||
| 2 | * sata_promise.c - Promise SATA | 2 | * sata_promise.c - Promise SATA |
| 3 | * | 3 | * |
| 4 | * Maintained by: Tejun Heo <tj@kernel.org> | 4 | * Maintained by: Tejun Heo <tj@kernel.org> |
| 5 | * Mikael Pettersson <mikpe@it.uu.se> | 5 | * Mikael Pettersson |
| 6 | * Please ALWAYS copy linux-ide@vger.kernel.org | 6 | * Please ALWAYS copy linux-ide@vger.kernel.org |
| 7 | * on emails. | 7 | * on emails. |
| 8 | * | 8 | * |
diff --git a/drivers/atm/he.c b/drivers/atm/he.c index 449f6298dc89..8557adcd34ee 100644 --- a/drivers/atm/he.c +++ b/drivers/atm/he.c | |||
| @@ -2865,15 +2865,4 @@ static struct pci_driver he_driver = { | |||
| 2865 | .id_table = he_pci_tbl, | 2865 | .id_table = he_pci_tbl, |
| 2866 | }; | 2866 | }; |
| 2867 | 2867 | ||
| 2868 | static int __init he_init(void) | 2868 | module_pci_driver(he_driver); |
| 2869 | { | ||
| 2870 | return pci_register_driver(&he_driver); | ||
| 2871 | } | ||
| 2872 | |||
| 2873 | static void __exit he_cleanup(void) | ||
| 2874 | { | ||
| 2875 | pci_unregister_driver(&he_driver); | ||
| 2876 | } | ||
| 2877 | |||
| 2878 | module_init(he_init); | ||
| 2879 | module_exit(he_cleanup); | ||
diff --git a/drivers/atm/nicstar.c b/drivers/atm/nicstar.c index 409502a78e7e..5aca5f4c5458 100644 --- a/drivers/atm/nicstar.c +++ b/drivers/atm/nicstar.c | |||
| @@ -778,7 +778,7 @@ static int ns_init_card(int i, struct pci_dev *pcidev) | |||
| 778 | return error; | 778 | return error; |
| 779 | } | 779 | } |
| 780 | 780 | ||
| 781 | if (mac[i] == NULL || mac_pton(mac[i], card->atmdev->esi)) { | 781 | if (mac[i] == NULL || !mac_pton(mac[i], card->atmdev->esi)) { |
| 782 | nicstar_read_eprom(card->membase, NICSTAR_EPROM_MAC_ADDR_OFFSET, | 782 | nicstar_read_eprom(card->membase, NICSTAR_EPROM_MAC_ADDR_OFFSET, |
| 783 | card->atmdev->esi, 6); | 783 | card->atmdev->esi, 6); |
| 784 | if (memcmp(card->atmdev->esi, "\x00\x00\x00\x00\x00\x00", 6) == | 784 | if (memcmp(card->atmdev->esi, "\x00\x00\x00\x00\x00\x00", 6) == |
diff --git a/drivers/bcma/scan.c b/drivers/bcma/scan.c index cd6b20fce680..37768401d113 100644 --- a/drivers/bcma/scan.c +++ b/drivers/bcma/scan.c | |||
| @@ -269,6 +269,8 @@ static struct bcma_device *bcma_find_core_reverse(struct bcma_bus *bus, u16 core | |||
| 269 | return NULL; | 269 | return NULL; |
| 270 | } | 270 | } |
| 271 | 271 | ||
| 272 | #define IS_ERR_VALUE_U32(x) ((x) >= (u32)-MAX_ERRNO) | ||
| 273 | |||
| 272 | static int bcma_get_next_core(struct bcma_bus *bus, u32 __iomem **eromptr, | 274 | static int bcma_get_next_core(struct bcma_bus *bus, u32 __iomem **eromptr, |
| 273 | struct bcma_device_id *match, int core_num, | 275 | struct bcma_device_id *match, int core_num, |
| 274 | struct bcma_device *core) | 276 | struct bcma_device *core) |
| @@ -351,11 +353,11 @@ static int bcma_get_next_core(struct bcma_bus *bus, u32 __iomem **eromptr, | |||
| 351 | * the main register space for the core | 353 | * the main register space for the core |
| 352 | */ | 354 | */ |
| 353 | tmp = bcma_erom_get_addr_desc(bus, eromptr, SCAN_ADDR_TYPE_SLAVE, 0); | 355 | tmp = bcma_erom_get_addr_desc(bus, eromptr, SCAN_ADDR_TYPE_SLAVE, 0); |
| 354 | if (tmp == 0 || IS_ERR_VALUE(tmp)) { | 356 | if (tmp == 0 || IS_ERR_VALUE_U32(tmp)) { |
| 355 | /* Try again to see if it is a bridge */ | 357 | /* Try again to see if it is a bridge */ |
| 356 | tmp = bcma_erom_get_addr_desc(bus, eromptr, | 358 | tmp = bcma_erom_get_addr_desc(bus, eromptr, |
| 357 | SCAN_ADDR_TYPE_BRIDGE, 0); | 359 | SCAN_ADDR_TYPE_BRIDGE, 0); |
| 358 | if (tmp == 0 || IS_ERR_VALUE(tmp)) { | 360 | if (tmp == 0 || IS_ERR_VALUE_U32(tmp)) { |
| 359 | return -EILSEQ; | 361 | return -EILSEQ; |
| 360 | } else { | 362 | } else { |
| 361 | bcma_info(bus, "Bridge found\n"); | 363 | bcma_info(bus, "Bridge found\n"); |
| @@ -369,7 +371,7 @@ static int bcma_get_next_core(struct bcma_bus *bus, u32 __iomem **eromptr, | |||
| 369 | for (j = 0; ; j++) { | 371 | for (j = 0; ; j++) { |
| 370 | tmp = bcma_erom_get_addr_desc(bus, eromptr, | 372 | tmp = bcma_erom_get_addr_desc(bus, eromptr, |
| 371 | SCAN_ADDR_TYPE_SLAVE, i); | 373 | SCAN_ADDR_TYPE_SLAVE, i); |
| 372 | if (IS_ERR_VALUE(tmp)) { | 374 | if (IS_ERR_VALUE_U32(tmp)) { |
| 373 | /* no more entries for port _i_ */ | 375 | /* no more entries for port _i_ */ |
| 374 | /* pr_debug("erom: slave port %d " | 376 | /* pr_debug("erom: slave port %d " |
| 375 | * "has %d descriptors\n", i, j); */ | 377 | * "has %d descriptors\n", i, j); */ |
| @@ -386,7 +388,7 @@ static int bcma_get_next_core(struct bcma_bus *bus, u32 __iomem **eromptr, | |||
| 386 | for (j = 0; ; j++) { | 388 | for (j = 0; ; j++) { |
| 387 | tmp = bcma_erom_get_addr_desc(bus, eromptr, | 389 | tmp = bcma_erom_get_addr_desc(bus, eromptr, |
| 388 | SCAN_ADDR_TYPE_MWRAP, i); | 390 | SCAN_ADDR_TYPE_MWRAP, i); |
| 389 | if (IS_ERR_VALUE(tmp)) { | 391 | if (IS_ERR_VALUE_U32(tmp)) { |
| 390 | /* no more entries for port _i_ */ | 392 | /* no more entries for port _i_ */ |
| 391 | /* pr_debug("erom: master wrapper %d " | 393 | /* pr_debug("erom: master wrapper %d " |
| 392 | * "has %d descriptors\n", i, j); */ | 394 | * "has %d descriptors\n", i, j); */ |
| @@ -404,7 +406,7 @@ static int bcma_get_next_core(struct bcma_bus *bus, u32 __iomem **eromptr, | |||
| 404 | for (j = 0; ; j++) { | 406 | for (j = 0; ; j++) { |
| 405 | tmp = bcma_erom_get_addr_desc(bus, eromptr, | 407 | tmp = bcma_erom_get_addr_desc(bus, eromptr, |
| 406 | SCAN_ADDR_TYPE_SWRAP, i + hack); | 408 | SCAN_ADDR_TYPE_SWRAP, i + hack); |
| 407 | if (IS_ERR_VALUE(tmp)) { | 409 | if (IS_ERR_VALUE_U32(tmp)) { |
| 408 | /* no more entries for port _i_ */ | 410 | /* no more entries for port _i_ */ |
| 409 | /* pr_debug("erom: master wrapper %d " | 411 | /* pr_debug("erom: master wrapper %d " |
| 410 | * has %d descriptors\n", i, j); */ | 412 | * has %d descriptors\n", i, j); */ |
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c index d2d95ff5353b..edfa2515bc86 100644 --- a/drivers/block/cciss.c +++ b/drivers/block/cciss.c | |||
| @@ -1189,6 +1189,7 @@ static int cciss_ioctl32_passthru(struct block_device *bdev, fmode_t mode, | |||
| 1189 | int err; | 1189 | int err; |
| 1190 | u32 cp; | 1190 | u32 cp; |
| 1191 | 1191 | ||
| 1192 | memset(&arg64, 0, sizeof(arg64)); | ||
| 1192 | err = 0; | 1193 | err = 0; |
| 1193 | err |= | 1194 | err |= |
| 1194 | copy_from_user(&arg64.LUN_info, &arg32->LUN_info, | 1195 | copy_from_user(&arg64.LUN_info, &arg32->LUN_info, |
diff --git a/drivers/block/cpqarray.c b/drivers/block/cpqarray.c index 639d26b90b91..2b9440384536 100644 --- a/drivers/block/cpqarray.c +++ b/drivers/block/cpqarray.c | |||
| @@ -1193,6 +1193,7 @@ out_passthru: | |||
| 1193 | ida_pci_info_struct pciinfo; | 1193 | ida_pci_info_struct pciinfo; |
| 1194 | 1194 | ||
| 1195 | if (!arg) return -EINVAL; | 1195 | if (!arg) return -EINVAL; |
| 1196 | memset(&pciinfo, 0, sizeof(pciinfo)); | ||
| 1196 | pciinfo.bus = host->pci_dev->bus->number; | 1197 | pciinfo.bus = host->pci_dev->bus->number; |
| 1197 | pciinfo.dev_fn = host->pci_dev->devfn; | 1198 | pciinfo.dev_fn = host->pci_dev->devfn; |
| 1198 | pciinfo.board_id = host->board_id; | 1199 | pciinfo.board_id = host->board_id; |
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index b22a7d0fe5b7..cb1db2979d3d 100644 --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c | |||
| @@ -931,12 +931,14 @@ static const char *rbd_dev_v1_snap_name(struct rbd_device *rbd_dev, | |||
| 931 | u64 snap_id) | 931 | u64 snap_id) |
| 932 | { | 932 | { |
| 933 | u32 which; | 933 | u32 which; |
| 934 | const char *snap_name; | ||
| 934 | 935 | ||
| 935 | which = rbd_dev_snap_index(rbd_dev, snap_id); | 936 | which = rbd_dev_snap_index(rbd_dev, snap_id); |
| 936 | if (which == BAD_SNAP_INDEX) | 937 | if (which == BAD_SNAP_INDEX) |
| 937 | return NULL; | 938 | return ERR_PTR(-ENOENT); |
| 938 | 939 | ||
| 939 | return _rbd_dev_v1_snap_name(rbd_dev, which); | 940 | snap_name = _rbd_dev_v1_snap_name(rbd_dev, which); |
| 941 | return snap_name ? snap_name : ERR_PTR(-ENOMEM); | ||
| 940 | } | 942 | } |
| 941 | 943 | ||
| 942 | static const char *rbd_snap_name(struct rbd_device *rbd_dev, u64 snap_id) | 944 | static const char *rbd_snap_name(struct rbd_device *rbd_dev, u64 snap_id) |
| @@ -2812,7 +2814,7 @@ out_err: | |||
| 2812 | obj_request_done_set(obj_request); | 2814 | obj_request_done_set(obj_request); |
| 2813 | } | 2815 | } |
| 2814 | 2816 | ||
| 2815 | static int rbd_obj_notify_ack(struct rbd_device *rbd_dev, u64 notify_id) | 2817 | static int rbd_obj_notify_ack_sync(struct rbd_device *rbd_dev, u64 notify_id) |
| 2816 | { | 2818 | { |
| 2817 | struct rbd_obj_request *obj_request; | 2819 | struct rbd_obj_request *obj_request; |
| 2818 | struct ceph_osd_client *osdc = &rbd_dev->rbd_client->client->osdc; | 2820 | struct ceph_osd_client *osdc = &rbd_dev->rbd_client->client->osdc; |
| @@ -2827,16 +2829,17 @@ static int rbd_obj_notify_ack(struct rbd_device *rbd_dev, u64 notify_id) | |||
| 2827 | obj_request->osd_req = rbd_osd_req_create(rbd_dev, false, obj_request); | 2829 | obj_request->osd_req = rbd_osd_req_create(rbd_dev, false, obj_request); |
| 2828 | if (!obj_request->osd_req) | 2830 | if (!obj_request->osd_req) |
| 2829 | goto out; | 2831 | goto out; |
| 2830 | obj_request->callback = rbd_obj_request_put; | ||
| 2831 | 2832 | ||
| 2832 | osd_req_op_watch_init(obj_request->osd_req, 0, CEPH_OSD_OP_NOTIFY_ACK, | 2833 | osd_req_op_watch_init(obj_request->osd_req, 0, CEPH_OSD_OP_NOTIFY_ACK, |
| 2833 | notify_id, 0, 0); | 2834 | notify_id, 0, 0); |
| 2834 | rbd_osd_req_format_read(obj_request); | 2835 | rbd_osd_req_format_read(obj_request); |
| 2835 | 2836 | ||
| 2836 | ret = rbd_obj_request_submit(osdc, obj_request); | 2837 | ret = rbd_obj_request_submit(osdc, obj_request); |
| 2837 | out: | ||
| 2838 | if (ret) | 2838 | if (ret) |
| 2839 | rbd_obj_request_put(obj_request); | 2839 | goto out; |
| 2840 | ret = rbd_obj_request_wait(obj_request); | ||
| 2841 | out: | ||
| 2842 | rbd_obj_request_put(obj_request); | ||
| 2840 | 2843 | ||
| 2841 | return ret; | 2844 | return ret; |
| 2842 | } | 2845 | } |
| @@ -2856,7 +2859,7 @@ static void rbd_watch_cb(u64 ver, u64 notify_id, u8 opcode, void *data) | |||
| 2856 | if (ret) | 2859 | if (ret) |
| 2857 | rbd_warn(rbd_dev, "header refresh error (%d)\n", ret); | 2860 | rbd_warn(rbd_dev, "header refresh error (%d)\n", ret); |
| 2858 | 2861 | ||
| 2859 | rbd_obj_notify_ack(rbd_dev, notify_id); | 2862 | rbd_obj_notify_ack_sync(rbd_dev, notify_id); |
| 2860 | } | 2863 | } |
| 2861 | 2864 | ||
| 2862 | /* | 2865 | /* |
| @@ -3328,6 +3331,31 @@ static void rbd_exists_validate(struct rbd_device *rbd_dev) | |||
| 3328 | clear_bit(RBD_DEV_FLAG_EXISTS, &rbd_dev->flags); | 3331 | clear_bit(RBD_DEV_FLAG_EXISTS, &rbd_dev->flags); |
| 3329 | } | 3332 | } |
| 3330 | 3333 | ||
| 3334 | static void rbd_dev_update_size(struct rbd_device *rbd_dev) | ||
| 3335 | { | ||
| 3336 | sector_t size; | ||
| 3337 | bool removing; | ||
| 3338 | |||
| 3339 | /* | ||
| 3340 | * Don't hold the lock while doing disk operations, | ||
| 3341 | * or lock ordering will conflict with the bdev mutex via: | ||
| 3342 | * rbd_add() -> blkdev_get() -> rbd_open() | ||
| 3343 | */ | ||
| 3344 | spin_lock_irq(&rbd_dev->lock); | ||
| 3345 | removing = test_bit(RBD_DEV_FLAG_REMOVING, &rbd_dev->flags); | ||
| 3346 | spin_unlock_irq(&rbd_dev->lock); | ||
| 3347 | /* | ||
| 3348 | * If the device is being removed, rbd_dev->disk has | ||
| 3349 | * been destroyed, so don't try to update its size | ||
| 3350 | */ | ||
| 3351 | if (!removing) { | ||
| 3352 | size = (sector_t)rbd_dev->mapping.size / SECTOR_SIZE; | ||
| 3353 | dout("setting size to %llu sectors", (unsigned long long)size); | ||
| 3354 | set_capacity(rbd_dev->disk, size); | ||
| 3355 | revalidate_disk(rbd_dev->disk); | ||
| 3356 | } | ||
| 3357 | } | ||
| 3358 | |||
| 3331 | static int rbd_dev_refresh(struct rbd_device *rbd_dev) | 3359 | static int rbd_dev_refresh(struct rbd_device *rbd_dev) |
| 3332 | { | 3360 | { |
| 3333 | u64 mapping_size; | 3361 | u64 mapping_size; |
| @@ -3347,12 +3375,7 @@ static int rbd_dev_refresh(struct rbd_device *rbd_dev) | |||
| 3347 | up_write(&rbd_dev->header_rwsem); | 3375 | up_write(&rbd_dev->header_rwsem); |
| 3348 | 3376 | ||
| 3349 | if (mapping_size != rbd_dev->mapping.size) { | 3377 | if (mapping_size != rbd_dev->mapping.size) { |
| 3350 | sector_t size; | 3378 | rbd_dev_update_size(rbd_dev); |
| 3351 | |||
| 3352 | size = (sector_t)rbd_dev->mapping.size / SECTOR_SIZE; | ||
| 3353 | dout("setting size to %llu sectors", (unsigned long long)size); | ||
| 3354 | set_capacity(rbd_dev->disk, size); | ||
| 3355 | revalidate_disk(rbd_dev->disk); | ||
| 3356 | } | 3379 | } |
| 3357 | 3380 | ||
| 3358 | return ret; | 3381 | return ret; |
| @@ -4061,8 +4084,13 @@ static u64 rbd_v2_snap_id_by_name(struct rbd_device *rbd_dev, const char *name) | |||
| 4061 | 4084 | ||
| 4062 | snap_id = snapc->snaps[which]; | 4085 | snap_id = snapc->snaps[which]; |
| 4063 | snap_name = rbd_dev_v2_snap_name(rbd_dev, snap_id); | 4086 | snap_name = rbd_dev_v2_snap_name(rbd_dev, snap_id); |
| 4064 | if (IS_ERR(snap_name)) | 4087 | if (IS_ERR(snap_name)) { |
| 4065 | break; | 4088 | /* ignore no-longer existing snapshots */ |
| 4089 | if (PTR_ERR(snap_name) == -ENOENT) | ||
| 4090 | continue; | ||
| 4091 | else | ||
| 4092 | break; | ||
| 4093 | } | ||
| 4066 | found = !strcmp(name, snap_name); | 4094 | found = !strcmp(name, snap_name); |
| 4067 | kfree(snap_name); | 4095 | kfree(snap_name); |
| 4068 | } | 4096 | } |
| @@ -4141,8 +4169,8 @@ static int rbd_dev_spec_update(struct rbd_device *rbd_dev) | |||
| 4141 | /* Look up the snapshot name, and make a copy */ | 4169 | /* Look up the snapshot name, and make a copy */ |
| 4142 | 4170 | ||
| 4143 | snap_name = rbd_snap_name(rbd_dev, spec->snap_id); | 4171 | snap_name = rbd_snap_name(rbd_dev, spec->snap_id); |
| 4144 | if (!snap_name) { | 4172 | if (IS_ERR(snap_name)) { |
| 4145 | ret = -ENOMEM; | 4173 | ret = PTR_ERR(snap_name); |
| 4146 | goto out_err; | 4174 | goto out_err; |
| 4147 | } | 4175 | } |
| 4148 | 4176 | ||
| @@ -5163,10 +5191,23 @@ static ssize_t rbd_remove(struct bus_type *bus, | |||
| 5163 | if (ret < 0 || already) | 5191 | if (ret < 0 || already) |
| 5164 | return ret; | 5192 | return ret; |
| 5165 | 5193 | ||
| 5166 | rbd_bus_del_dev(rbd_dev); | ||
| 5167 | ret = rbd_dev_header_watch_sync(rbd_dev, false); | 5194 | ret = rbd_dev_header_watch_sync(rbd_dev, false); |
| 5168 | if (ret) | 5195 | if (ret) |
| 5169 | rbd_warn(rbd_dev, "failed to cancel watch event (%d)\n", ret); | 5196 | rbd_warn(rbd_dev, "failed to cancel watch event (%d)\n", ret); |
| 5197 | |||
| 5198 | /* | ||
| 5199 | * flush remaining watch callbacks - these must be complete | ||
| 5200 | * before the osd_client is shutdown | ||
| 5201 | */ | ||
| 5202 | dout("%s: flushing notifies", __func__); | ||
| 5203 | ceph_osdc_flush_notifies(&rbd_dev->rbd_client->client->osdc); | ||
| 5204 | /* | ||
| 5205 | * Don't free anything from rbd_dev->disk until after all | ||
| 5206 | * notifies are completely processed. Otherwise | ||
| 5207 | * rbd_bus_del_dev() will race with rbd_watch_cb(), resulting | ||
| 5208 | * in a potential use after free of rbd_dev->disk or rbd_dev. | ||
| 5209 | */ | ||
| 5210 | rbd_bus_del_dev(rbd_dev); | ||
| 5170 | rbd_dev_image_release(rbd_dev); | 5211 | rbd_dev_image_release(rbd_dev); |
| 5171 | module_put(THIS_MODULE); | 5212 | module_put(THIS_MODULE); |
| 5172 | 5213 | ||
diff --git a/drivers/char/tpm/xen-tpmfront.c b/drivers/char/tpm/xen-tpmfront.c index 7a7929ba2658..06189e55b4e5 100644 --- a/drivers/char/tpm/xen-tpmfront.c +++ b/drivers/char/tpm/xen-tpmfront.c | |||
| @@ -142,32 +142,6 @@ static int vtpm_recv(struct tpm_chip *chip, u8 *buf, size_t count) | |||
| 142 | return length; | 142 | return length; |
| 143 | } | 143 | } |
| 144 | 144 | ||
| 145 | ssize_t tpm_show_locality(struct device *dev, struct device_attribute *attr, | ||
| 146 | char *buf) | ||
| 147 | { | ||
| 148 | struct tpm_chip *chip = dev_get_drvdata(dev); | ||
| 149 | struct tpm_private *priv = TPM_VPRIV(chip); | ||
| 150 | u8 locality = priv->shr->locality; | ||
| 151 | |||
| 152 | return sprintf(buf, "%d\n", locality); | ||
| 153 | } | ||
| 154 | |||
| 155 | ssize_t tpm_store_locality(struct device *dev, struct device_attribute *attr, | ||
| 156 | const char *buf, size_t len) | ||
| 157 | { | ||
| 158 | struct tpm_chip *chip = dev_get_drvdata(dev); | ||
| 159 | struct tpm_private *priv = TPM_VPRIV(chip); | ||
| 160 | u8 val; | ||
| 161 | |||
| 162 | int rv = kstrtou8(buf, 0, &val); | ||
| 163 | if (rv) | ||
| 164 | return rv; | ||
| 165 | |||
| 166 | priv->shr->locality = val; | ||
| 167 | |||
| 168 | return len; | ||
| 169 | } | ||
| 170 | |||
| 171 | static const struct file_operations vtpm_ops = { | 145 | static const struct file_operations vtpm_ops = { |
| 172 | .owner = THIS_MODULE, | 146 | .owner = THIS_MODULE, |
| 173 | .llseek = no_llseek, | 147 | .llseek = no_llseek, |
| @@ -188,8 +162,6 @@ static DEVICE_ATTR(caps, S_IRUGO, tpm_show_caps, NULL); | |||
| 188 | static DEVICE_ATTR(cancel, S_IWUSR | S_IWGRP, NULL, tpm_store_cancel); | 162 | static DEVICE_ATTR(cancel, S_IWUSR | S_IWGRP, NULL, tpm_store_cancel); |
| 189 | static DEVICE_ATTR(durations, S_IRUGO, tpm_show_durations, NULL); | 163 | static DEVICE_ATTR(durations, S_IRUGO, tpm_show_durations, NULL); |
| 190 | static DEVICE_ATTR(timeouts, S_IRUGO, tpm_show_timeouts, NULL); | 164 | static DEVICE_ATTR(timeouts, S_IRUGO, tpm_show_timeouts, NULL); |
| 191 | static DEVICE_ATTR(locality, S_IRUGO | S_IWUSR, tpm_show_locality, | ||
| 192 | tpm_store_locality); | ||
| 193 | 165 | ||
| 194 | static struct attribute *vtpm_attrs[] = { | 166 | static struct attribute *vtpm_attrs[] = { |
| 195 | &dev_attr_pubek.attr, | 167 | &dev_attr_pubek.attr, |
| @@ -202,7 +174,6 @@ static struct attribute *vtpm_attrs[] = { | |||
| 202 | &dev_attr_cancel.attr, | 174 | &dev_attr_cancel.attr, |
| 203 | &dev_attr_durations.attr, | 175 | &dev_attr_durations.attr, |
| 204 | &dev_attr_timeouts.attr, | 176 | &dev_attr_timeouts.attr, |
| 205 | &dev_attr_locality.attr, | ||
| 206 | NULL, | 177 | NULL, |
| 207 | }; | 178 | }; |
| 208 | 179 | ||
| @@ -210,8 +181,6 @@ static struct attribute_group vtpm_attr_grp = { | |||
| 210 | .attrs = vtpm_attrs, | 181 | .attrs = vtpm_attrs, |
| 211 | }; | 182 | }; |
| 212 | 183 | ||
| 213 | #define TPM_LONG_TIMEOUT (10 * 60 * HZ) | ||
| 214 | |||
| 215 | static const struct tpm_vendor_specific tpm_vtpm = { | 184 | static const struct tpm_vendor_specific tpm_vtpm = { |
| 216 | .status = vtpm_status, | 185 | .status = vtpm_status, |
| 217 | .recv = vtpm_recv, | 186 | .recv = vtpm_recv, |
| @@ -224,11 +193,6 @@ static const struct tpm_vendor_specific tpm_vtpm = { | |||
| 224 | .miscdev = { | 193 | .miscdev = { |
| 225 | .fops = &vtpm_ops, | 194 | .fops = &vtpm_ops, |
| 226 | }, | 195 | }, |
| 227 | .duration = { | ||
| 228 | TPM_LONG_TIMEOUT, | ||
| 229 | TPM_LONG_TIMEOUT, | ||
| 230 | TPM_LONG_TIMEOUT, | ||
| 231 | }, | ||
| 232 | }; | 196 | }; |
| 233 | 197 | ||
| 234 | static irqreturn_t tpmif_interrupt(int dummy, void *dev_id) | 198 | static irqreturn_t tpmif_interrupt(int dummy, void *dev_id) |
diff --git a/drivers/cpufreq/acpi-cpufreq.c b/drivers/cpufreq/acpi-cpufreq.c index a1260b4549db..d2c3253e015e 100644 --- a/drivers/cpufreq/acpi-cpufreq.c +++ b/drivers/cpufreq/acpi-cpufreq.c | |||
| @@ -986,6 +986,10 @@ static int __init acpi_cpufreq_init(void) | |||
| 986 | { | 986 | { |
| 987 | int ret; | 987 | int ret; |
| 988 | 988 | ||
| 989 | /* don't keep reloading if cpufreq_driver exists */ | ||
| 990 | if (cpufreq_get_current_driver()) | ||
| 991 | return 0; | ||
| 992 | |||
| 989 | if (acpi_disabled) | 993 | if (acpi_disabled) |
| 990 | return 0; | 994 | return 0; |
| 991 | 995 | ||
diff --git a/drivers/cpufreq/cpufreq-cpu0.c b/drivers/cpufreq/cpufreq-cpu0.c index cbfffa91ebdd..78c49d8e0f4a 100644 --- a/drivers/cpufreq/cpufreq-cpu0.c +++ b/drivers/cpufreq/cpufreq-cpu0.c | |||
| @@ -12,6 +12,7 @@ | |||
| 12 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | 12 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt |
| 13 | 13 | ||
| 14 | #include <linux/clk.h> | 14 | #include <linux/clk.h> |
| 15 | #include <linux/cpu.h> | ||
| 15 | #include <linux/cpufreq.h> | 16 | #include <linux/cpufreq.h> |
| 16 | #include <linux/err.h> | 17 | #include <linux/err.h> |
| 17 | #include <linux/module.h> | 18 | #include <linux/module.h> |
| @@ -177,7 +178,11 @@ static int cpu0_cpufreq_probe(struct platform_device *pdev) | |||
| 177 | struct device_node *np; | 178 | struct device_node *np; |
| 178 | int ret; | 179 | int ret; |
| 179 | 180 | ||
| 180 | cpu_dev = &pdev->dev; | 181 | cpu_dev = get_cpu_device(0); |
| 182 | if (!cpu_dev) { | ||
| 183 | pr_err("failed to get cpu0 device\n"); | ||
| 184 | return -ENODEV; | ||
| 185 | } | ||
| 181 | 186 | ||
| 182 | np = of_node_get(cpu_dev->of_node); | 187 | np = of_node_get(cpu_dev->of_node); |
| 183 | if (!np) { | 188 | if (!np) { |
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 43c24aa756f6..04548f7023af 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c | |||
| @@ -952,9 +952,20 @@ static void update_policy_cpu(struct cpufreq_policy *policy, unsigned int cpu) | |||
| 952 | if (cpu == policy->cpu) | 952 | if (cpu == policy->cpu) |
| 953 | return; | 953 | return; |
| 954 | 954 | ||
| 955 | /* | ||
| 956 | * Take direct locks as lock_policy_rwsem_write wouldn't work here. | ||
| 957 | * Also lock for last cpu is enough here as contention will happen only | ||
| 958 | * after policy->cpu is changed and after it is changed, other threads | ||
| 959 | * will try to acquire lock for new cpu. And policy is already updated | ||
| 960 | * by then. | ||
| 961 | */ | ||
| 962 | down_write(&per_cpu(cpu_policy_rwsem, policy->cpu)); | ||
| 963 | |||
| 955 | policy->last_cpu = policy->cpu; | 964 | policy->last_cpu = policy->cpu; |
| 956 | policy->cpu = cpu; | 965 | policy->cpu = cpu; |
| 957 | 966 | ||
| 967 | up_write(&per_cpu(cpu_policy_rwsem, policy->last_cpu)); | ||
| 968 | |||
| 958 | #ifdef CONFIG_CPU_FREQ_TABLE | 969 | #ifdef CONFIG_CPU_FREQ_TABLE |
| 959 | cpufreq_frequency_table_update_policy_cpu(policy); | 970 | cpufreq_frequency_table_update_policy_cpu(policy); |
| 960 | #endif | 971 | #endif |
| @@ -1125,7 +1136,7 @@ static int cpufreq_nominate_new_policy_cpu(struct cpufreq_policy *policy, | |||
| 1125 | int ret; | 1136 | int ret; |
| 1126 | 1137 | ||
| 1127 | /* first sibling now owns the new sysfs dir */ | 1138 | /* first sibling now owns the new sysfs dir */ |
| 1128 | cpu_dev = get_cpu_device(cpumask_first(policy->cpus)); | 1139 | cpu_dev = get_cpu_device(cpumask_any_but(policy->cpus, old_cpu)); |
| 1129 | 1140 | ||
| 1130 | /* Don't touch sysfs files during light-weight tear-down */ | 1141 | /* Don't touch sysfs files during light-weight tear-down */ |
| 1131 | if (frozen) | 1142 | if (frozen) |
| @@ -1189,12 +1200,9 @@ static int __cpufreq_remove_dev_prepare(struct device *dev, | |||
| 1189 | policy->governor->name, CPUFREQ_NAME_LEN); | 1200 | policy->governor->name, CPUFREQ_NAME_LEN); |
| 1190 | #endif | 1201 | #endif |
| 1191 | 1202 | ||
| 1192 | WARN_ON(lock_policy_rwsem_write(cpu)); | 1203 | lock_policy_rwsem_read(cpu); |
| 1193 | cpus = cpumask_weight(policy->cpus); | 1204 | cpus = cpumask_weight(policy->cpus); |
| 1194 | 1205 | unlock_policy_rwsem_read(cpu); | |
| 1195 | if (cpus > 1) | ||
| 1196 | cpumask_clear_cpu(cpu, policy->cpus); | ||
| 1197 | unlock_policy_rwsem_write(cpu); | ||
| 1198 | 1206 | ||
| 1199 | if (cpu != policy->cpu) { | 1207 | if (cpu != policy->cpu) { |
| 1200 | if (!frozen) | 1208 | if (!frozen) |
| @@ -1203,9 +1211,7 @@ static int __cpufreq_remove_dev_prepare(struct device *dev, | |||
| 1203 | 1211 | ||
| 1204 | new_cpu = cpufreq_nominate_new_policy_cpu(policy, cpu, frozen); | 1212 | new_cpu = cpufreq_nominate_new_policy_cpu(policy, cpu, frozen); |
| 1205 | if (new_cpu >= 0) { | 1213 | if (new_cpu >= 0) { |
| 1206 | WARN_ON(lock_policy_rwsem_write(cpu)); | ||
| 1207 | update_policy_cpu(policy, new_cpu); | 1214 | update_policy_cpu(policy, new_cpu); |
| 1208 | unlock_policy_rwsem_write(cpu); | ||
| 1209 | 1215 | ||
| 1210 | if (!frozen) { | 1216 | if (!frozen) { |
| 1211 | pr_debug("%s: policy Kobject moved to cpu: %d " | 1217 | pr_debug("%s: policy Kobject moved to cpu: %d " |
| @@ -1237,9 +1243,12 @@ static int __cpufreq_remove_dev_finish(struct device *dev, | |||
| 1237 | return -EINVAL; | 1243 | return -EINVAL; |
| 1238 | } | 1244 | } |
| 1239 | 1245 | ||
| 1240 | lock_policy_rwsem_read(cpu); | 1246 | WARN_ON(lock_policy_rwsem_write(cpu)); |
| 1241 | cpus = cpumask_weight(policy->cpus); | 1247 | cpus = cpumask_weight(policy->cpus); |
| 1242 | unlock_policy_rwsem_read(cpu); | 1248 | |
| 1249 | if (cpus > 1) | ||
| 1250 | cpumask_clear_cpu(cpu, policy->cpus); | ||
| 1251 | unlock_policy_rwsem_write(cpu); | ||
| 1243 | 1252 | ||
| 1244 | /* If cpu is last user of policy, free policy */ | 1253 | /* If cpu is last user of policy, free policy */ |
| 1245 | if (cpus == 1) { | 1254 | if (cpus == 1) { |
| @@ -1451,6 +1460,9 @@ unsigned int cpufreq_get(unsigned int cpu) | |||
| 1451 | { | 1460 | { |
| 1452 | unsigned int ret_freq = 0; | 1461 | unsigned int ret_freq = 0; |
| 1453 | 1462 | ||
| 1463 | if (cpufreq_disabled() || !cpufreq_driver) | ||
| 1464 | return -ENOENT; | ||
| 1465 | |||
| 1454 | if (!down_read_trylock(&cpufreq_rwsem)) | 1466 | if (!down_read_trylock(&cpufreq_rwsem)) |
| 1455 | return 0; | 1467 | return 0; |
| 1456 | 1468 | ||
| @@ -2095,7 +2107,7 @@ int cpufreq_register_driver(struct cpufreq_driver *driver_data) | |||
| 2095 | write_lock_irqsave(&cpufreq_driver_lock, flags); | 2107 | write_lock_irqsave(&cpufreq_driver_lock, flags); |
| 2096 | if (cpufreq_driver) { | 2108 | if (cpufreq_driver) { |
| 2097 | write_unlock_irqrestore(&cpufreq_driver_lock, flags); | 2109 | write_unlock_irqrestore(&cpufreq_driver_lock, flags); |
| 2098 | return -EBUSY; | 2110 | return -EEXIST; |
| 2099 | } | 2111 | } |
| 2100 | cpufreq_driver = driver_data; | 2112 | cpufreq_driver = driver_data; |
| 2101 | write_unlock_irqrestore(&cpufreq_driver_lock, flags); | 2113 | write_unlock_irqrestore(&cpufreq_driver_lock, flags); |
diff --git a/drivers/cpufreq/exynos5440-cpufreq.c b/drivers/cpufreq/exynos5440-cpufreq.c index d514c152fd1a..be5380ecdcd4 100644 --- a/drivers/cpufreq/exynos5440-cpufreq.c +++ b/drivers/cpufreq/exynos5440-cpufreq.c | |||
| @@ -457,7 +457,7 @@ err_free_table: | |||
| 457 | opp_free_cpufreq_table(dvfs_info->dev, &dvfs_info->freq_table); | 457 | opp_free_cpufreq_table(dvfs_info->dev, &dvfs_info->freq_table); |
| 458 | err_put_node: | 458 | err_put_node: |
| 459 | of_node_put(np); | 459 | of_node_put(np); |
| 460 | dev_err(dvfs_info->dev, "%s: failed initialization\n", __func__); | 460 | dev_err(&pdev->dev, "%s: failed initialization\n", __func__); |
| 461 | return ret; | 461 | return ret; |
| 462 | } | 462 | } |
| 463 | 463 | ||
diff --git a/drivers/cpufreq/imx6q-cpufreq.c b/drivers/cpufreq/imx6q-cpufreq.c index 3e396543aea4..c3fd2a101ca0 100644 --- a/drivers/cpufreq/imx6q-cpufreq.c +++ b/drivers/cpufreq/imx6q-cpufreq.c | |||
| @@ -7,6 +7,7 @@ | |||
| 7 | */ | 7 | */ |
| 8 | 8 | ||
| 9 | #include <linux/clk.h> | 9 | #include <linux/clk.h> |
| 10 | #include <linux/cpu.h> | ||
| 10 | #include <linux/cpufreq.h> | 11 | #include <linux/cpufreq.h> |
| 11 | #include <linux/delay.h> | 12 | #include <linux/delay.h> |
| 12 | #include <linux/err.h> | 13 | #include <linux/err.h> |
| @@ -202,7 +203,11 @@ static int imx6q_cpufreq_probe(struct platform_device *pdev) | |||
| 202 | unsigned long min_volt, max_volt; | 203 | unsigned long min_volt, max_volt; |
| 203 | int num, ret; | 204 | int num, ret; |
| 204 | 205 | ||
| 205 | cpu_dev = &pdev->dev; | 206 | cpu_dev = get_cpu_device(0); |
| 207 | if (!cpu_dev) { | ||
| 208 | pr_err("failed to get cpu0 device\n"); | ||
| 209 | return -ENODEV; | ||
| 210 | } | ||
| 206 | 211 | ||
| 207 | np = of_node_get(cpu_dev->of_node); | 212 | np = of_node_get(cpu_dev->of_node); |
| 208 | if (!np) { | 213 | if (!np) { |
diff --git a/drivers/gpu/drm/ast/ast_drv.h b/drivers/gpu/drm/ast/ast_drv.h index 796dbb212a41..8492b68e873c 100644 --- a/drivers/gpu/drm/ast/ast_drv.h +++ b/drivers/gpu/drm/ast/ast_drv.h | |||
| @@ -177,7 +177,7 @@ uint8_t ast_get_index_reg_mask(struct ast_private *ast, | |||
| 177 | 177 | ||
| 178 | static inline void ast_open_key(struct ast_private *ast) | 178 | static inline void ast_open_key(struct ast_private *ast) |
| 179 | { | 179 | { |
| 180 | ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xA1, 0xFF, 0x04); | 180 | ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0x80, 0xA8); |
| 181 | } | 181 | } |
| 182 | 182 | ||
| 183 | #define AST_VIDMEM_SIZE_8M 0x00800000 | 183 | #define AST_VIDMEM_SIZE_8M 0x00800000 |
diff --git a/drivers/gpu/drm/drm_context.c b/drivers/gpu/drm/drm_context.c index b4fb86d89850..224ff965bcf7 100644 --- a/drivers/gpu/drm/drm_context.c +++ b/drivers/gpu/drm/drm_context.c | |||
| @@ -42,6 +42,10 @@ | |||
| 42 | 42 | ||
| 43 | #include <drm/drmP.h> | 43 | #include <drm/drmP.h> |
| 44 | 44 | ||
| 45 | /******************************************************************/ | ||
| 46 | /** \name Context bitmap support */ | ||
| 47 | /*@{*/ | ||
| 48 | |||
| 45 | /** | 49 | /** |
| 46 | * Free a handle from the context bitmap. | 50 | * Free a handle from the context bitmap. |
| 47 | * | 51 | * |
| @@ -52,48 +56,13 @@ | |||
| 52 | * in drm_device::ctx_idr, while holding the drm_device::struct_mutex | 56 | * in drm_device::ctx_idr, while holding the drm_device::struct_mutex |
| 53 | * lock. | 57 | * lock. |
| 54 | */ | 58 | */ |
| 55 | static void drm_ctxbitmap_free(struct drm_device * dev, int ctx_handle) | 59 | void drm_ctxbitmap_free(struct drm_device * dev, int ctx_handle) |
| 56 | { | 60 | { |
| 57 | if (drm_core_check_feature(dev, DRIVER_MODESET)) | ||
| 58 | return; | ||
| 59 | |||
| 60 | mutex_lock(&dev->struct_mutex); | 61 | mutex_lock(&dev->struct_mutex); |
| 61 | idr_remove(&dev->ctx_idr, ctx_handle); | 62 | idr_remove(&dev->ctx_idr, ctx_handle); |
| 62 | mutex_unlock(&dev->struct_mutex); | 63 | mutex_unlock(&dev->struct_mutex); |
| 63 | } | 64 | } |
| 64 | 65 | ||
| 65 | /******************************************************************/ | ||
| 66 | /** \name Context bitmap support */ | ||
| 67 | /*@{*/ | ||
| 68 | |||
| 69 | void drm_legacy_ctxbitmap_release(struct drm_device *dev, | ||
| 70 | struct drm_file *file_priv) | ||
| 71 | { | ||
| 72 | if (drm_core_check_feature(dev, DRIVER_MODESET)) | ||
| 73 | return; | ||
| 74 | |||
| 75 | mutex_lock(&dev->ctxlist_mutex); | ||
| 76 | if (!list_empty(&dev->ctxlist)) { | ||
| 77 | struct drm_ctx_list *pos, *n; | ||
| 78 | |||
| 79 | list_for_each_entry_safe(pos, n, &dev->ctxlist, head) { | ||
| 80 | if (pos->tag == file_priv && | ||
| 81 | pos->handle != DRM_KERNEL_CONTEXT) { | ||
| 82 | if (dev->driver->context_dtor) | ||
| 83 | dev->driver->context_dtor(dev, | ||
| 84 | pos->handle); | ||
| 85 | |||
| 86 | drm_ctxbitmap_free(dev, pos->handle); | ||
| 87 | |||
| 88 | list_del(&pos->head); | ||
| 89 | kfree(pos); | ||
| 90 | --dev->ctx_count; | ||
| 91 | } | ||
| 92 | } | ||
| 93 | } | ||
| 94 | mutex_unlock(&dev->ctxlist_mutex); | ||
| 95 | } | ||
| 96 | |||
| 97 | /** | 66 | /** |
| 98 | * Context bitmap allocation. | 67 | * Context bitmap allocation. |
| 99 | * | 68 | * |
| @@ -121,12 +90,10 @@ static int drm_ctxbitmap_next(struct drm_device * dev) | |||
| 121 | * | 90 | * |
| 122 | * Initialise the drm_device::ctx_idr | 91 | * Initialise the drm_device::ctx_idr |
| 123 | */ | 92 | */ |
| 124 | void drm_legacy_ctxbitmap_init(struct drm_device * dev) | 93 | int drm_ctxbitmap_init(struct drm_device * dev) |
| 125 | { | 94 | { |
| 126 | if (drm_core_check_feature(dev, DRIVER_MODESET)) | ||
| 127 | return; | ||
| 128 | |||
| 129 | idr_init(&dev->ctx_idr); | 95 | idr_init(&dev->ctx_idr); |
| 96 | return 0; | ||
| 130 | } | 97 | } |
| 131 | 98 | ||
| 132 | /** | 99 | /** |
| @@ -137,7 +104,7 @@ void drm_legacy_ctxbitmap_init(struct drm_device * dev) | |||
| 137 | * Free all idr members using drm_ctx_sarea_free helper function | 104 | * Free all idr members using drm_ctx_sarea_free helper function |
| 138 | * while holding the drm_device::struct_mutex lock. | 105 | * while holding the drm_device::struct_mutex lock. |
| 139 | */ | 106 | */ |
| 140 | void drm_legacy_ctxbitmap_cleanup(struct drm_device * dev) | 107 | void drm_ctxbitmap_cleanup(struct drm_device * dev) |
| 141 | { | 108 | { |
| 142 | mutex_lock(&dev->struct_mutex); | 109 | mutex_lock(&dev->struct_mutex); |
| 143 | idr_destroy(&dev->ctx_idr); | 110 | idr_destroy(&dev->ctx_idr); |
| @@ -169,9 +136,6 @@ int drm_getsareactx(struct drm_device *dev, void *data, | |||
| 169 | struct drm_local_map *map; | 136 | struct drm_local_map *map; |
| 170 | struct drm_map_list *_entry; | 137 | struct drm_map_list *_entry; |
| 171 | 138 | ||
| 172 | if (drm_core_check_feature(dev, DRIVER_MODESET)) | ||
| 173 | return -EINVAL; | ||
| 174 | |||
| 175 | mutex_lock(&dev->struct_mutex); | 139 | mutex_lock(&dev->struct_mutex); |
| 176 | 140 | ||
| 177 | map = idr_find(&dev->ctx_idr, request->ctx_id); | 141 | map = idr_find(&dev->ctx_idr, request->ctx_id); |
| @@ -216,9 +180,6 @@ int drm_setsareactx(struct drm_device *dev, void *data, | |||
| 216 | struct drm_local_map *map = NULL; | 180 | struct drm_local_map *map = NULL; |
| 217 | struct drm_map_list *r_list = NULL; | 181 | struct drm_map_list *r_list = NULL; |
| 218 | 182 | ||
| 219 | if (drm_core_check_feature(dev, DRIVER_MODESET)) | ||
| 220 | return -EINVAL; | ||
| 221 | |||
| 222 | mutex_lock(&dev->struct_mutex); | 183 | mutex_lock(&dev->struct_mutex); |
| 223 | list_for_each_entry(r_list, &dev->maplist, head) { | 184 | list_for_each_entry(r_list, &dev->maplist, head) { |
| 224 | if (r_list->map | 185 | if (r_list->map |
| @@ -319,9 +280,6 @@ int drm_resctx(struct drm_device *dev, void *data, | |||
| 319 | struct drm_ctx ctx; | 280 | struct drm_ctx ctx; |
| 320 | int i; | 281 | int i; |
| 321 | 282 | ||
| 322 | if (drm_core_check_feature(dev, DRIVER_MODESET)) | ||
| 323 | return -EINVAL; | ||
| 324 | |||
| 325 | if (res->count >= DRM_RESERVED_CONTEXTS) { | 283 | if (res->count >= DRM_RESERVED_CONTEXTS) { |
| 326 | memset(&ctx, 0, sizeof(ctx)); | 284 | memset(&ctx, 0, sizeof(ctx)); |
| 327 | for (i = 0; i < DRM_RESERVED_CONTEXTS; i++) { | 285 | for (i = 0; i < DRM_RESERVED_CONTEXTS; i++) { |
| @@ -352,9 +310,6 @@ int drm_addctx(struct drm_device *dev, void *data, | |||
| 352 | struct drm_ctx_list *ctx_entry; | 310 | struct drm_ctx_list *ctx_entry; |
| 353 | struct drm_ctx *ctx = data; | 311 | struct drm_ctx *ctx = data; |
| 354 | 312 | ||
| 355 | if (drm_core_check_feature(dev, DRIVER_MODESET)) | ||
| 356 | return -EINVAL; | ||
| 357 | |||
| 358 | ctx->handle = drm_ctxbitmap_next(dev); | 313 | ctx->handle = drm_ctxbitmap_next(dev); |
| 359 | if (ctx->handle == DRM_KERNEL_CONTEXT) { | 314 | if (ctx->handle == DRM_KERNEL_CONTEXT) { |
| 360 | /* Skip kernel's context and get a new one. */ | 315 | /* Skip kernel's context and get a new one. */ |
| @@ -398,9 +353,6 @@ int drm_getctx(struct drm_device *dev, void *data, struct drm_file *file_priv) | |||
| 398 | { | 353 | { |
| 399 | struct drm_ctx *ctx = data; | 354 | struct drm_ctx *ctx = data; |
| 400 | 355 | ||
| 401 | if (drm_core_check_feature(dev, DRIVER_MODESET)) | ||
| 402 | return -EINVAL; | ||
| 403 | |||
| 404 | /* This is 0, because we don't handle any context flags */ | 356 | /* This is 0, because we don't handle any context flags */ |
| 405 | ctx->flags = 0; | 357 | ctx->flags = 0; |
| 406 | 358 | ||
| @@ -423,9 +375,6 @@ int drm_switchctx(struct drm_device *dev, void *data, | |||
| 423 | { | 375 | { |
| 424 | struct drm_ctx *ctx = data; | 376 | struct drm_ctx *ctx = data; |
| 425 | 377 | ||
| 426 | if (drm_core_check_feature(dev, DRIVER_MODESET)) | ||
| 427 | return -EINVAL; | ||
| 428 | |||
| 429 | DRM_DEBUG("%d\n", ctx->handle); | 378 | DRM_DEBUG("%d\n", ctx->handle); |
| 430 | return drm_context_switch(dev, dev->last_context, ctx->handle); | 379 | return drm_context_switch(dev, dev->last_context, ctx->handle); |
| 431 | } | 380 | } |
| @@ -446,9 +395,6 @@ int drm_newctx(struct drm_device *dev, void *data, | |||
| 446 | { | 395 | { |
| 447 | struct drm_ctx *ctx = data; | 396 | struct drm_ctx *ctx = data; |
| 448 | 397 | ||
| 449 | if (drm_core_check_feature(dev, DRIVER_MODESET)) | ||
| 450 | return -EINVAL; | ||
| 451 | |||
| 452 | DRM_DEBUG("%d\n", ctx->handle); | 398 | DRM_DEBUG("%d\n", ctx->handle); |
| 453 | drm_context_switch_complete(dev, file_priv, ctx->handle); | 399 | drm_context_switch_complete(dev, file_priv, ctx->handle); |
| 454 | 400 | ||
| @@ -471,9 +417,6 @@ int drm_rmctx(struct drm_device *dev, void *data, | |||
| 471 | { | 417 | { |
| 472 | struct drm_ctx *ctx = data; | 418 | struct drm_ctx *ctx = data; |
| 473 | 419 | ||
| 474 | if (drm_core_check_feature(dev, DRIVER_MODESET)) | ||
| 475 | return -EINVAL; | ||
| 476 | |||
| 477 | DRM_DEBUG("%d\n", ctx->handle); | 420 | DRM_DEBUG("%d\n", ctx->handle); |
| 478 | if (ctx->handle != DRM_KERNEL_CONTEXT) { | 421 | if (ctx->handle != DRM_KERNEL_CONTEXT) { |
| 479 | if (dev->driver->context_dtor) | 422 | if (dev->driver->context_dtor) |
diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c index 3d13ca6e257f..f6f6cc7fc133 100644 --- a/drivers/gpu/drm/drm_fb_helper.c +++ b/drivers/gpu/drm/drm_fb_helper.c | |||
| @@ -416,6 +416,14 @@ static void drm_fb_helper_dpms(struct fb_info *info, int dpms_mode) | |||
| 416 | return; | 416 | return; |
| 417 | 417 | ||
| 418 | /* | 418 | /* |
| 419 | * fbdev->blank can be called from irq context in case of a panic. | ||
| 420 | * Since we already have our own special panic handler which will | ||
| 421 | * restore the fbdev console mode completely, just bail out early. | ||
| 422 | */ | ||
| 423 | if (oops_in_progress) | ||
| 424 | return; | ||
| 425 | |||
| 426 | /* | ||
| 419 | * For each CRTC in this fb, turn the connectors on/off. | 427 | * For each CRTC in this fb, turn the connectors on/off. |
| 420 | */ | 428 | */ |
| 421 | drm_modeset_lock_all(dev); | 429 | drm_modeset_lock_all(dev); |
diff --git a/drivers/gpu/drm/drm_fops.c b/drivers/gpu/drm/drm_fops.c index 4be8e09a32ef..3f84277d7036 100644 --- a/drivers/gpu/drm/drm_fops.c +++ b/drivers/gpu/drm/drm_fops.c | |||
| @@ -439,7 +439,26 @@ int drm_release(struct inode *inode, struct file *filp) | |||
| 439 | if (dev->driver->driver_features & DRIVER_GEM) | 439 | if (dev->driver->driver_features & DRIVER_GEM) |
| 440 | drm_gem_release(dev, file_priv); | 440 | drm_gem_release(dev, file_priv); |
| 441 | 441 | ||
| 442 | drm_legacy_ctxbitmap_release(dev, file_priv); | 442 | mutex_lock(&dev->ctxlist_mutex); |
| 443 | if (!list_empty(&dev->ctxlist)) { | ||
| 444 | struct drm_ctx_list *pos, *n; | ||
| 445 | |||
| 446 | list_for_each_entry_safe(pos, n, &dev->ctxlist, head) { | ||
| 447 | if (pos->tag == file_priv && | ||
| 448 | pos->handle != DRM_KERNEL_CONTEXT) { | ||
| 449 | if (dev->driver->context_dtor) | ||
| 450 | dev->driver->context_dtor(dev, | ||
| 451 | pos->handle); | ||
| 452 | |||
| 453 | drm_ctxbitmap_free(dev, pos->handle); | ||
| 454 | |||
| 455 | list_del(&pos->head); | ||
| 456 | kfree(pos); | ||
| 457 | --dev->ctx_count; | ||
| 458 | } | ||
| 459 | } | ||
| 460 | } | ||
| 461 | mutex_unlock(&dev->ctxlist_mutex); | ||
| 443 | 462 | ||
| 444 | mutex_lock(&dev->struct_mutex); | 463 | mutex_lock(&dev->struct_mutex); |
| 445 | 464 | ||
diff --git a/drivers/gpu/drm/drm_stub.c b/drivers/gpu/drm/drm_stub.c index e7eb0276f7f1..39d864576be4 100644 --- a/drivers/gpu/drm/drm_stub.c +++ b/drivers/gpu/drm/drm_stub.c | |||
| @@ -292,7 +292,13 @@ int drm_fill_in_dev(struct drm_device *dev, | |||
| 292 | goto error_out_unreg; | 292 | goto error_out_unreg; |
| 293 | } | 293 | } |
| 294 | 294 | ||
| 295 | drm_legacy_ctxbitmap_init(dev); | 295 | |
| 296 | |||
| 297 | retcode = drm_ctxbitmap_init(dev); | ||
| 298 | if (retcode) { | ||
| 299 | DRM_ERROR("Cannot allocate memory for context bitmap.\n"); | ||
| 300 | goto error_out_unreg; | ||
| 301 | } | ||
| 296 | 302 | ||
| 297 | if (driver->driver_features & DRIVER_GEM) { | 303 | if (driver->driver_features & DRIVER_GEM) { |
| 298 | retcode = drm_gem_init(dev); | 304 | retcode = drm_gem_init(dev); |
| @@ -446,7 +452,7 @@ void drm_put_dev(struct drm_device *dev) | |||
| 446 | drm_rmmap(dev, r_list->map); | 452 | drm_rmmap(dev, r_list->map); |
| 447 | drm_ht_remove(&dev->map_hash); | 453 | drm_ht_remove(&dev->map_hash); |
| 448 | 454 | ||
| 449 | drm_legacy_ctxbitmap_cleanup(dev); | 455 | drm_ctxbitmap_cleanup(dev); |
| 450 | 456 | ||
| 451 | if (drm_core_check_feature(dev, DRIVER_MODESET)) | 457 | if (drm_core_check_feature(dev, DRIVER_MODESET)) |
| 452 | drm_put_minor(&dev->control); | 458 | drm_put_minor(&dev->control); |
diff --git a/drivers/gpu/drm/exynos/Kconfig b/drivers/gpu/drm/exynos/Kconfig index 4752f223e5b2..45b6ef595965 100644 --- a/drivers/gpu/drm/exynos/Kconfig +++ b/drivers/gpu/drm/exynos/Kconfig | |||
| @@ -56,7 +56,7 @@ config DRM_EXYNOS_IPP | |||
| 56 | 56 | ||
| 57 | config DRM_EXYNOS_FIMC | 57 | config DRM_EXYNOS_FIMC |
| 58 | bool "Exynos DRM FIMC" | 58 | bool "Exynos DRM FIMC" |
| 59 | depends on DRM_EXYNOS_IPP && MFD_SYSCON && OF | 59 | depends on DRM_EXYNOS_IPP && MFD_SYSCON |
| 60 | help | 60 | help |
| 61 | Choose this option if you want to use Exynos FIMC for DRM. | 61 | Choose this option if you want to use Exynos FIMC for DRM. |
| 62 | 62 | ||
diff --git a/drivers/gpu/drm/exynos/exynos_drm_buf.c b/drivers/gpu/drm/exynos/exynos_drm_buf.c index 3445a0f3a6b2..9c8088462c26 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_buf.c +++ b/drivers/gpu/drm/exynos/exynos_drm_buf.c | |||
| @@ -63,7 +63,8 @@ static int lowlevel_buffer_allocate(struct drm_device *dev, | |||
| 63 | return -ENOMEM; | 63 | return -ENOMEM; |
| 64 | } | 64 | } |
| 65 | 65 | ||
| 66 | buf->kvaddr = dma_alloc_attrs(dev->dev, buf->size, | 66 | buf->kvaddr = (void __iomem *)dma_alloc_attrs(dev->dev, |
| 67 | buf->size, | ||
| 67 | &buf->dma_addr, GFP_KERNEL, | 68 | &buf->dma_addr, GFP_KERNEL, |
| 68 | &buf->dma_attrs); | 69 | &buf->dma_attrs); |
| 69 | if (!buf->kvaddr) { | 70 | if (!buf->kvaddr) { |
| @@ -90,9 +91,9 @@ static int lowlevel_buffer_allocate(struct drm_device *dev, | |||
| 90 | } | 91 | } |
| 91 | 92 | ||
| 92 | buf->sgt = drm_prime_pages_to_sg(buf->pages, nr_pages); | 93 | buf->sgt = drm_prime_pages_to_sg(buf->pages, nr_pages); |
| 93 | if (!buf->sgt) { | 94 | if (IS_ERR(buf->sgt)) { |
| 94 | DRM_ERROR("failed to get sg table.\n"); | 95 | DRM_ERROR("failed to get sg table.\n"); |
| 95 | ret = -ENOMEM; | 96 | ret = PTR_ERR(buf->sgt); |
| 96 | goto err_free_attrs; | 97 | goto err_free_attrs; |
| 97 | } | 98 | } |
| 98 | 99 | ||
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c index 78e868bcf1ec..e7c2f2d07f19 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c | |||
| @@ -99,12 +99,13 @@ static int exynos_drm_fbdev_update(struct drm_fb_helper *helper, | |||
| 99 | if (is_drm_iommu_supported(dev)) { | 99 | if (is_drm_iommu_supported(dev)) { |
| 100 | unsigned int nr_pages = buffer->size >> PAGE_SHIFT; | 100 | unsigned int nr_pages = buffer->size >> PAGE_SHIFT; |
| 101 | 101 | ||
| 102 | buffer->kvaddr = vmap(buffer->pages, nr_pages, VM_MAP, | 102 | buffer->kvaddr = (void __iomem *) vmap(buffer->pages, |
| 103 | nr_pages, VM_MAP, | ||
| 103 | pgprot_writecombine(PAGE_KERNEL)); | 104 | pgprot_writecombine(PAGE_KERNEL)); |
| 104 | } else { | 105 | } else { |
| 105 | phys_addr_t dma_addr = buffer->dma_addr; | 106 | phys_addr_t dma_addr = buffer->dma_addr; |
| 106 | if (dma_addr) | 107 | if (dma_addr) |
| 107 | buffer->kvaddr = phys_to_virt(dma_addr); | 108 | buffer->kvaddr = (void __iomem *)phys_to_virt(dma_addr); |
| 108 | else | 109 | else |
| 109 | buffer->kvaddr = (void __iomem *)NULL; | 110 | buffer->kvaddr = (void __iomem *)NULL; |
| 110 | } | 111 | } |
diff --git a/drivers/gpu/drm/i2c/tda998x_drv.c b/drivers/gpu/drm/i2c/tda998x_drv.c index b1f8fc69023f..60e84043aa34 100644 --- a/drivers/gpu/drm/i2c/tda998x_drv.c +++ b/drivers/gpu/drm/i2c/tda998x_drv.c | |||
| @@ -707,8 +707,7 @@ tda998x_encoder_dpms(struct drm_encoder *encoder, int mode) | |||
| 707 | reg_write(encoder, REG_VIP_CNTRL_2, priv->vip_cntrl_2); | 707 | reg_write(encoder, REG_VIP_CNTRL_2, priv->vip_cntrl_2); |
| 708 | break; | 708 | break; |
| 709 | case DRM_MODE_DPMS_OFF: | 709 | case DRM_MODE_DPMS_OFF: |
| 710 | /* disable audio and video ports */ | 710 | /* disable video ports */ |
| 711 | reg_write(encoder, REG_ENA_AP, 0x00); | ||
| 712 | reg_write(encoder, REG_ENA_VP_0, 0x00); | 711 | reg_write(encoder, REG_ENA_VP_0, 0x00); |
| 713 | reg_write(encoder, REG_ENA_VP_1, 0x00); | 712 | reg_write(encoder, REG_ENA_VP_1, 0x00); |
| 714 | reg_write(encoder, REG_ENA_VP_2, 0x00); | 713 | reg_write(encoder, REG_ENA_VP_2, 0x00); |
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index 8507c6d1e642..df9253d890ee 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c | |||
| @@ -1392,14 +1392,11 @@ out: | |||
| 1392 | if (i915_terminally_wedged(&dev_priv->gpu_error)) | 1392 | if (i915_terminally_wedged(&dev_priv->gpu_error)) |
| 1393 | return VM_FAULT_SIGBUS; | 1393 | return VM_FAULT_SIGBUS; |
| 1394 | case -EAGAIN: | 1394 | case -EAGAIN: |
| 1395 | /* Give the error handler a chance to run and move the | 1395 | /* |
| 1396 | * objects off the GPU active list. Next time we service the | 1396 | * EAGAIN means the gpu is hung and we'll wait for the error |
| 1397 | * fault, we should be able to transition the page into the | 1397 | * handler to reset everything when re-faulting in |
| 1398 | * GTT without touching the GPU (and so avoid further | 1398 | * i915_mutex_lock_interruptible. |
| 1399 | * EIO/EGAIN). If the GPU is wedged, then there is no issue | ||
| 1400 | * with coherency, just lost writes. | ||
| 1401 | */ | 1399 | */ |
| 1402 | set_need_resched(); | ||
| 1403 | case 0: | 1400 | case 0: |
| 1404 | case -ERESTARTSYS: | 1401 | case -ERESTARTSYS: |
| 1405 | case -EINTR: | 1402 | case -EINTR: |
diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c index 83cce0cdb769..4b91228fd9bd 100644 --- a/drivers/gpu/drm/i915/i915_irq.c +++ b/drivers/gpu/drm/i915/i915_irq.c | |||
| @@ -1469,6 +1469,34 @@ static irqreturn_t ironlake_irq_handler(int irq, void *arg) | |||
| 1469 | return ret; | 1469 | return ret; |
| 1470 | } | 1470 | } |
| 1471 | 1471 | ||
| 1472 | static void i915_error_wake_up(struct drm_i915_private *dev_priv, | ||
| 1473 | bool reset_completed) | ||
| 1474 | { | ||
| 1475 | struct intel_ring_buffer *ring; | ||
| 1476 | int i; | ||
| 1477 | |||
| 1478 | /* | ||
| 1479 | * Notify all waiters for GPU completion events that reset state has | ||
| 1480 | * been changed, and that they need to restart their wait after | ||
| 1481 | * checking for potential errors (and bail out to drop locks if there is | ||
| 1482 | * a gpu reset pending so that i915_error_work_func can acquire them). | ||
| 1483 | */ | ||
| 1484 | |||
| 1485 | /* Wake up __wait_seqno, potentially holding dev->struct_mutex. */ | ||
| 1486 | for_each_ring(ring, dev_priv, i) | ||
| 1487 | wake_up_all(&ring->irq_queue); | ||
| 1488 | |||
| 1489 | /* Wake up intel_crtc_wait_for_pending_flips, holding crtc->mutex. */ | ||
| 1490 | wake_up_all(&dev_priv->pending_flip_queue); | ||
| 1491 | |||
| 1492 | /* | ||
| 1493 | * Signal tasks blocked in i915_gem_wait_for_error that the pending | ||
| 1494 | * reset state is cleared. | ||
| 1495 | */ | ||
| 1496 | if (reset_completed) | ||
| 1497 | wake_up_all(&dev_priv->gpu_error.reset_queue); | ||
| 1498 | } | ||
| 1499 | |||
| 1472 | /** | 1500 | /** |
| 1473 | * i915_error_work_func - do process context error handling work | 1501 | * i915_error_work_func - do process context error handling work |
| 1474 | * @work: work struct | 1502 | * @work: work struct |
| @@ -1483,11 +1511,10 @@ static void i915_error_work_func(struct work_struct *work) | |||
| 1483 | drm_i915_private_t *dev_priv = container_of(error, drm_i915_private_t, | 1511 | drm_i915_private_t *dev_priv = container_of(error, drm_i915_private_t, |
| 1484 | gpu_error); | 1512 | gpu_error); |
| 1485 | struct drm_device *dev = dev_priv->dev; | 1513 | struct drm_device *dev = dev_priv->dev; |
| 1486 | struct intel_ring_buffer *ring; | ||
| 1487 | char *error_event[] = { I915_ERROR_UEVENT "=1", NULL }; | 1514 | char *error_event[] = { I915_ERROR_UEVENT "=1", NULL }; |
| 1488 | char *reset_event[] = { I915_RESET_UEVENT "=1", NULL }; | 1515 | char *reset_event[] = { I915_RESET_UEVENT "=1", NULL }; |
| 1489 | char *reset_done_event[] = { I915_ERROR_UEVENT "=0", NULL }; | 1516 | char *reset_done_event[] = { I915_ERROR_UEVENT "=0", NULL }; |
| 1490 | int i, ret; | 1517 | int ret; |
| 1491 | 1518 | ||
| 1492 | kobject_uevent_env(&dev->primary->kdev.kobj, KOBJ_CHANGE, error_event); | 1519 | kobject_uevent_env(&dev->primary->kdev.kobj, KOBJ_CHANGE, error_event); |
| 1493 | 1520 | ||
| @@ -1506,8 +1533,16 @@ static void i915_error_work_func(struct work_struct *work) | |||
| 1506 | kobject_uevent_env(&dev->primary->kdev.kobj, KOBJ_CHANGE, | 1533 | kobject_uevent_env(&dev->primary->kdev.kobj, KOBJ_CHANGE, |
| 1507 | reset_event); | 1534 | reset_event); |
| 1508 | 1535 | ||
| 1536 | /* | ||
| 1537 | * All state reset _must_ be completed before we update the | ||
| 1538 | * reset counter, for otherwise waiters might miss the reset | ||
| 1539 | * pending state and not properly drop locks, resulting in | ||
| 1540 | * deadlocks with the reset work. | ||
| 1541 | */ | ||
| 1509 | ret = i915_reset(dev); | 1542 | ret = i915_reset(dev); |
| 1510 | 1543 | ||
| 1544 | intel_display_handle_reset(dev); | ||
| 1545 | |||
| 1511 | if (ret == 0) { | 1546 | if (ret == 0) { |
| 1512 | /* | 1547 | /* |
| 1513 | * After all the gem state is reset, increment the reset | 1548 | * After all the gem state is reset, increment the reset |
| @@ -1528,12 +1563,11 @@ static void i915_error_work_func(struct work_struct *work) | |||
| 1528 | atomic_set(&error->reset_counter, I915_WEDGED); | 1563 | atomic_set(&error->reset_counter, I915_WEDGED); |
| 1529 | } | 1564 | } |
| 1530 | 1565 | ||
| 1531 | for_each_ring(ring, dev_priv, i) | 1566 | /* |
| 1532 | wake_up_all(&ring->irq_queue); | 1567 | * Note: The wake_up also serves as a memory barrier so that |
| 1533 | 1568 | * waiters see the update value of the reset counter atomic_t. | |
| 1534 | intel_display_handle_reset(dev); | 1569 | */ |
| 1535 | 1570 | i915_error_wake_up(dev_priv, true); | |
| 1536 | wake_up_all(&dev_priv->gpu_error.reset_queue); | ||
| 1537 | } | 1571 | } |
| 1538 | } | 1572 | } |
| 1539 | 1573 | ||
| @@ -1642,8 +1676,6 @@ static void i915_report_and_clear_eir(struct drm_device *dev) | |||
| 1642 | void i915_handle_error(struct drm_device *dev, bool wedged) | 1676 | void i915_handle_error(struct drm_device *dev, bool wedged) |
| 1643 | { | 1677 | { |
| 1644 | struct drm_i915_private *dev_priv = dev->dev_private; | 1678 | struct drm_i915_private *dev_priv = dev->dev_private; |
| 1645 | struct intel_ring_buffer *ring; | ||
| 1646 | int i; | ||
| 1647 | 1679 | ||
| 1648 | i915_capture_error_state(dev); | 1680 | i915_capture_error_state(dev); |
| 1649 | i915_report_and_clear_eir(dev); | 1681 | i915_report_and_clear_eir(dev); |
| @@ -1653,11 +1685,19 @@ void i915_handle_error(struct drm_device *dev, bool wedged) | |||
| 1653 | &dev_priv->gpu_error.reset_counter); | 1685 | &dev_priv->gpu_error.reset_counter); |
| 1654 | 1686 | ||
| 1655 | /* | 1687 | /* |
| 1656 | * Wakeup waiting processes so that the reset work item | 1688 | * Wakeup waiting processes so that the reset work function |
| 1657 | * doesn't deadlock trying to grab various locks. | 1689 | * i915_error_work_func doesn't deadlock trying to grab various |
| 1690 | * locks. By bumping the reset counter first, the woken | ||
| 1691 | * processes will see a reset in progress and back off, | ||
| 1692 | * releasing their locks and then wait for the reset completion. | ||
| 1693 | * We must do this for _all_ gpu waiters that might hold locks | ||
| 1694 | * that the reset work needs to acquire. | ||
| 1695 | * | ||
| 1696 | * Note: The wake_up serves as the required memory barrier to | ||
| 1697 | * ensure that the waiters see the updated value of the reset | ||
| 1698 | * counter atomic_t. | ||
| 1658 | */ | 1699 | */ |
| 1659 | for_each_ring(ring, dev_priv, i) | 1700 | i915_error_wake_up(dev_priv, false); |
| 1660 | wake_up_all(&ring->irq_queue); | ||
| 1661 | } | 1701 | } |
| 1662 | 1702 | ||
| 1663 | /* | 1703 | /* |
diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c index 63aca49d11a8..63de2701b974 100644 --- a/drivers/gpu/drm/i915/intel_ddi.c +++ b/drivers/gpu/drm/i915/intel_ddi.c | |||
| @@ -778,7 +778,7 @@ void intel_ddi_enable_transcoder_func(struct drm_crtc *crtc) | |||
| 778 | /* Can only use the always-on power well for eDP when | 778 | /* Can only use the always-on power well for eDP when |
| 779 | * not using the panel fitter, and when not using motion | 779 | * not using the panel fitter, and when not using motion |
| 780 | * blur mitigation (which we don't support). */ | 780 | * blur mitigation (which we don't support). */ |
| 781 | if (intel_crtc->config.pch_pfit.size) | 781 | if (intel_crtc->config.pch_pfit.enabled) |
| 782 | temp |= TRANS_DDI_EDP_INPUT_A_ONOFF; | 782 | temp |= TRANS_DDI_EDP_INPUT_A_ONOFF; |
| 783 | else | 783 | else |
| 784 | temp |= TRANS_DDI_EDP_INPUT_A_ON; | 784 | temp |= TRANS_DDI_EDP_INPUT_A_ON; |
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 2489d0b4c7d2..d8a1d98693e7 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
| @@ -2249,7 +2249,7 @@ intel_pipe_set_base(struct drm_crtc *crtc, int x, int y, | |||
| 2249 | I915_WRITE(PIPESRC(intel_crtc->pipe), | 2249 | I915_WRITE(PIPESRC(intel_crtc->pipe), |
| 2250 | ((crtc->mode.hdisplay - 1) << 16) | | 2250 | ((crtc->mode.hdisplay - 1) << 16) | |
| 2251 | (crtc->mode.vdisplay - 1)); | 2251 | (crtc->mode.vdisplay - 1)); |
| 2252 | if (!intel_crtc->config.pch_pfit.size && | 2252 | if (!intel_crtc->config.pch_pfit.enabled && |
| 2253 | (intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS) || | 2253 | (intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS) || |
| 2254 | intel_pipe_has_type(crtc, INTEL_OUTPUT_EDP))) { | 2254 | intel_pipe_has_type(crtc, INTEL_OUTPUT_EDP))) { |
| 2255 | I915_WRITE(PF_CTL(intel_crtc->pipe), 0); | 2255 | I915_WRITE(PF_CTL(intel_crtc->pipe), 0); |
| @@ -3203,7 +3203,7 @@ static void ironlake_pfit_enable(struct intel_crtc *crtc) | |||
| 3203 | struct drm_i915_private *dev_priv = dev->dev_private; | 3203 | struct drm_i915_private *dev_priv = dev->dev_private; |
| 3204 | int pipe = crtc->pipe; | 3204 | int pipe = crtc->pipe; |
| 3205 | 3205 | ||
| 3206 | if (crtc->config.pch_pfit.size) { | 3206 | if (crtc->config.pch_pfit.enabled) { |
| 3207 | /* Force use of hard-coded filter coefficients | 3207 | /* Force use of hard-coded filter coefficients |
| 3208 | * as some pre-programmed values are broken, | 3208 | * as some pre-programmed values are broken, |
| 3209 | * e.g. x201. | 3209 | * e.g. x201. |
| @@ -3428,7 +3428,7 @@ static void ironlake_pfit_disable(struct intel_crtc *crtc) | |||
| 3428 | 3428 | ||
| 3429 | /* To avoid upsetting the power well on haswell only disable the pfit if | 3429 | /* To avoid upsetting the power well on haswell only disable the pfit if |
| 3430 | * it's in use. The hw state code will make sure we get this right. */ | 3430 | * it's in use. The hw state code will make sure we get this right. */ |
| 3431 | if (crtc->config.pch_pfit.size) { | 3431 | if (crtc->config.pch_pfit.enabled) { |
| 3432 | I915_WRITE(PF_CTL(pipe), 0); | 3432 | I915_WRITE(PF_CTL(pipe), 0); |
| 3433 | I915_WRITE(PF_WIN_POS(pipe), 0); | 3433 | I915_WRITE(PF_WIN_POS(pipe), 0); |
| 3434 | I915_WRITE(PF_WIN_SZ(pipe), 0); | 3434 | I915_WRITE(PF_WIN_SZ(pipe), 0); |
| @@ -4877,9 +4877,6 @@ static int i9xx_crtc_mode_set(struct drm_crtc *crtc, | |||
| 4877 | return -EINVAL; | 4877 | return -EINVAL; |
| 4878 | } | 4878 | } |
| 4879 | 4879 | ||
| 4880 | /* Ensure that the cursor is valid for the new mode before changing... */ | ||
| 4881 | intel_crtc_update_cursor(crtc, true); | ||
| 4882 | |||
| 4883 | if (is_lvds && dev_priv->lvds_downclock_avail) { | 4880 | if (is_lvds && dev_priv->lvds_downclock_avail) { |
| 4884 | /* | 4881 | /* |
| 4885 | * Ensure we match the reduced clock's P to the target clock. | 4882 | * Ensure we match the reduced clock's P to the target clock. |
| @@ -5768,9 +5765,6 @@ static int ironlake_crtc_mode_set(struct drm_crtc *crtc, | |||
| 5768 | intel_crtc->config.dpll.p2 = clock.p2; | 5765 | intel_crtc->config.dpll.p2 = clock.p2; |
| 5769 | } | 5766 | } |
| 5770 | 5767 | ||
| 5771 | /* Ensure that the cursor is valid for the new mode before changing... */ | ||
| 5772 | intel_crtc_update_cursor(crtc, true); | ||
| 5773 | |||
| 5774 | /* CPU eDP is the only output that doesn't need a PCH PLL of its own. */ | 5768 | /* CPU eDP is the only output that doesn't need a PCH PLL of its own. */ |
| 5775 | if (intel_crtc->config.has_pch_encoder) { | 5769 | if (intel_crtc->config.has_pch_encoder) { |
| 5776 | fp = i9xx_dpll_compute_fp(&intel_crtc->config.dpll); | 5770 | fp = i9xx_dpll_compute_fp(&intel_crtc->config.dpll); |
| @@ -5859,6 +5853,7 @@ static void ironlake_get_pfit_config(struct intel_crtc *crtc, | |||
| 5859 | tmp = I915_READ(PF_CTL(crtc->pipe)); | 5853 | tmp = I915_READ(PF_CTL(crtc->pipe)); |
| 5860 | 5854 | ||
| 5861 | if (tmp & PF_ENABLE) { | 5855 | if (tmp & PF_ENABLE) { |
| 5856 | pipe_config->pch_pfit.enabled = true; | ||
| 5862 | pipe_config->pch_pfit.pos = I915_READ(PF_WIN_POS(crtc->pipe)); | 5857 | pipe_config->pch_pfit.pos = I915_READ(PF_WIN_POS(crtc->pipe)); |
| 5863 | pipe_config->pch_pfit.size = I915_READ(PF_WIN_SZ(crtc->pipe)); | 5858 | pipe_config->pch_pfit.size = I915_READ(PF_WIN_SZ(crtc->pipe)); |
| 5864 | 5859 | ||
| @@ -6236,7 +6231,7 @@ static void haswell_modeset_global_resources(struct drm_device *dev) | |||
| 6236 | if (!crtc->base.enabled) | 6231 | if (!crtc->base.enabled) |
| 6237 | continue; | 6232 | continue; |
| 6238 | 6233 | ||
| 6239 | if (crtc->pipe != PIPE_A || crtc->config.pch_pfit.size || | 6234 | if (crtc->pipe != PIPE_A || crtc->config.pch_pfit.enabled || |
| 6240 | crtc->config.cpu_transcoder != TRANSCODER_EDP) | 6235 | crtc->config.cpu_transcoder != TRANSCODER_EDP) |
| 6241 | enable = true; | 6236 | enable = true; |
| 6242 | } | 6237 | } |
| @@ -6259,9 +6254,6 @@ static int haswell_crtc_mode_set(struct drm_crtc *crtc, | |||
| 6259 | if (!intel_ddi_pll_mode_set(crtc)) | 6254 | if (!intel_ddi_pll_mode_set(crtc)) |
| 6260 | return -EINVAL; | 6255 | return -EINVAL; |
| 6261 | 6256 | ||
| 6262 | /* Ensure that the cursor is valid for the new mode before changing... */ | ||
| 6263 | intel_crtc_update_cursor(crtc, true); | ||
| 6264 | |||
| 6265 | if (intel_crtc->config.has_dp_encoder) | 6257 | if (intel_crtc->config.has_dp_encoder) |
| 6266 | intel_dp_set_m_n(intel_crtc); | 6258 | intel_dp_set_m_n(intel_crtc); |
| 6267 | 6259 | ||
| @@ -6494,15 +6486,15 @@ static void haswell_write_eld(struct drm_connector *connector, | |||
| 6494 | 6486 | ||
| 6495 | /* Set ELD valid state */ | 6487 | /* Set ELD valid state */ |
| 6496 | tmp = I915_READ(aud_cntrl_st2); | 6488 | tmp = I915_READ(aud_cntrl_st2); |
| 6497 | DRM_DEBUG_DRIVER("HDMI audio: pin eld vld status=0x%8x\n", tmp); | 6489 | DRM_DEBUG_DRIVER("HDMI audio: pin eld vld status=0x%08x\n", tmp); |
| 6498 | tmp |= (AUDIO_ELD_VALID_A << (pipe * 4)); | 6490 | tmp |= (AUDIO_ELD_VALID_A << (pipe * 4)); |
| 6499 | I915_WRITE(aud_cntrl_st2, tmp); | 6491 | I915_WRITE(aud_cntrl_st2, tmp); |
| 6500 | tmp = I915_READ(aud_cntrl_st2); | 6492 | tmp = I915_READ(aud_cntrl_st2); |
| 6501 | DRM_DEBUG_DRIVER("HDMI audio: eld vld status=0x%8x\n", tmp); | 6493 | DRM_DEBUG_DRIVER("HDMI audio: eld vld status=0x%08x\n", tmp); |
| 6502 | 6494 | ||
| 6503 | /* Enable HDMI mode */ | 6495 | /* Enable HDMI mode */ |
| 6504 | tmp = I915_READ(aud_config); | 6496 | tmp = I915_READ(aud_config); |
| 6505 | DRM_DEBUG_DRIVER("HDMI audio: audio conf: 0x%8x\n", tmp); | 6497 | DRM_DEBUG_DRIVER("HDMI audio: audio conf: 0x%08x\n", tmp); |
| 6506 | /* clear N_programing_enable and N_value_index */ | 6498 | /* clear N_programing_enable and N_value_index */ |
| 6507 | tmp &= ~(AUD_CONFIG_N_VALUE_INDEX | AUD_CONFIG_N_PROG_ENABLE); | 6499 | tmp &= ~(AUD_CONFIG_N_VALUE_INDEX | AUD_CONFIG_N_PROG_ENABLE); |
| 6508 | I915_WRITE(aud_config, tmp); | 6500 | I915_WRITE(aud_config, tmp); |
| @@ -6937,7 +6929,8 @@ static int intel_crtc_cursor_set(struct drm_crtc *crtc, | |||
| 6937 | intel_crtc->cursor_width = width; | 6929 | intel_crtc->cursor_width = width; |
| 6938 | intel_crtc->cursor_height = height; | 6930 | intel_crtc->cursor_height = height; |
| 6939 | 6931 | ||
| 6940 | intel_crtc_update_cursor(crtc, intel_crtc->cursor_bo != NULL); | 6932 | if (intel_crtc->active) |
| 6933 | intel_crtc_update_cursor(crtc, intel_crtc->cursor_bo != NULL); | ||
| 6941 | 6934 | ||
| 6942 | return 0; | 6935 | return 0; |
| 6943 | fail_unpin: | 6936 | fail_unpin: |
| @@ -6956,7 +6949,8 @@ static int intel_crtc_cursor_move(struct drm_crtc *crtc, int x, int y) | |||
| 6956 | intel_crtc->cursor_x = x; | 6949 | intel_crtc->cursor_x = x; |
| 6957 | intel_crtc->cursor_y = y; | 6950 | intel_crtc->cursor_y = y; |
| 6958 | 6951 | ||
| 6959 | intel_crtc_update_cursor(crtc, intel_crtc->cursor_bo != NULL); | 6952 | if (intel_crtc->active) |
| 6953 | intel_crtc_update_cursor(crtc, intel_crtc->cursor_bo != NULL); | ||
| 6960 | 6954 | ||
| 6961 | return 0; | 6955 | return 0; |
| 6962 | } | 6956 | } |
| @@ -8205,9 +8199,10 @@ static void intel_dump_pipe_config(struct intel_crtc *crtc, | |||
| 8205 | pipe_config->gmch_pfit.control, | 8199 | pipe_config->gmch_pfit.control, |
| 8206 | pipe_config->gmch_pfit.pgm_ratios, | 8200 | pipe_config->gmch_pfit.pgm_ratios, |
| 8207 | pipe_config->gmch_pfit.lvds_border_bits); | 8201 | pipe_config->gmch_pfit.lvds_border_bits); |
| 8208 | DRM_DEBUG_KMS("pch pfit: pos: 0x%08x, size: 0x%08x\n", | 8202 | DRM_DEBUG_KMS("pch pfit: pos: 0x%08x, size: 0x%08x, %s\n", |
| 8209 | pipe_config->pch_pfit.pos, | 8203 | pipe_config->pch_pfit.pos, |
| 8210 | pipe_config->pch_pfit.size); | 8204 | pipe_config->pch_pfit.size, |
| 8205 | pipe_config->pch_pfit.enabled ? "enabled" : "disabled"); | ||
| 8211 | DRM_DEBUG_KMS("ips: %i\n", pipe_config->ips_enabled); | 8206 | DRM_DEBUG_KMS("ips: %i\n", pipe_config->ips_enabled); |
| 8212 | } | 8207 | } |
| 8213 | 8208 | ||
| @@ -8603,8 +8598,11 @@ intel_pipe_config_compare(struct drm_device *dev, | |||
| 8603 | if (INTEL_INFO(dev)->gen < 4) | 8598 | if (INTEL_INFO(dev)->gen < 4) |
| 8604 | PIPE_CONF_CHECK_I(gmch_pfit.pgm_ratios); | 8599 | PIPE_CONF_CHECK_I(gmch_pfit.pgm_ratios); |
| 8605 | PIPE_CONF_CHECK_I(gmch_pfit.lvds_border_bits); | 8600 | PIPE_CONF_CHECK_I(gmch_pfit.lvds_border_bits); |
| 8606 | PIPE_CONF_CHECK_I(pch_pfit.pos); | 8601 | PIPE_CONF_CHECK_I(pch_pfit.enabled); |
| 8607 | PIPE_CONF_CHECK_I(pch_pfit.size); | 8602 | if (current_config->pch_pfit.enabled) { |
| 8603 | PIPE_CONF_CHECK_I(pch_pfit.pos); | ||
| 8604 | PIPE_CONF_CHECK_I(pch_pfit.size); | ||
| 8605 | } | ||
| 8608 | 8606 | ||
| 8609 | PIPE_CONF_CHECK_I(ips_enabled); | 8607 | PIPE_CONF_CHECK_I(ips_enabled); |
| 8610 | 8608 | ||
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h index a47799e832c6..28cae80495e2 100644 --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h | |||
| @@ -280,6 +280,7 @@ struct intel_crtc_config { | |||
| 280 | struct { | 280 | struct { |
| 281 | u32 pos; | 281 | u32 pos; |
| 282 | u32 size; | 282 | u32 size; |
| 283 | bool enabled; | ||
| 283 | } pch_pfit; | 284 | } pch_pfit; |
| 284 | 285 | ||
| 285 | /* FDI configuration, only valid if has_pch_encoder is set. */ | 286 | /* FDI configuration, only valid if has_pch_encoder is set. */ |
diff --git a/drivers/gpu/drm/i915/intel_dvo.c b/drivers/gpu/drm/i915/intel_dvo.c index 406303b509c1..7fa7df546c1e 100644 --- a/drivers/gpu/drm/i915/intel_dvo.c +++ b/drivers/gpu/drm/i915/intel_dvo.c | |||
| @@ -263,6 +263,8 @@ static bool intel_dvo_compute_config(struct intel_encoder *encoder, | |||
| 263 | C(vtotal); | 263 | C(vtotal); |
| 264 | C(clock); | 264 | C(clock); |
| 265 | #undef C | 265 | #undef C |
| 266 | |||
| 267 | drm_mode_set_crtcinfo(adjusted_mode, 0); | ||
| 266 | } | 268 | } |
| 267 | 269 | ||
| 268 | if (intel_dvo->dev.dev_ops->mode_fixup) | 270 | if (intel_dvo->dev.dev_ops->mode_fixup) |
diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c index 42114ecbae0e..293564a2896a 100644 --- a/drivers/gpu/drm/i915/intel_panel.c +++ b/drivers/gpu/drm/i915/intel_panel.c | |||
| @@ -112,6 +112,7 @@ intel_pch_panel_fitting(struct intel_crtc *intel_crtc, | |||
| 112 | done: | 112 | done: |
| 113 | pipe_config->pch_pfit.pos = (x << 16) | y; | 113 | pipe_config->pch_pfit.pos = (x << 16) | y; |
| 114 | pipe_config->pch_pfit.size = (width << 16) | height; | 114 | pipe_config->pch_pfit.size = (width << 16) | height; |
| 115 | pipe_config->pch_pfit.enabled = pipe_config->pch_pfit.size != 0; | ||
| 115 | } | 116 | } |
| 116 | 117 | ||
| 117 | static void | 118 | static void |
diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c index 0c115cc4899f..dd176b7296c1 100644 --- a/drivers/gpu/drm/i915/intel_pm.c +++ b/drivers/gpu/drm/i915/intel_pm.c | |||
| @@ -2096,16 +2096,16 @@ static uint32_t ilk_pipe_pixel_rate(struct drm_device *dev, | |||
| 2096 | struct drm_crtc *crtc) | 2096 | struct drm_crtc *crtc) |
| 2097 | { | 2097 | { |
| 2098 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); | 2098 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); |
| 2099 | uint32_t pixel_rate, pfit_size; | 2099 | uint32_t pixel_rate; |
| 2100 | 2100 | ||
| 2101 | pixel_rate = intel_crtc->config.adjusted_mode.clock; | 2101 | pixel_rate = intel_crtc->config.adjusted_mode.clock; |
| 2102 | 2102 | ||
| 2103 | /* We only use IF-ID interlacing. If we ever use PF-ID we'll need to | 2103 | /* We only use IF-ID interlacing. If we ever use PF-ID we'll need to |
| 2104 | * adjust the pixel_rate here. */ | 2104 | * adjust the pixel_rate here. */ |
| 2105 | 2105 | ||
| 2106 | pfit_size = intel_crtc->config.pch_pfit.size; | 2106 | if (intel_crtc->config.pch_pfit.enabled) { |
| 2107 | if (pfit_size) { | ||
| 2108 | uint64_t pipe_w, pipe_h, pfit_w, pfit_h; | 2107 | uint64_t pipe_w, pipe_h, pfit_w, pfit_h; |
| 2108 | uint32_t pfit_size = intel_crtc->config.pch_pfit.size; | ||
| 2109 | 2109 | ||
| 2110 | pipe_w = intel_crtc->config.requested_mode.hdisplay; | 2110 | pipe_w = intel_crtc->config.requested_mode.hdisplay; |
| 2111 | pipe_h = intel_crtc->config.requested_mode.vdisplay; | 2111 | pipe_h = intel_crtc->config.requested_mode.vdisplay; |
diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c index 85037b9d4934..49482fd5b76c 100644 --- a/drivers/gpu/drm/i915/intel_sdvo.c +++ b/drivers/gpu/drm/i915/intel_sdvo.c | |||
| @@ -788,6 +788,8 @@ static void intel_sdvo_get_dtd_from_mode(struct intel_sdvo_dtd *dtd, | |||
| 788 | uint16_t h_sync_offset, v_sync_offset; | 788 | uint16_t h_sync_offset, v_sync_offset; |
| 789 | int mode_clock; | 789 | int mode_clock; |
| 790 | 790 | ||
| 791 | memset(dtd, 0, sizeof(*dtd)); | ||
| 792 | |||
| 791 | width = mode->hdisplay; | 793 | width = mode->hdisplay; |
| 792 | height = mode->vdisplay; | 794 | height = mode->vdisplay; |
| 793 | 795 | ||
| @@ -830,44 +832,51 @@ static void intel_sdvo_get_dtd_from_mode(struct intel_sdvo_dtd *dtd, | |||
| 830 | if (mode->flags & DRM_MODE_FLAG_PVSYNC) | 832 | if (mode->flags & DRM_MODE_FLAG_PVSYNC) |
| 831 | dtd->part2.dtd_flags |= DTD_FLAG_VSYNC_POSITIVE; | 833 | dtd->part2.dtd_flags |= DTD_FLAG_VSYNC_POSITIVE; |
| 832 | 834 | ||
| 833 | dtd->part2.sdvo_flags = 0; | ||
| 834 | dtd->part2.v_sync_off_high = v_sync_offset & 0xc0; | 835 | dtd->part2.v_sync_off_high = v_sync_offset & 0xc0; |
| 835 | dtd->part2.reserved = 0; | ||
| 836 | } | 836 | } |
| 837 | 837 | ||
| 838 | static void intel_sdvo_get_mode_from_dtd(struct drm_display_mode * mode, | 838 | static void intel_sdvo_get_mode_from_dtd(struct drm_display_mode *pmode, |
| 839 | const struct intel_sdvo_dtd *dtd) | 839 | const struct intel_sdvo_dtd *dtd) |
| 840 | { | 840 | { |
| 841 | mode->hdisplay = dtd->part1.h_active; | 841 | struct drm_display_mode mode = {}; |
| 842 | mode->hdisplay += ((dtd->part1.h_high >> 4) & 0x0f) << 8; | 842 | |
| 843 | mode->hsync_start = mode->hdisplay + dtd->part2.h_sync_off; | 843 | mode.hdisplay = dtd->part1.h_active; |
| 844 | mode->hsync_start += (dtd->part2.sync_off_width_high & 0xc0) << 2; | 844 | mode.hdisplay += ((dtd->part1.h_high >> 4) & 0x0f) << 8; |
| 845 | mode->hsync_end = mode->hsync_start + dtd->part2.h_sync_width; | 845 | mode.hsync_start = mode.hdisplay + dtd->part2.h_sync_off; |
| 846 | mode->hsync_end += (dtd->part2.sync_off_width_high & 0x30) << 4; | 846 | mode.hsync_start += (dtd->part2.sync_off_width_high & 0xc0) << 2; |
| 847 | mode->htotal = mode->hdisplay + dtd->part1.h_blank; | 847 | mode.hsync_end = mode.hsync_start + dtd->part2.h_sync_width; |
| 848 | mode->htotal += (dtd->part1.h_high & 0xf) << 8; | 848 | mode.hsync_end += (dtd->part2.sync_off_width_high & 0x30) << 4; |
| 849 | 849 | mode.htotal = mode.hdisplay + dtd->part1.h_blank; | |
| 850 | mode->vdisplay = dtd->part1.v_active; | 850 | mode.htotal += (dtd->part1.h_high & 0xf) << 8; |
| 851 | mode->vdisplay += ((dtd->part1.v_high >> 4) & 0x0f) << 8; | 851 | |
| 852 | mode->vsync_start = mode->vdisplay; | 852 | mode.vdisplay = dtd->part1.v_active; |
| 853 | mode->vsync_start += (dtd->part2.v_sync_off_width >> 4) & 0xf; | 853 | mode.vdisplay += ((dtd->part1.v_high >> 4) & 0x0f) << 8; |
| 854 | mode->vsync_start += (dtd->part2.sync_off_width_high & 0x0c) << 2; | 854 | mode.vsync_start = mode.vdisplay; |
| 855 | mode->vsync_start += dtd->part2.v_sync_off_high & 0xc0; | 855 | mode.vsync_start += (dtd->part2.v_sync_off_width >> 4) & 0xf; |
| 856 | mode->vsync_end = mode->vsync_start + | 856 | mode.vsync_start += (dtd->part2.sync_off_width_high & 0x0c) << 2; |
| 857 | mode.vsync_start += dtd->part2.v_sync_off_high & 0xc0; | ||
| 858 | mode.vsync_end = mode.vsync_start + | ||
| 857 | (dtd->part2.v_sync_off_width & 0xf); | 859 | (dtd->part2.v_sync_off_width & 0xf); |
| 858 | mode->vsync_end += (dtd->part2.sync_off_width_high & 0x3) << 4; | 860 | mode.vsync_end += (dtd->part2.sync_off_width_high & 0x3) << 4; |
| 859 | mode->vtotal = mode->vdisplay + dtd->part1.v_blank; | 861 | mode.vtotal = mode.vdisplay + dtd->part1.v_blank; |
| 860 | mode->vtotal += (dtd->part1.v_high & 0xf) << 8; | 862 | mode.vtotal += (dtd->part1.v_high & 0xf) << 8; |
| 861 | 863 | ||
| 862 | mode->clock = dtd->part1.clock * 10; | 864 | mode.clock = dtd->part1.clock * 10; |
| 863 | 865 | ||
| 864 | mode->flags &= ~(DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC); | ||
| 865 | if (dtd->part2.dtd_flags & DTD_FLAG_INTERLACE) | 866 | if (dtd->part2.dtd_flags & DTD_FLAG_INTERLACE) |
| 866 | mode->flags |= DRM_MODE_FLAG_INTERLACE; | 867 | mode.flags |= DRM_MODE_FLAG_INTERLACE; |
| 867 | if (dtd->part2.dtd_flags & DTD_FLAG_HSYNC_POSITIVE) | 868 | if (dtd->part2.dtd_flags & DTD_FLAG_HSYNC_POSITIVE) |
| 868 | mode->flags |= DRM_MODE_FLAG_PHSYNC; | 869 | mode.flags |= DRM_MODE_FLAG_PHSYNC; |
| 870 | else | ||
| 871 | mode.flags |= DRM_MODE_FLAG_NHSYNC; | ||
| 869 | if (dtd->part2.dtd_flags & DTD_FLAG_VSYNC_POSITIVE) | 872 | if (dtd->part2.dtd_flags & DTD_FLAG_VSYNC_POSITIVE) |
| 870 | mode->flags |= DRM_MODE_FLAG_PVSYNC; | 873 | mode.flags |= DRM_MODE_FLAG_PVSYNC; |
| 874 | else | ||
| 875 | mode.flags |= DRM_MODE_FLAG_NVSYNC; | ||
| 876 | |||
| 877 | drm_mode_set_crtcinfo(&mode, 0); | ||
| 878 | |||
| 879 | drm_mode_copy(pmode, &mode); | ||
| 871 | } | 880 | } |
| 872 | 881 | ||
| 873 | static bool intel_sdvo_check_supp_encode(struct intel_sdvo *intel_sdvo) | 882 | static bool intel_sdvo_check_supp_encode(struct intel_sdvo *intel_sdvo) |
diff --git a/drivers/gpu/drm/msm/adreno/adreno_gpu.c b/drivers/gpu/drm/msm/adreno/adreno_gpu.c index a60584763b61..a0b9d8a95b16 100644 --- a/drivers/gpu/drm/msm/adreno/adreno_gpu.c +++ b/drivers/gpu/drm/msm/adreno/adreno_gpu.c | |||
| @@ -124,6 +124,8 @@ void adreno_recover(struct msm_gpu *gpu) | |||
| 124 | 124 | ||
| 125 | /* reset completed fence seqno, just discard anything pending: */ | 125 | /* reset completed fence seqno, just discard anything pending: */ |
| 126 | adreno_gpu->memptrs->fence = gpu->submitted_fence; | 126 | adreno_gpu->memptrs->fence = gpu->submitted_fence; |
| 127 | adreno_gpu->memptrs->rptr = 0; | ||
| 128 | adreno_gpu->memptrs->wptr = 0; | ||
| 127 | 129 | ||
| 128 | gpu->funcs->pm_resume(gpu); | 130 | gpu->funcs->pm_resume(gpu); |
| 129 | ret = gpu->funcs->hw_init(gpu); | 131 | ret = gpu->funcs->hw_init(gpu); |
| @@ -229,7 +231,7 @@ void adreno_idle(struct msm_gpu *gpu) | |||
| 229 | return; | 231 | return; |
| 230 | } while(time_before(jiffies, t)); | 232 | } while(time_before(jiffies, t)); |
| 231 | 233 | ||
| 232 | DRM_ERROR("timeout waiting for %s to drain ringbuffer!\n", gpu->name); | 234 | DRM_ERROR("%s: timeout waiting to drain ringbuffer!\n", gpu->name); |
| 233 | 235 | ||
| 234 | /* TODO maybe we need to reset GPU here to recover from hang? */ | 236 | /* TODO maybe we need to reset GPU here to recover from hang? */ |
| 235 | } | 237 | } |
| @@ -256,11 +258,17 @@ void adreno_wait_ring(struct msm_gpu *gpu, uint32_t ndwords) | |||
| 256 | { | 258 | { |
| 257 | struct adreno_gpu *adreno_gpu = to_adreno_gpu(gpu); | 259 | struct adreno_gpu *adreno_gpu = to_adreno_gpu(gpu); |
| 258 | uint32_t freedwords; | 260 | uint32_t freedwords; |
| 261 | unsigned long t = jiffies + ADRENO_IDLE_TIMEOUT; | ||
| 259 | do { | 262 | do { |
| 260 | uint32_t size = gpu->rb->size / 4; | 263 | uint32_t size = gpu->rb->size / 4; |
| 261 | uint32_t wptr = get_wptr(gpu->rb); | 264 | uint32_t wptr = get_wptr(gpu->rb); |
| 262 | uint32_t rptr = adreno_gpu->memptrs->rptr; | 265 | uint32_t rptr = adreno_gpu->memptrs->rptr; |
| 263 | freedwords = (rptr + (size - 1) - wptr) % size; | 266 | freedwords = (rptr + (size - 1) - wptr) % size; |
| 267 | |||
| 268 | if (time_after(jiffies, t)) { | ||
| 269 | DRM_ERROR("%s: timeout waiting for ringbuffer space\n", gpu->name); | ||
| 270 | break; | ||
| 271 | } | ||
| 264 | } while(freedwords < ndwords); | 272 | } while(freedwords < ndwords); |
| 265 | } | 273 | } |
| 266 | 274 | ||
diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c index 864c9773636b..008d772384c7 100644 --- a/drivers/gpu/drm/msm/msm_drv.c +++ b/drivers/gpu/drm/msm/msm_drv.c | |||
| @@ -499,25 +499,41 @@ int msm_wait_fence_interruptable(struct drm_device *dev, uint32_t fence, | |||
| 499 | struct timespec *timeout) | 499 | struct timespec *timeout) |
| 500 | { | 500 | { |
| 501 | struct msm_drm_private *priv = dev->dev_private; | 501 | struct msm_drm_private *priv = dev->dev_private; |
| 502 | unsigned long timeout_jiffies = timespec_to_jiffies(timeout); | ||
| 503 | unsigned long start_jiffies = jiffies; | ||
| 504 | unsigned long remaining_jiffies; | ||
| 505 | int ret; | 502 | int ret; |
| 506 | 503 | ||
| 507 | if (time_after(start_jiffies, timeout_jiffies)) | 504 | if (!priv->gpu) |
| 508 | remaining_jiffies = 0; | 505 | return 0; |
| 509 | else | 506 | |
| 510 | remaining_jiffies = timeout_jiffies - start_jiffies; | 507 | if (fence > priv->gpu->submitted_fence) { |
| 511 | 508 | DRM_ERROR("waiting on invalid fence: %u (of %u)\n", | |
| 512 | ret = wait_event_interruptible_timeout(priv->fence_event, | 509 | fence, priv->gpu->submitted_fence); |
| 513 | priv->completed_fence >= fence, | 510 | return -EINVAL; |
| 514 | remaining_jiffies); | 511 | } |
| 515 | if (ret == 0) { | 512 | |
| 516 | DBG("timeout waiting for fence: %u (completed: %u)", | 513 | if (!timeout) { |
| 517 | fence, priv->completed_fence); | 514 | /* no-wait: */ |
| 518 | ret = -ETIMEDOUT; | 515 | ret = fence_completed(dev, fence) ? 0 : -EBUSY; |
| 519 | } else if (ret != -ERESTARTSYS) { | 516 | } else { |
| 520 | ret = 0; | 517 | unsigned long timeout_jiffies = timespec_to_jiffies(timeout); |
| 518 | unsigned long start_jiffies = jiffies; | ||
| 519 | unsigned long remaining_jiffies; | ||
| 520 | |||
| 521 | if (time_after(start_jiffies, timeout_jiffies)) | ||
| 522 | remaining_jiffies = 0; | ||
| 523 | else | ||
| 524 | remaining_jiffies = timeout_jiffies - start_jiffies; | ||
| 525 | |||
| 526 | ret = wait_event_interruptible_timeout(priv->fence_event, | ||
| 527 | fence_completed(dev, fence), | ||
| 528 | remaining_jiffies); | ||
| 529 | |||
| 530 | if (ret == 0) { | ||
| 531 | DBG("timeout waiting for fence: %u (completed: %u)", | ||
| 532 | fence, priv->completed_fence); | ||
| 533 | ret = -ETIMEDOUT; | ||
| 534 | } else if (ret != -ERESTARTSYS) { | ||
| 535 | ret = 0; | ||
| 536 | } | ||
| 521 | } | 537 | } |
| 522 | 538 | ||
| 523 | return ret; | 539 | return ret; |
diff --git a/drivers/gpu/drm/msm/msm_drv.h b/drivers/gpu/drm/msm/msm_drv.h index 80d75094bf0a..df8f1d084bc1 100644 --- a/drivers/gpu/drm/msm/msm_drv.h +++ b/drivers/gpu/drm/msm/msm_drv.h | |||
| @@ -153,7 +153,7 @@ void *msm_gem_vaddr(struct drm_gem_object *obj); | |||
| 153 | int msm_gem_queue_inactive_work(struct drm_gem_object *obj, | 153 | int msm_gem_queue_inactive_work(struct drm_gem_object *obj, |
| 154 | struct work_struct *work); | 154 | struct work_struct *work); |
| 155 | void msm_gem_move_to_active(struct drm_gem_object *obj, | 155 | void msm_gem_move_to_active(struct drm_gem_object *obj, |
| 156 | struct msm_gpu *gpu, uint32_t fence); | 156 | struct msm_gpu *gpu, bool write, uint32_t fence); |
| 157 | void msm_gem_move_to_inactive(struct drm_gem_object *obj); | 157 | void msm_gem_move_to_inactive(struct drm_gem_object *obj); |
| 158 | int msm_gem_cpu_prep(struct drm_gem_object *obj, uint32_t op, | 158 | int msm_gem_cpu_prep(struct drm_gem_object *obj, uint32_t op, |
| 159 | struct timespec *timeout); | 159 | struct timespec *timeout); |
| @@ -191,6 +191,12 @@ u32 msm_readl(const void __iomem *addr); | |||
| 191 | #define DBG(fmt, ...) DRM_DEBUG(fmt"\n", ##__VA_ARGS__) | 191 | #define DBG(fmt, ...) DRM_DEBUG(fmt"\n", ##__VA_ARGS__) |
| 192 | #define VERB(fmt, ...) if (0) DRM_DEBUG(fmt"\n", ##__VA_ARGS__) | 192 | #define VERB(fmt, ...) if (0) DRM_DEBUG(fmt"\n", ##__VA_ARGS__) |
| 193 | 193 | ||
| 194 | static inline bool fence_completed(struct drm_device *dev, uint32_t fence) | ||
| 195 | { | ||
| 196 | struct msm_drm_private *priv = dev->dev_private; | ||
| 197 | return priv->completed_fence >= fence; | ||
| 198 | } | ||
| 199 | |||
| 194 | static inline int align_pitch(int width, int bpp) | 200 | static inline int align_pitch(int width, int bpp) |
| 195 | { | 201 | { |
| 196 | int bytespp = (bpp + 7) / 8; | 202 | int bytespp = (bpp + 7) / 8; |
diff --git a/drivers/gpu/drm/msm/msm_gem.c b/drivers/gpu/drm/msm/msm_gem.c index 6b5a6c8c7658..29eacfa29cfb 100644 --- a/drivers/gpu/drm/msm/msm_gem.c +++ b/drivers/gpu/drm/msm/msm_gem.c | |||
| @@ -40,9 +40,9 @@ static struct page **get_pages(struct drm_gem_object *obj) | |||
| 40 | } | 40 | } |
| 41 | 41 | ||
| 42 | msm_obj->sgt = drm_prime_pages_to_sg(p, npages); | 42 | msm_obj->sgt = drm_prime_pages_to_sg(p, npages); |
| 43 | if (!msm_obj->sgt) { | 43 | if (IS_ERR(msm_obj->sgt)) { |
| 44 | dev_err(dev->dev, "failed to allocate sgt\n"); | 44 | dev_err(dev->dev, "failed to allocate sgt\n"); |
| 45 | return ERR_PTR(-ENOMEM); | 45 | return ERR_CAST(msm_obj->sgt); |
| 46 | } | 46 | } |
| 47 | 47 | ||
| 48 | msm_obj->pages = p; | 48 | msm_obj->pages = p; |
| @@ -159,7 +159,6 @@ out_unlock: | |||
| 159 | out: | 159 | out: |
| 160 | switch (ret) { | 160 | switch (ret) { |
| 161 | case -EAGAIN: | 161 | case -EAGAIN: |
| 162 | set_need_resched(); | ||
| 163 | case 0: | 162 | case 0: |
| 164 | case -ERESTARTSYS: | 163 | case -ERESTARTSYS: |
| 165 | case -EINTR: | 164 | case -EINTR: |
| @@ -393,11 +392,14 @@ int msm_gem_queue_inactive_work(struct drm_gem_object *obj, | |||
| 393 | } | 392 | } |
| 394 | 393 | ||
| 395 | void msm_gem_move_to_active(struct drm_gem_object *obj, | 394 | void msm_gem_move_to_active(struct drm_gem_object *obj, |
| 396 | struct msm_gpu *gpu, uint32_t fence) | 395 | struct msm_gpu *gpu, bool write, uint32_t fence) |
| 397 | { | 396 | { |
| 398 | struct msm_gem_object *msm_obj = to_msm_bo(obj); | 397 | struct msm_gem_object *msm_obj = to_msm_bo(obj); |
| 399 | msm_obj->gpu = gpu; | 398 | msm_obj->gpu = gpu; |
| 400 | msm_obj->fence = fence; | 399 | if (write) |
| 400 | msm_obj->write_fence = fence; | ||
| 401 | else | ||
| 402 | msm_obj->read_fence = fence; | ||
| 401 | list_del_init(&msm_obj->mm_list); | 403 | list_del_init(&msm_obj->mm_list); |
| 402 | list_add_tail(&msm_obj->mm_list, &gpu->active_list); | 404 | list_add_tail(&msm_obj->mm_list, &gpu->active_list); |
| 403 | } | 405 | } |
| @@ -411,7 +413,8 @@ void msm_gem_move_to_inactive(struct drm_gem_object *obj) | |||
| 411 | WARN_ON(!mutex_is_locked(&dev->struct_mutex)); | 413 | WARN_ON(!mutex_is_locked(&dev->struct_mutex)); |
| 412 | 414 | ||
| 413 | msm_obj->gpu = NULL; | 415 | msm_obj->gpu = NULL; |
| 414 | msm_obj->fence = 0; | 416 | msm_obj->read_fence = 0; |
| 417 | msm_obj->write_fence = 0; | ||
| 415 | list_del_init(&msm_obj->mm_list); | 418 | list_del_init(&msm_obj->mm_list); |
| 416 | list_add_tail(&msm_obj->mm_list, &priv->inactive_list); | 419 | list_add_tail(&msm_obj->mm_list, &priv->inactive_list); |
| 417 | 420 | ||
| @@ -433,8 +436,18 @@ int msm_gem_cpu_prep(struct drm_gem_object *obj, uint32_t op, | |||
| 433 | struct msm_gem_object *msm_obj = to_msm_bo(obj); | 436 | struct msm_gem_object *msm_obj = to_msm_bo(obj); |
| 434 | int ret = 0; | 437 | int ret = 0; |
| 435 | 438 | ||
| 436 | if (is_active(msm_obj) && !(op & MSM_PREP_NOSYNC)) | 439 | if (is_active(msm_obj)) { |
| 437 | ret = msm_wait_fence_interruptable(dev, msm_obj->fence, timeout); | 440 | uint32_t fence = 0; |
| 441 | |||
| 442 | if (op & MSM_PREP_READ) | ||
| 443 | fence = msm_obj->write_fence; | ||
| 444 | if (op & MSM_PREP_WRITE) | ||
| 445 | fence = max(fence, msm_obj->read_fence); | ||
| 446 | if (op & MSM_PREP_NOSYNC) | ||
| 447 | timeout = NULL; | ||
| 448 | |||
| 449 | ret = msm_wait_fence_interruptable(dev, fence, timeout); | ||
| 450 | } | ||
| 438 | 451 | ||
| 439 | /* TODO cache maintenance */ | 452 | /* TODO cache maintenance */ |
| 440 | 453 | ||
| @@ -455,9 +468,10 @@ void msm_gem_describe(struct drm_gem_object *obj, struct seq_file *m) | |||
| 455 | uint64_t off = drm_vma_node_start(&obj->vma_node); | 468 | uint64_t off = drm_vma_node_start(&obj->vma_node); |
| 456 | 469 | ||
| 457 | WARN_ON(!mutex_is_locked(&dev->struct_mutex)); | 470 | WARN_ON(!mutex_is_locked(&dev->struct_mutex)); |
| 458 | seq_printf(m, "%08x: %c(%d) %2d (%2d) %08llx %p %d\n", | 471 | seq_printf(m, "%08x: %c(r=%u,w=%u) %2d (%2d) %08llx %p %d\n", |
| 459 | msm_obj->flags, is_active(msm_obj) ? 'A' : 'I', | 472 | msm_obj->flags, is_active(msm_obj) ? 'A' : 'I', |
| 460 | msm_obj->fence, obj->name, obj->refcount.refcount.counter, | 473 | msm_obj->read_fence, msm_obj->write_fence, |
| 474 | obj->name, obj->refcount.refcount.counter, | ||
| 461 | off, msm_obj->vaddr, obj->size); | 475 | off, msm_obj->vaddr, obj->size); |
| 462 | } | 476 | } |
| 463 | 477 | ||
diff --git a/drivers/gpu/drm/msm/msm_gem.h b/drivers/gpu/drm/msm/msm_gem.h index d746f13d283c..0676f32e2c6a 100644 --- a/drivers/gpu/drm/msm/msm_gem.h +++ b/drivers/gpu/drm/msm/msm_gem.h | |||
| @@ -36,7 +36,7 @@ struct msm_gem_object { | |||
| 36 | */ | 36 | */ |
| 37 | struct list_head mm_list; | 37 | struct list_head mm_list; |
| 38 | struct msm_gpu *gpu; /* non-null if active */ | 38 | struct msm_gpu *gpu; /* non-null if active */ |
| 39 | uint32_t fence; | 39 | uint32_t read_fence, write_fence; |
| 40 | 40 | ||
| 41 | /* Transiently in the process of submit ioctl, objects associated | 41 | /* Transiently in the process of submit ioctl, objects associated |
| 42 | * with the submit are on submit->bo_list.. this only lasts for | 42 | * with the submit are on submit->bo_list.. this only lasts for |
diff --git a/drivers/gpu/drm/msm/msm_gem_submit.c b/drivers/gpu/drm/msm/msm_gem_submit.c index 3e1ef3a00f60..5281d4bc37f7 100644 --- a/drivers/gpu/drm/msm/msm_gem_submit.c +++ b/drivers/gpu/drm/msm/msm_gem_submit.c | |||
| @@ -78,7 +78,7 @@ static int submit_lookup_objects(struct msm_gem_submit *submit, | |||
| 78 | } | 78 | } |
| 79 | 79 | ||
| 80 | if (submit_bo.flags & BO_INVALID_FLAGS) { | 80 | if (submit_bo.flags & BO_INVALID_FLAGS) { |
| 81 | DBG("invalid flags: %x", submit_bo.flags); | 81 | DRM_ERROR("invalid flags: %x\n", submit_bo.flags); |
| 82 | ret = -EINVAL; | 82 | ret = -EINVAL; |
| 83 | goto out_unlock; | 83 | goto out_unlock; |
| 84 | } | 84 | } |
| @@ -92,7 +92,7 @@ static int submit_lookup_objects(struct msm_gem_submit *submit, | |||
| 92 | */ | 92 | */ |
| 93 | obj = idr_find(&file->object_idr, submit_bo.handle); | 93 | obj = idr_find(&file->object_idr, submit_bo.handle); |
| 94 | if (!obj) { | 94 | if (!obj) { |
| 95 | DBG("invalid handle %u at index %u", submit_bo.handle, i); | 95 | DRM_ERROR("invalid handle %u at index %u\n", submit_bo.handle, i); |
| 96 | ret = -EINVAL; | 96 | ret = -EINVAL; |
| 97 | goto out_unlock; | 97 | goto out_unlock; |
| 98 | } | 98 | } |
| @@ -100,7 +100,7 @@ static int submit_lookup_objects(struct msm_gem_submit *submit, | |||
| 100 | msm_obj = to_msm_bo(obj); | 100 | msm_obj = to_msm_bo(obj); |
| 101 | 101 | ||
| 102 | if (!list_empty(&msm_obj->submit_entry)) { | 102 | if (!list_empty(&msm_obj->submit_entry)) { |
| 103 | DBG("handle %u at index %u already on submit list", | 103 | DRM_ERROR("handle %u at index %u already on submit list\n", |
| 104 | submit_bo.handle, i); | 104 | submit_bo.handle, i); |
| 105 | ret = -EINVAL; | 105 | ret = -EINVAL; |
| 106 | goto out_unlock; | 106 | goto out_unlock; |
| @@ -216,8 +216,9 @@ static int submit_bo(struct msm_gem_submit *submit, uint32_t idx, | |||
| 216 | struct msm_gem_object **obj, uint32_t *iova, bool *valid) | 216 | struct msm_gem_object **obj, uint32_t *iova, bool *valid) |
| 217 | { | 217 | { |
| 218 | if (idx >= submit->nr_bos) { | 218 | if (idx >= submit->nr_bos) { |
| 219 | DBG("invalid buffer index: %u (out of %u)", idx, submit->nr_bos); | 219 | DRM_ERROR("invalid buffer index: %u (out of %u)\n", |
| 220 | return EINVAL; | 220 | idx, submit->nr_bos); |
| 221 | return -EINVAL; | ||
| 221 | } | 222 | } |
| 222 | 223 | ||
| 223 | if (obj) | 224 | if (obj) |
| @@ -239,7 +240,7 @@ static int submit_reloc(struct msm_gem_submit *submit, struct msm_gem_object *ob | |||
| 239 | int ret; | 240 | int ret; |
| 240 | 241 | ||
| 241 | if (offset % 4) { | 242 | if (offset % 4) { |
| 242 | DBG("non-aligned cmdstream buffer: %u", offset); | 243 | DRM_ERROR("non-aligned cmdstream buffer: %u\n", offset); |
| 243 | return -EINVAL; | 244 | return -EINVAL; |
| 244 | } | 245 | } |
| 245 | 246 | ||
| @@ -266,7 +267,7 @@ static int submit_reloc(struct msm_gem_submit *submit, struct msm_gem_object *ob | |||
| 266 | return -EFAULT; | 267 | return -EFAULT; |
| 267 | 268 | ||
| 268 | if (submit_reloc.submit_offset % 4) { | 269 | if (submit_reloc.submit_offset % 4) { |
| 269 | DBG("non-aligned reloc offset: %u", | 270 | DRM_ERROR("non-aligned reloc offset: %u\n", |
| 270 | submit_reloc.submit_offset); | 271 | submit_reloc.submit_offset); |
| 271 | return -EINVAL; | 272 | return -EINVAL; |
| 272 | } | 273 | } |
| @@ -276,7 +277,7 @@ static int submit_reloc(struct msm_gem_submit *submit, struct msm_gem_object *ob | |||
| 276 | 277 | ||
| 277 | if ((off >= (obj->base.size / 4)) || | 278 | if ((off >= (obj->base.size / 4)) || |
| 278 | (off < last_offset)) { | 279 | (off < last_offset)) { |
| 279 | DBG("invalid offset %u at reloc %u", off, i); | 280 | DRM_ERROR("invalid offset %u at reloc %u\n", off, i); |
| 280 | return -EINVAL; | 281 | return -EINVAL; |
| 281 | } | 282 | } |
| 282 | 283 | ||
| @@ -374,14 +375,15 @@ int msm_ioctl_gem_submit(struct drm_device *dev, void *data, | |||
| 374 | goto out; | 375 | goto out; |
| 375 | 376 | ||
| 376 | if (submit_cmd.size % 4) { | 377 | if (submit_cmd.size % 4) { |
| 377 | DBG("non-aligned cmdstream buffer size: %u", | 378 | DRM_ERROR("non-aligned cmdstream buffer size: %u\n", |
| 378 | submit_cmd.size); | 379 | submit_cmd.size); |
| 379 | ret = -EINVAL; | 380 | ret = -EINVAL; |
| 380 | goto out; | 381 | goto out; |
| 381 | } | 382 | } |
| 382 | 383 | ||
| 383 | if (submit_cmd.size >= msm_obj->base.size) { | 384 | if ((submit_cmd.size + submit_cmd.submit_offset) >= |
| 384 | DBG("invalid cmdstream size: %u", submit_cmd.size); | 385 | msm_obj->base.size) { |
| 386 | DRM_ERROR("invalid cmdstream size: %u\n", submit_cmd.size); | ||
| 385 | ret = -EINVAL; | 387 | ret = -EINVAL; |
| 386 | goto out; | 388 | goto out; |
| 387 | } | 389 | } |
diff --git a/drivers/gpu/drm/msm/msm_gpu.c b/drivers/gpu/drm/msm/msm_gpu.c index e1e1ec9321ff..3bab937965d1 100644 --- a/drivers/gpu/drm/msm/msm_gpu.c +++ b/drivers/gpu/drm/msm/msm_gpu.c | |||
| @@ -29,13 +29,14 @@ | |||
| 29 | static void bs_init(struct msm_gpu *gpu, struct platform_device *pdev) | 29 | static void bs_init(struct msm_gpu *gpu, struct platform_device *pdev) |
| 30 | { | 30 | { |
| 31 | struct drm_device *dev = gpu->dev; | 31 | struct drm_device *dev = gpu->dev; |
| 32 | struct kgsl_device_platform_data *pdata = pdev->dev.platform_data; | 32 | struct kgsl_device_platform_data *pdata; |
| 33 | 33 | ||
| 34 | if (!pdev) { | 34 | if (!pdev) { |
| 35 | dev_err(dev->dev, "could not find dtv pdata\n"); | 35 | dev_err(dev->dev, "could not find dtv pdata\n"); |
| 36 | return; | 36 | return; |
| 37 | } | 37 | } |
| 38 | 38 | ||
| 39 | pdata = pdev->dev.platform_data; | ||
| 39 | if (pdata->bus_scale_table) { | 40 | if (pdata->bus_scale_table) { |
| 40 | gpu->bsc = msm_bus_scale_register_client(pdata->bus_scale_table); | 41 | gpu->bsc = msm_bus_scale_register_client(pdata->bus_scale_table); |
| 41 | DBG("bus scale client: %08x", gpu->bsc); | 42 | DBG("bus scale client: %08x", gpu->bsc); |
| @@ -230,6 +231,8 @@ static void hangcheck_timer_reset(struct msm_gpu *gpu) | |||
| 230 | static void hangcheck_handler(unsigned long data) | 231 | static void hangcheck_handler(unsigned long data) |
| 231 | { | 232 | { |
| 232 | struct msm_gpu *gpu = (struct msm_gpu *)data; | 233 | struct msm_gpu *gpu = (struct msm_gpu *)data; |
| 234 | struct drm_device *dev = gpu->dev; | ||
| 235 | struct msm_drm_private *priv = dev->dev_private; | ||
| 233 | uint32_t fence = gpu->funcs->last_fence(gpu); | 236 | uint32_t fence = gpu->funcs->last_fence(gpu); |
| 234 | 237 | ||
| 235 | if (fence != gpu->hangcheck_fence) { | 238 | if (fence != gpu->hangcheck_fence) { |
| @@ -237,14 +240,22 @@ static void hangcheck_handler(unsigned long data) | |||
| 237 | gpu->hangcheck_fence = fence; | 240 | gpu->hangcheck_fence = fence; |
| 238 | } else if (fence < gpu->submitted_fence) { | 241 | } else if (fence < gpu->submitted_fence) { |
| 239 | /* no progress and not done.. hung! */ | 242 | /* no progress and not done.. hung! */ |
| 240 | struct msm_drm_private *priv = gpu->dev->dev_private; | ||
| 241 | gpu->hangcheck_fence = fence; | 243 | gpu->hangcheck_fence = fence; |
| 244 | dev_err(dev->dev, "%s: hangcheck detected gpu lockup!\n", | ||
| 245 | gpu->name); | ||
| 246 | dev_err(dev->dev, "%s: completed fence: %u\n", | ||
| 247 | gpu->name, fence); | ||
| 248 | dev_err(dev->dev, "%s: submitted fence: %u\n", | ||
| 249 | gpu->name, gpu->submitted_fence); | ||
| 242 | queue_work(priv->wq, &gpu->recover_work); | 250 | queue_work(priv->wq, &gpu->recover_work); |
| 243 | } | 251 | } |
| 244 | 252 | ||
| 245 | /* if still more pending work, reset the hangcheck timer: */ | 253 | /* if still more pending work, reset the hangcheck timer: */ |
| 246 | if (gpu->submitted_fence > gpu->hangcheck_fence) | 254 | if (gpu->submitted_fence > gpu->hangcheck_fence) |
| 247 | hangcheck_timer_reset(gpu); | 255 | hangcheck_timer_reset(gpu); |
| 256 | |||
| 257 | /* workaround for missing irq: */ | ||
| 258 | queue_work(priv->wq, &gpu->retire_work); | ||
| 248 | } | 259 | } |
| 249 | 260 | ||
| 250 | /* | 261 | /* |
| @@ -265,7 +276,8 @@ static void retire_worker(struct work_struct *work) | |||
| 265 | obj = list_first_entry(&gpu->active_list, | 276 | obj = list_first_entry(&gpu->active_list, |
| 266 | struct msm_gem_object, mm_list); | 277 | struct msm_gem_object, mm_list); |
| 267 | 278 | ||
| 268 | if (obj->fence <= fence) { | 279 | if ((obj->read_fence <= fence) && |
| 280 | (obj->write_fence <= fence)) { | ||
| 269 | /* move to inactive: */ | 281 | /* move to inactive: */ |
| 270 | msm_gem_move_to_inactive(&obj->base); | 282 | msm_gem_move_to_inactive(&obj->base); |
| 271 | msm_gem_put_iova(&obj->base, gpu->id); | 283 | msm_gem_put_iova(&obj->base, gpu->id); |
| @@ -321,7 +333,11 @@ int msm_gpu_submit(struct msm_gpu *gpu, struct msm_gem_submit *submit, | |||
| 321 | submit->gpu->id, &iova); | 333 | submit->gpu->id, &iova); |
| 322 | } | 334 | } |
| 323 | 335 | ||
| 324 | msm_gem_move_to_active(&msm_obj->base, gpu, submit->fence); | 336 | if (submit->bos[i].flags & MSM_SUBMIT_BO_READ) |
| 337 | msm_gem_move_to_active(&msm_obj->base, gpu, false, submit->fence); | ||
| 338 | |||
| 339 | if (submit->bos[i].flags & MSM_SUBMIT_BO_WRITE) | ||
| 340 | msm_gem_move_to_active(&msm_obj->base, gpu, true, submit->fence); | ||
| 325 | } | 341 | } |
| 326 | hangcheck_timer_reset(gpu); | 342 | hangcheck_timer_reset(gpu); |
| 327 | mutex_unlock(&dev->struct_mutex); | 343 | mutex_unlock(&dev->struct_mutex); |
diff --git a/drivers/gpu/drm/nouveau/core/subdev/bios/init.c b/drivers/gpu/drm/nouveau/core/subdev/bios/init.c index 2e11ea02cf87..57cda2a1437b 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/bios/init.c +++ b/drivers/gpu/drm/nouveau/core/subdev/bios/init.c | |||
| @@ -579,8 +579,22 @@ static void | |||
| 579 | init_reserved(struct nvbios_init *init) | 579 | init_reserved(struct nvbios_init *init) |
| 580 | { | 580 | { |
| 581 | u8 opcode = nv_ro08(init->bios, init->offset); | 581 | u8 opcode = nv_ro08(init->bios, init->offset); |
| 582 | trace("RESERVED\t0x%02x\n", opcode); | 582 | u8 length, i; |
| 583 | init->offset += 1; | 583 | |
| 584 | switch (opcode) { | ||
| 585 | case 0xaa: | ||
| 586 | length = 4; | ||
| 587 | break; | ||
| 588 | default: | ||
| 589 | length = 1; | ||
| 590 | break; | ||
| 591 | } | ||
| 592 | |||
| 593 | trace("RESERVED 0x%02x\t", opcode); | ||
| 594 | for (i = 1; i < length; i++) | ||
| 595 | cont(" 0x%02x", nv_ro08(init->bios, init->offset + i)); | ||
| 596 | cont("\n"); | ||
| 597 | init->offset += length; | ||
| 584 | } | 598 | } |
| 585 | 599 | ||
| 586 | /** | 600 | /** |
| @@ -1437,7 +1451,7 @@ init_configure_mem(struct nvbios_init *init) | |||
| 1437 | data = init_rdvgai(init, 0x03c4, 0x01); | 1451 | data = init_rdvgai(init, 0x03c4, 0x01); |
| 1438 | init_wrvgai(init, 0x03c4, 0x01, data | 0x20); | 1452 | init_wrvgai(init, 0x03c4, 0x01, data | 0x20); |
| 1439 | 1453 | ||
| 1440 | while ((addr = nv_ro32(bios, sdata)) != 0xffffffff) { | 1454 | for (; (addr = nv_ro32(bios, sdata)) != 0xffffffff; sdata += 4) { |
| 1441 | switch (addr) { | 1455 | switch (addr) { |
| 1442 | case 0x10021c: /* CKE_NORMAL */ | 1456 | case 0x10021c: /* CKE_NORMAL */ |
| 1443 | case 0x1002d0: /* CMD_REFRESH */ | 1457 | case 0x1002d0: /* CMD_REFRESH */ |
| @@ -2135,6 +2149,7 @@ static struct nvbios_init_opcode { | |||
| 2135 | [0x99] = { init_zm_auxch }, | 2149 | [0x99] = { init_zm_auxch }, |
| 2136 | [0x9a] = { init_i2c_long_if }, | 2150 | [0x9a] = { init_i2c_long_if }, |
| 2137 | [0xa9] = { init_gpio_ne }, | 2151 | [0xa9] = { init_gpio_ne }, |
| 2152 | [0xaa] = { init_reserved }, | ||
| 2138 | }; | 2153 | }; |
| 2139 | 2154 | ||
| 2140 | #define init_opcode_nr (sizeof(init_opcode) / sizeof(init_opcode[0])) | 2155 | #define init_opcode_nr (sizeof(init_opcode) / sizeof(init_opcode[0])) |
diff --git a/drivers/gpu/drm/nouveau/nouveau_display.c b/drivers/gpu/drm/nouveau/nouveau_display.c index d2712e6e5d31..7848590f5568 100644 --- a/drivers/gpu/drm/nouveau/nouveau_display.c +++ b/drivers/gpu/drm/nouveau/nouveau_display.c | |||
| @@ -278,7 +278,6 @@ nouveau_display_create(struct drm_device *dev) | |||
| 278 | { | 278 | { |
| 279 | struct nouveau_drm *drm = nouveau_drm(dev); | 279 | struct nouveau_drm *drm = nouveau_drm(dev); |
| 280 | struct nouveau_display *disp; | 280 | struct nouveau_display *disp; |
| 281 | u32 pclass = dev->pdev->class >> 8; | ||
| 282 | int ret, gen; | 281 | int ret, gen; |
| 283 | 282 | ||
| 284 | disp = drm->display = kzalloc(sizeof(*disp), GFP_KERNEL); | 283 | disp = drm->display = kzalloc(sizeof(*disp), GFP_KERNEL); |
| @@ -340,29 +339,25 @@ nouveau_display_create(struct drm_device *dev) | |||
| 340 | drm_kms_helper_poll_init(dev); | 339 | drm_kms_helper_poll_init(dev); |
| 341 | drm_kms_helper_poll_disable(dev); | 340 | drm_kms_helper_poll_disable(dev); |
| 342 | 341 | ||
| 343 | if (nouveau_modeset == 1 || | 342 | if (drm->vbios.dcb.entries) { |
| 344 | (nouveau_modeset < 0 && pclass == PCI_CLASS_DISPLAY_VGA)) { | 343 | if (nv_device(drm->device)->card_type < NV_50) |
| 345 | if (drm->vbios.dcb.entries) { | 344 | ret = nv04_display_create(dev); |
| 346 | if (nv_device(drm->device)->card_type < NV_50) | 345 | else |
| 347 | ret = nv04_display_create(dev); | 346 | ret = nv50_display_create(dev); |
| 348 | else | 347 | } else { |
| 349 | ret = nv50_display_create(dev); | 348 | ret = 0; |
| 350 | } else { | 349 | } |
| 351 | ret = 0; | ||
| 352 | } | ||
| 353 | |||
| 354 | if (ret) | ||
| 355 | goto disp_create_err; | ||
| 356 | 350 | ||
| 357 | if (dev->mode_config.num_crtc) { | 351 | if (ret) |
| 358 | ret = drm_vblank_init(dev, dev->mode_config.num_crtc); | 352 | goto disp_create_err; |
| 359 | if (ret) | ||
| 360 | goto vblank_err; | ||
| 361 | } | ||
| 362 | 353 | ||
| 363 | nouveau_backlight_init(dev); | 354 | if (dev->mode_config.num_crtc) { |
| 355 | ret = drm_vblank_init(dev, dev->mode_config.num_crtc); | ||
| 356 | if (ret) | ||
| 357 | goto vblank_err; | ||
| 364 | } | 358 | } |
| 365 | 359 | ||
| 360 | nouveau_backlight_init(dev); | ||
| 366 | return 0; | 361 | return 0; |
| 367 | 362 | ||
| 368 | vblank_err: | 363 | vblank_err: |
diff --git a/drivers/gpu/drm/nouveau/nouveau_fbcon.c b/drivers/gpu/drm/nouveau/nouveau_fbcon.c index 8f6d63d7edd3..a86ecf65c164 100644 --- a/drivers/gpu/drm/nouveau/nouveau_fbcon.c +++ b/drivers/gpu/drm/nouveau/nouveau_fbcon.c | |||
| @@ -454,7 +454,8 @@ nouveau_fbcon_init(struct drm_device *dev) | |||
| 454 | int preferred_bpp; | 454 | int preferred_bpp; |
| 455 | int ret; | 455 | int ret; |
| 456 | 456 | ||
| 457 | if (!dev->mode_config.num_crtc) | 457 | if (!dev->mode_config.num_crtc || |
| 458 | (dev->pdev->class >> 8) != PCI_CLASS_DISPLAY_VGA) | ||
| 458 | return 0; | 459 | return 0; |
| 459 | 460 | ||
| 460 | fbcon = kzalloc(sizeof(struct nouveau_fbdev), GFP_KERNEL); | 461 | fbcon = kzalloc(sizeof(struct nouveau_fbdev), GFP_KERNEL); |
diff --git a/drivers/gpu/drm/nouveau/nouveau_sgdma.c b/drivers/gpu/drm/nouveau/nouveau_sgdma.c index ca5492ac2da5..0843ebc910d4 100644 --- a/drivers/gpu/drm/nouveau/nouveau_sgdma.c +++ b/drivers/gpu/drm/nouveau/nouveau_sgdma.c | |||
| @@ -104,9 +104,7 @@ nouveau_sgdma_create_ttm(struct ttm_bo_device *bdev, | |||
| 104 | else | 104 | else |
| 105 | nvbe->ttm.ttm.func = &nv50_sgdma_backend; | 105 | nvbe->ttm.ttm.func = &nv50_sgdma_backend; |
| 106 | 106 | ||
| 107 | if (ttm_dma_tt_init(&nvbe->ttm, bdev, size, page_flags, dummy_read_page)) { | 107 | if (ttm_dma_tt_init(&nvbe->ttm, bdev, size, page_flags, dummy_read_page)) |
| 108 | kfree(nvbe); | ||
| 109 | return NULL; | 108 | return NULL; |
| 110 | } | ||
| 111 | return &nvbe->ttm.ttm; | 109 | return &nvbe->ttm.ttm; |
| 112 | } | 110 | } |
diff --git a/drivers/gpu/drm/radeon/atombios_encoders.c b/drivers/gpu/drm/radeon/atombios_encoders.c index dfac7965ea28..32923d2f6002 100644 --- a/drivers/gpu/drm/radeon/atombios_encoders.c +++ b/drivers/gpu/drm/radeon/atombios_encoders.c | |||
| @@ -707,8 +707,9 @@ atombios_get_encoder_mode(struct drm_encoder *encoder) | |||
| 707 | switch (connector->connector_type) { | 707 | switch (connector->connector_type) { |
| 708 | case DRM_MODE_CONNECTOR_DVII: | 708 | case DRM_MODE_CONNECTOR_DVII: |
| 709 | case DRM_MODE_CONNECTOR_HDMIB: /* HDMI-B is basically DL-DVI; analog works fine */ | 709 | case DRM_MODE_CONNECTOR_HDMIB: /* HDMI-B is basically DL-DVI; analog works fine */ |
| 710 | if (drm_detect_hdmi_monitor(radeon_connector->edid) && | 710 | if ((radeon_connector->audio == RADEON_AUDIO_ENABLE) || |
| 711 | radeon_audio) | 711 | (drm_detect_hdmi_monitor(radeon_connector->edid) && |
| 712 | (radeon_connector->audio == RADEON_AUDIO_AUTO))) | ||
| 712 | return ATOM_ENCODER_MODE_HDMI; | 713 | return ATOM_ENCODER_MODE_HDMI; |
| 713 | else if (radeon_connector->use_digital) | 714 | else if (radeon_connector->use_digital) |
| 714 | return ATOM_ENCODER_MODE_DVI; | 715 | return ATOM_ENCODER_MODE_DVI; |
| @@ -718,8 +719,9 @@ atombios_get_encoder_mode(struct drm_encoder *encoder) | |||
| 718 | case DRM_MODE_CONNECTOR_DVID: | 719 | case DRM_MODE_CONNECTOR_DVID: |
| 719 | case DRM_MODE_CONNECTOR_HDMIA: | 720 | case DRM_MODE_CONNECTOR_HDMIA: |
| 720 | default: | 721 | default: |
| 721 | if (drm_detect_hdmi_monitor(radeon_connector->edid) && | 722 | if ((radeon_connector->audio == RADEON_AUDIO_ENABLE) || |
| 722 | radeon_audio) | 723 | (drm_detect_hdmi_monitor(radeon_connector->edid) && |
| 724 | (radeon_connector->audio == RADEON_AUDIO_AUTO))) | ||
| 723 | return ATOM_ENCODER_MODE_HDMI; | 725 | return ATOM_ENCODER_MODE_HDMI; |
| 724 | else | 726 | else |
| 725 | return ATOM_ENCODER_MODE_DVI; | 727 | return ATOM_ENCODER_MODE_DVI; |
| @@ -732,8 +734,9 @@ atombios_get_encoder_mode(struct drm_encoder *encoder) | |||
| 732 | if ((dig_connector->dp_sink_type == CONNECTOR_OBJECT_ID_DISPLAYPORT) || | 734 | if ((dig_connector->dp_sink_type == CONNECTOR_OBJECT_ID_DISPLAYPORT) || |
| 733 | (dig_connector->dp_sink_type == CONNECTOR_OBJECT_ID_eDP)) | 735 | (dig_connector->dp_sink_type == CONNECTOR_OBJECT_ID_eDP)) |
| 734 | return ATOM_ENCODER_MODE_DP; | 736 | return ATOM_ENCODER_MODE_DP; |
| 735 | else if (drm_detect_hdmi_monitor(radeon_connector->edid) && | 737 | else if ((radeon_connector->audio == RADEON_AUDIO_ENABLE) || |
| 736 | radeon_audio) | 738 | (drm_detect_hdmi_monitor(radeon_connector->edid) && |
| 739 | (radeon_connector->audio == RADEON_AUDIO_AUTO))) | ||
| 737 | return ATOM_ENCODER_MODE_HDMI; | 740 | return ATOM_ENCODER_MODE_HDMI; |
| 738 | else | 741 | else |
| 739 | return ATOM_ENCODER_MODE_DVI; | 742 | return ATOM_ENCODER_MODE_DVI; |
| @@ -1647,8 +1650,12 @@ radeon_atom_encoder_dpms_dig(struct drm_encoder *encoder, int mode) | |||
| 1647 | atombios_dig_encoder_setup(encoder, ATOM_ENABLE, 0); | 1650 | atombios_dig_encoder_setup(encoder, ATOM_ENABLE, 0); |
| 1648 | atombios_dig_transmitter_setup(encoder, ATOM_TRANSMITTER_ACTION_SETUP, 0, 0); | 1651 | atombios_dig_transmitter_setup(encoder, ATOM_TRANSMITTER_ACTION_SETUP, 0, 0); |
| 1649 | atombios_dig_transmitter_setup(encoder, ATOM_TRANSMITTER_ACTION_ENABLE, 0, 0); | 1652 | atombios_dig_transmitter_setup(encoder, ATOM_TRANSMITTER_ACTION_ENABLE, 0, 0); |
| 1650 | /* some early dce3.2 boards have a bug in their transmitter control table */ | 1653 | /* some dce3.x boards have a bug in their transmitter control table. |
| 1651 | if ((rdev->family != CHIP_RV710) && (rdev->family != CHIP_RV730)) | 1654 | * ACTION_ENABLE_OUTPUT can probably be dropped since ACTION_ENABLE |
| 1655 | * does the same thing and more. | ||
| 1656 | */ | ||
| 1657 | if ((rdev->family != CHIP_RV710) && (rdev->family != CHIP_RV730) && | ||
| 1658 | (rdev->family != CHIP_RS880)) | ||
| 1652 | atombios_dig_transmitter_setup(encoder, ATOM_TRANSMITTER_ACTION_ENABLE_OUTPUT, 0, 0); | 1659 | atombios_dig_transmitter_setup(encoder, ATOM_TRANSMITTER_ACTION_ENABLE_OUTPUT, 0, 0); |
| 1653 | } | 1660 | } |
| 1654 | if (ENCODER_MODE_IS_DP(atombios_get_encoder_mode(encoder)) && connector) { | 1661 | if (ENCODER_MODE_IS_DP(atombios_get_encoder_mode(encoder)) && connector) { |
diff --git a/drivers/gpu/drm/radeon/btc_dpm.c b/drivers/gpu/drm/radeon/btc_dpm.c index 084e69414fd1..05ff315e8e9e 100644 --- a/drivers/gpu/drm/radeon/btc_dpm.c +++ b/drivers/gpu/drm/radeon/btc_dpm.c | |||
| @@ -2340,12 +2340,6 @@ int btc_dpm_set_power_state(struct radeon_device *rdev) | |||
| 2340 | return ret; | 2340 | return ret; |
| 2341 | } | 2341 | } |
| 2342 | 2342 | ||
| 2343 | ret = rv770_dpm_force_performance_level(rdev, RADEON_DPM_FORCED_LEVEL_AUTO); | ||
| 2344 | if (ret) { | ||
| 2345 | DRM_ERROR("rv770_dpm_force_performance_level failed\n"); | ||
| 2346 | return ret; | ||
| 2347 | } | ||
| 2348 | |||
| 2349 | return 0; | 2343 | return 0; |
| 2350 | } | 2344 | } |
| 2351 | 2345 | ||
diff --git a/drivers/gpu/drm/radeon/ci_dpm.c b/drivers/gpu/drm/radeon/ci_dpm.c index 3cce533397c6..899627443030 100644 --- a/drivers/gpu/drm/radeon/ci_dpm.c +++ b/drivers/gpu/drm/radeon/ci_dpm.c | |||
| @@ -4748,12 +4748,6 @@ int ci_dpm_set_power_state(struct radeon_device *rdev) | |||
| 4748 | if (pi->pcie_performance_request) | 4748 | if (pi->pcie_performance_request) |
| 4749 | ci_notify_link_speed_change_after_state_change(rdev, new_ps, old_ps); | 4749 | ci_notify_link_speed_change_after_state_change(rdev, new_ps, old_ps); |
| 4750 | 4750 | ||
| 4751 | ret = ci_dpm_force_performance_level(rdev, RADEON_DPM_FORCED_LEVEL_AUTO); | ||
| 4752 | if (ret) { | ||
| 4753 | DRM_ERROR("ci_dpm_force_performance_level failed\n"); | ||
| 4754 | return ret; | ||
| 4755 | } | ||
| 4756 | |||
| 4757 | cik_update_cg(rdev, (RADEON_CG_BLOCK_GFX | | 4751 | cik_update_cg(rdev, (RADEON_CG_BLOCK_GFX | |
| 4758 | RADEON_CG_BLOCK_MC | | 4752 | RADEON_CG_BLOCK_MC | |
| 4759 | RADEON_CG_BLOCK_SDMA | | 4753 | RADEON_CG_BLOCK_SDMA | |
diff --git a/drivers/gpu/drm/radeon/ci_smc.c b/drivers/gpu/drm/radeon/ci_smc.c index 53b43dd3cf1e..252e10a41cf5 100644 --- a/drivers/gpu/drm/radeon/ci_smc.c +++ b/drivers/gpu/drm/radeon/ci_smc.c | |||
| @@ -47,10 +47,11 @@ int ci_copy_bytes_to_smc(struct radeon_device *rdev, | |||
| 47 | u32 smc_start_address, | 47 | u32 smc_start_address, |
| 48 | const u8 *src, u32 byte_count, u32 limit) | 48 | const u8 *src, u32 byte_count, u32 limit) |
| 49 | { | 49 | { |
| 50 | unsigned long flags; | ||
| 50 | u32 data, original_data; | 51 | u32 data, original_data; |
| 51 | u32 addr; | 52 | u32 addr; |
| 52 | u32 extra_shift; | 53 | u32 extra_shift; |
| 53 | int ret; | 54 | int ret = 0; |
| 54 | 55 | ||
| 55 | if (smc_start_address & 3) | 56 | if (smc_start_address & 3) |
| 56 | return -EINVAL; | 57 | return -EINVAL; |
| @@ -59,13 +60,14 @@ int ci_copy_bytes_to_smc(struct radeon_device *rdev, | |||
| 59 | 60 | ||
| 60 | addr = smc_start_address; | 61 | addr = smc_start_address; |
| 61 | 62 | ||
| 63 | spin_lock_irqsave(&rdev->smc_idx_lock, flags); | ||
| 62 | while (byte_count >= 4) { | 64 | while (byte_count >= 4) { |
| 63 | /* SMC address space is BE */ | 65 | /* SMC address space is BE */ |
| 64 | data = (src[0] << 24) | (src[1] << 16) | (src[2] << 8) | src[3]; | 66 | data = (src[0] << 24) | (src[1] << 16) | (src[2] << 8) | src[3]; |
| 65 | 67 | ||
| 66 | ret = ci_set_smc_sram_address(rdev, addr, limit); | 68 | ret = ci_set_smc_sram_address(rdev, addr, limit); |
| 67 | if (ret) | 69 | if (ret) |
| 68 | return ret; | 70 | goto done; |
| 69 | 71 | ||
| 70 | WREG32(SMC_IND_DATA_0, data); | 72 | WREG32(SMC_IND_DATA_0, data); |
| 71 | 73 | ||
| @@ -80,7 +82,7 @@ int ci_copy_bytes_to_smc(struct radeon_device *rdev, | |||
| 80 | 82 | ||
| 81 | ret = ci_set_smc_sram_address(rdev, addr, limit); | 83 | ret = ci_set_smc_sram_address(rdev, addr, limit); |
| 82 | if (ret) | 84 | if (ret) |
| 83 | return ret; | 85 | goto done; |
| 84 | 86 | ||
| 85 | original_data = RREG32(SMC_IND_DATA_0); | 87 | original_data = RREG32(SMC_IND_DATA_0); |
| 86 | 88 | ||
| @@ -97,11 +99,15 @@ int ci_copy_bytes_to_smc(struct radeon_device *rdev, | |||
| 97 | 99 | ||
| 98 | ret = ci_set_smc_sram_address(rdev, addr, limit); | 100 | ret = ci_set_smc_sram_address(rdev, addr, limit); |
| 99 | if (ret) | 101 | if (ret) |
| 100 | return ret; | 102 | goto done; |
| 101 | 103 | ||
| 102 | WREG32(SMC_IND_DATA_0, data); | 104 | WREG32(SMC_IND_DATA_0, data); |
| 103 | } | 105 | } |
| 104 | return 0; | 106 | |
| 107 | done: | ||
| 108 | spin_unlock_irqrestore(&rdev->smc_idx_lock, flags); | ||
| 109 | |||
| 110 | return ret; | ||
| 105 | } | 111 | } |
| 106 | 112 | ||
| 107 | void ci_start_smc(struct radeon_device *rdev) | 113 | void ci_start_smc(struct radeon_device *rdev) |
| @@ -197,6 +203,7 @@ PPSMC_Result ci_wait_for_smc_inactive(struct radeon_device *rdev) | |||
| 197 | 203 | ||
| 198 | int ci_load_smc_ucode(struct radeon_device *rdev, u32 limit) | 204 | int ci_load_smc_ucode(struct radeon_device *rdev, u32 limit) |
| 199 | { | 205 | { |
| 206 | unsigned long flags; | ||
| 200 | u32 ucode_start_address; | 207 | u32 ucode_start_address; |
| 201 | u32 ucode_size; | 208 | u32 ucode_size; |
| 202 | const u8 *src; | 209 | const u8 *src; |
| @@ -219,6 +226,7 @@ int ci_load_smc_ucode(struct radeon_device *rdev, u32 limit) | |||
| 219 | return -EINVAL; | 226 | return -EINVAL; |
| 220 | 227 | ||
| 221 | src = (const u8 *)rdev->smc_fw->data; | 228 | src = (const u8 *)rdev->smc_fw->data; |
| 229 | spin_lock_irqsave(&rdev->smc_idx_lock, flags); | ||
| 222 | WREG32(SMC_IND_INDEX_0, ucode_start_address); | 230 | WREG32(SMC_IND_INDEX_0, ucode_start_address); |
| 223 | WREG32_P(SMC_IND_ACCESS_CNTL, AUTO_INCREMENT_IND_0, ~AUTO_INCREMENT_IND_0); | 231 | WREG32_P(SMC_IND_ACCESS_CNTL, AUTO_INCREMENT_IND_0, ~AUTO_INCREMENT_IND_0); |
| 224 | while (ucode_size >= 4) { | 232 | while (ucode_size >= 4) { |
| @@ -231,6 +239,7 @@ int ci_load_smc_ucode(struct radeon_device *rdev, u32 limit) | |||
| 231 | ucode_size -= 4; | 239 | ucode_size -= 4; |
| 232 | } | 240 | } |
| 233 | WREG32_P(SMC_IND_ACCESS_CNTL, 0, ~AUTO_INCREMENT_IND_0); | 241 | WREG32_P(SMC_IND_ACCESS_CNTL, 0, ~AUTO_INCREMENT_IND_0); |
| 242 | spin_unlock_irqrestore(&rdev->smc_idx_lock, flags); | ||
| 234 | 243 | ||
| 235 | return 0; | 244 | return 0; |
| 236 | } | 245 | } |
| @@ -238,25 +247,29 @@ int ci_load_smc_ucode(struct radeon_device *rdev, u32 limit) | |||
| 238 | int ci_read_smc_sram_dword(struct radeon_device *rdev, | 247 | int ci_read_smc_sram_dword(struct radeon_device *rdev, |
| 239 | u32 smc_address, u32 *value, u32 limit) | 248 | u32 smc_address, u32 *value, u32 limit) |
| 240 | { | 249 | { |
| 250 | unsigned long flags; | ||
| 241 | int ret; | 251 | int ret; |
| 242 | 252 | ||
| 253 | spin_lock_irqsave(&rdev->smc_idx_lock, flags); | ||
| 243 | ret = ci_set_smc_sram_address(rdev, smc_address, limit); | 254 | ret = ci_set_smc_sram_address(rdev, smc_address, limit); |
| 244 | if (ret) | 255 | if (ret == 0) |
| 245 | return ret; | 256 | *value = RREG32(SMC_IND_DATA_0); |
| 257 | spin_unlock_irqrestore(&rdev->smc_idx_lock, flags); | ||
| 246 | 258 | ||
| 247 | *value = RREG32(SMC_IND_DATA_0); | 259 | return ret; |
| 248 | return 0; | ||
| 249 | } | 260 | } |
| 250 | 261 | ||
| 251 | int ci_write_smc_sram_dword(struct radeon_device *rdev, | 262 | int ci_write_smc_sram_dword(struct radeon_device *rdev, |
| 252 | u32 smc_address, u32 value, u32 limit) | 263 | u32 smc_address, u32 value, u32 limit) |
| 253 | { | 264 | { |
| 265 | unsigned long flags; | ||
| 254 | int ret; | 266 | int ret; |
| 255 | 267 | ||
| 268 | spin_lock_irqsave(&rdev->smc_idx_lock, flags); | ||
| 256 | ret = ci_set_smc_sram_address(rdev, smc_address, limit); | 269 | ret = ci_set_smc_sram_address(rdev, smc_address, limit); |
| 257 | if (ret) | 270 | if (ret == 0) |
| 258 | return ret; | 271 | WREG32(SMC_IND_DATA_0, value); |
| 272 | spin_unlock_irqrestore(&rdev->smc_idx_lock, flags); | ||
| 259 | 273 | ||
| 260 | WREG32(SMC_IND_DATA_0, value); | 274 | return ret; |
| 261 | return 0; | ||
| 262 | } | 275 | } |
diff --git a/drivers/gpu/drm/radeon/cik.c b/drivers/gpu/drm/radeon/cik.c index a3bba0587276..adbdb6503b05 100644 --- a/drivers/gpu/drm/radeon/cik.c +++ b/drivers/gpu/drm/radeon/cik.c | |||
| @@ -77,6 +77,8 @@ static void cik_pcie_gen3_enable(struct radeon_device *rdev); | |||
| 77 | static void cik_program_aspm(struct radeon_device *rdev); | 77 | static void cik_program_aspm(struct radeon_device *rdev); |
| 78 | static void cik_init_pg(struct radeon_device *rdev); | 78 | static void cik_init_pg(struct radeon_device *rdev); |
| 79 | static void cik_init_cg(struct radeon_device *rdev); | 79 | static void cik_init_cg(struct radeon_device *rdev); |
| 80 | static void cik_enable_gui_idle_interrupt(struct radeon_device *rdev, | ||
| 81 | bool enable); | ||
| 80 | 82 | ||
| 81 | /* get temperature in millidegrees */ | 83 | /* get temperature in millidegrees */ |
| 82 | int ci_get_temp(struct radeon_device *rdev) | 84 | int ci_get_temp(struct radeon_device *rdev) |
| @@ -120,20 +122,27 @@ int kv_get_temp(struct radeon_device *rdev) | |||
| 120 | */ | 122 | */ |
| 121 | u32 cik_pciep_rreg(struct radeon_device *rdev, u32 reg) | 123 | u32 cik_pciep_rreg(struct radeon_device *rdev, u32 reg) |
| 122 | { | 124 | { |
| 125 | unsigned long flags; | ||
| 123 | u32 r; | 126 | u32 r; |
| 124 | 127 | ||
| 128 | spin_lock_irqsave(&rdev->pciep_idx_lock, flags); | ||
| 125 | WREG32(PCIE_INDEX, reg); | 129 | WREG32(PCIE_INDEX, reg); |
| 126 | (void)RREG32(PCIE_INDEX); | 130 | (void)RREG32(PCIE_INDEX); |
| 127 | r = RREG32(PCIE_DATA); | 131 | r = RREG32(PCIE_DATA); |
| 132 | spin_unlock_irqrestore(&rdev->pciep_idx_lock, flags); | ||
| 128 | return r; | 133 | return r; |
| 129 | } | 134 | } |
| 130 | 135 | ||
| 131 | void cik_pciep_wreg(struct radeon_device *rdev, u32 reg, u32 v) | 136 | void cik_pciep_wreg(struct radeon_device *rdev, u32 reg, u32 v) |
| 132 | { | 137 | { |
| 138 | unsigned long flags; | ||
| 139 | |||
| 140 | spin_lock_irqsave(&rdev->pciep_idx_lock, flags); | ||
| 133 | WREG32(PCIE_INDEX, reg); | 141 | WREG32(PCIE_INDEX, reg); |
| 134 | (void)RREG32(PCIE_INDEX); | 142 | (void)RREG32(PCIE_INDEX); |
| 135 | WREG32(PCIE_DATA, v); | 143 | WREG32(PCIE_DATA, v); |
| 136 | (void)RREG32(PCIE_DATA); | 144 | (void)RREG32(PCIE_DATA); |
| 145 | spin_unlock_irqrestore(&rdev->pciep_idx_lock, flags); | ||
| 137 | } | 146 | } |
| 138 | 147 | ||
| 139 | static const u32 spectre_rlc_save_restore_register_list[] = | 148 | static const u32 spectre_rlc_save_restore_register_list[] = |
| @@ -2722,7 +2731,8 @@ static void cik_gpu_init(struct radeon_device *rdev) | |||
| 2722 | } else if ((rdev->pdev->device == 0x1309) || | 2731 | } else if ((rdev->pdev->device == 0x1309) || |
| 2723 | (rdev->pdev->device == 0x130A) || | 2732 | (rdev->pdev->device == 0x130A) || |
| 2724 | (rdev->pdev->device == 0x130D) || | 2733 | (rdev->pdev->device == 0x130D) || |
| 2725 | (rdev->pdev->device == 0x1313)) { | 2734 | (rdev->pdev->device == 0x1313) || |
| 2735 | (rdev->pdev->device == 0x131D)) { | ||
| 2726 | rdev->config.cik.max_cu_per_sh = 6; | 2736 | rdev->config.cik.max_cu_per_sh = 6; |
| 2727 | rdev->config.cik.max_backends_per_se = 2; | 2737 | rdev->config.cik.max_backends_per_se = 2; |
| 2728 | } else if ((rdev->pdev->device == 0x1306) || | 2738 | } else if ((rdev->pdev->device == 0x1306) || |
| @@ -4013,6 +4023,8 @@ static int cik_cp_resume(struct radeon_device *rdev) | |||
| 4013 | { | 4023 | { |
| 4014 | int r; | 4024 | int r; |
| 4015 | 4025 | ||
| 4026 | cik_enable_gui_idle_interrupt(rdev, false); | ||
| 4027 | |||
| 4016 | r = cik_cp_load_microcode(rdev); | 4028 | r = cik_cp_load_microcode(rdev); |
| 4017 | if (r) | 4029 | if (r) |
| 4018 | return r; | 4030 | return r; |
| @@ -4024,6 +4036,8 @@ static int cik_cp_resume(struct radeon_device *rdev) | |||
| 4024 | if (r) | 4036 | if (r) |
| 4025 | return r; | 4037 | return r; |
| 4026 | 4038 | ||
| 4039 | cik_enable_gui_idle_interrupt(rdev, true); | ||
| 4040 | |||
| 4027 | return 0; | 4041 | return 0; |
| 4028 | } | 4042 | } |
| 4029 | 4043 | ||
| @@ -5376,7 +5390,9 @@ static void cik_enable_hdp_ls(struct radeon_device *rdev, | |||
| 5376 | void cik_update_cg(struct radeon_device *rdev, | 5390 | void cik_update_cg(struct radeon_device *rdev, |
| 5377 | u32 block, bool enable) | 5391 | u32 block, bool enable) |
| 5378 | { | 5392 | { |
| 5393 | |||
| 5379 | if (block & RADEON_CG_BLOCK_GFX) { | 5394 | if (block & RADEON_CG_BLOCK_GFX) { |
| 5395 | cik_enable_gui_idle_interrupt(rdev, false); | ||
| 5380 | /* order matters! */ | 5396 | /* order matters! */ |
| 5381 | if (enable) { | 5397 | if (enable) { |
| 5382 | cik_enable_mgcg(rdev, true); | 5398 | cik_enable_mgcg(rdev, true); |
| @@ -5385,6 +5401,7 @@ void cik_update_cg(struct radeon_device *rdev, | |||
| 5385 | cik_enable_cgcg(rdev, false); | 5401 | cik_enable_cgcg(rdev, false); |
| 5386 | cik_enable_mgcg(rdev, false); | 5402 | cik_enable_mgcg(rdev, false); |
| 5387 | } | 5403 | } |
| 5404 | cik_enable_gui_idle_interrupt(rdev, true); | ||
| 5388 | } | 5405 | } |
| 5389 | 5406 | ||
| 5390 | if (block & RADEON_CG_BLOCK_MC) { | 5407 | if (block & RADEON_CG_BLOCK_MC) { |
| @@ -5541,7 +5558,7 @@ static void cik_enable_gfx_cgpg(struct radeon_device *rdev, | |||
| 5541 | { | 5558 | { |
| 5542 | u32 data, orig; | 5559 | u32 data, orig; |
| 5543 | 5560 | ||
| 5544 | if (enable && (rdev->pg_flags & RADEON_PG_SUPPORT_GFX_CG)) { | 5561 | if (enable && (rdev->pg_flags & RADEON_PG_SUPPORT_GFX_PG)) { |
| 5545 | orig = data = RREG32(RLC_PG_CNTL); | 5562 | orig = data = RREG32(RLC_PG_CNTL); |
| 5546 | data |= GFX_PG_ENABLE; | 5563 | data |= GFX_PG_ENABLE; |
| 5547 | if (orig != data) | 5564 | if (orig != data) |
| @@ -5805,7 +5822,7 @@ static void cik_init_pg(struct radeon_device *rdev) | |||
| 5805 | if (rdev->pg_flags) { | 5822 | if (rdev->pg_flags) { |
| 5806 | cik_enable_sck_slowdown_on_pu(rdev, true); | 5823 | cik_enable_sck_slowdown_on_pu(rdev, true); |
| 5807 | cik_enable_sck_slowdown_on_pd(rdev, true); | 5824 | cik_enable_sck_slowdown_on_pd(rdev, true); |
| 5808 | if (rdev->pg_flags & RADEON_PG_SUPPORT_GFX_CG) { | 5825 | if (rdev->pg_flags & RADEON_PG_SUPPORT_GFX_PG) { |
| 5809 | cik_init_gfx_cgpg(rdev); | 5826 | cik_init_gfx_cgpg(rdev); |
| 5810 | cik_enable_cp_pg(rdev, true); | 5827 | cik_enable_cp_pg(rdev, true); |
| 5811 | cik_enable_gds_pg(rdev, true); | 5828 | cik_enable_gds_pg(rdev, true); |
| @@ -5819,7 +5836,7 @@ static void cik_fini_pg(struct radeon_device *rdev) | |||
| 5819 | { | 5836 | { |
| 5820 | if (rdev->pg_flags) { | 5837 | if (rdev->pg_flags) { |
| 5821 | cik_update_gfx_pg(rdev, false); | 5838 | cik_update_gfx_pg(rdev, false); |
| 5822 | if (rdev->pg_flags & RADEON_PG_SUPPORT_GFX_CG) { | 5839 | if (rdev->pg_flags & RADEON_PG_SUPPORT_GFX_PG) { |
| 5823 | cik_enable_cp_pg(rdev, false); | 5840 | cik_enable_cp_pg(rdev, false); |
| 5824 | cik_enable_gds_pg(rdev, false); | 5841 | cik_enable_gds_pg(rdev, false); |
| 5825 | } | 5842 | } |
| @@ -5895,7 +5912,9 @@ static void cik_disable_interrupt_state(struct radeon_device *rdev) | |||
| 5895 | u32 tmp; | 5912 | u32 tmp; |
| 5896 | 5913 | ||
| 5897 | /* gfx ring */ | 5914 | /* gfx ring */ |
| 5898 | WREG32(CP_INT_CNTL_RING0, CNTX_BUSY_INT_ENABLE | CNTX_EMPTY_INT_ENABLE); | 5915 | tmp = RREG32(CP_INT_CNTL_RING0) & |
| 5916 | (CNTX_BUSY_INT_ENABLE | CNTX_EMPTY_INT_ENABLE); | ||
| 5917 | WREG32(CP_INT_CNTL_RING0, tmp); | ||
| 5899 | /* sdma */ | 5918 | /* sdma */ |
| 5900 | tmp = RREG32(SDMA0_CNTL + SDMA0_REGISTER_OFFSET) & ~TRAP_ENABLE; | 5919 | tmp = RREG32(SDMA0_CNTL + SDMA0_REGISTER_OFFSET) & ~TRAP_ENABLE; |
| 5901 | WREG32(SDMA0_CNTL + SDMA0_REGISTER_OFFSET, tmp); | 5920 | WREG32(SDMA0_CNTL + SDMA0_REGISTER_OFFSET, tmp); |
| @@ -6036,8 +6055,7 @@ static int cik_irq_init(struct radeon_device *rdev) | |||
| 6036 | */ | 6055 | */ |
| 6037 | int cik_irq_set(struct radeon_device *rdev) | 6056 | int cik_irq_set(struct radeon_device *rdev) |
| 6038 | { | 6057 | { |
| 6039 | u32 cp_int_cntl = CNTX_BUSY_INT_ENABLE | CNTX_EMPTY_INT_ENABLE | | 6058 | u32 cp_int_cntl; |
| 6040 | PRIV_INSTR_INT_ENABLE | PRIV_REG_INT_ENABLE; | ||
| 6041 | u32 cp_m1p0, cp_m1p1, cp_m1p2, cp_m1p3; | 6059 | u32 cp_m1p0, cp_m1p1, cp_m1p2, cp_m1p3; |
| 6042 | u32 cp_m2p0, cp_m2p1, cp_m2p2, cp_m2p3; | 6060 | u32 cp_m2p0, cp_m2p1, cp_m2p2, cp_m2p3; |
| 6043 | u32 crtc1 = 0, crtc2 = 0, crtc3 = 0, crtc4 = 0, crtc5 = 0, crtc6 = 0; | 6061 | u32 crtc1 = 0, crtc2 = 0, crtc3 = 0, crtc4 = 0, crtc5 = 0, crtc6 = 0; |
| @@ -6058,6 +6076,10 @@ int cik_irq_set(struct radeon_device *rdev) | |||
| 6058 | return 0; | 6076 | return 0; |
| 6059 | } | 6077 | } |
| 6060 | 6078 | ||
| 6079 | cp_int_cntl = RREG32(CP_INT_CNTL_RING0) & | ||
| 6080 | (CNTX_BUSY_INT_ENABLE | CNTX_EMPTY_INT_ENABLE); | ||
| 6081 | cp_int_cntl |= PRIV_INSTR_INT_ENABLE | PRIV_REG_INT_ENABLE; | ||
| 6082 | |||
| 6061 | hpd1 = RREG32(DC_HPD1_INT_CONTROL) & ~DC_HPDx_INT_EN; | 6083 | hpd1 = RREG32(DC_HPD1_INT_CONTROL) & ~DC_HPDx_INT_EN; |
| 6062 | hpd2 = RREG32(DC_HPD2_INT_CONTROL) & ~DC_HPDx_INT_EN; | 6084 | hpd2 = RREG32(DC_HPD2_INT_CONTROL) & ~DC_HPDx_INT_EN; |
| 6063 | hpd3 = RREG32(DC_HPD3_INT_CONTROL) & ~DC_HPDx_INT_EN; | 6085 | hpd3 = RREG32(DC_HPD3_INT_CONTROL) & ~DC_HPDx_INT_EN; |
diff --git a/drivers/gpu/drm/radeon/cypress_dpm.c b/drivers/gpu/drm/radeon/cypress_dpm.c index 95a66db08d9b..91bb470de0a3 100644 --- a/drivers/gpu/drm/radeon/cypress_dpm.c +++ b/drivers/gpu/drm/radeon/cypress_dpm.c | |||
| @@ -2014,12 +2014,6 @@ int cypress_dpm_set_power_state(struct radeon_device *rdev) | |||
| 2014 | if (eg_pi->pcie_performance_request) | 2014 | if (eg_pi->pcie_performance_request) |
| 2015 | cypress_notify_link_speed_change_after_state_change(rdev, new_ps, old_ps); | 2015 | cypress_notify_link_speed_change_after_state_change(rdev, new_ps, old_ps); |
| 2016 | 2016 | ||
| 2017 | ret = rv770_dpm_force_performance_level(rdev, RADEON_DPM_FORCED_LEVEL_AUTO); | ||
| 2018 | if (ret) { | ||
| 2019 | DRM_ERROR("rv770_dpm_force_performance_level failed\n"); | ||
| 2020 | return ret; | ||
| 2021 | } | ||
| 2022 | |||
| 2023 | return 0; | 2017 | return 0; |
| 2024 | } | 2018 | } |
| 2025 | 2019 | ||
diff --git a/drivers/gpu/drm/radeon/dce6_afmt.c b/drivers/gpu/drm/radeon/dce6_afmt.c index 8953255e894b..85a69d2ea3d2 100644 --- a/drivers/gpu/drm/radeon/dce6_afmt.c +++ b/drivers/gpu/drm/radeon/dce6_afmt.c | |||
| @@ -28,22 +28,30 @@ | |||
| 28 | static u32 dce6_endpoint_rreg(struct radeon_device *rdev, | 28 | static u32 dce6_endpoint_rreg(struct radeon_device *rdev, |
| 29 | u32 block_offset, u32 reg) | 29 | u32 block_offset, u32 reg) |
| 30 | { | 30 | { |
| 31 | unsigned long flags; | ||
| 31 | u32 r; | 32 | u32 r; |
| 32 | 33 | ||
| 34 | spin_lock_irqsave(&rdev->end_idx_lock, flags); | ||
| 33 | WREG32(AZ_F0_CODEC_ENDPOINT_INDEX + block_offset, reg); | 35 | WREG32(AZ_F0_CODEC_ENDPOINT_INDEX + block_offset, reg); |
| 34 | r = RREG32(AZ_F0_CODEC_ENDPOINT_DATA + block_offset); | 36 | r = RREG32(AZ_F0_CODEC_ENDPOINT_DATA + block_offset); |
| 37 | spin_unlock_irqrestore(&rdev->end_idx_lock, flags); | ||
| 38 | |||
| 35 | return r; | 39 | return r; |
| 36 | } | 40 | } |
| 37 | 41 | ||
| 38 | static void dce6_endpoint_wreg(struct radeon_device *rdev, | 42 | static void dce6_endpoint_wreg(struct radeon_device *rdev, |
| 39 | u32 block_offset, u32 reg, u32 v) | 43 | u32 block_offset, u32 reg, u32 v) |
| 40 | { | 44 | { |
| 45 | unsigned long flags; | ||
| 46 | |||
| 47 | spin_lock_irqsave(&rdev->end_idx_lock, flags); | ||
| 41 | if (ASIC_IS_DCE8(rdev)) | 48 | if (ASIC_IS_DCE8(rdev)) |
| 42 | WREG32(AZ_F0_CODEC_ENDPOINT_INDEX + block_offset, reg); | 49 | WREG32(AZ_F0_CODEC_ENDPOINT_INDEX + block_offset, reg); |
| 43 | else | 50 | else |
| 44 | WREG32(AZ_F0_CODEC_ENDPOINT_INDEX + block_offset, | 51 | WREG32(AZ_F0_CODEC_ENDPOINT_INDEX + block_offset, |
| 45 | AZ_ENDPOINT_REG_WRITE_EN | AZ_ENDPOINT_REG_INDEX(reg)); | 52 | AZ_ENDPOINT_REG_WRITE_EN | AZ_ENDPOINT_REG_INDEX(reg)); |
| 46 | WREG32(AZ_F0_CODEC_ENDPOINT_DATA + block_offset, v); | 53 | WREG32(AZ_F0_CODEC_ENDPOINT_DATA + block_offset, v); |
| 54 | spin_unlock_irqrestore(&rdev->end_idx_lock, flags); | ||
| 47 | } | 55 | } |
| 48 | 56 | ||
| 49 | #define RREG32_ENDPOINT(block, reg) dce6_endpoint_rreg(rdev, (block), (reg)) | 57 | #define RREG32_ENDPOINT(block, reg) dce6_endpoint_rreg(rdev, (block), (reg)) |
| @@ -86,12 +94,12 @@ void dce6_afmt_select_pin(struct drm_encoder *encoder) | |||
| 86 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); | 94 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); |
| 87 | struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv; | 95 | struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv; |
| 88 | u32 offset = dig->afmt->offset; | 96 | u32 offset = dig->afmt->offset; |
| 89 | u32 id = dig->afmt->pin->id; | ||
| 90 | 97 | ||
| 91 | if (!dig->afmt->pin) | 98 | if (!dig->afmt->pin) |
| 92 | return; | 99 | return; |
| 93 | 100 | ||
| 94 | WREG32(AFMT_AUDIO_SRC_CONTROL + offset, AFMT_AUDIO_SRC_SELECT(id)); | 101 | WREG32(AFMT_AUDIO_SRC_CONTROL + offset, |
| 102 | AFMT_AUDIO_SRC_SELECT(dig->afmt->pin->id)); | ||
| 95 | } | 103 | } |
| 96 | 104 | ||
| 97 | void dce6_afmt_write_speaker_allocation(struct drm_encoder *encoder) | 105 | void dce6_afmt_write_speaker_allocation(struct drm_encoder *encoder) |
diff --git a/drivers/gpu/drm/radeon/kv_dpm.c b/drivers/gpu/drm/radeon/kv_dpm.c index ecd60809db4e..71399065db04 100644 --- a/drivers/gpu/drm/radeon/kv_dpm.c +++ b/drivers/gpu/drm/radeon/kv_dpm.c | |||
| @@ -40,6 +40,7 @@ static int kv_calculate_dpm_settings(struct radeon_device *rdev); | |||
| 40 | static void kv_enable_new_levels(struct radeon_device *rdev); | 40 | static void kv_enable_new_levels(struct radeon_device *rdev); |
| 41 | static void kv_program_nbps_index_settings(struct radeon_device *rdev, | 41 | static void kv_program_nbps_index_settings(struct radeon_device *rdev, |
| 42 | struct radeon_ps *new_rps); | 42 | struct radeon_ps *new_rps); |
| 43 | static int kv_set_enabled_level(struct radeon_device *rdev, u32 level); | ||
| 43 | static int kv_set_enabled_levels(struct radeon_device *rdev); | 44 | static int kv_set_enabled_levels(struct radeon_device *rdev); |
| 44 | static int kv_force_dpm_highest(struct radeon_device *rdev); | 45 | static int kv_force_dpm_highest(struct radeon_device *rdev); |
| 45 | static int kv_force_dpm_lowest(struct radeon_device *rdev); | 46 | static int kv_force_dpm_lowest(struct radeon_device *rdev); |
| @@ -519,7 +520,7 @@ static int kv_set_dpm_boot_state(struct radeon_device *rdev) | |||
| 519 | 520 | ||
| 520 | static void kv_program_vc(struct radeon_device *rdev) | 521 | static void kv_program_vc(struct radeon_device *rdev) |
| 521 | { | 522 | { |
| 522 | WREG32_SMC(CG_FTV_0, 0x3FFFC000); | 523 | WREG32_SMC(CG_FTV_0, 0x3FFFC100); |
| 523 | } | 524 | } |
| 524 | 525 | ||
| 525 | static void kv_clear_vc(struct radeon_device *rdev) | 526 | static void kv_clear_vc(struct radeon_device *rdev) |
| @@ -638,7 +639,10 @@ static int kv_force_lowest_valid(struct radeon_device *rdev) | |||
| 638 | 639 | ||
| 639 | static int kv_unforce_levels(struct radeon_device *rdev) | 640 | static int kv_unforce_levels(struct radeon_device *rdev) |
| 640 | { | 641 | { |
| 641 | return kv_notify_message_to_smu(rdev, PPSMC_MSG_NoForcedLevel); | 642 | if (rdev->family == CHIP_KABINI) |
| 643 | return kv_notify_message_to_smu(rdev, PPSMC_MSG_NoForcedLevel); | ||
| 644 | else | ||
| 645 | return kv_set_enabled_levels(rdev); | ||
| 642 | } | 646 | } |
| 643 | 647 | ||
| 644 | static int kv_update_sclk_t(struct radeon_device *rdev) | 648 | static int kv_update_sclk_t(struct radeon_device *rdev) |
| @@ -667,9 +671,8 @@ static int kv_program_bootup_state(struct radeon_device *rdev) | |||
| 667 | &rdev->pm.dpm.dyn_state.vddc_dependency_on_sclk; | 671 | &rdev->pm.dpm.dyn_state.vddc_dependency_on_sclk; |
| 668 | 672 | ||
| 669 | if (table && table->count) { | 673 | if (table && table->count) { |
| 670 | for (i = pi->graphics_dpm_level_count - 1; i >= 0; i--) { | 674 | for (i = pi->graphics_dpm_level_count - 1; i > 0; i--) { |
| 671 | if ((table->entries[i].clk == pi->boot_pl.sclk) || | 675 | if (table->entries[i].clk == pi->boot_pl.sclk) |
| 672 | (i == 0)) | ||
| 673 | break; | 676 | break; |
| 674 | } | 677 | } |
| 675 | 678 | ||
| @@ -682,9 +685,8 @@ static int kv_program_bootup_state(struct radeon_device *rdev) | |||
| 682 | if (table->num_max_dpm_entries == 0) | 685 | if (table->num_max_dpm_entries == 0) |
| 683 | return -EINVAL; | 686 | return -EINVAL; |
| 684 | 687 | ||
| 685 | for (i = pi->graphics_dpm_level_count - 1; i >= 0; i--) { | 688 | for (i = pi->graphics_dpm_level_count - 1; i > 0; i--) { |
| 686 | if ((table->entries[i].sclk_frequency == pi->boot_pl.sclk) || | 689 | if (table->entries[i].sclk_frequency == pi->boot_pl.sclk) |
| 687 | (i == 0)) | ||
| 688 | break; | 690 | break; |
| 689 | } | 691 | } |
| 690 | 692 | ||
| @@ -1078,6 +1080,13 @@ static int kv_enable_ulv(struct radeon_device *rdev, bool enable) | |||
| 1078 | PPSMC_MSG_EnableULV : PPSMC_MSG_DisableULV); | 1080 | PPSMC_MSG_EnableULV : PPSMC_MSG_DisableULV); |
| 1079 | } | 1081 | } |
| 1080 | 1082 | ||
| 1083 | static void kv_reset_acp_boot_level(struct radeon_device *rdev) | ||
| 1084 | { | ||
| 1085 | struct kv_power_info *pi = kv_get_pi(rdev); | ||
| 1086 | |||
| 1087 | pi->acp_boot_level = 0xff; | ||
| 1088 | } | ||
| 1089 | |||
| 1081 | static void kv_update_current_ps(struct radeon_device *rdev, | 1090 | static void kv_update_current_ps(struct radeon_device *rdev, |
| 1082 | struct radeon_ps *rps) | 1091 | struct radeon_ps *rps) |
| 1083 | { | 1092 | { |
| @@ -1100,6 +1109,18 @@ static void kv_update_requested_ps(struct radeon_device *rdev, | |||
| 1100 | pi->requested_rps.ps_priv = &pi->requested_ps; | 1109 | pi->requested_rps.ps_priv = &pi->requested_ps; |
| 1101 | } | 1110 | } |
| 1102 | 1111 | ||
| 1112 | void kv_dpm_enable_bapm(struct radeon_device *rdev, bool enable) | ||
| 1113 | { | ||
| 1114 | struct kv_power_info *pi = kv_get_pi(rdev); | ||
| 1115 | int ret; | ||
| 1116 | |||
| 1117 | if (pi->bapm_enable) { | ||
| 1118 | ret = kv_smc_bapm_enable(rdev, enable); | ||
| 1119 | if (ret) | ||
| 1120 | DRM_ERROR("kv_smc_bapm_enable failed\n"); | ||
| 1121 | } | ||
| 1122 | } | ||
| 1123 | |||
| 1103 | int kv_dpm_enable(struct radeon_device *rdev) | 1124 | int kv_dpm_enable(struct radeon_device *rdev) |
| 1104 | { | 1125 | { |
| 1105 | struct kv_power_info *pi = kv_get_pi(rdev); | 1126 | struct kv_power_info *pi = kv_get_pi(rdev); |
| @@ -1192,6 +1213,8 @@ int kv_dpm_enable(struct radeon_device *rdev) | |||
| 1192 | return ret; | 1213 | return ret; |
| 1193 | } | 1214 | } |
| 1194 | 1215 | ||
| 1216 | kv_reset_acp_boot_level(rdev); | ||
| 1217 | |||
| 1195 | if (rdev->irq.installed && | 1218 | if (rdev->irq.installed && |
| 1196 | r600_is_internal_thermal_sensor(rdev->pm.int_thermal_type)) { | 1219 | r600_is_internal_thermal_sensor(rdev->pm.int_thermal_type)) { |
| 1197 | ret = kv_set_thermal_temperature_range(rdev, R600_TEMP_RANGE_MIN, R600_TEMP_RANGE_MAX); | 1220 | ret = kv_set_thermal_temperature_range(rdev, R600_TEMP_RANGE_MIN, R600_TEMP_RANGE_MAX); |
| @@ -1203,6 +1226,12 @@ int kv_dpm_enable(struct radeon_device *rdev) | |||
| 1203 | radeon_irq_set(rdev); | 1226 | radeon_irq_set(rdev); |
| 1204 | } | 1227 | } |
| 1205 | 1228 | ||
| 1229 | ret = kv_smc_bapm_enable(rdev, false); | ||
| 1230 | if (ret) { | ||
| 1231 | DRM_ERROR("kv_smc_bapm_enable failed\n"); | ||
| 1232 | return ret; | ||
| 1233 | } | ||
| 1234 | |||
| 1206 | /* powerdown unused blocks for now */ | 1235 | /* powerdown unused blocks for now */ |
| 1207 | kv_dpm_powergate_acp(rdev, true); | 1236 | kv_dpm_powergate_acp(rdev, true); |
| 1208 | kv_dpm_powergate_samu(rdev, true); | 1237 | kv_dpm_powergate_samu(rdev, true); |
| @@ -1226,6 +1255,8 @@ void kv_dpm_disable(struct radeon_device *rdev) | |||
| 1226 | RADEON_CG_BLOCK_BIF | | 1255 | RADEON_CG_BLOCK_BIF | |
| 1227 | RADEON_CG_BLOCK_HDP), false); | 1256 | RADEON_CG_BLOCK_HDP), false); |
| 1228 | 1257 | ||
| 1258 | kv_smc_bapm_enable(rdev, false); | ||
| 1259 | |||
| 1229 | /* powerup blocks */ | 1260 | /* powerup blocks */ |
| 1230 | kv_dpm_powergate_acp(rdev, false); | 1261 | kv_dpm_powergate_acp(rdev, false); |
| 1231 | kv_dpm_powergate_samu(rdev, false); | 1262 | kv_dpm_powergate_samu(rdev, false); |
| @@ -1450,6 +1481,39 @@ static int kv_update_samu_dpm(struct radeon_device *rdev, bool gate) | |||
| 1450 | return kv_enable_samu_dpm(rdev, !gate); | 1481 | return kv_enable_samu_dpm(rdev, !gate); |
| 1451 | } | 1482 | } |
| 1452 | 1483 | ||
| 1484 | static u8 kv_get_acp_boot_level(struct radeon_device *rdev) | ||
| 1485 | { | ||
| 1486 | u8 i; | ||
| 1487 | struct radeon_clock_voltage_dependency_table *table = | ||
| 1488 | &rdev->pm.dpm.dyn_state.acp_clock_voltage_dependency_table; | ||
| 1489 | |||
| 1490 | for (i = 0; i < table->count; i++) { | ||
| 1491 | if (table->entries[i].clk >= 0) /* XXX */ | ||
| 1492 | break; | ||
| 1493 | } | ||
| 1494 | |||
| 1495 | if (i >= table->count) | ||
| 1496 | i = table->count - 1; | ||
| 1497 | |||
| 1498 | return i; | ||
| 1499 | } | ||
| 1500 | |||
| 1501 | static void kv_update_acp_boot_level(struct radeon_device *rdev) | ||
| 1502 | { | ||
| 1503 | struct kv_power_info *pi = kv_get_pi(rdev); | ||
| 1504 | u8 acp_boot_level; | ||
| 1505 | |||
| 1506 | if (!pi->caps_stable_p_state) { | ||
| 1507 | acp_boot_level = kv_get_acp_boot_level(rdev); | ||
| 1508 | if (acp_boot_level != pi->acp_boot_level) { | ||
| 1509 | pi->acp_boot_level = acp_boot_level; | ||
| 1510 | kv_send_msg_to_smc_with_parameter(rdev, | ||
| 1511 | PPSMC_MSG_ACPDPM_SetEnabledMask, | ||
| 1512 | (1 << pi->acp_boot_level)); | ||
| 1513 | } | ||
| 1514 | } | ||
| 1515 | } | ||
| 1516 | |||
| 1453 | static int kv_update_acp_dpm(struct radeon_device *rdev, bool gate) | 1517 | static int kv_update_acp_dpm(struct radeon_device *rdev, bool gate) |
| 1454 | { | 1518 | { |
| 1455 | struct kv_power_info *pi = kv_get_pi(rdev); | 1519 | struct kv_power_info *pi = kv_get_pi(rdev); |
| @@ -1461,7 +1525,7 @@ static int kv_update_acp_dpm(struct radeon_device *rdev, bool gate) | |||
| 1461 | if (pi->caps_stable_p_state) | 1525 | if (pi->caps_stable_p_state) |
| 1462 | pi->acp_boot_level = table->count - 1; | 1526 | pi->acp_boot_level = table->count - 1; |
| 1463 | else | 1527 | else |
| 1464 | pi->acp_boot_level = 0; | 1528 | pi->acp_boot_level = kv_get_acp_boot_level(rdev); |
| 1465 | 1529 | ||
| 1466 | ret = kv_copy_bytes_to_smc(rdev, | 1530 | ret = kv_copy_bytes_to_smc(rdev, |
| 1467 | pi->dpm_table_start + | 1531 | pi->dpm_table_start + |
| @@ -1588,13 +1652,11 @@ static void kv_set_valid_clock_range(struct radeon_device *rdev, | |||
| 1588 | } | 1652 | } |
| 1589 | } | 1653 | } |
| 1590 | 1654 | ||
| 1591 | for (i = pi->graphics_dpm_level_count - 1; i >= 0; i--) { | 1655 | for (i = pi->graphics_dpm_level_count - 1; i > 0; i--) { |
| 1592 | if ((table->entries[i].clk <= new_ps->levels[new_ps->num_levels -1].sclk) || | 1656 | if (table->entries[i].clk <= new_ps->levels[new_ps->num_levels - 1].sclk) |
| 1593 | (i == 0)) { | ||
| 1594 | pi->highest_valid = i; | ||
| 1595 | break; | 1657 | break; |
| 1596 | } | ||
| 1597 | } | 1658 | } |
| 1659 | pi->highest_valid = i; | ||
| 1598 | 1660 | ||
| 1599 | if (pi->lowest_valid > pi->highest_valid) { | 1661 | if (pi->lowest_valid > pi->highest_valid) { |
| 1600 | if ((new_ps->levels[0].sclk - table->entries[pi->highest_valid].clk) > | 1662 | if ((new_ps->levels[0].sclk - table->entries[pi->highest_valid].clk) > |
| @@ -1615,14 +1677,12 @@ static void kv_set_valid_clock_range(struct radeon_device *rdev, | |||
| 1615 | } | 1677 | } |
| 1616 | } | 1678 | } |
| 1617 | 1679 | ||
| 1618 | for (i = pi->graphics_dpm_level_count - 1; i >= 0; i--) { | 1680 | for (i = pi->graphics_dpm_level_count - 1; i > 0; i--) { |
| 1619 | if (table->entries[i].sclk_frequency <= | 1681 | if (table->entries[i].sclk_frequency <= |
| 1620 | new_ps->levels[new_ps->num_levels - 1].sclk || | 1682 | new_ps->levels[new_ps->num_levels - 1].sclk) |
| 1621 | i == 0) { | ||
| 1622 | pi->highest_valid = i; | ||
| 1623 | break; | 1683 | break; |
| 1624 | } | ||
| 1625 | } | 1684 | } |
| 1685 | pi->highest_valid = i; | ||
| 1626 | 1686 | ||
| 1627 | if (pi->lowest_valid > pi->highest_valid) { | 1687 | if (pi->lowest_valid > pi->highest_valid) { |
| 1628 | if ((new_ps->levels[0].sclk - | 1688 | if ((new_ps->levels[0].sclk - |
| @@ -1724,6 +1784,14 @@ int kv_dpm_set_power_state(struct radeon_device *rdev) | |||
| 1724 | RADEON_CG_BLOCK_BIF | | 1784 | RADEON_CG_BLOCK_BIF | |
| 1725 | RADEON_CG_BLOCK_HDP), false); | 1785 | RADEON_CG_BLOCK_HDP), false); |
| 1726 | 1786 | ||
| 1787 | if (pi->bapm_enable) { | ||
| 1788 | ret = kv_smc_bapm_enable(rdev, rdev->pm.dpm.ac_power); | ||
| 1789 | if (ret) { | ||
| 1790 | DRM_ERROR("kv_smc_bapm_enable failed\n"); | ||
| 1791 | return ret; | ||
| 1792 | } | ||
| 1793 | } | ||
| 1794 | |||
| 1727 | if (rdev->family == CHIP_KABINI) { | 1795 | if (rdev->family == CHIP_KABINI) { |
| 1728 | if (pi->enable_dpm) { | 1796 | if (pi->enable_dpm) { |
| 1729 | kv_set_valid_clock_range(rdev, new_ps); | 1797 | kv_set_valid_clock_range(rdev, new_ps); |
| @@ -1775,6 +1843,7 @@ int kv_dpm_set_power_state(struct radeon_device *rdev) | |||
| 1775 | return ret; | 1843 | return ret; |
| 1776 | } | 1844 | } |
| 1777 | #endif | 1845 | #endif |
| 1846 | kv_update_acp_boot_level(rdev); | ||
| 1778 | kv_update_sclk_t(rdev); | 1847 | kv_update_sclk_t(rdev); |
| 1779 | kv_enable_nb_dpm(rdev); | 1848 | kv_enable_nb_dpm(rdev); |
| 1780 | } | 1849 | } |
| @@ -1785,7 +1854,6 @@ int kv_dpm_set_power_state(struct radeon_device *rdev) | |||
| 1785 | RADEON_CG_BLOCK_BIF | | 1854 | RADEON_CG_BLOCK_BIF | |
| 1786 | RADEON_CG_BLOCK_HDP), true); | 1855 | RADEON_CG_BLOCK_HDP), true); |
| 1787 | 1856 | ||
| 1788 | rdev->pm.dpm.forced_level = RADEON_DPM_FORCED_LEVEL_AUTO; | ||
| 1789 | return 0; | 1857 | return 0; |
| 1790 | } | 1858 | } |
| 1791 | 1859 | ||
| @@ -1806,12 +1874,23 @@ void kv_dpm_setup_asic(struct radeon_device *rdev) | |||
| 1806 | 1874 | ||
| 1807 | void kv_dpm_reset_asic(struct radeon_device *rdev) | 1875 | void kv_dpm_reset_asic(struct radeon_device *rdev) |
| 1808 | { | 1876 | { |
| 1809 | kv_force_lowest_valid(rdev); | 1877 | struct kv_power_info *pi = kv_get_pi(rdev); |
| 1810 | kv_init_graphics_levels(rdev); | 1878 | |
| 1811 | kv_program_bootup_state(rdev); | 1879 | if (rdev->family == CHIP_KABINI) { |
| 1812 | kv_upload_dpm_settings(rdev); | 1880 | kv_force_lowest_valid(rdev); |
| 1813 | kv_force_lowest_valid(rdev); | 1881 | kv_init_graphics_levels(rdev); |
| 1814 | kv_unforce_levels(rdev); | 1882 | kv_program_bootup_state(rdev); |
| 1883 | kv_upload_dpm_settings(rdev); | ||
| 1884 | kv_force_lowest_valid(rdev); | ||
| 1885 | kv_unforce_levels(rdev); | ||
| 1886 | } else { | ||
| 1887 | kv_init_graphics_levels(rdev); | ||
| 1888 | kv_program_bootup_state(rdev); | ||
| 1889 | kv_freeze_sclk_dpm(rdev, true); | ||
| 1890 | kv_upload_dpm_settings(rdev); | ||
| 1891 | kv_freeze_sclk_dpm(rdev, false); | ||
| 1892 | kv_set_enabled_level(rdev, pi->graphics_boot_level); | ||
| 1893 | } | ||
| 1815 | } | 1894 | } |
| 1816 | 1895 | ||
| 1817 | //XXX use sumo_dpm_display_configuration_changed | 1896 | //XXX use sumo_dpm_display_configuration_changed |
| @@ -1871,12 +1950,15 @@ static int kv_force_dpm_highest(struct radeon_device *rdev) | |||
| 1871 | if (ret) | 1950 | if (ret) |
| 1872 | return ret; | 1951 | return ret; |
| 1873 | 1952 | ||
| 1874 | for (i = SMU7_MAX_LEVELS_GRAPHICS - 1; i >= 0; i--) { | 1953 | for (i = SMU7_MAX_LEVELS_GRAPHICS - 1; i > 0; i--) { |
| 1875 | if (enable_mask & (1 << i)) | 1954 | if (enable_mask & (1 << i)) |
| 1876 | break; | 1955 | break; |
| 1877 | } | 1956 | } |
| 1878 | 1957 | ||
| 1879 | return kv_send_msg_to_smc_with_parameter(rdev, PPSMC_MSG_DPM_ForceState, i); | 1958 | if (rdev->family == CHIP_KABINI) |
| 1959 | return kv_send_msg_to_smc_with_parameter(rdev, PPSMC_MSG_DPM_ForceState, i); | ||
| 1960 | else | ||
| 1961 | return kv_set_enabled_level(rdev, i); | ||
| 1880 | } | 1962 | } |
| 1881 | 1963 | ||
| 1882 | static int kv_force_dpm_lowest(struct radeon_device *rdev) | 1964 | static int kv_force_dpm_lowest(struct radeon_device *rdev) |
| @@ -1893,7 +1975,10 @@ static int kv_force_dpm_lowest(struct radeon_device *rdev) | |||
| 1893 | break; | 1975 | break; |
| 1894 | } | 1976 | } |
| 1895 | 1977 | ||
| 1896 | return kv_send_msg_to_smc_with_parameter(rdev, PPSMC_MSG_DPM_ForceState, i); | 1978 | if (rdev->family == CHIP_KABINI) |
| 1979 | return kv_send_msg_to_smc_with_parameter(rdev, PPSMC_MSG_DPM_ForceState, i); | ||
| 1980 | else | ||
| 1981 | return kv_set_enabled_level(rdev, i); | ||
| 1897 | } | 1982 | } |
| 1898 | 1983 | ||
| 1899 | static u8 kv_get_sleep_divider_id_from_clock(struct radeon_device *rdev, | 1984 | static u8 kv_get_sleep_divider_id_from_clock(struct radeon_device *rdev, |
| @@ -1911,9 +1996,9 @@ static u8 kv_get_sleep_divider_id_from_clock(struct radeon_device *rdev, | |||
| 1911 | if (!pi->caps_sclk_ds) | 1996 | if (!pi->caps_sclk_ds) |
| 1912 | return 0; | 1997 | return 0; |
| 1913 | 1998 | ||
| 1914 | for (i = KV_MAX_DEEPSLEEP_DIVIDER_ID; i <= 0; i--) { | 1999 | for (i = KV_MAX_DEEPSLEEP_DIVIDER_ID; i > 0; i--) { |
| 1915 | temp = sclk / sumo_get_sleep_divider_from_id(i); | 2000 | temp = sclk / sumo_get_sleep_divider_from_id(i); |
| 1916 | if ((temp >= min) || (i == 0)) | 2001 | if (temp >= min) |
| 1917 | break; | 2002 | break; |
| 1918 | } | 2003 | } |
| 1919 | 2004 | ||
| @@ -2039,12 +2124,12 @@ static void kv_apply_state_adjust_rules(struct radeon_device *rdev, | |||
| 2039 | ps->dpmx_nb_ps_lo = 0x1; | 2124 | ps->dpmx_nb_ps_lo = 0x1; |
| 2040 | ps->dpmx_nb_ps_hi = 0x0; | 2125 | ps->dpmx_nb_ps_hi = 0x0; |
| 2041 | } else { | 2126 | } else { |
| 2042 | ps->dpm0_pg_nb_ps_lo = 0x1; | 2127 | ps->dpm0_pg_nb_ps_lo = 0x3; |
| 2043 | ps->dpm0_pg_nb_ps_hi = 0x0; | 2128 | ps->dpm0_pg_nb_ps_hi = 0x0; |
| 2044 | ps->dpmx_nb_ps_lo = 0x2; | 2129 | ps->dpmx_nb_ps_lo = 0x3; |
| 2045 | ps->dpmx_nb_ps_hi = 0x1; | 2130 | ps->dpmx_nb_ps_hi = 0x0; |
| 2046 | 2131 | ||
| 2047 | if (pi->sys_info.nb_dpm_enable && pi->battery_state) { | 2132 | if (pi->sys_info.nb_dpm_enable) { |
| 2048 | force_high = (mclk >= pi->sys_info.nbp_memory_clock[3]) || | 2133 | force_high = (mclk >= pi->sys_info.nbp_memory_clock[3]) || |
| 2049 | pi->video_start || (rdev->pm.dpm.new_active_crtc_count >= 3) || | 2134 | pi->video_start || (rdev->pm.dpm.new_active_crtc_count >= 3) || |
| 2050 | pi->disable_nb_ps3_in_battery; | 2135 | pi->disable_nb_ps3_in_battery; |
| @@ -2210,6 +2295,15 @@ static void kv_enable_new_levels(struct radeon_device *rdev) | |||
| 2210 | } | 2295 | } |
| 2211 | } | 2296 | } |
| 2212 | 2297 | ||
| 2298 | static int kv_set_enabled_level(struct radeon_device *rdev, u32 level) | ||
| 2299 | { | ||
| 2300 | u32 new_mask = (1 << level); | ||
| 2301 | |||
| 2302 | return kv_send_msg_to_smc_with_parameter(rdev, | ||
| 2303 | PPSMC_MSG_SCLKDPM_SetEnabledMask, | ||
| 2304 | new_mask); | ||
| 2305 | } | ||
| 2306 | |||
| 2213 | static int kv_set_enabled_levels(struct radeon_device *rdev) | 2307 | static int kv_set_enabled_levels(struct radeon_device *rdev) |
| 2214 | { | 2308 | { |
| 2215 | struct kv_power_info *pi = kv_get_pi(rdev); | 2309 | struct kv_power_info *pi = kv_get_pi(rdev); |
diff --git a/drivers/gpu/drm/radeon/kv_dpm.h b/drivers/gpu/drm/radeon/kv_dpm.h index 32bb079572d7..8cef7525d7a8 100644 --- a/drivers/gpu/drm/radeon/kv_dpm.h +++ b/drivers/gpu/drm/radeon/kv_dpm.h | |||
| @@ -192,6 +192,7 @@ int kv_send_msg_to_smc_with_parameter(struct radeon_device *rdev, | |||
| 192 | int kv_read_smc_sram_dword(struct radeon_device *rdev, u32 smc_address, | 192 | int kv_read_smc_sram_dword(struct radeon_device *rdev, u32 smc_address, |
| 193 | u32 *value, u32 limit); | 193 | u32 *value, u32 limit); |
| 194 | int kv_smc_dpm_enable(struct radeon_device *rdev, bool enable); | 194 | int kv_smc_dpm_enable(struct radeon_device *rdev, bool enable); |
| 195 | int kv_smc_bapm_enable(struct radeon_device *rdev, bool enable); | ||
| 195 | int kv_copy_bytes_to_smc(struct radeon_device *rdev, | 196 | int kv_copy_bytes_to_smc(struct radeon_device *rdev, |
| 196 | u32 smc_start_address, | 197 | u32 smc_start_address, |
| 197 | const u8 *src, u32 byte_count, u32 limit); | 198 | const u8 *src, u32 byte_count, u32 limit); |
diff --git a/drivers/gpu/drm/radeon/kv_smc.c b/drivers/gpu/drm/radeon/kv_smc.c index 34a226d7e34a..0000b59a6d05 100644 --- a/drivers/gpu/drm/radeon/kv_smc.c +++ b/drivers/gpu/drm/radeon/kv_smc.c | |||
| @@ -107,6 +107,14 @@ int kv_smc_dpm_enable(struct radeon_device *rdev, bool enable) | |||
| 107 | return kv_notify_message_to_smu(rdev, PPSMC_MSG_DPM_Disable); | 107 | return kv_notify_message_to_smu(rdev, PPSMC_MSG_DPM_Disable); |
| 108 | } | 108 | } |
| 109 | 109 | ||
| 110 | int kv_smc_bapm_enable(struct radeon_device *rdev, bool enable) | ||
| 111 | { | ||
| 112 | if (enable) | ||
| 113 | return kv_notify_message_to_smu(rdev, PPSMC_MSG_EnableBAPM); | ||
| 114 | else | ||
| 115 | return kv_notify_message_to_smu(rdev, PPSMC_MSG_DisableBAPM); | ||
| 116 | } | ||
| 117 | |||
| 110 | int kv_copy_bytes_to_smc(struct radeon_device *rdev, | 118 | int kv_copy_bytes_to_smc(struct radeon_device *rdev, |
| 111 | u32 smc_start_address, | 119 | u32 smc_start_address, |
| 112 | const u8 *src, u32 byte_count, u32 limit) | 120 | const u8 *src, u32 byte_count, u32 limit) |
diff --git a/drivers/gpu/drm/radeon/ni_dpm.c b/drivers/gpu/drm/radeon/ni_dpm.c index f7b625c9e0e9..6c398a456d78 100644 --- a/drivers/gpu/drm/radeon/ni_dpm.c +++ b/drivers/gpu/drm/radeon/ni_dpm.c | |||
| @@ -3865,12 +3865,6 @@ int ni_dpm_set_power_state(struct radeon_device *rdev) | |||
| 3865 | return ret; | 3865 | return ret; |
| 3866 | } | 3866 | } |
| 3867 | 3867 | ||
| 3868 | ret = ni_dpm_force_performance_level(rdev, RADEON_DPM_FORCED_LEVEL_AUTO); | ||
| 3869 | if (ret) { | ||
| 3870 | DRM_ERROR("ni_dpm_force_performance_level failed\n"); | ||
| 3871 | return ret; | ||
| 3872 | } | ||
| 3873 | |||
| 3874 | return 0; | 3868 | return 0; |
| 3875 | } | 3869 | } |
| 3876 | 3870 | ||
diff --git a/drivers/gpu/drm/radeon/ppsmc.h b/drivers/gpu/drm/radeon/ppsmc.h index 682842804bce..5670b8291285 100644 --- a/drivers/gpu/drm/radeon/ppsmc.h +++ b/drivers/gpu/drm/radeon/ppsmc.h | |||
| @@ -163,6 +163,8 @@ typedef uint8_t PPSMC_Result; | |||
| 163 | #define PPSMC_MSG_VCEPowerON ((uint32_t) 0x10f) | 163 | #define PPSMC_MSG_VCEPowerON ((uint32_t) 0x10f) |
| 164 | #define PPSMC_MSG_DCE_RemoveVoltageAdjustment ((uint32_t) 0x11d) | 164 | #define PPSMC_MSG_DCE_RemoveVoltageAdjustment ((uint32_t) 0x11d) |
| 165 | #define PPSMC_MSG_DCE_AllowVoltageAdjustment ((uint32_t) 0x11e) | 165 | #define PPSMC_MSG_DCE_AllowVoltageAdjustment ((uint32_t) 0x11e) |
| 166 | #define PPSMC_MSG_EnableBAPM ((uint32_t) 0x120) | ||
| 167 | #define PPSMC_MSG_DisableBAPM ((uint32_t) 0x121) | ||
| 166 | #define PPSMC_MSG_UVD_DPM_Config ((uint32_t) 0x124) | 168 | #define PPSMC_MSG_UVD_DPM_Config ((uint32_t) 0x124) |
| 167 | 169 | ||
| 168 | 170 | ||
diff --git a/drivers/gpu/drm/radeon/r100.c b/drivers/gpu/drm/radeon/r100.c index 9fc61dd68bc0..24175717307b 100644 --- a/drivers/gpu/drm/radeon/r100.c +++ b/drivers/gpu/drm/radeon/r100.c | |||
| @@ -2853,21 +2853,28 @@ static void r100_pll_errata_after_data(struct radeon_device *rdev) | |||
| 2853 | 2853 | ||
| 2854 | uint32_t r100_pll_rreg(struct radeon_device *rdev, uint32_t reg) | 2854 | uint32_t r100_pll_rreg(struct radeon_device *rdev, uint32_t reg) |
| 2855 | { | 2855 | { |
| 2856 | unsigned long flags; | ||
| 2856 | uint32_t data; | 2857 | uint32_t data; |
| 2857 | 2858 | ||
| 2859 | spin_lock_irqsave(&rdev->pll_idx_lock, flags); | ||
| 2858 | WREG8(RADEON_CLOCK_CNTL_INDEX, reg & 0x3f); | 2860 | WREG8(RADEON_CLOCK_CNTL_INDEX, reg & 0x3f); |
| 2859 | r100_pll_errata_after_index(rdev); | 2861 | r100_pll_errata_after_index(rdev); |
| 2860 | data = RREG32(RADEON_CLOCK_CNTL_DATA); | 2862 | data = RREG32(RADEON_CLOCK_CNTL_DATA); |
| 2861 | r100_pll_errata_after_data(rdev); | 2863 | r100_pll_errata_after_data(rdev); |
| 2864 | spin_unlock_irqrestore(&rdev->pll_idx_lock, flags); | ||
| 2862 | return data; | 2865 | return data; |
| 2863 | } | 2866 | } |
| 2864 | 2867 | ||
| 2865 | void r100_pll_wreg(struct radeon_device *rdev, uint32_t reg, uint32_t v) | 2868 | void r100_pll_wreg(struct radeon_device *rdev, uint32_t reg, uint32_t v) |
| 2866 | { | 2869 | { |
| 2870 | unsigned long flags; | ||
| 2871 | |||
| 2872 | spin_lock_irqsave(&rdev->pll_idx_lock, flags); | ||
| 2867 | WREG8(RADEON_CLOCK_CNTL_INDEX, ((reg & 0x3f) | RADEON_PLL_WR_EN)); | 2873 | WREG8(RADEON_CLOCK_CNTL_INDEX, ((reg & 0x3f) | RADEON_PLL_WR_EN)); |
| 2868 | r100_pll_errata_after_index(rdev); | 2874 | r100_pll_errata_after_index(rdev); |
| 2869 | WREG32(RADEON_CLOCK_CNTL_DATA, v); | 2875 | WREG32(RADEON_CLOCK_CNTL_DATA, v); |
| 2870 | r100_pll_errata_after_data(rdev); | 2876 | r100_pll_errata_after_data(rdev); |
| 2877 | spin_unlock_irqrestore(&rdev->pll_idx_lock, flags); | ||
| 2871 | } | 2878 | } |
| 2872 | 2879 | ||
| 2873 | static void r100_set_safe_registers(struct radeon_device *rdev) | 2880 | static void r100_set_safe_registers(struct radeon_device *rdev) |
diff --git a/drivers/gpu/drm/radeon/r420.c b/drivers/gpu/drm/radeon/r420.c index 4e796ecf9ea4..6edf2b3a52b4 100644 --- a/drivers/gpu/drm/radeon/r420.c +++ b/drivers/gpu/drm/radeon/r420.c | |||
| @@ -160,18 +160,25 @@ void r420_pipes_init(struct radeon_device *rdev) | |||
| 160 | 160 | ||
| 161 | u32 r420_mc_rreg(struct radeon_device *rdev, u32 reg) | 161 | u32 r420_mc_rreg(struct radeon_device *rdev, u32 reg) |
| 162 | { | 162 | { |
| 163 | unsigned long flags; | ||
| 163 | u32 r; | 164 | u32 r; |
| 164 | 165 | ||
| 166 | spin_lock_irqsave(&rdev->mc_idx_lock, flags); | ||
| 165 | WREG32(R_0001F8_MC_IND_INDEX, S_0001F8_MC_IND_ADDR(reg)); | 167 | WREG32(R_0001F8_MC_IND_INDEX, S_0001F8_MC_IND_ADDR(reg)); |
| 166 | r = RREG32(R_0001FC_MC_IND_DATA); | 168 | r = RREG32(R_0001FC_MC_IND_DATA); |
| 169 | spin_unlock_irqrestore(&rdev->mc_idx_lock, flags); | ||
| 167 | return r; | 170 | return r; |
| 168 | } | 171 | } |
| 169 | 172 | ||
| 170 | void r420_mc_wreg(struct radeon_device *rdev, u32 reg, u32 v) | 173 | void r420_mc_wreg(struct radeon_device *rdev, u32 reg, u32 v) |
| 171 | { | 174 | { |
| 175 | unsigned long flags; | ||
| 176 | |||
| 177 | spin_lock_irqsave(&rdev->mc_idx_lock, flags); | ||
| 172 | WREG32(R_0001F8_MC_IND_INDEX, S_0001F8_MC_IND_ADDR(reg) | | 178 | WREG32(R_0001F8_MC_IND_INDEX, S_0001F8_MC_IND_ADDR(reg) | |
| 173 | S_0001F8_MC_IND_WR_EN(1)); | 179 | S_0001F8_MC_IND_WR_EN(1)); |
| 174 | WREG32(R_0001FC_MC_IND_DATA, v); | 180 | WREG32(R_0001FC_MC_IND_DATA, v); |
| 181 | spin_unlock_irqrestore(&rdev->mc_idx_lock, flags); | ||
| 175 | } | 182 | } |
| 176 | 183 | ||
| 177 | static void r420_debugfs(struct radeon_device *rdev) | 184 | static void r420_debugfs(struct radeon_device *rdev) |
diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c index ea4d3734e6d9..2a1b1876b431 100644 --- a/drivers/gpu/drm/radeon/r600.c +++ b/drivers/gpu/drm/radeon/r600.c | |||
| @@ -119,6 +119,11 @@ u32 r600_get_xclk(struct radeon_device *rdev) | |||
| 119 | return rdev->clock.spll.reference_freq; | 119 | return rdev->clock.spll.reference_freq; |
| 120 | } | 120 | } |
| 121 | 121 | ||
| 122 | int r600_set_uvd_clocks(struct radeon_device *rdev, u32 vclk, u32 dclk) | ||
| 123 | { | ||
| 124 | return 0; | ||
| 125 | } | ||
| 126 | |||
| 122 | /* get temperature in millidegrees */ | 127 | /* get temperature in millidegrees */ |
| 123 | int rv6xx_get_temp(struct radeon_device *rdev) | 128 | int rv6xx_get_temp(struct radeon_device *rdev) |
| 124 | { | 129 | { |
| @@ -1045,20 +1050,27 @@ int r600_mc_wait_for_idle(struct radeon_device *rdev) | |||
| 1045 | 1050 | ||
| 1046 | uint32_t rs780_mc_rreg(struct radeon_device *rdev, uint32_t reg) | 1051 | uint32_t rs780_mc_rreg(struct radeon_device *rdev, uint32_t reg) |
| 1047 | { | 1052 | { |
| 1053 | unsigned long flags; | ||
| 1048 | uint32_t r; | 1054 | uint32_t r; |
| 1049 | 1055 | ||
| 1056 | spin_lock_irqsave(&rdev->mc_idx_lock, flags); | ||
| 1050 | WREG32(R_0028F8_MC_INDEX, S_0028F8_MC_IND_ADDR(reg)); | 1057 | WREG32(R_0028F8_MC_INDEX, S_0028F8_MC_IND_ADDR(reg)); |
| 1051 | r = RREG32(R_0028FC_MC_DATA); | 1058 | r = RREG32(R_0028FC_MC_DATA); |
| 1052 | WREG32(R_0028F8_MC_INDEX, ~C_0028F8_MC_IND_ADDR); | 1059 | WREG32(R_0028F8_MC_INDEX, ~C_0028F8_MC_IND_ADDR); |
| 1060 | spin_unlock_irqrestore(&rdev->mc_idx_lock, flags); | ||
| 1053 | return r; | 1061 | return r; |
| 1054 | } | 1062 | } |
| 1055 | 1063 | ||
| 1056 | void rs780_mc_wreg(struct radeon_device *rdev, uint32_t reg, uint32_t v) | 1064 | void rs780_mc_wreg(struct radeon_device *rdev, uint32_t reg, uint32_t v) |
| 1057 | { | 1065 | { |
| 1066 | unsigned long flags; | ||
| 1067 | |||
| 1068 | spin_lock_irqsave(&rdev->mc_idx_lock, flags); | ||
| 1058 | WREG32(R_0028F8_MC_INDEX, S_0028F8_MC_IND_ADDR(reg) | | 1069 | WREG32(R_0028F8_MC_INDEX, S_0028F8_MC_IND_ADDR(reg) | |
| 1059 | S_0028F8_MC_IND_WR_EN(1)); | 1070 | S_0028F8_MC_IND_WR_EN(1)); |
| 1060 | WREG32(R_0028FC_MC_DATA, v); | 1071 | WREG32(R_0028FC_MC_DATA, v); |
| 1061 | WREG32(R_0028F8_MC_INDEX, 0x7F); | 1072 | WREG32(R_0028F8_MC_INDEX, 0x7F); |
| 1073 | spin_unlock_irqrestore(&rdev->mc_idx_lock, flags); | ||
| 1062 | } | 1074 | } |
| 1063 | 1075 | ||
| 1064 | static void r600_mc_program(struct radeon_device *rdev) | 1076 | static void r600_mc_program(struct radeon_device *rdev) |
| @@ -2092,20 +2104,27 @@ static void r600_gpu_init(struct radeon_device *rdev) | |||
| 2092 | */ | 2104 | */ |
| 2093 | u32 r600_pciep_rreg(struct radeon_device *rdev, u32 reg) | 2105 | u32 r600_pciep_rreg(struct radeon_device *rdev, u32 reg) |
| 2094 | { | 2106 | { |
| 2107 | unsigned long flags; | ||
| 2095 | u32 r; | 2108 | u32 r; |
| 2096 | 2109 | ||
| 2110 | spin_lock_irqsave(&rdev->pciep_idx_lock, flags); | ||
| 2097 | WREG32(PCIE_PORT_INDEX, ((reg) & 0xff)); | 2111 | WREG32(PCIE_PORT_INDEX, ((reg) & 0xff)); |
| 2098 | (void)RREG32(PCIE_PORT_INDEX); | 2112 | (void)RREG32(PCIE_PORT_INDEX); |
| 2099 | r = RREG32(PCIE_PORT_DATA); | 2113 | r = RREG32(PCIE_PORT_DATA); |
| 2114 | spin_unlock_irqrestore(&rdev->pciep_idx_lock, flags); | ||
| 2100 | return r; | 2115 | return r; |
| 2101 | } | 2116 | } |
| 2102 | 2117 | ||
| 2103 | void r600_pciep_wreg(struct radeon_device *rdev, u32 reg, u32 v) | 2118 | void r600_pciep_wreg(struct radeon_device *rdev, u32 reg, u32 v) |
| 2104 | { | 2119 | { |
| 2120 | unsigned long flags; | ||
| 2121 | |||
| 2122 | spin_lock_irqsave(&rdev->pciep_idx_lock, flags); | ||
| 2105 | WREG32(PCIE_PORT_INDEX, ((reg) & 0xff)); | 2123 | WREG32(PCIE_PORT_INDEX, ((reg) & 0xff)); |
| 2106 | (void)RREG32(PCIE_PORT_INDEX); | 2124 | (void)RREG32(PCIE_PORT_INDEX); |
| 2107 | WREG32(PCIE_PORT_DATA, (v)); | 2125 | WREG32(PCIE_PORT_DATA, (v)); |
| 2108 | (void)RREG32(PCIE_PORT_DATA); | 2126 | (void)RREG32(PCIE_PORT_DATA); |
| 2127 | spin_unlock_irqrestore(&rdev->pciep_idx_lock, flags); | ||
| 2109 | } | 2128 | } |
| 2110 | 2129 | ||
| 2111 | /* | 2130 | /* |
diff --git a/drivers/gpu/drm/radeon/r600_dpm.c b/drivers/gpu/drm/radeon/r600_dpm.c index fa0de46fcc0d..e65f211a7be0 100644 --- a/drivers/gpu/drm/radeon/r600_dpm.c +++ b/drivers/gpu/drm/radeon/r600_dpm.c | |||
| @@ -1219,30 +1219,20 @@ int r600_parse_extended_power_table(struct radeon_device *rdev) | |||
| 1219 | 1219 | ||
| 1220 | void r600_free_extended_power_table(struct radeon_device *rdev) | 1220 | void r600_free_extended_power_table(struct radeon_device *rdev) |
| 1221 | { | 1221 | { |
| 1222 | if (rdev->pm.dpm.dyn_state.vddc_dependency_on_sclk.entries) | 1222 | struct radeon_dpm_dynamic_state *dyn_state = &rdev->pm.dpm.dyn_state; |
| 1223 | kfree(rdev->pm.dpm.dyn_state.vddc_dependency_on_sclk.entries); | 1223 | |
| 1224 | if (rdev->pm.dpm.dyn_state.vddci_dependency_on_mclk.entries) | 1224 | kfree(dyn_state->vddc_dependency_on_sclk.entries); |
| 1225 | kfree(rdev->pm.dpm.dyn_state.vddci_dependency_on_mclk.entries); | 1225 | kfree(dyn_state->vddci_dependency_on_mclk.entries); |
| 1226 | if (rdev->pm.dpm.dyn_state.vddc_dependency_on_mclk.entries) | 1226 | kfree(dyn_state->vddc_dependency_on_mclk.entries); |
| 1227 | kfree(rdev->pm.dpm.dyn_state.vddc_dependency_on_mclk.entries); | 1227 | kfree(dyn_state->mvdd_dependency_on_mclk.entries); |
| 1228 | if (rdev->pm.dpm.dyn_state.mvdd_dependency_on_mclk.entries) | 1228 | kfree(dyn_state->cac_leakage_table.entries); |
| 1229 | kfree(rdev->pm.dpm.dyn_state.mvdd_dependency_on_mclk.entries); | 1229 | kfree(dyn_state->phase_shedding_limits_table.entries); |
| 1230 | if (rdev->pm.dpm.dyn_state.cac_leakage_table.entries) | 1230 | kfree(dyn_state->ppm_table); |
| 1231 | kfree(rdev->pm.dpm.dyn_state.cac_leakage_table.entries); | 1231 | kfree(dyn_state->cac_tdp_table); |
| 1232 | if (rdev->pm.dpm.dyn_state.phase_shedding_limits_table.entries) | 1232 | kfree(dyn_state->vce_clock_voltage_dependency_table.entries); |
| 1233 | kfree(rdev->pm.dpm.dyn_state.phase_shedding_limits_table.entries); | 1233 | kfree(dyn_state->uvd_clock_voltage_dependency_table.entries); |
| 1234 | if (rdev->pm.dpm.dyn_state.ppm_table) | 1234 | kfree(dyn_state->samu_clock_voltage_dependency_table.entries); |
| 1235 | kfree(rdev->pm.dpm.dyn_state.ppm_table); | 1235 | kfree(dyn_state->acp_clock_voltage_dependency_table.entries); |
| 1236 | if (rdev->pm.dpm.dyn_state.cac_tdp_table) | ||
| 1237 | kfree(rdev->pm.dpm.dyn_state.cac_tdp_table); | ||
| 1238 | if (rdev->pm.dpm.dyn_state.vce_clock_voltage_dependency_table.entries) | ||
| 1239 | kfree(rdev->pm.dpm.dyn_state.vce_clock_voltage_dependency_table.entries); | ||
| 1240 | if (rdev->pm.dpm.dyn_state.uvd_clock_voltage_dependency_table.entries) | ||
| 1241 | kfree(rdev->pm.dpm.dyn_state.uvd_clock_voltage_dependency_table.entries); | ||
| 1242 | if (rdev->pm.dpm.dyn_state.samu_clock_voltage_dependency_table.entries) | ||
| 1243 | kfree(rdev->pm.dpm.dyn_state.samu_clock_voltage_dependency_table.entries); | ||
| 1244 | if (rdev->pm.dpm.dyn_state.acp_clock_voltage_dependency_table.entries) | ||
| 1245 | kfree(rdev->pm.dpm.dyn_state.acp_clock_voltage_dependency_table.entries); | ||
| 1246 | } | 1236 | } |
| 1247 | 1237 | ||
| 1248 | enum radeon_pcie_gen r600_get_pcie_gen_support(struct radeon_device *rdev, | 1238 | enum radeon_pcie_gen r600_get_pcie_gen_support(struct radeon_device *rdev, |
diff --git a/drivers/gpu/drm/radeon/r600d.h b/drivers/gpu/drm/radeon/r600d.h index 454f90a849e4..e673fe26ea84 100644 --- a/drivers/gpu/drm/radeon/r600d.h +++ b/drivers/gpu/drm/radeon/r600d.h | |||
| @@ -1040,7 +1040,7 @@ | |||
| 1040 | # define HDMI0_AVI_INFO_CONT (1 << 1) | 1040 | # define HDMI0_AVI_INFO_CONT (1 << 1) |
| 1041 | # define HDMI0_AUDIO_INFO_SEND (1 << 4) | 1041 | # define HDMI0_AUDIO_INFO_SEND (1 << 4) |
| 1042 | # define HDMI0_AUDIO_INFO_CONT (1 << 5) | 1042 | # define HDMI0_AUDIO_INFO_CONT (1 << 5) |
| 1043 | # define HDMI0_AUDIO_INFO_SOURCE (1 << 6) /* 0 - sound block; 1 - hmdi regs */ | 1043 | # define HDMI0_AUDIO_INFO_SOURCE (1 << 6) /* 0 - sound block; 1 - hdmi regs */ |
| 1044 | # define HDMI0_AUDIO_INFO_UPDATE (1 << 7) | 1044 | # define HDMI0_AUDIO_INFO_UPDATE (1 << 7) |
| 1045 | # define HDMI0_MPEG_INFO_SEND (1 << 8) | 1045 | # define HDMI0_MPEG_INFO_SEND (1 << 8) |
| 1046 | # define HDMI0_MPEG_INFO_CONT (1 << 9) | 1046 | # define HDMI0_MPEG_INFO_CONT (1 << 9) |
diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h index ff8b564ce2b2..a400ac1c4147 100644 --- a/drivers/gpu/drm/radeon/radeon.h +++ b/drivers/gpu/drm/radeon/radeon.h | |||
| @@ -181,7 +181,7 @@ extern int radeon_aspm; | |||
| 181 | #define RADEON_CG_SUPPORT_HDP_MGCG (1 << 16) | 181 | #define RADEON_CG_SUPPORT_HDP_MGCG (1 << 16) |
| 182 | 182 | ||
| 183 | /* PG flags */ | 183 | /* PG flags */ |
| 184 | #define RADEON_PG_SUPPORT_GFX_CG (1 << 0) | 184 | #define RADEON_PG_SUPPORT_GFX_PG (1 << 0) |
| 185 | #define RADEON_PG_SUPPORT_GFX_SMG (1 << 1) | 185 | #define RADEON_PG_SUPPORT_GFX_SMG (1 << 1) |
| 186 | #define RADEON_PG_SUPPORT_GFX_DMG (1 << 2) | 186 | #define RADEON_PG_SUPPORT_GFX_DMG (1 << 2) |
| 187 | #define RADEON_PG_SUPPORT_UVD (1 << 3) | 187 | #define RADEON_PG_SUPPORT_UVD (1 << 3) |
| @@ -1778,6 +1778,7 @@ struct radeon_asic { | |||
| 1778 | int (*force_performance_level)(struct radeon_device *rdev, enum radeon_dpm_forced_level level); | 1778 | int (*force_performance_level)(struct radeon_device *rdev, enum radeon_dpm_forced_level level); |
| 1779 | bool (*vblank_too_short)(struct radeon_device *rdev); | 1779 | bool (*vblank_too_short)(struct radeon_device *rdev); |
| 1780 | void (*powergate_uvd)(struct radeon_device *rdev, bool gate); | 1780 | void (*powergate_uvd)(struct radeon_device *rdev, bool gate); |
| 1781 | void (*enable_bapm)(struct radeon_device *rdev, bool enable); | ||
| 1781 | } dpm; | 1782 | } dpm; |
| 1782 | /* pageflipping */ | 1783 | /* pageflipping */ |
| 1783 | struct { | 1784 | struct { |
| @@ -2110,6 +2111,28 @@ struct radeon_device { | |||
| 2110 | resource_size_t rmmio_size; | 2111 | resource_size_t rmmio_size; |
| 2111 | /* protects concurrent MM_INDEX/DATA based register access */ | 2112 | /* protects concurrent MM_INDEX/DATA based register access */ |
| 2112 | spinlock_t mmio_idx_lock; | 2113 | spinlock_t mmio_idx_lock; |
| 2114 | /* protects concurrent SMC based register access */ | ||
| 2115 | spinlock_t smc_idx_lock; | ||
| 2116 | /* protects concurrent PLL register access */ | ||
| 2117 | spinlock_t pll_idx_lock; | ||
| 2118 | /* protects concurrent MC register access */ | ||
| 2119 | spinlock_t mc_idx_lock; | ||
| 2120 | /* protects concurrent PCIE register access */ | ||
| 2121 | spinlock_t pcie_idx_lock; | ||
| 2122 | /* protects concurrent PCIE_PORT register access */ | ||
| 2123 | spinlock_t pciep_idx_lock; | ||
| 2124 | /* protects concurrent PIF register access */ | ||
| 2125 | spinlock_t pif_idx_lock; | ||
| 2126 | /* protects concurrent CG register access */ | ||
| 2127 | spinlock_t cg_idx_lock; | ||
| 2128 | /* protects concurrent UVD register access */ | ||
| 2129 | spinlock_t uvd_idx_lock; | ||
| 2130 | /* protects concurrent RCU register access */ | ||
| 2131 | spinlock_t rcu_idx_lock; | ||
| 2132 | /* protects concurrent DIDT register access */ | ||
| 2133 | spinlock_t didt_idx_lock; | ||
| 2134 | /* protects concurrent ENDPOINT (audio) register access */ | ||
| 2135 | spinlock_t end_idx_lock; | ||
| 2113 | void __iomem *rmmio; | 2136 | void __iomem *rmmio; |
| 2114 | radeon_rreg_t mc_rreg; | 2137 | radeon_rreg_t mc_rreg; |
| 2115 | radeon_wreg_t mc_wreg; | 2138 | radeon_wreg_t mc_wreg; |
| @@ -2277,123 +2300,179 @@ void cik_mm_wdoorbell(struct radeon_device *rdev, u32 offset, u32 v); | |||
| 2277 | */ | 2300 | */ |
| 2278 | static inline uint32_t rv370_pcie_rreg(struct radeon_device *rdev, uint32_t reg) | 2301 | static inline uint32_t rv370_pcie_rreg(struct radeon_device *rdev, uint32_t reg) |
| 2279 | { | 2302 | { |
| 2303 | unsigned long flags; | ||
| 2280 | uint32_t r; | 2304 | uint32_t r; |
| 2281 | 2305 | ||
| 2306 | spin_lock_irqsave(&rdev->pcie_idx_lock, flags); | ||
| 2282 | WREG32(RADEON_PCIE_INDEX, ((reg) & rdev->pcie_reg_mask)); | 2307 | WREG32(RADEON_PCIE_INDEX, ((reg) & rdev->pcie_reg_mask)); |
| 2283 | r = RREG32(RADEON_PCIE_DATA); | 2308 | r = RREG32(RADEON_PCIE_DATA); |
| 2309 | spin_unlock_irqrestore(&rdev->pcie_idx_lock, flags); | ||
| 2284 | return r; | 2310 | return r; |
| 2285 | } | 2311 | } |
| 2286 | 2312 | ||
| 2287 | static inline void rv370_pcie_wreg(struct radeon_device *rdev, uint32_t reg, uint32_t v) | 2313 | static inline void rv370_pcie_wreg(struct radeon_device *rdev, uint32_t reg, uint32_t v) |
| 2288 | { | 2314 | { |
| 2315 | unsigned long flags; | ||
| 2316 | |||
| 2317 | spin_lock_irqsave(&rdev->pcie_idx_lock, flags); | ||
| 2289 | WREG32(RADEON_PCIE_INDEX, ((reg) & rdev->pcie_reg_mask)); | 2318 | WREG32(RADEON_PCIE_INDEX, ((reg) & rdev->pcie_reg_mask)); |
| 2290 | WREG32(RADEON_PCIE_DATA, (v)); | 2319 | WREG32(RADEON_PCIE_DATA, (v)); |
| 2320 | spin_unlock_irqrestore(&rdev->pcie_idx_lock, flags); | ||
| 2291 | } | 2321 | } |
| 2292 | 2322 | ||
| 2293 | static inline u32 tn_smc_rreg(struct radeon_device *rdev, u32 reg) | 2323 | static inline u32 tn_smc_rreg(struct radeon_device *rdev, u32 reg) |
| 2294 | { | 2324 | { |
| 2325 | unsigned long flags; | ||
| 2295 | u32 r; | 2326 | u32 r; |
| 2296 | 2327 | ||
| 2328 | spin_lock_irqsave(&rdev->smc_idx_lock, flags); | ||
| 2297 | WREG32(TN_SMC_IND_INDEX_0, (reg)); | 2329 | WREG32(TN_SMC_IND_INDEX_0, (reg)); |
| 2298 | r = RREG32(TN_SMC_IND_DATA_0); | 2330 | r = RREG32(TN_SMC_IND_DATA_0); |
| 2331 | spin_unlock_irqrestore(&rdev->smc_idx_lock, flags); | ||
| 2299 | return r; | 2332 | return r; |
| 2300 | } | 2333 | } |
| 2301 | 2334 | ||
| 2302 | static inline void tn_smc_wreg(struct radeon_device *rdev, u32 reg, u32 v) | 2335 | static inline void tn_smc_wreg(struct radeon_device *rdev, u32 reg, u32 v) |
| 2303 | { | 2336 | { |
| 2337 | unsigned long flags; | ||
| 2338 | |||
| 2339 | spin_lock_irqsave(&rdev->smc_idx_lock, flags); | ||
| 2304 | WREG32(TN_SMC_IND_INDEX_0, (reg)); | 2340 | WREG32(TN_SMC_IND_INDEX_0, (reg)); |
| 2305 | WREG32(TN_SMC_IND_DATA_0, (v)); | 2341 | WREG32(TN_SMC_IND_DATA_0, (v)); |
| 2342 | spin_unlock_irqrestore(&rdev->smc_idx_lock, flags); | ||
| 2306 | } | 2343 | } |
| 2307 | 2344 | ||
| 2308 | static inline u32 r600_rcu_rreg(struct radeon_device *rdev, u32 reg) | 2345 | static inline u32 r600_rcu_rreg(struct radeon_device *rdev, u32 reg) |
| 2309 | { | 2346 | { |
| 2347 | unsigned long flags; | ||
| 2310 | u32 r; | 2348 | u32 r; |
| 2311 | 2349 | ||
| 2350 | spin_lock_irqsave(&rdev->rcu_idx_lock, flags); | ||
| 2312 | WREG32(R600_RCU_INDEX, ((reg) & 0x1fff)); | 2351 | WREG32(R600_RCU_INDEX, ((reg) & 0x1fff)); |
| 2313 | r = RREG32(R600_RCU_DATA); | 2352 | r = RREG32(R600_RCU_DATA); |
| 2353 | spin_unlock_irqrestore(&rdev->rcu_idx_lock, flags); | ||
| 2314 | return r; | 2354 | return r; |
| 2315 | } | 2355 | } |
| 2316 | 2356 | ||
| 2317 | static inline void r600_rcu_wreg(struct radeon_device *rdev, u32 reg, u32 v) | 2357 | static inline void r600_rcu_wreg(struct radeon_device *rdev, u32 reg, u32 v) |
| 2318 | { | 2358 | { |
| 2359 | unsigned long flags; | ||
| 2360 | |||
| 2361 | spin_lock_irqsave(&rdev->rcu_idx_lock, flags); | ||
| 2319 | WREG32(R600_RCU_INDEX, ((reg) & 0x1fff)); | 2362 | WREG32(R600_RCU_INDEX, ((reg) & 0x1fff)); |
| 2320 | WREG32(R600_RCU_DATA, (v)); | 2363 | WREG32(R600_RCU_DATA, (v)); |
| 2364 | spin_unlock_irqrestore(&rdev->rcu_idx_lock, flags); | ||
| 2321 | } | 2365 | } |
| 2322 | 2366 | ||
| 2323 | static inline u32 eg_cg_rreg(struct radeon_device *rdev, u32 reg) | 2367 | static inline u32 eg_cg_rreg(struct radeon_device *rdev, u32 reg) |
| 2324 | { | 2368 | { |
| 2369 | unsigned long flags; | ||
| 2325 | u32 r; | 2370 | u32 r; |
| 2326 | 2371 | ||
| 2372 | spin_lock_irqsave(&rdev->cg_idx_lock, flags); | ||
| 2327 | WREG32(EVERGREEN_CG_IND_ADDR, ((reg) & 0xffff)); | 2373 | WREG32(EVERGREEN_CG_IND_ADDR, ((reg) & 0xffff)); |
| 2328 | r = RREG32(EVERGREEN_CG_IND_DATA); | 2374 | r = RREG32(EVERGREEN_CG_IND_DATA); |
| 2375 | spin_unlock_irqrestore(&rdev->cg_idx_lock, flags); | ||
| 2329 | return r; | 2376 | return r; |
| 2330 | } | 2377 | } |
| 2331 | 2378 | ||
| 2332 | static inline void eg_cg_wreg(struct radeon_device *rdev, u32 reg, u32 v) | 2379 | static inline void eg_cg_wreg(struct radeon_device *rdev, u32 reg, u32 v) |
| 2333 | { | 2380 | { |
| 2381 | unsigned long flags; | ||
| 2382 | |||
| 2383 | spin_lock_irqsave(&rdev->cg_idx_lock, flags); | ||
| 2334 | WREG32(EVERGREEN_CG_IND_ADDR, ((reg) & 0xffff)); | 2384 | WREG32(EVERGREEN_CG_IND_ADDR, ((reg) & 0xffff)); |
| 2335 | WREG32(EVERGREEN_CG_IND_DATA, (v)); | 2385 | WREG32(EVERGREEN_CG_IND_DATA, (v)); |
| 2386 | spin_unlock_irqrestore(&rdev->cg_idx_lock, flags); | ||
| 2336 | } | 2387 | } |
| 2337 | 2388 | ||
| 2338 | static inline u32 eg_pif_phy0_rreg(struct radeon_device *rdev, u32 reg) | 2389 | static inline u32 eg_pif_phy0_rreg(struct radeon_device *rdev, u32 reg) |
| 2339 | { | 2390 | { |
| 2391 | unsigned long flags; | ||
| 2340 | u32 r; | 2392 | u32 r; |
| 2341 | 2393 | ||
| 2394 | spin_lock_irqsave(&rdev->pif_idx_lock, flags); | ||
| 2342 | WREG32(EVERGREEN_PIF_PHY0_INDEX, ((reg) & 0xffff)); | 2395 | WREG32(EVERGREEN_PIF_PHY0_INDEX, ((reg) & 0xffff)); |
| 2343 | r = RREG32(EVERGREEN_PIF_PHY0_DATA); | 2396 | r = RREG32(EVERGREEN_PIF_PHY0_DATA); |
| 2397 | spin_unlock_irqrestore(&rdev->pif_idx_lock, flags); | ||
| 2344 | return r; | 2398 | return r; |
| 2345 | } | 2399 | } |
| 2346 | 2400 | ||
| 2347 | static inline void eg_pif_phy0_wreg(struct radeon_device *rdev, u32 reg, u32 v) | 2401 | static inline void eg_pif_phy0_wreg(struct radeon_device *rdev, u32 reg, u32 v) |
| 2348 | { | 2402 | { |
| 2403 | unsigned long flags; | ||
| 2404 | |||
| 2405 | spin_lock_irqsave(&rdev->pif_idx_lock, flags); | ||
| 2349 | WREG32(EVERGREEN_PIF_PHY0_INDEX, ((reg) & 0xffff)); | 2406 | WREG32(EVERGREEN_PIF_PHY0_INDEX, ((reg) & 0xffff)); |
| 2350 | WREG32(EVERGREEN_PIF_PHY0_DATA, (v)); | 2407 | WREG32(EVERGREEN_PIF_PHY0_DATA, (v)); |
| 2408 | spin_unlock_irqrestore(&rdev->pif_idx_lock, flags); | ||
| 2351 | } | 2409 | } |
| 2352 | 2410 | ||
| 2353 | static inline u32 eg_pif_phy1_rreg(struct radeon_device *rdev, u32 reg) | 2411 | static inline u32 eg_pif_phy1_rreg(struct radeon_device *rdev, u32 reg) |
| 2354 | { | 2412 | { |
| 2413 | unsigned long flags; | ||
| 2355 | u32 r; | 2414 | u32 r; |
| 2356 | 2415 | ||
| 2416 | spin_lock_irqsave(&rdev->pif_idx_lock, flags); | ||
| 2357 | WREG32(EVERGREEN_PIF_PHY1_INDEX, ((reg) & 0xffff)); | 2417 | WREG32(EVERGREEN_PIF_PHY1_INDEX, ((reg) & 0xffff)); |
| 2358 | r = RREG32(EVERGREEN_PIF_PHY1_DATA); | 2418 | r = RREG32(EVERGREEN_PIF_PHY1_DATA); |
| 2419 | spin_unlock_irqrestore(&rdev->pif_idx_lock, flags); | ||
| 2359 | return r; | 2420 | return r; |
| 2360 | } | 2421 | } |
| 2361 | 2422 | ||
| 2362 | static inline void eg_pif_phy1_wreg(struct radeon_device *rdev, u32 reg, u32 v) | 2423 | static inline void eg_pif_phy1_wreg(struct radeon_device *rdev, u32 reg, u32 v) |
| 2363 | { | 2424 | { |
| 2425 | unsigned long flags; | ||
| 2426 | |||
| 2427 | spin_lock_irqsave(&rdev->pif_idx_lock, flags); | ||
| 2364 | WREG32(EVERGREEN_PIF_PHY1_INDEX, ((reg) & 0xffff)); | 2428 | WREG32(EVERGREEN_PIF_PHY1_INDEX, ((reg) & 0xffff)); |
| 2365 | WREG32(EVERGREEN_PIF_PHY1_DATA, (v)); | 2429 | WREG32(EVERGREEN_PIF_PHY1_DATA, (v)); |
| 2430 | spin_unlock_irqrestore(&rdev->pif_idx_lock, flags); | ||
| 2366 | } | 2431 | } |
| 2367 | 2432 | ||
| 2368 | static inline u32 r600_uvd_ctx_rreg(struct radeon_device *rdev, u32 reg) | 2433 | static inline u32 r600_uvd_ctx_rreg(struct radeon_device *rdev, u32 reg) |
| 2369 | { | 2434 | { |
| 2435 | unsigned long flags; | ||
| 2370 | u32 r; | 2436 | u32 r; |
| 2371 | 2437 | ||
| 2438 | spin_lock_irqsave(&rdev->uvd_idx_lock, flags); | ||
| 2372 | WREG32(R600_UVD_CTX_INDEX, ((reg) & 0x1ff)); | 2439 | WREG32(R600_UVD_CTX_INDEX, ((reg) & 0x1ff)); |
| 2373 | r = RREG32(R600_UVD_CTX_DATA); | 2440 | r = RREG32(R600_UVD_CTX_DATA); |
| 2441 | spin_unlock_irqrestore(&rdev->uvd_idx_lock, flags); | ||
| 2374 | return r; | 2442 | return r; |
| 2375 | } | 2443 | } |
| 2376 | 2444 | ||
| 2377 | static inline void r600_uvd_ctx_wreg(struct radeon_device *rdev, u32 reg, u32 v) | 2445 | static inline void r600_uvd_ctx_wreg(struct radeon_device *rdev, u32 reg, u32 v) |
| 2378 | { | 2446 | { |
| 2447 | unsigned long flags; | ||
| 2448 | |||
| 2449 | spin_lock_irqsave(&rdev->uvd_idx_lock, flags); | ||
| 2379 | WREG32(R600_UVD_CTX_INDEX, ((reg) & 0x1ff)); | 2450 | WREG32(R600_UVD_CTX_INDEX, ((reg) & 0x1ff)); |
| 2380 | WREG32(R600_UVD_CTX_DATA, (v)); | 2451 | WREG32(R600_UVD_CTX_DATA, (v)); |
| 2452 | spin_unlock_irqrestore(&rdev->uvd_idx_lock, flags); | ||
| 2381 | } | 2453 | } |
| 2382 | 2454 | ||
| 2383 | 2455 | ||
| 2384 | static inline u32 cik_didt_rreg(struct radeon_device *rdev, u32 reg) | 2456 | static inline u32 cik_didt_rreg(struct radeon_device *rdev, u32 reg) |
| 2385 | { | 2457 | { |
| 2458 | unsigned long flags; | ||
| 2386 | u32 r; | 2459 | u32 r; |
| 2387 | 2460 | ||
| 2461 | spin_lock_irqsave(&rdev->didt_idx_lock, flags); | ||
| 2388 | WREG32(CIK_DIDT_IND_INDEX, (reg)); | 2462 | WREG32(CIK_DIDT_IND_INDEX, (reg)); |
| 2389 | r = RREG32(CIK_DIDT_IND_DATA); | 2463 | r = RREG32(CIK_DIDT_IND_DATA); |
| 2464 | spin_unlock_irqrestore(&rdev->didt_idx_lock, flags); | ||
| 2390 | return r; | 2465 | return r; |
| 2391 | } | 2466 | } |
| 2392 | 2467 | ||
| 2393 | static inline void cik_didt_wreg(struct radeon_device *rdev, u32 reg, u32 v) | 2468 | static inline void cik_didt_wreg(struct radeon_device *rdev, u32 reg, u32 v) |
| 2394 | { | 2469 | { |
| 2470 | unsigned long flags; | ||
| 2471 | |||
| 2472 | spin_lock_irqsave(&rdev->didt_idx_lock, flags); | ||
| 2395 | WREG32(CIK_DIDT_IND_INDEX, (reg)); | 2473 | WREG32(CIK_DIDT_IND_INDEX, (reg)); |
| 2396 | WREG32(CIK_DIDT_IND_DATA, (v)); | 2474 | WREG32(CIK_DIDT_IND_DATA, (v)); |
| 2475 | spin_unlock_irqrestore(&rdev->didt_idx_lock, flags); | ||
| 2397 | } | 2476 | } |
| 2398 | 2477 | ||
| 2399 | void r100_pll_errata_after_index(struct radeon_device *rdev); | 2478 | void r100_pll_errata_after_index(struct radeon_device *rdev); |
| @@ -2569,6 +2648,7 @@ void radeon_ring_write(struct radeon_ring *ring, uint32_t v); | |||
| 2569 | #define radeon_dpm_force_performance_level(rdev, l) rdev->asic->dpm.force_performance_level((rdev), (l)) | 2648 | #define radeon_dpm_force_performance_level(rdev, l) rdev->asic->dpm.force_performance_level((rdev), (l)) |
| 2570 | #define radeon_dpm_vblank_too_short(rdev) rdev->asic->dpm.vblank_too_short((rdev)) | 2649 | #define radeon_dpm_vblank_too_short(rdev) rdev->asic->dpm.vblank_too_short((rdev)) |
| 2571 | #define radeon_dpm_powergate_uvd(rdev, g) rdev->asic->dpm.powergate_uvd((rdev), (g)) | 2650 | #define radeon_dpm_powergate_uvd(rdev, g) rdev->asic->dpm.powergate_uvd((rdev), (g)) |
| 2651 | #define radeon_dpm_enable_bapm(rdev, e) rdev->asic->dpm.enable_bapm((rdev), (e)) | ||
| 2572 | 2652 | ||
| 2573 | /* Common functions */ | 2653 | /* Common functions */ |
| 2574 | /* AGP */ | 2654 | /* AGP */ |
diff --git a/drivers/gpu/drm/radeon/radeon_asic.c b/drivers/gpu/drm/radeon/radeon_asic.c index 630853b96841..5003385a7512 100644 --- a/drivers/gpu/drm/radeon/radeon_asic.c +++ b/drivers/gpu/drm/radeon/radeon_asic.c | |||
| @@ -1037,6 +1037,7 @@ static struct radeon_asic rv6xx_asic = { | |||
| 1037 | .set_pcie_lanes = &r600_set_pcie_lanes, | 1037 | .set_pcie_lanes = &r600_set_pcie_lanes, |
| 1038 | .set_clock_gating = NULL, | 1038 | .set_clock_gating = NULL, |
| 1039 | .get_temperature = &rv6xx_get_temp, | 1039 | .get_temperature = &rv6xx_get_temp, |
| 1040 | .set_uvd_clocks = &r600_set_uvd_clocks, | ||
| 1040 | }, | 1041 | }, |
| 1041 | .dpm = { | 1042 | .dpm = { |
| 1042 | .init = &rv6xx_dpm_init, | 1043 | .init = &rv6xx_dpm_init, |
| @@ -1126,6 +1127,7 @@ static struct radeon_asic rs780_asic = { | |||
| 1126 | .set_pcie_lanes = NULL, | 1127 | .set_pcie_lanes = NULL, |
| 1127 | .set_clock_gating = NULL, | 1128 | .set_clock_gating = NULL, |
| 1128 | .get_temperature = &rv6xx_get_temp, | 1129 | .get_temperature = &rv6xx_get_temp, |
| 1130 | .set_uvd_clocks = &r600_set_uvd_clocks, | ||
| 1129 | }, | 1131 | }, |
| 1130 | .dpm = { | 1132 | .dpm = { |
| 1131 | .init = &rs780_dpm_init, | 1133 | .init = &rs780_dpm_init, |
| @@ -1141,6 +1143,7 @@ static struct radeon_asic rs780_asic = { | |||
| 1141 | .get_mclk = &rs780_dpm_get_mclk, | 1143 | .get_mclk = &rs780_dpm_get_mclk, |
| 1142 | .print_power_state = &rs780_dpm_print_power_state, | 1144 | .print_power_state = &rs780_dpm_print_power_state, |
| 1143 | .debugfs_print_current_performance_level = &rs780_dpm_debugfs_print_current_performance_level, | 1145 | .debugfs_print_current_performance_level = &rs780_dpm_debugfs_print_current_performance_level, |
| 1146 | .force_performance_level = &rs780_dpm_force_performance_level, | ||
| 1144 | }, | 1147 | }, |
| 1145 | .pflip = { | 1148 | .pflip = { |
| 1146 | .pre_page_flip = &rs600_pre_page_flip, | 1149 | .pre_page_flip = &rs600_pre_page_flip, |
| @@ -1791,6 +1794,7 @@ static struct radeon_asic trinity_asic = { | |||
| 1791 | .print_power_state = &trinity_dpm_print_power_state, | 1794 | .print_power_state = &trinity_dpm_print_power_state, |
| 1792 | .debugfs_print_current_performance_level = &trinity_dpm_debugfs_print_current_performance_level, | 1795 | .debugfs_print_current_performance_level = &trinity_dpm_debugfs_print_current_performance_level, |
| 1793 | .force_performance_level = &trinity_dpm_force_performance_level, | 1796 | .force_performance_level = &trinity_dpm_force_performance_level, |
| 1797 | .enable_bapm = &trinity_dpm_enable_bapm, | ||
| 1794 | }, | 1798 | }, |
| 1795 | .pflip = { | 1799 | .pflip = { |
| 1796 | .pre_page_flip = &evergreen_pre_page_flip, | 1800 | .pre_page_flip = &evergreen_pre_page_flip, |
| @@ -2166,6 +2170,7 @@ static struct radeon_asic kv_asic = { | |||
| 2166 | .debugfs_print_current_performance_level = &kv_dpm_debugfs_print_current_performance_level, | 2170 | .debugfs_print_current_performance_level = &kv_dpm_debugfs_print_current_performance_level, |
| 2167 | .force_performance_level = &kv_dpm_force_performance_level, | 2171 | .force_performance_level = &kv_dpm_force_performance_level, |
| 2168 | .powergate_uvd = &kv_dpm_powergate_uvd, | 2172 | .powergate_uvd = &kv_dpm_powergate_uvd, |
| 2173 | .enable_bapm = &kv_dpm_enable_bapm, | ||
| 2169 | }, | 2174 | }, |
| 2170 | .pflip = { | 2175 | .pflip = { |
| 2171 | .pre_page_flip = &evergreen_pre_page_flip, | 2176 | .pre_page_flip = &evergreen_pre_page_flip, |
| @@ -2390,7 +2395,7 @@ int radeon_asic_init(struct radeon_device *rdev) | |||
| 2390 | RADEON_CG_SUPPORT_HDP_LS | | 2395 | RADEON_CG_SUPPORT_HDP_LS | |
| 2391 | RADEON_CG_SUPPORT_HDP_MGCG; | 2396 | RADEON_CG_SUPPORT_HDP_MGCG; |
| 2392 | rdev->pg_flags = 0 | | 2397 | rdev->pg_flags = 0 | |
| 2393 | /*RADEON_PG_SUPPORT_GFX_CG | */ | 2398 | /*RADEON_PG_SUPPORT_GFX_PG | */ |
| 2394 | RADEON_PG_SUPPORT_SDMA; | 2399 | RADEON_PG_SUPPORT_SDMA; |
| 2395 | break; | 2400 | break; |
| 2396 | case CHIP_OLAND: | 2401 | case CHIP_OLAND: |
| @@ -2479,7 +2484,7 @@ int radeon_asic_init(struct radeon_device *rdev) | |||
| 2479 | RADEON_CG_SUPPORT_HDP_LS | | 2484 | RADEON_CG_SUPPORT_HDP_LS | |
| 2480 | RADEON_CG_SUPPORT_HDP_MGCG; | 2485 | RADEON_CG_SUPPORT_HDP_MGCG; |
| 2481 | rdev->pg_flags = 0; | 2486 | rdev->pg_flags = 0; |
| 2482 | /*RADEON_PG_SUPPORT_GFX_CG | | 2487 | /*RADEON_PG_SUPPORT_GFX_PG | |
| 2483 | RADEON_PG_SUPPORT_GFX_SMG | | 2488 | RADEON_PG_SUPPORT_GFX_SMG | |
| 2484 | RADEON_PG_SUPPORT_GFX_DMG | | 2489 | RADEON_PG_SUPPORT_GFX_DMG | |
| 2485 | RADEON_PG_SUPPORT_UVD | | 2490 | RADEON_PG_SUPPORT_UVD | |
| @@ -2507,7 +2512,7 @@ int radeon_asic_init(struct radeon_device *rdev) | |||
| 2507 | RADEON_CG_SUPPORT_HDP_LS | | 2512 | RADEON_CG_SUPPORT_HDP_LS | |
| 2508 | RADEON_CG_SUPPORT_HDP_MGCG; | 2513 | RADEON_CG_SUPPORT_HDP_MGCG; |
| 2509 | rdev->pg_flags = 0; | 2514 | rdev->pg_flags = 0; |
| 2510 | /*RADEON_PG_SUPPORT_GFX_CG | | 2515 | /*RADEON_PG_SUPPORT_GFX_PG | |
| 2511 | RADEON_PG_SUPPORT_GFX_SMG | | 2516 | RADEON_PG_SUPPORT_GFX_SMG | |
| 2512 | RADEON_PG_SUPPORT_UVD | | 2517 | RADEON_PG_SUPPORT_UVD | |
| 2513 | RADEON_PG_SUPPORT_VCE | | 2518 | RADEON_PG_SUPPORT_VCE | |
diff --git a/drivers/gpu/drm/radeon/radeon_asic.h b/drivers/gpu/drm/radeon/radeon_asic.h index 818bbe6b884b..70c29d5e080d 100644 --- a/drivers/gpu/drm/radeon/radeon_asic.h +++ b/drivers/gpu/drm/radeon/radeon_asic.h | |||
| @@ -389,6 +389,7 @@ int r600_mc_wait_for_idle(struct radeon_device *rdev); | |||
| 389 | u32 r600_get_xclk(struct radeon_device *rdev); | 389 | u32 r600_get_xclk(struct radeon_device *rdev); |
| 390 | uint64_t r600_get_gpu_clock_counter(struct radeon_device *rdev); | 390 | uint64_t r600_get_gpu_clock_counter(struct radeon_device *rdev); |
| 391 | int rv6xx_get_temp(struct radeon_device *rdev); | 391 | int rv6xx_get_temp(struct radeon_device *rdev); |
| 392 | int r600_set_uvd_clocks(struct radeon_device *rdev, u32 vclk, u32 dclk); | ||
| 392 | int r600_dpm_pre_set_power_state(struct radeon_device *rdev); | 393 | int r600_dpm_pre_set_power_state(struct radeon_device *rdev); |
| 393 | void r600_dpm_post_set_power_state(struct radeon_device *rdev); | 394 | void r600_dpm_post_set_power_state(struct radeon_device *rdev); |
| 394 | /* r600 dma */ | 395 | /* r600 dma */ |
| @@ -428,6 +429,8 @@ void rs780_dpm_print_power_state(struct radeon_device *rdev, | |||
| 428 | struct radeon_ps *ps); | 429 | struct radeon_ps *ps); |
| 429 | void rs780_dpm_debugfs_print_current_performance_level(struct radeon_device *rdev, | 430 | void rs780_dpm_debugfs_print_current_performance_level(struct radeon_device *rdev, |
| 430 | struct seq_file *m); | 431 | struct seq_file *m); |
| 432 | int rs780_dpm_force_performance_level(struct radeon_device *rdev, | ||
| 433 | enum radeon_dpm_forced_level level); | ||
| 431 | 434 | ||
| 432 | /* | 435 | /* |
| 433 | * rv770,rv730,rv710,rv740 | 436 | * rv770,rv730,rv710,rv740 |
| @@ -625,6 +628,7 @@ void trinity_dpm_debugfs_print_current_performance_level(struct radeon_device *r | |||
| 625 | struct seq_file *m); | 628 | struct seq_file *m); |
| 626 | int trinity_dpm_force_performance_level(struct radeon_device *rdev, | 629 | int trinity_dpm_force_performance_level(struct radeon_device *rdev, |
| 627 | enum radeon_dpm_forced_level level); | 630 | enum radeon_dpm_forced_level level); |
| 631 | void trinity_dpm_enable_bapm(struct radeon_device *rdev, bool enable); | ||
| 628 | 632 | ||
| 629 | /* DCE6 - SI */ | 633 | /* DCE6 - SI */ |
| 630 | void dce6_bandwidth_update(struct radeon_device *rdev); | 634 | void dce6_bandwidth_update(struct radeon_device *rdev); |
| @@ -781,6 +785,7 @@ void kv_dpm_debugfs_print_current_performance_level(struct radeon_device *rdev, | |||
| 781 | int kv_dpm_force_performance_level(struct radeon_device *rdev, | 785 | int kv_dpm_force_performance_level(struct radeon_device *rdev, |
| 782 | enum radeon_dpm_forced_level level); | 786 | enum radeon_dpm_forced_level level); |
| 783 | void kv_dpm_powergate_uvd(struct radeon_device *rdev, bool gate); | 787 | void kv_dpm_powergate_uvd(struct radeon_device *rdev, bool gate); |
| 788 | void kv_dpm_enable_bapm(struct radeon_device *rdev, bool enable); | ||
| 784 | 789 | ||
| 785 | /* uvd v1.0 */ | 790 | /* uvd v1.0 */ |
| 786 | uint32_t uvd_v1_0_get_rptr(struct radeon_device *rdev, | 791 | uint32_t uvd_v1_0_get_rptr(struct radeon_device *rdev, |
diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c b/drivers/gpu/drm/radeon/radeon_connectors.c index 2399f25ec037..79159b5da05b 100644 --- a/drivers/gpu/drm/radeon/radeon_connectors.c +++ b/drivers/gpu/drm/radeon/radeon_connectors.c | |||
| @@ -396,6 +396,21 @@ static int radeon_connector_set_property(struct drm_connector *connector, struct | |||
| 396 | } | 396 | } |
| 397 | } | 397 | } |
| 398 | 398 | ||
| 399 | if (property == rdev->mode_info.audio_property) { | ||
| 400 | struct radeon_connector *radeon_connector = to_radeon_connector(connector); | ||
| 401 | /* need to find digital encoder on connector */ | ||
| 402 | encoder = radeon_find_encoder(connector, DRM_MODE_ENCODER_TMDS); | ||
| 403 | if (!encoder) | ||
| 404 | return 0; | ||
| 405 | |||
| 406 | radeon_encoder = to_radeon_encoder(encoder); | ||
| 407 | |||
| 408 | if (radeon_connector->audio != val) { | ||
| 409 | radeon_connector->audio = val; | ||
| 410 | radeon_property_change_mode(&radeon_encoder->base); | ||
| 411 | } | ||
| 412 | } | ||
| 413 | |||
| 399 | if (property == rdev->mode_info.underscan_property) { | 414 | if (property == rdev->mode_info.underscan_property) { |
| 400 | /* need to find digital encoder on connector */ | 415 | /* need to find digital encoder on connector */ |
| 401 | encoder = radeon_find_encoder(connector, DRM_MODE_ENCODER_TMDS); | 416 | encoder = radeon_find_encoder(connector, DRM_MODE_ENCODER_TMDS); |
| @@ -1420,7 +1435,7 @@ radeon_dp_detect(struct drm_connector *connector, bool force) | |||
| 1420 | if (radeon_dp_getdpcd(radeon_connector)) | 1435 | if (radeon_dp_getdpcd(radeon_connector)) |
| 1421 | ret = connector_status_connected; | 1436 | ret = connector_status_connected; |
| 1422 | } else { | 1437 | } else { |
| 1423 | /* try non-aux ddc (DP to DVI/HMDI/etc. adapter) */ | 1438 | /* try non-aux ddc (DP to DVI/HDMI/etc. adapter) */ |
| 1424 | if (radeon_ddc_probe(radeon_connector, false)) | 1439 | if (radeon_ddc_probe(radeon_connector, false)) |
| 1425 | ret = connector_status_connected; | 1440 | ret = connector_status_connected; |
| 1426 | } | 1441 | } |
| @@ -1489,6 +1504,24 @@ static const struct drm_connector_funcs radeon_dp_connector_funcs = { | |||
| 1489 | .force = radeon_dvi_force, | 1504 | .force = radeon_dvi_force, |
| 1490 | }; | 1505 | }; |
| 1491 | 1506 | ||
| 1507 | static const struct drm_connector_funcs radeon_edp_connector_funcs = { | ||
| 1508 | .dpms = drm_helper_connector_dpms, | ||
| 1509 | .detect = radeon_dp_detect, | ||
| 1510 | .fill_modes = drm_helper_probe_single_connector_modes, | ||
| 1511 | .set_property = radeon_lvds_set_property, | ||
| 1512 | .destroy = radeon_dp_connector_destroy, | ||
| 1513 | .force = radeon_dvi_force, | ||
| 1514 | }; | ||
| 1515 | |||
| 1516 | static const struct drm_connector_funcs radeon_lvds_bridge_connector_funcs = { | ||
| 1517 | .dpms = drm_helper_connector_dpms, | ||
| 1518 | .detect = radeon_dp_detect, | ||
| 1519 | .fill_modes = drm_helper_probe_single_connector_modes, | ||
| 1520 | .set_property = radeon_lvds_set_property, | ||
| 1521 | .destroy = radeon_dp_connector_destroy, | ||
| 1522 | .force = radeon_dvi_force, | ||
| 1523 | }; | ||
| 1524 | |||
| 1492 | void | 1525 | void |
| 1493 | radeon_add_atom_connector(struct drm_device *dev, | 1526 | radeon_add_atom_connector(struct drm_device *dev, |
| 1494 | uint32_t connector_id, | 1527 | uint32_t connector_id, |
| @@ -1580,8 +1613,6 @@ radeon_add_atom_connector(struct drm_device *dev, | |||
| 1580 | goto failed; | 1613 | goto failed; |
| 1581 | radeon_dig_connector->igp_lane_info = igp_lane_info; | 1614 | radeon_dig_connector->igp_lane_info = igp_lane_info; |
| 1582 | radeon_connector->con_priv = radeon_dig_connector; | 1615 | radeon_connector->con_priv = radeon_dig_connector; |
| 1583 | drm_connector_init(dev, &radeon_connector->base, &radeon_dp_connector_funcs, connector_type); | ||
| 1584 | drm_connector_helper_add(&radeon_connector->base, &radeon_dp_connector_helper_funcs); | ||
| 1585 | if (i2c_bus->valid) { | 1616 | if (i2c_bus->valid) { |
| 1586 | /* add DP i2c bus */ | 1617 | /* add DP i2c bus */ |
| 1587 | if (connector_type == DRM_MODE_CONNECTOR_eDP) | 1618 | if (connector_type == DRM_MODE_CONNECTOR_eDP) |
| @@ -1598,6 +1629,10 @@ radeon_add_atom_connector(struct drm_device *dev, | |||
| 1598 | case DRM_MODE_CONNECTOR_VGA: | 1629 | case DRM_MODE_CONNECTOR_VGA: |
| 1599 | case DRM_MODE_CONNECTOR_DVIA: | 1630 | case DRM_MODE_CONNECTOR_DVIA: |
| 1600 | default: | 1631 | default: |
| 1632 | drm_connector_init(dev, &radeon_connector->base, | ||
| 1633 | &radeon_dp_connector_funcs, connector_type); | ||
| 1634 | drm_connector_helper_add(&radeon_connector->base, | ||
| 1635 | &radeon_dp_connector_helper_funcs); | ||
| 1601 | connector->interlace_allowed = true; | 1636 | connector->interlace_allowed = true; |
| 1602 | connector->doublescan_allowed = true; | 1637 | connector->doublescan_allowed = true; |
| 1603 | radeon_connector->dac_load_detect = true; | 1638 | radeon_connector->dac_load_detect = true; |
| @@ -1610,6 +1645,10 @@ radeon_add_atom_connector(struct drm_device *dev, | |||
| 1610 | case DRM_MODE_CONNECTOR_HDMIA: | 1645 | case DRM_MODE_CONNECTOR_HDMIA: |
| 1611 | case DRM_MODE_CONNECTOR_HDMIB: | 1646 | case DRM_MODE_CONNECTOR_HDMIB: |
| 1612 | case DRM_MODE_CONNECTOR_DisplayPort: | 1647 | case DRM_MODE_CONNECTOR_DisplayPort: |
| 1648 | drm_connector_init(dev, &radeon_connector->base, | ||
| 1649 | &radeon_dp_connector_funcs, connector_type); | ||
| 1650 | drm_connector_helper_add(&radeon_connector->base, | ||
| 1651 | &radeon_dp_connector_helper_funcs); | ||
| 1613 | drm_object_attach_property(&radeon_connector->base.base, | 1652 | drm_object_attach_property(&radeon_connector->base.base, |
| 1614 | rdev->mode_info.underscan_property, | 1653 | rdev->mode_info.underscan_property, |
| 1615 | UNDERSCAN_OFF); | 1654 | UNDERSCAN_OFF); |
| @@ -1619,6 +1658,9 @@ radeon_add_atom_connector(struct drm_device *dev, | |||
| 1619 | drm_object_attach_property(&radeon_connector->base.base, | 1658 | drm_object_attach_property(&radeon_connector->base.base, |
| 1620 | rdev->mode_info.underscan_vborder_property, | 1659 | rdev->mode_info.underscan_vborder_property, |
| 1621 | 0); | 1660 | 0); |
| 1661 | drm_object_attach_property(&radeon_connector->base.base, | ||
| 1662 | rdev->mode_info.audio_property, | ||
| 1663 | RADEON_AUDIO_DISABLE); | ||
| 1622 | subpixel_order = SubPixelHorizontalRGB; | 1664 | subpixel_order = SubPixelHorizontalRGB; |
| 1623 | connector->interlace_allowed = true; | 1665 | connector->interlace_allowed = true; |
| 1624 | if (connector_type == DRM_MODE_CONNECTOR_HDMIB) | 1666 | if (connector_type == DRM_MODE_CONNECTOR_HDMIB) |
| @@ -1634,6 +1676,10 @@ radeon_add_atom_connector(struct drm_device *dev, | |||
| 1634 | break; | 1676 | break; |
| 1635 | case DRM_MODE_CONNECTOR_LVDS: | 1677 | case DRM_MODE_CONNECTOR_LVDS: |
| 1636 | case DRM_MODE_CONNECTOR_eDP: | 1678 | case DRM_MODE_CONNECTOR_eDP: |
| 1679 | drm_connector_init(dev, &radeon_connector->base, | ||
| 1680 | &radeon_lvds_bridge_connector_funcs, connector_type); | ||
| 1681 | drm_connector_helper_add(&radeon_connector->base, | ||
| 1682 | &radeon_dp_connector_helper_funcs); | ||
| 1637 | drm_object_attach_property(&radeon_connector->base.base, | 1683 | drm_object_attach_property(&radeon_connector->base.base, |
| 1638 | dev->mode_config.scaling_mode_property, | 1684 | dev->mode_config.scaling_mode_property, |
| 1639 | DRM_MODE_SCALE_FULLSCREEN); | 1685 | DRM_MODE_SCALE_FULLSCREEN); |
| @@ -1708,6 +1754,11 @@ radeon_add_atom_connector(struct drm_device *dev, | |||
| 1708 | rdev->mode_info.underscan_vborder_property, | 1754 | rdev->mode_info.underscan_vborder_property, |
| 1709 | 0); | 1755 | 0); |
| 1710 | } | 1756 | } |
| 1757 | if (ASIC_IS_DCE2(rdev)) { | ||
| 1758 | drm_object_attach_property(&radeon_connector->base.base, | ||
| 1759 | rdev->mode_info.audio_property, | ||
| 1760 | RADEON_AUDIO_DISABLE); | ||
| 1761 | } | ||
| 1711 | if (connector_type == DRM_MODE_CONNECTOR_DVII) { | 1762 | if (connector_type == DRM_MODE_CONNECTOR_DVII) { |
| 1712 | radeon_connector->dac_load_detect = true; | 1763 | radeon_connector->dac_load_detect = true; |
| 1713 | drm_object_attach_property(&radeon_connector->base.base, | 1764 | drm_object_attach_property(&radeon_connector->base.base, |
| @@ -1748,6 +1799,11 @@ radeon_add_atom_connector(struct drm_device *dev, | |||
| 1748 | rdev->mode_info.underscan_vborder_property, | 1799 | rdev->mode_info.underscan_vborder_property, |
| 1749 | 0); | 1800 | 0); |
| 1750 | } | 1801 | } |
| 1802 | if (ASIC_IS_DCE2(rdev)) { | ||
| 1803 | drm_object_attach_property(&radeon_connector->base.base, | ||
| 1804 | rdev->mode_info.audio_property, | ||
| 1805 | RADEON_AUDIO_DISABLE); | ||
| 1806 | } | ||
| 1751 | subpixel_order = SubPixelHorizontalRGB; | 1807 | subpixel_order = SubPixelHorizontalRGB; |
| 1752 | connector->interlace_allowed = true; | 1808 | connector->interlace_allowed = true; |
| 1753 | if (connector_type == DRM_MODE_CONNECTOR_HDMIB) | 1809 | if (connector_type == DRM_MODE_CONNECTOR_HDMIB) |
| @@ -1787,6 +1843,11 @@ radeon_add_atom_connector(struct drm_device *dev, | |||
| 1787 | rdev->mode_info.underscan_vborder_property, | 1843 | rdev->mode_info.underscan_vborder_property, |
| 1788 | 0); | 1844 | 0); |
| 1789 | } | 1845 | } |
| 1846 | if (ASIC_IS_DCE2(rdev)) { | ||
| 1847 | drm_object_attach_property(&radeon_connector->base.base, | ||
| 1848 | rdev->mode_info.audio_property, | ||
| 1849 | RADEON_AUDIO_DISABLE); | ||
| 1850 | } | ||
| 1790 | connector->interlace_allowed = true; | 1851 | connector->interlace_allowed = true; |
| 1791 | /* in theory with a DP to VGA converter... */ | 1852 | /* in theory with a DP to VGA converter... */ |
| 1792 | connector->doublescan_allowed = false; | 1853 | connector->doublescan_allowed = false; |
| @@ -1797,7 +1858,7 @@ radeon_add_atom_connector(struct drm_device *dev, | |||
| 1797 | goto failed; | 1858 | goto failed; |
| 1798 | radeon_dig_connector->igp_lane_info = igp_lane_info; | 1859 | radeon_dig_connector->igp_lane_info = igp_lane_info; |
| 1799 | radeon_connector->con_priv = radeon_dig_connector; | 1860 | radeon_connector->con_priv = radeon_dig_connector; |
| 1800 | drm_connector_init(dev, &radeon_connector->base, &radeon_dp_connector_funcs, connector_type); | 1861 | drm_connector_init(dev, &radeon_connector->base, &radeon_edp_connector_funcs, connector_type); |
| 1801 | drm_connector_helper_add(&radeon_connector->base, &radeon_dp_connector_helper_funcs); | 1862 | drm_connector_helper_add(&radeon_connector->base, &radeon_dp_connector_helper_funcs); |
| 1802 | if (i2c_bus->valid) { | 1863 | if (i2c_bus->valid) { |
| 1803 | /* add DP i2c bus */ | 1864 | /* add DP i2c bus */ |
diff --git a/drivers/gpu/drm/radeon/radeon_cs.c b/drivers/gpu/drm/radeon/radeon_cs.c index a56084410372..ac6ece61a476 100644 --- a/drivers/gpu/drm/radeon/radeon_cs.c +++ b/drivers/gpu/drm/radeon/radeon_cs.c | |||
| @@ -28,6 +28,7 @@ | |||
| 28 | #include <drm/radeon_drm.h> | 28 | #include <drm/radeon_drm.h> |
| 29 | #include "radeon_reg.h" | 29 | #include "radeon_reg.h" |
| 30 | #include "radeon.h" | 30 | #include "radeon.h" |
| 31 | #include "radeon_trace.h" | ||
| 31 | 32 | ||
| 32 | static int radeon_cs_parser_relocs(struct radeon_cs_parser *p) | 33 | static int radeon_cs_parser_relocs(struct radeon_cs_parser *p) |
| 33 | { | 34 | { |
| @@ -80,9 +81,11 @@ static int radeon_cs_parser_relocs(struct radeon_cs_parser *p) | |||
| 80 | p->relocs[i].lobj.bo = p->relocs[i].robj; | 81 | p->relocs[i].lobj.bo = p->relocs[i].robj; |
| 81 | p->relocs[i].lobj.written = !!r->write_domain; | 82 | p->relocs[i].lobj.written = !!r->write_domain; |
| 82 | 83 | ||
| 83 | /* the first reloc of an UVD job is the | 84 | /* the first reloc of an UVD job is the msg and that must be in |
| 84 | msg and that must be in VRAM */ | 85 | VRAM, also but everything into VRAM on AGP cards to avoid |
| 85 | if (p->ring == R600_RING_TYPE_UVD_INDEX && i == 0) { | 86 | image corruptions */ |
| 87 | if (p->ring == R600_RING_TYPE_UVD_INDEX && | ||
| 88 | (i == 0 || p->rdev->flags & RADEON_IS_AGP)) { | ||
| 86 | /* TODO: is this still needed for NI+ ? */ | 89 | /* TODO: is this still needed for NI+ ? */ |
| 87 | p->relocs[i].lobj.domain = | 90 | p->relocs[i].lobj.domain = |
| 88 | RADEON_GEM_DOMAIN_VRAM; | 91 | RADEON_GEM_DOMAIN_VRAM; |
| @@ -559,6 +562,8 @@ int radeon_cs_ioctl(struct drm_device *dev, void *data, struct drm_file *filp) | |||
| 559 | return r; | 562 | return r; |
| 560 | } | 563 | } |
| 561 | 564 | ||
| 565 | trace_radeon_cs(&parser); | ||
| 566 | |||
| 562 | r = radeon_cs_ib_chunk(rdev, &parser); | 567 | r = radeon_cs_ib_chunk(rdev, &parser); |
| 563 | if (r) { | 568 | if (r) { |
| 564 | goto out; | 569 | goto out; |
diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c index 16cb8792b1e6..e29faa73b574 100644 --- a/drivers/gpu/drm/radeon/radeon_device.c +++ b/drivers/gpu/drm/radeon/radeon_device.c | |||
| @@ -1249,6 +1249,17 @@ int radeon_device_init(struct radeon_device *rdev, | |||
| 1249 | /* Registers mapping */ | 1249 | /* Registers mapping */ |
| 1250 | /* TODO: block userspace mapping of io register */ | 1250 | /* TODO: block userspace mapping of io register */ |
| 1251 | spin_lock_init(&rdev->mmio_idx_lock); | 1251 | spin_lock_init(&rdev->mmio_idx_lock); |
| 1252 | spin_lock_init(&rdev->smc_idx_lock); | ||
| 1253 | spin_lock_init(&rdev->pll_idx_lock); | ||
| 1254 | spin_lock_init(&rdev->mc_idx_lock); | ||
| 1255 | spin_lock_init(&rdev->pcie_idx_lock); | ||
| 1256 | spin_lock_init(&rdev->pciep_idx_lock); | ||
| 1257 | spin_lock_init(&rdev->pif_idx_lock); | ||
| 1258 | spin_lock_init(&rdev->cg_idx_lock); | ||
| 1259 | spin_lock_init(&rdev->uvd_idx_lock); | ||
| 1260 | spin_lock_init(&rdev->rcu_idx_lock); | ||
| 1261 | spin_lock_init(&rdev->didt_idx_lock); | ||
| 1262 | spin_lock_init(&rdev->end_idx_lock); | ||
| 1252 | if (rdev->family >= CHIP_BONAIRE) { | 1263 | if (rdev->family >= CHIP_BONAIRE) { |
| 1253 | rdev->rmmio_base = pci_resource_start(rdev->pdev, 5); | 1264 | rdev->rmmio_base = pci_resource_start(rdev->pdev, 5); |
| 1254 | rdev->rmmio_size = pci_resource_len(rdev->pdev, 5); | 1265 | rdev->rmmio_size = pci_resource_len(rdev->pdev, 5); |
diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c index b055bddaa94c..0d1aa050d41d 100644 --- a/drivers/gpu/drm/radeon/radeon_display.c +++ b/drivers/gpu/drm/radeon/radeon_display.c | |||
| @@ -1172,6 +1172,12 @@ static struct drm_prop_enum_list radeon_underscan_enum_list[] = | |||
| 1172 | { UNDERSCAN_AUTO, "auto" }, | 1172 | { UNDERSCAN_AUTO, "auto" }, |
| 1173 | }; | 1173 | }; |
| 1174 | 1174 | ||
| 1175 | static struct drm_prop_enum_list radeon_audio_enum_list[] = | ||
| 1176 | { { RADEON_AUDIO_DISABLE, "off" }, | ||
| 1177 | { RADEON_AUDIO_ENABLE, "on" }, | ||
| 1178 | { RADEON_AUDIO_AUTO, "auto" }, | ||
| 1179 | }; | ||
| 1180 | |||
| 1175 | static int radeon_modeset_create_props(struct radeon_device *rdev) | 1181 | static int radeon_modeset_create_props(struct radeon_device *rdev) |
| 1176 | { | 1182 | { |
| 1177 | int sz; | 1183 | int sz; |
| @@ -1222,6 +1228,12 @@ static int radeon_modeset_create_props(struct radeon_device *rdev) | |||
| 1222 | if (!rdev->mode_info.underscan_vborder_property) | 1228 | if (!rdev->mode_info.underscan_vborder_property) |
| 1223 | return -ENOMEM; | 1229 | return -ENOMEM; |
| 1224 | 1230 | ||
| 1231 | sz = ARRAY_SIZE(radeon_audio_enum_list); | ||
| 1232 | rdev->mode_info.audio_property = | ||
| 1233 | drm_property_create_enum(rdev->ddev, 0, | ||
| 1234 | "audio", | ||
| 1235 | radeon_audio_enum_list, sz); | ||
| 1236 | |||
| 1225 | return 0; | 1237 | return 0; |
| 1226 | } | 1238 | } |
| 1227 | 1239 | ||
diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c index cb4445f55a96..cdd12dcd988b 100644 --- a/drivers/gpu/drm/radeon/radeon_drv.c +++ b/drivers/gpu/drm/radeon/radeon_drv.c | |||
| @@ -153,7 +153,7 @@ int radeon_benchmarking = 0; | |||
| 153 | int radeon_testing = 0; | 153 | int radeon_testing = 0; |
| 154 | int radeon_connector_table = 0; | 154 | int radeon_connector_table = 0; |
| 155 | int radeon_tv = 1; | 155 | int radeon_tv = 1; |
| 156 | int radeon_audio = 0; | 156 | int radeon_audio = 1; |
| 157 | int radeon_disp_priority = 0; | 157 | int radeon_disp_priority = 0; |
| 158 | int radeon_hw_i2c = 0; | 158 | int radeon_hw_i2c = 0; |
| 159 | int radeon_pcie_gen2 = -1; | 159 | int radeon_pcie_gen2 = -1; |
diff --git a/drivers/gpu/drm/radeon/radeon_mode.h b/drivers/gpu/drm/radeon/radeon_mode.h index d908d8d68f6b..ef63d3f00b2f 100644 --- a/drivers/gpu/drm/radeon/radeon_mode.h +++ b/drivers/gpu/drm/radeon/radeon_mode.h | |||
| @@ -247,6 +247,8 @@ struct radeon_mode_info { | |||
| 247 | struct drm_property *underscan_property; | 247 | struct drm_property *underscan_property; |
| 248 | struct drm_property *underscan_hborder_property; | 248 | struct drm_property *underscan_hborder_property; |
| 249 | struct drm_property *underscan_vborder_property; | 249 | struct drm_property *underscan_vborder_property; |
| 250 | /* audio */ | ||
| 251 | struct drm_property *audio_property; | ||
| 250 | /* hardcoded DFP edid from BIOS */ | 252 | /* hardcoded DFP edid from BIOS */ |
| 251 | struct edid *bios_hardcoded_edid; | 253 | struct edid *bios_hardcoded_edid; |
| 252 | int bios_hardcoded_edid_size; | 254 | int bios_hardcoded_edid_size; |
| @@ -471,6 +473,12 @@ struct radeon_router { | |||
| 471 | u8 cd_mux_state; | 473 | u8 cd_mux_state; |
| 472 | }; | 474 | }; |
| 473 | 475 | ||
| 476 | enum radeon_connector_audio { | ||
| 477 | RADEON_AUDIO_DISABLE = 0, | ||
| 478 | RADEON_AUDIO_ENABLE = 1, | ||
| 479 | RADEON_AUDIO_AUTO = 2 | ||
| 480 | }; | ||
| 481 | |||
| 474 | struct radeon_connector { | 482 | struct radeon_connector { |
| 475 | struct drm_connector base; | 483 | struct drm_connector base; |
| 476 | uint32_t connector_id; | 484 | uint32_t connector_id; |
| @@ -489,6 +497,7 @@ struct radeon_connector { | |||
| 489 | struct radeon_hpd hpd; | 497 | struct radeon_hpd hpd; |
| 490 | struct radeon_router router; | 498 | struct radeon_router router; |
| 491 | struct radeon_i2c_chan *router_bus; | 499 | struct radeon_i2c_chan *router_bus; |
| 500 | enum radeon_connector_audio audio; | ||
| 492 | }; | 501 | }; |
| 493 | 502 | ||
| 494 | struct radeon_framebuffer { | 503 | struct radeon_framebuffer { |
diff --git a/drivers/gpu/drm/radeon/radeon_pm.c b/drivers/gpu/drm/radeon/radeon_pm.c index d7555369a3e5..87e1d69e8fdb 100644 --- a/drivers/gpu/drm/radeon/radeon_pm.c +++ b/drivers/gpu/drm/radeon/radeon_pm.c | |||
| @@ -67,7 +67,16 @@ int radeon_pm_get_type_index(struct radeon_device *rdev, | |||
| 67 | 67 | ||
| 68 | void radeon_pm_acpi_event_handler(struct radeon_device *rdev) | 68 | void radeon_pm_acpi_event_handler(struct radeon_device *rdev) |
| 69 | { | 69 | { |
| 70 | if (rdev->pm.pm_method == PM_METHOD_PROFILE) { | 70 | if ((rdev->pm.pm_method == PM_METHOD_DPM) && rdev->pm.dpm_enabled) { |
| 71 | mutex_lock(&rdev->pm.mutex); | ||
| 72 | if (power_supply_is_system_supplied() > 0) | ||
| 73 | rdev->pm.dpm.ac_power = true; | ||
| 74 | else | ||
| 75 | rdev->pm.dpm.ac_power = false; | ||
| 76 | if (rdev->asic->dpm.enable_bapm) | ||
| 77 | radeon_dpm_enable_bapm(rdev, rdev->pm.dpm.ac_power); | ||
| 78 | mutex_unlock(&rdev->pm.mutex); | ||
| 79 | } else if (rdev->pm.pm_method == PM_METHOD_PROFILE) { | ||
| 71 | if (rdev->pm.profile == PM_PROFILE_AUTO) { | 80 | if (rdev->pm.profile == PM_PROFILE_AUTO) { |
| 72 | mutex_lock(&rdev->pm.mutex); | 81 | mutex_lock(&rdev->pm.mutex); |
| 73 | radeon_pm_update_profile(rdev); | 82 | radeon_pm_update_profile(rdev); |
| @@ -333,7 +342,7 @@ static ssize_t radeon_get_pm_profile(struct device *dev, | |||
| 333 | struct device_attribute *attr, | 342 | struct device_attribute *attr, |
| 334 | char *buf) | 343 | char *buf) |
| 335 | { | 344 | { |
| 336 | struct drm_device *ddev = pci_get_drvdata(to_pci_dev(dev)); | 345 | struct drm_device *ddev = dev_get_drvdata(dev); |
| 337 | struct radeon_device *rdev = ddev->dev_private; | 346 | struct radeon_device *rdev = ddev->dev_private; |
| 338 | int cp = rdev->pm.profile; | 347 | int cp = rdev->pm.profile; |
| 339 | 348 | ||
| @@ -349,7 +358,7 @@ static ssize_t radeon_set_pm_profile(struct device *dev, | |||
| 349 | const char *buf, | 358 | const char *buf, |
| 350 | size_t count) | 359 | size_t count) |
| 351 | { | 360 | { |
| 352 | struct drm_device *ddev = pci_get_drvdata(to_pci_dev(dev)); | 361 | struct drm_device *ddev = dev_get_drvdata(dev); |
| 353 | struct radeon_device *rdev = ddev->dev_private; | 362 | struct radeon_device *rdev = ddev->dev_private; |
| 354 | 363 | ||
| 355 | mutex_lock(&rdev->pm.mutex); | 364 | mutex_lock(&rdev->pm.mutex); |
| @@ -383,7 +392,7 @@ static ssize_t radeon_get_pm_method(struct device *dev, | |||
| 383 | struct device_attribute *attr, | 392 | struct device_attribute *attr, |
| 384 | char *buf) | 393 | char *buf) |
| 385 | { | 394 | { |
| 386 | struct drm_device *ddev = pci_get_drvdata(to_pci_dev(dev)); | 395 | struct drm_device *ddev = dev_get_drvdata(dev); |
| 387 | struct radeon_device *rdev = ddev->dev_private; | 396 | struct radeon_device *rdev = ddev->dev_private; |
| 388 | int pm = rdev->pm.pm_method; | 397 | int pm = rdev->pm.pm_method; |
| 389 | 398 | ||
| @@ -397,7 +406,7 @@ static ssize_t radeon_set_pm_method(struct device *dev, | |||
| 397 | const char *buf, | 406 | const char *buf, |
| 398 | size_t count) | 407 | size_t count) |
| 399 | { | 408 | { |
| 400 | struct drm_device *ddev = pci_get_drvdata(to_pci_dev(dev)); | 409 | struct drm_device *ddev = dev_get_drvdata(dev); |
| 401 | struct radeon_device *rdev = ddev->dev_private; | 410 | struct radeon_device *rdev = ddev->dev_private; |
| 402 | 411 | ||
| 403 | /* we don't support the legacy modes with dpm */ | 412 | /* we don't support the legacy modes with dpm */ |
| @@ -433,7 +442,7 @@ static ssize_t radeon_get_dpm_state(struct device *dev, | |||
| 433 | struct device_attribute *attr, | 442 | struct device_attribute *attr, |
| 434 | char *buf) | 443 | char *buf) |
| 435 | { | 444 | { |
| 436 | struct drm_device *ddev = pci_get_drvdata(to_pci_dev(dev)); | 445 | struct drm_device *ddev = dev_get_drvdata(dev); |
| 437 | struct radeon_device *rdev = ddev->dev_private; | 446 | struct radeon_device *rdev = ddev->dev_private; |
| 438 | enum radeon_pm_state_type pm = rdev->pm.dpm.user_state; | 447 | enum radeon_pm_state_type pm = rdev->pm.dpm.user_state; |
| 439 | 448 | ||
| @@ -447,7 +456,7 @@ static ssize_t radeon_set_dpm_state(struct device *dev, | |||
| 447 | const char *buf, | 456 | const char *buf, |
| 448 | size_t count) | 457 | size_t count) |
| 449 | { | 458 | { |
| 450 | struct drm_device *ddev = pci_get_drvdata(to_pci_dev(dev)); | 459 | struct drm_device *ddev = dev_get_drvdata(dev); |
| 451 | struct radeon_device *rdev = ddev->dev_private; | 460 | struct radeon_device *rdev = ddev->dev_private; |
| 452 | 461 | ||
| 453 | mutex_lock(&rdev->pm.mutex); | 462 | mutex_lock(&rdev->pm.mutex); |
| @@ -472,7 +481,7 @@ static ssize_t radeon_get_dpm_forced_performance_level(struct device *dev, | |||
| 472 | struct device_attribute *attr, | 481 | struct device_attribute *attr, |
| 473 | char *buf) | 482 | char *buf) |
| 474 | { | 483 | { |
| 475 | struct drm_device *ddev = pci_get_drvdata(to_pci_dev(dev)); | 484 | struct drm_device *ddev = dev_get_drvdata(dev); |
| 476 | struct radeon_device *rdev = ddev->dev_private; | 485 | struct radeon_device *rdev = ddev->dev_private; |
| 477 | enum radeon_dpm_forced_level level = rdev->pm.dpm.forced_level; | 486 | enum radeon_dpm_forced_level level = rdev->pm.dpm.forced_level; |
| 478 | 487 | ||
| @@ -486,7 +495,7 @@ static ssize_t radeon_set_dpm_forced_performance_level(struct device *dev, | |||
| 486 | const char *buf, | 495 | const char *buf, |
| 487 | size_t count) | 496 | size_t count) |
| 488 | { | 497 | { |
| 489 | struct drm_device *ddev = pci_get_drvdata(to_pci_dev(dev)); | 498 | struct drm_device *ddev = dev_get_drvdata(dev); |
| 490 | struct radeon_device *rdev = ddev->dev_private; | 499 | struct radeon_device *rdev = ddev->dev_private; |
| 491 | enum radeon_dpm_forced_level level; | 500 | enum radeon_dpm_forced_level level; |
| 492 | int ret = 0; | 501 | int ret = 0; |
| @@ -524,7 +533,7 @@ static ssize_t radeon_hwmon_show_temp(struct device *dev, | |||
| 524 | struct device_attribute *attr, | 533 | struct device_attribute *attr, |
| 525 | char *buf) | 534 | char *buf) |
| 526 | { | 535 | { |
| 527 | struct drm_device *ddev = pci_get_drvdata(to_pci_dev(dev)); | 536 | struct drm_device *ddev = dev_get_drvdata(dev); |
| 528 | struct radeon_device *rdev = ddev->dev_private; | 537 | struct radeon_device *rdev = ddev->dev_private; |
| 529 | int temp; | 538 | int temp; |
| 530 | 539 | ||
| @@ -536,6 +545,23 @@ static ssize_t radeon_hwmon_show_temp(struct device *dev, | |||
| 536 | return snprintf(buf, PAGE_SIZE, "%d\n", temp); | 545 | return snprintf(buf, PAGE_SIZE, "%d\n", temp); |
| 537 | } | 546 | } |
| 538 | 547 | ||
| 548 | static ssize_t radeon_hwmon_show_temp_thresh(struct device *dev, | ||
| 549 | struct device_attribute *attr, | ||
| 550 | char *buf) | ||
| 551 | { | ||
| 552 | struct drm_device *ddev = dev_get_drvdata(dev); | ||
| 553 | struct radeon_device *rdev = ddev->dev_private; | ||
| 554 | int hyst = to_sensor_dev_attr(attr)->index; | ||
| 555 | int temp; | ||
| 556 | |||
| 557 | if (hyst) | ||
| 558 | temp = rdev->pm.dpm.thermal.min_temp; | ||
| 559 | else | ||
| 560 | temp = rdev->pm.dpm.thermal.max_temp; | ||
| 561 | |||
| 562 | return snprintf(buf, PAGE_SIZE, "%d\n", temp); | ||
| 563 | } | ||
| 564 | |||
| 539 | static ssize_t radeon_hwmon_show_name(struct device *dev, | 565 | static ssize_t radeon_hwmon_show_name(struct device *dev, |
| 540 | struct device_attribute *attr, | 566 | struct device_attribute *attr, |
| 541 | char *buf) | 567 | char *buf) |
| @@ -544,16 +570,37 @@ static ssize_t radeon_hwmon_show_name(struct device *dev, | |||
| 544 | } | 570 | } |
| 545 | 571 | ||
| 546 | static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, radeon_hwmon_show_temp, NULL, 0); | 572 | static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, radeon_hwmon_show_temp, NULL, 0); |
| 573 | static SENSOR_DEVICE_ATTR(temp1_crit, S_IRUGO, radeon_hwmon_show_temp_thresh, NULL, 0); | ||
| 574 | static SENSOR_DEVICE_ATTR(temp1_crit_hyst, S_IRUGO, radeon_hwmon_show_temp_thresh, NULL, 1); | ||
| 547 | static SENSOR_DEVICE_ATTR(name, S_IRUGO, radeon_hwmon_show_name, NULL, 0); | 575 | static SENSOR_DEVICE_ATTR(name, S_IRUGO, radeon_hwmon_show_name, NULL, 0); |
| 548 | 576 | ||
| 549 | static struct attribute *hwmon_attributes[] = { | 577 | static struct attribute *hwmon_attributes[] = { |
| 550 | &sensor_dev_attr_temp1_input.dev_attr.attr, | 578 | &sensor_dev_attr_temp1_input.dev_attr.attr, |
| 579 | &sensor_dev_attr_temp1_crit.dev_attr.attr, | ||
| 580 | &sensor_dev_attr_temp1_crit_hyst.dev_attr.attr, | ||
| 551 | &sensor_dev_attr_name.dev_attr.attr, | 581 | &sensor_dev_attr_name.dev_attr.attr, |
| 552 | NULL | 582 | NULL |
| 553 | }; | 583 | }; |
| 554 | 584 | ||
| 585 | static umode_t hwmon_attributes_visible(struct kobject *kobj, | ||
| 586 | struct attribute *attr, int index) | ||
| 587 | { | ||
| 588 | struct device *dev = container_of(kobj, struct device, kobj); | ||
| 589 | struct drm_device *ddev = dev_get_drvdata(dev); | ||
| 590 | struct radeon_device *rdev = ddev->dev_private; | ||
| 591 | |||
| 592 | /* Skip limit attributes if DPM is not enabled */ | ||
| 593 | if (rdev->pm.pm_method != PM_METHOD_DPM && | ||
| 594 | (attr == &sensor_dev_attr_temp1_crit.dev_attr.attr || | ||
| 595 | attr == &sensor_dev_attr_temp1_crit_hyst.dev_attr.attr)) | ||
| 596 | return 0; | ||
| 597 | |||
| 598 | return attr->mode; | ||
| 599 | } | ||
| 600 | |||
| 555 | static const struct attribute_group hwmon_attrgroup = { | 601 | static const struct attribute_group hwmon_attrgroup = { |
| 556 | .attrs = hwmon_attributes, | 602 | .attrs = hwmon_attributes, |
| 603 | .is_visible = hwmon_attributes_visible, | ||
| 557 | }; | 604 | }; |
| 558 | 605 | ||
| 559 | static int radeon_hwmon_init(struct radeon_device *rdev) | 606 | static int radeon_hwmon_init(struct radeon_device *rdev) |
| @@ -870,10 +917,13 @@ static void radeon_dpm_change_power_state_locked(struct radeon_device *rdev) | |||
| 870 | 917 | ||
| 871 | radeon_dpm_post_set_power_state(rdev); | 918 | radeon_dpm_post_set_power_state(rdev); |
| 872 | 919 | ||
| 873 | /* force low perf level for thermal */ | 920 | if (rdev->asic->dpm.force_performance_level) { |
| 874 | if (rdev->pm.dpm.thermal_active && | 921 | if (rdev->pm.dpm.thermal_active) |
| 875 | rdev->asic->dpm.force_performance_level) { | 922 | /* force low perf level for thermal */ |
| 876 | radeon_dpm_force_performance_level(rdev, RADEON_DPM_FORCED_LEVEL_LOW); | 923 | radeon_dpm_force_performance_level(rdev, RADEON_DPM_FORCED_LEVEL_LOW); |
| 924 | else | ||
| 925 | /* otherwise, enable auto */ | ||
| 926 | radeon_dpm_force_performance_level(rdev, RADEON_DPM_FORCED_LEVEL_AUTO); | ||
| 877 | } | 927 | } |
| 878 | 928 | ||
| 879 | done: | 929 | done: |
| @@ -1102,9 +1152,10 @@ static int radeon_pm_init_dpm(struct radeon_device *rdev) | |||
| 1102 | { | 1152 | { |
| 1103 | int ret; | 1153 | int ret; |
| 1104 | 1154 | ||
| 1105 | /* default to performance state */ | 1155 | /* default to balanced state */ |
| 1106 | rdev->pm.dpm.state = POWER_STATE_TYPE_BALANCED; | 1156 | rdev->pm.dpm.state = POWER_STATE_TYPE_BALANCED; |
| 1107 | rdev->pm.dpm.user_state = POWER_STATE_TYPE_BALANCED; | 1157 | rdev->pm.dpm.user_state = POWER_STATE_TYPE_BALANCED; |
| 1158 | rdev->pm.dpm.forced_level = RADEON_DPM_FORCED_LEVEL_AUTO; | ||
| 1108 | rdev->pm.default_sclk = rdev->clock.default_sclk; | 1159 | rdev->pm.default_sclk = rdev->clock.default_sclk; |
| 1109 | rdev->pm.default_mclk = rdev->clock.default_mclk; | 1160 | rdev->pm.default_mclk = rdev->clock.default_mclk; |
| 1110 | rdev->pm.current_sclk = rdev->clock.default_sclk; | 1161 | rdev->pm.current_sclk = rdev->clock.default_sclk; |
diff --git a/drivers/gpu/drm/radeon/radeon_trace.h b/drivers/gpu/drm/radeon/radeon_trace.h index eafd8160a155..f7e367815964 100644 --- a/drivers/gpu/drm/radeon/radeon_trace.h +++ b/drivers/gpu/drm/radeon/radeon_trace.h | |||
| @@ -27,6 +27,26 @@ TRACE_EVENT(radeon_bo_create, | |||
| 27 | TP_printk("bo=%p, pages=%u", __entry->bo, __entry->pages) | 27 | TP_printk("bo=%p, pages=%u", __entry->bo, __entry->pages) |
| 28 | ); | 28 | ); |
| 29 | 29 | ||
| 30 | TRACE_EVENT(radeon_cs, | ||
| 31 | TP_PROTO(struct radeon_cs_parser *p), | ||
| 32 | TP_ARGS(p), | ||
| 33 | TP_STRUCT__entry( | ||
| 34 | __field(u32, ring) | ||
| 35 | __field(u32, dw) | ||
| 36 | __field(u32, fences) | ||
| 37 | ), | ||
| 38 | |||
| 39 | TP_fast_assign( | ||
| 40 | __entry->ring = p->ring; | ||
| 41 | __entry->dw = p->chunks[p->chunk_ib_idx].length_dw; | ||
| 42 | __entry->fences = radeon_fence_count_emitted( | ||
| 43 | p->rdev, p->ring); | ||
| 44 | ), | ||
| 45 | TP_printk("ring=%u, dw=%u, fences=%u", | ||
| 46 | __entry->ring, __entry->dw, | ||
| 47 | __entry->fences) | ||
| 48 | ); | ||
| 49 | |||
| 30 | DECLARE_EVENT_CLASS(radeon_fence_request, | 50 | DECLARE_EVENT_CLASS(radeon_fence_request, |
| 31 | 51 | ||
| 32 | TP_PROTO(struct drm_device *dev, u32 seqno), | 52 | TP_PROTO(struct drm_device *dev, u32 seqno), |
| @@ -53,13 +73,6 @@ DEFINE_EVENT(radeon_fence_request, radeon_fence_emit, | |||
| 53 | TP_ARGS(dev, seqno) | 73 | TP_ARGS(dev, seqno) |
| 54 | ); | 74 | ); |
| 55 | 75 | ||
| 56 | DEFINE_EVENT(radeon_fence_request, radeon_fence_retire, | ||
| 57 | |||
| 58 | TP_PROTO(struct drm_device *dev, u32 seqno), | ||
| 59 | |||
| 60 | TP_ARGS(dev, seqno) | ||
| 61 | ); | ||
| 62 | |||
| 63 | DEFINE_EVENT(radeon_fence_request, radeon_fence_wait_begin, | 76 | DEFINE_EVENT(radeon_fence_request, radeon_fence_wait_begin, |
| 64 | 77 | ||
| 65 | TP_PROTO(struct drm_device *dev, u32 seqno), | 78 | TP_PROTO(struct drm_device *dev, u32 seqno), |
diff --git a/drivers/gpu/drm/radeon/rs400.c b/drivers/gpu/drm/radeon/rs400.c index b8074a8ec75a..9566b5940a5a 100644 --- a/drivers/gpu/drm/radeon/rs400.c +++ b/drivers/gpu/drm/radeon/rs400.c | |||
| @@ -274,19 +274,26 @@ static void rs400_mc_init(struct radeon_device *rdev) | |||
| 274 | 274 | ||
| 275 | uint32_t rs400_mc_rreg(struct radeon_device *rdev, uint32_t reg) | 275 | uint32_t rs400_mc_rreg(struct radeon_device *rdev, uint32_t reg) |
| 276 | { | 276 | { |
| 277 | unsigned long flags; | ||
| 277 | uint32_t r; | 278 | uint32_t r; |
| 278 | 279 | ||
| 280 | spin_lock_irqsave(&rdev->mc_idx_lock, flags); | ||
| 279 | WREG32(RS480_NB_MC_INDEX, reg & 0xff); | 281 | WREG32(RS480_NB_MC_INDEX, reg & 0xff); |
| 280 | r = RREG32(RS480_NB_MC_DATA); | 282 | r = RREG32(RS480_NB_MC_DATA); |
| 281 | WREG32(RS480_NB_MC_INDEX, 0xff); | 283 | WREG32(RS480_NB_MC_INDEX, 0xff); |
| 284 | spin_unlock_irqrestore(&rdev->mc_idx_lock, flags); | ||
| 282 | return r; | 285 | return r; |
| 283 | } | 286 | } |
| 284 | 287 | ||
| 285 | void rs400_mc_wreg(struct radeon_device *rdev, uint32_t reg, uint32_t v) | 288 | void rs400_mc_wreg(struct radeon_device *rdev, uint32_t reg, uint32_t v) |
| 286 | { | 289 | { |
| 290 | unsigned long flags; | ||
| 291 | |||
| 292 | spin_lock_irqsave(&rdev->mc_idx_lock, flags); | ||
| 287 | WREG32(RS480_NB_MC_INDEX, ((reg) & 0xff) | RS480_NB_MC_IND_WR_EN); | 293 | WREG32(RS480_NB_MC_INDEX, ((reg) & 0xff) | RS480_NB_MC_IND_WR_EN); |
| 288 | WREG32(RS480_NB_MC_DATA, (v)); | 294 | WREG32(RS480_NB_MC_DATA, (v)); |
| 289 | WREG32(RS480_NB_MC_INDEX, 0xff); | 295 | WREG32(RS480_NB_MC_INDEX, 0xff); |
| 296 | spin_unlock_irqrestore(&rdev->mc_idx_lock, flags); | ||
| 290 | } | 297 | } |
| 291 | 298 | ||
| 292 | #if defined(CONFIG_DEBUG_FS) | 299 | #if defined(CONFIG_DEBUG_FS) |
diff --git a/drivers/gpu/drm/radeon/rs600.c b/drivers/gpu/drm/radeon/rs600.c index 670b555d2ca2..6acba8017b9a 100644 --- a/drivers/gpu/drm/radeon/rs600.c +++ b/drivers/gpu/drm/radeon/rs600.c | |||
| @@ -847,16 +847,26 @@ void rs600_bandwidth_update(struct radeon_device *rdev) | |||
| 847 | 847 | ||
| 848 | uint32_t rs600_mc_rreg(struct radeon_device *rdev, uint32_t reg) | 848 | uint32_t rs600_mc_rreg(struct radeon_device *rdev, uint32_t reg) |
| 849 | { | 849 | { |
| 850 | unsigned long flags; | ||
| 851 | u32 r; | ||
| 852 | |||
| 853 | spin_lock_irqsave(&rdev->mc_idx_lock, flags); | ||
| 850 | WREG32(R_000070_MC_IND_INDEX, S_000070_MC_IND_ADDR(reg) | | 854 | WREG32(R_000070_MC_IND_INDEX, S_000070_MC_IND_ADDR(reg) | |
| 851 | S_000070_MC_IND_CITF_ARB0(1)); | 855 | S_000070_MC_IND_CITF_ARB0(1)); |
| 852 | return RREG32(R_000074_MC_IND_DATA); | 856 | r = RREG32(R_000074_MC_IND_DATA); |
| 857 | spin_unlock_irqrestore(&rdev->mc_idx_lock, flags); | ||
| 858 | return r; | ||
| 853 | } | 859 | } |
| 854 | 860 | ||
| 855 | void rs600_mc_wreg(struct radeon_device *rdev, uint32_t reg, uint32_t v) | 861 | void rs600_mc_wreg(struct radeon_device *rdev, uint32_t reg, uint32_t v) |
| 856 | { | 862 | { |
| 863 | unsigned long flags; | ||
| 864 | |||
| 865 | spin_lock_irqsave(&rdev->mc_idx_lock, flags); | ||
| 857 | WREG32(R_000070_MC_IND_INDEX, S_000070_MC_IND_ADDR(reg) | | 866 | WREG32(R_000070_MC_IND_INDEX, S_000070_MC_IND_ADDR(reg) | |
| 858 | S_000070_MC_IND_CITF_ARB0(1) | S_000070_MC_IND_WR_EN(1)); | 867 | S_000070_MC_IND_CITF_ARB0(1) | S_000070_MC_IND_WR_EN(1)); |
| 859 | WREG32(R_000074_MC_IND_DATA, v); | 868 | WREG32(R_000074_MC_IND_DATA, v); |
| 869 | spin_unlock_irqrestore(&rdev->mc_idx_lock, flags); | ||
| 860 | } | 870 | } |
| 861 | 871 | ||
| 862 | static void rs600_debugfs(struct radeon_device *rdev) | 872 | static void rs600_debugfs(struct radeon_device *rdev) |
diff --git a/drivers/gpu/drm/radeon/rs690.c b/drivers/gpu/drm/radeon/rs690.c index d8ddfb34545d..1447d794c22a 100644 --- a/drivers/gpu/drm/radeon/rs690.c +++ b/drivers/gpu/drm/radeon/rs690.c | |||
| @@ -631,20 +631,27 @@ void rs690_bandwidth_update(struct radeon_device *rdev) | |||
| 631 | 631 | ||
| 632 | uint32_t rs690_mc_rreg(struct radeon_device *rdev, uint32_t reg) | 632 | uint32_t rs690_mc_rreg(struct radeon_device *rdev, uint32_t reg) |
| 633 | { | 633 | { |
| 634 | unsigned long flags; | ||
| 634 | uint32_t r; | 635 | uint32_t r; |
| 635 | 636 | ||
| 637 | spin_lock_irqsave(&rdev->mc_idx_lock, flags); | ||
| 636 | WREG32(R_000078_MC_INDEX, S_000078_MC_IND_ADDR(reg)); | 638 | WREG32(R_000078_MC_INDEX, S_000078_MC_IND_ADDR(reg)); |
| 637 | r = RREG32(R_00007C_MC_DATA); | 639 | r = RREG32(R_00007C_MC_DATA); |
| 638 | WREG32(R_000078_MC_INDEX, ~C_000078_MC_IND_ADDR); | 640 | WREG32(R_000078_MC_INDEX, ~C_000078_MC_IND_ADDR); |
| 641 | spin_unlock_irqrestore(&rdev->mc_idx_lock, flags); | ||
| 639 | return r; | 642 | return r; |
| 640 | } | 643 | } |
| 641 | 644 | ||
| 642 | void rs690_mc_wreg(struct radeon_device *rdev, uint32_t reg, uint32_t v) | 645 | void rs690_mc_wreg(struct radeon_device *rdev, uint32_t reg, uint32_t v) |
| 643 | { | 646 | { |
| 647 | unsigned long flags; | ||
| 648 | |||
| 649 | spin_lock_irqsave(&rdev->mc_idx_lock, flags); | ||
| 644 | WREG32(R_000078_MC_INDEX, S_000078_MC_IND_ADDR(reg) | | 650 | WREG32(R_000078_MC_INDEX, S_000078_MC_IND_ADDR(reg) | |
| 645 | S_000078_MC_IND_WR_EN(1)); | 651 | S_000078_MC_IND_WR_EN(1)); |
| 646 | WREG32(R_00007C_MC_DATA, v); | 652 | WREG32(R_00007C_MC_DATA, v); |
| 647 | WREG32(R_000078_MC_INDEX, 0x7F); | 653 | WREG32(R_000078_MC_INDEX, 0x7F); |
| 654 | spin_unlock_irqrestore(&rdev->mc_idx_lock, flags); | ||
| 648 | } | 655 | } |
| 649 | 656 | ||
| 650 | static void rs690_mc_program(struct radeon_device *rdev) | 657 | static void rs690_mc_program(struct radeon_device *rdev) |
diff --git a/drivers/gpu/drm/radeon/rs780_dpm.c b/drivers/gpu/drm/radeon/rs780_dpm.c index d1a1ce73bd45..6af8505cf4d2 100644 --- a/drivers/gpu/drm/radeon/rs780_dpm.c +++ b/drivers/gpu/drm/radeon/rs780_dpm.c | |||
| @@ -62,9 +62,7 @@ static void rs780_get_pm_mode_parameters(struct radeon_device *rdev) | |||
| 62 | radeon_crtc = to_radeon_crtc(crtc); | 62 | radeon_crtc = to_radeon_crtc(crtc); |
| 63 | pi->crtc_id = radeon_crtc->crtc_id; | 63 | pi->crtc_id = radeon_crtc->crtc_id; |
| 64 | if (crtc->mode.htotal && crtc->mode.vtotal) | 64 | if (crtc->mode.htotal && crtc->mode.vtotal) |
| 65 | pi->refresh_rate = | 65 | pi->refresh_rate = drm_mode_vrefresh(&crtc->mode); |
| 66 | (crtc->mode.clock * 1000) / | ||
| 67 | (crtc->mode.htotal * crtc->mode.vtotal); | ||
| 68 | break; | 66 | break; |
| 69 | } | 67 | } |
| 70 | } | 68 | } |
| @@ -376,9 +374,8 @@ static void rs780_disable_vbios_powersaving(struct radeon_device *rdev) | |||
| 376 | WREG32_P(CG_INTGFX_MISC, 0, ~0xFFF00000); | 374 | WREG32_P(CG_INTGFX_MISC, 0, ~0xFFF00000); |
| 377 | } | 375 | } |
| 378 | 376 | ||
| 379 | static void rs780_force_voltage_to_high(struct radeon_device *rdev) | 377 | static void rs780_force_voltage(struct radeon_device *rdev, u16 voltage) |
| 380 | { | 378 | { |
| 381 | struct igp_power_info *pi = rs780_get_pi(rdev); | ||
| 382 | struct igp_ps *current_state = rs780_get_ps(rdev->pm.dpm.current_ps); | 379 | struct igp_ps *current_state = rs780_get_ps(rdev->pm.dpm.current_ps); |
| 383 | 380 | ||
| 384 | if ((current_state->max_voltage == RS780_VDDC_LEVEL_HIGH) && | 381 | if ((current_state->max_voltage == RS780_VDDC_LEVEL_HIGH) && |
| @@ -390,7 +387,7 @@ static void rs780_force_voltage_to_high(struct radeon_device *rdev) | |||
| 390 | udelay(1); | 387 | udelay(1); |
| 391 | 388 | ||
| 392 | WREG32_P(FVTHROT_PWM_CTRL_REG0, | 389 | WREG32_P(FVTHROT_PWM_CTRL_REG0, |
| 393 | STARTING_PWM_HIGHTIME(pi->max_voltage), | 390 | STARTING_PWM_HIGHTIME(voltage), |
| 394 | ~STARTING_PWM_HIGHTIME_MASK); | 391 | ~STARTING_PWM_HIGHTIME_MASK); |
| 395 | 392 | ||
| 396 | WREG32_P(FVTHROT_PWM_CTRL_REG0, | 393 | WREG32_P(FVTHROT_PWM_CTRL_REG0, |
| @@ -404,6 +401,26 @@ static void rs780_force_voltage_to_high(struct radeon_device *rdev) | |||
| 404 | WREG32_P(GFX_MACRO_BYPASS_CNTL, 0, ~SPLL_BYPASS_CNTL); | 401 | WREG32_P(GFX_MACRO_BYPASS_CNTL, 0, ~SPLL_BYPASS_CNTL); |
| 405 | } | 402 | } |
| 406 | 403 | ||
| 404 | static void rs780_force_fbdiv(struct radeon_device *rdev, u32 fb_div) | ||
| 405 | { | ||
| 406 | struct igp_ps *current_state = rs780_get_ps(rdev->pm.dpm.current_ps); | ||
| 407 | |||
| 408 | if (current_state->sclk_low == current_state->sclk_high) | ||
| 409 | return; | ||
| 410 | |||
| 411 | WREG32_P(GFX_MACRO_BYPASS_CNTL, SPLL_BYPASS_CNTL, ~SPLL_BYPASS_CNTL); | ||
| 412 | |||
| 413 | WREG32_P(FVTHROT_FBDIV_REG2, FORCED_FEEDBACK_DIV(fb_div), | ||
| 414 | ~FORCED_FEEDBACK_DIV_MASK); | ||
| 415 | WREG32_P(FVTHROT_FBDIV_REG1, STARTING_FEEDBACK_DIV(fb_div), | ||
| 416 | ~STARTING_FEEDBACK_DIV_MASK); | ||
| 417 | WREG32_P(FVTHROT_FBDIV_REG1, FORCE_FEEDBACK_DIV, ~FORCE_FEEDBACK_DIV); | ||
| 418 | |||
| 419 | udelay(100); | ||
| 420 | |||
| 421 | WREG32_P(GFX_MACRO_BYPASS_CNTL, 0, ~SPLL_BYPASS_CNTL); | ||
| 422 | } | ||
| 423 | |||
| 407 | static int rs780_set_engine_clock_scaling(struct radeon_device *rdev, | 424 | static int rs780_set_engine_clock_scaling(struct radeon_device *rdev, |
| 408 | struct radeon_ps *new_ps, | 425 | struct radeon_ps *new_ps, |
| 409 | struct radeon_ps *old_ps) | 426 | struct radeon_ps *old_ps) |
| @@ -432,17 +449,13 @@ static int rs780_set_engine_clock_scaling(struct radeon_device *rdev, | |||
| 432 | if (ret) | 449 | if (ret) |
| 433 | return ret; | 450 | return ret; |
| 434 | 451 | ||
| 435 | WREG32_P(GFX_MACRO_BYPASS_CNTL, SPLL_BYPASS_CNTL, ~SPLL_BYPASS_CNTL); | 452 | if ((min_dividers.ref_div != max_dividers.ref_div) || |
| 436 | 453 | (min_dividers.post_div != max_dividers.post_div) || | |
| 437 | WREG32_P(FVTHROT_FBDIV_REG2, FORCED_FEEDBACK_DIV(max_dividers.fb_div), | 454 | (max_dividers.ref_div != current_max_dividers.ref_div) || |
| 438 | ~FORCED_FEEDBACK_DIV_MASK); | 455 | (max_dividers.post_div != current_max_dividers.post_div)) |
| 439 | WREG32_P(FVTHROT_FBDIV_REG1, STARTING_FEEDBACK_DIV(max_dividers.fb_div), | 456 | return -EINVAL; |
| 440 | ~STARTING_FEEDBACK_DIV_MASK); | ||
| 441 | WREG32_P(FVTHROT_FBDIV_REG1, FORCE_FEEDBACK_DIV, ~FORCE_FEEDBACK_DIV); | ||
| 442 | |||
| 443 | udelay(100); | ||
| 444 | 457 | ||
| 445 | WREG32_P(GFX_MACRO_BYPASS_CNTL, 0, ~SPLL_BYPASS_CNTL); | 458 | rs780_force_fbdiv(rdev, max_dividers.fb_div); |
| 446 | 459 | ||
| 447 | if (max_dividers.fb_div > min_dividers.fb_div) { | 460 | if (max_dividers.fb_div > min_dividers.fb_div) { |
| 448 | WREG32_P(FVTHROT_FBDIV_REG0, | 461 | WREG32_P(FVTHROT_FBDIV_REG0, |
| @@ -486,6 +499,9 @@ static void rs780_activate_engine_clk_scaling(struct radeon_device *rdev, | |||
| 486 | (new_state->sclk_low == old_state->sclk_low)) | 499 | (new_state->sclk_low == old_state->sclk_low)) |
| 487 | return; | 500 | return; |
| 488 | 501 | ||
| 502 | if (new_state->sclk_high == new_state->sclk_low) | ||
| 503 | return; | ||
| 504 | |||
| 489 | rs780_clk_scaling_enable(rdev, true); | 505 | rs780_clk_scaling_enable(rdev, true); |
| 490 | } | 506 | } |
| 491 | 507 | ||
| @@ -649,7 +665,7 @@ int rs780_dpm_set_power_state(struct radeon_device *rdev) | |||
| 649 | rs780_set_uvd_clock_before_set_eng_clock(rdev, new_ps, old_ps); | 665 | rs780_set_uvd_clock_before_set_eng_clock(rdev, new_ps, old_ps); |
| 650 | 666 | ||
| 651 | if (pi->voltage_control) { | 667 | if (pi->voltage_control) { |
| 652 | rs780_force_voltage_to_high(rdev); | 668 | rs780_force_voltage(rdev, pi->max_voltage); |
| 653 | mdelay(5); | 669 | mdelay(5); |
| 654 | } | 670 | } |
| 655 | 671 | ||
| @@ -717,14 +733,18 @@ static void rs780_parse_pplib_non_clock_info(struct radeon_device *rdev, | |||
| 717 | if (ATOM_PPLIB_NONCLOCKINFO_VER1 < table_rev) { | 733 | if (ATOM_PPLIB_NONCLOCKINFO_VER1 < table_rev) { |
| 718 | rps->vclk = le32_to_cpu(non_clock_info->ulVCLK); | 734 | rps->vclk = le32_to_cpu(non_clock_info->ulVCLK); |
| 719 | rps->dclk = le32_to_cpu(non_clock_info->ulDCLK); | 735 | rps->dclk = le32_to_cpu(non_clock_info->ulDCLK); |
| 720 | } else if (r600_is_uvd_state(rps->class, rps->class2)) { | ||
| 721 | rps->vclk = RS780_DEFAULT_VCLK_FREQ; | ||
| 722 | rps->dclk = RS780_DEFAULT_DCLK_FREQ; | ||
| 723 | } else { | 736 | } else { |
| 724 | rps->vclk = 0; | 737 | rps->vclk = 0; |
| 725 | rps->dclk = 0; | 738 | rps->dclk = 0; |
| 726 | } | 739 | } |
| 727 | 740 | ||
| 741 | if (r600_is_uvd_state(rps->class, rps->class2)) { | ||
| 742 | if ((rps->vclk == 0) || (rps->dclk == 0)) { | ||
| 743 | rps->vclk = RS780_DEFAULT_VCLK_FREQ; | ||
| 744 | rps->dclk = RS780_DEFAULT_DCLK_FREQ; | ||
| 745 | } | ||
| 746 | } | ||
| 747 | |||
| 728 | if (rps->class & ATOM_PPLIB_CLASSIFICATION_BOOT) | 748 | if (rps->class & ATOM_PPLIB_CLASSIFICATION_BOOT) |
| 729 | rdev->pm.dpm.boot_ps = rps; | 749 | rdev->pm.dpm.boot_ps = rps; |
| 730 | if (rps->class & ATOM_PPLIB_CLASSIFICATION_UVDSTATE) | 750 | if (rps->class & ATOM_PPLIB_CLASSIFICATION_UVDSTATE) |
| @@ -986,3 +1006,55 @@ void rs780_dpm_debugfs_print_current_performance_level(struct radeon_device *rde | |||
| 986 | seq_printf(m, "power level 1 sclk: %u vddc_index: %d\n", | 1006 | seq_printf(m, "power level 1 sclk: %u vddc_index: %d\n", |
| 987 | ps->sclk_high, ps->max_voltage); | 1007 | ps->sclk_high, ps->max_voltage); |
| 988 | } | 1008 | } |
| 1009 | |||
| 1010 | int rs780_dpm_force_performance_level(struct radeon_device *rdev, | ||
| 1011 | enum radeon_dpm_forced_level level) | ||
| 1012 | { | ||
| 1013 | struct igp_power_info *pi = rs780_get_pi(rdev); | ||
| 1014 | struct radeon_ps *rps = rdev->pm.dpm.current_ps; | ||
| 1015 | struct igp_ps *ps = rs780_get_ps(rps); | ||
| 1016 | struct atom_clock_dividers dividers; | ||
| 1017 | int ret; | ||
| 1018 | |||
| 1019 | rs780_clk_scaling_enable(rdev, false); | ||
| 1020 | rs780_voltage_scaling_enable(rdev, false); | ||
| 1021 | |||
| 1022 | if (level == RADEON_DPM_FORCED_LEVEL_HIGH) { | ||
| 1023 | if (pi->voltage_control) | ||
| 1024 | rs780_force_voltage(rdev, pi->max_voltage); | ||
| 1025 | |||
| 1026 | ret = radeon_atom_get_clock_dividers(rdev, COMPUTE_ENGINE_PLL_PARAM, | ||
| 1027 | ps->sclk_high, false, ÷rs); | ||
| 1028 | if (ret) | ||
| 1029 | return ret; | ||
| 1030 | |||
| 1031 | rs780_force_fbdiv(rdev, dividers.fb_div); | ||
| 1032 | } else if (level == RADEON_DPM_FORCED_LEVEL_LOW) { | ||
| 1033 | ret = radeon_atom_get_clock_dividers(rdev, COMPUTE_ENGINE_PLL_PARAM, | ||
| 1034 | ps->sclk_low, false, ÷rs); | ||
| 1035 | if (ret) | ||
| 1036 | return ret; | ||
| 1037 | |||
| 1038 | rs780_force_fbdiv(rdev, dividers.fb_div); | ||
| 1039 | |||
| 1040 | if (pi->voltage_control) | ||
| 1041 | rs780_force_voltage(rdev, pi->min_voltage); | ||
| 1042 | } else { | ||
| 1043 | if (pi->voltage_control) | ||
| 1044 | rs780_force_voltage(rdev, pi->max_voltage); | ||
| 1045 | |||
| 1046 | if (ps->sclk_high != ps->sclk_low) { | ||
| 1047 | WREG32_P(FVTHROT_FBDIV_REG1, 0, ~FORCE_FEEDBACK_DIV); | ||
| 1048 | rs780_clk_scaling_enable(rdev, true); | ||
| 1049 | } | ||
| 1050 | |||
| 1051 | if (pi->voltage_control) { | ||
| 1052 | rs780_voltage_scaling_enable(rdev, true); | ||
| 1053 | rs780_enable_voltage_scaling(rdev, rps); | ||
| 1054 | } | ||
| 1055 | } | ||
| 1056 | |||
| 1057 | rdev->pm.dpm.forced_level = level; | ||
| 1058 | |||
| 1059 | return 0; | ||
| 1060 | } | ||
diff --git a/drivers/gpu/drm/radeon/rv515.c b/drivers/gpu/drm/radeon/rv515.c index 8ea1573ae820..873eb4b193b4 100644 --- a/drivers/gpu/drm/radeon/rv515.c +++ b/drivers/gpu/drm/radeon/rv515.c | |||
| @@ -209,19 +209,27 @@ static void rv515_mc_init(struct radeon_device *rdev) | |||
| 209 | 209 | ||
| 210 | uint32_t rv515_mc_rreg(struct radeon_device *rdev, uint32_t reg) | 210 | uint32_t rv515_mc_rreg(struct radeon_device *rdev, uint32_t reg) |
| 211 | { | 211 | { |
| 212 | unsigned long flags; | ||
| 212 | uint32_t r; | 213 | uint32_t r; |
| 213 | 214 | ||
| 215 | spin_lock_irqsave(&rdev->mc_idx_lock, flags); | ||
| 214 | WREG32(MC_IND_INDEX, 0x7f0000 | (reg & 0xffff)); | 216 | WREG32(MC_IND_INDEX, 0x7f0000 | (reg & 0xffff)); |
| 215 | r = RREG32(MC_IND_DATA); | 217 | r = RREG32(MC_IND_DATA); |
| 216 | WREG32(MC_IND_INDEX, 0); | 218 | WREG32(MC_IND_INDEX, 0); |
| 219 | spin_unlock_irqrestore(&rdev->mc_idx_lock, flags); | ||
| 220 | |||
| 217 | return r; | 221 | return r; |
| 218 | } | 222 | } |
| 219 | 223 | ||
| 220 | void rv515_mc_wreg(struct radeon_device *rdev, uint32_t reg, uint32_t v) | 224 | void rv515_mc_wreg(struct radeon_device *rdev, uint32_t reg, uint32_t v) |
| 221 | { | 225 | { |
| 226 | unsigned long flags; | ||
| 227 | |||
| 228 | spin_lock_irqsave(&rdev->mc_idx_lock, flags); | ||
| 222 | WREG32(MC_IND_INDEX, 0xff0000 | ((reg) & 0xffff)); | 229 | WREG32(MC_IND_INDEX, 0xff0000 | ((reg) & 0xffff)); |
| 223 | WREG32(MC_IND_DATA, (v)); | 230 | WREG32(MC_IND_DATA, (v)); |
| 224 | WREG32(MC_IND_INDEX, 0); | 231 | WREG32(MC_IND_INDEX, 0); |
| 232 | spin_unlock_irqrestore(&rdev->mc_idx_lock, flags); | ||
| 225 | } | 233 | } |
| 226 | 234 | ||
| 227 | #if defined(CONFIG_DEBUG_FS) | 235 | #if defined(CONFIG_DEBUG_FS) |
diff --git a/drivers/gpu/drm/radeon/rv6xx_dpm.c b/drivers/gpu/drm/radeon/rv6xx_dpm.c index ab1f2016f21e..5811d277a36a 100644 --- a/drivers/gpu/drm/radeon/rv6xx_dpm.c +++ b/drivers/gpu/drm/radeon/rv6xx_dpm.c | |||
| @@ -1758,8 +1758,6 @@ int rv6xx_dpm_set_power_state(struct radeon_device *rdev) | |||
| 1758 | 1758 | ||
| 1759 | rv6xx_set_uvd_clock_after_set_eng_clock(rdev, new_ps, old_ps); | 1759 | rv6xx_set_uvd_clock_after_set_eng_clock(rdev, new_ps, old_ps); |
| 1760 | 1760 | ||
| 1761 | rdev->pm.dpm.forced_level = RADEON_DPM_FORCED_LEVEL_AUTO; | ||
| 1762 | |||
| 1763 | return 0; | 1761 | return 0; |
| 1764 | } | 1762 | } |
| 1765 | 1763 | ||
diff --git a/drivers/gpu/drm/radeon/rv770_dpm.c b/drivers/gpu/drm/radeon/rv770_dpm.c index 8cbb85dae5aa..913b025ae9b3 100644 --- a/drivers/gpu/drm/radeon/rv770_dpm.c +++ b/drivers/gpu/drm/radeon/rv770_dpm.c | |||
| @@ -2064,12 +2064,6 @@ int rv770_dpm_set_power_state(struct radeon_device *rdev) | |||
| 2064 | rv770_program_dcodt_after_state_switch(rdev, new_ps, old_ps); | 2064 | rv770_program_dcodt_after_state_switch(rdev, new_ps, old_ps); |
| 2065 | rv770_set_uvd_clock_after_set_eng_clock(rdev, new_ps, old_ps); | 2065 | rv770_set_uvd_clock_after_set_eng_clock(rdev, new_ps, old_ps); |
| 2066 | 2066 | ||
| 2067 | ret = rv770_dpm_force_performance_level(rdev, RADEON_DPM_FORCED_LEVEL_AUTO); | ||
| 2068 | if (ret) { | ||
| 2069 | DRM_ERROR("rv770_dpm_force_performance_level failed\n"); | ||
| 2070 | return ret; | ||
| 2071 | } | ||
| 2072 | |||
| 2073 | return 0; | 2067 | return 0; |
| 2074 | } | 2068 | } |
| 2075 | 2069 | ||
| @@ -2147,14 +2141,18 @@ static void rv7xx_parse_pplib_non_clock_info(struct radeon_device *rdev, | |||
| 2147 | if (ATOM_PPLIB_NONCLOCKINFO_VER1 < table_rev) { | 2141 | if (ATOM_PPLIB_NONCLOCKINFO_VER1 < table_rev) { |
| 2148 | rps->vclk = le32_to_cpu(non_clock_info->ulVCLK); | 2142 | rps->vclk = le32_to_cpu(non_clock_info->ulVCLK); |
| 2149 | rps->dclk = le32_to_cpu(non_clock_info->ulDCLK); | 2143 | rps->dclk = le32_to_cpu(non_clock_info->ulDCLK); |
| 2150 | } else if (r600_is_uvd_state(rps->class, rps->class2)) { | ||
| 2151 | rps->vclk = RV770_DEFAULT_VCLK_FREQ; | ||
| 2152 | rps->dclk = RV770_DEFAULT_DCLK_FREQ; | ||
| 2153 | } else { | 2144 | } else { |
| 2154 | rps->vclk = 0; | 2145 | rps->vclk = 0; |
| 2155 | rps->dclk = 0; | 2146 | rps->dclk = 0; |
| 2156 | } | 2147 | } |
| 2157 | 2148 | ||
| 2149 | if (r600_is_uvd_state(rps->class, rps->class2)) { | ||
| 2150 | if ((rps->vclk == 0) || (rps->dclk == 0)) { | ||
| 2151 | rps->vclk = RV770_DEFAULT_VCLK_FREQ; | ||
| 2152 | rps->dclk = RV770_DEFAULT_DCLK_FREQ; | ||
| 2153 | } | ||
| 2154 | } | ||
| 2155 | |||
| 2158 | if (rps->class & ATOM_PPLIB_CLASSIFICATION_BOOT) | 2156 | if (rps->class & ATOM_PPLIB_CLASSIFICATION_BOOT) |
| 2159 | rdev->pm.dpm.boot_ps = rps; | 2157 | rdev->pm.dpm.boot_ps = rps; |
| 2160 | if (rps->class & ATOM_PPLIB_CLASSIFICATION_UVDSTATE) | 2158 | if (rps->class & ATOM_PPLIB_CLASSIFICATION_UVDSTATE) |
diff --git a/drivers/gpu/drm/radeon/rv770_smc.c b/drivers/gpu/drm/radeon/rv770_smc.c index ab95da570215..b2a224407365 100644 --- a/drivers/gpu/drm/radeon/rv770_smc.c +++ b/drivers/gpu/drm/radeon/rv770_smc.c | |||
| @@ -274,8 +274,8 @@ static const u8 cayman_smc_int_vectors[] = | |||
| 274 | 0x08, 0x72, 0x08, 0x72 | 274 | 0x08, 0x72, 0x08, 0x72 |
| 275 | }; | 275 | }; |
| 276 | 276 | ||
| 277 | int rv770_set_smc_sram_address(struct radeon_device *rdev, | 277 | static int rv770_set_smc_sram_address(struct radeon_device *rdev, |
| 278 | u16 smc_address, u16 limit) | 278 | u16 smc_address, u16 limit) |
| 279 | { | 279 | { |
| 280 | u32 addr; | 280 | u32 addr; |
| 281 | 281 | ||
| @@ -296,9 +296,10 @@ int rv770_copy_bytes_to_smc(struct radeon_device *rdev, | |||
| 296 | u16 smc_start_address, const u8 *src, | 296 | u16 smc_start_address, const u8 *src, |
| 297 | u16 byte_count, u16 limit) | 297 | u16 byte_count, u16 limit) |
| 298 | { | 298 | { |
| 299 | unsigned long flags; | ||
| 299 | u32 data, original_data, extra_shift; | 300 | u32 data, original_data, extra_shift; |
| 300 | u16 addr; | 301 | u16 addr; |
| 301 | int ret; | 302 | int ret = 0; |
| 302 | 303 | ||
| 303 | if (smc_start_address & 3) | 304 | if (smc_start_address & 3) |
| 304 | return -EINVAL; | 305 | return -EINVAL; |
| @@ -307,13 +308,14 @@ int rv770_copy_bytes_to_smc(struct radeon_device *rdev, | |||
| 307 | 308 | ||
| 308 | addr = smc_start_address; | 309 | addr = smc_start_address; |
| 309 | 310 | ||
| 311 | spin_lock_irqsave(&rdev->smc_idx_lock, flags); | ||
| 310 | while (byte_count >= 4) { | 312 | while (byte_count >= 4) { |
| 311 | /* SMC address space is BE */ | 313 | /* SMC address space is BE */ |
| 312 | data = (src[0] << 24) | (src[1] << 16) | (src[2] << 8) | src[3]; | 314 | data = (src[0] << 24) | (src[1] << 16) | (src[2] << 8) | src[3]; |
| 313 | 315 | ||
| 314 | ret = rv770_set_smc_sram_address(rdev, addr, limit); | 316 | ret = rv770_set_smc_sram_address(rdev, addr, limit); |
| 315 | if (ret) | 317 | if (ret) |
| 316 | return ret; | 318 | goto done; |
| 317 | 319 | ||
| 318 | WREG32(SMC_SRAM_DATA, data); | 320 | WREG32(SMC_SRAM_DATA, data); |
| 319 | 321 | ||
| @@ -328,7 +330,7 @@ int rv770_copy_bytes_to_smc(struct radeon_device *rdev, | |||
| 328 | 330 | ||
| 329 | ret = rv770_set_smc_sram_address(rdev, addr, limit); | 331 | ret = rv770_set_smc_sram_address(rdev, addr, limit); |
| 330 | if (ret) | 332 | if (ret) |
| 331 | return ret; | 333 | goto done; |
| 332 | 334 | ||
| 333 | original_data = RREG32(SMC_SRAM_DATA); | 335 | original_data = RREG32(SMC_SRAM_DATA); |
| 334 | 336 | ||
| @@ -346,12 +348,15 @@ int rv770_copy_bytes_to_smc(struct radeon_device *rdev, | |||
| 346 | 348 | ||
| 347 | ret = rv770_set_smc_sram_address(rdev, addr, limit); | 349 | ret = rv770_set_smc_sram_address(rdev, addr, limit); |
| 348 | if (ret) | 350 | if (ret) |
| 349 | return ret; | 351 | goto done; |
| 350 | 352 | ||
| 351 | WREG32(SMC_SRAM_DATA, data); | 353 | WREG32(SMC_SRAM_DATA, data); |
| 352 | } | 354 | } |
| 353 | 355 | ||
| 354 | return 0; | 356 | done: |
| 357 | spin_unlock_irqrestore(&rdev->smc_idx_lock, flags); | ||
| 358 | |||
| 359 | return ret; | ||
| 355 | } | 360 | } |
| 356 | 361 | ||
| 357 | static int rv770_program_interrupt_vectors(struct radeon_device *rdev, | 362 | static int rv770_program_interrupt_vectors(struct radeon_device *rdev, |
| @@ -461,12 +466,15 @@ PPSMC_Result rv770_wait_for_smc_inactive(struct radeon_device *rdev) | |||
| 461 | 466 | ||
| 462 | static void rv770_clear_smc_sram(struct radeon_device *rdev, u16 limit) | 467 | static void rv770_clear_smc_sram(struct radeon_device *rdev, u16 limit) |
| 463 | { | 468 | { |
| 469 | unsigned long flags; | ||
| 464 | u16 i; | 470 | u16 i; |
| 465 | 471 | ||
| 472 | spin_lock_irqsave(&rdev->smc_idx_lock, flags); | ||
| 466 | for (i = 0; i < limit; i += 4) { | 473 | for (i = 0; i < limit; i += 4) { |
| 467 | rv770_set_smc_sram_address(rdev, i, limit); | 474 | rv770_set_smc_sram_address(rdev, i, limit); |
| 468 | WREG32(SMC_SRAM_DATA, 0); | 475 | WREG32(SMC_SRAM_DATA, 0); |
| 469 | } | 476 | } |
| 477 | spin_unlock_irqrestore(&rdev->smc_idx_lock, flags); | ||
| 470 | } | 478 | } |
| 471 | 479 | ||
| 472 | int rv770_load_smc_ucode(struct radeon_device *rdev, | 480 | int rv770_load_smc_ucode(struct radeon_device *rdev, |
| @@ -595,27 +603,29 @@ int rv770_load_smc_ucode(struct radeon_device *rdev, | |||
| 595 | int rv770_read_smc_sram_dword(struct radeon_device *rdev, | 603 | int rv770_read_smc_sram_dword(struct radeon_device *rdev, |
| 596 | u16 smc_address, u32 *value, u16 limit) | 604 | u16 smc_address, u32 *value, u16 limit) |
| 597 | { | 605 | { |
| 606 | unsigned long flags; | ||
| 598 | int ret; | 607 | int ret; |
| 599 | 608 | ||
| 609 | spin_lock_irqsave(&rdev->smc_idx_lock, flags); | ||
| 600 | ret = rv770_set_smc_sram_address(rdev, smc_address, limit); | 610 | ret = rv770_set_smc_sram_address(rdev, smc_address, limit); |
| 601 | if (ret) | 611 | if (ret == 0) |
| 602 | return ret; | 612 | *value = RREG32(SMC_SRAM_DATA); |
| 603 | 613 | spin_unlock_irqrestore(&rdev->smc_idx_lock, flags); | |
| 604 | *value = RREG32(SMC_SRAM_DATA); | ||
| 605 | 614 | ||
| 606 | return 0; | 615 | return ret; |
| 607 | } | 616 | } |
| 608 | 617 | ||
| 609 | int rv770_write_smc_sram_dword(struct radeon_device *rdev, | 618 | int rv770_write_smc_sram_dword(struct radeon_device *rdev, |
| 610 | u16 smc_address, u32 value, u16 limit) | 619 | u16 smc_address, u32 value, u16 limit) |
| 611 | { | 620 | { |
| 621 | unsigned long flags; | ||
| 612 | int ret; | 622 | int ret; |
| 613 | 623 | ||
| 624 | spin_lock_irqsave(&rdev->smc_idx_lock, flags); | ||
| 614 | ret = rv770_set_smc_sram_address(rdev, smc_address, limit); | 625 | ret = rv770_set_smc_sram_address(rdev, smc_address, limit); |
| 615 | if (ret) | 626 | if (ret == 0) |
| 616 | return ret; | 627 | WREG32(SMC_SRAM_DATA, value); |
| 628 | spin_unlock_irqrestore(&rdev->smc_idx_lock, flags); | ||
| 617 | 629 | ||
| 618 | WREG32(SMC_SRAM_DATA, value); | 630 | return ret; |
| 619 | |||
| 620 | return 0; | ||
| 621 | } | 631 | } |
diff --git a/drivers/gpu/drm/radeon/rv770_smc.h b/drivers/gpu/drm/radeon/rv770_smc.h index f78d92a4b325..3b2c963c4880 100644 --- a/drivers/gpu/drm/radeon/rv770_smc.h +++ b/drivers/gpu/drm/radeon/rv770_smc.h | |||
| @@ -187,8 +187,6 @@ typedef struct RV770_SMC_STATETABLE RV770_SMC_STATETABLE; | |||
| 187 | #define RV770_SMC_SOFT_REGISTER_uvd_enabled 0x9C | 187 | #define RV770_SMC_SOFT_REGISTER_uvd_enabled 0x9C |
| 188 | #define RV770_SMC_SOFT_REGISTER_is_asic_lombok 0xA0 | 188 | #define RV770_SMC_SOFT_REGISTER_is_asic_lombok 0xA0 |
| 189 | 189 | ||
| 190 | int rv770_set_smc_sram_address(struct radeon_device *rdev, | ||
| 191 | u16 smc_address, u16 limit); | ||
| 192 | int rv770_copy_bytes_to_smc(struct radeon_device *rdev, | 190 | int rv770_copy_bytes_to_smc(struct radeon_device *rdev, |
| 193 | u16 smc_start_address, const u8 *src, | 191 | u16 smc_start_address, const u8 *src, |
| 194 | u16 byte_count, u16 limit); | 192 | u16 byte_count, u16 limit); |
diff --git a/drivers/gpu/drm/radeon/rv770d.h b/drivers/gpu/drm/radeon/rv770d.h index 9fe60e542922..1ae277152cc7 100644 --- a/drivers/gpu/drm/radeon/rv770d.h +++ b/drivers/gpu/drm/radeon/rv770d.h | |||
| @@ -852,7 +852,7 @@ | |||
| 852 | #define AFMT_VBI_PACKET_CONTROL 0x7608 | 852 | #define AFMT_VBI_PACKET_CONTROL 0x7608 |
| 853 | # define AFMT_GENERIC0_UPDATE (1 << 2) | 853 | # define AFMT_GENERIC0_UPDATE (1 << 2) |
| 854 | #define AFMT_INFOFRAME_CONTROL0 0x760c | 854 | #define AFMT_INFOFRAME_CONTROL0 0x760c |
| 855 | # define AFMT_AUDIO_INFO_SOURCE (1 << 6) /* 0 - sound block; 1 - hmdi regs */ | 855 | # define AFMT_AUDIO_INFO_SOURCE (1 << 6) /* 0 - sound block; 1 - hdmi regs */ |
| 856 | # define AFMT_AUDIO_INFO_UPDATE (1 << 7) | 856 | # define AFMT_AUDIO_INFO_UPDATE (1 << 7) |
| 857 | # define AFMT_MPEG_INFO_UPDATE (1 << 10) | 857 | # define AFMT_MPEG_INFO_UPDATE (1 << 10) |
| 858 | #define AFMT_GENERIC0_7 0x7610 | 858 | #define AFMT_GENERIC0_7 0x7610 |
diff --git a/drivers/gpu/drm/radeon/si.c b/drivers/gpu/drm/radeon/si.c index 3e23b757dcfa..c354c1094967 100644 --- a/drivers/gpu/drm/radeon/si.c +++ b/drivers/gpu/drm/radeon/si.c | |||
| @@ -83,6 +83,8 @@ extern void si_dma_vm_set_page(struct radeon_device *rdev, | |||
| 83 | uint64_t pe, | 83 | uint64_t pe, |
| 84 | uint64_t addr, unsigned count, | 84 | uint64_t addr, unsigned count, |
| 85 | uint32_t incr, uint32_t flags); | 85 | uint32_t incr, uint32_t flags); |
| 86 | static void si_enable_gui_idle_interrupt(struct radeon_device *rdev, | ||
| 87 | bool enable); | ||
| 86 | 88 | ||
| 87 | static const u32 verde_rlc_save_restore_register_list[] = | 89 | static const u32 verde_rlc_save_restore_register_list[] = |
| 88 | { | 90 | { |
| @@ -3386,6 +3388,8 @@ static int si_cp_resume(struct radeon_device *rdev) | |||
| 3386 | u32 rb_bufsz; | 3388 | u32 rb_bufsz; |
| 3387 | int r; | 3389 | int r; |
| 3388 | 3390 | ||
| 3391 | si_enable_gui_idle_interrupt(rdev, false); | ||
| 3392 | |||
| 3389 | WREG32(CP_SEM_WAIT_TIMER, 0x0); | 3393 | WREG32(CP_SEM_WAIT_TIMER, 0x0); |
| 3390 | WREG32(CP_SEM_INCOMPLETE_TIMER_CNTL, 0x0); | 3394 | WREG32(CP_SEM_INCOMPLETE_TIMER_CNTL, 0x0); |
| 3391 | 3395 | ||
| @@ -3501,6 +3505,8 @@ static int si_cp_resume(struct radeon_device *rdev) | |||
| 3501 | rdev->ring[CAYMAN_RING_TYPE_CP2_INDEX].ready = false; | 3505 | rdev->ring[CAYMAN_RING_TYPE_CP2_INDEX].ready = false; |
| 3502 | } | 3506 | } |
| 3503 | 3507 | ||
| 3508 | si_enable_gui_idle_interrupt(rdev, true); | ||
| 3509 | |||
| 3504 | return 0; | 3510 | return 0; |
| 3505 | } | 3511 | } |
| 3506 | 3512 | ||
| @@ -4888,7 +4894,7 @@ static void si_enable_gfx_cgpg(struct radeon_device *rdev, | |||
| 4888 | { | 4894 | { |
| 4889 | u32 tmp; | 4895 | u32 tmp; |
| 4890 | 4896 | ||
| 4891 | if (enable && (rdev->pg_flags & RADEON_PG_SUPPORT_GFX_CG)) { | 4897 | if (enable && (rdev->pg_flags & RADEON_PG_SUPPORT_GFX_PG)) { |
| 4892 | tmp = RLC_PUD(0x10) | RLC_PDD(0x10) | RLC_TTPD(0x10) | RLC_MSD(0x10); | 4898 | tmp = RLC_PUD(0x10) | RLC_PDD(0x10) | RLC_TTPD(0x10) | RLC_MSD(0x10); |
| 4893 | WREG32(RLC_TTOP_D, tmp); | 4899 | WREG32(RLC_TTOP_D, tmp); |
| 4894 | 4900 | ||
| @@ -5250,6 +5256,7 @@ void si_update_cg(struct radeon_device *rdev, | |||
| 5250 | u32 block, bool enable) | 5256 | u32 block, bool enable) |
| 5251 | { | 5257 | { |
| 5252 | if (block & RADEON_CG_BLOCK_GFX) { | 5258 | if (block & RADEON_CG_BLOCK_GFX) { |
| 5259 | si_enable_gui_idle_interrupt(rdev, false); | ||
| 5253 | /* order matters! */ | 5260 | /* order matters! */ |
| 5254 | if (enable) { | 5261 | if (enable) { |
| 5255 | si_enable_mgcg(rdev, true); | 5262 | si_enable_mgcg(rdev, true); |
| @@ -5258,6 +5265,7 @@ void si_update_cg(struct radeon_device *rdev, | |||
| 5258 | si_enable_cgcg(rdev, false); | 5265 | si_enable_cgcg(rdev, false); |
| 5259 | si_enable_mgcg(rdev, false); | 5266 | si_enable_mgcg(rdev, false); |
| 5260 | } | 5267 | } |
| 5268 | si_enable_gui_idle_interrupt(rdev, true); | ||
| 5261 | } | 5269 | } |
| 5262 | 5270 | ||
| 5263 | if (block & RADEON_CG_BLOCK_MC) { | 5271 | if (block & RADEON_CG_BLOCK_MC) { |
| @@ -5408,7 +5416,7 @@ static void si_init_pg(struct radeon_device *rdev) | |||
| 5408 | si_init_dma_pg(rdev); | 5416 | si_init_dma_pg(rdev); |
| 5409 | } | 5417 | } |
| 5410 | si_init_ao_cu_mask(rdev); | 5418 | si_init_ao_cu_mask(rdev); |
| 5411 | if (rdev->pg_flags & RADEON_PG_SUPPORT_GFX_CG) { | 5419 | if (rdev->pg_flags & RADEON_PG_SUPPORT_GFX_PG) { |
| 5412 | si_init_gfx_cgpg(rdev); | 5420 | si_init_gfx_cgpg(rdev); |
| 5413 | } | 5421 | } |
| 5414 | si_enable_dma_pg(rdev, true); | 5422 | si_enable_dma_pg(rdev, true); |
| @@ -5560,7 +5568,9 @@ static void si_disable_interrupt_state(struct radeon_device *rdev) | |||
| 5560 | { | 5568 | { |
| 5561 | u32 tmp; | 5569 | u32 tmp; |
| 5562 | 5570 | ||
| 5563 | WREG32(CP_INT_CNTL_RING0, CNTX_BUSY_INT_ENABLE | CNTX_EMPTY_INT_ENABLE); | 5571 | tmp = RREG32(CP_INT_CNTL_RING0) & |
| 5572 | (CNTX_BUSY_INT_ENABLE | CNTX_EMPTY_INT_ENABLE); | ||
| 5573 | WREG32(CP_INT_CNTL_RING0, tmp); | ||
| 5564 | WREG32(CP_INT_CNTL_RING1, 0); | 5574 | WREG32(CP_INT_CNTL_RING1, 0); |
| 5565 | WREG32(CP_INT_CNTL_RING2, 0); | 5575 | WREG32(CP_INT_CNTL_RING2, 0); |
| 5566 | tmp = RREG32(DMA_CNTL + DMA0_REGISTER_OFFSET) & ~TRAP_ENABLE; | 5576 | tmp = RREG32(DMA_CNTL + DMA0_REGISTER_OFFSET) & ~TRAP_ENABLE; |
| @@ -5685,7 +5695,7 @@ static int si_irq_init(struct radeon_device *rdev) | |||
| 5685 | 5695 | ||
| 5686 | int si_irq_set(struct radeon_device *rdev) | 5696 | int si_irq_set(struct radeon_device *rdev) |
| 5687 | { | 5697 | { |
| 5688 | u32 cp_int_cntl = CNTX_BUSY_INT_ENABLE | CNTX_EMPTY_INT_ENABLE; | 5698 | u32 cp_int_cntl; |
| 5689 | u32 cp_int_cntl1 = 0, cp_int_cntl2 = 0; | 5699 | u32 cp_int_cntl1 = 0, cp_int_cntl2 = 0; |
| 5690 | u32 crtc1 = 0, crtc2 = 0, crtc3 = 0, crtc4 = 0, crtc5 = 0, crtc6 = 0; | 5700 | u32 crtc1 = 0, crtc2 = 0, crtc3 = 0, crtc4 = 0, crtc5 = 0, crtc6 = 0; |
| 5691 | u32 hpd1 = 0, hpd2 = 0, hpd3 = 0, hpd4 = 0, hpd5 = 0, hpd6 = 0; | 5701 | u32 hpd1 = 0, hpd2 = 0, hpd3 = 0, hpd4 = 0, hpd5 = 0, hpd6 = 0; |
| @@ -5706,6 +5716,9 @@ int si_irq_set(struct radeon_device *rdev) | |||
| 5706 | return 0; | 5716 | return 0; |
| 5707 | } | 5717 | } |
| 5708 | 5718 | ||
| 5719 | cp_int_cntl = RREG32(CP_INT_CNTL_RING0) & | ||
| 5720 | (CNTX_BUSY_INT_ENABLE | CNTX_EMPTY_INT_ENABLE); | ||
| 5721 | |||
| 5709 | if (!ASIC_IS_NODCE(rdev)) { | 5722 | if (!ASIC_IS_NODCE(rdev)) { |
| 5710 | hpd1 = RREG32(DC_HPD1_INT_CONTROL) & ~DC_HPDx_INT_EN; | 5723 | hpd1 = RREG32(DC_HPD1_INT_CONTROL) & ~DC_HPDx_INT_EN; |
| 5711 | hpd2 = RREG32(DC_HPD2_INT_CONTROL) & ~DC_HPDx_INT_EN; | 5724 | hpd2 = RREG32(DC_HPD2_INT_CONTROL) & ~DC_HPDx_INT_EN; |
diff --git a/drivers/gpu/drm/radeon/si_dpm.c b/drivers/gpu/drm/radeon/si_dpm.c index 5be9b4e72350..cfe5d4d28915 100644 --- a/drivers/gpu/drm/radeon/si_dpm.c +++ b/drivers/gpu/drm/radeon/si_dpm.c | |||
| @@ -6075,12 +6075,6 @@ int si_dpm_set_power_state(struct radeon_device *rdev) | |||
| 6075 | return ret; | 6075 | return ret; |
| 6076 | } | 6076 | } |
| 6077 | 6077 | ||
| 6078 | ret = si_dpm_force_performance_level(rdev, RADEON_DPM_FORCED_LEVEL_AUTO); | ||
| 6079 | if (ret) { | ||
| 6080 | DRM_ERROR("si_dpm_force_performance_level failed\n"); | ||
| 6081 | return ret; | ||
| 6082 | } | ||
| 6083 | |||
| 6084 | si_update_cg(rdev, (RADEON_CG_BLOCK_GFX | | 6078 | si_update_cg(rdev, (RADEON_CG_BLOCK_GFX | |
| 6085 | RADEON_CG_BLOCK_MC | | 6079 | RADEON_CG_BLOCK_MC | |
| 6086 | RADEON_CG_BLOCK_SDMA | | 6080 | RADEON_CG_BLOCK_SDMA | |
diff --git a/drivers/gpu/drm/radeon/si_smc.c b/drivers/gpu/drm/radeon/si_smc.c index 5f524c0a541e..d422a1cbf727 100644 --- a/drivers/gpu/drm/radeon/si_smc.c +++ b/drivers/gpu/drm/radeon/si_smc.c | |||
| @@ -29,8 +29,8 @@ | |||
| 29 | #include "ppsmc.h" | 29 | #include "ppsmc.h" |
| 30 | #include "radeon_ucode.h" | 30 | #include "radeon_ucode.h" |
| 31 | 31 | ||
| 32 | int si_set_smc_sram_address(struct radeon_device *rdev, | 32 | static int si_set_smc_sram_address(struct radeon_device *rdev, |
| 33 | u32 smc_address, u32 limit) | 33 | u32 smc_address, u32 limit) |
| 34 | { | 34 | { |
| 35 | if (smc_address & 3) | 35 | if (smc_address & 3) |
| 36 | return -EINVAL; | 36 | return -EINVAL; |
| @@ -47,7 +47,8 @@ int si_copy_bytes_to_smc(struct radeon_device *rdev, | |||
| 47 | u32 smc_start_address, | 47 | u32 smc_start_address, |
| 48 | const u8 *src, u32 byte_count, u32 limit) | 48 | const u8 *src, u32 byte_count, u32 limit) |
| 49 | { | 49 | { |
| 50 | int ret; | 50 | unsigned long flags; |
| 51 | int ret = 0; | ||
| 51 | u32 data, original_data, addr, extra_shift; | 52 | u32 data, original_data, addr, extra_shift; |
| 52 | 53 | ||
| 53 | if (smc_start_address & 3) | 54 | if (smc_start_address & 3) |
| @@ -57,13 +58,14 @@ int si_copy_bytes_to_smc(struct radeon_device *rdev, | |||
| 57 | 58 | ||
| 58 | addr = smc_start_address; | 59 | addr = smc_start_address; |
| 59 | 60 | ||
| 61 | spin_lock_irqsave(&rdev->smc_idx_lock, flags); | ||
| 60 | while (byte_count >= 4) { | 62 | while (byte_count >= 4) { |
| 61 | /* SMC address space is BE */ | 63 | /* SMC address space is BE */ |
| 62 | data = (src[0] << 24) | (src[1] << 16) | (src[2] << 8) | src[3]; | 64 | data = (src[0] << 24) | (src[1] << 16) | (src[2] << 8) | src[3]; |
| 63 | 65 | ||
| 64 | ret = si_set_smc_sram_address(rdev, addr, limit); | 66 | ret = si_set_smc_sram_address(rdev, addr, limit); |
| 65 | if (ret) | 67 | if (ret) |
| 66 | return ret; | 68 | goto done; |
| 67 | 69 | ||
| 68 | WREG32(SMC_IND_DATA_0, data); | 70 | WREG32(SMC_IND_DATA_0, data); |
| 69 | 71 | ||
| @@ -78,7 +80,7 @@ int si_copy_bytes_to_smc(struct radeon_device *rdev, | |||
| 78 | 80 | ||
| 79 | ret = si_set_smc_sram_address(rdev, addr, limit); | 81 | ret = si_set_smc_sram_address(rdev, addr, limit); |
| 80 | if (ret) | 82 | if (ret) |
| 81 | return ret; | 83 | goto done; |
| 82 | 84 | ||
| 83 | original_data = RREG32(SMC_IND_DATA_0); | 85 | original_data = RREG32(SMC_IND_DATA_0); |
| 84 | 86 | ||
| @@ -96,11 +98,15 @@ int si_copy_bytes_to_smc(struct radeon_device *rdev, | |||
| 96 | 98 | ||
| 97 | ret = si_set_smc_sram_address(rdev, addr, limit); | 99 | ret = si_set_smc_sram_address(rdev, addr, limit); |
| 98 | if (ret) | 100 | if (ret) |
| 99 | return ret; | 101 | goto done; |
| 100 | 102 | ||
| 101 | WREG32(SMC_IND_DATA_0, data); | 103 | WREG32(SMC_IND_DATA_0, data); |
| 102 | } | 104 | } |
| 103 | return 0; | 105 | |
| 106 | done: | ||
| 107 | spin_unlock_irqrestore(&rdev->smc_idx_lock, flags); | ||
| 108 | |||
| 109 | return ret; | ||
| 104 | } | 110 | } |
| 105 | 111 | ||
| 106 | void si_start_smc(struct radeon_device *rdev) | 112 | void si_start_smc(struct radeon_device *rdev) |
| @@ -203,6 +209,7 @@ PPSMC_Result si_wait_for_smc_inactive(struct radeon_device *rdev) | |||
| 203 | 209 | ||
| 204 | int si_load_smc_ucode(struct radeon_device *rdev, u32 limit) | 210 | int si_load_smc_ucode(struct radeon_device *rdev, u32 limit) |
| 205 | { | 211 | { |
| 212 | unsigned long flags; | ||
| 206 | u32 ucode_start_address; | 213 | u32 ucode_start_address; |
| 207 | u32 ucode_size; | 214 | u32 ucode_size; |
| 208 | const u8 *src; | 215 | const u8 *src; |
| @@ -241,6 +248,7 @@ int si_load_smc_ucode(struct radeon_device *rdev, u32 limit) | |||
| 241 | return -EINVAL; | 248 | return -EINVAL; |
| 242 | 249 | ||
| 243 | src = (const u8 *)rdev->smc_fw->data; | 250 | src = (const u8 *)rdev->smc_fw->data; |
| 251 | spin_lock_irqsave(&rdev->smc_idx_lock, flags); | ||
| 244 | WREG32(SMC_IND_INDEX_0, ucode_start_address); | 252 | WREG32(SMC_IND_INDEX_0, ucode_start_address); |
| 245 | WREG32_P(SMC_IND_ACCESS_CNTL, AUTO_INCREMENT_IND_0, ~AUTO_INCREMENT_IND_0); | 253 | WREG32_P(SMC_IND_ACCESS_CNTL, AUTO_INCREMENT_IND_0, ~AUTO_INCREMENT_IND_0); |
| 246 | while (ucode_size >= 4) { | 254 | while (ucode_size >= 4) { |
| @@ -253,6 +261,7 @@ int si_load_smc_ucode(struct radeon_device *rdev, u32 limit) | |||
| 253 | ucode_size -= 4; | 261 | ucode_size -= 4; |
| 254 | } | 262 | } |
| 255 | WREG32_P(SMC_IND_ACCESS_CNTL, 0, ~AUTO_INCREMENT_IND_0); | 263 | WREG32_P(SMC_IND_ACCESS_CNTL, 0, ~AUTO_INCREMENT_IND_0); |
| 264 | spin_unlock_irqrestore(&rdev->smc_idx_lock, flags); | ||
| 256 | 265 | ||
| 257 | return 0; | 266 | return 0; |
| 258 | } | 267 | } |
| @@ -260,25 +269,29 @@ int si_load_smc_ucode(struct radeon_device *rdev, u32 limit) | |||
| 260 | int si_read_smc_sram_dword(struct radeon_device *rdev, u32 smc_address, | 269 | int si_read_smc_sram_dword(struct radeon_device *rdev, u32 smc_address, |
| 261 | u32 *value, u32 limit) | 270 | u32 *value, u32 limit) |
| 262 | { | 271 | { |
| 272 | unsigned long flags; | ||
| 263 | int ret; | 273 | int ret; |
| 264 | 274 | ||
| 275 | spin_lock_irqsave(&rdev->smc_idx_lock, flags); | ||
| 265 | ret = si_set_smc_sram_address(rdev, smc_address, limit); | 276 | ret = si_set_smc_sram_address(rdev, smc_address, limit); |
| 266 | if (ret) | 277 | if (ret == 0) |
| 267 | return ret; | 278 | *value = RREG32(SMC_IND_DATA_0); |
| 279 | spin_unlock_irqrestore(&rdev->smc_idx_lock, flags); | ||
| 268 | 280 | ||
| 269 | *value = RREG32(SMC_IND_DATA_0); | 281 | return ret; |
| 270 | return 0; | ||
| 271 | } | 282 | } |
| 272 | 283 | ||
| 273 | int si_write_smc_sram_dword(struct radeon_device *rdev, u32 smc_address, | 284 | int si_write_smc_sram_dword(struct radeon_device *rdev, u32 smc_address, |
| 274 | u32 value, u32 limit) | 285 | u32 value, u32 limit) |
| 275 | { | 286 | { |
| 287 | unsigned long flags; | ||
| 276 | int ret; | 288 | int ret; |
| 277 | 289 | ||
| 290 | spin_lock_irqsave(&rdev->smc_idx_lock, flags); | ||
| 278 | ret = si_set_smc_sram_address(rdev, smc_address, limit); | 291 | ret = si_set_smc_sram_address(rdev, smc_address, limit); |
| 279 | if (ret) | 292 | if (ret == 0) |
| 280 | return ret; | 293 | WREG32(SMC_IND_DATA_0, value); |
| 294 | spin_unlock_irqrestore(&rdev->smc_idx_lock, flags); | ||
| 281 | 295 | ||
| 282 | WREG32(SMC_IND_DATA_0, value); | 296 | return ret; |
| 283 | return 0; | ||
| 284 | } | 297 | } |
diff --git a/drivers/gpu/drm/radeon/sumo_dpm.c b/drivers/gpu/drm/radeon/sumo_dpm.c index 864761c0120e..96ea6db8bf57 100644 --- a/drivers/gpu/drm/radeon/sumo_dpm.c +++ b/drivers/gpu/drm/radeon/sumo_dpm.c | |||
| @@ -1319,8 +1319,6 @@ int sumo_dpm_set_power_state(struct radeon_device *rdev) | |||
| 1319 | if (pi->enable_dpm) | 1319 | if (pi->enable_dpm) |
| 1320 | sumo_set_uvd_clock_after_set_eng_clock(rdev, new_ps, old_ps); | 1320 | sumo_set_uvd_clock_after_set_eng_clock(rdev, new_ps, old_ps); |
| 1321 | 1321 | ||
| 1322 | rdev->pm.dpm.forced_level = RADEON_DPM_FORCED_LEVEL_AUTO; | ||
| 1323 | |||
| 1324 | return 0; | 1322 | return 0; |
| 1325 | } | 1323 | } |
| 1326 | 1324 | ||
diff --git a/drivers/gpu/drm/radeon/trinity_dpm.c b/drivers/gpu/drm/radeon/trinity_dpm.c index b07b7b8f1aff..7f998bf1cc9d 100644 --- a/drivers/gpu/drm/radeon/trinity_dpm.c +++ b/drivers/gpu/drm/radeon/trinity_dpm.c | |||
| @@ -1068,6 +1068,17 @@ static void trinity_update_requested_ps(struct radeon_device *rdev, | |||
| 1068 | pi->requested_rps.ps_priv = &pi->requested_ps; | 1068 | pi->requested_rps.ps_priv = &pi->requested_ps; |
| 1069 | } | 1069 | } |
| 1070 | 1070 | ||
| 1071 | void trinity_dpm_enable_bapm(struct radeon_device *rdev, bool enable) | ||
| 1072 | { | ||
| 1073 | struct trinity_power_info *pi = trinity_get_pi(rdev); | ||
| 1074 | |||
| 1075 | if (pi->enable_bapm) { | ||
| 1076 | trinity_acquire_mutex(rdev); | ||
| 1077 | trinity_dpm_bapm_enable(rdev, enable); | ||
| 1078 | trinity_release_mutex(rdev); | ||
| 1079 | } | ||
| 1080 | } | ||
| 1081 | |||
| 1071 | int trinity_dpm_enable(struct radeon_device *rdev) | 1082 | int trinity_dpm_enable(struct radeon_device *rdev) |
| 1072 | { | 1083 | { |
| 1073 | struct trinity_power_info *pi = trinity_get_pi(rdev); | 1084 | struct trinity_power_info *pi = trinity_get_pi(rdev); |
| @@ -1091,6 +1102,7 @@ int trinity_dpm_enable(struct radeon_device *rdev) | |||
| 1091 | trinity_program_sclk_dpm(rdev); | 1102 | trinity_program_sclk_dpm(rdev); |
| 1092 | trinity_start_dpm(rdev); | 1103 | trinity_start_dpm(rdev); |
| 1093 | trinity_wait_for_dpm_enabled(rdev); | 1104 | trinity_wait_for_dpm_enabled(rdev); |
| 1105 | trinity_dpm_bapm_enable(rdev, false); | ||
| 1094 | trinity_release_mutex(rdev); | 1106 | trinity_release_mutex(rdev); |
| 1095 | 1107 | ||
| 1096 | if (rdev->irq.installed && | 1108 | if (rdev->irq.installed && |
| @@ -1116,6 +1128,7 @@ void trinity_dpm_disable(struct radeon_device *rdev) | |||
| 1116 | trinity_release_mutex(rdev); | 1128 | trinity_release_mutex(rdev); |
| 1117 | return; | 1129 | return; |
| 1118 | } | 1130 | } |
| 1131 | trinity_dpm_bapm_enable(rdev, false); | ||
| 1119 | trinity_disable_clock_power_gating(rdev); | 1132 | trinity_disable_clock_power_gating(rdev); |
| 1120 | sumo_clear_vc(rdev); | 1133 | sumo_clear_vc(rdev); |
| 1121 | trinity_wait_for_level_0(rdev); | 1134 | trinity_wait_for_level_0(rdev); |
| @@ -1212,6 +1225,8 @@ int trinity_dpm_set_power_state(struct radeon_device *rdev) | |||
| 1212 | 1225 | ||
| 1213 | trinity_acquire_mutex(rdev); | 1226 | trinity_acquire_mutex(rdev); |
| 1214 | if (pi->enable_dpm) { | 1227 | if (pi->enable_dpm) { |
| 1228 | if (pi->enable_bapm) | ||
| 1229 | trinity_dpm_bapm_enable(rdev, rdev->pm.dpm.ac_power); | ||
| 1215 | trinity_set_uvd_clock_before_set_eng_clock(rdev, new_ps, old_ps); | 1230 | trinity_set_uvd_clock_before_set_eng_clock(rdev, new_ps, old_ps); |
| 1216 | trinity_enable_power_level_0(rdev); | 1231 | trinity_enable_power_level_0(rdev); |
| 1217 | trinity_force_level_0(rdev); | 1232 | trinity_force_level_0(rdev); |
| @@ -1221,7 +1236,6 @@ int trinity_dpm_set_power_state(struct radeon_device *rdev) | |||
| 1221 | trinity_force_level_0(rdev); | 1236 | trinity_force_level_0(rdev); |
| 1222 | trinity_unforce_levels(rdev); | 1237 | trinity_unforce_levels(rdev); |
| 1223 | trinity_set_uvd_clock_after_set_eng_clock(rdev, new_ps, old_ps); | 1238 | trinity_set_uvd_clock_after_set_eng_clock(rdev, new_ps, old_ps); |
| 1224 | rdev->pm.dpm.forced_level = RADEON_DPM_FORCED_LEVEL_AUTO; | ||
| 1225 | } | 1239 | } |
| 1226 | trinity_release_mutex(rdev); | 1240 | trinity_release_mutex(rdev); |
| 1227 | 1241 | ||
| @@ -1854,6 +1868,7 @@ int trinity_dpm_init(struct radeon_device *rdev) | |||
| 1854 | for (i = 0; i < SUMO_MAX_HARDWARE_POWERLEVELS; i++) | 1868 | for (i = 0; i < SUMO_MAX_HARDWARE_POWERLEVELS; i++) |
| 1855 | pi->at[i] = TRINITY_AT_DFLT; | 1869 | pi->at[i] = TRINITY_AT_DFLT; |
| 1856 | 1870 | ||
| 1871 | pi->enable_bapm = true; | ||
| 1857 | pi->enable_nbps_policy = true; | 1872 | pi->enable_nbps_policy = true; |
| 1858 | pi->enable_sclk_ds = true; | 1873 | pi->enable_sclk_ds = true; |
| 1859 | pi->enable_gfx_power_gating = true; | 1874 | pi->enable_gfx_power_gating = true; |
diff --git a/drivers/gpu/drm/radeon/trinity_dpm.h b/drivers/gpu/drm/radeon/trinity_dpm.h index e82df071f8b3..c261657750ca 100644 --- a/drivers/gpu/drm/radeon/trinity_dpm.h +++ b/drivers/gpu/drm/radeon/trinity_dpm.h | |||
| @@ -108,6 +108,7 @@ struct trinity_power_info { | |||
| 108 | bool enable_auto_thermal_throttling; | 108 | bool enable_auto_thermal_throttling; |
| 109 | bool enable_dpm; | 109 | bool enable_dpm; |
| 110 | bool enable_sclk_ds; | 110 | bool enable_sclk_ds; |
| 111 | bool enable_bapm; | ||
| 111 | bool uvd_dpm; | 112 | bool uvd_dpm; |
| 112 | struct radeon_ps current_rps; | 113 | struct radeon_ps current_rps; |
| 113 | struct trinity_ps current_ps; | 114 | struct trinity_ps current_ps; |
| @@ -118,6 +119,7 @@ struct trinity_power_info { | |||
| 118 | #define TRINITY_AT_DFLT 30 | 119 | #define TRINITY_AT_DFLT 30 |
| 119 | 120 | ||
| 120 | /* trinity_smc.c */ | 121 | /* trinity_smc.c */ |
| 122 | int trinity_dpm_bapm_enable(struct radeon_device *rdev, bool enable); | ||
| 121 | int trinity_dpm_config(struct radeon_device *rdev, bool enable); | 123 | int trinity_dpm_config(struct radeon_device *rdev, bool enable); |
| 122 | int trinity_uvd_dpm_config(struct radeon_device *rdev); | 124 | int trinity_uvd_dpm_config(struct radeon_device *rdev); |
| 123 | int trinity_dpm_force_state(struct radeon_device *rdev, u32 n); | 125 | int trinity_dpm_force_state(struct radeon_device *rdev, u32 n); |
diff --git a/drivers/gpu/drm/radeon/trinity_smc.c b/drivers/gpu/drm/radeon/trinity_smc.c index a42d89f1830c..9672bcbc7312 100644 --- a/drivers/gpu/drm/radeon/trinity_smc.c +++ b/drivers/gpu/drm/radeon/trinity_smc.c | |||
| @@ -56,6 +56,14 @@ static int trinity_notify_message_to_smu(struct radeon_device *rdev, u32 id) | |||
| 56 | return 0; | 56 | return 0; |
| 57 | } | 57 | } |
| 58 | 58 | ||
| 59 | int trinity_dpm_bapm_enable(struct radeon_device *rdev, bool enable) | ||
| 60 | { | ||
| 61 | if (enable) | ||
| 62 | return trinity_notify_message_to_smu(rdev, PPSMC_MSG_EnableBAPM); | ||
| 63 | else | ||
| 64 | return trinity_notify_message_to_smu(rdev, PPSMC_MSG_DisableBAPM); | ||
| 65 | } | ||
| 66 | |||
| 59 | int trinity_dpm_config(struct radeon_device *rdev, bool enable) | 67 | int trinity_dpm_config(struct radeon_device *rdev, bool enable) |
| 60 | { | 68 | { |
| 61 | if (enable) | 69 | if (enable) |
diff --git a/drivers/gpu/drm/ttm/ttm_object.c b/drivers/gpu/drm/ttm/ttm_object.c index 58a5f3261c0b..a868176c258a 100644 --- a/drivers/gpu/drm/ttm/ttm_object.c +++ b/drivers/gpu/drm/ttm/ttm_object.c | |||
| @@ -218,7 +218,7 @@ struct ttm_base_object *ttm_base_object_lookup(struct ttm_object_file *tfile, | |||
| 218 | uint32_t key) | 218 | uint32_t key) |
| 219 | { | 219 | { |
| 220 | struct ttm_object_device *tdev = tfile->tdev; | 220 | struct ttm_object_device *tdev = tfile->tdev; |
| 221 | struct ttm_base_object *base; | 221 | struct ttm_base_object *uninitialized_var(base); |
| 222 | struct drm_hash_item *hash; | 222 | struct drm_hash_item *hash; |
| 223 | int ret; | 223 | int ret; |
| 224 | 224 | ||
diff --git a/drivers/gpu/drm/ttm/ttm_tt.c b/drivers/gpu/drm/ttm/ttm_tt.c index 5e93a52d4f2c..210d50365162 100644 --- a/drivers/gpu/drm/ttm/ttm_tt.c +++ b/drivers/gpu/drm/ttm/ttm_tt.c | |||
| @@ -170,7 +170,7 @@ void ttm_tt_destroy(struct ttm_tt *ttm) | |||
| 170 | ttm_tt_unbind(ttm); | 170 | ttm_tt_unbind(ttm); |
| 171 | } | 171 | } |
| 172 | 172 | ||
| 173 | if (likely(ttm->pages != NULL)) { | 173 | if (ttm->state == tt_unbound) { |
| 174 | ttm->bdev->driver->ttm_tt_unpopulate(ttm); | 174 | ttm->bdev->driver->ttm_tt_unpopulate(ttm); |
| 175 | } | 175 | } |
| 176 | 176 | ||
diff --git a/drivers/gpu/drm/udl/udl_gem.c b/drivers/gpu/drm/udl/udl_gem.c index 8dbe9d0ae9a7..8bf646183bac 100644 --- a/drivers/gpu/drm/udl/udl_gem.c +++ b/drivers/gpu/drm/udl/udl_gem.c | |||
| @@ -97,7 +97,6 @@ int udl_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf) | |||
| 97 | ret = vm_insert_page(vma, (unsigned long)vmf->virtual_address, page); | 97 | ret = vm_insert_page(vma, (unsigned long)vmf->virtual_address, page); |
| 98 | switch (ret) { | 98 | switch (ret) { |
| 99 | case -EAGAIN: | 99 | case -EAGAIN: |
| 100 | set_need_resched(); | ||
| 101 | case 0: | 100 | case 0: |
| 102 | case -ERESTARTSYS: | 101 | case -ERESTARTSYS: |
| 103 | return VM_FAULT_NOPAGE; | 102 | return VM_FAULT_NOPAGE; |
diff --git a/drivers/hwmon/applesmc.c b/drivers/hwmon/applesmc.c index 62c2e32e25ef..98814d12a604 100644 --- a/drivers/hwmon/applesmc.c +++ b/drivers/hwmon/applesmc.c | |||
| @@ -525,16 +525,25 @@ static int applesmc_init_smcreg_try(void) | |||
| 525 | { | 525 | { |
| 526 | struct applesmc_registers *s = &smcreg; | 526 | struct applesmc_registers *s = &smcreg; |
| 527 | bool left_light_sensor, right_light_sensor; | 527 | bool left_light_sensor, right_light_sensor; |
| 528 | unsigned int count; | ||
| 528 | u8 tmp[1]; | 529 | u8 tmp[1]; |
| 529 | int ret; | 530 | int ret; |
| 530 | 531 | ||
| 531 | if (s->init_complete) | 532 | if (s->init_complete) |
| 532 | return 0; | 533 | return 0; |
| 533 | 534 | ||
| 534 | ret = read_register_count(&s->key_count); | 535 | ret = read_register_count(&count); |
| 535 | if (ret) | 536 | if (ret) |
| 536 | return ret; | 537 | return ret; |
| 537 | 538 | ||
| 539 | if (s->cache && s->key_count != count) { | ||
| 540 | pr_warn("key count changed from %d to %d\n", | ||
| 541 | s->key_count, count); | ||
| 542 | kfree(s->cache); | ||
| 543 | s->cache = NULL; | ||
| 544 | } | ||
| 545 | s->key_count = count; | ||
| 546 | |||
| 538 | if (!s->cache) | 547 | if (!s->cache) |
| 539 | s->cache = kcalloc(s->key_count, sizeof(*s->cache), GFP_KERNEL); | 548 | s->cache = kcalloc(s->key_count, sizeof(*s->cache), GFP_KERNEL); |
| 540 | if (!s->cache) | 549 | if (!s->cache) |
diff --git a/drivers/i2c/busses/i2c-designware-core.c b/drivers/i2c/busses/i2c-designware-core.c index dbecf08399f8..5888feef1ac5 100644 --- a/drivers/i2c/busses/i2c-designware-core.c +++ b/drivers/i2c/busses/i2c-designware-core.c | |||
| @@ -98,6 +98,8 @@ | |||
| 98 | 98 | ||
| 99 | #define DW_IC_ERR_TX_ABRT 0x1 | 99 | #define DW_IC_ERR_TX_ABRT 0x1 |
| 100 | 100 | ||
| 101 | #define DW_IC_TAR_10BITADDR_MASTER BIT(12) | ||
| 102 | |||
| 101 | /* | 103 | /* |
| 102 | * status codes | 104 | * status codes |
| 103 | */ | 105 | */ |
| @@ -388,22 +390,34 @@ static int i2c_dw_wait_bus_not_busy(struct dw_i2c_dev *dev) | |||
| 388 | static void i2c_dw_xfer_init(struct dw_i2c_dev *dev) | 390 | static void i2c_dw_xfer_init(struct dw_i2c_dev *dev) |
| 389 | { | 391 | { |
| 390 | struct i2c_msg *msgs = dev->msgs; | 392 | struct i2c_msg *msgs = dev->msgs; |
| 391 | u32 ic_con; | 393 | u32 ic_con, ic_tar = 0; |
| 392 | 394 | ||
| 393 | /* Disable the adapter */ | 395 | /* Disable the adapter */ |
| 394 | __i2c_dw_enable(dev, false); | 396 | __i2c_dw_enable(dev, false); |
| 395 | 397 | ||
| 396 | /* set the slave (target) address */ | ||
| 397 | dw_writel(dev, msgs[dev->msg_write_idx].addr, DW_IC_TAR); | ||
| 398 | |||
| 399 | /* if the slave address is ten bit address, enable 10BITADDR */ | 398 | /* if the slave address is ten bit address, enable 10BITADDR */ |
| 400 | ic_con = dw_readl(dev, DW_IC_CON); | 399 | ic_con = dw_readl(dev, DW_IC_CON); |
| 401 | if (msgs[dev->msg_write_idx].flags & I2C_M_TEN) | 400 | if (msgs[dev->msg_write_idx].flags & I2C_M_TEN) { |
| 402 | ic_con |= DW_IC_CON_10BITADDR_MASTER; | 401 | ic_con |= DW_IC_CON_10BITADDR_MASTER; |
| 403 | else | 402 | /* |
| 403 | * If I2C_DYNAMIC_TAR_UPDATE is set, the 10-bit addressing | ||
| 404 | * mode has to be enabled via bit 12 of IC_TAR register. | ||
| 405 | * We set it always as I2C_DYNAMIC_TAR_UPDATE can't be | ||
| 406 | * detected from registers. | ||
| 407 | */ | ||
| 408 | ic_tar = DW_IC_TAR_10BITADDR_MASTER; | ||
| 409 | } else { | ||
| 404 | ic_con &= ~DW_IC_CON_10BITADDR_MASTER; | 410 | ic_con &= ~DW_IC_CON_10BITADDR_MASTER; |
| 411 | } | ||
| 412 | |||
| 405 | dw_writel(dev, ic_con, DW_IC_CON); | 413 | dw_writel(dev, ic_con, DW_IC_CON); |
| 406 | 414 | ||
| 415 | /* | ||
| 416 | * Set the slave (target) address and enable 10-bit addressing mode | ||
| 417 | * if applicable. | ||
| 418 | */ | ||
| 419 | dw_writel(dev, msgs[dev->msg_write_idx].addr | ic_tar, DW_IC_TAR); | ||
| 420 | |||
| 407 | /* Enable the adapter */ | 421 | /* Enable the adapter */ |
| 408 | __i2c_dw_enable(dev, true); | 422 | __i2c_dw_enable(dev, true); |
| 409 | 423 | ||
diff --git a/drivers/i2c/busses/i2c-ismt.c b/drivers/i2c/busses/i2c-ismt.c index 8ed79a086f85..1672effbcebb 100644 --- a/drivers/i2c/busses/i2c-ismt.c +++ b/drivers/i2c/busses/i2c-ismt.c | |||
| @@ -393,6 +393,9 @@ static int ismt_access(struct i2c_adapter *adap, u16 addr, | |||
| 393 | 393 | ||
| 394 | desc = &priv->hw[priv->head]; | 394 | desc = &priv->hw[priv->head]; |
| 395 | 395 | ||
| 396 | /* Initialize the DMA buffer */ | ||
| 397 | memset(priv->dma_buffer, 0, sizeof(priv->dma_buffer)); | ||
| 398 | |||
| 396 | /* Initialize the descriptor */ | 399 | /* Initialize the descriptor */ |
| 397 | memset(desc, 0, sizeof(struct ismt_desc)); | 400 | memset(desc, 0, sizeof(struct ismt_desc)); |
| 398 | desc->tgtaddr_rw = ISMT_DESC_ADDR_RW(addr, read_write); | 401 | desc->tgtaddr_rw = ISMT_DESC_ADDR_RW(addr, read_write); |
diff --git a/drivers/i2c/busses/i2c-mv64xxx.c b/drivers/i2c/busses/i2c-mv64xxx.c index 7f3a47443494..d3e9cc3153a9 100644 --- a/drivers/i2c/busses/i2c-mv64xxx.c +++ b/drivers/i2c/busses/i2c-mv64xxx.c | |||
| @@ -234,9 +234,9 @@ static int mv64xxx_i2c_offload_msg(struct mv64xxx_i2c_data *drv_data) | |||
| 234 | ctrl_reg |= MV64XXX_I2C_BRIDGE_CONTROL_WR | | 234 | ctrl_reg |= MV64XXX_I2C_BRIDGE_CONTROL_WR | |
| 235 | (msg->len - 1) << MV64XXX_I2C_BRIDGE_CONTROL_TX_SIZE_SHIFT; | 235 | (msg->len - 1) << MV64XXX_I2C_BRIDGE_CONTROL_TX_SIZE_SHIFT; |
| 236 | 236 | ||
| 237 | writel_relaxed(data_reg_lo, | 237 | writel(data_reg_lo, |
| 238 | drv_data->reg_base + MV64XXX_I2C_REG_TX_DATA_LO); | 238 | drv_data->reg_base + MV64XXX_I2C_REG_TX_DATA_LO); |
| 239 | writel_relaxed(data_reg_hi, | 239 | writel(data_reg_hi, |
| 240 | drv_data->reg_base + MV64XXX_I2C_REG_TX_DATA_HI); | 240 | drv_data->reg_base + MV64XXX_I2C_REG_TX_DATA_HI); |
| 241 | 241 | ||
| 242 | } else { | 242 | } else { |
| @@ -697,6 +697,7 @@ static const struct of_device_id mv64xxx_i2c_of_match_table[] = { | |||
| 697 | MODULE_DEVICE_TABLE(of, mv64xxx_i2c_of_match_table); | 697 | MODULE_DEVICE_TABLE(of, mv64xxx_i2c_of_match_table); |
| 698 | 698 | ||
| 699 | #ifdef CONFIG_OF | 699 | #ifdef CONFIG_OF |
| 700 | #ifdef CONFIG_HAVE_CLK | ||
| 700 | static int | 701 | static int |
| 701 | mv64xxx_calc_freq(const int tclk, const int n, const int m) | 702 | mv64xxx_calc_freq(const int tclk, const int n, const int m) |
| 702 | { | 703 | { |
| @@ -726,16 +727,12 @@ mv64xxx_find_baud_factors(const u32 req_freq, const u32 tclk, u32 *best_n, | |||
| 726 | return false; | 727 | return false; |
| 727 | return true; | 728 | return true; |
| 728 | } | 729 | } |
| 730 | #endif /* CONFIG_HAVE_CLK */ | ||
| 729 | 731 | ||
| 730 | static int | 732 | static int |
| 731 | mv64xxx_of_config(struct mv64xxx_i2c_data *drv_data, | 733 | mv64xxx_of_config(struct mv64xxx_i2c_data *drv_data, |
| 732 | struct device *dev) | 734 | struct device *dev) |
| 733 | { | 735 | { |
| 734 | const struct of_device_id *device; | ||
| 735 | struct device_node *np = dev->of_node; | ||
| 736 | u32 bus_freq, tclk; | ||
| 737 | int rc = 0; | ||
| 738 | |||
| 739 | /* CLK is mandatory when using DT to describe the i2c bus. We | 736 | /* CLK is mandatory when using DT to describe the i2c bus. We |
| 740 | * need to know tclk in order to calculate bus clock | 737 | * need to know tclk in order to calculate bus clock |
| 741 | * factors. | 738 | * factors. |
| @@ -744,6 +741,11 @@ mv64xxx_of_config(struct mv64xxx_i2c_data *drv_data, | |||
| 744 | /* Have OF but no CLK */ | 741 | /* Have OF but no CLK */ |
| 745 | return -ENODEV; | 742 | return -ENODEV; |
| 746 | #else | 743 | #else |
| 744 | const struct of_device_id *device; | ||
| 745 | struct device_node *np = dev->of_node; | ||
| 746 | u32 bus_freq, tclk; | ||
| 747 | int rc = 0; | ||
| 748 | |||
| 747 | if (IS_ERR(drv_data->clk)) { | 749 | if (IS_ERR(drv_data->clk)) { |
| 748 | rc = -ENODEV; | 750 | rc = -ENODEV; |
| 749 | goto out; | 751 | goto out; |
diff --git a/drivers/i2c/busses/i2c-s3c2410.c b/drivers/i2c/busses/i2c-s3c2410.c index 3535f3c0f7b4..3747b9bf67d6 100644 --- a/drivers/i2c/busses/i2c-s3c2410.c +++ b/drivers/i2c/busses/i2c-s3c2410.c | |||
| @@ -1178,8 +1178,6 @@ static int s3c24xx_i2c_remove(struct platform_device *pdev) | |||
| 1178 | 1178 | ||
| 1179 | i2c_del_adapter(&i2c->adap); | 1179 | i2c_del_adapter(&i2c->adap); |
| 1180 | 1180 | ||
| 1181 | clk_disable_unprepare(i2c->clk); | ||
| 1182 | |||
| 1183 | if (pdev->dev.of_node && IS_ERR(i2c->pctrl)) | 1181 | if (pdev->dev.of_node && IS_ERR(i2c->pctrl)) |
| 1184 | s3c24xx_i2c_dt_gpio_free(i2c); | 1182 | s3c24xx_i2c_dt_gpio_free(i2c); |
| 1185 | 1183 | ||
diff --git a/drivers/iio/accel/bma180.c b/drivers/iio/accel/bma180.c index 12e32e6b4103..81e3dc260993 100644 --- a/drivers/iio/accel/bma180.c +++ b/drivers/iio/accel/bma180.c | |||
| @@ -620,7 +620,7 @@ static int bma180_remove(struct i2c_client *client) | |||
| 620 | #ifdef CONFIG_PM_SLEEP | 620 | #ifdef CONFIG_PM_SLEEP |
| 621 | static int bma180_suspend(struct device *dev) | 621 | static int bma180_suspend(struct device *dev) |
| 622 | { | 622 | { |
| 623 | struct iio_dev *indio_dev = dev_to_iio_dev(dev); | 623 | struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev)); |
| 624 | struct bma180_data *data = iio_priv(indio_dev); | 624 | struct bma180_data *data = iio_priv(indio_dev); |
| 625 | int ret; | 625 | int ret; |
| 626 | 626 | ||
| @@ -633,7 +633,7 @@ static int bma180_suspend(struct device *dev) | |||
| 633 | 633 | ||
| 634 | static int bma180_resume(struct device *dev) | 634 | static int bma180_resume(struct device *dev) |
| 635 | { | 635 | { |
| 636 | struct iio_dev *indio_dev = dev_to_iio_dev(dev); | 636 | struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev)); |
| 637 | struct bma180_data *data = iio_priv(indio_dev); | 637 | struct bma180_data *data = iio_priv(indio_dev); |
| 638 | int ret; | 638 | int ret; |
| 639 | 639 | ||
diff --git a/drivers/iio/adc/at91_adc.c b/drivers/iio/adc/at91_adc.c index 84be63bdf038..0f16b553e063 100644 --- a/drivers/iio/adc/at91_adc.c +++ b/drivers/iio/adc/at91_adc.c | |||
| @@ -556,7 +556,7 @@ static const struct iio_info at91_adc_info = { | |||
| 556 | 556 | ||
| 557 | static int at91_adc_probe(struct platform_device *pdev) | 557 | static int at91_adc_probe(struct platform_device *pdev) |
| 558 | { | 558 | { |
| 559 | unsigned int prsc, mstrclk, ticks, adc_clk, shtim; | 559 | unsigned int prsc, mstrclk, ticks, adc_clk, adc_clk_khz, shtim; |
| 560 | int ret; | 560 | int ret; |
| 561 | struct iio_dev *idev; | 561 | struct iio_dev *idev; |
| 562 | struct at91_adc_state *st; | 562 | struct at91_adc_state *st; |
| @@ -649,6 +649,7 @@ static int at91_adc_probe(struct platform_device *pdev) | |||
| 649 | */ | 649 | */ |
| 650 | mstrclk = clk_get_rate(st->clk); | 650 | mstrclk = clk_get_rate(st->clk); |
| 651 | adc_clk = clk_get_rate(st->adc_clk); | 651 | adc_clk = clk_get_rate(st->adc_clk); |
| 652 | adc_clk_khz = adc_clk / 1000; | ||
| 652 | prsc = (mstrclk / (2 * adc_clk)) - 1; | 653 | prsc = (mstrclk / (2 * adc_clk)) - 1; |
| 653 | 654 | ||
| 654 | if (!st->startup_time) { | 655 | if (!st->startup_time) { |
| @@ -662,15 +663,15 @@ static int at91_adc_probe(struct platform_device *pdev) | |||
| 662 | * defined in the electrical characteristics of the board, divided by 8. | 663 | * defined in the electrical characteristics of the board, divided by 8. |
| 663 | * The formula thus is : Startup Time = (ticks + 1) * 8 / ADC Clock | 664 | * The formula thus is : Startup Time = (ticks + 1) * 8 / ADC Clock |
| 664 | */ | 665 | */ |
| 665 | ticks = round_up((st->startup_time * adc_clk / | 666 | ticks = round_up((st->startup_time * adc_clk_khz / |
| 666 | 1000000) - 1, 8) / 8; | 667 | 1000) - 1, 8) / 8; |
| 667 | /* | 668 | /* |
| 668 | * a minimal Sample and Hold Time is necessary for the ADC to guarantee | 669 | * a minimal Sample and Hold Time is necessary for the ADC to guarantee |
| 669 | * the best converted final value between two channels selection | 670 | * the best converted final value between two channels selection |
| 670 | * The formula thus is : Sample and Hold Time = (shtim + 1) / ADCClock | 671 | * The formula thus is : Sample and Hold Time = (shtim + 1) / ADCClock |
| 671 | */ | 672 | */ |
| 672 | shtim = round_up((st->sample_hold_time * adc_clk / | 673 | shtim = round_up((st->sample_hold_time * adc_clk_khz / |
| 673 | 1000000) - 1, 1); | 674 | 1000) - 1, 1); |
| 674 | 675 | ||
| 675 | reg = AT91_ADC_PRESCAL_(prsc) & st->registers->mr_prescal_mask; | 676 | reg = AT91_ADC_PRESCAL_(prsc) & st->registers->mr_prescal_mask; |
| 676 | reg |= AT91_ADC_STARTUP_(ticks) & st->registers->mr_startup_mask; | 677 | reg |= AT91_ADC_STARTUP_(ticks) & st->registers->mr_startup_mask; |
diff --git a/drivers/iio/buffer_cb.c b/drivers/iio/buffer_cb.c index 9d19ba74f22b..415f3c6efd72 100644 --- a/drivers/iio/buffer_cb.c +++ b/drivers/iio/buffer_cb.c | |||
| @@ -41,6 +41,8 @@ struct iio_cb_buffer *iio_channel_get_all_cb(struct device *dev, | |||
| 41 | goto error_ret; | 41 | goto error_ret; |
| 42 | } | 42 | } |
| 43 | 43 | ||
| 44 | iio_buffer_init(&cb_buff->buffer); | ||
| 45 | |||
| 44 | cb_buff->private = private; | 46 | cb_buff->private = private; |
| 45 | cb_buff->cb = cb; | 47 | cb_buff->cb = cb; |
| 46 | cb_buff->buffer.access = &iio_cb_access; | 48 | cb_buff->buffer.access = &iio_cb_access; |
diff --git a/drivers/iio/dac/mcp4725.c b/drivers/iio/dac/mcp4725.c index 1f4a48e6a82c..1397b6e0e414 100644 --- a/drivers/iio/dac/mcp4725.c +++ b/drivers/iio/dac/mcp4725.c | |||
| @@ -37,21 +37,21 @@ struct mcp4725_data { | |||
| 37 | 37 | ||
| 38 | static int mcp4725_suspend(struct device *dev) | 38 | static int mcp4725_suspend(struct device *dev) |
| 39 | { | 39 | { |
| 40 | struct iio_dev *indio_dev = dev_to_iio_dev(dev); | 40 | struct mcp4725_data *data = iio_priv(i2c_get_clientdata( |
| 41 | struct mcp4725_data *data = iio_priv(indio_dev); | 41 | to_i2c_client(dev))); |
| 42 | u8 outbuf[2]; | 42 | u8 outbuf[2]; |
| 43 | 43 | ||
| 44 | outbuf[0] = (data->powerdown_mode + 1) << 4; | 44 | outbuf[0] = (data->powerdown_mode + 1) << 4; |
| 45 | outbuf[1] = 0; | 45 | outbuf[1] = 0; |
| 46 | data->powerdown = true; | 46 | data->powerdown = true; |
| 47 | 47 | ||
| 48 | return i2c_master_send(to_i2c_client(dev), outbuf, 2); | 48 | return i2c_master_send(data->client, outbuf, 2); |
| 49 | } | 49 | } |
| 50 | 50 | ||
| 51 | static int mcp4725_resume(struct device *dev) | 51 | static int mcp4725_resume(struct device *dev) |
| 52 | { | 52 | { |
| 53 | struct iio_dev *indio_dev = dev_to_iio_dev(dev); | 53 | struct mcp4725_data *data = iio_priv(i2c_get_clientdata( |
| 54 | struct mcp4725_data *data = iio_priv(indio_dev); | 54 | to_i2c_client(dev))); |
| 55 | u8 outbuf[2]; | 55 | u8 outbuf[2]; |
| 56 | 56 | ||
| 57 | /* restore previous DAC value */ | 57 | /* restore previous DAC value */ |
| @@ -59,7 +59,7 @@ static int mcp4725_resume(struct device *dev) | |||
| 59 | outbuf[1] = data->dac_value & 0xff; | 59 | outbuf[1] = data->dac_value & 0xff; |
| 60 | data->powerdown = false; | 60 | data->powerdown = false; |
| 61 | 61 | ||
| 62 | return i2c_master_send(to_i2c_client(dev), outbuf, 2); | 62 | return i2c_master_send(data->client, outbuf, 2); |
| 63 | } | 63 | } |
| 64 | 64 | ||
| 65 | #ifdef CONFIG_PM_SLEEP | 65 | #ifdef CONFIG_PM_SLEEP |
diff --git a/drivers/iio/iio_core.h b/drivers/iio/iio_core.h index 05c1b74502a3..9b32253b824b 100644 --- a/drivers/iio/iio_core.h +++ b/drivers/iio/iio_core.h | |||
| @@ -49,11 +49,15 @@ ssize_t iio_buffer_read_first_n_outer(struct file *filp, char __user *buf, | |||
| 49 | #define iio_buffer_poll_addr (&iio_buffer_poll) | 49 | #define iio_buffer_poll_addr (&iio_buffer_poll) |
| 50 | #define iio_buffer_read_first_n_outer_addr (&iio_buffer_read_first_n_outer) | 50 | #define iio_buffer_read_first_n_outer_addr (&iio_buffer_read_first_n_outer) |
| 51 | 51 | ||
| 52 | void iio_disable_all_buffers(struct iio_dev *indio_dev); | ||
| 53 | |||
| 52 | #else | 54 | #else |
| 53 | 55 | ||
| 54 | #define iio_buffer_poll_addr NULL | 56 | #define iio_buffer_poll_addr NULL |
| 55 | #define iio_buffer_read_first_n_outer_addr NULL | 57 | #define iio_buffer_read_first_n_outer_addr NULL |
| 56 | 58 | ||
| 59 | static inline void iio_disable_all_buffers(struct iio_dev *indio_dev) {} | ||
| 60 | |||
| 57 | #endif | 61 | #endif |
| 58 | 62 | ||
| 59 | int iio_device_register_eventset(struct iio_dev *indio_dev); | 63 | int iio_device_register_eventset(struct iio_dev *indio_dev); |
diff --git a/drivers/iio/industrialio-buffer.c b/drivers/iio/industrialio-buffer.c index e73033f3839a..2710f7245c3b 100644 --- a/drivers/iio/industrialio-buffer.c +++ b/drivers/iio/industrialio-buffer.c | |||
| @@ -460,6 +460,25 @@ static int iio_compute_scan_bytes(struct iio_dev *indio_dev, const long *mask, | |||
| 460 | return bytes; | 460 | return bytes; |
| 461 | } | 461 | } |
| 462 | 462 | ||
| 463 | void iio_disable_all_buffers(struct iio_dev *indio_dev) | ||
| 464 | { | ||
| 465 | struct iio_buffer *buffer, *_buffer; | ||
| 466 | |||
| 467 | if (list_empty(&indio_dev->buffer_list)) | ||
| 468 | return; | ||
| 469 | |||
| 470 | if (indio_dev->setup_ops->predisable) | ||
| 471 | indio_dev->setup_ops->predisable(indio_dev); | ||
| 472 | |||
| 473 | list_for_each_entry_safe(buffer, _buffer, | ||
| 474 | &indio_dev->buffer_list, buffer_list) | ||
| 475 | list_del_init(&buffer->buffer_list); | ||
| 476 | |||
| 477 | indio_dev->currentmode = INDIO_DIRECT_MODE; | ||
| 478 | if (indio_dev->setup_ops->postdisable) | ||
| 479 | indio_dev->setup_ops->postdisable(indio_dev); | ||
| 480 | } | ||
| 481 | |||
| 463 | int iio_update_buffers(struct iio_dev *indio_dev, | 482 | int iio_update_buffers(struct iio_dev *indio_dev, |
| 464 | struct iio_buffer *insert_buffer, | 483 | struct iio_buffer *insert_buffer, |
| 465 | struct iio_buffer *remove_buffer) | 484 | struct iio_buffer *remove_buffer) |
| @@ -528,8 +547,15 @@ int iio_update_buffers(struct iio_dev *indio_dev, | |||
| 528 | * Note can only occur when adding a buffer. | 547 | * Note can only occur when adding a buffer. |
| 529 | */ | 548 | */ |
| 530 | list_del(&insert_buffer->buffer_list); | 549 | list_del(&insert_buffer->buffer_list); |
| 531 | indio_dev->active_scan_mask = old_mask; | 550 | if (old_mask) { |
| 532 | success = -EINVAL; | 551 | indio_dev->active_scan_mask = old_mask; |
| 552 | success = -EINVAL; | ||
| 553 | } | ||
| 554 | else { | ||
| 555 | kfree(compound_mask); | ||
| 556 | ret = -EINVAL; | ||
| 557 | goto error_ret; | ||
| 558 | } | ||
| 533 | } | 559 | } |
| 534 | } else { | 560 | } else { |
| 535 | indio_dev->active_scan_mask = compound_mask; | 561 | indio_dev->active_scan_mask = compound_mask; |
diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c index 97f0297b120f..8e84cd522e49 100644 --- a/drivers/iio/industrialio-core.c +++ b/drivers/iio/industrialio-core.c | |||
| @@ -848,8 +848,6 @@ static void iio_device_unregister_sysfs(struct iio_dev *indio_dev) | |||
| 848 | static void iio_dev_release(struct device *device) | 848 | static void iio_dev_release(struct device *device) |
| 849 | { | 849 | { |
| 850 | struct iio_dev *indio_dev = dev_to_iio_dev(device); | 850 | struct iio_dev *indio_dev = dev_to_iio_dev(device); |
| 851 | if (indio_dev->chrdev.dev) | ||
| 852 | cdev_del(&indio_dev->chrdev); | ||
| 853 | if (indio_dev->modes & INDIO_BUFFER_TRIGGERED) | 851 | if (indio_dev->modes & INDIO_BUFFER_TRIGGERED) |
| 854 | iio_device_unregister_trigger_consumer(indio_dev); | 852 | iio_device_unregister_trigger_consumer(indio_dev); |
| 855 | iio_device_unregister_eventset(indio_dev); | 853 | iio_device_unregister_eventset(indio_dev); |
| @@ -970,6 +968,8 @@ static int iio_chrdev_open(struct inode *inode, struct file *filp) | |||
| 970 | if (test_and_set_bit(IIO_BUSY_BIT_POS, &indio_dev->flags)) | 968 | if (test_and_set_bit(IIO_BUSY_BIT_POS, &indio_dev->flags)) |
| 971 | return -EBUSY; | 969 | return -EBUSY; |
| 972 | 970 | ||
| 971 | iio_device_get(indio_dev); | ||
| 972 | |||
| 973 | filp->private_data = indio_dev; | 973 | filp->private_data = indio_dev; |
| 974 | 974 | ||
| 975 | return 0; | 975 | return 0; |
| @@ -983,6 +983,8 @@ static int iio_chrdev_release(struct inode *inode, struct file *filp) | |||
| 983 | struct iio_dev *indio_dev = container_of(inode->i_cdev, | 983 | struct iio_dev *indio_dev = container_of(inode->i_cdev, |
| 984 | struct iio_dev, chrdev); | 984 | struct iio_dev, chrdev); |
| 985 | clear_bit(IIO_BUSY_BIT_POS, &indio_dev->flags); | 985 | clear_bit(IIO_BUSY_BIT_POS, &indio_dev->flags); |
| 986 | iio_device_put(indio_dev); | ||
| 987 | |||
| 986 | return 0; | 988 | return 0; |
| 987 | } | 989 | } |
| 988 | 990 | ||
| @@ -1052,18 +1054,20 @@ int iio_device_register(struct iio_dev *indio_dev) | |||
| 1052 | indio_dev->setup_ops == NULL) | 1054 | indio_dev->setup_ops == NULL) |
| 1053 | indio_dev->setup_ops = &noop_ring_setup_ops; | 1055 | indio_dev->setup_ops = &noop_ring_setup_ops; |
| 1054 | 1056 | ||
| 1055 | ret = device_add(&indio_dev->dev); | ||
| 1056 | if (ret < 0) | ||
| 1057 | goto error_unreg_eventset; | ||
| 1058 | cdev_init(&indio_dev->chrdev, &iio_buffer_fileops); | 1057 | cdev_init(&indio_dev->chrdev, &iio_buffer_fileops); |
| 1059 | indio_dev->chrdev.owner = indio_dev->info->driver_module; | 1058 | indio_dev->chrdev.owner = indio_dev->info->driver_module; |
| 1059 | indio_dev->chrdev.kobj.parent = &indio_dev->dev.kobj; | ||
| 1060 | ret = cdev_add(&indio_dev->chrdev, indio_dev->dev.devt, 1); | 1060 | ret = cdev_add(&indio_dev->chrdev, indio_dev->dev.devt, 1); |
| 1061 | if (ret < 0) | 1061 | if (ret < 0) |
| 1062 | goto error_del_device; | 1062 | goto error_unreg_eventset; |
| 1063 | return 0; | ||
| 1064 | 1063 | ||
| 1065 | error_del_device: | 1064 | ret = device_add(&indio_dev->dev); |
| 1066 | device_del(&indio_dev->dev); | 1065 | if (ret < 0) |
| 1066 | goto error_cdev_del; | ||
| 1067 | |||
| 1068 | return 0; | ||
| 1069 | error_cdev_del: | ||
| 1070 | cdev_del(&indio_dev->chrdev); | ||
| 1067 | error_unreg_eventset: | 1071 | error_unreg_eventset: |
| 1068 | iio_device_unregister_eventset(indio_dev); | 1072 | iio_device_unregister_eventset(indio_dev); |
| 1069 | error_free_sysfs: | 1073 | error_free_sysfs: |
| @@ -1078,9 +1082,16 @@ EXPORT_SYMBOL(iio_device_register); | |||
| 1078 | void iio_device_unregister(struct iio_dev *indio_dev) | 1082 | void iio_device_unregister(struct iio_dev *indio_dev) |
| 1079 | { | 1083 | { |
| 1080 | mutex_lock(&indio_dev->info_exist_lock); | 1084 | mutex_lock(&indio_dev->info_exist_lock); |
| 1085 | |||
| 1086 | device_del(&indio_dev->dev); | ||
| 1087 | |||
| 1088 | if (indio_dev->chrdev.dev) | ||
| 1089 | cdev_del(&indio_dev->chrdev); | ||
| 1090 | |||
| 1091 | iio_disable_all_buffers(indio_dev); | ||
| 1092 | |||
| 1081 | indio_dev->info = NULL; | 1093 | indio_dev->info = NULL; |
| 1082 | mutex_unlock(&indio_dev->info_exist_lock); | 1094 | mutex_unlock(&indio_dev->info_exist_lock); |
| 1083 | device_del(&indio_dev->dev); | ||
| 1084 | } | 1095 | } |
| 1085 | EXPORT_SYMBOL(iio_device_unregister); | 1096 | EXPORT_SYMBOL(iio_device_unregister); |
| 1086 | subsys_initcall(iio_init); | 1097 | subsys_initcall(iio_init); |
diff --git a/drivers/iio/industrialio-event.c b/drivers/iio/industrialio-event.c index 10aa9ef86cec..6be65ef5faa9 100644 --- a/drivers/iio/industrialio-event.c +++ b/drivers/iio/industrialio-event.c | |||
| @@ -72,7 +72,8 @@ EXPORT_SYMBOL(iio_push_event); | |||
| 72 | static unsigned int iio_event_poll(struct file *filep, | 72 | static unsigned int iio_event_poll(struct file *filep, |
| 73 | struct poll_table_struct *wait) | 73 | struct poll_table_struct *wait) |
| 74 | { | 74 | { |
| 75 | struct iio_event_interface *ev_int = filep->private_data; | 75 | struct iio_dev *indio_dev = filep->private_data; |
| 76 | struct iio_event_interface *ev_int = indio_dev->event_interface; | ||
| 76 | unsigned int events = 0; | 77 | unsigned int events = 0; |
| 77 | 78 | ||
| 78 | poll_wait(filep, &ev_int->wait, wait); | 79 | poll_wait(filep, &ev_int->wait, wait); |
| @@ -90,7 +91,8 @@ static ssize_t iio_event_chrdev_read(struct file *filep, | |||
| 90 | size_t count, | 91 | size_t count, |
| 91 | loff_t *f_ps) | 92 | loff_t *f_ps) |
| 92 | { | 93 | { |
| 93 | struct iio_event_interface *ev_int = filep->private_data; | 94 | struct iio_dev *indio_dev = filep->private_data; |
| 95 | struct iio_event_interface *ev_int = indio_dev->event_interface; | ||
| 94 | unsigned int copied; | 96 | unsigned int copied; |
| 95 | int ret; | 97 | int ret; |
| 96 | 98 | ||
| @@ -121,7 +123,8 @@ error_unlock: | |||
| 121 | 123 | ||
| 122 | static int iio_event_chrdev_release(struct inode *inode, struct file *filep) | 124 | static int iio_event_chrdev_release(struct inode *inode, struct file *filep) |
| 123 | { | 125 | { |
| 124 | struct iio_event_interface *ev_int = filep->private_data; | 126 | struct iio_dev *indio_dev = filep->private_data; |
| 127 | struct iio_event_interface *ev_int = indio_dev->event_interface; | ||
| 125 | 128 | ||
| 126 | spin_lock_irq(&ev_int->wait.lock); | 129 | spin_lock_irq(&ev_int->wait.lock); |
| 127 | __clear_bit(IIO_BUSY_BIT_POS, &ev_int->flags); | 130 | __clear_bit(IIO_BUSY_BIT_POS, &ev_int->flags); |
| @@ -133,6 +136,8 @@ static int iio_event_chrdev_release(struct inode *inode, struct file *filep) | |||
| 133 | kfifo_reset_out(&ev_int->det_events); | 136 | kfifo_reset_out(&ev_int->det_events); |
| 134 | spin_unlock_irq(&ev_int->wait.lock); | 137 | spin_unlock_irq(&ev_int->wait.lock); |
| 135 | 138 | ||
| 139 | iio_device_put(indio_dev); | ||
| 140 | |||
| 136 | return 0; | 141 | return 0; |
| 137 | } | 142 | } |
| 138 | 143 | ||
| @@ -158,12 +163,15 @@ int iio_event_getfd(struct iio_dev *indio_dev) | |||
| 158 | return -EBUSY; | 163 | return -EBUSY; |
| 159 | } | 164 | } |
| 160 | spin_unlock_irq(&ev_int->wait.lock); | 165 | spin_unlock_irq(&ev_int->wait.lock); |
| 161 | fd = anon_inode_getfd("iio:event", | 166 | iio_device_get(indio_dev); |
| 162 | &iio_event_chrdev_fileops, ev_int, O_RDONLY); | 167 | |
| 168 | fd = anon_inode_getfd("iio:event", &iio_event_chrdev_fileops, | ||
| 169 | indio_dev, O_RDONLY); | ||
| 163 | if (fd < 0) { | 170 | if (fd < 0) { |
| 164 | spin_lock_irq(&ev_int->wait.lock); | 171 | spin_lock_irq(&ev_int->wait.lock); |
| 165 | __clear_bit(IIO_BUSY_BIT_POS, &ev_int->flags); | 172 | __clear_bit(IIO_BUSY_BIT_POS, &ev_int->flags); |
| 166 | spin_unlock_irq(&ev_int->wait.lock); | 173 | spin_unlock_irq(&ev_int->wait.lock); |
| 174 | iio_device_put(indio_dev); | ||
| 167 | } | 175 | } |
| 168 | return fd; | 176 | return fd; |
| 169 | } | 177 | } |
| @@ -276,7 +284,7 @@ static int iio_device_add_event_sysfs(struct iio_dev *indio_dev, | |||
| 276 | goto error_ret; | 284 | goto error_ret; |
| 277 | } | 285 | } |
| 278 | if (chan->modified) | 286 | if (chan->modified) |
| 279 | mask = IIO_MOD_EVENT_CODE(chan->type, 0, chan->channel, | 287 | mask = IIO_MOD_EVENT_CODE(chan->type, 0, chan->channel2, |
| 280 | i/IIO_EV_DIR_MAX, | 288 | i/IIO_EV_DIR_MAX, |
| 281 | i%IIO_EV_DIR_MAX); | 289 | i%IIO_EV_DIR_MAX); |
| 282 | else if (chan->differential) | 290 | else if (chan->differential) |
diff --git a/drivers/iio/temperature/tmp006.c b/drivers/iio/temperature/tmp006.c index 64ccde3f1f7a..6d63883da1ab 100644 --- a/drivers/iio/temperature/tmp006.c +++ b/drivers/iio/temperature/tmp006.c | |||
| @@ -255,12 +255,14 @@ static int tmp006_remove(struct i2c_client *client) | |||
| 255 | #ifdef CONFIG_PM_SLEEP | 255 | #ifdef CONFIG_PM_SLEEP |
| 256 | static int tmp006_suspend(struct device *dev) | 256 | static int tmp006_suspend(struct device *dev) |
| 257 | { | 257 | { |
| 258 | return tmp006_powerdown(iio_priv(dev_to_iio_dev(dev))); | 258 | struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev)); |
| 259 | return tmp006_powerdown(iio_priv(indio_dev)); | ||
| 259 | } | 260 | } |
| 260 | 261 | ||
| 261 | static int tmp006_resume(struct device *dev) | 262 | static int tmp006_resume(struct device *dev) |
| 262 | { | 263 | { |
| 263 | struct tmp006_data *data = iio_priv(dev_to_iio_dev(dev)); | 264 | struct tmp006_data *data = iio_priv(i2c_get_clientdata( |
| 265 | to_i2c_client(dev))); | ||
| 264 | return i2c_smbus_write_word_swapped(data->client, TMP006_CONFIG, | 266 | return i2c_smbus_write_word_swapped(data->client, TMP006_CONFIG, |
| 265 | data->config | TMP006_CONFIG_MOD_MASK); | 267 | data->config | TMP006_CONFIG_MOD_MASK); |
| 266 | } | 268 | } |
diff --git a/drivers/isdn/hardware/mISDN/hfcpci.c b/drivers/isdn/hardware/mISDN/hfcpci.c index 7f910c76ca0a..3c92780bda09 100644 --- a/drivers/isdn/hardware/mISDN/hfcpci.c +++ b/drivers/isdn/hardware/mISDN/hfcpci.c | |||
| @@ -2295,8 +2295,8 @@ _hfcpci_softirq(struct device *dev, void *arg) | |||
| 2295 | static void | 2295 | static void |
| 2296 | hfcpci_softirq(void *arg) | 2296 | hfcpci_softirq(void *arg) |
| 2297 | { | 2297 | { |
| 2298 | (void) driver_for_each_device(&hfc_driver.driver, NULL, arg, | 2298 | WARN_ON_ONCE(driver_for_each_device(&hfc_driver.driver, NULL, arg, |
| 2299 | _hfcpci_softirq); | 2299 | _hfcpci_softirq) != 0); |
| 2300 | 2300 | ||
| 2301 | /* if next event would be in the past ... */ | 2301 | /* if next event would be in the past ... */ |
| 2302 | if ((s32)(hfc_jiffies + tics - jiffies) <= 0) | 2302 | if ((s32)(hfc_jiffies + tics - jiffies) <= 0) |
diff --git a/drivers/isdn/hisax/amd7930_fn.c b/drivers/isdn/hisax/amd7930_fn.c index 1063babe1d3a..36817e0a0b94 100644 --- a/drivers/isdn/hisax/amd7930_fn.c +++ b/drivers/isdn/hisax/amd7930_fn.c | |||
| @@ -314,7 +314,7 @@ Amd7930_empty_Dfifo(struct IsdnCardState *cs, int flag) | |||
| 314 | 314 | ||
| 315 | t += sprintf(t, "Amd7930: empty_Dfifo cnt: %d |", cs->rcvidx); | 315 | t += sprintf(t, "Amd7930: empty_Dfifo cnt: %d |", cs->rcvidx); |
| 316 | QuickHex(t, cs->rcvbuf, cs->rcvidx); | 316 | QuickHex(t, cs->rcvbuf, cs->rcvidx); |
| 317 | debugl1(cs, cs->dlog); | 317 | debugl1(cs, "%s", cs->dlog); |
| 318 | } | 318 | } |
| 319 | /* moves received data in sk-buffer */ | 319 | /* moves received data in sk-buffer */ |
| 320 | memcpy(skb_put(skb, cs->rcvidx), cs->rcvbuf, cs->rcvidx); | 320 | memcpy(skb_put(skb, cs->rcvidx), cs->rcvbuf, cs->rcvidx); |
| @@ -406,7 +406,7 @@ Amd7930_fill_Dfifo(struct IsdnCardState *cs) | |||
| 406 | 406 | ||
| 407 | t += sprintf(t, "Amd7930: fill_Dfifo cnt: %d |", count); | 407 | t += sprintf(t, "Amd7930: fill_Dfifo cnt: %d |", count); |
| 408 | QuickHex(t, deb_ptr, count); | 408 | QuickHex(t, deb_ptr, count); |
| 409 | debugl1(cs, cs->dlog); | 409 | debugl1(cs, "%s", cs->dlog); |
| 410 | } | 410 | } |
| 411 | /* AMD interrupts on */ | 411 | /* AMD interrupts on */ |
| 412 | AmdIrqOn(cs); | 412 | AmdIrqOn(cs); |
diff --git a/drivers/isdn/hisax/avm_pci.c b/drivers/isdn/hisax/avm_pci.c index ee9b9a03cffa..d1427bd6452d 100644 --- a/drivers/isdn/hisax/avm_pci.c +++ b/drivers/isdn/hisax/avm_pci.c | |||
| @@ -285,7 +285,7 @@ hdlc_empty_fifo(struct BCState *bcs, int count) | |||
| 285 | t += sprintf(t, "hdlc_empty_fifo %c cnt %d", | 285 | t += sprintf(t, "hdlc_empty_fifo %c cnt %d", |
| 286 | bcs->channel ? 'B' : 'A', count); | 286 | bcs->channel ? 'B' : 'A', count); |
| 287 | QuickHex(t, p, count); | 287 | QuickHex(t, p, count); |
| 288 | debugl1(cs, bcs->blog); | 288 | debugl1(cs, "%s", bcs->blog); |
| 289 | } | 289 | } |
| 290 | } | 290 | } |
| 291 | 291 | ||
| @@ -345,7 +345,7 @@ hdlc_fill_fifo(struct BCState *bcs) | |||
| 345 | t += sprintf(t, "hdlc_fill_fifo %c cnt %d", | 345 | t += sprintf(t, "hdlc_fill_fifo %c cnt %d", |
| 346 | bcs->channel ? 'B' : 'A', count); | 346 | bcs->channel ? 'B' : 'A', count); |
| 347 | QuickHex(t, p, count); | 347 | QuickHex(t, p, count); |
| 348 | debugl1(cs, bcs->blog); | 348 | debugl1(cs, "%s", bcs->blog); |
| 349 | } | 349 | } |
| 350 | } | 350 | } |
| 351 | 351 | ||
diff --git a/drivers/isdn/hisax/config.c b/drivers/isdn/hisax/config.c index bf04d2a3cf4a..b33f53b3ca93 100644 --- a/drivers/isdn/hisax/config.c +++ b/drivers/isdn/hisax/config.c | |||
| @@ -1896,7 +1896,7 @@ static void EChannel_proc_rcv(struct hisax_d_if *d_if) | |||
| 1896 | ptr--; | 1896 | ptr--; |
| 1897 | *ptr++ = '\n'; | 1897 | *ptr++ = '\n'; |
| 1898 | *ptr = 0; | 1898 | *ptr = 0; |
| 1899 | HiSax_putstatus(cs, NULL, cs->dlog); | 1899 | HiSax_putstatus(cs, NULL, "%s", cs->dlog); |
| 1900 | } else | 1900 | } else |
| 1901 | HiSax_putstatus(cs, "LogEcho: ", | 1901 | HiSax_putstatus(cs, "LogEcho: ", |
| 1902 | "warning Frame too big (%d)", | 1902 | "warning Frame too big (%d)", |
diff --git a/drivers/isdn/hisax/diva.c b/drivers/isdn/hisax/diva.c index 8d0cf6e4dc00..4fc90de68d18 100644 --- a/drivers/isdn/hisax/diva.c +++ b/drivers/isdn/hisax/diva.c | |||
| @@ -427,7 +427,7 @@ Memhscx_empty_fifo(struct BCState *bcs, int count) | |||
| 427 | t += sprintf(t, "hscx_empty_fifo %c cnt %d", | 427 | t += sprintf(t, "hscx_empty_fifo %c cnt %d", |
| 428 | bcs->hw.hscx.hscx ? 'B' : 'A', count); | 428 | bcs->hw.hscx.hscx ? 'B' : 'A', count); |
| 429 | QuickHex(t, ptr, count); | 429 | QuickHex(t, ptr, count); |
| 430 | debugl1(cs, bcs->blog); | 430 | debugl1(cs, "%s", bcs->blog); |
| 431 | } | 431 | } |
| 432 | } | 432 | } |
| 433 | 433 | ||
| @@ -469,7 +469,7 @@ Memhscx_fill_fifo(struct BCState *bcs) | |||
| 469 | t += sprintf(t, "hscx_fill_fifo %c cnt %d", | 469 | t += sprintf(t, "hscx_fill_fifo %c cnt %d", |
| 470 | bcs->hw.hscx.hscx ? 'B' : 'A', count); | 470 | bcs->hw.hscx.hscx ? 'B' : 'A', count); |
| 471 | QuickHex(t, ptr, count); | 471 | QuickHex(t, ptr, count); |
| 472 | debugl1(cs, bcs->blog); | 472 | debugl1(cs, "%s", bcs->blog); |
| 473 | } | 473 | } |
| 474 | } | 474 | } |
| 475 | 475 | ||
diff --git a/drivers/isdn/hisax/elsa.c b/drivers/isdn/hisax/elsa.c index 1df6f9a56ca2..2be1c8a3bb5f 100644 --- a/drivers/isdn/hisax/elsa.c +++ b/drivers/isdn/hisax/elsa.c | |||
| @@ -535,7 +535,7 @@ check_arcofi(struct IsdnCardState *cs) | |||
| 535 | t = tmp; | 535 | t = tmp; |
| 536 | t += sprintf(tmp, "Arcofi data"); | 536 | t += sprintf(tmp, "Arcofi data"); |
| 537 | QuickHex(t, p, cs->dc.isac.mon_rxp); | 537 | QuickHex(t, p, cs->dc.isac.mon_rxp); |
| 538 | debugl1(cs, tmp); | 538 | debugl1(cs, "%s", tmp); |
| 539 | if ((cs->dc.isac.mon_rxp == 2) && (cs->dc.isac.mon_rx[0] == 0xa0)) { | 539 | if ((cs->dc.isac.mon_rxp == 2) && (cs->dc.isac.mon_rx[0] == 0xa0)) { |
| 540 | switch (cs->dc.isac.mon_rx[1]) { | 540 | switch (cs->dc.isac.mon_rx[1]) { |
| 541 | case 0x80: | 541 | case 0x80: |
diff --git a/drivers/isdn/hisax/elsa_ser.c b/drivers/isdn/hisax/elsa_ser.c index d4c98d330bfe..3f84dd8f1757 100644 --- a/drivers/isdn/hisax/elsa_ser.c +++ b/drivers/isdn/hisax/elsa_ser.c | |||
| @@ -344,7 +344,7 @@ static inline void receive_chars(struct IsdnCardState *cs, | |||
| 344 | 344 | ||
| 345 | t += sprintf(t, "modem read cnt %d", cs->hw.elsa.rcvcnt); | 345 | t += sprintf(t, "modem read cnt %d", cs->hw.elsa.rcvcnt); |
| 346 | QuickHex(t, cs->hw.elsa.rcvbuf, cs->hw.elsa.rcvcnt); | 346 | QuickHex(t, cs->hw.elsa.rcvbuf, cs->hw.elsa.rcvcnt); |
| 347 | debugl1(cs, tmp); | 347 | debugl1(cs, "%s", tmp); |
| 348 | } | 348 | } |
| 349 | cs->hw.elsa.rcvcnt = 0; | 349 | cs->hw.elsa.rcvcnt = 0; |
| 350 | } | 350 | } |
diff --git a/drivers/isdn/hisax/hfc_pci.c b/drivers/isdn/hisax/hfc_pci.c index 3ccd724ff8c2..497bd026c237 100644 --- a/drivers/isdn/hisax/hfc_pci.c +++ b/drivers/isdn/hisax/hfc_pci.c | |||
| @@ -901,7 +901,7 @@ Begin: | |||
| 901 | ptr--; | 901 | ptr--; |
| 902 | *ptr++ = '\n'; | 902 | *ptr++ = '\n'; |
| 903 | *ptr = 0; | 903 | *ptr = 0; |
| 904 | HiSax_putstatus(cs, NULL, cs->dlog); | 904 | HiSax_putstatus(cs, NULL, "%s", cs->dlog); |
| 905 | } else | 905 | } else |
| 906 | HiSax_putstatus(cs, "LogEcho: ", "warning Frame too big (%d)", total - 3); | 906 | HiSax_putstatus(cs, "LogEcho: ", "warning Frame too big (%d)", total - 3); |
| 907 | } | 907 | } |
diff --git a/drivers/isdn/hisax/hfc_sx.c b/drivers/isdn/hisax/hfc_sx.c index dc4574f735ef..fa1fefd711cd 100644 --- a/drivers/isdn/hisax/hfc_sx.c +++ b/drivers/isdn/hisax/hfc_sx.c | |||
| @@ -674,7 +674,7 @@ receive_emsg(struct IsdnCardState *cs) | |||
| 674 | ptr--; | 674 | ptr--; |
| 675 | *ptr++ = '\n'; | 675 | *ptr++ = '\n'; |
| 676 | *ptr = 0; | 676 | *ptr = 0; |
| 677 | HiSax_putstatus(cs, NULL, cs->dlog); | 677 | HiSax_putstatus(cs, NULL, "%s", cs->dlog); |
| 678 | } else | 678 | } else |
| 679 | HiSax_putstatus(cs, "LogEcho: ", "warning Frame too big (%d)", skb->len); | 679 | HiSax_putstatus(cs, "LogEcho: ", "warning Frame too big (%d)", skb->len); |
| 680 | } | 680 | } |
diff --git a/drivers/isdn/hisax/hscx_irq.c b/drivers/isdn/hisax/hscx_irq.c index f398d4838937..a8d6188402c6 100644 --- a/drivers/isdn/hisax/hscx_irq.c +++ b/drivers/isdn/hisax/hscx_irq.c | |||
| @@ -75,7 +75,7 @@ hscx_empty_fifo(struct BCState *bcs, int count) | |||
| 75 | t += sprintf(t, "hscx_empty_fifo %c cnt %d", | 75 | t += sprintf(t, "hscx_empty_fifo %c cnt %d", |
| 76 | bcs->hw.hscx.hscx ? 'B' : 'A', count); | 76 | bcs->hw.hscx.hscx ? 'B' : 'A', count); |
| 77 | QuickHex(t, ptr, count); | 77 | QuickHex(t, ptr, count); |
| 78 | debugl1(cs, bcs->blog); | 78 | debugl1(cs, "%s", bcs->blog); |
| 79 | } | 79 | } |
| 80 | } | 80 | } |
| 81 | 81 | ||
| @@ -115,7 +115,7 @@ hscx_fill_fifo(struct BCState *bcs) | |||
| 115 | t += sprintf(t, "hscx_fill_fifo %c cnt %d", | 115 | t += sprintf(t, "hscx_fill_fifo %c cnt %d", |
| 116 | bcs->hw.hscx.hscx ? 'B' : 'A', count); | 116 | bcs->hw.hscx.hscx ? 'B' : 'A', count); |
| 117 | QuickHex(t, ptr, count); | 117 | QuickHex(t, ptr, count); |
| 118 | debugl1(cs, bcs->blog); | 118 | debugl1(cs, "%s", bcs->blog); |
| 119 | } | 119 | } |
| 120 | } | 120 | } |
| 121 | 121 | ||
diff --git a/drivers/isdn/hisax/icc.c b/drivers/isdn/hisax/icc.c index db5321f6379b..51dae9167238 100644 --- a/drivers/isdn/hisax/icc.c +++ b/drivers/isdn/hisax/icc.c | |||
| @@ -134,7 +134,7 @@ icc_empty_fifo(struct IsdnCardState *cs, int count) | |||
| 134 | 134 | ||
| 135 | t += sprintf(t, "icc_empty_fifo cnt %d", count); | 135 | t += sprintf(t, "icc_empty_fifo cnt %d", count); |
| 136 | QuickHex(t, ptr, count); | 136 | QuickHex(t, ptr, count); |
| 137 | debugl1(cs, cs->dlog); | 137 | debugl1(cs, "%s", cs->dlog); |
| 138 | } | 138 | } |
| 139 | } | 139 | } |
| 140 | 140 | ||
| @@ -176,7 +176,7 @@ icc_fill_fifo(struct IsdnCardState *cs) | |||
| 176 | 176 | ||
| 177 | t += sprintf(t, "icc_fill_fifo cnt %d", count); | 177 | t += sprintf(t, "icc_fill_fifo cnt %d", count); |
| 178 | QuickHex(t, ptr, count); | 178 | QuickHex(t, ptr, count); |
| 179 | debugl1(cs, cs->dlog); | 179 | debugl1(cs, "%s", cs->dlog); |
| 180 | } | 180 | } |
| 181 | } | 181 | } |
| 182 | 182 | ||
diff --git a/drivers/isdn/hisax/ipacx.c b/drivers/isdn/hisax/ipacx.c index 74feb5c83067..5faa5de24305 100644 --- a/drivers/isdn/hisax/ipacx.c +++ b/drivers/isdn/hisax/ipacx.c | |||
| @@ -260,7 +260,7 @@ dch_empty_fifo(struct IsdnCardState *cs, int count) | |||
| 260 | 260 | ||
| 261 | t += sprintf(t, "dch_empty_fifo() cnt %d", count); | 261 | t += sprintf(t, "dch_empty_fifo() cnt %d", count); |
| 262 | QuickHex(t, ptr, count); | 262 | QuickHex(t, ptr, count); |
| 263 | debugl1(cs, cs->dlog); | 263 | debugl1(cs, "%s", cs->dlog); |
| 264 | } | 264 | } |
| 265 | } | 265 | } |
| 266 | 266 | ||
| @@ -307,7 +307,7 @@ dch_fill_fifo(struct IsdnCardState *cs) | |||
| 307 | 307 | ||
| 308 | t += sprintf(t, "dch_fill_fifo() cnt %d", count); | 308 | t += sprintf(t, "dch_fill_fifo() cnt %d", count); |
| 309 | QuickHex(t, ptr, count); | 309 | QuickHex(t, ptr, count); |
| 310 | debugl1(cs, cs->dlog); | 310 | debugl1(cs, "%s", cs->dlog); |
| 311 | } | 311 | } |
| 312 | } | 312 | } |
| 313 | 313 | ||
| @@ -539,7 +539,7 @@ bch_empty_fifo(struct BCState *bcs, int count) | |||
| 539 | 539 | ||
| 540 | t += sprintf(t, "bch_empty_fifo() B-%d cnt %d", hscx, count); | 540 | t += sprintf(t, "bch_empty_fifo() B-%d cnt %d", hscx, count); |
| 541 | QuickHex(t, ptr, count); | 541 | QuickHex(t, ptr, count); |
| 542 | debugl1(cs, bcs->blog); | 542 | debugl1(cs, "%s", bcs->blog); |
| 543 | } | 543 | } |
| 544 | } | 544 | } |
| 545 | 545 | ||
| @@ -582,7 +582,7 @@ bch_fill_fifo(struct BCState *bcs) | |||
| 582 | 582 | ||
| 583 | t += sprintf(t, "chb_fill_fifo() B-%d cnt %d", hscx, count); | 583 | t += sprintf(t, "chb_fill_fifo() B-%d cnt %d", hscx, count); |
| 584 | QuickHex(t, ptr, count); | 584 | QuickHex(t, ptr, count); |
| 585 | debugl1(cs, bcs->blog); | 585 | debugl1(cs, "%s", bcs->blog); |
| 586 | } | 586 | } |
| 587 | } | 587 | } |
| 588 | 588 | ||
diff --git a/drivers/isdn/hisax/isac.c b/drivers/isdn/hisax/isac.c index a365ccc1c99c..7fdf78f46433 100644 --- a/drivers/isdn/hisax/isac.c +++ b/drivers/isdn/hisax/isac.c | |||
| @@ -137,7 +137,7 @@ isac_empty_fifo(struct IsdnCardState *cs, int count) | |||
| 137 | 137 | ||
| 138 | t += sprintf(t, "isac_empty_fifo cnt %d", count); | 138 | t += sprintf(t, "isac_empty_fifo cnt %d", count); |
| 139 | QuickHex(t, ptr, count); | 139 | QuickHex(t, ptr, count); |
| 140 | debugl1(cs, cs->dlog); | 140 | debugl1(cs, "%s", cs->dlog); |
| 141 | } | 141 | } |
| 142 | } | 142 | } |
| 143 | 143 | ||
| @@ -179,7 +179,7 @@ isac_fill_fifo(struct IsdnCardState *cs) | |||
| 179 | 179 | ||
| 180 | t += sprintf(t, "isac_fill_fifo cnt %d", count); | 180 | t += sprintf(t, "isac_fill_fifo cnt %d", count); |
| 181 | QuickHex(t, ptr, count); | 181 | QuickHex(t, ptr, count); |
| 182 | debugl1(cs, cs->dlog); | 182 | debugl1(cs, "%s", cs->dlog); |
| 183 | } | 183 | } |
| 184 | } | 184 | } |
| 185 | 185 | ||
diff --git a/drivers/isdn/hisax/isar.c b/drivers/isdn/hisax/isar.c index 7fdf34704fe5..f4956c73aa11 100644 --- a/drivers/isdn/hisax/isar.c +++ b/drivers/isdn/hisax/isar.c | |||
| @@ -74,7 +74,7 @@ sendmsg(struct IsdnCardState *cs, u_char his, u_char creg, u_char len, | |||
| 74 | t = tmp; | 74 | t = tmp; |
| 75 | t += sprintf(t, "sendmbox cnt %d", len); | 75 | t += sprintf(t, "sendmbox cnt %d", len); |
| 76 | QuickHex(t, &msg[len-i], (i > 64) ? 64 : i); | 76 | QuickHex(t, &msg[len-i], (i > 64) ? 64 : i); |
| 77 | debugl1(cs, tmp); | 77 | debugl1(cs, "%s", tmp); |
| 78 | i -= 64; | 78 | i -= 64; |
| 79 | } | 79 | } |
| 80 | } | 80 | } |
| @@ -105,7 +105,7 @@ rcv_mbox(struct IsdnCardState *cs, struct isar_reg *ireg, u_char *msg) | |||
| 105 | t = tmp; | 105 | t = tmp; |
| 106 | t += sprintf(t, "rcv_mbox cnt %d", ireg->clsb); | 106 | t += sprintf(t, "rcv_mbox cnt %d", ireg->clsb); |
| 107 | QuickHex(t, &msg[ireg->clsb - i], (i > 64) ? 64 : i); | 107 | QuickHex(t, &msg[ireg->clsb - i], (i > 64) ? 64 : i); |
| 108 | debugl1(cs, tmp); | 108 | debugl1(cs, "%s", tmp); |
| 109 | i -= 64; | 109 | i -= 64; |
| 110 | } | 110 | } |
| 111 | } | 111 | } |
| @@ -1248,7 +1248,7 @@ isar_int_main(struct IsdnCardState *cs) | |||
| 1248 | tp += sprintf(debbuf, "msg iis(%x) msb(%x)", | 1248 | tp += sprintf(debbuf, "msg iis(%x) msb(%x)", |
| 1249 | ireg->iis, ireg->cmsb); | 1249 | ireg->iis, ireg->cmsb); |
| 1250 | QuickHex(tp, (u_char *)ireg->par, ireg->clsb); | 1250 | QuickHex(tp, (u_char *)ireg->par, ireg->clsb); |
| 1251 | debugl1(cs, debbuf); | 1251 | debugl1(cs, "%s", debbuf); |
| 1252 | } | 1252 | } |
| 1253 | break; | 1253 | break; |
| 1254 | case ISAR_IIS_INVMSG: | 1254 | case ISAR_IIS_INVMSG: |
diff --git a/drivers/isdn/hisax/jade.c b/drivers/isdn/hisax/jade.c index f946c58d8ab1..e2ae7871a209 100644 --- a/drivers/isdn/hisax/jade.c +++ b/drivers/isdn/hisax/jade.c | |||
| @@ -81,10 +81,7 @@ modejade(struct BCState *bcs, int mode, int bc) | |||
| 81 | int jade = bcs->hw.hscx.hscx; | 81 | int jade = bcs->hw.hscx.hscx; |
| 82 | 82 | ||
| 83 | if (cs->debug & L1_DEB_HSCX) { | 83 | if (cs->debug & L1_DEB_HSCX) { |
| 84 | char tmp[40]; | 84 | debugl1(cs, "jade %c mode %d ichan %d", 'A' + jade, mode, bc); |
| 85 | sprintf(tmp, "jade %c mode %d ichan %d", | ||
| 86 | 'A' + jade, mode, bc); | ||
| 87 | debugl1(cs, tmp); | ||
| 88 | } | 85 | } |
| 89 | bcs->mode = mode; | 86 | bcs->mode = mode; |
| 90 | bcs->channel = bc; | 87 | bcs->channel = bc; |
| @@ -257,23 +254,18 @@ void | |||
| 257 | clear_pending_jade_ints(struct IsdnCardState *cs) | 254 | clear_pending_jade_ints(struct IsdnCardState *cs) |
| 258 | { | 255 | { |
| 259 | int val; | 256 | int val; |
| 260 | char tmp[64]; | ||
| 261 | 257 | ||
| 262 | cs->BC_Write_Reg(cs, 0, jade_HDLC_IMR, 0x00); | 258 | cs->BC_Write_Reg(cs, 0, jade_HDLC_IMR, 0x00); |
| 263 | cs->BC_Write_Reg(cs, 1, jade_HDLC_IMR, 0x00); | 259 | cs->BC_Write_Reg(cs, 1, jade_HDLC_IMR, 0x00); |
| 264 | 260 | ||
| 265 | val = cs->BC_Read_Reg(cs, 1, jade_HDLC_ISR); | 261 | val = cs->BC_Read_Reg(cs, 1, jade_HDLC_ISR); |
| 266 | sprintf(tmp, "jade B ISTA %x", val); | 262 | debugl1(cs, "jade B ISTA %x", val); |
| 267 | debugl1(cs, tmp); | ||
| 268 | val = cs->BC_Read_Reg(cs, 0, jade_HDLC_ISR); | 263 | val = cs->BC_Read_Reg(cs, 0, jade_HDLC_ISR); |
| 269 | sprintf(tmp, "jade A ISTA %x", val); | 264 | debugl1(cs, "jade A ISTA %x", val); |
| 270 | debugl1(cs, tmp); | ||
| 271 | val = cs->BC_Read_Reg(cs, 1, jade_HDLC_STAR); | 265 | val = cs->BC_Read_Reg(cs, 1, jade_HDLC_STAR); |
| 272 | sprintf(tmp, "jade B STAR %x", val); | 266 | debugl1(cs, "jade B STAR %x", val); |
| 273 | debugl1(cs, tmp); | ||
| 274 | val = cs->BC_Read_Reg(cs, 0, jade_HDLC_STAR); | 267 | val = cs->BC_Read_Reg(cs, 0, jade_HDLC_STAR); |
| 275 | sprintf(tmp, "jade A STAR %x", val); | 268 | debugl1(cs, "jade A STAR %x", val); |
| 276 | debugl1(cs, tmp); | ||
| 277 | /* Unmask ints */ | 269 | /* Unmask ints */ |
| 278 | cs->BC_Write_Reg(cs, 0, jade_HDLC_IMR, 0xF8); | 270 | cs->BC_Write_Reg(cs, 0, jade_HDLC_IMR, 0xF8); |
| 279 | cs->BC_Write_Reg(cs, 1, jade_HDLC_IMR, 0xF8); | 271 | cs->BC_Write_Reg(cs, 1, jade_HDLC_IMR, 0xF8); |
diff --git a/drivers/isdn/hisax/jade_irq.c b/drivers/isdn/hisax/jade_irq.c index f521fc83dc76..b930da9b5aa6 100644 --- a/drivers/isdn/hisax/jade_irq.c +++ b/drivers/isdn/hisax/jade_irq.c | |||
| @@ -65,7 +65,7 @@ jade_empty_fifo(struct BCState *bcs, int count) | |||
| 65 | t += sprintf(t, "jade_empty_fifo %c cnt %d", | 65 | t += sprintf(t, "jade_empty_fifo %c cnt %d", |
| 66 | bcs->hw.hscx.hscx ? 'B' : 'A', count); | 66 | bcs->hw.hscx.hscx ? 'B' : 'A', count); |
| 67 | QuickHex(t, ptr, count); | 67 | QuickHex(t, ptr, count); |
| 68 | debugl1(cs, bcs->blog); | 68 | debugl1(cs, "%s", bcs->blog); |
| 69 | } | 69 | } |
| 70 | } | 70 | } |
| 71 | 71 | ||
| @@ -105,7 +105,7 @@ jade_fill_fifo(struct BCState *bcs) | |||
| 105 | t += sprintf(t, "jade_fill_fifo %c cnt %d", | 105 | t += sprintf(t, "jade_fill_fifo %c cnt %d", |
| 106 | bcs->hw.hscx.hscx ? 'B' : 'A', count); | 106 | bcs->hw.hscx.hscx ? 'B' : 'A', count); |
| 107 | QuickHex(t, ptr, count); | 107 | QuickHex(t, ptr, count); |
| 108 | debugl1(cs, bcs->blog); | 108 | debugl1(cs, "%s", bcs->blog); |
| 109 | } | 109 | } |
| 110 | } | 110 | } |
| 111 | 111 | ||
diff --git a/drivers/isdn/hisax/l3_1tr6.c b/drivers/isdn/hisax/l3_1tr6.c index 4c1bca5caa1d..875402e76d0a 100644 --- a/drivers/isdn/hisax/l3_1tr6.c +++ b/drivers/isdn/hisax/l3_1tr6.c | |||
| @@ -63,7 +63,7 @@ l3_1tr6_error(struct l3_process *pc, u_char *msg, struct sk_buff *skb) | |||
| 63 | { | 63 | { |
| 64 | dev_kfree_skb(skb); | 64 | dev_kfree_skb(skb); |
| 65 | if (pc->st->l3.debug & L3_DEB_WARN) | 65 | if (pc->st->l3.debug & L3_DEB_WARN) |
| 66 | l3_debug(pc->st, msg); | 66 | l3_debug(pc->st, "%s", msg); |
| 67 | l3_1tr6_release_req(pc, 0, NULL); | 67 | l3_1tr6_release_req(pc, 0, NULL); |
| 68 | } | 68 | } |
| 69 | 69 | ||
| @@ -161,7 +161,6 @@ l3_1tr6_setup(struct l3_process *pc, u_char pr, void *arg) | |||
| 161 | { | 161 | { |
| 162 | u_char *p; | 162 | u_char *p; |
| 163 | int bcfound = 0; | 163 | int bcfound = 0; |
| 164 | char tmp[80]; | ||
| 165 | struct sk_buff *skb = arg; | 164 | struct sk_buff *skb = arg; |
| 166 | 165 | ||
| 167 | /* Channel Identification */ | 166 | /* Channel Identification */ |
| @@ -214,10 +213,9 @@ l3_1tr6_setup(struct l3_process *pc, u_char pr, void *arg) | |||
| 214 | /* Signal all services, linklevel takes care of Service-Indicator */ | 213 | /* Signal all services, linklevel takes care of Service-Indicator */ |
| 215 | if (bcfound) { | 214 | if (bcfound) { |
| 216 | if ((pc->para.setup.si1 != 7) && (pc->st->l3.debug & L3_DEB_WARN)) { | 215 | if ((pc->para.setup.si1 != 7) && (pc->st->l3.debug & L3_DEB_WARN)) { |
| 217 | sprintf(tmp, "non-digital call: %s -> %s", | 216 | l3_debug(pc->st, "non-digital call: %s -> %s", |
| 218 | pc->para.setup.phone, | 217 | pc->para.setup.phone, |
| 219 | pc->para.setup.eazmsn); | 218 | pc->para.setup.eazmsn); |
| 220 | l3_debug(pc->st, tmp); | ||
| 221 | } | 219 | } |
| 222 | newl3state(pc, 6); | 220 | newl3state(pc, 6); |
| 223 | pc->st->l3.l3l4(pc->st, CC_SETUP | INDICATION, pc); | 221 | pc->st->l3.l3l4(pc->st, CC_SETUP | INDICATION, pc); |
| @@ -301,7 +299,7 @@ l3_1tr6_info(struct l3_process *pc, u_char pr, void *arg) | |||
| 301 | { | 299 | { |
| 302 | u_char *p; | 300 | u_char *p; |
| 303 | int i, tmpcharge = 0; | 301 | int i, tmpcharge = 0; |
| 304 | char a_charge[8], tmp[32]; | 302 | char a_charge[8]; |
| 305 | struct sk_buff *skb = arg; | 303 | struct sk_buff *skb = arg; |
| 306 | 304 | ||
| 307 | p = skb->data; | 305 | p = skb->data; |
| @@ -316,8 +314,8 @@ l3_1tr6_info(struct l3_process *pc, u_char pr, void *arg) | |||
| 316 | pc->st->l3.l3l4(pc->st, CC_CHARGE | INDICATION, pc); | 314 | pc->st->l3.l3l4(pc->st, CC_CHARGE | INDICATION, pc); |
| 317 | } | 315 | } |
| 318 | if (pc->st->l3.debug & L3_DEB_CHARGE) { | 316 | if (pc->st->l3.debug & L3_DEB_CHARGE) { |
| 319 | sprintf(tmp, "charging info %d", pc->para.chargeinfo); | 317 | l3_debug(pc->st, "charging info %d", |
| 320 | l3_debug(pc->st, tmp); | 318 | pc->para.chargeinfo); |
| 321 | } | 319 | } |
| 322 | } else if (pc->st->l3.debug & L3_DEB_CHARGE) | 320 | } else if (pc->st->l3.debug & L3_DEB_CHARGE) |
| 323 | l3_debug(pc->st, "charging info not found"); | 321 | l3_debug(pc->st, "charging info not found"); |
| @@ -399,7 +397,7 @@ l3_1tr6_disc(struct l3_process *pc, u_char pr, void *arg) | |||
| 399 | struct sk_buff *skb = arg; | 397 | struct sk_buff *skb = arg; |
| 400 | u_char *p; | 398 | u_char *p; |
| 401 | int i, tmpcharge = 0; | 399 | int i, tmpcharge = 0; |
| 402 | char a_charge[8], tmp[32]; | 400 | char a_charge[8]; |
| 403 | 401 | ||
| 404 | StopAllL3Timer(pc); | 402 | StopAllL3Timer(pc); |
| 405 | p = skb->data; | 403 | p = skb->data; |
| @@ -414,8 +412,8 @@ l3_1tr6_disc(struct l3_process *pc, u_char pr, void *arg) | |||
| 414 | pc->st->l3.l3l4(pc->st, CC_CHARGE | INDICATION, pc); | 412 | pc->st->l3.l3l4(pc->st, CC_CHARGE | INDICATION, pc); |
| 415 | } | 413 | } |
| 416 | if (pc->st->l3.debug & L3_DEB_CHARGE) { | 414 | if (pc->st->l3.debug & L3_DEB_CHARGE) { |
| 417 | sprintf(tmp, "charging info %d", pc->para.chargeinfo); | 415 | l3_debug(pc->st, "charging info %d", |
| 418 | l3_debug(pc->st, tmp); | 416 | pc->para.chargeinfo); |
| 419 | } | 417 | } |
| 420 | } else if (pc->st->l3.debug & L3_DEB_CHARGE) | 418 | } else if (pc->st->l3.debug & L3_DEB_CHARGE) |
| 421 | l3_debug(pc->st, "charging info not found"); | 419 | l3_debug(pc->st, "charging info not found"); |
| @@ -746,7 +744,6 @@ up1tr6(struct PStack *st, int pr, void *arg) | |||
| 746 | int i, mt, cr; | 744 | int i, mt, cr; |
| 747 | struct l3_process *proc; | 745 | struct l3_process *proc; |
| 748 | struct sk_buff *skb = arg; | 746 | struct sk_buff *skb = arg; |
| 749 | char tmp[80]; | ||
| 750 | 747 | ||
| 751 | switch (pr) { | 748 | switch (pr) { |
| 752 | case (DL_DATA | INDICATION): | 749 | case (DL_DATA | INDICATION): |
| @@ -762,26 +759,23 @@ up1tr6(struct PStack *st, int pr, void *arg) | |||
| 762 | } | 759 | } |
| 763 | if (skb->len < 4) { | 760 | if (skb->len < 4) { |
| 764 | if (st->l3.debug & L3_DEB_PROTERR) { | 761 | if (st->l3.debug & L3_DEB_PROTERR) { |
| 765 | sprintf(tmp, "up1tr6 len only %d", skb->len); | 762 | l3_debug(st, "up1tr6 len only %d", skb->len); |
| 766 | l3_debug(st, tmp); | ||
| 767 | } | 763 | } |
| 768 | dev_kfree_skb(skb); | 764 | dev_kfree_skb(skb); |
| 769 | return; | 765 | return; |
| 770 | } | 766 | } |
| 771 | if ((skb->data[0] & 0xfe) != PROTO_DIS_N0) { | 767 | if ((skb->data[0] & 0xfe) != PROTO_DIS_N0) { |
| 772 | if (st->l3.debug & L3_DEB_PROTERR) { | 768 | if (st->l3.debug & L3_DEB_PROTERR) { |
| 773 | sprintf(tmp, "up1tr6%sunexpected discriminator %x message len %d", | 769 | l3_debug(st, "up1tr6%sunexpected discriminator %x message len %d", |
| 774 | (pr == (DL_DATA | INDICATION)) ? " " : "(broadcast) ", | 770 | (pr == (DL_DATA | INDICATION)) ? " " : "(broadcast) ", |
| 775 | skb->data[0], skb->len); | 771 | skb->data[0], skb->len); |
| 776 | l3_debug(st, tmp); | ||
| 777 | } | 772 | } |
| 778 | dev_kfree_skb(skb); | 773 | dev_kfree_skb(skb); |
| 779 | return; | 774 | return; |
| 780 | } | 775 | } |
| 781 | if (skb->data[1] != 1) { | 776 | if (skb->data[1] != 1) { |
| 782 | if (st->l3.debug & L3_DEB_PROTERR) { | 777 | if (st->l3.debug & L3_DEB_PROTERR) { |
| 783 | sprintf(tmp, "up1tr6 CR len not 1"); | 778 | l3_debug(st, "up1tr6 CR len not 1"); |
| 784 | l3_debug(st, tmp); | ||
| 785 | } | 779 | } |
| 786 | dev_kfree_skb(skb); | 780 | dev_kfree_skb(skb); |
| 787 | return; | 781 | return; |
| @@ -791,9 +785,8 @@ up1tr6(struct PStack *st, int pr, void *arg) | |||
| 791 | if (skb->data[0] == PROTO_DIS_N0) { | 785 | if (skb->data[0] == PROTO_DIS_N0) { |
| 792 | dev_kfree_skb(skb); | 786 | dev_kfree_skb(skb); |
| 793 | if (st->l3.debug & L3_DEB_STATE) { | 787 | if (st->l3.debug & L3_DEB_STATE) { |
| 794 | sprintf(tmp, "up1tr6%s N0 mt %x unhandled", | 788 | l3_debug(st, "up1tr6%s N0 mt %x unhandled", |
| 795 | (pr == (DL_DATA | INDICATION)) ? " " : "(broadcast) ", mt); | 789 | (pr == (DL_DATA | INDICATION)) ? " " : "(broadcast) ", mt); |
| 796 | l3_debug(st, tmp); | ||
| 797 | } | 790 | } |
| 798 | } else if (skb->data[0] == PROTO_DIS_N1) { | 791 | } else if (skb->data[0] == PROTO_DIS_N1) { |
| 799 | if (!(proc = getl3proc(st, cr))) { | 792 | if (!(proc = getl3proc(st, cr))) { |
| @@ -801,8 +794,7 @@ up1tr6(struct PStack *st, int pr, void *arg) | |||
| 801 | if (cr < 128) { | 794 | if (cr < 128) { |
| 802 | if (!(proc = new_l3_process(st, cr))) { | 795 | if (!(proc = new_l3_process(st, cr))) { |
| 803 | if (st->l3.debug & L3_DEB_PROTERR) { | 796 | if (st->l3.debug & L3_DEB_PROTERR) { |
| 804 | sprintf(tmp, "up1tr6 no roc mem"); | 797 | l3_debug(st, "up1tr6 no roc mem"); |
| 805 | l3_debug(st, tmp); | ||
| 806 | } | 798 | } |
| 807 | dev_kfree_skb(skb); | 799 | dev_kfree_skb(skb); |
| 808 | return; | 800 | return; |
| @@ -821,8 +813,7 @@ up1tr6(struct PStack *st, int pr, void *arg) | |||
| 821 | } else { | 813 | } else { |
| 822 | if (!(proc = new_l3_process(st, cr))) { | 814 | if (!(proc = new_l3_process(st, cr))) { |
| 823 | if (st->l3.debug & L3_DEB_PROTERR) { | 815 | if (st->l3.debug & L3_DEB_PROTERR) { |
| 824 | sprintf(tmp, "up1tr6 no roc mem"); | 816 | l3_debug(st, "up1tr6 no roc mem"); |
| 825 | l3_debug(st, tmp); | ||
| 826 | } | 817 | } |
| 827 | dev_kfree_skb(skb); | 818 | dev_kfree_skb(skb); |
| 828 | return; | 819 | return; |
| @@ -837,18 +828,16 @@ up1tr6(struct PStack *st, int pr, void *arg) | |||
| 837 | if (i == ARRAY_SIZE(datastln1)) { | 828 | if (i == ARRAY_SIZE(datastln1)) { |
| 838 | dev_kfree_skb(skb); | 829 | dev_kfree_skb(skb); |
| 839 | if (st->l3.debug & L3_DEB_STATE) { | 830 | if (st->l3.debug & L3_DEB_STATE) { |
| 840 | sprintf(tmp, "up1tr6%sstate %d mt %x unhandled", | 831 | l3_debug(st, "up1tr6%sstate %d mt %x unhandled", |
| 841 | (pr == (DL_DATA | INDICATION)) ? " " : "(broadcast) ", | 832 | (pr == (DL_DATA | INDICATION)) ? " " : "(broadcast) ", |
| 842 | proc->state, mt); | 833 | proc->state, mt); |
| 843 | l3_debug(st, tmp); | ||
| 844 | } | 834 | } |
| 845 | return; | 835 | return; |
| 846 | } else { | 836 | } else { |
| 847 | if (st->l3.debug & L3_DEB_STATE) { | 837 | if (st->l3.debug & L3_DEB_STATE) { |
| 848 | sprintf(tmp, "up1tr6%sstate %d mt %x", | 838 | l3_debug(st, "up1tr6%sstate %d mt %x", |
| 849 | (pr == (DL_DATA | INDICATION)) ? " " : "(broadcast) ", | 839 | (pr == (DL_DATA | INDICATION)) ? " " : "(broadcast) ", |
| 850 | proc->state, mt); | 840 | proc->state, mt); |
| 851 | l3_debug(st, tmp); | ||
| 852 | } | 841 | } |
| 853 | datastln1[i].rout(proc, pr, skb); | 842 | datastln1[i].rout(proc, pr, skb); |
| 854 | } | 843 | } |
| @@ -861,7 +850,6 @@ down1tr6(struct PStack *st, int pr, void *arg) | |||
| 861 | int i, cr; | 850 | int i, cr; |
| 862 | struct l3_process *proc; | 851 | struct l3_process *proc; |
| 863 | struct Channel *chan; | 852 | struct Channel *chan; |
| 864 | char tmp[80]; | ||
| 865 | 853 | ||
| 866 | if ((DL_ESTABLISH | REQUEST) == pr) { | 854 | if ((DL_ESTABLISH | REQUEST) == pr) { |
| 867 | l3_msg(st, pr, NULL); | 855 | l3_msg(st, pr, NULL); |
| @@ -888,15 +876,13 @@ down1tr6(struct PStack *st, int pr, void *arg) | |||
| 888 | break; | 876 | break; |
| 889 | if (i == ARRAY_SIZE(downstl)) { | 877 | if (i == ARRAY_SIZE(downstl)) { |
| 890 | if (st->l3.debug & L3_DEB_STATE) { | 878 | if (st->l3.debug & L3_DEB_STATE) { |
| 891 | sprintf(tmp, "down1tr6 state %d prim %d unhandled", | 879 | l3_debug(st, "down1tr6 state %d prim %d unhandled", |
| 892 | proc->state, pr); | 880 | proc->state, pr); |
| 893 | l3_debug(st, tmp); | ||
| 894 | } | 881 | } |
| 895 | } else { | 882 | } else { |
| 896 | if (st->l3.debug & L3_DEB_STATE) { | 883 | if (st->l3.debug & L3_DEB_STATE) { |
| 897 | sprintf(tmp, "down1tr6 state %d prim %d", | 884 | l3_debug(st, "down1tr6 state %d prim %d", |
| 898 | proc->state, pr); | 885 | proc->state, pr); |
| 899 | l3_debug(st, tmp); | ||
| 900 | } | 886 | } |
| 901 | downstl[i].rout(proc, pr, arg); | 887 | downstl[i].rout(proc, pr, arg); |
| 902 | } | 888 | } |
diff --git a/drivers/isdn/hisax/netjet.c b/drivers/isdn/hisax/netjet.c index b646eed379df..233e432e06f6 100644 --- a/drivers/isdn/hisax/netjet.c +++ b/drivers/isdn/hisax/netjet.c | |||
| @@ -176,7 +176,7 @@ static void printframe(struct IsdnCardState *cs, u_char *buf, int count, char *s | |||
| 176 | else | 176 | else |
| 177 | j = i; | 177 | j = i; |
| 178 | QuickHex(t, p, j); | 178 | QuickHex(t, p, j); |
| 179 | debugl1(cs, tmp); | 179 | debugl1(cs, "%s", tmp); |
| 180 | p += j; | 180 | p += j; |
| 181 | i -= j; | 181 | i -= j; |
| 182 | t = tmp; | 182 | t = tmp; |
diff --git a/drivers/isdn/hisax/q931.c b/drivers/isdn/hisax/q931.c index 041bf52d9d0a..af1b020a81f1 100644 --- a/drivers/isdn/hisax/q931.c +++ b/drivers/isdn/hisax/q931.c | |||
| @@ -1179,7 +1179,7 @@ LogFrame(struct IsdnCardState *cs, u_char *buf, int size) | |||
| 1179 | dp--; | 1179 | dp--; |
| 1180 | *dp++ = '\n'; | 1180 | *dp++ = '\n'; |
| 1181 | *dp = 0; | 1181 | *dp = 0; |
| 1182 | HiSax_putstatus(cs, NULL, cs->dlog); | 1182 | HiSax_putstatus(cs, NULL, "%s", cs->dlog); |
| 1183 | } else | 1183 | } else |
| 1184 | HiSax_putstatus(cs, "LogFrame: ", "warning Frame too big (%d)", size); | 1184 | HiSax_putstatus(cs, "LogFrame: ", "warning Frame too big (%d)", size); |
| 1185 | } | 1185 | } |
| @@ -1246,7 +1246,7 @@ dlogframe(struct IsdnCardState *cs, struct sk_buff *skb, int dir) | |||
| 1246 | } | 1246 | } |
| 1247 | if (finish) { | 1247 | if (finish) { |
| 1248 | *dp = 0; | 1248 | *dp = 0; |
| 1249 | HiSax_putstatus(cs, NULL, cs->dlog); | 1249 | HiSax_putstatus(cs, NULL, "%s", cs->dlog); |
| 1250 | return; | 1250 | return; |
| 1251 | } | 1251 | } |
| 1252 | if ((0xfe & buf[0]) == PROTO_DIS_N0) { /* 1TR6 */ | 1252 | if ((0xfe & buf[0]) == PROTO_DIS_N0) { /* 1TR6 */ |
| @@ -1509,5 +1509,5 @@ dlogframe(struct IsdnCardState *cs, struct sk_buff *skb, int dir) | |||
| 1509 | dp += sprintf(dp, "Unknown protocol %x!", buf[0]); | 1509 | dp += sprintf(dp, "Unknown protocol %x!", buf[0]); |
| 1510 | } | 1510 | } |
| 1511 | *dp = 0; | 1511 | *dp = 0; |
| 1512 | HiSax_putstatus(cs, NULL, cs->dlog); | 1512 | HiSax_putstatus(cs, NULL, "%s", cs->dlog); |
| 1513 | } | 1513 | } |
diff --git a/drivers/isdn/hisax/w6692.c b/drivers/isdn/hisax/w6692.c index d8cac6935818..a85895585d90 100644 --- a/drivers/isdn/hisax/w6692.c +++ b/drivers/isdn/hisax/w6692.c | |||
| @@ -154,7 +154,7 @@ W6692_empty_fifo(struct IsdnCardState *cs, int count) | |||
| 154 | 154 | ||
| 155 | t += sprintf(t, "W6692_empty_fifo cnt %d", count); | 155 | t += sprintf(t, "W6692_empty_fifo cnt %d", count); |
| 156 | QuickHex(t, ptr, count); | 156 | QuickHex(t, ptr, count); |
| 157 | debugl1(cs, cs->dlog); | 157 | debugl1(cs, "%s", cs->dlog); |
| 158 | } | 158 | } |
| 159 | } | 159 | } |
| 160 | 160 | ||
| @@ -196,7 +196,7 @@ W6692_fill_fifo(struct IsdnCardState *cs) | |||
| 196 | 196 | ||
| 197 | t += sprintf(t, "W6692_fill_fifo cnt %d", count); | 197 | t += sprintf(t, "W6692_fill_fifo cnt %d", count); |
| 198 | QuickHex(t, ptr, count); | 198 | QuickHex(t, ptr, count); |
| 199 | debugl1(cs, cs->dlog); | 199 | debugl1(cs, "%s", cs->dlog); |
| 200 | } | 200 | } |
| 201 | } | 201 | } |
| 202 | 202 | ||
| @@ -226,7 +226,7 @@ W6692B_empty_fifo(struct BCState *bcs, int count) | |||
| 226 | t += sprintf(t, "W6692B_empty_fifo %c cnt %d", | 226 | t += sprintf(t, "W6692B_empty_fifo %c cnt %d", |
| 227 | bcs->channel + '1', count); | 227 | bcs->channel + '1', count); |
| 228 | QuickHex(t, ptr, count); | 228 | QuickHex(t, ptr, count); |
| 229 | debugl1(cs, bcs->blog); | 229 | debugl1(cs, "%s", bcs->blog); |
| 230 | } | 230 | } |
| 231 | } | 231 | } |
| 232 | 232 | ||
| @@ -264,7 +264,7 @@ W6692B_fill_fifo(struct BCState *bcs) | |||
| 264 | t += sprintf(t, "W6692B_fill_fifo %c cnt %d", | 264 | t += sprintf(t, "W6692B_fill_fifo %c cnt %d", |
| 265 | bcs->channel + '1', count); | 265 | bcs->channel + '1', count); |
| 266 | QuickHex(t, ptr, count); | 266 | QuickHex(t, ptr, count); |
| 267 | debugl1(cs, bcs->blog); | 267 | debugl1(cs, "%s", bcs->blog); |
| 268 | } | 268 | } |
| 269 | } | 269 | } |
| 270 | 270 | ||
diff --git a/drivers/mailbox/mailbox-omap2.c b/drivers/mailbox/mailbox-omap2.c index eba380d7b17f..42d2b893ea67 100644 --- a/drivers/mailbox/mailbox-omap2.c +++ b/drivers/mailbox/mailbox-omap2.c | |||
| @@ -325,7 +325,6 @@ static int omap2_mbox_remove(struct platform_device *pdev) | |||
| 325 | kfree(privblk); | 325 | kfree(privblk); |
| 326 | kfree(mboxblk); | 326 | kfree(mboxblk); |
| 327 | kfree(list); | 327 | kfree(list); |
| 328 | platform_set_drvdata(pdev, NULL); | ||
| 329 | 328 | ||
| 330 | return 0; | 329 | return 0; |
| 331 | } | 330 | } |
diff --git a/drivers/md/bcache/bcache.h b/drivers/md/bcache/bcache.h index b39f6f0b45f2..0f12382aa35d 100644 --- a/drivers/md/bcache/bcache.h +++ b/drivers/md/bcache/bcache.h | |||
| @@ -498,7 +498,7 @@ struct cached_dev { | |||
| 498 | */ | 498 | */ |
| 499 | atomic_t has_dirty; | 499 | atomic_t has_dirty; |
| 500 | 500 | ||
| 501 | struct ratelimit writeback_rate; | 501 | struct bch_ratelimit writeback_rate; |
| 502 | struct delayed_work writeback_rate_update; | 502 | struct delayed_work writeback_rate_update; |
| 503 | 503 | ||
| 504 | /* | 504 | /* |
| @@ -507,10 +507,9 @@ struct cached_dev { | |||
| 507 | */ | 507 | */ |
| 508 | sector_t last_read; | 508 | sector_t last_read; |
| 509 | 509 | ||
| 510 | /* Number of writeback bios in flight */ | 510 | /* Limit number of writeback bios in flight */ |
| 511 | atomic_t in_flight; | 511 | struct semaphore in_flight; |
| 512 | struct closure_with_timer writeback; | 512 | struct closure_with_timer writeback; |
| 513 | struct closure_waitlist writeback_wait; | ||
| 514 | 513 | ||
| 515 | struct keybuf writeback_keys; | 514 | struct keybuf writeback_keys; |
| 516 | 515 | ||
diff --git a/drivers/md/bcache/bset.c b/drivers/md/bcache/bset.c index 8010eed06a51..22d1ae72c282 100644 --- a/drivers/md/bcache/bset.c +++ b/drivers/md/bcache/bset.c | |||
| @@ -926,28 +926,45 @@ struct bkey *bch_next_recurse_key(struct btree *b, struct bkey *search) | |||
| 926 | 926 | ||
| 927 | /* Mergesort */ | 927 | /* Mergesort */ |
| 928 | 928 | ||
| 929 | static void sort_key_next(struct btree_iter *iter, | ||
| 930 | struct btree_iter_set *i) | ||
| 931 | { | ||
| 932 | i->k = bkey_next(i->k); | ||
| 933 | |||
| 934 | if (i->k == i->end) | ||
| 935 | *i = iter->data[--iter->used]; | ||
| 936 | } | ||
| 937 | |||
| 929 | static void btree_sort_fixup(struct btree_iter *iter) | 938 | static void btree_sort_fixup(struct btree_iter *iter) |
| 930 | { | 939 | { |
| 931 | while (iter->used > 1) { | 940 | while (iter->used > 1) { |
| 932 | struct btree_iter_set *top = iter->data, *i = top + 1; | 941 | struct btree_iter_set *top = iter->data, *i = top + 1; |
| 933 | struct bkey *k; | ||
| 934 | 942 | ||
| 935 | if (iter->used > 2 && | 943 | if (iter->used > 2 && |
| 936 | btree_iter_cmp(i[0], i[1])) | 944 | btree_iter_cmp(i[0], i[1])) |
| 937 | i++; | 945 | i++; |
| 938 | 946 | ||
| 939 | for (k = i->k; | 947 | if (bkey_cmp(top->k, &START_KEY(i->k)) <= 0) |
| 940 | k != i->end && bkey_cmp(top->k, &START_KEY(k)) > 0; | ||
| 941 | k = bkey_next(k)) | ||
| 942 | if (top->k > i->k) | ||
| 943 | __bch_cut_front(top->k, k); | ||
| 944 | else if (KEY_SIZE(k)) | ||
| 945 | bch_cut_back(&START_KEY(k), top->k); | ||
| 946 | |||
| 947 | if (top->k < i->k || k == i->k) | ||
| 948 | break; | 948 | break; |
| 949 | 949 | ||
| 950 | heap_sift(iter, i - top, btree_iter_cmp); | 950 | if (!KEY_SIZE(i->k)) { |
| 951 | sort_key_next(iter, i); | ||
| 952 | heap_sift(iter, i - top, btree_iter_cmp); | ||
| 953 | continue; | ||
| 954 | } | ||
| 955 | |||
| 956 | if (top->k > i->k) { | ||
| 957 | if (bkey_cmp(top->k, i->k) >= 0) | ||
| 958 | sort_key_next(iter, i); | ||
| 959 | else | ||
| 960 | bch_cut_front(top->k, i->k); | ||
| 961 | |||
| 962 | heap_sift(iter, i - top, btree_iter_cmp); | ||
| 963 | } else { | ||
| 964 | /* can't happen because of comparison func */ | ||
| 965 | BUG_ON(!bkey_cmp(&START_KEY(top->k), &START_KEY(i->k))); | ||
| 966 | bch_cut_back(&START_KEY(i->k), top->k); | ||
| 967 | } | ||
| 951 | } | 968 | } |
| 952 | } | 969 | } |
| 953 | 970 | ||
diff --git a/drivers/md/bcache/btree.c b/drivers/md/bcache/btree.c index f9764e61978b..f42fc7ed9cd6 100644 --- a/drivers/md/bcache/btree.c +++ b/drivers/md/bcache/btree.c | |||
| @@ -255,7 +255,7 @@ void bch_btree_node_read(struct btree *b) | |||
| 255 | 255 | ||
| 256 | return; | 256 | return; |
| 257 | err: | 257 | err: |
| 258 | bch_cache_set_error(b->c, "io error reading bucket %lu", | 258 | bch_cache_set_error(b->c, "io error reading bucket %zu", |
| 259 | PTR_BUCKET_NR(b->c, &b->key, 0)); | 259 | PTR_BUCKET_NR(b->c, &b->key, 0)); |
| 260 | } | 260 | } |
| 261 | 261 | ||
| @@ -612,7 +612,7 @@ static unsigned long bch_mca_scan(struct shrinker *shrink, | |||
| 612 | return SHRINK_STOP; | 612 | return SHRINK_STOP; |
| 613 | 613 | ||
| 614 | /* Return -1 if we can't do anything right now */ | 614 | /* Return -1 if we can't do anything right now */ |
| 615 | if (sc->gfp_mask & __GFP_WAIT) | 615 | if (sc->gfp_mask & __GFP_IO) |
| 616 | mutex_lock(&c->bucket_lock); | 616 | mutex_lock(&c->bucket_lock); |
| 617 | else if (!mutex_trylock(&c->bucket_lock)) | 617 | else if (!mutex_trylock(&c->bucket_lock)) |
| 618 | return -1; | 618 | return -1; |
diff --git a/drivers/md/bcache/journal.c b/drivers/md/bcache/journal.c index ba95ab84b2be..8435f81e5d85 100644 --- a/drivers/md/bcache/journal.c +++ b/drivers/md/bcache/journal.c | |||
| @@ -153,7 +153,8 @@ int bch_journal_read(struct cache_set *c, struct list_head *list, | |||
| 153 | bitmap_zero(bitmap, SB_JOURNAL_BUCKETS); | 153 | bitmap_zero(bitmap, SB_JOURNAL_BUCKETS); |
| 154 | pr_debug("%u journal buckets", ca->sb.njournal_buckets); | 154 | pr_debug("%u journal buckets", ca->sb.njournal_buckets); |
| 155 | 155 | ||
| 156 | /* Read journal buckets ordered by golden ratio hash to quickly | 156 | /* |
| 157 | * Read journal buckets ordered by golden ratio hash to quickly | ||
| 157 | * find a sequence of buckets with valid journal entries | 158 | * find a sequence of buckets with valid journal entries |
| 158 | */ | 159 | */ |
| 159 | for (i = 0; i < ca->sb.njournal_buckets; i++) { | 160 | for (i = 0; i < ca->sb.njournal_buckets; i++) { |
| @@ -166,18 +167,20 @@ int bch_journal_read(struct cache_set *c, struct list_head *list, | |||
| 166 | goto bsearch; | 167 | goto bsearch; |
| 167 | } | 168 | } |
| 168 | 169 | ||
| 169 | /* If that fails, check all the buckets we haven't checked | 170 | /* |
| 171 | * If that fails, check all the buckets we haven't checked | ||
| 170 | * already | 172 | * already |
| 171 | */ | 173 | */ |
| 172 | pr_debug("falling back to linear search"); | 174 | pr_debug("falling back to linear search"); |
| 173 | 175 | ||
| 174 | for (l = 0; l < ca->sb.njournal_buckets; l++) { | 176 | for (l = find_first_zero_bit(bitmap, ca->sb.njournal_buckets); |
| 175 | if (test_bit(l, bitmap)) | 177 | l < ca->sb.njournal_buckets; |
| 176 | continue; | 178 | l = find_next_zero_bit(bitmap, ca->sb.njournal_buckets, l + 1)) |
| 177 | |||
| 178 | if (read_bucket(l)) | 179 | if (read_bucket(l)) |
| 179 | goto bsearch; | 180 | goto bsearch; |
| 180 | } | 181 | |
| 182 | if (list_empty(list)) | ||
| 183 | continue; | ||
| 181 | bsearch: | 184 | bsearch: |
| 182 | /* Binary search */ | 185 | /* Binary search */ |
| 183 | m = r = find_next_bit(bitmap, ca->sb.njournal_buckets, l + 1); | 186 | m = r = find_next_bit(bitmap, ca->sb.njournal_buckets, l + 1); |
| @@ -197,10 +200,12 @@ bsearch: | |||
| 197 | r = m; | 200 | r = m; |
| 198 | } | 201 | } |
| 199 | 202 | ||
| 200 | /* Read buckets in reverse order until we stop finding more | 203 | /* |
| 204 | * Read buckets in reverse order until we stop finding more | ||
| 201 | * journal entries | 205 | * journal entries |
| 202 | */ | 206 | */ |
| 203 | pr_debug("finishing up"); | 207 | pr_debug("finishing up: m %u njournal_buckets %u", |
| 208 | m, ca->sb.njournal_buckets); | ||
| 204 | l = m; | 209 | l = m; |
| 205 | 210 | ||
| 206 | while (1) { | 211 | while (1) { |
| @@ -228,9 +233,10 @@ bsearch: | |||
| 228 | } | 233 | } |
| 229 | } | 234 | } |
| 230 | 235 | ||
| 231 | c->journal.seq = list_entry(list->prev, | 236 | if (!list_empty(list)) |
| 232 | struct journal_replay, | 237 | c->journal.seq = list_entry(list->prev, |
| 233 | list)->j.seq; | 238 | struct journal_replay, |
| 239 | list)->j.seq; | ||
| 234 | 240 | ||
| 235 | return 0; | 241 | return 0; |
| 236 | #undef read_bucket | 242 | #undef read_bucket |
| @@ -428,7 +434,7 @@ static void do_journal_discard(struct cache *ca) | |||
| 428 | return; | 434 | return; |
| 429 | } | 435 | } |
| 430 | 436 | ||
| 431 | switch (atomic_read(&ja->discard_in_flight) == DISCARD_IN_FLIGHT) { | 437 | switch (atomic_read(&ja->discard_in_flight)) { |
| 432 | case DISCARD_IN_FLIGHT: | 438 | case DISCARD_IN_FLIGHT: |
| 433 | return; | 439 | return; |
| 434 | 440 | ||
| @@ -689,6 +695,7 @@ void bch_journal_meta(struct cache_set *c, struct closure *cl) | |||
| 689 | if (cl) | 695 | if (cl) |
| 690 | BUG_ON(!closure_wait(&w->wait, cl)); | 696 | BUG_ON(!closure_wait(&w->wait, cl)); |
| 691 | 697 | ||
| 698 | closure_flush(&c->journal.io); | ||
| 692 | __journal_try_write(c, true); | 699 | __journal_try_write(c, true); |
| 693 | } | 700 | } |
| 694 | } | 701 | } |
diff --git a/drivers/md/bcache/request.c b/drivers/md/bcache/request.c index 786a1a4f74d8..71eb233b9ace 100644 --- a/drivers/md/bcache/request.c +++ b/drivers/md/bcache/request.c | |||
| @@ -997,14 +997,17 @@ static void request_write(struct cached_dev *dc, struct search *s) | |||
| 997 | } else { | 997 | } else { |
| 998 | bch_writeback_add(dc); | 998 | bch_writeback_add(dc); |
| 999 | 999 | ||
| 1000 | if (s->op.flush_journal) { | 1000 | if (bio->bi_rw & REQ_FLUSH) { |
| 1001 | /* Also need to send a flush to the backing device */ | 1001 | /* Also need to send a flush to the backing device */ |
| 1002 | s->op.cache_bio = bio_clone_bioset(bio, GFP_NOIO, | 1002 | struct bio *flush = bio_alloc_bioset(0, GFP_NOIO, |
| 1003 | dc->disk.bio_split); | 1003 | dc->disk.bio_split); |
| 1004 | 1004 | ||
| 1005 | bio->bi_size = 0; | 1005 | flush->bi_rw = WRITE_FLUSH; |
| 1006 | bio->bi_vcnt = 0; | 1006 | flush->bi_bdev = bio->bi_bdev; |
| 1007 | closure_bio_submit(bio, cl, s->d); | 1007 | flush->bi_end_io = request_endio; |
| 1008 | flush->bi_private = cl; | ||
| 1009 | |||
| 1010 | closure_bio_submit(flush, cl, s->d); | ||
| 1008 | } else { | 1011 | } else { |
| 1009 | s->op.cache_bio = bio; | 1012 | s->op.cache_bio = bio; |
| 1010 | } | 1013 | } |
diff --git a/drivers/md/bcache/sysfs.c b/drivers/md/bcache/sysfs.c index 4fe6ab2fbe2e..924dcfdae111 100644 --- a/drivers/md/bcache/sysfs.c +++ b/drivers/md/bcache/sysfs.c | |||
| @@ -223,8 +223,13 @@ STORE(__cached_dev) | |||
| 223 | } | 223 | } |
| 224 | 224 | ||
| 225 | if (attr == &sysfs_label) { | 225 | if (attr == &sysfs_label) { |
| 226 | /* note: endlines are preserved */ | 226 | if (size > SB_LABEL_SIZE) |
| 227 | memcpy(dc->sb.label, buf, SB_LABEL_SIZE); | 227 | return -EINVAL; |
| 228 | memcpy(dc->sb.label, buf, size); | ||
| 229 | if (size < SB_LABEL_SIZE) | ||
| 230 | dc->sb.label[size] = '\0'; | ||
| 231 | if (size && dc->sb.label[size - 1] == '\n') | ||
| 232 | dc->sb.label[size - 1] = '\0'; | ||
| 228 | bch_write_bdev_super(dc, NULL); | 233 | bch_write_bdev_super(dc, NULL); |
| 229 | if (dc->disk.c) { | 234 | if (dc->disk.c) { |
| 230 | memcpy(dc->disk.c->uuids[dc->disk.id].label, | 235 | memcpy(dc->disk.c->uuids[dc->disk.id].label, |
diff --git a/drivers/md/bcache/util.c b/drivers/md/bcache/util.c index 98eb81159a22..420dad545c7d 100644 --- a/drivers/md/bcache/util.c +++ b/drivers/md/bcache/util.c | |||
| @@ -190,7 +190,16 @@ void bch_time_stats_update(struct time_stats *stats, uint64_t start_time) | |||
| 190 | stats->last = now ?: 1; | 190 | stats->last = now ?: 1; |
| 191 | } | 191 | } |
| 192 | 192 | ||
| 193 | unsigned bch_next_delay(struct ratelimit *d, uint64_t done) | 193 | /** |
| 194 | * bch_next_delay() - increment @d by the amount of work done, and return how | ||
| 195 | * long to delay until the next time to do some work. | ||
| 196 | * | ||
| 197 | * @d - the struct bch_ratelimit to update | ||
| 198 | * @done - the amount of work done, in arbitrary units | ||
| 199 | * | ||
| 200 | * Returns the amount of time to delay by, in jiffies | ||
| 201 | */ | ||
| 202 | uint64_t bch_next_delay(struct bch_ratelimit *d, uint64_t done) | ||
| 194 | { | 203 | { |
| 195 | uint64_t now = local_clock(); | 204 | uint64_t now = local_clock(); |
| 196 | 205 | ||
diff --git a/drivers/md/bcache/util.h b/drivers/md/bcache/util.h index 1ae2a73ad85f..ea345c6896f4 100644 --- a/drivers/md/bcache/util.h +++ b/drivers/md/bcache/util.h | |||
| @@ -450,17 +450,23 @@ read_attribute(name ## _last_ ## frequency_units) | |||
| 450 | (ewma) >> factor; \ | 450 | (ewma) >> factor; \ |
| 451 | }) | 451 | }) |
| 452 | 452 | ||
| 453 | struct ratelimit { | 453 | struct bch_ratelimit { |
| 454 | /* Next time we want to do some work, in nanoseconds */ | ||
| 454 | uint64_t next; | 455 | uint64_t next; |
| 456 | |||
| 457 | /* | ||
| 458 | * Rate at which we want to do work, in units per nanosecond | ||
| 459 | * The units here correspond to the units passed to bch_next_delay() | ||
| 460 | */ | ||
| 455 | unsigned rate; | 461 | unsigned rate; |
| 456 | }; | 462 | }; |
| 457 | 463 | ||
| 458 | static inline void ratelimit_reset(struct ratelimit *d) | 464 | static inline void bch_ratelimit_reset(struct bch_ratelimit *d) |
| 459 | { | 465 | { |
| 460 | d->next = local_clock(); | 466 | d->next = local_clock(); |
| 461 | } | 467 | } |
| 462 | 468 | ||
| 463 | unsigned bch_next_delay(struct ratelimit *d, uint64_t done); | 469 | uint64_t bch_next_delay(struct bch_ratelimit *d, uint64_t done); |
| 464 | 470 | ||
| 465 | #define __DIV_SAFE(n, d, zero) \ | 471 | #define __DIV_SAFE(n, d, zero) \ |
| 466 | ({ \ | 472 | ({ \ |
diff --git a/drivers/md/bcache/writeback.c b/drivers/md/bcache/writeback.c index 22cbff551628..ba3ee48320f2 100644 --- a/drivers/md/bcache/writeback.c +++ b/drivers/md/bcache/writeback.c | |||
| @@ -94,11 +94,15 @@ static void update_writeback_rate(struct work_struct *work) | |||
| 94 | 94 | ||
| 95 | static unsigned writeback_delay(struct cached_dev *dc, unsigned sectors) | 95 | static unsigned writeback_delay(struct cached_dev *dc, unsigned sectors) |
| 96 | { | 96 | { |
| 97 | uint64_t ret; | ||
| 98 | |||
| 97 | if (atomic_read(&dc->disk.detaching) || | 99 | if (atomic_read(&dc->disk.detaching) || |
| 98 | !dc->writeback_percent) | 100 | !dc->writeback_percent) |
| 99 | return 0; | 101 | return 0; |
| 100 | 102 | ||
| 101 | return bch_next_delay(&dc->writeback_rate, sectors * 10000000ULL); | 103 | ret = bch_next_delay(&dc->writeback_rate, sectors * 10000000ULL); |
| 104 | |||
| 105 | return min_t(uint64_t, ret, HZ); | ||
| 102 | } | 106 | } |
| 103 | 107 | ||
| 104 | /* Background writeback */ | 108 | /* Background writeback */ |
| @@ -208,7 +212,7 @@ normal_refill: | |||
| 208 | 212 | ||
| 209 | up_write(&dc->writeback_lock); | 213 | up_write(&dc->writeback_lock); |
| 210 | 214 | ||
| 211 | ratelimit_reset(&dc->writeback_rate); | 215 | bch_ratelimit_reset(&dc->writeback_rate); |
| 212 | 216 | ||
| 213 | /* Punt to workqueue only so we don't recurse and blow the stack */ | 217 | /* Punt to workqueue only so we don't recurse and blow the stack */ |
| 214 | continue_at(cl, read_dirty, dirty_wq); | 218 | continue_at(cl, read_dirty, dirty_wq); |
| @@ -318,9 +322,7 @@ static void write_dirty_finish(struct closure *cl) | |||
| 318 | } | 322 | } |
| 319 | 323 | ||
| 320 | bch_keybuf_del(&dc->writeback_keys, w); | 324 | bch_keybuf_del(&dc->writeback_keys, w); |
| 321 | atomic_dec_bug(&dc->in_flight); | 325 | up(&dc->in_flight); |
| 322 | |||
| 323 | closure_wake_up(&dc->writeback_wait); | ||
| 324 | 326 | ||
| 325 | closure_return_with_destructor(cl, dirty_io_destructor); | 327 | closure_return_with_destructor(cl, dirty_io_destructor); |
| 326 | } | 328 | } |
| @@ -349,7 +351,7 @@ static void write_dirty(struct closure *cl) | |||
| 349 | 351 | ||
| 350 | closure_bio_submit(&io->bio, cl, &io->dc->disk); | 352 | closure_bio_submit(&io->bio, cl, &io->dc->disk); |
| 351 | 353 | ||
| 352 | continue_at(cl, write_dirty_finish, dirty_wq); | 354 | continue_at(cl, write_dirty_finish, system_wq); |
| 353 | } | 355 | } |
| 354 | 356 | ||
| 355 | static void read_dirty_endio(struct bio *bio, int error) | 357 | static void read_dirty_endio(struct bio *bio, int error) |
| @@ -369,7 +371,7 @@ static void read_dirty_submit(struct closure *cl) | |||
| 369 | 371 | ||
| 370 | closure_bio_submit(&io->bio, cl, &io->dc->disk); | 372 | closure_bio_submit(&io->bio, cl, &io->dc->disk); |
| 371 | 373 | ||
| 372 | continue_at(cl, write_dirty, dirty_wq); | 374 | continue_at(cl, write_dirty, system_wq); |
| 373 | } | 375 | } |
| 374 | 376 | ||
| 375 | static void read_dirty(struct closure *cl) | 377 | static void read_dirty(struct closure *cl) |
| @@ -394,12 +396,8 @@ static void read_dirty(struct closure *cl) | |||
| 394 | 396 | ||
| 395 | if (delay > 0 && | 397 | if (delay > 0 && |
| 396 | (KEY_START(&w->key) != dc->last_read || | 398 | (KEY_START(&w->key) != dc->last_read || |
| 397 | jiffies_to_msecs(delay) > 50)) { | 399 | jiffies_to_msecs(delay) > 50)) |
| 398 | w->private = NULL; | 400 | delay = schedule_timeout_uninterruptible(delay); |
| 399 | |||
| 400 | closure_delay(&dc->writeback, delay); | ||
| 401 | continue_at(cl, read_dirty, dirty_wq); | ||
| 402 | } | ||
| 403 | 401 | ||
| 404 | dc->last_read = KEY_OFFSET(&w->key); | 402 | dc->last_read = KEY_OFFSET(&w->key); |
| 405 | 403 | ||
| @@ -424,15 +422,10 @@ static void read_dirty(struct closure *cl) | |||
| 424 | 422 | ||
| 425 | trace_bcache_writeback(&w->key); | 423 | trace_bcache_writeback(&w->key); |
| 426 | 424 | ||
| 427 | closure_call(&io->cl, read_dirty_submit, NULL, &dc->disk.cl); | 425 | down(&dc->in_flight); |
| 426 | closure_call(&io->cl, read_dirty_submit, NULL, cl); | ||
| 428 | 427 | ||
| 429 | delay = writeback_delay(dc, KEY_SIZE(&w->key)); | 428 | delay = writeback_delay(dc, KEY_SIZE(&w->key)); |
| 430 | |||
| 431 | atomic_inc(&dc->in_flight); | ||
| 432 | |||
| 433 | if (!closure_wait_event(&dc->writeback_wait, cl, | ||
| 434 | atomic_read(&dc->in_flight) < 64)) | ||
| 435 | continue_at(cl, read_dirty, dirty_wq); | ||
| 436 | } | 429 | } |
| 437 | 430 | ||
| 438 | if (0) { | 431 | if (0) { |
| @@ -442,7 +435,11 @@ err: | |||
| 442 | bch_keybuf_del(&dc->writeback_keys, w); | 435 | bch_keybuf_del(&dc->writeback_keys, w); |
| 443 | } | 436 | } |
| 444 | 437 | ||
| 445 | refill_dirty(cl); | 438 | /* |
| 439 | * Wait for outstanding writeback IOs to finish (and keybuf slots to be | ||
| 440 | * freed) before refilling again | ||
| 441 | */ | ||
| 442 | continue_at(cl, refill_dirty, dirty_wq); | ||
| 446 | } | 443 | } |
| 447 | 444 | ||
| 448 | /* Init */ | 445 | /* Init */ |
| @@ -484,6 +481,7 @@ void bch_sectors_dirty_init(struct cached_dev *dc) | |||
| 484 | 481 | ||
| 485 | void bch_cached_dev_writeback_init(struct cached_dev *dc) | 482 | void bch_cached_dev_writeback_init(struct cached_dev *dc) |
| 486 | { | 483 | { |
| 484 | sema_init(&dc->in_flight, 64); | ||
| 487 | closure_init_unlocked(&dc->writeback); | 485 | closure_init_unlocked(&dc->writeback); |
| 488 | init_rwsem(&dc->writeback_lock); | 486 | init_rwsem(&dc->writeback_lock); |
| 489 | 487 | ||
| @@ -513,7 +511,7 @@ void bch_writeback_exit(void) | |||
| 513 | 511 | ||
| 514 | int __init bch_writeback_init(void) | 512 | int __init bch_writeback_init(void) |
| 515 | { | 513 | { |
| 516 | dirty_wq = create_singlethread_workqueue("bcache_writeback"); | 514 | dirty_wq = create_workqueue("bcache_writeback"); |
| 517 | if (!dirty_wq) | 515 | if (!dirty_wq) |
| 518 | return -ENOMEM; | 516 | return -ENOMEM; |
| 519 | 517 | ||
diff --git a/drivers/md/dm-io.c b/drivers/md/dm-io.c index ea49834377c8..2a20986a2fec 100644 --- a/drivers/md/dm-io.c +++ b/drivers/md/dm-io.c | |||
| @@ -19,8 +19,6 @@ | |||
| 19 | #define DM_MSG_PREFIX "io" | 19 | #define DM_MSG_PREFIX "io" |
| 20 | 20 | ||
| 21 | #define DM_IO_MAX_REGIONS BITS_PER_LONG | 21 | #define DM_IO_MAX_REGIONS BITS_PER_LONG |
| 22 | #define MIN_IOS 16 | ||
| 23 | #define MIN_BIOS 16 | ||
| 24 | 22 | ||
| 25 | struct dm_io_client { | 23 | struct dm_io_client { |
| 26 | mempool_t *pool; | 24 | mempool_t *pool; |
| @@ -50,16 +48,17 @@ static struct kmem_cache *_dm_io_cache; | |||
| 50 | struct dm_io_client *dm_io_client_create(void) | 48 | struct dm_io_client *dm_io_client_create(void) |
| 51 | { | 49 | { |
| 52 | struct dm_io_client *client; | 50 | struct dm_io_client *client; |
| 51 | unsigned min_ios = dm_get_reserved_bio_based_ios(); | ||
| 53 | 52 | ||
| 54 | client = kmalloc(sizeof(*client), GFP_KERNEL); | 53 | client = kmalloc(sizeof(*client), GFP_KERNEL); |
| 55 | if (!client) | 54 | if (!client) |
| 56 | return ERR_PTR(-ENOMEM); | 55 | return ERR_PTR(-ENOMEM); |
| 57 | 56 | ||
| 58 | client->pool = mempool_create_slab_pool(MIN_IOS, _dm_io_cache); | 57 | client->pool = mempool_create_slab_pool(min_ios, _dm_io_cache); |
| 59 | if (!client->pool) | 58 | if (!client->pool) |
| 60 | goto bad; | 59 | goto bad; |
| 61 | 60 | ||
| 62 | client->bios = bioset_create(MIN_BIOS, 0); | 61 | client->bios = bioset_create(min_ios, 0); |
| 63 | if (!client->bios) | 62 | if (!client->bios) |
| 64 | goto bad; | 63 | goto bad; |
| 65 | 64 | ||
diff --git a/drivers/md/dm-mpath.c b/drivers/md/dm-mpath.c index b759a127f9c3..de570a558764 100644 --- a/drivers/md/dm-mpath.c +++ b/drivers/md/dm-mpath.c | |||
| @@ -7,6 +7,7 @@ | |||
| 7 | 7 | ||
| 8 | #include <linux/device-mapper.h> | 8 | #include <linux/device-mapper.h> |
| 9 | 9 | ||
| 10 | #include "dm.h" | ||
| 10 | #include "dm-path-selector.h" | 11 | #include "dm-path-selector.h" |
| 11 | #include "dm-uevent.h" | 12 | #include "dm-uevent.h" |
| 12 | 13 | ||
| @@ -116,8 +117,6 @@ struct dm_mpath_io { | |||
| 116 | 117 | ||
| 117 | typedef int (*action_fn) (struct pgpath *pgpath); | 118 | typedef int (*action_fn) (struct pgpath *pgpath); |
| 118 | 119 | ||
| 119 | #define MIN_IOS 256 /* Mempool size */ | ||
| 120 | |||
| 121 | static struct kmem_cache *_mpio_cache; | 120 | static struct kmem_cache *_mpio_cache; |
| 122 | 121 | ||
| 123 | static struct workqueue_struct *kmultipathd, *kmpath_handlerd; | 122 | static struct workqueue_struct *kmultipathd, *kmpath_handlerd; |
| @@ -190,6 +189,7 @@ static void free_priority_group(struct priority_group *pg, | |||
| 190 | static struct multipath *alloc_multipath(struct dm_target *ti) | 189 | static struct multipath *alloc_multipath(struct dm_target *ti) |
| 191 | { | 190 | { |
| 192 | struct multipath *m; | 191 | struct multipath *m; |
| 192 | unsigned min_ios = dm_get_reserved_rq_based_ios(); | ||
| 193 | 193 | ||
| 194 | m = kzalloc(sizeof(*m), GFP_KERNEL); | 194 | m = kzalloc(sizeof(*m), GFP_KERNEL); |
| 195 | if (m) { | 195 | if (m) { |
| @@ -202,7 +202,7 @@ static struct multipath *alloc_multipath(struct dm_target *ti) | |||
| 202 | INIT_WORK(&m->trigger_event, trigger_event); | 202 | INIT_WORK(&m->trigger_event, trigger_event); |
| 203 | init_waitqueue_head(&m->pg_init_wait); | 203 | init_waitqueue_head(&m->pg_init_wait); |
| 204 | mutex_init(&m->work_mutex); | 204 | mutex_init(&m->work_mutex); |
| 205 | m->mpio_pool = mempool_create_slab_pool(MIN_IOS, _mpio_cache); | 205 | m->mpio_pool = mempool_create_slab_pool(min_ios, _mpio_cache); |
| 206 | if (!m->mpio_pool) { | 206 | if (!m->mpio_pool) { |
| 207 | kfree(m); | 207 | kfree(m); |
| 208 | return NULL; | 208 | return NULL; |
| @@ -1268,6 +1268,7 @@ static int noretry_error(int error) | |||
| 1268 | case -EREMOTEIO: | 1268 | case -EREMOTEIO: |
| 1269 | case -EILSEQ: | 1269 | case -EILSEQ: |
| 1270 | case -ENODATA: | 1270 | case -ENODATA: |
| 1271 | case -ENOSPC: | ||
| 1271 | return 1; | 1272 | return 1; |
| 1272 | } | 1273 | } |
| 1273 | 1274 | ||
| @@ -1298,8 +1299,17 @@ static int do_end_io(struct multipath *m, struct request *clone, | |||
| 1298 | if (!error && !clone->errors) | 1299 | if (!error && !clone->errors) |
| 1299 | return 0; /* I/O complete */ | 1300 | return 0; /* I/O complete */ |
| 1300 | 1301 | ||
| 1301 | if (noretry_error(error)) | 1302 | if (noretry_error(error)) { |
| 1303 | if ((clone->cmd_flags & REQ_WRITE_SAME) && | ||
| 1304 | !clone->q->limits.max_write_same_sectors) { | ||
| 1305 | struct queue_limits *limits; | ||
| 1306 | |||
| 1307 | /* device doesn't really support WRITE SAME, disable it */ | ||
| 1308 | limits = dm_get_queue_limits(dm_table_get_md(m->ti->table)); | ||
| 1309 | limits->max_write_same_sectors = 0; | ||
| 1310 | } | ||
| 1302 | return error; | 1311 | return error; |
| 1312 | } | ||
| 1303 | 1313 | ||
| 1304 | if (mpio->pgpath) | 1314 | if (mpio->pgpath) |
| 1305 | fail_path(mpio->pgpath); | 1315 | fail_path(mpio->pgpath); |
diff --git a/drivers/md/dm-snap-persistent.c b/drivers/md/dm-snap-persistent.c index 3ac415675b6c..4caa8e6d59d7 100644 --- a/drivers/md/dm-snap-persistent.c +++ b/drivers/md/dm-snap-persistent.c | |||
| @@ -256,7 +256,7 @@ static int chunk_io(struct pstore *ps, void *area, chunk_t chunk, int rw, | |||
| 256 | */ | 256 | */ |
| 257 | INIT_WORK_ONSTACK(&req.work, do_metadata); | 257 | INIT_WORK_ONSTACK(&req.work, do_metadata); |
| 258 | queue_work(ps->metadata_wq, &req.work); | 258 | queue_work(ps->metadata_wq, &req.work); |
| 259 | flush_work(&req.work); | 259 | flush_workqueue(ps->metadata_wq); |
| 260 | 260 | ||
| 261 | return req.result; | 261 | return req.result; |
| 262 | } | 262 | } |
diff --git a/drivers/md/dm-snap.c b/drivers/md/dm-snap.c index c434e5aab2df..aec57d76db5d 100644 --- a/drivers/md/dm-snap.c +++ b/drivers/md/dm-snap.c | |||
| @@ -725,17 +725,16 @@ static int calc_max_buckets(void) | |||
| 725 | */ | 725 | */ |
| 726 | static int init_hash_tables(struct dm_snapshot *s) | 726 | static int init_hash_tables(struct dm_snapshot *s) |
| 727 | { | 727 | { |
| 728 | sector_t hash_size, cow_dev_size, origin_dev_size, max_buckets; | 728 | sector_t hash_size, cow_dev_size, max_buckets; |
| 729 | 729 | ||
| 730 | /* | 730 | /* |
| 731 | * Calculate based on the size of the original volume or | 731 | * Calculate based on the size of the original volume or |
| 732 | * the COW volume... | 732 | * the COW volume... |
| 733 | */ | 733 | */ |
| 734 | cow_dev_size = get_dev_size(s->cow->bdev); | 734 | cow_dev_size = get_dev_size(s->cow->bdev); |
| 735 | origin_dev_size = get_dev_size(s->origin->bdev); | ||
| 736 | max_buckets = calc_max_buckets(); | 735 | max_buckets = calc_max_buckets(); |
| 737 | 736 | ||
| 738 | hash_size = min(origin_dev_size, cow_dev_size) >> s->store->chunk_shift; | 737 | hash_size = cow_dev_size >> s->store->chunk_shift; |
| 739 | hash_size = min(hash_size, max_buckets); | 738 | hash_size = min(hash_size, max_buckets); |
| 740 | 739 | ||
| 741 | if (hash_size < 64) | 740 | if (hash_size < 64) |
diff --git a/drivers/md/dm-stats.c b/drivers/md/dm-stats.c index 8ae31e8d3d64..3d404c1371ed 100644 --- a/drivers/md/dm-stats.c +++ b/drivers/md/dm-stats.c | |||
| @@ -451,19 +451,26 @@ static void dm_stat_for_entry(struct dm_stat *s, size_t entry, | |||
| 451 | struct dm_stat_percpu *p; | 451 | struct dm_stat_percpu *p; |
| 452 | 452 | ||
| 453 | /* | 453 | /* |
| 454 | * For strict correctness we should use local_irq_disable/enable | 454 | * For strict correctness we should use local_irq_save/restore |
| 455 | * instead of preempt_disable/enable. | 455 | * instead of preempt_disable/enable. |
| 456 | * | 456 | * |
| 457 | * This is racy if the driver finishes bios from non-interrupt | 457 | * preempt_disable/enable is racy if the driver finishes bios |
| 458 | * context as well as from interrupt context or from more different | 458 | * from non-interrupt context as well as from interrupt context |
| 459 | * interrupts. | 459 | * or from more different interrupts. |
| 460 | * | 460 | * |
| 461 | * However, the race only results in not counting some events, | 461 | * On 64-bit architectures the race only results in not counting some |
| 462 | * so it is acceptable. | 462 | * events, so it is acceptable. On 32-bit architectures the race could |
| 463 | * cause the counter going off by 2^32, so we need to do proper locking | ||
| 464 | * there. | ||
| 463 | * | 465 | * |
| 464 | * part_stat_lock()/part_stat_unlock() have this race too. | 466 | * part_stat_lock()/part_stat_unlock() have this race too. |
| 465 | */ | 467 | */ |
| 468 | #if BITS_PER_LONG == 32 | ||
| 469 | unsigned long flags; | ||
| 470 | local_irq_save(flags); | ||
| 471 | #else | ||
| 466 | preempt_disable(); | 472 | preempt_disable(); |
| 473 | #endif | ||
| 467 | p = &s->stat_percpu[smp_processor_id()][entry]; | 474 | p = &s->stat_percpu[smp_processor_id()][entry]; |
| 468 | 475 | ||
| 469 | if (!end) { | 476 | if (!end) { |
| @@ -478,7 +485,11 @@ static void dm_stat_for_entry(struct dm_stat *s, size_t entry, | |||
| 478 | p->ticks[idx] += duration; | 485 | p->ticks[idx] += duration; |
| 479 | } | 486 | } |
| 480 | 487 | ||
| 488 | #if BITS_PER_LONG == 32 | ||
| 489 | local_irq_restore(flags); | ||
| 490 | #else | ||
| 481 | preempt_enable(); | 491 | preempt_enable(); |
| 492 | #endif | ||
| 482 | } | 493 | } |
| 483 | 494 | ||
| 484 | static void __dm_stat_bio(struct dm_stat *s, unsigned long bi_rw, | 495 | static void __dm_stat_bio(struct dm_stat *s, unsigned long bi_rw, |
diff --git a/drivers/md/dm-thin.c b/drivers/md/dm-thin.c index ed063427d676..2c0cf511ec23 100644 --- a/drivers/md/dm-thin.c +++ b/drivers/md/dm-thin.c | |||
| @@ -2095,6 +2095,7 @@ static int pool_ctr(struct dm_target *ti, unsigned argc, char **argv) | |||
| 2095 | * them down to the data device. The thin device's discard | 2095 | * them down to the data device. The thin device's discard |
| 2096 | * processing will cause mappings to be removed from the btree. | 2096 | * processing will cause mappings to be removed from the btree. |
| 2097 | */ | 2097 | */ |
| 2098 | ti->discard_zeroes_data_unsupported = true; | ||
| 2098 | if (pf.discard_enabled && pf.discard_passdown) { | 2099 | if (pf.discard_enabled && pf.discard_passdown) { |
| 2099 | ti->num_discard_bios = 1; | 2100 | ti->num_discard_bios = 1; |
| 2100 | 2101 | ||
| @@ -2104,7 +2105,6 @@ static int pool_ctr(struct dm_target *ti, unsigned argc, char **argv) | |||
| 2104 | * thin devices' discard limits consistent). | 2105 | * thin devices' discard limits consistent). |
| 2105 | */ | 2106 | */ |
| 2106 | ti->discards_supported = true; | 2107 | ti->discards_supported = true; |
| 2107 | ti->discard_zeroes_data_unsupported = true; | ||
| 2108 | } | 2108 | } |
| 2109 | ti->private = pt; | 2109 | ti->private = pt; |
| 2110 | 2110 | ||
| @@ -2689,8 +2689,16 @@ static void pool_io_hints(struct dm_target *ti, struct queue_limits *limits) | |||
| 2689 | * They get transferred to the live pool in bind_control_target() | 2689 | * They get transferred to the live pool in bind_control_target() |
| 2690 | * called from pool_preresume(). | 2690 | * called from pool_preresume(). |
| 2691 | */ | 2691 | */ |
| 2692 | if (!pt->adjusted_pf.discard_enabled) | 2692 | if (!pt->adjusted_pf.discard_enabled) { |
| 2693 | /* | ||
| 2694 | * Must explicitly disallow stacking discard limits otherwise the | ||
| 2695 | * block layer will stack them if pool's data device has support. | ||
| 2696 | * QUEUE_FLAG_DISCARD wouldn't be set but there is no way for the | ||
| 2697 | * user to see that, so make sure to set all discard limits to 0. | ||
| 2698 | */ | ||
| 2699 | limits->discard_granularity = 0; | ||
| 2693 | return; | 2700 | return; |
| 2701 | } | ||
| 2694 | 2702 | ||
| 2695 | disable_passdown_if_not_supported(pt); | 2703 | disable_passdown_if_not_supported(pt); |
| 2696 | 2704 | ||
| @@ -2826,10 +2834,10 @@ static int thin_ctr(struct dm_target *ti, unsigned argc, char **argv) | |||
| 2826 | ti->per_bio_data_size = sizeof(struct dm_thin_endio_hook); | 2834 | ti->per_bio_data_size = sizeof(struct dm_thin_endio_hook); |
| 2827 | 2835 | ||
| 2828 | /* In case the pool supports discards, pass them on. */ | 2836 | /* In case the pool supports discards, pass them on. */ |
| 2837 | ti->discard_zeroes_data_unsupported = true; | ||
| 2829 | if (tc->pool->pf.discard_enabled) { | 2838 | if (tc->pool->pf.discard_enabled) { |
| 2830 | ti->discards_supported = true; | 2839 | ti->discards_supported = true; |
| 2831 | ti->num_discard_bios = 1; | 2840 | ti->num_discard_bios = 1; |
| 2832 | ti->discard_zeroes_data_unsupported = true; | ||
| 2833 | /* Discard bios must be split on a block boundary */ | 2841 | /* Discard bios must be split on a block boundary */ |
| 2834 | ti->split_discard_bios = true; | 2842 | ti->split_discard_bios = true; |
| 2835 | } | 2843 | } |
diff --git a/drivers/md/dm.c b/drivers/md/dm.c index 6a5e9ed2fcc3..b3e26c7d1417 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c | |||
| @@ -211,10 +211,55 @@ struct dm_md_mempools { | |||
| 211 | struct bio_set *bs; | 211 | struct bio_set *bs; |
| 212 | }; | 212 | }; |
| 213 | 213 | ||
| 214 | #define MIN_IOS 256 | 214 | #define RESERVED_BIO_BASED_IOS 16 |
| 215 | #define RESERVED_REQUEST_BASED_IOS 256 | ||
| 216 | #define RESERVED_MAX_IOS 1024 | ||
| 215 | static struct kmem_cache *_io_cache; | 217 | static struct kmem_cache *_io_cache; |
| 216 | static struct kmem_cache *_rq_tio_cache; | 218 | static struct kmem_cache *_rq_tio_cache; |
| 217 | 219 | ||
| 220 | /* | ||
| 221 | * Bio-based DM's mempools' reserved IOs set by the user. | ||
| 222 | */ | ||
| 223 | static unsigned reserved_bio_based_ios = RESERVED_BIO_BASED_IOS; | ||
| 224 | |||
| 225 | /* | ||
| 226 | * Request-based DM's mempools' reserved IOs set by the user. | ||
| 227 | */ | ||
| 228 | static unsigned reserved_rq_based_ios = RESERVED_REQUEST_BASED_IOS; | ||
| 229 | |||
| 230 | static unsigned __dm_get_reserved_ios(unsigned *reserved_ios, | ||
| 231 | unsigned def, unsigned max) | ||
| 232 | { | ||
| 233 | unsigned ios = ACCESS_ONCE(*reserved_ios); | ||
| 234 | unsigned modified_ios = 0; | ||
| 235 | |||
| 236 | if (!ios) | ||
| 237 | modified_ios = def; | ||
| 238 | else if (ios > max) | ||
| 239 | modified_ios = max; | ||
| 240 | |||
| 241 | if (modified_ios) { | ||
| 242 | (void)cmpxchg(reserved_ios, ios, modified_ios); | ||
| 243 | ios = modified_ios; | ||
| 244 | } | ||
| 245 | |||
| 246 | return ios; | ||
| 247 | } | ||
| 248 | |||
| 249 | unsigned dm_get_reserved_bio_based_ios(void) | ||
| 250 | { | ||
| 251 | return __dm_get_reserved_ios(&reserved_bio_based_ios, | ||
| 252 | RESERVED_BIO_BASED_IOS, RESERVED_MAX_IOS); | ||
| 253 | } | ||
| 254 | EXPORT_SYMBOL_GPL(dm_get_reserved_bio_based_ios); | ||
| 255 | |||
| 256 | unsigned dm_get_reserved_rq_based_ios(void) | ||
| 257 | { | ||
| 258 | return __dm_get_reserved_ios(&reserved_rq_based_ios, | ||
| 259 | RESERVED_REQUEST_BASED_IOS, RESERVED_MAX_IOS); | ||
| 260 | } | ||
| 261 | EXPORT_SYMBOL_GPL(dm_get_reserved_rq_based_ios); | ||
| 262 | |||
| 218 | static int __init local_init(void) | 263 | static int __init local_init(void) |
| 219 | { | 264 | { |
| 220 | int r = -ENOMEM; | 265 | int r = -ENOMEM; |
| @@ -2278,6 +2323,17 @@ struct target_type *dm_get_immutable_target_type(struct mapped_device *md) | |||
| 2278 | } | 2323 | } |
| 2279 | 2324 | ||
| 2280 | /* | 2325 | /* |
| 2326 | * The queue_limits are only valid as long as you have a reference | ||
| 2327 | * count on 'md'. | ||
| 2328 | */ | ||
| 2329 | struct queue_limits *dm_get_queue_limits(struct mapped_device *md) | ||
| 2330 | { | ||
| 2331 | BUG_ON(!atomic_read(&md->holders)); | ||
| 2332 | return &md->queue->limits; | ||
| 2333 | } | ||
| 2334 | EXPORT_SYMBOL_GPL(dm_get_queue_limits); | ||
| 2335 | |||
| 2336 | /* | ||
| 2281 | * Fully initialize a request-based queue (->elevator, ->request_fn, etc). | 2337 | * Fully initialize a request-based queue (->elevator, ->request_fn, etc). |
| 2282 | */ | 2338 | */ |
| 2283 | static int dm_init_request_based_queue(struct mapped_device *md) | 2339 | static int dm_init_request_based_queue(struct mapped_device *md) |
| @@ -2862,18 +2918,18 @@ struct dm_md_mempools *dm_alloc_md_mempools(unsigned type, unsigned integrity, u | |||
| 2862 | 2918 | ||
| 2863 | if (type == DM_TYPE_BIO_BASED) { | 2919 | if (type == DM_TYPE_BIO_BASED) { |
| 2864 | cachep = _io_cache; | 2920 | cachep = _io_cache; |
| 2865 | pool_size = 16; | 2921 | pool_size = dm_get_reserved_bio_based_ios(); |
| 2866 | front_pad = roundup(per_bio_data_size, __alignof__(struct dm_target_io)) + offsetof(struct dm_target_io, clone); | 2922 | front_pad = roundup(per_bio_data_size, __alignof__(struct dm_target_io)) + offsetof(struct dm_target_io, clone); |
| 2867 | } else if (type == DM_TYPE_REQUEST_BASED) { | 2923 | } else if (type == DM_TYPE_REQUEST_BASED) { |
| 2868 | cachep = _rq_tio_cache; | 2924 | cachep = _rq_tio_cache; |
| 2869 | pool_size = MIN_IOS; | 2925 | pool_size = dm_get_reserved_rq_based_ios(); |
| 2870 | front_pad = offsetof(struct dm_rq_clone_bio_info, clone); | 2926 | front_pad = offsetof(struct dm_rq_clone_bio_info, clone); |
| 2871 | /* per_bio_data_size is not used. See __bind_mempools(). */ | 2927 | /* per_bio_data_size is not used. See __bind_mempools(). */ |
| 2872 | WARN_ON(per_bio_data_size != 0); | 2928 | WARN_ON(per_bio_data_size != 0); |
| 2873 | } else | 2929 | } else |
| 2874 | goto out; | 2930 | goto out; |
| 2875 | 2931 | ||
| 2876 | pools->io_pool = mempool_create_slab_pool(MIN_IOS, cachep); | 2932 | pools->io_pool = mempool_create_slab_pool(pool_size, cachep); |
| 2877 | if (!pools->io_pool) | 2933 | if (!pools->io_pool) |
| 2878 | goto out; | 2934 | goto out; |
| 2879 | 2935 | ||
| @@ -2924,6 +2980,13 @@ module_exit(dm_exit); | |||
| 2924 | 2980 | ||
| 2925 | module_param(major, uint, 0); | 2981 | module_param(major, uint, 0); |
| 2926 | MODULE_PARM_DESC(major, "The major number of the device mapper"); | 2982 | MODULE_PARM_DESC(major, "The major number of the device mapper"); |
| 2983 | |||
| 2984 | module_param(reserved_bio_based_ios, uint, S_IRUGO | S_IWUSR); | ||
| 2985 | MODULE_PARM_DESC(reserved_bio_based_ios, "Reserved IOs in bio-based mempools"); | ||
| 2986 | |||
| 2987 | module_param(reserved_rq_based_ios, uint, S_IRUGO | S_IWUSR); | ||
| 2988 | MODULE_PARM_DESC(reserved_rq_based_ios, "Reserved IOs in request-based mempools"); | ||
| 2989 | |||
| 2927 | MODULE_DESCRIPTION(DM_NAME " driver"); | 2990 | MODULE_DESCRIPTION(DM_NAME " driver"); |
| 2928 | MODULE_AUTHOR("Joe Thornber <dm-devel@redhat.com>"); | 2991 | MODULE_AUTHOR("Joe Thornber <dm-devel@redhat.com>"); |
| 2929 | MODULE_LICENSE("GPL"); | 2992 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/md/dm.h b/drivers/md/dm.h index 5e604cc7b4aa..1d1ad7b7e527 100644 --- a/drivers/md/dm.h +++ b/drivers/md/dm.h | |||
| @@ -184,6 +184,9 @@ void dm_free_md_mempools(struct dm_md_mempools *pools); | |||
| 184 | /* | 184 | /* |
| 185 | * Helpers that are used by DM core | 185 | * Helpers that are used by DM core |
| 186 | */ | 186 | */ |
| 187 | unsigned dm_get_reserved_bio_based_ios(void); | ||
| 188 | unsigned dm_get_reserved_rq_based_ios(void); | ||
| 189 | |||
| 187 | static inline bool dm_message_test_buffer_overflow(char *result, unsigned maxlen) | 190 | static inline bool dm_message_test_buffer_overflow(char *result, unsigned maxlen) |
| 188 | { | 191 | { |
| 189 | return !maxlen || strlen(result) + 1 >= maxlen; | 192 | return !maxlen || strlen(result) + 1 >= maxlen; |
diff --git a/drivers/mtd/nand/pxa3xx_nand.c b/drivers/mtd/nand/pxa3xx_nand.c index 5db900d917f9..dd03dfdfb0d6 100644 --- a/drivers/mtd/nand/pxa3xx_nand.c +++ b/drivers/mtd/nand/pxa3xx_nand.c | |||
| @@ -1236,7 +1236,6 @@ static int pxa3xx_nand_remove(struct platform_device *pdev) | |||
| 1236 | return 0; | 1236 | return 0; |
| 1237 | } | 1237 | } |
| 1238 | 1238 | ||
| 1239 | #ifdef CONFIG_OF | ||
| 1240 | static struct of_device_id pxa3xx_nand_dt_ids[] = { | 1239 | static struct of_device_id pxa3xx_nand_dt_ids[] = { |
| 1241 | { | 1240 | { |
| 1242 | .compatible = "marvell,pxa3xx-nand", | 1241 | .compatible = "marvell,pxa3xx-nand", |
| @@ -1284,12 +1283,6 @@ static int pxa3xx_nand_probe_dt(struct platform_device *pdev) | |||
| 1284 | 1283 | ||
| 1285 | return 0; | 1284 | return 0; |
| 1286 | } | 1285 | } |
| 1287 | #else | ||
| 1288 | static inline int pxa3xx_nand_probe_dt(struct platform_device *pdev) | ||
| 1289 | { | ||
| 1290 | return 0; | ||
| 1291 | } | ||
| 1292 | #endif | ||
| 1293 | 1286 | ||
| 1294 | static int pxa3xx_nand_probe(struct platform_device *pdev) | 1287 | static int pxa3xx_nand_probe(struct platform_device *pdev) |
| 1295 | { | 1288 | { |
diff --git a/drivers/net/bonding/bond_alb.c b/drivers/net/bonding/bond_alb.c index 91f179d5135c..f428ef574372 100644 --- a/drivers/net/bonding/bond_alb.c +++ b/drivers/net/bonding/bond_alb.c | |||
| @@ -1472,7 +1472,7 @@ void bond_alb_monitor(struct work_struct *work) | |||
| 1472 | bond_info->lp_counter++; | 1472 | bond_info->lp_counter++; |
| 1473 | 1473 | ||
| 1474 | /* send learning packets */ | 1474 | /* send learning packets */ |
| 1475 | if (bond_info->lp_counter >= BOND_ALB_LP_TICKS) { | 1475 | if (bond_info->lp_counter >= BOND_ALB_LP_TICKS(bond)) { |
| 1476 | /* change of curr_active_slave involves swapping of mac addresses. | 1476 | /* change of curr_active_slave involves swapping of mac addresses. |
| 1477 | * in order to avoid this swapping from happening while | 1477 | * in order to avoid this swapping from happening while |
| 1478 | * sending the learning packets, the curr_slave_lock must be held for | 1478 | * sending the learning packets, the curr_slave_lock must be held for |
diff --git a/drivers/net/bonding/bond_alb.h b/drivers/net/bonding/bond_alb.h index 28d8e4c7dc06..c5eff5dafdfe 100644 --- a/drivers/net/bonding/bond_alb.h +++ b/drivers/net/bonding/bond_alb.h | |||
| @@ -36,14 +36,15 @@ struct slave; | |||
| 36 | * Used for division - never set | 36 | * Used for division - never set |
| 37 | * to zero !!! | 37 | * to zero !!! |
| 38 | */ | 38 | */ |
| 39 | #define BOND_ALB_LP_INTERVAL 1 /* In seconds, periodic send of | 39 | #define BOND_ALB_DEFAULT_LP_INTERVAL 1 |
| 40 | * learning packets to the switch | 40 | #define BOND_ALB_LP_INTERVAL(bond) (bond->params.lp_interval) /* In seconds, periodic send of |
| 41 | */ | 41 | * learning packets to the switch |
| 42 | */ | ||
| 42 | 43 | ||
| 43 | #define BOND_TLB_REBALANCE_TICKS (BOND_TLB_REBALANCE_INTERVAL \ | 44 | #define BOND_TLB_REBALANCE_TICKS (BOND_TLB_REBALANCE_INTERVAL \ |
| 44 | * ALB_TIMER_TICKS_PER_SEC) | 45 | * ALB_TIMER_TICKS_PER_SEC) |
| 45 | 46 | ||
| 46 | #define BOND_ALB_LP_TICKS (BOND_ALB_LP_INTERVAL \ | 47 | #define BOND_ALB_LP_TICKS(bond) (BOND_ALB_LP_INTERVAL(bond) \ |
| 47 | * ALB_TIMER_TICKS_PER_SEC) | 48 | * ALB_TIMER_TICKS_PER_SEC) |
| 48 | 49 | ||
| 49 | #define TLB_HASH_TABLE_SIZE 256 /* The size of the clients hash table. | 50 | #define TLB_HASH_TABLE_SIZE 256 /* The size of the clients hash table. |
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index 72df399c4ab3..55bbb8b8200c 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c | |||
| @@ -4416,6 +4416,7 @@ static int bond_check_params(struct bond_params *params) | |||
| 4416 | params->all_slaves_active = all_slaves_active; | 4416 | params->all_slaves_active = all_slaves_active; |
| 4417 | params->resend_igmp = resend_igmp; | 4417 | params->resend_igmp = resend_igmp; |
| 4418 | params->min_links = min_links; | 4418 | params->min_links = min_links; |
| 4419 | params->lp_interval = BOND_ALB_DEFAULT_LP_INTERVAL; | ||
| 4419 | 4420 | ||
| 4420 | if (primary) { | 4421 | if (primary) { |
| 4421 | strncpy(params->primary, primary, IFNAMSIZ); | 4422 | strncpy(params->primary, primary, IFNAMSIZ); |
diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c index eeab40b01b7a..c29b836749b6 100644 --- a/drivers/net/bonding/bond_sysfs.c +++ b/drivers/net/bonding/bond_sysfs.c | |||
| @@ -1699,6 +1699,44 @@ out: | |||
| 1699 | static DEVICE_ATTR(resend_igmp, S_IRUGO | S_IWUSR, | 1699 | static DEVICE_ATTR(resend_igmp, S_IRUGO | S_IWUSR, |
| 1700 | bonding_show_resend_igmp, bonding_store_resend_igmp); | 1700 | bonding_show_resend_igmp, bonding_store_resend_igmp); |
| 1701 | 1701 | ||
| 1702 | |||
| 1703 | static ssize_t bonding_show_lp_interval(struct device *d, | ||
| 1704 | struct device_attribute *attr, | ||
| 1705 | char *buf) | ||
| 1706 | { | ||
| 1707 | struct bonding *bond = to_bond(d); | ||
| 1708 | return sprintf(buf, "%d\n", bond->params.lp_interval); | ||
| 1709 | } | ||
| 1710 | |||
| 1711 | static ssize_t bonding_store_lp_interval(struct device *d, | ||
| 1712 | struct device_attribute *attr, | ||
| 1713 | const char *buf, size_t count) | ||
| 1714 | { | ||
| 1715 | struct bonding *bond = to_bond(d); | ||
| 1716 | int new_value, ret = count; | ||
| 1717 | |||
| 1718 | if (sscanf(buf, "%d", &new_value) != 1) { | ||
| 1719 | pr_err("%s: no lp interval value specified.\n", | ||
| 1720 | bond->dev->name); | ||
| 1721 | ret = -EINVAL; | ||
| 1722 | goto out; | ||
| 1723 | } | ||
| 1724 | |||
| 1725 | if (new_value <= 0) { | ||
| 1726 | pr_err ("%s: lp_interval must be between 1 and %d\n", | ||
| 1727 | bond->dev->name, INT_MAX); | ||
| 1728 | ret = -EINVAL; | ||
| 1729 | goto out; | ||
| 1730 | } | ||
| 1731 | |||
| 1732 | bond->params.lp_interval = new_value; | ||
| 1733 | out: | ||
| 1734 | return ret; | ||
| 1735 | } | ||
| 1736 | |||
| 1737 | static DEVICE_ATTR(lp_interval, S_IRUGO | S_IWUSR, | ||
| 1738 | bonding_show_lp_interval, bonding_store_lp_interval); | ||
| 1739 | |||
| 1702 | static struct attribute *per_bond_attrs[] = { | 1740 | static struct attribute *per_bond_attrs[] = { |
| 1703 | &dev_attr_slaves.attr, | 1741 | &dev_attr_slaves.attr, |
| 1704 | &dev_attr_mode.attr, | 1742 | &dev_attr_mode.attr, |
| @@ -1729,6 +1767,7 @@ static struct attribute *per_bond_attrs[] = { | |||
| 1729 | &dev_attr_all_slaves_active.attr, | 1767 | &dev_attr_all_slaves_active.attr, |
| 1730 | &dev_attr_resend_igmp.attr, | 1768 | &dev_attr_resend_igmp.attr, |
| 1731 | &dev_attr_min_links.attr, | 1769 | &dev_attr_min_links.attr, |
| 1770 | &dev_attr_lp_interval.attr, | ||
| 1732 | NULL, | 1771 | NULL, |
| 1733 | }; | 1772 | }; |
| 1734 | 1773 | ||
diff --git a/drivers/net/bonding/bonding.h b/drivers/net/bonding/bonding.h index 7ad8bd5cc947..03cf3fd14490 100644 --- a/drivers/net/bonding/bonding.h +++ b/drivers/net/bonding/bonding.h | |||
| @@ -176,6 +176,7 @@ struct bond_params { | |||
| 176 | int tx_queues; | 176 | int tx_queues; |
| 177 | int all_slaves_active; | 177 | int all_slaves_active; |
| 178 | int resend_igmp; | 178 | int resend_igmp; |
| 179 | int lp_interval; | ||
| 179 | }; | 180 | }; |
| 180 | 181 | ||
| 181 | struct bond_parm_tbl { | 182 | struct bond_parm_tbl { |
diff --git a/drivers/net/ethernet/adi/bfin_mac.c b/drivers/net/ethernet/adi/bfin_mac.c index e66684a438f5..75fb1d20d6fd 100644 --- a/drivers/net/ethernet/adi/bfin_mac.c +++ b/drivers/net/ethernet/adi/bfin_mac.c | |||
| @@ -530,7 +530,7 @@ static int bfin_mac_ethtool_setwol(struct net_device *dev, | |||
| 530 | if (lp->wol && !lp->irq_wake_requested) { | 530 | if (lp->wol && !lp->irq_wake_requested) { |
| 531 | /* register wake irq handler */ | 531 | /* register wake irq handler */ |
| 532 | rc = request_irq(IRQ_MAC_WAKEDET, bfin_mac_wake_interrupt, | 532 | rc = request_irq(IRQ_MAC_WAKEDET, bfin_mac_wake_interrupt, |
| 533 | IRQF_DISABLED, "EMAC_WAKE", dev); | 533 | 0, "EMAC_WAKE", dev); |
| 534 | if (rc) | 534 | if (rc) |
| 535 | return rc; | 535 | return rc; |
| 536 | lp->irq_wake_requested = true; | 536 | lp->irq_wake_requested = true; |
| @@ -1686,7 +1686,7 @@ static int bfin_mac_probe(struct platform_device *pdev) | |||
| 1686 | /* now, enable interrupts */ | 1686 | /* now, enable interrupts */ |
| 1687 | /* register irq handler */ | 1687 | /* register irq handler */ |
| 1688 | rc = request_irq(IRQ_MAC_RX, bfin_mac_interrupt, | 1688 | rc = request_irq(IRQ_MAC_RX, bfin_mac_interrupt, |
| 1689 | IRQF_DISABLED, "EMAC_RX", ndev); | 1689 | 0, "EMAC_RX", ndev); |
| 1690 | if (rc) { | 1690 | if (rc) { |
| 1691 | dev_err(&pdev->dev, "Cannot request Blackfin MAC RX IRQ!\n"); | 1691 | dev_err(&pdev->dev, "Cannot request Blackfin MAC RX IRQ!\n"); |
| 1692 | rc = -EBUSY; | 1692 | rc = -EBUSY; |
diff --git a/drivers/net/ethernet/amd/sun3lance.c b/drivers/net/ethernet/amd/sun3lance.c index d6b20296b8e4..3d8c6b2cdea4 100644 --- a/drivers/net/ethernet/amd/sun3lance.c +++ b/drivers/net/ethernet/amd/sun3lance.c | |||
| @@ -358,7 +358,7 @@ static int __init lance_probe( struct net_device *dev) | |||
| 358 | 358 | ||
| 359 | REGA(CSR0) = CSR0_STOP; | 359 | REGA(CSR0) = CSR0_STOP; |
| 360 | 360 | ||
| 361 | if (request_irq(LANCE_IRQ, lance_interrupt, IRQF_DISABLED, "SUN3 Lance", dev) < 0) { | 361 | if (request_irq(LANCE_IRQ, lance_interrupt, 0, "SUN3 Lance", dev) < 0) { |
| 362 | #ifdef CONFIG_SUN3 | 362 | #ifdef CONFIG_SUN3 |
| 363 | iounmap((void __iomem *)ioaddr); | 363 | iounmap((void __iomem *)ioaddr); |
| 364 | #endif | 364 | #endif |
diff --git a/drivers/net/ethernet/atheros/alx/main.c b/drivers/net/ethernet/atheros/alx/main.c index 027398ebbba6..fc95b235e210 100644 --- a/drivers/net/ethernet/atheros/alx/main.c +++ b/drivers/net/ethernet/atheros/alx/main.c | |||
| @@ -1188,7 +1188,7 @@ static int alx_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
| 1188 | struct alx_priv *alx; | 1188 | struct alx_priv *alx; |
| 1189 | struct alx_hw *hw; | 1189 | struct alx_hw *hw; |
| 1190 | bool phy_configured; | 1190 | bool phy_configured; |
| 1191 | int bars, pm_cap, err; | 1191 | int bars, err; |
| 1192 | 1192 | ||
| 1193 | err = pci_enable_device_mem(pdev); | 1193 | err = pci_enable_device_mem(pdev); |
| 1194 | if (err) | 1194 | if (err) |
| @@ -1225,18 +1225,13 @@ static int alx_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
| 1225 | pci_enable_pcie_error_reporting(pdev); | 1225 | pci_enable_pcie_error_reporting(pdev); |
| 1226 | pci_set_master(pdev); | 1226 | pci_set_master(pdev); |
| 1227 | 1227 | ||
| 1228 | pm_cap = pci_find_capability(pdev, PCI_CAP_ID_PM); | 1228 | if (!pdev->pm_cap) { |
| 1229 | if (pm_cap == 0) { | ||
| 1230 | dev_err(&pdev->dev, | 1229 | dev_err(&pdev->dev, |
| 1231 | "Can't find power management capability, aborting\n"); | 1230 | "Can't find power management capability, aborting\n"); |
| 1232 | err = -EIO; | 1231 | err = -EIO; |
| 1233 | goto out_pci_release; | 1232 | goto out_pci_release; |
| 1234 | } | 1233 | } |
| 1235 | 1234 | ||
| 1236 | err = pci_set_power_state(pdev, PCI_D0); | ||
| 1237 | if (err) | ||
| 1238 | goto out_pci_release; | ||
| 1239 | |||
| 1240 | netdev = alloc_etherdev(sizeof(*alx)); | 1235 | netdev = alloc_etherdev(sizeof(*alx)); |
| 1241 | if (!netdev) { | 1236 | if (!netdev) { |
| 1242 | err = -ENOMEM; | 1237 | err = -ENOMEM; |
diff --git a/drivers/net/ethernet/broadcom/bgmac.c b/drivers/net/ethernet/broadcom/bgmac.c index eec0af45b859..249468f95365 100644 --- a/drivers/net/ethernet/broadcom/bgmac.c +++ b/drivers/net/ethernet/broadcom/bgmac.c | |||
| @@ -157,6 +157,7 @@ static netdev_tx_t bgmac_dma_tx_add(struct bgmac *bgmac, | |||
| 157 | if (++ring->end >= BGMAC_TX_RING_SLOTS) | 157 | if (++ring->end >= BGMAC_TX_RING_SLOTS) |
| 158 | ring->end = 0; | 158 | ring->end = 0; |
| 159 | bgmac_write(bgmac, ring->mmio_base + BGMAC_DMA_TX_INDEX, | 159 | bgmac_write(bgmac, ring->mmio_base + BGMAC_DMA_TX_INDEX, |
| 160 | ring->index_base + | ||
| 160 | ring->end * sizeof(struct bgmac_dma_desc)); | 161 | ring->end * sizeof(struct bgmac_dma_desc)); |
| 161 | 162 | ||
| 162 | /* Always keep one slot free to allow detecting bugged calls. */ | 163 | /* Always keep one slot free to allow detecting bugged calls. */ |
| @@ -181,6 +182,8 @@ static void bgmac_dma_tx_free(struct bgmac *bgmac, struct bgmac_dma_ring *ring) | |||
| 181 | /* The last slot that hardware didn't consume yet */ | 182 | /* The last slot that hardware didn't consume yet */ |
| 182 | empty_slot = bgmac_read(bgmac, ring->mmio_base + BGMAC_DMA_TX_STATUS); | 183 | empty_slot = bgmac_read(bgmac, ring->mmio_base + BGMAC_DMA_TX_STATUS); |
| 183 | empty_slot &= BGMAC_DMA_TX_STATDPTR; | 184 | empty_slot &= BGMAC_DMA_TX_STATDPTR; |
| 185 | empty_slot -= ring->index_base; | ||
| 186 | empty_slot &= BGMAC_DMA_TX_STATDPTR; | ||
| 184 | empty_slot /= sizeof(struct bgmac_dma_desc); | 187 | empty_slot /= sizeof(struct bgmac_dma_desc); |
| 185 | 188 | ||
| 186 | while (ring->start != empty_slot) { | 189 | while (ring->start != empty_slot) { |
| @@ -274,6 +277,8 @@ static int bgmac_dma_rx_read(struct bgmac *bgmac, struct bgmac_dma_ring *ring, | |||
| 274 | 277 | ||
| 275 | end_slot = bgmac_read(bgmac, ring->mmio_base + BGMAC_DMA_RX_STATUS); | 278 | end_slot = bgmac_read(bgmac, ring->mmio_base + BGMAC_DMA_RX_STATUS); |
| 276 | end_slot &= BGMAC_DMA_RX_STATDPTR; | 279 | end_slot &= BGMAC_DMA_RX_STATDPTR; |
| 280 | end_slot -= ring->index_base; | ||
| 281 | end_slot &= BGMAC_DMA_RX_STATDPTR; | ||
| 277 | end_slot /= sizeof(struct bgmac_dma_desc); | 282 | end_slot /= sizeof(struct bgmac_dma_desc); |
| 278 | 283 | ||
| 279 | ring->end = end_slot; | 284 | ring->end = end_slot; |
| @@ -418,9 +423,6 @@ static int bgmac_dma_alloc(struct bgmac *bgmac) | |||
| 418 | ring = &bgmac->tx_ring[i]; | 423 | ring = &bgmac->tx_ring[i]; |
| 419 | ring->num_slots = BGMAC_TX_RING_SLOTS; | 424 | ring->num_slots = BGMAC_TX_RING_SLOTS; |
| 420 | ring->mmio_base = ring_base[i]; | 425 | ring->mmio_base = ring_base[i]; |
| 421 | if (bgmac_dma_unaligned(bgmac, ring, BGMAC_DMA_RING_TX)) | ||
| 422 | bgmac_warn(bgmac, "TX on ring 0x%X supports unaligned addressing but this feature is not implemented\n", | ||
| 423 | ring->mmio_base); | ||
| 424 | 426 | ||
| 425 | /* Alloc ring of descriptors */ | 427 | /* Alloc ring of descriptors */ |
| 426 | size = ring->num_slots * sizeof(struct bgmac_dma_desc); | 428 | size = ring->num_slots * sizeof(struct bgmac_dma_desc); |
| @@ -435,6 +437,13 @@ static int bgmac_dma_alloc(struct bgmac *bgmac) | |||
| 435 | if (ring->dma_base & 0xC0000000) | 437 | if (ring->dma_base & 0xC0000000) |
| 436 | bgmac_warn(bgmac, "DMA address using 0xC0000000 bit(s), it may need translation trick\n"); | 438 | bgmac_warn(bgmac, "DMA address using 0xC0000000 bit(s), it may need translation trick\n"); |
| 437 | 439 | ||
| 440 | ring->unaligned = bgmac_dma_unaligned(bgmac, ring, | ||
| 441 | BGMAC_DMA_RING_TX); | ||
| 442 | if (ring->unaligned) | ||
| 443 | ring->index_base = lower_32_bits(ring->dma_base); | ||
| 444 | else | ||
| 445 | ring->index_base = 0; | ||
| 446 | |||
| 438 | /* No need to alloc TX slots yet */ | 447 | /* No need to alloc TX slots yet */ |
| 439 | } | 448 | } |
| 440 | 449 | ||
| @@ -444,9 +453,6 @@ static int bgmac_dma_alloc(struct bgmac *bgmac) | |||
| 444 | ring = &bgmac->rx_ring[i]; | 453 | ring = &bgmac->rx_ring[i]; |
| 445 | ring->num_slots = BGMAC_RX_RING_SLOTS; | 454 | ring->num_slots = BGMAC_RX_RING_SLOTS; |
| 446 | ring->mmio_base = ring_base[i]; | 455 | ring->mmio_base = ring_base[i]; |
| 447 | if (bgmac_dma_unaligned(bgmac, ring, BGMAC_DMA_RING_RX)) | ||
| 448 | bgmac_warn(bgmac, "RX on ring 0x%X supports unaligned addressing but this feature is not implemented\n", | ||
| 449 | ring->mmio_base); | ||
| 450 | 456 | ||
| 451 | /* Alloc ring of descriptors */ | 457 | /* Alloc ring of descriptors */ |
| 452 | size = ring->num_slots * sizeof(struct bgmac_dma_desc); | 458 | size = ring->num_slots * sizeof(struct bgmac_dma_desc); |
| @@ -462,6 +468,13 @@ static int bgmac_dma_alloc(struct bgmac *bgmac) | |||
| 462 | if (ring->dma_base & 0xC0000000) | 468 | if (ring->dma_base & 0xC0000000) |
| 463 | bgmac_warn(bgmac, "DMA address using 0xC0000000 bit(s), it may need translation trick\n"); | 469 | bgmac_warn(bgmac, "DMA address using 0xC0000000 bit(s), it may need translation trick\n"); |
| 464 | 470 | ||
| 471 | ring->unaligned = bgmac_dma_unaligned(bgmac, ring, | ||
| 472 | BGMAC_DMA_RING_RX); | ||
| 473 | if (ring->unaligned) | ||
| 474 | ring->index_base = lower_32_bits(ring->dma_base); | ||
| 475 | else | ||
| 476 | ring->index_base = 0; | ||
| 477 | |||
| 465 | /* Alloc RX slots */ | 478 | /* Alloc RX slots */ |
| 466 | for (j = 0; j < ring->num_slots; j++) { | 479 | for (j = 0; j < ring->num_slots; j++) { |
| 467 | err = bgmac_dma_rx_skb_for_slot(bgmac, &ring->slots[j]); | 480 | err = bgmac_dma_rx_skb_for_slot(bgmac, &ring->slots[j]); |
| @@ -489,12 +502,14 @@ static void bgmac_dma_init(struct bgmac *bgmac) | |||
| 489 | for (i = 0; i < BGMAC_MAX_TX_RINGS; i++) { | 502 | for (i = 0; i < BGMAC_MAX_TX_RINGS; i++) { |
| 490 | ring = &bgmac->tx_ring[i]; | 503 | ring = &bgmac->tx_ring[i]; |
| 491 | 504 | ||
| 492 | /* We don't implement unaligned addressing, so enable first */ | 505 | if (!ring->unaligned) |
| 493 | bgmac_dma_tx_enable(bgmac, ring); | 506 | bgmac_dma_tx_enable(bgmac, ring); |
| 494 | bgmac_write(bgmac, ring->mmio_base + BGMAC_DMA_TX_RINGLO, | 507 | bgmac_write(bgmac, ring->mmio_base + BGMAC_DMA_TX_RINGLO, |
| 495 | lower_32_bits(ring->dma_base)); | 508 | lower_32_bits(ring->dma_base)); |
| 496 | bgmac_write(bgmac, ring->mmio_base + BGMAC_DMA_TX_RINGHI, | 509 | bgmac_write(bgmac, ring->mmio_base + BGMAC_DMA_TX_RINGHI, |
| 497 | upper_32_bits(ring->dma_base)); | 510 | upper_32_bits(ring->dma_base)); |
| 511 | if (ring->unaligned) | ||
| 512 | bgmac_dma_tx_enable(bgmac, ring); | ||
| 498 | 513 | ||
| 499 | ring->start = 0; | 514 | ring->start = 0; |
| 500 | ring->end = 0; /* Points the slot that should *not* be read */ | 515 | ring->end = 0; /* Points the slot that should *not* be read */ |
| @@ -505,12 +520,14 @@ static void bgmac_dma_init(struct bgmac *bgmac) | |||
| 505 | 520 | ||
| 506 | ring = &bgmac->rx_ring[i]; | 521 | ring = &bgmac->rx_ring[i]; |
| 507 | 522 | ||
| 508 | /* We don't implement unaligned addressing, so enable first */ | 523 | if (!ring->unaligned) |
| 509 | bgmac_dma_rx_enable(bgmac, ring); | 524 | bgmac_dma_rx_enable(bgmac, ring); |
| 510 | bgmac_write(bgmac, ring->mmio_base + BGMAC_DMA_RX_RINGLO, | 525 | bgmac_write(bgmac, ring->mmio_base + BGMAC_DMA_RX_RINGLO, |
| 511 | lower_32_bits(ring->dma_base)); | 526 | lower_32_bits(ring->dma_base)); |
| 512 | bgmac_write(bgmac, ring->mmio_base + BGMAC_DMA_RX_RINGHI, | 527 | bgmac_write(bgmac, ring->mmio_base + BGMAC_DMA_RX_RINGHI, |
| 513 | upper_32_bits(ring->dma_base)); | 528 | upper_32_bits(ring->dma_base)); |
| 529 | if (ring->unaligned) | ||
| 530 | bgmac_dma_rx_enable(bgmac, ring); | ||
| 514 | 531 | ||
| 515 | for (j = 0, dma_desc = ring->cpu_base; j < ring->num_slots; | 532 | for (j = 0, dma_desc = ring->cpu_base; j < ring->num_slots; |
| 516 | j++, dma_desc++) { | 533 | j++, dma_desc++) { |
| @@ -531,6 +548,7 @@ static void bgmac_dma_init(struct bgmac *bgmac) | |||
| 531 | } | 548 | } |
| 532 | 549 | ||
| 533 | bgmac_write(bgmac, ring->mmio_base + BGMAC_DMA_RX_INDEX, | 550 | bgmac_write(bgmac, ring->mmio_base + BGMAC_DMA_RX_INDEX, |
| 551 | ring->index_base + | ||
| 534 | ring->num_slots * sizeof(struct bgmac_dma_desc)); | 552 | ring->num_slots * sizeof(struct bgmac_dma_desc)); |
| 535 | 553 | ||
| 536 | ring->start = 0; | 554 | ring->start = 0; |
| @@ -908,10 +926,10 @@ static void bgmac_chip_reset(struct bgmac *bgmac) | |||
| 908 | struct bcma_drv_cc *cc = &bgmac->core->bus->drv_cc; | 926 | struct bcma_drv_cc *cc = &bgmac->core->bus->drv_cc; |
| 909 | u8 et_swtype = 0; | 927 | u8 et_swtype = 0; |
| 910 | u8 sw_type = BGMAC_CHIPCTL_1_SW_TYPE_EPHY | | 928 | u8 sw_type = BGMAC_CHIPCTL_1_SW_TYPE_EPHY | |
| 911 | BGMAC_CHIPCTL_1_IF_TYPE_RMII; | 929 | BGMAC_CHIPCTL_1_IF_TYPE_MII; |
| 912 | char buf[2]; | 930 | char buf[4]; |
| 913 | 931 | ||
| 914 | if (bcm47xx_nvram_getenv("et_swtype", buf, 1) > 0) { | 932 | if (bcm47xx_nvram_getenv("et_swtype", buf, sizeof(buf)) > 0) { |
| 915 | if (kstrtou8(buf, 0, &et_swtype)) | 933 | if (kstrtou8(buf, 0, &et_swtype)) |
| 916 | bgmac_err(bgmac, "Failed to parse et_swtype (%s)\n", | 934 | bgmac_err(bgmac, "Failed to parse et_swtype (%s)\n", |
| 917 | buf); | 935 | buf); |
diff --git a/drivers/net/ethernet/broadcom/bgmac.h b/drivers/net/ethernet/broadcom/bgmac.h index 98d4b5fcc070..66c8afbdc8c7 100644 --- a/drivers/net/ethernet/broadcom/bgmac.h +++ b/drivers/net/ethernet/broadcom/bgmac.h | |||
| @@ -333,7 +333,7 @@ | |||
| 333 | 333 | ||
| 334 | #define BGMAC_CHIPCTL_1_IF_TYPE_MASK 0x00000030 | 334 | #define BGMAC_CHIPCTL_1_IF_TYPE_MASK 0x00000030 |
| 335 | #define BGMAC_CHIPCTL_1_IF_TYPE_RMII 0x00000000 | 335 | #define BGMAC_CHIPCTL_1_IF_TYPE_RMII 0x00000000 |
| 336 | #define BGMAC_CHIPCTL_1_IF_TYPE_MI 0x00000010 | 336 | #define BGMAC_CHIPCTL_1_IF_TYPE_MII 0x00000010 |
| 337 | #define BGMAC_CHIPCTL_1_IF_TYPE_RGMII 0x00000020 | 337 | #define BGMAC_CHIPCTL_1_IF_TYPE_RGMII 0x00000020 |
| 338 | #define BGMAC_CHIPCTL_1_SW_TYPE_MASK 0x000000C0 | 338 | #define BGMAC_CHIPCTL_1_SW_TYPE_MASK 0x000000C0 |
| 339 | #define BGMAC_CHIPCTL_1_SW_TYPE_EPHY 0x00000000 | 339 | #define BGMAC_CHIPCTL_1_SW_TYPE_EPHY 0x00000000 |
| @@ -384,6 +384,8 @@ struct bgmac_dma_ring { | |||
| 384 | u16 mmio_base; | 384 | u16 mmio_base; |
| 385 | struct bgmac_dma_desc *cpu_base; | 385 | struct bgmac_dma_desc *cpu_base; |
| 386 | dma_addr_t dma_base; | 386 | dma_addr_t dma_base; |
| 387 | u32 index_base; /* Used for unaligned rings only, otherwise 0 */ | ||
| 388 | bool unaligned; | ||
| 387 | 389 | ||
| 388 | struct bgmac_slot_info slots[BGMAC_RX_RING_SLOTS]; | 390 | struct bgmac_slot_info slots[BGMAC_RX_RING_SLOTS]; |
| 389 | }; | 391 | }; |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h index 0c338026ce01..97b3d32a98bd 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h | |||
| @@ -246,8 +246,37 @@ enum { | |||
| 246 | BNX2X_MAX_CNIC_ETH_CL_ID_IDX, | 246 | BNX2X_MAX_CNIC_ETH_CL_ID_IDX, |
| 247 | }; | 247 | }; |
| 248 | 248 | ||
| 249 | #define BNX2X_CNIC_START_ETH_CID(bp) (BNX2X_NUM_NON_CNIC_QUEUES(bp) *\ | 249 | /* use a value high enough to be above all the PFs, which has least significant |
| 250 | * nibble as 8, so when cnic needs to come up with a CID for UIO to use to | ||
| 251 | * calculate doorbell address according to old doorbell configuration scheme | ||
| 252 | * (db_msg_sz 1 << 7 * cid + 0x40 DPM offset) it can come up with a valid number | ||
| 253 | * We must avoid coming up with cid 8 for iscsi since according to this method | ||
| 254 | * the designated UIO cid will come out 0 and it has a special handling for that | ||
| 255 | * case which doesn't suit us. Therefore will will cieling to closes cid which | ||
| 256 | * has least signigifcant nibble 8 and if it is 8 we will move forward to 0x18. | ||
| 257 | */ | ||
| 258 | |||
| 259 | #define BNX2X_1st_NON_L2_ETH_CID(bp) (BNX2X_NUM_NON_CNIC_QUEUES(bp) * \ | ||
| 250 | (bp)->max_cos) | 260 | (bp)->max_cos) |
| 261 | /* amount of cids traversed by UIO's DPM addition to doorbell */ | ||
| 262 | #define UIO_DPM 8 | ||
| 263 | /* roundup to DPM offset */ | ||
| 264 | #define UIO_ROUNDUP(bp) (roundup(BNX2X_1st_NON_L2_ETH_CID(bp), \ | ||
| 265 | UIO_DPM)) | ||
| 266 | /* offset to nearest value which has lsb nibble matching DPM */ | ||
| 267 | #define UIO_CID_OFFSET(bp) ((UIO_ROUNDUP(bp) + UIO_DPM) % \ | ||
| 268 | (UIO_DPM * 2)) | ||
| 269 | /* add offset to rounded-up cid to get a value which could be used with UIO */ | ||
| 270 | #define UIO_DPM_ALIGN(bp) (UIO_ROUNDUP(bp) + UIO_CID_OFFSET(bp)) | ||
| 271 | /* but wait - avoid UIO special case for cid 0 */ | ||
| 272 | #define UIO_DPM_CID0_OFFSET(bp) ((UIO_DPM * 2) * \ | ||
| 273 | (UIO_DPM_ALIGN(bp) == UIO_DPM)) | ||
| 274 | /* Properly DPM aligned CID dajusted to cid 0 secal case */ | ||
| 275 | #define BNX2X_CNIC_START_ETH_CID(bp) (UIO_DPM_ALIGN(bp) + \ | ||
| 276 | (UIO_DPM_CID0_OFFSET(bp))) | ||
| 277 | /* how many cids were wasted - need this value for cid allocation */ | ||
| 278 | #define UIO_CID_PAD(bp) (BNX2X_CNIC_START_ETH_CID(bp) - \ | ||
| 279 | BNX2X_1st_NON_L2_ETH_CID(bp)) | ||
| 251 | /* iSCSI L2 */ | 280 | /* iSCSI L2 */ |
| 252 | #define BNX2X_ISCSI_ETH_CID(bp) (BNX2X_CNIC_START_ETH_CID(bp)) | 281 | #define BNX2X_ISCSI_ETH_CID(bp) (BNX2X_CNIC_START_ETH_CID(bp)) |
| 253 | /* FCoE L2 */ | 282 | /* FCoE L2 */ |
| @@ -1542,7 +1571,6 @@ struct bnx2x { | |||
| 1542 | */ | 1571 | */ |
| 1543 | bool fcoe_init; | 1572 | bool fcoe_init; |
| 1544 | 1573 | ||
| 1545 | int pm_cap; | ||
| 1546 | int mrrs; | 1574 | int mrrs; |
| 1547 | 1575 | ||
| 1548 | struct delayed_work sp_task; | 1576 | struct delayed_work sp_task; |
| @@ -1681,10 +1709,11 @@ struct bnx2x { | |||
| 1681 | * Maximum CID count that might be required by the bnx2x: | 1709 | * Maximum CID count that might be required by the bnx2x: |
| 1682 | * Max RSS * Max_Tx_Multi_Cos + FCoE + iSCSI | 1710 | * Max RSS * Max_Tx_Multi_Cos + FCoE + iSCSI |
| 1683 | */ | 1711 | */ |
| 1712 | |||
| 1684 | #define BNX2X_L2_CID_COUNT(bp) (BNX2X_NUM_ETH_QUEUES(bp) * BNX2X_MULTI_TX_COS \ | 1713 | #define BNX2X_L2_CID_COUNT(bp) (BNX2X_NUM_ETH_QUEUES(bp) * BNX2X_MULTI_TX_COS \ |
| 1685 | + 2 * CNIC_SUPPORT(bp)) | 1714 | + CNIC_SUPPORT(bp) * (2 + UIO_CID_PAD(bp))) |
| 1686 | #define BNX2X_L2_MAX_CID(bp) (BNX2X_MAX_RSS_COUNT(bp) * BNX2X_MULTI_TX_COS \ | 1715 | #define BNX2X_L2_MAX_CID(bp) (BNX2X_MAX_RSS_COUNT(bp) * BNX2X_MULTI_TX_COS \ |
| 1687 | + 2 * CNIC_SUPPORT(bp)) | 1716 | + CNIC_SUPPORT(bp) * (2 + UIO_CID_PAD(bp))) |
| 1688 | #define L2_ILT_LINES(bp) (DIV_ROUND_UP(BNX2X_L2_CID_COUNT(bp),\ | 1717 | #define L2_ILT_LINES(bp) (DIV_ROUND_UP(BNX2X_L2_CID_COUNT(bp),\ |
| 1689 | ILT_PAGE_CIDS)) | 1718 | ILT_PAGE_CIDS)) |
| 1690 | 1719 | ||
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c index 90045c920d09..61726af1de6e 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c | |||
| @@ -3008,16 +3008,16 @@ int bnx2x_set_power_state(struct bnx2x *bp, pci_power_t state) | |||
| 3008 | u16 pmcsr; | 3008 | u16 pmcsr; |
| 3009 | 3009 | ||
| 3010 | /* If there is no power capability, silently succeed */ | 3010 | /* If there is no power capability, silently succeed */ |
| 3011 | if (!bp->pm_cap) { | 3011 | if (!bp->pdev->pm_cap) { |
| 3012 | BNX2X_DEV_INFO("No power capability. Breaking.\n"); | 3012 | BNX2X_DEV_INFO("No power capability. Breaking.\n"); |
| 3013 | return 0; | 3013 | return 0; |
| 3014 | } | 3014 | } |
| 3015 | 3015 | ||
| 3016 | pci_read_config_word(bp->pdev, bp->pm_cap + PCI_PM_CTRL, &pmcsr); | 3016 | pci_read_config_word(bp->pdev, bp->pdev->pm_cap + PCI_PM_CTRL, &pmcsr); |
| 3017 | 3017 | ||
| 3018 | switch (state) { | 3018 | switch (state) { |
| 3019 | case PCI_D0: | 3019 | case PCI_D0: |
| 3020 | pci_write_config_word(bp->pdev, bp->pm_cap + PCI_PM_CTRL, | 3020 | pci_write_config_word(bp->pdev, bp->pdev->pm_cap + PCI_PM_CTRL, |
| 3021 | ((pmcsr & ~PCI_PM_CTRL_STATE_MASK) | | 3021 | ((pmcsr & ~PCI_PM_CTRL_STATE_MASK) | |
| 3022 | PCI_PM_CTRL_PME_STATUS)); | 3022 | PCI_PM_CTRL_PME_STATUS)); |
| 3023 | 3023 | ||
| @@ -3041,7 +3041,7 @@ int bnx2x_set_power_state(struct bnx2x *bp, pci_power_t state) | |||
| 3041 | if (bp->wol) | 3041 | if (bp->wol) |
| 3042 | pmcsr |= PCI_PM_CTRL_PME_ENABLE; | 3042 | pmcsr |= PCI_PM_CTRL_PME_ENABLE; |
| 3043 | 3043 | ||
| 3044 | pci_write_config_word(bp->pdev, bp->pm_cap + PCI_PM_CTRL, | 3044 | pci_write_config_word(bp->pdev, bp->pdev->pm_cap + PCI_PM_CTRL, |
| 3045 | pmcsr); | 3045 | pmcsr); |
| 3046 | 3046 | ||
| 3047 | /* No more memory access after this point until | 3047 | /* No more memory access after this point until |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c index 2612e3c715d4..324de5f05332 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c | |||
| @@ -1387,9 +1387,9 @@ static bool bnx2x_is_nvm_accessible(struct bnx2x *bp) | |||
| 1387 | u16 pm = 0; | 1387 | u16 pm = 0; |
| 1388 | struct net_device *dev = pci_get_drvdata(bp->pdev); | 1388 | struct net_device *dev = pci_get_drvdata(bp->pdev); |
| 1389 | 1389 | ||
| 1390 | if (bp->pm_cap) | 1390 | if (bp->pdev->pm_cap) |
| 1391 | rc = pci_read_config_word(bp->pdev, | 1391 | rc = pci_read_config_word(bp->pdev, |
| 1392 | bp->pm_cap + PCI_PM_CTRL, &pm); | 1392 | bp->pdev->pm_cap + PCI_PM_CTRL, &pm); |
| 1393 | 1393 | ||
| 1394 | if ((rc && !netif_running(dev)) || | 1394 | if ((rc && !netif_running(dev)) || |
| 1395 | (!rc && ((pm & PCI_PM_CTRL_STATE_MASK) != (__force u16)PCI_D0))) | 1395 | (!rc && ((pm & PCI_PM_CTRL_STATE_MASK) != (__force u16)PCI_D0))) |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c index 2f8dbbbd7a86..a6704b555042 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | |||
| @@ -8652,6 +8652,7 @@ u32 bnx2x_send_unload_req(struct bnx2x *bp, int unload_mode) | |||
| 8652 | else if (bp->wol) { | 8652 | else if (bp->wol) { |
| 8653 | u32 emac_base = port ? GRCBASE_EMAC1 : GRCBASE_EMAC0; | 8653 | u32 emac_base = port ? GRCBASE_EMAC1 : GRCBASE_EMAC0; |
| 8654 | u8 *mac_addr = bp->dev->dev_addr; | 8654 | u8 *mac_addr = bp->dev->dev_addr; |
| 8655 | struct pci_dev *pdev = bp->pdev; | ||
| 8655 | u32 val; | 8656 | u32 val; |
| 8656 | u16 pmc; | 8657 | u16 pmc; |
| 8657 | 8658 | ||
| @@ -8668,9 +8669,9 @@ u32 bnx2x_send_unload_req(struct bnx2x *bp, int unload_mode) | |||
| 8668 | EMAC_WR(bp, EMAC_REG_EMAC_MAC_MATCH + entry + 4, val); | 8669 | EMAC_WR(bp, EMAC_REG_EMAC_MAC_MATCH + entry + 4, val); |
| 8669 | 8670 | ||
| 8670 | /* Enable the PME and clear the status */ | 8671 | /* Enable the PME and clear the status */ |
| 8671 | pci_read_config_word(bp->pdev, bp->pm_cap + PCI_PM_CTRL, &pmc); | 8672 | pci_read_config_word(pdev, pdev->pm_cap + PCI_PM_CTRL, &pmc); |
| 8672 | pmc |= PCI_PM_CTRL_PME_ENABLE | PCI_PM_CTRL_PME_STATUS; | 8673 | pmc |= PCI_PM_CTRL_PME_ENABLE | PCI_PM_CTRL_PME_STATUS; |
| 8673 | pci_write_config_word(bp->pdev, bp->pm_cap + PCI_PM_CTRL, pmc); | 8674 | pci_write_config_word(pdev, pdev->pm_cap + PCI_PM_CTRL, pmc); |
| 8674 | 8675 | ||
| 8675 | reset_code = DRV_MSG_CODE_UNLOAD_REQ_WOL_EN; | 8676 | reset_code = DRV_MSG_CODE_UNLOAD_REQ_WOL_EN; |
| 8676 | 8677 | ||
| @@ -10399,7 +10400,7 @@ static void bnx2x_get_common_hwinfo(struct bnx2x *bp) | |||
| 10399 | break; | 10400 | break; |
| 10400 | } | 10401 | } |
| 10401 | 10402 | ||
| 10402 | pci_read_config_word(bp->pdev, bp->pm_cap + PCI_PM_PMC, &pmc); | 10403 | pci_read_config_word(bp->pdev, bp->pdev->pm_cap + PCI_PM_PMC, &pmc); |
| 10403 | bp->flags |= (pmc & PCI_PM_CAP_PME_D3cold) ? 0 : NO_WOL_FLAG; | 10404 | bp->flags |= (pmc & PCI_PM_CAP_PME_D3cold) ? 0 : NO_WOL_FLAG; |
| 10404 | 10405 | ||
| 10405 | BNX2X_DEV_INFO("%sWoL capable\n", | 10406 | BNX2X_DEV_INFO("%sWoL capable\n", |
| @@ -12141,8 +12142,7 @@ static int bnx2x_init_dev(struct bnx2x *bp, struct pci_dev *pdev, | |||
| 12141 | } | 12142 | } |
| 12142 | 12143 | ||
| 12143 | if (IS_PF(bp)) { | 12144 | if (IS_PF(bp)) { |
| 12144 | bp->pm_cap = pdev->pm_cap; | 12145 | if (!pdev->pm_cap) { |
| 12145 | if (bp->pm_cap == 0) { | ||
| 12146 | dev_err(&bp->pdev->dev, | 12146 | dev_err(&bp->pdev->dev, |
| 12147 | "Cannot find power management capability, aborting\n"); | 12147 | "Cannot find power management capability, aborting\n"); |
| 12148 | rc = -EIO; | 12148 | rc = -EIO; |
| @@ -13632,6 +13632,10 @@ void bnx2x_setup_cnic_info(struct bnx2x *bp) | |||
| 13632 | cp->fcoe_init_cid = BNX2X_FCOE_ETH_CID(bp); | 13632 | cp->fcoe_init_cid = BNX2X_FCOE_ETH_CID(bp); |
| 13633 | cp->iscsi_l2_cid = BNX2X_ISCSI_ETH_CID(bp); | 13633 | cp->iscsi_l2_cid = BNX2X_ISCSI_ETH_CID(bp); |
| 13634 | 13634 | ||
| 13635 | DP(NETIF_MSG_IFUP, "BNX2X_1st_NON_L2_ETH_CID(bp) %x, cp->starting_cid %x, cp->fcoe_init_cid %x, cp->iscsi_l2_cid %x\n", | ||
| 13636 | BNX2X_1st_NON_L2_ETH_CID(bp), cp->starting_cid, cp->fcoe_init_cid, | ||
| 13637 | cp->iscsi_l2_cid); | ||
| 13638 | |||
| 13635 | if (NO_ISCSI_OOO(bp)) | 13639 | if (NO_ISCSI_OOO(bp)) |
| 13636 | cp->drv_state |= CNIC_DRV_STATE_NO_ISCSI_OOO; | 13640 | cp->drv_state |= CNIC_DRV_STATE_NO_ISCSI_OOO; |
| 13637 | } | 13641 | } |
diff --git a/drivers/net/ethernet/broadcom/cnic.c b/drivers/net/ethernet/broadcom/cnic.c index 8142480d9770..99394bd49a13 100644 --- a/drivers/net/ethernet/broadcom/cnic.c +++ b/drivers/net/ethernet/broadcom/cnic.c | |||
| @@ -3135,6 +3135,7 @@ static void cnic_service_bnx2x_bh(unsigned long data) | |||
| 3135 | { | 3135 | { |
| 3136 | struct cnic_dev *dev = (struct cnic_dev *) data; | 3136 | struct cnic_dev *dev = (struct cnic_dev *) data; |
| 3137 | struct cnic_local *cp = dev->cnic_priv; | 3137 | struct cnic_local *cp = dev->cnic_priv; |
| 3138 | struct bnx2x *bp = netdev_priv(dev->netdev); | ||
| 3138 | u32 status_idx, new_status_idx; | 3139 | u32 status_idx, new_status_idx; |
| 3139 | 3140 | ||
| 3140 | if (unlikely(!test_bit(CNIC_F_CNIC_UP, &dev->flags))) | 3141 | if (unlikely(!test_bit(CNIC_F_CNIC_UP, &dev->flags))) |
| @@ -3146,7 +3147,7 @@ static void cnic_service_bnx2x_bh(unsigned long data) | |||
| 3146 | CNIC_WR16(dev, cp->kcq1.io_addr, | 3147 | CNIC_WR16(dev, cp->kcq1.io_addr, |
| 3147 | cp->kcq1.sw_prod_idx + MAX_KCQ_IDX); | 3148 | cp->kcq1.sw_prod_idx + MAX_KCQ_IDX); |
| 3148 | 3149 | ||
| 3149 | if (cp->ethdev->drv_state & CNIC_DRV_STATE_NO_FCOE) { | 3150 | if (!CNIC_SUPPORTS_FCOE(bp)) { |
| 3150 | cp->arm_int(dev, status_idx); | 3151 | cp->arm_int(dev, status_idx); |
| 3151 | break; | 3152 | break; |
| 3152 | } | 3153 | } |
| @@ -5217,7 +5218,8 @@ static void cnic_init_rings(struct cnic_dev *dev) | |||
| 5217 | "iSCSI CLIENT_SETUP did not complete\n"); | 5218 | "iSCSI CLIENT_SETUP did not complete\n"); |
| 5218 | cnic_spq_completion(dev, DRV_CTL_RET_L2_SPQ_CREDIT_CMD, 1); | 5219 | cnic_spq_completion(dev, DRV_CTL_RET_L2_SPQ_CREDIT_CMD, 1); |
| 5219 | cnic_ring_ctl(dev, cid, cli, 1); | 5220 | cnic_ring_ctl(dev, cid, cli, 1); |
| 5220 | *cid_ptr = cid; | 5221 | *cid_ptr = cid >> 4; |
| 5222 | *(cid_ptr + 1) = cid * bp->db_size; | ||
| 5221 | } | 5223 | } |
| 5222 | } | 5224 | } |
| 5223 | 5225 | ||
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c index 5701f3d1a169..12d961c4ebca 100644 --- a/drivers/net/ethernet/broadcom/tg3.c +++ b/drivers/net/ethernet/broadcom/tg3.c | |||
| @@ -3034,6 +3034,7 @@ static bool tg3_phy_led_bug(struct tg3 *tp) | |||
| 3034 | { | 3034 | { |
| 3035 | switch (tg3_asic_rev(tp)) { | 3035 | switch (tg3_asic_rev(tp)) { |
| 3036 | case ASIC_REV_5719: | 3036 | case ASIC_REV_5719: |
| 3037 | case ASIC_REV_5720: | ||
| 3037 | if ((tp->phy_flags & TG3_PHYFLG_MII_SERDES) && | 3038 | if ((tp->phy_flags & TG3_PHYFLG_MII_SERDES) && |
| 3038 | !tp->pci_fn) | 3039 | !tp->pci_fn) |
| 3039 | return true; | 3040 | return true; |
| @@ -16192,12 +16193,12 @@ static int tg3_get_invariants(struct tg3 *tp, const struct pci_device_id *ent) | |||
| 16192 | * So explicitly force the chip into D0 here. | 16193 | * So explicitly force the chip into D0 here. |
| 16193 | */ | 16194 | */ |
| 16194 | pci_read_config_dword(tp->pdev, | 16195 | pci_read_config_dword(tp->pdev, |
| 16195 | tp->pm_cap + PCI_PM_CTRL, | 16196 | tp->pdev->pm_cap + PCI_PM_CTRL, |
| 16196 | &pm_reg); | 16197 | &pm_reg); |
| 16197 | pm_reg &= ~PCI_PM_CTRL_STATE_MASK; | 16198 | pm_reg &= ~PCI_PM_CTRL_STATE_MASK; |
| 16198 | pm_reg |= PCI_PM_CTRL_PME_ENABLE | 0 /* D0 */; | 16199 | pm_reg |= PCI_PM_CTRL_PME_ENABLE | 0 /* D0 */; |
| 16199 | pci_write_config_dword(tp->pdev, | 16200 | pci_write_config_dword(tp->pdev, |
| 16200 | tp->pm_cap + PCI_PM_CTRL, | 16201 | tp->pdev->pm_cap + PCI_PM_CTRL, |
| 16201 | pm_reg); | 16202 | pm_reg); |
| 16202 | 16203 | ||
| 16203 | /* Also, force SERR#/PERR# in PCI command. */ | 16204 | /* Also, force SERR#/PERR# in PCI command. */ |
| @@ -17346,7 +17347,6 @@ static int tg3_init_one(struct pci_dev *pdev, | |||
| 17346 | tp = netdev_priv(dev); | 17347 | tp = netdev_priv(dev); |
| 17347 | tp->pdev = pdev; | 17348 | tp->pdev = pdev; |
| 17348 | tp->dev = dev; | 17349 | tp->dev = dev; |
| 17349 | tp->pm_cap = pdev->pm_cap; | ||
| 17350 | tp->rx_mode = TG3_DEF_RX_MODE; | 17350 | tp->rx_mode = TG3_DEF_RX_MODE; |
| 17351 | tp->tx_mode = TG3_DEF_TX_MODE; | 17351 | tp->tx_mode = TG3_DEF_TX_MODE; |
| 17352 | tp->irq_sync = 1; | 17352 | tp->irq_sync = 1; |
diff --git a/drivers/net/ethernet/broadcom/tg3.h b/drivers/net/ethernet/broadcom/tg3.h index ddb8be1298ea..70257808aa37 100644 --- a/drivers/net/ethernet/broadcom/tg3.h +++ b/drivers/net/ethernet/broadcom/tg3.h | |||
| @@ -3234,7 +3234,6 @@ struct tg3 { | |||
| 3234 | u8 pci_lat_timer; | 3234 | u8 pci_lat_timer; |
| 3235 | 3235 | ||
| 3236 | int pci_fn; | 3236 | int pci_fn; |
| 3237 | int pm_cap; | ||
| 3238 | int msi_cap; | 3237 | int msi_cap; |
| 3239 | int pcix_cap; | 3238 | int pcix_cap; |
| 3240 | int pcie_readrq; | 3239 | int pcie_readrq; |
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c index 0d0665ca6f19..c73cabdbd4c0 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | |||
| @@ -6149,8 +6149,10 @@ static int __init cxgb4_init_module(void) | |||
| 6149 | pr_warn("could not create debugfs entry, continuing\n"); | 6149 | pr_warn("could not create debugfs entry, continuing\n"); |
| 6150 | 6150 | ||
| 6151 | ret = pci_register_driver(&cxgb4_driver); | 6151 | ret = pci_register_driver(&cxgb4_driver); |
| 6152 | if (ret < 0) | 6152 | if (ret < 0) { |
| 6153 | debugfs_remove(cxgb4_debugfs_root); | 6153 | debugfs_remove(cxgb4_debugfs_root); |
| 6154 | destroy_workqueue(workq); | ||
| 6155 | } | ||
| 6154 | 6156 | ||
| 6155 | register_inet6addr_notifier(&cxgb4_inet6addr_notifier); | 6157 | register_inet6addr_notifier(&cxgb4_inet6addr_notifier); |
| 6156 | 6158 | ||
diff --git a/drivers/net/ethernet/dec/tulip/de4x5.c b/drivers/net/ethernet/dec/tulip/de4x5.c index 2db6c573cec7..263b92c00cbf 100644 --- a/drivers/net/ethernet/dec/tulip/de4x5.c +++ b/drivers/net/ethernet/dec/tulip/de4x5.c | |||
| @@ -1321,7 +1321,7 @@ de4x5_open(struct net_device *dev) | |||
| 1321 | if (request_irq(dev->irq, de4x5_interrupt, IRQF_SHARED, | 1321 | if (request_irq(dev->irq, de4x5_interrupt, IRQF_SHARED, |
| 1322 | lp->adapter_name, dev)) { | 1322 | lp->adapter_name, dev)) { |
| 1323 | printk("de4x5_open(): Requested IRQ%d is busy - attemping FAST/SHARE...", dev->irq); | 1323 | printk("de4x5_open(): Requested IRQ%d is busy - attemping FAST/SHARE...", dev->irq); |
| 1324 | if (request_irq(dev->irq, de4x5_interrupt, IRQF_DISABLED | IRQF_SHARED, | 1324 | if (request_irq(dev->irq, de4x5_interrupt, IRQF_SHARED, |
| 1325 | lp->adapter_name, dev)) { | 1325 | lp->adapter_name, dev)) { |
| 1326 | printk("\n Cannot get IRQ- reconfigure your hardware.\n"); | 1326 | printk("\n Cannot get IRQ- reconfigure your hardware.\n"); |
| 1327 | disable_ast(dev); | 1327 | disable_ast(dev); |
diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c index 3224d28cdad4..100b528b9bd0 100644 --- a/drivers/net/ethernet/emulex/benet/be_main.c +++ b/drivers/net/ethernet/emulex/benet/be_main.c | |||
| @@ -2802,7 +2802,7 @@ static int be_vfs_if_create(struct be_adapter *adapter) | |||
| 2802 | struct be_resources res = {0}; | 2802 | struct be_resources res = {0}; |
| 2803 | struct be_vf_cfg *vf_cfg; | 2803 | struct be_vf_cfg *vf_cfg; |
| 2804 | u32 cap_flags, en_flags, vf; | 2804 | u32 cap_flags, en_flags, vf; |
| 2805 | int status; | 2805 | int status = 0; |
| 2806 | 2806 | ||
| 2807 | cap_flags = BE_IF_FLAGS_UNTAGGED | BE_IF_FLAGS_BROADCAST | | 2807 | cap_flags = BE_IF_FLAGS_UNTAGGED | BE_IF_FLAGS_BROADCAST | |
| 2808 | BE_IF_FLAGS_MULTICAST; | 2808 | BE_IF_FLAGS_MULTICAST; |
diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c index f9aacf5d8523..b2793b91cc55 100644 --- a/drivers/net/ethernet/freescale/fec_main.c +++ b/drivers/net/ethernet/freescale/fec_main.c | |||
| @@ -2199,7 +2199,7 @@ fec_probe(struct platform_device *pdev) | |||
| 2199 | goto failed_irq; | 2199 | goto failed_irq; |
| 2200 | } | 2200 | } |
| 2201 | ret = devm_request_irq(&pdev->dev, irq, fec_enet_interrupt, | 2201 | ret = devm_request_irq(&pdev->dev, irq, fec_enet_interrupt, |
| 2202 | IRQF_DISABLED, pdev->name, ndev); | 2202 | 0, pdev->name, ndev); |
| 2203 | if (ret) | 2203 | if (ret) |
| 2204 | goto failed_irq; | 2204 | goto failed_irq; |
| 2205 | } | 2205 | } |
diff --git a/drivers/net/ethernet/hp/hp100.c b/drivers/net/ethernet/hp/hp100.c index e3c7c697fc45..91227d03274e 100644 --- a/drivers/net/ethernet/hp/hp100.c +++ b/drivers/net/ethernet/hp/hp100.c | |||
| @@ -1097,7 +1097,7 @@ static int hp100_open(struct net_device *dev) | |||
| 1097 | /* New: if bus is PCI or EISA, interrupts might be shared interrupts */ | 1097 | /* New: if bus is PCI or EISA, interrupts might be shared interrupts */ |
| 1098 | if (request_irq(dev->irq, hp100_interrupt, | 1098 | if (request_irq(dev->irq, hp100_interrupt, |
| 1099 | lp->bus == HP100_BUS_PCI || lp->bus == | 1099 | lp->bus == HP100_BUS_PCI || lp->bus == |
| 1100 | HP100_BUS_EISA ? IRQF_SHARED : IRQF_DISABLED, | 1100 | HP100_BUS_EISA ? IRQF_SHARED : 0, |
| 1101 | "hp100", dev)) { | 1101 | "hp100", dev)) { |
| 1102 | printk("hp100: %s: unable to get IRQ %d\n", dev->name, dev->irq); | 1102 | printk("hp100: %s: unable to get IRQ %d\n", dev->name, dev->irq); |
| 1103 | return -EAGAIN; | 1103 | return -EAGAIN; |
diff --git a/drivers/net/ethernet/ibm/ehea/ehea_main.c b/drivers/net/ethernet/ibm/ehea/ehea_main.c index 35853b43d66e..2d1c6bdd3618 100644 --- a/drivers/net/ethernet/ibm/ehea/ehea_main.c +++ b/drivers/net/ethernet/ibm/ehea/ehea_main.c | |||
| @@ -102,6 +102,19 @@ static int ehea_probe_adapter(struct platform_device *dev); | |||
| 102 | 102 | ||
| 103 | static int ehea_remove(struct platform_device *dev); | 103 | static int ehea_remove(struct platform_device *dev); |
| 104 | 104 | ||
| 105 | static struct of_device_id ehea_module_device_table[] = { | ||
| 106 | { | ||
| 107 | .name = "lhea", | ||
| 108 | .compatible = "IBM,lhea", | ||
| 109 | }, | ||
| 110 | { | ||
| 111 | .type = "network", | ||
| 112 | .compatible = "IBM,lhea-ethernet", | ||
| 113 | }, | ||
| 114 | {}, | ||
| 115 | }; | ||
| 116 | MODULE_DEVICE_TABLE(of, ehea_module_device_table); | ||
| 117 | |||
| 105 | static struct of_device_id ehea_device_table[] = { | 118 | static struct of_device_id ehea_device_table[] = { |
| 106 | { | 119 | { |
| 107 | .name = "lhea", | 120 | .name = "lhea", |
| @@ -109,7 +122,6 @@ static struct of_device_id ehea_device_table[] = { | |||
| 109 | }, | 122 | }, |
| 110 | {}, | 123 | {}, |
| 111 | }; | 124 | }; |
| 112 | MODULE_DEVICE_TABLE(of, ehea_device_table); | ||
| 113 | 125 | ||
| 114 | static struct platform_driver ehea_driver = { | 126 | static struct platform_driver ehea_driver = { |
| 115 | .driver = { | 127 | .driver = { |
| @@ -1285,7 +1297,7 @@ static int ehea_reg_interrupts(struct net_device *dev) | |||
| 1285 | 1297 | ||
| 1286 | ret = ibmebus_request_irq(port->qp_eq->attr.ist1, | 1298 | ret = ibmebus_request_irq(port->qp_eq->attr.ist1, |
| 1287 | ehea_qp_aff_irq_handler, | 1299 | ehea_qp_aff_irq_handler, |
| 1288 | IRQF_DISABLED, port->int_aff_name, port); | 1300 | 0, port->int_aff_name, port); |
| 1289 | if (ret) { | 1301 | if (ret) { |
| 1290 | netdev_err(dev, "failed registering irq for qp_aff_irq_handler:ist=%X\n", | 1302 | netdev_err(dev, "failed registering irq for qp_aff_irq_handler:ist=%X\n", |
| 1291 | port->qp_eq->attr.ist1); | 1303 | port->qp_eq->attr.ist1); |
| @@ -1303,8 +1315,7 @@ static int ehea_reg_interrupts(struct net_device *dev) | |||
| 1303 | "%s-queue%d", dev->name, i); | 1315 | "%s-queue%d", dev->name, i); |
| 1304 | ret = ibmebus_request_irq(pr->eq->attr.ist1, | 1316 | ret = ibmebus_request_irq(pr->eq->attr.ist1, |
| 1305 | ehea_recv_irq_handler, | 1317 | ehea_recv_irq_handler, |
| 1306 | IRQF_DISABLED, pr->int_send_name, | 1318 | 0, pr->int_send_name, pr); |
| 1307 | pr); | ||
| 1308 | if (ret) { | 1319 | if (ret) { |
| 1309 | netdev_err(dev, "failed registering irq for ehea_queue port_res_nr:%d, ist=%X\n", | 1320 | netdev_err(dev, "failed registering irq for ehea_queue port_res_nr:%d, ist=%X\n", |
| 1310 | i, pr->eq->attr.ist1); | 1321 | i, pr->eq->attr.ist1); |
| @@ -3320,7 +3331,7 @@ static int ehea_probe_adapter(struct platform_device *dev) | |||
| 3320 | } | 3331 | } |
| 3321 | 3332 | ||
| 3322 | ret = ibmebus_request_irq(adapter->neq->attr.ist1, | 3333 | ret = ibmebus_request_irq(adapter->neq->attr.ist1, |
| 3323 | ehea_interrupt_neq, IRQF_DISABLED, | 3334 | ehea_interrupt_neq, 0, |
| 3324 | "ehea_neq", adapter); | 3335 | "ehea_neq", adapter); |
| 3325 | if (ret) { | 3336 | if (ret) { |
| 3326 | dev_err(&dev->dev, "requesting NEQ IRQ failed\n"); | 3337 | dev_err(&dev->dev, "requesting NEQ IRQ failed\n"); |
diff --git a/drivers/net/ethernet/intel/e1000e/ethtool.c b/drivers/net/ethernet/intel/e1000e/ethtool.c index a8633b8f0ac5..d14c8f53384c 100644 --- a/drivers/net/ethernet/intel/e1000e/ethtool.c +++ b/drivers/net/ethernet/intel/e1000e/ethtool.c | |||
| @@ -922,6 +922,14 @@ static int e1000_reg_test(struct e1000_adapter *adapter, u64 *data) | |||
| 922 | else | 922 | else |
| 923 | mask &= ~(1 << 30); | 923 | mask &= ~(1 << 30); |
| 924 | } | 924 | } |
| 925 | if (mac->type == e1000_pch2lan) { | ||
| 926 | /* SHRAH[0,1,2] different than previous */ | ||
| 927 | if (i == 7) | ||
| 928 | mask &= 0xFFF4FFFF; | ||
| 929 | /* SHRAH[3] different than SHRAH[0,1,2] */ | ||
| 930 | if (i == 10) | ||
| 931 | mask |= (1 << 30); | ||
| 932 | } | ||
| 925 | 933 | ||
| 926 | REG_PATTERN_TEST_ARRAY(E1000_RA, ((i << 1) + 1), mask, | 934 | REG_PATTERN_TEST_ARRAY(E1000_RA, ((i << 1) + 1), mask, |
| 927 | 0xFFFFFFFF); | 935 | 0xFFFFFFFF); |
diff --git a/drivers/net/ethernet/intel/e1000e/ich8lan.c b/drivers/net/ethernet/intel/e1000e/ich8lan.c index af08188d7e62..42f0f6717511 100644 --- a/drivers/net/ethernet/intel/e1000e/ich8lan.c +++ b/drivers/net/ethernet/intel/e1000e/ich8lan.c | |||
| @@ -1371,7 +1371,10 @@ static void e1000_rar_set_pch2lan(struct e1000_hw *hw, u8 *addr, u32 index) | |||
| 1371 | return; | 1371 | return; |
| 1372 | } | 1372 | } |
| 1373 | 1373 | ||
| 1374 | if (index < hw->mac.rar_entry_count) { | 1374 | /* RAR[1-6] are owned by manageability. Skip those and program the |
| 1375 | * next address into the SHRA register array. | ||
| 1376 | */ | ||
| 1377 | if (index < (u32)(hw->mac.rar_entry_count - 6)) { | ||
| 1375 | s32 ret_val; | 1378 | s32 ret_val; |
| 1376 | 1379 | ||
| 1377 | ret_val = e1000_acquire_swflag_ich8lan(hw); | 1380 | ret_val = e1000_acquire_swflag_ich8lan(hw); |
| @@ -1962,8 +1965,8 @@ void e1000_copy_rx_addrs_to_phy_ich8lan(struct e1000_hw *hw) | |||
| 1962 | if (ret_val) | 1965 | if (ret_val) |
| 1963 | goto release; | 1966 | goto release; |
| 1964 | 1967 | ||
| 1965 | /* Copy both RAL/H (rar_entry_count) and SHRAL/H (+4) to PHY */ | 1968 | /* Copy both RAL/H (rar_entry_count) and SHRAL/H to PHY */ |
| 1966 | for (i = 0; i < (hw->mac.rar_entry_count + 4); i++) { | 1969 | for (i = 0; i < (hw->mac.rar_entry_count); i++) { |
| 1967 | mac_reg = er32(RAL(i)); | 1970 | mac_reg = er32(RAL(i)); |
| 1968 | hw->phy.ops.write_reg_page(hw, BM_RAR_L(i), | 1971 | hw->phy.ops.write_reg_page(hw, BM_RAR_L(i), |
| 1969 | (u16)(mac_reg & 0xFFFF)); | 1972 | (u16)(mac_reg & 0xFFFF)); |
| @@ -2007,10 +2010,10 @@ s32 e1000_lv_jumbo_workaround_ich8lan(struct e1000_hw *hw, bool enable) | |||
| 2007 | return ret_val; | 2010 | return ret_val; |
| 2008 | 2011 | ||
| 2009 | if (enable) { | 2012 | if (enable) { |
| 2010 | /* Write Rx addresses (rar_entry_count for RAL/H, +4 for | 2013 | /* Write Rx addresses (rar_entry_count for RAL/H, and |
| 2011 | * SHRAL/H) and initial CRC values to the MAC | 2014 | * SHRAL/H) and initial CRC values to the MAC |
| 2012 | */ | 2015 | */ |
| 2013 | for (i = 0; i < (hw->mac.rar_entry_count + 4); i++) { | 2016 | for (i = 0; i < hw->mac.rar_entry_count; i++) { |
| 2014 | u8 mac_addr[ETH_ALEN] = { 0 }; | 2017 | u8 mac_addr[ETH_ALEN] = { 0 }; |
| 2015 | u32 addr_high, addr_low; | 2018 | u32 addr_high, addr_low; |
| 2016 | 2019 | ||
diff --git a/drivers/net/ethernet/intel/e1000e/ich8lan.h b/drivers/net/ethernet/intel/e1000e/ich8lan.h index 59865695b282..217090df33e7 100644 --- a/drivers/net/ethernet/intel/e1000e/ich8lan.h +++ b/drivers/net/ethernet/intel/e1000e/ich8lan.h | |||
| @@ -98,7 +98,7 @@ | |||
| 98 | #define PCIE_ICH8_SNOOP_ALL PCIE_NO_SNOOP_ALL | 98 | #define PCIE_ICH8_SNOOP_ALL PCIE_NO_SNOOP_ALL |
| 99 | 99 | ||
| 100 | #define E1000_ICH_RAR_ENTRIES 7 | 100 | #define E1000_ICH_RAR_ENTRIES 7 |
| 101 | #define E1000_PCH2_RAR_ENTRIES 5 /* RAR[0], SHRA[0-3] */ | 101 | #define E1000_PCH2_RAR_ENTRIES 11 /* RAR[0-6], SHRA[0-3] */ |
| 102 | #define E1000_PCH_LPT_RAR_ENTRIES 12 /* RAR[0], SHRA[0-10] */ | 102 | #define E1000_PCH_LPT_RAR_ENTRIES 12 /* RAR[0], SHRA[0-10] */ |
| 103 | 103 | ||
| 104 | #define PHY_PAGE_SHIFT 5 | 104 | #define PHY_PAGE_SHIFT 5 |
diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c index e87e9b01f404..4ef786775acb 100644 --- a/drivers/net/ethernet/intel/e1000e/netdev.c +++ b/drivers/net/ethernet/intel/e1000e/netdev.c | |||
| @@ -4868,7 +4868,7 @@ static void e1000_watchdog_task(struct work_struct *work) | |||
| 4868 | */ | 4868 | */ |
| 4869 | if ((hw->phy.type == e1000_phy_igp_3 || | 4869 | if ((hw->phy.type == e1000_phy_igp_3 || |
| 4870 | hw->phy.type == e1000_phy_bm) && | 4870 | hw->phy.type == e1000_phy_bm) && |
| 4871 | (hw->mac.autoneg == true) && | 4871 | hw->mac.autoneg && |
| 4872 | (adapter->link_speed == SPEED_10 || | 4872 | (adapter->link_speed == SPEED_10 || |
| 4873 | adapter->link_speed == SPEED_100) && | 4873 | adapter->link_speed == SPEED_100) && |
| 4874 | (adapter->link_duplex == HALF_DUPLEX)) { | 4874 | (adapter->link_duplex == HALF_DUPLEX)) { |
diff --git a/drivers/net/ethernet/intel/igb/e1000_82575.c b/drivers/net/ethernet/intel/igb/e1000_82575.c index 79b58353d849..47c2d10df826 100644 --- a/drivers/net/ethernet/intel/igb/e1000_82575.c +++ b/drivers/net/ethernet/intel/igb/e1000_82575.c | |||
| @@ -719,6 +719,10 @@ static s32 igb_get_phy_id_82575(struct e1000_hw *hw) | |||
| 719 | u32 ctrl_ext; | 719 | u32 ctrl_ext; |
| 720 | u32 mdic; | 720 | u32 mdic; |
| 721 | 721 | ||
| 722 | /* Extra read required for some PHY's on i354 */ | ||
| 723 | if (hw->mac.type == e1000_i354) | ||
| 724 | igb_get_phy_id(hw); | ||
| 725 | |||
| 722 | /* For SGMII PHYs, we try the list of possible addresses until | 726 | /* For SGMII PHYs, we try the list of possible addresses until |
| 723 | * we find one that works. For non-SGMII PHYs | 727 | * we find one that works. For non-SGMII PHYs |
| 724 | * (e.g. integrated copper PHYs), an address of 1 should | 728 | * (e.g. integrated copper PHYs), an address of 1 should |
diff --git a/drivers/net/ethernet/intel/igb/e1000_mac.c b/drivers/net/ethernet/intel/igb/e1000_mac.c index f0dfd41dd4bd..298f0ed50670 100644 --- a/drivers/net/ethernet/intel/igb/e1000_mac.c +++ b/drivers/net/ethernet/intel/igb/e1000_mac.c | |||
| @@ -712,6 +712,7 @@ static s32 igb_set_fc_watermarks(struct e1000_hw *hw) | |||
| 712 | static s32 igb_set_default_fc(struct e1000_hw *hw) | 712 | static s32 igb_set_default_fc(struct e1000_hw *hw) |
| 713 | { | 713 | { |
| 714 | s32 ret_val = 0; | 714 | s32 ret_val = 0; |
| 715 | u16 lan_offset; | ||
| 715 | u16 nvm_data; | 716 | u16 nvm_data; |
| 716 | 717 | ||
| 717 | /* Read and store word 0x0F of the EEPROM. This word contains bits | 718 | /* Read and store word 0x0F of the EEPROM. This word contains bits |
| @@ -722,7 +723,14 @@ static s32 igb_set_default_fc(struct e1000_hw *hw) | |||
| 722 | * control setting, then the variable hw->fc will | 723 | * control setting, then the variable hw->fc will |
| 723 | * be initialized based on a value in the EEPROM. | 724 | * be initialized based on a value in the EEPROM. |
| 724 | */ | 725 | */ |
| 725 | ret_val = hw->nvm.ops.read(hw, NVM_INIT_CONTROL2_REG, 1, &nvm_data); | 726 | if (hw->mac.type == e1000_i350) { |
| 727 | lan_offset = NVM_82580_LAN_FUNC_OFFSET(hw->bus.func); | ||
| 728 | ret_val = hw->nvm.ops.read(hw, NVM_INIT_CONTROL2_REG | ||
| 729 | + lan_offset, 1, &nvm_data); | ||
| 730 | } else { | ||
| 731 | ret_val = hw->nvm.ops.read(hw, NVM_INIT_CONTROL2_REG, | ||
| 732 | 1, &nvm_data); | ||
| 733 | } | ||
| 726 | 734 | ||
| 727 | if (ret_val) { | 735 | if (ret_val) { |
| 728 | hw_dbg("NVM Read Error\n"); | 736 | hw_dbg("NVM Read Error\n"); |
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c index 0e1b973659b0..e8649abf97c0 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c | |||
| @@ -160,6 +160,13 @@ static int ixgbe_get_settings(struct net_device *netdev, | |||
| 160 | bool autoneg = false; | 160 | bool autoneg = false; |
| 161 | bool link_up; | 161 | bool link_up; |
| 162 | 162 | ||
| 163 | /* SFP type is needed for get_link_capabilities */ | ||
| 164 | if (hw->phy.media_type & (ixgbe_media_type_fiber | | ||
| 165 | ixgbe_media_type_fiber_qsfp)) { | ||
| 166 | if (hw->phy.sfp_type == ixgbe_sfp_type_not_present) | ||
| 167 | hw->phy.ops.identify_sfp(hw); | ||
| 168 | } | ||
| 169 | |||
| 163 | hw->mac.ops.get_link_capabilities(hw, &supported_link, &autoneg); | 170 | hw->mac.ops.get_link_capabilities(hw, &supported_link, &autoneg); |
| 164 | 171 | ||
| 165 | /* set the supported link speeds */ | 172 | /* set the supported link speeds */ |
| @@ -186,6 +193,11 @@ static int ixgbe_get_settings(struct net_device *netdev, | |||
| 186 | ecmd->advertising |= ADVERTISED_1000baseT_Full; | 193 | ecmd->advertising |= ADVERTISED_1000baseT_Full; |
| 187 | if (supported_link & IXGBE_LINK_SPEED_100_FULL) | 194 | if (supported_link & IXGBE_LINK_SPEED_100_FULL) |
| 188 | ecmd->advertising |= ADVERTISED_100baseT_Full; | 195 | ecmd->advertising |= ADVERTISED_100baseT_Full; |
| 196 | |||
| 197 | if (hw->phy.multispeed_fiber && !autoneg) { | ||
| 198 | if (supported_link & IXGBE_LINK_SPEED_10GB_FULL) | ||
| 199 | ecmd->advertising = ADVERTISED_10000baseT_Full; | ||
| 200 | } | ||
| 189 | } | 201 | } |
| 190 | 202 | ||
| 191 | if (autoneg) { | 203 | if (autoneg) { |
| @@ -314,6 +326,14 @@ static int ixgbe_set_settings(struct net_device *netdev, | |||
| 314 | if (ecmd->advertising & ~ecmd->supported) | 326 | if (ecmd->advertising & ~ecmd->supported) |
| 315 | return -EINVAL; | 327 | return -EINVAL; |
| 316 | 328 | ||
| 329 | /* only allow one speed at a time if no autoneg */ | ||
| 330 | if (!ecmd->autoneg && hw->phy.multispeed_fiber) { | ||
| 331 | if (ecmd->advertising == | ||
| 332 | (ADVERTISED_10000baseT_Full | | ||
| 333 | ADVERTISED_1000baseT_Full)) | ||
| 334 | return -EINVAL; | ||
| 335 | } | ||
| 336 | |||
| 317 | old = hw->phy.autoneg_advertised; | 337 | old = hw->phy.autoneg_advertised; |
| 318 | advertised = 0; | 338 | advertised = 0; |
| 319 | if (ecmd->advertising & ADVERTISED_10000baseT_Full) | 339 | if (ecmd->advertising & ADVERTISED_10000baseT_Full) |
| @@ -1805,6 +1825,10 @@ static int ixgbe_run_loopback_test(struct ixgbe_adapter *adapter) | |||
| 1805 | unsigned int size = 1024; | 1825 | unsigned int size = 1024; |
| 1806 | netdev_tx_t tx_ret_val; | 1826 | netdev_tx_t tx_ret_val; |
| 1807 | struct sk_buff *skb; | 1827 | struct sk_buff *skb; |
| 1828 | u32 flags_orig = adapter->flags; | ||
| 1829 | |||
| 1830 | /* DCB can modify the frames on Tx */ | ||
| 1831 | adapter->flags &= ~IXGBE_FLAG_DCB_ENABLED; | ||
| 1808 | 1832 | ||
| 1809 | /* allocate test skb */ | 1833 | /* allocate test skb */ |
| 1810 | skb = alloc_skb(size, GFP_KERNEL); | 1834 | skb = alloc_skb(size, GFP_KERNEL); |
| @@ -1857,6 +1881,7 @@ static int ixgbe_run_loopback_test(struct ixgbe_adapter *adapter) | |||
| 1857 | 1881 | ||
| 1858 | /* free the original skb */ | 1882 | /* free the original skb */ |
| 1859 | kfree_skb(skb); | 1883 | kfree_skb(skb); |
| 1884 | adapter->flags = flags_orig; | ||
| 1860 | 1885 | ||
| 1861 | return ret_val; | 1886 | return ret_val; |
| 1862 | } | 1887 | } |
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c index 7aba452833e5..0ade0cd5ef53 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | |||
| @@ -3571,7 +3571,7 @@ static void ixgbe_configure_rx(struct ixgbe_adapter *adapter) | |||
| 3571 | { | 3571 | { |
| 3572 | struct ixgbe_hw *hw = &adapter->hw; | 3572 | struct ixgbe_hw *hw = &adapter->hw; |
| 3573 | int i; | 3573 | int i; |
| 3574 | u32 rxctrl; | 3574 | u32 rxctrl, rfctl; |
| 3575 | 3575 | ||
| 3576 | /* disable receives while setting up the descriptors */ | 3576 | /* disable receives while setting up the descriptors */ |
| 3577 | rxctrl = IXGBE_READ_REG(hw, IXGBE_RXCTRL); | 3577 | rxctrl = IXGBE_READ_REG(hw, IXGBE_RXCTRL); |
| @@ -3580,6 +3580,13 @@ static void ixgbe_configure_rx(struct ixgbe_adapter *adapter) | |||
| 3580 | ixgbe_setup_psrtype(adapter); | 3580 | ixgbe_setup_psrtype(adapter); |
| 3581 | ixgbe_setup_rdrxctl(adapter); | 3581 | ixgbe_setup_rdrxctl(adapter); |
| 3582 | 3582 | ||
| 3583 | /* RSC Setup */ | ||
| 3584 | rfctl = IXGBE_READ_REG(hw, IXGBE_RFCTL); | ||
| 3585 | rfctl &= ~IXGBE_RFCTL_RSC_DIS; | ||
| 3586 | if (!(adapter->flags2 & IXGBE_FLAG2_RSC_ENABLED)) | ||
| 3587 | rfctl |= IXGBE_RFCTL_RSC_DIS; | ||
| 3588 | IXGBE_WRITE_REG(hw, IXGBE_RFCTL, rfctl); | ||
| 3589 | |||
| 3583 | /* Program registers for the distribution of queues */ | 3590 | /* Program registers for the distribution of queues */ |
| 3584 | ixgbe_setup_mrqc(adapter); | 3591 | ixgbe_setup_mrqc(adapter); |
| 3585 | 3592 | ||
| @@ -5993,8 +6000,16 @@ static void ixgbe_sfp_link_config_subtask(struct ixgbe_adapter *adapter) | |||
| 5993 | adapter->flags &= ~IXGBE_FLAG_NEED_LINK_CONFIG; | 6000 | adapter->flags &= ~IXGBE_FLAG_NEED_LINK_CONFIG; |
| 5994 | 6001 | ||
| 5995 | speed = hw->phy.autoneg_advertised; | 6002 | speed = hw->phy.autoneg_advertised; |
| 5996 | if ((!speed) && (hw->mac.ops.get_link_capabilities)) | 6003 | if ((!speed) && (hw->mac.ops.get_link_capabilities)) { |
| 5997 | hw->mac.ops.get_link_capabilities(hw, &speed, &autoneg); | 6004 | hw->mac.ops.get_link_capabilities(hw, &speed, &autoneg); |
| 6005 | |||
| 6006 | /* setup the highest link when no autoneg */ | ||
| 6007 | if (!autoneg) { | ||
| 6008 | if (speed & IXGBE_LINK_SPEED_10GB_FULL) | ||
| 6009 | speed = IXGBE_LINK_SPEED_10GB_FULL; | ||
| 6010 | } | ||
| 6011 | } | ||
| 6012 | |||
| 5998 | if (hw->mac.ops.setup_link) | 6013 | if (hw->mac.ops.setup_link) |
| 5999 | hw->mac.ops.setup_link(hw, speed, true); | 6014 | hw->mac.ops.setup_link(hw, speed, true); |
| 6000 | 6015 | ||
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_type.h b/drivers/net/ethernet/intel/ixgbe/ixgbe_type.h index 6442cf8f9dce..10775cb9b6d8 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_type.h +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_type.h | |||
| @@ -1861,6 +1861,7 @@ enum { | |||
| 1861 | #define IXGBE_RFCTL_ISCSI_DIS 0x00000001 | 1861 | #define IXGBE_RFCTL_ISCSI_DIS 0x00000001 |
| 1862 | #define IXGBE_RFCTL_ISCSI_DWC_MASK 0x0000003E | 1862 | #define IXGBE_RFCTL_ISCSI_DWC_MASK 0x0000003E |
| 1863 | #define IXGBE_RFCTL_ISCSI_DWC_SHIFT 1 | 1863 | #define IXGBE_RFCTL_ISCSI_DWC_SHIFT 1 |
| 1864 | #define IXGBE_RFCTL_RSC_DIS 0x00000020 | ||
| 1864 | #define IXGBE_RFCTL_NFSW_DIS 0x00000040 | 1865 | #define IXGBE_RFCTL_NFSW_DIS 0x00000040 |
| 1865 | #define IXGBE_RFCTL_NFSR_DIS 0x00000080 | 1866 | #define IXGBE_RFCTL_NFSR_DIS 0x00000080 |
| 1866 | #define IXGBE_RFCTL_NFS_VER_MASK 0x00000300 | 1867 | #define IXGBE_RFCTL_NFS_VER_MASK 0x00000300 |
diff --git a/drivers/net/ethernet/lantiq_etop.c b/drivers/net/ethernet/lantiq_etop.c index bfdb06860397..6a6c1f76d8e0 100644 --- a/drivers/net/ethernet/lantiq_etop.c +++ b/drivers/net/ethernet/lantiq_etop.c | |||
| @@ -282,8 +282,7 @@ ltq_etop_hw_init(struct net_device *dev) | |||
| 282 | 282 | ||
| 283 | if (IS_TX(i)) { | 283 | if (IS_TX(i)) { |
| 284 | ltq_dma_alloc_tx(&ch->dma); | 284 | ltq_dma_alloc_tx(&ch->dma); |
| 285 | request_irq(irq, ltq_etop_dma_irq, IRQF_DISABLED, | 285 | request_irq(irq, ltq_etop_dma_irq, 0, "etop_tx", priv); |
| 286 | "etop_tx", priv); | ||
| 287 | } else if (IS_RX(i)) { | 286 | } else if (IS_RX(i)) { |
| 288 | ltq_dma_alloc_rx(&ch->dma); | 287 | ltq_dma_alloc_rx(&ch->dma); |
| 289 | for (ch->dma.desc = 0; ch->dma.desc < LTQ_DESC_NUM; | 288 | for (ch->dma.desc = 0; ch->dma.desc < LTQ_DESC_NUM; |
| @@ -291,8 +290,7 @@ ltq_etop_hw_init(struct net_device *dev) | |||
| 291 | if (ltq_etop_alloc_skb(ch)) | 290 | if (ltq_etop_alloc_skb(ch)) |
| 292 | return -ENOMEM; | 291 | return -ENOMEM; |
| 293 | ch->dma.desc = 0; | 292 | ch->dma.desc = 0; |
| 294 | request_irq(irq, ltq_etop_dma_irq, IRQF_DISABLED, | 293 | request_irq(irq, ltq_etop_dma_irq, 0, "etop_rx", priv); |
| 295 | "etop_rx", priv); | ||
| 296 | } | 294 | } |
| 297 | ch->dma.irq = irq; | 295 | ch->dma.irq = irq; |
| 298 | } | 296 | } |
diff --git a/drivers/net/ethernet/marvell/pxa168_eth.c b/drivers/net/ethernet/marvell/pxa168_eth.c index 4ae0c7426010..fff62460185c 100644 --- a/drivers/net/ethernet/marvell/pxa168_eth.c +++ b/drivers/net/ethernet/marvell/pxa168_eth.c | |||
| @@ -1123,8 +1123,7 @@ static int pxa168_eth_open(struct net_device *dev) | |||
| 1123 | struct pxa168_eth_private *pep = netdev_priv(dev); | 1123 | struct pxa168_eth_private *pep = netdev_priv(dev); |
| 1124 | int err; | 1124 | int err; |
| 1125 | 1125 | ||
| 1126 | err = request_irq(dev->irq, pxa168_eth_int_handler, | 1126 | err = request_irq(dev->irq, pxa168_eth_int_handler, 0, dev->name, dev); |
| 1127 | IRQF_DISABLED, dev->name, dev); | ||
| 1128 | if (err) { | 1127 | if (err) { |
| 1129 | dev_err(&dev->dev, "can't assign irq\n"); | 1128 | dev_err(&dev->dev, "can't assign irq\n"); |
| 1130 | return -EAGAIN; | 1129 | return -EAGAIN; |
diff --git a/drivers/net/ethernet/marvell/skge.c b/drivers/net/ethernet/marvell/skge.c index ef94a591f9e5..1a9c4f6269ea 100644 --- a/drivers/net/ethernet/marvell/skge.c +++ b/drivers/net/ethernet/marvell/skge.c | |||
| @@ -3092,6 +3092,9 @@ static struct sk_buff *skge_rx_get(struct net_device *dev, | |||
| 3092 | if (!nskb) | 3092 | if (!nskb) |
| 3093 | goto resubmit; | 3093 | goto resubmit; |
| 3094 | 3094 | ||
| 3095 | skb = e->skb; | ||
| 3096 | prefetch(skb->data); | ||
| 3097 | |||
| 3095 | if (skge_rx_setup(skge, e, nskb, skge->rx_buf_size) < 0) { | 3098 | if (skge_rx_setup(skge, e, nskb, skge->rx_buf_size) < 0) { |
| 3096 | dev_kfree_skb(nskb); | 3099 | dev_kfree_skb(nskb); |
| 3097 | goto resubmit; | 3100 | goto resubmit; |
| @@ -3101,8 +3104,6 @@ static struct sk_buff *skge_rx_get(struct net_device *dev, | |||
| 3101 | dma_unmap_addr(e, mapaddr), | 3104 | dma_unmap_addr(e, mapaddr), |
| 3102 | dma_unmap_len(e, maplen), | 3105 | dma_unmap_len(e, maplen), |
| 3103 | PCI_DMA_FROMDEVICE); | 3106 | PCI_DMA_FROMDEVICE); |
| 3104 | skb = e->skb; | ||
| 3105 | prefetch(skb->data); | ||
| 3106 | } | 3107 | } |
| 3107 | 3108 | ||
| 3108 | skb_put(skb, len); | 3109 | skb_put(skb, len); |
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c index a28cd801a236..0c750985f47e 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c | |||
| @@ -53,9 +53,11 @@ static int mlx4_en_moderation_update(struct mlx4_en_priv *priv) | |||
| 53 | for (i = 0; i < priv->tx_ring_num; i++) { | 53 | for (i = 0; i < priv->tx_ring_num; i++) { |
| 54 | priv->tx_cq[i].moder_cnt = priv->tx_frames; | 54 | priv->tx_cq[i].moder_cnt = priv->tx_frames; |
| 55 | priv->tx_cq[i].moder_time = priv->tx_usecs; | 55 | priv->tx_cq[i].moder_time = priv->tx_usecs; |
| 56 | err = mlx4_en_set_cq_moder(priv, &priv->tx_cq[i]); | 56 | if (priv->port_up) { |
| 57 | if (err) | 57 | err = mlx4_en_set_cq_moder(priv, &priv->tx_cq[i]); |
| 58 | return err; | 58 | if (err) |
| 59 | return err; | ||
| 60 | } | ||
| 59 | } | 61 | } |
| 60 | 62 | ||
| 61 | if (priv->adaptive_rx_coal) | 63 | if (priv->adaptive_rx_coal) |
| @@ -65,9 +67,11 @@ static int mlx4_en_moderation_update(struct mlx4_en_priv *priv) | |||
| 65 | priv->rx_cq[i].moder_cnt = priv->rx_frames; | 67 | priv->rx_cq[i].moder_cnt = priv->rx_frames; |
| 66 | priv->rx_cq[i].moder_time = priv->rx_usecs; | 68 | priv->rx_cq[i].moder_time = priv->rx_usecs; |
| 67 | priv->last_moder_time[i] = MLX4_EN_AUTO_CONF; | 69 | priv->last_moder_time[i] = MLX4_EN_AUTO_CONF; |
| 68 | err = mlx4_en_set_cq_moder(priv, &priv->rx_cq[i]); | 70 | if (priv->port_up) { |
| 69 | if (err) | 71 | err = mlx4_en_set_cq_moder(priv, &priv->rx_cq[i]); |
| 70 | return err; | 72 | if (err) |
| 73 | return err; | ||
| 74 | } | ||
| 71 | } | 75 | } |
| 72 | 76 | ||
| 73 | return err; | 77 | return err; |
diff --git a/drivers/net/ethernet/micrel/ks8851_mll.c b/drivers/net/ethernet/micrel/ks8851_mll.c index 0fba1532d326..075f4e21d33d 100644 --- a/drivers/net/ethernet/micrel/ks8851_mll.c +++ b/drivers/net/ethernet/micrel/ks8851_mll.c | |||
| @@ -915,7 +915,7 @@ static int ks_net_open(struct net_device *netdev) | |||
| 915 | struct ks_net *ks = netdev_priv(netdev); | 915 | struct ks_net *ks = netdev_priv(netdev); |
| 916 | int err; | 916 | int err; |
| 917 | 917 | ||
| 918 | #define KS_INT_FLAGS (IRQF_DISABLED|IRQF_TRIGGER_LOW) | 918 | #define KS_INT_FLAGS IRQF_TRIGGER_LOW |
| 919 | /* lock the card, even if we may not actually do anything | 919 | /* lock the card, even if we may not actually do anything |
| 920 | * else at the moment. | 920 | * else at the moment. |
| 921 | */ | 921 | */ |
diff --git a/drivers/net/ethernet/natsemi/jazzsonic.c b/drivers/net/ethernet/natsemi/jazzsonic.c index c20766c2f65b..79257f71c5d9 100644 --- a/drivers/net/ethernet/natsemi/jazzsonic.c +++ b/drivers/net/ethernet/natsemi/jazzsonic.c | |||
| @@ -83,8 +83,7 @@ static int jazzsonic_open(struct net_device* dev) | |||
| 83 | { | 83 | { |
| 84 | int retval; | 84 | int retval; |
| 85 | 85 | ||
| 86 | retval = request_irq(dev->irq, sonic_interrupt, IRQF_DISABLED, | 86 | retval = request_irq(dev->irq, sonic_interrupt, 0, "sonic", dev); |
| 87 | "sonic", dev); | ||
| 88 | if (retval) { | 87 | if (retval) { |
| 89 | printk(KERN_ERR "%s: unable to get IRQ %d.\n", | 88 | printk(KERN_ERR "%s: unable to get IRQ %d.\n", |
| 90 | dev->name, dev->irq); | 89 | dev->name, dev->irq); |
diff --git a/drivers/net/ethernet/natsemi/xtsonic.c b/drivers/net/ethernet/natsemi/xtsonic.c index c2e0256fe3df..4da172ac5599 100644 --- a/drivers/net/ethernet/natsemi/xtsonic.c +++ b/drivers/net/ethernet/natsemi/xtsonic.c | |||
| @@ -95,8 +95,7 @@ static int xtsonic_open(struct net_device *dev) | |||
| 95 | { | 95 | { |
| 96 | int retval; | 96 | int retval; |
| 97 | 97 | ||
| 98 | retval = request_irq(dev->irq, sonic_interrupt, IRQF_DISABLED, | 98 | retval = request_irq(dev->irq, sonic_interrupt, 0, "sonic", dev); |
| 99 | "sonic", dev); | ||
| 100 | if (retval) { | 99 | if (retval) { |
| 101 | printk(KERN_ERR "%s: unable to get IRQ %d.\n", | 100 | printk(KERN_ERR "%s: unable to get IRQ %d.\n", |
| 102 | dev->name, dev->irq); | 101 | dev->name, dev->irq); |
diff --git a/drivers/net/ethernet/pasemi/pasemi_mac.c b/drivers/net/ethernet/pasemi/pasemi_mac.c index c498181a9aa8..5b65356e7568 100644 --- a/drivers/net/ethernet/pasemi/pasemi_mac.c +++ b/drivers/net/ethernet/pasemi/pasemi_mac.c | |||
| @@ -1219,7 +1219,7 @@ static int pasemi_mac_open(struct net_device *dev) | |||
| 1219 | snprintf(mac->tx_irq_name, sizeof(mac->tx_irq_name), "%s tx", | 1219 | snprintf(mac->tx_irq_name, sizeof(mac->tx_irq_name), "%s tx", |
| 1220 | dev->name); | 1220 | dev->name); |
| 1221 | 1221 | ||
| 1222 | ret = request_irq(mac->tx->chan.irq, pasemi_mac_tx_intr, IRQF_DISABLED, | 1222 | ret = request_irq(mac->tx->chan.irq, pasemi_mac_tx_intr, 0, |
| 1223 | mac->tx_irq_name, mac->tx); | 1223 | mac->tx_irq_name, mac->tx); |
| 1224 | if (ret) { | 1224 | if (ret) { |
| 1225 | dev_err(&mac->pdev->dev, "request_irq of irq %d failed: %d\n", | 1225 | dev_err(&mac->pdev->dev, "request_irq of irq %d failed: %d\n", |
| @@ -1230,7 +1230,7 @@ static int pasemi_mac_open(struct net_device *dev) | |||
| 1230 | snprintf(mac->rx_irq_name, sizeof(mac->rx_irq_name), "%s rx", | 1230 | snprintf(mac->rx_irq_name, sizeof(mac->rx_irq_name), "%s rx", |
| 1231 | dev->name); | 1231 | dev->name); |
| 1232 | 1232 | ||
| 1233 | ret = request_irq(mac->rx->chan.irq, pasemi_mac_rx_intr, IRQF_DISABLED, | 1233 | ret = request_irq(mac->rx->chan.irq, pasemi_mac_rx_intr, 0, |
| 1234 | mac->rx_irq_name, mac->rx); | 1234 | mac->rx_irq_name, mac->rx); |
| 1235 | if (ret) { | 1235 | if (ret) { |
| 1236 | dev_err(&mac->pdev->dev, "request_irq of irq %d failed: %d\n", | 1236 | dev_err(&mac->pdev->dev, "request_irq of irq %d failed: %d\n", |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c index 652cc13c5023..392b9bd12b4f 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c | |||
| @@ -1561,6 +1561,7 @@ static int qlcnic_sriov_vf_reinit_driver(struct qlcnic_adapter *adapter) | |||
| 1561 | { | 1561 | { |
| 1562 | int err; | 1562 | int err; |
| 1563 | 1563 | ||
| 1564 | adapter->need_fw_reset = 0; | ||
| 1564 | qlcnic_83xx_reinit_mbx_work(adapter->ahw->mailbox); | 1565 | qlcnic_83xx_reinit_mbx_work(adapter->ahw->mailbox); |
| 1565 | qlcnic_83xx_enable_mbx_interrupt(adapter); | 1566 | qlcnic_83xx_enable_mbx_interrupt(adapter); |
| 1566 | 1567 | ||
diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c index 6f87f2cde647..3397cee89777 100644 --- a/drivers/net/ethernet/realtek/r8169.c +++ b/drivers/net/ethernet/realtek/r8169.c | |||
| @@ -4231,6 +4231,7 @@ static void rtl_init_rxcfg(struct rtl8169_private *tp) | |||
| 4231 | case RTL_GIGA_MAC_VER_23: | 4231 | case RTL_GIGA_MAC_VER_23: |
| 4232 | case RTL_GIGA_MAC_VER_24: | 4232 | case RTL_GIGA_MAC_VER_24: |
| 4233 | case RTL_GIGA_MAC_VER_34: | 4233 | case RTL_GIGA_MAC_VER_34: |
| 4234 | case RTL_GIGA_MAC_VER_35: | ||
| 4234 | RTL_W32(RxConfig, RX128_INT_EN | RX_MULTI_EN | RX_DMA_BURST); | 4235 | RTL_W32(RxConfig, RX128_INT_EN | RX_MULTI_EN | RX_DMA_BURST); |
| 4235 | break; | 4236 | break; |
| 4236 | case RTL_GIGA_MAC_VER_40: | 4237 | case RTL_GIGA_MAC_VER_40: |
diff --git a/drivers/net/ethernet/sfc/Kconfig b/drivers/net/ethernet/sfc/Kconfig index 8b7152565c5e..088921294448 100644 --- a/drivers/net/ethernet/sfc/Kconfig +++ b/drivers/net/ethernet/sfc/Kconfig | |||
| @@ -7,7 +7,7 @@ config SFC | |||
| 7 | select I2C_ALGOBIT | 7 | select I2C_ALGOBIT |
| 8 | select PTP_1588_CLOCK | 8 | select PTP_1588_CLOCK |
| 9 | ---help--- | 9 | ---help--- |
| 10 | This driver supports 10-gigabit Ethernet cards based on | 10 | This driver supports 10/40-gigabit Ethernet cards based on |
| 11 | the Solarflare SFC4000, SFC9000-family and SFC9100-family | 11 | the Solarflare SFC4000, SFC9000-family and SFC9100-family |
| 12 | controllers. | 12 | controllers. |
| 13 | 13 | ||
diff --git a/drivers/net/ethernet/sfc/ef10.c b/drivers/net/ethernet/sfc/ef10.c index 5f42313b4965..9f18ae984f9e 100644 --- a/drivers/net/ethernet/sfc/ef10.c +++ b/drivers/net/ethernet/sfc/ef10.c | |||
| @@ -94,7 +94,7 @@ static unsigned int efx_ef10_mem_map_size(struct efx_nic *efx) | |||
| 94 | return resource_size(&efx->pci_dev->resource[EFX_MEM_BAR]); | 94 | return resource_size(&efx->pci_dev->resource[EFX_MEM_BAR]); |
| 95 | } | 95 | } |
| 96 | 96 | ||
| 97 | static int efx_ef10_init_capabilities(struct efx_nic *efx) | 97 | static int efx_ef10_init_datapath_caps(struct efx_nic *efx) |
| 98 | { | 98 | { |
| 99 | MCDI_DECLARE_BUF(outbuf, MC_CMD_GET_CAPABILITIES_OUT_LEN); | 99 | MCDI_DECLARE_BUF(outbuf, MC_CMD_GET_CAPABILITIES_OUT_LEN); |
| 100 | struct efx_ef10_nic_data *nic_data = efx->nic_data; | 100 | struct efx_ef10_nic_data *nic_data = efx->nic_data; |
| @@ -107,16 +107,27 @@ static int efx_ef10_init_capabilities(struct efx_nic *efx) | |||
| 107 | outbuf, sizeof(outbuf), &outlen); | 107 | outbuf, sizeof(outbuf), &outlen); |
| 108 | if (rc) | 108 | if (rc) |
| 109 | return rc; | 109 | return rc; |
| 110 | if (outlen < sizeof(outbuf)) { | ||
| 111 | netif_err(efx, drv, efx->net_dev, | ||
| 112 | "unable to read datapath firmware capabilities\n"); | ||
| 113 | return -EIO; | ||
| 114 | } | ||
| 110 | 115 | ||
| 111 | if (outlen >= sizeof(outbuf)) { | 116 | nic_data->datapath_caps = |
| 112 | nic_data->datapath_caps = | 117 | MCDI_DWORD(outbuf, GET_CAPABILITIES_OUT_FLAGS1); |
| 113 | MCDI_DWORD(outbuf, GET_CAPABILITIES_OUT_FLAGS1); | 118 | |
| 114 | if (!(nic_data->datapath_caps & | 119 | if (!(nic_data->datapath_caps & |
| 115 | (1 << MC_CMD_GET_CAPABILITIES_OUT_TX_TSO_LBN))) { | 120 | (1 << MC_CMD_GET_CAPABILITIES_OUT_TX_TSO_LBN))) { |
| 116 | netif_err(efx, drv, efx->net_dev, | 121 | netif_err(efx, drv, efx->net_dev, |
| 117 | "Capabilities don't indicate TSO support.\n"); | 122 | "current firmware does not support TSO\n"); |
| 118 | return -ENODEV; | 123 | return -ENODEV; |
| 119 | } | 124 | } |
| 125 | |||
| 126 | if (!(nic_data->datapath_caps & | ||
| 127 | (1 << MC_CMD_GET_CAPABILITIES_OUT_RX_PREFIX_LEN_14_LBN))) { | ||
| 128 | netif_err(efx, probe, efx->net_dev, | ||
| 129 | "current firmware does not support an RX prefix\n"); | ||
| 130 | return -ENODEV; | ||
| 120 | } | 131 | } |
| 121 | 132 | ||
| 122 | return 0; | 133 | return 0; |
| @@ -217,21 +228,13 @@ static int efx_ef10_probe(struct efx_nic *efx) | |||
| 217 | if (rc) | 228 | if (rc) |
| 218 | goto fail3; | 229 | goto fail3; |
| 219 | 230 | ||
| 220 | rc = efx_ef10_init_capabilities(efx); | 231 | rc = efx_ef10_init_datapath_caps(efx); |
| 221 | if (rc < 0) | 232 | if (rc < 0) |
| 222 | goto fail3; | 233 | goto fail3; |
| 223 | 234 | ||
| 224 | efx->rx_packet_len_offset = | 235 | efx->rx_packet_len_offset = |
| 225 | ES_DZ_RX_PREFIX_PKTLEN_OFST - ES_DZ_RX_PREFIX_SIZE; | 236 | ES_DZ_RX_PREFIX_PKTLEN_OFST - ES_DZ_RX_PREFIX_SIZE; |
| 226 | 237 | ||
| 227 | if (!(nic_data->datapath_caps & | ||
| 228 | (1 << MC_CMD_GET_CAPABILITIES_OUT_RX_PREFIX_LEN_14_LBN))) { | ||
| 229 | netif_err(efx, probe, efx->net_dev, | ||
| 230 | "current firmware does not support an RX prefix\n"); | ||
| 231 | rc = -ENODEV; | ||
| 232 | goto fail3; | ||
| 233 | } | ||
| 234 | |||
| 235 | rc = efx_mcdi_port_get_number(efx); | 238 | rc = efx_mcdi_port_get_number(efx); |
| 236 | if (rc < 0) | 239 | if (rc < 0) |
| 237 | goto fail3; | 240 | goto fail3; |
| @@ -260,8 +263,6 @@ static int efx_ef10_probe(struct efx_nic *efx) | |||
| 260 | if (rc) | 263 | if (rc) |
| 261 | goto fail3; | 264 | goto fail3; |
| 262 | 265 | ||
| 263 | efx_ptp_probe(efx); | ||
| 264 | |||
| 265 | return 0; | 266 | return 0; |
| 266 | 267 | ||
| 267 | fail3: | 268 | fail3: |
| @@ -342,6 +343,13 @@ static int efx_ef10_init_nic(struct efx_nic *efx) | |||
| 342 | struct efx_ef10_nic_data *nic_data = efx->nic_data; | 343 | struct efx_ef10_nic_data *nic_data = efx->nic_data; |
| 343 | int rc; | 344 | int rc; |
| 344 | 345 | ||
| 346 | if (nic_data->must_check_datapath_caps) { | ||
| 347 | rc = efx_ef10_init_datapath_caps(efx); | ||
| 348 | if (rc) | ||
| 349 | return rc; | ||
| 350 | nic_data->must_check_datapath_caps = false; | ||
| 351 | } | ||
| 352 | |||
| 345 | if (nic_data->must_realloc_vis) { | 353 | if (nic_data->must_realloc_vis) { |
| 346 | /* We cannot let the number of VIs change now */ | 354 | /* We cannot let the number of VIs change now */ |
| 347 | rc = efx_ef10_alloc_vis(efx, nic_data->n_allocated_vis, | 355 | rc = efx_ef10_alloc_vis(efx, nic_data->n_allocated_vis, |
| @@ -710,6 +718,14 @@ static int efx_ef10_mcdi_poll_reboot(struct efx_nic *efx) | |||
| 710 | nic_data->must_restore_filters = true; | 718 | nic_data->must_restore_filters = true; |
| 711 | nic_data->rx_rss_context = EFX_EF10_RSS_CONTEXT_INVALID; | 719 | nic_data->rx_rss_context = EFX_EF10_RSS_CONTEXT_INVALID; |
| 712 | 720 | ||
| 721 | /* The datapath firmware might have been changed */ | ||
| 722 | nic_data->must_check_datapath_caps = true; | ||
| 723 | |||
| 724 | /* MAC statistics have been cleared on the NIC; clear the local | ||
| 725 | * statistic that we update with efx_update_diff_stat(). | ||
| 726 | */ | ||
| 727 | nic_data->stats[EF10_STAT_rx_bad_bytes] = 0; | ||
| 728 | |||
| 713 | return -EIO; | 729 | return -EIO; |
| 714 | } | 730 | } |
| 715 | 731 | ||
diff --git a/drivers/net/ethernet/sfc/mcdi_port.c b/drivers/net/ethernet/sfc/mcdi_port.c index 8d33da6697fb..7b6be61d549f 100644 --- a/drivers/net/ethernet/sfc/mcdi_port.c +++ b/drivers/net/ethernet/sfc/mcdi_port.c | |||
| @@ -556,6 +556,7 @@ static int efx_mcdi_phy_set_settings(struct efx_nic *efx, struct ethtool_cmd *ec | |||
| 556 | case 100: caps = 1 << MC_CMD_PHY_CAP_100FDX_LBN; break; | 556 | case 100: caps = 1 << MC_CMD_PHY_CAP_100FDX_LBN; break; |
| 557 | case 1000: caps = 1 << MC_CMD_PHY_CAP_1000FDX_LBN; break; | 557 | case 1000: caps = 1 << MC_CMD_PHY_CAP_1000FDX_LBN; break; |
| 558 | case 10000: caps = 1 << MC_CMD_PHY_CAP_10000FDX_LBN; break; | 558 | case 10000: caps = 1 << MC_CMD_PHY_CAP_10000FDX_LBN; break; |
| 559 | case 40000: caps = 1 << MC_CMD_PHY_CAP_40000FDX_LBN; break; | ||
| 559 | default: return -EINVAL; | 560 | default: return -EINVAL; |
| 560 | } | 561 | } |
| 561 | } else { | 562 | } else { |
| @@ -841,6 +842,7 @@ static unsigned int efx_mcdi_event_link_speed[] = { | |||
| 841 | [MCDI_EVENT_LINKCHANGE_SPEED_100M] = 100, | 842 | [MCDI_EVENT_LINKCHANGE_SPEED_100M] = 100, |
| 842 | [MCDI_EVENT_LINKCHANGE_SPEED_1G] = 1000, | 843 | [MCDI_EVENT_LINKCHANGE_SPEED_1G] = 1000, |
| 843 | [MCDI_EVENT_LINKCHANGE_SPEED_10G] = 10000, | 844 | [MCDI_EVENT_LINKCHANGE_SPEED_10G] = 10000, |
| 845 | [MCDI_EVENT_LINKCHANGE_SPEED_40G] = 40000, | ||
| 844 | }; | 846 | }; |
| 845 | 847 | ||
| 846 | void efx_mcdi_process_link_change(struct efx_nic *efx, efx_qword_t *ev) | 848 | void efx_mcdi_process_link_change(struct efx_nic *efx, efx_qword_t *ev) |
diff --git a/drivers/net/ethernet/sfc/nic.h b/drivers/net/ethernet/sfc/nic.h index 4b1e188f7a2f..fda29d39032f 100644 --- a/drivers/net/ethernet/sfc/nic.h +++ b/drivers/net/ethernet/sfc/nic.h | |||
| @@ -400,6 +400,8 @@ enum { | |||
| 400 | * @rx_rss_context: Firmware handle for our RSS context | 400 | * @rx_rss_context: Firmware handle for our RSS context |
| 401 | * @stats: Hardware statistics | 401 | * @stats: Hardware statistics |
| 402 | * @workaround_35388: Flag: firmware supports workaround for bug 35388 | 402 | * @workaround_35388: Flag: firmware supports workaround for bug 35388 |
| 403 | * @must_check_datapath_caps: Flag: @datapath_caps needs to be revalidated | ||
| 404 | * after MC reboot | ||
| 403 | * @datapath_caps: Capabilities of datapath firmware (FLAGS1 field of | 405 | * @datapath_caps: Capabilities of datapath firmware (FLAGS1 field of |
| 404 | * %MC_CMD_GET_CAPABILITIES response) | 406 | * %MC_CMD_GET_CAPABILITIES response) |
| 405 | */ | 407 | */ |
| @@ -413,6 +415,7 @@ struct efx_ef10_nic_data { | |||
| 413 | u32 rx_rss_context; | 415 | u32 rx_rss_context; |
| 414 | u64 stats[EF10_STAT_COUNT]; | 416 | u64 stats[EF10_STAT_COUNT]; |
| 415 | bool workaround_35388; | 417 | bool workaround_35388; |
| 418 | bool must_check_datapath_caps; | ||
| 416 | u32 datapath_caps; | 419 | u32 datapath_caps; |
| 417 | }; | 420 | }; |
| 418 | 421 | ||
diff --git a/drivers/net/ethernet/smsc/smc91x.h b/drivers/net/ethernet/smsc/smc91x.h index 370e13dde115..5730fe2445a6 100644 --- a/drivers/net/ethernet/smsc/smc91x.h +++ b/drivers/net/ethernet/smsc/smc91x.h | |||
| @@ -271,7 +271,7 @@ static inline void mcf_outsw(void *a, unsigned char *p, int l) | |||
| 271 | #define SMC_insw(a, r, p, l) mcf_insw(a + r, p, l) | 271 | #define SMC_insw(a, r, p, l) mcf_insw(a + r, p, l) |
| 272 | #define SMC_outsw(a, r, p, l) mcf_outsw(a + r, p, l) | 272 | #define SMC_outsw(a, r, p, l) mcf_outsw(a + r, p, l) |
| 273 | 273 | ||
| 274 | #define SMC_IRQ_FLAGS (IRQF_DISABLED) | 274 | #define SMC_IRQ_FLAGS 0 |
| 275 | 275 | ||
| 276 | #else | 276 | #else |
| 277 | 277 | ||
diff --git a/drivers/net/ethernet/smsc/smsc9420.c b/drivers/net/ethernet/smsc/smsc9420.c index ffa5c4ad1210..5f9e79f7f2df 100644 --- a/drivers/net/ethernet/smsc/smsc9420.c +++ b/drivers/net/ethernet/smsc/smsc9420.c | |||
| @@ -1356,8 +1356,7 @@ static int smsc9420_open(struct net_device *dev) | |||
| 1356 | smsc9420_reg_write(pd, INT_STAT, 0xFFFFFFFF); | 1356 | smsc9420_reg_write(pd, INT_STAT, 0xFFFFFFFF); |
| 1357 | smsc9420_pci_flush_write(pd); | 1357 | smsc9420_pci_flush_write(pd); |
| 1358 | 1358 | ||
| 1359 | result = request_irq(irq, smsc9420_isr, IRQF_SHARED | IRQF_DISABLED, | 1359 | result = request_irq(irq, smsc9420_isr, IRQF_SHARED, DRV_NAME, pd); |
| 1360 | DRV_NAME, pd); | ||
| 1361 | if (result) { | 1360 | if (result) { |
| 1362 | smsc_warn(IFUP, "Unable to use IRQ = %d", irq); | 1361 | smsc_warn(IFUP, "Unable to use IRQ = %d", irq); |
| 1363 | result = -ENODEV; | 1362 | result = -ENODEV; |
diff --git a/drivers/net/ethernet/toshiba/ps3_gelic_net.c b/drivers/net/ethernet/toshiba/ps3_gelic_net.c index 9c805e0c0cae..f7f2ef49c0c1 100644 --- a/drivers/net/ethernet/toshiba/ps3_gelic_net.c +++ b/drivers/net/ethernet/toshiba/ps3_gelic_net.c | |||
| @@ -1726,7 +1726,7 @@ static int ps3_gelic_driver_probe(struct ps3_system_bus_device *dev) | |||
| 1726 | goto fail_alloc_irq; | 1726 | goto fail_alloc_irq; |
| 1727 | } | 1727 | } |
| 1728 | result = request_irq(card->irq, gelic_card_interrupt, | 1728 | result = request_irq(card->irq, gelic_card_interrupt, |
| 1729 | IRQF_DISABLED, netdev->name, card); | 1729 | 0, netdev->name, card); |
| 1730 | 1730 | ||
| 1731 | if (result) { | 1731 | if (result) { |
| 1732 | dev_info(ctodev(card), "%s:request_irq failed (%d)\n", | 1732 | dev_info(ctodev(card), "%s:request_irq failed (%d)\n", |
diff --git a/drivers/net/irda/mcs7780.c b/drivers/net/irda/mcs7780.c index f07c340990da..3f138ca88670 100644 --- a/drivers/net/irda/mcs7780.c +++ b/drivers/net/irda/mcs7780.c | |||
| @@ -191,8 +191,8 @@ static inline int mcs_setup_transceiver_vishay(struct mcs_cb *mcs) | |||
| 191 | goto error; | 191 | goto error; |
| 192 | 192 | ||
| 193 | ret = 0; | 193 | ret = 0; |
| 194 | error: | 194 | error: |
| 195 | return ret; | 195 | return ret; |
| 196 | } | 196 | } |
| 197 | 197 | ||
| 198 | /* Setup a communication between mcs7780 and agilent chip. */ | 198 | /* Setup a communication between mcs7780 and agilent chip. */ |
| @@ -501,8 +501,11 @@ static inline int mcs_setup_urbs(struct mcs_cb *mcs) | |||
| 501 | return 0; | 501 | return 0; |
| 502 | 502 | ||
| 503 | mcs->rx_urb = usb_alloc_urb(0, GFP_KERNEL); | 503 | mcs->rx_urb = usb_alloc_urb(0, GFP_KERNEL); |
| 504 | if (!mcs->rx_urb) | 504 | if (!mcs->rx_urb) { |
| 505 | usb_free_urb(mcs->tx_urb); | ||
| 506 | mcs->tx_urb = NULL; | ||
| 505 | return 0; | 507 | return 0; |
| 508 | } | ||
| 506 | 509 | ||
| 507 | return 1; | 510 | return 1; |
| 508 | } | 511 | } |
| @@ -643,9 +646,9 @@ static int mcs_speed_change(struct mcs_cb *mcs) | |||
| 643 | ret = mcs_set_reg(mcs, MCS_MODE_REG, rval); | 646 | ret = mcs_set_reg(mcs, MCS_MODE_REG, rval); |
| 644 | 647 | ||
| 645 | mcs->speed = mcs->new_speed; | 648 | mcs->speed = mcs->new_speed; |
| 646 | error: | 649 | error: |
| 647 | mcs->new_speed = 0; | 650 | mcs->new_speed = 0; |
| 648 | return ret; | 651 | return ret; |
| 649 | } | 652 | } |
| 650 | 653 | ||
| 651 | /* Ioctl calls not supported at this time. Can be an area of future work. */ | 654 | /* Ioctl calls not supported at this time. Can be an area of future work. */ |
| @@ -738,17 +741,20 @@ static int mcs_net_open(struct net_device *netdev) | |||
| 738 | 741 | ||
| 739 | ret = mcs_receive_start(mcs); | 742 | ret = mcs_receive_start(mcs); |
| 740 | if (ret) | 743 | if (ret) |
| 741 | goto error3; | 744 | goto error4; |
| 742 | 745 | ||
| 743 | netif_start_queue(netdev); | 746 | netif_start_queue(netdev); |
| 744 | return 0; | 747 | return 0; |
| 745 | 748 | ||
| 746 | error3: | 749 | error4: |
| 747 | irlap_close(mcs->irlap); | 750 | usb_free_urb(mcs->rx_urb); |
| 748 | error2: | 751 | usb_free_urb(mcs->tx_urb); |
| 749 | kfree_skb(mcs->rx_buff.skb); | 752 | error3: |
| 750 | error1: | 753 | irlap_close(mcs->irlap); |
| 751 | return ret; | 754 | error2: |
| 755 | kfree_skb(mcs->rx_buff.skb); | ||
| 756 | error1: | ||
| 757 | return ret; | ||
| 752 | } | 758 | } |
| 753 | 759 | ||
| 754 | /* Receive callback function. */ | 760 | /* Receive callback function. */ |
| @@ -946,11 +952,11 @@ static int mcs_probe(struct usb_interface *intf, | |||
| 946 | usb_set_intfdata(intf, mcs); | 952 | usb_set_intfdata(intf, mcs); |
| 947 | return 0; | 953 | return 0; |
| 948 | 954 | ||
| 949 | error2: | 955 | error2: |
| 950 | free_netdev(ndev); | 956 | free_netdev(ndev); |
| 951 | 957 | ||
| 952 | error1: | 958 | error1: |
| 953 | return ret; | 959 | return ret; |
| 954 | } | 960 | } |
| 955 | 961 | ||
| 956 | /* The current device is removed, the USB layer tells us to shut down. */ | 962 | /* The current device is removed, the USB layer tells us to shut down. */ |
diff --git a/drivers/net/loopback.c b/drivers/net/loopback.c index fcbf680c3e62..a17d85a331f1 100644 --- a/drivers/net/loopback.c +++ b/drivers/net/loopback.c | |||
| @@ -146,6 +146,7 @@ static int loopback_dev_init(struct net_device *dev) | |||
| 146 | 146 | ||
| 147 | static void loopback_dev_free(struct net_device *dev) | 147 | static void loopback_dev_free(struct net_device *dev) |
| 148 | { | 148 | { |
| 149 | dev_net(dev)->loopback_dev = NULL; | ||
| 149 | free_percpu(dev->lstats); | 150 | free_percpu(dev->lstats); |
| 150 | free_netdev(dev); | 151 | free_netdev(dev); |
| 151 | } | 152 | } |
diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c index dcb21347c670..adeee615dd19 100644 --- a/drivers/net/netconsole.c +++ b/drivers/net/netconsole.c | |||
| @@ -684,15 +684,12 @@ restart: | |||
| 684 | case NETDEV_RELEASE: | 684 | case NETDEV_RELEASE: |
| 685 | case NETDEV_JOIN: | 685 | case NETDEV_JOIN: |
| 686 | case NETDEV_UNREGISTER: | 686 | case NETDEV_UNREGISTER: |
| 687 | /* | 687 | /* rtnl_lock already held |
| 688 | * rtnl_lock already held | ||
| 689 | * we might sleep in __netpoll_cleanup() | 688 | * we might sleep in __netpoll_cleanup() |
| 690 | */ | 689 | */ |
| 691 | spin_unlock_irqrestore(&target_list_lock, flags); | 690 | spin_unlock_irqrestore(&target_list_lock, flags); |
| 692 | 691 | ||
| 693 | mutex_lock(&nt->mutex); | ||
| 694 | __netpoll_cleanup(&nt->np); | 692 | __netpoll_cleanup(&nt->np); |
| 695 | mutex_unlock(&nt->mutex); | ||
| 696 | 693 | ||
| 697 | spin_lock_irqsave(&target_list_lock, flags); | 694 | spin_lock_irqsave(&target_list_lock, flags); |
| 698 | dev_put(nt->np.dev); | 695 | dev_put(nt->np.dev); |
diff --git a/drivers/net/phy/cicada.c b/drivers/net/phy/cicada.c index db472ffb6e89..313a0377f68f 100644 --- a/drivers/net/phy/cicada.c +++ b/drivers/net/phy/cicada.c | |||
| @@ -30,9 +30,9 @@ | |||
| 30 | #include <linux/ethtool.h> | 30 | #include <linux/ethtool.h> |
| 31 | #include <linux/phy.h> | 31 | #include <linux/phy.h> |
| 32 | 32 | ||
| 33 | #include <asm/io.h> | 33 | #include <linux/io.h> |
| 34 | #include <asm/irq.h> | 34 | #include <asm/irq.h> |
| 35 | #include <asm/uaccess.h> | 35 | #include <linux/uaccess.h> |
| 36 | 36 | ||
| 37 | /* Cicada Extended Control Register 1 */ | 37 | /* Cicada Extended Control Register 1 */ |
| 38 | #define MII_CIS8201_EXT_CON1 0x17 | 38 | #define MII_CIS8201_EXT_CON1 0x17 |
diff --git a/drivers/net/ppp/pptp.c b/drivers/net/ppp/pptp.c index 6fa5ae00039f..01805319e1e0 100644 --- a/drivers/net/ppp/pptp.c +++ b/drivers/net/ppp/pptp.c | |||
| @@ -281,7 +281,7 @@ static int pptp_xmit(struct ppp_channel *chan, struct sk_buff *skb) | |||
| 281 | nf_reset(skb); | 281 | nf_reset(skb); |
| 282 | 282 | ||
| 283 | skb->ip_summed = CHECKSUM_NONE; | 283 | skb->ip_summed = CHECKSUM_NONE; |
| 284 | ip_select_ident(iph, &rt->dst, NULL); | 284 | ip_select_ident(skb, &rt->dst, NULL); |
| 285 | ip_send_check(iph); | 285 | ip_send_check(iph); |
| 286 | 286 | ||
| 287 | ip_local_out(skb); | 287 | ip_local_out(skb); |
diff --git a/drivers/net/tun.c b/drivers/net/tun.c index a639de8401f8..807815fc9968 100644 --- a/drivers/net/tun.c +++ b/drivers/net/tun.c | |||
| @@ -1641,11 +1641,11 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr) | |||
| 1641 | INIT_LIST_HEAD(&tun->disabled); | 1641 | INIT_LIST_HEAD(&tun->disabled); |
| 1642 | err = tun_attach(tun, file, false); | 1642 | err = tun_attach(tun, file, false); |
| 1643 | if (err < 0) | 1643 | if (err < 0) |
| 1644 | goto err_free_dev; | 1644 | goto err_free_flow; |
| 1645 | 1645 | ||
| 1646 | err = register_netdevice(tun->dev); | 1646 | err = register_netdevice(tun->dev); |
| 1647 | if (err < 0) | 1647 | if (err < 0) |
| 1648 | goto err_free_dev; | 1648 | goto err_detach; |
| 1649 | 1649 | ||
| 1650 | if (device_create_file(&tun->dev->dev, &dev_attr_tun_flags) || | 1650 | if (device_create_file(&tun->dev->dev, &dev_attr_tun_flags) || |
| 1651 | device_create_file(&tun->dev->dev, &dev_attr_owner) || | 1651 | device_create_file(&tun->dev->dev, &dev_attr_owner) || |
| @@ -1689,7 +1689,12 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr) | |||
| 1689 | strcpy(ifr->ifr_name, tun->dev->name); | 1689 | strcpy(ifr->ifr_name, tun->dev->name); |
| 1690 | return 0; | 1690 | return 0; |
| 1691 | 1691 | ||
| 1692 | err_free_dev: | 1692 | err_detach: |
| 1693 | tun_detach_all(dev); | ||
| 1694 | err_free_flow: | ||
| 1695 | tun_flow_uninit(tun); | ||
| 1696 | security_tun_dev_free_security(tun->security); | ||
| 1697 | err_free_dev: | ||
| 1693 | free_netdev(dev); | 1698 | free_netdev(dev); |
| 1694 | return err; | 1699 | return err; |
| 1695 | } | 1700 | } |
diff --git a/drivers/net/usb/cdc_ether.c b/drivers/net/usb/cdc_ether.c index 03ad4dc293aa..2023f3ea891e 100644 --- a/drivers/net/usb/cdc_ether.c +++ b/drivers/net/usb/cdc_ether.c | |||
| @@ -33,7 +33,7 @@ | |||
| 33 | #include <linux/usb/usbnet.h> | 33 | #include <linux/usb/usbnet.h> |
| 34 | 34 | ||
| 35 | 35 | ||
| 36 | #if defined(CONFIG_USB_NET_RNDIS_HOST) || defined(CONFIG_USB_NET_RNDIS_HOST_MODULE) | 36 | #if IS_ENABLED(CONFIG_USB_NET_RNDIS_HOST) |
| 37 | 37 | ||
| 38 | static int is_rndis(struct usb_interface_descriptor *desc) | 38 | static int is_rndis(struct usb_interface_descriptor *desc) |
| 39 | { | 39 | { |
| @@ -69,8 +69,7 @@ static const u8 mbm_guid[16] = { | |||
| 69 | 0xa6, 0x07, 0xc0, 0xff, 0xcb, 0x7e, 0x39, 0x2a, | 69 | 0xa6, 0x07, 0xc0, 0xff, 0xcb, 0x7e, 0x39, 0x2a, |
| 70 | }; | 70 | }; |
| 71 | 71 | ||
| 72 | /* | 72 | /* probes control interface, claims data interface, collects the bulk |
| 73 | * probes control interface, claims data interface, collects the bulk | ||
| 74 | * endpoints, activates data interface (if needed), maybe sets MTU. | 73 | * endpoints, activates data interface (if needed), maybe sets MTU. |
| 75 | * all pure cdc, except for certain firmware workarounds, and knowing | 74 | * all pure cdc, except for certain firmware workarounds, and knowing |
| 76 | * that rndis uses one different rule. | 75 | * that rndis uses one different rule. |
| @@ -88,7 +87,7 @@ int usbnet_generic_cdc_bind(struct usbnet *dev, struct usb_interface *intf) | |||
| 88 | struct usb_cdc_mdlm_desc *desc = NULL; | 87 | struct usb_cdc_mdlm_desc *desc = NULL; |
| 89 | struct usb_cdc_mdlm_detail_desc *detail = NULL; | 88 | struct usb_cdc_mdlm_detail_desc *detail = NULL; |
| 90 | 89 | ||
| 91 | if (sizeof dev->data < sizeof *info) | 90 | if (sizeof(dev->data) < sizeof(*info)) |
| 92 | return -EDOM; | 91 | return -EDOM; |
| 93 | 92 | ||
| 94 | /* expect strict spec conformance for the descriptors, but | 93 | /* expect strict spec conformance for the descriptors, but |
| @@ -126,10 +125,10 @@ int usbnet_generic_cdc_bind(struct usbnet *dev, struct usb_interface *intf) | |||
| 126 | is_activesync(&intf->cur_altsetting->desc) || | 125 | is_activesync(&intf->cur_altsetting->desc) || |
| 127 | is_wireless_rndis(&intf->cur_altsetting->desc)); | 126 | is_wireless_rndis(&intf->cur_altsetting->desc)); |
| 128 | 127 | ||
| 129 | memset(info, 0, sizeof *info); | 128 | memset(info, 0, sizeof(*info)); |
| 130 | info->control = intf; | 129 | info->control = intf; |
| 131 | while (len > 3) { | 130 | while (len > 3) { |
| 132 | if (buf [1] != USB_DT_CS_INTERFACE) | 131 | if (buf[1] != USB_DT_CS_INTERFACE) |
| 133 | goto next_desc; | 132 | goto next_desc; |
| 134 | 133 | ||
| 135 | /* use bDescriptorSubType to identify the CDC descriptors. | 134 | /* use bDescriptorSubType to identify the CDC descriptors. |
| @@ -139,14 +138,14 @@ int usbnet_generic_cdc_bind(struct usbnet *dev, struct usb_interface *intf) | |||
| 139 | * in favor of a complicated OID-based RPC scheme doing what | 138 | * in favor of a complicated OID-based RPC scheme doing what |
| 140 | * CDC Ethernet achieves with a simple descriptor. | 139 | * CDC Ethernet achieves with a simple descriptor. |
| 141 | */ | 140 | */ |
| 142 | switch (buf [2]) { | 141 | switch (buf[2]) { |
| 143 | case USB_CDC_HEADER_TYPE: | 142 | case USB_CDC_HEADER_TYPE: |
| 144 | if (info->header) { | 143 | if (info->header) { |
| 145 | dev_dbg(&intf->dev, "extra CDC header\n"); | 144 | dev_dbg(&intf->dev, "extra CDC header\n"); |
| 146 | goto bad_desc; | 145 | goto bad_desc; |
| 147 | } | 146 | } |
| 148 | info->header = (void *) buf; | 147 | info->header = (void *) buf; |
| 149 | if (info->header->bLength != sizeof *info->header) { | 148 | if (info->header->bLength != sizeof(*info->header)) { |
| 150 | dev_dbg(&intf->dev, "CDC header len %u\n", | 149 | dev_dbg(&intf->dev, "CDC header len %u\n", |
| 151 | info->header->bLength); | 150 | info->header->bLength); |
| 152 | goto bad_desc; | 151 | goto bad_desc; |
| @@ -175,7 +174,7 @@ int usbnet_generic_cdc_bind(struct usbnet *dev, struct usb_interface *intf) | |||
| 175 | goto bad_desc; | 174 | goto bad_desc; |
| 176 | } | 175 | } |
| 177 | info->u = (void *) buf; | 176 | info->u = (void *) buf; |
| 178 | if (info->u->bLength != sizeof *info->u) { | 177 | if (info->u->bLength != sizeof(*info->u)) { |
| 179 | dev_dbg(&intf->dev, "CDC union len %u\n", | 178 | dev_dbg(&intf->dev, "CDC union len %u\n", |
| 180 | info->u->bLength); | 179 | info->u->bLength); |
| 181 | goto bad_desc; | 180 | goto bad_desc; |
| @@ -233,7 +232,7 @@ int usbnet_generic_cdc_bind(struct usbnet *dev, struct usb_interface *intf) | |||
| 233 | goto bad_desc; | 232 | goto bad_desc; |
| 234 | } | 233 | } |
| 235 | info->ether = (void *) buf; | 234 | info->ether = (void *) buf; |
| 236 | if (info->ether->bLength != sizeof *info->ether) { | 235 | if (info->ether->bLength != sizeof(*info->ether)) { |
| 237 | dev_dbg(&intf->dev, "CDC ether len %u\n", | 236 | dev_dbg(&intf->dev, "CDC ether len %u\n", |
| 238 | info->ether->bLength); | 237 | info->ether->bLength); |
| 239 | goto bad_desc; | 238 | goto bad_desc; |
| @@ -274,8 +273,8 @@ int usbnet_generic_cdc_bind(struct usbnet *dev, struct usb_interface *intf) | |||
| 274 | break; | 273 | break; |
| 275 | } | 274 | } |
| 276 | next_desc: | 275 | next_desc: |
| 277 | len -= buf [0]; /* bLength */ | 276 | len -= buf[0]; /* bLength */ |
| 278 | buf += buf [0]; | 277 | buf += buf[0]; |
| 279 | } | 278 | } |
| 280 | 279 | ||
| 281 | /* Microsoft ActiveSync based and some regular RNDIS devices lack the | 280 | /* Microsoft ActiveSync based and some regular RNDIS devices lack the |
| @@ -379,9 +378,7 @@ void usbnet_cdc_unbind(struct usbnet *dev, struct usb_interface *intf) | |||
| 379 | } | 378 | } |
| 380 | EXPORT_SYMBOL_GPL(usbnet_cdc_unbind); | 379 | EXPORT_SYMBOL_GPL(usbnet_cdc_unbind); |
| 381 | 380 | ||
| 382 | /*------------------------------------------------------------------------- | 381 | /* Communications Device Class, Ethernet Control model |
| 383 | * | ||
| 384 | * Communications Device Class, Ethernet Control model | ||
| 385 | * | 382 | * |
| 386 | * Takes two interfaces. The DATA interface is inactive till an altsetting | 383 | * Takes two interfaces. The DATA interface is inactive till an altsetting |
| 387 | * is selected. Configuration data includes class descriptors. There's | 384 | * is selected. Configuration data includes class descriptors. There's |
| @@ -389,8 +386,7 @@ EXPORT_SYMBOL_GPL(usbnet_cdc_unbind); | |||
| 389 | * | 386 | * |
| 390 | * This should interop with whatever the 2.4 "CDCEther.c" driver | 387 | * This should interop with whatever the 2.4 "CDCEther.c" driver |
| 391 | * (by Brad Hards) talked with, with more functionality. | 388 | * (by Brad Hards) talked with, with more functionality. |
| 392 | * | 389 | */ |
| 393 | *-------------------------------------------------------------------------*/ | ||
| 394 | 390 | ||
| 395 | static void dumpspeed(struct usbnet *dev, __le32 *speeds) | 391 | static void dumpspeed(struct usbnet *dev, __le32 *speeds) |
| 396 | { | 392 | { |
| @@ -404,7 +400,7 @@ void usbnet_cdc_status(struct usbnet *dev, struct urb *urb) | |||
| 404 | { | 400 | { |
| 405 | struct usb_cdc_notification *event; | 401 | struct usb_cdc_notification *event; |
| 406 | 402 | ||
| 407 | if (urb->actual_length < sizeof *event) | 403 | if (urb->actual_length < sizeof(*event)) |
| 408 | return; | 404 | return; |
| 409 | 405 | ||
| 410 | /* SPEED_CHANGE can get split into two 8-byte packets */ | 406 | /* SPEED_CHANGE can get split into two 8-byte packets */ |
| @@ -423,7 +419,7 @@ void usbnet_cdc_status(struct usbnet *dev, struct urb *urb) | |||
| 423 | case USB_CDC_NOTIFY_SPEED_CHANGE: /* tx/rx rates */ | 419 | case USB_CDC_NOTIFY_SPEED_CHANGE: /* tx/rx rates */ |
| 424 | netif_dbg(dev, timer, dev->net, "CDC: speed change (len %d)\n", | 420 | netif_dbg(dev, timer, dev->net, "CDC: speed change (len %d)\n", |
| 425 | urb->actual_length); | 421 | urb->actual_length); |
| 426 | if (urb->actual_length != (sizeof *event + 8)) | 422 | if (urb->actual_length != (sizeof(*event) + 8)) |
| 427 | set_bit(EVENT_STS_SPLIT, &dev->flags); | 423 | set_bit(EVENT_STS_SPLIT, &dev->flags); |
| 428 | else | 424 | else |
| 429 | dumpspeed(dev, (__le32 *) &event[1]); | 425 | dumpspeed(dev, (__le32 *) &event[1]); |
| @@ -469,7 +465,6 @@ EXPORT_SYMBOL_GPL(usbnet_cdc_bind); | |||
| 469 | static const struct driver_info cdc_info = { | 465 | static const struct driver_info cdc_info = { |
| 470 | .description = "CDC Ethernet Device", | 466 | .description = "CDC Ethernet Device", |
| 471 | .flags = FLAG_ETHER | FLAG_POINTTOPOINT, | 467 | .flags = FLAG_ETHER | FLAG_POINTTOPOINT, |
| 472 | // .check_connect = cdc_check_connect, | ||
| 473 | .bind = usbnet_cdc_bind, | 468 | .bind = usbnet_cdc_bind, |
| 474 | .unbind = usbnet_cdc_unbind, | 469 | .unbind = usbnet_cdc_unbind, |
| 475 | .status = usbnet_cdc_status, | 470 | .status = usbnet_cdc_status, |
| @@ -493,9 +488,8 @@ static const struct driver_info wwan_info = { | |||
| 493 | #define DELL_VENDOR_ID 0x413C | 488 | #define DELL_VENDOR_ID 0x413C |
| 494 | #define REALTEK_VENDOR_ID 0x0bda | 489 | #define REALTEK_VENDOR_ID 0x0bda |
| 495 | 490 | ||
| 496 | static const struct usb_device_id products [] = { | 491 | static const struct usb_device_id products[] = { |
| 497 | /* | 492 | /* BLACKLIST !! |
| 498 | * BLACKLIST !! | ||
| 499 | * | 493 | * |
| 500 | * First blacklist any products that are egregiously nonconformant | 494 | * First blacklist any products that are egregiously nonconformant |
| 501 | * with the CDC Ethernet specs. Minor braindamage we cope with; when | 495 | * with the CDC Ethernet specs. Minor braindamage we cope with; when |
| @@ -542,7 +536,7 @@ static const struct usb_device_id products [] = { | |||
| 542 | .driver_info = 0, | 536 | .driver_info = 0, |
| 543 | }, { | 537 | }, { |
| 544 | .match_flags = USB_DEVICE_ID_MATCH_INT_INFO | 538 | .match_flags = USB_DEVICE_ID_MATCH_INT_INFO |
| 545 | | USB_DEVICE_ID_MATCH_DEVICE, | 539 | | USB_DEVICE_ID_MATCH_DEVICE, |
| 546 | .idVendor = 0x04DD, | 540 | .idVendor = 0x04DD, |
| 547 | .idProduct = 0x8007, /* C-700 */ | 541 | .idProduct = 0x8007, /* C-700 */ |
| 548 | ZAURUS_MASTER_INTERFACE, | 542 | ZAURUS_MASTER_INTERFACE, |
| @@ -659,8 +653,7 @@ static const struct usb_device_id products [] = { | |||
| 659 | .driver_info = 0, | 653 | .driver_info = 0, |
| 660 | }, | 654 | }, |
| 661 | 655 | ||
| 662 | /* | 656 | /* WHITELIST!!! |
| 663 | * WHITELIST!!! | ||
| 664 | * | 657 | * |
| 665 | * CDC Ether uses two interfaces, not necessarily consecutive. | 658 | * CDC Ether uses two interfaces, not necessarily consecutive. |
| 666 | * We match the main interface, ignoring the optional device | 659 | * We match the main interface, ignoring the optional device |
| @@ -672,60 +665,40 @@ static const struct usb_device_id products [] = { | |||
| 672 | */ | 665 | */ |
| 673 | { | 666 | { |
| 674 | /* ZTE (Vodafone) K3805-Z */ | 667 | /* ZTE (Vodafone) K3805-Z */ |
| 675 | .match_flags = USB_DEVICE_ID_MATCH_VENDOR | 668 | USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1003, USB_CLASS_COMM, |
| 676 | | USB_DEVICE_ID_MATCH_PRODUCT | 669 | USB_CDC_SUBCLASS_ETHERNET, |
| 677 | | USB_DEVICE_ID_MATCH_INT_INFO, | 670 | USB_CDC_PROTO_NONE), |
| 678 | .idVendor = ZTE_VENDOR_ID, | ||
| 679 | .idProduct = 0x1003, | ||
| 680 | .bInterfaceClass = USB_CLASS_COMM, | ||
| 681 | .bInterfaceSubClass = USB_CDC_SUBCLASS_ETHERNET, | ||
| 682 | .bInterfaceProtocol = USB_CDC_PROTO_NONE, | ||
| 683 | .driver_info = (unsigned long)&wwan_info, | 671 | .driver_info = (unsigned long)&wwan_info, |
| 684 | }, { | 672 | }, { |
| 685 | /* ZTE (Vodafone) K3806-Z */ | 673 | /* ZTE (Vodafone) K3806-Z */ |
| 686 | .match_flags = USB_DEVICE_ID_MATCH_VENDOR | 674 | USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1015, USB_CLASS_COMM, |
| 687 | | USB_DEVICE_ID_MATCH_PRODUCT | 675 | USB_CDC_SUBCLASS_ETHERNET, |
| 688 | | USB_DEVICE_ID_MATCH_INT_INFO, | 676 | USB_CDC_PROTO_NONE), |
| 689 | .idVendor = ZTE_VENDOR_ID, | ||
| 690 | .idProduct = 0x1015, | ||
| 691 | .bInterfaceClass = USB_CLASS_COMM, | ||
| 692 | .bInterfaceSubClass = USB_CDC_SUBCLASS_ETHERNET, | ||
| 693 | .bInterfaceProtocol = USB_CDC_PROTO_NONE, | ||
| 694 | .driver_info = (unsigned long)&wwan_info, | 677 | .driver_info = (unsigned long)&wwan_info, |
| 695 | }, { | 678 | }, { |
| 696 | /* ZTE (Vodafone) K4510-Z */ | 679 | /* ZTE (Vodafone) K4510-Z */ |
| 697 | .match_flags = USB_DEVICE_ID_MATCH_VENDOR | 680 | USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1173, USB_CLASS_COMM, |
| 698 | | USB_DEVICE_ID_MATCH_PRODUCT | 681 | USB_CDC_SUBCLASS_ETHERNET, |
| 699 | | USB_DEVICE_ID_MATCH_INT_INFO, | 682 | USB_CDC_PROTO_NONE), |
| 700 | .idVendor = ZTE_VENDOR_ID, | ||
| 701 | .idProduct = 0x1173, | ||
| 702 | .bInterfaceClass = USB_CLASS_COMM, | ||
| 703 | .bInterfaceSubClass = USB_CDC_SUBCLASS_ETHERNET, | ||
| 704 | .bInterfaceProtocol = USB_CDC_PROTO_NONE, | ||
| 705 | .driver_info = (unsigned long)&wwan_info, | 683 | .driver_info = (unsigned long)&wwan_info, |
| 706 | }, { | 684 | }, { |
| 707 | /* ZTE (Vodafone) K3770-Z */ | 685 | /* ZTE (Vodafone) K3770-Z */ |
| 708 | .match_flags = USB_DEVICE_ID_MATCH_VENDOR | 686 | USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1177, USB_CLASS_COMM, |
| 709 | | USB_DEVICE_ID_MATCH_PRODUCT | 687 | USB_CDC_SUBCLASS_ETHERNET, |
| 710 | | USB_DEVICE_ID_MATCH_INT_INFO, | 688 | USB_CDC_PROTO_NONE), |
| 711 | .idVendor = ZTE_VENDOR_ID, | ||
| 712 | .idProduct = 0x1177, | ||
| 713 | .bInterfaceClass = USB_CLASS_COMM, | ||
| 714 | .bInterfaceSubClass = USB_CDC_SUBCLASS_ETHERNET, | ||
| 715 | .bInterfaceProtocol = USB_CDC_PROTO_NONE, | ||
| 716 | .driver_info = (unsigned long)&wwan_info, | 689 | .driver_info = (unsigned long)&wwan_info, |
| 717 | }, { | 690 | }, { |
| 718 | /* ZTE (Vodafone) K3772-Z */ | 691 | /* ZTE (Vodafone) K3772-Z */ |
| 719 | .match_flags = USB_DEVICE_ID_MATCH_VENDOR | 692 | USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1181, USB_CLASS_COMM, |
| 720 | | USB_DEVICE_ID_MATCH_PRODUCT | 693 | USB_CDC_SUBCLASS_ETHERNET, |
| 721 | | USB_DEVICE_ID_MATCH_INT_INFO, | 694 | USB_CDC_PROTO_NONE), |
| 722 | .idVendor = ZTE_VENDOR_ID, | ||
| 723 | .idProduct = 0x1181, | ||
| 724 | .bInterfaceClass = USB_CLASS_COMM, | ||
| 725 | .bInterfaceSubClass = USB_CDC_SUBCLASS_ETHERNET, | ||
| 726 | .bInterfaceProtocol = USB_CDC_PROTO_NONE, | ||
| 727 | .driver_info = (unsigned long)&wwan_info, | 695 | .driver_info = (unsigned long)&wwan_info, |
| 728 | }, { | 696 | }, { |
| 697 | /* Telit modules */ | ||
| 698 | USB_VENDOR_AND_INTERFACE_INFO(0x1bc7, USB_CLASS_COMM, | ||
| 699 | USB_CDC_SUBCLASS_ETHERNET, USB_CDC_PROTO_NONE), | ||
| 700 | .driver_info = (kernel_ulong_t) &wwan_info, | ||
| 701 | }, { | ||
| 729 | USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_ETHERNET, | 702 | USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_ETHERNET, |
| 730 | USB_CDC_PROTO_NONE), | 703 | USB_CDC_PROTO_NONE), |
| 731 | .driver_info = (unsigned long) &cdc_info, | 704 | .driver_info = (unsigned long) &cdc_info, |
| @@ -736,15 +709,11 @@ static const struct usb_device_id products [] = { | |||
| 736 | 709 | ||
| 737 | }, { | 710 | }, { |
| 738 | /* Various Huawei modems with a network port like the UMG1831 */ | 711 | /* Various Huawei modems with a network port like the UMG1831 */ |
| 739 | .match_flags = USB_DEVICE_ID_MATCH_VENDOR | 712 | USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, USB_CLASS_COMM, |
| 740 | | USB_DEVICE_ID_MATCH_INT_INFO, | 713 | USB_CDC_SUBCLASS_ETHERNET, 255), |
| 741 | .idVendor = HUAWEI_VENDOR_ID, | ||
| 742 | .bInterfaceClass = USB_CLASS_COMM, | ||
| 743 | .bInterfaceSubClass = USB_CDC_SUBCLASS_ETHERNET, | ||
| 744 | .bInterfaceProtocol = 255, | ||
| 745 | .driver_info = (unsigned long)&wwan_info, | 714 | .driver_info = (unsigned long)&wwan_info, |
| 746 | }, | 715 | }, |
| 747 | { }, // END | 716 | { }, /* END */ |
| 748 | }; | 717 | }; |
| 749 | MODULE_DEVICE_TABLE(usb, products); | 718 | MODULE_DEVICE_TABLE(usb, products); |
| 750 | 719 | ||
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c index bf64b4191dcc..d1292fe746bc 100644 --- a/drivers/net/vxlan.c +++ b/drivers/net/vxlan.c | |||
| @@ -564,7 +564,7 @@ static void vxlan_notify_add_rx_port(struct sock *sk) | |||
| 564 | struct net_device *dev; | 564 | struct net_device *dev; |
| 565 | struct net *net = sock_net(sk); | 565 | struct net *net = sock_net(sk); |
| 566 | sa_family_t sa_family = sk->sk_family; | 566 | sa_family_t sa_family = sk->sk_family; |
| 567 | u16 port = htons(inet_sk(sk)->inet_sport); | 567 | __be16 port = inet_sk(sk)->inet_sport; |
| 568 | 568 | ||
| 569 | rcu_read_lock(); | 569 | rcu_read_lock(); |
| 570 | for_each_netdev_rcu(net, dev) { | 570 | for_each_netdev_rcu(net, dev) { |
| @@ -581,7 +581,7 @@ static void vxlan_notify_del_rx_port(struct sock *sk) | |||
| 581 | struct net_device *dev; | 581 | struct net_device *dev; |
| 582 | struct net *net = sock_net(sk); | 582 | struct net *net = sock_net(sk); |
| 583 | sa_family_t sa_family = sk->sk_family; | 583 | sa_family_t sa_family = sk->sk_family; |
| 584 | u16 port = htons(inet_sk(sk)->inet_sport); | 584 | __be16 port = inet_sk(sk)->inet_sport; |
| 585 | 585 | ||
| 586 | rcu_read_lock(); | 586 | rcu_read_lock(); |
| 587 | for_each_netdev_rcu(net, dev) { | 587 | for_each_netdev_rcu(net, dev) { |
| @@ -2021,7 +2021,8 @@ static struct device_type vxlan_type = { | |||
| 2021 | }; | 2021 | }; |
| 2022 | 2022 | ||
| 2023 | /* Calls the ndo_add_vxlan_port of the caller in order to | 2023 | /* Calls the ndo_add_vxlan_port of the caller in order to |
| 2024 | * supply the listening VXLAN udp ports. | 2024 | * supply the listening VXLAN udp ports. Callers are expected |
| 2025 | * to implement the ndo_add_vxlan_port. | ||
| 2025 | */ | 2026 | */ |
| 2026 | void vxlan_get_rx_port(struct net_device *dev) | 2027 | void vxlan_get_rx_port(struct net_device *dev) |
| 2027 | { | 2028 | { |
| @@ -2029,16 +2030,13 @@ void vxlan_get_rx_port(struct net_device *dev) | |||
| 2029 | struct net *net = dev_net(dev); | 2030 | struct net *net = dev_net(dev); |
| 2030 | struct vxlan_net *vn = net_generic(net, vxlan_net_id); | 2031 | struct vxlan_net *vn = net_generic(net, vxlan_net_id); |
| 2031 | sa_family_t sa_family; | 2032 | sa_family_t sa_family; |
| 2032 | u16 port; | 2033 | __be16 port; |
| 2033 | int i; | 2034 | unsigned int i; |
| 2034 | |||
| 2035 | if (!dev || !dev->netdev_ops || !dev->netdev_ops->ndo_add_vxlan_port) | ||
| 2036 | return; | ||
| 2037 | 2035 | ||
| 2038 | spin_lock(&vn->sock_lock); | 2036 | spin_lock(&vn->sock_lock); |
| 2039 | for (i = 0; i < PORT_HASH_SIZE; ++i) { | 2037 | for (i = 0; i < PORT_HASH_SIZE; ++i) { |
| 2040 | hlist_for_each_entry_rcu(vs, vs_head(net, i), hlist) { | 2038 | hlist_for_each_entry_rcu(vs, &vn->sock_list[i], hlist) { |
| 2041 | port = htons(inet_sk(vs->sock->sk)->inet_sport); | 2039 | port = inet_sk(vs->sock->sk)->inet_sport; |
| 2042 | sa_family = vs->sock->sk->sk_family; | 2040 | sa_family = vs->sock->sk->sk_family; |
| 2043 | dev->netdev_ops->ndo_add_vxlan_port(dev, sa_family, | 2041 | dev->netdev_ops->ndo_add_vxlan_port(dev, sa_family, |
| 2044 | port); | 2042 | port); |
| @@ -2492,15 +2490,19 @@ static int vxlan_newlink(struct net *net, struct net_device *dev, | |||
| 2492 | 2490 | ||
| 2493 | SET_ETHTOOL_OPS(dev, &vxlan_ethtool_ops); | 2491 | SET_ETHTOOL_OPS(dev, &vxlan_ethtool_ops); |
| 2494 | 2492 | ||
| 2495 | /* create an fdb entry for default destination */ | 2493 | /* create an fdb entry for a valid default destination */ |
| 2496 | err = vxlan_fdb_create(vxlan, all_zeros_mac, | 2494 | if (!vxlan_addr_any(&vxlan->default_dst.remote_ip)) { |
| 2497 | &vxlan->default_dst.remote_ip, | 2495 | err = vxlan_fdb_create(vxlan, all_zeros_mac, |
| 2498 | NUD_REACHABLE|NUD_PERMANENT, | 2496 | &vxlan->default_dst.remote_ip, |
| 2499 | NLM_F_EXCL|NLM_F_CREATE, | 2497 | NUD_REACHABLE|NUD_PERMANENT, |
| 2500 | vxlan->dst_port, vxlan->default_dst.remote_vni, | 2498 | NLM_F_EXCL|NLM_F_CREATE, |
| 2501 | vxlan->default_dst.remote_ifindex, NTF_SELF); | 2499 | vxlan->dst_port, |
| 2502 | if (err) | 2500 | vxlan->default_dst.remote_vni, |
| 2503 | return err; | 2501 | vxlan->default_dst.remote_ifindex, |
| 2502 | NTF_SELF); | ||
| 2503 | if (err) | ||
| 2504 | return err; | ||
| 2505 | } | ||
| 2504 | 2506 | ||
| 2505 | err = register_netdevice(dev); | 2507 | err = register_netdevice(dev); |
| 2506 | if (err) { | 2508 | if (err) { |
diff --git a/drivers/net/wireless/brcm80211/Kconfig b/drivers/net/wireless/brcm80211/Kconfig index fc8a0fa6d3b2..b00a7e92225f 100644 --- a/drivers/net/wireless/brcm80211/Kconfig +++ b/drivers/net/wireless/brcm80211/Kconfig | |||
| @@ -28,7 +28,7 @@ config BRCMFMAC | |||
| 28 | 28 | ||
| 29 | config BRCMFMAC_SDIO | 29 | config BRCMFMAC_SDIO |
| 30 | bool "SDIO bus interface support for FullMAC driver" | 30 | bool "SDIO bus interface support for FullMAC driver" |
| 31 | depends on MMC | 31 | depends on (MMC = y || MMC = BRCMFMAC) |
| 32 | depends on BRCMFMAC | 32 | depends on BRCMFMAC |
| 33 | select FW_LOADER | 33 | select FW_LOADER |
| 34 | default y | 34 | default y |
| @@ -39,7 +39,7 @@ config BRCMFMAC_SDIO | |||
| 39 | 39 | ||
| 40 | config BRCMFMAC_USB | 40 | config BRCMFMAC_USB |
| 41 | bool "USB bus interface support for FullMAC driver" | 41 | bool "USB bus interface support for FullMAC driver" |
| 42 | depends on USB | 42 | depends on (USB = y || USB = BRCMFMAC) |
| 43 | depends on BRCMFMAC | 43 | depends on BRCMFMAC |
| 44 | select FW_LOADER | 44 | select FW_LOADER |
| 45 | ---help--- | 45 | ---help--- |
diff --git a/drivers/net/wireless/cw1200/cw1200_spi.c b/drivers/net/wireless/cw1200/cw1200_spi.c index d06376014bcd..f5e6b489ed32 100644 --- a/drivers/net/wireless/cw1200/cw1200_spi.c +++ b/drivers/net/wireless/cw1200/cw1200_spi.c | |||
| @@ -40,7 +40,9 @@ struct hwbus_priv { | |||
| 40 | struct cw1200_common *core; | 40 | struct cw1200_common *core; |
| 41 | const struct cw1200_platform_data_spi *pdata; | 41 | const struct cw1200_platform_data_spi *pdata; |
| 42 | spinlock_t lock; /* Serialize all bus operations */ | 42 | spinlock_t lock; /* Serialize all bus operations */ |
| 43 | wait_queue_head_t wq; | ||
| 43 | int claimed; | 44 | int claimed; |
| 45 | int irq_disabled; | ||
| 44 | }; | 46 | }; |
| 45 | 47 | ||
| 46 | #define SDIO_TO_SPI_ADDR(addr) ((addr & 0x1f)>>2) | 48 | #define SDIO_TO_SPI_ADDR(addr) ((addr & 0x1f)>>2) |
| @@ -197,8 +199,11 @@ static void cw1200_spi_lock(struct hwbus_priv *self) | |||
| 197 | { | 199 | { |
| 198 | unsigned long flags; | 200 | unsigned long flags; |
| 199 | 201 | ||
| 202 | DECLARE_WAITQUEUE(wait, current); | ||
| 203 | |||
| 200 | might_sleep(); | 204 | might_sleep(); |
| 201 | 205 | ||
| 206 | add_wait_queue(&self->wq, &wait); | ||
| 202 | spin_lock_irqsave(&self->lock, flags); | 207 | spin_lock_irqsave(&self->lock, flags); |
| 203 | while (1) { | 208 | while (1) { |
| 204 | set_current_state(TASK_UNINTERRUPTIBLE); | 209 | set_current_state(TASK_UNINTERRUPTIBLE); |
| @@ -211,6 +216,7 @@ static void cw1200_spi_lock(struct hwbus_priv *self) | |||
| 211 | set_current_state(TASK_RUNNING); | 216 | set_current_state(TASK_RUNNING); |
| 212 | self->claimed = 1; | 217 | self->claimed = 1; |
| 213 | spin_unlock_irqrestore(&self->lock, flags); | 218 | spin_unlock_irqrestore(&self->lock, flags); |
| 219 | remove_wait_queue(&self->wq, &wait); | ||
| 214 | 220 | ||
| 215 | return; | 221 | return; |
| 216 | } | 222 | } |
| @@ -222,6 +228,8 @@ static void cw1200_spi_unlock(struct hwbus_priv *self) | |||
| 222 | spin_lock_irqsave(&self->lock, flags); | 228 | spin_lock_irqsave(&self->lock, flags); |
| 223 | self->claimed = 0; | 229 | self->claimed = 0; |
| 224 | spin_unlock_irqrestore(&self->lock, flags); | 230 | spin_unlock_irqrestore(&self->lock, flags); |
| 231 | wake_up(&self->wq); | ||
| 232 | |||
| 225 | return; | 233 | return; |
| 226 | } | 234 | } |
| 227 | 235 | ||
| @@ -230,6 +238,8 @@ static irqreturn_t cw1200_spi_irq_handler(int irq, void *dev_id) | |||
| 230 | struct hwbus_priv *self = dev_id; | 238 | struct hwbus_priv *self = dev_id; |
| 231 | 239 | ||
| 232 | if (self->core) { | 240 | if (self->core) { |
| 241 | disable_irq_nosync(self->func->irq); | ||
| 242 | self->irq_disabled = 1; | ||
| 233 | cw1200_irq_handler(self->core); | 243 | cw1200_irq_handler(self->core); |
| 234 | return IRQ_HANDLED; | 244 | return IRQ_HANDLED; |
| 235 | } else { | 245 | } else { |
| @@ -263,13 +273,22 @@ exit: | |||
| 263 | 273 | ||
| 264 | static int cw1200_spi_irq_unsubscribe(struct hwbus_priv *self) | 274 | static int cw1200_spi_irq_unsubscribe(struct hwbus_priv *self) |
| 265 | { | 275 | { |
| 266 | int ret = 0; | ||
| 267 | |||
| 268 | pr_debug("SW IRQ unsubscribe\n"); | 276 | pr_debug("SW IRQ unsubscribe\n"); |
| 269 | disable_irq_wake(self->func->irq); | 277 | disable_irq_wake(self->func->irq); |
| 270 | free_irq(self->func->irq, self); | 278 | free_irq(self->func->irq, self); |
| 271 | 279 | ||
| 272 | return ret; | 280 | return 0; |
| 281 | } | ||
| 282 | |||
| 283 | static int cw1200_spi_irq_enable(struct hwbus_priv *self, int enable) | ||
| 284 | { | ||
| 285 | /* Disables are handled by the interrupt handler */ | ||
| 286 | if (enable && self->irq_disabled) { | ||
| 287 | enable_irq(self->func->irq); | ||
| 288 | self->irq_disabled = 0; | ||
| 289 | } | ||
| 290 | |||
| 291 | return 0; | ||
| 273 | } | 292 | } |
| 274 | 293 | ||
| 275 | static int cw1200_spi_off(const struct cw1200_platform_data_spi *pdata) | 294 | static int cw1200_spi_off(const struct cw1200_platform_data_spi *pdata) |
| @@ -349,6 +368,7 @@ static struct hwbus_ops cw1200_spi_hwbus_ops = { | |||
| 349 | .unlock = cw1200_spi_unlock, | 368 | .unlock = cw1200_spi_unlock, |
| 350 | .align_size = cw1200_spi_align_size, | 369 | .align_size = cw1200_spi_align_size, |
| 351 | .power_mgmt = cw1200_spi_pm, | 370 | .power_mgmt = cw1200_spi_pm, |
| 371 | .irq_enable = cw1200_spi_irq_enable, | ||
| 352 | }; | 372 | }; |
| 353 | 373 | ||
| 354 | /* Probe Function to be called by SPI stack when device is discovered */ | 374 | /* Probe Function to be called by SPI stack when device is discovered */ |
| @@ -400,6 +420,8 @@ static int cw1200_spi_probe(struct spi_device *func) | |||
| 400 | 420 | ||
| 401 | spi_set_drvdata(func, self); | 421 | spi_set_drvdata(func, self); |
| 402 | 422 | ||
| 423 | init_waitqueue_head(&self->wq); | ||
| 424 | |||
| 403 | status = cw1200_spi_irq_subscribe(self); | 425 | status = cw1200_spi_irq_subscribe(self); |
| 404 | 426 | ||
| 405 | status = cw1200_core_probe(&cw1200_spi_hwbus_ops, | 427 | status = cw1200_core_probe(&cw1200_spi_hwbus_ops, |
diff --git a/drivers/net/wireless/cw1200/fwio.c b/drivers/net/wireless/cw1200/fwio.c index acdff0f7f952..0b2061bbc68b 100644 --- a/drivers/net/wireless/cw1200/fwio.c +++ b/drivers/net/wireless/cw1200/fwio.c | |||
| @@ -485,7 +485,7 @@ int cw1200_load_firmware(struct cw1200_common *priv) | |||
| 485 | 485 | ||
| 486 | /* Enable interrupt signalling */ | 486 | /* Enable interrupt signalling */ |
| 487 | priv->hwbus_ops->lock(priv->hwbus_priv); | 487 | priv->hwbus_ops->lock(priv->hwbus_priv); |
| 488 | ret = __cw1200_irq_enable(priv, 1); | 488 | ret = __cw1200_irq_enable(priv, 2); |
| 489 | priv->hwbus_ops->unlock(priv->hwbus_priv); | 489 | priv->hwbus_ops->unlock(priv->hwbus_priv); |
| 490 | if (ret < 0) | 490 | if (ret < 0) |
| 491 | goto unsubscribe; | 491 | goto unsubscribe; |
diff --git a/drivers/net/wireless/cw1200/hwbus.h b/drivers/net/wireless/cw1200/hwbus.h index 8b2fc831c3de..51dfb3a90735 100644 --- a/drivers/net/wireless/cw1200/hwbus.h +++ b/drivers/net/wireless/cw1200/hwbus.h | |||
| @@ -28,6 +28,7 @@ struct hwbus_ops { | |||
| 28 | void (*unlock)(struct hwbus_priv *self); | 28 | void (*unlock)(struct hwbus_priv *self); |
| 29 | size_t (*align_size)(struct hwbus_priv *self, size_t size); | 29 | size_t (*align_size)(struct hwbus_priv *self, size_t size); |
| 30 | int (*power_mgmt)(struct hwbus_priv *self, bool suspend); | 30 | int (*power_mgmt)(struct hwbus_priv *self, bool suspend); |
| 31 | int (*irq_enable)(struct hwbus_priv *self, int enable); | ||
| 31 | }; | 32 | }; |
| 32 | 33 | ||
| 33 | #endif /* CW1200_HWBUS_H */ | 34 | #endif /* CW1200_HWBUS_H */ |
diff --git a/drivers/net/wireless/cw1200/hwio.c b/drivers/net/wireless/cw1200/hwio.c index ff230b7aeedd..41bd7615ccaa 100644 --- a/drivers/net/wireless/cw1200/hwio.c +++ b/drivers/net/wireless/cw1200/hwio.c | |||
| @@ -273,6 +273,21 @@ int __cw1200_irq_enable(struct cw1200_common *priv, int enable) | |||
| 273 | u16 val16; | 273 | u16 val16; |
| 274 | int ret; | 274 | int ret; |
| 275 | 275 | ||
| 276 | /* We need to do this hack because the SPI layer can sleep on I/O | ||
| 277 | and the general path involves I/O to the device in interrupt | ||
| 278 | context. | ||
| 279 | |||
| 280 | However, the initial enable call needs to go to the hardware. | ||
| 281 | |||
| 282 | We don't worry about shutdown because we do a full reset which | ||
| 283 | clears the interrupt enabled bits. | ||
| 284 | */ | ||
| 285 | if (priv->hwbus_ops->irq_enable) { | ||
| 286 | ret = priv->hwbus_ops->irq_enable(priv->hwbus_priv, enable); | ||
| 287 | if (ret || enable < 2) | ||
| 288 | return ret; | ||
| 289 | } | ||
| 290 | |||
| 276 | if (HIF_8601_SILICON == priv->hw_type) { | 291 | if (HIF_8601_SILICON == priv->hw_type) { |
| 277 | ret = __cw1200_reg_read_32(priv, ST90TDS_CONFIG_REG_ID, &val32); | 292 | ret = __cw1200_reg_read_32(priv, ST90TDS_CONFIG_REG_ID, &val32); |
| 278 | if (ret < 0) { | 293 | if (ret < 0) { |
diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c index 95e6e61c3de0..88ce656f96cd 100644 --- a/drivers/net/wireless/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/rt2x00/rt2800lib.c | |||
| @@ -6659,19 +6659,20 @@ int rt2800_enable_radio(struct rt2x00_dev *rt2x00dev) | |||
| 6659 | rt2800_init_registers(rt2x00dev))) | 6659 | rt2800_init_registers(rt2x00dev))) |
| 6660 | return -EIO; | 6660 | return -EIO; |
| 6661 | 6661 | ||
| 6662 | if (unlikely(rt2800_wait_bbp_rf_ready(rt2x00dev))) | ||
| 6663 | return -EIO; | ||
| 6664 | |||
| 6662 | /* | 6665 | /* |
| 6663 | * Send signal to firmware during boot time. | 6666 | * Send signal to firmware during boot time. |
| 6664 | */ | 6667 | */ |
| 6665 | rt2800_register_write(rt2x00dev, H2M_BBP_AGENT, 0); | 6668 | rt2800_register_write(rt2x00dev, H2M_BBP_AGENT, 0); |
| 6666 | rt2800_register_write(rt2x00dev, H2M_MAILBOX_CSR, 0); | 6669 | rt2800_register_write(rt2x00dev, H2M_MAILBOX_CSR, 0); |
| 6667 | if (rt2x00_is_usb(rt2x00dev)) { | 6670 | if (rt2x00_is_usb(rt2x00dev)) |
| 6668 | rt2800_register_write(rt2x00dev, H2M_INT_SRC, 0); | 6671 | rt2800_register_write(rt2x00dev, H2M_INT_SRC, 0); |
| 6669 | rt2800_mcu_request(rt2x00dev, MCU_BOOT_SIGNAL, 0, 0, 0); | 6672 | rt2800_mcu_request(rt2x00dev, MCU_BOOT_SIGNAL, 0, 0, 0); |
| 6670 | } | ||
| 6671 | msleep(1); | 6673 | msleep(1); |
| 6672 | 6674 | ||
| 6673 | if (unlikely(rt2800_wait_bbp_rf_ready(rt2x00dev) || | 6675 | if (unlikely(rt2800_wait_bbp_ready(rt2x00dev))) |
| 6674 | rt2800_wait_bbp_ready(rt2x00dev))) | ||
| 6675 | return -EIO; | 6676 | return -EIO; |
| 6676 | 6677 | ||
| 6677 | rt2800_init_bbp(rt2x00dev); | 6678 | rt2800_init_bbp(rt2x00dev); |
diff --git a/drivers/net/wireless/rtl818x/rtl8187/dev.c b/drivers/net/wireless/rtl818x/rtl8187/dev.c index 841fb9dfc9da..9a6edb0c014e 100644 --- a/drivers/net/wireless/rtl818x/rtl8187/dev.c +++ b/drivers/net/wireless/rtl818x/rtl8187/dev.c | |||
| @@ -438,17 +438,16 @@ static int rtl8187_init_urbs(struct ieee80211_hw *dev) | |||
| 438 | skb_queue_tail(&priv->rx_queue, skb); | 438 | skb_queue_tail(&priv->rx_queue, skb); |
| 439 | usb_anchor_urb(entry, &priv->anchored); | 439 | usb_anchor_urb(entry, &priv->anchored); |
| 440 | ret = usb_submit_urb(entry, GFP_KERNEL); | 440 | ret = usb_submit_urb(entry, GFP_KERNEL); |
| 441 | usb_put_urb(entry); | ||
| 441 | if (ret) { | 442 | if (ret) { |
| 442 | skb_unlink(skb, &priv->rx_queue); | 443 | skb_unlink(skb, &priv->rx_queue); |
| 443 | usb_unanchor_urb(entry); | 444 | usb_unanchor_urb(entry); |
| 444 | goto err; | 445 | goto err; |
| 445 | } | 446 | } |
| 446 | usb_free_urb(entry); | ||
| 447 | } | 447 | } |
| 448 | return ret; | 448 | return ret; |
| 449 | 449 | ||
| 450 | err: | 450 | err: |
| 451 | usb_free_urb(entry); | ||
| 452 | kfree_skb(skb); | 451 | kfree_skb(skb); |
| 453 | usb_kill_anchored_urbs(&priv->anchored); | 452 | usb_kill_anchored_urbs(&priv->anchored); |
| 454 | return ret; | 453 | return ret; |
| @@ -956,8 +955,12 @@ static int rtl8187_start(struct ieee80211_hw *dev) | |||
| 956 | (RETRY_COUNT << 8 /* short retry limit */) | | 955 | (RETRY_COUNT << 8 /* short retry limit */) | |
| 957 | (RETRY_COUNT << 0 /* long retry limit */) | | 956 | (RETRY_COUNT << 0 /* long retry limit */) | |
| 958 | (7 << 21 /* MAX TX DMA */)); | 957 | (7 << 21 /* MAX TX DMA */)); |
| 959 | rtl8187_init_urbs(dev); | 958 | ret = rtl8187_init_urbs(dev); |
| 960 | rtl8187b_init_status_urb(dev); | 959 | if (ret) |
| 960 | goto rtl8187_start_exit; | ||
| 961 | ret = rtl8187b_init_status_urb(dev); | ||
| 962 | if (ret) | ||
| 963 | usb_kill_anchored_urbs(&priv->anchored); | ||
| 961 | goto rtl8187_start_exit; | 964 | goto rtl8187_start_exit; |
| 962 | } | 965 | } |
| 963 | 966 | ||
| @@ -966,7 +969,9 @@ static int rtl8187_start(struct ieee80211_hw *dev) | |||
| 966 | rtl818x_iowrite32(priv, &priv->map->MAR[0], ~0); | 969 | rtl818x_iowrite32(priv, &priv->map->MAR[0], ~0); |
| 967 | rtl818x_iowrite32(priv, &priv->map->MAR[1], ~0); | 970 | rtl818x_iowrite32(priv, &priv->map->MAR[1], ~0); |
| 968 | 971 | ||
| 969 | rtl8187_init_urbs(dev); | 972 | ret = rtl8187_init_urbs(dev); |
| 973 | if (ret) | ||
| 974 | goto rtl8187_start_exit; | ||
| 970 | 975 | ||
| 971 | reg = RTL818X_RX_CONF_ONLYERLPKT | | 976 | reg = RTL818X_RX_CONF_ONLYERLPKT | |
| 972 | RTL818X_RX_CONF_RX_AUTORESETPHY | | 977 | RTL818X_RX_CONF_RX_AUTORESETPHY | |
diff --git a/drivers/net/xen-netback/common.h b/drivers/net/xen-netback/common.h index a1977430ddfb..5715318d6bab 100644 --- a/drivers/net/xen-netback/common.h +++ b/drivers/net/xen-netback/common.h | |||
| @@ -184,6 +184,7 @@ int xenvif_connect(struct xenvif *vif, unsigned long tx_ring_ref, | |||
| 184 | unsigned long rx_ring_ref, unsigned int tx_evtchn, | 184 | unsigned long rx_ring_ref, unsigned int tx_evtchn, |
| 185 | unsigned int rx_evtchn); | 185 | unsigned int rx_evtchn); |
| 186 | void xenvif_disconnect(struct xenvif *vif); | 186 | void xenvif_disconnect(struct xenvif *vif); |
| 187 | void xenvif_free(struct xenvif *vif); | ||
| 187 | 188 | ||
| 188 | int xenvif_xenbus_init(void); | 189 | int xenvif_xenbus_init(void); |
| 189 | void xenvif_xenbus_fini(void); | 190 | void xenvif_xenbus_fini(void); |
diff --git a/drivers/net/xen-netback/interface.c b/drivers/net/xen-netback/interface.c index 625c6f49cfba..01bb854c7f62 100644 --- a/drivers/net/xen-netback/interface.c +++ b/drivers/net/xen-netback/interface.c | |||
| @@ -353,6 +353,9 @@ struct xenvif *xenvif_alloc(struct device *parent, domid_t domid, | |||
| 353 | } | 353 | } |
| 354 | 354 | ||
| 355 | netdev_dbg(dev, "Successfully created xenvif\n"); | 355 | netdev_dbg(dev, "Successfully created xenvif\n"); |
| 356 | |||
| 357 | __module_get(THIS_MODULE); | ||
| 358 | |||
| 356 | return vif; | 359 | return vif; |
| 357 | } | 360 | } |
| 358 | 361 | ||
| @@ -366,8 +369,6 @@ int xenvif_connect(struct xenvif *vif, unsigned long tx_ring_ref, | |||
| 366 | if (vif->tx_irq) | 369 | if (vif->tx_irq) |
| 367 | return 0; | 370 | return 0; |
| 368 | 371 | ||
| 369 | __module_get(THIS_MODULE); | ||
| 370 | |||
| 371 | err = xenvif_map_frontend_rings(vif, tx_ring_ref, rx_ring_ref); | 372 | err = xenvif_map_frontend_rings(vif, tx_ring_ref, rx_ring_ref); |
| 372 | if (err < 0) | 373 | if (err < 0) |
| 373 | goto err; | 374 | goto err; |
| @@ -406,7 +407,7 @@ int xenvif_connect(struct xenvif *vif, unsigned long tx_ring_ref, | |||
| 406 | 407 | ||
| 407 | init_waitqueue_head(&vif->wq); | 408 | init_waitqueue_head(&vif->wq); |
| 408 | vif->task = kthread_create(xenvif_kthread, | 409 | vif->task = kthread_create(xenvif_kthread, |
| 409 | (void *)vif, vif->dev->name); | 410 | (void *)vif, "%s", vif->dev->name); |
| 410 | if (IS_ERR(vif->task)) { | 411 | if (IS_ERR(vif->task)) { |
| 411 | pr_warn("Could not allocate kthread for %s\n", vif->dev->name); | 412 | pr_warn("Could not allocate kthread for %s\n", vif->dev->name); |
| 412 | err = PTR_ERR(vif->task); | 413 | err = PTR_ERR(vif->task); |
| @@ -452,12 +453,6 @@ void xenvif_carrier_off(struct xenvif *vif) | |||
| 452 | 453 | ||
| 453 | void xenvif_disconnect(struct xenvif *vif) | 454 | void xenvif_disconnect(struct xenvif *vif) |
| 454 | { | 455 | { |
| 455 | /* Disconnect funtion might get called by generic framework | ||
| 456 | * even before vif connects, so we need to check if we really | ||
| 457 | * need to do a module_put. | ||
| 458 | */ | ||
| 459 | int need_module_put = 0; | ||
| 460 | |||
| 461 | if (netif_carrier_ok(vif->dev)) | 456 | if (netif_carrier_ok(vif->dev)) |
| 462 | xenvif_carrier_off(vif); | 457 | xenvif_carrier_off(vif); |
| 463 | 458 | ||
| @@ -468,23 +463,22 @@ void xenvif_disconnect(struct xenvif *vif) | |||
| 468 | unbind_from_irqhandler(vif->tx_irq, vif); | 463 | unbind_from_irqhandler(vif->tx_irq, vif); |
| 469 | unbind_from_irqhandler(vif->rx_irq, vif); | 464 | unbind_from_irqhandler(vif->rx_irq, vif); |
| 470 | } | 465 | } |
| 471 | /* vif->irq is valid, we had a module_get in | 466 | vif->tx_irq = 0; |
| 472 | * xenvif_connect. | ||
| 473 | */ | ||
| 474 | need_module_put = 1; | ||
| 475 | } | 467 | } |
| 476 | 468 | ||
| 477 | if (vif->task) | 469 | if (vif->task) |
| 478 | kthread_stop(vif->task); | 470 | kthread_stop(vif->task); |
| 479 | 471 | ||
| 472 | xenvif_unmap_frontend_rings(vif); | ||
| 473 | } | ||
| 474 | |||
| 475 | void xenvif_free(struct xenvif *vif) | ||
| 476 | { | ||
| 480 | netif_napi_del(&vif->napi); | 477 | netif_napi_del(&vif->napi); |
| 481 | 478 | ||
| 482 | unregister_netdev(vif->dev); | 479 | unregister_netdev(vif->dev); |
| 483 | 480 | ||
| 484 | xenvif_unmap_frontend_rings(vif); | ||
| 485 | |||
| 486 | free_netdev(vif->dev); | 481 | free_netdev(vif->dev); |
| 487 | 482 | ||
| 488 | if (need_module_put) | 483 | module_put(THIS_MODULE); |
| 489 | module_put(THIS_MODULE); | ||
| 490 | } | 484 | } |
diff --git a/drivers/net/xen-netback/netback.c b/drivers/net/xen-netback/netback.c index 956130c70036..f3e591c611de 100644 --- a/drivers/net/xen-netback/netback.c +++ b/drivers/net/xen-netback/netback.c | |||
| @@ -212,6 +212,49 @@ static bool start_new_rx_buffer(int offset, unsigned long size, int head) | |||
| 212 | return false; | 212 | return false; |
| 213 | } | 213 | } |
| 214 | 214 | ||
| 215 | struct xenvif_count_slot_state { | ||
| 216 | unsigned long copy_off; | ||
| 217 | bool head; | ||
| 218 | }; | ||
| 219 | |||
| 220 | unsigned int xenvif_count_frag_slots(struct xenvif *vif, | ||
| 221 | unsigned long offset, unsigned long size, | ||
| 222 | struct xenvif_count_slot_state *state) | ||
| 223 | { | ||
| 224 | unsigned count = 0; | ||
| 225 | |||
| 226 | offset &= ~PAGE_MASK; | ||
| 227 | |||
| 228 | while (size > 0) { | ||
| 229 | unsigned long bytes; | ||
| 230 | |||
| 231 | bytes = PAGE_SIZE - offset; | ||
| 232 | |||
| 233 | if (bytes > size) | ||
| 234 | bytes = size; | ||
| 235 | |||
| 236 | if (start_new_rx_buffer(state->copy_off, bytes, state->head)) { | ||
| 237 | count++; | ||
| 238 | state->copy_off = 0; | ||
| 239 | } | ||
| 240 | |||
| 241 | if (state->copy_off + bytes > MAX_BUFFER_OFFSET) | ||
| 242 | bytes = MAX_BUFFER_OFFSET - state->copy_off; | ||
| 243 | |||
| 244 | state->copy_off += bytes; | ||
| 245 | |||
| 246 | offset += bytes; | ||
| 247 | size -= bytes; | ||
| 248 | |||
| 249 | if (offset == PAGE_SIZE) | ||
| 250 | offset = 0; | ||
| 251 | |||
| 252 | state->head = false; | ||
| 253 | } | ||
| 254 | |||
| 255 | return count; | ||
| 256 | } | ||
| 257 | |||
| 215 | /* | 258 | /* |
| 216 | * Figure out how many ring slots we're going to need to send @skb to | 259 | * Figure out how many ring slots we're going to need to send @skb to |
| 217 | * the guest. This function is essentially a dry run of | 260 | * the guest. This function is essentially a dry run of |
| @@ -219,48 +262,39 @@ static bool start_new_rx_buffer(int offset, unsigned long size, int head) | |||
| 219 | */ | 262 | */ |
| 220 | unsigned int xenvif_count_skb_slots(struct xenvif *vif, struct sk_buff *skb) | 263 | unsigned int xenvif_count_skb_slots(struct xenvif *vif, struct sk_buff *skb) |
| 221 | { | 264 | { |
| 265 | struct xenvif_count_slot_state state; | ||
| 222 | unsigned int count; | 266 | unsigned int count; |
| 223 | int i, copy_off; | 267 | unsigned char *data; |
| 268 | unsigned i; | ||
| 224 | 269 | ||
| 225 | count = DIV_ROUND_UP(skb_headlen(skb), PAGE_SIZE); | 270 | state.head = true; |
| 271 | state.copy_off = 0; | ||
| 226 | 272 | ||
| 227 | copy_off = skb_headlen(skb) % PAGE_SIZE; | 273 | /* Slot for the first (partial) page of data. */ |
| 274 | count = 1; | ||
| 228 | 275 | ||
| 276 | /* Need a slot for the GSO prefix for GSO extra data? */ | ||
| 229 | if (skb_shinfo(skb)->gso_size) | 277 | if (skb_shinfo(skb)->gso_size) |
| 230 | count++; | 278 | count++; |
| 231 | 279 | ||
| 232 | for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) { | 280 | data = skb->data; |
| 233 | unsigned long size = skb_frag_size(&skb_shinfo(skb)->frags[i]); | 281 | while (data < skb_tail_pointer(skb)) { |
| 234 | unsigned long offset = skb_shinfo(skb)->frags[i].page_offset; | 282 | unsigned long offset = offset_in_page(data); |
| 235 | unsigned long bytes; | 283 | unsigned long size = PAGE_SIZE - offset; |
| 236 | |||
| 237 | offset &= ~PAGE_MASK; | ||
| 238 | |||
| 239 | while (size > 0) { | ||
| 240 | BUG_ON(offset >= PAGE_SIZE); | ||
| 241 | BUG_ON(copy_off > MAX_BUFFER_OFFSET); | ||
| 242 | |||
| 243 | bytes = PAGE_SIZE - offset; | ||
| 244 | |||
| 245 | if (bytes > size) | ||
| 246 | bytes = size; | ||
| 247 | 284 | ||
| 248 | if (start_new_rx_buffer(copy_off, bytes, 0)) { | 285 | if (data + size > skb_tail_pointer(skb)) |
| 249 | count++; | 286 | size = skb_tail_pointer(skb) - data; |
| 250 | copy_off = 0; | ||
| 251 | } | ||
| 252 | 287 | ||
| 253 | if (copy_off + bytes > MAX_BUFFER_OFFSET) | 288 | count += xenvif_count_frag_slots(vif, offset, size, &state); |
| 254 | bytes = MAX_BUFFER_OFFSET - copy_off; | ||
| 255 | 289 | ||
| 256 | copy_off += bytes; | 290 | data += size; |
| 291 | } | ||
| 257 | 292 | ||
| 258 | offset += bytes; | 293 | for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) { |
| 259 | size -= bytes; | 294 | unsigned long size = skb_frag_size(&skb_shinfo(skb)->frags[i]); |
| 295 | unsigned long offset = skb_shinfo(skb)->frags[i].page_offset; | ||
| 260 | 296 | ||
| 261 | if (offset == PAGE_SIZE) | 297 | count += xenvif_count_frag_slots(vif, offset, size, &state); |
| 262 | offset = 0; | ||
| 263 | } | ||
| 264 | } | 298 | } |
| 265 | return count; | 299 | return count; |
| 266 | } | 300 | } |
diff --git a/drivers/net/xen-netback/xenbus.c b/drivers/net/xen-netback/xenbus.c index 1fe48fe364ed..a53782ef1540 100644 --- a/drivers/net/xen-netback/xenbus.c +++ b/drivers/net/xen-netback/xenbus.c | |||
| @@ -42,7 +42,7 @@ static int netback_remove(struct xenbus_device *dev) | |||
| 42 | if (be->vif) { | 42 | if (be->vif) { |
| 43 | kobject_uevent(&dev->dev.kobj, KOBJ_OFFLINE); | 43 | kobject_uevent(&dev->dev.kobj, KOBJ_OFFLINE); |
| 44 | xenbus_rm(XBT_NIL, dev->nodename, "hotplug-status"); | 44 | xenbus_rm(XBT_NIL, dev->nodename, "hotplug-status"); |
| 45 | xenvif_disconnect(be->vif); | 45 | xenvif_free(be->vif); |
| 46 | be->vif = NULL; | 46 | be->vif = NULL; |
| 47 | } | 47 | } |
| 48 | kfree(be); | 48 | kfree(be); |
| @@ -213,9 +213,18 @@ static void disconnect_backend(struct xenbus_device *dev) | |||
| 213 | { | 213 | { |
| 214 | struct backend_info *be = dev_get_drvdata(&dev->dev); | 214 | struct backend_info *be = dev_get_drvdata(&dev->dev); |
| 215 | 215 | ||
| 216 | if (be->vif) | ||
| 217 | xenvif_disconnect(be->vif); | ||
| 218 | } | ||
| 219 | |||
| 220 | static void destroy_backend(struct xenbus_device *dev) | ||
| 221 | { | ||
| 222 | struct backend_info *be = dev_get_drvdata(&dev->dev); | ||
| 223 | |||
| 216 | if (be->vif) { | 224 | if (be->vif) { |
| 225 | kobject_uevent(&dev->dev.kobj, KOBJ_OFFLINE); | ||
| 217 | xenbus_rm(XBT_NIL, dev->nodename, "hotplug-status"); | 226 | xenbus_rm(XBT_NIL, dev->nodename, "hotplug-status"); |
| 218 | xenvif_disconnect(be->vif); | 227 | xenvif_free(be->vif); |
| 219 | be->vif = NULL; | 228 | be->vif = NULL; |
| 220 | } | 229 | } |
| 221 | } | 230 | } |
| @@ -246,14 +255,11 @@ static void frontend_changed(struct xenbus_device *dev, | |||
| 246 | case XenbusStateConnected: | 255 | case XenbusStateConnected: |
| 247 | if (dev->state == XenbusStateConnected) | 256 | if (dev->state == XenbusStateConnected) |
| 248 | break; | 257 | break; |
| 249 | backend_create_xenvif(be); | ||
| 250 | if (be->vif) | 258 | if (be->vif) |
| 251 | connect(be); | 259 | connect(be); |
| 252 | break; | 260 | break; |
| 253 | 261 | ||
| 254 | case XenbusStateClosing: | 262 | case XenbusStateClosing: |
| 255 | if (be->vif) | ||
| 256 | kobject_uevent(&dev->dev.kobj, KOBJ_OFFLINE); | ||
| 257 | disconnect_backend(dev); | 263 | disconnect_backend(dev); |
| 258 | xenbus_switch_state(dev, XenbusStateClosing); | 264 | xenbus_switch_state(dev, XenbusStateClosing); |
| 259 | break; | 265 | break; |
| @@ -262,6 +268,7 @@ static void frontend_changed(struct xenbus_device *dev, | |||
| 262 | xenbus_switch_state(dev, XenbusStateClosed); | 268 | xenbus_switch_state(dev, XenbusStateClosed); |
| 263 | if (xenbus_dev_is_online(dev)) | 269 | if (xenbus_dev_is_online(dev)) |
| 264 | break; | 270 | break; |
| 271 | destroy_backend(dev); | ||
| 265 | /* fall through if not online */ | 272 | /* fall through if not online */ |
| 266 | case XenbusStateUnknown: | 273 | case XenbusStateUnknown: |
| 267 | device_unregister(&dev->dev); | 274 | device_unregister(&dev->dev); |
diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c index 7c29ee4ed0ae..b0299e6d9a3f 100644 --- a/drivers/pci/pci-acpi.c +++ b/drivers/pci/pci-acpi.c | |||
| @@ -47,6 +47,9 @@ static void pci_acpi_wake_dev(acpi_handle handle, u32 event, void *context) | |||
| 47 | if (event != ACPI_NOTIFY_DEVICE_WAKE || !pci_dev) | 47 | if (event != ACPI_NOTIFY_DEVICE_WAKE || !pci_dev) |
| 48 | return; | 48 | return; |
| 49 | 49 | ||
| 50 | if (pci_dev->pme_poll) | ||
| 51 | pci_dev->pme_poll = false; | ||
| 52 | |||
| 50 | if (pci_dev->current_state == PCI_D3cold) { | 53 | if (pci_dev->current_state == PCI_D3cold) { |
| 51 | pci_wakeup_event(pci_dev); | 54 | pci_wakeup_event(pci_dev); |
| 52 | pm_runtime_resume(&pci_dev->dev); | 55 | pm_runtime_resume(&pci_dev->dev); |
| @@ -57,9 +60,6 @@ static void pci_acpi_wake_dev(acpi_handle handle, u32 event, void *context) | |||
| 57 | if (pci_dev->pme_support) | 60 | if (pci_dev->pme_support) |
| 58 | pci_check_pme_status(pci_dev); | 61 | pci_check_pme_status(pci_dev); |
| 59 | 62 | ||
| 60 | if (pci_dev->pme_poll) | ||
| 61 | pci_dev->pme_poll = false; | ||
| 62 | |||
| 63 | pci_wakeup_event(pci_dev); | 63 | pci_wakeup_event(pci_dev); |
| 64 | pm_runtime_resume(&pci_dev->dev); | 64 | pm_runtime_resume(&pci_dev->dev); |
| 65 | 65 | ||
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index e8ccf6c0f08a..bdd64b1b4817 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c | |||
| @@ -1155,8 +1155,14 @@ static void pci_enable_bridge(struct pci_dev *dev) | |||
| 1155 | 1155 | ||
| 1156 | pci_enable_bridge(dev->bus->self); | 1156 | pci_enable_bridge(dev->bus->self); |
| 1157 | 1157 | ||
| 1158 | if (pci_is_enabled(dev)) | 1158 | if (pci_is_enabled(dev)) { |
| 1159 | if (!dev->is_busmaster) { | ||
| 1160 | dev_warn(&dev->dev, "driver skip pci_set_master, fix it!\n"); | ||
| 1161 | pci_set_master(dev); | ||
| 1162 | } | ||
| 1159 | return; | 1163 | return; |
| 1164 | } | ||
| 1165 | |||
| 1160 | retval = pci_enable_device(dev); | 1166 | retval = pci_enable_device(dev); |
| 1161 | if (retval) | 1167 | if (retval) |
| 1162 | dev_err(&dev->dev, "Error enabling bridge (%d), continuing\n", | 1168 | dev_err(&dev->dev, "Error enabling bridge (%d), continuing\n", |
diff --git a/drivers/scsi/bnx2fc/bnx2fc.h b/drivers/scsi/bnx2fc/bnx2fc.h index 08b22a901c25..d7ca9305ff45 100644 --- a/drivers/scsi/bnx2fc/bnx2fc.h +++ b/drivers/scsi/bnx2fc/bnx2fc.h | |||
| @@ -105,7 +105,7 @@ | |||
| 105 | #define BNX2FC_RQ_WQE_SIZE (BNX2FC_RQ_BUF_SZ) | 105 | #define BNX2FC_RQ_WQE_SIZE (BNX2FC_RQ_BUF_SZ) |
| 106 | #define BNX2FC_XFERQ_WQE_SIZE (sizeof(struct fcoe_xfrqe)) | 106 | #define BNX2FC_XFERQ_WQE_SIZE (sizeof(struct fcoe_xfrqe)) |
| 107 | #define BNX2FC_CONFQ_WQE_SIZE (sizeof(struct fcoe_confqe)) | 107 | #define BNX2FC_CONFQ_WQE_SIZE (sizeof(struct fcoe_confqe)) |
| 108 | #define BNX2FC_5771X_DB_PAGE_SIZE 128 | 108 | #define BNX2X_DB_SHIFT 3 |
| 109 | 109 | ||
| 110 | #define BNX2FC_TASK_SIZE 128 | 110 | #define BNX2FC_TASK_SIZE 128 |
| 111 | #define BNX2FC_TASKS_PER_PAGE (PAGE_SIZE/BNX2FC_TASK_SIZE) | 111 | #define BNX2FC_TASKS_PER_PAGE (PAGE_SIZE/BNX2FC_TASK_SIZE) |
diff --git a/drivers/scsi/bnx2fc/bnx2fc_hwi.c b/drivers/scsi/bnx2fc/bnx2fc_hwi.c index c0d035a8f8f9..46a37657307f 100644 --- a/drivers/scsi/bnx2fc/bnx2fc_hwi.c +++ b/drivers/scsi/bnx2fc/bnx2fc_hwi.c | |||
| @@ -1421,8 +1421,7 @@ int bnx2fc_map_doorbell(struct bnx2fc_rport *tgt) | |||
| 1421 | 1421 | ||
| 1422 | reg_base = pci_resource_start(hba->pcidev, | 1422 | reg_base = pci_resource_start(hba->pcidev, |
| 1423 | BNX2X_DOORBELL_PCI_BAR); | 1423 | BNX2X_DOORBELL_PCI_BAR); |
| 1424 | reg_off = BNX2FC_5771X_DB_PAGE_SIZE * | 1424 | reg_off = (1 << BNX2X_DB_SHIFT) * (context_id & 0x1FFFF); |
| 1425 | (context_id & 0x1FFFF) + DPM_TRIGER_TYPE; | ||
| 1426 | tgt->ctx_base = ioremap_nocache(reg_base + reg_off, 4); | 1425 | tgt->ctx_base = ioremap_nocache(reg_base + reg_off, 4); |
| 1427 | if (!tgt->ctx_base) | 1426 | if (!tgt->ctx_base) |
| 1428 | return -ENOMEM; | 1427 | return -ENOMEM; |
diff --git a/drivers/scsi/bnx2i/bnx2i.h b/drivers/scsi/bnx2i/bnx2i.h index 6940f0930a84..c73bbcb63c02 100644 --- a/drivers/scsi/bnx2i/bnx2i.h +++ b/drivers/scsi/bnx2i/bnx2i.h | |||
| @@ -64,7 +64,7 @@ | |||
| 64 | #define MAX_PAGES_PER_CTRL_STRUCT_POOL 8 | 64 | #define MAX_PAGES_PER_CTRL_STRUCT_POOL 8 |
| 65 | #define BNX2I_RESERVED_SLOW_PATH_CMD_SLOTS 4 | 65 | #define BNX2I_RESERVED_SLOW_PATH_CMD_SLOTS 4 |
| 66 | 66 | ||
| 67 | #define BNX2I_5771X_DBELL_PAGE_SIZE 128 | 67 | #define BNX2X_DB_SHIFT 3 |
| 68 | 68 | ||
| 69 | /* 5706/08 hardware has limit on maximum buffer size per BD it can handle */ | 69 | /* 5706/08 hardware has limit on maximum buffer size per BD it can handle */ |
| 70 | #define MAX_BD_LENGTH 65535 | 70 | #define MAX_BD_LENGTH 65535 |
diff --git a/drivers/scsi/bnx2i/bnx2i_hwi.c b/drivers/scsi/bnx2i/bnx2i_hwi.c index af3e675d4d48..5be718c241c4 100644 --- a/drivers/scsi/bnx2i/bnx2i_hwi.c +++ b/drivers/scsi/bnx2i/bnx2i_hwi.c | |||
| @@ -2738,8 +2738,7 @@ int bnx2i_map_ep_dbell_regs(struct bnx2i_endpoint *ep) | |||
| 2738 | if (test_bit(BNX2I_NX2_DEV_57710, &ep->hba->cnic_dev_type)) { | 2738 | if (test_bit(BNX2I_NX2_DEV_57710, &ep->hba->cnic_dev_type)) { |
| 2739 | reg_base = pci_resource_start(ep->hba->pcidev, | 2739 | reg_base = pci_resource_start(ep->hba->pcidev, |
| 2740 | BNX2X_DOORBELL_PCI_BAR); | 2740 | BNX2X_DOORBELL_PCI_BAR); |
| 2741 | reg_off = BNX2I_5771X_DBELL_PAGE_SIZE * (cid_num & 0x1FFFF) + | 2741 | reg_off = (1 << BNX2X_DB_SHIFT) * (cid_num & 0x1FFFF); |
| 2742 | DPM_TRIGER_TYPE; | ||
| 2743 | ep->qp.ctx_base = ioremap_nocache(reg_base + reg_off, 4); | 2742 | ep->qp.ctx_base = ioremap_nocache(reg_base + reg_off, 4); |
| 2744 | goto arm_cq; | 2743 | goto arm_cq; |
| 2745 | } | 2744 | } |
diff --git a/drivers/staging/comedi/Kconfig b/drivers/staging/comedi/Kconfig index a84aab47a113..f73287eab373 100644 --- a/drivers/staging/comedi/Kconfig +++ b/drivers/staging/comedi/Kconfig | |||
| @@ -96,6 +96,15 @@ config COMEDI_SKEL | |||
| 96 | To compile this driver as a module, choose M here: the module will be | 96 | To compile this driver as a module, choose M here: the module will be |
| 97 | called skel. | 97 | called skel. |
| 98 | 98 | ||
| 99 | config COMEDI_SSV_DNP | ||
| 100 | tristate "SSV Embedded Systems DIL/Net-PC support" | ||
| 101 | depends on X86_32 || COMPILE_TEST | ||
| 102 | ---help--- | ||
| 103 | Enable support for SSV Embedded Systems DIL/Net-PC | ||
| 104 | |||
| 105 | To compile this driver as a module, choose M here: the module will be | ||
| 106 | called ssv_dnp. | ||
| 107 | |||
| 99 | endif # COMEDI_MISC_DRIVERS | 108 | endif # COMEDI_MISC_DRIVERS |
| 100 | 109 | ||
| 101 | menuconfig COMEDI_ISA_DRIVERS | 110 | menuconfig COMEDI_ISA_DRIVERS |
| @@ -386,6 +395,14 @@ config COMEDI_DMM32AT | |||
| 386 | To compile this driver as a module, choose M here: the module will be | 395 | To compile this driver as a module, choose M here: the module will be |
| 387 | called dmm32at. | 396 | called dmm32at. |
| 388 | 397 | ||
| 398 | config COMEDI_UNIOXX5 | ||
| 399 | tristate "Fastwel UNIOxx-5 analog and digital io board support" | ||
| 400 | ---help--- | ||
| 401 | Enable support for Fastwel UNIOxx-5 (analog and digital i/o) boards | ||
| 402 | |||
| 403 | To compile this driver as a module, choose M here: the module will be | ||
| 404 | called unioxx5. | ||
| 405 | |||
| 389 | config COMEDI_FL512 | 406 | config COMEDI_FL512 |
| 390 | tristate "FL512 ISA card support" | 407 | tristate "FL512 ISA card support" |
| 391 | ---help--- | 408 | ---help--- |
| @@ -855,14 +872,6 @@ config COMEDI_DYNA_PCI10XX | |||
| 855 | To compile this driver as a module, choose M here: the module will be | 872 | To compile this driver as a module, choose M here: the module will be |
| 856 | called dyna_pci10xx. | 873 | called dyna_pci10xx. |
| 857 | 874 | ||
| 858 | config COMEDI_UNIOXX5 | ||
| 859 | tristate "Fastwel UNIOxx-5 analog and digital io board support" | ||
| 860 | ---help--- | ||
| 861 | Enable support for Fastwel UNIOxx-5 (analog and digital i/o) boards | ||
| 862 | |||
| 863 | To compile this driver as a module, choose M here: the module will be | ||
| 864 | called unioxx5. | ||
| 865 | |||
| 866 | config COMEDI_GSC_HPDI | 875 | config COMEDI_GSC_HPDI |
| 867 | tristate "General Standards PCI-HPDI32 / PMC-HPDI32 support" | 876 | tristate "General Standards PCI-HPDI32 / PMC-HPDI32 support" |
| 868 | select COMEDI_FC | 877 | select COMEDI_FC |
| @@ -1085,14 +1094,6 @@ config COMEDI_S626 | |||
| 1085 | To compile this driver as a module, choose M here: the module will be | 1094 | To compile this driver as a module, choose M here: the module will be |
| 1086 | called s626. | 1095 | called s626. |
| 1087 | 1096 | ||
| 1088 | config COMEDI_SSV_DNP | ||
| 1089 | tristate "SSV Embedded Systems DIL/Net-PC support" | ||
| 1090 | ---help--- | ||
| 1091 | Enable support for SSV Embedded Systems DIL/Net-PC | ||
| 1092 | |||
| 1093 | To compile this driver as a module, choose M here: the module will be | ||
| 1094 | called ssv_dnp. | ||
| 1095 | |||
| 1096 | config COMEDI_MITE | 1097 | config COMEDI_MITE |
| 1097 | depends on HAS_DMA | 1098 | depends on HAS_DMA |
| 1098 | tristate | 1099 | tristate |
diff --git a/drivers/staging/dgap/dgap_driver.c b/drivers/staging/dgap/dgap_driver.c index 724a685753dd..40ef785a0428 100644 --- a/drivers/staging/dgap/dgap_driver.c +++ b/drivers/staging/dgap/dgap_driver.c | |||
| @@ -474,7 +474,7 @@ static void dgap_cleanup_board(struct board_t *brd) | |||
| 474 | 474 | ||
| 475 | DGAP_LOCK(dgap_global_lock, flags); | 475 | DGAP_LOCK(dgap_global_lock, flags); |
| 476 | brd->msgbuf = NULL; | 476 | brd->msgbuf = NULL; |
| 477 | printk(brd->msgbuf_head); | 477 | printk("%s", brd->msgbuf_head); |
| 478 | kfree(brd->msgbuf_head); | 478 | kfree(brd->msgbuf_head); |
| 479 | brd->msgbuf_head = NULL; | 479 | brd->msgbuf_head = NULL; |
| 480 | DGAP_UNLOCK(dgap_global_lock, flags); | 480 | DGAP_UNLOCK(dgap_global_lock, flags); |
| @@ -628,7 +628,7 @@ static int dgap_found_board(struct pci_dev *pdev, int id) | |||
| 628 | DPR_INIT(("dgap_scan(%d) - printing out the msgbuf\n", i)); | 628 | DPR_INIT(("dgap_scan(%d) - printing out the msgbuf\n", i)); |
| 629 | DGAP_LOCK(dgap_global_lock, flags); | 629 | DGAP_LOCK(dgap_global_lock, flags); |
| 630 | brd->msgbuf = NULL; | 630 | brd->msgbuf = NULL; |
| 631 | printk(brd->msgbuf_head); | 631 | printk("%s", brd->msgbuf_head); |
| 632 | kfree(brd->msgbuf_head); | 632 | kfree(brd->msgbuf_head); |
| 633 | brd->msgbuf_head = NULL; | 633 | brd->msgbuf_head = NULL; |
| 634 | DGAP_UNLOCK(dgap_global_lock, flags); | 634 | DGAP_UNLOCK(dgap_global_lock, flags); |
| @@ -955,25 +955,28 @@ static void dgap_mbuf(struct board_t *brd, const char *fmt, ...) { | |||
| 955 | char buf[1024]; | 955 | char buf[1024]; |
| 956 | int i; | 956 | int i; |
| 957 | unsigned long flags; | 957 | unsigned long flags; |
| 958 | size_t length; | ||
| 958 | 959 | ||
| 959 | DGAP_LOCK(dgap_global_lock, flags); | 960 | DGAP_LOCK(dgap_global_lock, flags); |
| 960 | 961 | ||
| 961 | /* Format buf using fmt and arguments contained in ap. */ | 962 | /* Format buf using fmt and arguments contained in ap. */ |
| 962 | va_start(ap, fmt); | 963 | va_start(ap, fmt); |
| 963 | i = vsprintf(buf, fmt, ap); | 964 | i = vsnprintf(buf, sizeof(buf), fmt, ap); |
| 964 | va_end(ap); | 965 | va_end(ap); |
| 965 | 966 | ||
| 966 | DPR((buf)); | 967 | DPR((buf)); |
| 967 | 968 | ||
| 968 | if (!brd || !brd->msgbuf) { | 969 | if (!brd || !brd->msgbuf) { |
| 969 | printk(buf); | 970 | printk("%s", buf); |
| 970 | DGAP_UNLOCK(dgap_global_lock, flags); | 971 | DGAP_UNLOCK(dgap_global_lock, flags); |
| 971 | return; | 972 | return; |
| 972 | } | 973 | } |
| 973 | 974 | ||
| 974 | memcpy(brd->msgbuf, buf, strlen(buf)); | 975 | length = strlen(buf) + 1; |
| 975 | brd->msgbuf += strlen(buf); | 976 | if (brd->msgbuf - brd->msgbuf_head < length) |
| 976 | *brd->msgbuf = 0; | 977 | length = brd->msgbuf - brd->msgbuf_head; |
| 978 | memcpy(brd->msgbuf, buf, length); | ||
| 979 | brd->msgbuf += length; | ||
| 977 | 980 | ||
| 978 | DGAP_UNLOCK(dgap_global_lock, flags); | 981 | DGAP_UNLOCK(dgap_global_lock, flags); |
| 979 | } | 982 | } |
diff --git a/drivers/staging/dgnc/dgnc_driver.c b/drivers/staging/dgnc/dgnc_driver.c index f8c1e22585d6..71d2b83cc3a1 100644 --- a/drivers/staging/dgnc/dgnc_driver.c +++ b/drivers/staging/dgnc/dgnc_driver.c | |||
| @@ -454,7 +454,7 @@ static void dgnc_cleanup_board(struct board_t *brd) | |||
| 454 | 454 | ||
| 455 | DGNC_LOCK(dgnc_global_lock, flags); | 455 | DGNC_LOCK(dgnc_global_lock, flags); |
| 456 | brd->msgbuf = NULL; | 456 | brd->msgbuf = NULL; |
| 457 | printk(brd->msgbuf_head); | 457 | printk("%s", brd->msgbuf_head); |
| 458 | kfree(brd->msgbuf_head); | 458 | kfree(brd->msgbuf_head); |
| 459 | brd->msgbuf_head = NULL; | 459 | brd->msgbuf_head = NULL; |
| 460 | DGNC_UNLOCK(dgnc_global_lock, flags); | 460 | DGNC_UNLOCK(dgnc_global_lock, flags); |
| @@ -710,7 +710,7 @@ static int dgnc_found_board(struct pci_dev *pdev, int id) | |||
| 710 | DPR_INIT(("dgnc_scan(%d) - printing out the msgbuf\n", i)); | 710 | DPR_INIT(("dgnc_scan(%d) - printing out the msgbuf\n", i)); |
| 711 | DGNC_LOCK(dgnc_global_lock, flags); | 711 | DGNC_LOCK(dgnc_global_lock, flags); |
| 712 | brd->msgbuf = NULL; | 712 | brd->msgbuf = NULL; |
| 713 | printk(brd->msgbuf_head); | 713 | printk("%s", brd->msgbuf_head); |
| 714 | kfree(brd->msgbuf_head); | 714 | kfree(brd->msgbuf_head); |
| 715 | brd->msgbuf_head = NULL; | 715 | brd->msgbuf_head = NULL; |
| 716 | DGNC_UNLOCK(dgnc_global_lock, flags); | 716 | DGNC_UNLOCK(dgnc_global_lock, flags); |
diff --git a/drivers/staging/iio/Kconfig b/drivers/staging/iio/Kconfig index db4d6dc03243..b36feb080cba 100644 --- a/drivers/staging/iio/Kconfig +++ b/drivers/staging/iio/Kconfig | |||
| @@ -37,7 +37,7 @@ config IIO_SIMPLE_DUMMY_EVENTS | |||
| 37 | 37 | ||
| 38 | config IIO_SIMPLE_DUMMY_BUFFER | 38 | config IIO_SIMPLE_DUMMY_BUFFER |
| 39 | boolean "Buffered capture support" | 39 | boolean "Buffered capture support" |
| 40 | depends on IIO_KFIFO_BUF | 40 | select IIO_KFIFO_BUF |
| 41 | help | 41 | help |
| 42 | Add buffered data capture to the simple dummy driver. | 42 | Add buffered data capture to the simple dummy driver. |
| 43 | 43 | ||
diff --git a/drivers/staging/iio/light/isl29018.c b/drivers/staging/iio/light/isl29018.c index 351936c3efd6..e4998e4d4434 100644 --- a/drivers/staging/iio/light/isl29018.c +++ b/drivers/staging/iio/light/isl29018.c | |||
| @@ -563,6 +563,7 @@ static int isl29018_probe(struct i2c_client *client, | |||
| 563 | mutex_init(&chip->lock); | 563 | mutex_init(&chip->lock); |
| 564 | 564 | ||
| 565 | chip->lux_scale = 1; | 565 | chip->lux_scale = 1; |
| 566 | chip->lux_uscale = 0; | ||
| 566 | chip->range = 1000; | 567 | chip->range = 1000; |
| 567 | chip->adc_bit = 16; | 568 | chip->adc_bit = 16; |
| 568 | chip->suspended = false; | 569 | chip->suspended = false; |
diff --git a/drivers/staging/iio/magnetometer/hmc5843.c b/drivers/staging/iio/magnetometer/hmc5843.c index d2748c329eae..c3f3f539e787 100644 --- a/drivers/staging/iio/magnetometer/hmc5843.c +++ b/drivers/staging/iio/magnetometer/hmc5843.c | |||
| @@ -229,7 +229,7 @@ static int hmc5843_read_measurement(struct iio_dev *indio_dev, | |||
| 229 | if (result < 0) | 229 | if (result < 0) |
| 230 | return -EINVAL; | 230 | return -EINVAL; |
| 231 | 231 | ||
| 232 | *val = result; | 232 | *val = sign_extend32(result, 15); |
| 233 | return IIO_VAL_INT; | 233 | return IIO_VAL_INT; |
| 234 | } | 234 | } |
| 235 | 235 | ||
diff --git a/drivers/staging/iio/meter/ade7854-spi.c b/drivers/staging/iio/meter/ade7854-spi.c index a802cf2491d6..4c6d2041260b 100644 --- a/drivers/staging/iio/meter/ade7854-spi.c +++ b/drivers/staging/iio/meter/ade7854-spi.c | |||
| @@ -299,7 +299,7 @@ static int ade7854_spi_probe(struct spi_device *spi) | |||
| 299 | if (ret) | 299 | if (ret) |
| 300 | iio_device_free(indio_dev); | 300 | iio_device_free(indio_dev); |
| 301 | 301 | ||
| 302 | return 0; | 302 | return ret; |
| 303 | } | 303 | } |
| 304 | 304 | ||
| 305 | static int ade7854_spi_remove(struct spi_device *spi) | 305 | static int ade7854_spi_remove(struct spi_device *spi) |
diff --git a/drivers/staging/line6/toneport.c b/drivers/staging/line6/toneport.c index 2f44d56700af..776d3632dc7d 100644 --- a/drivers/staging/line6/toneport.c +++ b/drivers/staging/line6/toneport.c | |||
| @@ -244,13 +244,17 @@ static int snd_toneport_source_put(struct snd_kcontrol *kcontrol, | |||
| 244 | struct snd_line6_pcm *line6pcm = snd_kcontrol_chip(kcontrol); | 244 | struct snd_line6_pcm *line6pcm = snd_kcontrol_chip(kcontrol); |
| 245 | struct usb_line6_toneport *toneport = | 245 | struct usb_line6_toneport *toneport = |
| 246 | (struct usb_line6_toneport *)line6pcm->line6; | 246 | (struct usb_line6_toneport *)line6pcm->line6; |
| 247 | unsigned int source; | ||
| 247 | 248 | ||
| 248 | if (ucontrol->value.enumerated.item[0] == toneport->source) | 249 | source = ucontrol->value.enumerated.item[0]; |
| 250 | if (source >= ARRAY_SIZE(toneport_source_info)) | ||
| 251 | return -EINVAL; | ||
| 252 | if (source == toneport->source) | ||
| 249 | return 0; | 253 | return 0; |
| 250 | 254 | ||
| 251 | toneport->source = ucontrol->value.enumerated.item[0]; | 255 | toneport->source = source; |
| 252 | toneport_send_cmd(toneport->line6.usbdev, | 256 | toneport_send_cmd(toneport->line6.usbdev, |
| 253 | toneport_source_info[toneport->source].code, 0x0000); | 257 | toneport_source_info[source].code, 0x0000); |
| 254 | return 1; | 258 | return 1; |
| 255 | } | 259 | } |
| 256 | 260 | ||
diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c index 086ca3d7241b..26b49a24b3df 100644 --- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c +++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c | |||
| @@ -1802,7 +1802,7 @@ kiblnd_recv (lnet_ni_t *ni, void *private, lnet_msg_t *lntmsg, int delayed, | |||
| 1802 | int | 1802 | int |
| 1803 | kiblnd_thread_start(int (*fn)(void *arg), void *arg, char *name) | 1803 | kiblnd_thread_start(int (*fn)(void *arg), void *arg, char *name) |
| 1804 | { | 1804 | { |
| 1805 | struct task_struct *task = kthread_run(fn, arg, name); | 1805 | struct task_struct *task = kthread_run(fn, arg, "%s", name); |
| 1806 | 1806 | ||
| 1807 | if (IS_ERR(task)) | 1807 | if (IS_ERR(task)) |
| 1808 | return PTR_ERR(task); | 1808 | return PTR_ERR(task); |
diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c index 2c581b7fa8ad..68a4f52ec998 100644 --- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c +++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c | |||
| @@ -1005,7 +1005,7 @@ ksocknal_send(lnet_ni_t *ni, void *private, lnet_msg_t *lntmsg) | |||
| 1005 | int | 1005 | int |
| 1006 | ksocknal_thread_start(int (*fn)(void *arg), void *arg, char *name) | 1006 | ksocknal_thread_start(int (*fn)(void *arg), void *arg, char *name) |
| 1007 | { | 1007 | { |
| 1008 | struct task_struct *task = kthread_run(fn, arg, name); | 1008 | struct task_struct *task = kthread_run(fn, arg, "%s", name); |
| 1009 | 1009 | ||
| 1010 | if (IS_ERR(task)) | 1010 | if (IS_ERR(task)) |
| 1011 | return PTR_ERR(task); | 1011 | return PTR_ERR(task); |
diff --git a/drivers/staging/lustre/lustre/Kconfig b/drivers/staging/lustre/lustre/Kconfig index 4e898e491860..2156a44d0740 100644 --- a/drivers/staging/lustre/lustre/Kconfig +++ b/drivers/staging/lustre/lustre/Kconfig | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | config LUSTRE_FS | 1 | config LUSTRE_FS |
| 2 | tristate "Lustre file system client support" | 2 | tristate "Lustre file system client support" |
| 3 | depends on INET && m | 3 | depends on INET && m && !MIPS && !XTENSA && !SUPERH |
| 4 | select LNET | 4 | select LNET |
| 5 | select CRYPTO | 5 | select CRYPTO |
| 6 | select CRYPTO_CRC32 | 6 | select CRYPTO_CRC32 |
| @@ -52,7 +52,7 @@ config LUSTRE_DEBUG_EXPENSIVE_CHECK | |||
| 52 | config LUSTRE_TRANSLATE_ERRNOS | 52 | config LUSTRE_TRANSLATE_ERRNOS |
| 53 | bool | 53 | bool |
| 54 | depends on LUSTRE_FS && !X86 | 54 | depends on LUSTRE_FS && !X86 |
| 55 | default true | 55 | default y |
| 56 | 56 | ||
| 57 | config LUSTRE_LLITE_LLOOP | 57 | config LUSTRE_LLITE_LLOOP |
| 58 | bool "Lustre virtual block device" | 58 | bool "Lustre virtual block device" |
diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c b/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c index 3916bda3004c..a100a0b96381 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c | |||
| @@ -800,9 +800,9 @@ static int ldlm_bl_thread_start(struct ldlm_bl_pool *blp) | |||
| 800 | 800 | ||
| 801 | init_completion(&bltd.bltd_comp); | 801 | init_completion(&bltd.bltd_comp); |
| 802 | bltd.bltd_num = atomic_read(&blp->blp_num_threads); | 802 | bltd.bltd_num = atomic_read(&blp->blp_num_threads); |
| 803 | snprintf(bltd.bltd_name, sizeof(bltd.bltd_name) - 1, | 803 | snprintf(bltd.bltd_name, sizeof(bltd.bltd_name), |
| 804 | "ldlm_bl_%02d", bltd.bltd_num); | 804 | "ldlm_bl_%02d", bltd.bltd_num); |
| 805 | task = kthread_run(ldlm_bl_thread_main, &bltd, bltd.bltd_name); | 805 | task = kthread_run(ldlm_bl_thread_main, &bltd, "%s", bltd.bltd_name); |
| 806 | if (IS_ERR(task)) { | 806 | if (IS_ERR(task)) { |
| 807 | CERROR("cannot start LDLM thread ldlm_bl_%02d: rc %ld\n", | 807 | CERROR("cannot start LDLM thread ldlm_bl_%02d: rc %ld\n", |
| 808 | atomic_read(&blp->blp_num_threads), PTR_ERR(task)); | 808 | atomic_read(&blp->blp_num_threads), PTR_ERR(task)); |
diff --git a/drivers/staging/lustre/lustre/libcfs/workitem.c b/drivers/staging/lustre/lustre/libcfs/workitem.c index 462172d1a756..1a55c81892e0 100644 --- a/drivers/staging/lustre/lustre/libcfs/workitem.c +++ b/drivers/staging/lustre/lustre/libcfs/workitem.c | |||
| @@ -397,7 +397,7 @@ cfs_wi_sched_create(char *name, struct cfs_cpt_table *cptab, | |||
| 397 | sched->ws_name, sched->ws_nthreads); | 397 | sched->ws_name, sched->ws_nthreads); |
| 398 | } | 398 | } |
| 399 | 399 | ||
| 400 | task = kthread_run(cfs_wi_scheduler, sched, name); | 400 | task = kthread_run(cfs_wi_scheduler, sched, "%s", name); |
| 401 | if (!IS_ERR(task)) { | 401 | if (!IS_ERR(task)) { |
| 402 | nthrs--; | 402 | nthrs--; |
| 403 | continue; | 403 | continue; |
diff --git a/drivers/staging/lustre/lustre/ptlrpc/pinger.c b/drivers/staging/lustre/lustre/ptlrpc/pinger.c index 227a0ae9593b..5dec771d70ee 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/pinger.c +++ b/drivers/staging/lustre/lustre/ptlrpc/pinger.c | |||
| @@ -383,8 +383,8 @@ int ptlrpc_start_pinger(void) | |||
| 383 | 383 | ||
| 384 | /* CLONE_VM and CLONE_FILES just avoid a needless copy, because we | 384 | /* CLONE_VM and CLONE_FILES just avoid a needless copy, because we |
| 385 | * just drop the VM and FILES in cfs_daemonize_ctxt() right away. */ | 385 | * just drop the VM and FILES in cfs_daemonize_ctxt() right away. */ |
| 386 | rc = PTR_ERR(kthread_run(ptlrpc_pinger_main, | 386 | rc = PTR_ERR(kthread_run(ptlrpc_pinger_main, &pinger_thread, |
| 387 | &pinger_thread, pinger_thread.t_name)); | 387 | "%s", pinger_thread.t_name)); |
| 388 | if (IS_ERR_VALUE(rc)) { | 388 | if (IS_ERR_VALUE(rc)) { |
| 389 | CERROR("cannot start thread: %d\n", rc); | 389 | CERROR("cannot start thread: %d\n", rc); |
| 390 | return rc; | 390 | return rc; |
diff --git a/drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c b/drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c index fbdeff65d059..89c9be96f454 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c +++ b/drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c | |||
| @@ -615,7 +615,7 @@ int ptlrpcd_start(int index, int max, const char *name, struct ptlrpcd_ctl *pc) | |||
| 615 | init_completion(&pc->pc_starting); | 615 | init_completion(&pc->pc_starting); |
| 616 | init_completion(&pc->pc_finishing); | 616 | init_completion(&pc->pc_finishing); |
| 617 | spin_lock_init(&pc->pc_lock); | 617 | spin_lock_init(&pc->pc_lock); |
| 618 | strncpy(pc->pc_name, name, sizeof(pc->pc_name) - 1); | 618 | strlcpy(pc->pc_name, name, sizeof(pc->pc_name)); |
| 619 | pc->pc_set = ptlrpc_prep_set(); | 619 | pc->pc_set = ptlrpc_prep_set(); |
| 620 | if (pc->pc_set == NULL) | 620 | if (pc->pc_set == NULL) |
| 621 | GOTO(out, rc = -ENOMEM); | 621 | GOTO(out, rc = -ENOMEM); |
| @@ -638,7 +638,7 @@ int ptlrpcd_start(int index, int max, const char *name, struct ptlrpcd_ctl *pc) | |||
| 638 | GOTO(out, rc); | 638 | GOTO(out, rc); |
| 639 | } | 639 | } |
| 640 | 640 | ||
| 641 | task = kthread_run(ptlrpcd, pc, pc->pc_name); | 641 | task = kthread_run(ptlrpcd, pc, "%s", pc->pc_name); |
| 642 | if (IS_ERR(task)) | 642 | if (IS_ERR(task)) |
| 643 | GOTO(out, rc = PTR_ERR(task)); | 643 | GOTO(out, rc = PTR_ERR(task)); |
| 644 | 644 | ||
| @@ -745,7 +745,7 @@ static int ptlrpcd_init(void) | |||
| 745 | if (ptlrpcds == NULL) | 745 | if (ptlrpcds == NULL) |
| 746 | GOTO(out, rc = -ENOMEM); | 746 | GOTO(out, rc = -ENOMEM); |
| 747 | 747 | ||
| 748 | snprintf(name, 15, "ptlrpcd_rcv"); | 748 | snprintf(name, sizeof(name), "ptlrpcd_rcv"); |
| 749 | set_bit(LIOD_RECOVERY, &ptlrpcds->pd_thread_rcv.pc_flags); | 749 | set_bit(LIOD_RECOVERY, &ptlrpcds->pd_thread_rcv.pc_flags); |
| 750 | rc = ptlrpcd_start(-1, nthreads, name, &ptlrpcds->pd_thread_rcv); | 750 | rc = ptlrpcd_start(-1, nthreads, name, &ptlrpcds->pd_thread_rcv); |
| 751 | if (rc < 0) | 751 | if (rc < 0) |
| @@ -764,7 +764,7 @@ static int ptlrpcd_init(void) | |||
| 764 | * unnecessary dependency. But how to distribute async RPCs load | 764 | * unnecessary dependency. But how to distribute async RPCs load |
| 765 | * among all the ptlrpc daemons becomes another trouble. */ | 765 | * among all the ptlrpc daemons becomes another trouble. */ |
| 766 | for (i = 0; i < nthreads; i++) { | 766 | for (i = 0; i < nthreads; i++) { |
| 767 | snprintf(name, 15, "ptlrpcd_%d", i); | 767 | snprintf(name, sizeof(name), "ptlrpcd_%d", i); |
| 768 | rc = ptlrpcd_start(i, nthreads, name, &ptlrpcds->pd_threads[i]); | 768 | rc = ptlrpcd_start(i, nthreads, name, &ptlrpcds->pd_threads[i]); |
| 769 | if (rc < 0) | 769 | if (rc < 0) |
| 770 | GOTO(out, rc); | 770 | GOTO(out, rc); |
diff --git a/drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c b/drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c index e90c8fb7da6a..6547f46a7729 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c +++ b/drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c | |||
| @@ -59,8 +59,8 @@ | |||
| 59 | ****************************************/ | 59 | ****************************************/ |
| 60 | 60 | ||
| 61 | 61 | ||
| 62 | #define PTRS_PER_PAGE (PAGE_CACHE_SIZE / sizeof(void *)) | 62 | #define POINTERS_PER_PAGE (PAGE_CACHE_SIZE / sizeof(void *)) |
| 63 | #define PAGES_PER_POOL (PTRS_PER_PAGE) | 63 | #define PAGES_PER_POOL (POINTERS_PER_PAGE) |
| 64 | 64 | ||
| 65 | #define IDLE_IDX_MAX (100) | 65 | #define IDLE_IDX_MAX (100) |
| 66 | #define IDLE_IDX_WEIGHT (3) | 66 | #define IDLE_IDX_WEIGHT (3) |
diff --git a/drivers/staging/lustre/lustre/ptlrpc/service.c b/drivers/staging/lustre/lustre/ptlrpc/service.c index ac8b5fd2300b..acf75f3873d1 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/service.c +++ b/drivers/staging/lustre/lustre/ptlrpc/service.c | |||
| @@ -2718,15 +2718,15 @@ int ptlrpc_start_thread(struct ptlrpc_service_part *svcpt, int wait) | |||
| 2718 | spin_unlock(&svcpt->scp_lock); | 2718 | spin_unlock(&svcpt->scp_lock); |
| 2719 | 2719 | ||
| 2720 | if (svcpt->scp_cpt >= 0) { | 2720 | if (svcpt->scp_cpt >= 0) { |
| 2721 | snprintf(thread->t_name, PTLRPC_THR_NAME_LEN, "%s%02d_%03d", | 2721 | snprintf(thread->t_name, sizeof(thread->t_name), "%s%02d_%03d", |
| 2722 | svc->srv_thread_name, svcpt->scp_cpt, thread->t_id); | 2722 | svc->srv_thread_name, svcpt->scp_cpt, thread->t_id); |
| 2723 | } else { | 2723 | } else { |
| 2724 | snprintf(thread->t_name, PTLRPC_THR_NAME_LEN, "%s_%04d", | 2724 | snprintf(thread->t_name, sizeof(thread->t_name), "%s_%04d", |
| 2725 | svc->srv_thread_name, thread->t_id); | 2725 | svc->srv_thread_name, thread->t_id); |
| 2726 | } | 2726 | } |
| 2727 | 2727 | ||
| 2728 | CDEBUG(D_RPCTRACE, "starting thread '%s'\n", thread->t_name); | 2728 | CDEBUG(D_RPCTRACE, "starting thread '%s'\n", thread->t_name); |
| 2729 | rc = PTR_ERR(kthread_run(ptlrpc_main, thread, thread->t_name)); | 2729 | rc = PTR_ERR(kthread_run(ptlrpc_main, thread, "%s", thread->t_name)); |
| 2730 | if (IS_ERR_VALUE(rc)) { | 2730 | if (IS_ERR_VALUE(rc)) { |
| 2731 | CERROR("cannot start thread '%s': rc %d\n", | 2731 | CERROR("cannot start thread '%s': rc %d\n", |
| 2732 | thread->t_name, rc); | 2732 | thread->t_name, rc); |
diff --git a/drivers/staging/octeon/ethernet-mem.c b/drivers/staging/octeon/ethernet-mem.c index 78b6cb743769..199059d64c9b 100644 --- a/drivers/staging/octeon/ethernet-mem.c +++ b/drivers/staging/octeon/ethernet-mem.c | |||
| @@ -48,13 +48,8 @@ static int cvm_oct_fill_hw_skbuff(int pool, int size, int elements) | |||
| 48 | while (freed) { | 48 | while (freed) { |
| 49 | 49 | ||
| 50 | struct sk_buff *skb = dev_alloc_skb(size + 256); | 50 | struct sk_buff *skb = dev_alloc_skb(size + 256); |
| 51 | if (unlikely(skb == NULL)) { | 51 | if (unlikely(skb == NULL)) |
| 52 | pr_warning | ||
| 53 | ("Failed to allocate skb for hardware pool %d\n", | ||
| 54 | pool); | ||
| 55 | break; | 52 | break; |
| 56 | } | ||
| 57 | |||
| 58 | skb_reserve(skb, 256 - (((unsigned long)skb->data) & 0x7f)); | 53 | skb_reserve(skb, 256 - (((unsigned long)skb->data) & 0x7f)); |
| 59 | *(struct sk_buff **)(skb->data - sizeof(void *)) = skb; | 54 | *(struct sk_buff **)(skb->data - sizeof(void *)) = skb; |
| 60 | cvmx_fpa_free(skb->data, pool, DONT_WRITEBACK(size / 128)); | 55 | cvmx_fpa_free(skb->data, pool, DONT_WRITEBACK(size / 128)); |
diff --git a/drivers/staging/octeon/ethernet-rgmii.c b/drivers/staging/octeon/ethernet-rgmii.c index d8f5f694ec35..ea53af30dfa7 100644 --- a/drivers/staging/octeon/ethernet-rgmii.c +++ b/drivers/staging/octeon/ethernet-rgmii.c | |||
| @@ -373,9 +373,7 @@ int cvm_oct_rgmii_init(struct net_device *dev) | |||
| 373 | * Enable interrupts on inband status changes | 373 | * Enable interrupts on inband status changes |
| 374 | * for this port. | 374 | * for this port. |
| 375 | */ | 375 | */ |
| 376 | gmx_rx_int_en.u64 = | 376 | gmx_rx_int_en.u64 = 0; |
| 377 | cvmx_read_csr(CVMX_GMXX_RXX_INT_EN | ||
| 378 | (index, interface)); | ||
| 379 | gmx_rx_int_en.s.phy_dupx = 1; | 377 | gmx_rx_int_en.s.phy_dupx = 1; |
| 380 | gmx_rx_int_en.s.phy_link = 1; | 378 | gmx_rx_int_en.s.phy_link = 1; |
| 381 | gmx_rx_int_en.s.phy_spd = 1; | 379 | gmx_rx_int_en.s.phy_spd = 1; |
diff --git a/drivers/staging/octeon/ethernet-rx.c b/drivers/staging/octeon/ethernet-rx.c index 34afc16bc493..e14a1bb04361 100644 --- a/drivers/staging/octeon/ethernet-rx.c +++ b/drivers/staging/octeon/ethernet-rx.c | |||
| @@ -303,6 +303,7 @@ static int cvm_oct_napi_poll(struct napi_struct *napi, int budget) | |||
| 303 | if (backlog > budget * cores_in_use && napi != NULL) | 303 | if (backlog > budget * cores_in_use && napi != NULL) |
| 304 | cvm_oct_enable_one_cpu(); | 304 | cvm_oct_enable_one_cpu(); |
| 305 | } | 305 | } |
| 306 | rx_count++; | ||
| 306 | 307 | ||
| 307 | skb_in_hw = USE_SKBUFFS_IN_HW && work->word2.s.bufs == 1; | 308 | skb_in_hw = USE_SKBUFFS_IN_HW && work->word2.s.bufs == 1; |
| 308 | if (likely(skb_in_hw)) { | 309 | if (likely(skb_in_hw)) { |
| @@ -336,9 +337,6 @@ static int cvm_oct_napi_poll(struct napi_struct *napi, int budget) | |||
| 336 | */ | 337 | */ |
| 337 | skb = dev_alloc_skb(work->len); | 338 | skb = dev_alloc_skb(work->len); |
| 338 | if (!skb) { | 339 | if (!skb) { |
| 339 | printk_ratelimited("Port %d failed to allocate " | ||
| 340 | "skbuff, packet dropped\n", | ||
| 341 | work->ipprt); | ||
| 342 | cvm_oct_free_work(work); | 340 | cvm_oct_free_work(work); |
| 343 | continue; | 341 | continue; |
| 344 | } | 342 | } |
| @@ -429,7 +427,6 @@ static int cvm_oct_napi_poll(struct napi_struct *napi, int budget) | |||
| 429 | #endif | 427 | #endif |
| 430 | } | 428 | } |
| 431 | netif_receive_skb(skb); | 429 | netif_receive_skb(skb); |
| 432 | rx_count++; | ||
| 433 | } else { | 430 | } else { |
| 434 | /* Drop any packet received for a device that isn't up */ | 431 | /* Drop any packet received for a device that isn't up */ |
| 435 | /* | 432 | /* |
diff --git a/drivers/staging/rtl8188eu/core/rtw_ieee80211.c b/drivers/staging/rtl8188eu/core/rtw_ieee80211.c index 3605c5da822d..6fc77428e83a 100644 --- a/drivers/staging/rtl8188eu/core/rtw_ieee80211.c +++ b/drivers/staging/rtl8188eu/core/rtw_ieee80211.c | |||
| @@ -157,8 +157,8 @@ _func_enter_; | |||
| 157 | 157 | ||
| 158 | *frlen = *frlen + (len + 2); | 158 | *frlen = *frlen + (len + 2); |
| 159 | 159 | ||
| 160 | return pbuf + len + 2; | ||
| 161 | _func_exit_; | 160 | _func_exit_; |
| 161 | return pbuf + len + 2; | ||
| 162 | } | 162 | } |
| 163 | 163 | ||
| 164 | inline u8 *rtw_set_ie_ch_switch (u8 *buf, u32 *buf_len, u8 ch_switch_mode, | 164 | inline u8 *rtw_set_ie_ch_switch (u8 *buf, u32 *buf_len, u8 ch_switch_mode, |
diff --git a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c index 8b2ba26ba38d..4b2eb8e9b562 100644 --- a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c +++ b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c | |||
| @@ -1827,13 +1827,13 @@ unsigned int OnAction_back(struct adapter *padapter, union recv_frame *precv_fra | |||
| 1827 | 1827 | ||
| 1828 | #ifdef CONFIG_88EU_P2P | 1828 | #ifdef CONFIG_88EU_P2P |
| 1829 | 1829 | ||
| 1830 | static int get_reg_classes_full_count(struct p2p_channels channel_list) | 1830 | static int get_reg_classes_full_count(struct p2p_channels *channel_list) |
| 1831 | { | 1831 | { |
| 1832 | int cnt = 0; | 1832 | int cnt = 0; |
| 1833 | int i; | 1833 | int i; |
| 1834 | 1834 | ||
| 1835 | for (i = 0; i < channel_list.reg_classes; i++) { | 1835 | for (i = 0; i < channel_list->reg_classes; i++) { |
| 1836 | cnt += channel_list.reg_class[i].channels; | 1836 | cnt += channel_list->reg_class[i].channels; |
| 1837 | } | 1837 | } |
| 1838 | 1838 | ||
| 1839 | return cnt; | 1839 | return cnt; |
| @@ -2065,7 +2065,7 @@ void issue_p2p_GO_request(struct adapter *padapter, u8 *raddr) | |||
| 2065 | /* + number of channels in all classes */ | 2065 | /* + number of channels in all classes */ |
| 2066 | len_channellist_attr = 3 | 2066 | len_channellist_attr = 3 |
| 2067 | + (1 + 1) * (u16)(pmlmeext->channel_list.reg_classes) | 2067 | + (1 + 1) * (u16)(pmlmeext->channel_list.reg_classes) |
| 2068 | + get_reg_classes_full_count(pmlmeext->channel_list); | 2068 | + get_reg_classes_full_count(&pmlmeext->channel_list); |
| 2069 | 2069 | ||
| 2070 | *(__le16 *)(p2pie + p2pielen) = cpu_to_le16(len_channellist_attr); | 2070 | *(__le16 *)(p2pie + p2pielen) = cpu_to_le16(len_channellist_attr); |
| 2071 | p2pielen += 2; | 2071 | p2pielen += 2; |
| @@ -2437,7 +2437,7 @@ static void issue_p2p_GO_response(struct adapter *padapter, u8 *raddr, u8 *frame | |||
| 2437 | /* + number of channels in all classes */ | 2437 | /* + number of channels in all classes */ |
| 2438 | len_channellist_attr = 3 | 2438 | len_channellist_attr = 3 |
| 2439 | + (1 + 1) * (u16)pmlmeext->channel_list.reg_classes | 2439 | + (1 + 1) * (u16)pmlmeext->channel_list.reg_classes |
| 2440 | + get_reg_classes_full_count(pmlmeext->channel_list); | 2440 | + get_reg_classes_full_count(&pmlmeext->channel_list); |
| 2441 | 2441 | ||
| 2442 | *(__le16 *)(p2pie + p2pielen) = cpu_to_le16(len_channellist_attr); | 2442 | *(__le16 *)(p2pie + p2pielen) = cpu_to_le16(len_channellist_attr); |
| 2443 | 2443 | ||
| @@ -2859,7 +2859,7 @@ void issue_p2p_invitation_request(struct adapter *padapter, u8 *raddr) | |||
| 2859 | /* + number of channels in all classes */ | 2859 | /* + number of channels in all classes */ |
| 2860 | len_channellist_attr = 3 | 2860 | len_channellist_attr = 3 |
| 2861 | + (1 + 1) * (u16)pmlmeext->channel_list.reg_classes | 2861 | + (1 + 1) * (u16)pmlmeext->channel_list.reg_classes |
| 2862 | + get_reg_classes_full_count(pmlmeext->channel_list); | 2862 | + get_reg_classes_full_count(&pmlmeext->channel_list); |
| 2863 | 2863 | ||
| 2864 | *(__le16 *)(p2pie + p2pielen) = cpu_to_le16(len_channellist_attr); | 2864 | *(__le16 *)(p2pie + p2pielen) = cpu_to_le16(len_channellist_attr); |
| 2865 | 2865 | ||
| @@ -3120,7 +3120,7 @@ void issue_p2p_invitation_response(struct adapter *padapter, u8 *raddr, u8 dialo | |||
| 3120 | /* + number of channels in all classes */ | 3120 | /* + number of channels in all classes */ |
| 3121 | len_channellist_attr = 3 | 3121 | len_channellist_attr = 3 |
| 3122 | + (1 + 1) * (u16)pmlmeext->channel_list.reg_classes | 3122 | + (1 + 1) * (u16)pmlmeext->channel_list.reg_classes |
| 3123 | + get_reg_classes_full_count(pmlmeext->channel_list); | 3123 | + get_reg_classes_full_count(&pmlmeext->channel_list); |
| 3124 | 3124 | ||
| 3125 | *(__le16 *)(p2pie + p2pielen) = cpu_to_le16(len_channellist_attr); | 3125 | *(__le16 *)(p2pie + p2pielen) = cpu_to_le16(len_channellist_attr); |
| 3126 | p2pielen += 2; | 3126 | p2pielen += 2; |
diff --git a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c index 013ea487e7ac..8018edd3d42e 100644 --- a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c +++ b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c | |||
| @@ -631,7 +631,7 @@ void WMMOnAssocRsp(struct adapter *padapter) | |||
| 631 | inx[0] = 0; inx[1] = 1; inx[2] = 2; inx[3] = 3; | 631 | inx[0] = 0; inx[1] = 1; inx[2] = 2; inx[3] = 3; |
| 632 | 632 | ||
| 633 | if (pregpriv->wifi_spec == 1) { | 633 | if (pregpriv->wifi_spec == 1) { |
| 634 | u32 j, tmp, change_inx; | 634 | u32 j, tmp, change_inx = false; |
| 635 | 635 | ||
| 636 | /* entry indx: 0->vo, 1->vi, 2->be, 3->bk. */ | 636 | /* entry indx: 0->vo, 1->vi, 2->be, 3->bk. */ |
| 637 | for (i = 0; i < 4; i++) { | 637 | for (i = 0; i < 4; i++) { |
diff --git a/drivers/staging/rtl8188eu/include/odm.h b/drivers/staging/rtl8188eu/include/odm.h index 2bfe72841921..4787bacdcad8 100644 --- a/drivers/staging/rtl8188eu/include/odm.h +++ b/drivers/staging/rtl8188eu/include/odm.h | |||
| @@ -1010,7 +1010,7 @@ enum dm_dig_op { | |||
| 1010 | #define DM_false_ALARM_THRESH_LOW 400 | 1010 | #define DM_false_ALARM_THRESH_LOW 400 |
| 1011 | #define DM_false_ALARM_THRESH_HIGH 1000 | 1011 | #define DM_false_ALARM_THRESH_HIGH 1000 |
| 1012 | 1012 | ||
| 1013 | #define DM_DIG_MAX_NIC 0x3e | 1013 | #define DM_DIG_MAX_NIC 0x4e |
| 1014 | #define DM_DIG_MIN_NIC 0x1e /* 0x22/0x1c */ | 1014 | #define DM_DIG_MIN_NIC 0x1e /* 0x22/0x1c */ |
| 1015 | 1015 | ||
| 1016 | #define DM_DIG_MAX_AP 0x32 | 1016 | #define DM_DIG_MAX_AP 0x32 |
diff --git a/drivers/staging/rtl8188eu/include/rtl8188e_hal.h b/drivers/staging/rtl8188eu/include/rtl8188e_hal.h index 52b280165a92..555c801d2ded 100644 --- a/drivers/staging/rtl8188eu/include/rtl8188e_hal.h +++ b/drivers/staging/rtl8188eu/include/rtl8188e_hal.h | |||
| @@ -188,7 +188,7 @@ enum ChannelPlan { | |||
| 188 | 188 | ||
| 189 | struct txpowerinfo24g { | 189 | struct txpowerinfo24g { |
| 190 | u8 IndexCCK_Base[MAX_RF_PATH][MAX_CHNL_GROUP_24G]; | 190 | u8 IndexCCK_Base[MAX_RF_PATH][MAX_CHNL_GROUP_24G]; |
| 191 | u8 IndexBW40_Base[MAX_RF_PATH][MAX_CHNL_GROUP_24G-1]; | 191 | u8 IndexBW40_Base[MAX_RF_PATH][MAX_CHNL_GROUP_24G]; |
| 192 | /* If only one tx, only BW20 and OFDM are used. */ | 192 | /* If only one tx, only BW20 and OFDM are used. */ |
| 193 | s8 CCK_Diff[MAX_RF_PATH][MAX_TX_COUNT]; | 193 | s8 CCK_Diff[MAX_RF_PATH][MAX_TX_COUNT]; |
| 194 | s8 OFDM_Diff[MAX_RF_PATH][MAX_TX_COUNT]; | 194 | s8 OFDM_Diff[MAX_RF_PATH][MAX_TX_COUNT]; |
diff --git a/drivers/staging/rtl8188eu/include/rtw_mlme_ext.h b/drivers/staging/rtl8188eu/include/rtw_mlme_ext.h index a96b018e5e6a..853ab80a2b86 100644 --- a/drivers/staging/rtl8188eu/include/rtw_mlme_ext.h +++ b/drivers/staging/rtl8188eu/include/rtw_mlme_ext.h | |||
| @@ -870,6 +870,7 @@ static struct fwevent wlanevents[] = { | |||
| 870 | {0, NULL}, | 870 | {0, NULL}, |
| 871 | {0, NULL}, | 871 | {0, NULL}, |
| 872 | {0, &rtw_cpwm_event_callback}, | 872 | {0, &rtw_cpwm_event_callback}, |
| 873 | {0, NULL}, | ||
| 873 | }; | 874 | }; |
| 874 | 875 | ||
| 875 | #endif/* _RTL_MLME_EXT_C_ */ | 876 | #endif/* _RTL_MLME_EXT_C_ */ |
diff --git a/drivers/staging/vt6656/card.c b/drivers/staging/vt6656/card.c index dbf11ecb794e..19d3cf451b88 100644 --- a/drivers/staging/vt6656/card.c +++ b/drivers/staging/vt6656/card.c | |||
| @@ -172,8 +172,8 @@ static u16 swGetOFDMControlRate(struct vnt_private *pDevice, u16 wRateIdx) | |||
| 172 | if (!CARDbIsOFDMinBasicRate(pDevice)) { | 172 | if (!CARDbIsOFDMinBasicRate(pDevice)) { |
| 173 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO | 173 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO |
| 174 | "swGetOFDMControlRate:(NO OFDM) %d\n", wRateIdx); | 174 | "swGetOFDMControlRate:(NO OFDM) %d\n", wRateIdx); |
| 175 | if (wRateIdx > RATE_24M) | 175 | if (wRateIdx > RATE_24M) |
| 176 | wRateIdx = RATE_24M; | 176 | wRateIdx = RATE_24M; |
| 177 | return wRateIdx; | 177 | return wRateIdx; |
| 178 | } | 178 | } |
| 179 | 179 | ||
diff --git a/drivers/staging/xillybus/xillybus_core.c b/drivers/staging/xillybus/xillybus_core.c index efc56987a60b..7db6f03a0054 100644 --- a/drivers/staging/xillybus/xillybus_core.c +++ b/drivers/staging/xillybus/xillybus_core.c | |||
| @@ -2054,7 +2054,7 @@ static int xillybus_init_chrdev(struct xilly_endpoint *endpoint, | |||
| 2054 | NULL, | 2054 | NULL, |
| 2055 | MKDEV(major, i), | 2055 | MKDEV(major, i), |
| 2056 | NULL, | 2056 | NULL, |
| 2057 | devname); | 2057 | "%s", devname); |
| 2058 | 2058 | ||
| 2059 | if (IS_ERR(device)) { | 2059 | if (IS_ERR(device)) { |
| 2060 | pr_warn("xillybus: Failed to create %s " | 2060 | pr_warn("xillybus: Failed to create %s " |
diff --git a/drivers/staging/zram/zram_drv.c b/drivers/staging/zram/zram_drv.c index 91d94b564433..2c4ed52ca849 100644 --- a/drivers/staging/zram/zram_drv.c +++ b/drivers/staging/zram/zram_drv.c | |||
| @@ -981,4 +981,3 @@ MODULE_PARM_DESC(num_devices, "Number of zram devices"); | |||
| 981 | MODULE_LICENSE("Dual BSD/GPL"); | 981 | MODULE_LICENSE("Dual BSD/GPL"); |
| 982 | MODULE_AUTHOR("Nitin Gupta <ngupta@vflare.org>"); | 982 | MODULE_AUTHOR("Nitin Gupta <ngupta@vflare.org>"); |
| 983 | MODULE_DESCRIPTION("Compressed RAM Block Device"); | 983 | MODULE_DESCRIPTION("Compressed RAM Block Device"); |
| 984 | MODULE_ALIAS("devname:zram"); | ||
diff --git a/drivers/usb/dwc3/Kconfig b/drivers/usb/dwc3/Kconfig index b870872e020f..70fc43027a5c 100644 --- a/drivers/usb/dwc3/Kconfig +++ b/drivers/usb/dwc3/Kconfig | |||
| @@ -1,7 +1,6 @@ | |||
| 1 | config USB_DWC3 | 1 | config USB_DWC3 |
| 2 | tristate "DesignWare USB3 DRD Core Support" | 2 | tristate "DesignWare USB3 DRD Core Support" |
| 3 | depends on (USB || USB_GADGET) && HAS_DMA | 3 | depends on (USB || USB_GADGET) && HAS_DMA |
| 4 | depends on EXTCON | ||
| 5 | select USB_XHCI_PLATFORM if USB_SUPPORT && USB_XHCI_HCD | 4 | select USB_XHCI_PLATFORM if USB_SUPPORT && USB_XHCI_HCD |
| 6 | help | 5 | help |
| 7 | Say Y or M here if your system has a Dual Role SuperSpeed | 6 | Say Y or M here if your system has a Dual Role SuperSpeed |
diff --git a/drivers/usb/dwc3/dwc3-pci.c b/drivers/usb/dwc3/dwc3-pci.c index 9b138129e856..997ebe420bc9 100644 --- a/drivers/usb/dwc3/dwc3-pci.c +++ b/drivers/usb/dwc3/dwc3-pci.c | |||
| @@ -28,6 +28,7 @@ | |||
| 28 | /* FIXME define these in <linux/pci_ids.h> */ | 28 | /* FIXME define these in <linux/pci_ids.h> */ |
| 29 | #define PCI_VENDOR_ID_SYNOPSYS 0x16c3 | 29 | #define PCI_VENDOR_ID_SYNOPSYS 0x16c3 |
| 30 | #define PCI_DEVICE_ID_SYNOPSYS_HAPSUSB3 0xabcd | 30 | #define PCI_DEVICE_ID_SYNOPSYS_HAPSUSB3 0xabcd |
| 31 | #define PCI_DEVICE_ID_INTEL_BYT 0x0f37 | ||
| 31 | 32 | ||
| 32 | struct dwc3_pci { | 33 | struct dwc3_pci { |
| 33 | struct device *dev; | 34 | struct device *dev; |
| @@ -187,6 +188,7 @@ static DEFINE_PCI_DEVICE_TABLE(dwc3_pci_id_table) = { | |||
| 187 | PCI_DEVICE(PCI_VENDOR_ID_SYNOPSYS, | 188 | PCI_DEVICE(PCI_VENDOR_ID_SYNOPSYS, |
| 188 | PCI_DEVICE_ID_SYNOPSYS_HAPSUSB3), | 189 | PCI_DEVICE_ID_SYNOPSYS_HAPSUSB3), |
| 189 | }, | 190 | }, |
| 191 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_BYT), }, | ||
| 190 | { } /* Terminating Entry */ | 192 | { } /* Terminating Entry */ |
| 191 | }; | 193 | }; |
| 192 | MODULE_DEVICE_TABLE(pci, dwc3_pci_id_table); | 194 | MODULE_DEVICE_TABLE(pci, dwc3_pci_id_table); |
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index f168eaebdef8..5452c0fce360 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c | |||
| @@ -2611,15 +2611,13 @@ int dwc3_gadget_init(struct dwc3 *dwc) | |||
| 2611 | ret = usb_add_gadget_udc(dwc->dev, &dwc->gadget); | 2611 | ret = usb_add_gadget_udc(dwc->dev, &dwc->gadget); |
| 2612 | if (ret) { | 2612 | if (ret) { |
| 2613 | dev_err(dwc->dev, "failed to register udc\n"); | 2613 | dev_err(dwc->dev, "failed to register udc\n"); |
| 2614 | goto err5; | 2614 | goto err4; |
| 2615 | } | 2615 | } |
| 2616 | 2616 | ||
| 2617 | return 0; | 2617 | return 0; |
| 2618 | 2618 | ||
| 2619 | err5: | ||
| 2620 | dwc3_gadget_free_endpoints(dwc); | ||
| 2621 | |||
| 2622 | err4: | 2619 | err4: |
| 2620 | dwc3_gadget_free_endpoints(dwc); | ||
| 2623 | dma_free_coherent(dwc->dev, DWC3_EP0_BOUNCE_SIZE, | 2621 | dma_free_coherent(dwc->dev, DWC3_EP0_BOUNCE_SIZE, |
| 2624 | dwc->ep0_bounce, dwc->ep0_bounce_addr); | 2622 | dwc->ep0_bounce, dwc->ep0_bounce_addr); |
| 2625 | 2623 | ||
diff --git a/drivers/usb/gadget/cdc2.c b/drivers/usb/gadget/cdc2.c index 5a5acf22c694..e126b6b248e6 100644 --- a/drivers/usb/gadget/cdc2.c +++ b/drivers/usb/gadget/cdc2.c | |||
| @@ -113,12 +113,6 @@ static int __init cdc_do_config(struct usb_configuration *c) | |||
| 113 | c->bmAttributes |= USB_CONFIG_ATT_WAKEUP; | 113 | c->bmAttributes |= USB_CONFIG_ATT_WAKEUP; |
| 114 | } | 114 | } |
| 115 | 115 | ||
| 116 | fi_ecm = usb_get_function_instance("ecm"); | ||
| 117 | if (IS_ERR(fi_ecm)) { | ||
| 118 | status = PTR_ERR(fi_ecm); | ||
| 119 | goto err_func_ecm; | ||
| 120 | } | ||
| 121 | |||
| 122 | f_ecm = usb_get_function(fi_ecm); | 116 | f_ecm = usb_get_function(fi_ecm); |
| 123 | if (IS_ERR(f_ecm)) { | 117 | if (IS_ERR(f_ecm)) { |
| 124 | status = PTR_ERR(f_ecm); | 118 | status = PTR_ERR(f_ecm); |
| @@ -129,35 +123,24 @@ static int __init cdc_do_config(struct usb_configuration *c) | |||
| 129 | if (status) | 123 | if (status) |
| 130 | goto err_add_ecm; | 124 | goto err_add_ecm; |
| 131 | 125 | ||
| 132 | fi_serial = usb_get_function_instance("acm"); | ||
| 133 | if (IS_ERR(fi_serial)) { | ||
| 134 | status = PTR_ERR(fi_serial); | ||
| 135 | goto err_get_acm; | ||
| 136 | } | ||
| 137 | |||
| 138 | f_acm = usb_get_function(fi_serial); | 126 | f_acm = usb_get_function(fi_serial); |
| 139 | if (IS_ERR(f_acm)) { | 127 | if (IS_ERR(f_acm)) { |
| 140 | status = PTR_ERR(f_acm); | 128 | status = PTR_ERR(f_acm); |
| 141 | goto err_func_acm; | 129 | goto err_get_acm; |
| 142 | } | 130 | } |
| 143 | 131 | ||
| 144 | status = usb_add_function(c, f_acm); | 132 | status = usb_add_function(c, f_acm); |
| 145 | if (status) | 133 | if (status) |
| 146 | goto err_add_acm; | 134 | goto err_add_acm; |
| 147 | |||
| 148 | return 0; | 135 | return 0; |
| 149 | 136 | ||
| 150 | err_add_acm: | 137 | err_add_acm: |
| 151 | usb_put_function(f_acm); | 138 | usb_put_function(f_acm); |
| 152 | err_func_acm: | ||
| 153 | usb_put_function_instance(fi_serial); | ||
| 154 | err_get_acm: | 139 | err_get_acm: |
| 155 | usb_remove_function(c, f_ecm); | 140 | usb_remove_function(c, f_ecm); |
| 156 | err_add_ecm: | 141 | err_add_ecm: |
| 157 | usb_put_function(f_ecm); | 142 | usb_put_function(f_ecm); |
| 158 | err_get_ecm: | 143 | err_get_ecm: |
| 159 | usb_put_function_instance(fi_ecm); | ||
| 160 | err_func_ecm: | ||
| 161 | return status; | 144 | return status; |
| 162 | } | 145 | } |
| 163 | 146 | ||
diff --git a/drivers/usb/gadget/dummy_hcd.c b/drivers/usb/gadget/dummy_hcd.c index 06ecd08fd57a..b8a2376971a4 100644 --- a/drivers/usb/gadget/dummy_hcd.c +++ b/drivers/usb/gadget/dummy_hcd.c | |||
| @@ -923,8 +923,9 @@ static int dummy_udc_stop(struct usb_gadget *g, | |||
| 923 | struct dummy_hcd *dum_hcd = gadget_to_dummy_hcd(g); | 923 | struct dummy_hcd *dum_hcd = gadget_to_dummy_hcd(g); |
| 924 | struct dummy *dum = dum_hcd->dum; | 924 | struct dummy *dum = dum_hcd->dum; |
| 925 | 925 | ||
| 926 | dev_dbg(udc_dev(dum), "unregister gadget driver '%s'\n", | 926 | if (driver) |
| 927 | driver->driver.name); | 927 | dev_dbg(udc_dev(dum), "unregister gadget driver '%s'\n", |
| 928 | driver->driver.name); | ||
| 928 | 929 | ||
| 929 | dum->driver = NULL; | 930 | dum->driver = NULL; |
| 930 | 931 | ||
| @@ -1000,8 +1001,8 @@ static int dummy_udc_remove(struct platform_device *pdev) | |||
| 1000 | { | 1001 | { |
| 1001 | struct dummy *dum = platform_get_drvdata(pdev); | 1002 | struct dummy *dum = platform_get_drvdata(pdev); |
| 1002 | 1003 | ||
| 1003 | usb_del_gadget_udc(&dum->gadget); | ||
| 1004 | device_remove_file(&dum->gadget.dev, &dev_attr_function); | 1004 | device_remove_file(&dum->gadget.dev, &dev_attr_function); |
| 1005 | usb_del_gadget_udc(&dum->gadget); | ||
| 1005 | return 0; | 1006 | return 0; |
| 1006 | } | 1007 | } |
| 1007 | 1008 | ||
diff --git a/drivers/usb/gadget/f_ecm.c b/drivers/usb/gadget/f_ecm.c index edab45da3741..8d9e6f7e8f1a 100644 --- a/drivers/usb/gadget/f_ecm.c +++ b/drivers/usb/gadget/f_ecm.c | |||
| @@ -995,7 +995,7 @@ static void ecm_unbind(struct usb_configuration *c, struct usb_function *f) | |||
| 995 | usb_ep_free_request(ecm->notify, ecm->notify_req); | 995 | usb_ep_free_request(ecm->notify, ecm->notify_req); |
| 996 | } | 996 | } |
| 997 | 997 | ||
| 998 | struct usb_function *ecm_alloc(struct usb_function_instance *fi) | 998 | static struct usb_function *ecm_alloc(struct usb_function_instance *fi) |
| 999 | { | 999 | { |
| 1000 | struct f_ecm *ecm; | 1000 | struct f_ecm *ecm; |
| 1001 | struct f_ecm_opts *opts; | 1001 | struct f_ecm_opts *opts; |
diff --git a/drivers/usb/gadget/f_eem.c b/drivers/usb/gadget/f_eem.c index d00392d879db..d61c11d765d0 100644 --- a/drivers/usb/gadget/f_eem.c +++ b/drivers/usb/gadget/f_eem.c | |||
| @@ -624,7 +624,7 @@ static void eem_unbind(struct usb_configuration *c, struct usb_function *f) | |||
| 624 | usb_free_all_descriptors(f); | 624 | usb_free_all_descriptors(f); |
| 625 | } | 625 | } |
| 626 | 626 | ||
| 627 | struct usb_function *eem_alloc(struct usb_function_instance *fi) | 627 | static struct usb_function *eem_alloc(struct usb_function_instance *fi) |
| 628 | { | 628 | { |
| 629 | struct f_eem *eem; | 629 | struct f_eem *eem; |
| 630 | struct f_eem_opts *opts; | 630 | struct f_eem_opts *opts; |
diff --git a/drivers/usb/gadget/f_mass_storage.c b/drivers/usb/gadget/f_mass_storage.c index 313b835eedfd..a01d7d38c016 100644 --- a/drivers/usb/gadget/f_mass_storage.c +++ b/drivers/usb/gadget/f_mass_storage.c | |||
| @@ -2260,10 +2260,12 @@ reset: | |||
| 2260 | /* Disable the endpoints */ | 2260 | /* Disable the endpoints */ |
| 2261 | if (fsg->bulk_in_enabled) { | 2261 | if (fsg->bulk_in_enabled) { |
| 2262 | usb_ep_disable(fsg->bulk_in); | 2262 | usb_ep_disable(fsg->bulk_in); |
| 2263 | fsg->bulk_in->driver_data = NULL; | ||
| 2263 | fsg->bulk_in_enabled = 0; | 2264 | fsg->bulk_in_enabled = 0; |
| 2264 | } | 2265 | } |
| 2265 | if (fsg->bulk_out_enabled) { | 2266 | if (fsg->bulk_out_enabled) { |
| 2266 | usb_ep_disable(fsg->bulk_out); | 2267 | usb_ep_disable(fsg->bulk_out); |
| 2268 | fsg->bulk_out->driver_data = NULL; | ||
| 2267 | fsg->bulk_out_enabled = 0; | 2269 | fsg->bulk_out_enabled = 0; |
| 2268 | } | 2270 | } |
| 2269 | 2271 | ||
diff --git a/drivers/usb/gadget/fotg210-udc.c b/drivers/usb/gadget/fotg210-udc.c index 32db2eee2d87..bbbfd1948778 100644 --- a/drivers/usb/gadget/fotg210-udc.c +++ b/drivers/usb/gadget/fotg210-udc.c | |||
| @@ -1214,6 +1214,6 @@ static struct platform_driver fotg210_driver = { | |||
| 1214 | 1214 | ||
| 1215 | module_platform_driver(fotg210_driver); | 1215 | module_platform_driver(fotg210_driver); |
| 1216 | 1216 | ||
| 1217 | MODULE_AUTHOR("Yuan-Hsin Chen <yhchen@faraday-tech.com>"); | 1217 | MODULE_AUTHOR("Yuan-Hsin Chen, Feng-Hsin Chiang <john453@faraday-tech.com>"); |
| 1218 | MODULE_LICENSE("GPL"); | 1218 | MODULE_LICENSE("GPL"); |
| 1219 | MODULE_DESCRIPTION(DRIVER_DESC); | 1219 | MODULE_DESCRIPTION(DRIVER_DESC); |
diff --git a/drivers/usb/gadget/fusb300_udc.c b/drivers/usb/gadget/fusb300_udc.c index f1dd6daabe21..b278abe52453 100644 --- a/drivers/usb/gadget/fusb300_udc.c +++ b/drivers/usb/gadget/fusb300_udc.c | |||
| @@ -22,7 +22,7 @@ | |||
| 22 | 22 | ||
| 23 | MODULE_DESCRIPTION("FUSB300 USB gadget driver"); | 23 | MODULE_DESCRIPTION("FUSB300 USB gadget driver"); |
| 24 | MODULE_LICENSE("GPL"); | 24 | MODULE_LICENSE("GPL"); |
| 25 | MODULE_AUTHOR("Yuan Hsin Chen <yhchen@faraday-tech.com>"); | 25 | MODULE_AUTHOR("Yuan-Hsin Chen, Feng-Hsin Chiang <john453@faraday-tech.com>"); |
| 26 | MODULE_ALIAS("platform:fusb300_udc"); | 26 | MODULE_ALIAS("platform:fusb300_udc"); |
| 27 | 27 | ||
| 28 | #define DRIVER_VERSION "20 October 2010" | 28 | #define DRIVER_VERSION "20 October 2010" |
diff --git a/drivers/usb/gadget/multi.c b/drivers/usb/gadget/multi.c index 2a1ebefd8f9e..23393254a8a3 100644 --- a/drivers/usb/gadget/multi.c +++ b/drivers/usb/gadget/multi.c | |||
| @@ -179,7 +179,7 @@ err_conf: | |||
| 179 | return ret; | 179 | return ret; |
| 180 | } | 180 | } |
| 181 | 181 | ||
| 182 | static int rndis_config_register(struct usb_composite_dev *cdev) | 182 | static __ref int rndis_config_register(struct usb_composite_dev *cdev) |
| 183 | { | 183 | { |
| 184 | static struct usb_configuration config = { | 184 | static struct usb_configuration config = { |
| 185 | .bConfigurationValue = MULTI_RNDIS_CONFIG_NUM, | 185 | .bConfigurationValue = MULTI_RNDIS_CONFIG_NUM, |
| @@ -194,7 +194,7 @@ static int rndis_config_register(struct usb_composite_dev *cdev) | |||
| 194 | 194 | ||
| 195 | #else | 195 | #else |
| 196 | 196 | ||
| 197 | static int rndis_config_register(struct usb_composite_dev *cdev) | 197 | static __ref int rndis_config_register(struct usb_composite_dev *cdev) |
| 198 | { | 198 | { |
| 199 | return 0; | 199 | return 0; |
| 200 | } | 200 | } |
| @@ -241,7 +241,7 @@ err_conf: | |||
| 241 | return ret; | 241 | return ret; |
| 242 | } | 242 | } |
| 243 | 243 | ||
| 244 | static int cdc_config_register(struct usb_composite_dev *cdev) | 244 | static __ref int cdc_config_register(struct usb_composite_dev *cdev) |
| 245 | { | 245 | { |
| 246 | static struct usb_configuration config = { | 246 | static struct usb_configuration config = { |
| 247 | .bConfigurationValue = MULTI_CDC_CONFIG_NUM, | 247 | .bConfigurationValue = MULTI_CDC_CONFIG_NUM, |
| @@ -256,7 +256,7 @@ static int cdc_config_register(struct usb_composite_dev *cdev) | |||
| 256 | 256 | ||
| 257 | #else | 257 | #else |
| 258 | 258 | ||
| 259 | static int cdc_config_register(struct usb_composite_dev *cdev) | 259 | static __ref int cdc_config_register(struct usb_composite_dev *cdev) |
| 260 | { | 260 | { |
| 261 | return 0; | 261 | return 0; |
| 262 | } | 262 | } |
diff --git a/drivers/usb/gadget/mv_u3d_core.c b/drivers/usb/gadget/mv_u3d_core.c index bbb6e98c4384..561b30efb8ee 100644 --- a/drivers/usb/gadget/mv_u3d_core.c +++ b/drivers/usb/gadget/mv_u3d_core.c | |||
| @@ -645,6 +645,7 @@ static int mv_u3d_ep_disable(struct usb_ep *_ep) | |||
| 645 | struct mv_u3d_ep *ep; | 645 | struct mv_u3d_ep *ep; |
| 646 | struct mv_u3d_ep_context *ep_context; | 646 | struct mv_u3d_ep_context *ep_context; |
| 647 | u32 epxcr, direction; | 647 | u32 epxcr, direction; |
| 648 | unsigned long flags; | ||
| 648 | 649 | ||
| 649 | if (!_ep) | 650 | if (!_ep) |
| 650 | return -EINVAL; | 651 | return -EINVAL; |
| @@ -661,7 +662,9 @@ static int mv_u3d_ep_disable(struct usb_ep *_ep) | |||
| 661 | direction = mv_u3d_ep_dir(ep); | 662 | direction = mv_u3d_ep_dir(ep); |
| 662 | 663 | ||
| 663 | /* nuke all pending requests (does flush) */ | 664 | /* nuke all pending requests (does flush) */ |
| 665 | spin_lock_irqsave(&u3d->lock, flags); | ||
| 664 | mv_u3d_nuke(ep, -ESHUTDOWN); | 666 | mv_u3d_nuke(ep, -ESHUTDOWN); |
| 667 | spin_unlock_irqrestore(&u3d->lock, flags); | ||
| 665 | 668 | ||
| 666 | /* Disable the endpoint for Rx or Tx and reset the endpoint type */ | 669 | /* Disable the endpoint for Rx or Tx and reset the endpoint type */ |
| 667 | if (direction == MV_U3D_EP_DIR_OUT) { | 670 | if (direction == MV_U3D_EP_DIR_OUT) { |
diff --git a/drivers/usb/gadget/s3c-hsotg.c b/drivers/usb/gadget/s3c-hsotg.c index d69b36a99dbc..6bddf1aa2347 100644 --- a/drivers/usb/gadget/s3c-hsotg.c +++ b/drivers/usb/gadget/s3c-hsotg.c | |||
| @@ -2475,8 +2475,6 @@ irq_retry: | |||
| 2475 | if (gintsts & GINTSTS_ErlySusp) { | 2475 | if (gintsts & GINTSTS_ErlySusp) { |
| 2476 | dev_dbg(hsotg->dev, "GINTSTS_ErlySusp\n"); | 2476 | dev_dbg(hsotg->dev, "GINTSTS_ErlySusp\n"); |
| 2477 | writel(GINTSTS_ErlySusp, hsotg->regs + GINTSTS); | 2477 | writel(GINTSTS_ErlySusp, hsotg->regs + GINTSTS); |
| 2478 | |||
| 2479 | s3c_hsotg_disconnect(hsotg); | ||
| 2480 | } | 2478 | } |
| 2481 | 2479 | ||
| 2482 | /* | 2480 | /* |
| @@ -2962,9 +2960,6 @@ static int s3c_hsotg_udc_stop(struct usb_gadget *gadget, | |||
| 2962 | if (!hsotg) | 2960 | if (!hsotg) |
| 2963 | return -ENODEV; | 2961 | return -ENODEV; |
| 2964 | 2962 | ||
| 2965 | if (!driver || driver != hsotg->driver || !driver->unbind) | ||
| 2966 | return -EINVAL; | ||
| 2967 | |||
| 2968 | /* all endpoints should be shutdown */ | 2963 | /* all endpoints should be shutdown */ |
| 2969 | for (ep = 0; ep < hsotg->num_of_eps; ep++) | 2964 | for (ep = 0; ep < hsotg->num_of_eps; ep++) |
| 2970 | s3c_hsotg_ep_disable(&hsotg->eps[ep].ep); | 2965 | s3c_hsotg_ep_disable(&hsotg->eps[ep].ep); |
| @@ -2972,15 +2967,15 @@ static int s3c_hsotg_udc_stop(struct usb_gadget *gadget, | |||
| 2972 | spin_lock_irqsave(&hsotg->lock, flags); | 2967 | spin_lock_irqsave(&hsotg->lock, flags); |
| 2973 | 2968 | ||
| 2974 | s3c_hsotg_phy_disable(hsotg); | 2969 | s3c_hsotg_phy_disable(hsotg); |
| 2975 | regulator_bulk_disable(ARRAY_SIZE(hsotg->supplies), hsotg->supplies); | ||
| 2976 | 2970 | ||
| 2977 | hsotg->driver = NULL; | 2971 | if (!driver) |
| 2972 | hsotg->driver = NULL; | ||
| 2973 | |||
| 2978 | hsotg->gadget.speed = USB_SPEED_UNKNOWN; | 2974 | hsotg->gadget.speed = USB_SPEED_UNKNOWN; |
| 2979 | 2975 | ||
| 2980 | spin_unlock_irqrestore(&hsotg->lock, flags); | 2976 | spin_unlock_irqrestore(&hsotg->lock, flags); |
| 2981 | 2977 | ||
| 2982 | dev_info(hsotg->dev, "unregistered gadget driver '%s'\n", | 2978 | regulator_bulk_disable(ARRAY_SIZE(hsotg->supplies), hsotg->supplies); |
| 2983 | driver->driver.name); | ||
| 2984 | 2979 | ||
| 2985 | return 0; | 2980 | return 0; |
| 2986 | } | 2981 | } |
diff --git a/drivers/usb/host/ehci-fsl.c b/drivers/usb/host/ehci-fsl.c index 947b009009f1..4449f565d6c6 100644 --- a/drivers/usb/host/ehci-fsl.c +++ b/drivers/usb/host/ehci-fsl.c | |||
| @@ -669,7 +669,7 @@ static const struct hc_driver ehci_fsl_hc_driver = { | |||
| 669 | * generic hardware linkage | 669 | * generic hardware linkage |
| 670 | */ | 670 | */ |
| 671 | .irq = ehci_irq, | 671 | .irq = ehci_irq, |
| 672 | .flags = HCD_USB2 | HCD_MEMORY | HCD_BH, | 672 | .flags = HCD_USB2 | HCD_MEMORY, |
| 673 | 673 | ||
| 674 | /* | 674 | /* |
| 675 | * basic lifecycle operations | 675 | * basic lifecycle operations |
diff --git a/drivers/usb/host/ehci-grlib.c b/drivers/usb/host/ehci-grlib.c index b52a66ce92e8..83ab51af250f 100644 --- a/drivers/usb/host/ehci-grlib.c +++ b/drivers/usb/host/ehci-grlib.c | |||
| @@ -43,7 +43,7 @@ static const struct hc_driver ehci_grlib_hc_driver = { | |||
| 43 | * generic hardware linkage | 43 | * generic hardware linkage |
| 44 | */ | 44 | */ |
| 45 | .irq = ehci_irq, | 45 | .irq = ehci_irq, |
| 46 | .flags = HCD_MEMORY | HCD_USB2 | HCD_BH, | 46 | .flags = HCD_MEMORY | HCD_USB2, |
| 47 | 47 | ||
| 48 | /* | 48 | /* |
| 49 | * basic lifecycle operations | 49 | * basic lifecycle operations |
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c index 5d6022f30ebe..86ab9fd9fe9e 100644 --- a/drivers/usb/host/ehci-hcd.c +++ b/drivers/usb/host/ehci-hcd.c | |||
| @@ -1158,7 +1158,7 @@ static const struct hc_driver ehci_hc_driver = { | |||
| 1158 | * generic hardware linkage | 1158 | * generic hardware linkage |
| 1159 | */ | 1159 | */ |
| 1160 | .irq = ehci_irq, | 1160 | .irq = ehci_irq, |
| 1161 | .flags = HCD_MEMORY | HCD_USB2 | HCD_BH, | 1161 | .flags = HCD_MEMORY | HCD_USB2, |
| 1162 | 1162 | ||
| 1163 | /* | 1163 | /* |
| 1164 | * basic lifecycle operations | 1164 | * basic lifecycle operations |
diff --git a/drivers/usb/host/ehci-mv.c b/drivers/usb/host/ehci-mv.c index 417c10da9450..35cdbd88bbbe 100644 --- a/drivers/usb/host/ehci-mv.c +++ b/drivers/usb/host/ehci-mv.c | |||
| @@ -96,7 +96,7 @@ static const struct hc_driver mv_ehci_hc_driver = { | |||
| 96 | * generic hardware linkage | 96 | * generic hardware linkage |
| 97 | */ | 97 | */ |
| 98 | .irq = ehci_irq, | 98 | .irq = ehci_irq, |
| 99 | .flags = HCD_MEMORY | HCD_USB2 | HCD_BH, | 99 | .flags = HCD_MEMORY | HCD_USB2, |
| 100 | 100 | ||
| 101 | /* | 101 | /* |
| 102 | * basic lifecycle operations | 102 | * basic lifecycle operations |
diff --git a/drivers/usb/host/ehci-octeon.c b/drivers/usb/host/ehci-octeon.c index ab0397e4d8f3..45cc00158412 100644 --- a/drivers/usb/host/ehci-octeon.c +++ b/drivers/usb/host/ehci-octeon.c | |||
| @@ -51,7 +51,7 @@ static const struct hc_driver ehci_octeon_hc_driver = { | |||
| 51 | * generic hardware linkage | 51 | * generic hardware linkage |
| 52 | */ | 52 | */ |
| 53 | .irq = ehci_irq, | 53 | .irq = ehci_irq, |
| 54 | .flags = HCD_MEMORY | HCD_USB2 | HCD_BH, | 54 | .flags = HCD_MEMORY | HCD_USB2, |
| 55 | 55 | ||
| 56 | /* | 56 | /* |
| 57 | * basic lifecycle operations | 57 | * basic lifecycle operations |
diff --git a/drivers/usb/host/ehci-pmcmsp.c b/drivers/usb/host/ehci-pmcmsp.c index 893b707f0000..601e208bd782 100644 --- a/drivers/usb/host/ehci-pmcmsp.c +++ b/drivers/usb/host/ehci-pmcmsp.c | |||
| @@ -286,7 +286,7 @@ static const struct hc_driver ehci_msp_hc_driver = { | |||
| 286 | #else | 286 | #else |
| 287 | .irq = ehci_irq, | 287 | .irq = ehci_irq, |
| 288 | #endif | 288 | #endif |
| 289 | .flags = HCD_MEMORY | HCD_USB2 | HCD_BH, | 289 | .flags = HCD_MEMORY | HCD_USB2, |
| 290 | 290 | ||
| 291 | /* | 291 | /* |
| 292 | * basic lifecycle operations | 292 | * basic lifecycle operations |
diff --git a/drivers/usb/host/ehci-ppc-of.c b/drivers/usb/host/ehci-ppc-of.c index 6cc5567bf9c8..932293fa32de 100644 --- a/drivers/usb/host/ehci-ppc-of.c +++ b/drivers/usb/host/ehci-ppc-of.c | |||
| @@ -28,7 +28,7 @@ static const struct hc_driver ehci_ppc_of_hc_driver = { | |||
| 28 | * generic hardware linkage | 28 | * generic hardware linkage |
| 29 | */ | 29 | */ |
| 30 | .irq = ehci_irq, | 30 | .irq = ehci_irq, |
| 31 | .flags = HCD_MEMORY | HCD_USB2 | HCD_BH, | 31 | .flags = HCD_MEMORY | HCD_USB2, |
| 32 | 32 | ||
| 33 | /* | 33 | /* |
| 34 | * basic lifecycle operations | 34 | * basic lifecycle operations |
diff --git a/drivers/usb/host/ehci-ps3.c b/drivers/usb/host/ehci-ps3.c index 8188542ba17e..fd983771b025 100644 --- a/drivers/usb/host/ehci-ps3.c +++ b/drivers/usb/host/ehci-ps3.c | |||
| @@ -71,7 +71,7 @@ static const struct hc_driver ps3_ehci_hc_driver = { | |||
| 71 | .product_desc = "PS3 EHCI Host Controller", | 71 | .product_desc = "PS3 EHCI Host Controller", |
| 72 | .hcd_priv_size = sizeof(struct ehci_hcd), | 72 | .hcd_priv_size = sizeof(struct ehci_hcd), |
| 73 | .irq = ehci_irq, | 73 | .irq = ehci_irq, |
| 74 | .flags = HCD_MEMORY | HCD_USB2 | HCD_BH, | 74 | .flags = HCD_MEMORY | HCD_USB2, |
| 75 | .reset = ps3_ehci_hc_reset, | 75 | .reset = ps3_ehci_hc_reset, |
| 76 | .start = ehci_run, | 76 | .start = ehci_run, |
| 77 | .stop = ehci_stop, | 77 | .stop = ehci_stop, |
diff --git a/drivers/usb/host/ehci-q.c b/drivers/usb/host/ehci-q.c index e321804c3475..a7f776a13eb1 100644 --- a/drivers/usb/host/ehci-q.c +++ b/drivers/usb/host/ehci-q.c | |||
| @@ -247,6 +247,8 @@ static int qtd_copy_status ( | |||
| 247 | 247 | ||
| 248 | static void | 248 | static void |
| 249 | ehci_urb_done(struct ehci_hcd *ehci, struct urb *urb, int status) | 249 | ehci_urb_done(struct ehci_hcd *ehci, struct urb *urb, int status) |
| 250 | __releases(ehci->lock) | ||
| 251 | __acquires(ehci->lock) | ||
| 250 | { | 252 | { |
| 251 | if (usb_pipetype(urb->pipe) == PIPE_INTERRUPT) { | 253 | if (usb_pipetype(urb->pipe) == PIPE_INTERRUPT) { |
| 252 | /* ... update hc-wide periodic stats */ | 254 | /* ... update hc-wide periodic stats */ |
| @@ -272,8 +274,11 @@ ehci_urb_done(struct ehci_hcd *ehci, struct urb *urb, int status) | |||
| 272 | urb->actual_length, urb->transfer_buffer_length); | 274 | urb->actual_length, urb->transfer_buffer_length); |
| 273 | #endif | 275 | #endif |
| 274 | 276 | ||
| 277 | /* complete() can reenter this HCD */ | ||
| 275 | usb_hcd_unlink_urb_from_ep(ehci_to_hcd(ehci), urb); | 278 | usb_hcd_unlink_urb_from_ep(ehci_to_hcd(ehci), urb); |
| 279 | spin_unlock (&ehci->lock); | ||
| 276 | usb_hcd_giveback_urb(ehci_to_hcd(ehci), urb, status); | 280 | usb_hcd_giveback_urb(ehci_to_hcd(ehci), urb, status); |
| 281 | spin_lock (&ehci->lock); | ||
| 277 | } | 282 | } |
| 278 | 283 | ||
| 279 | static int qh_schedule (struct ehci_hcd *ehci, struct ehci_qh *qh); | 284 | static int qh_schedule (struct ehci_hcd *ehci, struct ehci_qh *qh); |
diff --git a/drivers/usb/host/ehci-sead3.c b/drivers/usb/host/ehci-sead3.c index 8a734498079b..b2de52d39614 100644 --- a/drivers/usb/host/ehci-sead3.c +++ b/drivers/usb/host/ehci-sead3.c | |||
| @@ -55,7 +55,7 @@ const struct hc_driver ehci_sead3_hc_driver = { | |||
| 55 | * generic hardware linkage | 55 | * generic hardware linkage |
| 56 | */ | 56 | */ |
| 57 | .irq = ehci_irq, | 57 | .irq = ehci_irq, |
| 58 | .flags = HCD_MEMORY | HCD_USB2 | HCD_BH, | 58 | .flags = HCD_MEMORY | HCD_USB2, |
| 59 | 59 | ||
| 60 | /* | 60 | /* |
| 61 | * basic lifecycle operations | 61 | * basic lifecycle operations |
diff --git a/drivers/usb/host/ehci-sh.c b/drivers/usb/host/ehci-sh.c index dc899eb2b861..93e59a13bc1f 100644 --- a/drivers/usb/host/ehci-sh.c +++ b/drivers/usb/host/ehci-sh.c | |||
| @@ -36,7 +36,7 @@ static const struct hc_driver ehci_sh_hc_driver = { | |||
| 36 | * generic hardware linkage | 36 | * generic hardware linkage |
| 37 | */ | 37 | */ |
| 38 | .irq = ehci_irq, | 38 | .irq = ehci_irq, |
| 39 | .flags = HCD_USB2 | HCD_MEMORY | HCD_BH, | 39 | .flags = HCD_USB2 | HCD_MEMORY, |
| 40 | 40 | ||
| 41 | /* | 41 | /* |
| 42 | * basic lifecycle operations | 42 | * basic lifecycle operations |
diff --git a/drivers/usb/host/ehci-tilegx.c b/drivers/usb/host/ehci-tilegx.c index 67026ffbf9a8..cca4be90a864 100644 --- a/drivers/usb/host/ehci-tilegx.c +++ b/drivers/usb/host/ehci-tilegx.c | |||
| @@ -61,7 +61,7 @@ static const struct hc_driver ehci_tilegx_hc_driver = { | |||
| 61 | * Generic hardware linkage. | 61 | * Generic hardware linkage. |
| 62 | */ | 62 | */ |
| 63 | .irq = ehci_irq, | 63 | .irq = ehci_irq, |
| 64 | .flags = HCD_MEMORY | HCD_USB2 | HCD_BH, | 64 | .flags = HCD_MEMORY | HCD_USB2, |
| 65 | 65 | ||
| 66 | /* | 66 | /* |
| 67 | * Basic lifecycle operations. | 67 | * Basic lifecycle operations. |
diff --git a/drivers/usb/host/ehci-w90x900.c b/drivers/usb/host/ehci-w90x900.c index 1c370dfbee0d..59e0e24c753f 100644 --- a/drivers/usb/host/ehci-w90x900.c +++ b/drivers/usb/host/ehci-w90x900.c | |||
| @@ -108,7 +108,7 @@ static const struct hc_driver ehci_w90x900_hc_driver = { | |||
| 108 | * generic hardware linkage | 108 | * generic hardware linkage |
| 109 | */ | 109 | */ |
| 110 | .irq = ehci_irq, | 110 | .irq = ehci_irq, |
| 111 | .flags = HCD_USB2|HCD_MEMORY|HCD_BH, | 111 | .flags = HCD_USB2|HCD_MEMORY, |
| 112 | 112 | ||
| 113 | /* | 113 | /* |
| 114 | * basic lifecycle operations | 114 | * basic lifecycle operations |
diff --git a/drivers/usb/host/ehci-xilinx-of.c b/drivers/usb/host/ehci-xilinx-of.c index 95979f9f4381..eba962e6ebfb 100644 --- a/drivers/usb/host/ehci-xilinx-of.c +++ b/drivers/usb/host/ehci-xilinx-of.c | |||
| @@ -79,7 +79,7 @@ static const struct hc_driver ehci_xilinx_of_hc_driver = { | |||
| 79 | * generic hardware linkage | 79 | * generic hardware linkage |
| 80 | */ | 80 | */ |
| 81 | .irq = ehci_irq, | 81 | .irq = ehci_irq, |
| 82 | .flags = HCD_MEMORY | HCD_USB2 | HCD_BH, | 82 | .flags = HCD_MEMORY | HCD_USB2, |
| 83 | 83 | ||
| 84 | /* | 84 | /* |
| 85 | * basic lifecycle operations | 85 | * basic lifecycle operations |
diff --git a/drivers/usb/host/fsl-mph-dr-of.c b/drivers/usb/host/fsl-mph-dr-of.c index 9e0020d9e4c8..abd5050a4899 100644 --- a/drivers/usb/host/fsl-mph-dr-of.c +++ b/drivers/usb/host/fsl-mph-dr-of.c | |||
| @@ -24,7 +24,7 @@ struct fsl_usb2_dev_data { | |||
| 24 | enum fsl_usb2_operating_modes op_mode; /* operating mode */ | 24 | enum fsl_usb2_operating_modes op_mode; /* operating mode */ |
| 25 | }; | 25 | }; |
| 26 | 26 | ||
| 27 | struct fsl_usb2_dev_data dr_mode_data[] = { | 27 | static struct fsl_usb2_dev_data dr_mode_data[] = { |
| 28 | { | 28 | { |
| 29 | .dr_mode = "host", | 29 | .dr_mode = "host", |
| 30 | .drivers = { "fsl-ehci", NULL, NULL, }, | 30 | .drivers = { "fsl-ehci", NULL, NULL, }, |
| @@ -42,7 +42,7 @@ struct fsl_usb2_dev_data dr_mode_data[] = { | |||
| 42 | }, | 42 | }, |
| 43 | }; | 43 | }; |
| 44 | 44 | ||
| 45 | struct fsl_usb2_dev_data *get_dr_mode_data(struct device_node *np) | 45 | static struct fsl_usb2_dev_data *get_dr_mode_data(struct device_node *np) |
| 46 | { | 46 | { |
| 47 | const unsigned char *prop; | 47 | const unsigned char *prop; |
| 48 | int i; | 48 | int i; |
| @@ -75,7 +75,7 @@ static enum fsl_usb2_phy_modes determine_usb_phy(const char *phy_type) | |||
| 75 | return FSL_USB2_PHY_NONE; | 75 | return FSL_USB2_PHY_NONE; |
| 76 | } | 76 | } |
| 77 | 77 | ||
| 78 | struct platform_device *fsl_usb2_device_register( | 78 | static struct platform_device *fsl_usb2_device_register( |
| 79 | struct platform_device *ofdev, | 79 | struct platform_device *ofdev, |
| 80 | struct fsl_usb2_platform_data *pdata, | 80 | struct fsl_usb2_platform_data *pdata, |
| 81 | const char *name, int id) | 81 | const char *name, int id) |
diff --git a/drivers/usb/phy/phy-omap-usb3.c b/drivers/usb/phy/phy-omap-usb3.c index fc15694d3031..4e8a0405f956 100644 --- a/drivers/usb/phy/phy-omap-usb3.c +++ b/drivers/usb/phy/phy-omap-usb3.c | |||
| @@ -79,7 +79,7 @@ static struct usb_dpll_params *omap_usb3_get_dpll_params(unsigned long rate) | |||
| 79 | return &dpll_map[i].params; | 79 | return &dpll_map[i].params; |
| 80 | } | 80 | } |
| 81 | 81 | ||
| 82 | return 0; | 82 | return NULL; |
| 83 | } | 83 | } |
| 84 | 84 | ||
| 85 | static int omap_usb3_suspend(struct usb_phy *x, int suspend) | 85 | static int omap_usb3_suspend(struct usb_phy *x, int suspend) |
diff --git a/drivers/usb/serial/Kconfig b/drivers/usb/serial/Kconfig index c454bfa22a10..ddb9c51f2c99 100644 --- a/drivers/usb/serial/Kconfig +++ b/drivers/usb/serial/Kconfig | |||
| @@ -60,7 +60,7 @@ config USB_SERIAL_SIMPLE | |||
| 60 | - Suunto ANT+ USB device. | 60 | - Suunto ANT+ USB device. |
| 61 | - Fundamental Software dongle. | 61 | - Fundamental Software dongle. |
| 62 | - HP4x calculators | 62 | - HP4x calculators |
| 63 | - a number of Motoroloa phones | 63 | - a number of Motorola phones |
| 64 | - Siemens USB/MPI adapter. | 64 | - Siemens USB/MPI adapter. |
| 65 | - ViVOtech ViVOpay USB device. | 65 | - ViVOtech ViVOpay USB device. |
| 66 | - Infineon Modem Flashloader USB interface | 66 | - Infineon Modem Flashloader USB interface |
diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c index e7a84f0f5179..bedf8e47713b 100644 --- a/drivers/usb/serial/pl2303.c +++ b/drivers/usb/serial/pl2303.c | |||
| @@ -139,6 +139,7 @@ enum pl2303_type { | |||
| 139 | HX_TA, /* HX(A) / X(A) / TA version */ /* TODO: improve */ | 139 | HX_TA, /* HX(A) / X(A) / TA version */ /* TODO: improve */ |
| 140 | HXD_EA_RA_SA, /* HXD / EA / RA / SA version */ /* TODO: improve */ | 140 | HXD_EA_RA_SA, /* HXD / EA / RA / SA version */ /* TODO: improve */ |
| 141 | TB, /* TB version */ | 141 | TB, /* TB version */ |
| 142 | HX_CLONE, /* Cheap and less functional clone of the HX chip */ | ||
| 142 | }; | 143 | }; |
| 143 | /* | 144 | /* |
| 144 | * NOTE: don't know the difference between type 0 and type 1, | 145 | * NOTE: don't know the difference between type 0 and type 1, |
| @@ -206,8 +207,23 @@ static int pl2303_startup(struct usb_serial *serial) | |||
| 206 | * the device descriptors of the X/HX, HXD, EA, RA, SA, TA, TB | 207 | * the device descriptors of the X/HX, HXD, EA, RA, SA, TA, TB |
| 207 | */ | 208 | */ |
| 208 | if (le16_to_cpu(serial->dev->descriptor.bcdDevice) == 0x300) { | 209 | if (le16_to_cpu(serial->dev->descriptor.bcdDevice) == 0x300) { |
| 209 | type = HX_TA; | 210 | /* Check if the device is a clone */ |
| 210 | type_str = "X/HX/TA"; | 211 | pl2303_vendor_read(0x9494, 0, serial, buf); |
| 212 | /* | ||
| 213 | * NOTE: Not sure if this read is really needed. | ||
| 214 | * The HX returns 0x00, the clone 0x02, but the Windows | ||
| 215 | * driver seems to ignore the value and continues. | ||
| 216 | */ | ||
| 217 | pl2303_vendor_write(0x0606, 0xaa, serial); | ||
| 218 | pl2303_vendor_read(0x8686, 0, serial, buf); | ||
| 219 | if (buf[0] != 0xaa) { | ||
| 220 | type = HX_CLONE; | ||
| 221 | type_str = "X/HX clone (limited functionality)"; | ||
| 222 | } else { | ||
| 223 | type = HX_TA; | ||
| 224 | type_str = "X/HX/TA"; | ||
| 225 | } | ||
| 226 | pl2303_vendor_write(0x0606, 0x00, serial); | ||
| 211 | } else if (le16_to_cpu(serial->dev->descriptor.bcdDevice) | 227 | } else if (le16_to_cpu(serial->dev->descriptor.bcdDevice) |
| 212 | == 0x400) { | 228 | == 0x400) { |
| 213 | type = HXD_EA_RA_SA; | 229 | type = HXD_EA_RA_SA; |
| @@ -305,8 +321,9 @@ static int pl2303_baudrate_encode_direct(int baud, enum pl2303_type type, | |||
| 305 | { | 321 | { |
| 306 | /* | 322 | /* |
| 307 | * NOTE: Only the values defined in baud_sup are supported ! | 323 | * NOTE: Only the values defined in baud_sup are supported ! |
| 308 | * => if unsupported values are set, the PL2303 seems to | 324 | * => if unsupported values are set, the PL2303 uses 9600 baud instead |
| 309 | * use 9600 baud (at least my PL2303X always does) | 325 | * => HX clones just don't work at unsupported baud rates < 115200 baud, |
| 326 | * for baud rates > 115200 they run at 115200 baud | ||
| 310 | */ | 327 | */ |
| 311 | const int baud_sup[] = { 75, 150, 300, 600, 1200, 1800, 2400, 3600, | 328 | const int baud_sup[] = { 75, 150, 300, 600, 1200, 1800, 2400, 3600, |
| 312 | 4800, 7200, 9600, 14400, 19200, 28800, 38400, | 329 | 4800, 7200, 9600, 14400, 19200, 28800, 38400, |
| @@ -316,14 +333,14 @@ static int pl2303_baudrate_encode_direct(int baud, enum pl2303_type type, | |||
| 316 | * NOTE: With the exception of type_0/1 devices, the following | 333 | * NOTE: With the exception of type_0/1 devices, the following |
| 317 | * additional baud rates are supported (tested with HX rev. 3A only): | 334 | * additional baud rates are supported (tested with HX rev. 3A only): |
| 318 | * 110*, 56000*, 128000, 134400, 161280, 201600, 256000*, 268800, | 335 | * 110*, 56000*, 128000, 134400, 161280, 201600, 256000*, 268800, |
| 319 | * 403200, 806400. (*: not HX) | 336 | * 403200, 806400. (*: not HX and HX clones) |
| 320 | * | 337 | * |
| 321 | * Maximum values: HXD, TB: 12000000; HX, TA: 6000000; | 338 | * Maximum values: HXD, TB: 12000000; HX, TA: 6000000; |
| 322 | * type_0+1: 1228800; RA: 921600; SA: 115200 | 339 | * type_0+1: 1228800; RA: 921600; HX clones, SA: 115200 |
| 323 | * | 340 | * |
| 324 | * As long as we are not using this encoding method for anything else | 341 | * As long as we are not using this encoding method for anything else |
| 325 | * than the type_0+1 and HX chips, there is no point in complicating | 342 | * than the type_0+1, HX and HX clone chips, there is no point in |
| 326 | * the code to support them. | 343 | * complicating the code to support them. |
| 327 | */ | 344 | */ |
| 328 | int i; | 345 | int i; |
| 329 | 346 | ||
| @@ -347,6 +364,8 @@ static int pl2303_baudrate_encode_direct(int baud, enum pl2303_type type, | |||
| 347 | baud = min_t(int, baud, 6000000); | 364 | baud = min_t(int, baud, 6000000); |
| 348 | else if (type == type_0 || type == type_1) | 365 | else if (type == type_0 || type == type_1) |
| 349 | baud = min_t(int, baud, 1228800); | 366 | baud = min_t(int, baud, 1228800); |
| 367 | else if (type == HX_CLONE) | ||
| 368 | baud = min_t(int, baud, 115200); | ||
| 350 | /* Direct (standard) baud rate encoding method */ | 369 | /* Direct (standard) baud rate encoding method */ |
| 351 | put_unaligned_le32(baud, buf); | 370 | put_unaligned_le32(baud, buf); |
| 352 | 371 | ||
| @@ -359,7 +378,8 @@ static int pl2303_baudrate_encode_divisor(int baud, enum pl2303_type type, | |||
| 359 | /* | 378 | /* |
| 360 | * Divisor based baud rate encoding method | 379 | * Divisor based baud rate encoding method |
| 361 | * | 380 | * |
| 362 | * NOTE: it's not clear if the type_0/1 chips support this method | 381 | * NOTE: HX clones do NOT support this method. |
| 382 | * It's not clear if the type_0/1 chips support it. | ||
| 363 | * | 383 | * |
| 364 | * divisor = 12MHz * 32 / baudrate = 2^A * B | 384 | * divisor = 12MHz * 32 / baudrate = 2^A * B |
| 365 | * | 385 | * |
| @@ -452,7 +472,7 @@ static void pl2303_encode_baudrate(struct tty_struct *tty, | |||
| 452 | * 1) Direct method: encodes the baud rate value directly | 472 | * 1) Direct method: encodes the baud rate value directly |
| 453 | * => supported by all chip types | 473 | * => supported by all chip types |
| 454 | * 2) Divisor based method: encodes a divisor to a base value (12MHz*32) | 474 | * 2) Divisor based method: encodes a divisor to a base value (12MHz*32) |
| 455 | * => supported by HX chips (and likely not by type_0/1 chips) | 475 | * => not supported by HX clones (and likely type_0/1 chips) |
| 456 | * | 476 | * |
| 457 | * NOTE: Although the divisor based baud rate encoding method is much | 477 | * NOTE: Although the divisor based baud rate encoding method is much |
| 458 | * more flexible, some of the standard baud rate values can not be | 478 | * more flexible, some of the standard baud rate values can not be |
| @@ -460,7 +480,7 @@ static void pl2303_encode_baudrate(struct tty_struct *tty, | |||
| 460 | * the device likely uses the same baud rate generator for both methods | 480 | * the device likely uses the same baud rate generator for both methods |
| 461 | * so that there is likley no difference. | 481 | * so that there is likley no difference. |
| 462 | */ | 482 | */ |
| 463 | if (type == type_0 || type == type_1) | 483 | if (type == type_0 || type == type_1 || type == HX_CLONE) |
| 464 | baud = pl2303_baudrate_encode_direct(baud, type, buf); | 484 | baud = pl2303_baudrate_encode_direct(baud, type, buf); |
| 465 | else | 485 | else |
| 466 | baud = pl2303_baudrate_encode_divisor(baud, type, buf); | 486 | baud = pl2303_baudrate_encode_divisor(baud, type, buf); |
| @@ -813,6 +833,7 @@ static void pl2303_break_ctl(struct tty_struct *tty, int break_state) | |||
| 813 | result = usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0), | 833 | result = usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0), |
| 814 | BREAK_REQUEST, BREAK_REQUEST_TYPE, state, | 834 | BREAK_REQUEST, BREAK_REQUEST_TYPE, state, |
| 815 | 0, NULL, 0, 100); | 835 | 0, NULL, 0, 100); |
| 836 | /* NOTE: HX clones don't support sending breaks, -EPIPE is returned */ | ||
| 816 | if (result) | 837 | if (result) |
| 817 | dev_err(&port->dev, "error sending break = %d\n", result); | 838 | dev_err(&port->dev, "error sending break = %d\n", result); |
| 818 | } | 839 | } |
diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c index 4b79a1f2f901..592b31698fc8 100644 --- a/drivers/vhost/scsi.c +++ b/drivers/vhost/scsi.c | |||
| @@ -461,7 +461,7 @@ static void tcm_vhost_release_cmd(struct se_cmd *se_cmd) | |||
| 461 | u32 i; | 461 | u32 i; |
| 462 | for (i = 0; i < tv_cmd->tvc_sgl_count; i++) | 462 | for (i = 0; i < tv_cmd->tvc_sgl_count; i++) |
| 463 | put_page(sg_page(&tv_cmd->tvc_sgl[i])); | 463 | put_page(sg_page(&tv_cmd->tvc_sgl[i])); |
| 464 | } | 464 | } |
| 465 | 465 | ||
| 466 | tcm_vhost_put_inflight(tv_cmd->inflight); | 466 | tcm_vhost_put_inflight(tv_cmd->inflight); |
| 467 | percpu_ida_free(&se_sess->sess_tag_pool, se_cmd->map_tag); | 467 | percpu_ida_free(&se_sess->sess_tag_pool, se_cmd->map_tag); |
| @@ -1373,21 +1373,30 @@ static int vhost_scsi_set_features(struct vhost_scsi *vs, u64 features) | |||
| 1373 | return 0; | 1373 | return 0; |
| 1374 | } | 1374 | } |
| 1375 | 1375 | ||
| 1376 | static void vhost_scsi_free(struct vhost_scsi *vs) | ||
| 1377 | { | ||
| 1378 | if (is_vmalloc_addr(vs)) | ||
| 1379 | vfree(vs); | ||
| 1380 | else | ||
| 1381 | kfree(vs); | ||
| 1382 | } | ||
| 1383 | |||
| 1376 | static int vhost_scsi_open(struct inode *inode, struct file *f) | 1384 | static int vhost_scsi_open(struct inode *inode, struct file *f) |
| 1377 | { | 1385 | { |
| 1378 | struct vhost_scsi *vs; | 1386 | struct vhost_scsi *vs; |
| 1379 | struct vhost_virtqueue **vqs; | 1387 | struct vhost_virtqueue **vqs; |
| 1380 | int r, i; | 1388 | int r = -ENOMEM, i; |
| 1381 | 1389 | ||
| 1382 | vs = kzalloc(sizeof(*vs), GFP_KERNEL); | 1390 | vs = kzalloc(sizeof(*vs), GFP_KERNEL | __GFP_NOWARN | __GFP_REPEAT); |
| 1383 | if (!vs) | 1391 | if (!vs) { |
| 1384 | return -ENOMEM; | 1392 | vs = vzalloc(sizeof(*vs)); |
| 1393 | if (!vs) | ||
| 1394 | goto err_vs; | ||
| 1395 | } | ||
| 1385 | 1396 | ||
| 1386 | vqs = kmalloc(VHOST_SCSI_MAX_VQ * sizeof(*vqs), GFP_KERNEL); | 1397 | vqs = kmalloc(VHOST_SCSI_MAX_VQ * sizeof(*vqs), GFP_KERNEL); |
| 1387 | if (!vqs) { | 1398 | if (!vqs) |
| 1388 | kfree(vs); | 1399 | goto err_vqs; |
| 1389 | return -ENOMEM; | ||
| 1390 | } | ||
| 1391 | 1400 | ||
| 1392 | vhost_work_init(&vs->vs_completion_work, vhost_scsi_complete_cmd_work); | 1401 | vhost_work_init(&vs->vs_completion_work, vhost_scsi_complete_cmd_work); |
| 1393 | vhost_work_init(&vs->vs_event_work, tcm_vhost_evt_work); | 1402 | vhost_work_init(&vs->vs_event_work, tcm_vhost_evt_work); |
| @@ -1407,14 +1416,18 @@ static int vhost_scsi_open(struct inode *inode, struct file *f) | |||
| 1407 | 1416 | ||
| 1408 | tcm_vhost_init_inflight(vs, NULL); | 1417 | tcm_vhost_init_inflight(vs, NULL); |
| 1409 | 1418 | ||
| 1410 | if (r < 0) { | 1419 | if (r < 0) |
| 1411 | kfree(vqs); | 1420 | goto err_init; |
| 1412 | kfree(vs); | ||
| 1413 | return r; | ||
| 1414 | } | ||
| 1415 | 1421 | ||
| 1416 | f->private_data = vs; | 1422 | f->private_data = vs; |
| 1417 | return 0; | 1423 | return 0; |
| 1424 | |||
| 1425 | err_init: | ||
| 1426 | kfree(vqs); | ||
| 1427 | err_vqs: | ||
| 1428 | vhost_scsi_free(vs); | ||
| 1429 | err_vs: | ||
| 1430 | return r; | ||
| 1418 | } | 1431 | } |
| 1419 | 1432 | ||
| 1420 | static int vhost_scsi_release(struct inode *inode, struct file *f) | 1433 | static int vhost_scsi_release(struct inode *inode, struct file *f) |
| @@ -1431,7 +1444,7 @@ static int vhost_scsi_release(struct inode *inode, struct file *f) | |||
| 1431 | /* Jobs can re-queue themselves in evt kick handler. Do extra flush. */ | 1444 | /* Jobs can re-queue themselves in evt kick handler. Do extra flush. */ |
| 1432 | vhost_scsi_flush(vs); | 1445 | vhost_scsi_flush(vs); |
| 1433 | kfree(vs->dev.vqs); | 1446 | kfree(vs->dev.vqs); |
| 1434 | kfree(vs); | 1447 | vhost_scsi_free(vs); |
| 1435 | return 0; | 1448 | return 0; |
| 1436 | } | 1449 | } |
| 1437 | 1450 | ||
diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c index 9a9502a4aa50..69068e0d8f31 100644 --- a/drivers/vhost/vhost.c +++ b/drivers/vhost/vhost.c | |||
| @@ -161,9 +161,11 @@ void vhost_work_queue(struct vhost_dev *dev, struct vhost_work *work) | |||
| 161 | if (list_empty(&work->node)) { | 161 | if (list_empty(&work->node)) { |
| 162 | list_add_tail(&work->node, &dev->work_list); | 162 | list_add_tail(&work->node, &dev->work_list); |
| 163 | work->queue_seq++; | 163 | work->queue_seq++; |
| 164 | spin_unlock_irqrestore(&dev->work_lock, flags); | ||
| 164 | wake_up_process(dev->worker); | 165 | wake_up_process(dev->worker); |
| 166 | } else { | ||
| 167 | spin_unlock_irqrestore(&dev->work_lock, flags); | ||
| 165 | } | 168 | } |
| 166 | spin_unlock_irqrestore(&dev->work_lock, flags); | ||
| 167 | } | 169 | } |
| 168 | EXPORT_SYMBOL_GPL(vhost_work_queue); | 170 | EXPORT_SYMBOL_GPL(vhost_work_queue); |
| 169 | 171 | ||
diff --git a/drivers/video/mmp/hw/mmp_ctrl.c b/drivers/video/mmp/hw/mmp_ctrl.c index 75dca19bf214..6ac755270ab4 100644 --- a/drivers/video/mmp/hw/mmp_ctrl.c +++ b/drivers/video/mmp/hw/mmp_ctrl.c | |||
| @@ -514,7 +514,7 @@ static int mmphw_probe(struct platform_device *pdev) | |||
| 514 | if (IS_ERR(ctrl->clk)) { | 514 | if (IS_ERR(ctrl->clk)) { |
| 515 | dev_err(ctrl->dev, "unable to get clk %s\n", mi->clk_name); | 515 | dev_err(ctrl->dev, "unable to get clk %s\n", mi->clk_name); |
| 516 | ret = -ENOENT; | 516 | ret = -ENOENT; |
| 517 | goto failed_get_clk; | 517 | goto failed; |
| 518 | } | 518 | } |
| 519 | clk_prepare_enable(ctrl->clk); | 519 | clk_prepare_enable(ctrl->clk); |
| 520 | 520 | ||
| @@ -551,21 +551,8 @@ failed_path_init: | |||
| 551 | path_deinit(path_plat); | 551 | path_deinit(path_plat); |
| 552 | } | 552 | } |
| 553 | 553 | ||
| 554 | if (ctrl->clk) { | 554 | clk_disable_unprepare(ctrl->clk); |
| 555 | devm_clk_put(ctrl->dev, ctrl->clk); | ||
| 556 | clk_disable_unprepare(ctrl->clk); | ||
| 557 | } | ||
| 558 | failed_get_clk: | ||
| 559 | devm_free_irq(ctrl->dev, ctrl->irq, ctrl); | ||
| 560 | failed: | 555 | failed: |
| 561 | if (ctrl) { | ||
| 562 | if (ctrl->reg_base) | ||
| 563 | devm_iounmap(ctrl->dev, ctrl->reg_base); | ||
| 564 | devm_release_mem_region(ctrl->dev, res->start, | ||
| 565 | resource_size(res)); | ||
| 566 | devm_kfree(ctrl->dev, ctrl); | ||
| 567 | } | ||
| 568 | |||
| 569 | dev_err(&pdev->dev, "device init failed\n"); | 556 | dev_err(&pdev->dev, "device init failed\n"); |
| 570 | 557 | ||
| 571 | return ret; | 558 | return ret; |
diff --git a/drivers/video/mxsfb.c b/drivers/video/mxsfb.c index d250ed0f806d..27197a8048c0 100644 --- a/drivers/video/mxsfb.c +++ b/drivers/video/mxsfb.c | |||
| @@ -620,6 +620,7 @@ static int mxsfb_restore_mode(struct mxsfb_info *host) | |||
| 620 | break; | 620 | break; |
| 621 | case 3: | 621 | case 3: |
| 622 | bits_per_pixel = 32; | 622 | bits_per_pixel = 32; |
| 623 | break; | ||
| 623 | case 1: | 624 | case 1: |
| 624 | default: | 625 | default: |
| 625 | return -EINVAL; | 626 | return -EINVAL; |
diff --git a/drivers/video/neofb.c b/drivers/video/neofb.c index 7ef079c146e7..c172a5281f9e 100644 --- a/drivers/video/neofb.c +++ b/drivers/video/neofb.c | |||
| @@ -2075,6 +2075,7 @@ static int neofb_probe(struct pci_dev *dev, const struct pci_device_id *id) | |||
| 2075 | if (!fb_find_mode(&info->var, info, mode_option, NULL, 0, | 2075 | if (!fb_find_mode(&info->var, info, mode_option, NULL, 0, |
| 2076 | info->monspecs.modedb, 16)) { | 2076 | info->monspecs.modedb, 16)) { |
| 2077 | printk(KERN_ERR "neofb: Unable to find usable video mode.\n"); | 2077 | printk(KERN_ERR "neofb: Unable to find usable video mode.\n"); |
| 2078 | err = -EINVAL; | ||
| 2078 | goto err_map_video; | 2079 | goto err_map_video; |
| 2079 | } | 2080 | } |
| 2080 | 2081 | ||
| @@ -2097,7 +2098,8 @@ static int neofb_probe(struct pci_dev *dev, const struct pci_device_id *id) | |||
| 2097 | info->fix.smem_len >> 10, info->var.xres, | 2098 | info->fix.smem_len >> 10, info->var.xres, |
| 2098 | info->var.yres, h_sync / 1000, h_sync % 1000, v_sync); | 2099 | info->var.yres, h_sync / 1000, h_sync % 1000, v_sync); |
| 2099 | 2100 | ||
| 2100 | if (fb_alloc_cmap(&info->cmap, 256, 0) < 0) | 2101 | err = fb_alloc_cmap(&info->cmap, 256, 0); |
| 2102 | if (err < 0) | ||
| 2101 | goto err_map_video; | 2103 | goto err_map_video; |
| 2102 | 2104 | ||
| 2103 | err = register_framebuffer(info); | 2105 | err = register_framebuffer(info); |
diff --git a/drivers/video/of_display_timing.c b/drivers/video/of_display_timing.c index 171821ddd78d..ba5b40f581f6 100644 --- a/drivers/video/of_display_timing.c +++ b/drivers/video/of_display_timing.c | |||
| @@ -120,7 +120,7 @@ int of_get_display_timing(struct device_node *np, const char *name, | |||
| 120 | return -EINVAL; | 120 | return -EINVAL; |
| 121 | } | 121 | } |
| 122 | 122 | ||
| 123 | timing_np = of_find_node_by_name(np, name); | 123 | timing_np = of_get_child_by_name(np, name); |
| 124 | if (!timing_np) { | 124 | if (!timing_np) { |
| 125 | pr_err("%s: could not find node '%s'\n", | 125 | pr_err("%s: could not find node '%s'\n", |
| 126 | of_node_full_name(np), name); | 126 | of_node_full_name(np), name); |
| @@ -143,11 +143,11 @@ struct display_timings *of_get_display_timings(struct device_node *np) | |||
| 143 | struct display_timings *disp; | 143 | struct display_timings *disp; |
| 144 | 144 | ||
| 145 | if (!np) { | 145 | if (!np) { |
| 146 | pr_err("%s: no devicenode given\n", of_node_full_name(np)); | 146 | pr_err("%s: no device node given\n", of_node_full_name(np)); |
| 147 | return NULL; | 147 | return NULL; |
| 148 | } | 148 | } |
| 149 | 149 | ||
| 150 | timings_np = of_find_node_by_name(np, "display-timings"); | 150 | timings_np = of_get_child_by_name(np, "display-timings"); |
| 151 | if (!timings_np) { | 151 | if (!timings_np) { |
| 152 | pr_err("%s: could not find display-timings node\n", | 152 | pr_err("%s: could not find display-timings node\n", |
| 153 | of_node_full_name(np)); | 153 | of_node_full_name(np)); |
diff --git a/drivers/video/omap2/displays-new/Kconfig b/drivers/video/omap2/displays-new/Kconfig index 6c90885b0940..10b25e7cd878 100644 --- a/drivers/video/omap2/displays-new/Kconfig +++ b/drivers/video/omap2/displays-new/Kconfig | |||
| @@ -35,6 +35,7 @@ config DISPLAY_PANEL_DPI | |||
| 35 | 35 | ||
| 36 | config DISPLAY_PANEL_DSI_CM | 36 | config DISPLAY_PANEL_DSI_CM |
| 37 | tristate "Generic DSI Command Mode Panel" | 37 | tristate "Generic DSI Command Mode Panel" |
| 38 | depends on BACKLIGHT_CLASS_DEVICE | ||
| 38 | help | 39 | help |
| 39 | Driver for generic DSI command mode panels. | 40 | Driver for generic DSI command mode panels. |
| 40 | 41 | ||
diff --git a/drivers/video/omap2/displays-new/connector-analog-tv.c b/drivers/video/omap2/displays-new/connector-analog-tv.c index 1b60698f141e..ccd9073f706f 100644 --- a/drivers/video/omap2/displays-new/connector-analog-tv.c +++ b/drivers/video/omap2/displays-new/connector-analog-tv.c | |||
| @@ -191,7 +191,7 @@ static int tvc_probe_pdata(struct platform_device *pdev) | |||
| 191 | in = omap_dss_find_output(pdata->source); | 191 | in = omap_dss_find_output(pdata->source); |
| 192 | if (in == NULL) { | 192 | if (in == NULL) { |
| 193 | dev_err(&pdev->dev, "Failed to find video source\n"); | 193 | dev_err(&pdev->dev, "Failed to find video source\n"); |
| 194 | return -ENODEV; | 194 | return -EPROBE_DEFER; |
| 195 | } | 195 | } |
| 196 | 196 | ||
| 197 | ddata->in = in; | 197 | ddata->in = in; |
diff --git a/drivers/video/omap2/displays-new/connector-dvi.c b/drivers/video/omap2/displays-new/connector-dvi.c index bc5f8ceda371..63d88ee6dfe4 100644 --- a/drivers/video/omap2/displays-new/connector-dvi.c +++ b/drivers/video/omap2/displays-new/connector-dvi.c | |||
| @@ -263,7 +263,7 @@ static int dvic_probe_pdata(struct platform_device *pdev) | |||
| 263 | in = omap_dss_find_output(pdata->source); | 263 | in = omap_dss_find_output(pdata->source); |
| 264 | if (in == NULL) { | 264 | if (in == NULL) { |
| 265 | dev_err(&pdev->dev, "Failed to find video source\n"); | 265 | dev_err(&pdev->dev, "Failed to find video source\n"); |
| 266 | return -ENODEV; | 266 | return -EPROBE_DEFER; |
| 267 | } | 267 | } |
| 268 | 268 | ||
| 269 | ddata->in = in; | 269 | ddata->in = in; |
diff --git a/drivers/video/omap2/displays-new/connector-hdmi.c b/drivers/video/omap2/displays-new/connector-hdmi.c index c5826716d6ab..9abe2c039ae9 100644 --- a/drivers/video/omap2/displays-new/connector-hdmi.c +++ b/drivers/video/omap2/displays-new/connector-hdmi.c | |||
| @@ -290,7 +290,7 @@ static int hdmic_probe_pdata(struct platform_device *pdev) | |||
| 290 | in = omap_dss_find_output(pdata->source); | 290 | in = omap_dss_find_output(pdata->source); |
| 291 | if (in == NULL) { | 291 | if (in == NULL) { |
| 292 | dev_err(&pdev->dev, "Failed to find video source\n"); | 292 | dev_err(&pdev->dev, "Failed to find video source\n"); |
| 293 | return -ENODEV; | 293 | return -EPROBE_DEFER; |
| 294 | } | 294 | } |
| 295 | 295 | ||
| 296 | ddata->in = in; | 296 | ddata->in = in; |
diff --git a/drivers/video/omap2/dss/dispc.c b/drivers/video/omap2/dss/dispc.c index 02a7340111df..477975009eee 100644 --- a/drivers/video/omap2/dss/dispc.c +++ b/drivers/video/omap2/dss/dispc.c | |||
| @@ -3691,6 +3691,7 @@ static int __init omap_dispchw_probe(struct platform_device *pdev) | |||
| 3691 | } | 3691 | } |
| 3692 | 3692 | ||
| 3693 | pm_runtime_enable(&pdev->dev); | 3693 | pm_runtime_enable(&pdev->dev); |
| 3694 | pm_runtime_irq_safe(&pdev->dev); | ||
| 3694 | 3695 | ||
| 3695 | r = dispc_runtime_get(); | 3696 | r = dispc_runtime_get(); |
| 3696 | if (r) | 3697 | if (r) |
diff --git a/drivers/video/s3fb.c b/drivers/video/s3fb.c index 47ca86c5c6c0..d838ba829459 100644 --- a/drivers/video/s3fb.c +++ b/drivers/video/s3fb.c | |||
| @@ -1336,14 +1336,7 @@ static int s3_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) | |||
| 1336 | (info->var.bits_per_pixel * info->var.xres_virtual); | 1336 | (info->var.bits_per_pixel * info->var.xres_virtual); |
| 1337 | if (info->var.yres_virtual < info->var.yres) { | 1337 | if (info->var.yres_virtual < info->var.yres) { |
| 1338 | dev_err(info->device, "virtual vertical size smaller than real\n"); | 1338 | dev_err(info->device, "virtual vertical size smaller than real\n"); |
| 1339 | goto err_find_mode; | 1339 | rc = -EINVAL; |
| 1340 | } | ||
| 1341 | |||
| 1342 | /* maximize virtual vertical size for fast scrolling */ | ||
| 1343 | info->var.yres_virtual = info->fix.smem_len * 8 / | ||
| 1344 | (info->var.bits_per_pixel * info->var.xres_virtual); | ||
| 1345 | if (info->var.yres_virtual < info->var.yres) { | ||
| 1346 | dev_err(info->device, "virtual vertical size smaller than real\n"); | ||
| 1347 | goto err_find_mode; | 1340 | goto err_find_mode; |
| 1348 | } | 1341 | } |
| 1349 | 1342 | ||
diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c index a50c6e3a7cc4..b232908a6192 100644 --- a/drivers/xen/balloon.c +++ b/drivers/xen/balloon.c | |||
| @@ -398,8 +398,6 @@ static enum bp_state decrease_reservation(unsigned long nr_pages, gfp_t gfp) | |||
| 398 | if (nr_pages > ARRAY_SIZE(frame_list)) | 398 | if (nr_pages > ARRAY_SIZE(frame_list)) |
| 399 | nr_pages = ARRAY_SIZE(frame_list); | 399 | nr_pages = ARRAY_SIZE(frame_list); |
| 400 | 400 | ||
| 401 | scratch_page = get_balloon_scratch_page(); | ||
| 402 | |||
| 403 | for (i = 0; i < nr_pages; i++) { | 401 | for (i = 0; i < nr_pages; i++) { |
| 404 | page = alloc_page(gfp); | 402 | page = alloc_page(gfp); |
| 405 | if (page == NULL) { | 403 | if (page == NULL) { |
| @@ -413,6 +411,12 @@ static enum bp_state decrease_reservation(unsigned long nr_pages, gfp_t gfp) | |||
| 413 | 411 | ||
| 414 | scrub_page(page); | 412 | scrub_page(page); |
| 415 | 413 | ||
| 414 | /* | ||
| 415 | * Ballooned out frames are effectively replaced with | ||
| 416 | * a scratch frame. Ensure direct mappings and the | ||
| 417 | * p2m are consistent. | ||
| 418 | */ | ||
| 419 | scratch_page = get_balloon_scratch_page(); | ||
| 416 | #ifdef CONFIG_XEN_HAVE_PVMMU | 420 | #ifdef CONFIG_XEN_HAVE_PVMMU |
| 417 | if (xen_pv_domain() && !PageHighMem(page)) { | 421 | if (xen_pv_domain() && !PageHighMem(page)) { |
| 418 | ret = HYPERVISOR_update_va_mapping( | 422 | ret = HYPERVISOR_update_va_mapping( |
| @@ -422,24 +426,19 @@ static enum bp_state decrease_reservation(unsigned long nr_pages, gfp_t gfp) | |||
| 422 | BUG_ON(ret); | 426 | BUG_ON(ret); |
| 423 | } | 427 | } |
| 424 | #endif | 428 | #endif |
| 425 | } | ||
| 426 | |||
| 427 | /* Ensure that ballooned highmem pages don't have kmaps. */ | ||
| 428 | kmap_flush_unused(); | ||
| 429 | flush_tlb_all(); | ||
| 430 | |||
| 431 | /* No more mappings: invalidate P2M and add to balloon. */ | ||
| 432 | for (i = 0; i < nr_pages; i++) { | ||
| 433 | pfn = mfn_to_pfn(frame_list[i]); | ||
| 434 | if (!xen_feature(XENFEAT_auto_translated_physmap)) { | 429 | if (!xen_feature(XENFEAT_auto_translated_physmap)) { |
| 435 | unsigned long p; | 430 | unsigned long p; |
| 436 | p = page_to_pfn(scratch_page); | 431 | p = page_to_pfn(scratch_page); |
| 437 | __set_phys_to_machine(pfn, pfn_to_mfn(p)); | 432 | __set_phys_to_machine(pfn, pfn_to_mfn(p)); |
| 438 | } | 433 | } |
| 434 | put_balloon_scratch_page(); | ||
| 435 | |||
| 439 | balloon_append(pfn_to_page(pfn)); | 436 | balloon_append(pfn_to_page(pfn)); |
| 440 | } | 437 | } |
| 441 | 438 | ||
| 442 | put_balloon_scratch_page(); | 439 | /* Ensure that ballooned highmem pages don't have kmaps. */ |
| 440 | kmap_flush_unused(); | ||
| 441 | flush_tlb_all(); | ||
| 443 | 442 | ||
| 444 | set_xen_guest_handle(reservation.extent_start, frame_list); | 443 | set_xen_guest_handle(reservation.extent_start, frame_list); |
| 445 | reservation.nr_extents = nr_pages; | 444 | reservation.nr_extents = nr_pages; |
