Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4619743pxj; Wed, 12 May 2021 09:22:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwPa2ND2w4WRJ/xXv4/J3/d7xAllBNV5zr7Pvpr+NsHt2MsqiDbM8NeOR5jJ6ZVeoqj358i X-Received: by 2002:a9d:2c69:: with SMTP id f96mr30843837otb.242.1620836559785; Wed, 12 May 2021 09:22:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620836559; cv=none; d=google.com; s=arc-20160816; b=hNraJ7Schy/6ma1jZfHuzcv5WmTKEi1nlZ9Outk4zIkESboUyj9aoln3MPcF2AbNBc IAJ5Qu1ql2pn+OAegFaNmpn3me/J3L/L3WPFiLLeMN20dm0QBVYl+VpA0Mp5Up2TI5RC hlicLKdKewgceWIrh/7KuV5vJe+6Y+lXFBHYQg1L4baoF25qHqSbz9w3Z3ILvG3VHcId Xy4s0aBlWceMspvcxK+/7wDyAEFRcyeBsNuiC1Q303pxleOzuST+iMxLvVOCyQRgOVxk J8o2HC9j7kMvA2Fp+VMBSu6vy+3ld5e7GNjxKtrKwWmySnfO1rhnD2/6gBeWPGOGyqPO zKKg== 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=IJzu6B6YX8iI5pRutxTqbqXJDDZ3MDxyuuvKQzpObuqRwrbUFRVsPUCb4WPr9HeLwP 5AluNqbwWbqsA5wEbf9hQ2nMzlLoscaBIRPsu6Ba6xzpanRkId2zo718a1ukCzRngvY8 6JKSrUYbCAwKTKPI0ziE75LrN51l6sQg+BFEO1mHkbkYHUm9gAL9tA0QikQh5gs1h2FX hBY7BAZ9ZNoiYwOTH3i1KnTUZmc3IC5JMQtOK/YOlEmHTplMIuJuu04yTUkGfYlT5Aay 3yWCVJKQaydiKF0XkwAgBgUP6uYfNKXY20dUQYFraBXkOOlKW5wFmM5aKSLRaFP+nhJR hCfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="DZIM/kKM"; 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 m3si255448ote.193.2021.05.12.09.22.26; Wed, 12 May 2021 09:22:39 -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="DZIM/kKM"; 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 S240677AbhELQSl (ORCPT + 99 others); Wed, 12 May 2021 12:18:41 -0400 Received: from mail.kernel.org ([198.145.29.99]:55290 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235710AbhELPgB (ORCPT ); Wed, 12 May 2021 11:36:01 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 8F02F61108; Wed, 12 May 2021 15:18:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620832683; bh=Ip3zgyeZub5VEfzgBL6PdRbTF4F0CsaZQvfLmEkXS0s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DZIM/kKM6LcP9u3kXyTI2NX4Ke7WpfQ1piHhgRz30ofPq/KsgfNvAmNo2lsVgQSrU WlL9VqhCjyBorw8wZLwxPySdMv6BYwV9ih8oaG2u/2y2z8iVAbwRx1UEQ8Gjvj3E/M B2WsWiqPlh9LvghJnlk7sUE6V/pfO6dwrzS2aqdc= 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.10 381/530] powerpc/pseries: Only register vio drivers if vio bus exists Date: Wed, 12 May 2021 16:48:11 +0200 Message-Id: <20210512144832.295961264@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210512144819.664462530@linuxfoundation.org> References: <20210512144819.664462530@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