Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp6260610pxb; Tue, 16 Feb 2021 22:53:58 -0800 (PST) X-Google-Smtp-Source: ABdhPJxHORNhgAa/qocG0G0RBwMLBA3Q1UoH2lP6q+6A9sOc8PcbSxa6sxDIXk3B0EsKe+4sPllU X-Received: by 2002:aa7:d617:: with SMTP id c23mr24599283edr.215.1613544838156; Tue, 16 Feb 2021 22:53:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613544838; cv=none; d=google.com; s=arc-20160816; b=vkhbhPB6eLI5IXYhDozqO7GX5cXOH59wKT27se5iEAjiUu7siiRqOMyhfEoetiffjg f2UuatLkgIiJfMqZVLVlbYgNgKNJwrhdPL+vWvpXdlt9HwYf06QXQc1fC9qbhRzNWJsb yNB13/10MoxCO2efAiN9bwxNtHbfyZxUdNYLjpACJevLbySnce6cIXCePSl0rJcqPCKM LoPFF4yBZ0NeLq9aSvtx9qy19uAc3arQpJW3llUzL41GiOnpYANdlqtMTZXxUMZHmdvK /Rr5Yb43uJh4bZWq62FbeW7Z76/AfGoVAIrVsG5m4I6xMXZi31oDCGNZGpAF8yq4C26Q yuBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:dkim-signature:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=gXlU4wj89dRtYqmSRTd3ZCIacCt3jo7TZ0QmF2GeH/w=; b=h6OhHfDWlt7hiHG/Bh68AGZXMkh/7RNexzw+MmPmBQgIDJ3Nn/Xslum4FuXgUmWewi ONQEXbG7Te4Hfqziuv4yyPXpMaXv2NEuQ88Cz/Dk29JtlA6sm+VkgUdoiBfPjK76VgK9 3ir7jZpDqQTl6RsZlfqM8tGQRScvQnGDQDQIfg33sotK+P+NPrFXiC+ZxkbDxJZgKciO IbvUBkN5eoqDG5GAKbv7HNeg2tURI+Qail8lcuDiKIqJOJ5W2aStXGBQUnUxOT6N0+PU /z1iYtY/IiTqbysWJP0s+4rffgzjngtz81YU1udNF9pmCDFDxu2Gq354zlOAVMHJAKg8 1Yxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=D51MUk6a; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y18si732936edr.152.2021.02.16.22.53.35; Tue, 16 Feb 2021 22:53:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=D51MUk6a; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231145AbhBQGwY (ORCPT + 99 others); Wed, 17 Feb 2021 01:52:24 -0500 Received: from hqnvemgate25.nvidia.com ([216.228.121.64]:3373 "EHLO hqnvemgate25.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231589AbhBQGwN (ORCPT ); Wed, 17 Feb 2021 01:52:13 -0500 Received: from hqmail.nvidia.com (Not Verified[216.228.121.13]) by hqnvemgate25.nvidia.com (using TLS: TLSv1.2, AES256-SHA) id ; Tue, 16 Feb 2021 22:51:29 -0800 Received: from mtl-vdi-166.wap.labs.mlnx (172.20.145.6) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 17 Feb 2021 06:51:27 +0000 Date: Wed, 17 Feb 2021 08:51:23 +0200 From: Eli Cohen To: Si-Wei Liu CC: Jason Wang , , , , , Subject: Re: [PATCH v1] vdpa/mlx5: Restore the hardware used index after change map Message-ID: <20210217065123.GA128881@mtl-vdi-166.wap.labs.mlnx> References: <0d592ed0-3cea-cfb0-9b7b-9d2755da3f12@redhat.com> <20210208100445.GA173340@mtl-vdi-166.wap.labs.mlnx> <379d79ff-c8b4-9acb-1ee4-16573b601973@redhat.com> <20210209061232.GC210455@mtl-vdi-166.wap.labs.mlnx> <411ff244-a698-a312-333a-4fdbeb3271d1@redhat.com> <24d383db-e65c-82ff-9948-58ead3fc502b@oracle.com> <20210210154531.GA70716@mtl-vdi-166.wap.labs.mlnx> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.5 (bf161cf53efb) (2018-04-13) X-Originating-IP: [172.20.145.6] X-ClientProxiedBy: HQMAIL111.nvidia.com (172.20.187.18) To HQMAIL107.nvidia.com (172.20.187.13) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1613544689; bh=gXlU4wj89dRtYqmSRTd3ZCIacCt3jo7TZ0QmF2GeH/w=; h=Date:From:To:CC:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To:User-Agent: X-Originating-IP:X-ClientProxiedBy; b=D51MUk6a1LIHjYR7vDnSfWHJ6CpdnAzYmaYM6Tr0hfGJoFfxpOIegOEJIMEskXkZ7 QF5PTei3v6wIctQtI1+JqYxM792BciA+JNi4F387Pd+/decgsAhTEF/ep6s6m3G1SM N4EgF/V5X534ag5JmwlIo0rJzDetHHwSCUtPvGFamTznzpqGW+AApQlsrHt88RGfXT i9MUs6F5d5NvYJAs9AfLMEjl0O5snGW5Rusz2cq8sEDkSkg+FcCPbCfV0YEWPkprk1 fYowVXb4ekOBbJFr5efi/ICTD8EcvpccjhTd29aE/8EAp5qyFhlc7zT5leuUUWd9fe Q2qACShDjlaKw== Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Feb 16, 2021 at 04:25:20PM -0800, Si-Wei Liu wrote: > > > > The saved mvq->avail_idx will be used to recreate hardware virtq object and > > > the used index in create_virtqueue(), once status DRIVER_OK is set. I > > > suspect we should pass the index to mvq->used_idx in > > > mlx5_vdpa_set_vq_state() below instead. > > > > > Right, that's what I am checking but still no final conclusions. I need > > to harness hardware guy to provide me with clear answers. > OK. Could you update what you find from the hardware guy and let us know > e.g. if the current firmware interface would suffice? > Te answer I got is that upon query_virtqueue, the hardware available and used indices should always return the same value for virtqueues that complete in order - that's the case for network virtqueues. The value returned is the consumer index of the hardware. These values should be provided when creating a virtqueue; in case of attaching to an existing virtqueue (e.g. after suspend and resume), the values can be non zero. Currently there's a bug in the firmware where for RX virtqueue, the value returned for the available index is wrong. However, the value returned for used index is the correct value. Therefore, we need to return the hardware used index in get_vq_state() and restore this value into both the new object's available and used indices.