Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp667440rwb; Mon, 26 Sep 2022 04:28:55 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7ijHr/zms1a4DprfGVMNuxwkINFc0J+PXCJ7ne7qcUkH0KNzKfdJzxcgW3B191U+n6clJ4 X-Received: by 2002:a17:907:60c7:b0:77c:7f13:7da3 with SMTP id hv7-20020a17090760c700b0077c7f137da3mr17377949ejc.210.1664191735365; Mon, 26 Sep 2022 04:28:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664191735; cv=none; d=google.com; s=arc-20160816; b=o37hJVEro+u+DeNEAV94K1mrSufHiMw6zuiNXXGzuExsb6FqhvvmfAnhEyyA5rIBHk OGBc2IWTPD3MM7jeMPVwkl8CbnJC7AxFL4eVn0v7X2VRhJmKTlVbL3b6JH+Xf8L7r1QP lLus5FA9WqXlEMrgVMGLWSWDuk39wBfOssoLxF57ChC2fdhbsswzfE5M1250Le80fBB4 eK/gNuQwR20VaTP0pF9jg7ptAGwC8RGuhz2YUo6HAuvY43sOF/e+vthM2n3zLdko85yQ HG+xTT1yGmx+doBs06l4pOkdY+RmM6Ne8wT8JotDre+xq4Wf1nedRQRfe19RnytI6IRz Vd6Q== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=KqGmQA65Mw5vik0YBN7/jc3eEqEQKIxJWBXxrMBbAMg=; b=Pg8x5p/+o63x1+0IQRI9RS5TstRTZ99n+murGJfG4X5KJS2mvMcWpGXsN7U0nDdr+X kEZbfKx3VkkxeUydHTFidFvuvvdbyFs7qC56fvB8tu7F562iOyS8BqqlFA2ROk3tOtIX +eHNRC48iB55K3npW79EM0T5xFTj4lI2YcprRwJpdExw112/gJWjV0IV+85baKokD+BS xzLguDW2z0CBNlVJ5fi8hJWEtEhR3+BPlltctxLt5CbRAG9J5QCn6ZubMaXhLbGk8nnE QHzFbZGMKJ8nuQN94hkGwgs2vzp5m6sNHBmOfewkolvEYGx92CjwcNPpGuEksR3NYMJG FPZw== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y24-20020a056402171800b0045724323eabsi4073318edu.65.2022.09.26.04.28.30; Mon, 26 Sep 2022 04:28:55 -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; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234684AbiIZJkV (ORCPT + 99 others); Mon, 26 Sep 2022 05:40:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39836 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235118AbiIZJiz (ORCPT ); Mon, 26 Sep 2022 05:38:55 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E696B46204 for ; Mon, 26 Sep 2022 02:37:24 -0700 (PDT) Received: from dggemv711-chm.china.huawei.com (unknown [172.30.72.55]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4Mbcz903c2zpTTv; Mon, 26 Sep 2022 17:34:29 +0800 (CST) Received: from kwepemm600005.china.huawei.com (7.193.23.191) by dggemv711-chm.china.huawei.com (10.1.198.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Mon, 26 Sep 2022 17:37:23 +0800 Received: from huawei.com (10.69.192.56) by kwepemm600005.china.huawei.com (7.193.23.191) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Mon, 26 Sep 2022 17:37:22 +0800 From: Longfang Liu To: , , CC: , , , Subject: [PATCH v3 2/5] hisi_acc_vfio_pci: Fix device data address combination problem Date: Mon, 26 Sep 2022 17:33:29 +0800 Message-ID: <20220926093332.28824-3-liulongfang@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20220926093332.28824-1-liulongfang@huawei.com> References: <20220926093332.28824-1-liulongfang@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.69.192.56] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To kwepemm600005.china.huawei.com (7.193.23.191) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, 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 The queue address of the accelerator device should be combined into a dma address in a way of combining the low and high bits. The previous combination is wrong and needs to be modified. Reviewed-by: Jason Gunthorpe Signed-off-by: Longfang Liu --- drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c b/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c index 4ef9761ef467..fbe72ce173de 100644 --- a/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c +++ b/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c @@ -520,12 +520,12 @@ static int vf_qm_state_save(struct hisi_acc_vf_core_device *hisi_acc_vdev, return -EINVAL; /* Every reg is 32 bit, the dma address is 64 bit. */ - vf_data->eqe_dma = vf_data->qm_eqc_dw[2]; + vf_data->eqe_dma = vf_data->qm_eqc_dw[1]; vf_data->eqe_dma <<= QM_XQC_ADDR_OFFSET; - vf_data->eqe_dma |= vf_data->qm_eqc_dw[1]; - vf_data->aeqe_dma = vf_data->qm_aeqc_dw[2]; + vf_data->eqe_dma |= vf_data->qm_eqc_dw[0]; + vf_data->aeqe_dma = vf_data->qm_aeqc_dw[1]; vf_data->aeqe_dma <<= QM_XQC_ADDR_OFFSET; - vf_data->aeqe_dma |= vf_data->qm_aeqc_dw[1]; + vf_data->aeqe_dma |= vf_data->qm_aeqc_dw[0]; /* Through SQC_BT/CQC_BT to get sqc and cqc address */ ret = qm_get_sqc(vf_qm, &vf_data->sqc_dma); -- 2.33.0