Received: by 2002:a89:48b:0:b0:1f5:f2ab:c469 with SMTP id a11csp283291lqd; Wed, 24 Apr 2024 02:03:43 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWxee45tWovjNAtmasSp9k+FB+Nk6NuV0hL0qvhVWk0UpJoiL5mjA94Fz3KzyMB2J6+cwOXVmK0/9FYGWMPejMj36iOu1quQDv2wfO0qQ== X-Google-Smtp-Source: AGHT+IHyeLse2HKp+z40A2BHEKjd/YYnNGD3og695GbAo1W13rmOJLSlKJ6JooShrq9SeVpIIG7h X-Received: by 2002:a05:6358:980f:b0:186:1805:c6c2 with SMTP id y15-20020a056358980f00b001861805c6c2mr1659623rwa.0.1713949423169; Wed, 24 Apr 2024 02:03:43 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713949423; cv=pass; d=google.com; s=arc-20160816; b=P0RBW4p65YY3ySTKG4O4UGn1j2qu91nsl85c4PUeBxAc/7dh3Jqm+xUGI9JNqimG3z uRbd1KcG/8yNvLsrZI6YAoG64b7OuFSMGIpnetX3XKjr02PVOVBrysuSSgyD3zfqNTZJ kRpB3KjtJOyBFbkx11uKy11Vf0sKeoYUlYpmjjys/94dYB982s4hpqAEVntd9DxuiGcl 7YxO6WQ5uo9jw7oGd9sv9zSRk9ahSMZBc3v0mDZgHGMXu+slAd/Esd7E60tkmeRwdpYR EJkKno3BjZRpSLiIsuaIyTxsGo3KYXKdNmRMqjLd6aRbQoQ1LZzoyV7XlNJrRSMeJDID Am1w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=su20QwuKanjuayInO9QtZI1K19DFVlAv8+gpjiL9s4Q=; fh=lW6MHi1ma+bdiE1he+iHyx9lPKntUb1s0946rN3rfJM=; b=NIDVxt+Rw3DOM7/MLwkmSb+E37kmyEwvLCbtsQTUAISuaIxbbs8UmXYLN9ZrYcNK3V wLbVlXgdzFxiJIRdb8fro6IRtqvp230TpOMm1++DdF0tKj+PWt9rq3WGou+D31mmEZAn siN0To6r9B7Se4bbe2+jFLN25U+Owpl3seRB4NtwwlhLCF5xCgLaPpeIimCw9EkFPPHn mdSZsRPrxXbti29/+V7m57S9M2X0FzhFUbBpadvsSIdjK5Wc6bNBvqKtXTKXpYOlxQtI SukTQEzvqM4MImuOC10BLyy5KQjZsf3QTM0ZE9m+/4n8UWoQkTvrQFtmw+aS4ALxM1ra vp0Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-156589-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-156589-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id 3-20020ac85743000000b00437cc3384a9si11904266qtx.232.2024.04.24.02.03.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 02:03:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-156589-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-156589-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-156589-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id DD5D11C2328D for ; Wed, 24 Apr 2024 09:03:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 42909158A37; Wed, 24 Apr 2024 09:03:35 +0000 (UTC) Received: from szxga04-in.huawei.com (szxga04-in.huawei.com [45.249.212.190]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9DE0A157468; Wed, 24 Apr 2024 09:03:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.190 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713949414; cv=none; b=Qi/tEI7mPnCmOdTCRJkszmxo+BGhEsTk2ADpI6ip7Fav44RenZgdxOHZqdGP5LAZpdLoL8aE/s+bYlrHXZRvA4bR3JgJhoW1C7+SgWE+u3heYNKYIy4v3kuUHIquxPVTh3xaBipKBbtr+Qbi44XMjJzXCysfhm007Hm7sKgA8ck= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713949414; c=relaxed/simple; bh=ek7iSkZeQhEAXZowAd/rNzDaNByG1nPmFY7C4c+Vep0=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=szk7FbNifMKKIjXN/wJpcBFYm3UNiwblfGkMoHvz0f76x2OKQeWHeMcKcHWewBwmjJJdj/uWyWUgK7+QwpyfqoVGFTfYujXokO9A0ps106oS+BE0FX2Ko/KhFlar9m29/VI/hAzaC3gS5TdEwBmUDNvnEtcnQdBAd/njFl+LkE0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.190 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.163.17]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4VPXyX62qCz1ypCv; Wed, 24 Apr 2024 17:00:52 +0800 (CST) Received: from kwepemm600005.china.huawei.com (unknown [7.193.23.191]) by mail.maildlp.com (Postfix) with ESMTPS id B70081A0188; Wed, 24 Apr 2024 17:03:23 +0800 (CST) Received: from huawei.com (10.50.165.33) by kwepemm600005.china.huawei.com (7.193.23.191) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Wed, 24 Apr 2024 17:03:23 +0800 From: Longfang Liu To: , , , CC: , , , Subject: [PATCH v5 2/5] hisi_acc_vfio_pci: modify the register location of the XQC address Date: Wed, 24 Apr 2024 16:57:18 +0800 Message-ID: <20240424085721.12760-3-liulongfang@huawei.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20240424085721.12760-1-liulongfang@huawei.com> References: <20240424085721.12760-1-liulongfang@huawei.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To kwepemm600005.china.huawei.com (7.193.23.191) According to the latest hardware register specification. The DMA addresses of EQE and AEQE are not at the front of their respective register groups, but start from the second. So, previously fetching the value starting from the first register would result in an incorrect address. Therefore, the register location from which the address is obtained needs to be modified. Signed-off-by: Longfang Liu --- drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c | 8 ++++---- drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.h | 3 +++ 2 files changed, 7 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 45351be8e270..0c7e31076ff4 100644 --- a/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c +++ b/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c @@ -516,12 +516,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[1]; + vf_data->eqe_dma = vf_data->qm_eqc_dw[QM_XQC_ADDR_HIGH]; vf_data->eqe_dma <<= QM_XQC_ADDR_OFFSET; - vf_data->eqe_dma |= vf_data->qm_eqc_dw[0]; - vf_data->aeqe_dma = vf_data->qm_aeqc_dw[1]; + vf_data->eqe_dma |= vf_data->qm_eqc_dw[QM_XQC_ADDR_LOW]; + vf_data->aeqe_dma = vf_data->qm_aeqc_dw[QM_XQC_ADDR_HIGH]; vf_data->aeqe_dma <<= QM_XQC_ADDR_OFFSET; - vf_data->aeqe_dma |= vf_data->qm_aeqc_dw[0]; + vf_data->aeqe_dma |= vf_data->qm_aeqc_dw[QM_XQC_ADDR_LOW]; /* Through SQC_BT/CQC_BT to get sqc and cqc address */ ret = qm_get_sqc(vf_qm, &vf_data->sqc_dma); diff --git a/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.h b/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.h index 5bab46602fad..f887ab98581c 100644 --- a/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.h +++ b/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.h @@ -38,6 +38,9 @@ #define QM_REG_ADDR_OFFSET 0x0004 #define QM_XQC_ADDR_OFFSET 32U +#define QM_XQC_ADDR_LOW 0x1 +#define QM_XQC_ADDR_HIGH 0x2 + #define QM_VF_AEQ_INT_MASK 0x0004 #define QM_VF_EQ_INT_MASK 0x000c #define QM_IFC_INT_SOURCE_V 0x0020 -- 2.24.0