Made VMALLOC_END of type unsigned long.
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 1/4 Made VMALLOC_END of type unsigned long.
Quoted 14 lines · Russell King - ARM Linux
arch/arm/mach-davinci/include/mach/io.h line 21
Quoted 11 lines · Andreas Fenkart
This makes
VMALLOC_ENDconsistent withVMALLOC_STARTarch/arm/mach-davinci/include/mach/io.h +1
-1@@ -18,7 +18,7 @@* I/O mapping * ---------------------------------------------------------------------------- */ -#define IO_PHYS 0x01c00000 +#define IO_PHYS 0x01c00000ULWhy is this change required?
Davinci defines VMALLOC_END this way:
#define VMALLOC_END (IO_VIRT - (2<<20))
The simple solution would be to prefix the VMALLOC_END with UL, the alternative to make IO_VIRT unsinged long.
IO_VIRT and recurses are defined in mach/hardware.h
#define IO_PHYS 0x01c00000UL
#define IO_OFFSET 0xfd000000 /* Virtual IO = 0xfec00000 */
#define IO_SIZE 0x00400000
#define IO_VIRT (IO_PHYS + IO_OFFSET)
Changing IO_VIRT to unsigned long should be fine. Virtual addresses are mostly unsigned long,@least VMALLOC_START, PAGE_OFFSET are. See below for complete list of IO_VIRT usage.
IO_PHYS should not be changed though, since it is assigned to unsigned int fields.
So I changed the patch, and made only IO_VIRT unsigned long:
#define IO_PHYS 0x01c00000 #define IO_OFFSET 0xfd000000 /* Virtual IO = 0xfec00000 */ #define IO_SIZE 0x00400000 -#define IO_VIRT (IO_PHYS + IO_OFFSET) +#define IO_VIRT UL(IO_PHYS + IO_OFFSET)
Andreas
----
IO_VIRT:
-assigned to struct map_desc / unsigned long virtual; -used as return value in void __iomem *davinci_ioremap function; -used in define DA8XX_CP_INTC_VIRT, which recursively is used as:
--assigned to struct map_desc / unsigned long virtual; --assigned to struct davinci_soc_info / void __iomem *intc_base; -used in define of VMALLOC_END
IO_PHYS:
-assigned to struct machine_desc / unsigned int phys_io; -assigned to struct machine_desc / unsigned int io_pg_offst; -shifted and assigned to struct map_desc / unsigned long pfn; -used defines for UART base address, which are:
--via plat_serial8250_port / resource_size_t mapbase ---assigned to type phys_addr_t
-used defines for TIMER base address, which recursively are:
--assigned to struct davinci_timer_instance / void __iomem *base; -used defines for WDOG base address, which are:
--via struct resource / resource_size_t start ---assigned to type phys_addr_t
PATCH 1/4 Made VMALLOC_END of type unsigned long.
Quoted 6 lines · Andreas Fenkart
Davinci defines
VMALLOC_ENDthis way:#define
VMALLOC_END(IO_VIRT- (2<<20))The simple solution would be to prefix the
VMALLOC_ENDwith UL, the alternative to makeIO_VIRTunsinged long.
Is:
(IO_VIRT - (2<<20))UL
valid C? I don't think it is, and neither does my compiler.
Quoted 2 lines
IO_PHYSshould not be changed though, since it is assigned to unsigned int fields.
I'd actually argue that it's more correct for physical addresses to be unsigned long rather than unsigned int.
Review
Quoted 7 lines
So I changed the patch, and made only
IO_VIRTunsigned long:#define IO_PHYS 0x01c00000 #define IO_OFFSET 0xfd000000 /* Virtual IO = 0xfec00000 */ #define IO_SIZE 0x00400000(quoted diff) +1
-1-#define IO_VIRT (IO_PHYS + IO_OFFSET) +#define IO_VIRT UL(IO_PHYS + IO_OFFSET)
This doesn't work, for the same reason I point out above. An expression suffixed with 'UL' is not valid. However, a pure number may be suffixed with 'UL' to make it an unsigned long constant.
Review
Quoted 3 lines
IO_PHYS:(quoted diff) +0
-2-assigned to struct machine_desc / unsigned int phys_io; -assigned to struct machine_desc / unsigned int io_pg_offst;
These both can become unsigned long without any harm.
Review
Quoted 9 lines
(quoted diff) +0
-9-shifted and assigned to struct map_desc / unsigned long pfn; -used defines for UART base address, which are: --via plat_serial8250_port / resource_size_t mapbase ---assigned to type phys_addr_t -used defines for TIMER base address, which recursively are: --assigned to struct davinci_timer_instance / void __iomem *base; -used defines for WDOG base address, which are: --via struct resource / resource_size_t start ---assigned to type phys_addr_t
The rest are fine.
PATCH 1/4 Made VMALLOC_END of type unsigned long.
Hello,
Quoted 5 lines · Russell King - ARM Linux
Quoted 4 lines · Andreas Fenkart
Davinci defines
VMALLOC_ENDthis way:#define
VMALLOC_END(IO_VIRT- (2<<20))
Quoted 8 lines
Quoted 2 lines
The simple solution would be to prefix the
VMALLOC_ENDwith UL, the alternative to makeIO_VIRTunsinged long.Is:
(IO_VIRT - (2<<20))ULvalid C? I don't think it is, and neither does my compiler.
No, but
UL(IO_VIRT - (2<<20))
might work?! Havn't tried though.
Best regards
Uwe
Signature · 2 lines
Pengutronix e.K. | Uwe Kleine-K?nig | Industrial Linux Solutions | http://www.pengutronix.de/ |
PATCH 1/4 Made VMALLOC_END of type unsigned long.
Quoted 13 lines · Uwe Kleine-K?nig
Hello,
Quoted 10 lines · Russell King - ARM Linux
Quoted 6 lines · Andreas Fenkart
Davinci defines
VMALLOC_ENDthis way:#define
VMALLOC_END(IO_VIRT- (2<<20))The simple solution would be to prefix the
VMALLOC_ENDwith UL, the alternative to makeIO_VIRTunsinged long.Is:
Quoted 8 lines
Quoted 3 lines
(IO_VIRT - (2<<20))ULvalid C? I don't think it is, and neither does my compiler.
No, but
UL(IO_VIRT - (2<<20))might work?! Havn't tried though.
'UL()' is our own macro which appends UL if building in C mode, otherwise omits it if assembly:
arch/arm/include/asm/memory.h:#define UL(x) _AC(x, UL)
include/linux/const.h:
#ifdef __ASSEMBLY__
#define _AC(X,Y) X
#define _AT(T,X) X
#else
#define __AC(X,Y) (X##Y) #define _AC(X,Y) __AC(X,Y) #define _AT(T,X) ((T)(X))
#endif