qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH v7 11/14] KVM: Register/unregister the guest private memory r


From: Gupta, Pankaj
Subject: Re: [PATCH v7 11/14] KVM: Register/unregister the guest private memory regions
Date: Wed, 20 Jul 2022 17:31:34 +0200
User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.10.0


+bool __weak kvm_arch_private_mem_supported(struct kvm *kvm)
+{
+       return false;
+}

Does this function has to be overriden by SEV and TDX to support the private
regions?

Yes it should be overridden by architectures which want to support it.

o.k


+
    static int check_memory_region_flags(const struct kvm_user_mem_region *mem)
    {
        u32 valid_flags = KVM_MEM_LOG_DIRTY_PAGES;
@@ -4689,6 +4729,22 @@ static long kvm_vm_ioctl(struct file *filp,
                r = kvm_vm_ioctl_set_memory_region(kvm, &mem);
                break;
        }
+#ifdef CONFIG_HAVE_KVM_PRIVATE_MEM
+       case KVM_MEMORY_ENCRYPT_REG_REGION:
+       case KVM_MEMORY_ENCRYPT_UNREG_REGION: {
+               struct kvm_enc_region region;
+
+               if (!kvm_arch_private_mem_supported(kvm))
+                       goto arch_vm_ioctl;
+
+               r = -EFAULT;
+               if (copy_from_user(&region, argp, sizeof(region)))
+                       goto out;
+
+               r = kvm_vm_ioctl_set_encrypted_region(kvm, ioctl, &region);

this is to store private region metadata not only the encrypted region?

Correct.

Sorry for not being clear, was suggesting name change of this function from:
"kvm_vm_ioctl_set_encrypted_region" to "kvm_vm_ioctl_set_private_region"

Though I don't have strong reason to change it, I'm fine with this and

Yes, no strong reason, just thought "kvm_vm_ioctl_set_private_region" would depict the actual functionality :)

this name matches the above kvm_arch_private_mem_supported perfectly.
BTW could not understand this, how "kvm_vm_ioctl_set_encrypted_region"
matches "kvm_arch_private_mem_supported"?

Thanks,
Pankaj



reply via email to

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