From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 29B2AC433FE for ; Thu, 4 Nov 2021 18:01:55 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E90AE611C0 for ; Thu, 4 Nov 2021 18:01:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org E90AE611C0 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1B2777204A; Thu, 4 Nov 2021 18:01:54 +0000 (UTC) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by gabe.freedesktop.org (Postfix) with ESMTPS id B0EE46F8A4 for ; Thu, 4 Nov 2021 16:07:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1636042044; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=n/ejIrVb3rZrH44A2zViksmvIEiiBszGsTbTQyQjoKs=; b=LvLQR+aYFOapD3BSkUOTIVBOgr4SPjKGChG1F1zUzMQlEWGKPB3B9dfwHbHQj53BlWYaAK BJpwFamaQHKL7Cc0cybw73fj/uRjjTwKdm6TtxONcVAnmnLFyYQUwvCW9vk0i6Kgf9DCF5 KX/dw6F+sOXg9yVBrB4IPfo/zh4lYDg= Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-513-T2JJjjZAPz-_5fOb8kJS7w-1; Thu, 04 Nov 2021 12:07:22 -0400 X-MC-Unique: T2JJjjZAPz-_5fOb8kJS7w-1 Received: by mail-wr1-f71.google.com with SMTP id d13-20020adf9b8d000000b00160a94c235aso1178328wrc.2 for ; Thu, 04 Nov 2021 09:07:22 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=n/ejIrVb3rZrH44A2zViksmvIEiiBszGsTbTQyQjoKs=; b=bcNKyCVWK4CrqgPdFbKVS5cPO0h/gNR/CudTulH0MlK/RlyOdBB5m0jc+RENFk9GDf La6ItbDHKgsO5WaRtGzNB1XSh+/KBhzY/xGHP8Bs333hpp6cViOVs1sE/wQSFXFQPZzj 5TLTa0HvADXcFk4vzhFj3lyojrjeXeJ9OxeZBMGACjONo8WS8u7A0E/p6cq2Z9DTRQEx Byh9QZftp4h73jCwxADQP8Wkdi/K6fpcQ3Lbwpdxi5xewK6O4Q1hY/RCgw5NhjgB/LaC CiBbi5mdcKKkL0w1dQ8+YMQvj1nA2/SOzc7GPhI/PCAkF62gH81FfJkYMY+CsvTW1fEN X7gQ== X-Gm-Message-State: AOAM532iioCn8Mp5kWs6rwpi8Q68ltRa9sHJaafFdysrSy+95G0W+MB7 JyMQPJ7/K7rTGltTz8ptolKiGd33cH1LNoCBW12gNAHu5bgxIwadcLeGifCjZ1sj8x2ij8h9CG8 fVGCrbfu0fJX/HjEOA3YLkgkiCA== X-Received: by 2002:a7b:ca44:: with SMTP id m4mr23689909wml.100.1636042041579; Thu, 04 Nov 2021 09:07:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwxQs3q9Q2yGgJQmZ5zypW+OBIyfR4YAS74a/Zv3Ucv5aomcisjC91zz+w+lhZHPPKLJjXLiw== X-Received: by 2002:a7b:ca44:: with SMTP id m4mr23689832wml.100.1636042041250; Thu, 04 Nov 2021 09:07:21 -0700 (PDT) Received: from minerva.home ([92.176.231.106]) by smtp.gmail.com with ESMTPSA id l18sm5877863wrt.81.2021.11.04.09.07.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Nov 2021 09:07:20 -0700 (PDT) From: Javier Martinez Canillas To: linux-kernel@vger.kernel.org Subject: [PATCH v2 0/2] Cleanups for the nomodeset kernel command line parameter logic Date: Thu, 4 Nov 2021 17:07:05 +0100 Message-Id: <20211104160707.1407052-1-javierm@redhat.com> X-Mailer: git-send-email 2.33.1 MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=javierm@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Mailman-Approved-At: Thu, 04 Nov 2021 18:01:52 +0000 X-BeenThere: amd-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion list for AMD gfx List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-fbdev@vger.kernel.org, David Airlie , Daniel Vetter , Joonas Lahtinen , dri-devel@lists.freedesktop.org, Gurchetan Singh , Gerd Hoffmann , Javier Martinez Canillas , amd-gfx@lists.freedesktop.org, VMware Graphics , Peter Robinson , nouveau@lists.freedesktop.org, Dave Airlie , Chia-I Wu , Ben Skeggs , Thomas Zimmermann , =?UTF-8?q?Michel=20D=C3=A4nzer?= , Maarten Lankhorst , Maxime Ripard , Hans de Goede , Jani Nikula , Rodrigo Vivi , virtualization@lists.linux-foundation.org, Pekka Paalanen , Greg Kroah-Hartman , "Pan, Xinhui" , spice-devel@lists.freedesktop.org, Daniel Vetter , Alex Deucher , intel-gfx@lists.freedesktop.org, =?UTF-8?q?Christian=20K=C3=B6nig?= , Zack Rusin Errors-To: amd-gfx-bounces@lists.freedesktop.org Sender: "amd-gfx" There is a lot of historical baggage on this parameter. It is defined in the vgacon driver as nomodeset, but its set function is called text_mode() and the value queried with a function named vgacon_text_force(). All this implies that it's about forcing text mode for VGA, yet it is not used in neither vgacon nor other console driver. The only users for these are DRM drivers, that check for the vgacon_text_force() return value to determine whether the driver should be loaded or not. That makes it quite confusing to read the code, because the variables and function names don't reflect what they actually do and also are not in the same subsystem as the drivers that make use of them. This patch-set attempts to cleanup the code by moving the nomodseset param to the DRM subsystem and do some renaming to make their intention clearer. There is also another aspect that could be improved, and is the fact that drivers are checking for the nomodeset being set as an indication if have to be loaded. But there may be other reasons why this could be the case, so it is better to encapsulate the logic in a separate function to make clear what's about. This is a v2 of the patches, that address the issues pointed out by Thomas Zimmermann and Jani Nikula in v1: https://lore.kernel.org/lkml/5b4e4534-4786-d231-e331-78fdb5d8496a@redhat.com/T/ Patch #1 adds a drm_drv_enabled() function that could be used by drivers to check if these could be enabled, instead of just using vgacon_text_force(). Patch #2 moves the nomodeset logic to the DRM subsystem and renames the functions and variables to better explain what these actually do. Changes in v2: - Squash patch to add drm_drv_enabled() and make drivers use it. - Make the drivers changes before moving nomodeset logic to DRM. - Make drm_drv_enabled() return an errno and -ENODEV if nomodeset. - Remove debug and error messages in drivers. - Conditionally build drm_nomodeset.o if CONFIG_VGA_CONSOLE is set. - Squash patches to move nomodeset logic to DRM and do the renaming. - Name the function drm_check_modeset() and make it return -ENODEV. Javier Martinez Canillas (2): drm: Add a drm_drv_enabled() to check if drivers should be enabled drm: Move nomodeset kernel parameter to the DRM subsystem drivers/gpu/drm/Makefile | 2 ++ drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 8 +++----- drivers/gpu/drm/ast/ast_drv.c | 8 +++++--- drivers/gpu/drm/drm_drv.c | 21 ++++++++++++++++++++ drivers/gpu/drm/drm_nomodeset.c | 26 +++++++++++++++++++++++++ drivers/gpu/drm/i915/i915_module.c | 8 +++++--- drivers/gpu/drm/mgag200/mgag200_drv.c | 8 +++++--- drivers/gpu/drm/nouveau/nouveau_drm.c | 6 ++++-- drivers/gpu/drm/qxl/qxl_drv.c | 8 +++++--- drivers/gpu/drm/radeon/radeon_drv.c | 7 ++++--- drivers/gpu/drm/tiny/bochs.c | 8 +++++--- drivers/gpu/drm/tiny/cirrus.c | 9 ++++++--- drivers/gpu/drm/vboxvideo/vbox_drv.c | 10 +++++----- drivers/gpu/drm/virtio/virtgpu_drv.c | 6 +++--- drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 6 +++--- drivers/video/console/vgacon.c | 21 -------------------- include/drm/drm_drv.h | 1 + include/drm/drm_mode_config.h | 6 ++++++ include/linux/console.h | 6 ------ 19 files changed, 109 insertions(+), 66 deletions(-) create mode 100644 drivers/gpu/drm/drm_nomodeset.c -- 2.33.1