From patchwork Tue Jan 25 09:37:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Pei, Andy" X-Patchwork-Id: 106487 X-Patchwork-Delegate: maxime.coquelin@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 1F651A04A7; Tue, 25 Jan 2022 10:43:31 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B918F428C9; Tue, 25 Jan 2022 10:43:05 +0100 (CET) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by mails.dpdk.org (Postfix) with ESMTP id D3A414285F for ; Tue, 25 Jan 2022 10:43:03 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1643103784; x=1674639784; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=I+hJ8ZTAlweT9fitcr7WwTIuTsq8PUZmX4NaH0xJHdY=; b=MwrJ2wxLPzH3pI0aYB04g/ixJMQyfNm7dV1O/9vwUnSW4XWVCOIcLwiH WYOnF7l590AEtleHxoQ0z43F/AiO/SkkIXbDByX9SfB9Myj3LoGB0PcIP g70uP4QZGcgOTMndDfrL5aTuU5fvF/0okoehNzXHpQQc5n6AmLLA7/DyI 4emVdEP/c7QaqGRoXB0EIF9nBZSLVqIw/bJSb6t+EfWk1fYweymMpF6/+ VxiZfI710RJ8aV0uaNuinIEIbpPbnuKB9hwIjsLlSklfGpG3E+ZGhJeel idbln7mP1OQhK/Dwbi3zZ/4g2R7ZU8m5QFWWaIvM93ttT+vbxaR4RNw8u A==; X-IronPort-AV: E=McAfee;i="6200,9189,10237"; a="229840444" X-IronPort-AV: E=Sophos;i="5.88,314,1635231600"; d="scan'208";a="229840444" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Jan 2022 01:43:03 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.88,314,1635231600"; d="scan'208";a="534656826" Received: from dpdk-dipei.sh.intel.com ([10.67.111.91]) by orsmga008.jf.intel.com with ESMTP; 25 Jan 2022 01:43:00 -0800 From: Andy Pei To: dev@dpdk.org Cc: chenbo.xia@intel.com, maxime.coquelin@redhat.com, gang.cao@intel.com, changpeng.liu@intel.com Subject: [PATCH v2 09/15] vdpa/ifc: add some log at VDPA launch before qemu connect Date: Tue, 25 Jan 2022 17:37:11 +0800 Message-Id: <1643103437-118618-10-git-send-email-andy.pei@intel.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1643103437-118618-1-git-send-email-andy.pei@intel.com> References: <1643093258-47258-2-git-send-email-andy.pei@intel.com> <1643103437-118618-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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Add some log of virtio blk device config space information at VDPA launch before qemu connects. Signed-off-by: Andy Pei --- drivers/vdpa/ifc/ifcvf_vdpa.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/drivers/vdpa/ifc/ifcvf_vdpa.c b/drivers/vdpa/ifc/ifcvf_vdpa.c index 00e7274..ff91e80 100644 --- a/drivers/vdpa/ifc/ifcvf_vdpa.c +++ b/drivers/vdpa/ifc/ifcvf_vdpa.c @@ -1436,6 +1436,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; @@ -1502,6 +1505,31 @@ 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;