Re: [PATCH] x86: x86_{phys,virt}_bits field also for i386 (v3)

From: Jan Beulich
Date: Fri Sep 19 2008 - 04:32:30 EST


>>> Jeremy Fitzhardinge <jeremy@xxxxxxxx> 18.09.08 20:00 >>>
>I take it we're talking about this chunk:
>
>-static inline int phys_addr_valid(unsigned long addr)
>+static inline int phys_addr_valid(resource_size_t addr)
> {
>- return addr < (1UL << boot_cpu_data.x86_phys_bits);
>+#ifdef CONFIG_RESOURCES_64BIT
>+ return !(addr >> boot_cpu_data.x86_phys_bits);
>+#else
>+ return 1;
>+#endif

Yes.

>Is x86_phys_bits defined to be the actual number of address lines poking
>out of the CPU package, or the number of address bits we can
>meaningfully put into a pte?

The intention is for it to express a CPU capability.

>I would say the simplest thing to do here is be explicit:
>
> if (sizeof(addr) == sizeof(u64))
> return !(addr >> boot_cpu_data.x86_phys_bits);
> else
> return 1;
>
>That's not ideal, but I guess its good enough. I assume x86_phys_bits
>can never be less than 32?

Yes, one could do it that way. But what's the point of having RESOURCES_64BIT
set and resource_size_t nevertheless being a 32-bit quantity? And why,
independent of that, was ioremap() not changed to use phys_addr_t?

Jan

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/