From: Christopher Covington <cov@codeaurora.org>
To: "Gabriel L. Somlo" <somlo@cmu.edu>,
Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: paul@pwsan.com, Matt Fleming <matt.fleming@intel.com>,
"Richard W.M. Jones" <rjones@redhat.com>,
Leif Lindholm <leif.lindholm@linaro.org>,
Jordan Justen <jordan.l.justen@intel.com>,
"x86@kernel.org" <x86@kernel.org>,
QEMU Developers <qemu-devel@nongnu.org>,
gleb@cloudius-systems.com, galak@codeaurora.org,
kernelnewbies@kernelnewbies.org,
Gerd Hoffmann <kraxel@redhat.com>,
"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
Paolo Bonzini <pbonzini@redhat.com>,
zajec5@gmail.com, linux-api@vger.kernel.org,
Laszlo Ersek <lersek@redhat.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [Qemu-devel] [PATCH v2 0/3] SysFS driver for QEMU fw_cfg device
Date: Wed, 26 Aug 2015 14:15:03 -0400 [thread overview]
Message-ID: <55DE0227.8090905@codeaurora.org> (raw)
In-Reply-To: <20150819204915.GA6164@GLSMBP.INI.CMU.EDU>
Hi Gabriel,
On 08/19/2015 04:49 PM, Gabriel L. Somlo wrote:
> Hi Ard,
>
> On Wed, Aug 19, 2015 at 11:42:02AM +0200, Ard Biesheuvel wrote:
>> (missed some cc's)
>>
>> On 19 August 2015 at 11:38, Ard Biesheuvel <ard.biesheuvel@linaro.org> 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 :)
I do this with kernel parameters:
host:
qemu-system-aarch64 -append="KEY1=val1 KEY2=val2"
guest:
KEY1=`sed -nr s/.*KEY1=([^ ]+).*/\1/ /proc/cmdline`
KEY2=`sed -nr s/.*KEY2=([^ ]+).*/\1/ /proc/cmdline`
do_something_with $KEY1 $KEY2
In practice it's just script=hostfile, where hostfile is available to the
guest via a 9P passthrough filesystem mount.
While quite architecture specific, I've also previously used an
"angel-cmdline" tool for similar purposes. Peter's recent semihosting patches
support such a tool for AArch64. (On AArch32 upstream QEMU disallows
semihosting from userspace.)
Before I had 9P on all the simulators I regularly ran, I used a semihosting
based "angel-load" tool.
Regards,
Christopher Covington
--
Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
next prev parent reply other threads:[~2015-08-26 18:15 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-11 18:44 [Qemu-devel] [PATCH v2 0/3] SysFS driver for QEMU fw_cfg device Gabriel L. Somlo
2015-08-11 18:44 ` [Qemu-devel] [PATCH v2 1/3] firmware: introduce sysfs driver for QEMU's " Gabriel L. Somlo
2015-08-11 18:44 ` [Qemu-devel] [PATCH v2 2/3] kobject: export kset_find_obj() to be used from modules Gabriel L. Somlo
2015-08-11 18:44 ` [Qemu-devel] [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>
2015-08-19 9:42 ` [Qemu-devel] [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
2015-08-20 5:21 ` Ard Biesheuvel
2015-08-21 3:47 ` Gabriel L. Somlo
2015-08-24 7:56 ` Ard Biesheuvel
2015-08-26 18:15 ` Christopher Covington [this message]
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=55DE0227.8090905@codeaurora.org \
--to=cov@codeaurora.org \
--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=rjones@redhat.com \
--cc=somlo@cmu.edu \
--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).