From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DFB62C433DF for ; Thu, 20 Aug 2020 09:45:19 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id AF0B72173E for ; Thu, 20 Aug 2020 09:45:19 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="KT6MWaTm"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="LxUe/5zO" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AF0B72173E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=Jn7a3DP7HJJE1kDGf9XwxqSXjyhmepUgt1IsxMHfG34=; b=KT6MWaTmnMRmGw3f/aM8MIef0 Bb136l8yrBrTRXMf+oLD5+pA5u83xbi8TCUxN2ZOo6J/lXWC1dPyLo7mlf3X+TI4IYbP7oPmMbHb5 CWW8qmilNi5xAAKcjz7Tgnuvl8HY9PV3aFW0oNaf7bvVzhXyi12zYAu0CKPN+DnLr901hQXFUErU+ WxRCwq3f5HE57EnEQGr2ewE98pJEeX02QTAvhPK6o/lIUhWCtbsoSIEBaLoEEIynpS6Kn0PnfOwVi FMPp4NEzDyTomR85l5h1Dg1iopKiS/IVhkcjIc1WtXIghjLPo6ZdxBG+wGgi+9FNFtzj/DSpqs2Gz bQ/VObU9A==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1k8h6T-0001v4-Er; Thu, 20 Aug 2020 09:43:25 +0000 Received: from mail.kernel.org ([198.145.29.99]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1k8h6R-0001uR-FT for linux-arm-kernel@lists.infradead.org; Thu, 20 Aug 2020 09:43:24 +0000 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 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-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200820_054323_676947_2D5F101B X-CRM114-Status: GOOD ( 28.97 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , "maz@kernel.org" , Justin He , Wei Chen , "kvm@vger.kernel.org" , Suzuki Poulose , "netdev@vger.kernel.org" , "richardcochran@gmail.com" , Steve Capper , "linux-kernel@vger.kernel.org" , "sean.j.christopherson@intel.com" , Steven Price , Kaly Xin , "john.stultz@linaro.org" , "yangbo.lu@nxp.com" , "pbonzini@redhat.com" , "tglx@linutronix.de" , nd , "kvmarm@lists.cs.columbia.edu" , "linux-arm-kernel@lists.infradead.org" Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel