linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Michel Lanners <mlan@cpu.lu>
To: bob@kunk.jriver.com, bh40@calva.net,
	Paul Mackerras <paulus@linuxcare.com.au>
Cc: linuxppc-dev@lists.linuxppc.org
Subject: Re: controlfb and X (fixed)
Date: Sat, 18 Nov 2000 19:31:35 +0100 (CET)	[thread overview]
Message-ID: <200011181831.TAA00710@piglet.grunz.lu> (raw)
In-Reply-To: <20001107212230.7256.qmail@kunk.jriver.com>

[-- Attachment #1: Type: TEXT/plain, Size: 920 bytes --]

Hi all,

Some time ago, there were reports of crashes with controlfb and 2.4
kernels, while starting XF4.0.

I've taken a look, and it seems that indeed the mmap code recently added
to controlfb is to blame.

Below is the patch that fixes the hanging box while starting X for me.
It seems while implementing mmap() for 2.4 kernels in controlfb, I
forgot to copy 2 lines :-((

Ben and Paul, could you apply this patch to all your 2.4 / 2.5 trees? It
also fixes the 7_spaces_instead_of_tab problem in the mmap() code ;-)

Cheers, happy hacking, and sorry for this bug :-)

Michel

-------------------------------------------------------------------------
Michel Lanners                 |  " Read Philosophy.  Study Art.
23, Rue Paul Henkes            |    Ask Questions.  Make Mistakes.
L-1710 Luxembourg              |
email   mlan@cpu.lu            |
http://www.cpu.lu/~mlan        |                     Learn Always. "

[-- Attachment #2: 2.4-control-mmap-fix.diff --]
[-- Type: TEXT/plain, Size: 2497 bytes --]

--- /mnt/r4/usr/src/linux-2.4.paul/drivers/video/controlfb.c	Thu Oct 19 03:36:07 2000
+++ linux-2.4.0-test10/drivers/video/controlfb.c	Sat Nov 18 19:23:10 2000
@@ -338,38 +343,41 @@
 static int control_mmap(struct fb_info *info, struct file *file,
                        struct vm_area_struct *vma)
 {
-       struct fb_ops *fb = info->fbops;
-       struct fb_fix_screeninfo fix;
-       struct fb_var_screeninfo var;
-       unsigned long off, start;
-       u32 len;
-
-       fb->fb_get_fix(&fix, PROC_CONSOLE(info), info);
-       off = vma->vm_pgoff << PAGE_SHIFT;
-
-       /* frame buffer memory */
-       start = fix.smem_start;
-       len = PAGE_ALIGN((start & ~PAGE_MASK)+fix.smem_len);
-       if (off >= len) {
-               /* memory mapped io */
-               off -= len;
-               fb->fb_get_var(&var, PROC_CONSOLE(info), info);
-               if (var.accel_flags)
-                       return -EINVAL;
-               start = fix.mmio_start;
-               len = PAGE_ALIGN((start & ~PAGE_MASK)+fix.mmio_len);
-               pgprot_val(vma->vm_page_prot) |= _PAGE_NO_CACHE|_PAGE_GUARDED;
-       } else {
-               /* framebuffer */
-               pgprot_val(vma->vm_page_prot) |= _PAGE_WRITETHRU;
-       }
-       start &= PAGE_MASK;
-       vma->vm_pgoff = off >> PAGE_SHIFT;
-       if (io_remap_page_range(vma->vm_start, off,
-           vma->vm_end - vma->vm_start, vma->vm_page_prot))
-               return -EAGAIN;
+	struct fb_ops *fb = info->fbops;
+	struct fb_fix_screeninfo fix;
+	struct fb_var_screeninfo var;
+	unsigned long off, start;
+	u32 len;

-       return 0;
+	fb->fb_get_fix(&fix, PROC_CONSOLE(info), info);
+	off = vma->vm_pgoff << PAGE_SHIFT;
+
+	/* frame buffer memory */
+	start = fix.smem_start;
+	len = PAGE_ALIGN((start & ~PAGE_MASK)+fix.smem_len);
+	if (off >= len) {
+		/* memory mapped io */
+		off -= len;
+		fb->fb_get_var(&var, PROC_CONSOLE(info), info);
+		if (var.accel_flags)
+			return -EINVAL;
+		start = fix.mmio_start;
+		len = PAGE_ALIGN((start & ~PAGE_MASK)+fix.mmio_len);
+		pgprot_val(vma->vm_page_prot) |= _PAGE_NO_CACHE|_PAGE_GUARDED;
+	} else {
+		/* framebuffer */
+		pgprot_val(vma->vm_page_prot) |= _PAGE_WRITETHRU;
+	}
+	start &= PAGE_MASK;
+	if ((vma->vm_end - vma->vm_start + off) > len)
+		return -EINVAL;
+	off += start;
+	vma->vm_pgoff = off >> PAGE_SHIFT;
+	if (io_remap_page_range(vma->vm_start, off,
+	    vma->vm_end - vma->vm_start, vma->vm_page_prot))
+		return -EAGAIN;
+
+	return 0;
 }



  reply	other threads:[~2000-11-18 18:31 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-11-06  3:27 controlfb and X Robert E Brose II
2000-11-06 22:44 ` Michel Lanners
2000-11-07  6:16   ` bob
2000-11-07  7:05   ` Brad Boyer
2000-11-07 17:59     ` bob
2000-11-07 19:47     ` Michel Lanners
2000-11-07 21:22       ` bob
2000-11-18 18:31         ` Michel Lanners [this message]
2000-11-09  6:50 ` Michel Lanners
     [not found] <200011191036.LAA00685@piglet.grunz.lu>
2000-11-20  4:39 ` controlfb and X (fixed) Robert E Brose II

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200011181831.TAA00710@piglet.grunz.lu \
    --to=mlan@cpu.lu \
    --cc=bh40@calva.net \
    --cc=bob@kunk.jriver.com \
    --cc=linuxppc-dev@lists.linuxppc.org \
    --cc=paulus@linuxcare.com.au \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).