Re: [Qemu-devel] RFC: guest-side retrieval of fw_cfg file

2015-07-26 Thread Laszlo Ersek
On 07/26/15 01:21, Gabriel L. Somlo wrote: > On Tue, Jul 21, 2015 at 12:07:08AM +0200, Laszlo Ersek wrote: >> On 07/20/15 23:19, Gabriel L. Somlo wrote: >> >> ... I just love "find", sorry. :) Anyway, I don't envision myself as a >> user of this feature any time soon, so please feel free to ignore

Re: [Qemu-devel] RFC: guest-side retrieval of fw_cfg file

2015-07-25 Thread Gabriel L. Somlo
On Tue, Jul 21, 2015 at 12:07:08AM +0200, Laszlo Ersek wrote: > On 07/20/15 23:19, Gabriel L. Somlo wrote: > > ... I just love "find", sorry. :) Anyway, I don't envision myself as a > user of this feature any time soon, so please feel free to ignore me. How about this: I create /sys/firmware/fw_c

Re: [Qemu-devel] RFC: guest-side retrieval of fw_cfg file

2015-07-20 Thread Laszlo Ersek
On 07/20/15 23:19, Gabriel L. Somlo wrote: > The code to build nested ksets (represending sub-sub-directories of > /sys/firmware/fw_cfg/...) and cleaning them up on exit doesn't promise > to be *too* horrible or bulky, but as I was getting ready to start > writing it, I realized that, in theory, n

Re: [Qemu-devel] RFC: guest-side retrieval of fw_cfg file

2015-07-20 Thread Gabriel L. Somlo
New working version of fw_cfg sysfs module enclosed at the end of this mail, featuring: - probing for the appropriate fw_cfg port/address for the architecture we're on. It's either that, or preprocessor #ifdef voodoo to try only the right access method matching

Re: [Qemu-devel] RFC: guest-side retrieval of fw_cfg file

2015-07-16 Thread Gabriel L. Somlo
On Thu, Jul 16, 2015 at 01:27:15PM -0600, Eric Blake wrote: > On 07/15/2015 06:43 PM, Gabriel L. Somlo wrote: > > > > > OK, so I replaced my port i/o with mmio equivalents: > > > > -#define FW_CFG_PORT_CTL 0x510 > > +#define FW_CFG_PORT_CTL (void *)0x09020008 > > > > -#define FW_CFG_PORT_DATA

Re: [Qemu-devel] RFC: guest-side retrieval of fw_cfg file

2015-07-16 Thread Eric Blake
On 07/15/2015 06:43 PM, Gabriel L. Somlo wrote: > > OK, so I replaced my port i/o with mmio equivalents: > > -#define FW_CFG_PORT_CTL 0x510 > +#define FW_CFG_PORT_CTL (void *)0x09020008 > > -#define FW_CFG_PORT_DATA 0x511 > +#define FW_CFG_PORT_DATA (void *)0x0902 Under-parenthesized; yo

Re: [Qemu-devel] RFC: guest-side retrieval of fw_cfg file

2015-07-16 Thread Igor Mammedov
On Thu, 16 Jul 2015 13:25:56 +0300 "Michael S. Tsirkin" wrote: > On Thu, Jul 16, 2015 at 11:50:38AM +0200, Igor Mammedov wrote: > > On Thu, 16 Jul 2015 10:30:41 +0300 > > "Michael S. Tsirkin" wrote: > > > > > On Thu, Jul 16, 2015 at 08:57:36AM +0200, Igor Mammedov wrote: > > > > On Wed, 15 Jul

Re: [Qemu-devel] RFC: guest-side retrieval of fw_cfg file

2015-07-16 Thread Michael S. Tsirkin
On Thu, Jul 16, 2015 at 11:50:38AM +0200, Igor Mammedov wrote: > On Thu, 16 Jul 2015 10:30:41 +0300 > "Michael S. Tsirkin" wrote: > > > On Thu, Jul 16, 2015 at 08:57:36AM +0200, Igor Mammedov wrote: > > > On Wed, 15 Jul 2015 19:24:33 +0300 > > > "Michael S. Tsirkin" wrote: > > > > > > > On Wed,

Re: [Qemu-devel] RFC: guest-side retrieval of fw_cfg file

2015-07-16 Thread Igor Mammedov
On Thu, 16 Jul 2015 10:30:41 +0300 "Michael S. Tsirkin" wrote: > On Thu, Jul 16, 2015 at 08:57:36AM +0200, Igor Mammedov wrote: > > On Wed, 15 Jul 2015 19:24:33 +0300 > > "Michael S. Tsirkin" wrote: > > > > > On Wed, Jul 15, 2015 at 06:01:42PM +0200, Igor Mammedov wrote: > > > > On Wed, 15 Jul

Re: [Qemu-devel] RFC: guest-side retrieval of fw_cfg file

2015-07-16 Thread Michael S. Tsirkin
On Thu, Jul 16, 2015 at 08:57:36AM +0200, Igor Mammedov wrote: > On Wed, 15 Jul 2015 19:24:33 +0300 > "Michael S. Tsirkin" wrote: > > > On Wed, Jul 15, 2015 at 06:01:42PM +0200, Igor Mammedov wrote: > > > On Wed, 15 Jul 2015 17:08:27 +0300 > > > "Michael S. Tsirkin" wrote: > > > > > > > On Mon,

Re: [Qemu-devel] RFC: guest-side retrieval of fw_cfg file

2015-07-15 Thread Igor Mammedov
On Wed, 15 Jul 2015 19:24:33 +0300 "Michael S. Tsirkin" wrote: > On Wed, Jul 15, 2015 at 06:01:42PM +0200, Igor Mammedov wrote: > > On Wed, 15 Jul 2015 17:08:27 +0300 > > "Michael S. Tsirkin" wrote: > > > > > On Mon, Jul 13, 2015 at 04:09:37PM -0400, Gabriel L. Somlo wrote: > > > > Hi, > > > >

Re: [Qemu-devel] RFC: guest-side retrieval of fw_cfg file

2015-07-15 Thread Gabriel L. Somlo
On Wed, Jul 15, 2015 at 07:24:33PM +0300, Michael S. Tsirkin wrote: > On Wed, Jul 15, 2015 at 06:01:42PM +0200, Igor Mammedov wrote: > > On Wed, 15 Jul 2015 17:08:27 +0300 > > "Michael S. Tsirkin" wrote: > > > > > On Mon, Jul 13, 2015 at 04:09:37PM -0400, Gabriel L. Somlo wrote: > > > > Hi, > > >

Re: [Qemu-devel] RFC: guest-side retrieval of fw_cfg file

2015-07-15 Thread Gabriel L. Somlo
On Tue, Jul 14, 2015 at 10:43:46AM +0100, Richard W.M. Jones wrote: > On Mon, Jul 13, 2015 at 04:09:37PM -0400, Gabriel L. Somlo wrote: > > 3. I'm currently only handling x86 and I/O ports. I could drop the > >fw_cfg_dmi_whitelist and just check the signature, using mmio where > >appropriat

Re: [Qemu-devel] RFC: guest-side retrieval of fw_cfg file

2015-07-15 Thread Michael S. Tsirkin
On Wed, Jul 15, 2015 at 06:01:42PM +0200, Igor Mammedov wrote: > On Wed, 15 Jul 2015 17:08:27 +0300 > "Michael S. Tsirkin" wrote: > > > On Mon, Jul 13, 2015 at 04:09:37PM -0400, Gabriel L. Somlo wrote: > > > Hi, > > > > > > A while ago I was pondering on the options available for retrieving > >

Re: [Qemu-devel] RFC: guest-side retrieval of fw_cfg file

2015-07-15 Thread Igor Mammedov
On Wed, 15 Jul 2015 17:08:27 +0300 "Michael S. Tsirkin" wrote: > On Mon, Jul 13, 2015 at 04:09:37PM -0400, Gabriel L. Somlo wrote: > > Hi, > > > > A while ago I was pondering on the options available for retrieving > > a fw_cfg blob from the guest-side (now that we can insert fw_cfg > > files on

Re: [Qemu-devel] RFC: guest-side retrieval of fw_cfg file

2015-07-15 Thread Michael S. Tsirkin
On Mon, Jul 13, 2015 at 04:09:37PM -0400, Gabriel L. Somlo wrote: > Hi, > > A while ago I was pondering on the options available for retrieving > a fw_cfg blob from the guest-side (now that we can insert fw_cfg > files on the host-side command line, see commit 81b2b8106). > > So over the last cou

Re: [Qemu-devel] RFC: guest-side retrieval of fw_cfg file

2015-07-15 Thread Matt Fleming
On Mon, 2015-07-13 at 16:09 -0400, Gabriel L. Somlo wrote: > > 3. I'm currently only handling x86 and I/O ports. I could drop the >fw_cfg_dmi_whitelist and just check the signature, using mmio where >appropriate, but I don't have a handy-dandy set of VMs for those >architectures on whi

Re: [Qemu-devel] RFC: guest-side retrieval of fw_cfg file

2015-07-15 Thread Laszlo Ersek
On 07/15/15 13:06, Matt Fleming wrote: > On Tue, 2015-07-14 at 13:00 -0400, Gabriel L. Somlo wrote: >> >> That being said, I did reimplement systemd's escape method in cca. 30 >> lines of C, so that shouldn't be too onerous. > > I really don't see a reason to use systemd's naming scheme instead of

Re: [Qemu-devel] RFC: guest-side retrieval of fw_cfg file

2015-07-15 Thread Matt Fleming
On Tue, 2015-07-14 at 13:00 -0400, Gabriel L. Somlo wrote: > > That being said, I did reimplement systemd's escape method in cca. 30 > lines of C, so that shouldn't be too onerous. I really don't see a reason to use systemd's naming scheme instead of the one already provided by the kernel. > Bes

Re: [Qemu-devel] RFC: guest-side retrieval of fw_cfg file

2015-07-14 Thread Gabriel L. Somlo
On Tue, Jul 14, 2015 at 07:48:30PM +0100, Richard W.M. Jones wrote: > > > > /* read chunk of given fw_cfg blob (caller responsible for > > > > sanity-check) */ > > > > static inline void fw_cfg_read_blob(uint16_t select, > > > > void *buf, loff_t pos, size_t >

Re: [Qemu-devel] RFC: guest-side retrieval of fw_cfg file

2015-07-14 Thread Gerd Hoffmann
Hi, > > > /* read chunk of given fw_cfg blob (caller responsible for sanity-check) > > > */ > > > static inline void fw_cfg_read_blob(uint16_t select, > > >void *buf, loff_t pos, size_t count) > > > { > > > mutex_lock(&fw_cfg_dev_lock); > > > outw(select, FW_

Re: [Qemu-devel] RFC: guest-side retrieval of fw_cfg file

2015-07-14 Thread Peter Maydell
On 14 July 2015 at 19:48, Richard W.M. Jones wrote: > A long time ago I wrote a memcpy and a "pseudo-DMA" interface for > fw_cfg, but they were both roundly rejected as you can find in the > archives. IIRC opinions have changed on the pseudo-DMA approach since then; last time it was suggested I t

Re: [Qemu-devel] RFC: guest-side retrieval of fw_cfg file

2015-07-14 Thread Richard W.M. Jones
On Tue, Jul 14, 2015 at 07:48:29PM +0100, Richard W.M. Jones wrote: > On aarch64 kernel loading is really slow because it can only transfer > (IIRC) 8 bytes at a time, and there are no string instructions we can > use to speed it up. I should note here I'm talking about AAVMF (ie. guest UEFI) whic

Re: [Qemu-devel] RFC: guest-side retrieval of fw_cfg file

2015-07-14 Thread Richard W.M. Jones
On Tue, Jul 14, 2015 at 02:23:14PM -0400, Gabriel L. Somlo wrote: > On Tue, Jul 14, 2015 at 10:43:46AM +0100, Richard W.M. Jones wrote: > > On Mon, Jul 13, 2015 at 04:09:37PM -0400, Gabriel L. Somlo wrote: > > > 3. I'm currently only handling x86 and I/O ports. I could drop the > > >fw_cfg_dmi_

Re: [Qemu-devel] RFC: guest-side retrieval of fw_cfg file

2015-07-14 Thread Gabriel L. Somlo
On Tue, Jul 14, 2015 at 02:23:14PM -0400, Gabriel L. Somlo wrote: > On Tue, Jul 14, 2015 at 10:43:46AM +0100, Richard W.M. Jones wrote: > > On Mon, Jul 13, 2015 at 04:09:37PM -0400, Gabriel L. Somlo wrote: > > > 3. I'm currently only handling x86 and I/O ports. I could drop the > > >fw_cfg_dmi_

Re: [Qemu-devel] RFC: guest-side retrieval of fw_cfg file

2015-07-14 Thread Gabriel L. Somlo
On Tue, Jul 14, 2015 at 10:43:46AM +0100, Richard W.M. Jones wrote: > On Mon, Jul 13, 2015 at 04:09:37PM -0400, Gabriel L. Somlo wrote: > > 3. I'm currently only handling x86 and I/O ports. I could drop the > >fw_cfg_dmi_whitelist and just check the signature, using mmio where > >appropriat

Re: [Qemu-devel] RFC: guest-side retrieval of fw_cfg file

2015-07-14 Thread Gabriel L. Somlo
On Mon, Jul 13, 2015 at 05:03:02PM -0600, Eric Blake wrote: > On 07/13/2015 02:09 PM, Gabriel L. Somlo wrote: > > 2. File names are listed in /sys/fs/fw_cfg/... with slashes replaced > >exclamation marks, e.g.: > > Instead of inventing yet another escaping mechanism, can you mimic an > already

Re: [Qemu-devel] RFC: guest-side retrieval of fw_cfg file

2015-07-14 Thread Laszlo Ersek
On 07/13/15 22:09, Gabriel L. Somlo wrote: > Hi, > > A while ago I was pondering on the options available for retrieving > a fw_cfg blob from the guest-side (now that we can insert fw_cfg > files on the host-side command line, see commit 81b2b8106). > > So over the last couple of weekends I cooke

Re: [Qemu-devel] RFC: guest-side retrieval of fw_cfg file

2015-07-14 Thread Richard W.M. Jones
On Mon, Jul 13, 2015 at 04:09:37PM -0400, Gabriel L. Somlo wrote: > 3. I'm currently only handling x86 and I/O ports. I could drop the >fw_cfg_dmi_whitelist and just check the signature, using mmio where >appropriate, but I don't have a handy-dandy set of VMs for those >architectures on

Re: [Qemu-devel] RFC: guest-side retrieval of fw_cfg file

2015-07-13 Thread Eric Blake
On 07/13/2015 02:09 PM, Gabriel L. Somlo wrote: > 2. File names are listed in /sys/fs/fw_cfg/... with slashes replaced >exclamation marks, e.g.: Instead of inventing yet another escaping mechanism, can you mimic an already existing convention such as systemd's escaping? http://www.freedesktop

[Qemu-devel] RFC: guest-side retrieval of fw_cfg file

2015-07-13 Thread Gabriel L. Somlo
Hi, A while ago I was pondering on the options available for retrieving a fw_cfg blob from the guest-side (now that we can insert fw_cfg files on the host-side command line, see commit 81b2b8106). So over the last couple of weekends I cooked up the sysfs kernel module below, which lists all fw_cf