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 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A41FBC64ED8 for ; Fri, 24 Feb 2023 21:43:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc: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=Oph8/SbLEzjDLlTJQmGTuPzts5/1uAg+90dkcl+V7Wo=; b=UdKv1T1r7sDV4I R8UXDmlY5M68ORrALgvSsFGxWxal5E5no+UZ+5eUOVi0ThvFthedffavGfoQC0TbMgukzC5yzkVQc +evUp2zGU1FBOxdzPHceH87rx5wGM97bZvUGOmmnx1ImI39axUYrDW09U34HmKsCuJqZCT/Rrm3yw dftuQkP7E6rRTMN9QI9jjfE1Am68zbFSAE7U3dphg2oGg6cBvX/n0eekcYMW1UwvJyguBGPrQFzfj 31klX4BP3x/dvc83NX1vnDecwQ3J9tpcDPlBzAqNxsF02sePYCzQ84rk4hKO84jKsq4wqAPqp0Ffk mA7pY4KYMxiRR8C/Cu+w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pVfqI-00420z-Gu; Fri, 24 Feb 2023 21:43:02 +0000 Received: from out-57.mta1.migadu.com ([2001:41d0:203:375::39]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pVfqE-0041zv-A6 for linux-arm-kernel@lists.infradead.org; Fri, 24 Feb 2023 21:43:00 +0000 Date: Fri, 24 Feb 2023 21:42:48 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1677274973; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=WmSQFrDiHOhPNR+S34Fx8sranVsqnTdjDl048iCZQWc=; b=Ey6v7axCvWWDPveM9+7PWfKV6yHQhB0E5/5wgQXKpj6xIfgmY4WHtT1IUljq6W/mP2VSj/ iq/PZFzAnMpG+cCu9RiJ0a/hGSFqY2QwctDAGhy85sJuFT/Wkg8HCj4hMk9JvjY6WkpOBM pOJxqP8c0QBf3c8/jHJo28KqKcTUmHk= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Oliver Upton To: James Morse Cc: Marc Zyngier , Suzuki K Poulose , kvmarm@lists.linux.dev, Akihiko Odaki , Zenghui Yu , Raghavendra Rao Ananta , linux-arm-kernel@lists.infradead.org, Salil Mehta Subject: Re: [RFC PATCH v2 5/6] KVM: arm64: Add support for KVM_EXIT_HYPERCALL Message-ID: References: <20230211013759.3556016-1-oliver.upton@linux.dev> <20230211013759.3556016-6-oliver.upton@linux.dev> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Migadu-Flow: FLOW_OUT X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230224_134259_147493_8C673293 X-CRM114-Status: GOOD ( 17.80 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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 Hi James, On Fri, Feb 24, 2023 at 03:12:33PM +0000, James Morse wrote: > On 11/02/2023 01:37, Oliver Upton wrote: > > +static void kvm_prepare_hypercall_exit(struct kvm_vcpu *vcpu, u32 func_id, bool smc) > > +{ > > + struct kvm_run *run = vcpu->run; > > + > > + run->exit_reason = KVM_EXIT_HYPERCALL; > > > + run->hypercall.nr = func_id; > > This is a bit weird. The func_id is the x0 value, so it would more naturally live in > run->hypercall.args[0]. > > User-space also needs the SMC/HVC immediate value, as that is only available in the ESR. > It makes more sense to put the immediate value here. Completely buy that userspace has no way of getting at the immediate. But why do we need to expose it in the first place? The UAPI here has been constructed around SMCCC, so the immediate should be zero across the board. Sure, SMCCC says that nonzero values can be used by the hypervisor, but in that case the register interface needn't follow SMCCC (i.e. what if the function ID is in x7 for some silly reason). Curious if there's a use case you had in mind I haven't thought of. > > + if (smc) > > + run->hypercall.flags = KVM_HYPERCALL_EXIT_SMC; Drive by self-review (be warned!): flags needs explicit zeroing, otherwise this flag will remain up for a subsequent HVC. -- Thanks, Oliver _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel