From: "Jan Beulich" Subject: [PATCH] kexec: fix some types Date: Thu, 15 Jan 2015 15:32:03 +0000 Message-ID: <54B7EB8302000078000557CD@mail.emea.novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__Part3500DB63.1__=" Return-path: Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1YBmOz-0006o5-Vd for xen-devel@lists.xenproject.org; Thu, 15 Jan 2015 15:32:06 +0000 List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel Cc: Andrew Cooper , Keir Fraser , David Vrabel List-Id: xen-devel@lists.xenproject.org This is a MIME message. If you are reading this text, you may want to consider changing to a mail reader or gateway that understands how to properly handle MIME multipart messages. --=__Part3500DB63.1__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline crashinfo_maxaddr can/will be a 64-bit type, hence passing it to fls() is wrong. crashinfo_maxaddr_bits, otoh, doesn't need to be a paddr_t, and can additionally be __initdata. struct xen_kexec_reserve's start field - representing a physical address - ought to have respective type. Signed-off-by: Jan Beulich --- Note: Aliasing fls64/ffs64 to fls/ffs is generally wrong, but switching the latter to have (unsigned) int parameters on x86 (just like is the case on ARM, and matching generic_{fls,ffs}) will need to be done in a separate patch, along with auditing all current uses. --- a/xen/common/kexec.c +++ b/xen/common/kexec.c @@ -78,7 +78,7 @@ static paddr_t __initdata crashinfo_maxa =20 /* =3D log base 2 of crashinfo_maxaddr after checking for sanity. Default = to * larger than the entire physical address space. */ -paddr_t crashinfo_maxaddr_bits =3D 64; +unsigned int __initdata crashinfo_maxaddr_bits =3D 64; =20 /* Pointers to keep track of the crash heap region. */ static void *crash_heap_current =3D NULL, *crash_heap_end =3D NULL; @@ -532,7 +532,7 @@ void __init kexec_early_calculations(voi low_crashinfo_mode =3D LOW_CRASHINFO_NONE; =20 if ( low_crashinfo_mode > LOW_CRASHINFO_NONE ) - crashinfo_maxaddr_bits =3D fls(crashinfo_maxaddr) - 1; + crashinfo_maxaddr_bits =3D fls64(crashinfo_maxaddr) - 1; } =20 static int __init kexec_init(void) --- a/xen/include/asm-x86/bitops.h +++ b/xen/include/asm-x86/bitops.h @@ -420,6 +420,9 @@ static inline int fls(unsigned long x) return (int)r+1; } =20 +#define ffs64 ffs +#define fls64 fls + /** * hweightN - returns the hamming weight of a N-bit word * @x: the word to weigh --- a/xen/include/xen/kexec.h +++ b/xen/include/xen/kexec.h @@ -10,7 +10,7 @@ =20 typedef struct xen_kexec_reserve { unsigned long size; - unsigned long start; + paddr_t start; } xen_kexec_reserve_t; =20 extern xen_kexec_reserve_t kexec_crash_area; @@ -38,7 +38,7 @@ enum low_crashinfo { /* Low crashinfo mode. Start as INVALID so serveral codepaths can set up * defaults without needing to know the state of the others. */ extern enum low_crashinfo low_crashinfo_mode; -extern paddr_t crashinfo_maxaddr_bits; +extern unsigned int crashinfo_maxaddr_bits; void kexec_early_calculations(void); =20 int machine_kexec_add_page(struct kexec_image *image, unsigned long = vaddr, --=__Part3500DB63.1__= Content-Type: text/plain; name="kexec-types.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="kexec-types.patch" kexec: fix some types=0A=0Acrashinfo_maxaddr can/will be a 64-bit type, = hence passing it to fls()=0Ais wrong.=0A=0Acrashinfo_maxaddr_bits, otoh, = doesn't need to be a paddr_t, and can=0Aadditionally be __initdata.=0A=0Ast= ruct xen_kexec_reserve's start field - representing a physical=0Aaddress - = ought to have respective type.=0A=0ASigned-off-by: Jan Beulich =0A---=0ANote: Aliasing fls64/ffs64 to fls/ffs is generally wrong, = but switching=0A the latter to have (unsigned) int parameters on x86 = (just like is=0A the case on ARM, and matching generic_{fls,ffs}) = will need to be=0A done in a separate patch, along with auditing all = current uses.=0A=0A--- a/xen/common/kexec.c=0A+++ b/xen/common/kexec.c=0A@@= -78,7 +78,7 @@ static paddr_t __initdata crashinfo_maxa=0A =0A /* =3D log = base 2 of crashinfo_maxaddr after checking for sanity. Default to=0A * = larger than the entire physical address space. */=0A-paddr_t crashinfo_maxa= ddr_bits =3D 64;=0A+unsigned int __initdata crashinfo_maxaddr_bits =3D = 64;=0A =0A /* Pointers to keep track of the crash heap region. */=0A = static void *crash_heap_current =3D NULL, *crash_heap_end =3D NULL;=0A@@ = -532,7 +532,7 @@ void __init kexec_early_calculations(voi=0A = low_crashinfo_mode =3D LOW_CRASHINFO_NONE;=0A =0A if ( low_crashinfo_mo= de > LOW_CRASHINFO_NONE )=0A- crashinfo_maxaddr_bits =3D fls(crashin= fo_maxaddr) - 1;=0A+ crashinfo_maxaddr_bits =3D fls64(crashinfo_maxa= ddr) - 1;=0A }=0A =0A static int __init kexec_init(void)=0A--- a/xen/includ= e/asm-x86/bitops.h=0A+++ b/xen/include/asm-x86/bitops.h=0A@@ -420,6 +420,9 = @@ static inline int fls(unsigned long x)=0A return (int)r+1;=0A }=0A = =0A+#define ffs64 ffs=0A+#define fls64 fls=0A+=0A /**=0A * hweightN - = returns the hamming weight of a N-bit word=0A * @x: the word to weigh=0A--= - a/xen/include/xen/kexec.h=0A+++ b/xen/include/xen/kexec.h=0A@@ -10,7 = +10,7 @@=0A =0A typedef struct xen_kexec_reserve {=0A unsigned long = size;=0A- unsigned long start;=0A+ paddr_t start;=0A } xen_kexec_rese= rve_t;=0A =0A extern xen_kexec_reserve_t kexec_crash_area;=0A@@ -38,7 = +38,7 @@ enum low_crashinfo {=0A /* Low crashinfo mode. Start as INVALID = so serveral codepaths can set up=0A * defaults without needing to know = the state of the others. */=0A extern enum low_crashinfo low_crashinfo_mode= ;=0A-extern paddr_t crashinfo_maxaddr_bits;=0A+extern unsigned int = crashinfo_maxaddr_bits;=0A void kexec_early_calculations(void);=0A =0A int = machine_kexec_add_page(struct kexec_image *image, unsigned long vaddr,=0A --=__Part3500DB63.1__= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel --=__Part3500DB63.1__=--