[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <62b3c444-36db-4ac0-bc10-e8d8a5f553c9@linux.intel.com>
Date: Tue, 10 Dec 2024 17:50:33 +0800
From: Binbin Wu <binbin.wu@...ux.intel.com>
To: Chao Gao <chao.gao@...el.com>
Cc: pbonzini@...hat.com, seanjc@...gle.com, kvm@...r.kernel.org,
rick.p.edgecombe@...el.com, kai.huang@...el.com, adrian.hunter@...el.com,
reinette.chatre@...el.com, xiaoyao.li@...el.com,
tony.lindgren@...ux.intel.com, isaku.yamahata@...el.com,
yan.y.zhao@...el.com, michael.roth@....com, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 6/7] KVM: TDX: Handle TDX PV port I/O hypercall
On 12/10/2024 5:42 PM, Chao Gao wrote:
>> +static int tdx_emulate_io(struct kvm_vcpu *vcpu)
>> +{
>> + struct x86_emulate_ctxt *ctxt = vcpu->arch.emulate_ctxt;
>> + unsigned long val = 0;
>> + unsigned int port;
>> + int size, ret;
>> + bool write;
> ..
>
>> +
>> + ++vcpu->stat.io_exits;
>> +
>> + size = tdvmcall_a0_read(vcpu);
>> + write = tdvmcall_a1_read(vcpu);
> a1 (i.e., R13) should be either 0 or 1. Other values are reserved according to
> the GHCI spec. It is not appropriate to cast it to a boolean. For example, if
> R13=2, KVM shouldn't treat it as a write request; instead, this request should
> be rejected.
Right, will fix it.
Thanks!
>> + port = tdvmcall_a2_read(vcpu);
>> +
>> + if (size != 1 && size != 2 && size != 4) {
>> + tdvmcall_set_return_code(vcpu, TDVMCALL_STATUS_INVALID_OPERAND);
>> + return 1;
>> + }
Powered by blists - more mailing lists