On 2/16/22, 2:44 AM, "Daniel P. Berrangé" <berrange(a)redhat.com> wrote:
On Wed, Feb 16, 2022 at 11:25:40AM +0100, Michal Prívozník wrote:
> On 2/8/22 06:21, Haibin Huang wrote:
> > From: Lin Yang <lin.a.yang(a)intel.com>
> >
> > According to the result parsing from xml, add the argument of
> > SGX EPC memory backend into QEMU command line:
> >
> > #qemu-system-x86_64 \
> > ...... \
> > -object memory-backend-epc,id=mem1,size=64M,prealloc=on \
> > -object memory-backend-epc,id=mem2,size=28M \
> > -M sgx-epc.0.memdev=mem1,sgx-epc.1.memdev=mem2
> >
> > Signed-off-by: Lin Yang <lin.a.yang(a)intel.com>
> > ---
> > src/qemu/qemu_alias.c | 3 +-
> > src/qemu/qemu_command.c | 46 +++++++++++++++++--
> > .../sgx-epc.x86_64-6.2.0.args | 38 +++++++++++++++
> > tests/qemuxml2argvtest.c | 2 +
> > 4 files changed, 84 insertions(+), 5 deletions(-)
> > create mode 100644 tests/qemuxml2argvdata/sgx-epc.x86_64-6.2.0.args
> >
> > diff --git a/tests/qemuxml2argvdata/sgx-epc.x86_64-6.2.0.args
b/tests/qemuxml2argvdata/sgx-epc.x86_64-6.2.0.args
> > new file mode 100644
> > index 0000000000..e1aa274054
> > --- /dev/null
> > +++ b/tests/qemuxml2argvdata/sgx-epc.x86_64-6.2.0.args
> > @@ -0,0 +1,38 @@
> > +LC_ALL=C \
> > +PATH=/bin \
> > +HOME=/tmp/lib/domain--1-QEMUGuest1 \
> > +USER=test \
> > +LOGNAME=test \
> > +XDG_DATA_HOME=/tmp/lib/domain--1-QEMUGuest1/.local/share \
> > +XDG_CACHE_HOME=/tmp/lib/domain--1-QEMUGuest1/.cache \
> > +XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
> > +/usr/bin/qemu-system-x86_64 \
> > +-name guest=QEMUGuest1,debug-threads=on \
> > +-S \
> > +-object
'{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/tmp/lib/domain--1-QEMUGuest1/master-key.aes"}'
\
> > +-machine pc-q35-6.2,usb=off,dump-guest-core=off,memory-backend=pc.ram \
> > +-accel tcg \
> > +-cpu qemu64 \
> > +-m 134 \
> > +-object
'{"qom-type":"memory-backend-ram","id":"pc.ram","size":140509184}'
\
> > +-overcommit mem-lock=off \
> > +-smp 1,sockets=1,cores=1,threads=1 \
> > +-object
'{"qom-type":"memory-backend-epc","id":"memepc0","prealloc":true,"size":67108864}'
\
> > +-object
'{"qom-type":"memory-backend-epc","id":"memepc1","prealloc":true,"size":16777216}'
\
> > +-M sgx-epc.0.memdev=memepc0,sgx-epc.1.memdev=memepc1 \
>
> I don't think this is correct. IIUC, this can be passed to -machine
> directly, e.g.:
>
> -machine
>
pc-q35-6.2,usb=off,dump-guest-core=off,memory-backend=pc.ram,sgx-epc.0.memdev=memepc0,sgx-epc.1.memdev=memepc1
>
> And when I try to do that, I get:
>
> qemu-system-x86_64: Parameter 'sgx-epc.0.node' is missing
>
> Any idea, what's going on? I would much rather avoid using -M if we can
> help it.
-M is just the short alias for --machine arg. We must definitely be
adding the neccessary args to the *existing* --machine arg, not adding
a second copy of it.
Thanks for pointing out this. I will update here to add those sgx args to the
existing --machine arg.
Thanks,
Lin.