mbox series

[v4,0/2] drivers: make early_platform code SuperH-specific

Message ID 20191003092913.10731-1-brgl@bgdev.pl (mailing list archive)
Headers show
Series drivers: make early_platform code SuperH-specific | expand

Message

Bartosz Golaszewski Oct. 3, 2019, 9:29 a.m. UTC
From: Bartosz Golaszewski <bgolaszewski@baylibre.com>

Some time ago I started a discussion about the need for a proper early device
probing mechanism[1]. One that would be based on real platform drivers and
support both platform data and device tree.

While we're far from reaching any consensus on the implementation, Arnd
suggested that I start off by moving the SuperH-specific early platform
drivers implementation to arch/sh[2].

This series is the first attempt at making way for a new, less hacky
implementation.

The first patch moves all the early_platform code to arch/sh.

The second patch prefixes all early_platform symbols with 'sh_'.

[1] https://lkml.org/lkml/2018/4/26/657
[2] https://lkml.org/lkml/2018/4/27/239

v1 -> v2:
- certain drivers are compiled for arm/mach-shmobile too - we need to
  add ifdefs for CONFIG_SUPERH around early_platform calls

v2 -> v3:
- added a stub for is_early_platform_device() which always returns false
  on non-SuperH architectures

v3 -> v4:
- rebased on top of v5.4-rc1
- removed patches that are already upstream from the series

Bartosz Golaszewski (2):
  drivers: move the early platform device support to arch/sh
  sh: add the sh_ prefix to early platform symbols

 arch/sh/drivers/Makefile               |   2 +-
 arch/sh/drivers/platform_early.c       | 347 +++++++++++++++++++++++++
 arch/sh/include/asm/platform_early.h   |  61 +++++
 arch/sh/kernel/cpu/sh2/setup-sh7619.c  |   3 +-
 arch/sh/kernel/cpu/sh2a/setup-mxg.c    |   3 +-
 arch/sh/kernel/cpu/sh2a/setup-sh7201.c |   3 +-
 arch/sh/kernel/cpu/sh2a/setup-sh7203.c |   3 +-
 arch/sh/kernel/cpu/sh2a/setup-sh7206.c |   3 +-
 arch/sh/kernel/cpu/sh2a/setup-sh7264.c |   3 +-
 arch/sh/kernel/cpu/sh2a/setup-sh7269.c |   3 +-
 arch/sh/kernel/cpu/sh3/setup-sh3.c     |   1 +
 arch/sh/kernel/cpu/sh3/setup-sh7705.c  |   3 +-
 arch/sh/kernel/cpu/sh3/setup-sh770x.c  |   3 +-
 arch/sh/kernel/cpu/sh3/setup-sh7710.c  |   3 +-
 arch/sh/kernel/cpu/sh3/setup-sh7720.c  |   3 +-
 arch/sh/kernel/cpu/sh4/setup-sh4-202.c |   3 +-
 arch/sh/kernel/cpu/sh4/setup-sh7750.c  |   9 +-
 arch/sh/kernel/cpu/sh4/setup-sh7760.c  |   3 +-
 arch/sh/kernel/cpu/sh4a/setup-sh7343.c |   3 +-
 arch/sh/kernel/cpu/sh4a/setup-sh7366.c |   3 +-
 arch/sh/kernel/cpu/sh4a/setup-sh7722.c |   3 +-
 arch/sh/kernel/cpu/sh4a/setup-sh7723.c |   3 +-
 arch/sh/kernel/cpu/sh4a/setup-sh7724.c |   3 +-
 arch/sh/kernel/cpu/sh4a/setup-sh7734.c |   3 +-
 arch/sh/kernel/cpu/sh4a/setup-sh7757.c |   3 +-
 arch/sh/kernel/cpu/sh4a/setup-sh7763.c |   3 +-
 arch/sh/kernel/cpu/sh4a/setup-sh7770.c |   3 +-
 arch/sh/kernel/cpu/sh4a/setup-sh7780.c |   3 +-
 arch/sh/kernel/cpu/sh4a/setup-sh7785.c |   3 +-
 arch/sh/kernel/cpu/sh4a/setup-sh7786.c |   3 +-
 arch/sh/kernel/cpu/sh4a/setup-shx3.c   |   3 +-
 arch/sh/kernel/cpu/sh5/setup-sh5.c     |   3 +-
 arch/sh/kernel/setup.c                 |   3 +-
 arch/sh/kernel/time.c                  |   5 +-
 drivers/base/platform.c                | 288 --------------------
 drivers/clocksource/sh_cmt.c           |  13 +-
 drivers/clocksource/sh_mtu2.c          |  13 +-
 drivers/clocksource/sh_tmu.c           |  14 +-
 drivers/tty/serial/sh-sci.c            |  11 +-
 include/linux/platform_device.h        |  64 +----
 40 files changed, 525 insertions(+), 387 deletions(-)
 create mode 100644 arch/sh/drivers/platform_early.c
 create mode 100644 arch/sh/include/asm/platform_early.h

Comments

Greg KH Oct. 4, 2019, 1 p.m. UTC | #1
On Thu, Oct 03, 2019 at 11:29:11AM +0200, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> 
> Some time ago I started a discussion about the need for a proper early device
> probing mechanism[1]. One that would be based on real platform drivers and
> support both platform data and device tree.
> 
> While we're far from reaching any consensus on the implementation, Arnd
> suggested that I start off by moving the SuperH-specific early platform
> drivers implementation to arch/sh[2].
> 
> This series is the first attempt at making way for a new, less hacky
> implementation.
> 
> The first patch moves all the early_platform code to arch/sh.
> 
> The second patch prefixes all early_platform symbols with 'sh_'.
> 
> [1] https://lkml.org/lkml/2018/4/26/657
> [2] https://lkml.org/lkml/2018/4/27/239
> 
> v1 -> v2:
> - certain drivers are compiled for arm/mach-shmobile too - we need to
>   add ifdefs for CONFIG_SUPERH around early_platform calls
> 
> v2 -> v3:
> - added a stub for is_early_platform_device() which always returns false
>   on non-SuperH architectures
> 
> v3 -> v4:
> - rebased on top of v5.4-rc1
> - removed patches that are already upstream from the series
> 
> Bartosz Golaszewski (2):
>   drivers: move the early platform device support to arch/sh
>   sh: add the sh_ prefix to early platform symbols

I like this, any objection from anyone if I take this in my driver-core
tree for 5.5-rc1?

thanks,

greg k-h
Rich Felker Oct. 4, 2019, 1:20 p.m. UTC | #2
On Fri, Oct 04, 2019 at 03:00:31PM +0200, Greg Kroah-Hartman wrote:
> On Thu, Oct 03, 2019 at 11:29:11AM +0200, Bartosz Golaszewski wrote:
> > From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> > 
> > Some time ago I started a discussion about the need for a proper early device
> > probing mechanism[1]. One that would be based on real platform drivers and
> > support both platform data and device tree.
> > 
> > While we're far from reaching any consensus on the implementation, Arnd
> > suggested that I start off by moving the SuperH-specific early platform
> > drivers implementation to arch/sh[2].
> > 
> > This series is the first attempt at making way for a new, less hacky
> > implementation.
> > 
> > The first patch moves all the early_platform code to arch/sh.
> > 
> > The second patch prefixes all early_platform symbols with 'sh_'.
> > 
> > [1] https://lkml.org/lkml/2018/4/26/657
> > [2] https://lkml.org/lkml/2018/4/27/239
> > 
> > v1 -> v2:
> > - certain drivers are compiled for arm/mach-shmobile too - we need to
> >   add ifdefs for CONFIG_SUPERH around early_platform calls
> > 
> > v2 -> v3:
> > - added a stub for is_early_platform_device() which always returns false
> >   on non-SuperH architectures
> > 
> > v3 -> v4:
> > - rebased on top of v5.4-rc1
> > - removed patches that are already upstream from the series
> > 
> > Bartosz Golaszewski (2):
> >   drivers: move the early platform device support to arch/sh
> >   sh: add the sh_ prefix to early platform symbols
> 
> I like this, any objection from anyone if I take this in my driver-core
> tree for 5.5-rc1?

I don't think I have any objection. It will probably make gratuitous
merge conflicts with Sato-san's old device tree sh4 work when we get
back to finishing that, but that's not really a big deal.

Rich
Greg KH Oct. 7, 2019, 2:44 p.m. UTC | #3
On Fri, Oct 04, 2019 at 09:20:25AM -0400, Rich Felker wrote:
> On Fri, Oct 04, 2019 at 03:00:31PM +0200, Greg Kroah-Hartman wrote:
> > On Thu, Oct 03, 2019 at 11:29:11AM +0200, Bartosz Golaszewski wrote:
> > > From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> > > 
> > > Some time ago I started a discussion about the need for a proper early device
> > > probing mechanism[1]. One that would be based on real platform drivers and
> > > support both platform data and device tree.
> > > 
> > > While we're far from reaching any consensus on the implementation, Arnd
> > > suggested that I start off by moving the SuperH-specific early platform
> > > drivers implementation to arch/sh[2].
> > > 
> > > This series is the first attempt at making way for a new, less hacky
> > > implementation.
> > > 
> > > The first patch moves all the early_platform code to arch/sh.
> > > 
> > > The second patch prefixes all early_platform symbols with 'sh_'.
> > > 
> > > [1] https://lkml.org/lkml/2018/4/26/657
> > > [2] https://lkml.org/lkml/2018/4/27/239
> > > 
> > > v1 -> v2:
> > > - certain drivers are compiled for arm/mach-shmobile too - we need to
> > >   add ifdefs for CONFIG_SUPERH around early_platform calls
> > > 
> > > v2 -> v3:
> > > - added a stub for is_early_platform_device() which always returns false
> > >   on non-SuperH architectures
> > > 
> > > v3 -> v4:
> > > - rebased on top of v5.4-rc1
> > > - removed patches that are already upstream from the series
> > > 
> > > Bartosz Golaszewski (2):
> > >   drivers: move the early platform device support to arch/sh
> > >   sh: add the sh_ prefix to early platform symbols
> > 
> > I like this, any objection from anyone if I take this in my driver-core
> > tree for 5.5-rc1?
> 
> I don't think I have any objection. It will probably make gratuitous
> merge conflicts with Sato-san's old device tree sh4 work when we get
> back to finishing that, but that's not really a big deal.

Ok, I've queued it up in my tree now, thanks,

greg k-h
Guenter Roeck Dec. 2, 2019, 4:14 a.m. UTC | #4
On Thu, Oct 03, 2019 at 11:29:12AM +0200, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> 
> SuperH is the only user of the current implementation of early platform
> device support. We want to introduce a more robust approach to early
> probing. As the first step - move all the current early platform code
> to arch/sh.
> 
> In order not to export internal drivers/base functions to arch code for
> this temporary solution - copy the two needed routines for driver
> matching from drivers/base/platform.c to arch/sh/drivers/platform_early.c.
> 
> Also: call early_platform_cleanup() from subsys_initcall() so that it's
> called after all early devices are probed.
> 
> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>

Wondering ... has anyone tested this patch on affected hardware ?
All my qemu boot tests (both sh and sheb) fail because of it.
Bisect log below.

Guenter

---
# bad: [72c0870e3a05d9cd5466d08c3d2a3069ed0a2f9f] Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
# good: [89d57dddd7d319ded00415790a0bb3c954b7e386] Merge tag 'media/v5.5-1' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media
git bisect start 'HEAD' '89d57dddd7d3'
# good: [0a6cad5df541108cfd3fbd79eef48eb824c89bdc] Merge branch 'vmwgfx-coherent' of git://people.freedesktop.org/~thomash/linux into drm-next
git bisect good 0a6cad5df541108cfd3fbd79eef48eb824c89bdc
# bad: [9a3d7fd275be4559277667228902824165153c80] Merge tag 'driver-core-5.5-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core
git bisect bad 9a3d7fd275be4559277667228902824165153c80
# good: [59274c7164807d27b24e6c068dfe734f7bea4623] Merge tag 'usb-5.5-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb
git bisect good 59274c7164807d27b24e6c068dfe734f7bea4623
# good: [e71903106721dc53923e90aa484d78bc86c039a9] staging: mt7621-dma: align to match open parenthesis
git bisect good e71903106721dc53923e90aa484d78bc86c039a9
# good: [8f56e4ebe05c26c30e167519273843476e39e244] Merge tag 'char-misc-5.5-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc
git bisect good 8f56e4ebe05c26c30e167519273843476e39e244
# good: [8bde9f3d2a217d1635a7c7bdf8ad4c25c9a34b50] Merge tag 'iio-for-5.5c' of https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-next
git bisect good 8bde9f3d2a217d1635a7c7bdf8ad4c25c9a34b50
# bad: [0628cda318df6baec439ca6e6e274007492f1ccd] mac80211: Use debugfs_create_xul() helper
git bisect bad 0628cda318df6baec439ca6e6e274007492f1ccd
# bad: [03324507e66c7664c754b1ef92c5c3be24c78aa2] driver core: Allow fwnode_operations.add_links to differentiate errors
git bisect bad 03324507e66c7664c754b1ef92c5c3be24c78aa2
# bad: [313f5dbba41d905d59c820bb2d91ee6c661aff99] debugfs: remove return value of debugfs_create_u16()
git bisect bad 313f5dbba41d905d59c820bb2d91ee6c661aff99
# good: [d4387cd117414ba80230f27a514be5ca4a09cfcc] of: property: Create device links for all child-supplier depencencies
git bisect good d4387cd117414ba80230f27a514be5ca4a09cfcc
# bad: [c31e73121f4c1ec45a3e523ac6ce3ce6dafdcec1] base: soc: Handle custom soc information sysfs entries
git bisect bad c31e73121f4c1ec45a3e523ac6ce3ce6dafdcec1
# bad: [201e91091b1d47047f55580b5474e1239f4d17aa] sh: add the sh_ prefix to early platform symbols
git bisect bad 201e91091b1d47047f55580b5474e1239f4d17aa
# bad: [507fd01d5333338753a1cc26322dfc9f856c109f] drivers: move the early platform device support to arch/sh
git bisect bad 507fd01d5333338753a1cc26322dfc9f856c109f
# first bad commit: [507fd01d5333338753a1cc26322dfc9f856c109f] drivers: move the early platform device support to arch/sh
Bartosz Golaszewski Dec. 2, 2019, 7:40 a.m. UTC | #5
pon., 2 gru 2019 o 05:14 Guenter Roeck <linux@roeck-us.net> napisał(a):
>
> On Thu, Oct 03, 2019 at 11:29:12AM +0200, Bartosz Golaszewski wrote:
> > From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> >
> > SuperH is the only user of the current implementation of early platform
> > device support. We want to introduce a more robust approach to early
> > probing. As the first step - move all the current early platform code
> > to arch/sh.
> >
> > In order not to export internal drivers/base functions to arch code for
> > this temporary solution - copy the two needed routines for driver
> > matching from drivers/base/platform.c to arch/sh/drivers/platform_early.c.
> >
> > Also: call early_platform_cleanup() from subsys_initcall() so that it's
> > called after all early devices are probed.
> >
> > Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
>
> Wondering ... has anyone tested this patch on affected hardware ?
> All my qemu boot tests (both sh and sheb) fail because of it.
> Bisect log below.
>
> Guenter
>
> ---
> # bad: [72c0870e3a05d9cd5466d08c3d2a3069ed0a2f9f] Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
> # good: [89d57dddd7d319ded00415790a0bb3c954b7e386] Merge tag 'media/v5.5-1' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media
> git bisect start 'HEAD' '89d57dddd7d3'
> # good: [0a6cad5df541108cfd3fbd79eef48eb824c89bdc] Merge branch 'vmwgfx-coherent' of git://people.freedesktop.org/~thomash/linux into drm-next
> git bisect good 0a6cad5df541108cfd3fbd79eef48eb824c89bdc
> # bad: [9a3d7fd275be4559277667228902824165153c80] Merge tag 'driver-core-5.5-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core
> git bisect bad 9a3d7fd275be4559277667228902824165153c80
> # good: [59274c7164807d27b24e6c068dfe734f7bea4623] Merge tag 'usb-5.5-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb
> git bisect good 59274c7164807d27b24e6c068dfe734f7bea4623
> # good: [e71903106721dc53923e90aa484d78bc86c039a9] staging: mt7621-dma: align to match open parenthesis
> git bisect good e71903106721dc53923e90aa484d78bc86c039a9
> # good: [8f56e4ebe05c26c30e167519273843476e39e244] Merge tag 'char-misc-5.5-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc
> git bisect good 8f56e4ebe05c26c30e167519273843476e39e244
> # good: [8bde9f3d2a217d1635a7c7bdf8ad4c25c9a34b50] Merge tag 'iio-for-5.5c' of https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-next
> git bisect good 8bde9f3d2a217d1635a7c7bdf8ad4c25c9a34b50
> # bad: [0628cda318df6baec439ca6e6e274007492f1ccd] mac80211: Use debugfs_create_xul() helper
> git bisect bad 0628cda318df6baec439ca6e6e274007492f1ccd
> # bad: [03324507e66c7664c754b1ef92c5c3be24c78aa2] driver core: Allow fwnode_operations.add_links to differentiate errors
> git bisect bad 03324507e66c7664c754b1ef92c5c3be24c78aa2
> # bad: [313f5dbba41d905d59c820bb2d91ee6c661aff99] debugfs: remove return value of debugfs_create_u16()
> git bisect bad 313f5dbba41d905d59c820bb2d91ee6c661aff99
> # good: [d4387cd117414ba80230f27a514be5ca4a09cfcc] of: property: Create device links for all child-supplier depencencies
> git bisect good d4387cd117414ba80230f27a514be5ca4a09cfcc
> # bad: [c31e73121f4c1ec45a3e523ac6ce3ce6dafdcec1] base: soc: Handle custom soc information sysfs entries
> git bisect bad c31e73121f4c1ec45a3e523ac6ce3ce6dafdcec1
> # bad: [201e91091b1d47047f55580b5474e1239f4d17aa] sh: add the sh_ prefix to early platform symbols
> git bisect bad 201e91091b1d47047f55580b5474e1239f4d17aa
> # bad: [507fd01d5333338753a1cc26322dfc9f856c109f] drivers: move the early platform device support to arch/sh
> git bisect bad 507fd01d5333338753a1cc26322dfc9f856c109f
> # first bad commit: [507fd01d5333338753a1cc26322dfc9f856c109f] drivers: move the early platform device support to arch/sh

Hi Guenter,

can you post some bootlogs? Is it the same problem everywhere?

Bart
Guenter Roeck Dec. 2, 2019, 1:03 p.m. UTC | #6
On 12/1/19 11:40 PM, Bartosz Golaszewski wrote:
> pon., 2 gru 2019 o 05:14 Guenter Roeck <linux@roeck-us.net> napisał(a):
>>
>> On Thu, Oct 03, 2019 at 11:29:12AM +0200, Bartosz Golaszewski wrote:
>>> From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
>>>
>>> SuperH is the only user of the current implementation of early platform
>>> device support. We want to introduce a more robust approach to early
>>> probing. As the first step - move all the current early platform code
>>> to arch/sh.
>>>
>>> In order not to export internal drivers/base functions to arch code for
>>> this temporary solution - copy the two needed routines for driver
>>> matching from drivers/base/platform.c to arch/sh/drivers/platform_early.c.
>>>
>>> Also: call early_platform_cleanup() from subsys_initcall() so that it's
>>> called after all early devices are probed.
>>>
>>> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
>>
>> Wondering ... has anyone tested this patch on affected hardware ?
>> All my qemu boot tests (both sh and sheb) fail because of it.
>> Bisect log below.
>>
>> Guenter
>>
>> ---
>> # bad: [72c0870e3a05d9cd5466d08c3d2a3069ed0a2f9f] Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
>> # good: [89d57dddd7d319ded00415790a0bb3c954b7e386] Merge tag 'media/v5.5-1' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media
>> git bisect start 'HEAD' '89d57dddd7d3'
>> # good: [0a6cad5df541108cfd3fbd79eef48eb824c89bdc] Merge branch 'vmwgfx-coherent' of git://people.freedesktop.org/~thomash/linux into drm-next
>> git bisect good 0a6cad5df541108cfd3fbd79eef48eb824c89bdc
>> # bad: [9a3d7fd275be4559277667228902824165153c80] Merge tag 'driver-core-5.5-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core
>> git bisect bad 9a3d7fd275be4559277667228902824165153c80
>> # good: [59274c7164807d27b24e6c068dfe734f7bea4623] Merge tag 'usb-5.5-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb
>> git bisect good 59274c7164807d27b24e6c068dfe734f7bea4623
>> # good: [e71903106721dc53923e90aa484d78bc86c039a9] staging: mt7621-dma: align to match open parenthesis
>> git bisect good e71903106721dc53923e90aa484d78bc86c039a9
>> # good: [8f56e4ebe05c26c30e167519273843476e39e244] Merge tag 'char-misc-5.5-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc
>> git bisect good 8f56e4ebe05c26c30e167519273843476e39e244
>> # good: [8bde9f3d2a217d1635a7c7bdf8ad4c25c9a34b50] Merge tag 'iio-for-5.5c' of https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-next
>> git bisect good 8bde9f3d2a217d1635a7c7bdf8ad4c25c9a34b50
>> # bad: [0628cda318df6baec439ca6e6e274007492f1ccd] mac80211: Use debugfs_create_xul() helper
>> git bisect bad 0628cda318df6baec439ca6e6e274007492f1ccd
>> # bad: [03324507e66c7664c754b1ef92c5c3be24c78aa2] driver core: Allow fwnode_operations.add_links to differentiate errors
>> git bisect bad 03324507e66c7664c754b1ef92c5c3be24c78aa2
>> # bad: [313f5dbba41d905d59c820bb2d91ee6c661aff99] debugfs: remove return value of debugfs_create_u16()
>> git bisect bad 313f5dbba41d905d59c820bb2d91ee6c661aff99
>> # good: [d4387cd117414ba80230f27a514be5ca4a09cfcc] of: property: Create device links for all child-supplier depencencies
>> git bisect good d4387cd117414ba80230f27a514be5ca4a09cfcc
>> # bad: [c31e73121f4c1ec45a3e523ac6ce3ce6dafdcec1] base: soc: Handle custom soc information sysfs entries
>> git bisect bad c31e73121f4c1ec45a3e523ac6ce3ce6dafdcec1
>> # bad: [201e91091b1d47047f55580b5474e1239f4d17aa] sh: add the sh_ prefix to early platform symbols
>> git bisect bad 201e91091b1d47047f55580b5474e1239f4d17aa
>> # bad: [507fd01d5333338753a1cc26322dfc9f856c109f] drivers: move the early platform device support to arch/sh
>> git bisect bad 507fd01d5333338753a1cc26322dfc9f856c109f
>> # first bad commit: [507fd01d5333338753a1cc26322dfc9f856c109f] drivers: move the early platform device support to arch/sh
> 
> Hi Guenter,
> 
> can you post some bootlogs? Is it the same problem everywhere?
> 

I don't have any useful logs. The boot fails too early for that.

Sorry, I don't understand "everywhere". It fails in mainline and -next, if that is what you mean.
And, yes, it has failed in -next for a while, looking back at the log history.

Guenter
Bartosz Golaszewski Dec. 2, 2019, 5:18 p.m. UTC | #7
pon., 2 gru 2019 o 14:03 Guenter Roeck <linux@roeck-us.net> napisał(a):
>
> On 12/1/19 11:40 PM, Bartosz Golaszewski wrote:
> > pon., 2 gru 2019 o 05:14 Guenter Roeck <linux@roeck-us.net> napisał(a):
> >>
> >> On Thu, Oct 03, 2019 at 11:29:12AM +0200, Bartosz Golaszewski wrote:
> >>> From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> >>>
> >>> SuperH is the only user of the current implementation of early platform
> >>> device support. We want to introduce a more robust approach to early
> >>> probing. As the first step - move all the current early platform code
> >>> to arch/sh.
> >>>
> >>> In order not to export internal drivers/base functions to arch code for
> >>> this temporary solution - copy the two needed routines for driver
> >>> matching from drivers/base/platform.c to arch/sh/drivers/platform_early.c.
> >>>
> >>> Also: call early_platform_cleanup() from subsys_initcall() so that it's
> >>> called after all early devices are probed.
> >>>
> >>> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> >>
> >> Wondering ... has anyone tested this patch on affected hardware ?
> >> All my qemu boot tests (both sh and sheb) fail because of it.
> >> Bisect log below.
> >>
> >> Guenter
> >>
> >> ---
> >> # bad: [72c0870e3a05d9cd5466d08c3d2a3069ed0a2f9f] Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
> >> # good: [89d57dddd7d319ded00415790a0bb3c954b7e386] Merge tag 'media/v5.5-1' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media
> >> git bisect start 'HEAD' '89d57dddd7d3'
> >> # good: [0a6cad5df541108cfd3fbd79eef48eb824c89bdc] Merge branch 'vmwgfx-coherent' of git://people.freedesktop.org/~thomash/linux into drm-next
> >> git bisect good 0a6cad5df541108cfd3fbd79eef48eb824c89bdc
> >> # bad: [9a3d7fd275be4559277667228902824165153c80] Merge tag 'driver-core-5.5-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core
> >> git bisect bad 9a3d7fd275be4559277667228902824165153c80
> >> # good: [59274c7164807d27b24e6c068dfe734f7bea4623] Merge tag 'usb-5.5-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb
> >> git bisect good 59274c7164807d27b24e6c068dfe734f7bea4623
> >> # good: [e71903106721dc53923e90aa484d78bc86c039a9] staging: mt7621-dma: align to match open parenthesis
> >> git bisect good e71903106721dc53923e90aa484d78bc86c039a9
> >> # good: [8f56e4ebe05c26c30e167519273843476e39e244] Merge tag 'char-misc-5.5-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc
> >> git bisect good 8f56e4ebe05c26c30e167519273843476e39e244
> >> # good: [8bde9f3d2a217d1635a7c7bdf8ad4c25c9a34b50] Merge tag 'iio-for-5.5c' of https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-next
> >> git bisect good 8bde9f3d2a217d1635a7c7bdf8ad4c25c9a34b50
> >> # bad: [0628cda318df6baec439ca6e6e274007492f1ccd] mac80211: Use debugfs_create_xul() helper
> >> git bisect bad 0628cda318df6baec439ca6e6e274007492f1ccd
> >> # bad: [03324507e66c7664c754b1ef92c5c3be24c78aa2] driver core: Allow fwnode_operations.add_links to differentiate errors
> >> git bisect bad 03324507e66c7664c754b1ef92c5c3be24c78aa2
> >> # bad: [313f5dbba41d905d59c820bb2d91ee6c661aff99] debugfs: remove return value of debugfs_create_u16()
> >> git bisect bad 313f5dbba41d905d59c820bb2d91ee6c661aff99
> >> # good: [d4387cd117414ba80230f27a514be5ca4a09cfcc] of: property: Create device links for all child-supplier depencencies
> >> git bisect good d4387cd117414ba80230f27a514be5ca4a09cfcc
> >> # bad: [c31e73121f4c1ec45a3e523ac6ce3ce6dafdcec1] base: soc: Handle custom soc information sysfs entries
> >> git bisect bad c31e73121f4c1ec45a3e523ac6ce3ce6dafdcec1
> >> # bad: [201e91091b1d47047f55580b5474e1239f4d17aa] sh: add the sh_ prefix to early platform symbols
> >> git bisect bad 201e91091b1d47047f55580b5474e1239f4d17aa
> >> # bad: [507fd01d5333338753a1cc26322dfc9f856c109f] drivers: move the early platform device support to arch/sh
> >> git bisect bad 507fd01d5333338753a1cc26322dfc9f856c109f
> >> # first bad commit: [507fd01d5333338753a1cc26322dfc9f856c109f] drivers: move the early platform device support to arch/sh
> >
> > Hi Guenter,
> >
> > can you post some bootlogs? Is it the same problem everywhere?
> >
>
> I don't have any useful logs. The boot fails too early for that.
>

Yeah, it touched "early" devices after all...

> Sorry, I don't understand "everywhere". It fails in mainline and -next, if that is what you mean.

I referred to "All my qemu boot tests" when saying everywhere.

I don't have any relevant HW - the idea for this patch is to stop
compiling for everyone a bunch of code that's only used by one largely
irrelevant architecture and free the namespace for a generic early
platform drivers implementation.

How are you creating your SH qemu images? I'm seeing there's something
in buildroot for superh - maybe I'll be able to build something
useful.

Bartosz

> And, yes, it has failed in -next for a while, looking back at the log history.
>
> Guenter
Guenter Roeck Dec. 2, 2019, 5:42 p.m. UTC | #8
On Mon, Dec 02, 2019 at 06:18:22PM +0100, Bartosz Golaszewski wrote:
> pon., 2 gru 2019 o 14:03 Guenter Roeck <linux@roeck-us.net> napisał(a):
> >
> > On 12/1/19 11:40 PM, Bartosz Golaszewski wrote:
> > > pon., 2 gru 2019 o 05:14 Guenter Roeck <linux@roeck-us.net> napisał(a):
> > >>
> > >> On Thu, Oct 03, 2019 at 11:29:12AM +0200, Bartosz Golaszewski wrote:
> > >>> From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> > >>>
> > >>> SuperH is the only user of the current implementation of early platform
> > >>> device support. We want to introduce a more robust approach to early
> > >>> probing. As the first step - move all the current early platform code
> > >>> to arch/sh.
> > >>>
> > >>> In order not to export internal drivers/base functions to arch code for
> > >>> this temporary solution - copy the two needed routines for driver
> > >>> matching from drivers/base/platform.c to arch/sh/drivers/platform_early.c.
> > >>>
> > >>> Also: call early_platform_cleanup() from subsys_initcall() so that it's
> > >>> called after all early devices are probed.
> > >>>
> > >>> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> > >>
> > >> Wondering ... has anyone tested this patch on affected hardware ?
> > >> All my qemu boot tests (both sh and sheb) fail because of it.
> > >> Bisect log below.
> > >>
> > >> Guenter
> > >>
> > >> ---
> > >> # bad: [72c0870e3a05d9cd5466d08c3d2a3069ed0a2f9f] Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
> > >> # good: [89d57dddd7d319ded00415790a0bb3c954b7e386] Merge tag 'media/v5.5-1' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media
> > >> git bisect start 'HEAD' '89d57dddd7d3'
> > >> # good: [0a6cad5df541108cfd3fbd79eef48eb824c89bdc] Merge branch 'vmwgfx-coherent' of git://people.freedesktop.org/~thomash/linux into drm-next
> > >> git bisect good 0a6cad5df541108cfd3fbd79eef48eb824c89bdc
> > >> # bad: [9a3d7fd275be4559277667228902824165153c80] Merge tag 'driver-core-5.5-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core
> > >> git bisect bad 9a3d7fd275be4559277667228902824165153c80
> > >> # good: [59274c7164807d27b24e6c068dfe734f7bea4623] Merge tag 'usb-5.5-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb
> > >> git bisect good 59274c7164807d27b24e6c068dfe734f7bea4623
> > >> # good: [e71903106721dc53923e90aa484d78bc86c039a9] staging: mt7621-dma: align to match open parenthesis
> > >> git bisect good e71903106721dc53923e90aa484d78bc86c039a9
> > >> # good: [8f56e4ebe05c26c30e167519273843476e39e244] Merge tag 'char-misc-5.5-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc
> > >> git bisect good 8f56e4ebe05c26c30e167519273843476e39e244
> > >> # good: [8bde9f3d2a217d1635a7c7bdf8ad4c25c9a34b50] Merge tag 'iio-for-5.5c' of https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-next
> > >> git bisect good 8bde9f3d2a217d1635a7c7bdf8ad4c25c9a34b50
> > >> # bad: [0628cda318df6baec439ca6e6e274007492f1ccd] mac80211: Use debugfs_create_xul() helper
> > >> git bisect bad 0628cda318df6baec439ca6e6e274007492f1ccd
> > >> # bad: [03324507e66c7664c754b1ef92c5c3be24c78aa2] driver core: Allow fwnode_operations.add_links to differentiate errors
> > >> git bisect bad 03324507e66c7664c754b1ef92c5c3be24c78aa2
> > >> # bad: [313f5dbba41d905d59c820bb2d91ee6c661aff99] debugfs: remove return value of debugfs_create_u16()
> > >> git bisect bad 313f5dbba41d905d59c820bb2d91ee6c661aff99
> > >> # good: [d4387cd117414ba80230f27a514be5ca4a09cfcc] of: property: Create device links for all child-supplier depencencies
> > >> git bisect good d4387cd117414ba80230f27a514be5ca4a09cfcc
> > >> # bad: [c31e73121f4c1ec45a3e523ac6ce3ce6dafdcec1] base: soc: Handle custom soc information sysfs entries
> > >> git bisect bad c31e73121f4c1ec45a3e523ac6ce3ce6dafdcec1
> > >> # bad: [201e91091b1d47047f55580b5474e1239f4d17aa] sh: add the sh_ prefix to early platform symbols
> > >> git bisect bad 201e91091b1d47047f55580b5474e1239f4d17aa
> > >> # bad: [507fd01d5333338753a1cc26322dfc9f856c109f] drivers: move the early platform device support to arch/sh
> > >> git bisect bad 507fd01d5333338753a1cc26322dfc9f856c109f
> > >> # first bad commit: [507fd01d5333338753a1cc26322dfc9f856c109f] drivers: move the early platform device support to arch/sh
> > >
> > > Hi Guenter,
> > >
> > > can you post some bootlogs? Is it the same problem everywhere?
> > >
> >
> > I don't have any useful logs. The boot fails too early for that.
> >
> 
> Yeah, it touched "early" devices after all...
> 
> > Sorry, I don't understand "everywhere". It fails in mainline and -next, if that is what you mean.
> 
> I referred to "All my qemu boot tests" when saying everywhere.
> 

Yes, it affects all my sh and sheb qemu boot tests.
See https://kerneltests.org/builders/.

> I don't have any relevant HW - the idea for this patch is to stop
> compiling for everyone a bunch of code that's only used by one largely
> irrelevant architecture and free the namespace for a generic early
> platform drivers implementation.
> 
> How are you creating your SH qemu images? I'm seeing there's something
> in buildroot for superh - maybe I'll be able to build something
> useful.
> 

I use buildroot. Various root file systems and scripts are at
https://github.com/groeck/linux-build-test/tree/master/rootfs/{sh,sheb}

Guenter
Guenter Roeck Dec. 3, 2019, 5:24 a.m. UTC | #9
On 12/2/19 9:18 AM, Bartosz Golaszewski wrote:
> pon., 2 gru 2019 o 14:03 Guenter Roeck <linux@roeck-us.net> napisał(a):
>>
>> On 12/1/19 11:40 PM, Bartosz Golaszewski wrote:
>>> pon., 2 gru 2019 o 05:14 Guenter Roeck <linux@roeck-us.net> napisał(a):
>>>>
>>>> On Thu, Oct 03, 2019 at 11:29:12AM +0200, Bartosz Golaszewski wrote:
>>>>> From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
>>>>>
>>>>> SuperH is the only user of the current implementation of early platform
>>>>> device support. We want to introduce a more robust approach to early
>>>>> probing. As the first step - move all the current early platform code
>>>>> to arch/sh.
>>>>>
>>>>> In order not to export internal drivers/base functions to arch code for
>>>>> this temporary solution - copy the two needed routines for driver
>>>>> matching from drivers/base/platform.c to arch/sh/drivers/platform_early.c.
>>>>>
>>>>> Also: call early_platform_cleanup() from subsys_initcall() so that it's
>>>>> called after all early devices are probed.
>>>>>
>>>>> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
>>>>
>>>> Wondering ... has anyone tested this patch on affected hardware ?
>>>> All my qemu boot tests (both sh and sheb) fail because of it.
>>>> Bisect log below.
>>>>
>>>> Guenter
>>>>
>>>> ---
>>>> # bad: [72c0870e3a05d9cd5466d08c3d2a3069ed0a2f9f] Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
>>>> # good: [89d57dddd7d319ded00415790a0bb3c954b7e386] Merge tag 'media/v5.5-1' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media
>>>> git bisect start 'HEAD' '89d57dddd7d3'
>>>> # good: [0a6cad5df541108cfd3fbd79eef48eb824c89bdc] Merge branch 'vmwgfx-coherent' of git://people.freedesktop.org/~thomash/linux into drm-next
>>>> git bisect good 0a6cad5df541108cfd3fbd79eef48eb824c89bdc
>>>> # bad: [9a3d7fd275be4559277667228902824165153c80] Merge tag 'driver-core-5.5-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core
>>>> git bisect bad 9a3d7fd275be4559277667228902824165153c80
>>>> # good: [59274c7164807d27b24e6c068dfe734f7bea4623] Merge tag 'usb-5.5-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb
>>>> git bisect good 59274c7164807d27b24e6c068dfe734f7bea4623
>>>> # good: [e71903106721dc53923e90aa484d78bc86c039a9] staging: mt7621-dma: align to match open parenthesis
>>>> git bisect good e71903106721dc53923e90aa484d78bc86c039a9
>>>> # good: [8f56e4ebe05c26c30e167519273843476e39e244] Merge tag 'char-misc-5.5-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc
>>>> git bisect good 8f56e4ebe05c26c30e167519273843476e39e244
>>>> # good: [8bde9f3d2a217d1635a7c7bdf8ad4c25c9a34b50] Merge tag 'iio-for-5.5c' of https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-next
>>>> git bisect good 8bde9f3d2a217d1635a7c7bdf8ad4c25c9a34b50
>>>> # bad: [0628cda318df6baec439ca6e6e274007492f1ccd] mac80211: Use debugfs_create_xul() helper
>>>> git bisect bad 0628cda318df6baec439ca6e6e274007492f1ccd
>>>> # bad: [03324507e66c7664c754b1ef92c5c3be24c78aa2] driver core: Allow fwnode_operations.add_links to differentiate errors
>>>> git bisect bad 03324507e66c7664c754b1ef92c5c3be24c78aa2
>>>> # bad: [313f5dbba41d905d59c820bb2d91ee6c661aff99] debugfs: remove return value of debugfs_create_u16()
>>>> git bisect bad 313f5dbba41d905d59c820bb2d91ee6c661aff99
>>>> # good: [d4387cd117414ba80230f27a514be5ca4a09cfcc] of: property: Create device links for all child-supplier depencencies
>>>> git bisect good d4387cd117414ba80230f27a514be5ca4a09cfcc
>>>> # bad: [c31e73121f4c1ec45a3e523ac6ce3ce6dafdcec1] base: soc: Handle custom soc information sysfs entries
>>>> git bisect bad c31e73121f4c1ec45a3e523ac6ce3ce6dafdcec1
>>>> # bad: [201e91091b1d47047f55580b5474e1239f4d17aa] sh: add the sh_ prefix to early platform symbols
>>>> git bisect bad 201e91091b1d47047f55580b5474e1239f4d17aa
>>>> # bad: [507fd01d5333338753a1cc26322dfc9f856c109f] drivers: move the early platform device support to arch/sh
>>>> git bisect bad 507fd01d5333338753a1cc26322dfc9f856c109f
>>>> # first bad commit: [507fd01d5333338753a1cc26322dfc9f856c109f] drivers: move the early platform device support to arch/sh
>>>
>>> Hi Guenter,
>>>
>>> can you post some bootlogs? Is it the same problem everywhere?
>>>
>>
>> I don't have any useful logs. The boot fails too early for that.
>>
> 
> Yeah, it touched "early" devices after all...
> 
>> Sorry, I don't understand "everywhere". It fails in mainline and -next, if that is what you mean.
> 
> I referred to "All my qemu boot tests" when saying everywhere.
> 
> I don't have any relevant HW - the idea for this patch is to stop
> compiling for everyone a bunch of code that's only used by one largely
> irrelevant architecture and free the namespace for a generic early
> platform drivers implementation.
> 
> How are you creating your SH qemu images? I'm seeing there's something
> in buildroot for superh - maybe I'll be able to bearly_platform_cleanupuild something
> useful.
> 

Below is a possible fix. As I had suspected, the call to early_platform_cleanup()
is in the wrong place.

Guenter

---
  arch/sh/drivers/platform_early.c | 11 ++---------
  drivers/base/platform.c          |  4 ++++
  2 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/arch/sh/drivers/platform_early.c b/arch/sh/drivers/platform_early.c
index f6d148451dfc..16f33bffd8fc 100644
--- a/arch/sh/drivers/platform_early.c
+++ b/arch/sh/drivers/platform_early.c
@@ -325,9 +325,9 @@ int __init sh_early_platform_driver_probe(char *class_str,
  }

  /**
- * sh_early_platform_cleanup - clean up early platform code
+ * early_platform_cleanup - clean up early platform code
   */
-static int __init sh_early_platform_cleanup(void)
+void early_platform_cleanup(void)
  {
  	struct platform_device *pd, *pd2;

@@ -337,11 +337,4 @@ static int __init sh_early_platform_cleanup(void)
  		list_del(&pd->dev.devres_head);
  		memset(&pd->dev.devres_head, 0, sizeof(pd->dev.devres_head));
  	}
-
-	return 0;
  }
-/*
- * This must happen once after all early devices are probed but before probing
- * real platform devices.
- */
-subsys_initcall(sh_early_platform_cleanup);
diff --git a/drivers/base/platform.c b/drivers/base/platform.c
index 7c532548b0a6..3ba153e356ee 100644
--- a/drivers/base/platform.c
+++ b/drivers/base/platform.c
@@ -1325,10 +1325,14 @@ struct device *platform_find_device_by_driver(struct device *start,
  }
  EXPORT_SYMBOL_GPL(platform_find_device_by_driver);

+void __weak early_platform_cleanup(void) { }
+
  int __init platform_bus_init(void)
  {
  	int error;

+	early_platform_cleanup();
+
  	error = device_register(&platform_bus);
  	if (error) {
  		put_device(&platform_bus);
Bartosz Golaszewski Dec. 3, 2019, 9:49 a.m. UTC | #10
wt., 3 gru 2019 o 06:24 Guenter Roeck <linux@roeck-us.net> napisał(a):
>
> On 12/2/19 9:18 AM, Bartosz Golaszewski wrote:
> > pon., 2 gru 2019 o 14:03 Guenter Roeck <linux@roeck-us.net> napisał(a):
> >>
> >> On 12/1/19 11:40 PM, Bartosz Golaszewski wrote:
> >>> pon., 2 gru 2019 o 05:14 Guenter Roeck <linux@roeck-us.net> napisał(a):
> >>>>
> >>>> On Thu, Oct 03, 2019 at 11:29:12AM +0200, Bartosz Golaszewski wrote:
> >>>>> From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> >>>>>
> >>>>> SuperH is the only user of the current implementation of early platform
> >>>>> device support. We want to introduce a more robust approach to early
> >>>>> probing. As the first step - move all the current early platform code
> >>>>> to arch/sh.
> >>>>>
> >>>>> In order not to export internal drivers/base functions to arch code for
> >>>>> this temporary solution - copy the two needed routines for driver
> >>>>> matching from drivers/base/platform.c to arch/sh/drivers/platform_early.c.
> >>>>>
> >>>>> Also: call early_platform_cleanup() from subsys_initcall() so that it's
> >>>>> called after all early devices are probed.
> >>>>>
> >>>>> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> >>>>
> >>>> Wondering ... has anyone tested this patch on affected hardware ?
> >>>> All my qemu boot tests (both sh and sheb) fail because of it.
> >>>> Bisect log below.
> >>>>
> >>>> Guenter
> >>>>
> >>>> ---
> >>>> # bad: [72c0870e3a05d9cd5466d08c3d2a3069ed0a2f9f] Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
> >>>> # good: [89d57dddd7d319ded00415790a0bb3c954b7e386] Merge tag 'media/v5.5-1' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media
> >>>> git bisect start 'HEAD' '89d57dddd7d3'
> >>>> # good: [0a6cad5df541108cfd3fbd79eef48eb824c89bdc] Merge branch 'vmwgfx-coherent' of git://people.freedesktop.org/~thomash/linux into drm-next
> >>>> git bisect good 0a6cad5df541108cfd3fbd79eef48eb824c89bdc
> >>>> # bad: [9a3d7fd275be4559277667228902824165153c80] Merge tag 'driver-core-5.5-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core
> >>>> git bisect bad 9a3d7fd275be4559277667228902824165153c80
> >>>> # good: [59274c7164807d27b24e6c068dfe734f7bea4623] Merge tag 'usb-5.5-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb
> >>>> git bisect good 59274c7164807d27b24e6c068dfe734f7bea4623
> >>>> # good: [e71903106721dc53923e90aa484d78bc86c039a9] staging: mt7621-dma: align to match open parenthesis
> >>>> git bisect good e71903106721dc53923e90aa484d78bc86c039a9
> >>>> # good: [8f56e4ebe05c26c30e167519273843476e39e244] Merge tag 'char-misc-5.5-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc
> >>>> git bisect good 8f56e4ebe05c26c30e167519273843476e39e244
> >>>> # good: [8bde9f3d2a217d1635a7c7bdf8ad4c25c9a34b50] Merge tag 'iio-for-5.5c' of https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-next
> >>>> git bisect good 8bde9f3d2a217d1635a7c7bdf8ad4c25c9a34b50
> >>>> # bad: [0628cda318df6baec439ca6e6e274007492f1ccd] mac80211: Use debugfs_create_xul() helper
> >>>> git bisect bad 0628cda318df6baec439ca6e6e274007492f1ccd
> >>>> # bad: [03324507e66c7664c754b1ef92c5c3be24c78aa2] driver core: Allow fwnode_operations.add_links to differentiate errors
> >>>> git bisect bad 03324507e66c7664c754b1ef92c5c3be24c78aa2
> >>>> # bad: [313f5dbba41d905d59c820bb2d91ee6c661aff99] debugfs: remove return value of debugfs_create_u16()
> >>>> git bisect bad 313f5dbba41d905d59c820bb2d91ee6c661aff99
> >>>> # good: [d4387cd117414ba80230f27a514be5ca4a09cfcc] of: property: Create device links for all child-supplier depencencies
> >>>> git bisect good d4387cd117414ba80230f27a514be5ca4a09cfcc
> >>>> # bad: [c31e73121f4c1ec45a3e523ac6ce3ce6dafdcec1] base: soc: Handle custom soc information sysfs entries
> >>>> git bisect bad c31e73121f4c1ec45a3e523ac6ce3ce6dafdcec1
> >>>> # bad: [201e91091b1d47047f55580b5474e1239f4d17aa] sh: add the sh_ prefix to early platform symbols
> >>>> git bisect bad 201e91091b1d47047f55580b5474e1239f4d17aa
> >>>> # bad: [507fd01d5333338753a1cc26322dfc9f856c109f] drivers: move the early platform device support to arch/sh
> >>>> git bisect bad 507fd01d5333338753a1cc26322dfc9f856c109f
> >>>> # first bad commit: [507fd01d5333338753a1cc26322dfc9f856c109f] drivers: move the early platform device support to arch/sh
> >>>
> >>> Hi Guenter,
> >>>
> >>> can you post some bootlogs? Is it the same problem everywhere?
> >>>
> >>
> >> I don't have any useful logs. The boot fails too early for that.
> >>
> >
> > Yeah, it touched "early" devices after all...
> >
> >> Sorry, I don't understand "everywhere". It fails in mainline and -next, if that is what you mean.
> >
> > I referred to "All my qemu boot tests" when saying everywhere.
> >
> > I don't have any relevant HW - the idea for this patch is to stop
> > compiling for everyone a bunch of code that's only used by one largely
> > irrelevant architecture and free the namespace for a generic early
> > platform drivers implementation.
> >
> > How are you creating your SH qemu images? I'm seeing there's something
> > in buildroot for superh - maybe I'll be able to bearly_platform_cleanupuild something
> > useful.
> >
>
> Below is a possible fix. As I had suspected, the call to early_platform_cleanup()
> is in the wrong place.
>

This makes sense. If it fixes the issue - do you want to send it to Greg?

Bart

> Guenter
>
> ---
>   arch/sh/drivers/platform_early.c | 11 ++---------
>   drivers/base/platform.c          |  4 ++++
>   2 files changed, 6 insertions(+), 9 deletions(-)
>
> diff --git a/arch/sh/drivers/platform_early.c b/arch/sh/drivers/platform_early.c
> index f6d148451dfc..16f33bffd8fc 100644
> --- a/arch/sh/drivers/platform_early.c
> +++ b/arch/sh/drivers/platform_early.c
> @@ -325,9 +325,9 @@ int __init sh_early_platform_driver_probe(char *class_str,
>   }
>
>   /**
> - * sh_early_platform_cleanup - clean up early platform code
> + * early_platform_cleanup - clean up early platform code
>    */
> -static int __init sh_early_platform_cleanup(void)
> +void early_platform_cleanup(void)
>   {
>         struct platform_device *pd, *pd2;
>
> @@ -337,11 +337,4 @@ static int __init sh_early_platform_cleanup(void)
>                 list_del(&pd->dev.devres_head);
>                 memset(&pd->dev.devres_head, 0, sizeof(pd->dev.devres_head));
>         }
> -
> -       return 0;
>   }
> -/*
> - * This must happen once after all early devices are probed but before probing
> - * real platform devices.
> - */
> -subsys_initcall(sh_early_platform_cleanup);
> diff --git a/drivers/base/platform.c b/drivers/base/platform.c
> index 7c532548b0a6..3ba153e356ee 100644
> --- a/drivers/base/platform.c
> +++ b/drivers/base/platform.c
> @@ -1325,10 +1325,14 @@ struct device *platform_find_device_by_driver(struct device *start,
>   }
>   EXPORT_SYMBOL_GPL(platform_find_device_by_driver);
>
> +void __weak early_platform_cleanup(void) { }
> +
>   int __init platform_bus_init(void)
>   {
>         int error;
>
> +       early_platform_cleanup();
> +
>         error = device_register(&platform_bus);
>         if (error) {
>                 put_device(&platform_bus);
>
Geert Uytterhoeven Dec. 3, 2019, 10:14 a.m. UTC | #11
Hi Bartosz, Günter,

On Tue, Dec 3, 2019 at 10:50 AM Bartosz Golaszewski <brgl@bgdev.pl> wrote:
> wt., 3 gru 2019 o 06:24 Guenter Roeck <linux@roeck-us.net> napisał(a):
> > On 12/2/19 9:18 AM, Bartosz Golaszewski wrote:
> > > pon., 2 gru 2019 o 14:03 Guenter Roeck <linux@roeck-us.net> napisał(a):
> > >>
> > >> On 12/1/19 11:40 PM, Bartosz Golaszewski wrote:
> > >>> pon., 2 gru 2019 o 05:14 Guenter Roeck <linux@roeck-us.net> napisał(a):
> > >>>>
> > >>>> On Thu, Oct 03, 2019 at 11:29:12AM +0200, Bartosz Golaszewski wrote:
> > >>>>> From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> > >>>>>
> > >>>>> SuperH is the only user of the current implementation of early platform
> > >>>>> device support. We want to introduce a more robust approach to early
> > >>>>> probing. As the first step - move all the current early platform code
> > >>>>> to arch/sh.
> > >>>>>
> > >>>>> In order not to export internal drivers/base functions to arch code for
> > >>>>> this temporary solution - copy the two needed routines for driver
> > >>>>> matching from drivers/base/platform.c to arch/sh/drivers/platform_early.c.
> > >>>>>
> > >>>>> Also: call early_platform_cleanup() from subsys_initcall() so that it's
> > >>>>> called after all early devices are probed.
> > >>>>>
> > >>>>> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> > >>>>
> > >>>> Wondering ... has anyone tested this patch on affected hardware ?
> > >>>> All my qemu boot tests (both sh and sheb) fail because of it.
> > >>>> Bisect log below.
> > >>>>
> > >>>> Guenter
> > >>>>
> > >>>> ---
> > >>>> # bad: [72c0870e3a05d9cd5466d08c3d2a3069ed0a2f9f] Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
> > >>>> # good: [89d57dddd7d319ded00415790a0bb3c954b7e386] Merge tag 'media/v5.5-1' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media
> > >>>> git bisect start 'HEAD' '89d57dddd7d3'
> > >>>> # good: [0a6cad5df541108cfd3fbd79eef48eb824c89bdc] Merge branch 'vmwgfx-coherent' of git://people.freedesktop.org/~thomash/linux into drm-next
> > >>>> git bisect good 0a6cad5df541108cfd3fbd79eef48eb824c89bdc
> > >>>> # bad: [9a3d7fd275be4559277667228902824165153c80] Merge tag 'driver-core-5.5-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core
> > >>>> git bisect bad 9a3d7fd275be4559277667228902824165153c80
> > >>>> # good: [59274c7164807d27b24e6c068dfe734f7bea4623] Merge tag 'usb-5.5-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb
> > >>>> git bisect good 59274c7164807d27b24e6c068dfe734f7bea4623
> > >>>> # good: [e71903106721dc53923e90aa484d78bc86c039a9] staging: mt7621-dma: align to match open parenthesis
> > >>>> git bisect good e71903106721dc53923e90aa484d78bc86c039a9
> > >>>> # good: [8f56e4ebe05c26c30e167519273843476e39e244] Merge tag 'char-misc-5.5-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc
> > >>>> git bisect good 8f56e4ebe05c26c30e167519273843476e39e244
> > >>>> # good: [8bde9f3d2a217d1635a7c7bdf8ad4c25c9a34b50] Merge tag 'iio-for-5.5c' of https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-next
> > >>>> git bisect good 8bde9f3d2a217d1635a7c7bdf8ad4c25c9a34b50
> > >>>> # bad: [0628cda318df6baec439ca6e6e274007492f1ccd] mac80211: Use debugfs_create_xul() helper
> > >>>> git bisect bad 0628cda318df6baec439ca6e6e274007492f1ccd
> > >>>> # bad: [03324507e66c7664c754b1ef92c5c3be24c78aa2] driver core: Allow fwnode_operations.add_links to differentiate errors
> > >>>> git bisect bad 03324507e66c7664c754b1ef92c5c3be24c78aa2
> > >>>> # bad: [313f5dbba41d905d59c820bb2d91ee6c661aff99] debugfs: remove return value of debugfs_create_u16()
> > >>>> git bisect bad 313f5dbba41d905d59c820bb2d91ee6c661aff99
> > >>>> # good: [d4387cd117414ba80230f27a514be5ca4a09cfcc] of: property: Create device links for all child-supplier depencencies
> > >>>> git bisect good d4387cd117414ba80230f27a514be5ca4a09cfcc
> > >>>> # bad: [c31e73121f4c1ec45a3e523ac6ce3ce6dafdcec1] base: soc: Handle custom soc information sysfs entries
> > >>>> git bisect bad c31e73121f4c1ec45a3e523ac6ce3ce6dafdcec1
> > >>>> # bad: [201e91091b1d47047f55580b5474e1239f4d17aa] sh: add the sh_ prefix to early platform symbols
> > >>>> git bisect bad 201e91091b1d47047f55580b5474e1239f4d17aa
> > >>>> # bad: [507fd01d5333338753a1cc26322dfc9f856c109f] drivers: move the early platform device support to arch/sh
> > >>>> git bisect bad 507fd01d5333338753a1cc26322dfc9f856c109f
> > >>>> # first bad commit: [507fd01d5333338753a1cc26322dfc9f856c109f] drivers: move the early platform device support to arch/sh
> > >>>
> > >>> Hi Guenter,
> > >>>
> > >>> can you post some bootlogs? Is it the same problem everywhere?
> > >>>
> > >>
> > >> I don't have any useful logs. The boot fails too early for that.
> > >>
> > >
> > > Yeah, it touched "early" devices after all...
> > >
> > >> Sorry, I don't understand "everywhere". It fails in mainline and -next, if that is what you mean.
> > >
> > > I referred to "All my qemu boot tests" when saying everywhere.
> > >
> > > I don't have any relevant HW - the idea for this patch is to stop
> > > compiling for everyone a bunch of code that's only used by one largely
> > > irrelevant architecture and free the namespace for a generic early
> > > platform drivers implementation.
> > >
> > > How are you creating your SH qemu images? I'm seeing there's something
> > > in buildroot for superh - maybe I'll be able to bearly_platform_cleanupuild something
> > > useful.
> > >
> >
> > Below is a possible fix. As I had suspected, the call to early_platform_cleanup()
> > is in the wrong place.
> >
>
> This makes sense. If it fixes the issue - do you want to send it to Greg?

Which tree does this patch apply to?
Oh, it's whitespace-damaged.

After applying it manually on top of current Linus' tree, (remote)
SH7722-based Migo-R boots again, so
Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>

There's still an issue with crashing userspace, but that happens on v5.4
too. Bisecting...

Gr{oetje,eeting}s,

                        Geert
Guenter Roeck Dec. 3, 2019, 2:36 p.m. UTC | #12
On 12/3/19 2:14 AM, Geert Uytterhoeven wrote:
> Hi Bartosz, Günter,
> 
> On Tue, Dec 3, 2019 at 10:50 AM Bartosz Golaszewski <brgl@bgdev.pl> wrote:
>> wt., 3 gru 2019 o 06:24 Guenter Roeck <linux@roeck-us.net> napisał(a):
>>> On 12/2/19 9:18 AM, Bartosz Golaszewski wrote:
>>>> pon., 2 gru 2019 o 14:03 Guenter Roeck <linux@roeck-us.net> napisał(a):
>>>>>
>>>>> On 12/1/19 11:40 PM, Bartosz Golaszewski wrote:
>>>>>> pon., 2 gru 2019 o 05:14 Guenter Roeck <linux@roeck-us.net> napisał(a):
>>>>>>>
>>>>>>> On Thu, Oct 03, 2019 at 11:29:12AM +0200, Bartosz Golaszewski wrote:
>>>>>>>> From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
>>>>>>>>
>>>>>>>> SuperH is the only user of the current implementation of early platform
>>>>>>>> device support. We want to introduce a more robust approach to early
>>>>>>>> probing. As the first step - move all the current early platform code
>>>>>>>> to arch/sh.
>>>>>>>>
>>>>>>>> In order not to export internal drivers/base functions to arch code for
>>>>>>>> this temporary solution - copy the two needed routines for driver
>>>>>>>> matching from drivers/base/platform.c to arch/sh/drivers/platform_early.c.
>>>>>>>>
>>>>>>>> Also: call early_platform_cleanup() from subsys_initcall() so that it's
>>>>>>>> called after all early devices are probed.
>>>>>>>>
>>>>>>>> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
>>>>>>>
>>>>>>> Wondering ... has anyone tested this patch on affected hardware ?
>>>>>>> All my qemu boot tests (both sh and sheb) fail because of it.
>>>>>>> Bisect log below.
>>>>>>>
>>>>>>> Guenter
>>>>>>>
>>>>>>> ---
>>>>>>> # bad: [72c0870e3a05d9cd5466d08c3d2a3069ed0a2f9f] Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
>>>>>>> # good: [89d57dddd7d319ded00415790a0bb3c954b7e386] Merge tag 'media/v5.5-1' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media
>>>>>>> git bisect start 'HEAD' '89d57dddd7d3'
>>>>>>> # good: [0a6cad5df541108cfd3fbd79eef48eb824c89bdc] Merge branch 'vmwgfx-coherent' of git://people.freedesktop.org/~thomash/linux into drm-next
>>>>>>> git bisect good 0a6cad5df541108cfd3fbd79eef48eb824c89bdc
>>>>>>> # bad: [9a3d7fd275be4559277667228902824165153c80] Merge tag 'driver-core-5.5-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core
>>>>>>> git bisect bad 9a3d7fd275be4559277667228902824165153c80
>>>>>>> # good: [59274c7164807d27b24e6c068dfe734f7bea4623] Merge tag 'usb-5.5-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb
>>>>>>> git bisect good 59274c7164807d27b24e6c068dfe734f7bea4623
>>>>>>> # good: [e71903106721dc53923e90aa484d78bc86c039a9] staging: mt7621-dma: align to match open parenthesis
>>>>>>> git bisect good e71903106721dc53923e90aa484d78bc86c039a9
>>>>>>> # good: [8f56e4ebe05c26c30e167519273843476e39e244] Merge tag 'char-misc-5.5-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc
>>>>>>> git bisect good 8f56e4ebe05c26c30e167519273843476e39e244
>>>>>>> # good: [8bde9f3d2a217d1635a7c7bdf8ad4c25c9a34b50] Merge tag 'iio-for-5.5c' of https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-next
>>>>>>> git bisect good 8bde9f3d2a217d1635a7c7bdf8ad4c25c9a34b50
>>>>>>> # bad: [0628cda318df6baec439ca6e6e274007492f1ccd] mac80211: Use debugfs_create_xul() helper
>>>>>>> git bisect bad 0628cda318df6baec439ca6e6e274007492f1ccd
>>>>>>> # bad: [03324507e66c7664c754b1ef92c5c3be24c78aa2] driver core: Allow fwnode_operations.add_links to differentiate errors
>>>>>>> git bisect bad 03324507e66c7664c754b1ef92c5c3be24c78aa2
>>>>>>> # bad: [313f5dbba41d905d59c820bb2d91ee6c661aff99] debugfs: remove return value of debugfs_create_u16()
>>>>>>> git bisect bad 313f5dbba41d905d59c820bb2d91ee6c661aff99
>>>>>>> # good: [d4387cd117414ba80230f27a514be5ca4a09cfcc] of: property: Create device links for all child-supplier depencencies
>>>>>>> git bisect good d4387cd117414ba80230f27a514be5ca4a09cfcc
>>>>>>> # bad: [c31e73121f4c1ec45a3e523ac6ce3ce6dafdcec1] base: soc: Handle custom soc information sysfs entries
>>>>>>> git bisect bad c31e73121f4c1ec45a3e523ac6ce3ce6dafdcec1
>>>>>>> # bad: [201e91091b1d47047f55580b5474e1239f4d17aa] sh: add the sh_ prefix to early platform symbols
>>>>>>> git bisect bad 201e91091b1d47047f55580b5474e1239f4d17aa
>>>>>>> # bad: [507fd01d5333338753a1cc26322dfc9f856c109f] drivers: move the early platform device support to arch/sh
>>>>>>> git bisect bad 507fd01d5333338753a1cc26322dfc9f856c109f
>>>>>>> # first bad commit: [507fd01d5333338753a1cc26322dfc9f856c109f] drivers: move the early platform device support to arch/sh
>>>>>>
>>>>>> Hi Guenter,
>>>>>>
>>>>>> can you post some bootlogs? Is it the same problem everywhere?
>>>>>>
>>>>>
>>>>> I don't have any useful logs. The boot fails too early for that.
>>>>>
>>>>
>>>> Yeah, it touched "early" devices after all...
>>>>
>>>>> Sorry, I don't understand "everywhere". It fails in mainline and -next, if that is what you mean.
>>>>
>>>> I referred to "All my qemu boot tests" when saying everywhere.
>>>>
>>>> I don't have any relevant HW - the idea for this patch is to stop
>>>> compiling for everyone a bunch of code that's only used by one largely
>>>> irrelevant architecture and free the namespace for a generic early
>>>> platform drivers implementation.
>>>>
>>>> How are you creating your SH qemu images? I'm seeing there's something
>>>> in buildroot for superh - maybe I'll be able to bearly_platform_cleanupuild something
>>>> useful.
>>>>
>>>
>>> Below is a possible fix. As I had suspected, the call to early_platform_cleanup()
>>> is in the wrong place.
>>>
>>
>> This makes sense. If it fixes the issue - do you want to send it to Greg?
> 
> Which tree does this patch apply to?
> Oh, it's whitespace-damaged.
> 

Sorry, that wasn't meant to be applicable, just a hack to confirm my suspicion.
I'll clean it up and submit it.

Thanks,
Guenter

> After applying it manually on top of current Linus' tree, (remote)
> SH7722-based Migo-R boots again, so
> Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>
> 
> There's still an issue with crashing userspace, but that happens on v5.4
> too. Bisecting...
> 
> Gr{oetje,eeting}s,
> 
>                          Geert
>