Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp1216425pxa; Thu, 20 Aug 2020 05:56:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxAWwEx2HhXrTZf+nfRE6UYjMh1W7Qo1GXQMp8ryBmdE/eynBNe5b4otkvA6tjTAu98VkWV X-Received: by 2002:a17:906:6146:: with SMTP id p6mr3195933ejl.211.1597928217703; Thu, 20 Aug 2020 05:56:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597928217; cv=none; d=google.com; s=arc-20160816; b=U49qmYDgbVeMxipiawgveZDXtLtgWXnEV56ps71dfUoLyWSuXfJlscbQHLbw9MENmO P9TWoVQBRwrhwXhv0Cj7aFHeVBeLkcV7BXt9E+ga9ILJARQrcaVb4By6Cb2K3xKWTGjE 5o2KSpjTIPn69klJd4XwCPPJsBnIKpItptMfuCfJC1iURkk1ueYBRc0ATkm01CQWskSn 3EoJH/gbdDjSllHYRnuADx83X/3sMeD+BHeykBBeS6ttSNufrwSv3qg6qYrLBf1Ju0Fp X50mTOLSKCLWfzQlGOU7JbHSEZE+dvsDOLxUQnPMQ22TLsipid7FWMkktVNto3uQ0QDq UdLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=1ixRprnQ2x05vajrJxKEMur80wmgJ5QsYzwvsmP0BGo=; b=VzsQR2TjqlkHKjaLJ/maUbVJ4shIqM/ZoCmPyg6nhISrLF9bdsN8zYbrfRlGIWx+XR GMCY+81+ANuIFk4p6nMDzA1WB/mEAM5/rwaZTm14UE93V6dO/9LZyM0tj0c3q5O/ML4L UE7kn9tfRwSNqt3K4Qf6xgv4WXM7YIx+8DN2ZKdFeLWsu78F6/NWc1Dl8WBt0uPHA3H8 5VVe6qpcZPfnRJO0Z7lvykG1qdt9IA7nJOnFjn9RoZvnG503s6TZ8vV3xVHBWspp0tvA 3cwUgv7uCuyREBSQvq1KHbaab/5Txm84wp0DKebUQIbu9ZOHQ8JGBtF83/D/UQ1p7T9B iACw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="LxUe/5zO"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dc15si1094328ejb.374.2020.08.20.05.56.33; Thu, 20 Aug 2020 05:56:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="LxUe/5zO"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729578AbgHTMyA (ORCPT + 99 others); Thu, 20 Aug 2020 08:54:00 -0400 Received: from mail.kernel.org ([198.145.29.99]:40958 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729236AbgHTJnX (ORCPT ); Thu, 20 Aug 2020 05:43:23 -0400 Received: from willie-the-truck (236.31.169.217.in-addr.arpa [217.169.31.236]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id C285F20724; Thu, 20 Aug 2020 09:43:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597916602; bh=CnunxCsOvBU/gUFXe+EXz0IAGG4b1qj7pIVDUrpfZWg=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=LxUe/5zOhpUu0yX3QPQi/2NIS3QBRStNZyzIAXegfpS5FX55TPD3T3rBBxX49W404 pxpLHhvfzBFfEL+qweR6QBJe8n8M0SifTa+Y0PGkqpTqM1J2zqQNThqD9utBYHkaWm UJ3W7NW4FCAaIbpLQhWuXnyKqLZ+xGPa//aVByaE= Date: Thu, 20 Aug 2020 10:43:15 +0100 From: Will Deacon To: Jianyong Wu Cc: "netdev@vger.kernel.org" , "yangbo.lu@nxp.com" , "john.stultz@linaro.org" , "tglx@linutronix.de" , "pbonzini@redhat.com" , "sean.j.christopherson@intel.com" , "maz@kernel.org" , "richardcochran@gmail.com" , Mark Rutland , Suzuki Poulose , Steven Price , "linux-kernel@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , "kvmarm@lists.cs.columbia.edu" , "kvm@vger.kernel.org" , Steve Capper , Kaly Xin , Justin He , Wei Chen , nd Subject: Re: [PATCH v13 2/9] arm/arm64: KVM: Advertise KVM UID to guests via SMCCC Message-ID: <20200820094314.GA18838@willie-the-truck> References: <20200619130120.40556-1-jianyong.wu@arm.com> <20200619130120.40556-3-jianyong.wu@arm.com> <20200727113821.GB20437@willie-the-truck> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jul 28, 2020 at 01:07:14AM +0000, Jianyong Wu wrote: > > > > -----Original Message----- > > From: Will Deacon > > Sent: Monday, July 27, 2020 7:38 PM > > To: Jianyong Wu > > Cc: netdev@vger.kernel.org; yangbo.lu@nxp.com; john.stultz@linaro.org; > > tglx@linutronix.de; pbonzini@redhat.com; sean.j.christopherson@intel.com; > > maz@kernel.org; richardcochran@gmail.com; Mark Rutland > > ; Suzuki Poulose ; > > Steven Price ; linux-kernel@vger.kernel.org; linux- > > arm-kernel@lists.infradead.org; kvmarm@lists.cs.columbia.edu; > > kvm@vger.kernel.org; Steve Capper ; Kaly Xin > > ; Justin He ; Wei Chen > > ; nd > > Subject: Re: [PATCH v13 2/9] arm/arm64: KVM: Advertise KVM UID to guests > > via SMCCC > > > > On Mon, Jul 27, 2020 at 03:45:37AM +0000, Jianyong Wu wrote: > > > > From: Will Deacon > > > > > > > > We can advertise ourselves to guests as KVM and provide a basic > > > > features bitmap for discoverability of future hypervisor services. > > > > > > > > Cc: Marc Zyngier > > > > Signed-off-by: Will Deacon > > > > Signed-off-by: Jianyong Wu > > > > --- > > > > arch/arm64/kvm/hypercalls.c | 29 +++++++++++++++++++---------- > > > > 1 file changed, 19 insertions(+), 10 deletions(-) > > > > > > > > diff --git a/arch/arm64/kvm/hypercalls.c > > > > b/arch/arm64/kvm/hypercalls.c index 550dfa3e53cd..db6dce3d0e23 > > > > 100644 > > > > --- a/arch/arm64/kvm/hypercalls.c > > > > +++ b/arch/arm64/kvm/hypercalls.c > > > > @@ -12,13 +12,13 @@ > > > > int kvm_hvc_call_handler(struct kvm_vcpu *vcpu) { > > > > u32 func_id = smccc_get_function(vcpu); > > > > - long val = SMCCC_RET_NOT_SUPPORTED; > > > > + u32 val[4] = {SMCCC_RET_NOT_SUPPORTED}; > > > > > > There is a risk as this u32 value will return here and a u64 value > > > will be obtained in guest. For example, The val[0] is initialized as > > > -1 of 0xffffffff and the guest get 0xffffffff then it will be compared > > > with -1 of 0xffffffffffffffff Also this problem exists for the > > > transfer of address in u64 type. So the following assignment to "val" > > > should be split into two > > > u32 value and assign to val[0] and val[1] respectively. > > > WDYT? > > > > Yes, I think you're right that this is a bug, but isn't the solution just to make > > that an array of 'long'? > > > > long val [4]; > > > > That will sign-extend the negative error codes as required, while leaving the > > explicitly unsigned UID constants alone. > > Ok, that's much better. I will fix it at next version. > > By the way, I wonder when will you update this patch set. I see someone like me > adopt this patch set as code base and need rebase it every time, so expect your update. I'm not working on it, so please feel free to include it along with the patches that add an upstream user. Will