qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [RFC PATCH v1 20/22] fw_cfg: sev: disable dma in real m


From: Michael S. Tsirkin
Subject: Re: [Qemu-devel] [RFC PATCH v1 20/22] fw_cfg: sev: disable dma in real mode
Date: Tue, 13 Sep 2016 23:55:52 +0300

On Tue, Sep 13, 2016 at 03:46:15PM -0500, Brijesh Singh wrote:
> Hi Michael,
> 
> On 09/13/2016 01:39 PM, Michael S. Tsirkin wrote:
> > On Tue, Sep 13, 2016 at 10:50:06AM -0400, Brijesh Singh wrote:
> > > In SEV-enabled guest dma should be performed on shared pages. Since
> > > the SeaBIOS executes in non PAE mode and does not have access to C-bit
> > > to create a shared page hence disable the dma operation when reading
> > > from fw_cfg interface.
> > > 
> > > Signed-off-by: Brijesh Singh <address@hidden>
> > 
> > Why do we need new interfaces for this though? Just
> > set dma_enabled=false on command line.
> > 
> 
> Thanks, i was not aware of dma_enabled=false command line option.
> Could you please tell me how to set this command line option?
> 
> I see this in 'qemu --help'
> 
> -fw_cfg [name=]<name>,file=<file>
>                  add named fw_cfg entry from file
> -fw_cfg [name=]<name>,string=<str>
>                  add named fw_cfg entry from string
> 

For example, set it on all fw cfg devices:

-global fw_cfg.dma_enabled=false

should work.

> > > ---
> > >  hw/nvram/fw_cfg.c |    6 ++++++
> > >  1 file changed, 6 insertions(+)
> > > 
> > > diff --git a/hw/nvram/fw_cfg.c b/hw/nvram/fw_cfg.c
> > > index 6a68e59..aca99e9 100644
> > > --- a/hw/nvram/fw_cfg.c
> > > +++ b/hw/nvram/fw_cfg.c
> > > @@ -24,6 +24,7 @@
> > >  #include "qemu/osdep.h"
> > >  #include "hw/hw.h"
> > >  #include "sysemu/sysemu.h"
> > > +#include "sysemu/kvm.h"
> > >  #include "sysemu/dma.h"
> > >  #include "hw/boards.h"
> > >  #include "hw/isa/isa.h"
> > > @@ -1009,6 +1010,11 @@ static void fw_cfg_io_realize(DeviceState *dev, 
> > > Error **errp)
> > >      FWCfgIoState *s = FW_CFG_IO(dev);
> > >      SysBusDevice *sbd = SYS_BUS_DEVICE(dev);
> > > 
> > > +    /* disable dma on fw_cfg when SEV is enabled */
> > > +    if (kvm_sev_enabled()) {
> > > +        qdev_prop_set_bit(dev, "dma_enabled", false);
> > > +    }
> > > +
> > >      /* when using port i/o, the 8-bit data register ALWAYS overlaps
> > >       * with half of the 16-bit control register. Hence, the total size
> > >       * of the i/o region used is FW_CFG_CTL_SIZE */



reply via email to

[Prev in Thread] Current Thread [Next in Thread]