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 X-Spam-Level: X-Spam-Status: No, score=-1.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_PASS autolearn=ham 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 82055C43381 for ; Thu, 7 Mar 2019 09:39:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 58C1520675 for ; Thu, 7 Mar 2019 09:39:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726334AbfCGJjh (ORCPT ); Thu, 7 Mar 2019 04:39:37 -0500 Received: from mail-vk1-f195.google.com ([209.85.221.195]:40124 "EHLO mail-vk1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726102AbfCGJjg (ORCPT ); Thu, 7 Mar 2019 04:39:36 -0500 Received: by mail-vk1-f195.google.com with SMTP id d84so3547222vke.7; Thu, 07 Mar 2019 01:39:35 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=d4+VprPDJEzEhmtGEvPgsb6lf60i3/fCoOU7mG6GuUs=; b=BP/IbROSjQxMZnxExlv7pFuealp7Id6NKXGeeCTNn2W9Cn86/AWEFl2v0frW1LUxS6 GpBlCSJ7E7bbGV70pUbKDt3X49eBKqrNW1RsH0DILPqP1pVTQRpSmocMFNmoUtblVHXX jkhf2SJyJDCAQHyN271r0PWlecCa113AYomGc1iBM8rjWG33GWqu0kbBNScuAGurmFvf TJ5NtHdy1ke7RduBBzFSF/+lYln/6STdJfWtNjkF8ybF0G0CPH3KqVqNTnrM7dkmbEW/ g872gIi2RBByvrlco3NipYGYecpr4XFIjIzXi88fdC51shjAHk9Pr8+G/taPC7cbLmK6 q03w== X-Gm-Message-State: APjAAAWZ5jIX153bSrYvaCQe/krFWpR2/g66j1nODuXA1diEXu3JnEVJ UQD7yZqkddY2NM5/ydIs3oasjI2UlwvVjDgXK3A= X-Google-Smtp-Source: APXvYqwjcl94kDc1TBKBsE4/NUtEwQ8z3kBlmb20++mFzQXpOtEJ6laSvXtEn3yXJYRO6VTwu+N36nWLpIfd892EawY= X-Received: by 2002:a1f:be81:: with SMTP id o123mr5834879vkf.83.1551951575281; Thu, 07 Mar 2019 01:39:35 -0800 (PST) MIME-Version: 1.0 References: <20190307051641.GA7012@localhost.localdomain> <871s3jm532.fsf@intel.com> In-Reply-To: <871s3jm532.fsf@intel.com> From: Geert Uytterhoeven Date: Thu, 7 Mar 2019 10:39:23 +0100 Message-ID: Subject: Re: Is it possible to reset graphics controller on reboot in a framebuffer driver? To: Jani Nikula Cc: Linux Fbdev development list , DRI Development , Linux Kernel Mailing List , Bartlomiej Zolnierkiewicz , Sudip Mukherjee , Yifeng Li , Teddy Wang Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Jani, On Thu, Mar 7, 2019 at 10:00 AM Jani Nikula wrote: > On Thu, 07 Mar 2019, Tom Li wrote: > > As you may have noticed, recently I've been working on a reworked version > > of sm712fb, and planned to convert it to a DRM/KMS driver. Besides using > > it on embedded/non-x86 systems, I thought it would be a good idea to support > > histrocial x86 laptops with this VGA chipset as well, so I've acquired a > > machine for testing. > > > > However, soon I found a nasty problem. The BIOS does not reset the chip > > on boot! Like most graphics controller of that era, sm712 chipset has a > > VGA compatible mode and a 2D framebuffer mode. The power-on default is > > VGA. The BIOS writer just assumed this, and does nothing to reinitialize > > it. If one uses the framebuffer driver under Linux, once the machine reboots, > > the entire LCD panel becomes a piece of garbage. > > > > AFAIK, the framebuffer driver would be running throughout the kernel's life- > > cycle, is it really possible to workaround this issue by restoring on VGA > > state upon reboot? > > It's possible to do this using a reboot notifier. I am not sure if there > are better ways to achieve the same, but there's at least one example of > using reboot notifiers to achieve the exact same goal. > > See drivers/video/fbdev/aty/atyfb_base.c, look for > register_reboot_notifier(). Or a shutdown handler, which is more device-centric? (cfr. "[3/4] fbdev: atafb: Fix broken frame buffer after kexec", https://patchwork.kernel.org/patch/10814381/). Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds From mboxrd@z Thu Jan 1 00:00:00 1970 From: Geert Uytterhoeven Date: Thu, 07 Mar 2019 09:39:23 +0000 Subject: Re: Is it possible to reset graphics controller on reboot in a framebuffer driver? Message-Id: List-Id: References: <20190307051641.GA7012@localhost.localdomain> <871s3jm532.fsf@intel.com> In-Reply-To: <871s3jm532.fsf@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Jani Nikula Cc: Linux Fbdev development list , Teddy Wang , Bartlomiej Zolnierkiewicz , Linux Kernel Mailing List , DRI Development , Yifeng Li , Sudip Mukherjee Hi Jani, On Thu, Mar 7, 2019 at 10:00 AM Jani Nikula wrote: > On Thu, 07 Mar 2019, Tom Li wrote: > > As you may have noticed, recently I've been working on a reworked version > > of sm712fb, and planned to convert it to a DRM/KMS driver. Besides using > > it on embedded/non-x86 systems, I thought it would be a good idea to support > > histrocial x86 laptops with this VGA chipset as well, so I've acquired a > > machine for testing. > > > > However, soon I found a nasty problem. The BIOS does not reset the chip > > on boot! Like most graphics controller of that era, sm712 chipset has a > > VGA compatible mode and a 2D framebuffer mode. The power-on default is > > VGA. The BIOS writer just assumed this, and does nothing to reinitialize > > it. If one uses the framebuffer driver under Linux, once the machine reboots, > > the entire LCD panel becomes a piece of garbage. > > > > AFAIK, the framebuffer driver would be running throughout the kernel's life- > > cycle, is it really possible to workaround this issue by restoring on VGA > > state upon reboot? > > It's possible to do this using a reboot notifier. I am not sure if there > are better ways to achieve the same, but there's at least one example of > using reboot notifiers to achieve the exact same goal. > > See drivers/video/fbdev/aty/atyfb_base.c, look for > register_reboot_notifier(). Or a shutdown handler, which is more device-centric? (cfr. "[3/4] fbdev: atafb: Fix broken frame buffer after kexec", https://patchwork.kernel.org/patch/10814381/). Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds From mboxrd@z Thu Jan 1 00:00:00 1970 From: Geert Uytterhoeven Subject: Re: Is it possible to reset graphics controller on reboot in a framebuffer driver? Date: Thu, 7 Mar 2019 10:39:23 +0100 Message-ID: References: <20190307051641.GA7012@localhost.localdomain> <871s3jm532.fsf@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 Return-path: Received: from mail-vk1-f194.google.com (mail-vk1-f194.google.com [209.85.221.194]) by gabe.freedesktop.org (Postfix) with ESMTPS id 441726E279 for ; Thu, 7 Mar 2019 09:39:36 +0000 (UTC) Received: by mail-vk1-f194.google.com with SMTP id j195so3540755vkj.9 for ; Thu, 07 Mar 2019 01:39:36 -0800 (PST) In-Reply-To: <871s3jm532.fsf@intel.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" To: Jani Nikula Cc: Linux Fbdev development list , Teddy Wang , Bartlomiej Zolnierkiewicz , Linux Kernel Mailing List , DRI Development , Yifeng Li , Sudip Mukherjee List-Id: dri-devel@lists.freedesktop.org SGkgSmFuaSwKCk9uIFRodSwgTWFyIDcsIDIwMTkgYXQgMTA6MDAgQU0gSmFuaSBOaWt1bGEgPGph bmkubmlrdW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