From patchwork Tue Jun 1 14:59:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Javier Martinez Canillas X-Patchwork-Id: 12291493 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F2335C47093 for ; Tue, 1 Jun 2021 14:59:34 +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 BE129613B1 for ; Tue, 1 Jun 2021 14:59:34 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BE129613B1 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2595E6E829; Tue, 1 Jun 2021 14:59:33 +0000 (UTC) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by gabe.freedesktop.org (Postfix) with ESMTPS id 77A186E829 for ; Tue, 1 Jun 2021 14:59:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1622559571; 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: in-reply-to:in-reply-to:references:references; bh=gmQ5sapNm/J3W6mK4f4jmCWQiczf9fEBrpQYFqEuvNI=; b=AejJJnQgNL6W3g7tFNb0Ugs1OVNkQPXToF14uoMSo7KNHCGCTgjtBcO9j8opvfXdtSrLOB 9txuS6VG4RmFynB1Ca543/0e04XslUH74j2f9FrrAnj2IQ5u8mB45AD/FjdT6FNNN0ucb7 pJfro6hmfoi9y3x66ouypf9Kr9GUwOQ= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-534-nUZKOTcRNzi3_lf5rSnAZQ-1; Tue, 01 Jun 2021 10:59:30 -0400 X-MC-Unique: nUZKOTcRNzi3_lf5rSnAZQ-1 Received: by mail-wm1-f72.google.com with SMTP id 19-20020a05600c2313b0290193637766d9so1174046wmo.7 for ; Tue, 01 Jun 2021 07:59:30 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=gmQ5sapNm/J3W6mK4f4jmCWQiczf9fEBrpQYFqEuvNI=; b=YNjC940FAX2nD9UQ6dLcCrU6DmW+sKlVJvT8nV/MtAt5scNvqFplrQIYeYY95EjURP N+HvcKHJFO5XZ/F3Un11Wi8WrFBFoKT272gRV2cmrfTpkf9PzhS3pYhhJQp3GP/zqMid FrQzy06LZbfyp0/SPw65MwyAZ/m3YEqaBnnOL4xpXKXfg+T6IA9I2ef06thsTCpfzIfe DuY3qGk42eKPCMXbvQjSXEWzTDG1vMRSrKm4cF50GJevKB949Ffct1Iok5XmYXyMta4S D5YKBjuNq1gI7TMY57gpa5UcfeytRzslORn74Kmt3VI0mBWT5KKyEs5LkgZQ53bcJIFn APMg== X-Gm-Message-State: AOAM531JFOQylDRNaNReuDGRPtTDE7bJR2mtf5ijYsjjwPAMUFpYxa5w PDLpDeVPBa7hk6qpaJOsEtuQbt4Z5Zm/jwi31uS00iMgDr6Ozh4C8I7VrKtBB+UyUHG9HmMwlw0 jWDkNNh1K9b9XVChikyljXa+CcvIc X-Received: by 2002:adf:8bd4:: with SMTP id w20mr15579529wra.310.1622559566225; Tue, 01 Jun 2021 07:59:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxQHrKdO567c3olyoWc4lzbbNuTy4CMdhBLpG2aYelB09sF8IxFHqikVKvNNAfTaXCw3YhB1Q== X-Received: by 2002:adf:8bd4:: with SMTP id w20mr15579486wra.310.1622559565948; Tue, 01 Jun 2021 07:59:25 -0700 (PDT) Received: from minerva.redhat.com ([92.176.231.106]) by smtp.gmail.com with ESMTPSA id h6sm3533153wrt.6.2021.06.01.07.59.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Jun 2021 07:59:25 -0700 (PDT) From: Javier Martinez Canillas To: linux-kernel@vger.kernel.org Subject: [PATCH v2 1/2] drivers/firmware: move x86 Generic System Framebuffers support Date: Tue, 1 Jun 2021 16:59:11 +0200 Message-Id: <20210601145912.774054-2-javierm@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210601145912.774054-1-javierm@redhat.com> References: <20210601145912.774054-1-javierm@redhat.com> 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 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-efi@vger.kernel.org, Brijesh Singh , David Airlie , dri-devel@lists.freedesktop.org, Arvind Sankar , Nicolas Saenz Julienne , "H. Peter Anvin" , Ard Biesheuvel , Krzysztof Kozlowski , x86@kernel.org, Javier Martinez Canillas , "Peter Zijlstra \(Intel\)" , Ingo Molnar , Peter Robinson , Joerg Roedel , Chester Lin , Hans de Goede , Borislav Petkov , Josh Poimboeuf , Thomas Gleixner , Andy Shevchenko , Kalle Valo , Juergen Gross , Greg Kroah-Hartman , Dinh Nguyen , Thomas Zimmermann , Sudeep Holla Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The x86 architecture has generic support to register a system framebuffer platform device. It either registers a "simple-framebuffer" if the config option CONFIG_X86_SYSFB is enabled, or a legacy VGA/VBE/EFI FB device. But the code is generic enough to be reused by other architectures and can be moved out of the arch/x86 directory. This will allow to also support the simple{fb,drm} drivers on non-x86 EFI platforms, such as aarch64 where these drivers are only supported with DT. Signed-off-by: Javier Martinez Canillas Acked-by: Greg Kroah-Hartman --- Changes in v2: - Use default y and depends on X86 instead doing a select in arch/x86/Kconfig. - Also enable the SYSFB Kconfig option when COMPILE_TEST. - Improve commit message to explain why is useful for other arches to use this. arch/x86/Kconfig | 26 --------------- arch/x86/kernel/Makefile | 3 -- drivers/firmware/Kconfig | 32 +++++++++++++++++++ drivers/firmware/Makefile | 2 ++ drivers/firmware/efi/Makefile | 2 ++ .../firmware/efi}/sysfb_efi.c | 2 +- {arch/x86/kernel => drivers/firmware}/sysfb.c | 2 +- .../firmware}/sysfb_simplefb.c | 2 +- .../x86/include/asm => include/linux}/sysfb.h | 6 ++-- 9 files changed, 42 insertions(+), 35 deletions(-) rename {arch/x86/kernel => drivers/firmware/efi}/sysfb_efi.c (99%) rename {arch/x86/kernel => drivers/firmware}/sysfb.c (98%) rename {arch/x86/kernel => drivers/firmware}/sysfb_simplefb.c (99%) rename {arch/x86/include/asm => include/linux}/sysfb.h (95%) diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 39175aa072e..9907d4bed70 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -2796,32 +2796,6 @@ config AMD_NB def_bool y depends on CPU_SUP_AMD && PCI -config X86_SYSFB - bool "Mark VGA/VBE/EFI FB as generic system framebuffer" - help - Firmwares often provide initial graphics framebuffers so the BIOS, - bootloader or kernel can show basic video-output during boot for - user-guidance and debugging. Historically, x86 used the VESA BIOS - Extensions and EFI-framebuffers for this, which are mostly limited - to x86. - This option, if enabled, marks VGA/VBE/EFI framebuffers as generic - framebuffers so the new generic system-framebuffer drivers can be - used on x86. If the framebuffer is not compatible with the generic - modes, it is advertised as fallback platform framebuffer so legacy - drivers like efifb, vesafb and uvesafb can pick it up. - If this option is not selected, all system framebuffers are always - marked as fallback platform framebuffers as usual. - - Note: Legacy fbdev drivers, including vesafb, efifb, uvesafb, will - not be able to pick up generic system framebuffers if this option - is selected. You are highly encouraged to enable simplefb as - replacement if you select this option. simplefb can correctly deal - with generic system framebuffers. But you should still keep vesafb - and others enabled as fallback if a system framebuffer is - incompatible with simplefb. - - If unsure, say Y. - endmenu diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel/Makefile index 0f66682ac02..4114ea47def 100644 --- a/arch/x86/kernel/Makefile +++ b/arch/x86/kernel/Makefile @@ -135,9 +135,6 @@ obj-$(CONFIG_X86_CHECK_BIOS_CORRUPTION) += check.o obj-$(CONFIG_SWIOTLB) += pci-swiotlb.o obj-$(CONFIG_OF) += devicetree.o obj-$(CONFIG_UPROBES) += uprobes.o -obj-y += sysfb.o -obj-$(CONFIG_X86_SYSFB) += sysfb_simplefb.o -obj-$(CONFIG_EFI) += sysfb_efi.o obj-$(CONFIG_PERF_EVENTS) += perf_regs.o obj-$(CONFIG_TRACING) += tracepoint.o diff --git a/drivers/firmware/Kconfig b/drivers/firmware/Kconfig index b53ac9fc770..4392fc57cf3 100644 --- a/drivers/firmware/Kconfig +++ b/drivers/firmware/Kconfig @@ -251,6 +251,38 @@ config QCOM_SCM_DOWNLOAD_MODE_DEFAULT Say Y here to enable "download mode" by default. +config SYSFB + bool + default y + depends on X86 || COMPILE_TEST + +config X86_SYSFB + bool "Mark VGA/VBE/EFI FB as generic system framebuffer" + depends on SYSFB + help + Firmwares often provide initial graphics framebuffers so the BIOS, + bootloader or kernel can show basic video-output during boot for + user-guidance and debugging. Historically, x86 used the VESA BIOS + Extensions and EFI-framebuffers for this, which are mostly limited + to x86. + This option, if enabled, marks VGA/VBE/EFI framebuffers as generic + framebuffers so the new generic system-framebuffer drivers can be + used on x86. If the framebuffer is not compatible with the generic + modes, it is advertised as fallback platform framebuffer so legacy + drivers like efifb, vesafb and uvesafb can pick it up. + If this option is not selected, all system framebuffers are always + marked as fallback platform framebuffers as usual. + + Note: Legacy fbdev drivers, including vesafb, efifb, uvesafb, will + not be able to pick up generic system framebuffers if this option + is selected. You are highly encouraged to enable simplefb as + replacement if you select this option. simplefb can correctly deal + with generic system framebuffers. But you should still keep vesafb + and others enabled as fallback if a system framebuffer is + incompatible with simplefb. + + If unsure, say Y. + config TI_SCI_PROTOCOL tristate "TI System Control Interface (TISCI) Message Protocol" depends on TI_MESSAGE_MANAGER diff --git a/drivers/firmware/Makefile b/drivers/firmware/Makefile index 546ac8e7f6d..946dda07443 100644 --- a/drivers/firmware/Makefile +++ b/drivers/firmware/Makefile @@ -18,6 +18,8 @@ obj-$(CONFIG_FIRMWARE_MEMMAP) += memmap.o obj-$(CONFIG_RASPBERRYPI_FIRMWARE) += raspberrypi.o obj-$(CONFIG_FW_CFG_SYSFS) += qemu_fw_cfg.o obj-$(CONFIG_QCOM_SCM) += qcom_scm.o qcom_scm-smc.o qcom_scm-legacy.o +obj-$(CONFIG_SYSFB) += sysfb.o +obj-$(CONFIG_X86_SYSFB) += sysfb_simplefb.o obj-$(CONFIG_TI_SCI_PROTOCOL) += ti_sci.o obj-$(CONFIG_TRUSTED_FOUNDATIONS) += trusted_foundations.o obj-$(CONFIG_TURRIS_MOX_RWTM) += turris-mox-rwtm.o diff --git a/drivers/firmware/efi/Makefile b/drivers/firmware/efi/Makefile index 467e9425967..c02ff25dd47 100644 --- a/drivers/firmware/efi/Makefile +++ b/drivers/firmware/efi/Makefile @@ -36,6 +36,8 @@ obj-$(CONFIG_LOAD_UEFI_KEYS) += mokvar-table.o fake_map-y += fake_mem.o fake_map-$(CONFIG_X86) += x86_fake_mem.o +obj-$(CONFIG_SYSFB) += sysfb_efi.o + arm-obj-$(CONFIG_EFI) := efi-init.o arm-runtime.o obj-$(CONFIG_ARM) += $(arm-obj-y) obj-$(CONFIG_ARM64) += $(arm-obj-y) diff --git a/arch/x86/kernel/sysfb_efi.c b/drivers/firmware/efi/sysfb_efi.c similarity index 99% rename from arch/x86/kernel/sysfb_efi.c rename to drivers/firmware/efi/sysfb_efi.c index 8a56a6d8009..9f035b15501 100644 --- a/arch/x86/kernel/sysfb_efi.c +++ b/drivers/firmware/efi/sysfb_efi.c @@ -21,10 +21,10 @@ #include #include #include +#include #include