From: "Michael S. Tsirkin" <mst@redhat.com>
To: "Marc-André Lureau" <marcandre.lureau@redhat.com>
Cc: qemu-devel@nongnu.org, ehabkost@redhat.com, anderson@redhat.com,
imammedo@redhat.com, lersek@redhat.com
Subject: Re: [Qemu-devel] [PATCH v5 3/8] fw_cfg: add vmcoreinfo file
Date: Fri, 8 Sep 2017 15:32:08 +0300 [thread overview]
Message-ID: <20170908153004-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <20170807181618.22562-4-marcandre.lureau@redhat.com>
On Mon, Aug 07, 2017 at 08:16:13PM +0200, Marc-André Lureau wrote:
> See docs/specs/fw_cfg.txt for details.
>
> The "etc/vmcoreinfo" is added when using "-global
> fw_cfg.vmcoreinfo=on" qemu option.
>
> Disabled by default for machine types v2.9 and older.
>
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
I don't like it that it's part of the fw cfg device.
Could we make this off by default and only add this with
some -device?
Thanks,
MST
> ---
> include/hw/compat.h | 8 ++++++++
> include/hw/nvram/fw_cfg.h | 9 +++++++++
> hw/nvram/fw_cfg.c | 20 ++++++++++++++++++++
> docs/specs/fw_cfg.txt | 16 ++++++++++++++++
> 4 files changed, 53 insertions(+)
>
> diff --git a/include/hw/compat.h b/include/hw/compat.h
> index 08f36004da..317fd2e2e3 100644
> --- a/include/hw/compat.h
> +++ b/include/hw/compat.h
> @@ -18,6 +18,14 @@
> .driver = "pcie-root-port",\
> .property = "x-migrate-msix",\
> .value = "false",\
> + },{\
> + .driver = "fw_cfg_mem",\
> + .property = "vmcoreinfo",\
> + .value = "off",\
> + },{\
> + .driver = "fw_cfg_io",\
> + .property = "vmcoreinfo",\
> + .value = "off",\
> },
>
> #define HW_COMPAT_2_8 \
> diff --git a/include/hw/nvram/fw_cfg.h b/include/hw/nvram/fw_cfg.h
> index 3527cd51d8..a35f47405d 100644
> --- a/include/hw/nvram/fw_cfg.h
> +++ b/include/hw/nvram/fw_cfg.h
> @@ -30,6 +30,11 @@ typedef struct FWCfgFile {
> void fw_cfg_set_order_override(FWCfgState *fw_cfg, int order);
> void fw_cfg_reset_order_override(FWCfgState *fw_cfg);
>
> +typedef struct FWCfgVMCoreInfo {
> + uint64_t paddr;
> + uint32_t size;
> +} QEMU_PACKED FWCfgVMCoreInfo;
> +
> typedef struct FWCfgFiles {
> uint32_t count;
> FWCfgFile f[];
> @@ -65,6 +70,10 @@ struct FWCfgState {
> dma_addr_t dma_addr;
> AddressSpace *dma_as;
> MemoryRegion dma_iomem;
> +
> + bool vmcoreinfo_enabled;
> + bool has_vmcoreinfo;
> + FWCfgVMCoreInfo vmcoreinfo;
> };
>
> struct FWCfgIoState {
> diff --git a/hw/nvram/fw_cfg.c b/hw/nvram/fw_cfg.c
> index 28780088b9..342afc4ed2 100644
> --- a/hw/nvram/fw_cfg.c
> +++ b/hw/nvram/fw_cfg.c
> @@ -504,6 +504,7 @@ static void fw_cfg_reset(DeviceState *d)
>
> /* we never register a read callback for FW_CFG_SIGNATURE */
> fw_cfg_select(s, FW_CFG_SIGNATURE);
> + s->has_vmcoreinfo = false;
> }
>
> /* Save restore 32 bit int as uint16_t
> @@ -869,7 +870,12 @@ static void fw_cfg_machine_ready(struct Notifier *n, void *data)
> qemu_register_reset(fw_cfg_machine_reset, s);
> }
>
> +static void fw_cfg_vmci_written(void *dev)
> +{
> + FWCfgState *s = FW_CFG(dev);
>
> + s->has_vmcoreinfo = true;
> +}
>
> static void fw_cfg_common_realize(DeviceState *dev, Error **errp)
> {
> @@ -895,6 +901,16 @@ static void fw_cfg_common_realize(DeviceState *dev, Error **errp)
>
> fw_cfg_add_i32(s, FW_CFG_ID, version);
>
> + if (s->vmcoreinfo_enabled) {
> + if (!s->dma_enabled) {
> + error_setg(errp, "vmcoreinfo requires dma_enabled");
> + return;
> + }
> + fw_cfg_add_file_callback(s, "etc/vmcoreinfo",
> + NULL, fw_cfg_vmci_written, s,
> + &s->vmcoreinfo, sizeof(s->vmcoreinfo), false);
> + }
> +
> s->machine_ready.notify = fw_cfg_machine_ready;
> qemu_add_machine_init_done_notifier(&s->machine_ready);
> }
> @@ -1031,6 +1047,8 @@ static void fw_cfg_file_slots_allocate(FWCfgState *s, Error **errp)
> static Property fw_cfg_io_properties[] = {
> DEFINE_PROP_BOOL("dma_enabled", FWCfgIoState, parent_obj.dma_enabled,
> true),
> + DEFINE_PROP_BOOL("vmcoreinfo", FWCfgIoState, parent_obj.vmcoreinfo_enabled,
> + true),
> DEFINE_PROP_UINT16("x-file-slots", FWCfgIoState, parent_obj.file_slots,
> FW_CFG_FILE_SLOTS_DFLT),
> DEFINE_PROP_END_OF_LIST(),
> @@ -1082,6 +1100,8 @@ static Property fw_cfg_mem_properties[] = {
> DEFINE_PROP_UINT32("data_width", FWCfgMemState, data_width, -1),
> DEFINE_PROP_BOOL("dma_enabled", FWCfgMemState, parent_obj.dma_enabled,
> true),
> + DEFINE_PROP_BOOL("vmcoreinfo", FWCfgMemState, parent_obj.vmcoreinfo_enabled,
> + true),
> DEFINE_PROP_UINT16("x-file-slots", FWCfgMemState, parent_obj.file_slots,
> FW_CFG_FILE_SLOTS_DFLT),
> DEFINE_PROP_END_OF_LIST(),
> diff --git a/docs/specs/fw_cfg.txt b/docs/specs/fw_cfg.txt
> index 08c00bdf44..37d0f9f40a 100644
> --- a/docs/specs/fw_cfg.txt
> +++ b/docs/specs/fw_cfg.txt
> @@ -136,6 +136,22 @@ struct FWCfgFile { /* an individual file entry, 64 bytes total */
> char name[56]; /* fw_cfg item name, NUL-terminated ascii */
> };
>
> +=== etc/vmcoreinfo ===
> +
> +A guest may use this entry to add information details to qemu
> +dumps. The entry gives location and size of an ELF note that is
> +appended in qemu dumps.
> +
> +The entry is of 12 bytes with this format:
> +
> +struct FWCfgVMCoreInfo {
> + uint64_t paddr; /* physical address of ELF note, LE */
> + uint32_t size; /* size of ELF note region, LE */
> +};
> +
> +The note format/class must be of the target bitness and the size must
> +be less than 1Mb.
> +
> === All Other Data Items ===
>
> Please consult the QEMU source for the most up-to-date and authoritative list
> --
> 2.14.0.1.geff633fa0
>
next prev parent reply other threads:[~2017-09-08 12:32 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-07 18:16 [Qemu-devel] [PATCH v5 0/8] KASLR kernel dump support Marc-André Lureau
2017-08-07 18:16 ` [Qemu-devel] [PATCH v5 1/8] fw_cfg: rename read callback Marc-André Lureau
2017-08-07 18:16 ` [Qemu-devel] [PATCH v5 2/8] fw_cfg: add write callback Marc-André Lureau
2017-09-08 12:40 ` Michael S. Tsirkin
2017-08-07 18:16 ` [Qemu-devel] [PATCH v5 3/8] fw_cfg: add vmcoreinfo file Marc-André Lureau
2017-09-08 12:32 ` Michael S. Tsirkin [this message]
2017-09-08 12:36 ` Michael S. Tsirkin
2017-09-08 12:42 ` Michael S. Tsirkin
2017-09-08 15:39 ` Michael S. Tsirkin
2017-09-08 15:39 ` Michael S. Tsirkin
2017-09-08 15:49 ` Marc-André Lureau
2017-09-10 1:52 ` Michael S. Tsirkin
2017-08-07 18:16 ` [Qemu-devel] [PATCH v5 4/8] dump: add guest ELF note Marc-André Lureau
2017-08-07 18:16 ` [Qemu-devel] [PATCH v5 5/8] dump: update phys_base header field based on VMCOREINFO content Marc-André Lureau
2017-08-07 18:16 ` [Qemu-devel] [PATCH v5 6/8] kdump: set vmcoreinfo location Marc-André Lureau
2017-08-07 18:16 ` [Qemu-devel] [PATCH v5 7/8] scripts/dump-guest-memory.py: add vmcoreinfo Marc-André Lureau
2017-08-07 18:16 ` [Qemu-devel] [PATCH v5 8/8] MAINTAINERS: add Dump maintainers Marc-André Lureau
2017-08-16 20:15 ` [Qemu-devel] [PATCH v5 0/8] KASLR kernel dump support Michael S. Tsirkin
2017-09-08 12:46 ` Michael S. Tsirkin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170908153004-mutt-send-email-mst@kernel.org \
--to=mst@redhat.com \
--cc=anderson@redhat.com \
--cc=ehabkost@redhat.com \
--cc=imammedo@redhat.com \
--cc=lersek@redhat.com \
--cc=marcandre.lureau@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.