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.6 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,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 2C74FC433E3 for ; Thu, 20 Aug 2020 12:53:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 057CA207DE for ; Thu, 20 Aug 2020 12:53:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597928036; bh=CnunxCsOvBU/gUFXe+EXz0IAGG4b1qj7pIVDUrpfZWg=; h=Date:From:To:Cc:Subject:References:In-Reply-To:List-ID:From; b=ediwDT0aZoBDesCG+8OK3G6z4JMdncKT/hUbrzJKL2O51q2zJfg66kDp2vdXZpJJZ a5ed0EfFvPUNFHANv4sgsaR9kxx9tt/kH/V27umF6CaCNXJ3mUCr+UwVjX/j/4oRDO 9wlJIQlY15RHetqSWLZq8QcTndo6fg2dO0bat1H0= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730291AbgHTMxp (ORCPT ); Thu, 20 Aug 2020 08:53:45 -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: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@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