[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a8451fb59f300b6953e2d4a3cd06281400439212.camel@intel.com>
Date: Tue, 16 Apr 2024 14:57:05 +0000
From: "Edgecombe, Rick P" <rick.p.edgecombe@...el.com>
To: "kvm@...r.kernel.org" <kvm@...r.kernel.org>, "Yamahata, Isaku"
<isaku.yamahata@...el.com>
CC: "seanjc@...gle.com" <seanjc@...gle.com>, "Huang, Kai"
<kai.huang@...el.com>, "federico.parola@...ito.it"
<federico.parola@...ito.it>, "linux-kernel@...r.kernel.org"
<linux-kernel@...r.kernel.org>, "isaku.yamahata@...il.com"
<isaku.yamahata@...il.com>, "dmatlack@...gle.com" <dmatlack@...gle.com>,
"michael.roth@....com" <michael.roth@....com>, "pbonzini@...hat.com"
<pbonzini@...hat.com>
Subject: Re: [PATCH v2 08/10] KVM: x86: Add a hook in
kvm_arch_vcpu_map_memory()
On Wed, 2024-04-10 at 15:07 -0700, isaku.yamahata@...el.com 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;
> +}
Powered by blists - more mailing lists