From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 816FF10954 for ; Mon, 20 Nov 2023 09:15:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="cCOor4pL" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0BEFAC433C7; Mon, 20 Nov 2023 09:15:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1700471751; bh=ulfrs1lwWSLiXa93qQO9UqueURMN8+QeUnxSoLFXX0Q=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=cCOor4pLsOHql5WLvcGXZEYvoJJgCdP0dv7gc9dgTo0RnGdI5D/8iHTgNxiym7Nj8 HC8t211AYj0Fg8YlBzkSpaZdVvRGIY4sqBh5fchkBYntgra/yoClh23RI7wLSWdhwe qNXAHk3cLoputk93bBuMHE6mWP9CYewx/CvOYPO75iV5lYufQy0WrMJks5/ZjJh3HH rm3FR8ewEdd8aIhcxRopp5udjy5ou5ka59n70KKKk7mRNQY5+mucUqV9zmrpRAzCMW fmoiWCDtZWmCyy0Ibu2wO0eWCj2FUHXj6AssDx8APgs0r3aMvYr6biIxb3y06rYJxF TbWGhpMfCvqpA== Received: from disco-boy.misterjones.org ([217.182.43.188] helo=www.loen.fr) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1r50Ng-00EfhU-Gk; Mon, 20 Nov 2023 09:15:48 +0000 Precedence: bulk X-Mailing-List: kvmarm@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Date: Mon, 20 Nov 2023 09:15:48 +0000 From: Marc Zyngier To: Kunkun Jiang Cc: Oliver Upton , James Morse , Suzuki K Poulose , Zenghui Yu , Catalin Marinas , Will Deacon , Jean-Philippe Brucker , eric.auger@redhat.com, linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, wanghaibin.wang@huawei.com Subject: Re: [PATCH v2] KVM: arm/arm64: GICv4: Do not perform a map to a mapped vLPI In-Reply-To: <20231119104941.1952-1-jiangkunkun@huawei.com> References: <20231119104941.1952-1-jiangkunkun@huawei.com> User-Agent: Roundcube Webmail/1.4.15 Message-ID: <8a84365107c856e266b206e6e2374ec3@kernel.org> X-Sender: maz@kernel.org Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit X-SA-Exim-Connect-IP: 217.182.43.188 X-SA-Exim-Rcpt-To: jiangkunkun@huawei.com, oliver.upton@linux.dev, james.morse@arm.com, suzuki.poulose@arm.com, yuzenghui@huawei.com, catalin.marinas@arm.com, will@kernel.org, jean-philippe@linaro.org, eric.auger@redhat.com, linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, wanghaibin.wang@huawei.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false On 2023-11-19 10:49, Kunkun Jiang wrote: > Before performing a map, let's check whether the vLPI has been > mapped. This corresponds to checking whether a vLPI is valid > before unmap it. I don't understand this last sentence. Mapping and unmapping are two different actions, and we shouldn't conflate them. > > Fixes: 196b136498b3 ("KVM: arm/arm64: GICv4: Wire mapping/unmapping of > VLPIs in VFIO irq bypass") > Signed-off-by: Kunkun Jiang > --- > arch/arm64/kvm/vgic/vgic-v4.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/arch/arm64/kvm/vgic/vgic-v4.c > b/arch/arm64/kvm/vgic/vgic-v4.c > index 339a55194b2c..fb60bbb94460 100644 > --- a/arch/arm64/kvm/vgic/vgic-v4.c > +++ b/arch/arm64/kvm/vgic/vgic-v4.c > @@ -436,6 +436,11 @@ int kvm_vgic_v4_set_forwarding(struct kvm *kvm, > int virq, > if (ret) > goto out; > > + if (irq->hw) { > + ret = 0; ret is obviously already 0. > + goto out; > + } > + > /* > * Emit the mapping request. If it fails, the ITS probably > * isn't v4 compatible, so let's silently bail out. Holding Furthermore, this really deserves a comment. Something like: /* Silently exit if the vLPI is already mapped */ With these changes: Acked-by: Marc Zyngier Oliver, can you please apply these changes and queue it as a fix for 6.7? Thanks, M. -- Jazz is not dead. It just smells funny... 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 CFB5BC197A0 for ; Mon, 20 Nov 2023 09:16:29 +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-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:Message-ID:References:In-Reply-To:Subject:Cc:To:From :Date:MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=3R/KvF+CCc0AahyiVw7ccDEumGl7Yl/izGb7Q2pphdE=; b=k8/w0sYEAY8sSQH752oNwpxoIR BBPBLWMnRqFaQU/Bl/DXRs2ZcN88uW4RIhsezm5g1pg26CgmDPBSr1Fdq0KfehbuwKWtRheNjJ2Yf GJnK0vXohsdxU+0o8xHBpPE9jcQ+zA663oPQ51E9ToEJH7iwfw0yfVhwil461qdzy79MPae1pkrBa kBCqgmxLtkWgPgwWsdtAxnhz5m8EEJ3H6n5e1WcQ298xjtMPLTyGFMVyPjNw8vsK3ZDEReLxHlOZK dBXbVMezsTfoVOiHWMPz5ASoXw6DcGpUhWjlvbYyrqwDx5GdsSFccDrgC5Zl7PFHcdLLAVi3dcysc JCLiDYmg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r50Nt-00BcZf-0O; Mon, 20 Nov 2023 09:16:01 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r50Nl-00BcXf-0k for linux-arm-kernel@lists.infradead.org; Mon, 20 Nov 2023 09:15:58 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id DEFC461068; Mon, 20 Nov 2023 09:15:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0BEFAC433C7; Mon, 20 Nov 2023 09:15:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1700471751; bh=ulfrs1lwWSLiXa93qQO9UqueURMN8+QeUnxSoLFXX0Q=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=cCOor4pLsOHql5WLvcGXZEYvoJJgCdP0dv7gc9dgTo0RnGdI5D/8iHTgNxiym7Nj8 HC8t211AYj0Fg8YlBzkSpaZdVvRGIY4sqBh5fchkBYntgra/yoClh23RI7wLSWdhwe qNXAHk3cLoputk93bBuMHE6mWP9CYewx/CvOYPO75iV5lYufQy0WrMJks5/ZjJh3HH rm3FR8ewEdd8aIhcxRopp5udjy5ou5ka59n70KKKk7mRNQY5+mucUqV9zmrpRAzCMW fmoiWCDtZWmCyy0Ibu2wO0eWCj2FUHXj6AssDx8APgs0r3aMvYr6biIxb3y06rYJxF TbWGhpMfCvqpA== Received: from disco-boy.misterjones.org ([217.182.43.188] helo=www.loen.fr) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1r50Ng-00EfhU-Gk; Mon, 20 Nov 2023 09:15:48 +0000 MIME-Version: 1.0 Date: Mon, 20 Nov 2023 09:15:48 +0000 From: Marc Zyngier To: Kunkun Jiang Cc: Oliver Upton , James Morse , Suzuki K Poulose , Zenghui Yu , Catalin Marinas , Will Deacon , Jean-Philippe Brucker , eric.auger@redhat.com, linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, wanghaibin.wang@huawei.com Subject: Re: [PATCH v2] KVM: arm/arm64: GICv4: Do not perform a map to a mapped vLPI In-Reply-To: <20231119104941.1952-1-jiangkunkun@huawei.com> References: <20231119104941.1952-1-jiangkunkun@huawei.com> User-Agent: Roundcube Webmail/1.4.15 Message-ID: <8a84365107c856e266b206e6e2374ec3@kernel.org> X-Sender: maz@kernel.org X-SA-Exim-Connect-IP: 217.182.43.188 X-SA-Exim-Rcpt-To: jiangkunkun@huawei.com, oliver.upton@linux.dev, james.morse@arm.com, suzuki.poulose@arm.com, yuzenghui@huawei.com, catalin.marinas@arm.com, will@kernel.org, jean-philippe@linaro.org, eric.auger@redhat.com, linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, wanghaibin.wang@huawei.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231120_011553_474492_2B715479 X-CRM114-Status: GOOD ( 17.95 ) 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-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 2023-11-19 10:49, Kunkun Jiang wrote: > Before performing a map, let's check whether the vLPI has been > mapped. This corresponds to checking whether a vLPI is valid > before unmap it. I don't understand this last sentence. Mapping and unmapping are two different actions, and we shouldn't conflate them. > > Fixes: 196b136498b3 ("KVM: arm/arm64: GICv4: Wire mapping/unmapping of > VLPIs in VFIO irq bypass") > Signed-off-by: Kunkun Jiang > --- > arch/arm64/kvm/vgic/vgic-v4.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/arch/arm64/kvm/vgic/vgic-v4.c > b/arch/arm64/kvm/vgic/vgic-v4.c > index 339a55194b2c..fb60bbb94460 100644 > --- a/arch/arm64/kvm/vgic/vgic-v4.c > +++ b/arch/arm64/kvm/vgic/vgic-v4.c > @@ -436,6 +436,11 @@ int kvm_vgic_v4_set_forwarding(struct kvm *kvm, > int virq, > if (ret) > goto out; > > + if (irq->hw) { > + ret = 0; ret is obviously already 0. > + goto out; > + } > + > /* > * Emit the mapping request. If it fails, the ITS probably > * isn't v4 compatible, so let's silently bail out. Holding Furthermore, this really deserves a comment. Something like: /* Silently exit if the vLPI is already mapped */ With these changes: Acked-by: Marc Zyngier Oliver, can you please apply these changes and queue it as a fix for 6.7? Thanks, M. -- Jazz is not dead. It just smells funny... _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel