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 smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (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 9125BC433F5 for ; Thu, 7 Apr 2022 01:12:28 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 3AA4D60B1E; Thu, 7 Apr 2022 01:12:28 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 8d5eL-eEG9ZP; Thu, 7 Apr 2022 01:12:27 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp3.osuosl.org (Postfix) with ESMTPS id E1A3B60DFC; Thu, 7 Apr 2022 01:12:26 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id B68C1C002C; Thu, 7 Apr 2022 01:12:26 +0000 (UTC) Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by lists.linuxfoundation.org (Postfix) with ESMTP id 80C0EC0012 for ; Thu, 7 Apr 2022 01:12:25 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 5F9D6408E6 for ; Thu, 7 Apr 2022 01:12:25 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Authentication-Results: smtp2.osuosl.org (amavisd-new); dkim=pass (2048-bit key) header.d=kernel.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id IK4KeCRHKFmR for ; Thu, 7 Apr 2022 01:12:24 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by smtp2.osuosl.org (Postfix) with ESMTPS id AC16940570 for ; Thu, 7 Apr 2022 01:12:24 +0000 (UTC) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E36C561DAE; Thu, 7 Apr 2022 01:12:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A3B1AC385A6; Thu, 7 Apr 2022 01:12:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1649293943; bh=FyfMAb4pET40laDeBOm8DWu3wFtvWQJja39+vtrswb0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HGEdnFUVi9a4k82QsNpcv8na+CCb3W2DKMNK3tfL4Dl9pCFjv8KStZm8DVSv+yCyq 9fKl8azpRIbqP0bQ4DSsBRAYJP/bCS0o7QSau85UGIWqIqFFjoqTmJyJFEjCWMWWNO mD/UWcGY+Z+a0jwP48UYk+cZQ2aWV72zghuoDmOfZTGCfGOah+gx347Pn8s8S2ytNQ 0Tyo9eJFXVEcrSX7Iq3OeTBVUvRuCvwFD9L06YDSiQT2UTl2duFmA6fGC6si1dRns9 NsKiEDUj/UstxKuf4OnaVlHsydSPYYorkbaj/eLSRBit6XAC30J+JQZHHv0+DOd7mX c2+6u6NOkJukQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: [PATCH AUTOSEL 5.16 19/30] vhost_vdpa: don't setup irq offloading when irq_num < 0 Date: Wed, 6 Apr 2022 21:11:29 -0400 Message-Id: <20220407011140.113856-19-sashal@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220407011140.113856-1-sashal@kernel.org> References: <20220407011140.113856-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Cc: Sasha Levin , kvm@vger.kernel.org, "Michael S . Tsirkin" , netdev@vger.kernel.org, virtualization@lists.linux-foundation.org, Zhu Lingshan X-BeenThere: virtualization@lists.linux-foundation.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Linux virtualization List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: virtualization-bounces@lists.linux-foundation.org Sender: "Virtualization" From: Zhu Lingshan [ Upstream commit cce0ab2b2a39072d81f98017f7b076f3410ef740 ] When irq number is negative(e.g., -EINVAL), the virtqueue may be disabled or the virtqueues are sharing a device irq. In such case, we should not setup irq offloading for a virtqueue. Signed-off-by: Zhu Lingshan Link: https://lore.kernel.org/r/20220222115428.998334-3-lingshan.zhu@intel.com Signed-off-by: Michael S. Tsirkin Signed-off-by: Sasha Levin --- drivers/vhost/vdpa.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/vhost/vdpa.c b/drivers/vhost/vdpa.c index e3c4f059b21a..2c226329c132 100644 --- a/drivers/vhost/vdpa.c +++ b/drivers/vhost/vdpa.c @@ -97,8 +97,11 @@ static void vhost_vdpa_setup_vq_irq(struct vhost_vdpa *v, u16 qid) return; irq = ops->get_vq_irq(vdpa, qid); + if (irq < 0) + return; + irq_bypass_unregister_producer(&vq->call_ctx.producer); - if (!vq->call_ctx.ctx || irq < 0) + if (!vq->call_ctx.ctx) return; vq->call_ctx.producer.token = vq->call_ctx.ctx; -- 2.35.1 _______________________________________________ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization 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 5A58FC433FE for ; Thu, 7 Apr 2022 01:19:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238270AbiDGBV0 (ORCPT ); Wed, 6 Apr 2022 21:21:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33322 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237238AbiDGBRS (ORCPT ); Wed, 6 Apr 2022 21:17:18 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2ECBB194780; Wed, 6 Apr 2022 18:12:26 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 15D7DB8268A; Thu, 7 Apr 2022 01:12:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A3B1AC385A6; Thu, 7 Apr 2022 01:12:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1649293943; bh=FyfMAb4pET40laDeBOm8DWu3wFtvWQJja39+vtrswb0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HGEdnFUVi9a4k82QsNpcv8na+CCb3W2DKMNK3tfL4Dl9pCFjv8KStZm8DVSv+yCyq 9fKl8azpRIbqP0bQ4DSsBRAYJP/bCS0o7QSau85UGIWqIqFFjoqTmJyJFEjCWMWWNO mD/UWcGY+Z+a0jwP48UYk+cZQ2aWV72zghuoDmOfZTGCfGOah+gx347Pn8s8S2ytNQ 0Tyo9eJFXVEcrSX7Iq3OeTBVUvRuCvwFD9L06YDSiQT2UTl2duFmA6fGC6si1dRns9 NsKiEDUj/UstxKuf4OnaVlHsydSPYYorkbaj/eLSRBit6XAC30J+JQZHHv0+DOd7mX c2+6u6NOkJukQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Zhu Lingshan , "Michael S . Tsirkin" , Sasha Levin , jasowang@redhat.com, kvm@vger.kernel.org, virtualization@lists.linux-foundation.org, netdev@vger.kernel.org Subject: [PATCH AUTOSEL 5.16 19/30] vhost_vdpa: don't setup irq offloading when irq_num < 0 Date: Wed, 6 Apr 2022 21:11:29 -0400 Message-Id: <20220407011140.113856-19-sashal@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220407011140.113856-1-sashal@kernel.org> References: <20220407011140.113856-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Zhu Lingshan [ Upstream commit cce0ab2b2a39072d81f98017f7b076f3410ef740 ] When irq number is negative(e.g., -EINVAL), the virtqueue may be disabled or the virtqueues are sharing a device irq. In such case, we should not setup irq offloading for a virtqueue. Signed-off-by: Zhu Lingshan Link: https://lore.kernel.org/r/20220222115428.998334-3-lingshan.zhu@intel.com Signed-off-by: Michael S. Tsirkin Signed-off-by: Sasha Levin --- drivers/vhost/vdpa.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/vhost/vdpa.c b/drivers/vhost/vdpa.c index e3c4f059b21a..2c226329c132 100644 --- a/drivers/vhost/vdpa.c +++ b/drivers/vhost/vdpa.c @@ -97,8 +97,11 @@ static void vhost_vdpa_setup_vq_irq(struct vhost_vdpa *v, u16 qid) return; irq = ops->get_vq_irq(vdpa, qid); + if (irq < 0) + return; + irq_bypass_unregister_producer(&vq->call_ctx.producer); - if (!vq->call_ctx.ctx || irq < 0) + if (!vq->call_ctx.ctx) return; vq->call_ctx.producer.token = vq->call_ctx.ctx; -- 2.35.1