cleanup hardcoding __pa/__va macros etc.
PATCH 1/1 cleanup hardcoding __pa/__va macros etc.
hello.
here is a patch to cleanup some hard coded lines.
plese let me know if these are valid changes.
thanks.
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-24
12:22:46.000000000 +0900
+++ linux/arch/mips/mm/dma-noncoherent.c 2006-09-24 12:20:35.000000000 +0900
@@ -334,7 +334,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
arch/mips/mm/init.c +0 -0
@@ -155,24 +155,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
free_area_init(zones_size);
@@ -233,7 +231,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
include/asm-mips/dma.h +0 -0
@@ -87,8 +87,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 for 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
include/asm-mips/io.h +0 -0
@@ -116,7 +116,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 (unsigned long) __pa(address);
}
/*
@@ -133,7 +133,7 @@ static inline unsigned long virt_to_phys
*/
static inline void * phys_to_virt(unsigned long address) {
- return (void *)(address + PAGE_OFFSET);
+ return (void *) __va(address);
}
/*
@@ -141,12 +141,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 (unsigned long) __pa(address);
}
static inline void * isa_bus_to_virt(unsigned long address) {
- return (void *)(address + PAGE_OFFSET);
+ return (void *) __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
include/asm-mips/page.h +0 -0
@@ -134,8 +134,13 @@ 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))
+#define UNMAPLIMIT (UNCAC_BASE - CAC_BASE) /*HIGHMEM_START*/
+#define ISMAPPED(x) (KSEGX((x)) > UNMAPLIMIT)
+#define ___pa(x) ((unsigned long) (x) - PAGE_OFFSET)
+#define __pa(x) (ISMAPPED(x) ? (x) : ___pa(x))
+
+#define ___va(x) ((void *)((unsigned long) (x) + PAGE_OFFSET))
+#define __va(x) (ISMAPPED(x) ? (x) : ___va(x))
#define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT)
PATCH 1/1 cleanup hardcoding __pa/__va macros etc. (FWD)
[forwarding to: [email protected]]
hello.
here is a patch to cleanup some hard coded lines.
plese let me know if these are valid changes.
thanks.
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-24 12:22:46.000000000 +0900
+++ linux/arch/mips/mm/dma-noncoherent.c 2006-09-24 12:20:35.000000000 +0900 @@ -334,7 +334,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
arch/mips/mm/init.c 2006-09-24 14:23:56.000000000 +0900 renamed from arch/mips/mm/init.c 2006-09-24 12:22:46.000000000 +0900 +7 -9
@@ -155,24 +155,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 free_area_init(zones_size);
@@ -233,7 +231,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
include/asm-mips/dma.h 2006-09-24 14:14:28.000000000 +0900 renamed from include/asm-mips/dma.h 2006-09-24 12:23:34.000000000 +0900 +4 -1
@@ -87,8 +87,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 for 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
include/asm-mips/io.h 2006-09-24 12:40:12.000000000 +0900 renamed from include/asm-mips/io.h 2006-09-24 12:23:34.000000000 +0900 +4 -4
@@ -116,7 +116,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 (unsigned long) __pa(address); } /*
@@ -133,7 +133,7 @@ static inline unsigned long virt_to_phys */ static inline void * phys_to_virt(unsigned long address) { - return (void *)(address + PAGE_OFFSET); + return (void *) __va(address); } /*
@@ -141,12 +141,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 (unsigned long) __pa(address); } static inline void * isa_bus_to_virt(unsigned long address) { - return (void *)(address + PAGE_OFFSET); + return (void *) __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-24 12:23:34.000000000 +0900
+++ linux/include/asm-mips/page.h 2006-09-24 14:00:53.000000000 +0900 @@ -134,8 +134,13 @@ 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))
+#define UNMAPLIMIT (UNCAC_BASE - CAC_BASE) /*HIGHMEM_START*/
+#define ISMAPPED(x) (KSEGX((x)) > UNMAPLIMIT)
+#define ___pa(x) ((unsigned long) (x) - PAGE_OFFSET)
+#define __pa(x) (ISMAPPED(x) ? (x) : ___pa(x))
+
+#define ___va(x) ((void *)((unsigned long) (x) + PAGE_OFFSET))
+#define __va(x) (ISMAPPED(x) ? (x) : ___va(x))
#define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT)
------ End of Forwarded Message
Quoted 7 lines · girish
include/asm-mips/page.h +0
-1@@ -134,8 +134,13 @@ 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)
include/asm-mips/page.h typedef struct { unsigned long pgprot; } · line 145
Quoted 10 lines
include/asm-mips/page.h +7
-1-#define __va (x) ((void *)((unsigned long) (x) + PAGE_OFFSET)) +#define UNMAPLIMIT (UNCAC_BASE - CAC_BASE)/*HIGHMEM_START*/ +#define ISMAPPED (x) (KSEGX((x)) > UNMAPLIMIT) +#define ___pa (x) ((unsigned long) (x) - PAGE_OFFSET) +#define __pa (x) (ISMAPPED(x) ? (x) : ___pa(x)) + +#define ___va (x) ((void *)((unsigned long) (x) + PAGE_OFFSET)) +#define __va (x) (ISMAPPED(x) ? (x) : ___va(x))#define pfn_to_kaddr (pfn) __va((pfn) << PAGE_SHIFT)
This part looks broken for 64-bit kernel.
For other parts, it would be better to keep correct indentation level.
---
Atsushi Nemoto
Re: [PATCH] cleanup hardcoding __pa/__va macros etc. (take-2)
Here is the patch again, attached as a text file. I don't have idea how these macros should be on a 64bit machine, so I just left them as it is. Could you please verify these macros again?
Quoted 25 lines · Atsushi Nemoto
Quoted 7 lines · girish
include/asm-mips/page.h 2006-09-24 14:00:53.000000000 +0900 renamed from include/asm-mips/page.h 2006-09-24 12:23:34.000000000 +0900 +0
-1@@ -134,8 +134,13 @@ 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)include/asm-mips/page.h 2006-09-24 14:00:53.000000000 +0900 typedef struct { unsigned long pgprot; } · line 145
Quoted 10 lines
include/asm-mips/page.h 2006-09-24 14:00:53.000000000 +0900 renamed from include/asm-mips/page.h 2006-09-24 12:23:34.000000000 +0900 +7
-1-#define __va(x) ((void *)((unsigned long) (x) + PAGE_OFFSET)) +#define UNMAPLIMIT (UNCAC_BASE - CAC_BASE) /*HIGHMEM_START*/ +#define ISMAPPED(x) (KSEGX((x)) > UNMAPLIMIT) +#define ___pa(x) ((unsigned long) (x) - PAGE_OFFSET) +#define __pa(x) (ISMAPPED(x) ? (x) : ___pa(x)) + +#define ___va(x) ((void *)((unsigned long) (x) + PAGE_OFFSET)) +#define __va(x) (ISMAPPED(x) ? (x) : ___va(x)) #define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT)This part looks broken for 64-bit kernel.
For other parts, it would be better to keep correct indentation level.
---
Atsushi Nemoto
Re: [PATCH] cleanup hardcoding __pa/__va macros etc. (take-2)
Quoted 3 lines · girish
Here is the patch again, attached as a text file. I don't have idea how these macros should be on a 64bit machine, so I just left them as it is. Could you please verify these macros again?
Well, I should ask first: Why do you change __pa() and __va() ?
I can not see point of ISMAPPED() testing. And these macros are used quite often so they should be as fast as possible.
---
Atsushi Nemoto
A message that is not in the archive (sent off-list or not yet received): C13EBDF2.724C%[email protected]
PATCH 1/1 cleanup hardcoding __pa/__va macros etc. (take-2)
------ Forwarded Message
From: girish <[email protected]>
Date: Tue, 26 Sep 2006 11:22:26 +0900
To: Atsushi Nemoto <[email protected]>
Cc: "[email protected]" <[email protected]>
Conversation: [PATCH] cleanup hardcoding __pa/__va macros etc. (take-2)
Subject: Re: [PATCH] cleanup hardcoding __pa/__va macros etc. (take-2)
The idea is to differentiate the Kseg0/Kseg1 segments in the physical area. Beyond these areas lies the mapped area (or the HIGHMEM). What complicates this matter further is their overlapping nature. The __pa()/__va() treated all addresses mapped into PAGE_OFFSET (8000_0000) area. The effort is to correctly differentiate these areas.
I could not think of any better solution & the only simplification I came up with -
#ifdef CONFIG_32BIT
/* 8000_0000 & above */
#define ISMAPPEDPA(x) ((x) > KSEG0)
/* below 2000_0000 */
#define ISUNMAPPEDVA(x) ((x) < HIGHMEM_START)
#else
#define ISMAPPEDPA(x) (1)
#define ISMAPPEDVA(x) (1)
#endif
#define ___pa(x) ((unsigned long) (x) - KSEGX((x)))
#define __pa(x) (ISUNMAPPEDPA(x) ? ___pa((x)) : (x))
#define ___va(x) ((void *)((unsigned long) (x) + KSEG0))
#define __va(x) (ISUNMAPPEDVA(x) ? ___va((x)) : (x))
Quoted 5 lines · Atsushi Nemoto
Quoted 3 lines · girish
Here is the patch again, attached as a text file. I don't have idea how these macros should be on a 64bit machine, so I just left them as it is. Could you please verify these macros again?
Quoted 7 lines
Well, I should ask first: Why do you change
__pa()and__va()?I can not see point of
ISMAPPED()testing. And these macros are used quite often so they should be as fast as possible.---
Atsushi Nemoto
------ End of Forwarded Message
Re: [PATCH] cleanup hardcoding __pa/__va macros etc. (take-2)
In reply to a message not in the archiveQuoted 5 lines · girish
The idea is to differentiate the Kseg0/Kseg1 segments in the physical area. Beyond these areas lies the mapped area (or the HIGHMEM). What complicates this matter further is their overlapping nature. The __pa()/__va() treated all addresses mapped into
PAGE_OFFSET(8000_0000) area. The effort is to correctly differentiate these areas.
Yes, __va() and __pa() are used to convert an physical address from/to an kernel logical address (i.e. low unmapped virtual address).
I think passing another sort of addresses to them is simply wrong.
P.S.
Please do not reply to [email protected].
---
Atsushi Nemoto
Re: [PATCH] cleanup hardcoding __pa/__va macros etc. (take-2)
Quoted 11 lines
Quoted 6 lines
The idea is to differentiate the Kseg0/Kseg1 segments in the physical area. Beyond these areas lies the mapped area (or the HIGHMEM). What complicates this matter further is their overlapping nature. The __pa()/__va() treated all addresses mapped into
PAGE_OFFSET(8000_0000) area. The effort is to correctly differentiate these areas.Yes,
__va()and__pa()are used to convert an physical address from/to an kernel logical address (i.e. low unmapped virtual address).I think passing another sort of addresses to them is simply wrong.
Agreed.
But, then again treating all addresses as above PAGE_OFFSET is also wrong :) I looked at it just as a work around. These macros are called from so many other places that if an access is made at say 4000_0000 the kernel will oops telling it was C000_0000 access error. Now that confused me a lot! With this change now kernel oops on 4000_0000 :)
Anyway, you may ignore __pa/__va macros.
Could you please look into other changes I proposed?
Quoted 3 lines
P.S.
Please do not reply to [email protected].
I am sorry. It was a stupid mistake in creating address book entry.
Re: [PATCH] cleanup hardcoding __pa/__va macros etc. (take-2)
Quoted 1 line · girish
But, then again treating all addresses as above
PAGE_OFFSETis also wrong :)
It would be a design not a bug :-)
Quoted 4 lines
I looked at it just as a work around. These macros are called from so many other places that if an access is made at say 4000_0000 the kernel will oops telling it was
C000_0000access error. Now that confused me a lot! With this change now kernel oops on 4000_0000 :)
Yes, 4000_0000, which is wrong too. And it _hides_ wrong usage of vaddr/paddr. Bad side effect :)
Quoted 3 lines
Anyway, you may ignore __pa/__va macros.
Could you please look into other changes I proposed?
__pa() returns "unsigned long" and __va() returns "void *" so some casts are also redundant.
Other parts looks good for me.
---
Atsushi Nemoto
Re: [PATCH] cleanup hardcoding __pa/__va macros etc. (take-2)
Quoted 13 lines
Quoted 2 lines
But, then again treating all addresses as above
PAGE_OFFSETis also wrong :)It would be a design not a bug :-)
Quoted 4 lines
I looked at it just as a work around. These macros are called from so many other places that if an access is made at say 4000_0000 the kernel will oops telling it was
C000_0000access error. Now that confused me a lot! With this change now kernel oops on 4000_0000 :)Yes, 4000_0000, which is wrong too. And it _hides_ wrong usage of vaddr/paddr. Bad side effect :)
Quoted 6 lines
Quoted 3 lines
Anyway, you may ignore __pa/__va macros.
Could you please look into other changes I proposed?
__pa()returns "unsigned long" and__va()returns "void *" so some casts are also redundant.
After removing some of the redundant casts, re-submitting the patch. Attached the patch in a text file.
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.
BTW, I have couple of more changes in mind.
.1a Currently only one PCI DMA window is supported. We need to extend that, if the PCI controller has multiple windows. Example implementation is in arch/powerpc.
.1b During HIGHMEM support the PCI windows are not honored correctly. A kmap() based mapping could be provided during PCI sync. Example implementation, again arch/powerpc. Has anybody looked into this? .2 Has anybody tested /dev/mem and/or /dev/kmem devices on MIPS platform?
Re: [PATCH] cleanup hardcoding __pa/__va macros etc. (take-2)
Quoted 2 lines · girish
After removing some of the redundant casts, re-submitting the patch. Attached the patch in a text file.
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...
Quoted 4 lines
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
---
Atsushi Nemoto
PATCH] cleanup hardcoding __pa/__va macros etc. (take-4)
Quoted 3 lines
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.
Quoted 8 lines
Quoted 4 lines
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.
Re: PATCH] cleanup hardcoding __pa/__va macros etc. (take-4)
Quoted 31 lines · girish
Date: Thu, 28 Sep 2006 01:58:02 +0900
Subject: PATCH] cleanup hardcoding __pa/__va macros etc. (take-4)
From: girish <[email protected]>
To: Atsushi Nemoto <[email protected]>
CC: "[email protected]" <[email protected]>,
girish <[email protected]>Content-type: multipart/mixed; boundary="B_3242253489_7379959"Quoted 2 lines
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.
Quoted 8 lines
Quoted 4 lines
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.
Quoted 4 lines
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 <[email protected]>
-#ifdef CONFIG_ISA
- if (low < max_dma)
+ if (low < max_dma) }
This doesn't quite compile.
Ralf
Re: PATCH] cleanup hardcoding __pa/__va macros etc. (take-5)
Quoted 41 lines · Ralf Baechle
Quoted 35 lines · girish
Date: Thu, 28 Sep 2006 01:58:02 +0900
Subject: PATCH] cleanup hardcoding __pa/__va macros etc. (take-4)
From: girish <[email protected]>
To: Atsushi Nemoto <[email protected]>
CC: "[email protected]" <[email protected]>,
girish <[email protected]>Content-type: multipart/mixed; boundary="B_3242253489_7379959"Quoted 2 lines
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.
Quoted 8 lines
Quoted 4 lines
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 <[email protected]>(quoted diff) +1
-2-#ifdef CONFIG_ISA - if (low < max_dma) + if (low < max_dma) }
Quoted 2 lines
This doesn't quite compile.
Stupid mistake. Fixed & resending.
Re: PATCH] cleanup hardcoding __pa/__va macros etc. (take-5)
Quoted 6 lines · girish
Quoted 6 lines
Quoted 5 lines
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 <[email protected]>
Quoted 8 lines
Quoted 6 lines
(quoted diff) +1
-2-#ifdef CONFIG_ISA - if (low < max_dma) + if (low < max_dma) }This doesn't quite compile.
Stupid mistake. Fixed & resending.
Looks good to me, except for page.h part.
---
Atsushi Nemoto
Re: PATCH] cleanup hardcoding __pa/__va macros etc. (take-5)
Quoted 11 lines · Atsushi Nemoto
Quoted 10 lines · girish
Quoted 10 lines
Quoted 5 lines
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 <[email protected]>(quoted diff) +1
-2-#ifdef CONFIG_ISA - if (low < max_dma) + if (low < max_dma) }
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
This doesn't quite compile.
Stupid mistake. Fixed & resending.
Looks good to me, except for
page.hpart.
I agree, but as of now, I do not have any better solution. If & when I will implement kernel page table for memory above 2000_0000, I plan to give it a through mapping. That is to say, 4000_0000 physical mapped to 4000_0000 virtual. In that case the page.h __pa/__va macros stand a chance (^_^;)
If somebody has already done kernel page table implementation, could you please pass on the relevant patch? Thanks.
Re: PATCH] cleanup hardcoding __pa/__va macros etc. (take-5)
Quoted 7 lines · girish
Quoted 1 line
Looks good to me, except for
page.hpart.I agree, but as of now, I do not have any better solution. If & when I will implement kernel page table for memory above 2000_0000, I plan to give it a through mapping. That is to say, 4000_0000 physical mapped to 4000_0000 virtual. In that case the
page.h__pa/__va macros stand a chance (^_^;)
No. 4000_0000 physical is never mapped to 4000_0000 virtual. The low 2GB of virtual address space are used for user mapping.
Quoted 2 lines
If somebody has already done kernel page table implementation, could you please pass on the relevant patch? Thanks.
If you have a 64-bit CPU, you can use a 64-bit kernel which gives you large XKPHYS area. If not, and your CPU does not have D-cache aliasing, you can use CONFIG_HIGHMEM which are using kernel page table already. Otherwise you are out of luck for now unfortunately.
Anyway, you do not have to change __pa() and __va().
---
Atsushi Nemoto
Re: PATCH] cleanup hardcoding __pa/__va macros etc. (take-5)
Quoted 11 lines · Atsushi Nemoto
Quoted 7 lines · girish
Quoted 1 line
Looks good to me, except for
page.hpart.I agree, but as of now, I do not have any better solution. If & when I will implement kernel page table for memory above 2000_0000, I plan to give it a through mapping. That is to say, 4000_0000 physical mapped to 4000_0000 virtual. In that case the
page.h__pa/__va macros stand a chance (^_^;)No. 4000_0000 physical is never mapped to 4000_0000 virtual. The low 2GB of virtual address space are used for user mapping.
Can't I provide Kernel mapping via swapper_pg_dir to 4000_0000?
Quoted 8 lines
Quoted 3 lines
If somebody has already done kernel page table implementation, could you please pass on the relevant patch? Thanks.
If you have a 64-bit CPU, you can use a 64-bit kernel which gives you large XKPHYS area. If not, and your CPU does not have D-cache aliasing, you can use
CONFIG_HIGHMEMwhich are using kernel page table already. Otherwise you are out of luck for now unfortunately.
We poor 32bit users!
I have, to some extent, already incorporated highmem (1GB) through HIGHMEM + SPARSEMEM combination.
Quoted 4 lines
Anyway, you do not have to change
__pa()and__va().---
Atsushi Nemoto
Re: PATCH] cleanup hardcoding __pa/__va macros etc. (take-5)
Quoted 4 lines · girish
Quoted 2 lines
No. 4000_0000 physical is never mapped to 4000_0000 virtual. The low 2GB of virtual address space are used for user mapping.
Can't I provide Kernel mapping via
swapper_pg_dirto 4000_0000?
Yes. I do not think it is possible.
Quoted 2 lines
I have, to some extent, already incorporated highmem (1GB) through HIGHMEM + SPARSEMEM combination.
So using __pa() and __va() for HIGHMEM page is wrong. If there were such usages, please fix them instead.
---
Atsushi Nemoto
Re: [PATCH] cleanup hardcoding __pa/__va macros etc. (take-2)
In reply to Atsushi NemotoQuoted 1 line · Atsushi Nemoto
Please do not reply to [email protected].
In fact it is impossible to mail to that address - there is on git-commits list alias on linux-mips.org which means there is no way spam could get to the git-commits list.
Ralf