qemu-devel
[Top][All Lists]
Advanced

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

Re: [RFC PATCH v3 17/36] pflash_cfi01/tdx: Introduce ram_mode of pflash


From: Xiaoyao Li
Subject: Re: [RFC PATCH v3 17/36] pflash_cfi01/tdx: Introduce ram_mode of pflash for TDVF
Date: Mon, 21 Mar 2022 16:54:51 +0800
User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Firefox/91.0 Thunderbird/91.6.1

On 3/18/2022 10:07 PM, Philippe Mathieu-Daudé wrote:
Hi,

On 17/3/22 14:58, Xiaoyao Li wrote:
TDX VM needs to boot with Trust Domain Virtual Firmware (TDVF). Unlike
that OVMF is mapped as rom device, TDVF needs to be mapped as private
memory. This is because TDX architecture doesn't provide read-only
capability for VMM, and it doesn't support instruction emulation due
to guest memory and registers are not accessible for VMM.

On the other hand, OVMF can work as TDVF, which is usually configured
as pflash device in QEMU. To keep the same usage (QEMU parameter),
introduce ram_mode to pflash for TDVF. When it's creating a TDX VM,
ram_mode will be enabled automatically that map the firmware as RAM.

Note, this implies two things:
  1. TDVF (OVMF) is not read-only (write-protected).

  2. It doesn't support non-volatile UEFI variables as what pflash
     supports that the change to non-volatile UEFI variables won't get
     synced back to backend vars.fd file.

Signed-off-by: Xiaoyao Li <xiaoyao.li@intel.com>
---
  hw/block/pflash_cfi01.c | 25 ++++++++++++++++++-------
  hw/i386/pc_sysfw.c      | 14 +++++++++++---
  2 files changed, 29 insertions(+), 10 deletions(-)

If you don't need a pflash device, don't use it: simply map your nvram
region as ram in your machine. No need to clutter the pflash model like
that.

I know it's dirty to hack the pflash device. The purpose is to make the user interface unchanged that people can still use

        -drive if=pflash,format=raw,unit=0,file=/path/to/OVMF_CODE.fd
        -drive if=pflash,format=raw,unit=1,file=/path/to/OVMF_VARS.fd

to create TD guest.

I can go back to use generic loader[1] to load TDVF in v2.

[1] https://lore.kernel.org/qemu-devel/acaf651389c3f407a9d6d0a2e943daf0a85bb5fc.1625704981.git.isaku.yamahata@intel.com/

NAcked-by: Philippe Mathieu-Daudé <f4bug@amsat.org>





reply via email to

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