rpms/kernel/F-9 drm-mm-readd-nopfn.patch, NONE, 1.1 drm-fedora9-rollup.patch, 1.4, 1.5 kernel.spec, 1.822, 1.823

Chuck Ebbert cebbert at fedoraproject.org
Thu Oct 30 14:52:45 UTC 2008


Author: cebbert

Update of /cvs/pkgs/rpms/kernel/F-9
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv19624

Modified Files:
	drm-fedora9-rollup.patch kernel.spec 
Added Files:
	drm-mm-readd-nopfn.patch 
Log Message:
Fix the DRM patch enough that the code compiles.

drm-mm-readd-nopfn.patch:

--- NEW FILE drm-mm-readd-nopfn.patch ---
revert commit: 0d71d10a4252a3938e6b70189bc776171c02e076

This will re-add the mm nopfn ops, needed by the F9 DRM code.

--- b/include/linux/mm.h
+++ a/include/linux/mm.h
@@ -166,6 +166,8 @@
 	void (*open)(struct vm_area_struct * area);
 	void (*close)(struct vm_area_struct * area);
 	int (*fault)(struct vm_area_struct *vma, struct vm_fault *vmf);
+	unsigned long (*nopfn)(struct vm_area_struct *area,
+			unsigned long address);
 
 	/* notification that a previously read-only page is about to become
 	 * writable, if an error is returned it will cause a SIGBUS */
@@ -673,6 +675,13 @@
 }
 
 /*
+ * Error return values for the *_nopfn functions
+ */
+#define NOPFN_SIGBUS	((unsigned long) -1)
+#define NOPFN_OOM	((unsigned long) -2)
+#define NOPFN_REFAULT	((unsigned long) -3)
+
+/*
  * Different kinds of faults, as returned by handle_mm_fault().
  * Used to decide whether a process gets delivered SIGBUS or
  * just gets major/minor fault counters bumped up.
--- b/mm/memory.c
+++ a/mm/memory.c
@@ -1058,9 +1058,11 @@
 	if (vma->vm_flags & (VM_LOCKED | VM_SHARED))
 		return 0;
 	/*
+	 * And if we have a fault or a nopfn routine, it's not an
+	 * anonymous region.
-	 * And if we have a fault routine, it's not an anonymous region.
 	 */
+	return !vma->vm_ops ||
+		(!vma->vm_ops->fault && !vma->vm_ops->nopfn);
-	return !vma->vm_ops || !vma->vm_ops->fault;
 }
 
 int get_user_pages(struct task_struct *tsk, struct mm_struct *mm,
@@ -1336,11 +1338,6 @@
  *
  * This function should only be called from a vm_ops->fault handler, and
  * in that case the handler should return NULL.
- *
- * vma cannot be a COW mapping.
- *
- * As this is called only for pages that do not currently exist, we
- * do not need to flush old virtual caches or the TLB.
  */
 int vm_insert_pfn(struct vm_area_struct *vma, unsigned long addr,
 			unsigned long pfn)
@@ -2504,6 +2501,59 @@
 	return __do_fault(mm, vma, address, pmd, pgoff, flags, orig_pte);
 }
 
+
+/*
+ * do_no_pfn() tries to create a new page mapping for a page without
+ * a struct_page backing it
+ *
+ * As this is called only for pages that do not currently exist, we
+ * do not need to flush old virtual caches or the TLB.
+ *
+ * We enter with non-exclusive mmap_sem (to exclude vma changes,
+ * but allow concurrent faults), and pte mapped but not yet locked.
+ * We return with mmap_sem still held, but pte unmapped and unlocked.
+ *
+ * It is expected that the ->nopfn handler always returns the same pfn
+ * for a given virtual mapping.
+ *
+ * Mark this `noinline' to prevent it from bloating the main pagefault code.
+ */
+static noinline int do_no_pfn(struct mm_struct *mm, struct vm_area_struct *vma,
+		     unsigned long address, pte_t *page_table, pmd_t *pmd,
+		     int write_access)
+{
+	spinlock_t *ptl;
+	pte_t entry;
+	unsigned long pfn;
+
+	pte_unmap(page_table);
+	BUG_ON(!(vma->vm_flags & (VM_PFNMAP|VM_MIXEDMAP)));
+	BUG_ON((vma->vm_flags & VM_PFNMAP) && is_cow_mapping(vma->vm_flags));
+
+	pfn = vma->vm_ops->nopfn(vma, address & PAGE_MASK);
+
+	BUG_ON((vma->vm_flags & VM_MIXEDMAP) && pfn_valid(pfn));
+
+	if (unlikely(pfn == NOPFN_OOM))
+		return VM_FAULT_OOM;
+	else if (unlikely(pfn == NOPFN_SIGBUS))
+		return VM_FAULT_SIGBUS;
+	else if (unlikely(pfn == NOPFN_REFAULT))
+		return 0;
+
+	page_table = pte_offset_map_lock(mm, pmd, address, &ptl);
+
+	/* Only go through if we didn't race with anybody else... */
+	if (pte_none(*page_table)) {
+		entry = pfn_pte(pfn, vma->vm_page_prot);
+		if (write_access)
+			entry = maybe_mkwrite(pte_mkdirty(entry), vma);
+		set_pte_at(mm, address, page_table, entry);
+	}
+	pte_unmap_unlock(page_table, ptl);
+	return 0;
+}
+
 /*
  * Fault of a previously existing named mapping. Repopulate the pte
  * from the encoded file_pte if possible. This enables swappable
@@ -2564,6 +2614,9 @@
 				if (likely(vma->vm_ops->fault))
 					return do_linear_fault(mm, vma, address,
 						pte, pmd, write_access, entry);
+				if (unlikely(vma->vm_ops->nopfn))
+					return do_no_pfn(mm, vma, address, pte,
+							 pmd, write_access);
 			}
 			return do_anonymous_page(mm, vma, address,
 						 pte, pmd, write_access);

drm-fedora9-rollup.patch:

Index: drm-fedora9-rollup.patch
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/F-9/drm-fedora9-rollup.patch,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- drm-fedora9-rollup.patch	30 Oct 2008 12:45:25 -0000	1.4
+++ drm-fedora9-rollup.patch	30 Oct 2008 14:52:45 -0000	1.5
@@ -9108,11 +9108,11 @@
 +	return num_modes;
 +}
 +EXPORT_SYMBOL(drm_add_edid_modes);
-diff --git a/drivers/gpu/drm/drm_edid.h b/drivers/gpu/drm/drm_edid.h
+diff --git a/include/drm/drm_edid.h b/include/drm/drm_edid.h
 new file mode 100644
 index 0000000..0d2eeaa
 --- /dev/null
-+++ b/drivers/gpu/drm/drm_edid.h
++++ b/include/drm/drm_edid.h
 @@ -0,0 +1,176 @@
 +#ifndef __DRM_EDID_H__
 +#define __DRM_EDID_H__
@@ -13335,7 +13335,7 @@
 +
 +void drm_ttm_cache_flush(void)
 +{
-+	if (on_each_cpu(drm_ttm_ipi_handler, NULL, 1, 1) != 0)
++	if (on_each_cpu(drm_ttm_ipi_handler, NULL, 1) != 0)
 +		DRM_ERROR("Timed out waiting for drm cache flush.\n");
 +}
 +EXPORT_SYMBOL(drm_ttm_cache_flush);
@@ -29505,7 +29505,7 @@
 +							     PAGE_SIZE,
 +							     DMA_BIDIRECTIONAL);
 +
-+					if (dma_mapping_error(dev->sg->busaddr[idx])) {
++					if (dma_mapping_error(NULL, dev->sg->busaddr[idx])) {
 +						return -ENOMEM;
 +					}
 +				}
@@ -30591,7 +30591,7 @@
 +							 page, o,
 +							 NV_CTXDMA_PAGE_SIZE,
 +							 PCI_DMA_BIDIRECTIONAL);
-+			if (pci_dma_mapping_error(nvbe->pagelist[d])) {
++			if (pci_dma_mapping_error(nvbe->dev->pdev, nvbe->pagelist[d])) {
 +				be->func->clear(be);
 +				DRM_ERROR("pci_map_page failed\n");
 +				return -EINVAL;
@@ -30766,7 +30766,7 @@
 +
 +	dev_priv->gart_info.sg_dummy_page =
 +		alloc_page(GFP_KERNEL|__GFP_DMA32);
-+	SetPageLocked(dev_priv->gart_info.sg_dummy_page);
++	set_page_locked(dev_priv->gart_info.sg_dummy_page);
 +	dev_priv->gart_info.sg_dummy_bus =
 +		pci_map_page(dev->pdev, dev_priv->gart_info.sg_dummy_page, 0,
 +			     PAGE_SIZE, PCI_DMA_BIDIRECTIONAL);


Index: kernel.spec
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/F-9/kernel.spec,v
retrieving revision 1.822
retrieving revision 1.823
diff -u -r1.822 -r1.823
--- kernel.spec	30 Oct 2008 08:38:49 -0000	1.822
+++ kernel.spec	30 Oct 2008 14:52:45 -0000	1.823
@@ -663,6 +663,7 @@
 
 # nouveau + drm fixes
 Patch1801: drm-fedora9-rollup.patch
+Patch1802: drm-mm-readd-nopfn.patch
 
 # kludge to make ich9 e1000 work
 Patch2000: linux-2.6-e1000-ich9.patch
@@ -1228,6 +1229,7 @@
 
 # Nouveau DRM + drm fixes
 ApplyPatch drm-fedora9-rollup.patch
+ApplyPatch drm-mm-readd-nopfn.patch
 
 # Filesystem patches
 
@@ -1849,6 +1851,9 @@
 %kernel_variant_files -a /%{image_install_path}/xen*-%{KVERREL}.xen -e /etc/ld.so.conf.d/kernelcap-%{KVERREL}.xen.conf %{with_xen} xen
 
 %changelog
+* Thu Oct 30 2008 Chuck Ebbert <cebbert at redhat.com> 2.6.27.4-10
+- Fix the DRM patch enough that the code compiles.
+
 * Thu Oct 30 2008 Chuck Ebbert <cebbert at redhat.com> 2.6.27.4-9
 - Fix TCP option ordering that broke connectivity for some people.
 




More information about the scm-commits mailing list