xen/kexec: Style fixes

Adjust kexec and kimage to more closely adhere to Xen style.

Sort the includes, dropping duplicates (kexec.h) and unused (ctype.h and
kernel.h).

No functional change.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Roger Pau Monné <roger.pau@citrix.com>
This commit is contained in:
Andrew Cooper committed 2026-06-30 16:46:42 +01:00
1 parent 7702e782f3
commit 505f2bda51
3 files changed
+49 -36

No files matched your search

+39 -25
View File
@@ -6,31 +6,33 @@
* - Magnus Damm <magnus@valinux.co.jp>
*/
#include <xen/init.h>
#include <xen/lib.h>
#include <xen/acpi.h>
#include <xen/ctype.h>
#include <xen/console.h>
#include <xen/cpu.h>
#include <xen/cpumask.h>
#include <xen/elfcore.h>
#include <xen/errno.h>
#include <xen/guest_access.h>
#include <xen/param.h>
#include <xen/watchdog.h>
#include <xen/sched.h>
#include <xen/types.h>
#include <xen/hypercall.h>
#include <xen/init.h>
#include <xen/kexec.h>
#include <xen/keyhandler.h>
#include <public/kexec.h>
#include <xen/cpumask.h>
#include <asm/atomic.h>
#include <xen/spinlock.h>
#include <xen/version.h>
#include <xen/console.h>
#include <xen/kexec.h>
#include <xen/kimage.h>
#include <public/elfnote.h>
#include <xen/lib.h>
#include <xen/param.h>
#include <xen/sched.h>
#include <xen/spinlock.h>
#include <xen/types.h>
#include <xen/version.h>
#include <xen/watchdog.h>
#include <asm/atomic.h>
#include <xsm/xsm.h>
#include <xen/cpu.h>
#include <public/elfnote.h>
#include <public/kexec.h>
#ifdef CONFIG_COMPAT
#include <compat/kexec.h>
#endif
@@ -38,7 +40,10 @@
bool __read_mostly kexecing;
/* Memory regions to store the per cpu register state etc. on a crash. */
typedef struct { Elf_Note * start; size_t size; } crash_note_range_t;
typedef struct {
Elf_Note *start;
size_t size;
} crash_note_range_t;
static crash_note_range_t *crash_notes;
/* Lock to prevent race conditions when allocating the crash note buffers.
@@ -65,7 +70,7 @@ static size_t vmcoreinfo_size = 0;
xen_kexec_reserve_t kexec_crash_area;
paddr_t __initdata kexec_crash_area_limit = ~(paddr_t)0;
static struct {
u64 start, end;
uint64_t start, end;
unsigned long size;
} ranges[16] __initdata;
@@ -162,6 +167,7 @@ static int __init cf_check parse_crashkernel(const char *str)
++idx;
} while ( *str == ',' );
if ( idx < ARRAY_SIZE(ranges) )
ranges[idx].size = 0;
}
@@ -232,7 +238,7 @@ custom_param("low_crashinfo", parse_low_crashinfo);
*/
static int __init cf_check parse_crashinfo_maxaddr(const char *str)
{
u64 addr;
uint64_t addr;
const char *q;
/* if low_crashinfo_mode is unset, default to min. */
@@ -252,7 +258,7 @@ static int __init cf_check parse_crashinfo_maxaddr(const char *str)
}
custom_param("crashinfo_maxaddr", parse_crashinfo_maxaddr);
void __init set_kexec_crash_area_size(u64 system_ram)
void __init set_kexec_crash_area_size(uint64_t system_ram)
{
unsigned int idx;
@@ -418,6 +424,7 @@ static void cf_check do_crashdump_trigger(unsigned char key)
static void setup_note(Elf_Note *n, const char *name, int type, int descsz)
{
int l = strlen(name) + 1;
strlcpy(ELFNOTE_NAME(n), name, l);
n->namesz = l;
n->descsz = descsz;
@@ -453,10 +460,13 @@ static size_t sizeof_cpu_notes(const unsigned long cpu)
static void *alloc_from_crash_heap(const size_t bytes)
{
void *ret;
if ( crash_heap_current + bytes > crash_heap_end )
return NULL;
ret = (void*)crash_heap_current;
ret = crash_heap_current;
crash_heap_current += bytes;
return ret;
}
@@ -548,9 +558,8 @@ static int cf_check cpu_callback(
* fail the CPU_UP_PREPARE */
kexec_init_cpu_notes(cpu);
break;
default:
break;
}
return NOTIFY_DONE;
}
@@ -620,7 +629,8 @@ presmp_initcall(kexec_init);
static int kexec_get_reserve(xen_kexec_range_t *range)
{
if ( kexec_crash_area.size > 0 && kexec_crash_area.start > 0) {
if ( kexec_crash_area.size > 0 && kexec_crash_area.start > 0 )
{
range->start = kexec_crash_area.start;
range->size = kexec_crash_area.size;
}
@@ -776,7 +786,7 @@ static void crash_save_vmcoreinfo(void)
{
size_t data_size;
if (vmcoreinfo_size > 0) /* already saved */
if ( vmcoreinfo_size > 0 )
return;
data_size = VMCOREINFO_BYTES - (sizeof(Elf_Note) + ELFNOTE_ALIGN(strlen(VMCOREINFO_NOTE_NAME) + 1));
@@ -841,6 +851,7 @@ static int kexec_exec(XEN_GUEST_HANDLE_PARAM(void) uarg)
image = kexec_image[base + pos];
ret = continue_hypercall_on_cpu(0, kexec_reboot, image);
break;
case KEXEC_TYPE_CRASH:
kexec_crash(CRASHREASON_KEXECCMD); /* Does not return */
break;
@@ -1010,12 +1021,15 @@ static int do_kexec_op_internal(unsigned long op,
case KEXEC_CMD_kexec:
ret = kexec_exec(uarg);
break;
case KEXEC_CMD_kexec_load:
ret = kexec_load(uarg);
break;
case KEXEC_CMD_kexec_unload:
ret = kexec_unload(uarg);
break;
case KEXEC_CMD_kexec_status:
ret = kexec_status(uarg);
break;
+9 -10
View File
@@ -11,15 +11,13 @@
* Version 2. See the file COPYING for more details.
*/
#include <xen/types.h>
#include <xen/init.h>
#include <xen/kernel.h>
#include <xen/errno.h>
#include <xen/spinlock.h>
#include <xen/guest_access.h>
#include <xen/mm.h>
#include <xen/init.h>
#include <xen/kexec.h>
#include <xen/kimage.h>
#include <xen/mm.h>
#include <xen/spinlock.h>
#include <asm/page.h>
@@ -221,8 +219,8 @@ static int kimage_crash_alloc(struct kexec_image **rimage, paddr_t entry,
unsigned long i;
/* Verify we have a valid entry point */
if ( (entry < kexec_crash_area.start)
|| (entry > kexec_crash_area.start + kexec_crash_area.size))
if ( entry < kexec_crash_area.start ||
entry > kexec_crash_area.start + kexec_crash_area.size )
return -EADDRNOTAVAIL;
/*
@@ -244,8 +242,8 @@ static int kimage_crash_alloc(struct kexec_image **rimage, paddr_t entry,
mstart = segments[i].dest_maddr;
mend = mstart + segments[i].dest_size;
/* Ensure we are within the crash kernel limits. */
if ( (mstart < kexec_crash_area.start )
|| (mend > kexec_crash_area.start + kexec_crash_area.size))
if ( mstart < kexec_crash_area.start ||
mend > kexec_crash_area.start + kexec_crash_area.size )
return -EADDRNOTAVAIL;
}
@@ -825,7 +823,8 @@ int kimage_load_segments(struct kexec_image *image)
int s;
int result;
for ( s = 0; s < image->nr_segments; s++ ) {
for ( s = 0; s < image->nr_segments; s++ )
{
result = kimage_load_segment(image, &image->segments[s]);
if ( result < 0 )
return result;
+1 -1
View File
@@ -19,7 +19,7 @@ extern paddr_t kexec_crash_area_limit;
extern bool kexecing;
void set_kexec_crash_area_size(u64 system_ram);
void set_kexec_crash_area_size(uint64_t system_ram);
/* We have space for 4 images to support atomic update
* of images. This is important for CRASH images since
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.