All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] powerpc/pseries: Only register vio drivers if vio bus exists
@ 2021-03-16  1:09 Michael Ellerman
  2021-03-30 10:32 ` Paul Menzel
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Michael Ellerman @ 2021-03-16  1:09 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: pmenzel

The vio bus is a fake bus, which we use on pseries LPARs (guests) to
discover devices provided by the hypervisor. There's no need or sense
in creating the vio bus on bare metal systems.

Which is why commit 4336b9337824 ("powerpc/pseries: Make vio and
ibmebus initcalls pseries specific") made the initialisation of the
vio bus only happen in LPARs.

However as a result of that commit we now see errors at boot on bare
metal systems:

  Driver 'hvc_console' was unable to register with bus_type 'vio' because the bus was not initialized.
  Driver 'tpm_ibmvtpm' was unable to register with bus_type 'vio' because the bus was not initialized.

This happens because those drivers are built-in, and are calling
vio_register_driver(). It in turn calls driver_register() with a
reference to vio_bus_type, but we haven't registered vio_bus_type with
the driver core.

Fix it by also guarding vio_register_driver() with a check to see if
we are on pseries.

Fixes: 4336b9337824 ("powerpc/pseries: Make vio and ibmebus initcalls pseries specific")
Reported-by: Paul Menzel <pmenzel@molgen.mpg.de>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
---
 arch/powerpc/platforms/pseries/vio.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/powerpc/platforms/pseries/vio.c b/arch/powerpc/platforms/pseries/vio.c
index 9cb4fc839fd5..429053d0402a 100644
--- a/arch/powerpc/platforms/pseries/vio.c
+++ b/arch/powerpc/platforms/pseries/vio.c
@@ -1285,6 +1285,10 @@ static int vio_bus_remove(struct device *dev)
 int __vio_register_driver(struct vio_driver *viodrv, struct module *owner,
 			  const char *mod_name)
 {
+	// vio_bus_type is only initialised for pseries
+	if (!machine_is(pseries))
+		return -ENODEV;
+
 	pr_debug("%s: driver %s registering\n", __func__, viodrv->name);
 
 	/* fill in 'struct driver' fields */
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] powerpc/pseries: Only register vio drivers if vio bus exists
  2021-03-16  1:09 [PATCH] powerpc/pseries: Only register vio drivers if vio bus exists Michael Ellerman
@ 2021-03-30 10:32 ` Paul Menzel
  2021-03-31  4:38   ` Michael Ellerman
  2021-03-30 19:57 ` Tyrel Datwyler
  2021-04-10 14:28 ` Michael Ellerman
  2 siblings, 1 reply; 5+ messages in thread
From: Paul Menzel @ 2021-03-30 10:32 UTC (permalink / raw)
  To: Michael Ellerman; +Cc: linuxppc-dev

Dear Michael,


Am 16.03.21 um 02:09 schrieb Michael Ellerman:
> The vio bus is a fake bus, which we use on pseries LPARs (guests) to
> discover devices provided by the hypervisor. There's no need or sense
> in creating the vio bus on bare metal systems.
> 
> Which is why commit 4336b9337824 ("powerpc/pseries: Make vio and
> ibmebus initcalls pseries specific") made the initialisation of the
> vio bus only happen in LPARs.
> 
> However as a result of that commit we now see errors at boot on bare
> metal systems:
> 
>    Driver 'hvc_console' was unable to register with bus_type 'vio' because the bus was not initialized.
>    Driver 'tpm_ibmvtpm' was unable to register with bus_type 'vio' because the bus was not initialized.
> 
> This happens because those drivers are built-in, and are calling
> vio_register_driver(). It in turn calls driver_register() with a
> reference to vio_bus_type, but we haven't registered vio_bus_type with
> the driver core.
> 
> Fix it by also guarding vio_register_driver() with a check to see if
> we are on pseries.
> 
> Fixes: 4336b9337824 ("powerpc/pseries: Make vio and ibmebus initcalls pseries specific")
> Reported-by: Paul Menzel <pmenzel@molgen.mpg.de>
> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
> ---
>   arch/powerpc/platforms/pseries/vio.c | 4 ++++
>   1 file changed, 4 insertions(+)
> 
> diff --git a/arch/powerpc/platforms/pseries/vio.c b/arch/powerpc/platforms/pseries/vio.c
> index 9cb4fc839fd5..429053d0402a 100644
> --- a/arch/powerpc/platforms/pseries/vio.c
> +++ b/arch/powerpc/platforms/pseries/vio.c
> @@ -1285,6 +1285,10 @@ static int vio_bus_remove(struct device *dev)
>   int __vio_register_driver(struct vio_driver *viodrv, struct module *owner,
>   			  const char *mod_name)
>   {
> +	// vio_bus_type is only initialised for pseries
> +	if (!machine_is(pseries))
> +		return -ENODEV;
> +
>   	pr_debug("%s: driver %s registering\n", __func__, viodrv->name);
>   
>   	/* fill in 'struct driver' fields */

Thank you. The errors are gone now.

Tested-by: Paul Menzel <pmenzel@molgen.mpg.de> # IBM S822L (POWER8)

As it fixes a commit from Linux 5.8, should it be tagged for the stable 
releases, or is it going to be picked up automatically due to the Fixes tag?


Kind regards,

Paul

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] powerpc/pseries: Only register vio drivers if vio bus exists
  2021-03-16  1:09 [PATCH] powerpc/pseries: Only register vio drivers if vio bus exists Michael Ellerman
  2021-03-30 10:32 ` Paul Menzel
@ 2021-03-30 19:57 ` Tyrel Datwyler
  2021-04-10 14:28 ` Michael Ellerman
  2 siblings, 0 replies; 5+ messages in thread
From: Tyrel Datwyler @ 2021-03-30 19:57 UTC (permalink / raw)
  To: Michael Ellerman, linuxppc-dev; +Cc: pmenzel

On 3/15/21 6:09 PM, Michael Ellerman wrote:
> The vio bus is a fake bus, which we use on pseries LPARs (guests) to
> discover devices provided by the hypervisor. There's no need or sense
> in creating the vio bus on bare metal systems.
> 
> Which is why commit 4336b9337824 ("powerpc/pseries: Make vio and
> ibmebus initcalls pseries specific") made the initialisation of the
> vio bus only happen in LPARs.
> 
> However as a result of that commit we now see errors at boot on bare
> metal systems:
> 
>   Driver 'hvc_console' was unable to register with bus_type 'vio' because the bus was not initialized.
>   Driver 'tpm_ibmvtpm' was unable to register with bus_type 'vio' because the bus was not initialized.
> 
> This happens because those drivers are built-in, and are calling
> vio_register_driver(). It in turn calls driver_register() with a
> reference to vio_bus_type, but we haven't registered vio_bus_type with
> the driver core.
> 
> Fix it by also guarding vio_register_driver() with a check to see if
> we are on pseries.
> 
> Fixes: 4336b9337824 ("powerpc/pseries: Make vio and ibmebus initcalls pseries specific")
> Reported-by: Paul Menzel <pmenzel@molgen.mpg.de>
> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
> ---

Reviewed-by: Tyrel Datwyler <tyreld@linux.ibm.com>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] powerpc/pseries: Only register vio drivers if vio bus exists
  2021-03-30 10:32 ` Paul Menzel
@ 2021-03-31  4:38   ` Michael Ellerman
  0 siblings, 0 replies; 5+ messages in thread
From: Michael Ellerman @ 2021-03-31  4:38 UTC (permalink / raw)
  To: Paul Menzel; +Cc: linuxppc-dev

Paul Menzel <pmenzel@molgen.mpg.de> writes:
> Am 16.03.21 um 02:09 schrieb Michael Ellerman:
>> The vio bus is a fake bus, which we use on pseries LPARs (guests) to
>> discover devices provided by the hypervisor. There's no need or sense
>> in creating the vio bus on bare metal systems.
>> 
>> Which is why commit 4336b9337824 ("powerpc/pseries: Make vio and
>> ibmebus initcalls pseries specific") made the initialisation of the
>> vio bus only happen in LPARs.
>> 
>> However as a result of that commit we now see errors at boot on bare
>> metal systems:
>> 
>>    Driver 'hvc_console' was unable to register with bus_type 'vio' because the bus was not initialized.
>>    Driver 'tpm_ibmvtpm' was unable to register with bus_type 'vio' because the bus was not initialized.
>> 
>> This happens because those drivers are built-in, and are calling
>> vio_register_driver(). It in turn calls driver_register() with a
>> reference to vio_bus_type, but we haven't registered vio_bus_type with
>> the driver core.
>> 
>> Fix it by also guarding vio_register_driver() with a check to see if
>> we are on pseries.
>> 
>> Fixes: 4336b9337824 ("powerpc/pseries: Make vio and ibmebus initcalls pseries specific")
>> Reported-by: Paul Menzel <pmenzel@molgen.mpg.de>
>> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
>> ---
>>   arch/powerpc/platforms/pseries/vio.c | 4 ++++
>>   1 file changed, 4 insertions(+)
>> 
>> diff --git a/arch/powerpc/platforms/pseries/vio.c b/arch/powerpc/platforms/pseries/vio.c
>> index 9cb4fc839fd5..429053d0402a 100644
>> --- a/arch/powerpc/platforms/pseries/vio.c
>> +++ b/arch/powerpc/platforms/pseries/vio.c
>> @@ -1285,6 +1285,10 @@ static int vio_bus_remove(struct device *dev)
>>   int __vio_register_driver(struct vio_driver *viodrv, struct module *owner,
>>   			  const char *mod_name)
>>   {
>> +	// vio_bus_type is only initialised for pseries
>> +	if (!machine_is(pseries))
>> +		return -ENODEV;
>> +
>>   	pr_debug("%s: driver %s registering\n", __func__, viodrv->name);
>>   
>>   	/* fill in 'struct driver' fields */
>
> Thank you. The errors are gone now.
>
> Tested-by: Paul Menzel <pmenzel@molgen.mpg.de> # IBM S822L (POWER8)
>
> As it fixes a commit from Linux 5.8, should it be tagged for the stable 
> releases, or is it going to be picked up automatically due to the Fixes tag?

It's not what I'd describe as a bad bug, so I'm not that inclined to
tag it for stable.

But given it has a Fixes tag, and is quite small, the bots will probably
backport it automatically.

cheers

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] powerpc/pseries: Only register vio drivers if vio bus exists
  2021-03-16  1:09 [PATCH] powerpc/pseries: Only register vio drivers if vio bus exists Michael Ellerman
  2021-03-30 10:32 ` Paul Menzel
  2021-03-30 19:57 ` Tyrel Datwyler
@ 2021-04-10 14:28 ` Michael Ellerman
  2 siblings, 0 replies; 5+ messages in thread
From: Michael Ellerman @ 2021-04-10 14:28 UTC (permalink / raw)
  To: Michael Ellerman, linuxppc-dev; +Cc: pmenzel

On Tue, 16 Mar 2021 12:09:38 +1100, Michael Ellerman wrote:
> The vio bus is a fake bus, which we use on pseries LPARs (guests) to
> discover devices provided by the hypervisor. There's no need or sense
> in creating the vio bus on bare metal systems.
> 
> Which is why commit 4336b9337824 ("powerpc/pseries: Make vio and
> ibmebus initcalls pseries specific") made the initialisation of the
> vio bus only happen in LPARs.
> 
> [...]

Applied to powerpc/next.

[1/1] powerpc/pseries: Only register vio drivers if vio bus exists
      https://git.kernel.org/powerpc/c/11d92156f7a862091009d7655d19c1e7de37fc7a

cheers

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-04-10 14:33 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-16  1:09 [PATCH] powerpc/pseries: Only register vio drivers if vio bus exists Michael Ellerman
2021-03-30 10:32 ` Paul Menzel
2021-03-31  4:38   ` Michael Ellerman
2021-03-30 19:57 ` Tyrel Datwyler
2021-04-10 14:28 ` Michael Ellerman

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.