On Wed, Sep 21, 2022 at 11:15 AM Michael S. Tsirkin <m...@redhat.com> wrote: > > On Wed, Sep 14, 2022 at 12:41:34AM +0100, Jason A. Donenfeld wrote: > > If setup_data is being read into a specific memory location, then > > generally the setup_data address parameter is read first, so that the > > caller knows where to read it into. In that case, we should return > > setup_data containing the absolute addresses that are hard coded and > > determined a priori. This is the case when kernels are loaded by BIOS, > > for example. In contrast, when setup_data is read as a file, then we > > shouldn't modify setup_data, since the absolute address will be wrong by > > definition. This is the case when OVMF loads the image. > > > > This allows setup_data to be used like normal, without crashing when EFI > > tries to use it. > > > > (As a small development note, strangely, fw_cfg_add_file_callback() was > > exported but fw_cfg_add_bytes_callback() wasn't, so this makes that > > consistent.) > > > > Cc: Gerd Hoffmann <kra...@redhat.com> > > Cc: Laurent Vivier <laur...@vivier.eu> > > Cc: Michael S. Tsirkin <m...@redhat.com> > > Cc: Paolo Bonzini <pbonz...@redhat.com> > > Cc: Peter Maydell <peter.mayd...@linaro.org> > > Cc: Philippe Mathieu-Daudé <f4...@amsat.org> > > Cc: Richard Henderson <richard.hender...@linaro.org> > > Suggested-by: Ard Biesheuvel <a...@kernel.org> > > Signed-off-by: Jason A. Donenfeld <ja...@zx2c4.com> > > --- > > hw/i386/x86.c | 37 +++++++++++++++++++++++++++---------- > > hw/nvram/fw_cfg.c | 12 ++++++------ > > include/hw/nvram/fw_cfg.h | 22 ++++++++++++++++++++++ > > 3 files changed, 55 insertions(+), 16 deletions(-) > > > > diff --git a/hw/i386/x86.c b/hw/i386/x86.c > > index 050eedc0c8..933bbdd836 100644 > > --- a/hw/i386/x86.c > > +++ b/hw/i386/x86.c > > @@ -764,6 +764,18 @@ static bool load_elfboot(const char *kernel_filename, > > return true; > > } > > > > +struct setup_data_fixup { > > + void *pos; > > + hwaddr val; > > + uint32_t addr; > > +}; > > + > > btw > > typedef struct SetupDataFixup { > void *pos; > hwaddr val; > uint32_t addr; > } SetupDataFixup; > > > and use typedef everywhere.
Okay no problem. Will do for v5. Jason