* [PATCH 3/3] redefine resource_size_t as phys_addr_t
@ 2008-09-11 8:31 Jeremy Fitzhardinge
2008-09-14 15:25 ` Ingo Molnar
2008-12-29 16:57 ` [PATCH/RFC] Remove obsolete CONFIG_RESOURCES_64BIT (was: Re: [PATCH 3/3] redefine resource_size_t as phys_addr_t) Geert Uytterhoeven
0 siblings, 2 replies; 3+ messages in thread
From: Jeremy Fitzhardinge @ 2008-09-11 8:31 UTC (permalink / raw)
To: Ingo Molnar; +Cc: Alex Nixon, Andrew Morton, Linux Kernel Mailing List
There's no good reason why a resource_size_t shouldn't just be a
physical address, so simply redefine it in terms of phys_addr_t.
Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---
arch/powerpc/platforms/Kconfig.cputype | 1 -
arch/powerpc/sysdev/ppc4xx_pci.c | 16 ++++++----------
arch/x86/Kconfig | 1 -
arch/x86/kernel/e820.c | 4 +---
drivers/pci/setup-bus.c | 9 ++++-----
include/linux/types.h | 8 ++------
6 files changed, 13 insertions(+), 26 deletions(-)
===================================================================
--- a/arch/powerpc/platforms/Kconfig.cputype
+++ b/arch/powerpc/platforms/Kconfig.cputype
@@ -135,7 +135,6 @@
config PHYS_64BIT
bool 'Large physical address support' if E500
depends on 44x || E500
- select RESOURCES_64BIT
default y if 44x
---help---
This option enables kernel support for larger than 32-bit physical
===================================================================
--- a/arch/powerpc/sysdev/ppc4xx_pci.c
+++ b/arch/powerpc/sysdev/ppc4xx_pci.c
@@ -41,13 +41,10 @@
#define U64_TO_U32_LOW(val) ((u32)((val) & 0x00000000ffffffffULL))
#define U64_TO_U32_HIGH(val) ((u32)((val) >> 32))
-#ifdef CONFIG_RESOURCES_64BIT
-#define RES_TO_U32_LOW(val) U64_TO_U32_LOW(val)
-#define RES_TO_U32_HIGH(val) U64_TO_U32_HIGH(val)
-#else
-#define RES_TO_U32_LOW(val) (val)
-#define RES_TO_U32_HIGH(val) (0)
-#endif
+#define RES_TO_U32_LOW(val) \
+ ((sizeof(resource_size_t) > sizeof(u32)) ? U64_TO_U32_LOW(val) : (val))
+#define RES_TO_U32_HIGH(val) \
+ ((sizeof(resource_size_t) > sizeof(u32)) ? U64_TO_U32_HIGH(val) : (0))
static inline int ppc440spe_revA(void)
{
@@ -145,12 +142,11 @@
/* Use that */
res->start = pci_addr;
-#ifndef CONFIG_RESOURCES_64BIT
/* Beware of 32 bits resources */
- if ((pci_addr + size) > 0x100000000ull)
+ if (sizeof(resource_size_t) == sizeof(u32) &&
+ (pci_addr + size) > 0x100000000ull)
res->end = 0xffffffff;
else
-#endif
res->end = res->start + size - 1;
break;
}
===================================================================
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -995,7 +995,6 @@
def_bool n
prompt "PAE (Physical Address Extension) Support"
depends on X86_32 && !HIGHMEM4G
- select RESOURCES_64BIT
help
PAE is required for NX support, and furthermore enables
larger swapspace support for non-overcommit purposes. It
===================================================================
--- a/arch/x86/kernel/e820.c
+++ b/arch/x86/kernel/e820.c
@@ -1276,12 +1276,10 @@
res = alloc_bootmem_low(sizeof(struct resource) * e820.nr_map);
for (i = 0; i < e820.nr_map; i++) {
end = e820.map[i].addr + e820.map[i].size - 1;
-#ifndef CONFIG_RESOURCES_64BIT
- if (end > 0x100000000ULL) {
+ if (end != (resource_size_t)end) {
res++;
continue;
}
-#endif
res->name = e820_type_to_string(e820.map[i].type);
res->start = e820.map[i].addr;
res->end = end;
===================================================================
--- a/drivers/pci/setup-bus.c
+++ b/drivers/pci/setup-bus.c
@@ -377,11 +377,10 @@
align = 0;
min_align = 0;
for (order = 0; order <= max_order; order++) {
-#ifdef CONFIG_RESOURCES_64BIT
- resource_size_t align1 = 1ULL << (order + 20);
-#else
- resource_size_t align1 = 1U << (order + 20);
-#endif
+ resource_size_t align1 = 1;
+
+ align1 <<= (order + 20);
+
if (!align)
min_align = align1;
else if (ALIGN(align + min_align, min_align) < align1)
===================================================================
--- a/include/linux/types.h
+++ b/include/linux/types.h
@@ -191,17 +191,13 @@
#ifdef __KERNEL__
typedef unsigned __bitwise__ gfp_t;
-#ifdef CONFIG_RESOURCES_64BIT
-typedef u64 resource_size_t;
-#else
-typedef u32 resource_size_t;
-#endif
-
#ifdef CONFIG_PHYS_ADDR_T_64BIT
typedef u64 phys_addr_t;
#else
typedef u32 phys_addr_t;
#endif
+
+typedef phys_addr_t resource_size_t;
struct ustat {
__kernel_daddr_t f_tfree;
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH 3/3] redefine resource_size_t as phys_addr_t
2008-09-11 8:31 [PATCH 3/3] redefine resource_size_t as phys_addr_t Jeremy Fitzhardinge
@ 2008-09-14 15:25 ` Ingo Molnar
2008-12-29 16:57 ` [PATCH/RFC] Remove obsolete CONFIG_RESOURCES_64BIT (was: Re: [PATCH 3/3] redefine resource_size_t as phys_addr_t) Geert Uytterhoeven
1 sibling, 0 replies; 3+ messages in thread
From: Ingo Molnar @ 2008-09-14 15:25 UTC (permalink / raw)
To: Jeremy Fitzhardinge; +Cc: Alex Nixon, Andrew Morton, Linux Kernel Mailing List
* Jeremy Fitzhardinge <jeremy@goop.org> wrote:
> There's no good reason why a resource_size_t shouldn't just be a
> physical address, so simply redefine it in terms of phys_addr_t.
i've applied your patchset to tip/core/resources:
8308c54: generic: redefine resource_size_t as phys_addr_t
947d049: generic: make PFN_PHYS explicitly return phys_addr_t
600715d: generic: add phys_addr_t for holding physical addresses
thanks,
Ingo
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH/RFC] Remove obsolete CONFIG_RESOURCES_64BIT (was: Re: [PATCH 3/3] redefine resource_size_t as phys_addr_t)
2008-09-11 8:31 [PATCH 3/3] redefine resource_size_t as phys_addr_t Jeremy Fitzhardinge
2008-09-14 15:25 ` Ingo Molnar
@ 2008-12-29 16:57 ` Geert Uytterhoeven
1 sibling, 0 replies; 3+ messages in thread
From: Geert Uytterhoeven @ 2008-12-29 16:57 UTC (permalink / raw)
To: Jeremy Fitzhardinge
Cc: Ingo Molnar, Alex Nixon, Andrew Morton, Linux Kernel Mailing List
On Thu, 11 Sep 2008, Jeremy Fitzhardinge wrote:
> There's no good reason why a resource_size_t shouldn't just be a
> physical address, so simply redefine it in terms of phys_addr_t.
And hence CONFIG_RESOURCES_64BIT became unused.
Subject: [PATCH/RFC] Remove obsolete CONFIG_RESOURCES_64BIT
commit 8308c54d7e312f7a03e2ce2057d0837e6fe3843f ("generic: redefine
resource_size_t as phys_addr_t") made CONFIG_RESOURCES_64BIT obsolete, but
didn't remove it. Remove it.
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
---
Although sometimes I'm longing for the days I could hunt for "warning: cast
to pointer from integer of different size" when enabling it...
diff --git a/mm/Kconfig b/mm/Kconfig
index 5b5790f..a5b7781 100644
--- a/mm/Kconfig
+++ b/mm/Kconfig
@@ -181,12 +181,6 @@ config MIGRATION
example on NUMA systems to put pages nearer to the processors accessing
the page.
-config RESOURCES_64BIT
- bool "64 bit Memory and IO resources (EXPERIMENTAL)" if (!64BIT && EXPERIMENTAL)
- default 64BIT
- help
- This option allows memory and IO resources to be 64 bit.
-
config PHYS_ADDR_T_64BIT
def_bool 64BIT || ARCH_PHYS_ADDR_T_64BIT
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-12-29 16:57 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-11 8:31 [PATCH 3/3] redefine resource_size_t as phys_addr_t Jeremy Fitzhardinge
2008-09-14 15:25 ` Ingo Molnar
2008-12-29 16:57 ` [PATCH/RFC] Remove obsolete CONFIG_RESOURCES_64BIT (was: Re: [PATCH 3/3] redefine resource_size_t as phys_addr_t) Geert Uytterhoeven
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox