[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 25/58] kvm/tdx: Don't complain when converting vMMIO regio
From: |
Daniel P . Berrangé |
Subject: |
Re: [PATCH v2 25/58] kvm/tdx: Don't complain when converting vMMIO region to shared |
Date: |
Mon, 21 Aug 2023 10:34:29 +0100 |
User-agent: |
Mutt/2.2.9 (2022-11-12) |
On Fri, Aug 18, 2023 at 05:50:08AM -0400, Xiaoyao Li wrote:
> From: Isaku Yamahata <isaku.yamahata@intel.com>
>
> Because vMMIO region needs to be shared region, guest TD may explicitly
> convert such region from private to shared. Don't complain such
> conversion.
>
> Signed-off-by: Isaku Yamahata <isaku.yamahata@intel.com>
> Signed-off-by: Xiaoyao Li <xiaoyao.li@intel.com>
> ---
> accel/kvm/kvm-all.c | 20 ++++++++++++++++++--
> 1 file changed, 18 insertions(+), 2 deletions(-)
>
> diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c
> index fceec7f2a83f..9d0aa8c97feb 100644
> --- a/accel/kvm/kvm-all.c
> +++ b/accel/kvm/kvm-all.c
> @@ -3094,8 +3094,24 @@ static int kvm_convert_memory(hwaddr start, hwaddr
> size, bool to_private)
> */
> ram_block_convert_range(rb, offset, size, to_private);
> } else {
> - warn_report("Convert non guest-memfd backed memory region
> (0x%"HWADDR_PRIx" ,+ 0x%"HWADDR_PRIx") to %s",
> - start, size, to_private ? "private" : "shared");
> + MemoryRegion *mr = section.mr;
> +
> + /*
> + * Because vMMIO region must be shared, guest TD may convert vMMIO
> + * region to shared explicitly. Don't complain such case. See
> + * memory_region_type() for checking if the region is MMIO region.
> + */
> + if (to_private ||
> + memory_region_is_ram(mr) ||
> + memory_region_is_ram_device(mr) ||
> + memory_region_is_rom(mr) ||
> + memory_region_is_romd(mr)) {
Should we also have !is_tdx_vm() as the first clause to check, as IIUC
you only need the special logic for TDX VMs.
> + warn_report("Convert non guest-memfd backed memory region
> (0x%"HWADDR_PRIx" ,+ 0x%"HWADDR_PRIx") of %s to %s",
> + start, size, mr->name, to_private ? "private" :
> "shared");
> + } else {
> + ret = 0;
> + }
Inconsistent indentation here due to use of tabs
> +
> }
>
> memory_region_unref(section.mr);
> --
> 2.34.1
>
With regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
- Re: [PATCH v2 18/58] i386/tdx: Validate TD attributes, (continued)
- [PATCH v2 19/58] qom: implement property helper for sha384, Xiaoyao Li, 2023/08/18
- [PATCH v2 20/58] i386/tdx: Allows mrconfigid/mrowner/mrownerconfig for TDX_INIT_VM, Xiaoyao Li, 2023/08/18
- [PATCH v2 21/58] i386/tdx: Implement user specified tsc frequency, Xiaoyao Li, 2023/08/18
- [PATCH v2 25/58] kvm/tdx: Don't complain when converting vMMIO region to shared, Xiaoyao Li, 2023/08/18
- Re: [PATCH v2 25/58] kvm/tdx: Don't complain when converting vMMIO region to shared,
Daniel P . Berrangé <=
- [PATCH v2 28/58] i386/tdx: Parse TDVF metadata for TDX VM, Xiaoyao Li, 2023/08/18
- [PATCH v2 26/58] kvm/tdx: Ignore memory conversion to shared of unassigned region, Xiaoyao Li, 2023/08/18
- [PATCH v2 27/58] i386/tdvf: Introduce function to parse TDVF metadata, Xiaoyao Li, 2023/08/18
- [PATCH v2 24/58] i386/tdx: Create kvm gmem for TD, Xiaoyao Li, 2023/08/18
- [PATCH v2 23/58] i386/tdx: Make memory type private by default, Xiaoyao Li, 2023/08/18
- [PATCH v2 29/58] i386/tdx: Skip BIOS shadowing setup, Xiaoyao Li, 2023/08/18
- [PATCH v2 30/58] i386/tdx: Don't initialize pc.rom for TDX VMs, Xiaoyao Li, 2023/08/18
- [PATCH v2 31/58] i386/tdx: Track mem_ptr for each firmware entry of TDVF, Xiaoyao Li, 2023/08/18
- [PATCH v2 32/58] i386/tdx: Track RAM entries for TDX VM, Xiaoyao Li, 2023/08/18