Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp2496362rwb; Mon, 3 Oct 2022 01:19:23 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7R6CdhLa2FjjZsZmNxavnWGP5fbE3pw0PXE8ilmySatJzKyi2ViRxU/YZ6Ca+06CQODsQU X-Received: by 2002:a63:e218:0:b0:448:5163:478f with SMTP id q24-20020a63e218000000b004485163478fmr8417607pgh.415.1664785163506; Mon, 03 Oct 2022 01:19:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664785163; cv=none; d=google.com; s=arc-20160816; b=dzszlcTj04njVp7raE6m9/aD1lzL9fR2GPS6tTuBGgjgugYis+i4QNXoboolY2jgsG 5ThC62rDaui/lMsyp+peBN9Y382fzP5HzLZXI9SlDDwf3eHdzE3RTOe7nyH/n+avNOND okMkqCz+pCfx8IyOMjH6T001JVTzYdU20w0F+IMf71bAjxqsh4ZWap1RQbD6FYzAlUIQ acO8/w1TGg9E720z2R0LgR5c4lCW4Fh6EJPaKQsWnxg+eMKM7k2ZW9tfpPxdiFx0YqF0 9+PrarqbbEUyQdkUr6Rm2fO8D58vgZU5HX0LCYMo0Rcfeq8NJx3t7dtAoQ3PQkZVnGlw T6zg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=k4u6CSmPBFratT8nBE20qqbFLOcJRTSR0U3cklykyPI=; b=iovpXhqPcU00zMjtHrXq20t1eJQlxo5aW4VGpw8ptV0zWgQCjwpEtaSaVmjDFw6Eqx nRmeWkq7wQ6QvSTLHQfR+ef2cTU7cWBnr/btInd9buM8iJWzeAIs1t6Qj5xe2L88VfLY LVju4/4HNUcFLsSiWGmIVd3acL3nmlwZ8KeBWTxIcyksaxQIn5f7GmN97fXOqwD7J9OG TaThq6b7Pej6YG9j8WUh2fcPU7ynJuCIf3fYvp/jV3dwnjenfjy8CLe5H4vbegb8Ihlc aUEgDB/xhxYqaY0YsuxFR9vzgM6eVsCdMSz1nYg4KxoSYvszG0zLapZ4+m86tM637cek F2ng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ub4X5N3l; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e19-20020a63f553000000b004398688a988si10963341pgk.382.2022.10.03.01.19.11; Mon, 03 Oct 2022 01:19:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ub4X5N3l; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231237AbiJCHcO (ORCPT + 99 others); Mon, 3 Oct 2022 03:32:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43554 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231210AbiJCHbQ (ORCPT ); Mon, 3 Oct 2022 03:31:16 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C588D4D80F; Mon, 3 Oct 2022 00:20:29 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 3062360FC1; Mon, 3 Oct 2022 07:20:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4672BC433D6; Mon, 3 Oct 2022 07:20:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664781628; bh=Qehyhczy34GYCAxTdZ+1feiRyWrmxMPUNWaUD+1T+aA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ub4X5N3lsiB2SdBtGa3MZ8YsZi8wJj7xn+HoUlgPrEKDoE6lNEYq6NmTn9wIVEbvB AQu1kCL/yjFEIdb9tHHQH9PfY/vyepAUwf8qUg4i0ohsOZpXnhWcGTHo5Pf30I+YIk sX6npY/udz9+RCQHnYsIShDHo56skMQApXQAx6b8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Angus Chen , Jason Wang , "Michael S. Tsirkin" , Zhu Lingshan , Sasha Levin Subject: [PATCH 5.15 65/83] vdpa/ifcvf: fix the calculation of queuepair Date: Mon, 3 Oct 2022 09:11:30 +0200 Message-Id: <20221003070723.626652120@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221003070721.971297651@linuxfoundation.org> References: <20221003070721.971297651@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Angus Chen [ Upstream commit db5db1a00d0816207be3a0166fcb4f523eaf3b52 ] The q_pair_id to address a queue pair in the lm bar should be calculated by queue_id / 2 rather than queue_id / nr_vring. Fixes: 2ddae773c93b ("vDPA/ifcvf: detect and use the onboard number of queues directly") Signed-off-by: Angus Chen Reviewed-by: Jason Wang Reviewed-by: Michael S. Tsirkin Acked-by: Zhu Lingshan Message-Id: <20220923091013.191-1-angus.chen@jaguarmicro.com> Signed-off-by: Michael S. Tsirkin Signed-off-by: Sasha Levin --- drivers/vdpa/ifcvf/ifcvf_base.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/vdpa/ifcvf/ifcvf_base.c b/drivers/vdpa/ifcvf/ifcvf_base.c index 7d41dfe48ade..5091ff9d6c93 100644 --- a/drivers/vdpa/ifcvf/ifcvf_base.c +++ b/drivers/vdpa/ifcvf/ifcvf_base.c @@ -327,7 +327,7 @@ u16 ifcvf_get_vq_state(struct ifcvf_hw *hw, u16 qid) u32 q_pair_id; ifcvf_lm = (struct ifcvf_lm_cfg __iomem *)hw->lm_cfg; - q_pair_id = qid / hw->nr_vring; + q_pair_id = qid / 2; avail_idx_addr = &ifcvf_lm->vring_lm_cfg[q_pair_id].idx_addr[qid % 2]; last_avail_idx = ifc_ioread16(avail_idx_addr); @@ -341,7 +341,7 @@ int ifcvf_set_vq_state(struct ifcvf_hw *hw, u16 qid, u16 num) u32 q_pair_id; ifcvf_lm = (struct ifcvf_lm_cfg __iomem *)hw->lm_cfg; - q_pair_id = qid / hw->nr_vring; + q_pair_id = qid / 2; avail_idx_addr = &ifcvf_lm->vring_lm_cfg[q_pair_id].idx_addr[qid % 2]; hw->vring[qid].last_avail_idx = num; ifc_iowrite16(num, avail_idx_addr); -- 2.35.1