diff options
96 files changed, 733 insertions, 404 deletions
diff --git a/Documentation/devicetree/bindings/sound/da7218.txt b/Documentation/devicetree/bindings/sound/da7218.txt index 5ca5a709b6aa..3ab9dfef38d1 100644 --- a/Documentation/devicetree/bindings/sound/da7218.txt +++ b/Documentation/devicetree/bindings/sound/da7218.txt | |||
| @@ -73,7 +73,7 @@ Example: | |||
| 73 | compatible = "dlg,da7218"; | 73 | compatible = "dlg,da7218"; |
| 74 | reg = <0x1a>; | 74 | reg = <0x1a>; |
| 75 | interrupt-parent = <&gpio6>; | 75 | interrupt-parent = <&gpio6>; |
| 76 | interrupts = <11 IRQ_TYPE_LEVEL_HIGH>; | 76 | interrupts = <11 IRQ_TYPE_LEVEL_LOW>; |
| 77 | wakeup-source; | 77 | wakeup-source; |
| 78 | 78 | ||
| 79 | VDD-supply = <®_audio>; | 79 | VDD-supply = <®_audio>; |
diff --git a/Documentation/devicetree/bindings/sound/da7219.txt b/Documentation/devicetree/bindings/sound/da7219.txt index cf61681826b6..5b54d2d045c3 100644 --- a/Documentation/devicetree/bindings/sound/da7219.txt +++ b/Documentation/devicetree/bindings/sound/da7219.txt | |||
| @@ -77,7 +77,7 @@ Example: | |||
| 77 | reg = <0x1a>; | 77 | reg = <0x1a>; |
| 78 | 78 | ||
| 79 | interrupt-parent = <&gpio6>; | 79 | interrupt-parent = <&gpio6>; |
| 80 | interrupts = <11 IRQ_TYPE_LEVEL_HIGH>; | 80 | interrupts = <11 IRQ_TYPE_LEVEL_LOW>; |
| 81 | 81 | ||
| 82 | VDD-supply = <®_audio>; | 82 | VDD-supply = <®_audio>; |
| 83 | VDDMIC-supply = <®_audio>; | 83 | VDDMIC-supply = <®_audio>; |
diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index 8a1860a36c77..b56c11f51baf 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c | |||
| @@ -220,7 +220,8 @@ static bool clk_core_is_enabled(struct clk_core *core) | |||
| 220 | 220 | ||
| 221 | ret = core->ops->is_enabled(core->hw); | 221 | ret = core->ops->is_enabled(core->hw); |
| 222 | done: | 222 | done: |
| 223 | clk_pm_runtime_put(core); | 223 | if (core->dev) |
| 224 | pm_runtime_put(core->dev); | ||
| 224 | 225 | ||
| 225 | return ret; | 226 | return ret; |
| 226 | } | 227 | } |
diff --git a/drivers/gpio/gpio-reg.c b/drivers/gpio/gpio-reg.c index 23e771dba4c1..e85903eddc68 100644 --- a/drivers/gpio/gpio-reg.c +++ b/drivers/gpio/gpio-reg.c | |||
| @@ -103,8 +103,8 @@ static int gpio_reg_to_irq(struct gpio_chip *gc, unsigned offset) | |||
| 103 | struct gpio_reg *r = to_gpio_reg(gc); | 103 | struct gpio_reg *r = to_gpio_reg(gc); |
| 104 | int irq = r->irqs[offset]; | 104 | int irq = r->irqs[offset]; |
| 105 | 105 | ||
| 106 | if (irq >= 0 && r->irq.domain) | 106 | if (irq >= 0 && r->irqdomain) |
| 107 | irq = irq_find_mapping(r->irq.domain, irq); | 107 | irq = irq_find_mapping(r->irqdomain, irq); |
| 108 | 108 | ||
| 109 | return irq; | 109 | return irq; |
| 110 | } | 110 | } |
diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c index eb4528c87c0b..d6f3d9ee1350 100644 --- a/drivers/gpio/gpiolib-acpi.c +++ b/drivers/gpio/gpiolib-acpi.c | |||
| @@ -1074,7 +1074,7 @@ void acpi_gpiochip_add(struct gpio_chip *chip) | |||
| 1074 | } | 1074 | } |
| 1075 | 1075 | ||
| 1076 | if (!chip->names) | 1076 | if (!chip->names) |
| 1077 | devprop_gpiochip_set_names(chip); | 1077 | devprop_gpiochip_set_names(chip, dev_fwnode(chip->parent)); |
| 1078 | 1078 | ||
| 1079 | acpi_gpiochip_request_regions(acpi_gpio); | 1079 | acpi_gpiochip_request_regions(acpi_gpio); |
| 1080 | acpi_gpiochip_scan_gpios(acpi_gpio); | 1080 | acpi_gpiochip_scan_gpios(acpi_gpio); |
diff --git a/drivers/gpio/gpiolib-devprop.c b/drivers/gpio/gpiolib-devprop.c index 27f383bda7d9..f748aa3e77f7 100644 --- a/drivers/gpio/gpiolib-devprop.c +++ b/drivers/gpio/gpiolib-devprop.c | |||
| @@ -19,30 +19,27 @@ | |||
| 19 | /** | 19 | /** |
| 20 | * devprop_gpiochip_set_names - Set GPIO line names using device properties | 20 | * devprop_gpiochip_set_names - Set GPIO line names using device properties |
| 21 | * @chip: GPIO chip whose lines should be named, if possible | 21 | * @chip: GPIO chip whose lines should be named, if possible |
| 22 | * @fwnode: Property Node containing the gpio-line-names property | ||
| 22 | * | 23 | * |
| 23 | * Looks for device property "gpio-line-names" and if it exists assigns | 24 | * Looks for device property "gpio-line-names" and if it exists assigns |
| 24 | * GPIO line names for the chip. The memory allocated for the assigned | 25 | * GPIO line names for the chip. The memory allocated for the assigned |
| 25 | * names belong to the underlying firmware node and should not be released | 26 | * names belong to the underlying firmware node and should not be released |
| 26 | * by the caller. | 27 | * by the caller. |
| 27 | */ | 28 | */ |
| 28 | void devprop_gpiochip_set_names(struct gpio_chip *chip) | 29 | void devprop_gpiochip_set_names(struct gpio_chip *chip, |
| 30 | const struct fwnode_handle *fwnode) | ||
| 29 | { | 31 | { |
| 30 | struct gpio_device *gdev = chip->gpiodev; | 32 | struct gpio_device *gdev = chip->gpiodev; |
| 31 | const char **names; | 33 | const char **names; |
| 32 | int ret, i; | 34 | int ret, i; |
| 33 | 35 | ||
| 34 | if (!chip->parent) { | 36 | ret = fwnode_property_read_string_array(fwnode, "gpio-line-names", |
| 35 | dev_warn(&gdev->dev, "GPIO chip parent is NULL\n"); | ||
| 36 | return; | ||
| 37 | } | ||
| 38 | |||
| 39 | ret = device_property_read_string_array(chip->parent, "gpio-line-names", | ||
| 40 | NULL, 0); | 37 | NULL, 0); |
| 41 | if (ret < 0) | 38 | if (ret < 0) |
| 42 | return; | 39 | return; |
| 43 | 40 | ||
| 44 | if (ret != gdev->ngpio) { | 41 | if (ret != gdev->ngpio) { |
| 45 | dev_warn(chip->parent, | 42 | dev_warn(&gdev->dev, |
| 46 | "names %d do not match number of GPIOs %d\n", ret, | 43 | "names %d do not match number of GPIOs %d\n", ret, |
| 47 | gdev->ngpio); | 44 | gdev->ngpio); |
| 48 | return; | 45 | return; |
| @@ -52,10 +49,10 @@ void devprop_gpiochip_set_names(struct gpio_chip *chip) | |||
| 52 | if (!names) | 49 | if (!names) |
| 53 | return; | 50 | return; |
| 54 | 51 | ||
| 55 | ret = device_property_read_string_array(chip->parent, "gpio-line-names", | 52 | ret = fwnode_property_read_string_array(fwnode, "gpio-line-names", |
| 56 | names, gdev->ngpio); | 53 | names, gdev->ngpio); |
| 57 | if (ret < 0) { | 54 | if (ret < 0) { |
| 58 | dev_warn(chip->parent, "failed to read GPIO line names\n"); | 55 | dev_warn(&gdev->dev, "failed to read GPIO line names\n"); |
| 59 | kfree(names); | 56 | kfree(names); |
| 60 | return; | 57 | return; |
| 61 | } | 58 | } |
diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c index e0d59e61b52f..72a0695d2ac3 100644 --- a/drivers/gpio/gpiolib-of.c +++ b/drivers/gpio/gpiolib-of.c | |||
| @@ -493,7 +493,8 @@ int of_gpiochip_add(struct gpio_chip *chip) | |||
| 493 | 493 | ||
| 494 | /* If the chip defines names itself, these take precedence */ | 494 | /* If the chip defines names itself, these take precedence */ |
| 495 | if (!chip->names) | 495 | if (!chip->names) |
| 496 | devprop_gpiochip_set_names(chip); | 496 | devprop_gpiochip_set_names(chip, |
| 497 | of_fwnode_handle(chip->of_node)); | ||
| 497 | 498 | ||
| 498 | of_node_get(chip->of_node); | 499 | of_node_get(chip->of_node); |
| 499 | 500 | ||
diff --git a/drivers/gpio/gpiolib.h b/drivers/gpio/gpiolib.h index af48322839c3..6c44d1652139 100644 --- a/drivers/gpio/gpiolib.h +++ b/drivers/gpio/gpiolib.h | |||
| @@ -228,7 +228,8 @@ static inline int gpio_chip_hwgpio(const struct gpio_desc *desc) | |||
| 228 | return desc - &desc->gdev->descs[0]; | 228 | return desc - &desc->gdev->descs[0]; |
| 229 | } | 229 | } |
| 230 | 230 | ||
| 231 | void devprop_gpiochip_set_names(struct gpio_chip *chip); | 231 | void devprop_gpiochip_set_names(struct gpio_chip *chip, |
| 232 | const struct fwnode_handle *fwnode); | ||
| 232 | 233 | ||
| 233 | /* With descriptor prefix */ | 234 | /* With descriptor prefix */ |
| 234 | 235 | ||
diff --git a/drivers/gpu/drm/i915/gvt/display.c b/drivers/gpu/drm/i915/gvt/display.c index 355120865efd..309f3fa6794a 100644 --- a/drivers/gpu/drm/i915/gvt/display.c +++ b/drivers/gpu/drm/i915/gvt/display.c | |||
| @@ -266,6 +266,8 @@ static void emulate_monitor_status_change(struct intel_vgpu *vgpu) | |||
| 266 | /* Clear host CRT status, so guest couldn't detect this host CRT. */ | 266 | /* Clear host CRT status, so guest couldn't detect this host CRT. */ |
| 267 | if (IS_BROADWELL(dev_priv)) | 267 | if (IS_BROADWELL(dev_priv)) |
| 268 | vgpu_vreg(vgpu, PCH_ADPA) &= ~ADPA_CRT_HOTPLUG_MONITOR_MASK; | 268 | vgpu_vreg(vgpu, PCH_ADPA) &= ~ADPA_CRT_HOTPLUG_MONITOR_MASK; |
| 269 | |||
| 270 | vgpu_vreg(vgpu, PIPECONF(PIPE_A)) |= PIPECONF_ENABLE; | ||
| 269 | } | 271 | } |
| 270 | 272 | ||
| 271 | static void clean_virtual_dp_monitor(struct intel_vgpu *vgpu, int port_num) | 273 | static void clean_virtual_dp_monitor(struct intel_vgpu *vgpu, int port_num) |
| @@ -282,7 +284,6 @@ static void clean_virtual_dp_monitor(struct intel_vgpu *vgpu, int port_num) | |||
| 282 | static int setup_virtual_dp_monitor(struct intel_vgpu *vgpu, int port_num, | 284 | static int setup_virtual_dp_monitor(struct intel_vgpu *vgpu, int port_num, |
| 283 | int type, unsigned int resolution) | 285 | int type, unsigned int resolution) |
| 284 | { | 286 | { |
| 285 | struct drm_i915_private *dev_priv = vgpu->gvt->dev_priv; | ||
| 286 | struct intel_vgpu_port *port = intel_vgpu_port(vgpu, port_num); | 287 | struct intel_vgpu_port *port = intel_vgpu_port(vgpu, port_num); |
| 287 | 288 | ||
| 288 | if (WARN_ON(resolution >= GVT_EDID_NUM)) | 289 | if (WARN_ON(resolution >= GVT_EDID_NUM)) |
| @@ -308,7 +309,7 @@ static int setup_virtual_dp_monitor(struct intel_vgpu *vgpu, int port_num, | |||
| 308 | port->type = type; | 309 | port->type = type; |
| 309 | 310 | ||
| 310 | emulate_monitor_status_change(vgpu); | 311 | emulate_monitor_status_change(vgpu); |
| 311 | vgpu_vreg(vgpu, PIPECONF(PIPE_A)) |= PIPECONF_ENABLE; | 312 | |
| 312 | return 0; | 313 | return 0; |
| 313 | } | 314 | } |
| 314 | 315 | ||
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index ff9397030092..30cf273d57aa 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
| @@ -13194,7 +13194,7 @@ intel_primary_plane_create(struct drm_i915_private *dev_priv, enum pipe pipe) | |||
| 13194 | primary->frontbuffer_bit = INTEL_FRONTBUFFER_PRIMARY(pipe); | 13194 | primary->frontbuffer_bit = INTEL_FRONTBUFFER_PRIMARY(pipe); |
| 13195 | primary->check_plane = intel_check_primary_plane; | 13195 | primary->check_plane = intel_check_primary_plane; |
| 13196 | 13196 | ||
| 13197 | if (INTEL_GEN(dev_priv) >= 10 || IS_GEMINILAKE(dev_priv)) { | 13197 | if (INTEL_GEN(dev_priv) >= 10) { |
| 13198 | intel_primary_formats = skl_primary_formats; | 13198 | intel_primary_formats = skl_primary_formats; |
| 13199 | num_formats = ARRAY_SIZE(skl_primary_formats); | 13199 | num_formats = ARRAY_SIZE(skl_primary_formats); |
| 13200 | modifiers = skl_format_modifiers_ccs; | 13200 | modifiers = skl_format_modifiers_ccs; |
diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c index 8d4a5be3b913..56fe261b6268 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drm.c +++ b/drivers/gpu/drm/nouveau/nouveau_drm.c | |||
| @@ -152,9 +152,9 @@ nouveau_cli_work_queue(struct nouveau_cli *cli, struct dma_fence *fence, | |||
| 152 | work->cli = cli; | 152 | work->cli = cli; |
| 153 | mutex_lock(&cli->lock); | 153 | mutex_lock(&cli->lock); |
| 154 | list_add_tail(&work->head, &cli->worker); | 154 | list_add_tail(&work->head, &cli->worker); |
| 155 | mutex_unlock(&cli->lock); | ||
| 156 | if (dma_fence_add_callback(fence, &work->cb, nouveau_cli_work_fence)) | 155 | if (dma_fence_add_callback(fence, &work->cb, nouveau_cli_work_fence)) |
| 157 | nouveau_cli_work_fence(fence, &work->cb); | 156 | nouveau_cli_work_fence(fence, &work->cb); |
| 157 | mutex_unlock(&cli->lock); | ||
| 158 | } | 158 | } |
| 159 | 159 | ||
| 160 | static void | 160 | static void |
diff --git a/drivers/hwmon/hwmon.c b/drivers/hwmon/hwmon.c index c9790e2c3440..af5123042990 100644 --- a/drivers/hwmon/hwmon.c +++ b/drivers/hwmon/hwmon.c | |||
| @@ -143,6 +143,7 @@ static int hwmon_thermal_add_sensor(struct device *dev, | |||
| 143 | struct hwmon_device *hwdev, int index) | 143 | struct hwmon_device *hwdev, int index) |
| 144 | { | 144 | { |
| 145 | struct hwmon_thermal_data *tdata; | 145 | struct hwmon_thermal_data *tdata; |
| 146 | struct thermal_zone_device *tzd; | ||
| 146 | 147 | ||
| 147 | tdata = devm_kzalloc(dev, sizeof(*tdata), GFP_KERNEL); | 148 | tdata = devm_kzalloc(dev, sizeof(*tdata), GFP_KERNEL); |
| 148 | if (!tdata) | 149 | if (!tdata) |
| @@ -151,8 +152,14 @@ static int hwmon_thermal_add_sensor(struct device *dev, | |||
| 151 | tdata->hwdev = hwdev; | 152 | tdata->hwdev = hwdev; |
| 152 | tdata->index = index; | 153 | tdata->index = index; |
| 153 | 154 | ||
| 154 | devm_thermal_zone_of_sensor_register(&hwdev->dev, index, tdata, | 155 | tzd = devm_thermal_zone_of_sensor_register(&hwdev->dev, index, tdata, |
| 155 | &hwmon_thermal_ops); | 156 | &hwmon_thermal_ops); |
| 157 | /* | ||
| 158 | * If CONFIG_THERMAL_OF is disabled, this returns -ENODEV, | ||
| 159 | * so ignore that error but forward any other error. | ||
| 160 | */ | ||
| 161 | if (IS_ERR(tzd) && (PTR_ERR(tzd) != -ENODEV)) | ||
| 162 | return PTR_ERR(tzd); | ||
| 156 | 163 | ||
| 157 | return 0; | 164 | return 0; |
| 158 | } | 165 | } |
| @@ -621,14 +628,20 @@ __hwmon_device_register(struct device *dev, const char *name, void *drvdata, | |||
| 621 | if (!chip->ops->is_visible(drvdata, hwmon_temp, | 628 | if (!chip->ops->is_visible(drvdata, hwmon_temp, |
| 622 | hwmon_temp_input, j)) | 629 | hwmon_temp_input, j)) |
| 623 | continue; | 630 | continue; |
| 624 | if (info[i]->config[j] & HWMON_T_INPUT) | 631 | if (info[i]->config[j] & HWMON_T_INPUT) { |
| 625 | hwmon_thermal_add_sensor(dev, hwdev, j); | 632 | err = hwmon_thermal_add_sensor(dev, |
| 633 | hwdev, j); | ||
| 634 | if (err) | ||
| 635 | goto free_device; | ||
| 636 | } | ||
| 626 | } | 637 | } |
| 627 | } | 638 | } |
| 628 | } | 639 | } |
| 629 | 640 | ||
| 630 | return hdev; | 641 | return hdev; |
| 631 | 642 | ||
| 643 | free_device: | ||
| 644 | device_unregister(hdev); | ||
| 632 | free_hwmon: | 645 | free_hwmon: |
| 633 | kfree(hwdev); | 646 | kfree(hwdev); |
| 634 | ida_remove: | 647 | ida_remove: |
diff --git a/drivers/infiniband/core/security.c b/drivers/infiniband/core/security.c index feafdb961c48..59b2f96d986a 100644 --- a/drivers/infiniband/core/security.c +++ b/drivers/infiniband/core/security.c | |||
| @@ -386,6 +386,9 @@ int ib_open_shared_qp_security(struct ib_qp *qp, struct ib_device *dev) | |||
| 386 | if (ret) | 386 | if (ret) |
| 387 | return ret; | 387 | return ret; |
| 388 | 388 | ||
| 389 | if (!qp->qp_sec) | ||
| 390 | return 0; | ||
| 391 | |||
| 389 | mutex_lock(&real_qp->qp_sec->mutex); | 392 | mutex_lock(&real_qp->qp_sec->mutex); |
| 390 | ret = check_qp_port_pkey_settings(real_qp->qp_sec->ports_pkeys, | 393 | ret = check_qp_port_pkey_settings(real_qp->qp_sec->ports_pkeys, |
| 391 | qp->qp_sec); | 394 | qp->qp_sec); |
diff --git a/drivers/infiniband/core/uverbs_cmd.c b/drivers/infiniband/core/uverbs_cmd.c index d0202bb176a4..840b24096690 100644 --- a/drivers/infiniband/core/uverbs_cmd.c +++ b/drivers/infiniband/core/uverbs_cmd.c | |||
| @@ -2074,8 +2074,8 @@ int ib_uverbs_ex_modify_qp(struct ib_uverbs_file *file, | |||
| 2074 | return -EOPNOTSUPP; | 2074 | return -EOPNOTSUPP; |
| 2075 | 2075 | ||
| 2076 | if (ucore->inlen > sizeof(cmd)) { | 2076 | if (ucore->inlen > sizeof(cmd)) { |
| 2077 | if (ib_is_udata_cleared(ucore, sizeof(cmd), | 2077 | if (!ib_is_udata_cleared(ucore, sizeof(cmd), |
| 2078 | ucore->inlen - sizeof(cmd))) | 2078 | ucore->inlen - sizeof(cmd))) |
| 2079 | return -EOPNOTSUPP; | 2079 | return -EOPNOTSUPP; |
| 2080 | } | 2080 | } |
| 2081 | 2081 | ||
diff --git a/drivers/infiniband/core/verbs.c b/drivers/infiniband/core/verbs.c index 3fb8fb6cc824..e36d27ed4daa 100644 --- a/drivers/infiniband/core/verbs.c +++ b/drivers/infiniband/core/verbs.c | |||
| @@ -1438,7 +1438,8 @@ int ib_close_qp(struct ib_qp *qp) | |||
| 1438 | spin_unlock_irqrestore(&real_qp->device->event_handler_lock, flags); | 1438 | spin_unlock_irqrestore(&real_qp->device->event_handler_lock, flags); |
| 1439 | 1439 | ||
| 1440 | atomic_dec(&real_qp->usecnt); | 1440 | atomic_dec(&real_qp->usecnt); |
| 1441 | ib_close_shared_qp_security(qp->qp_sec); | 1441 | if (qp->qp_sec) |
| 1442 | ib_close_shared_qp_security(qp->qp_sec); | ||
| 1442 | kfree(qp); | 1443 | kfree(qp); |
| 1443 | 1444 | ||
| 1444 | return 0; | 1445 | return 0; |
diff --git a/drivers/infiniband/hw/cxgb4/cq.c b/drivers/infiniband/hw/cxgb4/cq.c index b7bfc536e00f..6f2b26126c64 100644 --- a/drivers/infiniband/hw/cxgb4/cq.c +++ b/drivers/infiniband/hw/cxgb4/cq.c | |||
| @@ -395,7 +395,7 @@ next_cqe: | |||
| 395 | 395 | ||
| 396 | static int cqe_completes_wr(struct t4_cqe *cqe, struct t4_wq *wq) | 396 | static int cqe_completes_wr(struct t4_cqe *cqe, struct t4_wq *wq) |
| 397 | { | 397 | { |
| 398 | if (CQE_OPCODE(cqe) == C4IW_DRAIN_OPCODE) { | 398 | if (DRAIN_CQE(cqe)) { |
| 399 | WARN_ONCE(1, "Unexpected DRAIN CQE qp id %u!\n", wq->sq.qid); | 399 | WARN_ONCE(1, "Unexpected DRAIN CQE qp id %u!\n", wq->sq.qid); |
| 400 | return 0; | 400 | return 0; |
| 401 | } | 401 | } |
| @@ -494,7 +494,7 @@ static int poll_cq(struct t4_wq *wq, struct t4_cq *cq, struct t4_cqe *cqe, | |||
| 494 | /* | 494 | /* |
| 495 | * Special cqe for drain WR completions... | 495 | * Special cqe for drain WR completions... |
| 496 | */ | 496 | */ |
| 497 | if (CQE_OPCODE(hw_cqe) == C4IW_DRAIN_OPCODE) { | 497 | if (DRAIN_CQE(hw_cqe)) { |
| 498 | *cookie = CQE_DRAIN_COOKIE(hw_cqe); | 498 | *cookie = CQE_DRAIN_COOKIE(hw_cqe); |
| 499 | *cqe = *hw_cqe; | 499 | *cqe = *hw_cqe; |
| 500 | goto skip_cqe; | 500 | goto skip_cqe; |
| @@ -571,10 +571,10 @@ static int poll_cq(struct t4_wq *wq, struct t4_cq *cq, struct t4_cqe *cqe, | |||
| 571 | ret = -EAGAIN; | 571 | ret = -EAGAIN; |
| 572 | goto skip_cqe; | 572 | goto skip_cqe; |
| 573 | } | 573 | } |
| 574 | if (unlikely((CQE_WRID_MSN(hw_cqe) != (wq->rq.msn)))) { | 574 | if (unlikely(!CQE_STATUS(hw_cqe) && |
| 575 | CQE_WRID_MSN(hw_cqe) != wq->rq.msn)) { | ||
| 575 | t4_set_wq_in_error(wq); | 576 | t4_set_wq_in_error(wq); |
| 576 | hw_cqe->header |= htonl(CQE_STATUS_V(T4_ERR_MSN)); | 577 | hw_cqe->header |= cpu_to_be32(CQE_STATUS_V(T4_ERR_MSN)); |
| 577 | goto proc_cqe; | ||
| 578 | } | 578 | } |
| 579 | goto proc_cqe; | 579 | goto proc_cqe; |
| 580 | } | 580 | } |
| @@ -748,9 +748,6 @@ static int c4iw_poll_cq_one(struct c4iw_cq *chp, struct ib_wc *wc) | |||
| 748 | c4iw_invalidate_mr(qhp->rhp, | 748 | c4iw_invalidate_mr(qhp->rhp, |
| 749 | CQE_WRID_FR_STAG(&cqe)); | 749 | CQE_WRID_FR_STAG(&cqe)); |
| 750 | break; | 750 | break; |
| 751 | case C4IW_DRAIN_OPCODE: | ||
| 752 | wc->opcode = IB_WC_SEND; | ||
| 753 | break; | ||
| 754 | default: | 751 | default: |
| 755 | pr_err("Unexpected opcode %d in the CQE received for QPID=0x%0x\n", | 752 | pr_err("Unexpected opcode %d in the CQE received for QPID=0x%0x\n", |
| 756 | CQE_OPCODE(&cqe), CQE_QPID(&cqe)); | 753 | CQE_OPCODE(&cqe), CQE_QPID(&cqe)); |
diff --git a/drivers/infiniband/hw/cxgb4/iw_cxgb4.h b/drivers/infiniband/hw/cxgb4/iw_cxgb4.h index 470f97a79ebb..65dd3726ca02 100644 --- a/drivers/infiniband/hw/cxgb4/iw_cxgb4.h +++ b/drivers/infiniband/hw/cxgb4/iw_cxgb4.h | |||
| @@ -693,8 +693,6 @@ static inline int to_ib_qp_state(int c4iw_qp_state) | |||
| 693 | return IB_QPS_ERR; | 693 | return IB_QPS_ERR; |
| 694 | } | 694 | } |
| 695 | 695 | ||
| 696 | #define C4IW_DRAIN_OPCODE FW_RI_SGE_EC_CR_RETURN | ||
| 697 | |||
| 698 | static inline u32 c4iw_ib_to_tpt_access(int a) | 696 | static inline u32 c4iw_ib_to_tpt_access(int a) |
| 699 | { | 697 | { |
| 700 | return (a & IB_ACCESS_REMOTE_WRITE ? FW_RI_MEM_ACCESS_REM_WRITE : 0) | | 698 | return (a & IB_ACCESS_REMOTE_WRITE ? FW_RI_MEM_ACCESS_REM_WRITE : 0) | |
diff --git a/drivers/infiniband/hw/cxgb4/qp.c b/drivers/infiniband/hw/cxgb4/qp.c index 38bddd02a943..d5c92fc520d6 100644 --- a/drivers/infiniband/hw/cxgb4/qp.c +++ b/drivers/infiniband/hw/cxgb4/qp.c | |||
| @@ -790,21 +790,57 @@ static int ring_kernel_rq_db(struct c4iw_qp *qhp, u16 inc) | |||
| 790 | return 0; | 790 | return 0; |
| 791 | } | 791 | } |
| 792 | 792 | ||
| 793 | static void complete_sq_drain_wr(struct c4iw_qp *qhp, struct ib_send_wr *wr) | 793 | static int ib_to_fw_opcode(int ib_opcode) |
| 794 | { | ||
| 795 | int opcode; | ||
| 796 | |||
| 797 | switch (ib_opcode) { | ||
| 798 | case IB_WR_SEND_WITH_INV: | ||
| 799 | opcode = FW_RI_SEND_WITH_INV; | ||
| 800 | break; | ||
| 801 | case IB_WR_SEND: | ||
| 802 | opcode = FW_RI_SEND; | ||
| 803 | break; | ||
| 804 | case IB_WR_RDMA_WRITE: | ||
| 805 | opcode = FW_RI_RDMA_WRITE; | ||
| 806 | break; | ||
| 807 | case IB_WR_RDMA_READ: | ||
| 808 | case IB_WR_RDMA_READ_WITH_INV: | ||
| 809 | opcode = FW_RI_READ_REQ; | ||
| 810 | break; | ||
| 811 | case IB_WR_REG_MR: | ||
| 812 | opcode = FW_RI_FAST_REGISTER; | ||
| 813 | break; | ||
| 814 | case IB_WR_LOCAL_INV: | ||
| 815 | opcode = FW_RI_LOCAL_INV; | ||
| 816 | break; | ||
| 817 | default: | ||
| 818 | opcode = -EINVAL; | ||
| 819 | } | ||
| 820 | return opcode; | ||
| 821 | } | ||
| 822 | |||
| 823 | static int complete_sq_drain_wr(struct c4iw_qp *qhp, struct ib_send_wr *wr) | ||
| 794 | { | 824 | { |
| 795 | struct t4_cqe cqe = {}; | 825 | struct t4_cqe cqe = {}; |
| 796 | struct c4iw_cq *schp; | 826 | struct c4iw_cq *schp; |
| 797 | unsigned long flag; | 827 | unsigned long flag; |
| 798 | struct t4_cq *cq; | 828 | struct t4_cq *cq; |
| 829 | int opcode; | ||
| 799 | 830 | ||
| 800 | schp = to_c4iw_cq(qhp->ibqp.send_cq); | 831 | schp = to_c4iw_cq(qhp->ibqp.send_cq); |
| 801 | cq = &schp->cq; | 832 | cq = &schp->cq; |
| 802 | 833 | ||
| 834 | opcode = ib_to_fw_opcode(wr->opcode); | ||
| 835 | if (opcode < 0) | ||
| 836 | return opcode; | ||
| 837 | |||
| 803 | cqe.u.drain_cookie = wr->wr_id; | 838 | cqe.u.drain_cookie = wr->wr_id; |
| 804 | cqe.header = cpu_to_be32(CQE_STATUS_V(T4_ERR_SWFLUSH) | | 839 | cqe.header = cpu_to_be32(CQE_STATUS_V(T4_ERR_SWFLUSH) | |
| 805 | CQE_OPCODE_V(C4IW_DRAIN_OPCODE) | | 840 | CQE_OPCODE_V(opcode) | |
| 806 | CQE_TYPE_V(1) | | 841 | CQE_TYPE_V(1) | |
| 807 | CQE_SWCQE_V(1) | | 842 | CQE_SWCQE_V(1) | |
| 843 | CQE_DRAIN_V(1) | | ||
| 808 | CQE_QPID_V(qhp->wq.sq.qid)); | 844 | CQE_QPID_V(qhp->wq.sq.qid)); |
| 809 | 845 | ||
| 810 | spin_lock_irqsave(&schp->lock, flag); | 846 | spin_lock_irqsave(&schp->lock, flag); |
| @@ -819,6 +855,23 @@ static void complete_sq_drain_wr(struct c4iw_qp *qhp, struct ib_send_wr *wr) | |||
| 819 | schp->ibcq.cq_context); | 855 | schp->ibcq.cq_context); |
| 820 | spin_unlock_irqrestore(&schp->comp_handler_lock, flag); | 856 | spin_unlock_irqrestore(&schp->comp_handler_lock, flag); |
| 821 | } | 857 | } |
| 858 | return 0; | ||
| 859 | } | ||
| 860 | |||
| 861 | static int complete_sq_drain_wrs(struct c4iw_qp *qhp, struct ib_send_wr *wr, | ||
| 862 | struct ib_send_wr **bad_wr) | ||
| 863 | { | ||
| 864 | int ret = 0; | ||
| 865 | |||
| 866 | while (wr) { | ||
| 867 | ret = complete_sq_drain_wr(qhp, wr); | ||
| 868 | if (ret) { | ||
| 869 | *bad_wr = wr; | ||
| 870 | break; | ||
| 871 | } | ||
| 872 | wr = wr->next; | ||
| 873 | } | ||
| 874 | return ret; | ||
| 822 | } | 875 | } |
| 823 | 876 | ||
| 824 | static void complete_rq_drain_wr(struct c4iw_qp *qhp, struct ib_recv_wr *wr) | 877 | static void complete_rq_drain_wr(struct c4iw_qp *qhp, struct ib_recv_wr *wr) |
| @@ -833,9 +886,10 @@ static void complete_rq_drain_wr(struct c4iw_qp *qhp, struct ib_recv_wr *wr) | |||
| 833 | 886 | ||
| 834 | cqe.u.drain_cookie = wr->wr_id; | 887 | cqe.u.drain_cookie = wr->wr_id; |
| 835 | cqe.header = cpu_to_be32(CQE_STATUS_V(T4_ERR_SWFLUSH) | | 888 | cqe.header = cpu_to_be32(CQE_STATUS_V(T4_ERR_SWFLUSH) | |
| 836 | CQE_OPCODE_V(C4IW_DRAIN_OPCODE) | | 889 | CQE_OPCODE_V(FW_RI_SEND) | |
| 837 | CQE_TYPE_V(0) | | 890 | CQE_TYPE_V(0) | |
| 838 | CQE_SWCQE_V(1) | | 891 | CQE_SWCQE_V(1) | |
| 892 | CQE_DRAIN_V(1) | | ||
| 839 | CQE_QPID_V(qhp->wq.sq.qid)); | 893 | CQE_QPID_V(qhp->wq.sq.qid)); |
| 840 | 894 | ||
| 841 | spin_lock_irqsave(&rchp->lock, flag); | 895 | spin_lock_irqsave(&rchp->lock, flag); |
| @@ -852,6 +906,14 @@ static void complete_rq_drain_wr(struct c4iw_qp *qhp, struct ib_recv_wr *wr) | |||
| 852 | } | 906 | } |
| 853 | } | 907 | } |
| 854 | 908 | ||
| 909 | static void complete_rq_drain_wrs(struct c4iw_qp *qhp, struct ib_recv_wr *wr) | ||
| 910 | { | ||
| 911 | while (wr) { | ||
| 912 | complete_rq_drain_wr(qhp, wr); | ||
| 913 | wr = wr->next; | ||
| 914 | } | ||
| 915 | } | ||
| 916 | |||
| 855 | int c4iw_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr, | 917 | int c4iw_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr, |
| 856 | struct ib_send_wr **bad_wr) | 918 | struct ib_send_wr **bad_wr) |
| 857 | { | 919 | { |
| @@ -875,7 +937,7 @@ int c4iw_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr, | |||
| 875 | */ | 937 | */ |
| 876 | if (qhp->wq.flushed) { | 938 | if (qhp->wq.flushed) { |
| 877 | spin_unlock_irqrestore(&qhp->lock, flag); | 939 | spin_unlock_irqrestore(&qhp->lock, flag); |
| 878 | complete_sq_drain_wr(qhp, wr); | 940 | err = complete_sq_drain_wrs(qhp, wr, bad_wr); |
| 879 | return err; | 941 | return err; |
| 880 | } | 942 | } |
| 881 | num_wrs = t4_sq_avail(&qhp->wq); | 943 | num_wrs = t4_sq_avail(&qhp->wq); |
| @@ -1023,7 +1085,7 @@ int c4iw_post_receive(struct ib_qp *ibqp, struct ib_recv_wr *wr, | |||
| 1023 | */ | 1085 | */ |
| 1024 | if (qhp->wq.flushed) { | 1086 | if (qhp->wq.flushed) { |
| 1025 | spin_unlock_irqrestore(&qhp->lock, flag); | 1087 | spin_unlock_irqrestore(&qhp->lock, flag); |
| 1026 | complete_rq_drain_wr(qhp, wr); | 1088 | complete_rq_drain_wrs(qhp, wr); |
| 1027 | return err; | 1089 | return err; |
| 1028 | } | 1090 | } |
| 1029 | num_wrs = t4_rq_avail(&qhp->wq); | 1091 | num_wrs = t4_rq_avail(&qhp->wq); |
diff --git a/drivers/infiniband/hw/cxgb4/t4.h b/drivers/infiniband/hw/cxgb4/t4.h index e9ea94268d51..79e8ee12c391 100644 --- a/drivers/infiniband/hw/cxgb4/t4.h +++ b/drivers/infiniband/hw/cxgb4/t4.h | |||
| @@ -197,6 +197,11 @@ struct t4_cqe { | |||
| 197 | #define CQE_SWCQE_G(x) ((((x) >> CQE_SWCQE_S)) & CQE_SWCQE_M) | 197 | #define CQE_SWCQE_G(x) ((((x) >> CQE_SWCQE_S)) & CQE_SWCQE_M) |
| 198 | #define CQE_SWCQE_V(x) ((x)<<CQE_SWCQE_S) | 198 | #define CQE_SWCQE_V(x) ((x)<<CQE_SWCQE_S) |
| 199 | 199 | ||
| 200 | #define CQE_DRAIN_S 10 | ||
| 201 | #define CQE_DRAIN_M 0x1 | ||
| 202 | #define CQE_DRAIN_G(x) ((((x) >> CQE_DRAIN_S)) & CQE_DRAIN_M) | ||
| 203 | #define CQE_DRAIN_V(x) ((x)<<CQE_DRAIN_S) | ||
| 204 | |||
| 200 | #define CQE_STATUS_S 5 | 205 | #define CQE_STATUS_S 5 |
| 201 | #define CQE_STATUS_M 0x1F | 206 | #define CQE_STATUS_M 0x1F |
| 202 | #define CQE_STATUS_G(x) ((((x) >> CQE_STATUS_S)) & CQE_STATUS_M) | 207 | #define CQE_STATUS_G(x) ((((x) >> CQE_STATUS_S)) & CQE_STATUS_M) |
| @@ -213,6 +218,7 @@ struct t4_cqe { | |||
| 213 | #define CQE_OPCODE_V(x) ((x)<<CQE_OPCODE_S) | 218 | #define CQE_OPCODE_V(x) ((x)<<CQE_OPCODE_S) |
| 214 | 219 | ||
| 215 | #define SW_CQE(x) (CQE_SWCQE_G(be32_to_cpu((x)->header))) | 220 | #define SW_CQE(x) (CQE_SWCQE_G(be32_to_cpu((x)->header))) |
| 221 | #define DRAIN_CQE(x) (CQE_DRAIN_G(be32_to_cpu((x)->header))) | ||
| 216 | #define CQE_QPID(x) (CQE_QPID_G(be32_to_cpu((x)->header))) | 222 | #define CQE_QPID(x) (CQE_QPID_G(be32_to_cpu((x)->header))) |
| 217 | #define CQE_TYPE(x) (CQE_TYPE_G(be32_to_cpu((x)->header))) | 223 | #define CQE_TYPE(x) (CQE_TYPE_G(be32_to_cpu((x)->header))) |
| 218 | #define SQ_TYPE(x) (CQE_TYPE((x))) | 224 | #define SQ_TYPE(x) (CQE_TYPE((x))) |
diff --git a/drivers/infiniband/hw/hfi1/hfi.h b/drivers/infiniband/hw/hfi1/hfi.h index 4a9b4d7efe63..8ce9118d4a7f 100644 --- a/drivers/infiniband/hw/hfi1/hfi.h +++ b/drivers/infiniband/hw/hfi1/hfi.h | |||
| @@ -1131,7 +1131,6 @@ struct hfi1_devdata { | |||
| 1131 | u16 pcie_lnkctl; | 1131 | u16 pcie_lnkctl; |
| 1132 | u16 pcie_devctl2; | 1132 | u16 pcie_devctl2; |
| 1133 | u32 pci_msix0; | 1133 | u32 pci_msix0; |
| 1134 | u32 pci_lnkctl3; | ||
| 1135 | u32 pci_tph2; | 1134 | u32 pci_tph2; |
| 1136 | 1135 | ||
| 1137 | /* | 1136 | /* |
diff --git a/drivers/infiniband/hw/hfi1/pcie.c b/drivers/infiniband/hw/hfi1/pcie.c index 09e50fd2a08f..8c7e7a60b715 100644 --- a/drivers/infiniband/hw/hfi1/pcie.c +++ b/drivers/infiniband/hw/hfi1/pcie.c | |||
| @@ -411,15 +411,12 @@ int restore_pci_variables(struct hfi1_devdata *dd) | |||
| 411 | if (ret) | 411 | if (ret) |
| 412 | goto error; | 412 | goto error; |
| 413 | 413 | ||
| 414 | ret = pci_write_config_dword(dd->pcidev, PCIE_CFG_SPCIE1, | 414 | if (pci_find_ext_capability(dd->pcidev, PCI_EXT_CAP_ID_TPH)) { |
| 415 | dd->pci_lnkctl3); | 415 | ret = pci_write_config_dword(dd->pcidev, PCIE_CFG_TPH2, |
| 416 | if (ret) | 416 | dd->pci_tph2); |
| 417 | goto error; | 417 | if (ret) |
| 418 | 418 | goto error; | |
| 419 | ret = pci_write_config_dword(dd->pcidev, PCIE_CFG_TPH2, dd->pci_tph2); | 419 | } |
| 420 | if (ret) | ||
| 421 | goto error; | ||
| 422 | |||
| 423 | return 0; | 420 | return 0; |
| 424 | 421 | ||
| 425 | error: | 422 | error: |
| @@ -469,15 +466,12 @@ int save_pci_variables(struct hfi1_devdata *dd) | |||
| 469 | if (ret) | 466 | if (ret) |
| 470 | goto error; | 467 | goto error; |
| 471 | 468 | ||
| 472 | ret = pci_read_config_dword(dd->pcidev, PCIE_CFG_SPCIE1, | 469 | if (pci_find_ext_capability(dd->pcidev, PCI_EXT_CAP_ID_TPH)) { |
| 473 | &dd->pci_lnkctl3); | 470 | ret = pci_read_config_dword(dd->pcidev, PCIE_CFG_TPH2, |
| 474 | if (ret) | 471 | &dd->pci_tph2); |
| 475 | goto error; | 472 | if (ret) |
| 476 | 473 | goto error; | |
| 477 | ret = pci_read_config_dword(dd->pcidev, PCIE_CFG_TPH2, &dd->pci_tph2); | 474 | } |
| 478 | if (ret) | ||
| 479 | goto error; | ||
| 480 | |||
| 481 | return 0; | 475 | return 0; |
| 482 | 476 | ||
| 483 | error: | 477 | error: |
diff --git a/drivers/infiniband/hw/mlx5/cmd.c b/drivers/infiniband/hw/mlx5/cmd.c index 470995fa38d2..6f6712f87a73 100644 --- a/drivers/infiniband/hw/mlx5/cmd.c +++ b/drivers/infiniband/hw/mlx5/cmd.c | |||
| @@ -47,17 +47,6 @@ int mlx5_cmd_null_mkey(struct mlx5_core_dev *dev, u32 *null_mkey) | |||
| 47 | return err; | 47 | return err; |
| 48 | } | 48 | } |
| 49 | 49 | ||
| 50 | int mlx5_cmd_query_cong_counter(struct mlx5_core_dev *dev, | ||
| 51 | bool reset, void *out, int out_size) | ||
| 52 | { | ||
| 53 | u32 in[MLX5_ST_SZ_DW(query_cong_statistics_in)] = { }; | ||
| 54 | |||
| 55 | MLX5_SET(query_cong_statistics_in, in, opcode, | ||
| 56 | MLX5_CMD_OP_QUERY_CONG_STATISTICS); | ||
| 57 | MLX5_SET(query_cong_statistics_in, in, clear, reset); | ||
| 58 | return mlx5_cmd_exec(dev, in, sizeof(in), out, out_size); | ||
| 59 | } | ||
| 60 | |||
| 61 | int mlx5_cmd_query_cong_params(struct mlx5_core_dev *dev, int cong_point, | 50 | int mlx5_cmd_query_cong_params(struct mlx5_core_dev *dev, int cong_point, |
| 62 | void *out, int out_size) | 51 | void *out, int out_size) |
| 63 | { | 52 | { |
diff --git a/drivers/infiniband/hw/mlx5/cmd.h b/drivers/infiniband/hw/mlx5/cmd.h index af4c24596274..78ffded7cc2c 100644 --- a/drivers/infiniband/hw/mlx5/cmd.h +++ b/drivers/infiniband/hw/mlx5/cmd.h | |||
| @@ -37,8 +37,6 @@ | |||
| 37 | #include <linux/mlx5/driver.h> | 37 | #include <linux/mlx5/driver.h> |
| 38 | 38 | ||
| 39 | int mlx5_cmd_null_mkey(struct mlx5_core_dev *dev, u32 *null_mkey); | 39 | int mlx5_cmd_null_mkey(struct mlx5_core_dev *dev, u32 *null_mkey); |
| 40 | int mlx5_cmd_query_cong_counter(struct mlx5_core_dev *dev, | ||
| 41 | bool reset, void *out, int out_size); | ||
| 42 | int mlx5_cmd_query_cong_params(struct mlx5_core_dev *dev, int cong_point, | 40 | int mlx5_cmd_query_cong_params(struct mlx5_core_dev *dev, int cong_point, |
| 43 | void *out, int out_size); | 41 | void *out, int out_size); |
| 44 | int mlx5_cmd_modify_cong_params(struct mlx5_core_dev *mdev, | 42 | int mlx5_cmd_modify_cong_params(struct mlx5_core_dev *mdev, |
diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c index 543d0a4c8bf3..8ac50de2b242 100644 --- a/drivers/infiniband/hw/mlx5/main.c +++ b/drivers/infiniband/hw/mlx5/main.c | |||
| @@ -1463,6 +1463,7 @@ static struct ib_ucontext *mlx5_ib_alloc_ucontext(struct ib_device *ibdev, | |||
| 1463 | } | 1463 | } |
| 1464 | 1464 | ||
| 1465 | INIT_LIST_HEAD(&context->vma_private_list); | 1465 | INIT_LIST_HEAD(&context->vma_private_list); |
| 1466 | mutex_init(&context->vma_private_list_mutex); | ||
| 1466 | INIT_LIST_HEAD(&context->db_page_list); | 1467 | INIT_LIST_HEAD(&context->db_page_list); |
| 1467 | mutex_init(&context->db_page_mutex); | 1468 | mutex_init(&context->db_page_mutex); |
| 1468 | 1469 | ||
| @@ -1624,7 +1625,9 @@ static void mlx5_ib_vma_close(struct vm_area_struct *area) | |||
| 1624 | * mlx5_ib_disassociate_ucontext(). | 1625 | * mlx5_ib_disassociate_ucontext(). |
| 1625 | */ | 1626 | */ |
| 1626 | mlx5_ib_vma_priv_data->vma = NULL; | 1627 | mlx5_ib_vma_priv_data->vma = NULL; |
| 1628 | mutex_lock(mlx5_ib_vma_priv_data->vma_private_list_mutex); | ||
| 1627 | list_del(&mlx5_ib_vma_priv_data->list); | 1629 | list_del(&mlx5_ib_vma_priv_data->list); |
| 1630 | mutex_unlock(mlx5_ib_vma_priv_data->vma_private_list_mutex); | ||
| 1628 | kfree(mlx5_ib_vma_priv_data); | 1631 | kfree(mlx5_ib_vma_priv_data); |
| 1629 | } | 1632 | } |
| 1630 | 1633 | ||
| @@ -1644,10 +1647,13 @@ static int mlx5_ib_set_vma_data(struct vm_area_struct *vma, | |||
| 1644 | return -ENOMEM; | 1647 | return -ENOMEM; |
| 1645 | 1648 | ||
| 1646 | vma_prv->vma = vma; | 1649 | vma_prv->vma = vma; |
| 1650 | vma_prv->vma_private_list_mutex = &ctx->vma_private_list_mutex; | ||
| 1647 | vma->vm_private_data = vma_prv; | 1651 | vma->vm_private_data = vma_prv; |
| 1648 | vma->vm_ops = &mlx5_ib_vm_ops; | 1652 | vma->vm_ops = &mlx5_ib_vm_ops; |
| 1649 | 1653 | ||
| 1654 | mutex_lock(&ctx->vma_private_list_mutex); | ||
| 1650 | list_add(&vma_prv->list, vma_head); | 1655 | list_add(&vma_prv->list, vma_head); |
| 1656 | mutex_unlock(&ctx->vma_private_list_mutex); | ||
| 1651 | 1657 | ||
| 1652 | return 0; | 1658 | return 0; |
| 1653 | } | 1659 | } |
| @@ -1690,6 +1696,7 @@ static void mlx5_ib_disassociate_ucontext(struct ib_ucontext *ibcontext) | |||
| 1690 | * mlx5_ib_vma_close. | 1696 | * mlx5_ib_vma_close. |
| 1691 | */ | 1697 | */ |
| 1692 | down_write(&owning_mm->mmap_sem); | 1698 | down_write(&owning_mm->mmap_sem); |
| 1699 | mutex_lock(&context->vma_private_list_mutex); | ||
| 1693 | list_for_each_entry_safe(vma_private, n, &context->vma_private_list, | 1700 | list_for_each_entry_safe(vma_private, n, &context->vma_private_list, |
| 1694 | list) { | 1701 | list) { |
| 1695 | vma = vma_private->vma; | 1702 | vma = vma_private->vma; |
| @@ -1704,6 +1711,7 @@ static void mlx5_ib_disassociate_ucontext(struct ib_ucontext *ibcontext) | |||
| 1704 | list_del(&vma_private->list); | 1711 | list_del(&vma_private->list); |
| 1705 | kfree(vma_private); | 1712 | kfree(vma_private); |
| 1706 | } | 1713 | } |
| 1714 | mutex_unlock(&context->vma_private_list_mutex); | ||
| 1707 | up_write(&owning_mm->mmap_sem); | 1715 | up_write(&owning_mm->mmap_sem); |
| 1708 | mmput(owning_mm); | 1716 | mmput(owning_mm); |
| 1709 | put_task_struct(owning_process); | 1717 | put_task_struct(owning_process); |
| @@ -3737,34 +3745,6 @@ free: | |||
| 3737 | return ret; | 3745 | return ret; |
| 3738 | } | 3746 | } |
| 3739 | 3747 | ||
| 3740 | static int mlx5_ib_query_cong_counters(struct mlx5_ib_dev *dev, | ||
| 3741 | struct mlx5_ib_port *port, | ||
| 3742 | struct rdma_hw_stats *stats) | ||
| 3743 | { | ||
| 3744 | int outlen = MLX5_ST_SZ_BYTES(query_cong_statistics_out); | ||
| 3745 | void *out; | ||
| 3746 | int ret, i; | ||
| 3747 | int offset = port->cnts.num_q_counters; | ||
| 3748 | |||
| 3749 | out = kvzalloc(outlen, GFP_KERNEL); | ||
| 3750 | if (!out) | ||
| 3751 | return -ENOMEM; | ||
| 3752 | |||
| 3753 | ret = mlx5_cmd_query_cong_counter(dev->mdev, false, out, outlen); | ||
| 3754 | if (ret) | ||
| 3755 | goto free; | ||
| 3756 | |||
| 3757 | for (i = 0; i < port->cnts.num_cong_counters; i++) { | ||
| 3758 | stats->value[i + offset] = | ||
| 3759 | be64_to_cpup((__be64 *)(out + | ||
| 3760 | port->cnts.offsets[i + offset])); | ||
| 3761 | } | ||
| 3762 | |||
| 3763 | free: | ||
| 3764 | kvfree(out); | ||
| 3765 | return ret; | ||
| 3766 | } | ||
| 3767 | |||
| 3768 | static int mlx5_ib_get_hw_stats(struct ib_device *ibdev, | 3748 | static int mlx5_ib_get_hw_stats(struct ib_device *ibdev, |
| 3769 | struct rdma_hw_stats *stats, | 3749 | struct rdma_hw_stats *stats, |
| 3770 | u8 port_num, int index) | 3750 | u8 port_num, int index) |
| @@ -3782,7 +3762,12 @@ static int mlx5_ib_get_hw_stats(struct ib_device *ibdev, | |||
| 3782 | num_counters = port->cnts.num_q_counters; | 3762 | num_counters = port->cnts.num_q_counters; |
| 3783 | 3763 | ||
| 3784 | if (MLX5_CAP_GEN(dev->mdev, cc_query_allowed)) { | 3764 | if (MLX5_CAP_GEN(dev->mdev, cc_query_allowed)) { |
| 3785 | ret = mlx5_ib_query_cong_counters(dev, port, stats); | 3765 | ret = mlx5_lag_query_cong_counters(dev->mdev, |
| 3766 | stats->value + | ||
| 3767 | port->cnts.num_q_counters, | ||
| 3768 | port->cnts.num_cong_counters, | ||
| 3769 | port->cnts.offsets + | ||
| 3770 | port->cnts.num_q_counters); | ||
| 3786 | if (ret) | 3771 | if (ret) |
| 3787 | return ret; | 3772 | return ret; |
| 3788 | num_counters += port->cnts.num_cong_counters; | 3773 | num_counters += port->cnts.num_cong_counters; |
diff --git a/drivers/infiniband/hw/mlx5/mlx5_ib.h b/drivers/infiniband/hw/mlx5/mlx5_ib.h index 6dd8cac78de2..2c5f3533bbc9 100644 --- a/drivers/infiniband/hw/mlx5/mlx5_ib.h +++ b/drivers/infiniband/hw/mlx5/mlx5_ib.h | |||
| @@ -115,6 +115,8 @@ enum { | |||
| 115 | struct mlx5_ib_vma_private_data { | 115 | struct mlx5_ib_vma_private_data { |
| 116 | struct list_head list; | 116 | struct list_head list; |
| 117 | struct vm_area_struct *vma; | 117 | struct vm_area_struct *vma; |
| 118 | /* protect vma_private_list add/del */ | ||
| 119 | struct mutex *vma_private_list_mutex; | ||
| 118 | }; | 120 | }; |
| 119 | 121 | ||
| 120 | struct mlx5_ib_ucontext { | 122 | struct mlx5_ib_ucontext { |
| @@ -129,6 +131,8 @@ struct mlx5_ib_ucontext { | |||
| 129 | /* Transport Domain number */ | 131 | /* Transport Domain number */ |
| 130 | u32 tdn; | 132 | u32 tdn; |
| 131 | struct list_head vma_private_list; | 133 | struct list_head vma_private_list; |
| 134 | /* protect vma_private_list add/del */ | ||
| 135 | struct mutex vma_private_list_mutex; | ||
| 132 | 136 | ||
| 133 | unsigned long upd_xlt_page; | 137 | unsigned long upd_xlt_page; |
| 134 | /* protect ODP/KSM */ | 138 | /* protect ODP/KSM */ |
diff --git a/drivers/infiniband/hw/mlx5/mr.c b/drivers/infiniband/hw/mlx5/mr.c index ee0ee1f9994b..d109fe8290a7 100644 --- a/drivers/infiniband/hw/mlx5/mr.c +++ b/drivers/infiniband/hw/mlx5/mr.c | |||
| @@ -1637,6 +1637,7 @@ struct ib_mr *mlx5_ib_alloc_mr(struct ib_pd *pd, | |||
| 1637 | MLX5_SET(mkc, mkc, access_mode, mr->access_mode); | 1637 | MLX5_SET(mkc, mkc, access_mode, mr->access_mode); |
| 1638 | MLX5_SET(mkc, mkc, umr_en, 1); | 1638 | MLX5_SET(mkc, mkc, umr_en, 1); |
| 1639 | 1639 | ||
| 1640 | mr->ibmr.device = pd->device; | ||
| 1640 | err = mlx5_core_create_mkey(dev->mdev, &mr->mmkey, in, inlen); | 1641 | err = mlx5_core_create_mkey(dev->mdev, &mr->mmkey, in, inlen); |
| 1641 | if (err) | 1642 | if (err) |
| 1642 | goto err_destroy_psv; | 1643 | goto err_destroy_psv; |
diff --git a/drivers/infiniband/hw/vmw_pvrdma/pvrdma.h b/drivers/infiniband/hw/vmw_pvrdma/pvrdma.h index 63bc2efc34eb..4f7bd3b6a315 100644 --- a/drivers/infiniband/hw/vmw_pvrdma/pvrdma.h +++ b/drivers/infiniband/hw/vmw_pvrdma/pvrdma.h | |||
| @@ -94,7 +94,7 @@ struct pvrdma_cq { | |||
| 94 | u32 cq_handle; | 94 | u32 cq_handle; |
| 95 | bool is_kernel; | 95 | bool is_kernel; |
| 96 | atomic_t refcnt; | 96 | atomic_t refcnt; |
| 97 | wait_queue_head_t wait; | 97 | struct completion free; |
| 98 | }; | 98 | }; |
| 99 | 99 | ||
| 100 | struct pvrdma_id_table { | 100 | struct pvrdma_id_table { |
| @@ -175,7 +175,7 @@ struct pvrdma_srq { | |||
| 175 | u32 srq_handle; | 175 | u32 srq_handle; |
| 176 | int npages; | 176 | int npages; |
| 177 | refcount_t refcnt; | 177 | refcount_t refcnt; |
| 178 | wait_queue_head_t wait; | 178 | struct completion free; |
| 179 | }; | 179 | }; |
| 180 | 180 | ||
| 181 | struct pvrdma_qp { | 181 | struct pvrdma_qp { |
| @@ -197,7 +197,7 @@ struct pvrdma_qp { | |||
| 197 | bool is_kernel; | 197 | bool is_kernel; |
| 198 | struct mutex mutex; /* QP state mutex. */ | 198 | struct mutex mutex; /* QP state mutex. */ |
| 199 | atomic_t refcnt; | 199 | atomic_t refcnt; |
| 200 | wait_queue_head_t wait; | 200 | struct completion free; |
| 201 | }; | 201 | }; |
| 202 | 202 | ||
| 203 | struct pvrdma_dev { | 203 | struct pvrdma_dev { |
diff --git a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_cq.c b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_cq.c index 3562c0c30492..e529622cefad 100644 --- a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_cq.c +++ b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_cq.c | |||
| @@ -179,7 +179,7 @@ struct ib_cq *pvrdma_create_cq(struct ib_device *ibdev, | |||
| 179 | pvrdma_page_dir_insert_umem(&cq->pdir, cq->umem, 0); | 179 | pvrdma_page_dir_insert_umem(&cq->pdir, cq->umem, 0); |
| 180 | 180 | ||
| 181 | atomic_set(&cq->refcnt, 1); | 181 | atomic_set(&cq->refcnt, 1); |
| 182 | init_waitqueue_head(&cq->wait); | 182 | init_completion(&cq->free); |
| 183 | spin_lock_init(&cq->cq_lock); | 183 | spin_lock_init(&cq->cq_lock); |
| 184 | 184 | ||
| 185 | memset(cmd, 0, sizeof(*cmd)); | 185 | memset(cmd, 0, sizeof(*cmd)); |
| @@ -230,8 +230,9 @@ err_cq: | |||
| 230 | 230 | ||
| 231 | static void pvrdma_free_cq(struct pvrdma_dev *dev, struct pvrdma_cq *cq) | 231 | static void pvrdma_free_cq(struct pvrdma_dev *dev, struct pvrdma_cq *cq) |
| 232 | { | 232 | { |
| 233 | atomic_dec(&cq->refcnt); | 233 | if (atomic_dec_and_test(&cq->refcnt)) |
| 234 | wait_event(cq->wait, !atomic_read(&cq->refcnt)); | 234 | complete(&cq->free); |
| 235 | wait_for_completion(&cq->free); | ||
| 235 | 236 | ||
| 236 | if (!cq->is_kernel) | 237 | if (!cq->is_kernel) |
| 237 | ib_umem_release(cq->umem); | 238 | ib_umem_release(cq->umem); |
diff --git a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_main.c b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_main.c index 1f4e18717a00..e92681878c93 100644 --- a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_main.c +++ b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_main.c | |||
| @@ -346,9 +346,8 @@ static void pvrdma_qp_event(struct pvrdma_dev *dev, u32 qpn, int type) | |||
| 346 | ibqp->event_handler(&e, ibqp->qp_context); | 346 | ibqp->event_handler(&e, ibqp->qp_context); |
| 347 | } | 347 | } |
| 348 | if (qp) { | 348 | if (qp) { |
| 349 | atomic_dec(&qp->refcnt); | 349 | if (atomic_dec_and_test(&qp->refcnt)) |
| 350 | if (atomic_read(&qp->refcnt) == 0) | 350 | complete(&qp->free); |
| 351 | wake_up(&qp->wait); | ||
| 352 | } | 351 | } |
| 353 | } | 352 | } |
| 354 | 353 | ||
| @@ -373,9 +372,8 @@ static void pvrdma_cq_event(struct pvrdma_dev *dev, u32 cqn, int type) | |||
| 373 | ibcq->event_handler(&e, ibcq->cq_context); | 372 | ibcq->event_handler(&e, ibcq->cq_context); |
| 374 | } | 373 | } |
| 375 | if (cq) { | 374 | if (cq) { |
| 376 | atomic_dec(&cq->refcnt); | 375 | if (atomic_dec_and_test(&cq->refcnt)) |
| 377 | if (atomic_read(&cq->refcnt) == 0) | 376 | complete(&cq->free); |
| 378 | wake_up(&cq->wait); | ||
| 379 | } | 377 | } |
| 380 | } | 378 | } |
| 381 | 379 | ||
| @@ -404,7 +402,7 @@ static void pvrdma_srq_event(struct pvrdma_dev *dev, u32 srqn, int type) | |||
| 404 | } | 402 | } |
| 405 | if (srq) { | 403 | if (srq) { |
| 406 | if (refcount_dec_and_test(&srq->refcnt)) | 404 | if (refcount_dec_and_test(&srq->refcnt)) |
| 407 | wake_up(&srq->wait); | 405 | complete(&srq->free); |
| 408 | } | 406 | } |
| 409 | } | 407 | } |
| 410 | 408 | ||
| @@ -539,9 +537,8 @@ static irqreturn_t pvrdma_intrx_handler(int irq, void *dev_id) | |||
| 539 | if (cq && cq->ibcq.comp_handler) | 537 | if (cq && cq->ibcq.comp_handler) |
| 540 | cq->ibcq.comp_handler(&cq->ibcq, cq->ibcq.cq_context); | 538 | cq->ibcq.comp_handler(&cq->ibcq, cq->ibcq.cq_context); |
| 541 | if (cq) { | 539 | if (cq) { |
| 542 | atomic_dec(&cq->refcnt); | 540 | if (atomic_dec_and_test(&cq->refcnt)) |
| 543 | if (atomic_read(&cq->refcnt)) | 541 | complete(&cq->free); |
| 544 | wake_up(&cq->wait); | ||
| 545 | } | 542 | } |
| 546 | pvrdma_idx_ring_inc(&ring->cons_head, ring_slots); | 543 | pvrdma_idx_ring_inc(&ring->cons_head, ring_slots); |
| 547 | } | 544 | } |
diff --git a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_qp.c b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_qp.c index 10420a18d02f..4059308e1454 100644 --- a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_qp.c +++ b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_qp.c | |||
| @@ -246,7 +246,7 @@ struct ib_qp *pvrdma_create_qp(struct ib_pd *pd, | |||
| 246 | spin_lock_init(&qp->rq.lock); | 246 | spin_lock_init(&qp->rq.lock); |
| 247 | mutex_init(&qp->mutex); | 247 | mutex_init(&qp->mutex); |
| 248 | atomic_set(&qp->refcnt, 1); | 248 | atomic_set(&qp->refcnt, 1); |
| 249 | init_waitqueue_head(&qp->wait); | 249 | init_completion(&qp->free); |
| 250 | 250 | ||
| 251 | qp->state = IB_QPS_RESET; | 251 | qp->state = IB_QPS_RESET; |
| 252 | 252 | ||
| @@ -428,8 +428,16 @@ static void pvrdma_free_qp(struct pvrdma_qp *qp) | |||
| 428 | 428 | ||
| 429 | pvrdma_unlock_cqs(scq, rcq, &scq_flags, &rcq_flags); | 429 | pvrdma_unlock_cqs(scq, rcq, &scq_flags, &rcq_flags); |
| 430 | 430 | ||
| 431 | atomic_dec(&qp->refcnt); | 431 | if (atomic_dec_and_test(&qp->refcnt)) |
| 432 | wait_event(qp->wait, !atomic_read(&qp->refcnt)); | 432 | complete(&qp->free); |
| 433 | wait_for_completion(&qp->free); | ||
| 434 | |||
| 435 | if (!qp->is_kernel) { | ||
| 436 | if (qp->rumem) | ||
| 437 | ib_umem_release(qp->rumem); | ||
| 438 | if (qp->sumem) | ||
| 439 | ib_umem_release(qp->sumem); | ||
| 440 | } | ||
| 433 | 441 | ||
| 434 | pvrdma_page_dir_cleanup(dev, &qp->pdir); | 442 | pvrdma_page_dir_cleanup(dev, &qp->pdir); |
| 435 | 443 | ||
diff --git a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_srq.c b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_srq.c index 826ccb864596..5acebb1ef631 100644 --- a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_srq.c +++ b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_srq.c | |||
| @@ -149,7 +149,7 @@ struct ib_srq *pvrdma_create_srq(struct ib_pd *pd, | |||
| 149 | 149 | ||
| 150 | spin_lock_init(&srq->lock); | 150 | spin_lock_init(&srq->lock); |
| 151 | refcount_set(&srq->refcnt, 1); | 151 | refcount_set(&srq->refcnt, 1); |
| 152 | init_waitqueue_head(&srq->wait); | 152 | init_completion(&srq->free); |
| 153 | 153 | ||
| 154 | dev_dbg(&dev->pdev->dev, | 154 | dev_dbg(&dev->pdev->dev, |
| 155 | "create shared receive queue from user space\n"); | 155 | "create shared receive queue from user space\n"); |
| @@ -236,8 +236,9 @@ static void pvrdma_free_srq(struct pvrdma_dev *dev, struct pvrdma_srq *srq) | |||
| 236 | dev->srq_tbl[srq->srq_handle] = NULL; | 236 | dev->srq_tbl[srq->srq_handle] = NULL; |
| 237 | spin_unlock_irqrestore(&dev->srq_tbl_lock, flags); | 237 | spin_unlock_irqrestore(&dev->srq_tbl_lock, flags); |
| 238 | 238 | ||
| 239 | refcount_dec(&srq->refcnt); | 239 | if (refcount_dec_and_test(&srq->refcnt)) |
| 240 | wait_event(srq->wait, !refcount_read(&srq->refcnt)); | 240 | complete(&srq->free); |
| 241 | wait_for_completion(&srq->free); | ||
| 241 | 242 | ||
| 242 | /* There is no support for kernel clients, so this is safe. */ | 243 | /* There is no support for kernel clients, so this is safe. */ |
| 243 | ib_umem_release(srq->umem); | 244 | ib_umem_release(srq->umem); |
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_ib.c b/drivers/infiniband/ulp/ipoib/ipoib_ib.c index 3b96cdaf9a83..e6151a29c412 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_ib.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_ib.c | |||
| @@ -1236,13 +1236,10 @@ static void __ipoib_ib_dev_flush(struct ipoib_dev_priv *priv, | |||
| 1236 | ipoib_ib_dev_down(dev); | 1236 | ipoib_ib_dev_down(dev); |
| 1237 | 1237 | ||
| 1238 | if (level == IPOIB_FLUSH_HEAVY) { | 1238 | if (level == IPOIB_FLUSH_HEAVY) { |
| 1239 | rtnl_lock(); | ||
| 1240 | if (test_bit(IPOIB_FLAG_INITIALIZED, &priv->flags)) | 1239 | if (test_bit(IPOIB_FLAG_INITIALIZED, &priv->flags)) |
| 1241 | ipoib_ib_dev_stop(dev); | 1240 | ipoib_ib_dev_stop(dev); |
| 1242 | 1241 | ||
| 1243 | result = ipoib_ib_dev_open(dev); | 1242 | if (ipoib_ib_dev_open(dev)) |
| 1244 | rtnl_unlock(); | ||
| 1245 | if (result) | ||
| 1246 | return; | 1243 | return; |
| 1247 | 1244 | ||
| 1248 | if (netif_queue_stopped(dev)) | 1245 | if (netif_queue_stopped(dev)) |
| @@ -1282,7 +1279,9 @@ void ipoib_ib_dev_flush_heavy(struct work_struct *work) | |||
| 1282 | struct ipoib_dev_priv *priv = | 1279 | struct ipoib_dev_priv *priv = |
| 1283 | container_of(work, struct ipoib_dev_priv, flush_heavy); | 1280 | container_of(work, struct ipoib_dev_priv, flush_heavy); |
| 1284 | 1281 | ||
| 1282 | rtnl_lock(); | ||
| 1285 | __ipoib_ib_dev_flush(priv, IPOIB_FLUSH_HEAVY, 0); | 1283 | __ipoib_ib_dev_flush(priv, IPOIB_FLUSH_HEAVY, 0); |
| 1284 | rtnl_unlock(); | ||
| 1286 | } | 1285 | } |
| 1287 | 1286 | ||
| 1288 | void ipoib_ib_dev_cleanup(struct net_device *dev) | 1287 | void ipoib_ib_dev_cleanup(struct net_device *dev) |
diff --git a/drivers/leds/led-core.c b/drivers/leds/led-core.c index fd83c7f77a95..f3654fd2eaf3 100644 --- a/drivers/leds/led-core.c +++ b/drivers/leds/led-core.c | |||
| @@ -186,7 +186,7 @@ void led_blink_set(struct led_classdev *led_cdev, | |||
| 186 | unsigned long *delay_on, | 186 | unsigned long *delay_on, |
| 187 | unsigned long *delay_off) | 187 | unsigned long *delay_off) |
| 188 | { | 188 | { |
| 189 | del_timer_sync(&led_cdev->blink_timer); | 189 | led_stop_software_blink(led_cdev); |
| 190 | 190 | ||
| 191 | clear_bit(LED_BLINK_ONESHOT, &led_cdev->work_flags); | 191 | clear_bit(LED_BLINK_ONESHOT, &led_cdev->work_flags); |
| 192 | clear_bit(LED_BLINK_ONESHOT_STOP, &led_cdev->work_flags); | 192 | clear_bit(LED_BLINK_ONESHOT_STOP, &led_cdev->work_flags); |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c index 4c739d5355d2..8ae269ec17a1 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c | |||
| @@ -3030,7 +3030,7 @@ int bnx2x_nic_unload(struct bnx2x *bp, int unload_mode, bool keep_link) | |||
| 3030 | 3030 | ||
| 3031 | del_timer_sync(&bp->timer); | 3031 | del_timer_sync(&bp->timer); |
| 3032 | 3032 | ||
| 3033 | if (IS_PF(bp)) { | 3033 | if (IS_PF(bp) && !BP_NOMCP(bp)) { |
| 3034 | /* Set ALWAYS_ALIVE bit in shmem */ | 3034 | /* Set ALWAYS_ALIVE bit in shmem */ |
| 3035 | bp->fw_drv_pulse_wr_seq |= DRV_PULSE_ALWAYS_ALIVE; | 3035 | bp->fw_drv_pulse_wr_seq |= DRV_PULSE_ALWAYS_ALIVE; |
| 3036 | bnx2x_drv_pulse(bp); | 3036 | bnx2x_drv_pulse(bp); |
| @@ -3116,7 +3116,7 @@ int bnx2x_nic_unload(struct bnx2x *bp, int unload_mode, bool keep_link) | |||
| 3116 | bp->cnic_loaded = false; | 3116 | bp->cnic_loaded = false; |
| 3117 | 3117 | ||
| 3118 | /* Clear driver version indication in shmem */ | 3118 | /* Clear driver version indication in shmem */ |
| 3119 | if (IS_PF(bp)) | 3119 | if (IS_PF(bp) && !BP_NOMCP(bp)) |
| 3120 | bnx2x_update_mng_version(bp); | 3120 | bnx2x_update_mng_version(bp); |
| 3121 | 3121 | ||
| 3122 | /* Check if there are pending parity attentions. If there are - set | 3122 | /* Check if there are pending parity attentions. If there are - set |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c index 91e2a7560b48..ddd5d3ebd201 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | |||
| @@ -9578,6 +9578,15 @@ static int bnx2x_init_shmem(struct bnx2x *bp) | |||
| 9578 | 9578 | ||
| 9579 | do { | 9579 | do { |
| 9580 | bp->common.shmem_base = REG_RD(bp, MISC_REG_SHARED_MEM_ADDR); | 9580 | bp->common.shmem_base = REG_RD(bp, MISC_REG_SHARED_MEM_ADDR); |
| 9581 | |||
| 9582 | /* If we read all 0xFFs, means we are in PCI error state and | ||
| 9583 | * should bail out to avoid crashes on adapter's FW reads. | ||
| 9584 | */ | ||
| 9585 | if (bp->common.shmem_base == 0xFFFFFFFF) { | ||
| 9586 | bp->flags |= NO_MCP_FLAG; | ||
| 9587 | return -ENODEV; | ||
| 9588 | } | ||
| 9589 | |||
| 9581 | if (bp->common.shmem_base) { | 9590 | if (bp->common.shmem_base) { |
| 9582 | val = SHMEM_RD(bp, validity_map[BP_PORT(bp)]); | 9591 | val = SHMEM_RD(bp, validity_map[BP_PORT(bp)]); |
| 9583 | if (val & SHR_MEM_VALIDITY_MB) | 9592 | if (val & SHR_MEM_VALIDITY_MB) |
| @@ -14320,7 +14329,10 @@ static pci_ers_result_t bnx2x_io_slot_reset(struct pci_dev *pdev) | |||
| 14320 | BNX2X_ERR("IO slot reset --> driver unload\n"); | 14329 | BNX2X_ERR("IO slot reset --> driver unload\n"); |
| 14321 | 14330 | ||
| 14322 | /* MCP should have been reset; Need to wait for validity */ | 14331 | /* MCP should have been reset; Need to wait for validity */ |
| 14323 | bnx2x_init_shmem(bp); | 14332 | if (bnx2x_init_shmem(bp)) { |
| 14333 | rtnl_unlock(); | ||
| 14334 | return PCI_ERS_RESULT_DISCONNECT; | ||
| 14335 | } | ||
| 14324 | 14336 | ||
| 14325 | if (IS_PF(bp) && SHMEM2_HAS(bp, drv_capabilities_flag)) { | 14337 | if (IS_PF(bp) && SHMEM2_HAS(bp, drv_capabilities_flag)) { |
| 14326 | u32 v; | 14338 | u32 v; |
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c index d09c5a9c53b5..8995cfefbfcf 100644 --- a/drivers/net/ethernet/broadcom/tg3.c +++ b/drivers/net/ethernet/broadcom/tg3.c | |||
| @@ -4,11 +4,13 @@ | |||
| 4 | * Copyright (C) 2001, 2002, 2003, 2004 David S. Miller (davem@redhat.com) | 4 | * Copyright (C) 2001, 2002, 2003, 2004 David S. Miller (davem@redhat.com) |
| 5 | * Copyright (C) 2001, 2002, 2003 Jeff Garzik (jgarzik@pobox.com) | 5 | * Copyright (C) 2001, 2002, 2003 Jeff Garzik (jgarzik@pobox.com) |
| 6 | * Copyright (C) 2004 Sun Microsystems Inc. | 6 | * Copyright (C) 2004 Sun Microsystems Inc. |
| 7 | * Copyright (C) 2005-2014 Broadcom Corporation. | 7 | * Copyright (C) 2005-2016 Broadcom Corporation. |
| 8 | * Copyright (C) 2016-2017 Broadcom Limited. | ||
| 8 | * | 9 | * |
| 9 | * Firmware is: | 10 | * Firmware is: |
| 10 | * Derived from proprietary unpublished source code, | 11 | * Derived from proprietary unpublished source code, |
| 11 | * Copyright (C) 2000-2003 Broadcom Corporation. | 12 | * Copyright (C) 2000-2016 Broadcom Corporation. |
| 13 | * Copyright (C) 2016-2017 Broadcom Ltd. | ||
| 12 | * | 14 | * |
| 13 | * Permission is hereby granted for the distribution of this firmware | 15 | * Permission is hereby granted for the distribution of this firmware |
| 14 | * data in hexadecimal or equivalent format, provided this copyright | 16 | * data in hexadecimal or equivalent format, provided this copyright |
| @@ -10052,6 +10054,16 @@ static int tg3_reset_hw(struct tg3 *tp, bool reset_phy) | |||
| 10052 | 10054 | ||
| 10053 | tw32(GRC_MODE, tp->grc_mode | val); | 10055 | tw32(GRC_MODE, tp->grc_mode | val); |
| 10054 | 10056 | ||
| 10057 | /* On one of the AMD platform, MRRS is restricted to 4000 because of | ||
| 10058 | * south bridge limitation. As a workaround, Driver is setting MRRS | ||
| 10059 | * to 2048 instead of default 4096. | ||
| 10060 | */ | ||
| 10061 | if (tp->pdev->subsystem_vendor == PCI_VENDOR_ID_DELL && | ||
| 10062 | tp->pdev->subsystem_device == TG3PCI_SUBDEVICE_ID_DELL_5762) { | ||
| 10063 | val = tr32(TG3PCI_DEV_STATUS_CTRL) & ~MAX_READ_REQ_MASK; | ||
| 10064 | tw32(TG3PCI_DEV_STATUS_CTRL, val | MAX_READ_REQ_SIZE_2048); | ||
| 10065 | } | ||
| 10066 | |||
| 10055 | /* Setup the timer prescalar register. Clock is always 66Mhz. */ | 10067 | /* Setup the timer prescalar register. Clock is always 66Mhz. */ |
| 10056 | val = tr32(GRC_MISC_CFG); | 10068 | val = tr32(GRC_MISC_CFG); |
| 10057 | val &= ~0xff; | 10069 | val &= ~0xff; |
| @@ -14227,7 +14239,8 @@ static int tg3_change_mtu(struct net_device *dev, int new_mtu) | |||
| 14227 | */ | 14239 | */ |
| 14228 | if (tg3_asic_rev(tp) == ASIC_REV_57766 || | 14240 | if (tg3_asic_rev(tp) == ASIC_REV_57766 || |
| 14229 | tg3_asic_rev(tp) == ASIC_REV_5717 || | 14241 | tg3_asic_rev(tp) == ASIC_REV_5717 || |
| 14230 | tg3_asic_rev(tp) == ASIC_REV_5719) | 14242 | tg3_asic_rev(tp) == ASIC_REV_5719 || |
| 14243 | tg3_asic_rev(tp) == ASIC_REV_5720) | ||
| 14231 | reset_phy = true; | 14244 | reset_phy = true; |
| 14232 | 14245 | ||
| 14233 | err = tg3_restart_hw(tp, reset_phy); | 14246 | err = tg3_restart_hw(tp, reset_phy); |
diff --git a/drivers/net/ethernet/broadcom/tg3.h b/drivers/net/ethernet/broadcom/tg3.h index c2d02d02d1e6..1f0271fa7c74 100644 --- a/drivers/net/ethernet/broadcom/tg3.h +++ b/drivers/net/ethernet/broadcom/tg3.h | |||
| @@ -5,7 +5,8 @@ | |||
| 5 | * Copyright (C) 2001, 2002, 2003, 2004 David S. Miller (davem@redhat.com) | 5 | * Copyright (C) 2001, 2002, 2003, 2004 David S. Miller (davem@redhat.com) |
| 6 | * Copyright (C) 2001 Jeff Garzik (jgarzik@pobox.com) | 6 | * Copyright (C) 2001 Jeff Garzik (jgarzik@pobox.com) |
| 7 | * Copyright (C) 2004 Sun Microsystems Inc. | 7 | * Copyright (C) 2004 Sun Microsystems Inc. |
| 8 | * Copyright (C) 2007-2014 Broadcom Corporation. | 8 | * Copyright (C) 2007-2016 Broadcom Corporation. |
| 9 | * Copyright (C) 2016-2017 Broadcom Limited. | ||
| 9 | */ | 10 | */ |
| 10 | 11 | ||
| 11 | #ifndef _T3_H | 12 | #ifndef _T3_H |
| @@ -96,6 +97,7 @@ | |||
| 96 | #define TG3PCI_SUBDEVICE_ID_DELL_JAGUAR 0x0106 | 97 | #define TG3PCI_SUBDEVICE_ID_DELL_JAGUAR 0x0106 |
| 97 | #define TG3PCI_SUBDEVICE_ID_DELL_MERLOT 0x0109 | 98 | #define TG3PCI_SUBDEVICE_ID_DELL_MERLOT 0x0109 |
| 98 | #define TG3PCI_SUBDEVICE_ID_DELL_SLIM_MERLOT 0x010a | 99 | #define TG3PCI_SUBDEVICE_ID_DELL_SLIM_MERLOT 0x010a |
| 100 | #define TG3PCI_SUBDEVICE_ID_DELL_5762 0x07f0 | ||
| 99 | #define TG3PCI_SUBVENDOR_ID_COMPAQ PCI_VENDOR_ID_COMPAQ | 101 | #define TG3PCI_SUBVENDOR_ID_COMPAQ PCI_VENDOR_ID_COMPAQ |
| 100 | #define TG3PCI_SUBDEVICE_ID_COMPAQ_BANSHEE 0x007c | 102 | #define TG3PCI_SUBDEVICE_ID_COMPAQ_BANSHEE 0x007c |
| 101 | #define TG3PCI_SUBDEVICE_ID_COMPAQ_BANSHEE_2 0x009a | 103 | #define TG3PCI_SUBDEVICE_ID_COMPAQ_BANSHEE_2 0x009a |
| @@ -281,6 +283,9 @@ | |||
| 281 | #define TG3PCI_STD_RING_PROD_IDX 0x00000098 /* 64-bit */ | 283 | #define TG3PCI_STD_RING_PROD_IDX 0x00000098 /* 64-bit */ |
| 282 | #define TG3PCI_RCV_RET_RING_CON_IDX 0x000000a0 /* 64-bit */ | 284 | #define TG3PCI_RCV_RET_RING_CON_IDX 0x000000a0 /* 64-bit */ |
| 283 | /* 0xa8 --> 0xb8 unused */ | 285 | /* 0xa8 --> 0xb8 unused */ |
| 286 | #define TG3PCI_DEV_STATUS_CTRL 0x000000b4 | ||
| 287 | #define MAX_READ_REQ_SIZE_2048 0x00004000 | ||
| 288 | #define MAX_READ_REQ_MASK 0x00007000 | ||
| 284 | #define TG3PCI_DUAL_MAC_CTRL 0x000000b8 | 289 | #define TG3PCI_DUAL_MAC_CTRL 0x000000b8 |
| 285 | #define DUAL_MAC_CTRL_CH_MASK 0x00000003 | 290 | #define DUAL_MAC_CTRL_CH_MASK 0x00000003 |
| 286 | #define DUAL_MAC_CTRL_ID 0x00000004 | 291 | #define DUAL_MAC_CTRL_ID 0x00000004 |
diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c index 610573855213..8184d2fca9be 100644 --- a/drivers/net/ethernet/freescale/fec_main.c +++ b/drivers/net/ethernet/freescale/fec_main.c | |||
| @@ -818,6 +818,12 @@ static void fec_enet_bd_init(struct net_device *dev) | |||
| 818 | for (i = 0; i < txq->bd.ring_size; i++) { | 818 | for (i = 0; i < txq->bd.ring_size; i++) { |
| 819 | /* Initialize the BD for every fragment in the page. */ | 819 | /* Initialize the BD for every fragment in the page. */ |
| 820 | bdp->cbd_sc = cpu_to_fec16(0); | 820 | bdp->cbd_sc = cpu_to_fec16(0); |
| 821 | if (bdp->cbd_bufaddr && | ||
| 822 | !IS_TSO_HEADER(txq, fec32_to_cpu(bdp->cbd_bufaddr))) | ||
| 823 | dma_unmap_single(&fep->pdev->dev, | ||
| 824 | fec32_to_cpu(bdp->cbd_bufaddr), | ||
| 825 | fec16_to_cpu(bdp->cbd_datlen), | ||
| 826 | DMA_TO_DEVICE); | ||
| 821 | if (txq->tx_skbuff[i]) { | 827 | if (txq->tx_skbuff[i]) { |
| 822 | dev_kfree_skb_any(txq->tx_skbuff[i]); | 828 | dev_kfree_skb_any(txq->tx_skbuff[i]); |
| 823 | txq->tx_skbuff[i] = NULL; | 829 | txq->tx_skbuff[i] = NULL; |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/lag.c b/drivers/net/ethernet/mellanox/mlx5/core/lag.c index f26f97fe4666..582b2f18010a 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/lag.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/lag.c | |||
| @@ -137,6 +137,17 @@ int mlx5_cmd_destroy_vport_lag(struct mlx5_core_dev *dev) | |||
| 137 | } | 137 | } |
| 138 | EXPORT_SYMBOL(mlx5_cmd_destroy_vport_lag); | 138 | EXPORT_SYMBOL(mlx5_cmd_destroy_vport_lag); |
| 139 | 139 | ||
| 140 | static int mlx5_cmd_query_cong_counter(struct mlx5_core_dev *dev, | ||
| 141 | bool reset, void *out, int out_size) | ||
| 142 | { | ||
| 143 | u32 in[MLX5_ST_SZ_DW(query_cong_statistics_in)] = { }; | ||
| 144 | |||
| 145 | MLX5_SET(query_cong_statistics_in, in, opcode, | ||
| 146 | MLX5_CMD_OP_QUERY_CONG_STATISTICS); | ||
| 147 | MLX5_SET(query_cong_statistics_in, in, clear, reset); | ||
| 148 | return mlx5_cmd_exec(dev, in, sizeof(in), out, out_size); | ||
| 149 | } | ||
| 150 | |||
| 140 | static struct mlx5_lag *mlx5_lag_dev_get(struct mlx5_core_dev *dev) | 151 | static struct mlx5_lag *mlx5_lag_dev_get(struct mlx5_core_dev *dev) |
| 141 | { | 152 | { |
| 142 | return dev->priv.lag; | 153 | return dev->priv.lag; |
| @@ -633,3 +644,48 @@ bool mlx5_lag_intf_add(struct mlx5_interface *intf, struct mlx5_priv *priv) | |||
| 633 | /* If bonded, we do not add an IB device for PF1. */ | 644 | /* If bonded, we do not add an IB device for PF1. */ |
| 634 | return false; | 645 | return false; |
| 635 | } | 646 | } |
| 647 | |||
| 648 | int mlx5_lag_query_cong_counters(struct mlx5_core_dev *dev, | ||
| 649 | u64 *values, | ||
| 650 | int num_counters, | ||
| 651 | size_t *offsets) | ||
| 652 | { | ||
| 653 | int outlen = MLX5_ST_SZ_BYTES(query_cong_statistics_out); | ||
| 654 | struct mlx5_core_dev *mdev[MLX5_MAX_PORTS]; | ||
| 655 | struct mlx5_lag *ldev; | ||
| 656 | int num_ports; | ||
| 657 | int ret, i, j; | ||
| 658 | void *out; | ||
| 659 | |||
| 660 | out = kvzalloc(outlen, GFP_KERNEL); | ||
| 661 | if (!out) | ||
| 662 | return -ENOMEM; | ||
| 663 | |||
| 664 | memset(values, 0, sizeof(*values) * num_counters); | ||
| 665 | |||
| 666 | mutex_lock(&lag_mutex); | ||
| 667 | ldev = mlx5_lag_dev_get(dev); | ||
| 668 | if (ldev && mlx5_lag_is_bonded(ldev)) { | ||
| 669 | num_ports = MLX5_MAX_PORTS; | ||
| 670 | mdev[0] = ldev->pf[0].dev; | ||
| 671 | mdev[1] = ldev->pf[1].dev; | ||
| 672 | } else { | ||
| 673 | num_ports = 1; | ||
| 674 | mdev[0] = dev; | ||
| 675 | } | ||
| 676 | |||
| 677 | for (i = 0; i < num_ports; ++i) { | ||
| 678 | ret = mlx5_cmd_query_cong_counter(mdev[i], false, out, outlen); | ||
| 679 | if (ret) | ||
| 680 | goto unlock; | ||
| 681 | |||
| 682 | for (j = 0; j < num_counters; ++j) | ||
| 683 | values[j] += be64_to_cpup((__be64 *)(out + offsets[j])); | ||
| 684 | } | ||
| 685 | |||
| 686 | unlock: | ||
| 687 | mutex_unlock(&lag_mutex); | ||
| 688 | kvfree(out); | ||
| 689 | return ret; | ||
| 690 | } | ||
| 691 | EXPORT_SYMBOL(mlx5_lag_query_cong_counters); | ||
diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c index ab4614113403..422ff6333c52 100644 --- a/drivers/net/phy/micrel.c +++ b/drivers/net/phy/micrel.c | |||
| @@ -624,6 +624,7 @@ static int ksz9031_read_status(struct phy_device *phydev) | |||
| 624 | phydev->link = 0; | 624 | phydev->link = 0; |
| 625 | if (phydev->drv->config_intr && phy_interrupt_is_valid(phydev)) | 625 | if (phydev->drv->config_intr && phy_interrupt_is_valid(phydev)) |
| 626 | phydev->drv->config_intr(phydev); | 626 | phydev->drv->config_intr(phydev); |
| 627 | return genphy_config_aneg(phydev); | ||
| 627 | } | 628 | } |
| 628 | 629 | ||
| 629 | return 0; | 630 | return 0; |
diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c index 5dc9668dde34..827f3f92560e 100644 --- a/drivers/net/phy/phylink.c +++ b/drivers/net/phy/phylink.c | |||
| @@ -526,6 +526,7 @@ struct phylink *phylink_create(struct net_device *ndev, struct device_node *np, | |||
| 526 | pl->link_config.pause = MLO_PAUSE_AN; | 526 | pl->link_config.pause = MLO_PAUSE_AN; |
| 527 | pl->link_config.speed = SPEED_UNKNOWN; | 527 | pl->link_config.speed = SPEED_UNKNOWN; |
| 528 | pl->link_config.duplex = DUPLEX_UNKNOWN; | 528 | pl->link_config.duplex = DUPLEX_UNKNOWN; |
| 529 | pl->link_config.an_enabled = true; | ||
| 529 | pl->ops = ops; | 530 | pl->ops = ops; |
| 530 | __set_bit(PHYLINK_DISABLE_STOPPED, &pl->phylink_disable_state); | 531 | __set_bit(PHYLINK_DISABLE_STOPPED, &pl->phylink_disable_state); |
| 531 | 532 | ||
| @@ -951,6 +952,7 @@ int phylink_ethtool_ksettings_set(struct phylink *pl, | |||
| 951 | mutex_lock(&pl->state_mutex); | 952 | mutex_lock(&pl->state_mutex); |
| 952 | /* Configure the MAC to match the new settings */ | 953 | /* Configure the MAC to match the new settings */ |
| 953 | linkmode_copy(pl->link_config.advertising, our_kset.link_modes.advertising); | 954 | linkmode_copy(pl->link_config.advertising, our_kset.link_modes.advertising); |
| 955 | pl->link_config.interface = config.interface; | ||
| 954 | pl->link_config.speed = our_kset.base.speed; | 956 | pl->link_config.speed = our_kset.base.speed; |
| 955 | pl->link_config.duplex = our_kset.base.duplex; | 957 | pl->link_config.duplex = our_kset.base.duplex; |
| 956 | pl->link_config.an_enabled = our_kset.base.autoneg != AUTONEG_DISABLE; | 958 | pl->link_config.an_enabled = our_kset.base.autoneg != AUTONEG_DISABLE; |
diff --git a/include/linux/mlx5/driver.h b/include/linux/mlx5/driver.h index 57b109c6e422..1f509d072026 100644 --- a/include/linux/mlx5/driver.h +++ b/include/linux/mlx5/driver.h | |||
| @@ -1165,6 +1165,10 @@ int mlx5_cmd_create_vport_lag(struct mlx5_core_dev *dev); | |||
| 1165 | int mlx5_cmd_destroy_vport_lag(struct mlx5_core_dev *dev); | 1165 | int mlx5_cmd_destroy_vport_lag(struct mlx5_core_dev *dev); |
| 1166 | bool mlx5_lag_is_active(struct mlx5_core_dev *dev); | 1166 | bool mlx5_lag_is_active(struct mlx5_core_dev *dev); |
| 1167 | struct net_device *mlx5_lag_get_roce_netdev(struct mlx5_core_dev *dev); | 1167 | struct net_device *mlx5_lag_get_roce_netdev(struct mlx5_core_dev *dev); |
| 1168 | int mlx5_lag_query_cong_counters(struct mlx5_core_dev *dev, | ||
| 1169 | u64 *values, | ||
| 1170 | int num_counters, | ||
| 1171 | size_t *offsets); | ||
| 1168 | struct mlx5_uars_page *mlx5_get_uars_page(struct mlx5_core_dev *mdev); | 1172 | struct mlx5_uars_page *mlx5_get_uars_page(struct mlx5_core_dev *mdev); |
| 1169 | void mlx5_put_uars_page(struct mlx5_core_dev *mdev, struct mlx5_uars_page *up); | 1173 | void mlx5_put_uars_page(struct mlx5_core_dev *mdev, struct mlx5_uars_page *up); |
| 1170 | 1174 | ||
diff --git a/include/net/sock.h b/include/net/sock.h index 9155da422692..7a7b14e9628a 100644 --- a/include/net/sock.h +++ b/include/net/sock.h | |||
| @@ -1514,6 +1514,11 @@ static inline bool sock_owned_by_user(const struct sock *sk) | |||
| 1514 | return sk->sk_lock.owned; | 1514 | return sk->sk_lock.owned; |
| 1515 | } | 1515 | } |
| 1516 | 1516 | ||
| 1517 | static inline bool sock_owned_by_user_nocheck(const struct sock *sk) | ||
| 1518 | { | ||
| 1519 | return sk->sk_lock.owned; | ||
| 1520 | } | ||
| 1521 | |||
| 1517 | /* no reclassification while locks are held */ | 1522 | /* no reclassification while locks are held */ |
| 1518 | static inline bool sock_allow_reclassification(const struct sock *csk) | 1523 | static inline bool sock_allow_reclassification(const struct sock *csk) |
| 1519 | { | 1524 | { |
diff --git a/include/net/xfrm.h b/include/net/xfrm.h index dc28a98ce97c..ae35991b5877 100644 --- a/include/net/xfrm.h +++ b/include/net/xfrm.h | |||
| @@ -1570,6 +1570,9 @@ int xfrm_init_state(struct xfrm_state *x); | |||
| 1570 | int xfrm_prepare_input(struct xfrm_state *x, struct sk_buff *skb); | 1570 | int xfrm_prepare_input(struct xfrm_state *x, struct sk_buff *skb); |
| 1571 | int xfrm_input(struct sk_buff *skb, int nexthdr, __be32 spi, int encap_type); | 1571 | int xfrm_input(struct sk_buff *skb, int nexthdr, __be32 spi, int encap_type); |
| 1572 | int xfrm_input_resume(struct sk_buff *skb, int nexthdr); | 1572 | int xfrm_input_resume(struct sk_buff *skb, int nexthdr); |
| 1573 | int xfrm_trans_queue(struct sk_buff *skb, | ||
| 1574 | int (*finish)(struct net *, struct sock *, | ||
| 1575 | struct sk_buff *)); | ||
| 1573 | int xfrm_output_resume(struct sk_buff *skb, int err); | 1576 | int xfrm_output_resume(struct sk_buff *skb, int err); |
| 1574 | int xfrm_output(struct sock *sk, struct sk_buff *skb); | 1577 | int xfrm_output(struct sock *sk, struct sk_buff *skb); |
| 1575 | int xfrm_inner_extract_output(struct xfrm_state *x, struct sk_buff *skb); | 1578 | int xfrm_inner_extract_output(struct xfrm_state *x, struct sk_buff *skb); |
diff --git a/include/trace/events/tcp.h b/include/trace/events/tcp.h index 07cccca6cbf1..ab34c561f26b 100644 --- a/include/trace/events/tcp.h +++ b/include/trace/events/tcp.h | |||
| @@ -25,6 +25,35 @@ | |||
| 25 | tcp_state_name(TCP_CLOSING), \ | 25 | tcp_state_name(TCP_CLOSING), \ |
| 26 | tcp_state_name(TCP_NEW_SYN_RECV)) | 26 | tcp_state_name(TCP_NEW_SYN_RECV)) |
| 27 | 27 | ||
| 28 | #define TP_STORE_V4MAPPED(__entry, saddr, daddr) \ | ||
| 29 | do { \ | ||
| 30 | struct in6_addr *pin6; \ | ||
| 31 | \ | ||
| 32 | pin6 = (struct in6_addr *)__entry->saddr_v6; \ | ||
| 33 | ipv6_addr_set_v4mapped(saddr, pin6); \ | ||
| 34 | pin6 = (struct in6_addr *)__entry->daddr_v6; \ | ||
| 35 | ipv6_addr_set_v4mapped(daddr, pin6); \ | ||
| 36 | } while (0) | ||
| 37 | |||
| 38 | #if IS_ENABLED(CONFIG_IPV6) | ||
| 39 | #define TP_STORE_ADDRS(__entry, saddr, daddr, saddr6, daddr6) \ | ||
| 40 | do { \ | ||
| 41 | if (sk->sk_family == AF_INET6) { \ | ||
| 42 | struct in6_addr *pin6; \ | ||
| 43 | \ | ||
| 44 | pin6 = (struct in6_addr *)__entry->saddr_v6; \ | ||
| 45 | *pin6 = saddr6; \ | ||
| 46 | pin6 = (struct in6_addr *)__entry->daddr_v6; \ | ||
| 47 | *pin6 = daddr6; \ | ||
| 48 | } else { \ | ||
| 49 | TP_STORE_V4MAPPED(__entry, saddr, daddr); \ | ||
| 50 | } \ | ||
| 51 | } while (0) | ||
| 52 | #else | ||
| 53 | #define TP_STORE_ADDRS(__entry, saddr, daddr, saddr6, daddr6) \ | ||
| 54 | TP_STORE_V4MAPPED(__entry, saddr, daddr) | ||
| 55 | #endif | ||
| 56 | |||
| 28 | /* | 57 | /* |
| 29 | * tcp event with arguments sk and skb | 58 | * tcp event with arguments sk and skb |
| 30 | * | 59 | * |
| @@ -50,7 +79,6 @@ DECLARE_EVENT_CLASS(tcp_event_sk_skb, | |||
| 50 | 79 | ||
| 51 | TP_fast_assign( | 80 | TP_fast_assign( |
| 52 | struct inet_sock *inet = inet_sk(sk); | 81 | struct inet_sock *inet = inet_sk(sk); |
| 53 | struct in6_addr *pin6; | ||
| 54 | __be32 *p32; | 82 | __be32 *p32; |
| 55 | 83 | ||
| 56 | __entry->skbaddr = skb; | 84 | __entry->skbaddr = skb; |
| @@ -65,20 +93,8 @@ DECLARE_EVENT_CLASS(tcp_event_sk_skb, | |||
| 65 | p32 = (__be32 *) __entry->daddr; | 93 | p32 = (__be32 *) __entry->daddr; |
| 66 | *p32 = inet->inet_daddr; | 94 | *p32 = inet->inet_daddr; |
| 67 | 95 | ||
| 68 | #if IS_ENABLED(CONFIG_IPV6) | 96 | TP_STORE_ADDRS(__entry, inet->inet_saddr, inet->inet_daddr, |
| 69 | if (sk->sk_family == AF_INET6) { | 97 | sk->sk_v6_rcv_saddr, sk->sk_v6_daddr); |
| 70 | pin6 = (struct in6_addr *)__entry->saddr_v6; | ||
| 71 | *pin6 = sk->sk_v6_rcv_saddr; | ||
| 72 | pin6 = (struct in6_addr *)__entry->daddr_v6; | ||
| 73 | *pin6 = sk->sk_v6_daddr; | ||
| 74 | } else | ||
| 75 | #endif | ||
| 76 | { | ||
| 77 | pin6 = (struct in6_addr *)__entry->saddr_v6; | ||
| 78 | ipv6_addr_set_v4mapped(inet->inet_saddr, pin6); | ||
| 79 | pin6 = (struct in6_addr *)__entry->daddr_v6; | ||
| 80 | ipv6_addr_set_v4mapped(inet->inet_daddr, pin6); | ||
| 81 | } | ||
| 82 | ), | 98 | ), |
| 83 | 99 | ||
| 84 | TP_printk("sport=%hu dport=%hu saddr=%pI4 daddr=%pI4 saddrv6=%pI6c daddrv6=%pI6c", | 100 | TP_printk("sport=%hu dport=%hu saddr=%pI4 daddr=%pI4 saddrv6=%pI6c daddrv6=%pI6c", |
| @@ -127,7 +143,6 @@ DECLARE_EVENT_CLASS(tcp_event_sk, | |||
| 127 | 143 | ||
| 128 | TP_fast_assign( | 144 | TP_fast_assign( |
| 129 | struct inet_sock *inet = inet_sk(sk); | 145 | struct inet_sock *inet = inet_sk(sk); |
| 130 | struct in6_addr *pin6; | ||
| 131 | __be32 *p32; | 146 | __be32 *p32; |
| 132 | 147 | ||
| 133 | __entry->skaddr = sk; | 148 | __entry->skaddr = sk; |
| @@ -141,20 +156,8 @@ DECLARE_EVENT_CLASS(tcp_event_sk, | |||
| 141 | p32 = (__be32 *) __entry->daddr; | 156 | p32 = (__be32 *) __entry->daddr; |
| 142 | *p32 = inet->inet_daddr; | 157 | *p32 = inet->inet_daddr; |
| 143 | 158 | ||
| 144 | #if IS_ENABLED(CONFIG_IPV6) | 159 | TP_STORE_ADDRS(__entry, inet->inet_saddr, inet->inet_daddr, |
| 145 | if (sk->sk_family == AF_INET6) { | 160 | sk->sk_v6_rcv_saddr, sk->sk_v6_daddr); |
| 146 | pin6 = (struct in6_addr *)__entry->saddr_v6; | ||
| 147 | *pin6 = sk->sk_v6_rcv_saddr; | ||
| 148 | pin6 = (struct in6_addr *)__entry->daddr_v6; | ||
| 149 | *pin6 = sk->sk_v6_daddr; | ||
| 150 | } else | ||
| 151 | #endif | ||
| 152 | { | ||
| 153 | pin6 = (struct in6_addr *)__entry->saddr_v6; | ||
| 154 | ipv6_addr_set_v4mapped(inet->inet_saddr, pin6); | ||
| 155 | pin6 = (struct in6_addr *)__entry->daddr_v6; | ||
| 156 | ipv6_addr_set_v4mapped(inet->inet_daddr, pin6); | ||
| 157 | } | ||
| 158 | ), | 161 | ), |
| 159 | 162 | ||
| 160 | TP_printk("sport=%hu dport=%hu saddr=%pI4 daddr=%pI4 saddrv6=%pI6c daddrv6=%pI6c", | 163 | TP_printk("sport=%hu dport=%hu saddr=%pI4 daddr=%pI4 saddrv6=%pI6c daddrv6=%pI6c", |
| @@ -197,7 +200,6 @@ TRACE_EVENT(tcp_set_state, | |||
| 197 | 200 | ||
| 198 | TP_fast_assign( | 201 | TP_fast_assign( |
| 199 | struct inet_sock *inet = inet_sk(sk); | 202 | struct inet_sock *inet = inet_sk(sk); |
| 200 | struct in6_addr *pin6; | ||
| 201 | __be32 *p32; | 203 | __be32 *p32; |
| 202 | 204 | ||
| 203 | __entry->skaddr = sk; | 205 | __entry->skaddr = sk; |
| @@ -213,20 +215,8 @@ TRACE_EVENT(tcp_set_state, | |||
| 213 | p32 = (__be32 *) __entry->daddr; | 215 | p32 = (__be32 *) __entry->daddr; |
| 214 | *p32 = inet->inet_daddr; | 216 | *p32 = inet->inet_daddr; |
| 215 | 217 | ||
| 216 | #if IS_ENABLED(CONFIG_IPV6) | 218 | TP_STORE_ADDRS(__entry, inet->inet_saddr, inet->inet_daddr, |
| 217 | if (sk->sk_family == AF_INET6) { | 219 | sk->sk_v6_rcv_saddr, sk->sk_v6_daddr); |
| 218 | pin6 = (struct in6_addr *)__entry->saddr_v6; | ||
| 219 | *pin6 = sk->sk_v6_rcv_saddr; | ||
| 220 | pin6 = (struct in6_addr *)__entry->daddr_v6; | ||
| 221 | *pin6 = sk->sk_v6_daddr; | ||
| 222 | } else | ||
| 223 | #endif | ||
| 224 | { | ||
| 225 | pin6 = (struct in6_addr *)__entry->saddr_v6; | ||
| 226 | ipv6_addr_set_v4mapped(inet->inet_saddr, pin6); | ||
| 227 | pin6 = (struct in6_addr *)__entry->daddr_v6; | ||
| 228 | ipv6_addr_set_v4mapped(inet->inet_daddr, pin6); | ||
| 229 | } | ||
| 230 | ), | 220 | ), |
| 231 | 221 | ||
| 232 | TP_printk("sport=%hu dport=%hu saddr=%pI4 daddr=%pI4 saddrv6=%pI6c daddrv6=%pI6c oldstate=%s newstate=%s", | 222 | TP_printk("sport=%hu dport=%hu saddr=%pI4 daddr=%pI4 saddrv6=%pI6c daddrv6=%pI6c oldstate=%s newstate=%s", |
| @@ -256,7 +246,6 @@ TRACE_EVENT(tcp_retransmit_synack, | |||
| 256 | 246 | ||
| 257 | TP_fast_assign( | 247 | TP_fast_assign( |
| 258 | struct inet_request_sock *ireq = inet_rsk(req); | 248 | struct inet_request_sock *ireq = inet_rsk(req); |
| 259 | struct in6_addr *pin6; | ||
| 260 | __be32 *p32; | 249 | __be32 *p32; |
| 261 | 250 | ||
| 262 | __entry->skaddr = sk; | 251 | __entry->skaddr = sk; |
| @@ -271,20 +260,8 @@ TRACE_EVENT(tcp_retransmit_synack, | |||
| 271 | p32 = (__be32 *) __entry->daddr; | 260 | p32 = (__be32 *) __entry->daddr; |
| 272 | *p32 = ireq->ir_rmt_addr; | 261 | *p32 = ireq->ir_rmt_addr; |
| 273 | 262 | ||
| 274 | #if IS_ENABLED(CONFIG_IPV6) | 263 | TP_STORE_ADDRS(__entry, ireq->ir_loc_addr, ireq->ir_rmt_addr, |
| 275 | if (sk->sk_family == AF_INET6) { | 264 | ireq->ir_v6_loc_addr, ireq->ir_v6_rmt_addr); |
| 276 | pin6 = (struct in6_addr *)__entry->saddr_v6; | ||
| 277 | *pin6 = ireq->ir_v6_loc_addr; | ||
| 278 | pin6 = (struct in6_addr *)__entry->daddr_v6; | ||
| 279 | *pin6 = ireq->ir_v6_rmt_addr; | ||
| 280 | } else | ||
| 281 | #endif | ||
| 282 | { | ||
| 283 | pin6 = (struct in6_addr *)__entry->saddr_v6; | ||
| 284 | ipv6_addr_set_v4mapped(ireq->ir_loc_addr, pin6); | ||
| 285 | pin6 = (struct in6_addr *)__entry->daddr_v6; | ||
| 286 | ipv6_addr_set_v4mapped(ireq->ir_rmt_addr, pin6); | ||
| 287 | } | ||
| 288 | ), | 265 | ), |
| 289 | 266 | ||
| 290 | TP_printk("sport=%hu dport=%hu saddr=%pI4 daddr=%pI4 saddrv6=%pI6c daddrv6=%pI6c", | 267 | TP_printk("sport=%hu dport=%hu saddr=%pI4 daddr=%pI4 saddrv6=%pI6c daddrv6=%pI6c", |
diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c index c87766c1c204..9ab18995ff1e 100644 --- a/kernel/trace/ring_buffer.c +++ b/kernel/trace/ring_buffer.c | |||
| @@ -280,6 +280,8 @@ EXPORT_SYMBOL_GPL(ring_buffer_event_data); | |||
| 280 | /* Missed count stored at end */ | 280 | /* Missed count stored at end */ |
| 281 | #define RB_MISSED_STORED (1 << 30) | 281 | #define RB_MISSED_STORED (1 << 30) |
| 282 | 282 | ||
| 283 | #define RB_MISSED_FLAGS (RB_MISSED_EVENTS|RB_MISSED_STORED) | ||
| 284 | |||
| 283 | struct buffer_data_page { | 285 | struct buffer_data_page { |
| 284 | u64 time_stamp; /* page time stamp */ | 286 | u64 time_stamp; /* page time stamp */ |
| 285 | local_t commit; /* write committed index */ | 287 | local_t commit; /* write committed index */ |
| @@ -331,7 +333,9 @@ static void rb_init_page(struct buffer_data_page *bpage) | |||
| 331 | */ | 333 | */ |
| 332 | size_t ring_buffer_page_len(void *page) | 334 | size_t ring_buffer_page_len(void *page) |
| 333 | { | 335 | { |
| 334 | return local_read(&((struct buffer_data_page *)page)->commit) | 336 | struct buffer_data_page *bpage = page; |
| 337 | |||
| 338 | return (local_read(&bpage->commit) & ~RB_MISSED_FLAGS) | ||
| 335 | + BUF_PAGE_HDR_SIZE; | 339 | + BUF_PAGE_HDR_SIZE; |
| 336 | } | 340 | } |
| 337 | 341 | ||
| @@ -4400,8 +4404,13 @@ void ring_buffer_free_read_page(struct ring_buffer *buffer, int cpu, void *data) | |||
| 4400 | { | 4404 | { |
| 4401 | struct ring_buffer_per_cpu *cpu_buffer = buffer->buffers[cpu]; | 4405 | struct ring_buffer_per_cpu *cpu_buffer = buffer->buffers[cpu]; |
| 4402 | struct buffer_data_page *bpage = data; | 4406 | struct buffer_data_page *bpage = data; |
| 4407 | struct page *page = virt_to_page(bpage); | ||
| 4403 | unsigned long flags; | 4408 | unsigned long flags; |
| 4404 | 4409 | ||
| 4410 | /* If the page is still in use someplace else, we can't reuse it */ | ||
| 4411 | if (page_ref_count(page) > 1) | ||
| 4412 | goto out; | ||
| 4413 | |||
| 4405 | local_irq_save(flags); | 4414 | local_irq_save(flags); |
| 4406 | arch_spin_lock(&cpu_buffer->lock); | 4415 | arch_spin_lock(&cpu_buffer->lock); |
| 4407 | 4416 | ||
| @@ -4413,6 +4422,7 @@ void ring_buffer_free_read_page(struct ring_buffer *buffer, int cpu, void *data) | |||
| 4413 | arch_spin_unlock(&cpu_buffer->lock); | 4422 | arch_spin_unlock(&cpu_buffer->lock); |
| 4414 | local_irq_restore(flags); | 4423 | local_irq_restore(flags); |
| 4415 | 4424 | ||
| 4425 | out: | ||
| 4416 | free_page((unsigned long)bpage); | 4426 | free_page((unsigned long)bpage); |
| 4417 | } | 4427 | } |
| 4418 | EXPORT_SYMBOL_GPL(ring_buffer_free_read_page); | 4428 | EXPORT_SYMBOL_GPL(ring_buffer_free_read_page); |
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index 59518b8126d0..2a8d8a294345 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c | |||
| @@ -6769,7 +6769,7 @@ tracing_buffers_splice_read(struct file *file, loff_t *ppos, | |||
| 6769 | .spd_release = buffer_spd_release, | 6769 | .spd_release = buffer_spd_release, |
| 6770 | }; | 6770 | }; |
| 6771 | struct buffer_ref *ref; | 6771 | struct buffer_ref *ref; |
| 6772 | int entries, size, i; | 6772 | int entries, i; |
| 6773 | ssize_t ret = 0; | 6773 | ssize_t ret = 0; |
| 6774 | 6774 | ||
| 6775 | #ifdef CONFIG_TRACER_MAX_TRACE | 6775 | #ifdef CONFIG_TRACER_MAX_TRACE |
| @@ -6823,14 +6823,6 @@ tracing_buffers_splice_read(struct file *file, loff_t *ppos, | |||
| 6823 | break; | 6823 | break; |
| 6824 | } | 6824 | } |
| 6825 | 6825 | ||
| 6826 | /* | ||
| 6827 | * zero out any left over data, this is going to | ||
| 6828 | * user land. | ||
| 6829 | */ | ||
| 6830 | size = ring_buffer_page_len(ref->page); | ||
| 6831 | if (size < PAGE_SIZE) | ||
| 6832 | memset(ref->page + size, 0, PAGE_SIZE - size); | ||
| 6833 | |||
| 6834 | page = virt_to_page(ref->page); | 6826 | page = virt_to_page(ref->page); |
| 6835 | 6827 | ||
| 6836 | spd.pages[i] = page; | 6828 | spd.pages[i] = page; |
| @@ -7588,6 +7580,7 @@ allocate_trace_buffer(struct trace_array *tr, struct trace_buffer *buf, int size | |||
| 7588 | buf->data = alloc_percpu(struct trace_array_cpu); | 7580 | buf->data = alloc_percpu(struct trace_array_cpu); |
| 7589 | if (!buf->data) { | 7581 | if (!buf->data) { |
| 7590 | ring_buffer_free(buf->buffer); | 7582 | ring_buffer_free(buf->buffer); |
| 7583 | buf->buffer = NULL; | ||
| 7591 | return -ENOMEM; | 7584 | return -ENOMEM; |
| 7592 | } | 7585 | } |
| 7593 | 7586 | ||
| @@ -7611,7 +7604,9 @@ static int allocate_trace_buffers(struct trace_array *tr, int size) | |||
| 7611 | allocate_snapshot ? size : 1); | 7604 | allocate_snapshot ? size : 1); |
| 7612 | if (WARN_ON(ret)) { | 7605 | if (WARN_ON(ret)) { |
| 7613 | ring_buffer_free(tr->trace_buffer.buffer); | 7606 | ring_buffer_free(tr->trace_buffer.buffer); |
| 7607 | tr->trace_buffer.buffer = NULL; | ||
| 7614 | free_percpu(tr->trace_buffer.data); | 7608 | free_percpu(tr->trace_buffer.data); |
| 7609 | tr->trace_buffer.data = NULL; | ||
| 7615 | return -ENOMEM; | 7610 | return -ENOMEM; |
| 7616 | } | 7611 | } |
| 7617 | tr->allocated_snapshot = allocate_snapshot; | 7612 | tr->allocated_snapshot = allocate_snapshot; |
diff --git a/net/core/skbuff.c b/net/core/skbuff.c index a3cb0be4c6f3..08f574081315 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c | |||
| @@ -1177,12 +1177,12 @@ int skb_copy_ubufs(struct sk_buff *skb, gfp_t gfp_mask) | |||
| 1177 | int i, new_frags; | 1177 | int i, new_frags; |
| 1178 | u32 d_off; | 1178 | u32 d_off; |
| 1179 | 1179 | ||
| 1180 | if (!num_frags) | ||
| 1181 | goto release; | ||
| 1182 | |||
| 1183 | if (skb_shared(skb) || skb_unclone(skb, gfp_mask)) | 1180 | if (skb_shared(skb) || skb_unclone(skb, gfp_mask)) |
| 1184 | return -EINVAL; | 1181 | return -EINVAL; |
| 1185 | 1182 | ||
| 1183 | if (!num_frags) | ||
| 1184 | goto release; | ||
| 1185 | |||
| 1186 | new_frags = (__skb_pagelen(skb) + PAGE_SIZE - 1) >> PAGE_SHIFT; | 1186 | new_frags = (__skb_pagelen(skb) + PAGE_SIZE - 1) >> PAGE_SHIFT; |
| 1187 | for (i = 0; i < new_frags; i++) { | 1187 | for (i = 0; i < new_frags; i++) { |
| 1188 | page = alloc_page(gfp_mask); | 1188 | page = alloc_page(gfp_mask); |
diff --git a/net/ipv4/xfrm4_input.c b/net/ipv4/xfrm4_input.c index e50b7fea57ee..bcfc00e88756 100644 --- a/net/ipv4/xfrm4_input.c +++ b/net/ipv4/xfrm4_input.c | |||
| @@ -23,6 +23,12 @@ int xfrm4_extract_input(struct xfrm_state *x, struct sk_buff *skb) | |||
| 23 | return xfrm4_extract_header(skb); | 23 | return xfrm4_extract_header(skb); |
| 24 | } | 24 | } |
| 25 | 25 | ||
| 26 | static int xfrm4_rcv_encap_finish2(struct net *net, struct sock *sk, | ||
| 27 | struct sk_buff *skb) | ||
| 28 | { | ||
| 29 | return dst_input(skb); | ||
| 30 | } | ||
| 31 | |||
| 26 | static inline int xfrm4_rcv_encap_finish(struct net *net, struct sock *sk, | 32 | static inline int xfrm4_rcv_encap_finish(struct net *net, struct sock *sk, |
| 27 | struct sk_buff *skb) | 33 | struct sk_buff *skb) |
| 28 | { | 34 | { |
| @@ -33,7 +39,11 @@ static inline int xfrm4_rcv_encap_finish(struct net *net, struct sock *sk, | |||
| 33 | iph->tos, skb->dev)) | 39 | iph->tos, skb->dev)) |
| 34 | goto drop; | 40 | goto drop; |
| 35 | } | 41 | } |
| 36 | return dst_input(skb); | 42 | |
| 43 | if (xfrm_trans_queue(skb, xfrm4_rcv_encap_finish2)) | ||
| 44 | goto drop; | ||
| 45 | |||
| 46 | return 0; | ||
| 37 | drop: | 47 | drop: |
| 38 | kfree_skb(skb); | 48 | kfree_skb(skb); |
| 39 | return NET_RX_DROP; | 49 | return NET_RX_DROP; |
diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c index 416c8913f132..772695960890 100644 --- a/net/ipv6/ip6_gre.c +++ b/net/ipv6/ip6_gre.c | |||
| @@ -1014,6 +1014,36 @@ static void ip6gre_tunnel_setup(struct net_device *dev) | |||
| 1014 | eth_random_addr(dev->perm_addr); | 1014 | eth_random_addr(dev->perm_addr); |
| 1015 | } | 1015 | } |
| 1016 | 1016 | ||
| 1017 | #define GRE6_FEATURES (NETIF_F_SG | \ | ||
| 1018 | NETIF_F_FRAGLIST | \ | ||
| 1019 | NETIF_F_HIGHDMA | \ | ||
| 1020 | NETIF_F_HW_CSUM) | ||
| 1021 | |||
| 1022 | static void ip6gre_tnl_init_features(struct net_device *dev) | ||
| 1023 | { | ||
| 1024 | struct ip6_tnl *nt = netdev_priv(dev); | ||
| 1025 | |||
| 1026 | dev->features |= GRE6_FEATURES; | ||
| 1027 | dev->hw_features |= GRE6_FEATURES; | ||
| 1028 | |||
| 1029 | if (!(nt->parms.o_flags & TUNNEL_SEQ)) { | ||
| 1030 | /* TCP offload with GRE SEQ is not supported, nor | ||
| 1031 | * can we support 2 levels of outer headers requiring | ||
| 1032 | * an update. | ||
| 1033 | */ | ||
| 1034 | if (!(nt->parms.o_flags & TUNNEL_CSUM) || | ||
| 1035 | nt->encap.type == TUNNEL_ENCAP_NONE) { | ||
| 1036 | dev->features |= NETIF_F_GSO_SOFTWARE; | ||
| 1037 | dev->hw_features |= NETIF_F_GSO_SOFTWARE; | ||
| 1038 | } | ||
| 1039 | |||
| 1040 | /* Can use a lockless transmit, unless we generate | ||
| 1041 | * output sequences | ||
| 1042 | */ | ||
| 1043 | dev->features |= NETIF_F_LLTX; | ||
| 1044 | } | ||
| 1045 | } | ||
| 1046 | |||
| 1017 | static int ip6gre_tunnel_init_common(struct net_device *dev) | 1047 | static int ip6gre_tunnel_init_common(struct net_device *dev) |
| 1018 | { | 1048 | { |
| 1019 | struct ip6_tnl *tunnel; | 1049 | struct ip6_tnl *tunnel; |
| @@ -1048,6 +1078,8 @@ static int ip6gre_tunnel_init_common(struct net_device *dev) | |||
| 1048 | if (!(tunnel->parms.flags & IP6_TNL_F_IGN_ENCAP_LIMIT)) | 1078 | if (!(tunnel->parms.flags & IP6_TNL_F_IGN_ENCAP_LIMIT)) |
| 1049 | dev->mtu -= 8; | 1079 | dev->mtu -= 8; |
| 1050 | 1080 | ||
| 1081 | ip6gre_tnl_init_features(dev); | ||
| 1082 | |||
| 1051 | return 0; | 1083 | return 0; |
| 1052 | } | 1084 | } |
| 1053 | 1085 | ||
| @@ -1298,11 +1330,6 @@ static const struct net_device_ops ip6gre_tap_netdev_ops = { | |||
| 1298 | .ndo_get_iflink = ip6_tnl_get_iflink, | 1330 | .ndo_get_iflink = ip6_tnl_get_iflink, |
| 1299 | }; | 1331 | }; |
| 1300 | 1332 | ||
| 1301 | #define GRE6_FEATURES (NETIF_F_SG | \ | ||
| 1302 | NETIF_F_FRAGLIST | \ | ||
| 1303 | NETIF_F_HIGHDMA | \ | ||
| 1304 | NETIF_F_HW_CSUM) | ||
| 1305 | |||
| 1306 | static void ip6gre_tap_setup(struct net_device *dev) | 1333 | static void ip6gre_tap_setup(struct net_device *dev) |
| 1307 | { | 1334 | { |
| 1308 | 1335 | ||
| @@ -1383,26 +1410,6 @@ static int ip6gre_newlink(struct net *src_net, struct net_device *dev, | |||
| 1383 | nt->net = dev_net(dev); | 1410 | nt->net = dev_net(dev); |
| 1384 | ip6gre_tnl_link_config(nt, !tb[IFLA_MTU]); | 1411 | ip6gre_tnl_link_config(nt, !tb[IFLA_MTU]); |
| 1385 | 1412 | ||
| 1386 | dev->features |= GRE6_FEATURES; | ||
| 1387 | dev->hw_features |= GRE6_FEATURES; | ||
| 1388 | |||
| 1389 | if (!(nt->parms.o_flags & TUNNEL_SEQ)) { | ||
| 1390 | /* TCP offload with GRE SEQ is not supported, nor | ||
| 1391 | * can we support 2 levels of outer headers requiring | ||
| 1392 | * an update. | ||
| 1393 | */ | ||
| 1394 | if (!(nt->parms.o_flags & TUNNEL_CSUM) || | ||
| 1395 | (nt->encap.type == TUNNEL_ENCAP_NONE)) { | ||
| 1396 | dev->features |= NETIF_F_GSO_SOFTWARE; | ||
| 1397 | dev->hw_features |= NETIF_F_GSO_SOFTWARE; | ||
| 1398 | } | ||
| 1399 | |||
| 1400 | /* Can use a lockless transmit, unless we generate | ||
| 1401 | * output sequences | ||
| 1402 | */ | ||
| 1403 | dev->features |= NETIF_F_LLTX; | ||
| 1404 | } | ||
| 1405 | |||
| 1406 | err = register_netdevice(dev); | 1413 | err = register_netdevice(dev); |
| 1407 | if (err) | 1414 | if (err) |
| 1408 | goto out; | 1415 | goto out; |
diff --git a/net/ipv6/xfrm6_input.c b/net/ipv6/xfrm6_input.c index fe04e23af986..841f4a07438e 100644 --- a/net/ipv6/xfrm6_input.c +++ b/net/ipv6/xfrm6_input.c | |||
| @@ -32,6 +32,14 @@ int xfrm6_rcv_spi(struct sk_buff *skb, int nexthdr, __be32 spi, | |||
| 32 | } | 32 | } |
| 33 | EXPORT_SYMBOL(xfrm6_rcv_spi); | 33 | EXPORT_SYMBOL(xfrm6_rcv_spi); |
| 34 | 34 | ||
| 35 | static int xfrm6_transport_finish2(struct net *net, struct sock *sk, | ||
| 36 | struct sk_buff *skb) | ||
| 37 | { | ||
| 38 | if (xfrm_trans_queue(skb, ip6_rcv_finish)) | ||
| 39 | __kfree_skb(skb); | ||
| 40 | return -1; | ||
| 41 | } | ||
| 42 | |||
| 35 | int xfrm6_transport_finish(struct sk_buff *skb, int async) | 43 | int xfrm6_transport_finish(struct sk_buff *skb, int async) |
| 36 | { | 44 | { |
| 37 | struct xfrm_offload *xo = xfrm_offload(skb); | 45 | struct xfrm_offload *xo = xfrm_offload(skb); |
| @@ -56,7 +64,7 @@ int xfrm6_transport_finish(struct sk_buff *skb, int async) | |||
| 56 | 64 | ||
| 57 | NF_HOOK(NFPROTO_IPV6, NF_INET_PRE_ROUTING, | 65 | NF_HOOK(NFPROTO_IPV6, NF_INET_PRE_ROUTING, |
| 58 | dev_net(skb->dev), NULL, skb, skb->dev, NULL, | 66 | dev_net(skb->dev), NULL, skb, skb->dev, NULL, |
| 59 | ip6_rcv_finish); | 67 | xfrm6_transport_finish2); |
| 60 | return -1; | 68 | return -1; |
| 61 | } | 69 | } |
| 62 | 70 | ||
diff --git a/net/rds/send.c b/net/rds/send.c index b52cdc8ae428..f72466c63f0c 100644 --- a/net/rds/send.c +++ b/net/rds/send.c | |||
| @@ -1009,6 +1009,9 @@ static int rds_rdma_bytes(struct msghdr *msg, size_t *rdma_bytes) | |||
| 1009 | continue; | 1009 | continue; |
| 1010 | 1010 | ||
| 1011 | if (cmsg->cmsg_type == RDS_CMSG_RDMA_ARGS) { | 1011 | if (cmsg->cmsg_type == RDS_CMSG_RDMA_ARGS) { |
| 1012 | if (cmsg->cmsg_len < | ||
| 1013 | CMSG_LEN(sizeof(struct rds_rdma_args))) | ||
| 1014 | return -EINVAL; | ||
| 1012 | args = CMSG_DATA(cmsg); | 1015 | args = CMSG_DATA(cmsg); |
| 1013 | *rdma_bytes += args->remote_vec.bytes; | 1016 | *rdma_bytes += args->remote_vec.bytes; |
| 1014 | } | 1017 | } |
diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c index b91ea03e3afa..b9d63d2246e6 100644 --- a/net/sched/cls_api.c +++ b/net/sched/cls_api.c | |||
| @@ -379,6 +379,8 @@ void tcf_block_put(struct tcf_block *block) | |||
| 379 | { | 379 | { |
| 380 | struct tcf_block_ext_info ei = {0, }; | 380 | struct tcf_block_ext_info ei = {0, }; |
| 381 | 381 | ||
| 382 | if (!block) | ||
| 383 | return; | ||
| 382 | tcf_block_put_ext(block, block->q, &ei); | 384 | tcf_block_put_ext(block, block->q, &ei); |
| 383 | } | 385 | } |
| 384 | 386 | ||
diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c index cd1b200acae7..661c7144b53a 100644 --- a/net/sched/sch_generic.c +++ b/net/sched/sch_generic.c | |||
| @@ -1040,6 +1040,8 @@ void mini_qdisc_pair_swap(struct mini_Qdisc_pair *miniqp, | |||
| 1040 | 1040 | ||
| 1041 | if (!tp_head) { | 1041 | if (!tp_head) { |
| 1042 | RCU_INIT_POINTER(*miniqp->p_miniq, NULL); | 1042 | RCU_INIT_POINTER(*miniqp->p_miniq, NULL); |
| 1043 | /* Wait for flying RCU callback before it is freed. */ | ||
| 1044 | rcu_barrier_bh(); | ||
| 1043 | return; | 1045 | return; |
| 1044 | } | 1046 | } |
| 1045 | 1047 | ||
| @@ -1055,7 +1057,7 @@ void mini_qdisc_pair_swap(struct mini_Qdisc_pair *miniqp, | |||
| 1055 | rcu_assign_pointer(*miniqp->p_miniq, miniq); | 1057 | rcu_assign_pointer(*miniqp->p_miniq, miniq); |
| 1056 | 1058 | ||
| 1057 | if (miniq_old) | 1059 | if (miniq_old) |
| 1058 | /* This is counterpart of the rcu barrier above. We need to | 1060 | /* This is counterpart of the rcu barriers above. We need to |
| 1059 | * block potential new user of miniq_old until all readers | 1061 | * block potential new user of miniq_old until all readers |
| 1060 | * are not seeing it. | 1062 | * are not seeing it. |
| 1061 | */ | 1063 | */ |
diff --git a/net/sctp/socket.c b/net/sctp/socket.c index 3253f724a995..b4fb6e4886d2 100644 --- a/net/sctp/socket.c +++ b/net/sctp/socket.c | |||
| @@ -4498,7 +4498,7 @@ static int sctp_init_sock(struct sock *sk) | |||
| 4498 | SCTP_DBG_OBJCNT_INC(sock); | 4498 | SCTP_DBG_OBJCNT_INC(sock); |
| 4499 | 4499 | ||
| 4500 | local_bh_disable(); | 4500 | local_bh_disable(); |
| 4501 | percpu_counter_inc(&sctp_sockets_allocated); | 4501 | sk_sockets_allocated_inc(sk); |
| 4502 | sock_prot_inuse_add(net, sk->sk_prot, 1); | 4502 | sock_prot_inuse_add(net, sk->sk_prot, 1); |
| 4503 | 4503 | ||
| 4504 | /* Nothing can fail after this block, otherwise | 4504 | /* Nothing can fail after this block, otherwise |
| @@ -4542,7 +4542,7 @@ static void sctp_destroy_sock(struct sock *sk) | |||
| 4542 | } | 4542 | } |
| 4543 | sctp_endpoint_free(sp->ep); | 4543 | sctp_endpoint_free(sp->ep); |
| 4544 | local_bh_disable(); | 4544 | local_bh_disable(); |
| 4545 | percpu_counter_dec(&sctp_sockets_allocated); | 4545 | sk_sockets_allocated_dec(sk); |
| 4546 | sock_prot_inuse_add(sock_net(sk), sk->sk_prot, -1); | 4546 | sock_prot_inuse_add(sock_net(sk), sk->sk_prot, -1); |
| 4547 | local_bh_enable(); | 4547 | local_bh_enable(); |
| 4548 | } | 4548 | } |
diff --git a/net/strparser/strparser.c b/net/strparser/strparser.c index c5fda15ba319..1fdab5c4eda8 100644 --- a/net/strparser/strparser.c +++ b/net/strparser/strparser.c | |||
| @@ -401,7 +401,7 @@ void strp_data_ready(struct strparser *strp) | |||
| 401 | * allows a thread in BH context to safely check if the process | 401 | * allows a thread in BH context to safely check if the process |
| 402 | * lock is held. In this case, if the lock is held, queue work. | 402 | * lock is held. In this case, if the lock is held, queue work. |
| 403 | */ | 403 | */ |
| 404 | if (sock_owned_by_user(strp->sk)) { | 404 | if (sock_owned_by_user_nocheck(strp->sk)) { |
| 405 | queue_work(strp_wq, &strp->work); | 405 | queue_work(strp_wq, &strp->work); |
| 406 | return; | 406 | return; |
| 407 | } | 407 | } |
diff --git a/net/tipc/bearer.c b/net/tipc/bearer.c index 47ec121574ce..c8001471da6c 100644 --- a/net/tipc/bearer.c +++ b/net/tipc/bearer.c | |||
| @@ -324,6 +324,7 @@ restart: | |||
| 324 | if (res) { | 324 | if (res) { |
| 325 | pr_warn("Bearer <%s> rejected, enable failure (%d)\n", | 325 | pr_warn("Bearer <%s> rejected, enable failure (%d)\n", |
| 326 | name, -res); | 326 | name, -res); |
| 327 | kfree(b); | ||
| 327 | return -EINVAL; | 328 | return -EINVAL; |
| 328 | } | 329 | } |
| 329 | 330 | ||
| @@ -347,8 +348,10 @@ restart: | |||
| 347 | if (skb) | 348 | if (skb) |
| 348 | tipc_bearer_xmit_skb(net, bearer_id, skb, &b->bcast_addr); | 349 | tipc_bearer_xmit_skb(net, bearer_id, skb, &b->bcast_addr); |
| 349 | 350 | ||
| 350 | if (tipc_mon_create(net, bearer_id)) | 351 | if (tipc_mon_create(net, bearer_id)) { |
| 352 | bearer_disable(net, b); | ||
| 351 | return -ENOMEM; | 353 | return -ENOMEM; |
| 354 | } | ||
| 352 | 355 | ||
| 353 | pr_info("Enabled bearer <%s>, discovery domain %s, priority %u\n", | 356 | pr_info("Enabled bearer <%s>, discovery domain %s, priority %u\n", |
| 354 | name, | 357 | name, |
diff --git a/net/tipc/group.c b/net/tipc/group.c index 7ebbdeb2a90e..8e12ab55346b 100644 --- a/net/tipc/group.c +++ b/net/tipc/group.c | |||
| @@ -368,18 +368,20 @@ void tipc_group_update_bc_members(struct tipc_group *grp, int len, bool ack) | |||
| 368 | u16 prev = grp->bc_snd_nxt - 1; | 368 | u16 prev = grp->bc_snd_nxt - 1; |
| 369 | struct tipc_member *m; | 369 | struct tipc_member *m; |
| 370 | struct rb_node *n; | 370 | struct rb_node *n; |
| 371 | u16 ackers = 0; | ||
| 371 | 372 | ||
| 372 | for (n = rb_first(&grp->members); n; n = rb_next(n)) { | 373 | for (n = rb_first(&grp->members); n; n = rb_next(n)) { |
| 373 | m = container_of(n, struct tipc_member, tree_node); | 374 | m = container_of(n, struct tipc_member, tree_node); |
| 374 | if (tipc_group_is_enabled(m)) { | 375 | if (tipc_group_is_enabled(m)) { |
| 375 | tipc_group_update_member(m, len); | 376 | tipc_group_update_member(m, len); |
| 376 | m->bc_acked = prev; | 377 | m->bc_acked = prev; |
| 378 | ackers++; | ||
| 377 | } | 379 | } |
| 378 | } | 380 | } |
| 379 | 381 | ||
| 380 | /* Mark number of acknowledges to expect, if any */ | 382 | /* Mark number of acknowledges to expect, if any */ |
| 381 | if (ack) | 383 | if (ack) |
| 382 | grp->bc_ackers = grp->member_cnt; | 384 | grp->bc_ackers = ackers; |
| 383 | grp->bc_snd_nxt++; | 385 | grp->bc_snd_nxt++; |
| 384 | } | 386 | } |
| 385 | 387 | ||
| @@ -848,17 +850,26 @@ void tipc_group_member_evt(struct tipc_group *grp, | |||
| 848 | *usr_wakeup = true; | 850 | *usr_wakeup = true; |
| 849 | m->usr_pending = false; | 851 | m->usr_pending = false; |
| 850 | node_up = tipc_node_is_up(net, node); | 852 | node_up = tipc_node_is_up(net, node); |
| 851 | 853 | m->event_msg = NULL; | |
| 852 | /* Hold back event if more messages might be expected */ | 854 | |
| 853 | if (m->state != MBR_LEAVING && node_up) { | 855 | if (node_up) { |
| 854 | m->event_msg = skb; | 856 | /* Hold back event if a LEAVE msg should be expected */ |
| 855 | tipc_group_decr_active(grp, m); | 857 | if (m->state != MBR_LEAVING) { |
| 856 | m->state = MBR_LEAVING; | 858 | m->event_msg = skb; |
| 857 | } else { | 859 | tipc_group_decr_active(grp, m); |
| 858 | if (node_up) | 860 | m->state = MBR_LEAVING; |
| 861 | } else { | ||
| 859 | msg_set_grp_bc_seqno(hdr, m->bc_syncpt); | 862 | msg_set_grp_bc_seqno(hdr, m->bc_syncpt); |
| 860 | else | 863 | __skb_queue_tail(inputq, skb); |
| 864 | } | ||
| 865 | } else { | ||
| 866 | if (m->state != MBR_LEAVING) { | ||
| 867 | tipc_group_decr_active(grp, m); | ||
| 868 | m->state = MBR_LEAVING; | ||
| 861 | msg_set_grp_bc_seqno(hdr, m->bc_rcv_nxt); | 869 | msg_set_grp_bc_seqno(hdr, m->bc_rcv_nxt); |
| 870 | } else { | ||
| 871 | msg_set_grp_bc_seqno(hdr, m->bc_syncpt); | ||
| 872 | } | ||
| 862 | __skb_queue_tail(inputq, skb); | 873 | __skb_queue_tail(inputq, skb); |
| 863 | } | 874 | } |
| 864 | list_del_init(&m->list); | 875 | list_del_init(&m->list); |
diff --git a/net/tipc/monitor.c b/net/tipc/monitor.c index 8e884ed06d4b..32dc33a94bc7 100644 --- a/net/tipc/monitor.c +++ b/net/tipc/monitor.c | |||
| @@ -642,9 +642,13 @@ void tipc_mon_delete(struct net *net, int bearer_id) | |||
| 642 | { | 642 | { |
| 643 | struct tipc_net *tn = tipc_net(net); | 643 | struct tipc_net *tn = tipc_net(net); |
| 644 | struct tipc_monitor *mon = tipc_monitor(net, bearer_id); | 644 | struct tipc_monitor *mon = tipc_monitor(net, bearer_id); |
| 645 | struct tipc_peer *self = get_self(net, bearer_id); | 645 | struct tipc_peer *self; |
| 646 | struct tipc_peer *peer, *tmp; | 646 | struct tipc_peer *peer, *tmp; |
| 647 | 647 | ||
| 648 | if (!mon) | ||
| 649 | return; | ||
| 650 | |||
| 651 | self = get_self(net, bearer_id); | ||
| 648 | write_lock_bh(&mon->lock); | 652 | write_lock_bh(&mon->lock); |
| 649 | tn->monitors[bearer_id] = NULL; | 653 | tn->monitors[bearer_id] = NULL; |
| 650 | list_for_each_entry_safe(peer, tmp, &self->list, list) { | 654 | list_for_each_entry_safe(peer, tmp, &self->list, list) { |
diff --git a/net/tipc/socket.c b/net/tipc/socket.c index 41127d0b925e..3b4084480377 100644 --- a/net/tipc/socket.c +++ b/net/tipc/socket.c | |||
| @@ -727,11 +727,11 @@ static unsigned int tipc_poll(struct file *file, struct socket *sock, | |||
| 727 | 727 | ||
| 728 | switch (sk->sk_state) { | 728 | switch (sk->sk_state) { |
| 729 | case TIPC_ESTABLISHED: | 729 | case TIPC_ESTABLISHED: |
| 730 | case TIPC_CONNECTING: | ||
| 730 | if (!tsk->cong_link_cnt && !tsk_conn_cong(tsk)) | 731 | if (!tsk->cong_link_cnt && !tsk_conn_cong(tsk)) |
| 731 | revents |= POLLOUT; | 732 | revents |= POLLOUT; |
| 732 | /* fall thru' */ | 733 | /* fall thru' */ |
| 733 | case TIPC_LISTEN: | 734 | case TIPC_LISTEN: |
| 734 | case TIPC_CONNECTING: | ||
| 735 | if (!skb_queue_empty(&sk->sk_receive_queue)) | 735 | if (!skb_queue_empty(&sk->sk_receive_queue)) |
| 736 | revents |= POLLIN | POLLRDNORM; | 736 | revents |= POLLIN | POLLRDNORM; |
| 737 | break; | 737 | break; |
diff --git a/net/xfrm/xfrm_input.c b/net/xfrm/xfrm_input.c index 347ab31574d5..3f6f6f8c9fa5 100644 --- a/net/xfrm/xfrm_input.c +++ b/net/xfrm/xfrm_input.c | |||
| @@ -8,15 +8,29 @@ | |||
| 8 | * | 8 | * |
| 9 | */ | 9 | */ |
| 10 | 10 | ||
| 11 | #include <linux/bottom_half.h> | ||
| 12 | #include <linux/interrupt.h> | ||
| 11 | #include <linux/slab.h> | 13 | #include <linux/slab.h> |
| 12 | #include <linux/module.h> | 14 | #include <linux/module.h> |
| 13 | #include <linux/netdevice.h> | 15 | #include <linux/netdevice.h> |
| 16 | #include <linux/percpu.h> | ||
| 14 | #include <net/dst.h> | 17 | #include <net/dst.h> |
| 15 | #include <net/ip.h> | 18 | #include <net/ip.h> |
| 16 | #include <net/xfrm.h> | 19 | #include <net/xfrm.h> |
| 17 | #include <net/ip_tunnels.h> | 20 | #include <net/ip_tunnels.h> |
| 18 | #include <net/ip6_tunnel.h> | 21 | #include <net/ip6_tunnel.h> |
| 19 | 22 | ||
| 23 | struct xfrm_trans_tasklet { | ||
| 24 | struct tasklet_struct tasklet; | ||
| 25 | struct sk_buff_head queue; | ||
| 26 | }; | ||
| 27 | |||
| 28 | struct xfrm_trans_cb { | ||
| 29 | int (*finish)(struct net *net, struct sock *sk, struct sk_buff *skb); | ||
| 30 | }; | ||
| 31 | |||
| 32 | #define XFRM_TRANS_SKB_CB(__skb) ((struct xfrm_trans_cb *)&((__skb)->cb[0])) | ||
| 33 | |||
| 20 | static struct kmem_cache *secpath_cachep __read_mostly; | 34 | static struct kmem_cache *secpath_cachep __read_mostly; |
| 21 | 35 | ||
| 22 | static DEFINE_SPINLOCK(xfrm_input_afinfo_lock); | 36 | static DEFINE_SPINLOCK(xfrm_input_afinfo_lock); |
| @@ -25,6 +39,8 @@ static struct xfrm_input_afinfo const __rcu *xfrm_input_afinfo[AF_INET6 + 1]; | |||
| 25 | static struct gro_cells gro_cells; | 39 | static struct gro_cells gro_cells; |
| 26 | static struct net_device xfrm_napi_dev; | 40 | static struct net_device xfrm_napi_dev; |
| 27 | 41 | ||
| 42 | static DEFINE_PER_CPU(struct xfrm_trans_tasklet, xfrm_trans_tasklet); | ||
| 43 | |||
| 28 | int xfrm_input_register_afinfo(const struct xfrm_input_afinfo *afinfo) | 44 | int xfrm_input_register_afinfo(const struct xfrm_input_afinfo *afinfo) |
| 29 | { | 45 | { |
| 30 | int err = 0; | 46 | int err = 0; |
| @@ -207,7 +223,7 @@ int xfrm_input(struct sk_buff *skb, int nexthdr, __be32 spi, int encap_type) | |||
| 207 | xfrm_address_t *daddr; | 223 | xfrm_address_t *daddr; |
| 208 | struct xfrm_mode *inner_mode; | 224 | struct xfrm_mode *inner_mode; |
| 209 | u32 mark = skb->mark; | 225 | u32 mark = skb->mark; |
| 210 | unsigned int family; | 226 | unsigned int family = AF_UNSPEC; |
| 211 | int decaps = 0; | 227 | int decaps = 0; |
| 212 | int async = 0; | 228 | int async = 0; |
| 213 | bool xfrm_gro = false; | 229 | bool xfrm_gro = false; |
| @@ -216,6 +232,16 @@ int xfrm_input(struct sk_buff *skb, int nexthdr, __be32 spi, int encap_type) | |||
| 216 | 232 | ||
| 217 | if (encap_type < 0) { | 233 | if (encap_type < 0) { |
| 218 | x = xfrm_input_state(skb); | 234 | x = xfrm_input_state(skb); |
| 235 | |||
| 236 | if (unlikely(x->km.state != XFRM_STATE_VALID)) { | ||
| 237 | if (x->km.state == XFRM_STATE_ACQ) | ||
| 238 | XFRM_INC_STATS(net, LINUX_MIB_XFRMACQUIREERROR); | ||
| 239 | else | ||
| 240 | XFRM_INC_STATS(net, | ||
| 241 | LINUX_MIB_XFRMINSTATEINVALID); | ||
| 242 | goto drop; | ||
| 243 | } | ||
| 244 | |||
| 219 | family = x->outer_mode->afinfo->family; | 245 | family = x->outer_mode->afinfo->family; |
| 220 | 246 | ||
| 221 | /* An encap_type of -1 indicates async resumption. */ | 247 | /* An encap_type of -1 indicates async resumption. */ |
| @@ -467,9 +493,41 @@ int xfrm_input_resume(struct sk_buff *skb, int nexthdr) | |||
| 467 | } | 493 | } |
| 468 | EXPORT_SYMBOL(xfrm_input_resume); | 494 | EXPORT_SYMBOL(xfrm_input_resume); |
| 469 | 495 | ||
| 496 | static void xfrm_trans_reinject(unsigned long data) | ||
| 497 | { | ||
| 498 | struct xfrm_trans_tasklet *trans = (void *)data; | ||
| 499 | struct sk_buff_head queue; | ||
| 500 | struct sk_buff *skb; | ||
| 501 | |||
| 502 | __skb_queue_head_init(&queue); | ||
| 503 | skb_queue_splice_init(&trans->queue, &queue); | ||
| 504 | |||
| 505 | while ((skb = __skb_dequeue(&queue))) | ||
| 506 | XFRM_TRANS_SKB_CB(skb)->finish(dev_net(skb->dev), NULL, skb); | ||
| 507 | } | ||
| 508 | |||
| 509 | int xfrm_trans_queue(struct sk_buff *skb, | ||
| 510 | int (*finish)(struct net *, struct sock *, | ||
| 511 | struct sk_buff *)) | ||
| 512 | { | ||
| 513 | struct xfrm_trans_tasklet *trans; | ||
| 514 | |||
| 515 | trans = this_cpu_ptr(&xfrm_trans_tasklet); | ||
| 516 | |||
| 517 | if (skb_queue_len(&trans->queue) >= netdev_max_backlog) | ||
| 518 | return -ENOBUFS; | ||
| 519 | |||
| 520 | XFRM_TRANS_SKB_CB(skb)->finish = finish; | ||
| 521 | skb_queue_tail(&trans->queue, skb); | ||
| 522 | tasklet_schedule(&trans->tasklet); | ||
| 523 | return 0; | ||
| 524 | } | ||
| 525 | EXPORT_SYMBOL(xfrm_trans_queue); | ||
| 526 | |||
| 470 | void __init xfrm_input_init(void) | 527 | void __init xfrm_input_init(void) |
| 471 | { | 528 | { |
| 472 | int err; | 529 | int err; |
| 530 | int i; | ||
| 473 | 531 | ||
| 474 | init_dummy_netdev(&xfrm_napi_dev); | 532 | init_dummy_netdev(&xfrm_napi_dev); |
| 475 | err = gro_cells_init(&gro_cells, &xfrm_napi_dev); | 533 | err = gro_cells_init(&gro_cells, &xfrm_napi_dev); |
| @@ -480,4 +538,13 @@ void __init xfrm_input_init(void) | |||
| 480 | sizeof(struct sec_path), | 538 | sizeof(struct sec_path), |
| 481 | 0, SLAB_HWCACHE_ALIGN|SLAB_PANIC, | 539 | 0, SLAB_HWCACHE_ALIGN|SLAB_PANIC, |
| 482 | NULL); | 540 | NULL); |
| 541 | |||
| 542 | for_each_possible_cpu(i) { | ||
| 543 | struct xfrm_trans_tasklet *trans; | ||
| 544 | |||
| 545 | trans = &per_cpu(xfrm_trans_tasklet, i); | ||
| 546 | __skb_queue_head_init(&trans->queue); | ||
| 547 | tasklet_init(&trans->tasklet, xfrm_trans_reinject, | ||
| 548 | (unsigned long)trans); | ||
| 549 | } | ||
| 483 | } | 550 | } |
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c index 9542975eb2f9..70aa5cb0c659 100644 --- a/net/xfrm/xfrm_policy.c +++ b/net/xfrm/xfrm_policy.c | |||
| @@ -1168,9 +1168,15 @@ static struct xfrm_policy *xfrm_sk_policy_lookup(const struct sock *sk, int dir, | |||
| 1168 | again: | 1168 | again: |
| 1169 | pol = rcu_dereference(sk->sk_policy[dir]); | 1169 | pol = rcu_dereference(sk->sk_policy[dir]); |
| 1170 | if (pol != NULL) { | 1170 | if (pol != NULL) { |
| 1171 | bool match = xfrm_selector_match(&pol->selector, fl, family); | 1171 | bool match; |
| 1172 | int err = 0; | 1172 | int err = 0; |
| 1173 | 1173 | ||
| 1174 | if (pol->family != family) { | ||
| 1175 | pol = NULL; | ||
| 1176 | goto out; | ||
| 1177 | } | ||
| 1178 | |||
| 1179 | match = xfrm_selector_match(&pol->selector, fl, family); | ||
| 1174 | if (match) { | 1180 | if (match) { |
| 1175 | if ((sk->sk_mark & pol->mark.m) != pol->mark.v) { | 1181 | if ((sk->sk_mark & pol->mark.m) != pol->mark.v) { |
| 1176 | pol = NULL; | 1182 | pol = NULL; |
| @@ -1833,6 +1839,7 @@ xfrm_resolve_and_create_bundle(struct xfrm_policy **pols, int num_pols, | |||
| 1833 | sizeof(struct xfrm_policy *) * num_pols) == 0 && | 1839 | sizeof(struct xfrm_policy *) * num_pols) == 0 && |
| 1834 | xfrm_xdst_can_reuse(xdst, xfrm, err)) { | 1840 | xfrm_xdst_can_reuse(xdst, xfrm, err)) { |
| 1835 | dst_hold(&xdst->u.dst); | 1841 | dst_hold(&xdst->u.dst); |
| 1842 | xfrm_pols_put(pols, num_pols); | ||
| 1836 | while (err > 0) | 1843 | while (err > 0) |
| 1837 | xfrm_state_put(xfrm[--err]); | 1844 | xfrm_state_put(xfrm[--err]); |
| 1838 | return xdst; | 1845 | return xdst; |
diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c index 065d89606888..500b3391f474 100644 --- a/net/xfrm/xfrm_state.c +++ b/net/xfrm/xfrm_state.c | |||
| @@ -1343,6 +1343,7 @@ static struct xfrm_state *xfrm_state_clone(struct xfrm_state *orig, | |||
| 1343 | 1343 | ||
| 1344 | if (orig->aead) { | 1344 | if (orig->aead) { |
| 1345 | x->aead = xfrm_algo_aead_clone(orig->aead); | 1345 | x->aead = xfrm_algo_aead_clone(orig->aead); |
| 1346 | x->geniv = orig->geniv; | ||
| 1346 | if (!x->aead) | 1347 | if (!x->aead) |
| 1347 | goto error; | 1348 | goto error; |
| 1348 | } | 1349 | } |
diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c index 983b0233767b..bdb48e5dba04 100644 --- a/net/xfrm/xfrm_user.c +++ b/net/xfrm/xfrm_user.c | |||
| @@ -1419,11 +1419,14 @@ static void copy_templates(struct xfrm_policy *xp, struct xfrm_user_tmpl *ut, | |||
| 1419 | 1419 | ||
| 1420 | static int validate_tmpl(int nr, struct xfrm_user_tmpl *ut, u16 family) | 1420 | static int validate_tmpl(int nr, struct xfrm_user_tmpl *ut, u16 family) |
| 1421 | { | 1421 | { |
| 1422 | u16 prev_family; | ||
| 1422 | int i; | 1423 | int i; |
| 1423 | 1424 | ||
| 1424 | if (nr > XFRM_MAX_DEPTH) | 1425 | if (nr > XFRM_MAX_DEPTH) |
| 1425 | return -EINVAL; | 1426 | return -EINVAL; |
| 1426 | 1427 | ||
| 1428 | prev_family = family; | ||
| 1429 | |||
| 1427 | for (i = 0; i < nr; i++) { | 1430 | for (i = 0; i < nr; i++) { |
| 1428 | /* We never validated the ut->family value, so many | 1431 | /* We never validated the ut->family value, so many |
| 1429 | * applications simply leave it at zero. The check was | 1432 | * applications simply leave it at zero. The check was |
| @@ -1435,6 +1438,12 @@ static int validate_tmpl(int nr, struct xfrm_user_tmpl *ut, u16 family) | |||
| 1435 | if (!ut[i].family) | 1438 | if (!ut[i].family) |
| 1436 | ut[i].family = family; | 1439 | ut[i].family = family; |
| 1437 | 1440 | ||
| 1441 | if ((ut[i].mode == XFRM_MODE_TRANSPORT) && | ||
| 1442 | (ut[i].family != prev_family)) | ||
| 1443 | return -EINVAL; | ||
| 1444 | |||
| 1445 | prev_family = ut[i].family; | ||
| 1446 | |||
| 1438 | switch (ut[i].family) { | 1447 | switch (ut[i].family) { |
| 1439 | case AF_INET: | 1448 | case AF_INET: |
| 1440 | break; | 1449 | break; |
| @@ -1445,6 +1454,21 @@ static int validate_tmpl(int nr, struct xfrm_user_tmpl *ut, u16 family) | |||
| 1445 | default: | 1454 | default: |
| 1446 | return -EINVAL; | 1455 | return -EINVAL; |
| 1447 | } | 1456 | } |
| 1457 | |||
| 1458 | switch (ut[i].id.proto) { | ||
| 1459 | case IPPROTO_AH: | ||
| 1460 | case IPPROTO_ESP: | ||
| 1461 | case IPPROTO_COMP: | ||
| 1462 | #if IS_ENABLED(CONFIG_IPV6) | ||
| 1463 | case IPPROTO_ROUTING: | ||
| 1464 | case IPPROTO_DSTOPTS: | ||
| 1465 | #endif | ||
| 1466 | case IPSEC_PROTO_ANY: | ||
| 1467 | break; | ||
| 1468 | default: | ||
| 1469 | return -EINVAL; | ||
| 1470 | } | ||
| 1471 | |||
| 1448 | } | 1472 | } |
| 1449 | 1473 | ||
| 1450 | return 0; | 1474 | return 0; |
| @@ -2470,7 +2494,7 @@ static const struct nla_policy xfrma_policy[XFRMA_MAX+1] = { | |||
| 2470 | [XFRMA_PROTO] = { .type = NLA_U8 }, | 2494 | [XFRMA_PROTO] = { .type = NLA_U8 }, |
| 2471 | [XFRMA_ADDRESS_FILTER] = { .len = sizeof(struct xfrm_address_filter) }, | 2495 | [XFRMA_ADDRESS_FILTER] = { .len = sizeof(struct xfrm_address_filter) }, |
| 2472 | [XFRMA_OFFLOAD_DEV] = { .len = sizeof(struct xfrm_user_offload) }, | 2496 | [XFRMA_OFFLOAD_DEV] = { .len = sizeof(struct xfrm_user_offload) }, |
| 2473 | [XFRMA_OUTPUT_MARK] = { .len = NLA_U32 }, | 2497 | [XFRMA_OUTPUT_MARK] = { .type = NLA_U32 }, |
| 2474 | }; | 2498 | }; |
| 2475 | 2499 | ||
| 2476 | static const struct nla_policy xfrma_spd_policy[XFRMA_SPD_MAX+1] = { | 2500 | static const struct nla_policy xfrma_spd_policy[XFRMA_SPD_MAX+1] = { |
diff --git a/sound/hda/hdac_i915.c b/sound/hda/hdac_i915.c index 038a180d3f81..cbe818eda336 100644 --- a/sound/hda/hdac_i915.c +++ b/sound/hda/hdac_i915.c | |||
| @@ -325,7 +325,7 @@ static int hdac_component_master_match(struct device *dev, void *data) | |||
| 325 | */ | 325 | */ |
| 326 | int snd_hdac_i915_register_notifier(const struct i915_audio_component_audio_ops *aops) | 326 | int snd_hdac_i915_register_notifier(const struct i915_audio_component_audio_ops *aops) |
| 327 | { | 327 | { |
| 328 | if (WARN_ON(!hdac_acomp)) | 328 | if (!hdac_acomp) |
| 329 | return -ENODEV; | 329 | return -ENODEV; |
| 330 | 330 | ||
| 331 | hdac_acomp->audio_ops = aops; | 331 | hdac_acomp->audio_ops = aops; |
diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c index a81aacf684b2..37e1cf8218ff 100644 --- a/sound/pci/hda/patch_conexant.c +++ b/sound/pci/hda/patch_conexant.c | |||
| @@ -271,6 +271,8 @@ enum { | |||
| 271 | CXT_FIXUP_HP_SPECTRE, | 271 | CXT_FIXUP_HP_SPECTRE, |
| 272 | CXT_FIXUP_HP_GATE_MIC, | 272 | CXT_FIXUP_HP_GATE_MIC, |
| 273 | CXT_FIXUP_MUTE_LED_GPIO, | 273 | CXT_FIXUP_MUTE_LED_GPIO, |
| 274 | CXT_FIXUP_HEADSET_MIC, | ||
| 275 | CXT_FIXUP_HP_MIC_NO_PRESENCE, | ||
| 274 | }; | 276 | }; |
| 275 | 277 | ||
| 276 | /* for hda_fixup_thinkpad_acpi() */ | 278 | /* for hda_fixup_thinkpad_acpi() */ |
| @@ -350,6 +352,18 @@ static void cxt_fixup_headphone_mic(struct hda_codec *codec, | |||
| 350 | } | 352 | } |
| 351 | } | 353 | } |
| 352 | 354 | ||
| 355 | static void cxt_fixup_headset_mic(struct hda_codec *codec, | ||
| 356 | const struct hda_fixup *fix, int action) | ||
| 357 | { | ||
| 358 | struct conexant_spec *spec = codec->spec; | ||
| 359 | |||
| 360 | switch (action) { | ||
| 361 | case HDA_FIXUP_ACT_PRE_PROBE: | ||
| 362 | spec->parse_flags |= HDA_PINCFG_HEADSET_MIC; | ||
| 363 | break; | ||
| 364 | } | ||
| 365 | } | ||
| 366 | |||
| 353 | /* OPLC XO 1.5 fixup */ | 367 | /* OPLC XO 1.5 fixup */ |
| 354 | 368 | ||
| 355 | /* OLPC XO-1.5 supports DC input mode (e.g. for use with analog sensors) | 369 | /* OLPC XO-1.5 supports DC input mode (e.g. for use with analog sensors) |
| @@ -880,6 +894,19 @@ static const struct hda_fixup cxt_fixups[] = { | |||
| 880 | .type = HDA_FIXUP_FUNC, | 894 | .type = HDA_FIXUP_FUNC, |
| 881 | .v.func = cxt_fixup_mute_led_gpio, | 895 | .v.func = cxt_fixup_mute_led_gpio, |
| 882 | }, | 896 | }, |
| 897 | [CXT_FIXUP_HEADSET_MIC] = { | ||
| 898 | .type = HDA_FIXUP_FUNC, | ||
| 899 | .v.func = cxt_fixup_headset_mic, | ||
| 900 | }, | ||
| 901 | [CXT_FIXUP_HP_MIC_NO_PRESENCE] = { | ||
| 902 | .type = HDA_FIXUP_PINS, | ||
| 903 | .v.pins = (const struct hda_pintbl[]) { | ||
| 904 | { 0x1a, 0x02a1113c }, | ||
| 905 | { } | ||
| 906 | }, | ||
| 907 | .chained = true, | ||
| 908 | .chain_id = CXT_FIXUP_HEADSET_MIC, | ||
| 909 | }, | ||
| 883 | }; | 910 | }; |
| 884 | 911 | ||
| 885 | static const struct snd_pci_quirk cxt5045_fixups[] = { | 912 | static const struct snd_pci_quirk cxt5045_fixups[] = { |
| @@ -934,6 +961,8 @@ static const struct snd_pci_quirk cxt5066_fixups[] = { | |||
| 934 | SND_PCI_QUIRK(0x103c, 0x8115, "HP Z1 Gen3", CXT_FIXUP_HP_GATE_MIC), | 961 | SND_PCI_QUIRK(0x103c, 0x8115, "HP Z1 Gen3", CXT_FIXUP_HP_GATE_MIC), |
| 935 | SND_PCI_QUIRK(0x103c, 0x814f, "HP ZBook 15u G3", CXT_FIXUP_MUTE_LED_GPIO), | 962 | SND_PCI_QUIRK(0x103c, 0x814f, "HP ZBook 15u G3", CXT_FIXUP_MUTE_LED_GPIO), |
| 936 | SND_PCI_QUIRK(0x103c, 0x822e, "HP ProBook 440 G4", CXT_FIXUP_MUTE_LED_GPIO), | 963 | SND_PCI_QUIRK(0x103c, 0x822e, "HP ProBook 440 G4", CXT_FIXUP_MUTE_LED_GPIO), |
| 964 | SND_PCI_QUIRK(0x103c, 0x8299, "HP 800 G3 SFF", CXT_FIXUP_HP_MIC_NO_PRESENCE), | ||
| 965 | SND_PCI_QUIRK(0x103c, 0x829a, "HP 800 G3 DM", CXT_FIXUP_HP_MIC_NO_PRESENCE), | ||
| 937 | SND_PCI_QUIRK(0x1043, 0x138d, "Asus", CXT_FIXUP_HEADPHONE_MIC_PIN), | 966 | SND_PCI_QUIRK(0x1043, 0x138d, "Asus", CXT_FIXUP_HEADPHONE_MIC_PIN), |
| 938 | SND_PCI_QUIRK(0x152d, 0x0833, "OLPC XO-1.5", CXT_FIXUP_OLPC_XO), | 967 | SND_PCI_QUIRK(0x152d, 0x0833, "OLPC XO-1.5", CXT_FIXUP_OLPC_XO), |
| 939 | SND_PCI_QUIRK(0x17aa, 0x20f2, "Lenovo T400", CXT_PINCFG_LENOVO_TP410), | 968 | SND_PCI_QUIRK(0x17aa, 0x20f2, "Lenovo T400", CXT_PINCFG_LENOVO_TP410), |
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 6a4db00511ab..8fd2d9c62c96 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
| @@ -324,8 +324,12 @@ static void alc_fill_eapd_coef(struct hda_codec *codec) | |||
| 324 | case 0x10ec0292: | 324 | case 0x10ec0292: |
| 325 | alc_update_coef_idx(codec, 0x4, 1<<15, 0); | 325 | alc_update_coef_idx(codec, 0x4, 1<<15, 0); |
| 326 | break; | 326 | break; |
| 327 | case 0x10ec0215: | ||
| 328 | case 0x10ec0225: | 327 | case 0x10ec0225: |
| 328 | case 0x10ec0295: | ||
| 329 | case 0x10ec0299: | ||
| 330 | alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000); | ||
| 331 | /* fallthrough */ | ||
| 332 | case 0x10ec0215: | ||
| 329 | case 0x10ec0233: | 333 | case 0x10ec0233: |
| 330 | case 0x10ec0236: | 334 | case 0x10ec0236: |
| 331 | case 0x10ec0255: | 335 | case 0x10ec0255: |
| @@ -336,10 +340,8 @@ static void alc_fill_eapd_coef(struct hda_codec *codec) | |||
| 336 | case 0x10ec0286: | 340 | case 0x10ec0286: |
| 337 | case 0x10ec0288: | 341 | case 0x10ec0288: |
| 338 | case 0x10ec0285: | 342 | case 0x10ec0285: |
| 339 | case 0x10ec0295: | ||
| 340 | case 0x10ec0298: | 343 | case 0x10ec0298: |
| 341 | case 0x10ec0289: | 344 | case 0x10ec0289: |
| 342 | case 0x10ec0299: | ||
| 343 | alc_update_coef_idx(codec, 0x10, 1<<9, 0); | 345 | alc_update_coef_idx(codec, 0x10, 1<<9, 0); |
| 344 | break; | 346 | break; |
| 345 | case 0x10ec0275: | 347 | case 0x10ec0275: |
| @@ -6328,6 +6330,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { | |||
| 6328 | SND_PCI_QUIRK(0x17aa, 0x30bb, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY), | 6330 | SND_PCI_QUIRK(0x17aa, 0x30bb, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY), |
| 6329 | SND_PCI_QUIRK(0x17aa, 0x30e2, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY), | 6331 | SND_PCI_QUIRK(0x17aa, 0x30e2, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY), |
| 6330 | SND_PCI_QUIRK(0x17aa, 0x310c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION), | 6332 | SND_PCI_QUIRK(0x17aa, 0x310c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION), |
| 6333 | SND_PCI_QUIRK(0x17aa, 0x313c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION), | ||
| 6331 | SND_PCI_QUIRK(0x17aa, 0x3112, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY), | 6334 | SND_PCI_QUIRK(0x17aa, 0x3112, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY), |
| 6332 | SND_PCI_QUIRK(0x17aa, 0x3902, "Lenovo E50-80", ALC269_FIXUP_DMIC_THINKPAD_ACPI), | 6335 | SND_PCI_QUIRK(0x17aa, 0x3902, "Lenovo E50-80", ALC269_FIXUP_DMIC_THINKPAD_ACPI), |
| 6333 | SND_PCI_QUIRK(0x17aa, 0x3977, "IdeaPad S210", ALC283_FIXUP_INT_MIC), | 6336 | SND_PCI_QUIRK(0x17aa, 0x3977, "IdeaPad S210", ALC283_FIXUP_INT_MIC), |
| @@ -6586,6 +6589,11 @@ static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = { | |||
| 6586 | {0x1b, 0x01011020}, | 6589 | {0x1b, 0x01011020}, |
| 6587 | {0x21, 0x02211010}), | 6590 | {0x21, 0x02211010}), |
| 6588 | SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, | 6591 | SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, |
| 6592 | {0x12, 0x90a60130}, | ||
| 6593 | {0x14, 0x90170110}, | ||
| 6594 | {0x1b, 0x01011020}, | ||
| 6595 | {0x21, 0x0221101f}), | ||
| 6596 | SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, | ||
| 6589 | {0x12, 0x90a60160}, | 6597 | {0x12, 0x90a60160}, |
| 6590 | {0x14, 0x90170120}, | 6598 | {0x14, 0x90170120}, |
| 6591 | {0x21, 0x02211030}), | 6599 | {0x21, 0x02211030}), |
diff --git a/sound/soc/amd/acp-pcm-dma.c b/sound/soc/amd/acp-pcm-dma.c index 9f521a55d610..b5e41df6bb3a 100644 --- a/sound/soc/amd/acp-pcm-dma.c +++ b/sound/soc/amd/acp-pcm-dma.c | |||
| @@ -1051,6 +1051,11 @@ static int acp_audio_probe(struct platform_device *pdev) | |||
| 1051 | struct resource *res; | 1051 | struct resource *res; |
| 1052 | const u32 *pdata = pdev->dev.platform_data; | 1052 | const u32 *pdata = pdev->dev.platform_data; |
| 1053 | 1053 | ||
| 1054 | if (!pdata) { | ||
| 1055 | dev_err(&pdev->dev, "Missing platform data\n"); | ||
| 1056 | return -ENODEV; | ||
| 1057 | } | ||
| 1058 | |||
| 1054 | audio_drv_data = devm_kzalloc(&pdev->dev, sizeof(struct audio_drv_data), | 1059 | audio_drv_data = devm_kzalloc(&pdev->dev, sizeof(struct audio_drv_data), |
| 1055 | GFP_KERNEL); | 1060 | GFP_KERNEL); |
| 1056 | if (audio_drv_data == NULL) | 1061 | if (audio_drv_data == NULL) |
| @@ -1058,6 +1063,8 @@ static int acp_audio_probe(struct platform_device *pdev) | |||
| 1058 | 1063 | ||
| 1059 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 1064 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
| 1060 | audio_drv_data->acp_mmio = devm_ioremap_resource(&pdev->dev, res); | 1065 | audio_drv_data->acp_mmio = devm_ioremap_resource(&pdev->dev, res); |
| 1066 | if (IS_ERR(audio_drv_data->acp_mmio)) | ||
| 1067 | return PTR_ERR(audio_drv_data->acp_mmio); | ||
| 1061 | 1068 | ||
| 1062 | /* The following members gets populated in device 'open' | 1069 | /* The following members gets populated in device 'open' |
| 1063 | * function. Till then interrupts are disabled in 'acp_init' | 1070 | * function. Till then interrupts are disabled in 'acp_init' |
diff --git a/sound/soc/atmel/Kconfig b/sound/soc/atmel/Kconfig index 4a56f3dfba51..dcee145dd179 100644 --- a/sound/soc/atmel/Kconfig +++ b/sound/soc/atmel/Kconfig | |||
| @@ -64,7 +64,7 @@ config SND_AT91_SOC_SAM9X5_WM8731 | |||
| 64 | config SND_ATMEL_SOC_CLASSD | 64 | config SND_ATMEL_SOC_CLASSD |
| 65 | tristate "Atmel ASoC driver for boards using CLASSD" | 65 | tristate "Atmel ASoC driver for boards using CLASSD" |
| 66 | depends on ARCH_AT91 || COMPILE_TEST | 66 | depends on ARCH_AT91 || COMPILE_TEST |
| 67 | select SND_ATMEL_SOC_DMA | 67 | select SND_SOC_GENERIC_DMAENGINE_PCM |
| 68 | select REGMAP_MMIO | 68 | select REGMAP_MMIO |
| 69 | help | 69 | help |
| 70 | Say Y if you want to add support for Atmel ASoC driver for boards using | 70 | Say Y if you want to add support for Atmel ASoC driver for boards using |
diff --git a/sound/soc/codecs/da7218.c b/sound/soc/codecs/da7218.c index b2d42ec1dcd9..56564ce90cb6 100644 --- a/sound/soc/codecs/da7218.c +++ b/sound/soc/codecs/da7218.c | |||
| @@ -2520,7 +2520,7 @@ static struct da7218_pdata *da7218_of_to_pdata(struct snd_soc_codec *codec) | |||
| 2520 | } | 2520 | } |
| 2521 | 2521 | ||
| 2522 | if (da7218->dev_id == DA7218_DEV_ID) { | 2522 | if (da7218->dev_id == DA7218_DEV_ID) { |
| 2523 | hpldet_np = of_find_node_by_name(np, "da7218_hpldet"); | 2523 | hpldet_np = of_get_child_by_name(np, "da7218_hpldet"); |
| 2524 | if (!hpldet_np) | 2524 | if (!hpldet_np) |
| 2525 | return pdata; | 2525 | return pdata; |
| 2526 | 2526 | ||
diff --git a/sound/soc/codecs/msm8916-wcd-analog.c b/sound/soc/codecs/msm8916-wcd-analog.c index 5f3c42c4f74a..066ea2f4ce7b 100644 --- a/sound/soc/codecs/msm8916-wcd-analog.c +++ b/sound/soc/codecs/msm8916-wcd-analog.c | |||
| @@ -267,7 +267,7 @@ | |||
| 267 | #define MSM8916_WCD_ANALOG_RATES (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_16000 |\ | 267 | #define MSM8916_WCD_ANALOG_RATES (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_16000 |\ |
| 268 | SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_48000) | 268 | SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_48000) |
| 269 | #define MSM8916_WCD_ANALOG_FORMATS (SNDRV_PCM_FMTBIT_S16_LE |\ | 269 | #define MSM8916_WCD_ANALOG_FORMATS (SNDRV_PCM_FMTBIT_S16_LE |\ |
| 270 | SNDRV_PCM_FMTBIT_S24_LE) | 270 | SNDRV_PCM_FMTBIT_S32_LE) |
| 271 | 271 | ||
| 272 | static int btn_mask = SND_JACK_BTN_0 | SND_JACK_BTN_1 | | 272 | static int btn_mask = SND_JACK_BTN_0 | SND_JACK_BTN_1 | |
| 273 | SND_JACK_BTN_2 | SND_JACK_BTN_3 | SND_JACK_BTN_4; | 273 | SND_JACK_BTN_2 | SND_JACK_BTN_3 | SND_JACK_BTN_4; |
diff --git a/sound/soc/codecs/msm8916-wcd-digital.c b/sound/soc/codecs/msm8916-wcd-digital.c index a10a724eb448..13354d6304a8 100644 --- a/sound/soc/codecs/msm8916-wcd-digital.c +++ b/sound/soc/codecs/msm8916-wcd-digital.c | |||
| @@ -194,7 +194,7 @@ | |||
| 194 | SNDRV_PCM_RATE_32000 | \ | 194 | SNDRV_PCM_RATE_32000 | \ |
| 195 | SNDRV_PCM_RATE_48000) | 195 | SNDRV_PCM_RATE_48000) |
| 196 | #define MSM8916_WCD_DIGITAL_FORMATS (SNDRV_PCM_FMTBIT_S16_LE |\ | 196 | #define MSM8916_WCD_DIGITAL_FORMATS (SNDRV_PCM_FMTBIT_S16_LE |\ |
| 197 | SNDRV_PCM_FMTBIT_S24_LE) | 197 | SNDRV_PCM_FMTBIT_S32_LE) |
| 198 | 198 | ||
| 199 | struct msm8916_wcd_digital_priv { | 199 | struct msm8916_wcd_digital_priv { |
| 200 | struct clk *ahbclk, *mclk; | 200 | struct clk *ahbclk, *mclk; |
| @@ -645,7 +645,7 @@ static int msm8916_wcd_digital_hw_params(struct snd_pcm_substream *substream, | |||
| 645 | RX_I2S_CTL_RX_I2S_MODE_MASK, | 645 | RX_I2S_CTL_RX_I2S_MODE_MASK, |
| 646 | RX_I2S_CTL_RX_I2S_MODE_16); | 646 | RX_I2S_CTL_RX_I2S_MODE_16); |
| 647 | break; | 647 | break; |
| 648 | case SNDRV_PCM_FORMAT_S24_LE: | 648 | case SNDRV_PCM_FORMAT_S32_LE: |
| 649 | snd_soc_update_bits(dai->codec, LPASS_CDC_CLK_TX_I2S_CTL, | 649 | snd_soc_update_bits(dai->codec, LPASS_CDC_CLK_TX_I2S_CTL, |
| 650 | TX_I2S_CTL_TX_I2S_MODE_MASK, | 650 | TX_I2S_CTL_TX_I2S_MODE_MASK, |
| 651 | TX_I2S_CTL_TX_I2S_MODE_32); | 651 | TX_I2S_CTL_TX_I2S_MODE_32); |
diff --git a/sound/soc/codecs/nau8825.c b/sound/soc/codecs/nau8825.c index 714ce17da717..e853a6dfd33b 100644 --- a/sound/soc/codecs/nau8825.c +++ b/sound/soc/codecs/nau8825.c | |||
| @@ -905,6 +905,7 @@ static int nau8825_adc_event(struct snd_soc_dapm_widget *w, | |||
| 905 | 905 | ||
| 906 | switch (event) { | 906 | switch (event) { |
| 907 | case SND_SOC_DAPM_POST_PMU: | 907 | case SND_SOC_DAPM_POST_PMU: |
| 908 | msleep(125); | ||
| 908 | regmap_update_bits(nau8825->regmap, NAU8825_REG_ENA_CTRL, | 909 | regmap_update_bits(nau8825->regmap, NAU8825_REG_ENA_CTRL, |
| 909 | NAU8825_ENABLE_ADC, NAU8825_ENABLE_ADC); | 910 | NAU8825_ENABLE_ADC, NAU8825_ENABLE_ADC); |
| 910 | break; | 911 | break; |
diff --git a/sound/soc/codecs/rt5514-spi.c b/sound/soc/codecs/rt5514-spi.c index 2df91db765ac..64bf26cec20d 100644 --- a/sound/soc/codecs/rt5514-spi.c +++ b/sound/soc/codecs/rt5514-spi.c | |||
| @@ -289,6 +289,8 @@ static int rt5514_spi_pcm_probe(struct snd_soc_platform *platform) | |||
| 289 | dev_err(&rt5514_spi->dev, | 289 | dev_err(&rt5514_spi->dev, |
| 290 | "%s Failed to reguest IRQ: %d\n", __func__, | 290 | "%s Failed to reguest IRQ: %d\n", __func__, |
| 291 | ret); | 291 | ret); |
| 292 | else | ||
| 293 | device_init_wakeup(rt5514_dsp->dev, true); | ||
| 292 | } | 294 | } |
| 293 | 295 | ||
| 294 | return 0; | 296 | return 0; |
| @@ -456,8 +458,6 @@ static int rt5514_spi_probe(struct spi_device *spi) | |||
| 456 | return ret; | 458 | return ret; |
| 457 | } | 459 | } |
| 458 | 460 | ||
| 459 | device_init_wakeup(&spi->dev, true); | ||
| 460 | |||
| 461 | return 0; | 461 | return 0; |
| 462 | } | 462 | } |
| 463 | 463 | ||
| @@ -482,10 +482,13 @@ static int __maybe_unused rt5514_resume(struct device *dev) | |||
| 482 | if (device_may_wakeup(dev)) | 482 | if (device_may_wakeup(dev)) |
| 483 | disable_irq_wake(irq); | 483 | disable_irq_wake(irq); |
| 484 | 484 | ||
| 485 | if (rt5514_dsp->substream) { | 485 | if (rt5514_dsp) { |
| 486 | rt5514_spi_burst_read(RT5514_IRQ_CTRL, (u8 *)&buf, sizeof(buf)); | 486 | if (rt5514_dsp->substream) { |
| 487 | if (buf[0] & RT5514_IRQ_STATUS_BIT) | 487 | rt5514_spi_burst_read(RT5514_IRQ_CTRL, (u8 *)&buf, |
| 488 | rt5514_schedule_copy(rt5514_dsp); | 488 | sizeof(buf)); |
| 489 | if (buf[0] & RT5514_IRQ_STATUS_BIT) | ||
| 490 | rt5514_schedule_copy(rt5514_dsp); | ||
| 491 | } | ||
| 489 | } | 492 | } |
| 490 | 493 | ||
| 491 | return 0; | 494 | return 0; |
diff --git a/sound/soc/codecs/rt5514.c b/sound/soc/codecs/rt5514.c index 2a5b5d74e697..2dd6e9f990a4 100644 --- a/sound/soc/codecs/rt5514.c +++ b/sound/soc/codecs/rt5514.c | |||
| @@ -496,7 +496,7 @@ static const struct snd_soc_dapm_widget rt5514_dapm_widgets[] = { | |||
| 496 | SND_SOC_DAPM_PGA("DMIC1", SND_SOC_NOPM, 0, 0, NULL, 0), | 496 | SND_SOC_DAPM_PGA("DMIC1", SND_SOC_NOPM, 0, 0, NULL, 0), |
| 497 | SND_SOC_DAPM_PGA("DMIC2", SND_SOC_NOPM, 0, 0, NULL, 0), | 497 | SND_SOC_DAPM_PGA("DMIC2", SND_SOC_NOPM, 0, 0, NULL, 0), |
| 498 | 498 | ||
| 499 | SND_SOC_DAPM_SUPPLY("DMIC CLK", SND_SOC_NOPM, 0, 0, | 499 | SND_SOC_DAPM_SUPPLY_S("DMIC CLK", 1, SND_SOC_NOPM, 0, 0, |
| 500 | rt5514_set_dmic_clk, SND_SOC_DAPM_PRE_PMU), | 500 | rt5514_set_dmic_clk, SND_SOC_DAPM_PRE_PMU), |
| 501 | 501 | ||
| 502 | SND_SOC_DAPM_SUPPLY("ADC CLK", RT5514_CLK_CTRL1, | 502 | SND_SOC_DAPM_SUPPLY("ADC CLK", RT5514_CLK_CTRL1, |
diff --git a/sound/soc/codecs/rt5645.c b/sound/soc/codecs/rt5645.c index f020d2d1eef4..edc152c8a1fe 100644 --- a/sound/soc/codecs/rt5645.c +++ b/sound/soc/codecs/rt5645.c | |||
| @@ -3823,6 +3823,8 @@ static int rt5645_i2c_probe(struct i2c_client *i2c, | |||
| 3823 | regmap_read(regmap, RT5645_VENDOR_ID, &val); | 3823 | regmap_read(regmap, RT5645_VENDOR_ID, &val); |
| 3824 | rt5645->v_id = val & 0xff; | 3824 | rt5645->v_id = val & 0xff; |
| 3825 | 3825 | ||
| 3826 | regmap_write(rt5645->regmap, RT5645_AD_DA_MIXER, 0x8080); | ||
| 3827 | |||
| 3826 | ret = regmap_register_patch(rt5645->regmap, init_list, | 3828 | ret = regmap_register_patch(rt5645->regmap, init_list, |
| 3827 | ARRAY_SIZE(init_list)); | 3829 | ARRAY_SIZE(init_list)); |
| 3828 | if (ret != 0) | 3830 | if (ret != 0) |
diff --git a/sound/soc/codecs/rt5663.c b/sound/soc/codecs/rt5663.c index b036c9dc0c8c..d329bf719d80 100644 --- a/sound/soc/codecs/rt5663.c +++ b/sound/soc/codecs/rt5663.c | |||
| @@ -1560,6 +1560,10 @@ static int rt5663_jack_detect(struct snd_soc_codec *codec, int jack_insert) | |||
| 1560 | RT5663_IRQ_POW_SAV_MASK, RT5663_IRQ_POW_SAV_EN); | 1560 | RT5663_IRQ_POW_SAV_MASK, RT5663_IRQ_POW_SAV_EN); |
| 1561 | snd_soc_update_bits(codec, RT5663_IRQ_1, | 1561 | snd_soc_update_bits(codec, RT5663_IRQ_1, |
| 1562 | RT5663_EN_IRQ_JD1_MASK, RT5663_EN_IRQ_JD1_EN); | 1562 | RT5663_EN_IRQ_JD1_MASK, RT5663_EN_IRQ_JD1_EN); |
| 1563 | snd_soc_update_bits(codec, RT5663_EM_JACK_TYPE_1, | ||
| 1564 | RT5663_EM_JD_MASK, RT5663_EM_JD_RST); | ||
| 1565 | snd_soc_update_bits(codec, RT5663_EM_JACK_TYPE_1, | ||
| 1566 | RT5663_EM_JD_MASK, RT5663_EM_JD_NOR); | ||
| 1563 | 1567 | ||
| 1564 | while (true) { | 1568 | while (true) { |
| 1565 | regmap_read(rt5663->regmap, RT5663_INT_ST_2, &val); | 1569 | regmap_read(rt5663->regmap, RT5663_INT_ST_2, &val); |
diff --git a/sound/soc/codecs/rt5663.h b/sound/soc/codecs/rt5663.h index c5a9b69579ad..03adc8004ba9 100644 --- a/sound/soc/codecs/rt5663.h +++ b/sound/soc/codecs/rt5663.h | |||
| @@ -1029,6 +1029,10 @@ | |||
| 1029 | #define RT5663_POL_EXT_JD_SHIFT 10 | 1029 | #define RT5663_POL_EXT_JD_SHIFT 10 |
| 1030 | #define RT5663_POL_EXT_JD_EN (0x1 << 10) | 1030 | #define RT5663_POL_EXT_JD_EN (0x1 << 10) |
| 1031 | #define RT5663_POL_EXT_JD_DIS (0x0 << 10) | 1031 | #define RT5663_POL_EXT_JD_DIS (0x0 << 10) |
| 1032 | #define RT5663_EM_JD_MASK (0x1 << 7) | ||
| 1033 | #define RT5663_EM_JD_SHIFT 7 | ||
| 1034 | #define RT5663_EM_JD_NOR (0x1 << 7) | ||
| 1035 | #define RT5663_EM_JD_RST (0x0 << 7) | ||
| 1032 | 1036 | ||
| 1033 | /* DACREF LDO Control (0x0112)*/ | 1037 | /* DACREF LDO Control (0x0112)*/ |
| 1034 | #define RT5663_PWR_LDO_DACREFL_MASK (0x1 << 9) | 1038 | #define RT5663_PWR_LDO_DACREFL_MASK (0x1 << 9) |
diff --git a/sound/soc/codecs/tlv320aic31xx.h b/sound/soc/codecs/tlv320aic31xx.h index 730fb2058869..1ff3edb7bbb6 100644 --- a/sound/soc/codecs/tlv320aic31xx.h +++ b/sound/soc/codecs/tlv320aic31xx.h | |||
| @@ -116,7 +116,7 @@ struct aic31xx_pdata { | |||
| 116 | /* INT2 interrupt control */ | 116 | /* INT2 interrupt control */ |
| 117 | #define AIC31XX_INT2CTRL AIC31XX_REG(0, 49) | 117 | #define AIC31XX_INT2CTRL AIC31XX_REG(0, 49) |
| 118 | /* GPIO1 control */ | 118 | /* GPIO1 control */ |
| 119 | #define AIC31XX_GPIO1 AIC31XX_REG(0, 50) | 119 | #define AIC31XX_GPIO1 AIC31XX_REG(0, 51) |
| 120 | 120 | ||
| 121 | #define AIC31XX_DACPRB AIC31XX_REG(0, 60) | 121 | #define AIC31XX_DACPRB AIC31XX_REG(0, 60) |
| 122 | /* ADC Instruction Set Register */ | 122 | /* ADC Instruction Set Register */ |
diff --git a/sound/soc/codecs/twl4030.c b/sound/soc/codecs/twl4030.c index c482b2e7a7d2..cfe72b9d4356 100644 --- a/sound/soc/codecs/twl4030.c +++ b/sound/soc/codecs/twl4030.c | |||
| @@ -232,7 +232,7 @@ static struct twl4030_codec_data *twl4030_get_pdata(struct snd_soc_codec *codec) | |||
| 232 | struct twl4030_codec_data *pdata = dev_get_platdata(codec->dev); | 232 | struct twl4030_codec_data *pdata = dev_get_platdata(codec->dev); |
| 233 | struct device_node *twl4030_codec_node = NULL; | 233 | struct device_node *twl4030_codec_node = NULL; |
| 234 | 234 | ||
| 235 | twl4030_codec_node = of_find_node_by_name(codec->dev->parent->of_node, | 235 | twl4030_codec_node = of_get_child_by_name(codec->dev->parent->of_node, |
| 236 | "codec"); | 236 | "codec"); |
| 237 | 237 | ||
| 238 | if (!pdata && twl4030_codec_node) { | 238 | if (!pdata && twl4030_codec_node) { |
| @@ -241,9 +241,11 @@ static struct twl4030_codec_data *twl4030_get_pdata(struct snd_soc_codec *codec) | |||
| 241 | GFP_KERNEL); | 241 | GFP_KERNEL); |
| 242 | if (!pdata) { | 242 | if (!pdata) { |
| 243 | dev_err(codec->dev, "Can not allocate memory\n"); | 243 | dev_err(codec->dev, "Can not allocate memory\n"); |
| 244 | of_node_put(twl4030_codec_node); | ||
| 244 | return NULL; | 245 | return NULL; |
| 245 | } | 246 | } |
| 246 | twl4030_setup_pdata_of(pdata, twl4030_codec_node); | 247 | twl4030_setup_pdata_of(pdata, twl4030_codec_node); |
| 248 | of_node_put(twl4030_codec_node); | ||
| 247 | } | 249 | } |
| 248 | 250 | ||
| 249 | return pdata; | 251 | return pdata; |
diff --git a/sound/soc/codecs/wm_adsp.c b/sound/soc/codecs/wm_adsp.c index 65c059b5ffd7..66e32f5d2917 100644 --- a/sound/soc/codecs/wm_adsp.c +++ b/sound/soc/codecs/wm_adsp.c | |||
| @@ -1733,7 +1733,7 @@ static int wm_adsp_load(struct wm_adsp *dsp) | |||
| 1733 | le64_to_cpu(footer->timestamp)); | 1733 | le64_to_cpu(footer->timestamp)); |
| 1734 | 1734 | ||
| 1735 | while (pos < firmware->size && | 1735 | while (pos < firmware->size && |
| 1736 | pos - firmware->size > sizeof(*region)) { | 1736 | sizeof(*region) < firmware->size - pos) { |
| 1737 | region = (void *)&(firmware->data[pos]); | 1737 | region = (void *)&(firmware->data[pos]); |
| 1738 | region_name = "Unknown"; | 1738 | region_name = "Unknown"; |
| 1739 | reg = 0; | 1739 | reg = 0; |
| @@ -1782,8 +1782,8 @@ static int wm_adsp_load(struct wm_adsp *dsp) | |||
| 1782 | regions, le32_to_cpu(region->len), offset, | 1782 | regions, le32_to_cpu(region->len), offset, |
| 1783 | region_name); | 1783 | region_name); |
| 1784 | 1784 | ||
| 1785 | if ((pos + le32_to_cpu(region->len) + sizeof(*region)) > | 1785 | if (le32_to_cpu(region->len) > |
| 1786 | firmware->size) { | 1786 | firmware->size - pos - sizeof(*region)) { |
| 1787 | adsp_err(dsp, | 1787 | adsp_err(dsp, |
| 1788 | "%s.%d: %s region len %d bytes exceeds file length %zu\n", | 1788 | "%s.%d: %s region len %d bytes exceeds file length %zu\n", |
| 1789 | file, regions, region_name, | 1789 | file, regions, region_name, |
| @@ -2253,7 +2253,7 @@ static int wm_adsp_load_coeff(struct wm_adsp *dsp) | |||
| 2253 | 2253 | ||
| 2254 | blocks = 0; | 2254 | blocks = 0; |
| 2255 | while (pos < firmware->size && | 2255 | while (pos < firmware->size && |
| 2256 | pos - firmware->size > sizeof(*blk)) { | 2256 | sizeof(*blk) < firmware->size - pos) { |
| 2257 | blk = (void *)(&firmware->data[pos]); | 2257 | blk = (void *)(&firmware->data[pos]); |
| 2258 | 2258 | ||
| 2259 | type = le16_to_cpu(blk->type); | 2259 | type = le16_to_cpu(blk->type); |
| @@ -2327,8 +2327,8 @@ static int wm_adsp_load_coeff(struct wm_adsp *dsp) | |||
| 2327 | } | 2327 | } |
| 2328 | 2328 | ||
| 2329 | if (reg) { | 2329 | if (reg) { |
| 2330 | if ((pos + le32_to_cpu(blk->len) + sizeof(*blk)) > | 2330 | if (le32_to_cpu(blk->len) > |
| 2331 | firmware->size) { | 2331 | firmware->size - pos - sizeof(*blk)) { |
| 2332 | adsp_err(dsp, | 2332 | adsp_err(dsp, |
| 2333 | "%s.%d: %s region len %d bytes exceeds file length %zu\n", | 2333 | "%s.%d: %s region len %d bytes exceeds file length %zu\n", |
| 2334 | file, blocks, region_name, | 2334 | file, blocks, region_name, |
diff --git a/sound/soc/fsl/fsl_asrc.h b/sound/soc/fsl/fsl_asrc.h index 0f163abe4ba3..52c27a358933 100644 --- a/sound/soc/fsl/fsl_asrc.h +++ b/sound/soc/fsl/fsl_asrc.h | |||
| @@ -260,8 +260,8 @@ | |||
| 260 | #define ASRFSTi_OUTPUT_FIFO_SHIFT 12 | 260 | #define ASRFSTi_OUTPUT_FIFO_SHIFT 12 |
| 261 | #define ASRFSTi_OUTPUT_FIFO_MASK (((1 << ASRFSTi_OUTPUT_FIFO_WIDTH) - 1) << ASRFSTi_OUTPUT_FIFO_SHIFT) | 261 | #define ASRFSTi_OUTPUT_FIFO_MASK (((1 << ASRFSTi_OUTPUT_FIFO_WIDTH) - 1) << ASRFSTi_OUTPUT_FIFO_SHIFT) |
| 262 | #define ASRFSTi_IAEi_SHIFT 11 | 262 | #define ASRFSTi_IAEi_SHIFT 11 |
| 263 | #define ASRFSTi_IAEi_MASK (1 << ASRFSTi_OAFi_SHIFT) | 263 | #define ASRFSTi_IAEi_MASK (1 << ASRFSTi_IAEi_SHIFT) |
| 264 | #define ASRFSTi_IAEi (1 << ASRFSTi_OAFi_SHIFT) | 264 | #define ASRFSTi_IAEi (1 << ASRFSTi_IAEi_SHIFT) |
| 265 | #define ASRFSTi_INPUT_FIFO_WIDTH 7 | 265 | #define ASRFSTi_INPUT_FIFO_WIDTH 7 |
| 266 | #define ASRFSTi_INPUT_FIFO_SHIFT 0 | 266 | #define ASRFSTi_INPUT_FIFO_SHIFT 0 |
| 267 | #define ASRFSTi_INPUT_FIFO_MASK ((1 << ASRFSTi_INPUT_FIFO_WIDTH) - 1) | 267 | #define ASRFSTi_INPUT_FIFO_MASK ((1 << ASRFSTi_INPUT_FIFO_WIDTH) - 1) |
diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c index f2f51e06e22c..424bafaf51ef 100644 --- a/sound/soc/fsl/fsl_ssi.c +++ b/sound/soc/fsl/fsl_ssi.c | |||
| @@ -38,6 +38,7 @@ | |||
| 38 | #include <linux/ctype.h> | 38 | #include <linux/ctype.h> |
| 39 | #include <linux/device.h> | 39 | #include <linux/device.h> |
| 40 | #include <linux/delay.h> | 40 | #include <linux/delay.h> |
| 41 | #include <linux/mutex.h> | ||
| 41 | #include <linux/slab.h> | 42 | #include <linux/slab.h> |
| 42 | #include <linux/spinlock.h> | 43 | #include <linux/spinlock.h> |
| 43 | #include <linux/of.h> | 44 | #include <linux/of.h> |
| @@ -265,6 +266,8 @@ struct fsl_ssi_private { | |||
| 265 | 266 | ||
| 266 | u32 fifo_watermark; | 267 | u32 fifo_watermark; |
| 267 | u32 dma_maxburst; | 268 | u32 dma_maxburst; |
| 269 | |||
| 270 | struct mutex ac97_reg_lock; | ||
| 268 | }; | 271 | }; |
| 269 | 272 | ||
| 270 | /* | 273 | /* |
| @@ -1260,11 +1263,13 @@ static void fsl_ssi_ac97_write(struct snd_ac97 *ac97, unsigned short reg, | |||
| 1260 | if (reg > 0x7f) | 1263 | if (reg > 0x7f) |
| 1261 | return; | 1264 | return; |
| 1262 | 1265 | ||
| 1266 | mutex_lock(&fsl_ac97_data->ac97_reg_lock); | ||
| 1267 | |||
| 1263 | ret = clk_prepare_enable(fsl_ac97_data->clk); | 1268 | ret = clk_prepare_enable(fsl_ac97_data->clk); |
| 1264 | if (ret) { | 1269 | if (ret) { |
| 1265 | pr_err("ac97 write clk_prepare_enable failed: %d\n", | 1270 | pr_err("ac97 write clk_prepare_enable failed: %d\n", |
| 1266 | ret); | 1271 | ret); |
| 1267 | return; | 1272 | goto ret_unlock; |
| 1268 | } | 1273 | } |
| 1269 | 1274 | ||
| 1270 | lreg = reg << 12; | 1275 | lreg = reg << 12; |
| @@ -1278,6 +1283,9 @@ static void fsl_ssi_ac97_write(struct snd_ac97 *ac97, unsigned short reg, | |||
| 1278 | udelay(100); | 1283 | udelay(100); |
| 1279 | 1284 | ||
| 1280 | clk_disable_unprepare(fsl_ac97_data->clk); | 1285 | clk_disable_unprepare(fsl_ac97_data->clk); |
| 1286 | |||
| 1287 | ret_unlock: | ||
| 1288 | mutex_unlock(&fsl_ac97_data->ac97_reg_lock); | ||
| 1281 | } | 1289 | } |
| 1282 | 1290 | ||
| 1283 | static unsigned short fsl_ssi_ac97_read(struct snd_ac97 *ac97, | 1291 | static unsigned short fsl_ssi_ac97_read(struct snd_ac97 *ac97, |
| @@ -1285,16 +1293,18 @@ static unsigned short fsl_ssi_ac97_read(struct snd_ac97 *ac97, | |||
| 1285 | { | 1293 | { |
| 1286 | struct regmap *regs = fsl_ac97_data->regs; | 1294 | struct regmap *regs = fsl_ac97_data->regs; |
| 1287 | 1295 | ||
| 1288 | unsigned short val = -1; | 1296 | unsigned short val = 0; |
| 1289 | u32 reg_val; | 1297 | u32 reg_val; |
| 1290 | unsigned int lreg; | 1298 | unsigned int lreg; |
| 1291 | int ret; | 1299 | int ret; |
| 1292 | 1300 | ||
| 1301 | mutex_lock(&fsl_ac97_data->ac97_reg_lock); | ||
| 1302 | |||
| 1293 | ret = clk_prepare_enable(fsl_ac97_data->clk); | 1303 | ret = clk_prepare_enable(fsl_ac97_data->clk); |
| 1294 | if (ret) { | 1304 | if (ret) { |
| 1295 | pr_err("ac97 read clk_prepare_enable failed: %d\n", | 1305 | pr_err("ac97 read clk_prepare_enable failed: %d\n", |
| 1296 | ret); | 1306 | ret); |
| 1297 | return -1; | 1307 | goto ret_unlock; |
| 1298 | } | 1308 | } |
| 1299 | 1309 | ||
| 1300 | lreg = (reg & 0x7f) << 12; | 1310 | lreg = (reg & 0x7f) << 12; |
| @@ -1309,6 +1319,8 @@ static unsigned short fsl_ssi_ac97_read(struct snd_ac97 *ac97, | |||
| 1309 | 1319 | ||
| 1310 | clk_disable_unprepare(fsl_ac97_data->clk); | 1320 | clk_disable_unprepare(fsl_ac97_data->clk); |
| 1311 | 1321 | ||
| 1322 | ret_unlock: | ||
| 1323 | mutex_unlock(&fsl_ac97_data->ac97_reg_lock); | ||
| 1312 | return val; | 1324 | return val; |
| 1313 | } | 1325 | } |
| 1314 | 1326 | ||
| @@ -1458,12 +1470,6 @@ static int fsl_ssi_probe(struct platform_device *pdev) | |||
| 1458 | sizeof(fsl_ssi_ac97_dai)); | 1470 | sizeof(fsl_ssi_ac97_dai)); |
| 1459 | 1471 | ||
| 1460 | fsl_ac97_data = ssi_private; | 1472 | fsl_ac97_data = ssi_private; |
| 1461 | |||
| 1462 | ret = snd_soc_set_ac97_ops_of_reset(&fsl_ssi_ac97_ops, pdev); | ||
| 1463 | if (ret) { | ||
| 1464 | dev_err(&pdev->dev, "could not set AC'97 ops\n"); | ||
| 1465 | return ret; | ||
| 1466 | } | ||
| 1467 | } else { | 1473 | } else { |
| 1468 | /* Initialize this copy of the CPU DAI driver structure */ | 1474 | /* Initialize this copy of the CPU DAI driver structure */ |
| 1469 | memcpy(&ssi_private->cpu_dai_drv, &fsl_ssi_dai_template, | 1475 | memcpy(&ssi_private->cpu_dai_drv, &fsl_ssi_dai_template, |
| @@ -1574,6 +1580,15 @@ static int fsl_ssi_probe(struct platform_device *pdev) | |||
| 1574 | return ret; | 1580 | return ret; |
| 1575 | } | 1581 | } |
| 1576 | 1582 | ||
| 1583 | if (fsl_ssi_is_ac97(ssi_private)) { | ||
| 1584 | mutex_init(&ssi_private->ac97_reg_lock); | ||
| 1585 | ret = snd_soc_set_ac97_ops_of_reset(&fsl_ssi_ac97_ops, pdev); | ||
| 1586 | if (ret) { | ||
| 1587 | dev_err(&pdev->dev, "could not set AC'97 ops\n"); | ||
| 1588 | goto error_ac97_ops; | ||
| 1589 | } | ||
| 1590 | } | ||
| 1591 | |||
| 1577 | ret = devm_snd_soc_register_component(&pdev->dev, &fsl_ssi_component, | 1592 | ret = devm_snd_soc_register_component(&pdev->dev, &fsl_ssi_component, |
| 1578 | &ssi_private->cpu_dai_drv, 1); | 1593 | &ssi_private->cpu_dai_drv, 1); |
| 1579 | if (ret) { | 1594 | if (ret) { |
| @@ -1657,6 +1672,13 @@ error_sound_card: | |||
| 1657 | fsl_ssi_debugfs_remove(&ssi_private->dbg_stats); | 1672 | fsl_ssi_debugfs_remove(&ssi_private->dbg_stats); |
| 1658 | 1673 | ||
| 1659 | error_asoc_register: | 1674 | error_asoc_register: |
| 1675 | if (fsl_ssi_is_ac97(ssi_private)) | ||
| 1676 | snd_soc_set_ac97_ops(NULL); | ||
| 1677 | |||
| 1678 | error_ac97_ops: | ||
| 1679 | if (fsl_ssi_is_ac97(ssi_private)) | ||
| 1680 | mutex_destroy(&ssi_private->ac97_reg_lock); | ||
| 1681 | |||
| 1660 | if (ssi_private->soc->imx) | 1682 | if (ssi_private->soc->imx) |
| 1661 | fsl_ssi_imx_clean(pdev, ssi_private); | 1683 | fsl_ssi_imx_clean(pdev, ssi_private); |
| 1662 | 1684 | ||
| @@ -1675,8 +1697,10 @@ static int fsl_ssi_remove(struct platform_device *pdev) | |||
| 1675 | if (ssi_private->soc->imx) | 1697 | if (ssi_private->soc->imx) |
| 1676 | fsl_ssi_imx_clean(pdev, ssi_private); | 1698 | fsl_ssi_imx_clean(pdev, ssi_private); |
| 1677 | 1699 | ||
| 1678 | if (fsl_ssi_is_ac97(ssi_private)) | 1700 | if (fsl_ssi_is_ac97(ssi_private)) { |
| 1679 | snd_soc_set_ac97_ops(NULL); | 1701 | snd_soc_set_ac97_ops(NULL); |
| 1702 | mutex_destroy(&ssi_private->ac97_reg_lock); | ||
| 1703 | } | ||
| 1680 | 1704 | ||
| 1681 | return 0; | 1705 | return 0; |
| 1682 | } | 1706 | } |
diff --git a/sound/soc/intel/boards/kbl_rt5663_max98927.c b/sound/soc/intel/boards/kbl_rt5663_max98927.c index 6f9a8bcf20f3..6dcad0a8a0d0 100644 --- a/sound/soc/intel/boards/kbl_rt5663_max98927.c +++ b/sound/soc/intel/boards/kbl_rt5663_max98927.c | |||
| @@ -101,7 +101,7 @@ static const struct snd_soc_dapm_route kabylake_map[] = { | |||
| 101 | { "ssp0 Tx", NULL, "spk_out" }, | 101 | { "ssp0 Tx", NULL, "spk_out" }, |
| 102 | 102 | ||
| 103 | { "AIF Playback", NULL, "ssp1 Tx" }, | 103 | { "AIF Playback", NULL, "ssp1 Tx" }, |
| 104 | { "ssp1 Tx", NULL, "hs_out" }, | 104 | { "ssp1 Tx", NULL, "codec1_out" }, |
| 105 | 105 | ||
| 106 | { "hs_in", NULL, "ssp1 Rx" }, | 106 | { "hs_in", NULL, "ssp1 Rx" }, |
| 107 | { "ssp1 Rx", NULL, "AIF Capture" }, | 107 | { "ssp1 Rx", NULL, "AIF Capture" }, |
diff --git a/sound/soc/intel/boards/kbl_rt5663_rt5514_max98927.c b/sound/soc/intel/boards/kbl_rt5663_rt5514_max98927.c index 6072164f2d43..271ae3c2c535 100644 --- a/sound/soc/intel/boards/kbl_rt5663_rt5514_max98927.c +++ b/sound/soc/intel/boards/kbl_rt5663_rt5514_max98927.c | |||
| @@ -109,7 +109,7 @@ static const struct snd_soc_dapm_route kabylake_map[] = { | |||
| 109 | { "ssp0 Tx", NULL, "spk_out" }, | 109 | { "ssp0 Tx", NULL, "spk_out" }, |
| 110 | 110 | ||
| 111 | { "AIF Playback", NULL, "ssp1 Tx" }, | 111 | { "AIF Playback", NULL, "ssp1 Tx" }, |
| 112 | { "ssp1 Tx", NULL, "hs_out" }, | 112 | { "ssp1 Tx", NULL, "codec1_out" }, |
| 113 | 113 | ||
| 114 | { "hs_in", NULL, "ssp1 Rx" }, | 114 | { "hs_in", NULL, "ssp1 Rx" }, |
| 115 | { "ssp1 Rx", NULL, "AIF Capture" }, | 115 | { "ssp1 Rx", NULL, "AIF Capture" }, |
diff --git a/sound/soc/intel/skylake/skl-nhlt.c b/sound/soc/intel/skylake/skl-nhlt.c index d14c50a60289..3eaac41090ca 100644 --- a/sound/soc/intel/skylake/skl-nhlt.c +++ b/sound/soc/intel/skylake/skl-nhlt.c | |||
| @@ -119,11 +119,16 @@ static bool skl_check_ep_match(struct device *dev, struct nhlt_endpoint *epnt, | |||
| 119 | 119 | ||
| 120 | if ((epnt->virtual_bus_id == instance_id) && | 120 | if ((epnt->virtual_bus_id == instance_id) && |
| 121 | (epnt->linktype == link_type) && | 121 | (epnt->linktype == link_type) && |
| 122 | (epnt->direction == dirn) && | 122 | (epnt->direction == dirn)) { |
| 123 | (epnt->device_type == dev_type)) | 123 | /* do not check dev_type for DMIC link type */ |
| 124 | return true; | 124 | if (epnt->linktype == NHLT_LINK_DMIC) |
| 125 | else | 125 | return true; |
| 126 | return false; | 126 | |
| 127 | if (epnt->device_type == dev_type) | ||
| 128 | return true; | ||
| 129 | } | ||
| 130 | |||
| 131 | return false; | ||
| 127 | } | 132 | } |
| 128 | 133 | ||
| 129 | struct nhlt_specific_cfg | 134 | struct nhlt_specific_cfg |
diff --git a/sound/soc/intel/skylake/skl-topology.c b/sound/soc/intel/skylake/skl-topology.c index a072bcf209d2..81923da18ac2 100644 --- a/sound/soc/intel/skylake/skl-topology.c +++ b/sound/soc/intel/skylake/skl-topology.c | |||
| @@ -2908,7 +2908,7 @@ static int skl_tplg_control_load(struct snd_soc_component *cmpnt, | |||
| 2908 | break; | 2908 | break; |
| 2909 | 2909 | ||
| 2910 | default: | 2910 | default: |
| 2911 | dev_warn(bus->dev, "Control load not supported %d:%d:%d\n", | 2911 | dev_dbg(bus->dev, "Control load not supported %d:%d:%d\n", |
| 2912 | hdr->ops.get, hdr->ops.put, hdr->ops.info); | 2912 | hdr->ops.get, hdr->ops.put, hdr->ops.info); |
| 2913 | break; | 2913 | break; |
| 2914 | } | 2914 | } |
diff --git a/sound/soc/rockchip/rockchip_spdif.c b/sound/soc/rockchip/rockchip_spdif.c index ee5055d47d13..a89fe9b6463b 100644 --- a/sound/soc/rockchip/rockchip_spdif.c +++ b/sound/soc/rockchip/rockchip_spdif.c | |||
| @@ -322,26 +322,30 @@ static int rk_spdif_probe(struct platform_device *pdev) | |||
| 322 | spdif->mclk = devm_clk_get(&pdev->dev, "mclk"); | 322 | spdif->mclk = devm_clk_get(&pdev->dev, "mclk"); |
| 323 | if (IS_ERR(spdif->mclk)) { | 323 | if (IS_ERR(spdif->mclk)) { |
| 324 | dev_err(&pdev->dev, "Can't retrieve rk_spdif master clock\n"); | 324 | dev_err(&pdev->dev, "Can't retrieve rk_spdif master clock\n"); |
| 325 | return PTR_ERR(spdif->mclk); | 325 | ret = PTR_ERR(spdif->mclk); |
| 326 | goto err_disable_hclk; | ||
| 326 | } | 327 | } |
| 327 | 328 | ||
| 328 | ret = clk_prepare_enable(spdif->mclk); | 329 | ret = clk_prepare_enable(spdif->mclk); |
| 329 | if (ret) { | 330 | if (ret) { |
| 330 | dev_err(spdif->dev, "clock enable failed %d\n", ret); | 331 | dev_err(spdif->dev, "clock enable failed %d\n", ret); |
| 331 | return ret; | 332 | goto err_disable_clocks; |
| 332 | } | 333 | } |
| 333 | 334 | ||
| 334 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 335 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
| 335 | regs = devm_ioremap_resource(&pdev->dev, res); | 336 | regs = devm_ioremap_resource(&pdev->dev, res); |
| 336 | if (IS_ERR(regs)) | 337 | if (IS_ERR(regs)) { |
| 337 | return PTR_ERR(regs); | 338 | ret = PTR_ERR(regs); |
| 339 | goto err_disable_clocks; | ||
| 340 | } | ||
| 338 | 341 | ||
| 339 | spdif->regmap = devm_regmap_init_mmio_clk(&pdev->dev, "hclk", regs, | 342 | spdif->regmap = devm_regmap_init_mmio_clk(&pdev->dev, "hclk", regs, |
| 340 | &rk_spdif_regmap_config); | 343 | &rk_spdif_regmap_config); |
| 341 | if (IS_ERR(spdif->regmap)) { | 344 | if (IS_ERR(spdif->regmap)) { |
| 342 | dev_err(&pdev->dev, | 345 | dev_err(&pdev->dev, |
| 343 | "Failed to initialise managed register map\n"); | 346 | "Failed to initialise managed register map\n"); |
| 344 | return PTR_ERR(spdif->regmap); | 347 | ret = PTR_ERR(spdif->regmap); |
| 348 | goto err_disable_clocks; | ||
| 345 | } | 349 | } |
| 346 | 350 | ||
| 347 | spdif->playback_dma_data.addr = res->start + SPDIF_SMPDR; | 351 | spdif->playback_dma_data.addr = res->start + SPDIF_SMPDR; |
| @@ -373,6 +377,10 @@ static int rk_spdif_probe(struct platform_device *pdev) | |||
| 373 | 377 | ||
| 374 | err_pm_runtime: | 378 | err_pm_runtime: |
| 375 | pm_runtime_disable(&pdev->dev); | 379 | pm_runtime_disable(&pdev->dev); |
| 380 | err_disable_clocks: | ||
| 381 | clk_disable_unprepare(spdif->mclk); | ||
| 382 | err_disable_hclk: | ||
| 383 | clk_disable_unprepare(spdif->hclk); | ||
| 376 | 384 | ||
| 377 | return ret; | 385 | return ret; |
| 378 | } | 386 | } |
diff --git a/sound/soc/sh/rcar/adg.c b/sound/soc/sh/rcar/adg.c index 8ddb08714faa..4672688cac32 100644 --- a/sound/soc/sh/rcar/adg.c +++ b/sound/soc/sh/rcar/adg.c | |||
| @@ -222,7 +222,7 @@ int rsnd_adg_set_cmd_timsel_gen2(struct rsnd_mod *cmd_mod, | |||
| 222 | NULL, &val, NULL); | 222 | NULL, &val, NULL); |
| 223 | 223 | ||
| 224 | val = val << shift; | 224 | val = val << shift; |
| 225 | mask = 0xffff << shift; | 225 | mask = 0x0f1f << shift; |
| 226 | 226 | ||
| 227 | rsnd_mod_bset(adg_mod, CMDOUT_TIMSEL, mask, val); | 227 | rsnd_mod_bset(adg_mod, CMDOUT_TIMSEL, mask, val); |
| 228 | 228 | ||
| @@ -250,7 +250,7 @@ int rsnd_adg_set_src_timesel_gen2(struct rsnd_mod *src_mod, | |||
| 250 | 250 | ||
| 251 | in = in << shift; | 251 | in = in << shift; |
| 252 | out = out << shift; | 252 | out = out << shift; |
| 253 | mask = 0xffff << shift; | 253 | mask = 0x0f1f << shift; |
| 254 | 254 | ||
| 255 | switch (id / 2) { | 255 | switch (id / 2) { |
| 256 | case 0: | 256 | case 0: |
| @@ -380,7 +380,7 @@ int rsnd_adg_ssi_clk_try_start(struct rsnd_mod *ssi_mod, unsigned int rate) | |||
| 380 | ckr = 0x80000000; | 380 | ckr = 0x80000000; |
| 381 | } | 381 | } |
| 382 | 382 | ||
| 383 | rsnd_mod_bset(adg_mod, BRGCKR, 0x80FF0000, adg->ckr | ckr); | 383 | rsnd_mod_bset(adg_mod, BRGCKR, 0x80770000, adg->ckr | ckr); |
| 384 | rsnd_mod_write(adg_mod, BRRA, adg->rbga); | 384 | rsnd_mod_write(adg_mod, BRRA, adg->rbga); |
| 385 | rsnd_mod_write(adg_mod, BRRB, adg->rbgb); | 385 | rsnd_mod_write(adg_mod, BRRB, adg->rbgb); |
| 386 | 386 | ||
diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c index c70eb2097816..f12a88a21dfa 100644 --- a/sound/soc/sh/rcar/core.c +++ b/sound/soc/sh/rcar/core.c | |||
| @@ -1332,8 +1332,8 @@ static int rsnd_pcm_new(struct snd_soc_pcm_runtime *rtd) | |||
| 1332 | 1332 | ||
| 1333 | return snd_pcm_lib_preallocate_pages_for_all( | 1333 | return snd_pcm_lib_preallocate_pages_for_all( |
| 1334 | rtd->pcm, | 1334 | rtd->pcm, |
| 1335 | SNDRV_DMA_TYPE_CONTINUOUS, | 1335 | SNDRV_DMA_TYPE_DEV, |
| 1336 | snd_dma_continuous_data(GFP_KERNEL), | 1336 | rtd->card->snd_card->dev, |
| 1337 | PREALLOC_BUFFER, PREALLOC_BUFFER_MAX); | 1337 | PREALLOC_BUFFER, PREALLOC_BUFFER_MAX); |
| 1338 | } | 1338 | } |
| 1339 | 1339 | ||
diff --git a/sound/soc/sh/rcar/dma.c b/sound/soc/sh/rcar/dma.c index fd557abfe390..4d750bdf8e24 100644 --- a/sound/soc/sh/rcar/dma.c +++ b/sound/soc/sh/rcar/dma.c | |||
| @@ -26,10 +26,7 @@ | |||
| 26 | struct rsnd_dmaen { | 26 | struct rsnd_dmaen { |
| 27 | struct dma_chan *chan; | 27 | struct dma_chan *chan; |
| 28 | dma_cookie_t cookie; | 28 | dma_cookie_t cookie; |
| 29 | dma_addr_t dma_buf; | ||
| 30 | unsigned int dma_len; | 29 | unsigned int dma_len; |
| 31 | unsigned int dma_period; | ||
| 32 | unsigned int dma_cnt; | ||
| 33 | }; | 30 | }; |
| 34 | 31 | ||
| 35 | struct rsnd_dmapp { | 32 | struct rsnd_dmapp { |
| @@ -71,38 +68,10 @@ static struct rsnd_mod mem = { | |||
| 71 | /* | 68 | /* |
| 72 | * Audio DMAC | 69 | * Audio DMAC |
| 73 | */ | 70 | */ |
| 74 | #define rsnd_dmaen_sync(dmaen, io, i) __rsnd_dmaen_sync(dmaen, io, i, 1) | ||
| 75 | #define rsnd_dmaen_unsync(dmaen, io, i) __rsnd_dmaen_sync(dmaen, io, i, 0) | ||
| 76 | static void __rsnd_dmaen_sync(struct rsnd_dmaen *dmaen, struct rsnd_dai_stream *io, | ||
| 77 | int i, int sync) | ||
| 78 | { | ||
| 79 | struct device *dev = dmaen->chan->device->dev; | ||
| 80 | enum dma_data_direction dir; | ||
| 81 | int is_play = rsnd_io_is_play(io); | ||
| 82 | dma_addr_t buf; | ||
| 83 | int len, max; | ||
| 84 | size_t period; | ||
| 85 | |||
| 86 | len = dmaen->dma_len; | ||
| 87 | period = dmaen->dma_period; | ||
| 88 | max = len / period; | ||
| 89 | i = i % max; | ||
| 90 | buf = dmaen->dma_buf + (period * i); | ||
| 91 | |||
| 92 | dir = is_play ? DMA_TO_DEVICE : DMA_FROM_DEVICE; | ||
| 93 | |||
| 94 | if (sync) | ||
| 95 | dma_sync_single_for_device(dev, buf, period, dir); | ||
| 96 | else | ||
| 97 | dma_sync_single_for_cpu(dev, buf, period, dir); | ||
| 98 | } | ||
| 99 | |||
| 100 | static void __rsnd_dmaen_complete(struct rsnd_mod *mod, | 71 | static void __rsnd_dmaen_complete(struct rsnd_mod *mod, |
| 101 | struct rsnd_dai_stream *io) | 72 | struct rsnd_dai_stream *io) |
| 102 | { | 73 | { |
| 103 | struct rsnd_priv *priv = rsnd_mod_to_priv(mod); | 74 | struct rsnd_priv *priv = rsnd_mod_to_priv(mod); |
| 104 | struct rsnd_dma *dma = rsnd_mod_to_dma(mod); | ||
| 105 | struct rsnd_dmaen *dmaen = rsnd_dma_to_dmaen(dma); | ||
| 106 | bool elapsed = false; | 75 | bool elapsed = false; |
| 107 | unsigned long flags; | 76 | unsigned long flags; |
| 108 | 77 | ||
| @@ -115,22 +84,9 @@ static void __rsnd_dmaen_complete(struct rsnd_mod *mod, | |||
| 115 | */ | 84 | */ |
| 116 | spin_lock_irqsave(&priv->lock, flags); | 85 | spin_lock_irqsave(&priv->lock, flags); |
| 117 | 86 | ||
| 118 | if (rsnd_io_is_working(io)) { | 87 | if (rsnd_io_is_working(io)) |
| 119 | rsnd_dmaen_unsync(dmaen, io, dmaen->dma_cnt); | ||
| 120 | |||
| 121 | /* | ||
| 122 | * Next period is already started. | ||
| 123 | * Let's sync Next Next period | ||
| 124 | * see | ||
| 125 | * rsnd_dmaen_start() | ||
| 126 | */ | ||
| 127 | rsnd_dmaen_sync(dmaen, io, dmaen->dma_cnt + 2); | ||
| 128 | |||
| 129 | elapsed = true; | 88 | elapsed = true; |
| 130 | 89 | ||
| 131 | dmaen->dma_cnt++; | ||
| 132 | } | ||
| 133 | |||
| 134 | spin_unlock_irqrestore(&priv->lock, flags); | 90 | spin_unlock_irqrestore(&priv->lock, flags); |
| 135 | 91 | ||
| 136 | if (elapsed) | 92 | if (elapsed) |
| @@ -165,14 +121,8 @@ static int rsnd_dmaen_stop(struct rsnd_mod *mod, | |||
| 165 | struct rsnd_dma *dma = rsnd_mod_to_dma(mod); | 121 | struct rsnd_dma *dma = rsnd_mod_to_dma(mod); |
| 166 | struct rsnd_dmaen *dmaen = rsnd_dma_to_dmaen(dma); | 122 | struct rsnd_dmaen *dmaen = rsnd_dma_to_dmaen(dma); |
| 167 | 123 | ||
| 168 | if (dmaen->chan) { | 124 | if (dmaen->chan) |
| 169 | int is_play = rsnd_io_is_play(io); | ||
| 170 | |||
| 171 | dmaengine_terminate_all(dmaen->chan); | 125 | dmaengine_terminate_all(dmaen->chan); |
| 172 | dma_unmap_single(dmaen->chan->device->dev, | ||
| 173 | dmaen->dma_buf, dmaen->dma_len, | ||
| 174 | is_play ? DMA_TO_DEVICE : DMA_FROM_DEVICE); | ||
| 175 | } | ||
| 176 | 126 | ||
| 177 | return 0; | 127 | return 0; |
| 178 | } | 128 | } |
| @@ -237,11 +187,7 @@ static int rsnd_dmaen_start(struct rsnd_mod *mod, | |||
| 237 | struct device *dev = rsnd_priv_to_dev(priv); | 187 | struct device *dev = rsnd_priv_to_dev(priv); |
| 238 | struct dma_async_tx_descriptor *desc; | 188 | struct dma_async_tx_descriptor *desc; |
| 239 | struct dma_slave_config cfg = {}; | 189 | struct dma_slave_config cfg = {}; |
| 240 | dma_addr_t buf; | ||
| 241 | size_t len; | ||
| 242 | size_t period; | ||
| 243 | int is_play = rsnd_io_is_play(io); | 190 | int is_play = rsnd_io_is_play(io); |
| 244 | int i; | ||
| 245 | int ret; | 191 | int ret; |
| 246 | 192 | ||
| 247 | cfg.direction = is_play ? DMA_MEM_TO_DEV : DMA_DEV_TO_MEM; | 193 | cfg.direction = is_play ? DMA_MEM_TO_DEV : DMA_DEV_TO_MEM; |
| @@ -258,19 +204,10 @@ static int rsnd_dmaen_start(struct rsnd_mod *mod, | |||
| 258 | if (ret < 0) | 204 | if (ret < 0) |
| 259 | return ret; | 205 | return ret; |
| 260 | 206 | ||
| 261 | len = snd_pcm_lib_buffer_bytes(substream); | ||
| 262 | period = snd_pcm_lib_period_bytes(substream); | ||
| 263 | buf = dma_map_single(dmaen->chan->device->dev, | ||
| 264 | substream->runtime->dma_area, | ||
| 265 | len, | ||
| 266 | is_play ? DMA_TO_DEVICE : DMA_FROM_DEVICE); | ||
| 267 | if (dma_mapping_error(dmaen->chan->device->dev, buf)) { | ||
| 268 | dev_err(dev, "dma map failed\n"); | ||
| 269 | return -EIO; | ||
| 270 | } | ||
| 271 | |||
| 272 | desc = dmaengine_prep_dma_cyclic(dmaen->chan, | 207 | desc = dmaengine_prep_dma_cyclic(dmaen->chan, |
| 273 | buf, len, period, | 208 | substream->runtime->dma_addr, |
| 209 | snd_pcm_lib_buffer_bytes(substream), | ||
| 210 | snd_pcm_lib_period_bytes(substream), | ||
| 274 | is_play ? DMA_MEM_TO_DEV : DMA_DEV_TO_MEM, | 211 | is_play ? DMA_MEM_TO_DEV : DMA_DEV_TO_MEM, |
| 275 | DMA_PREP_INTERRUPT | DMA_CTRL_ACK); | 212 | DMA_PREP_INTERRUPT | DMA_CTRL_ACK); |
| 276 | 213 | ||
| @@ -282,18 +219,7 @@ static int rsnd_dmaen_start(struct rsnd_mod *mod, | |||
| 282 | desc->callback = rsnd_dmaen_complete; | 219 | desc->callback = rsnd_dmaen_complete; |
| 283 | desc->callback_param = rsnd_mod_get(dma); | 220 | desc->callback_param = rsnd_mod_get(dma); |
| 284 | 221 | ||
| 285 | dmaen->dma_buf = buf; | 222 | dmaen->dma_len = snd_pcm_lib_buffer_bytes(substream); |
| 286 | dmaen->dma_len = len; | ||
| 287 | dmaen->dma_period = period; | ||
| 288 | dmaen->dma_cnt = 0; | ||
| 289 | |||
| 290 | /* | ||
| 291 | * synchronize this and next period | ||
| 292 | * see | ||
| 293 | * __rsnd_dmaen_complete() | ||
| 294 | */ | ||
| 295 | for (i = 0; i < 2; i++) | ||
| 296 | rsnd_dmaen_sync(dmaen, io, i); | ||
| 297 | 223 | ||
| 298 | dmaen->cookie = dmaengine_submit(desc); | 224 | dmaen->cookie = dmaengine_submit(desc); |
| 299 | if (dmaen->cookie < 0) { | 225 | if (dmaen->cookie < 0) { |
diff --git a/sound/soc/sh/rcar/ssi.c b/sound/soc/sh/rcar/ssi.c index fece1e5f582f..cbf3bf312d23 100644 --- a/sound/soc/sh/rcar/ssi.c +++ b/sound/soc/sh/rcar/ssi.c | |||
| @@ -446,25 +446,29 @@ static bool rsnd_ssi_pointer_update(struct rsnd_mod *mod, | |||
| 446 | int byte) | 446 | int byte) |
| 447 | { | 447 | { |
| 448 | struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod); | 448 | struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod); |
| 449 | bool ret = false; | ||
| 450 | int byte_pos; | ||
| 449 | 451 | ||
| 450 | ssi->byte_pos += byte; | 452 | byte_pos = ssi->byte_pos + byte; |
| 451 | 453 | ||
| 452 | if (ssi->byte_pos >= ssi->next_period_byte) { | 454 | if (byte_pos >= ssi->next_period_byte) { |
| 453 | struct snd_pcm_runtime *runtime = rsnd_io_to_runtime(io); | 455 | struct snd_pcm_runtime *runtime = rsnd_io_to_runtime(io); |
| 454 | 456 | ||
| 455 | ssi->period_pos++; | 457 | ssi->period_pos++; |
| 456 | ssi->next_period_byte += ssi->byte_per_period; | 458 | ssi->next_period_byte += ssi->byte_per_period; |
| 457 | 459 | ||
| 458 | if (ssi->period_pos >= runtime->periods) { | 460 | if (ssi->period_pos >= runtime->periods) { |
| 459 | ssi->byte_pos = 0; | 461 | byte_pos = 0; |
| 460 | ssi->period_pos = 0; | 462 | ssi->period_pos = 0; |
| 461 | ssi->next_period_byte = ssi->byte_per_period; | 463 | ssi->next_period_byte = ssi->byte_per_period; |
| 462 | } | 464 | } |
| 463 | 465 | ||
| 464 | return true; | 466 | ret = true; |
| 465 | } | 467 | } |
| 466 | 468 | ||
| 467 | return false; | 469 | WRITE_ONCE(ssi->byte_pos, byte_pos); |
| 470 | |||
| 471 | return ret; | ||
| 468 | } | 472 | } |
| 469 | 473 | ||
| 470 | /* | 474 | /* |
| @@ -838,7 +842,7 @@ static int rsnd_ssi_pointer(struct rsnd_mod *mod, | |||
| 838 | struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod); | 842 | struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod); |
| 839 | struct snd_pcm_runtime *runtime = rsnd_io_to_runtime(io); | 843 | struct snd_pcm_runtime *runtime = rsnd_io_to_runtime(io); |
| 840 | 844 | ||
| 841 | *pointer = bytes_to_frames(runtime, ssi->byte_pos); | 845 | *pointer = bytes_to_frames(runtime, READ_ONCE(ssi->byte_pos)); |
| 842 | 846 | ||
| 843 | return 0; | 847 | return 0; |
| 844 | } | 848 | } |
diff --git a/sound/soc/sh/rcar/ssiu.c b/sound/soc/sh/rcar/ssiu.c index 4d948757d300..6ff8a36c2c82 100644 --- a/sound/soc/sh/rcar/ssiu.c +++ b/sound/soc/sh/rcar/ssiu.c | |||
| @@ -125,6 +125,7 @@ static int rsnd_ssiu_init_gen2(struct rsnd_mod *mod, | |||
| 125 | { | 125 | { |
| 126 | int hdmi = rsnd_ssi_hdmi_port(io); | 126 | int hdmi = rsnd_ssi_hdmi_port(io); |
| 127 | int ret; | 127 | int ret; |
| 128 | u32 mode = 0; | ||
| 128 | 129 | ||
| 129 | ret = rsnd_ssiu_init(mod, io, priv); | 130 | ret = rsnd_ssiu_init(mod, io, priv); |
| 130 | if (ret < 0) | 131 | if (ret < 0) |
| @@ -136,9 +137,11 @@ static int rsnd_ssiu_init_gen2(struct rsnd_mod *mod, | |||
| 136 | * see | 137 | * see |
| 137 | * rsnd_ssi_config_init() | 138 | * rsnd_ssi_config_init() |
| 138 | */ | 139 | */ |
| 139 | rsnd_mod_write(mod, SSI_MODE, 0x1); | 140 | mode = 0x1; |
| 140 | } | 141 | } |
| 141 | 142 | ||
| 143 | rsnd_mod_write(mod, SSI_MODE, mode); | ||
| 144 | |||
| 142 | if (rsnd_ssi_use_busif(io)) { | 145 | if (rsnd_ssi_use_busif(io)) { |
| 143 | rsnd_mod_write(mod, SSI_BUSIF_ADINR, | 146 | rsnd_mod_write(mod, SSI_BUSIF_ADINR, |
| 144 | rsnd_get_adinr_bit(mod, io) | | 147 | rsnd_get_adinr_bit(mod, io) | |
diff --git a/tools/bpf/bpftool/map.c b/tools/bpf/bpftool/map.c index e2450c8e88e6..a8c3a33dd185 100644 --- a/tools/bpf/bpftool/map.c +++ b/tools/bpf/bpftool/map.c | |||
| @@ -523,21 +523,23 @@ static int do_show(int argc, char **argv) | |||
| 523 | break; | 523 | break; |
| 524 | p_err("can't get next map: %s%s", strerror(errno), | 524 | p_err("can't get next map: %s%s", strerror(errno), |
| 525 | errno == EINVAL ? " -- kernel too old?" : ""); | 525 | errno == EINVAL ? " -- kernel too old?" : ""); |
| 526 | return -1; | 526 | break; |
| 527 | } | 527 | } |
| 528 | 528 | ||
| 529 | fd = bpf_map_get_fd_by_id(id); | 529 | fd = bpf_map_get_fd_by_id(id); |
| 530 | if (fd < 0) { | 530 | if (fd < 0) { |
| 531 | if (errno == ENOENT) | ||
| 532 | continue; | ||
| 531 | p_err("can't get map by id (%u): %s", | 533 | p_err("can't get map by id (%u): %s", |
| 532 | id, strerror(errno)); | 534 | id, strerror(errno)); |
| 533 | return -1; | 535 | break; |
| 534 | } | 536 | } |
| 535 | 537 | ||
| 536 | err = bpf_obj_get_info_by_fd(fd, &info, &len); | 538 | err = bpf_obj_get_info_by_fd(fd, &info, &len); |
| 537 | if (err) { | 539 | if (err) { |
| 538 | p_err("can't get map info: %s", strerror(errno)); | 540 | p_err("can't get map info: %s", strerror(errno)); |
| 539 | close(fd); | 541 | close(fd); |
| 540 | return -1; | 542 | break; |
| 541 | } | 543 | } |
| 542 | 544 | ||
| 543 | if (json_output) | 545 | if (json_output) |
diff --git a/tools/bpf/bpftool/prog.c b/tools/bpf/bpftool/prog.c index ad619b96c276..dded77345bfb 100644 --- a/tools/bpf/bpftool/prog.c +++ b/tools/bpf/bpftool/prog.c | |||
| @@ -382,6 +382,8 @@ static int do_show(int argc, char **argv) | |||
| 382 | 382 | ||
| 383 | fd = bpf_prog_get_fd_by_id(id); | 383 | fd = bpf_prog_get_fd_by_id(id); |
| 384 | if (fd < 0) { | 384 | if (fd < 0) { |
| 385 | if (errno == ENOENT) | ||
| 386 | continue; | ||
| 385 | p_err("can't get prog by id (%u): %s", | 387 | p_err("can't get prog by id (%u): %s", |
| 386 | id, strerror(errno)); | 388 | id, strerror(errno)); |
| 387 | err = -1; | 389 | err = -1; |
diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile index 05fc4e2e7b3a..9316e648a880 100644 --- a/tools/testing/selftests/bpf/Makefile +++ b/tools/testing/selftests/bpf/Makefile | |||
| @@ -39,7 +39,7 @@ $(BPFOBJ): force | |||
| 39 | CLANG ?= clang | 39 | CLANG ?= clang |
| 40 | LLC ?= llc | 40 | LLC ?= llc |
| 41 | 41 | ||
| 42 | PROBE := $(shell llc -march=bpf -mcpu=probe -filetype=null /dev/null 2>&1) | 42 | PROBE := $(shell $(LLC) -march=bpf -mcpu=probe -filetype=null /dev/null 2>&1) |
| 43 | 43 | ||
| 44 | # Let newer LLVM versions transparently probe the kernel for availability | 44 | # Let newer LLVM versions transparently probe the kernel for availability |
| 45 | # of full BPF instruction set. | 45 | # of full BPF instruction set. |
