Re: [PATCH RFC 6/7] Revert "x86: return modified setup_data only if read as memory, not as file"

From: Jason A. Donenfeld
Date: Thu Feb 09 2023 - 10:52:44 EST


On Wed, Feb 08, 2023 at 04:12:51PM -0500, Michael S. Tsirkin wrote:
> This reverts commit e935b735085dfa61d8e6d276b6f9e7687796a3c7.
>
> Fixes: e935b73508 ("x86: return modified setup_data only if read as memory, not as file")
> Signed-off-by: Michael S. Tsirkin <mst@xxxxxxxxxx>
> ---
> include/hw/nvram/fw_cfg.h | 22 -------------------
> hw/i386/x86.c | 46 +++++++++------------------------------
> hw/nvram/fw_cfg.c | 12 +++++-----
> 3 files changed, 16 insertions(+), 64 deletions(-)
>
> diff --git a/include/hw/nvram/fw_cfg.h b/include/hw/nvram/fw_cfg.h
> index 2e503904dc..c1f81a5f13 100644
> --- a/include/hw/nvram/fw_cfg.h
> +++ b/include/hw/nvram/fw_cfg.h
> @@ -117,28 +117,6 @@ struct FWCfgMemState {
> */
> void fw_cfg_add_bytes(FWCfgState *s, uint16_t key, void *data, size_t len);
>
> -/**
> - * fw_cfg_add_bytes_callback:
> - * @s: fw_cfg device being modified
> - * @key: selector key value for new fw_cfg item
> - * @select_cb: callback function when selecting
> - * @write_cb: callback function after a write
> - * @callback_opaque: argument to be passed into callback function
> - * @data: pointer to start of item data
> - * @len: size of item data
> - * @read_only: is file read only
> - *
> - * Add a new fw_cfg item, available by selecting the given key, as a raw
> - * "blob" of the given size. The data referenced by the starting pointer
> - * is only linked, NOT copied, into the data structure of the fw_cfg device.
> - */
> -void fw_cfg_add_bytes_callback(FWCfgState *s, uint16_t key,
> - FWCfgCallback select_cb,
> - FWCfgWriteCallback write_cb,
> - void *callback_opaque,
> - void *data, size_t len,
> - bool read_only);
> -
> /**
> * fw_cfg_add_string:
> * @s: fw_cfg device being modified
> diff --git a/hw/nvram/fw_cfg.c b/hw/nvram/fw_cfg.c
> index a00881bc64..29a5bef1d5 100644
> --- a/hw/nvram/fw_cfg.c
> +++ b/hw/nvram/fw_cfg.c
> @@ -693,12 +693,12 @@ static const VMStateDescription vmstate_fw_cfg = {
> }
> };
>
> -void fw_cfg_add_bytes_callback(FWCfgState *s, uint16_t key,
> - FWCfgCallback select_cb,
> - FWCfgWriteCallback write_cb,
> - void *callback_opaque,
> - void *data, size_t len,
> - bool read_only)
> +static void fw_cfg_add_bytes_callback(FWCfgState *s, uint16_t key,
> + FWCfgCallback select_cb,
> + FWCfgWriteCallback write_cb,
> + void *callback_opaque,
> + void *data, size_t len,
> + bool read_only)
> {
> int arch = !!(key & FW_CFG_ARCH_LOCAL);

Could you leave these snippets in? This function is useful and will be
needed in the reprise.

Jason