Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp2078241ybp; Thu, 10 Oct 2019 01:47:56 -0700 (PDT) X-Google-Smtp-Source: APXvYqxkdWAg9L8sZqqNKN/VYoR4Ha6SkU8nSaNu4pI4siMixRDEF3B0z6r4gVRocOyfMg1Gm+oF X-Received: by 2002:a17:906:d964:: with SMTP id rp4mr6792895ejb.147.1570697276472; Thu, 10 Oct 2019 01:47:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570697276; cv=none; d=google.com; s=arc-20160816; b=zEQsltQRoaHPlKcsCOmgM2lnt4XoHJQKHq6dlVu75q/YKk9FJZWzsklim2IKLh1Uqt nd6HJFCQDwxl7J5gSEl119GqU2X2UqstlLIIvfXwzzx3yAwS1T4JIEURcd13FUN9pvRS bJMqaezX2z1sT0SsG9/KQLQOnrYBkrX3DYymAUOVZPDzGNQyMVNjAz8n9BgMjv2gEnNf YBfBrr1yWB1TMaBS5PJ3MhMbc0DehfpGP43iHkf9olIdmhm1Uu+PoWKuzzje92SuXtWz 1FC3Mic/NJyORjm3RUxspmTsrZ7lnMK+HTRj1C92PreLS5ALTcmqO2shrWtFchAwJZaH hGMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=DHdcHU1KXFbj08UfLDE5UorGMYRhi1wa2RMxS/D36tE=; b=blwhHGwBJ3EeYU3IqYMbJjj68KvT7hadchq7kjQFcdrnr6C3BYm+tMvUqStrSAegqh UHOKXg65akZgW5h6ugA6gnO2rlBy3IchPU6P9aGRkgz2iQ7c355j6bbVQlK05Zfo/Xc9 W6n/xwnBE+tfDAPzDdwdBultCnnIuU+uGbXc+vB07WPZs8LVin86T4vzewLIakrYHvgz b8MTI6dXt17WmAmaY0pWQ2kT6dabOm9Z3oaQey9Yp4G25PyD8qXaxegcbfssml7M9lyh ZuuOYf0UoMHiWMLBF2QPmSqX9boW4dLzJgZqhoRnoddOIMkQDZAprme9gzcwdkxyKkAS WX6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=SOqxFBWk; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e21si3512481edb.164.2019.10.10.01.47.33; Thu, 10 Oct 2019 01:47:56 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=SOqxFBWk; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388943AbfJJIo3 (ORCPT + 99 others); Thu, 10 Oct 2019 04:44:29 -0400 Received: from mail.kernel.org ([198.145.29.99]:49666 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388932AbfJJIo2 (ORCPT ); Thu, 10 Oct 2019 04:44:28 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 02B4D2054F; Thu, 10 Oct 2019 08:44:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570697067; bh=ESmn47NdpDrnRFhWFMS6oHzR/zZ0XeYN/LYzXWP7Urs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SOqxFBWkKsW+csOq3eB7yI2602UkkrJAmMrMhdg7NAqRx/6xNyIEAEPMFpiUECYD/ E3pnk/cWM4Jjnsq1PUfuzQMeTtBxpWDwU5Eb9/o5bJhPXtEzYG3EzwoLoDTkYSfAHk 5f84E9YEVKhE9tN1y9iiJrxEOU/pphozqdR7+VWU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Michel=20D=C3=A4nzer?= , Hans de Goede , Alex Deucher , Sasha Levin Subject: [PATCH 5.3 135/148] drm/radeon: Bail earlier when radeon.cik_/si_support=0 is passed Date: Thu, 10 Oct 2019 10:36:36 +0200 Message-Id: <20191010083620.545054451@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191010083609.660878383@linuxfoundation.org> References: <20191010083609.660878383@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Hans de Goede [ Upstream commit 9dbc88d013b79c62bd845cb9e7c0256e660967c5 ] Bail from the pci_driver probe function instead of from the drm_driver load function. This avoid /dev/dri/card0 temporarily getting registered and then unregistered again, sending unwanted add / remove udev events to userspace. Specifically this avoids triggering the (userspace) bug fixed by this plymouth merge-request: https://gitlab.freedesktop.org/plymouth/plymouth/merge_requests/59 Note that despite that being an userspace bug, not sending unnecessary udev events is a good idea in general. BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1490490 Reviewed-by: Michel Dänzer Signed-off-by: Hans de Goede Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- drivers/gpu/drm/radeon/radeon_drv.c | 31 +++++++++++++++++++++++++++++ drivers/gpu/drm/radeon/radeon_kms.c | 25 ----------------------- 2 files changed, 31 insertions(+), 25 deletions(-) diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c index 15d7bebe17294..5cc0fbb04ab14 100644 --- a/drivers/gpu/drm/radeon/radeon_drv.c +++ b/drivers/gpu/drm/radeon/radeon_drv.c @@ -325,8 +325,39 @@ bool radeon_device_is_virtual(void); static int radeon_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) { + unsigned long flags = 0; int ret; + if (!ent) + return -ENODEV; /* Avoid NULL-ptr deref in drm_get_pci_dev */ + + flags = ent->driver_data; + + if (!radeon_si_support) { + switch (flags & RADEON_FAMILY_MASK) { + case CHIP_TAHITI: + case CHIP_PITCAIRN: + case CHIP_VERDE: + case CHIP_OLAND: + case CHIP_HAINAN: + dev_info(&pdev->dev, + "SI support disabled by module param\n"); + return -ENODEV; + } + } + if (!radeon_cik_support) { + switch (flags & RADEON_FAMILY_MASK) { + case CHIP_KAVERI: + case CHIP_BONAIRE: + case CHIP_HAWAII: + case CHIP_KABINI: + case CHIP_MULLINS: + dev_info(&pdev->dev, + "CIK support disabled by module param\n"); + return -ENODEV; + } + } + if (vga_switcheroo_client_probe_defer(pdev)) return -EPROBE_DEFER; diff --git a/drivers/gpu/drm/radeon/radeon_kms.c b/drivers/gpu/drm/radeon/radeon_kms.c index 07f7ace42c4ba..e85c554eeaa94 100644 --- a/drivers/gpu/drm/radeon/radeon_kms.c +++ b/drivers/gpu/drm/radeon/radeon_kms.c @@ -100,31 +100,6 @@ int radeon_driver_load_kms(struct drm_device *dev, unsigned long flags) struct radeon_device *rdev; int r, acpi_status; - if (!radeon_si_support) { - switch (flags & RADEON_FAMILY_MASK) { - case CHIP_TAHITI: - case CHIP_PITCAIRN: - case CHIP_VERDE: - case CHIP_OLAND: - case CHIP_HAINAN: - dev_info(dev->dev, - "SI support disabled by module param\n"); - return -ENODEV; - } - } - if (!radeon_cik_support) { - switch (flags & RADEON_FAMILY_MASK) { - case CHIP_KAVERI: - case CHIP_BONAIRE: - case CHIP_HAWAII: - case CHIP_KABINI: - case CHIP_MULLINS: - dev_info(dev->dev, - "CIK support disabled by module param\n"); - return -ENODEV; - } - } - rdev = kzalloc(sizeof(struct radeon_device), GFP_KERNEL); if (rdev == NULL) { return -ENOMEM; -- 2.20.1