* [PATCH] kexec: fix some types
@ 2015-01-15 15:32 Jan Beulich
2015-01-15 16:05 ` David Vrabel
0 siblings, 1 reply; 2+ messages in thread
From: Jan Beulich @ 2015-01-15 15:32 UTC (permalink / raw)
To: xen-devel; +Cc: Andrew Cooper, Keir Fraser, David Vrabel
[-- Attachment #1: Type: text/plain, Size: 2456 bytes --]
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 <jbeulich@suse.com>
---
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
/* = log base 2 of crashinfo_maxaddr after checking for sanity. Default to
* larger than the entire physical address space. */
-paddr_t crashinfo_maxaddr_bits = 64;
+unsigned int __initdata crashinfo_maxaddr_bits = 64;
/* Pointers to keep track of the crash heap region. */
static void *crash_heap_current = NULL, *crash_heap_end = NULL;
@@ -532,7 +532,7 @@ void __init kexec_early_calculations(voi
low_crashinfo_mode = LOW_CRASHINFO_NONE;
if ( low_crashinfo_mode > LOW_CRASHINFO_NONE )
- crashinfo_maxaddr_bits = fls(crashinfo_maxaddr) - 1;
+ crashinfo_maxaddr_bits = fls64(crashinfo_maxaddr) - 1;
}
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;
}
+#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 @@
typedef struct xen_kexec_reserve {
unsigned long size;
- unsigned long start;
+ paddr_t start;
} xen_kexec_reserve_t;
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);
int machine_kexec_add_page(struct kexec_image *image, unsigned long vaddr,
[-- Attachment #2: kexec-types.patch --]
[-- Type: text/plain, Size: 2475 bytes --]
kexec: fix some types
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 <jbeulich@suse.com>
---
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
/* = log base 2 of crashinfo_maxaddr after checking for sanity. Default to
* larger than the entire physical address space. */
-paddr_t crashinfo_maxaddr_bits = 64;
+unsigned int __initdata crashinfo_maxaddr_bits = 64;
/* Pointers to keep track of the crash heap region. */
static void *crash_heap_current = NULL, *crash_heap_end = NULL;
@@ -532,7 +532,7 @@ void __init kexec_early_calculations(voi
low_crashinfo_mode = LOW_CRASHINFO_NONE;
if ( low_crashinfo_mode > LOW_CRASHINFO_NONE )
- crashinfo_maxaddr_bits = fls(crashinfo_maxaddr) - 1;
+ crashinfo_maxaddr_bits = fls64(crashinfo_maxaddr) - 1;
}
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;
}
+#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 @@
typedef struct xen_kexec_reserve {
unsigned long size;
- unsigned long start;
+ paddr_t start;
} xen_kexec_reserve_t;
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);
int machine_kexec_add_page(struct kexec_image *image, unsigned long vaddr,
[-- Attachment #3: Type: text/plain, Size: 126 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] kexec: fix some types
2015-01-15 15:32 [PATCH] kexec: fix some types Jan Beulich
@ 2015-01-15 16:05 ` David Vrabel
0 siblings, 0 replies; 2+ messages in thread
From: David Vrabel @ 2015-01-15 16:05 UTC (permalink / raw)
To: Jan Beulich, xen-devel; +Cc: Andrew Cooper, Keir Fraser, David Vrabel
On 15/01/15 15:32, Jan Beulich wrote:
> 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.
Reviewed-by: David Vrabel <david.vrabel@citrix.com>
David
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-01-15 16:06 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-15 15:32 [PATCH] kexec: fix some types Jan Beulich
2015-01-15 16:05 ` David Vrabel
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.