[libvirt][PATCH RESEND v10 5/5] qemu: Add command-line to generate SGX EPC memory backend

Michal Prívozník mprivozn at redhat.com
Tue Feb 22 09:16:59 UTC 2022


On 2/16/22 11:25, Michal Prívozník wrote:

>> 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.
> 

One more thing. I've enabled SGX on my machine hoping to test this out,
but my attempts are failing so far. Firstly, with these patches qemu is
unhappy, because .node attribute is missing:

/home/zippy/work/qemu/qemu.git/build/qemu-system-x86_64 \

-machine pc-i440fx-4.0,usb=off,dump-guest-core=off \
-accel kvm \
-cpu host,migratable=on \
-m size=4194304k,slots=16,maxmem=1099511627776k \

-object '{"qom-type":"memory-backend-memfd","id":"memepc0","hugetlb":true,"hugetlbsize":2097152,"prealloc":true,"size":67108864,"host-nodes":[0],"policy":"bind"}' \
-M sgx-epc.0.memdev=memepc0 \

qemu-system-x86_64: Parameter 'sgx-epc.0.node' is missing


But okay, I can add .node, but that doesn't get me much further:

/home/zippy/work/qemu/qemu.git/build/qemu-system-x86_64 \

-machine pc-i440fx-4.0,usb=off,dump-guest-core=off \
-accel kvm \
-cpu host,migratable=on \
-m size=4194304k,slots=16,maxmem=1099511627776k \

-object '{"qom-type":"memory-backend-memfd","id":"memepc0","hugetlb":true,"hugetlbsize":2097152,"prealloc":true,"size":67108864,"host-nodes":[0],"policy":"bind"}' \
-M sgx-epc.0.memdev=memepc0,sgx-epc.0.node=0 \

qemu-system-x86_64: Invalid parameter type for 'memdev', expected: memory-backend-epc


Michal




More information about the libvir-list mailing list