From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 74297A034C;
	Sun, 27 Mar 2022 17:36:49 +0200 (CEST)
Received: from [217.70.189.124] (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 53F1D4288A;
	Sun, 27 Mar 2022 17:36:05 +0200 (CEST)
Received: from mga14.intel.com (mga14.intel.com [192.55.52.115])
 by mails.dpdk.org (Postfix) with ESMTP id F3D7F42896
 for <dev@dpdk.org>; Sun, 27 Mar 2022 17:36:03 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple;
 d=intel.com; i=@intel.com; q=dns/txt; s=Intel;
 t=1648395364; x=1679931364;
 h=from:to:cc:subject:date:message-id:in-reply-to: references;
 bh=4QV8Vtzr8Qw4ZXuXhZdnuMqpIxdI0oilBYOJX8Y8blM=;
 b=iMYfcANEyjq94UHEse/ZvazRM5LouYwYLKhS2KBsFnb9QgoupOmtl+Ot
 GJ1bEGX/3i9npsbjPQD6Y1YYnE1xIKbHnpZ8GjaWZ4200Gb0CO/6UHCeS
 4kbkdEi4vFxiuk+nQBx0U+x0ZiJPdRIbZ4RnTepRfJc0jpJ+45gFmQ/ol
 rbqxsWIgxuQ6TO25VVV0XIiIqglJkYE3hnDgRaPHGg3jATtZ4Kjl+HCsz
 Bdh3JtSXEMLjbzcqfl2fIZG0RM9WrlnrzLlKcAIajpbkGpECbO1viqRJq
 zYTbE+tVsLuMlJ7a8KfhMP4GeLbrKlbaupwbdRXcV7nRGk4zCyMHwTSRY Q==;
X-IronPort-AV: E=McAfee;i="6200,9189,10299"; a="259045654"
X-IronPort-AV: E=Sophos;i="5.90,215,1643702400"; d="scan'208";a="259045654"
Received: from orsmga008.jf.intel.com ([10.7.209.65])
 by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;
 27 Mar 2022 08:36:03 -0700
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.90,215,1643702400"; d="scan'208";a="562421568"
Received: from dpdk-dipei.sh.intel.com ([10.67.110.238])
 by orsmga008.jf.intel.com with ESMTP; 27 Mar 2022 08:36:01 -0700
From: Andy Pei <andy.pei@intel.com>
To: dev@dpdk.org
Cc: chenbo.xia@intel.com, maxime.coquelin@redhat.com, gang.cao@intel.com,
 changpeng.liu@intel.com
Subject: [PATCH v4 10/16] vdpa/ifc: add some log at VDPA lauch before qemu
 connect
Date: Sun, 27 Mar 2022 22:51:33 +0800
Message-Id: <1648392699-60113-11-git-send-email-andy.pei@intel.com>
X-Mailer: git-send-email 1.8.3.1
In-Reply-To: <1648392699-60113-1-git-send-email-andy.pei@intel.com>
References: <1643093258-47258-2-git-send-email-andy.pei@intel.com>
 <1648392699-60113-1-git-send-email-andy.pei@intel.com>
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org

Signed-off-by: Andy Pei <andy.pei@intel.com>
---
 drivers/vdpa/ifc/ifcvf_vdpa.c | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/drivers/vdpa/ifc/ifcvf_vdpa.c b/drivers/vdpa/ifc/ifcvf_vdpa.c
index 28191e4..9bc2f47 100644
--- a/drivers/vdpa/ifc/ifcvf_vdpa.c
+++ b/drivers/vdpa/ifc/ifcvf_vdpa.c
@@ -1431,6 +1431,9 @@ struct rte_vdpa_dev_info dev_info[] = {
 	struct rte_kvargs *kvlist = NULL;
 	int ret = 0;
 	int16_t device_id;
+	__u64 capacity = 0;
+	uint8_t *byte;
+	uint32_t i;
 
 	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
 		return 0;
@@ -1497,6 +1500,32 @@ struct rte_vdpa_dev_info dev_info[] = {
 		internal->features = features &
 					~(1ULL << VIRTIO_F_IOMMU_PLATFORM);
 		internal->features |= dev_info[IFCVF_BLK].features;
+
+		/**
+		** cannot read 64-bit register in one attempt,
+		** so read byte by byte.
+		**/
+		for (i = 0; i < sizeof(internal->hw.blk_cfg->capacity); i++) {
+			byte = (uint8_t *)&internal->hw.blk_cfg->capacity + i;
+			capacity |= (__u64)*byte << (i * 8);
+		}
+		DRV_LOG(INFO, "capacity  : %quG", capacity >> 21);
+
+		DRV_LOG(INFO, "size_max  : 0x%08x",
+			internal->hw.blk_cfg->size_max);
+		DRV_LOG(INFO, "seg_max   : 0x%08x",
+			internal->hw.blk_cfg->seg_max);
+		DRV_LOG(INFO, "blk_size  : 0x%08x",
+			internal->hw.blk_cfg->blk_size);
+		DRV_LOG(INFO, "geometry");
+		DRV_LOG(INFO, "    cylinders: %u",
+			internal->hw.blk_cfg->geometry.cylinders);
+		DRV_LOG(INFO, "    heads    : %u",
+			internal->hw.blk_cfg->geometry.heads);
+		DRV_LOG(INFO, "    sectors  : %u",
+			internal->hw.blk_cfg->geometry.sectors);
+		DRV_LOG(INFO, "num_queues: 0x%08x",
+			internal->hw.blk_cfg->num_queues);
 	}
 
 	list->internal = internal;
-- 
1.8.3.1