From: girish <girishvg@gmail.com>
To: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Cc: "linux-mips@linux-mips.org" <linux-mips@linux-mips.org>,
girish <girishvg@gmail.com>
Subject: PATCH] cleanup hardcoding __pa/__va macros etc. (take-4)
Date: Thu, 28 Sep 2006 01:58:02 +0900 [thread overview]
Message-ID: <C140DCAC.7A1C%girishvg@gmail.com> (raw)
In-Reply-To: <20060928.003542.21929658.anemo@mba.ocn.ne.jp>
[-- Attachment #1: Type: text/plain, Size: 1042 bytes --]
> Using just plain text and adding Signed-off-by line would be preferred.
> Also your patch seems against neither latest lmo nor kernel.org tree...
The kernel sources I was referring to were 2.6.17-rc6.
>> In the meantime, I couldn't find the changes suggested for SPARSEMEM support
>> in the main source tree. Especially the ones reviewed during month of August
>> ([PATCH] do not count pages in holes with sparsemem ...). Could you please
>> resend the consolidated patch to the list? Thanks.
>
> August? I sent the patch with that title in July and applied already.
>
> http://www.linux-mips.org/git?p=linux.git;a=commit;h=239367b4
Again, I was referring to older sources, that is 2.6.17-rc6. I have just
upgraded reference sources to 2.6.18 as mentioned above & now I see the
changes. Thanks. In fact I am experimenting on highmem/sparsemem with
2.6.16.16 kernel sources.
Please find attached patch created from 2.6.18 (kernel.org) tree. Let me
know if this is alright.
Signed-off-by: Girish V. Gulawani <girishvg@gmail.com>
[-- Attachment #2: patch-pavafix-20060928 --]
[-- Type: application/octet-stream, Size: 4604 bytes --]
diff -uprN -X linux-vanilla/Documentation/dontdiff linux-vanilla/arch/mips/mm/dma-noncoherent.c linux/arch/mips/mm/dma-noncoherent.c
--- linux-vanilla/arch/mips/mm/dma-noncoherent.c 2006-09-20 12:42:06.000000000 +0900
+++ linux/arch/mips/mm/dma-noncoherent.c 2006-09-28 01:14:01.000000000 +0900
@@ -333,7 +333,7 @@ EXPORT_SYMBOL(pci_dac_page_to_dma);
struct page *pci_dac_dma_to_page(struct pci_dev *pdev,
dma64_addr_t dma_addr)
{
- return mem_map + (dma_addr >> PAGE_SHIFT);
+ return pfn_to_page (dma_addr >> PAGE_SHIFT);
}
EXPORT_SYMBOL(pci_dac_dma_to_page);
diff -uprN -X linux-vanilla/Documentation/dontdiff linux-vanilla/arch/mips/mm/init.c linux/arch/mips/mm/init.c
--- linux-vanilla/arch/mips/mm/init.c 2006-09-20 12:42:06.000000000 +0900
+++ linux/arch/mips/mm/init.c 2006-09-28 01:16:20.000000000 +0900
@@ -180,24 +180,22 @@ void __init paging_init(void)
low = max_low_pfn;
high = highend_pfn;
-#ifdef CONFIG_ISA
- if (low < max_dma)
+ if (low < max_dma) }
zones_size[ZONE_DMA] = low;
- else {
+ } else {
zones_size[ZONE_DMA] = max_dma;
zones_size[ZONE_NORMAL] = low - max_dma;
}
-#else
- zones_size[ZONE_DMA] = low;
-#endif
+
#ifdef CONFIG_HIGHMEM
if (cpu_has_dc_aliases) {
printk(KERN_WARNING "This processor doesn't support highmem.");
if (high - low)
printk(" %ldk highmem ignored", high - low);
printk("\n");
- } else
- zones_size[ZONE_HIGHMEM] = high - low;
+ } else {
+ zones_size[ZONE_HIGHMEM] = high - highstart_pfn;
+ }
#endif
#ifdef CONFIG_FLATMEM
@@ -246,7 +244,7 @@ void __init mem_init(void)
#ifdef CONFIG_HIGHMEM
for (tmp = highstart_pfn; tmp < highend_pfn; tmp++) {
- struct page *page = mem_map + tmp;
+ struct page *page = pfn_to_page (tmp);
if (!page_is_ram(tmp)) {
SetPageReserved(page);
diff -uprN -X linux-vanilla/Documentation/dontdiff linux-vanilla/include/asm-mips/dma.h linux/include/asm-mips/dma.h
--- linux-vanilla/include/asm-mips/dma.h 2006-09-20 12:42:06.000000000 +0900
+++ linux/include/asm-mips/dma.h 2006-09-28 01:18:31.000000000 +0900
@@ -86,8 +86,13 @@
/* Horrible hack to have a correct DMA window on IP22 */
#include <asm/sgi/mc.h>
#define MAX_DMA_ADDRESS (PAGE_OFFSET + SGIMC_SEG0_BADDR + 0x01000000)
-#else
+#elif defined(CONFIG_ISA)
#define MAX_DMA_ADDRESS (PAGE_OFFSET + 0x01000000)
+#else
+#ifndef PLAT_MAX_DMA_SIZE
+#define PLAT_MAX_DMA_SIZE 0x10000000 /* 256MB: true on most of the MIPS32 systems */
+#endif
+#define MAX_DMA_ADDRESS (PAGE_OFFSET + PLAT_MAX_DMA_SIZE)
#endif
/* 8237 DMA controllers */
diff -uprN -X linux-vanilla/Documentation/dontdiff linux-vanilla/include/asm-mips/io.h linux/include/asm-mips/io.h
--- linux-vanilla/include/asm-mips/io.h 2006-09-20 12:42:06.000000000 +0900
+++ linux/include/asm-mips/io.h 2006-09-28 01:20:22.000000000 +0900
@@ -115,7 +115,7 @@ static inline void set_io_port_base(unsi
*/
static inline unsigned long virt_to_phys(volatile void * address)
{
- return (unsigned long)address - PAGE_OFFSET;
+ return __pa(address);
}
/*
@@ -132,7 +132,7 @@ static inline unsigned long virt_to_phys
*/
static inline void * phys_to_virt(unsigned long address)
{
- return (void *)(address + PAGE_OFFSET);
+ return __va(address);
}
/*
@@ -140,12 +140,12 @@ static inline void * phys_to_virt(unsign
*/
static inline unsigned long isa_virt_to_bus(volatile void * address)
{
- return (unsigned long)address - PAGE_OFFSET;
+ return __pa(address);
}
static inline void * isa_bus_to_virt(unsigned long address)
{
- return (void *)(address + PAGE_OFFSET);
+ return __va(address);
}
#define isa_page_to_bus page_to_phys
diff -uprN -X linux-vanilla/Documentation/dontdiff linux-vanilla/include/asm-mips/page.h linux/include/asm-mips/page.h
--- linux-vanilla/include/asm-mips/page.h 2006-09-20 12:42:06.000000000 +0900
+++ linux/include/asm-mips/page.h 2006-09-28 01:26:00.000000000 +0900
@@ -129,8 +129,15 @@ typedef struct { unsigned long pgprot; }
/* to align the pointer to the (next) page boundary */
#define PAGE_ALIGN(addr) (((addr) + PAGE_SIZE - 1) & PAGE_MASK)
-#define __pa(x) ((unsigned long) (x) - PAGE_OFFSET)
-#define __va(x) ((void *)((unsigned long) (x) + PAGE_OFFSET))
+#ifdef CONFIG_32BIT
+#define ISMAPPED(x) (KSEGX((x)) >= HIGHMEM_START && KSEGX((x)) < KSEG0)
+#else
+#define ISMAPPED(x) (0)
+#endif
+#define ___pa(x) ((unsigned long) (x) - PAGE_OFFSET)
+#define __pa(x) (ISMAPPED(x) ? (unsigned long)(x) : ___pa(x))
+#define ___va(x) ((void *)((unsigned long) (x) + PAGE_OFFSET))
+#define __va(x) (ISMAPPED(x) ? (void*)(x) : ___va(x))
#define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT)
next prev parent reply other threads:[~2006-09-27 16:58 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-09-24 5:39 [PATCH] cleanup hardcoding __pa/__va macros etc girish
2006-09-24 7:15 ` [PATCH] cleanup hardcoding __pa/__va macros etc. (FWD) girish
2006-09-24 15:26 ` [PATCH] cleanup hardcoding __pa/__va macros etc Atsushi Nemoto
2006-09-25 14:51 ` [PATCH] cleanup hardcoding __pa/__va macros etc. (take-2) girish
2006-09-25 15:43 ` Atsushi Nemoto
[not found] ` <C13EBDF2.724C%girishvg@gmail.com>
2006-09-26 2:24 ` FW: " girish
2006-09-26 9:02 ` Atsushi Nemoto
2006-09-26 15:20 ` girish
2006-09-26 16:35 ` Atsushi Nemoto
2006-09-26 22:06 ` girish
2006-09-27 15:35 ` Atsushi Nemoto
2006-09-27 16:58 ` girish [this message]
2006-09-28 23:29 ` PATCH] cleanup hardcoding __pa/__va macros etc. (take-4) Ralf Baechle
2006-09-29 14:45 ` PATCH] cleanup hardcoding __pa/__va macros etc. (take-5) girish
2006-09-29 17:59 ` Atsushi Nemoto
2006-09-29 18:33 ` girish
2006-10-01 14:52 ` Atsushi Nemoto
2006-10-01 14:57 ` girish
2006-10-01 15:09 ` Atsushi Nemoto
2006-09-28 15:01 ` [PATCH] cleanup hardcoding __pa/__va macros etc. (take-2) Ralf Baechle
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=C140DCAC.7A1C%girishvg@gmail.com \
--to=girishvg@gmail.com \
--cc=anemo@mba.ocn.ne.jp \
--cc=linux-mips@linux-mips.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.