Re: [PATCH v4 1/2] x86: return modified setup_data only if read as memory, not as file

2022-09-21 Thread Paolo Bonzini
On Wed, Sep 21, 2022 at 11:12 AM Jason A. Donenfeld wrote: > > Also I think it's cleaner if a reset callback puts the value back to > > zero. fw_cfg already has fw_cfg_machine_reset, so perhaps the easiest > > way is to add a FWCfgCallback reset_cb argument to just > > fw_cfg_add_bytes_callback. I

Re: [PATCH v4 1/2] x86: return modified setup_data only if read as memory, not as file

2022-09-21 Thread Jason A. Donenfeld
On Wed, Sep 21, 2022 at 11:15 AM Michael S. Tsirkin 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

Re: [PATCH v4 1/2] x86: return modified setup_data only if read as memory, not as file

2022-09-21 Thread Michael S. Tsirkin
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 containin

Re: [PATCH v4 1/2] x86: return modified setup_data only if read as memory, not as file

2022-09-21 Thread Jason A. Donenfeld
On Wed, Sep 21, 2022 at 11:04:17AM +0200, Jason A. Donenfeld wrote: > > Also I think it's cleaner if a reset callback puts the value back to > > zero. fw_cfg already has fw_cfg_machine_reset, so perhaps the easiest > > way is to add a FWCfgCallback reset_cb argument to just > > fw_cfg_add_bytes_cal

Re: [PATCH v4 1/2] x86: return modified setup_data only if read as memory, not as file

2022-09-21 Thread Jason A. Donenfeld
Hi Paolo, On Wed, Sep 21, 2022 at 10:59 AM Paolo Bonzini wrote: > Just a small comment, addr should be little-endian (see > fw_cfg_add_i32). It's not used outside x86_load_linux, so it is > possible to just use cpu_to_le32 there. Oh, shucks: I thought about this and then forgot to do it. Thanks

Re: [PATCH v4 1/2] x86: return modified setup_data only if read as memory, not as file

2022-09-21 Thread Paolo Bonzini
> 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; >

Re: [PATCH v4 1/2] x86: return modified setup_data only if read as memory, not as file

2022-09-16 Thread Ard Biesheuvel
On Wed, 14 Sept 2022 at 01:42, 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 ab

[PATCH v4 1/2] x86: return modified setup_data only if read as memory, not as file

2022-09-13 Thread Jason A. Donenfeld
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 i