Re: [PATCH] load_elf: Remove unused address variables from callers
On Wed, Sep 23, 2020 at 2:15 PM BALATON Zoltan wrote: > > On Tue, 7 Jul 2020, BALATON Zoltan wrote: > > On Tue, 7 Jul 2020, Alistair Francis wrote: > >> On Sun, Jul 5, 2020 at 10:41 AM BALATON Zoltan wrote: > >>> Several callers of load_elf() pass pointers for lowaddr and highaddr > >>> parameters which are then not used for anything. This may stem from a > >>> misunderstanding that load_elf need a value here but in fact it can > >>> take NULL to ignore these values. Remove such unused variables and > >>> pass NULL instead from callers that don't need these. > >>> > >>> Signed-off-by: BALATON Zoltan > >> > >> Reviewed-by: Alistair Francis > > > > So this got a few review and acked by but since it touches multiple parts > > who > > will actually send pull or merge it? I'd like to make sure this won't miss > > the freeze deadline just because everybody thinks this should go in via some > > other maintainer. What's the best way for this? Trivial maintainers or Peter > > should handle such patches? > > Ping? Could someone please queue this patch? It still seems to apply > cleanly. I've got to send a register API PR, I'll add this one to it unless someone else wants to take it. Alistair > > Regards, > BALATON Zoltan > > >>> --- > >>> hw/alpha/dp264.c | 8 > >>> hw/arm/armv7m.c| 4 +--- > >>> hw/cris/boot.c | 4 ++-- > >>> hw/microblaze/boot.c | 4 ++-- > >>> hw/mips/fuloong2e.c| 8 > >>> hw/moxie/moxiesim.c| 4 ++-- > >>> hw/nios2/boot.c| 4 ++-- > >>> hw/ppc/mac_newworld.c | 6 ++ > >>> hw/ppc/mac_oldworld.c | 6 ++ > >>> hw/ppc/ppc440_bamboo.c | 9 +++-- > >>> hw/ppc/sam460ex.c | 12 +--- > >>> hw/ppc/spapr.c | 11 --- > >>> hw/ppc/virtex_ml507.c | 4 ++-- > >>> hw/riscv/boot.c| 8 > >>> hw/xtensa/sim.c| 3 +-- > >>> hw/xtensa/xtfpga.c | 3 +-- > >>> 16 files changed, 41 insertions(+), 57 deletions(-) > >>> > >>> diff --git a/hw/alpha/dp264.c b/hw/alpha/dp264.c > >>> index f7751b18f6..4d24518d1d 100644 > >>> --- a/hw/alpha/dp264.c > >>> +++ b/hw/alpha/dp264.c > >>> @@ -62,8 +62,8 @@ static void clipper_init(MachineState *machine) > >>> qemu_irq rtc_irq; > >>> long size, i; > >>> char *palcode_filename; > >>> -uint64_t palcode_entry, palcode_low, palcode_high; > >>> -uint64_t kernel_entry, kernel_low, kernel_high; > >>> +uint64_t palcode_entry; > >>> +uint64_t kernel_entry, kernel_low; > >>> unsigned int smp_cpus = machine->smp.cpus; > >>> > >>> /* Create up to 4 cpus. */ > >>> @@ -113,7 +113,7 @@ static void clipper_init(MachineState *machine) > >>> exit(1); > >>> } > >>> size = load_elf(palcode_filename, NULL, cpu_alpha_superpage_to_phys, > >>> -NULL, &palcode_entry, &palcode_low, &palcode_high, > >>> NULL, > >>> +NULL, &palcode_entry, NULL, NULL, NULL, > >>> 0, EM_ALPHA, 0, 0); > >>> if (size < 0) { > >>> error_report("could not load palcode '%s'", palcode_filename); > >>> @@ -132,7 +132,7 @@ static void clipper_init(MachineState *machine) > >>> uint64_t param_offset; > >>> > >>> size = load_elf(kernel_filename, NULL, > >>> cpu_alpha_superpage_to_phys, > >>> -NULL, &kernel_entry, &kernel_low, &kernel_high, > >>> NULL, > >>> +NULL, &kernel_entry, &kernel_low, NULL, NULL, > >>> 0, EM_ALPHA, 0, 0); > >>> if (size < 0) { > >>> error_report("could not load kernel '%s'", kernel_filename); > >>> diff --git a/hw/arm/armv7m.c b/hw/arm/armv7m.c > >>> index 3308211e9c..92f859d760 100644 > >>> --- a/hw/arm/armv7m.c > >>> +++ b/hw/arm/armv7m.c > >>> @@ -309,7 +309,6 @@ void armv7m_load_kernel(ARMCPU *cpu, const char > >>> *kernel_filename, int mem_size) > >>> { > >>> int image_size; > >>> uint64_t entry; > >>> -uint64_t lowaddr; > >>> int big_endian; > >>> AddressSpace *as; > >>> int asidx; > >>> @@ -330,12 +329,11 @@ void armv7m_load_kernel(ARMCPU *cpu, const char > >>> *kernel_filename, int mem_size) > >>> > >>> if (kernel_filename) { > >>> image_size = load_elf_as(kernel_filename, NULL, NULL, NULL, > >>> - &entry, &lowaddr, NULL, > >>> + &entry, NULL, NULL, > >>> NULL, big_endian, EM_ARM, 1, 0, as); > >>> if (image_size < 0) { > >>> image_size = load_image_targphys_as(kernel_filename, 0, > >>> mem_size, as); > >>> -lowaddr = 0; > >>> } > >>> if (image_size < 0) { > >>> error_report("Could not load kernel '%s'", kernel_filename); > >>> diff --git a/hw/cris/boot.c b/hw/cris/boot.c > >>> index b8947bc660..aa8d2756d6 100644 > >>> --- a/hw/cris/boot.c > >>> +++ b/hw/cris/boot
Re: [PATCH] load_elf: Remove unused address variables from callers
On Wed, 23 Sep 2020, BALATON Zoltan wrote: On Tue, 7 Jul 2020, BALATON Zoltan wrote: On Tue, 7 Jul 2020, Alistair Francis wrote: On Sun, Jul 5, 2020 at 10:41 AM BALATON Zoltan wrote: Several callers of load_elf() pass pointers for lowaddr and highaddr parameters which are then not used for anything. This may stem from a misunderstanding that load_elf need a value here but in fact it can take NULL to ignore these values. Remove such unused variables and pass NULL instead from callers that don't need these. Signed-off-by: BALATON Zoltan Reviewed-by: Alistair Francis So this got a few review and acked by but since it touches multiple parts who will actually send pull or merge it? I'd like to make sure this won't miss the freeze deadline just because everybody thinks this should go in via some other maintainer. What's the best way for this? Trivial maintainers or Peter should handle such patches? Ping? Could someone please queue this patch? It still seems to apply cleanly. Forgot to include the link to the original patch: http://patchwork.ozlabs.org/project/qemu-devel/patch/20200705174020.bdd01746...@zero.eik.bme.hu/ Regards, BALATON Zoltan --- hw/alpha/dp264.c | 8 hw/arm/armv7m.c| 4 +--- hw/cris/boot.c | 4 ++-- hw/microblaze/boot.c | 4 ++-- hw/mips/fuloong2e.c| 8 hw/moxie/moxiesim.c| 4 ++-- hw/nios2/boot.c| 4 ++-- hw/ppc/mac_newworld.c | 6 ++ hw/ppc/mac_oldworld.c | 6 ++ hw/ppc/ppc440_bamboo.c | 9 +++-- hw/ppc/sam460ex.c | 12 +--- hw/ppc/spapr.c | 11 --- hw/ppc/virtex_ml507.c | 4 ++-- hw/riscv/boot.c| 8 hw/xtensa/sim.c| 3 +-- hw/xtensa/xtfpga.c | 3 +-- 16 files changed, 41 insertions(+), 57 deletions(-) diff --git a/hw/alpha/dp264.c b/hw/alpha/dp264.c index f7751b18f6..4d24518d1d 100644 --- a/hw/alpha/dp264.c +++ b/hw/alpha/dp264.c @@ -62,8 +62,8 @@ static void clipper_init(MachineState *machine) qemu_irq rtc_irq; long size, i; char *palcode_filename; -uint64_t palcode_entry, palcode_low, palcode_high; -uint64_t kernel_entry, kernel_low, kernel_high; +uint64_t palcode_entry; +uint64_t kernel_entry, kernel_low; unsigned int smp_cpus = machine->smp.cpus; /* Create up to 4 cpus. */ @@ -113,7 +113,7 @@ static void clipper_init(MachineState *machine) exit(1); } size = load_elf(palcode_filename, NULL, cpu_alpha_superpage_to_phys, -NULL, &palcode_entry, &palcode_low, &palcode_high, NULL, +NULL, &palcode_entry, NULL, NULL, NULL, 0, EM_ALPHA, 0, 0); if (size < 0) { error_report("could not load palcode '%s'", palcode_filename); @@ -132,7 +132,7 @@ static void clipper_init(MachineState *machine) uint64_t param_offset; size = load_elf(kernel_filename, NULL, cpu_alpha_superpage_to_phys, -NULL, &kernel_entry, &kernel_low, &kernel_high, NULL, +NULL, &kernel_entry, &kernel_low, NULL, NULL, 0, EM_ALPHA, 0, 0); if (size < 0) { error_report("could not load kernel '%s'", kernel_filename); diff --git a/hw/arm/armv7m.c b/hw/arm/armv7m.c index 3308211e9c..92f859d760 100644 --- a/hw/arm/armv7m.c +++ b/hw/arm/armv7m.c @@ -309,7 +309,6 @@ void armv7m_load_kernel(ARMCPU *cpu, const char *kernel_filename, int mem_size) { int image_size; uint64_t entry; -uint64_t lowaddr; int big_endian; AddressSpace *as; int asidx; @@ -330,12 +329,11 @@ void armv7m_load_kernel(ARMCPU *cpu, const char *kernel_filename, int mem_size) if (kernel_filename) { image_size = load_elf_as(kernel_filename, NULL, NULL, NULL, - &entry, &lowaddr, NULL, + &entry, NULL, NULL, NULL, big_endian, EM_ARM, 1, 0, as); if (image_size < 0) { image_size = load_image_targphys_as(kernel_filename, 0, mem_size, as); -lowaddr = 0; } if (image_size < 0) { error_report("Could not load kernel '%s'", kernel_filename); diff --git a/hw/cris/boot.c b/hw/cris/boot.c index b8947bc660..aa8d2756d6 100644 --- a/hw/cris/boot.c +++ b/hw/cris/boot.c @@ -67,7 +67,7 @@ static uint64_t translate_kernel_address(void *opaque, uint64_t addr) void cris_load_image(CRISCPU *cpu, struct cris_load_info *li) { CPUCRISState *env = &cpu->env; -uint64_t entry, high; +uint64_t entry; int kcmdline_len; int image_size; @@ -76,7 +76,7 @@ void cris_load_image(CRISCPU *cpu, struct cris_load_info *li) devboard SDK. */ image_size = load_elf(li->image_filename, NULL, translate_kernel_address, NULL, - &entry, NULL, &high, NULL, 0, EM_C
Re: [PATCH] load_elf: Remove unused address variables from callers
On Tue, 7 Jul 2020, BALATON Zoltan wrote: On Tue, 7 Jul 2020, Alistair Francis wrote: On Sun, Jul 5, 2020 at 10:41 AM BALATON Zoltan wrote: Several callers of load_elf() pass pointers for lowaddr and highaddr parameters which are then not used for anything. This may stem from a misunderstanding that load_elf need a value here but in fact it can take NULL to ignore these values. Remove such unused variables and pass NULL instead from callers that don't need these. Signed-off-by: BALATON Zoltan Reviewed-by: Alistair Francis So this got a few review and acked by but since it touches multiple parts who will actually send pull or merge it? I'd like to make sure this won't miss the freeze deadline just because everybody thinks this should go in via some other maintainer. What's the best way for this? Trivial maintainers or Peter should handle such patches? Ping? Could someone please queue this patch? It still seems to apply cleanly. Regards, BALATON Zoltan --- hw/alpha/dp264.c | 8 hw/arm/armv7m.c| 4 +--- hw/cris/boot.c | 4 ++-- hw/microblaze/boot.c | 4 ++-- hw/mips/fuloong2e.c| 8 hw/moxie/moxiesim.c| 4 ++-- hw/nios2/boot.c| 4 ++-- hw/ppc/mac_newworld.c | 6 ++ hw/ppc/mac_oldworld.c | 6 ++ hw/ppc/ppc440_bamboo.c | 9 +++-- hw/ppc/sam460ex.c | 12 +--- hw/ppc/spapr.c | 11 --- hw/ppc/virtex_ml507.c | 4 ++-- hw/riscv/boot.c| 8 hw/xtensa/sim.c| 3 +-- hw/xtensa/xtfpga.c | 3 +-- 16 files changed, 41 insertions(+), 57 deletions(-) diff --git a/hw/alpha/dp264.c b/hw/alpha/dp264.c index f7751b18f6..4d24518d1d 100644 --- a/hw/alpha/dp264.c +++ b/hw/alpha/dp264.c @@ -62,8 +62,8 @@ static void clipper_init(MachineState *machine) qemu_irq rtc_irq; long size, i; char *palcode_filename; -uint64_t palcode_entry, palcode_low, palcode_high; -uint64_t kernel_entry, kernel_low, kernel_high; +uint64_t palcode_entry; +uint64_t kernel_entry, kernel_low; unsigned int smp_cpus = machine->smp.cpus; /* Create up to 4 cpus. */ @@ -113,7 +113,7 @@ static void clipper_init(MachineState *machine) exit(1); } size = load_elf(palcode_filename, NULL, cpu_alpha_superpage_to_phys, -NULL, &palcode_entry, &palcode_low, &palcode_high, NULL, +NULL, &palcode_entry, NULL, NULL, NULL, 0, EM_ALPHA, 0, 0); if (size < 0) { error_report("could not load palcode '%s'", palcode_filename); @@ -132,7 +132,7 @@ static void clipper_init(MachineState *machine) uint64_t param_offset; size = load_elf(kernel_filename, NULL, cpu_alpha_superpage_to_phys, -NULL, &kernel_entry, &kernel_low, &kernel_high, NULL, +NULL, &kernel_entry, &kernel_low, NULL, NULL, 0, EM_ALPHA, 0, 0); if (size < 0) { error_report("could not load kernel '%s'", kernel_filename); diff --git a/hw/arm/armv7m.c b/hw/arm/armv7m.c index 3308211e9c..92f859d760 100644 --- a/hw/arm/armv7m.c +++ b/hw/arm/armv7m.c @@ -309,7 +309,6 @@ void armv7m_load_kernel(ARMCPU *cpu, const char *kernel_filename, int mem_size) { int image_size; uint64_t entry; -uint64_t lowaddr; int big_endian; AddressSpace *as; int asidx; @@ -330,12 +329,11 @@ void armv7m_load_kernel(ARMCPU *cpu, const char *kernel_filename, int mem_size) if (kernel_filename) { image_size = load_elf_as(kernel_filename, NULL, NULL, NULL, - &entry, &lowaddr, NULL, + &entry, NULL, NULL, NULL, big_endian, EM_ARM, 1, 0, as); if (image_size < 0) { image_size = load_image_targphys_as(kernel_filename, 0, mem_size, as); -lowaddr = 0; } if (image_size < 0) { error_report("Could not load kernel '%s'", kernel_filename); diff --git a/hw/cris/boot.c b/hw/cris/boot.c index b8947bc660..aa8d2756d6 100644 --- a/hw/cris/boot.c +++ b/hw/cris/boot.c @@ -67,7 +67,7 @@ static uint64_t translate_kernel_address(void *opaque, uint64_t addr) void cris_load_image(CRISCPU *cpu, struct cris_load_info *li) { CPUCRISState *env = &cpu->env; -uint64_t entry, high; +uint64_t entry; int kcmdline_len; int image_size; @@ -76,7 +76,7 @@ void cris_load_image(CRISCPU *cpu, struct cris_load_info *li) devboard SDK. */ image_size = load_elf(li->image_filename, NULL, translate_kernel_address, NULL, - &entry, NULL, &high, NULL, 0, EM_CRIS, 0, 0); + &entry, NULL, NULL, NULL, 0, EM_CRIS, 0, 0); li->entry = entry; if (image_size < 0) { /* Takes a kimage from the axis devboard SDK. */
Re: [PATCH] load_elf: Remove unused address variables from callers
On Sun, Jul 5, 2020 at 10:40 AM BALATON Zoltan wrote: > > Several callers of load_elf() pass pointers for lowaddr and highaddr > parameters which are then not used for anything. This may stem from a > misunderstanding that load_elf need a value here but in fact it can > take NULL to ignore these values. Remove such unused variables and > pass NULL instead from callers that don't need these. > > Signed-off-by: BALATON Zoltan > --- [...] > hw/xtensa/sim.c| 3 +-- > hw/xtensa/xtfpga.c | 3 +-- For Xtensa parts: Acked-by: Max Filippov -- Thanks. -- Max
Re: [PATCH] load_elf: Remove unused address variables from callers
On Tue, 7 Jul 2020, Alistair Francis wrote: On Sun, Jul 5, 2020 at 10:41 AM BALATON Zoltan wrote: Several callers of load_elf() pass pointers for lowaddr and highaddr parameters which are then not used for anything. This may stem from a misunderstanding that load_elf need a value here but in fact it can take NULL to ignore these values. Remove such unused variables and pass NULL instead from callers that don't need these. Signed-off-by: BALATON Zoltan Reviewed-by: Alistair Francis So this got a few review and acked by but since it touches multiple parts who will actually send pull or merge it? I'd like to make sure this won't miss the freeze deadline just because everybody thinks this should go in via some other maintainer. What's the best way for this? Trivial maintainers or Peter should handle such patches? Regards, BALATON Zoltan Alistair --- hw/alpha/dp264.c | 8 hw/arm/armv7m.c| 4 +--- hw/cris/boot.c | 4 ++-- hw/microblaze/boot.c | 4 ++-- hw/mips/fuloong2e.c| 8 hw/moxie/moxiesim.c| 4 ++-- hw/nios2/boot.c| 4 ++-- hw/ppc/mac_newworld.c | 6 ++ hw/ppc/mac_oldworld.c | 6 ++ hw/ppc/ppc440_bamboo.c | 9 +++-- hw/ppc/sam460ex.c | 12 +--- hw/ppc/spapr.c | 11 --- hw/ppc/virtex_ml507.c | 4 ++-- hw/riscv/boot.c| 8 hw/xtensa/sim.c| 3 +-- hw/xtensa/xtfpga.c | 3 +-- 16 files changed, 41 insertions(+), 57 deletions(-) diff --git a/hw/alpha/dp264.c b/hw/alpha/dp264.c index f7751b18f6..4d24518d1d 100644 --- a/hw/alpha/dp264.c +++ b/hw/alpha/dp264.c @@ -62,8 +62,8 @@ static void clipper_init(MachineState *machine) qemu_irq rtc_irq; long size, i; char *palcode_filename; -uint64_t palcode_entry, palcode_low, palcode_high; -uint64_t kernel_entry, kernel_low, kernel_high; +uint64_t palcode_entry; +uint64_t kernel_entry, kernel_low; unsigned int smp_cpus = machine->smp.cpus; /* Create up to 4 cpus. */ @@ -113,7 +113,7 @@ static void clipper_init(MachineState *machine) exit(1); } size = load_elf(palcode_filename, NULL, cpu_alpha_superpage_to_phys, -NULL, &palcode_entry, &palcode_low, &palcode_high, NULL, +NULL, &palcode_entry, NULL, NULL, NULL, 0, EM_ALPHA, 0, 0); if (size < 0) { error_report("could not load palcode '%s'", palcode_filename); @@ -132,7 +132,7 @@ static void clipper_init(MachineState *machine) uint64_t param_offset; size = load_elf(kernel_filename, NULL, cpu_alpha_superpage_to_phys, -NULL, &kernel_entry, &kernel_low, &kernel_high, NULL, +NULL, &kernel_entry, &kernel_low, NULL, NULL, 0, EM_ALPHA, 0, 0); if (size < 0) { error_report("could not load kernel '%s'", kernel_filename); diff --git a/hw/arm/armv7m.c b/hw/arm/armv7m.c index 3308211e9c..92f859d760 100644 --- a/hw/arm/armv7m.c +++ b/hw/arm/armv7m.c @@ -309,7 +309,6 @@ void armv7m_load_kernel(ARMCPU *cpu, const char *kernel_filename, int mem_size) { int image_size; uint64_t entry; -uint64_t lowaddr; int big_endian; AddressSpace *as; int asidx; @@ -330,12 +329,11 @@ void armv7m_load_kernel(ARMCPU *cpu, const char *kernel_filename, int mem_size) if (kernel_filename) { image_size = load_elf_as(kernel_filename, NULL, NULL, NULL, - &entry, &lowaddr, NULL, + &entry, NULL, NULL, NULL, big_endian, EM_ARM, 1, 0, as); if (image_size < 0) { image_size = load_image_targphys_as(kernel_filename, 0, mem_size, as); -lowaddr = 0; } if (image_size < 0) { error_report("Could not load kernel '%s'", kernel_filename); diff --git a/hw/cris/boot.c b/hw/cris/boot.c index b8947bc660..aa8d2756d6 100644 --- a/hw/cris/boot.c +++ b/hw/cris/boot.c @@ -67,7 +67,7 @@ static uint64_t translate_kernel_address(void *opaque, uint64_t addr) void cris_load_image(CRISCPU *cpu, struct cris_load_info *li) { CPUCRISState *env = &cpu->env; -uint64_t entry, high; +uint64_t entry; int kcmdline_len; int image_size; @@ -76,7 +76,7 @@ void cris_load_image(CRISCPU *cpu, struct cris_load_info *li) devboard SDK. */ image_size = load_elf(li->image_filename, NULL, translate_kernel_address, NULL, - &entry, NULL, &high, NULL, 0, EM_CRIS, 0, 0); + &entry, NULL, NULL, NULL, 0, EM_CRIS, 0, 0); li->entry = entry; if (image_size < 0) { /* Takes a kimage from the axis devboard SDK. */ diff --git a/hw/microblaze/boot.c b/hw/microblaze/boot.c index 925e3f7c9d..8ad3c27f2c 100644 --- a/hw/microblaze/boot.c ++
Re: [PATCH] load_elf: Remove unused address variables from callers
On Sun, Jul 5, 2020 at 10:41 AM BALATON Zoltan wrote: > > Several callers of load_elf() pass pointers for lowaddr and highaddr > parameters which are then not used for anything. This may stem from a > misunderstanding that load_elf need a value here but in fact it can > take NULL to ignore these values. Remove such unused variables and > pass NULL instead from callers that don't need these. > > Signed-off-by: BALATON Zoltan Reviewed-by: Alistair Francis Alistair > --- > hw/alpha/dp264.c | 8 > hw/arm/armv7m.c| 4 +--- > hw/cris/boot.c | 4 ++-- > hw/microblaze/boot.c | 4 ++-- > hw/mips/fuloong2e.c| 8 > hw/moxie/moxiesim.c| 4 ++-- > hw/nios2/boot.c| 4 ++-- > hw/ppc/mac_newworld.c | 6 ++ > hw/ppc/mac_oldworld.c | 6 ++ > hw/ppc/ppc440_bamboo.c | 9 +++-- > hw/ppc/sam460ex.c | 12 +--- > hw/ppc/spapr.c | 11 --- > hw/ppc/virtex_ml507.c | 4 ++-- > hw/riscv/boot.c| 8 > hw/xtensa/sim.c| 3 +-- > hw/xtensa/xtfpga.c | 3 +-- > 16 files changed, 41 insertions(+), 57 deletions(-) > > diff --git a/hw/alpha/dp264.c b/hw/alpha/dp264.c > index f7751b18f6..4d24518d1d 100644 > --- a/hw/alpha/dp264.c > +++ b/hw/alpha/dp264.c > @@ -62,8 +62,8 @@ static void clipper_init(MachineState *machine) > qemu_irq rtc_irq; > long size, i; > char *palcode_filename; > -uint64_t palcode_entry, palcode_low, palcode_high; > -uint64_t kernel_entry, kernel_low, kernel_high; > +uint64_t palcode_entry; > +uint64_t kernel_entry, kernel_low; > unsigned int smp_cpus = machine->smp.cpus; > > /* Create up to 4 cpus. */ > @@ -113,7 +113,7 @@ static void clipper_init(MachineState *machine) > exit(1); > } > size = load_elf(palcode_filename, NULL, cpu_alpha_superpage_to_phys, > -NULL, &palcode_entry, &palcode_low, &palcode_high, NULL, > +NULL, &palcode_entry, NULL, NULL, NULL, > 0, EM_ALPHA, 0, 0); > if (size < 0) { > error_report("could not load palcode '%s'", palcode_filename); > @@ -132,7 +132,7 @@ static void clipper_init(MachineState *machine) > uint64_t param_offset; > > size = load_elf(kernel_filename, NULL, cpu_alpha_superpage_to_phys, > -NULL, &kernel_entry, &kernel_low, &kernel_high, NULL, > +NULL, &kernel_entry, &kernel_low, NULL, NULL, > 0, EM_ALPHA, 0, 0); > if (size < 0) { > error_report("could not load kernel '%s'", kernel_filename); > diff --git a/hw/arm/armv7m.c b/hw/arm/armv7m.c > index 3308211e9c..92f859d760 100644 > --- a/hw/arm/armv7m.c > +++ b/hw/arm/armv7m.c > @@ -309,7 +309,6 @@ void armv7m_load_kernel(ARMCPU *cpu, const char > *kernel_filename, int mem_size) > { > int image_size; > uint64_t entry; > -uint64_t lowaddr; > int big_endian; > AddressSpace *as; > int asidx; > @@ -330,12 +329,11 @@ void armv7m_load_kernel(ARMCPU *cpu, const char > *kernel_filename, int mem_size) > > if (kernel_filename) { > image_size = load_elf_as(kernel_filename, NULL, NULL, NULL, > - &entry, &lowaddr, NULL, > + &entry, NULL, NULL, > NULL, big_endian, EM_ARM, 1, 0, as); > if (image_size < 0) { > image_size = load_image_targphys_as(kernel_filename, 0, > mem_size, as); > -lowaddr = 0; > } > if (image_size < 0) { > error_report("Could not load kernel '%s'", kernel_filename); > diff --git a/hw/cris/boot.c b/hw/cris/boot.c > index b8947bc660..aa8d2756d6 100644 > --- a/hw/cris/boot.c > +++ b/hw/cris/boot.c > @@ -67,7 +67,7 @@ static uint64_t translate_kernel_address(void *opaque, > uint64_t addr) > void cris_load_image(CRISCPU *cpu, struct cris_load_info *li) > { > CPUCRISState *env = &cpu->env; > -uint64_t entry, high; > +uint64_t entry; > int kcmdline_len; > int image_size; > > @@ -76,7 +76,7 @@ void cris_load_image(CRISCPU *cpu, struct cris_load_info > *li) > devboard SDK. */ > image_size = load_elf(li->image_filename, NULL, >translate_kernel_address, NULL, > - &entry, NULL, &high, NULL, 0, EM_CRIS, 0, 0); > + &entry, NULL, NULL, NULL, 0, EM_CRIS, 0, 0); > li->entry = entry; > if (image_size < 0) { > /* Takes a kimage from the axis devboard SDK. */ > diff --git a/hw/microblaze/boot.c b/hw/microblaze/boot.c > index 925e3f7c9d..8ad3c27f2c 100644 > --- a/hw/microblaze/boot.c > +++ b/hw/microblaze/boot.c > @@ -135,7 +135,7 @@ void microblaze_load_kernel(MicroBlazeCPU *cpu, hwaddr > ddr_base, > > if (kernel_filename) { > int kernel_size; > -uint
Re: [PATCH] load_elf: Remove unused address variables from callers
On Sun, Jul 05, 2020 at 07:22:11PM +0200, BALATON Zoltan wrote: > Several callers of load_elf() pass pointers for lowaddr and highaddr > parameters which are then not used for anything. This may stem from a > misunderstanding that load_elf need a value here but in fact it can > take NULL to ignore these values. Remove such unused variables and > pass NULL instead from callers that don't need these. > > Signed-off-by: BALATON Zoltan Reviewed-by: David Gibson ppc parts Acked-by: David Gibson > --- > hw/alpha/dp264.c | 8 > hw/arm/armv7m.c| 4 +--- > hw/cris/boot.c | 4 ++-- > hw/microblaze/boot.c | 4 ++-- > hw/mips/fuloong2e.c| 8 > hw/moxie/moxiesim.c| 4 ++-- > hw/nios2/boot.c| 4 ++-- > hw/ppc/mac_newworld.c | 6 ++ > hw/ppc/mac_oldworld.c | 6 ++ > hw/ppc/ppc440_bamboo.c | 9 +++-- > hw/ppc/sam460ex.c | 12 +--- > hw/ppc/spapr.c | 11 --- > hw/ppc/virtex_ml507.c | 4 ++-- > hw/riscv/boot.c| 8 > hw/xtensa/sim.c| 3 +-- > hw/xtensa/xtfpga.c | 3 +-- > 16 files changed, 41 insertions(+), 57 deletions(-) > > diff --git a/hw/alpha/dp264.c b/hw/alpha/dp264.c > index f7751b18f6..4d24518d1d 100644 > --- a/hw/alpha/dp264.c > +++ b/hw/alpha/dp264.c > @@ -62,8 +62,8 @@ static void clipper_init(MachineState *machine) > qemu_irq rtc_irq; > long size, i; > char *palcode_filename; > -uint64_t palcode_entry, palcode_low, palcode_high; > -uint64_t kernel_entry, kernel_low, kernel_high; > +uint64_t palcode_entry; > +uint64_t kernel_entry, kernel_low; > unsigned int smp_cpus = machine->smp.cpus; > > /* Create up to 4 cpus. */ > @@ -113,7 +113,7 @@ static void clipper_init(MachineState *machine) > exit(1); > } > size = load_elf(palcode_filename, NULL, cpu_alpha_superpage_to_phys, > -NULL, &palcode_entry, &palcode_low, &palcode_high, NULL, > +NULL, &palcode_entry, NULL, NULL, NULL, > 0, EM_ALPHA, 0, 0); > if (size < 0) { > error_report("could not load palcode '%s'", palcode_filename); > @@ -132,7 +132,7 @@ static void clipper_init(MachineState *machine) > uint64_t param_offset; > > size = load_elf(kernel_filename, NULL, cpu_alpha_superpage_to_phys, > -NULL, &kernel_entry, &kernel_low, &kernel_high, NULL, > +NULL, &kernel_entry, &kernel_low, NULL, NULL, > 0, EM_ALPHA, 0, 0); > if (size < 0) { > error_report("could not load kernel '%s'", kernel_filename); > diff --git a/hw/arm/armv7m.c b/hw/arm/armv7m.c > index 3308211e9c..92f859d760 100644 > --- a/hw/arm/armv7m.c > +++ b/hw/arm/armv7m.c > @@ -309,7 +309,6 @@ void armv7m_load_kernel(ARMCPU *cpu, const char > *kernel_filename, int mem_size) > { > int image_size; > uint64_t entry; > -uint64_t lowaddr; > int big_endian; > AddressSpace *as; > int asidx; > @@ -330,12 +329,11 @@ void armv7m_load_kernel(ARMCPU *cpu, const char > *kernel_filename, int mem_size) > > if (kernel_filename) { > image_size = load_elf_as(kernel_filename, NULL, NULL, NULL, > - &entry, &lowaddr, NULL, > + &entry, NULL, NULL, > NULL, big_endian, EM_ARM, 1, 0, as); > if (image_size < 0) { > image_size = load_image_targphys_as(kernel_filename, 0, > mem_size, as); > -lowaddr = 0; > } > if (image_size < 0) { > error_report("Could not load kernel '%s'", kernel_filename); > diff --git a/hw/cris/boot.c b/hw/cris/boot.c > index b8947bc660..aa8d2756d6 100644 > --- a/hw/cris/boot.c > +++ b/hw/cris/boot.c > @@ -67,7 +67,7 @@ static uint64_t translate_kernel_address(void *opaque, > uint64_t addr) > void cris_load_image(CRISCPU *cpu, struct cris_load_info *li) > { > CPUCRISState *env = &cpu->env; > -uint64_t entry, high; > +uint64_t entry; > int kcmdline_len; > int image_size; > > @@ -76,7 +76,7 @@ void cris_load_image(CRISCPU *cpu, struct cris_load_info > *li) > devboard SDK. */ > image_size = load_elf(li->image_filename, NULL, >translate_kernel_address, NULL, > - &entry, NULL, &high, NULL, 0, EM_CRIS, 0, 0); > + &entry, NULL, NULL, NULL, 0, EM_CRIS, 0, 0); > li->entry = entry; > if (image_size < 0) { > /* Takes a kimage from the axis devboard SDK. */ > diff --git a/hw/microblaze/boot.c b/hw/microblaze/boot.c > index 925e3f7c9d..8ad3c27f2c 100644 > --- a/hw/microblaze/boot.c > +++ b/hw/microblaze/boot.c > @@ -135,7 +135,7 @@ void microblaze_load_kernel(MicroBlazeCPU *cpu, hwaddr > ddr_base, > > if (kernel_filename) { >
[PATCH] load_elf: Remove unused address variables from callers
Several callers of load_elf() pass pointers for lowaddr and highaddr parameters which are then not used for anything. This may stem from a misunderstanding that load_elf need a value here but in fact it can take NULL to ignore these values. Remove such unused variables and pass NULL instead from callers that don't need these. Signed-off-by: BALATON Zoltan --- hw/alpha/dp264.c | 8 hw/arm/armv7m.c| 4 +--- hw/cris/boot.c | 4 ++-- hw/microblaze/boot.c | 4 ++-- hw/mips/fuloong2e.c| 8 hw/moxie/moxiesim.c| 4 ++-- hw/nios2/boot.c| 4 ++-- hw/ppc/mac_newworld.c | 6 ++ hw/ppc/mac_oldworld.c | 6 ++ hw/ppc/ppc440_bamboo.c | 9 +++-- hw/ppc/sam460ex.c | 12 +--- hw/ppc/spapr.c | 11 --- hw/ppc/virtex_ml507.c | 4 ++-- hw/riscv/boot.c| 8 hw/xtensa/sim.c| 3 +-- hw/xtensa/xtfpga.c | 3 +-- 16 files changed, 41 insertions(+), 57 deletions(-) diff --git a/hw/alpha/dp264.c b/hw/alpha/dp264.c index f7751b18f6..4d24518d1d 100644 --- a/hw/alpha/dp264.c +++ b/hw/alpha/dp264.c @@ -62,8 +62,8 @@ static void clipper_init(MachineState *machine) qemu_irq rtc_irq; long size, i; char *palcode_filename; -uint64_t palcode_entry, palcode_low, palcode_high; -uint64_t kernel_entry, kernel_low, kernel_high; +uint64_t palcode_entry; +uint64_t kernel_entry, kernel_low; unsigned int smp_cpus = machine->smp.cpus; /* Create up to 4 cpus. */ @@ -113,7 +113,7 @@ static void clipper_init(MachineState *machine) exit(1); } size = load_elf(palcode_filename, NULL, cpu_alpha_superpage_to_phys, -NULL, &palcode_entry, &palcode_low, &palcode_high, NULL, +NULL, &palcode_entry, NULL, NULL, NULL, 0, EM_ALPHA, 0, 0); if (size < 0) { error_report("could not load palcode '%s'", palcode_filename); @@ -132,7 +132,7 @@ static void clipper_init(MachineState *machine) uint64_t param_offset; size = load_elf(kernel_filename, NULL, cpu_alpha_superpage_to_phys, -NULL, &kernel_entry, &kernel_low, &kernel_high, NULL, +NULL, &kernel_entry, &kernel_low, NULL, NULL, 0, EM_ALPHA, 0, 0); if (size < 0) { error_report("could not load kernel '%s'", kernel_filename); diff --git a/hw/arm/armv7m.c b/hw/arm/armv7m.c index 3308211e9c..92f859d760 100644 --- a/hw/arm/armv7m.c +++ b/hw/arm/armv7m.c @@ -309,7 +309,6 @@ void armv7m_load_kernel(ARMCPU *cpu, const char *kernel_filename, int mem_size) { int image_size; uint64_t entry; -uint64_t lowaddr; int big_endian; AddressSpace *as; int asidx; @@ -330,12 +329,11 @@ void armv7m_load_kernel(ARMCPU *cpu, const char *kernel_filename, int mem_size) if (kernel_filename) { image_size = load_elf_as(kernel_filename, NULL, NULL, NULL, - &entry, &lowaddr, NULL, + &entry, NULL, NULL, NULL, big_endian, EM_ARM, 1, 0, as); if (image_size < 0) { image_size = load_image_targphys_as(kernel_filename, 0, mem_size, as); -lowaddr = 0; } if (image_size < 0) { error_report("Could not load kernel '%s'", kernel_filename); diff --git a/hw/cris/boot.c b/hw/cris/boot.c index b8947bc660..aa8d2756d6 100644 --- a/hw/cris/boot.c +++ b/hw/cris/boot.c @@ -67,7 +67,7 @@ static uint64_t translate_kernel_address(void *opaque, uint64_t addr) void cris_load_image(CRISCPU *cpu, struct cris_load_info *li) { CPUCRISState *env = &cpu->env; -uint64_t entry, high; +uint64_t entry; int kcmdline_len; int image_size; @@ -76,7 +76,7 @@ void cris_load_image(CRISCPU *cpu, struct cris_load_info *li) devboard SDK. */ image_size = load_elf(li->image_filename, NULL, translate_kernel_address, NULL, - &entry, NULL, &high, NULL, 0, EM_CRIS, 0, 0); + &entry, NULL, NULL, NULL, 0, EM_CRIS, 0, 0); li->entry = entry; if (image_size < 0) { /* Takes a kimage from the axis devboard SDK. */ diff --git a/hw/microblaze/boot.c b/hw/microblaze/boot.c index 925e3f7c9d..8ad3c27f2c 100644 --- a/hw/microblaze/boot.c +++ b/hw/microblaze/boot.c @@ -135,7 +135,7 @@ void microblaze_load_kernel(MicroBlazeCPU *cpu, hwaddr ddr_base, if (kernel_filename) { int kernel_size; -uint64_t entry, low, high; +uint64_t entry, high; uint32_t base32; int big_endian = 0; @@ -145,7 +145,7 @@ void microblaze_load_kernel(MicroBlazeCPU *cpu, hwaddr ddr_base, /* Boots a kernel elf binary. */ kernel_size = load_elf(kernel_filename, NULL, NULL, NULL, -