linux-api.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Gabriel L. Somlo" <somlo@cmu.edu>
To: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"Richard W.M. Jones" <rjones@redhat.com>,
	Jordan Justen <jordan.l.justen@intel.com>,
	"x86@kernel.org" <x86@kernel.org>,
	QEMU Developers <qemu-devel@nongnu.org>,
	Gleb Natapov <gleb@cloudius-systems.com>,
	Matt Fleming <matt.fleming@intel.com>,
	kernelnewbies@kernelnewbies.org,
	Gerd Hoffmann <kraxel@redhat.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Laszlo Ersek <lersek@redhat.com>,
	"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
	ralf@linux-mips.org, zajec5@gmail.com, paul@pwsan.com,
	Kumar Gala <galak@codeaurora.org>,
	linux-api@vger.kernel.org,
	Leif Lindholm <leif.lindholm@linaro.org>
Subject: Re: [PATCH v2 0/3] SysFS driver for QEMU fw_cfg device
Date: Thu, 20 Aug 2015 23:47:57 -0400	[thread overview]
Message-ID: <20150821034757.GA6982@GLSMBP.INI.CMU.EDU> (raw)
In-Reply-To: <CAKv+Gu9wr+BUDjoz9NAkLNXxViDOM_PRoZRU8sxHog-iX=yUpQ@mail.gmail.com>

On Thu, Aug 20, 2015 at 07:21:48AM +0200, Ard Biesheuvel wrote:
> On 19 August 2015 at 22:49, Gabriel L. Somlo <somlo@cmu.edu> wrote:
> >> > From: "Gabriel L. Somlo" <somlo@cmu.edu>
> >> >> Several different architectures supported by QEMU are set up with a
> >> >> "firmware configuration" (fw_cfg) device, used to pass configuration
> >> >> "blobs" into the guest by the host running QEMU.
> >> >>
> >> >> Historically, these config blobs were mostly of interest to the guest
> >> >> BIOS, but since QEMU v2.4 it is possible to insert arbitrary blobs via
> >> >> the command line, which makes them potentially interesting to userspace
> >> >> (e.g. for passing early boot environment variables, etc.).
> >> >>
> >> >
> >> > Does 'potentially interesting' mean you have a use case? Could you elaborate?
> >
> > My personal one would be something like:
> >
> > cat > guestinfo.txt << EOT
> >   KEY1="val1"
> >   KEY2="val2"
> >   ...
> > EOT
> >
> > qemu-system-x86_64 ... -fw-cfg name="opt/guestinfo",file=./guestinfo.txt ...
> >
> > Then, from inside the guest:
> >
> >   . /sys/firmware/qemu_fw_cfg/by_name/opt/guestinfo/raw
> >
> >   do_something_with $KEY1 $KEY2
> >   ...
> >
> > But I'm thinking this is only one of the many positive things one
> > could do with the ability to access random host-supplied blobs from
> > guest userspace :)
> >
> 
> 'random host-supplied blobs' sounds awfully like files in a file
> system to me, and that is already supported by QEMU and works with any
> guest OS unmodified. If you are in control of the command line, surely
> you can add a -drive xxx,fat:path/to/blobs -device xxx pair that
> simply turns up as a volume.

That did come up, here's the start of original thread on the qemu mailing
list from a while back:

https://lists.gnu.org/archive/html/qemu-devel/2015-02/msg00371.html

To recap, the main advantages to transfering data this way are:

	1. Asynchronous

	   The host can simply pass data via the qemu command line, and
	   not have to care if/when the guest is ready to accept the
	   data (i.e. has made it far enough to e.g. start a guest agent)

	2. Out-of-band

	   I don't have to take over a user-visible element such as a
	   disk drive. Same reason VSOCK (or VMWare VMCI for that matter)
	   exist and are NOT actual Ethernet/TCP-IP network interfaces :)

> > DT on ARM is fine, and I'm certainly happy to learn how to do it (even
> > though my main focus is, for now, x86). The unfortunate thing though
> > is that on x86, fw_cfg is *not* AFAICT in ACPI, so I'd have to detour into
> > first adding it in on the host side, before I can rewrite the guest side
> > driver to look it up in there :)
> >
> >> > I am not sure how relevant sun4 and ppc/mac are for what you are trying to
> >> > accomplish, but perhaps it would be best to focus on x86 and ARM for now
> >> > and do it correctly. If the probing is actually needed, you can always add
> >> > it later.
> >
> > I guess that's the direction things seem to be headed, although it would
> > make me a bit sad to leave out sun and ppc right from the very beginning :)
> >
> 
> Sorry to be blunt, but I am not convinced there is a need for this
> driver anyway.

See above (hopefully I'm being sufficiently persuasive :) )

In VMWare one would fetch similar "guestinfo" variables via something like

	FOO=$(vmware-tools --getinfo "FOO")

but I thought exposing fw_cfg in /sys/firmware/... would make access to
*any* blobs (including, but not limited to my particular use case) even
easier and more generic than that.

> > PS. If you have one .c file in the kernel which does any of the DT-on-arm
> > boilerplate I'm supposed to immitate, I'd appreciate the shortcut :)
> >
> 
> Check out drivers/tty/serial/amba-pl011.c

I'll check it out.

Thanks much!
--Gabriel

  reply	other threads:[~2015-08-21  3:47 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-11 18:44 [PATCH v2 0/3] SysFS driver for QEMU fw_cfg device Gabriel L. Somlo
2015-08-11 18:44 ` [PATCH v2 1/3] firmware: introduce sysfs driver for QEMU's " Gabriel L. Somlo
2015-08-11 18:44 ` [PATCH v2 2/3] kobject: export kset_find_obj() to be used from modules Gabriel L. Somlo
     [not found] ` <cover.1439315079.git.somlo-D+Gtc/HYRWM@public.gmane.org>
2015-08-11 18:44   ` [PATCH v2 3/3] firmware: fw_cfg: create directory hierarchy for fw_cfg file names Gabriel L. Somlo
     [not found] ` <1439977109-20314-1-git-send-email-ard.biesheuvel@linaro.org>
     [not found]   ` <1439977109-20314-1-git-send-email-ard.biesheuvel-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2015-08-19  9:42     ` [PATCH v2 0/3] SysFS driver for QEMU fw_cfg device Ard Biesheuvel
2015-08-19 20:49       ` Gabriel L. Somlo
2015-08-19 23:04         ` Leif Lindholm
     [not found]         ` <20150819204915.GA6164-VPZ87SnTp2qKUezXOiBB2eW1CriLhL8O@public.gmane.org>
2015-08-20  5:21           ` Ard Biesheuvel
2015-08-21  3:47             ` Gabriel L. Somlo [this message]
     [not found]               ` <20150821034757.GA6982-VPZ87SnTp2qKUezXOiBB2eW1CriLhL8O@public.gmane.org>
2015-08-24  7:56                 ` Ard Biesheuvel
2015-08-26 18:15         ` Christopher Covington
     [not found]           ` <55DE0227.8090905-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2015-09-01 16:11             ` Gabriel L. Somlo

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=20150821034757.GA6982@GLSMBP.INI.CMU.EDU \
    --to=somlo@cmu.edu \
    --cc=ard.biesheuvel@linaro.org \
    --cc=galak@codeaurora.org \
    --cc=gleb@cloudius-systems.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jordan.l.justen@intel.com \
    --cc=kernelnewbies@kernelnewbies.org \
    --cc=kraxel@redhat.com \
    --cc=leif.lindholm@linaro.org \
    --cc=lersek@redhat.com \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matt.fleming@intel.com \
    --cc=paul@pwsan.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=ralf@linux-mips.org \
    --cc=rjones@redhat.com \
    --cc=x86@kernel.org \
    --cc=zajec5@gmail.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).