From nobody Tue Jun 30 20:10:28 2026 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1C6BFC433F5 for ; Mon, 10 Jan 2022 09:56:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243478AbiAJJ4i (ORCPT ); Mon, 10 Jan 2022 04:56:38 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:47330 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243445AbiAJJ4b (ORCPT ); Mon, 10 Jan 2022 04:56:31 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1641808591; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=DGDm1oaaWKUbsURSYDtt3eA6CLvZDH+FDjQaP+AuY/8=; b=C3zX4jOmqYap+53SM/TkVYqwkS8y67VK05zxkVEjyNL+H2O+Y2qMJYOJn5ufDNJH0CkU9J eDzX71xjvuE+3MNfc7LZQsocqC9YKNW+4rPxRfAU+p1HMDwIvSa/K/H/yjw3p1p51hhyL/ zcDPQqSgNppra7varnquPFosqjatHGQ= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-528-DWh7alb7OuKcQwZXd5LP_g-1; Mon, 10 Jan 2022 04:56:30 -0500 X-MC-Unique: DWh7alb7OuKcQwZXd5LP_g-1 Received: by mail-wm1-f69.google.com with SMTP id m9-20020a05600c4f4900b0034644da3525so4697926wmq.3 for ; Mon, 10 Jan 2022 01:56:30 -0800 (PST) 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=DGDm1oaaWKUbsURSYDtt3eA6CLvZDH+FDjQaP+AuY/8=; b=Ukzk6VuS3ocp3aX+hXeuONgJiHfYmYimFeY9JrTEfbhRjS1I90sl0DAoNhwAY58CUY Yk8BMm4/wKYfNWu6v5Jk8BlrK3nyYKVyetwi3/34LvucyGFkKSaNT98XW1cxMSrxxY/r q0tJRj4EtACveeG/T2vrG4BXph/St/4bANkOhntZu9iCyCj8+vp2zPlYK5DpnK+Czl2t O2Z75a5SZlJMzvVhwL/RUx5LQ8cndW0eD9ghjiYSdFkhrcLZbh3MEPyMj7IEVihXE/Jn H+Dj718cxvFOJ5a5mr4c8r0i6aIsiLK5wpRjT8BAH2JzYDvMowDwhCriphV7YreyIKmE v8/Q== X-Gm-Message-State: AOAM531C2WhpfqcpNjE5MYeLG0yBHeXHFUXjNgOxAritMnlW+bshqM5b D58lEZ7M/WlBLlFz1eTuiNhpkIZI18LdUtl5877SoCAS0/dFnddiiwYDyiDl8Vpf6Qbt0HKw34a mRoJxtX7fgd3BZ8sgGpdFiFkYuZiWZUR0pM5kTRA7AVl4CVEcvj4CdG+o7m6pQMC6HLnD9z/cS7 o= X-Received: by 2002:a5d:6302:: with SMTP id i2mr5349410wru.25.1641808589103; Mon, 10 Jan 2022 01:56:29 -0800 (PST) X-Google-Smtp-Source: ABdhPJz6ths/AcE+USA4b9jT9nuUL+2SfOzOGrd7hBLtsih5mHKb9hQ17/vSxnWdP1FKhpwI1kRuhA== X-Received: by 2002:a5d:6302:: with SMTP id i2mr5349395wru.25.1641808588900; Mon, 10 Jan 2022 01:56:28 -0800 (PST) Received: from minerva.home ([92.176.231.205]) by smtp.gmail.com with ESMTPSA id b13sm6315167wrf.64.2022.01.10.01.56.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Jan 2022 01:56:28 -0800 (PST) From: Javier Martinez Canillas To: linux-kernel@vger.kernel.org Cc: Kris Karas , Peter Robinson , Geert Uytterhoeven , Javier Martinez Canillas , dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org Subject: [PATCH v2 1/2] video: vga16fb: Fix logic that checks for the display standard Date: Mon, 10 Jan 2022 10:56:24 +0100 Message-Id: <20220110095625.278836-2-javierm@redhat.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20220110095625.278836-1-javierm@redhat.com> References: <20220110095625.278836-1-javierm@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The vga16fb framebuffer driver supports both Enhanced Graphics Adapter (EGA) and Video Graphics Array (VGA) 16 color graphic cards. But the logic to check whether the EGA or VGA standard are used is not correct. It just checks if screen_info.orig_video_isVGA is set, but it should check if is set to VIDEO_TYPE_VGAC instead. This means that it assumes to be VGA even if is set to VIDEO_TYPE_EGAC. All non-x86 architectures though treat orig_video_isVGA as a boolean so only do the change for x86 and keep the old logic for the other arches. Signed-off-by: Javier Martinez Canillas Acked-by: Maxime Ripard Tested-By: Kris Karas --- Changes in v2: - Make the change only for x86 (Geert Uytterhoeven) drivers/video/fbdev/vga16fb.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/video/fbdev/vga16fb.c b/drivers/video/fbdev/vga16fb.c index e2757ff1c23d..8c464409eb99 100644 --- a/drivers/video/fbdev/vga16fb.c +++ b/drivers/video/fbdev/vga16fb.c @@ -1332,7 +1332,12 @@ static int vga16fb_probe(struct platform_device *dev) printk(KERN_INFO "vga16fb: mapped to 0x%p\n", info->screen_base); par =3D info->par; =20 +#if defined(CONFIG_X86) + par->isVGA =3D screen_info.orig_video_isVGA =3D=3D VIDEO_TYPE_VGAC; +#else + /* non-x86 architectures treat orig_video_isVGA as a boolean flag */ par->isVGA =3D screen_info.orig_video_isVGA; +#endif par->palette_blanked =3D 0; par->vesa_blanked =3D 0; =20 --=20 2.33.1 From nobody Tue Jun 30 20:10:28 2026 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2B6E8C433EF for ; Mon, 10 Jan 2022 09:57:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243522AbiAJJ4u (ORCPT ); Mon, 10 Jan 2022 04:56:50 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:58446 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243454AbiAJJ4d (ORCPT ); Mon, 10 Jan 2022 04:56:33 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1641808592; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wJr2+TRe6SBb1BM5UDY1ejbky83MU/0sD3dvYedx6MA=; b=J4ZOZtmCIds8/MwCUrWz/SS2nQNAVJ5EeyzV5uefZMGGOa6nEnmxSdx/2ed2b+3Ve2ZoFI qbSn1IrqtEtqURijjBDdZSpf4hOw5wjit6pAN0ZxpNkdz/3/a67bx99MnduDj5rSdk2nrC rU1EALk8oYxYKasYPAbPU15Q8OPsyac= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-532-rezVg43GNGGyvTyUrMvwJw-1; Mon, 10 Jan 2022 04:56:31 -0500 X-MC-Unique: rezVg43GNGGyvTyUrMvwJw-1 Received: by mail-wr1-f69.google.com with SMTP id v18-20020a5d5912000000b001815910d2c0so4003856wrd.1 for ; Mon, 10 Jan 2022 01:56:31 -0800 (PST) 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=wJr2+TRe6SBb1BM5UDY1ejbky83MU/0sD3dvYedx6MA=; b=weqh8O9QE2/GyhGw6tpyn39YsTiTxRXdDjEKXfMg4NLCNfqK+duvCQV0AZyUbjG8Nl ZlravLa4N9kiDUZ5CIMC4rYSWYkIiuJj4iLYVYEsnf0uUn9FVuifQwpH4YwvaTFW7ZCt sbjznJOBa2mChinQWnvfke402vl1afXGxeQbeLR9zCxd6KQyZLBDsgXUjSpRNeVwZPE5 8LbcrIhayB556K3IJk/ymCCuO5weGRAT72SJ/+BpugxhvkZRqM3pEmIYNAac7PtyFW8y 2dhUrTJiUnGV/UIqiIU9TJ/+2xTFAJIOrQaFWnZdoi/zabJeriL9DVwUZhlXrbfmctyR IrjA== X-Gm-Message-State: AOAM531GZSW1m6wbw+/FFQ1bvGrtmJX72MVErFRYY1p5sbkprMN7W+M8 yYZAawmQPlj8CoXGsWqEqKCYBdeArvuLIk1Il1xpF56exV1R3hyxQx6FE1yuX2iMg2idSOH/QFt scuPOluVNavQweQiMuLJFua0GohR79U2R6pnwfZBJjJI+i+3ZPwjU8QEylC7mO4zZ5epz9iitUn s= X-Received: by 2002:a05:6000:11c9:: with SMTP id i9mr6134117wrx.544.1641808590225; Mon, 10 Jan 2022 01:56:30 -0800 (PST) X-Google-Smtp-Source: ABdhPJzvF1fUNv4N+g4L82v97FbltLNWdtemC8wnOpy3eswOBvCDx6S9Wvq2C8LmHTKllcM2hylVhA== X-Received: by 2002:a05:6000:11c9:: with SMTP id i9mr6134090wrx.544.1641808589966; Mon, 10 Jan 2022 01:56:29 -0800 (PST) Received: from minerva.home ([92.176.231.205]) by smtp.gmail.com with ESMTPSA id b13sm6315167wrf.64.2022.01.10.01.56.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Jan 2022 01:56:29 -0800 (PST) From: Javier Martinez Canillas To: linux-kernel@vger.kernel.org Cc: Kris Karas , Peter Robinson , Geert Uytterhoeven , Javier Martinez Canillas , stable@vger.kernel.org, Borislav Petkov , Daniel Vetter , Greg Kroah-Hartman , Thomas Zimmermann , dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org Subject: [PATCH v2 2/2] video: vga16fb: Only probe for EGA and VGA 16 color graphic cards Date: Mon, 10 Jan 2022 10:56:25 +0100 Message-Id: <20220110095625.278836-3-javierm@redhat.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20220110095625.278836-1-javierm@redhat.com> References: <20220110095625.278836-1-javierm@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The vga16fb framebuffer driver only supports Enhanced Graphics Adapter (EGA) and Video Graphics Array (VGA) 16 color graphic cards. But it doesn't check if the adapter is one of those or if a VGA16 mode is used. This means that the driver will be probed even if a VESA BIOS Extensions (VBE) or Graphics Output Protocol (GOP) interface is used. This issue has been present for a long time but it was only exposed by commit d391c5827107 ("drivers/firmware: move x86 Generic System Framebuffers support") since the platform device registration to match the {vesa,efi}fb drivers is done later as a consequence of that change. All non-x86 architectures though treat orig_video_isVGA as a boolean so only do the supported video mode check for x86 and not for other arches. Link: https://bugzilla.kernel.org/show_bug.cgi?id=3D215001 Fixes: d391c5827107 ("drivers/firmware: move x86 Generic System Framebuffer= s support") Reported-by: Kris Karas Cc: # 5.15.x Signed-off-by: Javier Martinez Canillas Tested-by: Kris Karas Acked-by: Maxime Ripard Tested-By: Kris Karas --- Changes in v2: - Only check the suppported video mode for x86 (Geert Uytterhoeven). drivers/video/fbdev/vga16fb.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/drivers/video/fbdev/vga16fb.c b/drivers/video/fbdev/vga16fb.c index 8c464409eb99..d21f68f3ee44 100644 --- a/drivers/video/fbdev/vga16fb.c +++ b/drivers/video/fbdev/vga16fb.c @@ -184,6 +184,25 @@ static inline void setindex(int index) vga_io_w(VGA_GFX_I, index); } =20 +/* Check if the video mode is supported by the driver */ +static inline int check_mode_supported(void) +{ + /* non-x86 architectures treat orig_video_isVGA as a boolean flag */ +#if defined(CONFIG_X86) + /* only EGA and VGA in 16 color graphic mode are supported */ + if (screen_info.orig_video_isVGA !=3D VIDEO_TYPE_EGAC && + screen_info.orig_video_isVGA !=3D VIDEO_TYPE_VGAC) + return -ENODEV; + + if (screen_info.orig_video_mode !=3D 0x0D && /* 320x200/4 (EGA) */ + screen_info.orig_video_mode !=3D 0x0E && /* 640x200/4 (EGA) */ + screen_info.orig_video_mode !=3D 0x10 && /* 640x350/4 (EGA) */ + screen_info.orig_video_mode !=3D 0x12) /* 640x480/4 (VGA) */ + return -ENODEV; +#endif + return 0; +} + static void vga16fb_pan_var(struct fb_info *info,=20 struct fb_var_screeninfo *var) { @@ -1427,6 +1446,11 @@ static int __init vga16fb_init(void) =20 vga16fb_setup(option); #endif + + ret =3D check_mode_supported(); + if (ret) + return ret; + ret =3D platform_driver_register(&vga16fb_driver); =20 if (!ret) { --=20 2.33.1