Commit c61529f6 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'driver-core-5.7-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core

Pull driver core fixes from Greg KH:
 "Here are a number of small driver core fixes for 5.7-rc5 to resolve a
  bunch of reported issues with the current tree.

  Biggest here are the reverts and patches from John Stultz to resolve a
  bunch of deferred probe regressions we have been seeing in 5.7-rc
  right now.

  Along with those are some other smaller fixes:

   - coredump crash fix

   - devlink fix for when permissive mode was enabled

   - amba and platform device dma_parms fixes

   - component error silenced for when deferred probe happens

  All of these have been in linux-next for a while with no reported
  issues"

* tag 'driver-core-5.7-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core:
  regulator: Revert "Use driver_deferred_probe_timeout for regulator_init_complete_work"
  driver core: Ensure wait_for_device_probe() waits until the deferred_probe_timeout fires
  driver core: Use dev_warn() instead of dev_WARN() for deferred_probe_timeout warnings
  driver core: Revert default driver_deferred_probe_timeout value to 0
  component: Silence bind error on -EPROBE_DEFER
  driver core: Fix handling of fw_devlink=permissive
  coredump: fix crash when umh is disabled
  amba: Initialize dma_parms for amba devices
  driver core: platform: Initialize dma_parms for platform devices
parents e7a1c733 2a15483b
...@@ -645,6 +645,7 @@ static void amba_device_initialize(struct amba_device *dev, const char *name) ...@@ -645,6 +645,7 @@ static void amba_device_initialize(struct amba_device *dev, const char *name)
dev->dev.release = amba_device_release; dev->dev.release = amba_device_release;
dev->dev.bus = &amba_bustype; dev->dev.bus = &amba_bustype;
dev->dev.dma_mask = &dev->dev.coherent_dma_mask; dev->dev.dma_mask = &dev->dev.coherent_dma_mask;
dev->dev.dma_parms = &dev->dma_parms;
dev->res.name = dev_name(&dev->dev); dev->res.name = dev_name(&dev->dev);
} }
......
...@@ -256,7 +256,8 @@ static int try_to_bring_up_master(struct master *master, ...@@ -256,7 +256,8 @@ static int try_to_bring_up_master(struct master *master,
ret = master->ops->bind(master->dev); ret = master->ops->bind(master->dev);
if (ret < 0) { if (ret < 0) {
devres_release_group(master->dev, NULL); devres_release_group(master->dev, NULL);
dev_info(master->dev, "master bind failed: %d\n", ret); if (ret != -EPROBE_DEFER)
dev_info(master->dev, "master bind failed: %d\n", ret);
return ret; return ret;
} }
...@@ -611,8 +612,9 @@ static int component_bind(struct component *component, struct master *master, ...@@ -611,8 +612,9 @@ static int component_bind(struct component *component, struct master *master,
devres_release_group(component->dev, NULL); devres_release_group(component->dev, NULL);
devres_release_group(master->dev, NULL); devres_release_group(master->dev, NULL);
dev_err(master->dev, "failed to bind %s (ops %ps): %d\n", if (ret != -EPROBE_DEFER)
dev_name(component->dev), component->ops, ret); dev_err(master->dev, "failed to bind %s (ops %ps): %d\n",
dev_name(component->dev), component->ops, ret);
} }
return ret; return ret;
......
...@@ -2370,6 +2370,11 @@ u32 fw_devlink_get_flags(void) ...@@ -2370,6 +2370,11 @@ u32 fw_devlink_get_flags(void)
return fw_devlink_flags; return fw_devlink_flags;
} }
static bool fw_devlink_is_permissive(void)
{
return fw_devlink_flags == DL_FLAG_SYNC_STATE_ONLY;
}
/** /**
* device_add - add device to device hierarchy. * device_add - add device to device hierarchy.
* @dev: device. * @dev: device.
...@@ -2524,7 +2529,7 @@ int device_add(struct device *dev) ...@@ -2524,7 +2529,7 @@ int device_add(struct device *dev)
if (fw_devlink_flags && is_fwnode_dev && if (fw_devlink_flags && is_fwnode_dev &&
fwnode_has_op(dev->fwnode, add_links)) { fwnode_has_op(dev->fwnode, add_links)) {
fw_ret = fwnode_call_int_op(dev->fwnode, add_links, dev); fw_ret = fwnode_call_int_op(dev->fwnode, add_links, dev);
if (fw_ret == -ENODEV) if (fw_ret == -ENODEV && !fw_devlink_is_permissive())
device_link_wait_for_mandatory_supplier(dev); device_link_wait_for_mandatory_supplier(dev);
else if (fw_ret) else if (fw_ret)
device_link_wait_for_optional_supplier(dev); device_link_wait_for_optional_supplier(dev);
......
...@@ -224,17 +224,9 @@ static int deferred_devs_show(struct seq_file *s, void *data) ...@@ -224,17 +224,9 @@ static int deferred_devs_show(struct seq_file *s, void *data)
} }
DEFINE_SHOW_ATTRIBUTE(deferred_devs); DEFINE_SHOW_ATTRIBUTE(deferred_devs);
#ifdef CONFIG_MODULES int driver_deferred_probe_timeout;
/*
* In the case of modules, set the default probe timeout to
* 30 seconds to give userland some time to load needed modules
*/
int driver_deferred_probe_timeout = 30;
#else
/* In the case of !modules, no probe timeout needed */
int driver_deferred_probe_timeout = -1;
#endif
EXPORT_SYMBOL_GPL(driver_deferred_probe_timeout); EXPORT_SYMBOL_GPL(driver_deferred_probe_timeout);
static DECLARE_WAIT_QUEUE_HEAD(probe_timeout_waitqueue);
static int __init deferred_probe_timeout_setup(char *str) static int __init deferred_probe_timeout_setup(char *str)
{ {
...@@ -266,8 +258,8 @@ int driver_deferred_probe_check_state(struct device *dev) ...@@ -266,8 +258,8 @@ int driver_deferred_probe_check_state(struct device *dev)
return -ENODEV; return -ENODEV;
} }
if (!driver_deferred_probe_timeout) { if (!driver_deferred_probe_timeout && initcalls_done) {
dev_WARN(dev, "deferred probe timeout, ignoring dependency"); dev_warn(dev, "deferred probe timeout, ignoring dependency");
return -ETIMEDOUT; return -ETIMEDOUT;
} }
...@@ -284,6 +276,7 @@ static void deferred_probe_timeout_work_func(struct work_struct *work) ...@@ -284,6 +276,7 @@ static void deferred_probe_timeout_work_func(struct work_struct *work)
list_for_each_entry_safe(private, p, &deferred_probe_pending_list, deferred_probe) list_for_each_entry_safe(private, p, &deferred_probe_pending_list, deferred_probe)
dev_info(private->device, "deferred probe pending"); dev_info(private->device, "deferred probe pending");
wake_up(&probe_timeout_waitqueue);
} }
static DECLARE_DELAYED_WORK(deferred_probe_timeout_work, deferred_probe_timeout_work_func); static DECLARE_DELAYED_WORK(deferred_probe_timeout_work, deferred_probe_timeout_work_func);
...@@ -658,6 +651,9 @@ int driver_probe_done(void) ...@@ -658,6 +651,9 @@ int driver_probe_done(void)
*/ */
void wait_for_device_probe(void) void wait_for_device_probe(void)
{ {
/* wait for probe timeout */
wait_event(probe_timeout_waitqueue, !driver_deferred_probe_timeout);
/* wait for the deferred probe workqueue to finish */ /* wait for the deferred probe workqueue to finish */
flush_work(&deferred_probe_work); flush_work(&deferred_probe_work);
......
...@@ -380,6 +380,8 @@ struct platform_object { ...@@ -380,6 +380,8 @@ struct platform_object {
*/ */
static void setup_pdev_dma_masks(struct platform_device *pdev) static void setup_pdev_dma_masks(struct platform_device *pdev)
{ {
pdev->dev.dma_parms = &pdev->dma_parms;
if (!pdev->dev.coherent_dma_mask) if (!pdev->dev.coherent_dma_mask)
pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32); pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
if (!pdev->dev.dma_mask) { if (!pdev->dev.dma_mask) {
......
...@@ -5754,10 +5754,6 @@ static DECLARE_DELAYED_WORK(regulator_init_complete_work, ...@@ -5754,10 +5754,6 @@ static DECLARE_DELAYED_WORK(regulator_init_complete_work,
static int __init regulator_init_complete(void) static int __init regulator_init_complete(void)
{ {
int delay = driver_deferred_probe_timeout;
if (delay < 0)
delay = 0;
/* /*
* Since DT doesn't provide an idiomatic mechanism for * Since DT doesn't provide an idiomatic mechanism for
* enabling full constraints and since it's much more natural * enabling full constraints and since it's much more natural
...@@ -5768,17 +5764,18 @@ static int __init regulator_init_complete(void) ...@@ -5768,17 +5764,18 @@ static int __init regulator_init_complete(void)
has_full_constraints = true; has_full_constraints = true;
/* /*
* If driver_deferred_probe_timeout is set, we punt * We punt completion for an arbitrary amount of time since
* completion for that many seconds since systems like * systems like distros will load many drivers from userspace
* distros will load many drivers from userspace so consumers * so consumers might not always be ready yet, this is
* might not always be ready yet, this is particularly an * particularly an issue with laptops where this might bounce
* issue with laptops where this might bounce the display off * the display off then on. Ideally we'd get a notification
* then on. Ideally we'd get a notification from userspace * from userspace when this happens but we don't so just wait
* when this happens but we don't so just wait a bit and hope * a bit and hope we waited long enough. It'd be better if
* we waited long enough. It'd be better if we'd only do * we'd only do this on systems that need it, and a kernel
* this on systems that need it. * command line option might be useful.
*/ */
schedule_delayed_work(&regulator_init_complete_work, delay * HZ); schedule_delayed_work(&regulator_init_complete_work,
msecs_to_jiffies(30000));
return 0; return 0;
} }
......
...@@ -788,6 +788,14 @@ void do_coredump(const kernel_siginfo_t *siginfo) ...@@ -788,6 +788,14 @@ void do_coredump(const kernel_siginfo_t *siginfo)
if (displaced) if (displaced)
put_files_struct(displaced); put_files_struct(displaced);
if (!dump_interrupted()) { if (!dump_interrupted()) {
/*
* umh disabled with CONFIG_STATIC_USERMODEHELPER_PATH="" would
* have this set to NULL.
*/
if (!cprm.file) {
pr_info("Core dump to |%s disabled\n", cn.corename);
goto close_fail;
}
file_start_write(cprm.file); file_start_write(cprm.file);
core_dumped = binfmt->core_dump(&cprm); core_dumped = binfmt->core_dump(&cprm);
file_end_write(cprm.file); file_end_write(cprm.file);
......
...@@ -65,6 +65,7 @@ struct amba_device { ...@@ -65,6 +65,7 @@ struct amba_device {
struct device dev; struct device dev;
struct resource res; struct resource res;
struct clk *pclk; struct clk *pclk;
struct device_dma_parameters dma_parms;
unsigned int periphid; unsigned int periphid;
unsigned int cid; unsigned int cid;
struct amba_cs_uci_id uci; struct amba_cs_uci_id uci;
......
...@@ -25,6 +25,7 @@ struct platform_device { ...@@ -25,6 +25,7 @@ struct platform_device {
bool id_auto; bool id_auto;
struct device dev; struct device dev;
u64 platform_dma_mask; u64 platform_dma_mask;
struct device_dma_parameters dma_parms;
u32 num_resources; u32 num_resources;
struct resource *resource; struct resource *resource;
......
...@@ -544,6 +544,11 @@ EXPORT_SYMBOL_GPL(fork_usermode_blob); ...@@ -544,6 +544,11 @@ EXPORT_SYMBOL_GPL(fork_usermode_blob);
* Runs a user-space application. The application is started * Runs a user-space application. The application is started
* asynchronously if wait is not set, and runs as a child of system workqueues. * asynchronously if wait is not set, and runs as a child of system workqueues.
* (ie. it runs with full root capabilities and optimized affinity). * (ie. it runs with full root capabilities and optimized affinity).
*
* Note: successful return value does not guarantee the helper was called at
* all. You can't rely on sub_info->{init,cleanup} being called even for
* UMH_WAIT_* wait modes as STATIC_USERMODEHELPER_PATH="" turns all helpers
* into a successful no-op.
*/ */
int call_usermodehelper_exec(struct subprocess_info *sub_info, int wait) int call_usermodehelper_exec(struct subprocess_info *sub_info, int wait)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment