Skip to content

Commit fd26f3a

Browse files
mpegregkh
authored andcommitted
powerpc/pseries: Only register vio drivers if vio bus exists
[ Upstream commit 11d9215 ] 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 4336b93 ("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: 4336b93 ("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> Tested-by: Paul Menzel <pmenzel@molgen.mpg.de> Reviewed-by: Tyrel Datwyler <tyreld@linux.ibm.com> Link: https://lore.kernel.org/r/20210316010938.525657-1-mpe@ellerman.id.au Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 4877c4a commit fd26f3a

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

  • arch/powerpc/platforms/pseries

‎arch/powerpc/platforms/pseries/vio.c‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1286,6 +1286,10 @@ static int vio_bus_remove(struct device *dev)
12861286
int __vio_register_driver(struct vio_driver *viodrv, struct module *owner,
12871287
const char *mod_name)
12881288
{
1289+
// vio_bus_type is only initialised for pseries
1290+
if (!machine_is(pseries))
1291+
return -ENODEV;
1292+
12891293
pr_debug("%s: driver %s registering\n", __func__, viodrv->name);
12901294

12911295
/* fill in 'struct driver' fields */

0 commit comments

Comments
 (0)