Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753003AbdGCIeL (ORCPT ); Mon, 3 Jul 2017 04:34:11 -0400 Received: from chuckie.co.uk ([82.165.15.123]:46374 "EHLO s16892447.onlinehome-server.info" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752591AbdGCIeI (ORCPT ); Mon, 3 Jul 2017 04:34:08 -0400 To: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, kraxel@redhat.com References: <1499032363-8290-1-git-send-email-mark.cave-ayland@ilande.co.uk> <20170703081116.rub4ty5ewpi5af3o@phenom.ffwll.local> From: Mark Cave-Ayland Message-ID: Date: Mon, 3 Jul 2017 09:33:51 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <20170703081116.rub4ty5ewpi5af3o@phenom.ffwll.local> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-SA-Exim-Connect-IP: 86.188.254.49 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: Re: [PATCH] drm/bochs: switch fb_ops over to use drm_fb_helper_cfb helpers X-SA-Exim-Version: 4.2.1 (built Sun, 08 Jan 2012 02:45:44 +0000) X-SA-Exim-Scanned: Yes (on s16892447.onlinehome-server.info) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2105 Lines: 51 On 03/07/17 09:11, Daniel Vetter wrote: > On Sun, Jul 02, 2017 at 10:52:43PM +0100, Mark Cave-Ayland wrote: >> The current drm_fb_helper_sys helpers referenced in fb_ops assume that the >> video memory is in system RAM. This is not the case for sparc which uses direct >> physical memory accesses for IO memory and causes the bochs_drm module to panic >> immediately upon startup as it tries to initialise the framebuffer. >> >> Switching fb_ops over to use the drm_fb_helper_cfb helpers ensures that the >> correct accesses are used on sparc, fixing the panic and allowing the >> bochs_drm module to function under qemu-system-sparc64. >> >> Signed-off-by: Mark Cave-Ayland > > So is this generally true for bochs, or is this now going to broken > platforms where the bochs framebuffer is in system memory? > > I'm not entirely clear on that from your commit message ... Here's my original analysis on the problem: http://lkml.iu.edu/hypermail/linux/kernel/1706.3/04745.html where you can see the issue is that on sparc you can't just assume that address returned from ioremap() is a virtual address. Most of the context for this change comes from commit 68648ed which has this initial paragraph: fbdev: add drawing functions for framebuffers in system RAM The generic drawing functions (cfbimgblt, cfbcopyarea, cfbfillrect) assume that the framebuffer is in IO memory. However, we have 3 drivers (hecubafb, arcfb, and vfb) where the framebuffer is allocated from system RAM (via vmalloc). Using _raw_read/write and family for these drivers (as used in the cfb* functions) is illegal, especially in other platforms. Given that bochs_drm is a PCI device which supports both memory and IO accesses then I would think that the above comment about using _raw_read/write isn't relevant here and this is the correct fix (for reference I do see that nouveau/radeon/i915 which are also PCI-based are already using the cfb helper functions). Hopefully Gerd has experience using bochs_drm with other non-x86 systems and can comment further. ATB, Mark.