Skip to contentSkip to conversation

kexec: minor fixups and enhancements

PATCH In review Geoff Levand 6 participants 35 messages Aug 22, 2014 – Nov 13, 2014

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

cover kexec: minor fixups and enhancements

Hi,

Here are a few minor fixups and enhancements for kexec support.

Patch 3 and 4 that add preprocessor macros for the kimage list flags are ones that I use in the arm64 kexec support I am working on, so it would be nice for those to go in.

Please consider.

-Geoff

The following changes since commit 7d1311b93e58ed55f3a31cc8f94c4b8fe988a2b9:

Linux 3.17-rc1 (2014-08-16 10:40:26 -0600)

are available in the git repository at:

git://git.linaro.org/people/geoff.levand/linux-kexec.git for-kexec

for you to fetch changes up to dc3c63e69815e00dce5454bd50e2991e9ea33f64:

powerpc/kexec: Use global IND_FLAGS macro (2014-08-22 11:15:18 -0700)

----------------------------------------------------------------
Geoff Levand (5):
kexec: Fix make headers_check
kexec: Simplify conditional
kexec: Add bit definitions for kimage entry flags
kexec: Add IND_FLAGS macro powerpc/kexec: Use global IND_FLAGS macro

 arch/powerpc/kernel/machine_kexec_64.c |  2 --
 include/linux/kexec.h                  | 20 ++++++++++++++++----
 include/uapi/linux/kexec.h             |  6 ------
 kernel/kexec.c                         | 17 ++++++++++-------
 4 files changed, 26 insertions(+), 19 deletions(-)
Signature · 7 lines
1.9.1


_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
#1 lore raw

PATCH 1/5 kexec: Fix make headers_check

Remove the unneded declaration for a kexec_load() routine.

Fixes errors like these when running 'make headers_check':

include/uapi/linux/kexec.h: userspace cannot reference function or variable defined in the kernel

---
 include/uapi/linux/kexec.h | 6 ------
 1 file changed, 6 deletions(-)
include/uapi/linux/kexec.h +0 -6
index 6925f5b..99048e5 100644
@@ -55,12 +55,6 @@ struct kexec_segment {
 	size_t memsz;
 };
 
-/* Load a new kernel image as described by the kexec_segment array
- * consisting of passed number of segments at the entry-point address.
- * The flags allow different useage types.
- */
-extern int kexec_load(void *, size_t, struct kexec_segment *,
-		unsigned long int);
 #endif /* __KERNEL__ */
 
 #endif /* _UAPILINUX_KEXEC_H */
Signature · 8 lines
1.9.1



_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
#2 lore raw

Re: [PATCH 1/5] kexec: Fix make headers_check

Quoted 7 lines · Geoff Levand

Remove the unneded declaration for a kexec_load() routine.

Fixes errors like these when running 'make headers_check':

include/uapi/linux/kexec.h: userspace cannot reference function or variable defined in the kernel

I think Paul Bolle tried to remove this in the past and maximilian had objections.

http://lists.infradead.org/pipermail/kexec/2014-January/010902.html

I can't see that how exporting kernel prototype helps here. kexec-tools seems to be using syscall(__NR_kexec_load) directly for non-xen case. So I would be fine with removing this definition. Just trying to make sure that it does not break any other library or users of this declaration.

Thanks
Vivek

Quoted 30 lines
---
 include/uapi/linux/kexec.h | 6 ------
 1 file changed, 6 deletions(-)
include/uapi/linux/kexec.h +0 -6
index 6925f5b..99048e5 100644
@@ -55,12 +55,6 @@ struct kexec_segment {
 	size_t memsz;
 };
 
-/* Load a new kernel image as described by the kexec_segment array
- * consisting of passed number of segments at the entry-point address.
- * The flags allow different useage types.
- */
-extern int kexec_load(void *, size_t, struct kexec_segment *,
-		unsigned long int);
 #endif /* __KERNEL__ */
 
 #endif /* _UAPILINUX_KEXEC_H */
Signature · 8 lines
1.9.1



_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

Acked-by
#3 lore raw

Re: [PATCH 1/5] kexec: Fix make headers_check

[Added Peter Anvin.]

Quoted 5 lines · Vivek Goyal
Quoted 4 lines · Geoff Levand

Remove the unneded declaration for a kexec_load() routine.

Fixes errors like these when running 'make headers_check':

Quoted 8 lines
Quoted 3 lines

include/uapi/linux/kexec.h: userspace cannot reference function or variable defined in the kernel

I think Paul Bolle tried to remove this in the past and maximilian had objections.

http://lists.infradead.org/pipermail/kexec/2014-January/010902.html

I've wanted to resend my patch, perhaps with a new commit explanation, for quite some time now. I never got around doing that.

Quoted 1 line

I can't see that how exporting kernel prototype helps here.

It doesn't, for the reasons I've set out in
http://lists.infradead.org/pipermail/kexec/2014-January/010900.html . In
short: why bother using this prototype if one still needs to define the matching function oneself?

Quoted 4 lines

kexec-tools
seems to be using syscall(__NR_kexec_load) directly for non-xen case. So I would be fine with removing this definition. Just trying to make sure that it does not break any other library or users of this declaration.

Obviously, this can only break compiling those libraries, or other users. It can't break already compiled binaries. Besides I don't think those libraries, etc actually exist. Maximilian mentioned klibc in January, but I wasn't able to find a version of klibc that cared about this prototype. No one pointed me at a version that does (or any other library, etc., for that matter).

(If we do decide to keep this prototype, we should special case this prototype in headers_check.pl just to silence the build.)

The above can be summarized like this:

Paul Bolle

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

#4 lore raw

Re: [PATCH 1/5] kexec: Fix make headers_check

Hi Geoff,

Quoted 39 lines · Paul Bolle

[Added Peter Anvin.]

Quoted 5 lines · Vivek Goyal
Quoted 4 lines · Geoff Levand

Remove the unneded declaration for a kexec_load() routine.

Fixes errors like these when running 'make headers_check':

Quoted 8 lines
Quoted 3 lines

include/uapi/linux/kexec.h: userspace cannot reference function or variable defined in the kernel

I think Paul Bolle tried to remove this in the past and maximilian had objections.

http://lists.infradead.org/pipermail/kexec/2014-January/010902.html

I've wanted to resend my patch, perhaps with a new commit explanation, for quite some time now. I never got around doing that.

Quoted 1 line

I can't see that how exporting kernel prototype helps here.

It doesn't, for the reasons I've set out in
http://lists.infradead.org/pipermail/kexec/2014-January/010900.html . In
short: why bother using this prototype if one still needs to define the matching function oneself?

Quoted 4 lines

kexec-tools
seems to be using syscall(__NR_kexec_load) directly for non-xen case. So I would be fine with removing this definition. Just trying to make sure that it does not break any other library or users of this declaration.

Obviously, this can only break compiling those libraries, or other users. It can't break already compiled binaries. Besides I don't think those libraries, etc actually exist. Maximilian mentioned klibc in January, but I wasn't able to find a version of klibc that cared about this prototype. No one pointed me at a version that does (or any other library, etc., for that matter).

Quoted 5 lines

(If we do decide to keep this prototype, we should special case this prototype in headers_check.pl just to silence the build.)

The above can be summarized like this:

It seems not much happened after I added my Acked-by. I assume you still want to get this merged. Is that correct?

Paul Bolle

#5 lore raw

Re: [PATCH 1/5] kexec: Fix make headers_check

Hi,

Quoted 40 lines · Paul Bolle
Quoted 39 lines · Paul Bolle

[Added Peter Anvin.]

Quoted 5 lines · Vivek Goyal
Quoted 4 lines · Geoff Levand

Remove the unneded declaration for a kexec_load() routine.

Fixes errors like these when running 'make headers_check':

Quoted 8 lines
Quoted 3 lines

include/uapi/linux/kexec.h: userspace cannot reference function or variable defined in the kernel

I think Paul Bolle tried to remove this in the past and maximilian had objections.

http://lists.infradead.org/pipermail/kexec/2014-January/010902.html

I've wanted to resend my patch, perhaps with a new commit explanation, for quite some time now. I never got around doing that.

Quoted 1 line

I can't see that how exporting kernel prototype helps here.

It doesn't, for the reasons I've set out in
http://lists.infradead.org/pipermail/kexec/2014-January/010900.html . In
short: why bother using this prototype if one still needs to define the matching function oneself?

Quoted 4 lines

kexec-tools
seems to be using syscall(__NR_kexec_load) directly for non-xen case. So I would be fine with removing this definition. Just trying to make sure that it does not break any other library or users of this declaration.

Obviously, this can only break compiling those libraries, or other users. It can't break already compiled binaries. Besides I don't think those libraries, etc actually exist. Maximilian mentioned klibc in January, but I wasn't able to find a version of klibc that cared about this prototype. No one pointed me at a version that does (or any other library, etc., for that matter).

Quoted 8 lines
Quoted 5 lines

(If we do decide to keep this prototype, we should special case this prototype in headers_check.pl just to silence the build.)

The above can be summarized like this:

It seems not much happened after I added my Acked-by. I assume you still want to get this merged. Is that correct?

Yes, I think we concluded there are no real users of this kexec_load() ptototype, and so it can be removed.

-Geoff

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

#6 lore raw

Re: [PATCH 1/5] kexec: Fix make headers_check

Quoted 6 lines · Geoff Levand
Quoted 2 lines · Paul Bolle

It seems not much happened after I added my Acked-by. I assume you still want to get this merged. Is that correct?

Yes, I think we concluded there are no real users of this kexec_load() ptototype, and so it can be removed.

What would be the quickest way to get this finally resolved? Who's in charge of this stuff? Would resending your patch, with my Ack added, speed up things? The vain side of my personality does think it would help.

Paul Bolle

#7 lore raw

Re: [PATCH 1/5] kexec: Fix make headers_check

Quoted 5 lines · Paul Bolle
Quoted 4 lines · Geoff Levand
Quoted 2 lines · Paul Bolle

It seems not much happened after I added my Acked-by. I assume you still want to get this merged. Is that correct?

Quoted 7 lines
Quoted 2 lines

Yes, I think we concluded there are no real users of this kexec_load() ptototype, and so it can be removed.

What would be the quickest way to get this finally resolved? Who's in charge of this stuff? Would resending your patch, with my Ack added, speed up things? The vain side of my personality does think it would help.

I'll prepare a V2 set of the this series with the various acks and ask Andrew to merge it.

-Geoff

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

#8 lore raw

Re: [PATCH 1/5] kexec: Fix make headers_check

In reply to Paul Bolle
Quoted 8 lines · Paul Bolle

Obviously, this can only break compiling those libraries, or other users. It can't break already compiled binaries. Besides I don't think those libraries, etc actually exist. Maximilian mentioned klibc in January, but I wasn't able to find a version of klibc that cared about this prototype. No one pointed me at a version that does (or any other library, etc., for that matter).

... and that would be a klibc bug and we'd just fix it.

-hpa

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

#9 lore raw

PATCH 2/5 kexec: Simplify conditional

In reply to Geoff Levand

Simplify the code around one of the conditionals in the kexec_load syscall routine.

The original code was confusing with a redundant check on KEXEC_ON_CRASH and comments outside of the conditional block. This change switches the order of the conditional check, and cleans up the comments for the conditional. There is no functional change to the code.

---
 kernel/kexec.c | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)
kernel/kexec.c +10 -7
index 0b49a0a..d04b56e 100644
@@ -1282,19 +1282,22 @@ SYSCALL_DEFINE4(kexec_load, unsigned long, entry, unsigned long, nr_segments,
 	if (nr_segments > 0) {
 		unsigned long i;
 
-		/* Loading another kernel to reboot into */
-		if ((flags & KEXEC_ON_CRASH) == 0)
-			result = kimage_alloc_init(&image, entry, nr_segments,
-						   segments, flags);
-		/* Loading another kernel to switch to if this one crashes */
-		else if (flags & KEXEC_ON_CRASH) {
-			/* Free any current crash dump kernel before
+		if (flags & KEXEC_ON_CRASH) {
+			/*
+			 * Loading another kernel to switch to if this one
+			 * crashes.  Free any current crash dump kernel before
 			 * we corrupt it.
 			 */
+
 			kimage_free(xchg(&kexec_crash_image, NULL));
 			result = kimage_alloc_init(&image, entry, nr_segments,
 						   segments, flags);
 			crash_map_reserved_pages();
+		} else {
+			/* Loading another kernel to reboot into. */
+
+			result = kimage_alloc_init(&image, entry, nr_segments,
+						   segments, flags);
 		}
 		if (result)
 			goto out;
Signature · 8 lines
1.9.1



_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Acked-by on v1 2/5
#10 lore raw

Re: [PATCH 2/5] kexec: Simplify conditional

Quoted 9 lines · Geoff Levand

Simplify the code around one of the conditionals in the kexec_load syscall routine.

The original code was confusing with a redundant check on KEXEC_ON_CRASH and comments outside of the conditional block. This change switches the order of the conditional check, and cleans up the comments for the conditional. There is no functional change to the code.

This is simple reorganization.

Vivek

Quoted 47 lines
---
 kernel/kexec.c | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)
kernel/kexec.c +10 -7
index 0b49a0a..d04b56e 100644
@@ -1282,19 +1282,22 @@ SYSCALL_DEFINE4(kexec_load, unsigned long, entry, unsigned long, nr_segments,
 	if (nr_segments > 0) {
 		unsigned long i;
 
-		/* Loading another kernel to reboot into */
-		if ((flags & KEXEC_ON_CRASH) == 0)
-			result = kimage_alloc_init(&image, entry, nr_segments,
-						   segments, flags);
-		/* Loading another kernel to switch to if this one crashes */
-		else if (flags & KEXEC_ON_CRASH) {
-			/* Free any current crash dump kernel before
+		if (flags & KEXEC_ON_CRASH) {
+			/*
+			 * Loading another kernel to switch to if this one
+			 * crashes.  Free any current crash dump kernel before
 			 * we corrupt it.
 			 */
+
 			kimage_free(xchg(&kexec_crash_image, NULL));
 			result = kimage_alloc_init(&image, entry, nr_segments,
 						   segments, flags);
 			crash_map_reserved_pages();
+		} else {
+			/* Loading another kernel to reboot into. */
+
+			result = kimage_alloc_init(&image, entry, nr_segments,
+						   segments, flags);
 		}
 		if (result)
 			goto out;
Signature · 8 lines
1.9.1



_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

#11 lore raw

PATCH 3/5 kexec: Add bit definitions for kimage entry flags

In reply to Geoff Levand

Define new kexec preprocessor macros IND_*_BIT that define the bit position of the kimage entry flags. Change the existing IND_* flag macros to be defined as bit shifts of the corresponding IND_*_BIT macros. Also wrap all C language code in kexec.h with #if !defined(__ASSEMBLY__) so assembly files can include kexec.h to get the IND_* and IND_*_BIT macros.

Some CPU instruction sets have tests for bit position which are convenient in implementing routines that operate on the kimage entry list. The addition of these bit position macros in a common location will avoid duplicate definitions and the chance that changes to the IND_* flags will not be propagated to assembly files.

---
 include/linux/kexec.h | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)
include/linux/kexec.h +15 -4
index 4b2a0e1..8c628ca 100644
@@ -1,6 +1,18 @@
 #ifndef LINUX_KEXEC_H
 #define LINUX_KEXEC_H
 
+#define IND_DESTINATION_BIT 0
+#define IND_INDIRECTION_BIT 1
+#define IND_DONE_BIT        2
+#define IND_SOURCE_BIT      3
+
+#define IND_DESTINATION  (1 << IND_DESTINATION_BIT)
+#define IND_INDIRECTION  (1 << IND_INDIRECTION_BIT)
+#define IND_DONE         (1 << IND_DONE_BIT)
+#define IND_SOURCE       (1 << IND_SOURCE_BIT)
+
+#if !defined(__ASSEMBLY__)
+
 #include <uapi/linux/kexec.h>
 
 #ifdef CONFIG_KEXEC
@@ -64,10 +76,6 @@
  */
 
 typedef unsigned long kimage_entry_t;
-#define IND_DESTINATION  0x1
-#define IND_INDIRECTION  0x2
-#define IND_DONE         0x4
-#define IND_SOURCE       0x8
 
 struct kexec_segment {
 	/*
@@ -312,4 +320,7 @@ struct task_struct;
 static inline void crash_kexec(struct pt_regs *regs) { }
 static inline int kexec_should_crash(struct task_struct *p) { return 0; }
 #endif /* CONFIG_KEXEC */
+
+#endif /* !defined(__ASSEBMLY__) */
+
 #endif /* LINUX_KEXEC_H */
Signature · 8 lines
1.9.1



_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Acked-by on v1 3/5
#12 lore raw

Re: [PATCH 3/5] kexec: Add bit definitions for kimage entry flags

Quoted 6 lines · Geoff Levand

Define new kexec preprocessor macros IND_*_BIT that define the bit position of the kimage entry flags. Change the existing IND_* flag macros to be defined as bit shifts of the corresponding IND_*_BIT macros. Also wrap all C language code in kexec.h with #if !defined(__ASSEMBLY__) so assembly files can include kexec.h to get the IND_* and IND_*_BIT macros.

Quoted 7 lines

Some CPU instruction sets have tests for bit position which are convenient in implementing routines that operate on the kimage entry list. The addition of these bit position macros in a common location will avoid duplicate definitions and the chance that changes to the IND_* flags will not be propagated to assembly files.

Looks good to me.

Vivek

Quoted 55 lines
---
 include/linux/kexec.h | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)
include/linux/kexec.h +15 -4
index 4b2a0e1..8c628ca 100644
@@ -1,6 +1,18 @@
 #ifndef LINUX_KEXEC_H
 #define LINUX_KEXEC_H
 
+#define IND_DESTINATION_BIT 0
+#define IND_INDIRECTION_BIT 1
+#define IND_DONE_BIT        2
+#define IND_SOURCE_BIT      3
+
+#define IND_DESTINATION  (1 << IND_DESTINATION_BIT)
+#define IND_INDIRECTION  (1 << IND_INDIRECTION_BIT)
+#define IND_DONE         (1 << IND_DONE_BIT)
+#define IND_SOURCE       (1 << IND_SOURCE_BIT)
+
+#if !defined(__ASSEMBLY__)
+
 #include <uapi/linux/kexec.h>
 
 #ifdef CONFIG_KEXEC
@@ -64,10 +76,6 @@
  */
 
 typedef unsigned long kimage_entry_t;
-#define IND_DESTINATION  0x1
-#define IND_INDIRECTION  0x2
-#define IND_DONE         0x4
-#define IND_SOURCE       0x8
 
 struct kexec_segment {
 	/*
@@ -312,4 +320,7 @@ struct task_struct;
 static inline void crash_kexec(struct pt_regs *regs) { }
 static inline int kexec_should_crash(struct task_struct *p) { return 0; }
 #endif /* CONFIG_KEXEC */
+
+#endif /* !defined(__ASSEBMLY__) */
+
 #endif /* LINUX_KEXEC_H */
Signature · 8 lines
1.9.1



_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

#13 lore raw

PATCH 4/5 kexec: Add IND_FLAGS macro

In reply to Geoff Levand

Add a new kexec preprocessor macro IND_FLAGS, which is the bitwise OR of all the possible kexec IND_ kimage_entry indirection flags.

Having this macro allows for simplified code in the prosessing of the kexec kimage_entry items.

---
 include/linux/kexec.h | 1 +
 1 file changed, 1 insertion(+)
include/linux/kexec.h +1 -0
index 8c628ca..a4758f9 100644
@@ -10,6 +10,7 @@
 #define IND_INDIRECTION  (1 << IND_INDIRECTION_BIT)
 #define IND_DONE         (1 << IND_DONE_BIT)
 #define IND_SOURCE       (1 << IND_SOURCE_BIT)
+#define IND_FLAGS (IND_DESTINATION | IND_INDIRECTION | IND_DONE | IND_SOURCE)
 
 #if !defined(__ASSEMBLY__)
 
Signature · 8 lines
1.9.1



_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Acked-by on v1 4/5
#14 lore raw

Re: [PATCH 4/5] kexec: Add IND_FLAGS macro

Quoted 7 lines · Geoff Levand

Add a new kexec preprocessor macro IND_FLAGS, which is the bitwise OR of all the possible kexec IND_ kimage_entry indirection flags.

Having this macro allows for simplified code in the prosessing of the kexec kimage_entry items.

Vivek

Quoted 25 lines
---
 include/linux/kexec.h | 1 +
 1 file changed, 1 insertion(+)
include/linux/kexec.h +1 -0
index 8c628ca..a4758f9 100644
@@ -10,6 +10,7 @@
 #define IND_INDIRECTION  (1 << IND_INDIRECTION_BIT)
 #define IND_DONE         (1 << IND_DONE_BIT)
 #define IND_SOURCE       (1 << IND_SOURCE_BIT)
+#define IND_FLAGS (IND_DESTINATION | IND_INDIRECTION | IND_DONE | IND_SOURCE)
 
 #if !defined(__ASSEMBLY__)
 
Signature · 8 lines
1.9.1



_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

#15 lore raw

PATCH 5/5 powerpc/kexec: Use global IND_FLAGS macro

In reply to Geoff Levand

linux/kexec.h now defines an IND_FLAGS macro. Remove the local powerpc definition and use the generic one.

---
 arch/powerpc/kernel/machine_kexec_64.c | 2 --
 1 file changed, 2 deletions(-)
arch/powerpc/kernel/machine_kexec_64.c +0 -2
index 879b3aa..75652a32 100644
@@ -96,8 +96,6 @@ int default_machine_kexec_prepare(struct kimage *image)
 	return 0;
 }
 
-#define IND_FLAGS (IND_DESTINATION | IND_INDIRECTION | IND_DONE | IND_SOURCE)
-
 static void copy_segments(unsigned long ind)
 {
 	unsigned long entry;
Signature · 7 lines
1.9.1


_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
#16 lore raw
In reply to Geoff Levand
Quoted 9 lines · Geoff Levand

Hi,

Here are a few minor fixups and enhancements for kexec support.

Patch 3 and 4 that add preprocessor macros for the kimage list flags are ones that I use in the arm64 kexec support I am working on, so it would be nice for those to go in.

Please consider.

Hi Geoff,

Does arm64 has secureboot? If yes, then it might make sense to enable the new syscall kexec_file_load() on arm64 instead of trying to make old syscall work first.

Thanks
Vivek

Quoted 23 lines

-Geoff

The following changes since commit 7d1311b93e58ed55f3a31cc8f94c4b8fe988a2b9:

Linux 3.17-rc1 (2014-08-16 10:40:26 -0600)

are available in the git repository at:

git://git.linaro.org/people/geoff.levand/linux-kexec.git for-kexec

for you to fetch changes up to dc3c63e69815e00dce5454bd50e2991e9ea33f64:

powerpc/kexec: Use global IND_FLAGS macro (2014-08-22 11:15:18 -0700)

----------------------------------------------------------------
Geoff Levand (5):
kexec: Fix make headers_check
kexec: Simplify conditional
kexec: Add bit definitions for kimage entry flags
kexec: Add IND_FLAGS macro powerpc/kexec: Use global IND_FLAGS macro

Quoted 14 lines
 arch/powerpc/kernel/machine_kexec_64.c |  2 --
 include/linux/kexec.h                  | 20 ++++++++++++++++----
 include/uapi/linux/kexec.h             |  6 ------
 kernel/kexec.c                         | 17 ++++++++++-------
 4 files changed, 26 insertions(+), 19 deletions(-)
Signature · 7 lines
1.9.1


_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

#17 lore raw
Quoted 9 lines · Vivek Goyal
Quoted 8 lines · Geoff Levand

Hi,

Here are a few minor fixups and enhancements for kexec support.

Patch 3 and 4 that add preprocessor macros for the kimage list flags are ones that I use in the arm64 kexec support I am working on, so it would be nice for those to go in.

Quoted 7 lines
Quoted 1 line

Please consider.

Hi Geoff,

Does arm64 has secureboot? If yes, then it might make sense to enable the new syscall kexec_file_load() on arm64 instead of trying to make old syscall work first.

It will save efforts for efi support as well, for the in-kernel loader we do not necessary to save the efi physical addresses or runtime ranges to sysfs and passing them to 2nd kernel, we can just copy them in kernel.

Thanks
Dave

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

#18 lore raw
In reply to Vivek Goyal

Hi Vivek,

Quoted 3 lines · Vivek Goyal

Does arm64 has secureboot? If yes, then it might make sense to enable the new syscall kexec_file_load() on arm64 instead of trying to make old syscall work first.

Yes, arm64 should support secureboot, but I have not looked into it.

When do you expect syscall kexec_file_load to get merged? I won't wait until then to push my current kexec work.

-Geoff

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

#19 lore raw
Quoted 11 lines · Geoff Levand

Hi Vivek,

Quoted 3 lines · Vivek Goyal

Does arm64 has secureboot? If yes, then it might make sense to enable the new syscall kexec_file_load() on arm64 instead of trying to make old syscall work first.

Yes, arm64 should support secureboot, but I have not looked into it.

When do you expect syscall kexec_file_load to get merged? I won't wait until then to push my current kexec work.

It got merged in 3.17-rc1

Thanks
Vivek

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

#20 lore raw

v2 cover kexec: Minor fixups and enhancements

In reply to Geoff Levand

Hi Andrew,

This series is basically a re-send of my kexec fix-up patches I sent out back in August. Everyone who commented seemed to think these changes were OK, but there doesn't seem to be a kexec maintainer to pick these up. Could you take them through your mm tree?

Please let us know.

-Geoff

V2 changes:
o Collected various Acked-by's.

The following changes since commit bfe01a5ba2490f299e1d2d5508cbbbadd897bbe9:

Linux 3.17 (2014-10-05 12:23:04 -0700)

are available in the git repository at:

git://git.linaro.org/people/geoff.levand/linux-kexec.git for-kexec

for you to fetch changes up to adf97d602657c72f6ee59aefe5d51149159a3e99:

powerpc/kexec: Use global IND_FLAGS macro (2014-10-06 17:06:26 -0700)

----------------------------------------------------------------
Geoff Levand (5):
kexec: Fix make headers_check
kexec: Simplify conditional
kexec: Add bit definitions for kimage entry flags
kexec: Add IND_FLAGS macro powerpc/kexec: Use global IND_FLAGS macro

 arch/powerpc/kernel/machine_kexec_64.c |  2 --
 include/linux/kexec.h                  | 20 ++++++++++++++++----
 include/uapi/linux/kexec.h             |  6 ------
 kernel/kexec.c                         | 17 ++++++++++-------
 4 files changed, 26 insertions(+), 19 deletions(-)
Signature · 7 lines
1.9.1


_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
#21 lore raw

PATCH 1/1 kexec: Add bit definitions for kimage entry flags

Define new kexec preprocessor macros IND_*_BIT that define the bit position of the kimage entry flags. Change the existing IND_* flag macros to be defined as bit shifts of the corresponding IND_*_BIT macros. Also wrap all C language code in kexec.h with #if !defined(__ASSEMBLY__) so assembly files can include kexec.h to get the IND_* and IND_*_BIT macros.

Some CPU instruction sets have tests for bit position which are convenient in implementing routines that operate on the kimage entry list. The addition of these bit position macros in a common location will avoid duplicate definitions and the chance that changes to the IND_* flags will not be propagated to assembly files.

---
 include/linux/kexec.h | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)
include/linux/kexec.h +15 -4
index 4b2a0e1..8c628ca 100644
@@ -1,6 +1,18 @@
 #ifndef LINUX_KEXEC_H
 #define LINUX_KEXEC_H
 
+#define IND_DESTINATION_BIT 0
+#define IND_INDIRECTION_BIT 1
+#define IND_DONE_BIT        2
+#define IND_SOURCE_BIT      3
+
+#define IND_DESTINATION  (1 << IND_DESTINATION_BIT)
+#define IND_INDIRECTION  (1 << IND_INDIRECTION_BIT)
+#define IND_DONE         (1 << IND_DONE_BIT)
+#define IND_SOURCE       (1 << IND_SOURCE_BIT)
+
+#if !defined(__ASSEMBLY__)
+
 #include <uapi/linux/kexec.h>
 
 #ifdef CONFIG_KEXEC
@@ -64,10 +76,6 @@
  */
 
 typedef unsigned long kimage_entry_t;
-#define IND_DESTINATION  0x1
-#define IND_INDIRECTION  0x2
-#define IND_DONE         0x4
-#define IND_SOURCE       0x8
 
 struct kexec_segment {
 	/*
@@ -312,4 +320,7 @@ struct task_struct;
 static inline void crash_kexec(struct pt_regs *regs) { }
 static inline int kexec_should_crash(struct task_struct *p) { return 0; }
 #endif /* CONFIG_KEXEC */
+
+#endif /* !defined(__ASSEBMLY__) */
+
 #endif /* LINUX_KEXEC_H */
Signature · 8 lines
1.9.1



_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
#22 lore raw

PATCH 1/1 kexec: Simplify conditional

In reply to Geoff Levand

Simplify the code around one of the conditionals in the kexec_load syscall routine.

The original code was confusing with a redundant check on KEXEC_ON_CRASH and comments outside of the conditional block. This change switches the order of the conditional check, and cleans up the comments for the conditional. There is no functional change to the code.

---
 kernel/kexec.c | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)
kernel/kexec.c +10 -7
index 2bee072..4b8356b 100644
@@ -1288,19 +1288,22 @@ SYSCALL_DEFINE4(kexec_load, unsigned long, entry, unsigned long, nr_segments,
 	if (nr_segments > 0) {
 		unsigned long i;
 
-		/* Loading another kernel to reboot into */
-		if ((flags & KEXEC_ON_CRASH) == 0)
-			result = kimage_alloc_init(&image, entry, nr_segments,
-						   segments, flags);
-		/* Loading another kernel to switch to if this one crashes */
-		else if (flags & KEXEC_ON_CRASH) {
-			/* Free any current crash dump kernel before
+		if (flags & KEXEC_ON_CRASH) {
+			/*
+			 * Loading another kernel to switch to if this one
+			 * crashes.  Free any current crash dump kernel before
 			 * we corrupt it.
 			 */
+
 			kimage_free(xchg(&kexec_crash_image, NULL));
 			result = kimage_alloc_init(&image, entry, nr_segments,
 						   segments, flags);
 			crash_map_reserved_pages();
+		} else {
+			/* Loading another kernel to reboot into. */
+
+			result = kimage_alloc_init(&image, entry, nr_segments,
+						   segments, flags);
 		}
 		if (result)
 			goto out;
Signature · 8 lines
1.9.1



_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
#23 lore raw

PATCH 1/1 powerpc/kexec: Use global IND_FLAGS macro

In reply to Geoff Levand

linux/kexec.h now defines an IND_FLAGS macro. Remove the local powerpc definition and use the generic one.

---
 arch/powerpc/kernel/machine_kexec_64.c | 2 --
 1 file changed, 2 deletions(-)
arch/powerpc/kernel/machine_kexec_64.c +0 -2
index 879b3aa..75652a32 100644
@@ -96,8 +96,6 @@ int default_machine_kexec_prepare(struct kimage *image)
 	return 0;
 }
 
-#define IND_FLAGS (IND_DESTINATION | IND_INDIRECTION | IND_DONE | IND_SOURCE)
-
 static void copy_segments(unsigned long ind)
 {
 	unsigned long entry;
Signature · 7 lines
1.9.1


_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
#24 lore raw

Re: [PATCH V25/5] powerpc/kexec: Use global IND_FLAGS macro

Quoted 4 lines · Geoff Levand

linux/kexec.h now defines an IND_FLAGS macro. Remove the local powerpc definition and use the generic one.

I think this patch should be merged in previous patch. I guess after applying patch4, series might not be compilable as there are two definitions of IND_FLAGS now.

Thanks
Vivek

Quoted 25 lines
---
 arch/powerpc/kernel/machine_kexec_64.c | 2 --
 1 file changed, 2 deletions(-)
arch/powerpc/kernel/machine_kexec_64.c +0 -2
index 879b3aa..75652a32 100644
@@ -96,8 +96,6 @@ int default_machine_kexec_prepare(struct kimage *image)
 	return 0;
 }
 
-#define IND_FLAGS (IND_DESTINATION | IND_INDIRECTION | IND_DONE | IND_SOURCE)
-
 static void copy_segments(unsigned long ind)
 {
 	unsigned long entry;
Signature · 7 lines
1.9.1


_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

#25 lore raw

PATCH v3 1/1 kexec: Add IND_FLAGS macro

Add a new kexec preprocessor macro IND_FLAGS, which is the bitwise OR of all the possible kexec IND_ kimage_entry indirection flags. Having this macro allows for simplified code in the processing of the kexec kimage_entry items. Also, remove the local powerpc definition and use the generic one.

---
Hi Ben,

Could you give your ack on this, then I'll try to get it merged with my other kexec patches.

Thanks.

-Geoff

 arch/powerpc/kernel/machine_kexec_64.c | 2 --
 include/linux/kexec.h                  | 1 +
 2 files changed, 1 insertion(+), 2 deletions(-)
arch/powerpc/kernel/machine_kexec_64.c +0 -2
index 879b3aa..75652a32 100644
@@ -96,8 +96,6 @@ int default_machine_kexec_prepare(struct kimage *image)
 	return 0;
 }
 
-#define IND_FLAGS (IND_DESTINATION | IND_INDIRECTION | IND_DONE | IND_SOURCE)
-
 static void copy_segments(unsigned long ind)
 {
 	unsigned long entry;
include/linux/kexec.h +1 -0
index 25e039c..b23412c 100644
@@ -10,6 +10,7 @@
 #define IND_INDIRECTION  (1 << IND_INDIRECTION_BIT)
 #define IND_DONE         (1 << IND_DONE_BIT)
 #define IND_SOURCE       (1 << IND_SOURCE_BIT)
+#define IND_FLAGS (IND_DESTINATION | IND_INDIRECTION | IND_DONE | IND_SOURCE)
 
 #if !defined(__ASSEMBLY__)
 
Signature · 9 lines
1.9.1




_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Acked-by on v3 1/1
#26 lore raw

Re: [PATCH V3] kexec: Add IND_FLAGS macro

Quoted 7 lines · Geoff Levand

Add a new kexec preprocessor macro IND_FLAGS, which is the bitwise OR of all the possible kexec IND_ kimage_entry indirection flags. Having this macro allows for simplified code in the processing of the kexec kimage_entry items. Also, remove the local powerpc definition and use the generic one.

Quoted 33 lines

---
Hi Ben,

Could you give your ack on this, then I'll try to get it merged with my other kexec patches.

Thanks.

(quoted diff) +0 -1
-Geoff
 
 arch/powerpc/kernel/machine_kexec_64.c | 2 --
 include/linux/kexec.h                  | 1 +
 2 files changed, 1 insertion(+), 2 deletions(-)
arch/powerpc/kernel/machine_kexec_64.c +0 -2
index 879b3aa..75652a32 100644
@@ -96,8 +96,6 @@ int default_machine_kexec_prepare(struct kimage *image)
 	return 0;
 }
 
-#define IND_FLAGS (IND_DESTINATION | IND_INDIRECTION | IND_DONE | IND_SOURCE)
-
 static void copy_segments(unsigned long ind)
 {
 	unsigned long entry;
include/linux/kexec.h +0 -0
index 25e039c..b23412c 100644

include/linux/kexec.h line 16

Quoted 7 lines
include/linux/kexec.h +1 -0
@@ -10,6 +10,7 @@
 #define IND_INDIRECTION  (1 << IND_INDIRECTION_BIT)
 #define IND_DONE         (1 << IND_DONE_BIT)
 #define IND_SOURCE       (1 << IND_SOURCE_BIT)
+#define IND_FLAGS (IND_DESTINATION | IND_INDIRECTION | IND_DONE | IND_SOURCE)
 
 #if !defined(__ASSEMBLY__)
 

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

#27 lore raw

PATCH 1/1 kexec: Add IND_FLAGS macro

In reply to Geoff Levand

Add a new kexec preprocessor macro IND_FLAGS, which is the bitwise OR of all the possible kexec IND_ kimage_entry indirection flags.

Having this macro allows for simplified code in the prosessing of the kexec kimage_entry items.

---
 include/linux/kexec.h | 1 +
 1 file changed, 1 insertion(+)
include/linux/kexec.h +1 -0
index 8c628ca..a4758f9 100644
@@ -10,6 +10,7 @@
 #define IND_INDIRECTION  (1 << IND_INDIRECTION_BIT)
 #define IND_DONE         (1 << IND_DONE_BIT)
 #define IND_SOURCE       (1 << IND_SOURCE_BIT)
+#define IND_FLAGS (IND_DESTINATION | IND_INDIRECTION | IND_DONE | IND_SOURCE)
 
 #if !defined(__ASSEMBLY__)
 
Signature · 8 lines
1.9.1



_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
author Acked-by Vivek Goyal on v1 1/1
#28 lore raw

Re: [PATCH V3 4/5] kexec: Add IND_FLAGS macro

Add a new kexec preprocessor macro IND_FLAGS, which is the bitwise OR of all the possible kexec IND_ kimage_entry indirection flags. Having this macro allows for simplified code in the prosessing of the kexec kimage_entry items. Also, remove the local powerpc definition and use the generic one.

---

From V2: Folded patch 5 into patch 4.

 arch/powerpc/kernel/machine_kexec_64.c | 2 --
 include/linux/kexec.h                  | 1 +
 2 files changed, 1 insertion(+), 2 deletions(-)
arch/powerpc/kernel/machine_kexec_64.c +0 -2
index 879b3aa..75652a32 100644
@@ -96,8 +96,6 @@ int default_machine_kexec_prepare(struct kimage *image)
 	return 0;
 }
 
-#define IND_FLAGS (IND_DESTINATION | IND_INDIRECTION | IND_DONE | IND_SOURCE)
-
 static void copy_segments(unsigned long ind)
 {
 	unsigned long entry;
include/linux/kexec.h +1 -0
index 8c628ca..a4758f9 100644
@@ -10,6 +10,7 @@
 #define IND_INDIRECTION  (1 << IND_INDIRECTION_BIT)
 #define IND_DONE         (1 << IND_DONE_BIT)
 #define IND_SOURCE       (1 << IND_SOURCE_BIT)
+#define IND_FLAGS (IND_DESTINATION | IND_INDIRECTION | IND_DONE | IND_SOURCE)
 
 #if !defined(__ASSEMBLY__)
 
Signature · 9 lines
1.9.1




_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
#29 lore raw

PATCH 1/1 kexec: Fix make headers_check

In reply to Geoff Levand

Remove the unneded declaration for a kexec_load() routine.

Fixes errors like these when running 'make headers_check':

include/uapi/linux/kexec.h: userspace cannot reference function or variable defined in the kernel

---
 include/uapi/linux/kexec.h | 6 ------
 1 file changed, 6 deletions(-)
include/uapi/linux/kexec.h +0 -6
index 6925f5b..99048e5 100644
@@ -55,12 +55,6 @@ struct kexec_segment {
 	size_t memsz;
 };
 
-/* Load a new kernel image as described by the kexec_segment array
- * consisting of passed number of segments at the entry-point address.
- * The flags allow different useage types.
- */
-extern int kexec_load(void *, size_t, struct kexec_segment *,
-		unsigned long int);
 #endif /* __KERNEL__ */
 
 #endif /* _UAPILINUX_KEXEC_H */
Signature · 8 lines
1.9.1



_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
#30 lore raw

v3 cover kexec: minor fixups and enhancements

In reply to Geoff Levand

Hi Andrew,

This is essentially a resend of my patch set from October with the exception of folding the last two patches of that series into the final patch here.

The patches here have been in review since first posted in August, and have been acked by one or two kexec developers. Could you merge them through your mm tree? Thanks.

-Geoff

The following changes since commit 206c5f60a3d902bc4b56dab2de3e88de5eb06108:

Linux 3.18-rc4 (2014-11-09 14:55:29 -0800)

are available in the git repository at:

git://git.linaro.org/people/geoff.levand/linux-kexec.git for-kexec

for you to fetch changes up to 916ef4b8abaa4202ea43731b9cd3f8e0ea95f05b:

kexec: Add IND_FLAGS macro (2014-11-12 15:27:54 -0800)

----------------------------------------------------------------
Geoff Levand (4):
kexec: Fix make headers_check
kexec: Simplify conditional
kexec: Add bit definitions for kimage entry flags
kexec: Add IND_FLAGS macro

 arch/powerpc/kernel/machine_kexec_64.c |  2 --
 include/linux/kexec.h                  | 20 ++++++++++++++++----
 include/uapi/linux/kexec.h             |  6 ------
 kernel/kexec.c                         | 17 ++++++++++-------
 4 files changed, 26 insertions(+), 19 deletions(-)
Signature · 7 lines
1.9.1


_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
#31 lore raw

PATCH v3 1/4 kexec: Fix make headers_check

Remove the unneded declaration for a kexec_load() routine.

Fixes errors like these when running 'make headers_check':

include/uapi/linux/kexec.h: userspace cannot reference function or variable defined in the kernel

---
 include/uapi/linux/kexec.h | 6 ------
 1 file changed, 6 deletions(-)
include/uapi/linux/kexec.h +0 -6
index 6925f5b..99048e5 100644
@@ -55,12 +55,6 @@ struct kexec_segment {
 	size_t memsz;
 };
 
-/* Load a new kernel image as described by the kexec_segment array
- * consisting of passed number of segments at the entry-point address.
- * The flags allow different useage types.
- */
-extern int kexec_load(void *, size_t, struct kexec_segment *,
-		unsigned long int);
 #endif /* __KERNEL__ */
 
 #endif /* _UAPILINUX_KEXEC_H */
Signature · 8 lines
1.9.1



_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
#32 lore raw

PATCH v3 2/4 kexec: Simplify conditional

In reply to Geoff Levand

Simplify the code around one of the conditionals in the kexec_load syscall routine.

The original code was confusing with a redundant check on KEXEC_ON_CRASH and comments outside of the conditional block. This change switches the order of the conditional check, and cleans up the comments for the conditional. There is no functional change to the code.

---
 kernel/kexec.c | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)
kernel/kexec.c +10 -7
index 2abf9f6..650fcba 100644
@@ -1288,19 +1288,22 @@ SYSCALL_DEFINE4(kexec_load, unsigned long, entry, unsigned long, nr_segments,
 	if (nr_segments > 0) {
 		unsigned long i;
 
-		/* Loading another kernel to reboot into */
-		if ((flags & KEXEC_ON_CRASH) == 0)
-			result = kimage_alloc_init(&image, entry, nr_segments,
-						   segments, flags);
-		/* Loading another kernel to switch to if this one crashes */
-		else if (flags & KEXEC_ON_CRASH) {
-			/* Free any current crash dump kernel before
+		if (flags & KEXEC_ON_CRASH) {
+			/*
+			 * Loading another kernel to switch to if this one
+			 * crashes.  Free any current crash dump kernel before
 			 * we corrupt it.
 			 */
+
 			kimage_free(xchg(&kexec_crash_image, NULL));
 			result = kimage_alloc_init(&image, entry, nr_segments,
 						   segments, flags);
 			crash_map_reserved_pages();
+		} else {
+			/* Loading another kernel to reboot into. */
+
+			result = kimage_alloc_init(&image, entry, nr_segments,
+						   segments, flags);
 		}
 		if (result)
 			goto out;
Signature · 8 lines
1.9.1



_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
#33 lore raw

PATCH v3 3/4 kexec: Add bit definitions for kimage entry flags

In reply to Geoff Levand

Define new kexec preprocessor macros IND_*_BIT that define the bit position of the kimage entry flags. Change the existing IND_* flag macros to be defined as bit shifts of the corresponding IND_*_BIT macros. Also wrap all C language code in kexec.h with #if !defined(__ASSEMBLY__) so assembly files can include kexec.h to get the IND_* and IND_*_BIT macros.

Some CPU instruction sets have tests for bit position which are convenient in implementing routines that operate on the kimage entry list. The addition of these bit position macros in a common location will avoid duplicate definitions and the chance that changes to the IND_* flags will not be propagated to assembly files.

---
 include/linux/kexec.h | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)
include/linux/kexec.h +15 -4
index 9d957b7..25e039c 100644
@@ -1,6 +1,18 @@
 #ifndef LINUX_KEXEC_H
 #define LINUX_KEXEC_H
 
+#define IND_DESTINATION_BIT 0
+#define IND_INDIRECTION_BIT 1
+#define IND_DONE_BIT        2
+#define IND_SOURCE_BIT      3
+
+#define IND_DESTINATION  (1 << IND_DESTINATION_BIT)
+#define IND_INDIRECTION  (1 << IND_INDIRECTION_BIT)
+#define IND_DONE         (1 << IND_DONE_BIT)
+#define IND_SOURCE       (1 << IND_SOURCE_BIT)
+
+#if !defined(__ASSEMBLY__)
+
 #include <uapi/linux/kexec.h>
 
 #ifdef CONFIG_KEXEC
@@ -64,10 +76,6 @@
  */
 
 typedef unsigned long kimage_entry_t;
-#define IND_DESTINATION  0x1
-#define IND_INDIRECTION  0x2
-#define IND_DONE         0x4
-#define IND_SOURCE       0x8
 
 struct kexec_segment {
 	/*
@@ -313,4 +321,7 @@ struct task_struct;
 static inline void crash_kexec(struct pt_regs *regs) { }
 static inline int kexec_should_crash(struct task_struct *p) { return 0; }
 #endif /* CONFIG_KEXEC */
+
+#endif /* !defined(__ASSEBMLY__) */
+
 #endif /* LINUX_KEXEC_H */
Signature · 8 lines
1.9.1



_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
#34 lore raw

PATCH v3 4/4 kexec: Add IND_FLAGS macro

In reply to Geoff Levand

Add a new kexec preprocessor macro IND_FLAGS, which is the bitwise OR of all the possible kexec IND_ kimage_entry indirection flags. Having this macro allows for simplified code in the prosessing of the kexec kimage_entry items. Also, remove the local powerpc definition and use the generic one.

---
 arch/powerpc/kernel/machine_kexec_64.c | 2 --
 include/linux/kexec.h                  | 1 +
 2 files changed, 1 insertion(+), 2 deletions(-)
arch/powerpc/kernel/machine_kexec_64.c +0 -2
index 879b3aa..75652a32 100644
@@ -96,8 +96,6 @@ int default_machine_kexec_prepare(struct kimage *image)
 	return 0;
 }
 
-#define IND_FLAGS (IND_DESTINATION | IND_INDIRECTION | IND_DONE | IND_SOURCE)
-
 static void copy_segments(unsigned long ind)
 {
 	unsigned long entry;
include/linux/kexec.h +1 -0
index 25e039c..b23412c 100644
@@ -10,6 +10,7 @@
 #define IND_INDIRECTION  (1 << IND_INDIRECTION_BIT)
 #define IND_DONE         (1 << IND_DONE_BIT)
 #define IND_SOURCE       (1 << IND_SOURCE_BIT)
+#define IND_FLAGS (IND_DESTINATION | IND_INDIRECTION | IND_DONE | IND_SOURCE)
 
 #if !defined(__ASSEMBLY__)
 
Signature · 7 lines
1.9.1


_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec