[RFC PATCH 5/7] qemu: add support to TDVF firmware loader

Peter Krempa pkrempa at redhat.com
Fri Jun 18 11:18:16 UTC 2021


On Fri, Jun 18, 2021 at 16:50:50 +0800, Zhenzhong Duan wrote:
> TDX guest need a specific firmware TDVF to bootup, add a new element
> in TrustDomain element for that purpose, like below:
> 
> <TrustDomain type='tdx'>
>    <policy>0x0001</policy>
>    <loader>/path/to/TDVF-binary</loader>
> </TrustDomain>
> 
> Qemu command line looks like:
> 
> $QEMU ... \
>   -device loader,file= /path/to/TDVF-binary,id=fd0
> 
> Signed-off-by: Zhenzhong Duan <zhenzhong.duan at intel.com>
> ---
>  docs/schemas/domaincommon.rng                   | 3 +++
>  src/conf/domain_conf.c                          | 6 ++++++
>  src/conf/domain_conf.h                          | 1 +
>  src/qemu/qemu_command.c                         | 4 ++++
>  tests/genericxml2xmlindata/trust-domain-tdx.xml | 1 +
>  tests/qemuxml2argvdata/trust-domain-tdx.xml     | 1 +
>  6 files changed, 16 insertions(+)

[...]

> diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
> index 7cb5061c8c..cabfc80b4b 100644
> --- a/src/conf/domain_conf.h
> +++ b/src/conf/domain_conf.h
> @@ -2671,6 +2671,7 @@ typedef enum {
>  struct _virDomainTDXDef {
>      int sectype; /* enum virDomainTrustDomain */
>      unsigned int policy; /* bit 0 set hint debug enabled, other bit reserved */
> +    char *loader; /* patch for TDX TDVF firmware */
>  };
>  
>  typedef enum {
> diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
> index 1e14c95a49..891d795b02 100644
> --- a/src/qemu/qemu_command.c
> +++ b/src/qemu/qemu_command.c
> @@ -9885,6 +9885,10 @@ qemuBuildTDXCommandLine(virDomainObj *vm, virCommand *cmd,
>  
>      virCommandAddArg(cmd, "-object");
>      virCommandAddArgBuffer(cmd, &buf);
> +
> +    virCommandAddArg(cmd, "-device");
> +    virCommandAddArgFormat(cmd, "loader,id=fd0,file=%s", tdx->loader);
> +
>      return 0;
>  }
>  

This again mixes config changes with qemu-specific changes.




More information about the libvir-list mailing list