From patchwork Fri Jun 25 13:09:46 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: 12345021 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=-17.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,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 D4DE6C48BC2 for ; Fri, 25 Jun 2021 13:12:06 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 A67E861956 for ; Fri, 25 Jun 2021 13:12:06 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A67E861956 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=iVlb0qUChcLqOqipGQZD10Fj4rd2tLHqRXoT6TPQFP8=; b=qJFVfftxZzMhug 7RYKoePgeUMr6bvbSjGSe8NrjZh7RDz7+yLYNdaBeJiO2tKV86yvgOVYEMVqPh2hWwvR7JdNrowO0 kk7Avvg1x2fYGYvFO/3nai/N5FjArsJ97kAVLjrY1iZmEmwUFVh3bzquTOKk62fykkKFZjByK2UC6 Lm/ZugpEo1UzcZZtYJUeSyyohX5QD+LkyZDI885Js35kdHW7bf9u0X8pwXt/1W+SX4O1KtVqc20aB /pYRZtbD6zHuayUA7p5phKa+y5zsPkUQeuRWWwUNv0+4sI7FH3WciIdU8sxfbYN7q18CEVSG0CYHh Hh6jsBR2cdOsBPRGjo9A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lwlbJ-001bPz-Kx; Fri, 25 Jun 2021 13:10:29 +0000 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lwlb3-001bMH-UY for linux-arm-kernel@lists.infradead.org; Fri, 25 Jun 2021 13:10:18 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1624626613; 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=PNAp2KzVwp2HJpAICzqzoywufhnCYAR1xRg0ncSjjzQ=; b=aLEHhPaB1M4LUBSYOa34kY+NcgjsAvV8Ys8cOKHrsrn0dE/KwHa82eZ5NwphTitW05rFSf EjiYNv9M6nhXh00aUna2AUROJvC9wHQK5UbKVI4kG7XBeHqTwE8xBl8+LyclkwHO4OkZRs mWzETh9xoY49E/C7ctrrUSqGPR7i4vs= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-392-pxaNBBBpPZ-9FMlSE7Fi_Q-1; Fri, 25 Jun 2021 09:10:11 -0400 X-MC-Unique: pxaNBBBpPZ-9FMlSE7Fi_Q-1 Received: by mail-wm1-f69.google.com with SMTP id m6-20020a7bce060000b02901d2a0c361bfso4178514wmc.4 for ; Fri, 25 Jun 2021 06:10:11 -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=PNAp2KzVwp2HJpAICzqzoywufhnCYAR1xRg0ncSjjzQ=; b=DfbThKSCPdgoTc9TYY8fuAnRrVeW38qzD38nRifvUzL5/6LZUPN27tWKt/rmSGNskv dwb6qoYu5FF50BnvXqnbem6/HMVWLAP7FWBtPTUO+toO/CKoec8px5mf4mBH9kGcwChy wftNDM1njGtdhpMfP6WuOhhJQveoSGWmh4uJ/FiiDPcZ2MKmBCsWTvhzyh2KRuofBfgo PZygOqAqaSTV58PmN9H8fnOPeSixlxR6wm3Bfh0IaI5VyujsDWTOh45AHd4GSeImAdTr iUpaRSmQNsB4+V40uszQtUmsEOpUIYgjPxnPg3PffauLNC3CstG34rPbeT4hK1T4vW7c rSRQ== X-Gm-Message-State: AOAM531pPdAvAfe40oZ7tQrl1cVOLFTbetF3YQoPXEYinFQDiC0vHNfK IoSMwSzv13VMlWw98dVCBUYIHv8hXKVm7T0JIJJ1Vgd0IvM/dm2dZNVHymOd/NZMY/5FpygF78q fT6kEdezBcDLaIutLB2gSjAxjivyerZ3ph/8= X-Received: by 2002:adf:de87:: with SMTP id w7mr10991061wrl.333.1624626600816; Fri, 25 Jun 2021 06:10:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw9JlLTp3gkSgmXVuuBEZlbTpm3s98JJq7htgnfMTMY1BcxRHZ+aAzUeYOQaLnz1g/268OaWQ== X-Received: by 2002:adf:de87:: with SMTP id w7mr10990996wrl.333.1624626600479; Fri, 25 Jun 2021 06:10:00 -0700 (PDT) Received: from minerva.redhat.com ([92.176.231.106]) by smtp.gmail.com with ESMTPSA id x7sm5995864wre.8.2021.06.25.06.09.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Jun 2021 06:10:00 -0700 (PDT) From: Javier Martinez Canillas To: linux-kernel@vger.kernel.org Cc: Thomas Zimmermann , Palmer Dabbelt , Russell King , linux-efi@vger.kernel.org, Thomas Gleixner , Hans de Goede , x86@kernel.org, Ingo Molnar , Will Deacon , Paul Walmsley , linux-riscv@lists.infradead.org, Borislav Petkov , Albert Ou , Peter Robinson , dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, David Airlie , Greg Kroah-Hartman , Daniel Vetter , Ard Biesheuvel , Catalin Marinas , Atish Patra , Javier Martinez Canillas Subject: [PATCH v3 1/2] drivers/firmware: move x86 Generic System Framebuffers support Date: Fri, 25 Jun 2021 15:09:46 +0200 Message-Id: <20210625130947.1803678-2-javierm@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210625130947.1803678-1-javierm@redhat.com> References: <20210625130947.1803678-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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210625_061014_107616_CCD9F91F X-CRM114-Status: GOOD ( 25.99 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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: Borislav Petkov Acked-by: Greg Kroah-Hartman --- Changes in v3: - Add Borislav and Greg Acked-by tags. 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 0ae3eccfec52..f169a30db768 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -2766,32 +2766,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 0f66682ac02a..4114ea47def2 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 1db738d5b301..5991071e9d7f 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 546ac8e7f6d0..946dda07443d 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 467e94259679..c02ff25dd477 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 8a56a6d80098..9f035b15501c 100644 --- a/arch/x86/kernel/sysfb_efi.c +++ b/drivers/firmware/efi/sysfb_efi.c @@ -21,10 +21,10 @@ #include #include #include +#include #include