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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DE5A3CA0EC3 for ; Tue, 12 Sep 2023 13:14:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235391AbjILNOR (ORCPT ); Tue, 12 Sep 2023 09:14:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54570 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235531AbjILNOF (ORCPT ); Tue, 12 Sep 2023 09:14:05 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D3F9C19AD for ; Tue, 12 Sep 2023 06:07:15 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7BAD5C433C7; Tue, 12 Sep 2023 13:07:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1694524035; bh=zc+anFrDxyaIxmTBk8RiH3yEVkBLLz+pPnUwEmsdLlo=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=qnw6Ai3INePJNahBUb/EPn0fFcc7gqV6/poTDmTeVc6g/wWqKUueEXpbqCqAQkAyS WdHNrvgJG+lcsbl7qY7Rcaea5ZOsQ1pTwpigB+Ira6DzXP60rL3zpfkIZLkXTAIH10 8AmASd73uAmJGa/1mDdOZxyuKq4AiJGqVfhBt77w8ZOHvOEz6v9ZRl6QJUjNOARKOG 7QBFOLN4vCuM4ZPRvvVoJPhncieIExi5UK6+nBV56DzzAuD37EYExcrOxgp2bjTByX nxQr/TG/cuQEER+WIbs43qxvCGwlNS+MKtCNC7SFeNxG64M8eVz/Sk8NRWEPS/vNxQ QIm9F1wfz/Meg== Received: from [104.132.96.100] (helo=wait-a-minute.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1qg36m-00CGvE-Rr; Tue, 12 Sep 2023 14:07:13 +0100 Date: Tue, 12 Sep 2023 14:07:07 +0100 Message-ID: <87fs3j4k1w.wl-maz@kernel.org> From: Marc Zyngier To: Zenghui Yu Cc: kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org, James Morse , Suzuki K Poulose , Oliver Upton , Zenghui Yu , Xu Zhao Subject: Re: [PATCH 4/5] KVM: arm64: vgic-v3: Refactor GICv3 SGI generation In-Reply-To: <963a899d-d25a-368f-1465-851787c25959@linux.dev> References: <20230907100931.1186690-1-maz@kernel.org> <20230907100931.1186690-5-maz@kernel.org> <87ledd51tu.wl-maz@kernel.org> <963a899d-d25a-368f-1465-851787c25959@linux.dev> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/28.2 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 104.132.96.100 X-SA-Exim-Rcpt-To: zenghui.yu@linux.dev, kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org, james.morse@arm.com, suzuki.poulose@arm.com, oliver.upton@linux.dev, yuzenghui@huawei.com, zhaoxu.35@bytedance.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org On Mon, 11 Sep 2023 16:57:39 +0100, Zenghui Yu wrote: > > On 2023/9/11 02:18, Marc Zyngier wrote: > > On Sun, 10 Sep 2023 17:25:36 +0100, > > Zenghui Yu wrote: > >> > >> Hi Marc, > >> > >> I asked because it seems that in kvm/arm64 we always use > >> kvm_get_vcpu(kvm, i) to obtain the kvm_vcpu pointer, even if *i* is > >> sometimes essentially provided by userspace.. > > > > Huh, this is incredibly dodgy. I had a go at a few occurrences (see > > below), but this is hardly a complete list. > > Another case is all kvm_get_vcpu(kvm, target_addr) in the vgic-its > emulation code. As we expose GITS_TYPER.PTA=0 to guest, which indicates > that the target address corresponds to the PE number specified by > GICR_TYPER.Processor_Number, which is now encoded as vcpu->vcpu_id. Yup, that's indeed missing. I'm going to hack kvmtool to generate stupid vcpu_ids and see what explodes... Thanks, M. -- Without deviation from the norm, progress is not possible.