public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Tomas Szepe <szepe@pinerecords.com>
To: "David S. Miller" <davem@redhat.com>
Cc: zaitcev@redhat.com, linux-kernel@vger.kernel.org
Subject: Re: sparc32 sunrpc.o
Date: Sun, 29 Sep 2002 12:22:39 +0200	[thread overview]
Message-ID: <20020929102238.GD4323@louise.pinerecords.com> (raw)
In-Reply-To: <20020928.232350.33317317.davem@redhat.com>

>    From: Tomas Szepe <szepe@pinerecords.com>
>    Date: Sat, 28 Sep 2002 18:13:16 +0200
> 
>    > Ok, DaveM, could you have a look at this patch?
>    
>    Please disregard, highmem.c unreasonably included linux/highmem.h.
>    I'll be looking into this some more.
>    
> Let us know when new working patch is available :-)

Right.  :)
This took a bit longer cos I had to leave for the night.

Patch against 2.4.20-pre8.

T.


diff -urN 2.4.20-pre8.vanilla/arch/sparc/kernel/sparc_ksyms.c linux-2.4.20-pre8/arch/sparc/kernel/sparc_ksyms.c
--- 2.4.20-pre8.vanilla/arch/sparc/kernel/sparc_ksyms.c	2002-08-03 06:12:08.000000000 +0200
+++ linux-2.4.20-pre8/arch/sparc/kernel/sparc_ksyms.c	2002-09-29 11:45:33.000000000 +0200
@@ -46,6 +46,9 @@
 #include <asm/sbus.h>
 #include <asm/dma.h>
 #endif
+#ifdef CONFIG_HIGHMEM
+#include <asm/highmem.h>
+#endif
 #include <asm/a.out.h>
 #include <asm/io-unit.h>
 
@@ -204,6 +207,12 @@
 EXPORT_SYMBOL(pci_dma_sync_single);
 #endif
 
+/* in arch/sparc/mm/highmem.c */
+#ifdef CONFIG_HIGHMEM
+EXPORT_SYMBOL(kmap_atomic);
+EXPORT_SYMBOL(kunmap_atomic);
+#endif
+
 /* Solaris/SunOS binary compatibility */
 EXPORT_SYMBOL(svr4_setcontext);
 EXPORT_SYMBOL(svr4_getcontext);
diff -urN 2.4.20-pre8.vanilla/arch/sparc/mm/Makefile linux-2.4.20-pre8/arch/sparc/mm/Makefile
--- 2.4.20-pre8.vanilla/arch/sparc/mm/Makefile	2000-12-29 23:07:21.000000000 +0100
+++ linux-2.4.20-pre8/arch/sparc/mm/Makefile	2002-09-29 11:45:33.000000000 +0200
@@ -11,7 +11,7 @@
 	$(CC) $(AFLAGS) -ansi -c -o $*.o $<
 
 O_TARGET := mm.o
-obj-y    := fault.o init.o loadmmu.o generic.o extable.o btfixup.o
+obj-y    := fault.o init.o loadmmu.o generic.o extable.o highmem.o btfixup.o
 
 ifeq ($(CONFIG_SUN4),y)
 obj-y	 += nosrmmu.o
diff -urN 2.4.20-pre8.vanilla/arch/sparc/mm/highmem.c linux-2.4.20-pre8/arch/sparc/mm/highmem.c
--- 2.4.20-pre8.vanilla/arch/sparc/mm/highmem.c	1970-01-01 01:00:00.000000000 +0100
+++ linux-2.4.20-pre8/arch/sparc/mm/highmem.c	2002-09-29 11:46:38.000000000 +0200
@@ -0,0 +1,84 @@
+/*
+ *  highmem.c: virtual kernel memory mappings for high memory
+ *
+ *  Provides kernel-static versions of atomic kmap functions originally
+ *  found as inlines in include/asm-sparc/highmem.h.  These became
+ *  needed as kmap_atomic() and kunmap_atomic() started getting
+ *  called from within modules.
+ *  -- Tomas Szepe <szepe@pinerecords.com>, September 2002
+ */
+
+#include <linux/mm.h>
+#include <asm/highmem.h>
+#include <asm/pgalloc.h>
+
+/*
+ * The use of kmap_atomic/kunmap_atomic is discouraged -- kmap()/kunmap()
+ * gives a more generic (and caching) interface.  But kmap_atomic() can
+ * be used in IRQ contexts, so in some (very limited) cases we need it.
+ */
+void *kmap_atomic(struct page *page, enum km_type type)
+{
+	unsigned long idx;
+	unsigned long vaddr;
+
+	if (page < highmem_start_page)
+		return page_address(page);
+
+	idx = type + KM_TYPE_NR * smp_processor_id();
+	vaddr = fix_kmap_begin + idx * PAGE_SIZE;
+
+/* XXX Fix - Anton */
+#if 0
+	__flush_cache_one(vaddr);
+#else
+	flush_cache_all();
+#endif
+
+#if HIGHMEM_DEBUG
+	if (!pte_none(*(kmap_pte + idx)))
+		BUG();
+#endif
+	set_pte(kmap_pte + idx, mk_pte(page, kmap_prot));
+/* XXX Fix - Anton */
+#if 0
+	__flush_tlb_one(vaddr);
+#else
+	flush_tlb_all();
+#endif
+
+	return (void *) vaddr;
+}
+
+void kunmap_atomic(void *kvaddr, enum km_type type)
+{
+	unsigned long vaddr = (unsigned long) kvaddr;
+	unsigned long idx = type + KM_TYPE_NR * smp_processor_id();
+
+	if (vaddr < fix_kmap_begin) /* FIXME */
+		return;
+
+	if (vaddr != fix_kmap_begin + idx * PAGE_SIZE)
+		BUG();
+
+/* XXX Fix - Anton */
+#if 0
+	__flush_cache_one(vaddr);
+#else
+	flush_cache_all();
+#endif
+
+#ifdef HIGHMEM_DEBUG
+	/*
+	 *  Force other mappings to oops if they try to access
+	 *  this pte without first remapping it.
+	 */
+	pte_clear(kmap_pte + idx);
+/* XXX Fix - Anton */
+#if 0
+	__flush_tlb_one(vaddr);
+#else
+	flush_tlb_all();
+#endif
+#endif
+}
diff -urN 2.4.20-pre8.vanilla/include/asm-sparc/highmem.h linux-2.4.20-pre8/include/asm-sparc/highmem.h
--- 2.4.20-pre8.vanilla/include/asm-sparc/highmem.h	2002-09-29 11:36:45.000000000 +0200
+++ linux-2.4.20-pre8/include/asm-sparc/highmem.h	2002-09-29 11:48:13.000000000 +0200
@@ -29,6 +29,13 @@
 /* undef for production */
 #define HIGHMEM_DEBUG 1
 
+/* in mm/highmem.c */
+extern void *kmap_high(struct page *page);
+extern void kunmap_high(struct page *page);
+
+/* in mm/memory.c */
+extern struct page *highmem_start_page;
+
 /* declarations for highmem.c */
 extern unsigned long highstart_pfn, highend_pfn;
 
@@ -51,12 +58,13 @@
  */
 #define LAST_PKMAP 1024
 
-#define LAST_PKMAP_MASK (LAST_PKMAP - 1)
-#define PKMAP_NR(virt)  ((virt - pkmap_base) >> PAGE_SHIFT)
-#define PKMAP_ADDR(nr)  (pkmap_base + ((nr) << PAGE_SHIFT))
-
-extern void *kmap_high(struct page *page);
-extern void kunmap_high(struct page *page);
+#define LAST_PKMAP_MASK		(LAST_PKMAP - 1)
+#define PKMAP_NR(virt)		((virt - pkmap_base) >> PAGE_SHIFT)
+#define PKMAP_ADDR(nr)		(pkmap_base + ((nr) << PAGE_SHIFT))
+
+/* in arch/sparc/mm/highmem.c */
+void *kmap_atomic(struct page *page, enum km_type type);
+void kunmap_atomic(void *kvaddr, enum km_type type);
 
 static inline void *kmap(struct page *page)
 {
@@ -76,78 +84,6 @@
 	kunmap_high(page);
 }
 
-/*
- * The use of kmap_atomic/kunmap_atomic is discouraged - kmap/kunmap
- * gives a more generic (and caching) interface. But kmap_atomic can
- * be used in IRQ contexts, so in some (very limited) cases we need
- * it.
- */
-static inline void *kmap_atomic(struct page *page, enum km_type type)
-{
-	unsigned long idx;
-	unsigned long vaddr;
-
-	if (page < highmem_start_page)
-		return page_address(page);
-
-	idx = type + KM_TYPE_NR*smp_processor_id();
-	vaddr = fix_kmap_begin + idx * PAGE_SIZE;
-
-/* XXX Fix - Anton */
-#if 0
-	__flush_cache_one(vaddr);
-#else
-	flush_cache_all();
-#endif
-
-#if HIGHMEM_DEBUG
-	if (!pte_none(*(kmap_pte+idx)))
-		BUG();
-#endif
-	set_pte(kmap_pte+idx, mk_pte(page, kmap_prot));
-/* XXX Fix - Anton */
-#if 0
-	__flush_tlb_one(vaddr);
-#else
-	flush_tlb_all();
-#endif
-
-	return (void*) vaddr;
-}
-
-static inline void kunmap_atomic(void *kvaddr, enum km_type type)
-{
-	unsigned long vaddr = (unsigned long) kvaddr;
-	unsigned long idx = type + KM_TYPE_NR*smp_processor_id();
-
-	if (vaddr < fix_kmap_begin) // FIXME
-		return;
-
-	if (vaddr != fix_kmap_begin + idx * PAGE_SIZE)
-		BUG();
-
-/* XXX Fix - Anton */
-#if 0
-	__flush_cache_one(vaddr);
-#else
-	flush_cache_all();
-#endif
-
-#ifdef HIGHMEM_DEBUG
-	/*
-	 * force other mappings to Oops if they'll try to access
-	 * this pte without first remap it
-	 */
-	pte_clear(kmap_pte+idx);
-/* XXX Fix - Anton */
-#if 0
-	__flush_tlb_one(vaddr);
-#else
-	flush_tlb_all();
-#endif
-#endif
-}
-
 #endif /* __KERNEL__ */
 
 #endif /* _ASM_HIGHMEM_H */

  reply	other threads:[~2002-09-29 10:17 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.1033072381.13688.linux-kernel2news@redhat.com>
2002-09-26 21:27 ` sparc32 sunrpc.o Pete Zaitcev
2002-09-26 21:29   ` David S. Miller
2002-09-28 12:28     ` Tomas Szepe
2002-09-28 16:13       ` Tomas Szepe
2002-09-29  6:23         ` David S. Miller
2002-09-29 10:22           ` Tomas Szepe [this message]
2002-09-29 23:56             ` Pete Zaitcev
2002-09-30  0:50               ` David S. Miller
2002-09-30  2:05               ` Horst von Brand
2002-09-30  2:09               ` Tomas Szepe
2002-09-26 20:25 Tomas Szepe
2002-09-26 21:09 ` David S. Miller

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=20020929102238.GD4323@louise.pinerecords.com \
    --to=szepe@pinerecords.com \
    --cc=davem@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=zaitcev@redhat.com \
    /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