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

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Jeremy Fitzhardinge
Date: Thursday, September 18, 2008 - 11:00 am

Jan Beulich wrote:

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


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?

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?

    J
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: [PATCH] x86: x86_{phys,virt}_bits field also for i386 (v3), Jeremy Fitzhardinge, (Thu Sep 18, 11:00 am)
Re: [PATCH] x86: x86_{phys,virt}_bits field also for i386 (v3), Jeremy Fitzhardinge, (Fri Sep 19, 2:46 pm)