From patchwork Tue Feb 22 07:01:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zhu, Lingshan" X-Patchwork-Id: 12754593 X-Patchwork-Delegate: kuba@kernel.org 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 0B5A5C433F5 for ; Tue, 22 Feb 2022 07:08:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230392AbiBVHJK (ORCPT ); Tue, 22 Feb 2022 02:09:10 -0500 Received: from gmail-smtp-in.l.google.com ([23.128.96.19]:59488 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230382AbiBVHJG (ORCPT ); Tue, 22 Feb 2022 02:09:06 -0500 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 39FC0B151A for ; Mon, 21 Feb 2022 23:08:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1645513722; x=1677049722; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=u7sfhBlDXqoF4USnYs/Zw05QturZAb6oqbYahKFO2vU=; b=lb4Kd8ibEa6yXK3dvoGcQNliIU7U3HgC/2IUeGTJqJRYiJVNZH7vqtK1 DFp0w9LL4aRxJV5zVQt7Wd11LiNfIsA4b8xjv1SEDqAs66bAigTHG3Aln wUfT+9VBTSiEplwd65cqViGueuNHyOOZBI2jce/KWbGZyqe+YhegM4lqr 558MwAiRr4Kq1qybnH0BbwyRQNxsXbFRSU7cl5ibnUoYBWmeNDOJNjrvZ AuA4/5tGZHjHOXFbKUo+jijZg2i+ovAv7SrU1JVW6hkIMjHR6IbT1VgKA FgPxAD5PHC4alAGeSWqTXQOKh9ysdgiyesJ69JMvtVMObcUr0Z+pQRPW+ A==; X-IronPort-AV: E=McAfee;i="6200,9189,10265"; a="249207304" X-IronPort-AV: E=Sophos;i="5.88,387,1635231600"; d="scan'208";a="249207304" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Feb 2022 23:08:42 -0800 X-IronPort-AV: E=Sophos;i="5.88,387,1635231600"; d="scan'208";a="776207136" Received: from unknown (HELO cra01infra01.deacluster.intel.com) ([10.240.193.73]) by fmsmga006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Feb 2022 23:08:40 -0800 From: Zhu Lingshan To: mst@redhat.com, jasowang@redhat.com Cc: netdev@vger.kernel.org, virtualization@lists.linux-foundation.org, Zhu Lingshan Subject: [PATCH V5 2/5] vhost_vdpa: don't setup irq offloading when irq_num < 0 Date: Tue, 22 Feb 2022 15:01:06 +0800 Message-Id: <20220222070109.931260-3-lingshan.zhu@intel.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20220222070109.931260-1-lingshan.zhu@intel.com> References: <20220222070109.931260-1-lingshan.zhu@intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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 --- 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 851539807bc9..8f53a8478c28 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;