public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "George Kadianakis (asn)" <asn@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] linux-patches r1506 - genpatches-2.6/trunk/2.6.28
Date: Wed, 11 Mar 2009 15:10:20 +0000	[thread overview]
Message-ID: <E1LhQ4a-0007R0-80@stork.gentoo.org> (raw)

Author: asn
Date: 2009-03-11 15:10:19 +0000 (Wed, 11 Mar 2009)
New Revision: 1506

Added:
   genpatches-2.6/trunk/2.6.28/2300_ppc-legacymem-anon-memory.patch
Modified:
   genpatches-2.6/trunk/2.6.28/0000_README
Log:
Fix launching of X.org on some PPC platforms

Modified: genpatches-2.6/trunk/2.6.28/0000_README
===================================================================
--- genpatches-2.6/trunk/2.6.28/0000_README	2009-03-07 19:52:39 UTC (rev 1505)
+++ genpatches-2.6/trunk/2.6.28/0000_README	2009-03-11 15:10:19 UTC (rev 1506)
@@ -79,6 +79,10 @@
 From:	http://bugs.gentoo.org/show_bug.cgi?id=257738
 Desc:	Fix return value of journal_start_commit()
 
+Patch	2300_ppc-legacymem-anon-memory.patch
+From:	https://bugs.gentoo.org/253149
+Desc:	Fix launching of X.org on some PPC platforms
+
 Patch:	2305_uninline-pci-ioremap-bar.patch
 From:	http://bugs.gentoo.org/252488
 Desc:	Move some PCI code around to fix compilation on alpha
@@ -97,7 +101,7 @@
 
 Patch:	2705_i915-no-vblank-on-disabled-pipe.patch
 From:	http://bugs.gentoo.org/253813
-Desc:	Fix crash with GEM + compiz
+ppDesc:	Fix crash with GEM + compiz
 
 Patch:	2710_i915-set-vblank-flag-correctly.patch
 From;	http://bugs.gentoo.org/253813

Added: genpatches-2.6/trunk/2.6.28/2300_ppc-legacymem-anon-memory.patch
===================================================================
--- genpatches-2.6/trunk/2.6.28/2300_ppc-legacymem-anon-memory.patch	                        (rev 0)
+++ genpatches-2.6/trunk/2.6.28/2300_ppc-legacymem-anon-memory.patch	2009-03-11 15:10:19 UTC (rev 1506)
@@ -0,0 +1,51 @@
+From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
+Date: Sun, 8 Feb 2009 14:27:21 +0000 (+0000)
+Subject: powerpc/pci: mmap anonymous memory when legacy_mem doesn't exist
+X-Git-Tag: v2.6.29-rc5~40^2~1
+X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Ftorvalds%2Flinux-2.6.git;a=commitdiff_plain;h=5b11abfdb572bf9284e596dd198ac2aaf95b6616
+
+powerpc/pci: mmap anonymous memory when legacy_mem doesn't exist
+
+The new legacy_mem file in sysfs is causing problems with X on machines
+that don't support legacy memory access. The way I initially implemented
+it, we would fail with -ENXIO when trying to mmap it, thus exposing to
+X that we do support the API but there is no legacy memory.
+
+Unfortunately, X poor error handling is causing it to fail to start when
+it gets this error.
+
+This implements a workaround hack that instead maps anonymous memory
+instead (using shmem if VM_SHARED is set, just like /dev/zero does).
+
+Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
+---
+
+diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
+index 19b12d2..0f41812 100644
+--- a/arch/powerpc/kernel/pci-common.c
++++ b/arch/powerpc/kernel/pci-common.c
+@@ -561,8 +561,21 @@ int pci_mmap_legacy_page_range(struct pci_bus *bus,
+ 		 (unsigned long long)(offset + size - 1));
+ 
+ 	if (mmap_state == pci_mmap_mem) {
+-		if ((offset + size) > hose->isa_mem_size)
+-			return -ENXIO;
++		/* Hack alert !
++		 *
++		 * Because X is lame and can fail starting if it gets an error trying
++		 * to mmap legacy_mem (instead of just moving on without legacy memory
++		 * access) we fake it here by giving it anonymous memory, effectively
++		 * behaving just like /dev/zero
++		 */
++		if ((offset + size) > hose->isa_mem_size) {
++			printk(KERN_DEBUG
++			       "Process %s (pid:%d) mapped non-existing PCI legacy memory for 0%04x:%02x\n",
++			       current->comm, current->pid, pci_domain_nr(bus), bus->number);
++			if (vma->vm_flags & VM_SHARED)
++				return shmem_zero_setup(vma);
++			return 0;
++		}
+ 		offset += hose->isa_mem_phys;
+ 	} else {
+ 		unsigned long io_offset = (unsigned long)hose->io_base_virt - _IO_BASE;
+




                 reply	other threads:[~2009-03-11 15:10 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=E1LhQ4a-0007R0-80@stork.gentoo.org \
    --to=asn@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    /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