Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4680912pxj; Wed, 12 May 2021 10:44:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyFA3m665n6JHP0W/VWp+a8c353cyaGr2eDLefHj1fAytPv80qRnoZy6bs5FDAUGK5qHTn7 X-Received: by 2002:aa7:c2cc:: with SMTP id m12mr45014265edp.1.1620841394319; Wed, 12 May 2021 10:43:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620841394; cv=none; d=google.com; s=arc-20160816; b=AQiZAD8uX0vAZ0EVZOt2HM0h5mNKmqhAiFmy/1ogIjcfHKmnvkQFuPS+lNMM7JgTg6 UaGRupmBLm8XfOfHz9cB4rh4S4jFMF5AdjnSLdD2BXiUDL9AyhA9n1jyoPNC/KUJV0N8 9bdQUkcAH0o/R3zXDM+SLIsMeRxehOCtvykwvZkN2rXxOtoYzc2vJOsvBNzswX12PaeC mWRP+JcxDg8BG6IzsMsJlEvMCsKXz37ZA/tb/Tvl2QsaKh0XiPuo5TXVjBWnksT8X1TL y5hyn9BqkIV5mkMniuTOL9l12MKUU8MFiWoVy+/tJmtPbnfCYj4uk4e2af2432IECCYk K5XQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=afK+aDN2rFz2fVlVBX4JxJ8c6qS5+AiexUB4ztZ9bEo=; b=MbyzJtrrYT9Jdn/AtqtPR3cS2MfwBhbKLyuI012Bh5iuoOQkoz8eDUsYRndZukhJ1O FNHRYaVeWRz1rhyKLOsjzwU2ll2VBMfKAUTUjBycwi8a2jHUXWn9AjAj1POv0+i429n+ fshuHzAYRU/zWThOwj31bk23MC2jNnovg3+TvGJ8LYbu8hjE2BXqw8pjydndDV5c3Mah OYcXKYApuM7voHYL2ugZ38W10xb0c3/V6mB71+aD5DeFYIalzcAjFtFzM+N+paljWJdj iyHHREJTvuHs3CKTsGYnyFBXKEoCe/WOiGzXDyrpP/nKz0AbcQO3Iuq8cp/ZiNkxBOQ2 4TeA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=BgLIcDOP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b15si331295eds.133.2021.05.12.10.42.49; Wed, 12 May 2021 10:43:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=BgLIcDOP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349405AbhELRmC (ORCPT + 99 others); Wed, 12 May 2021 13:42:02 -0400 Received: from mail.kernel.org ([198.145.29.99]:51344 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238495AbhELQPN (ORCPT ); Wed, 12 May 2021 12:15:13 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id D406E61419; Wed, 12 May 2021 15:42:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620834151; bh=Ip3zgyeZub5VEfzgBL6PdRbTF4F0CsaZQvfLmEkXS0s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BgLIcDOPS3HavlijgwqJky1Cy3QCGjLXJN4eaHKiV4Et9iXrOmifd7CrvnqgWs5Cz /3jTsOW1KMVdAgZ3ekEPD9FTukfXNKCHwXAJ6Ijt1J+gSRnJ61TEuG2MBZ7tQmy3q/ y44Iq84j7ZtDVVvS1KakCM0c09aD9xYrzUQuv7n4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Paul Menzel , Michael Ellerman , Tyrel Datwyler , Sasha Levin Subject: [PATCH 5.11 428/601] powerpc/pseries: Only register vio drivers if vio bus exists Date: Wed, 12 May 2021 16:48:25 +0200 Message-Id: <20210512144841.928844164@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210512144827.811958675@linuxfoundation.org> References: <20210512144827.811958675@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Michael Ellerman [ Upstream commit 11d92156f7a862091009d7655d19c1e7de37fc7a ] 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 Signed-off-by: Michael Ellerman Tested-by: Paul Menzel Reviewed-by: Tyrel Datwyler Link: https://lore.kernel.org/r/20210316010938.525657-1-mpe@ellerman.id.au Signed-off-by: Sasha Levin --- 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 b2797cfe4e2b..68276e05502b 100644 --- a/arch/powerpc/platforms/pseries/vio.c +++ b/arch/powerpc/platforms/pseries/vio.c @@ -1286,6 +1286,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.30.2