public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* RE: [PATCH v3 5/5] RFC: fw_cfg: add DMA write operation in sysfs
@ 2017-10-30 11:07 Hatayama, Daisuke
  2017-10-30 16:19 ` Michael S. Tsirkin
  0 siblings, 1 reply; 5+ messages in thread
From: Hatayama, Daisuke @ 2017-10-30 11:07 UTC (permalink / raw)
  To: 'marcandre.lureau@redhat.com'
  Cc: 'somlo@cmu.edu', 'mst@redhat.com',
	linux-kernel@vger.kernel.org, 'qemu-devel@nongnu.org'

> From: Marc-André Lureau <marcandre.lureau@redhat.com>
>
> Since qemu 2.9, DMA write operations are allowed. However, usage of this
> interface from kernel or user-space is strongly discouraged by the
> maintainers. This patch is meant for experimentations for now.
>

Could you (or maintainers?) tell me how experimental the DMA write
operations from kernel are?

>From some technical reason?
Or simply there has not been enough test yet so far?

> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
>  drivers/firmware/qemu_fw_cfg.c | 21 ++++++++++++++++++++-
>  1 file changed, 20 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/firmware/qemu_fw_cfg.c b/drivers/firmware/qemu_fw_cfg.c
> index 54b569da3257..e2f2ad1c9c0c 100644
> --- a/drivers/firmware/qemu_fw_cfg.c
> +++ b/drivers/firmware/qemu_fw_cfg.c
> @@ -524,9 +524,28 @@ static ssize_t fw_cfg_sysfs_read_raw(struct file *filp, struct kobject *kobj,
>       return fw_cfg_read_blob(entry->f.select, buf, pos, count, true);
>  }
>
> +static ssize_t fw_cfg_sysfs_write_raw(struct file *filp, struct kobject *kobj,
> +                                   struct bin_attribute *bin_attr,
> +                                   char *buf, loff_t pos, size_t count)
> +{
> +     struct fw_cfg_sysfs_entry *entry = to_entry(kobj);
> +
> +     if (!fw_cfg_dma_enabled())
> +             return -ENOTSUPP;
> +
> +     if (pos > entry->f.size)
> +             return -EINVAL;
> +
> +     if (count > entry->f.size - pos)
> +             count = entry->f.size - pos;
> +
> +     return fw_cfg_write_blob(entry->f.select, buf, pos, count);
> +}
> +
>  static struct bin_attribute fw_cfg_sysfs_attr_raw = {
> -     .attr = { .name = "raw", .mode = S_IRUSR },
> +     .attr = { .name = "raw", .mode = S_IRUSR | S_IWUSR },
>       .read = fw_cfg_sysfs_read_raw,
> +     .write = fw_cfg_sysfs_write_raw,
>  };
>
>  /*
> --
> 2.14.1.146.gd35faa819

Thanks.
HATAYAMA, Daisuke

^ permalink raw reply	[flat|nested] 5+ messages in thread
* [PATCH v3 0/5] fw_cfg: add DMA operations & etc/vmcoreinfo support
@ 2017-09-22 13:24 marcandre.lureau
  2017-09-22 13:24 ` [PATCH v3 5/5] RFC: fw_cfg: add DMA write operation in sysfs marcandre.lureau
  0 siblings, 1 reply; 5+ messages in thread
From: marcandre.lureau @ 2017-09-22 13:24 UTC (permalink / raw)
  To: linux-kernel; +Cc: somlo, qemu-devel, mst, Marc-André Lureau

From: Marc-André Lureau <marcandre.lureau@redhat.com>

Hi,

This series brings DMA operations support to the fw_cfg kernel module
and provide "etc/vmcoreinfo" support.

At the current iteration of "[Qemu-devel] [PATCH v6 0/7] KASLR kernel
dump support" patch series, a "etc/vmcoreinfo" entry is added with
qemu -device vmcoreinfo, where the guest during boot or later, can
write the addr/size location of a ELF note to be appended in the qemu
dump.

v3: (thanks kbuild)
- add "fw_cfg: fix the command line module name" patch
- fix build of "fw_cfg: add DMA register" with CONFIG_FW_CFG_SYSFS_CMDLINE=y
- fix 'Wshift-count-overflow'

v2:
- use platform device for dma mapping
- add etc/vmcoreinfo patch
- some code cleanups

Marc-André Lureau (5):
  fw_cfg: fix the command line module name
  fw_cfg: add DMA register
  fw_cfg: do DMA read operation
  fw_cfg: write vmcoreinfo details
  RFC: fw_cfg: add DMA write operation in sysfs

 drivers/firmware/qemu_fw_cfg.c | 284 ++++++++++++++++++++++++++++++++++++-----
 1 file changed, 254 insertions(+), 30 deletions(-)

-- 
2.14.1.146.gd35faa819

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-10-31 17:06 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-30 11:07 [PATCH v3 5/5] RFC: fw_cfg: add DMA write operation in sysfs Hatayama, Daisuke
2017-10-30 16:19 ` Michael S. Tsirkin
2017-10-31  9:55   ` Hatayama, Daisuke
2017-10-31 17:06     ` Michael S. Tsirkin
  -- strict thread matches above, loose matches on Subject: below --
2017-09-22 13:24 [PATCH v3 0/5] fw_cfg: add DMA operations & etc/vmcoreinfo support marcandre.lureau
2017-09-22 13:24 ` [PATCH v3 5/5] RFC: fw_cfg: add DMA write operation in sysfs marcandre.lureau

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox