qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH 3/3] nvdimm: honor -object memory-backend-file, readonly=on o


From: Stefan Hajnoczi
Subject: Re: [PATCH 3/3] nvdimm: honor -object memory-backend-file, readonly=on option
Date: Wed, 16 Sep 2020 10:39:54 +0100

On Fri, Aug 21, 2020 at 03:03:50PM +0200, Philippe Mathieu-Daudé wrote:
> On 8/4/20 12:12 PM, Stefan Hajnoczi wrote:
> > Make it possible to present read-only files to the guest as "unarmed"
> > NVDIMMs. The Linux NVDIMM device (/dev/pmemX) is read-only.
> > 
> > Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
> > ---
> >  docs/nvdimm.txt | 8 +++++++-
> >  hw/mem/nvdimm.c | 4 ++++
> >  2 files changed, 11 insertions(+), 1 deletion(-)
> > 
> > diff --git a/docs/nvdimm.txt b/docs/nvdimm.txt
> > index c2c6e441b3..c0b52de111 100644
> > --- a/docs/nvdimm.txt
> > +++ b/docs/nvdimm.txt
> > @@ -17,7 +17,7 @@ following command line options:
> >  
> >   -machine pc,nvdimm
> >   -m $RAM_SIZE,slots=$N,maxmem=$MAX_SIZE
> > - -object 
> > memory-backend-file,id=mem1,share=on,mem-path=$PATH,size=$NVDIMM_SIZE
> > + -object 
> > memory-backend-file,id=mem1,share=on,mem-path=$PATH,size=$NVDIMM_SIZE,readonly=off
> >   -device nvdimm,id=nvdimm1,memdev=mem1
> >  
> >  Where,
> > @@ -42,6 +42,12 @@ Where,
> >     "share=off", then guest writes won't be applied to the backend
> >     file and thus will be invisible to other guests.
> >  
> > +   "readonly=on/off" controls whether the the file $PATH is opened 
> > read-only or
> 
> Double "the the".

Will fix.

> > diff --git a/hw/mem/nvdimm.c b/hw/mem/nvdimm.c
> > index e1574bc07c..694223450e 100644
> > --- a/hw/mem/nvdimm.c
> > +++ b/hw/mem/nvdimm.c
> > @@ -151,6 +151,10 @@ static void nvdimm_prepare_memory_region(NVDIMMDevice 
> > *nvdimm, Error **errp)
> >                               "nvdimm-memory", mr, 0, pmem_size);
> >      memory_region_set_nonvolatile(nvdimm->nvdimm_mr, true);
> >      nvdimm->nvdimm_mr->align = align;
> > +
> > +    if (memory_region_is_rom(mr)) {
> > +        nvdimm->unarmed = true; /* this device is read-only */
> > +    }
> 
> Can you move this hunk before the alias creation?
> (Just before nvdimm->nvdimm_mr = ...).

Will fix.

Attachment: signature.asc
Description: PGP signature


reply via email to

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