Make deferring probe forever optional
Subsystems (16)
Rob Herring
maintainerv2 cover Make deferring probe forever optional
This series came out of a discussion on the ARM boot-architecture list[1] about DT forwards and backwards compatibility issues. There are issues with newer DTs breaking on older, stable kernels. Some of these are difficult to solve, but cases of optional devices not having kernel support should be solvable.
I tested this on a RPi3 B with the pinctrl driver forced off. With this change, the MMC/SD and UART drivers can function without the pinctrl driver.
v2:
- Add a DT property for pinctrl to flag using defaults
- Add a debug timeout to stop deferring some number of seconds after initcalls are done (giving modules a chance to load)
- Split pinctrl support to its own patch
- WARN when we stop deferring probe for a device
- Add IOMMU support
- Add PM domain support
Rob
[1] https://lists.linaro.org/pipermail/boot-architecture/2018-April/000466.html
Rob Herring (8):
driver core: make deferring probe after init optional driver core: add a deferred probe timeout
dt-bindings: pinctrl: add a 'pinctrl-use-default' property
arm: dts: bcm283x: mark the UART pin muxing nodes with
pinctrl-use-default
pinctrl: optionally stop deferring probe at end of initcalls
iommu: Stop deferring probe at end of initcalls
iommu: Remove IOMMU_OF_DECLARE
PM / Domains: Stop deferring probe at the end of initcall
.../admin-guide/kernel-parameters.txt | 7 +++ .../bindings/pinctrl/pinctrl-bindings.txt | 6 +++ arch/arm/boot/dts/bcm283x.dtsi | 2 + drivers/base/dd.c | 43 +++++++++++++++++++ drivers/base/power/domain.c | 2 +- drivers/iommu/arm-smmu-v3.c | 2 - drivers/iommu/arm-smmu.c | 7 --- drivers/iommu/exynos-iommu.c | 2 - drivers/iommu/ipmmu-vmsa.c | 3 -- drivers/iommu/msm_iommu.c | 2 - drivers/iommu/of_iommu.c | 21 +-------- drivers/iommu/qcom_iommu.c | 2 - drivers/iommu/rockchip-iommu.c | 2 - drivers/pinctrl/devicetree.c | 14 ++++-- include/linux/device.h | 2 + include/linux/of_iommu.h | 4 -- 16 files changed, 73 insertions(+), 48 deletions(-)
--
2.17.0
Rob Herring
maintainerPATCH v2 1/8 driver core: make deferring probe after init optional
Deferred probe will currently wait forever on dependent devices to probe, but sometimes a driver will never exist. It's also not always critical for a driver to exist. Platforms can rely on default configuration from the bootloader or reset defaults for things such as pinctrl and power domains. This is often the case with initial platform support until various drivers get enabled. There's at least 2 scenarios where deferred probe can render a platform broken. Both involve using a DT which has more devices and dependencies than the kernel supports. The 1st case is a driver may be disabled in the kernel config. The 2nd case is the kernel version may simply not have the dependent driver. This can happen if using a newer DT (provided by firmware perhaps) with a stable kernel version.
Subsystems or drivers may opt-in to this behavior by calling driver_deferred_probe_check_init_done() instead of just returning -EPROBE_DEFER. They may use additional information from DT or kernel's config to decide whether to continue to defer probe or not.
--- drivers/base/dd.c | 17 +++++++++++++++++ include/linux/device.h | 2 ++ 2 files changed, 19 insertions(+)
drivers/base/dd.c +17 -0
@@ -226,6 +226,16 @@ void device_unblock_probing(void)driver_deferred_probe_trigger (); } +int driver_deferred_probe_check_init_done (struct device *dev,bool optional) +{ +if (optional && initcalls_done) { +dev_WARN (dev,"ignoring dependency for device, assuming no driver" ); +return -ENODEV ; + } + +return -EPROBE_DEFER ; +} +/** * deferred_probe_initcall() - Enable probing of deferred devices *
@@ -240,6 +250,13 @@ static int deferred_probe_initcall(void)/* Sort as many dependencies as possible before exiting initcalls */ flush_work (&deferred_probe_work); initcalls_done = true; + +/* +* Trigger deferred probe again, this time we won't defer anything +* that is optional +*/ +driver_deferred_probe_trigger (); +flush_work (&deferred_probe_work);return 0 ; }late_initcall (deferred_probe_initcall);
include/linux/device.h +2 -0
@@ -334,6 +334,8 @@ struct device *driver_find_device(struct device_driver *drv, struct device *start, void *data, int (*match)(struct device *dev, void *data)); +int driver_deferred_probe_check_init_done (struct device *dev,bool optional); +/** * struct subsys_interface - interfaces to device functions * @name: name of the device function
Signature · 1 line
2.17.0
Re: [PATCH v2 1/8] driver core: make deferring probe after init optional
Quoted 4 lines · Rob Herring
Subsystems or drivers may opt-in to this behavior by calling
driver_deferred_probe_check_init_done()instead of just returning -EPROBE_DEFER. They may use additional information from DT or kernel's config to decide whether to continue to defer probe or not.
Should userspace have some involvement in this decision? It knows if
it's got any intention of loading modules for example. Kernel config
checks might be good enough, though it's going to be a pain to work out
if the relevant driver is built as a module for example.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20180524/252c8b9e/attachment.sig>
Rob Herring
maintainerRe: [PATCH v2 1/8] driver core: make deferring probe after init optional
Quoted 11 lines · Mark Brown
Quoted 4 lines · Rob Herring
Subsystems or drivers may opt-in to this behavior by calling
driver_deferred_probe_check_init_done()instead of just returning -EPROBE_DEFER. They may use additional information from DT or kernel's config to decide whether to continue to defer probe or not.Should userspace have some involvement in this decision? It knows if it's got any intention of loading modules for example. Kernel config checks might be good enough, though it's going to be a pain to work out if the relevant driver is built as a module for example.
I looked into whether we could hook into uevents in some way. If we knew when all the coldplug events had been handled, that would be sufficient. But it doesn't look to me like we can tell when that happens with the uevent netlink socket. I think about the only thing we can tell is if userspace has opened a socket. I'm not all that familiar with how the whole sequence works, so other opinions on this would be helpful.
Also, for this to work with serial consoles, we have to make the decision before we get to userspace. I couldn't get systemd to create serial gettys either if we deferred later. There's some dependence on /dev/console, but I didn't get to the bottom of it.
Rob
Robin Murphy
reviewerRe: [PATCH v2 1/8] driver core: make deferring probe after init optional
In reply to Mark BrownQuoted 11 lines · Mark Brown
Quoted 4 lines · Rob Herring
Subsystems or drivers may opt-in to this behavior by calling
driver_deferred_probe_check_init_done()instead of just returning -EPROBE_DEFER. They may use additional information from DT or kernel's config to decide whether to continue to defer probe or not.Should userspace have some involvement in this decision? It knows if it's got any intention of loading modules for example. Kernel config checks might be good enough, though it's going to be a pain to work out if the relevant driver is built as a module for example.
Arguably userspace has some control over that already, as in many cases it can just unbind and reprobe the consumer driver after loading the provider driver (in my silly IOMMU-drivers-as-modules PoC a while ago I was delighted to find that it can really be that simple). It's a bit harder when the device is the primary console or root filesystem, but I think that's effectively just another variant of the "defer until a module is loaded" chicken-and-egg problem.
Robin.
Re: [PATCH v2 1/8] driver core: make deferring probe after init optional
In reply to Mark BrownQuoted 7 lines · Mark Brown
Quoted 4 lines · Rob Herring
Subsystems or drivers may opt-in to this behavior by calling
driver_deferred_probe_check_init_done()instead of just returning -EPROBE_DEFER. They may use additional information from DT or kernel's config to decide whether to continue to defer probe or not.
Quoted 5 lines
Should userspace have some involvement in this decision? It knows if it's got any intention of loading modules for example. Kernel config checks might be good enough, though it's going to be a pain to work out if the relevant driver is built as a module for example.
A parallel issue is that loading an overlay could provide the resource that will allow the deferred probe to complete. (That is, once we finish implementing the run time overlays feature.)
-Frank
Rob Herring
maintainerRe: [PATCH v2 1/8] driver core: make deferring probe after init optional
Quoted 14 lines · Frank Rowand
Quoted 7 lines · Mark Brown
Quoted 4 lines · Rob Herring
Subsystems or drivers may opt-in to this behavior by calling
driver_deferred_probe_check_init_done()instead of just returning -EPROBE_DEFER. They may use additional information from DT or kernel's config to decide whether to continue to defer probe or not.Quoted 5 lines
Should userspace have some involvement in this decision? It knows if it's got any intention of loading modules for example. Kernel config checks might be good enough, though it's going to be a pain to work out if the relevant driver is built as a module for example.
Quoted 3 lines
A parallel issue is that loading an overlay could provide the resource that will allow the deferred probe to complete. (That is, once we finish implementing the run time overlays feature.)
I'd like to see an actual example where that could happen. I agree you could craft it, but would it really be a valid partitioning? For example, SoC pinctrl, iommu, or power domains defined in an overlay would not be something valid to apply during kernel boot or after boot (though putting those into overlays is exactly what Alex wants to do).
Rob
Greg Kroah-Hartman
maintainerRe: [PATCH v2 1/8] driver core: make deferring probe after init optional
In reply to Rob HerringQuoted 29 lines · Rob Herring
Deferred probe will currently wait forever on dependent devices to probe, but sometimes a driver will never exist. It's also not always critical for a driver to exist. Platforms can rely on default configuration from the bootloader or reset defaults for things such as pinctrl and power domains. This is often the case with initial platform support until various drivers get enabled. There's at least 2 scenarios where deferred probe can render a platform broken. Both involve using a DT which has more devices and dependencies than the kernel supports. The 1st case is a driver may be disabled in the kernel config. The 2nd case is the kernel version may simply not have the dependent driver. This can happen if using a newer DT (provided by firmware perhaps) with a stable kernel version.
Subsystems or drivers may opt-in to this behavior by calling
driver_deferred_probe_check_init_done()instead of just returning -EPROBE_DEFER. They may use additional information from DT or kernel's config to decide whether to continue to defer probe or not.Cc Alexander Graf <[email protected]>Signed-off-by Rob Herring <[email protected]>--- drivers/base/dd.c | 17 +++++++++++++++++ include/linux/device.h | 2 ++ 2 files changed, 19 insertions(+)drivers/base/dd.c +0
-0
drivers/base/dd.c void device_unblock_probing(void) · line 232
Quoted 7 lines
drivers/base/dd.c +4
-0@@ -226,6 +226,16 @@ void device_unblock_probing(void)driver_deferred_probe_trigger (); } +int driver_deferred_probe_check_init_done (struct device *dev,bool optional) +{ +if (optional && initcalls_done) { +dev_WARN (dev,"ignoring dependency for device, assuming no driver" );
You really only need dev_warn(), here, right?
thanks,
greg k-h
Rob Herring
maintainerRe: [PATCH v2 1/8] driver core: make deferring probe after init optional
Quoted 33 lines · Greg Kroah-Hartman
Quoted 32 lines · Rob Herring
Deferred probe will currently wait forever on dependent devices to probe, but sometimes a driver will never exist. It's also not always critical for a driver to exist. Platforms can rely on default configuration from the bootloader or reset defaults for things such as pinctrl and power domains. This is often the case with initial platform support until various drivers get enabled. There's at least 2 scenarios where deferred probe can render a platform broken. Both involve using a DT which has more devices and dependencies than the kernel supports. The 1st case is a driver may be disabled in the kernel config. The 2nd case is the kernel version may simply not have the dependent driver. This can happen if using a newer DT (provided by firmware perhaps) with a stable kernel version.
Subsystems or drivers may opt-in to this behavior by calling
driver_deferred_probe_check_init_done()instead of just returning -EPROBE_DEFER. They may use additional information from DT or kernel's config to decide whether to continue to defer probe or not.Cc Alexander Graf <[email protected]>Signed-off-by Rob Herring <[email protected]>--- drivers/base/dd.c | 17 +++++++++++++++++ include/linux/device.h | 2 ++ 2 files changed, 19 insertions(+)drivers/base/dd.c +0
-0@@ -226,6 +226,16 @@ void device_unblock_probing(void)driver_deferred_probe_trigger (); }
Quoted 6 lines
drivers/base/dd.c void device_unblock_probing(void) · line 232
Quoted 4 lines
drivers/base/dd.c +4
-0+int driver_deferred_probe_check_init_done (struct device *dev,bool optional) +{ +if (optional && initcalls_done) { +dev_WARN (dev,"ignoring dependency for device, assuming no driver" );You really only need
dev_warn(), here, right?
No, the screaming is on purpose.
Bjorn had concerns about debugging/supporting subtle problems that could stem from this. Such as electrical settings not quite right that cause intermittent errors.
Rob
Greg Kroah-Hartman
maintainerRe: [PATCH v2 1/8] driver core: make deferring probe after init optional
In reply to Rob HerringQuoted 29 lines · Rob Herring
Deferred probe will currently wait forever on dependent devices to probe, but sometimes a driver will never exist. It's also not always critical for a driver to exist. Platforms can rely on default configuration from the bootloader or reset defaults for things such as pinctrl and power domains. This is often the case with initial platform support until various drivers get enabled. There's at least 2 scenarios where deferred probe can render a platform broken. Both involve using a DT which has more devices and dependencies than the kernel supports. The 1st case is a driver may be disabled in the kernel config. The 2nd case is the kernel version may simply not have the dependent driver. This can happen if using a newer DT (provided by firmware perhaps) with a stable kernel version.
Subsystems or drivers may opt-in to this behavior by calling
driver_deferred_probe_check_init_done()instead of just returning -EPROBE_DEFER. They may use additional information from DT or kernel's config to decide whether to continue to defer probe or not.Cc Alexander Graf <[email protected]>Signed-off-by Rob Herring <[email protected]>--- drivers/base/dd.c | 17 +++++++++++++++++ include/linux/device.h | 2 ++ 2 files changed, 19 insertions(+)drivers/base/dd.c +0
-0
drivers/base/dd.c void device_unblock_probing(void) · line 231
Quoted 6 lines
drivers/base/dd.c +3
-0@@ -226,6 +226,16 @@ void device_unblock_probing(void)driver_deferred_probe_trigger (); } +int driver_deferred_probe_check_init_done (struct device *dev,bool optional) +{ +if (optional && initcalls_done) {
Wait, what's the "optional" mess here?
The caller knows this value, so why do you need to even pass it in here?
And bool values that are not obvious are horrid. I had to go look this up when reading the later patches that just passed "true" in this variable as I had no idea what that meant.
So as-is, no, this isn't ok, sorry.
And at the least, this needs some kerneldoc to explain it :)
thanks,
greg k-h
Rob Herring
maintainerRe: [PATCH v2 1/8] driver core: make deferring probe after init optional
Quoted 33 lines · Greg Kroah-Hartman
Quoted 32 lines · Rob Herring
Deferred probe will currently wait forever on dependent devices to probe, but sometimes a driver will never exist. It's also not always critical for a driver to exist. Platforms can rely on default configuration from the bootloader or reset defaults for things such as pinctrl and power domains. This is often the case with initial platform support until various drivers get enabled. There's at least 2 scenarios where deferred probe can render a platform broken. Both involve using a DT which has more devices and dependencies than the kernel supports. The 1st case is a driver may be disabled in the kernel config. The 2nd case is the kernel version may simply not have the dependent driver. This can happen if using a newer DT (provided by firmware perhaps) with a stable kernel version.
Subsystems or drivers may opt-in to this behavior by calling
driver_deferred_probe_check_init_done()instead of just returning -EPROBE_DEFER. They may use additional information from DT or kernel's config to decide whether to continue to defer probe or not.Cc Alexander Graf <[email protected]>Signed-off-by Rob Herring <[email protected]>--- drivers/base/dd.c | 17 +++++++++++++++++ include/linux/device.h | 2 ++ 2 files changed, 19 insertions(+)drivers/base/dd.c +0
-0@@ -226,6 +226,16 @@ void device_unblock_probing(void)driver_deferred_probe_trigger (); }
Quoted 5 lines
drivers/base/dd.c void device_unblock_probing(void) · line 231
Quoted 3 lines
drivers/base/dd.c +3
-0+int driver_deferred_probe_check_init_done (struct device *dev,bool optional) +{ +if (optional && initcalls_done) {Wait, what's the "optional" mess here?
My intent was that subsystems just always call this function and never return EPROBE_DEFER themselves. Then the driver core can make decisions as to what to do (such as the timeout added in the next patch). Or it can print common error/debug messages. So optional is a hint to allow subsystems per device control.
Quoted 2 lines
The caller knows this value, so why do you need to even pass it in here?
Because regardless of the value, we always stop deferring when/if we hit the timeout and the caller doesn't know about the timeout. If we get rid of it, we'd need functions for both init done and for deferred timeout.
Quoted 3 lines
And bool values that are not obvious are horrid. I had to go look this up when reading the later patches that just passed "true" in this variable as I had no idea what that meant.
Perhaps inverting it and calling it "keep_deferring" would be better. However, the flag is ignored if we have timed out.
Quoted 4 lines
So as-is, no, this isn't ok, sorry.
And at the least, this needs some kerneldoc to explain it :)
That part is easy enough to fix.
Rob
Robin Murphy
reviewerRe: [PATCH v2 1/8] driver core: make deferring probe after init optional
Quoted 41 lines · Rob Herring
Quoted 33 lines · Greg Kroah-Hartman
Quoted 32 lines · Rob Herring
Deferred probe will currently wait forever on dependent devices to probe, but sometimes a driver will never exist. It's also not always critical for a driver to exist. Platforms can rely on default configuration from the bootloader or reset defaults for things such as pinctrl and power domains. This is often the case with initial platform support until various drivers get enabled. There's at least 2 scenarios where deferred probe can render a platform broken. Both involve using a DT which has more devices and dependencies than the kernel supports. The 1st case is a driver may be disabled in the kernel config. The 2nd case is the kernel version may simply not have the dependent driver. This can happen if using a newer DT (provided by firmware perhaps) with a stable kernel version.
Subsystems or drivers may opt-in to this behavior by calling
driver_deferred_probe_check_init_done()instead of just returning -EPROBE_DEFER. They may use additional information from DT or kernel's config to decide whether to continue to defer probe or not.Cc Alexander Graf <[email protected]>Signed-off-by Rob Herring <[email protected]>--- drivers/base/dd.c | 17 +++++++++++++++++ include/linux/device.h | 2 ++ 2 files changed, 19 insertions(+)drivers/base/dd.c +0
-0@@ -226,6 +226,16 @@ void device_unblock_probing(void)driver_deferred_probe_trigger (); }Quoted 5 lines
drivers/base/dd.c void device_unblock_probing(void) · line 231
Quoted 3 lines
drivers/base/dd.c +3
-0+int driver_deferred_probe_check_init_done (struct device *dev,bool optional) +{ +if (optional && initcalls_done) {Wait, what's the "optional" mess here?
Quoted 5 lines
My intent was that subsystems just always call this function and never return
EPROBE_DEFERthemselves. Then the driver core can make decisions as to what to do (such as the timeout added in the next patch). Or it can print common error/debug messages. So optional is a hint to allow subsystems per device control.
Maybe just driver_defer_probe() might be a more descriptive name? To me, calling "foo_check_x()" with a parameter that says "I don't actually care about x" is the really unintuitive bit.
Quoted 8 lines
Quoted 2 lines
The caller knows this value, so why do you need to even pass it in here?
Because regardless of the value, we always stop deferring when/if we hit the timeout and the caller doesn't know about the timeout. If we get rid of it, we'd need functions for both init done and for deferred timeout.
Quoted 6 lines
Quoted 3 lines
And bool values that are not obvious are horrid. I had to go look this up when reading the later patches that just passed "true" in this variable as I had no idea what that meant.
Perhaps inverting it and calling it "
keep_deferring" would be better. However, the flag is ignored if we have timed out.
Perhaps an enum (or bitmask of named flags) then? That would allow the most readability at callsites, plus it seems quite likely that we may want intermediate degrees of "deferral strictness" eventually.
Robin.
Quoted 9 lines
Quoted 4 lines
So as-is, no, this isn't ok, sorry.
And at the least, this needs some kerneldoc to explain it :)
That part is easy enough to fix.
Rob
Rob Herring
maintainerRe: [PATCH v2 1/8] driver core: make deferring probe after init optional
Quoted 61 lines · Robin Murphy
Quoted 53 lines · Rob Herring
Quoted 41 lines · Greg Kroah-Hartman
Quoted 39 lines · Rob Herring
Deferred probe will currently wait forever on dependent devices to probe,
but sometimes a driver will never exist. It's also not always critical for
a driver to exist. Platforms can rely on default configuration from the bootloader or reset defaults for things such as pinctrl and power domains.
This is often the case with initial platform support until various drivers
get enabled. There's at least 2 scenarios where deferred probe can render
a platform broken. Both involve using a DT which has more devices and dependencies than the kernel supports. The 1st case is a driver may be disabled in the kernel config. The 2nd case is the kernel version may simply not have the dependent driver. This can happen if using a newer DT
(provided by firmware perhaps) with a stable kernel version.Subsystems or drivers may opt-in to this behavior by calling
driver_deferred_probe_check_init_done()instead of just returning -EPROBE_DEFER. They may use additional information from DT or kernel's config to decide whether to continue to defer probe or not.Cc Alexander Graf <[email protected]>Signed-off-by Rob Herring <[email protected]>--- drivers/base/dd.c | 17 +++++++++++++++++ include/linux/device.h | 2 ++ 2 files changed, 19 insertions(+)drivers/base/dd.c +0
-0@@ -226,6 +226,16 @@ void device_unblock_probing(void)driver_deferred_probe_trigger (); }Quoted 7 lines
drivers/base/dd.c void device_unblock_probing(void) · line 231
Quoted 4 lines
drivers/base/dd.c +3
-0+int driver_deferred_probe_check_init_done (struct device *dev,bool optional) +{ +if (optional && initcalls_done) {Wait, what's the "optional" mess here?
Quoted 5 lines
My intent was that subsystems just always call this function and never return
EPROBE_DEFERthemselves. Then the driver core can make decisions as to what to do (such as the timeout added in the next patch). Or it can print common error/debug messages. So optional is a hint to allow subsystems per device control.
Quoted 3 lines
Maybe just
driver_defer_probe()might be a more descriptive name? To me, calling "foo_check_x()" with a parameter that says "I don't actually care about x" is the really unintuitive bit.
All the other (though static or internal to driver core) functions are prefixed driver_deferred_probe_* so I was trying to remain consistent there. You're right though, with the timeout it's not just whether initcalls are done. It's really "get the return value depending on the core's deferred probe state". So perhaps one of these:
driver_deferred_probe_get_return_val()driver_deferred_probe_handle_return()
The other option would be a more straight-forward functions that just returns a bool on whether to continue deferring and leave the return code handling to the caller:
if (driver_deferred_probe_enabled_for_builtin(dev))
return -EPROBE_DEFER;
else
return -ENODEV;
The pinctrl case would look like this:
builtin_only = of_property_read_bool(np_pctldev, "pinctrl-use-default"); if (builtin_only && driver_deferred_probe_enabled_for_builtin(dev))
return -EPROBE_DEFER;
else if (!builtin_only && driver_deferred_probe_enabled(dev))
return -EPROBE_DEFER;
else
return -ENODEV;
I still prefer the former, picking the bike shed color is easier with the latter.
Quoted 14 lines
Quoted 14 lines
Quoted 2 lines
The caller knows this value, so why do you need to even pass it in here?
Because regardless of the value, we always stop deferring when/if we hit the timeout and the caller doesn't know about the timeout. If we get rid of it, we'd need functions for both init done and for deferred timeout.
Quoted 3 lines
And bool values that are not obvious are horrid. I had to go look this up when reading the later patches that just passed "true" in this variable as I had no idea what that meant.
Quoted 7 lines
Quoted 2 lines
Perhaps inverting it and calling it "
keep_deferring" would be better. However, the flag is ignored if we have timed out.Perhaps an enum (or bitmask of named flags) then? That would allow the most readability at callsites, plus it seems quite likely that we may want intermediate degrees of "deferral strictness" eventually.
A bitmask is just 32 booleans stuffed into one parameter which I can guess Greg's opinion on.
I can't really think of other flags we might need here. If we added some userspace trigger saying module loading is done, I don't think we'd need that to be per caller.
Rob
Re: [PATCH v2 1/8] driver core: make deferring probe after init optional
In reply to Rob HerringQuoted 12 lines · Rob Herring
Deferred probe will currently wait forever on dependent devices to probe, but sometimes a driver will never exist. It's also not always critical for a driver to exist. Platforms can rely on default configuration from the bootloader or reset defaults for things such as pinctrl and power domains. This is often the case with initial platform support until various drivers get enabled. There's at least 2 scenarios where deferred probe can render a platform broken. Both involve using a DT which has more devices and dependencies than the kernel supports. The 1st case is a driver may be disabled in the kernel config. The 2nd case is the kernel version may simply not have the dependent driver. This can happen if using a newer DT (provided by firmware perhaps) with a stable kernel version.
Quoted 5 lines
Subsystems or drivers may opt-in to this behavior by calling
driver_deferred_probe_check_init_done()instead of just returning -EPROBE_DEFER. They may use additional information from DT or kernel's config to decide whether to continue to defer probe or not.
For builtin drivers this still looks reasonable.
But I would like to have an additional clarification here stating that drivers that might be targeted by this query must not be compiled as modules.
And I would prefer to see an ack from e.g. Arnd that arm-soc is okay that we drop "tristate" on drivers affected by this; e.g. if we put this in the pinctrl core then all pinctrl drivers should be "bool" and so should any i2c, ssbi and spmi buses and drivers be.
Regards,
Bjorn
Quoted 58 lines
Cc Alexander Graf <[email protected]>Signed-off-by Rob Herring <[email protected]>--- drivers/base/dd.c | 17 +++++++++++++++++ include/linux/device.h | 2 ++ 2 files changed, 19 insertions(+)drivers/base/dd.c +17
-0@@ -226,6 +226,16 @@ void device_unblock_probing(void)driver_deferred_probe_trigger (); } +int driver_deferred_probe_check_init_done (struct device *dev,bool optional) +{ +if (optional && initcalls_done) { +dev_WARN (dev,"ignoring dependency for device, assuming no driver" ); +return -ENODEV ; + } + +return -EPROBE_DEFER ; +} +/** * deferred_probe_initcall() - Enable probing of deferred devices * @@ -240,6 +250,13 @@ static int deferred_probe_initcall(void)/* Sort as many dependencies as possible before exiting initcalls */ flush_work (&deferred_probe_work); initcalls_done = true; + +/* +* Trigger deferred probe again, this time we won't defer anything +* that is optional +*/ +driver_deferred_probe_trigger (); +flush_work (&deferred_probe_work);return 0 ; }late_initcall (deferred_probe_initcall);include/linux/device.h +2
-0@@ -334,6 +334,8 @@ struct device *driver_find_device(struct device_driver *drv, struct device *start, void *data, int (*match)(struct device *dev, void *data)); +int driver_deferred_probe_check_init_done (struct device *dev,bool optional); +/** * struct subsys_interface - interfaces to device functions * @name: name of the device function Signature · 1 line
2.17.0
Rob Herring
maintainerRe: [PATCH v2 1/8] driver core: make deferring probe after init optional
Quoted 22 lines · Bjorn Andersson
Quoted 12 lines · Rob Herring
Deferred probe will currently wait forever on dependent devices to probe, but sometimes a driver will never exist. It's also not always critical for a driver to exist. Platforms can rely on default configuration from the bootloader or reset defaults for things such as pinctrl and power domains. This is often the case with initial platform support until various drivers get enabled. There's at least 2 scenarios where deferred probe can render a platform broken. Both involve using a DT which has more devices and dependencies than the kernel supports. The 1st case is a driver may be disabled in the kernel config. The 2nd case is the kernel version may simply not have the dependent driver. This can happen if using a newer DT (provided by firmware perhaps) with a stable kernel version.
Quoted 5 lines
Subsystems or drivers may opt-in to this behavior by calling
driver_deferred_probe_check_init_done()instead of just returning -EPROBE_DEFER. They may use additional information from DT or kernel's config to decide whether to continue to defer probe or not.For builtin drivers this still looks reasonable.
Quoted 8 lines
But I would like to have an additional clarification here stating that drivers that might be targeted by this query must not be compiled as modules.
And I would prefer to see an ack from e.g. Arnd that arm-soc is okay that we drop "tristate" on drivers affected by this; e.g. if we put this in the pinctrl core then all pinctrl drivers should be "bool" and so should any i2c, ssbi and spmi buses and drivers be.
For pinctrl, you are not affected now unless you change your DT. I made pinctrl opt-in since as you said it could lead to some intermittent problems. If iommu or power domains are required, then it should fail pretty hard.
However, good luck getting your serial console to work if it has a pinctrl dependency and that's a module. It won't work because the console has to be up before userspace. Of course, you can just rely on earlycon, but that just proves that pinctrl is not required (at least for 1 serial pin). :)
Rob
Quoted 62 lines
Regards,
BjornQuoted 58 lines
Cc Alexander Graf <[email protected]>Signed-off-by Rob Herring <[email protected]>--- drivers/base/dd.c | 17 +++++++++++++++++ include/linux/device.h | 2 ++ 2 files changed, 19 insertions(+)drivers/base/dd.c +17
-0@@ -226,6 +226,16 @@ void device_unblock_probing(void)driver_deferred_probe_trigger (); } +int driver_deferred_probe_check_init_done (struct device *dev,bool optional) +{ +if (optional && initcalls_done) { +dev_WARN (dev,"ignoring dependency for device, assuming no driver" ); +return -ENODEV ; + } + +return -EPROBE_DEFER ; +} +/** * deferred_probe_initcall() - Enable probing of deferred devices * @@ -240,6 +250,13 @@ static int deferred_probe_initcall(void)/* Sort as many dependencies as possible before exiting initcalls */ flush_work (&deferred_probe_work); initcalls_done = true; + +/* +* Trigger deferred probe again, this time we won't defer anything +* that is optional +*/ +driver_deferred_probe_trigger (); +flush_work (&deferred_probe_work);return 0 ; }late_initcall (deferred_probe_initcall);include/linux/device.h +2
-1@@ -334,6 +334,8 @@ struct device *driver_find_device(struct device_driver *drv, struct device *start, void *data, int (*match)(struct device *dev, void *data)); +int driver_deferred_probe_check_init_done (struct device *dev,bool optional); +/** * struct subsys_interface - interfaces to device functions * @name: name of the device function -- 2.17.0
Rob Herring
maintainerPATCH v2 2/8 driver core: add a deferred probe timeout
In reply to Rob HerringDeferring probe can wait forever on dependencies that may never appear for a variety of reasons. This can be difficult to debug especially if the console has dependencies or userspace fails to boot to a shell. Add a timeout to retry probing without possibly optional dependencies and to dump out the deferred probe pending list after retrying.
This mechanism is intended for debug purposes. It won't work for the console which needs to be enabled before userspace starts. However, if the console's dependencies are resolved, then the kernel log will be printed (as opposed to no output).
--- .../admin-guide/kernel-parameters.txt | 7 +++++ drivers/base/dd.c | 28 ++++++++++++++++++- 2 files changed, 34 insertions(+), 1 deletion(-)
Documentation/admin-guide/kernel-parameters.txt +7 -0
@@ -809,6 +809,13 @@ Defaults to the default architecture's huge page size if not specified. + deferred_probe_timeout= + [KNL] Set a timeout in seconds for deferred probe to + give up waiting on dependencies to probe. Only specific + dependencies (subsystems or drivers) that have opted in + will be ignored. This option also dumps out devices + still on the deferred probe list after retrying. + dhash_entries= [KNL] Set number of hash buckets for dentry cache.
drivers/base/dd.c +27 -1
@@ -226,9 +226,17 @@ void device_unblock_probing(void)driver_deferred_probe_trigger (); } +static int deferred_probe_timeout =-1 ; +static int __init deferred_probe_timeout_setup (char *str) +{ + deferred_probe_timeout =simple_strtol (str,NULL ,0 ); +return 1 ; +} +__setup ("deferred_probe_timeout=" , deferred_probe_timeout_setup); +int driver_deferred_probe_check_init_done (struct device *dev,bool optional) { -if (optional && initcalls_done) { +if ((optional || !deferred_probe_timeout) && initcalls_done) {dev_WARN (dev,"ignoring dependency for device, assuming no driver" );return -ENODEV ; }
@@ -236,6 +244,19 @@ int driver_deferred_probe_check_init_done(struct device *dev, bool optional)return -EPROBE_DEFER ; } +static void deferred_probe_timeout_work_func (struct work_struct *work) +{ +struct device_private *private, *p; + + deferred_probe_timeout =0 ; +driver_deferred_probe_trigger (); +flush_work (&deferred_probe_work); + +list_for_each_entry_safe (private, p, &deferred_probe_pending_list, deferred_probe) +dev_info (private->device,"deferred probe pending" ); +} +static DECLARE_DELAYED_WORK(deferred_probe_timeout_work, deferred_probe_timeout_work_func); +/** * deferred_probe_initcall() - Enable probing of deferred devices *
@@ -257,6 +278,11 @@ static int deferred_probe_initcall(void)*/ driver_deferred_probe_trigger ();flush_work (&deferred_probe_work); + +if (deferred_probe_timeout >0 ) { +schedule_delayed_work (&deferred_probe_timeout_work, + deferred_probe_timeout *HZ ); + }return 0 ; }late_initcall (deferred_probe_initcall);
Signature · 1 line
2.17.0
Greg Kroah-Hartman
maintainerRe: [PATCH v2 2/8] driver core: add a deferred probe timeout
Quoted 22 lines · Rob Herring
Deferring probe can wait forever on dependencies that may never appear for a variety of reasons. This can be difficult to debug especially if the console has dependencies or userspace fails to boot to a shell. Add a timeout to retry probing without possibly optional dependencies and to dump out the deferred probe pending list after retrying.
This mechanism is intended for debug purposes. It won't work for the console which needs to be enabled before userspace starts. However, if the console's dependencies are resolved, then the kernel log will be printed (as opposed to no output).
Signed-off-by Rob Herring <[email protected]>--- .../admin-guide/kernel-parameters.txt | 7 +++++ drivers/base/dd.c | 28 ++++++++++++++++++- 2 files changed, 34 insertions(+), 1 deletion(-)Documentation/admin-guide/kernel-parameters.txt +0
-0
Documentation/admin-guide/kernel-parameters.txt line 817
Quoted 9 lines
Documentation/admin-guide/kernel-parameters.txt +6
-0@@ -809,6 +809,13 @@ Defaults to the default architecture's huge page size if not specified. + deferred_probe_timeout= + [KNL] Set a timeout in seconds for deferred probe to + give up waiting on dependencies to probe. Only specific + dependencies (subsystems or drivers) that have opted in + will be ignored. This option also dumps out devices + still on the deferred probe list after retrying.
Doesn't sound like a debugging-only option. I can see devices enabling this when they figure out that's the only way their platform can boot :)
thanks,
greg k-h
Rob Herring
maintainerRe: [PATCH v2 2/8] driver core: add a deferred probe timeout
Quoted 26 lines · Greg Kroah-Hartman
Quoted 25 lines · Rob Herring
Deferring probe can wait forever on dependencies that may never appear for a variety of reasons. This can be difficult to debug especially if the console has dependencies or userspace fails to boot to a shell. Add a timeout to retry probing without possibly optional dependencies and to dump out the deferred probe pending list after retrying.
This mechanism is intended for debug purposes. It won't work for the console which needs to be enabled before userspace starts. However, if the console's dependencies are resolved, then the kernel log will be printed (as opposed to no output).
Signed-off-by Rob Herring <[email protected]>--- .../admin-guide/kernel-parameters.txt | 7 +++++ drivers/base/dd.c | 28 ++++++++++++++++++- 2 files changed, 34 insertions(+), 1 deletion(-)Documentation/admin-guide/kernel-parameters.txt +0
-0@@ -809,6 +809,13 @@ Defaults to the default architecture's huge page size if not specified.
Quoted 9 lines
Documentation/admin-guide/kernel-parameters.txt line 817
Quoted 6 lines
Documentation/admin-guide/kernel-parameters.txt +6
-0+ deferred_probe_timeout= + [KNL] Set a timeout in seconds for deferred probe to + give up waiting on dependencies to probe. Only specific + dependencies (subsystems or drivers) that have opted in + will be ignored. This option also dumps out devices + still on the deferred probe list after retrying.Doesn't sound like a debugging-only option. I can see devices enabling this when they figure out that's the only way their platform can boot :)
Here's some rope...
No doubt it can be abused. So are you saying don't call it a debug option or hide it behind a config option? And for the latter, what's one that distros don't just turn on?
Rob
Greg Kroah-Hartman
maintainerRe: [PATCH v2 2/8] driver core: add a deferred probe timeout
Quoted 38 lines · Rob Herring
Quoted 26 lines · Greg Kroah-Hartman
Quoted 25 lines · Rob Herring
Deferring probe can wait forever on dependencies that may never appear for a variety of reasons. This can be difficult to debug especially if the console has dependencies or userspace fails to boot to a shell. Add a timeout to retry probing without possibly optional dependencies and to dump out the deferred probe pending list after retrying.
This mechanism is intended for debug purposes. It won't work for the console which needs to be enabled before userspace starts. However, if the console's dependencies are resolved, then the kernel log will be printed (as opposed to no output).
Signed-off-by Rob Herring <[email protected]>--- .../admin-guide/kernel-parameters.txt | 7 +++++ drivers/base/dd.c | 28 ++++++++++++++++++- 2 files changed, 34 insertions(+), 1 deletion(-)Documentation/admin-guide/kernel-parameters.txt +0
-0@@ -809,6 +809,13 @@ Defaults to the default architecture's huge page size if not specified.Quoted 9 lines
Documentation/admin-guide/kernel-parameters.txt line 817
Quoted 6 lines
Documentation/admin-guide/kernel-parameters.txt +6
-0+ deferred_probe_timeout= + [KNL] Set a timeout in seconds for deferred probe to + give up waiting on dependencies to probe. Only specific + dependencies (subsystems or drivers) that have opted in + will be ignored. This option also dumps out devices + still on the deferred probe list after retrying.Doesn't sound like a debugging-only option. I can see devices enabling this when they figure out that's the only way their platform can boot :)
Quoted 5 lines
Here's some rope...
No doubt it can be abused. So are you saying don't call it a debug option or hide it behind a config option? And for the latter, what's one that distros don't just turn on?
If it is a debug option, make it obvious it's only for debugging. The commit log here says it's a debug option, but your documentation does not say that at all, and that's what people will read.
Well, they might read it, probably not. But at least give us something to point at when they mess things up :)
thanks,
greg k-h
Rob Herring
maintainerPATCH v2 3/8 dt-bindings: pinctrl: add a 'pinctrl-use-default' property
In reply to Rob HerringPin setup may be optional in some cases such as the reset default works or the pin setup is done by the bootloader. In these cases, it is optional for the OS to support managing the pin controller and pin setup. In order to support this scenario, add a property 'pinctrl-use-default' to indicate that the pin configuration is optional.
--- .../devicetree/bindings/pinctrl/pinctrl-bindings.txt | 6 ++++++ 1 file changed, 6 insertions(+)
Documentation/devicetree/bindings/pinctrl/pinctrl-bindings.txt +6 -0
@@ -103,6 +103,12 @@ Optional properties: #pinctrl-cells: Number of pin control cells in addition to the index within the pin controller device instance +pinctrl-use-default: Boolean. Indicates that the OS can use the boot default + pin configuration. This allows using an OS that does not have a + driver for the pin controller. This property can be set either + globally for the pin controller or in child nodes for individual + pin group control. + Pin controller devices should contain the pin configuration nodes that client devices reference.
Signature · 1 line
2.17.0
Rob Herring
maintainerPATCH v2 4/8 arm: dts: bcm283x: mark the UART pin muxing nodes with pinctrl-use-default
In reply to Rob Herring--- arch/arm/boot/dts/bcm283x.dtsi | 2 ++ 1 file changed, 2 insertions(+)
arch/arm/boot/dts/bcm283x.dtsi +2 -0
@@ -321,6 +321,7 @@ }; uart0_gpio14: uart0_gpio14 { + pinctrl-use-default; brcm,pins = <14 15>; brcm,function = <BCM2835_FSEL_ALT0>; };
@@ -353,6 +354,7 @@ }; uart1_gpio14: uart1_gpio14 { + pinctrl-use-default; brcm,pins = <14 15>; brcm,function = <BCM2835_FSEL_ALT5>; };
Signature · 1 line
2.17.0
Rob Herring
maintainerPATCH v2 5/8 pinctrl: optionally stop deferring probe at end of initcalls
In reply to Rob HerringIf the pinctrl node in DT indicates that pin setup is optional and the defaults can be used with the 'pinctrl-use-default', then only defer probe until initcalls are done. This gives platforms the option to work without their pinctrl driver being enabled.
--- drivers/pinctrl/devicetree.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
drivers/pinctrl/devicetree.c +10 -4
@@ -110,17 +110,23 @@ static int dt_to_map_one_config(struct pinctrl *p,int ret;struct pinctrl_map *map;unsigned num_maps; +bool pctl_optional = false;/* Find the pin controller containing np_config */ np_pctldev =of_node_get (np_config);for (;;) { +if (!pctl_optional) + pctl_optional =of_property_read_bool (np_pctldev,"pinctrl-use-default" ); + np_pctldev =of_get_next_parent (np_pctldev);if (!np_pctldev ||of_node_is_root (np_pctldev)) { -dev_info (p->dev,"could not find pctldev for node %pOF, deferring probe\n" , - np_config);of_node_put (np_pctldev); -/* OK let's just assume this will appear later then */ -return -EPROBE_DEFER ; + ret =driver_deferred_probe_check_init_done (p->dev, pctl_optional); +if (ret == -EPROBE_DEFER ) +/* OK let's just assume this will appear later then */ +dev_info (p->dev,"could not find pctldev for node %pOF, deferring probe\n" , + np_config); +return ret; }/* If we're creating a hog we can use the passed pctldev */ if (pctldev && (np_pctldev == p->dev->of_node))
Signature · 1 line
2.17.0
Re: [PATCH v2 5/8] pinctrl: optionally stop deferring probe at end of initcalls
Quoted 6 lines · Rob Herring
If the pinctrl node in DT indicates that pin setup is optional and the defaults can be used with the 'pinctrl-use-default', then only defer probe until initcalls are done. This gives platforms the option to work without their pinctrl driver being enabled.
Signed-off-by Rob Herring <[email protected]>
I trust that you know what you're doing so I guess
Yours,
Linus Walleij
Rob Herring
maintainerPATCH v2 6/8 iommu: Stop deferring probe at end of initcalls
In reply to Rob HerringThe IOMMU subsystem has its own mechanism to not defer probe if driver support is missing. Now that the driver core supports stopping deferring probe if drivers aren't built-in (and probed), use the driver core support so the IOMMU specific support can be removed.
--- drivers/iommu/of_iommu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iommu/of_iommu.c +1 -1
@@ -133,7 +133,7 @@ static int of_iommu_xlate(struct device *dev,* a proper probe-ordering dependency mechanism in future. */ if (!ops) -return -EPROBE_DEFER ; +return driver_deferred_probe_check_init_done (dev, true);return ops->of_xlate (dev, iommu_spec); }
Signature · 1 line
2.17.0
Rob Herring
maintainerPATCH v2 7/8 iommu: Remove IOMMU_OF_DECLARE
In reply to Rob HerringNow that we use the driver core to stop deferred probe for missing drivers, IOMMU_OF_DECLARE can be removed.
This is slightly less optimal than having a list of built-in drivers in that we'll now defer probe twice before giving up. This shouldn't have a significant impact on boot times as past discussions about deferred probe have given no evidence of deferred probe having a substantial impact.
--- drivers/iommu/arm-smmu-v3.c | 2 -- drivers/iommu/arm-smmu.c | 7 ------- drivers/iommu/exynos-iommu.c | 2 -- drivers/iommu/ipmmu-vmsa.c | 3 --- drivers/iommu/msm_iommu.c | 2 -- drivers/iommu/of_iommu.c | 19 +------------------ drivers/iommu/qcom_iommu.c | 2 -- drivers/iommu/rockchip-iommu.c | 2 -- include/linux/of_iommu.h | 4 ---- 9 files changed, 1 insertion(+), 42 deletions(-)
drivers/iommu/arm-smmu-v3.c +0 -2
@@ -2915,8 +2915,6 @@ static struct platform_driver arm_smmu_driver = { };module_platform_driver (arm_smmu_driver); -IOMMU_OF_DECLARE (arm_smmuv3,"arm,smmu-v3" ); -MODULE_DESCRIPTION ("IOMMU API for ARM architected SMMUv3 implementations" );MODULE_AUTHOR ("Will Deacon <[email protected]>" );MODULE_LICENSE ("GPL v2" );
drivers/iommu/arm-smmu.c +0 -7
@@ -2211,13 +2211,6 @@ static struct platform_driver arm_smmu_driver = { };module_platform_driver (arm_smmu_driver); -IOMMU_OF_DECLARE (arm_smmuv1,"arm,smmu-v1" ); -IOMMU_OF_DECLARE (arm_smmuv2,"arm,smmu-v2" ); -IOMMU_OF_DECLARE (arm_mmu400,"arm,mmu-400" ); -IOMMU_OF_DECLARE (arm_mmu401,"arm,mmu-401" ); -IOMMU_OF_DECLARE (arm_mmu500,"arm,mmu-500" ); -IOMMU_OF_DECLARE (cavium_smmuv2,"cavium,smmu-v2" ); -MODULE_DESCRIPTION ("IOMMU API for ARM architected SMMU implementations" );MODULE_AUTHOR ("Will Deacon <[email protected]>" );MODULE_LICENSE ("GPL v2" );
drivers/iommu/exynos-iommu.c +0 -2
@@ -1390,5 +1390,3 @@ static int __init exynos_iommu_init(void)return ret; }core_initcall (exynos_iommu_init); - -IOMMU_OF_DECLARE (exynos_iommu_of,"samsung,exynos-sysmmu" );
drivers/iommu/ipmmu-vmsa.c +0 -3
@@ -1108,9 +1108,6 @@ static void __exit ipmmu_exit(void)subsys_initcall (ipmmu_init);module_exit (ipmmu_exit); -IOMMU_OF_DECLARE (ipmmu_vmsa_iommu_of,"renesas,ipmmu-vmsa" ); -IOMMU_OF_DECLARE (ipmmu_r8a7795_iommu_of,"renesas,ipmmu-r8a7795" ); -MODULE_DESCRIPTION ("IOMMU API for Renesas VMSA-compatible IPMMU" );MODULE_AUTHOR ("Laurent Pinchart <[email protected]>" );MODULE_LICENSE ("GPL v2" );
drivers/iommu/msm_iommu.c +0 -2
@@ -877,7 +877,5 @@ static void __exit msm_iommu_driver_exit(void)subsys_initcall (msm_iommu_driver_init);module_exit (msm_iommu_driver_exit); -IOMMU_OF_DECLARE (msm_iommu_of,"qcom,apq8064-iommu" ); -MODULE_LICENSE ("GPL v2" );MODULE_AUTHOR ("Stepan Moskovchenko <[email protected]>" );
drivers/iommu/of_iommu.c +1 -18
@@ -27,9 +27,6 @@#define NO_IOMMU 1 -static const struct of_device_id __iommu_of_table_sentinel -__used __section (__iommu_of_table_end); -/** * of_get_dma_window - Parse *dma-window property and returns 0 if found. *
@@ -98,19 +95,6 @@ int of_get_dma_window(struct device_node *dn, const char *prefix, int index, }EXPORT_SYMBOL_GPL (of_get_dma_window); -static bool of_iommu_driver_present (struct device_node *np) -{ -/* -* If the IOMMU still isn't ready by the time we reach init, assume -* it never will be. We don't want to defer indefinitely, nor attempt -* to dereference __iommu_of_table after it's been freed. -*/ -if (system_state >=SYSTEM_RUNNING ) -return false; - -return of_match_node (&__iommu_of_table, np); -} -static int of_iommu_xlate (struct device *dev,struct of_phandle_args *iommu_spec) {
@@ -120,8 +104,7 @@ static int of_iommu_xlate(struct device *dev, ops =iommu_ops_from_fwnode (fwnode);if ((ops && !ops->of_xlate) || - !of_device_is_available (iommu_spec->np) || - (!ops && !of_iommu_driver_present (iommu_spec->np))) + !of_device_is_available (iommu_spec->np))return NO_IOMMU ; err =iommu_fwspec_init (dev, &iommu_spec->np->fwnode, ops);
drivers/iommu/qcom_iommu.c +0 -2
@@ -947,7 +947,5 @@ static void __exit qcom_iommu_exit(void)module_init (qcom_iommu_init);module_exit (qcom_iommu_exit); -IOMMU_OF_DECLARE (qcom_iommu_dev,"qcom,msm-iommu-v1" ); -MODULE_DESCRIPTION ("IOMMU API for QCOM IOMMU v1 implementations" );MODULE_LICENSE ("GPL v2" );
drivers/iommu/rockchip-iommu.c +0 -2
@@ -1284,8 +1284,6 @@ static int __init rk_iommu_init(void) }subsys_initcall (rk_iommu_init); -IOMMU_OF_DECLARE (rk_iommu_of,"rockchip,iommu" ); -MODULE_DESCRIPTION ("IOMMU API for Rockchip" );MODULE_AUTHOR ("Simon Xue <[email protected]> and Daniel Kurtz <[email protected]>" );MODULE_ALIAS ("platform:rockchip-iommu" );
include/linux/of_iommu.h +0 -4
@@ -32,8 +32,4 @@ static inline const struct iommu_ops *of_iommu_configure(struct device *dev,#endif /* CONFIG_OF_IOMMU */ -extern struct of_device_id __iommu_of_table; - -#define IOMMU_OF_DECLARE (name, compat) OF_DECLARE_1(iommu, name, compat, NULL) -#endif /* __OF_IOMMU_H */
Signature · 1 line
2.17.0
Re: [PATCH v2 7/8] iommu: Remove IOMMU_OF_DECLARE
Quoted 58 lines · Rob Herring
Now that we use the driver core to stop deferred probe for missing drivers,
IOMMU_OF_DECLAREcan be removed.This is slightly less optimal than having a list of built-in drivers in that we'll now defer probe twice before giving up. This shouldn't have a significant impact on boot times as past discussions about deferred probe have given no evidence of deferred probe having a substantial impact.
Cc Will Deacon <[email protected]>Cc Robin Murphy <[email protected]>Cc Joerg Roedel <[email protected]>Cc Marek Szyprowski <[email protected]>Cc Kukjin Kim <[email protected]>Cc Krzysztof Kozlowski <[email protected]>Cc Rob Clark <[email protected]>Cc Heiko Stuebner <[email protected]>Cc Frank Rowand <[email protected]>Signed-off-by Rob Herring <[email protected]>--- drivers/iommu/arm-smmu-v3.c | 2 -- drivers/iommu/arm-smmu.c | 7 ------- drivers/iommu/exynos-iommu.c | 2 -- drivers/iommu/ipmmu-vmsa.c | 3 --- drivers/iommu/msm_iommu.c | 2 -- drivers/iommu/of_iommu.c | 19 +------------------ drivers/iommu/qcom_iommu.c | 2 -- drivers/iommu/rockchip-iommu.c | 2 -- include/linux/of_iommu.h | 4 ---- 9 files changed, 1 insertion(+), 42 deletions(-)drivers/iommu/arm-smmu-v3.c +0
-2@@ -2915,8 +2915,6 @@ static struct platform_driver arm_smmu_driver = { };module_platform_driver (arm_smmu_driver); -IOMMU_OF_DECLARE (arm_smmuv3,"arm,smmu-v3" ); -MODULE_DESCRIPTION ("IOMMU API for ARM architected SMMUv3 implementations" );MODULE_AUTHOR ("Will Deacon <[email protected]>" );MODULE_LICENSE ("GPL v2" );drivers/iommu/arm-smmu.c +0
-0@@ -2211,13 +2211,6 @@ static struct platform_driver arm_smmu_driver = { };module_platform_driver (arm_smmu_driver);
drivers/iommu/arm-smmu.c static struct platform_driver arm_smmu_driver = { · line 2216
Quoted 10 lines
drivers/iommu/arm-smmu.c +0
-7-IOMMU_OF_DECLARE (arm_smmuv1,"arm,smmu-v1" ); -IOMMU_OF_DECLARE (arm_smmuv2,"arm,smmu-v2" ); -IOMMU_OF_DECLARE (arm_mmu400,"arm,mmu-400" ); -IOMMU_OF_DECLARE (arm_mmu401,"arm,mmu-401" ); -IOMMU_OF_DECLARE (arm_mmu500,"arm,mmu-500" ); -IOMMU_OF_DECLARE (cavium_smmuv2,"cavium,smmu-v2" ); -MODULE_DESCRIPTION ("IOMMU API for ARM architected SMMU implementations" );MODULE_AUTHOR ("Will Deacon <[email protected]>" );MODULE_LICENSE ("GPL v2" );
For the SMMU drivers:
Will
Re: [PATCH v2 7/8] iommu: Remove IOMMU_OF_DECLARE
In reply to Rob HerringHi Rob,
Quoted 9 lines · Rob Herring
Now that we use the driver core to stop deferred probe for missing drivers,
IOMMU_OF_DECLAREcan be removed.This is slightly less optimal than having a list of built-in drivers in that we'll now defer probe twice before giving up. This shouldn't have a significant impact on boot times as past discussions about deferred probe have given no evidence of deferred probe having a substantial impact.
Quoted 16 lines
Cc Will Deacon <[email protected]>Cc Robin Murphy <[email protected]>Cc Joerg Roedel <[email protected]>Cc Marek Szyprowski <[email protected]>Cc Kukjin Kim <[email protected]>Cc Krzysztof Kozlowski <[email protected]>Cc Rob Clark <[email protected]>Cc Heiko Stuebner <[email protected]>Cc Frank Rowand <[email protected]>Cc linux-arm-kernel at lists.infradead.orgCc iommu at lists.linux-foundation.orgCc linux-samsung-soc at vger.kernel.orgCc linux-arm-msm at vger.kernel.orgCc linux-rockchip at lists.infradead.orgCc devicetree at vger.kernel.orgSigned-off-by Rob Herring <[email protected]>
For Exynos IOMMU:
Quoted 153 lines
--- drivers/iommu/arm-smmu-v3.c | 2 -- drivers/iommu/arm-smmu.c | 7 ------- drivers/iommu/exynos-iommu.c | 2 -- drivers/iommu/ipmmu-vmsa.c | 3 --- drivers/iommu/msm_iommu.c | 2 -- drivers/iommu/of_iommu.c | 19 +------------------ drivers/iommu/qcom_iommu.c | 2 -- drivers/iommu/rockchip-iommu.c | 2 -- include/linux/of_iommu.h | 4 ---- 9 files changed, 1 insertion(+), 42 deletions(-)drivers/iommu/arm-smmu-v3.c +0
-2@@ -2915,8 +2915,6 @@ static struct platform_driver arm_smmu_driver = { };module_platform_driver (arm_smmu_driver); -IOMMU_OF_DECLARE (arm_smmuv3,"arm,smmu-v3" ); -MODULE_DESCRIPTION ("IOMMU API for ARM architected SMMUv3 implementations" );MODULE_AUTHOR ("Will Deacon <[email protected]>" );MODULE_LICENSE ("GPL v2" );drivers/iommu/arm-smmu.c +0
-7@@ -2211,13 +2211,6 @@ static struct platform_driver arm_smmu_driver = { };module_platform_driver (arm_smmu_driver); -IOMMU_OF_DECLARE (arm_smmuv1,"arm,smmu-v1" ); -IOMMU_OF_DECLARE (arm_smmuv2,"arm,smmu-v2" ); -IOMMU_OF_DECLARE (arm_mmu400,"arm,mmu-400" ); -IOMMU_OF_DECLARE (arm_mmu401,"arm,mmu-401" ); -IOMMU_OF_DECLARE (arm_mmu500,"arm,mmu-500" ); -IOMMU_OF_DECLARE (cavium_smmuv2,"cavium,smmu-v2" ); -MODULE_DESCRIPTION ("IOMMU API for ARM architected SMMU implementations" );MODULE_AUTHOR ("Will Deacon <[email protected]>" );MODULE_LICENSE ("GPL v2" );drivers/iommu/exynos-iommu.c +0
-2@@ -1390,5 +1390,3 @@ static int __init exynos_iommu_init(void)return ret; }core_initcall (exynos_iommu_init); - -IOMMU_OF_DECLARE (exynos_iommu_of,"samsung,exynos-sysmmu" );drivers/iommu/ipmmu-vmsa.c +0
-3@@ -1108,9 +1108,6 @@ static void __exit ipmmu_exit(void)subsys_initcall (ipmmu_init);module_exit (ipmmu_exit); -IOMMU_OF_DECLARE (ipmmu_vmsa_iommu_of,"renesas,ipmmu-vmsa" ); -IOMMU_OF_DECLARE (ipmmu_r8a7795_iommu_of,"renesas,ipmmu-r8a7795" ); -MODULE_DESCRIPTION ("IOMMU API for Renesas VMSA-compatible IPMMU" );MODULE_AUTHOR ("Laurent Pinchart <[email protected]>" );MODULE_LICENSE ("GPL v2" );drivers/iommu/msm_iommu.c +0
-2@@ -877,7 +877,5 @@ static void __exit msm_iommu_driver_exit(void)subsys_initcall (msm_iommu_driver_init);module_exit (msm_iommu_driver_exit); -IOMMU_OF_DECLARE (msm_iommu_of,"qcom,apq8064-iommu" ); -MODULE_LICENSE ("GPL v2" );MODULE_AUTHOR ("Stepan Moskovchenko <[email protected]>" );drivers/iommu/of_iommu.c +1
-18@@ -27,9 +27,6 @@#define NO_IOMMU 1 -static const struct of_device_id __iommu_of_table_sentinel -__used __section (__iommu_of_table_end); -/** * of_get_dma_window - Parse *dma-window property and returns 0 if found. * @@ -98,19 +95,6 @@ int of_get_dma_window(struct device_node *dn, const char *prefix, int index, }EXPORT_SYMBOL_GPL (of_get_dma_window); -static bool of_iommu_driver_present (struct device_node *np) -{ -/* -* If the IOMMU still isn't ready by the time we reach init, assume -* it never will be. We don't want to defer indefinitely, nor attempt -* to dereference __iommu_of_table after it's been freed. -*/ -if (system_state >=SYSTEM_RUNNING ) -return false; - -return of_match_node (&__iommu_of_table, np); -} -static int of_iommu_xlate (struct device *dev,struct of_phandle_args *iommu_spec) {@@ -120,8 +104,7 @@ static int of_iommu_xlate(struct device *dev, ops =iommu_ops_from_fwnode (fwnode);if ((ops && !ops->of_xlate) || - !of_device_is_available (iommu_spec->np) || - (!ops && !of_iommu_driver_present (iommu_spec->np))) + !of_device_is_available (iommu_spec->np))return NO_IOMMU ; err =iommu_fwspec_init (dev, &iommu_spec->np->fwnode, ops);drivers/iommu/qcom_iommu.c +0
-2@@ -947,7 +947,5 @@ static void __exit qcom_iommu_exit(void)module_init (qcom_iommu_init);module_exit (qcom_iommu_exit); -IOMMU_OF_DECLARE (qcom_iommu_dev,"qcom,msm-iommu-v1" ); -MODULE_DESCRIPTION ("IOMMU API for QCOM IOMMU v1 implementations" );MODULE_LICENSE ("GPL v2" );drivers/iommu/rockchip-iommu.c +0
-2@@ -1284,8 +1284,6 @@ static int __init rk_iommu_init(void) }subsys_initcall (rk_iommu_init); -IOMMU_OF_DECLARE (rk_iommu_of,"rockchip,iommu" ); -MODULE_DESCRIPTION ("IOMMU API for Rockchip" );MODULE_AUTHOR ("Simon Xue <[email protected]> and Daniel Kurtz <[email protected]>" );MODULE_ALIAS ("platform:rockchip-iommu" );include/linux/of_iommu.h +0
-0
include/linux/of_iommu.h static inline const struct iommu_ops *of_iommu_configure(struct device *dev, · line 35
Quoted 8 lines
include/linux/of_iommu.h +0
-4@@ -32,8 +32,4 @@ static inline const struct iommu_ops *of_iommu_configure(struct device *dev,#endif /* CONFIG_OF_IOMMU */ -extern struct of_device_id __iommu_of_table; - -#define IOMMU_OF_DECLARE (name, compat) OF_DECLARE_1(iommu, name, compat, NULL) -#endif /* __OF_IOMMU_H */
Best regards
Signature · 2 lines
Marek Szyprowski, PhD Samsung R&D Institute Poland
Rob Herring
maintainerPATCH v2 8/8 PM / Domains: Stop deferring probe at the end of initcall
In reply to Rob HerringAll PM domain drivers must be built-in (at least those using DT), so there is no point deferring probe after initcalls are done. Continuing to defer probe may prevent booting successfully even if managing PM domains is not required. This can happen if the user failed to enable the driver or if power-domains are added to a platform's DT, but there is not yet a driver (e.g. a new DTB with an old kernel).
Call the driver core function driver_deferred_probe_check_init_done() instead of just returning -EPROBE_DEFER to stop deferring probe when initcalls are done.
--- drivers/base/power/domain.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/base/power/domain.c +1 -1
@@ -2218,7 +2218,7 @@ int genpd_dev_pm_attach(struct device *dev)mutex_unlock (&gpd_list_lock);dev_dbg (dev,"%s() failed to find PM domain: %ld\n" , __func__,PTR_ERR (pd)); -return -EPROBE_DEFER ; +return driver_deferred_probe_check_init_done (dev, true); }dev_dbg (dev,"adding to PM domain %s\n" , pd->name);
Signature · 1 line
2.17.0
Quoted 20 lines · Rob Herring
Rob Herring (8):
driver core: make deferring probe after init optional driver core: add a deferred probe timeout
dt-bindings: pinctrl: add a 'pinctrl-use-default' property
arm: dts: bcm283x: mark the UART pin muxing nodes with
pinctrl-use-default
pinctrl: optionally stop deferring probe at end of initcalls
iommu: Stop deferring probe at end of initcalls
iommu: RemoveIOMMU_OF_DECLARE
PM / Domains: Stop deferring probe at the end of initcall.../admin-guide/kernel-parameters.txt | 7 +++ .../bindings/pinctrl/pinctrl-bindings.txt | 6 +++ arch/arm/boot/dts/bcm283x.dtsi | 2 + drivers/base/dd.c | 43 +++++++++++++++++++ drivers/base/power/domain.c | 2 +- drivers/iommu/arm-smmu-v3.c | 2 - drivers/iommu/arm-smmu.c | 7 --- drivers/iommu/exynos-iommu.c | 2 - drivers/iommu/ipmmu-vmsa.c | 3 --
Quoted 8 lines
drivers/iommu/msm_iommu.c | 2 - drivers/iommu/of_iommu.c | 21 +-------- drivers/iommu/qcom_iommu.c | 2 - drivers/iommu/rockchip-iommu.c | 2 - drivers/pinctrl/devicetree.c | 14 ++++-- include/linux/device.h | 2 + include/linux/of_iommu.h | 4 -- 16 files changed, 73 insertions(+), 48 deletions(-)
For the IOMMU bits: