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 smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (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 44D18C433FE for ; Thu, 7 Apr 2022 01:13:47 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id E5F7E8125A; Thu, 7 Apr 2022 01:13:46 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id oPKSyJsoSmfU; Thu, 7 Apr 2022 01:13:46 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp1.osuosl.org (Postfix) with ESMTPS id 8DE6880EE3; Thu, 7 Apr 2022 01:13:45 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 63078C001D; Thu, 7 Apr 2022 01:13:45 +0000 (UTC) Received: from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136]) by lists.linuxfoundation.org (Postfix) with ESMTP id A6BEDC0012 for ; Thu, 7 Apr 2022 01:13:43 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 952B060F41 for ; Thu, 7 Apr 2022 01:13:43 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Authentication-Results: smtp3.osuosl.org (amavisd-new); dkim=pass (2048-bit key) header.d=kernel.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 aO1bWUnZ5kmf for ; Thu, 7 Apr 2022 01:13:42 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by smtp3.osuosl.org (Postfix) with ESMTPS id B5BA460C03 for ; Thu, 7 Apr 2022 01:13:42 +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 ams.source.kernel.org (Postfix) with ESMTPS id 28636B8261D; Thu, 7 Apr 2022 01:13:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E99DFC385A1; Thu, 7 Apr 2022 01:13:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1649294019; bh=1kWx12Muyv7hyNQivimjk08S38ZMZK/FXxmUOm/fI48=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Yf7rd6C0sV/g2dfLevLmfrKjlGzmGtO30PxM6zHxgHTOxeK4fjb4vlejk0QpgEDrK qf6PYw/+pDjjRJWANJHaW8LU3IkPHwkIDZN3HKSbSXMdnfWRuF9huywTobAZuWd/ix asfncoleUEWoP/2LfGJongadxA5mFUyQ6AxAcnGl8/ygYImohr5Am0HfoNuUKJPVUn Cb77jv/wdB4nDq5a/4Y7xVpBPT7V17Q27O36JzjqFHdQ/lUz8/KGe/vXcb04uXHj/h csDgAiaBhemkTaaxeqmEIa+YwrdaxpdgENWH5yKm1beV6sFHXLTteMqtwK+cRQuq64 J457U3vj+gAWA== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: [PATCH AUTOSEL 5.15 16/27] vhost_vdpa: don't setup irq offloading when irq_num < 0 Date: Wed, 6 Apr 2022 21:12:46 -0400 Message-Id: <20220407011257.114287-16-sashal@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220407011257.114287-1-sashal@kernel.org> References: <20220407011257.114287-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 d62f05d056b7..299a99532618 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 6263FC433FE for ; Thu, 7 Apr 2022 01:31:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242114AbiDGBcF (ORCPT ); Wed, 6 Apr 2022 21:32:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32870 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238845AbiDGBSj (ORCPT ); Wed, 6 Apr 2022 21:18:39 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6B25D1A1285; Wed, 6 Apr 2022 18:13:42 -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 24B22B81E79; Thu, 7 Apr 2022 01:13:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E99DFC385A1; Thu, 7 Apr 2022 01:13:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1649294019; bh=1kWx12Muyv7hyNQivimjk08S38ZMZK/FXxmUOm/fI48=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Yf7rd6C0sV/g2dfLevLmfrKjlGzmGtO30PxM6zHxgHTOxeK4fjb4vlejk0QpgEDrK qf6PYw/+pDjjRJWANJHaW8LU3IkPHwkIDZN3HKSbSXMdnfWRuF9huywTobAZuWd/ix asfncoleUEWoP/2LfGJongadxA5mFUyQ6AxAcnGl8/ygYImohr5Am0HfoNuUKJPVUn Cb77jv/wdB4nDq5a/4Y7xVpBPT7V17Q27O36JzjqFHdQ/lUz8/KGe/vXcb04uXHj/h csDgAiaBhemkTaaxeqmEIa+YwrdaxpdgENWH5yKm1beV6sFHXLTteMqtwK+cRQuq64 J457U3vj+gAWA== 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.15 16/27] vhost_vdpa: don't setup irq offloading when irq_num < 0 Date: Wed, 6 Apr 2022 21:12:46 -0400 Message-Id: <20220407011257.114287-16-sashal@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220407011257.114287-1-sashal@kernel.org> References: <20220407011257.114287-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 d62f05d056b7..299a99532618 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