Re: [PATCH v2 08/10] KVM: x86: Add a hook in kvm_arch_vcpu_map_memory()

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

 



On Wed, 2024-04-10 at 15:07 -0700, isaku.yamahata@xxxxxxxxx wrote:
> +static int kvm_pre_mmu_map_page(struct kvm_vcpu *vcpu,
> +                               struct kvm_memory_mapping *mapping,
> +                               u64 *error_code)
> +{
> +       int r = 0;
> +
> +       if (vcpu->kvm->arch.vm_type == KVM_X86_DEFAULT_VM) {
> +               /* nothing */

On the Intel side, vt_pre_mmu_map_page will handle doing nothing. Is there a
reason the AMD side can't do the same thing?

> +       } else if (vcpu->kvm->arch.vm_type == KVM_X86_SW_PROTECTED_VM) {
> +               if (kvm_mem_is_private(vcpu->kvm, gpa_to_gfn(mapping-
> >base_address)))
> +                       *error_code |= PFERR_PRIVATE_ACCESS;

Not suggesting to do anything about it for this series, but there seems to be a
growing amount of manual KVM_X86_SW_PROTECTED_VM checks. I guess the problem
with giving it its own x86_ops is figuring which arch calls to use. Hmm.

> +       } else if (kvm_x86_ops.pre_mmu_map_page)
> +               r = static_call(kvm_x86_pre_mmu_map_page)(vcpu, mapping,
> +                                                         error_code);
> +       else
> +               r = -EOPNOTSUPP;

Do we actually need this last check?

> +
> +       return r;
> +}





[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux