* [PATCH v2 1/5] platform/chrome: cros_ec_lpc: Move mec_init to device probe
@ 2022-11-01 22:22 Brian Norris
2022-11-01 22:22 ` [PATCH v2 2/5] platform/chrome: cros_ec_lpc: Mark PROBE_PREFER_ASYNCHRONOUS Brian Norris
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: Brian Norris @ 2022-11-01 22:22 UTC (permalink / raw)
To: Benson Leung, Guenter Roeck; +Cc: chrome-platform, linux-kernel, Brian Norris
Disregarding the weird global state hiding in this cros_ec_lpc_mec_*()
stuff, it belongs in device probe. We shouldn't assume we can access
hardware resources when the device isn't attached to the driver.
Signed-off-by: Brian Norris <briannorris@chromium.org>
---
Changes in v2:
- drop cros_ec_lpc_mec_destroy() (removed in -next; was done wrong in
my v1 anyway)
drivers/platform/chrome/cros_ec_lpc.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/platform/chrome/cros_ec_lpc.c b/drivers/platform/chrome/cros_ec_lpc.c
index 6ef5e5d40ba4..48302183d62e 100644
--- a/drivers/platform/chrome/cros_ec_lpc.c
+++ b/drivers/platform/chrome/cros_ec_lpc.c
@@ -354,6 +354,9 @@ static int cros_ec_lpc_probe(struct platform_device *pdev)
return -EBUSY;
}
+ cros_ec_lpc_mec_init(EC_HOST_CMD_REGION0,
+ EC_LPC_ADDR_MEMMAP + EC_MEMMAP_SIZE);
+
/*
* Read the mapped ID twice, the first one is assuming the
* EC is a Microchip Embedded Controller (MEC) variant, if the
@@ -586,9 +589,6 @@ static int __init cros_ec_lpc_init(void)
return -ENODEV;
}
- cros_ec_lpc_mec_init(EC_HOST_CMD_REGION0,
- EC_LPC_ADDR_MEMMAP + EC_MEMMAP_SIZE);
-
/* Register the driver */
ret = platform_driver_register(&cros_ec_lpc_driver);
if (ret) {
--
2.38.1.273.g43a17bfeac-goog
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v2 2/5] platform/chrome: cros_ec_lpc: Mark PROBE_PREFER_ASYNCHRONOUS
2022-11-01 22:22 [PATCH v2 1/5] platform/chrome: cros_ec_lpc: Move mec_init to device probe Brian Norris
@ 2022-11-01 22:22 ` Brian Norris
2022-11-01 22:22 ` [PATCH v2 3/5] platform/chrome: cros_ec_debugfs: Set PROBE_PREFER_ASYNCHRONOUS Brian Norris
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Brian Norris @ 2022-11-01 22:22 UTC (permalink / raw)
To: Benson Leung, Guenter Roeck; +Cc: chrome-platform, linux-kernel, Brian Norris
This takes on the order of 60ms to probe on some systems, so let it
probe asynchronously. It shouldn't have any dependencies that aren't
handled cleanly.
Signed-off-by: Brian Norris <briannorris@chromium.org>
---
(no changes since v1)
drivers/platform/chrome/cros_ec_lpc.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/platform/chrome/cros_ec_lpc.c b/drivers/platform/chrome/cros_ec_lpc.c
index 48302183d62e..2e4dba724ada 100644
--- a/drivers/platform/chrome/cros_ec_lpc.c
+++ b/drivers/platform/chrome/cros_ec_lpc.c
@@ -557,6 +557,7 @@ static struct platform_driver cros_ec_lpc_driver = {
.name = DRV_NAME,
.acpi_match_table = cros_ec_lpc_acpi_device_ids,
.pm = &cros_ec_lpc_pm_ops,
+ .probe_type = PROBE_PREFER_ASYNCHRONOUS,
},
.probe = cros_ec_lpc_probe,
.remove = cros_ec_lpc_remove,
--
2.38.1.273.g43a17bfeac-goog
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v2 3/5] platform/chrome: cros_ec_debugfs: Set PROBE_PREFER_ASYNCHRONOUS
2022-11-01 22:22 [PATCH v2 1/5] platform/chrome: cros_ec_lpc: Move mec_init to device probe Brian Norris
2022-11-01 22:22 ` [PATCH v2 2/5] platform/chrome: cros_ec_lpc: Mark PROBE_PREFER_ASYNCHRONOUS Brian Norris
@ 2022-11-01 22:22 ` Brian Norris
2022-11-01 22:22 ` [PATCH v2 4/5] platform/chrome: cros_ec_lightbar: " Brian Norris
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Brian Norris @ 2022-11-01 22:22 UTC (permalink / raw)
To: Benson Leung, Guenter Roeck; +Cc: chrome-platform, linux-kernel, Brian Norris
This driver takes on the order of 40ms to start on some systems. It
shouldn't have many cross-device dependencies to race with, nor racy
access to shared state with other drivers, so this should be a
relatively low risk change.
This driver was pinpointed as part of a survey of top slowest initcalls
(i.e., are built in, and probing synchronously) on a lab of ChromeOS
systems.
Signed-off-by: Brian Norris <briannorris@chromium.org>
---
(no changes since v1)
drivers/platform/chrome/cros_ec_debugfs.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/platform/chrome/cros_ec_debugfs.c b/drivers/platform/chrome/cros_ec_debugfs.c
index 4e63adf083ea..21d973fc6be2 100644
--- a/drivers/platform/chrome/cros_ec_debugfs.c
+++ b/drivers/platform/chrome/cros_ec_debugfs.c
@@ -521,6 +521,7 @@ static struct platform_driver cros_ec_debugfs_driver = {
.driver = {
.name = DRV_NAME,
.pm = &cros_ec_debugfs_pm_ops,
+ .probe_type = PROBE_PREFER_ASYNCHRONOUS,
},
.probe = cros_ec_debugfs_probe,
.remove = cros_ec_debugfs_remove,
--
2.38.1.273.g43a17bfeac-goog
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v2 4/5] platform/chrome: cros_ec_lightbar: Set PROBE_PREFER_ASYNCHRONOUS
2022-11-01 22:22 [PATCH v2 1/5] platform/chrome: cros_ec_lpc: Move mec_init to device probe Brian Norris
2022-11-01 22:22 ` [PATCH v2 2/5] platform/chrome: cros_ec_lpc: Mark PROBE_PREFER_ASYNCHRONOUS Brian Norris
2022-11-01 22:22 ` [PATCH v2 3/5] platform/chrome: cros_ec_debugfs: Set PROBE_PREFER_ASYNCHRONOUS Brian Norris
@ 2022-11-01 22:22 ` Brian Norris
2022-11-01 22:22 ` [PATCH v2 5/5] platform/chrome: cros_ec_spi: " Brian Norris
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Brian Norris @ 2022-11-01 22:22 UTC (permalink / raw)
To: Benson Leung, Guenter Roeck; +Cc: chrome-platform, linux-kernel, Brian Norris
This driver takes on the order of 15ms to start on some systems. Even on
systems where there is no lightbar support, it can take a few
milliseconds just to probe the EC for support. It shouldn't have many
cross-device dependencies to race with, nor racy access to shared state
with other drivers, so this should be a relatively low risk change.
This driver was pinpointed as part of a survey of top slowest initcalls
(i.e., are built in, and probing synchronously) on a lab of ChromeOS
systems.
Signed-off-by: Brian Norris <briannorris@chromium.org>
---
(no changes since v1)
drivers/platform/chrome/cros_ec_lightbar.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/platform/chrome/cros_ec_lightbar.c b/drivers/platform/chrome/cros_ec_lightbar.c
index 469dfc7a4a03..ff4d619cf924 100644
--- a/drivers/platform/chrome/cros_ec_lightbar.c
+++ b/drivers/platform/chrome/cros_ec_lightbar.c
@@ -601,6 +601,7 @@ static struct platform_driver cros_ec_lightbar_driver = {
.driver = {
.name = DRV_NAME,
.pm = &cros_ec_lightbar_pm_ops,
+ .probe_type = PROBE_PREFER_ASYNCHRONOUS,
},
.probe = cros_ec_lightbar_probe,
.remove = cros_ec_lightbar_remove,
--
2.38.1.273.g43a17bfeac-goog
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v2 5/5] platform/chrome: cros_ec_spi: Set PROBE_PREFER_ASYNCHRONOUS
2022-11-01 22:22 [PATCH v2 1/5] platform/chrome: cros_ec_lpc: Move mec_init to device probe Brian Norris
` (2 preceding siblings ...)
2022-11-01 22:22 ` [PATCH v2 4/5] platform/chrome: cros_ec_lightbar: " Brian Norris
@ 2022-11-01 22:22 ` Brian Norris
2022-11-02 4:30 ` [PATCH v2 1/5] platform/chrome: cros_ec_lpc: Move mec_init to device probe patchwork-bot+chrome-platform
2022-11-02 12:30 ` patchwork-bot+chrome-platform
5 siblings, 0 replies; 7+ messages in thread
From: Brian Norris @ 2022-11-01 22:22 UTC (permalink / raw)
To: Benson Leung, Guenter Roeck; +Cc: chrome-platform, linux-kernel, Brian Norris
This driver often takes on the order of 10ms to start, but in some cases
as much as 600ms [1]. It shouldn't have many cross-device dependencies
to race with, nor racy access to shared state with other drivers, so
this should be a relatively low risk change.
This driver was pinpointed as part of a survey of top slowest initcalls
(i.e., are built in, and probing synchronously) on a lab of ChromeOS
systems.
[1] 600ms was especially surprising to me, so I checked a little deeper.
This driver is used to interface with Embedded Controllers besides just
the traditional laptop power-state controller -- it also interfaces with
some fingerprint readers, which may start up in parallel with the
kernel, or which may not even be present on some SKUs, despite having a
node for it. Thus, our time is wasted just timing out talking to it. At
least we can do that without blocking everyone else.
Signed-off-by: Brian Norris <briannorris@chromium.org>
---
(no changes since v1)
drivers/platform/chrome/cros_ec_spi.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/platform/chrome/cros_ec_spi.c b/drivers/platform/chrome/cros_ec_spi.c
index 7360b3ff6e4f..21143dba8970 100644
--- a/drivers/platform/chrome/cros_ec_spi.c
+++ b/drivers/platform/chrome/cros_ec_spi.c
@@ -834,6 +834,7 @@ static struct spi_driver cros_ec_driver_spi = {
.name = "cros-ec-spi",
.of_match_table = cros_ec_spi_of_match,
.pm = &cros_ec_spi_pm_ops,
+ .probe_type = PROBE_PREFER_ASYNCHRONOUS,
},
.probe = cros_ec_spi_probe,
.remove = cros_ec_spi_remove,
--
2.38.1.273.g43a17bfeac-goog
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v2 1/5] platform/chrome: cros_ec_lpc: Move mec_init to device probe
2022-11-01 22:22 [PATCH v2 1/5] platform/chrome: cros_ec_lpc: Move mec_init to device probe Brian Norris
` (3 preceding siblings ...)
2022-11-01 22:22 ` [PATCH v2 5/5] platform/chrome: cros_ec_spi: " Brian Norris
@ 2022-11-02 4:30 ` patchwork-bot+chrome-platform
2022-11-02 12:30 ` patchwork-bot+chrome-platform
5 siblings, 0 replies; 7+ messages in thread
From: patchwork-bot+chrome-platform @ 2022-11-02 4:30 UTC (permalink / raw)
To: Brian Norris; +Cc: bleung, groeck, chrome-platform, linux-kernel
Hello:
This series was applied to chrome-platform/linux.git (for-kernelci)
by Tzung-Bi Shih <tzungbi@kernel.org>:
On Tue, 1 Nov 2022 15:22:06 -0700 you wrote:
> Disregarding the weird global state hiding in this cros_ec_lpc_mec_*()
> stuff, it belongs in device probe. We shouldn't assume we can access
> hardware resources when the device isn't attached to the driver.
>
> Signed-off-by: Brian Norris <briannorris@chromium.org>
> ---
>
> [...]
Here is the summary with links:
- [v2,1/5] platform/chrome: cros_ec_lpc: Move mec_init to device probe
https://git.kernel.org/chrome-platform/c/fdf84f9ae30b
- [v2,2/5] platform/chrome: cros_ec_lpc: Mark PROBE_PREFER_ASYNCHRONOUS
https://git.kernel.org/chrome-platform/c/bd88b965ae8c
- [v2,3/5] platform/chrome: cros_ec_debugfs: Set PROBE_PREFER_ASYNCHRONOUS
https://git.kernel.org/chrome-platform/c/692a68ad7f3c
- [v2,4/5] platform/chrome: cros_ec_lightbar: Set PROBE_PREFER_ASYNCHRONOUS
https://git.kernel.org/chrome-platform/c/873ab3e886b5
- [v2,5/5] platform/chrome: cros_ec_spi: Set PROBE_PREFER_ASYNCHRONOUS
https://git.kernel.org/chrome-platform/c/015e4b05c377
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2 1/5] platform/chrome: cros_ec_lpc: Move mec_init to device probe
2022-11-01 22:22 [PATCH v2 1/5] platform/chrome: cros_ec_lpc: Move mec_init to device probe Brian Norris
` (4 preceding siblings ...)
2022-11-02 4:30 ` [PATCH v2 1/5] platform/chrome: cros_ec_lpc: Move mec_init to device probe patchwork-bot+chrome-platform
@ 2022-11-02 12:30 ` patchwork-bot+chrome-platform
5 siblings, 0 replies; 7+ messages in thread
From: patchwork-bot+chrome-platform @ 2022-11-02 12:30 UTC (permalink / raw)
To: Brian Norris; +Cc: bleung, groeck, chrome-platform, linux-kernel
Hello:
This series was applied to chrome-platform/linux.git (for-next)
by Tzung-Bi Shih <tzungbi@kernel.org>:
On Tue, 1 Nov 2022 15:22:06 -0700 you wrote:
> Disregarding the weird global state hiding in this cros_ec_lpc_mec_*()
> stuff, it belongs in device probe. We shouldn't assume we can access
> hardware resources when the device isn't attached to the driver.
>
> Signed-off-by: Brian Norris <briannorris@chromium.org>
> ---
>
> [...]
Here is the summary with links:
- [v2,1/5] platform/chrome: cros_ec_lpc: Move mec_init to device probe
https://git.kernel.org/chrome-platform/c/fdf84f9ae30b
- [v2,2/5] platform/chrome: cros_ec_lpc: Mark PROBE_PREFER_ASYNCHRONOUS
https://git.kernel.org/chrome-platform/c/bd88b965ae8c
- [v2,3/5] platform/chrome: cros_ec_debugfs: Set PROBE_PREFER_ASYNCHRONOUS
https://git.kernel.org/chrome-platform/c/692a68ad7f3c
- [v2,4/5] platform/chrome: cros_ec_lightbar: Set PROBE_PREFER_ASYNCHRONOUS
https://git.kernel.org/chrome-platform/c/873ab3e886b5
- [v2,5/5] platform/chrome: cros_ec_spi: Set PROBE_PREFER_ASYNCHRONOUS
https://git.kernel.org/chrome-platform/c/015e4b05c377
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2022-11-02 12:30 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-01 22:22 [PATCH v2 1/5] platform/chrome: cros_ec_lpc: Move mec_init to device probe Brian Norris
2022-11-01 22:22 ` [PATCH v2 2/5] platform/chrome: cros_ec_lpc: Mark PROBE_PREFER_ASYNCHRONOUS Brian Norris
2022-11-01 22:22 ` [PATCH v2 3/5] platform/chrome: cros_ec_debugfs: Set PROBE_PREFER_ASYNCHRONOUS Brian Norris
2022-11-01 22:22 ` [PATCH v2 4/5] platform/chrome: cros_ec_lightbar: " Brian Norris
2022-11-01 22:22 ` [PATCH v2 5/5] platform/chrome: cros_ec_spi: " Brian Norris
2022-11-02 4:30 ` [PATCH v2 1/5] platform/chrome: cros_ec_lpc: Move mec_init to device probe patchwork-bot+chrome-platform
2022-11-02 12:30 ` patchwork-bot+chrome-platform
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).