[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f83f6923-7aa2-4a10-8e83-3fa77400c446@linux.intel.com>
Date: Fri, 19 Apr 2024 09:42:48 +0800
From: Binbin Wu <binbin.wu@...ux.intel.com>
To: Isaku Yamahata <isaku.yamahata@...el.com>
Cc: Sean Christopherson <sean.j.christopherson@...el.com>,
kvm@...r.kernel.org, linux-kernel@...r.kernel.org, isaku.yamahata@...il.com,
Paolo Bonzini <pbonzini@...hat.com>, erdemaktas@...gle.com,
Sean Christopherson <seanjc@...gle.com>, Sagi Shahar <sagis@...gle.com>,
Kai Huang <kai.huang@...el.com>, chen.bo@...el.com, hang.yuan@...el.com,
tina.zhang@...el.com, isaku.yamahata@...ux.intel.com
Subject: Re: [PATCH v19 110/130] KVM: TDX: Handle TDX PV MMIO hypercall
On 4/19/2024 5:22 AM, Isaku Yamahata wrote:
> On Thu, Apr 18, 2024 at 07:04:11PM +0800,
> Binbin Wu <binbin.wu@...ux.intel.com> wrote:
>
>>
>> On 4/18/2024 5:29 PM, Binbin Wu wrote:
>>>> +
>>>> +static int tdx_emulate_mmio(struct kvm_vcpu *vcpu)
>>>> +{
>>>> + struct kvm_memory_slot *slot;
>>>> + int size, write, r;
>>>> + unsigned long val;
>>>> + gpa_t gpa;
>>>> +
>>>> + KVM_BUG_ON(vcpu->mmio_needed, vcpu->kvm);
>>>> +
>>>> + size = tdvmcall_a0_read(vcpu);
>>>> + write = tdvmcall_a1_read(vcpu);
>>>> + gpa = tdvmcall_a2_read(vcpu);
>>>> + val = write ? tdvmcall_a3_read(vcpu) : 0;
>>>> +
>>>> + if (size != 1 && size != 2 && size != 4 && size != 8)
>>>> + goto error;
>>>> + if (write != 0 && write != 1)
>>>> + goto error;
>>>> +
>>>> + /* Strip the shared bit, allow MMIO with and without it set. */
>>> Based on the discussion
>>> https://lore.kernel.org/all/ZcUO5sFEAIH68JIA@google.com/
>>> Do we still allow the MMIO without shared bit?
> That's independent. The part is how to work around guest accesses the
> MMIO region with private GPA. This part is, the guest issues
> TDG.VP.VMCALL<MMMIO> and KVM masks out the shared bit to make it friendly
> to the user space VMM.
It's similar.
The tdvmcall from the guest for mmio can also be private GPA, which is
not reasonable, right?
According to the comment, kvm doens't care about if the TD guest issue
the tdvmcall with private GPA or shared GPA.
Powered by blists - more mailing lists