From patchwork Tue Nov 5 14:23:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nipun Gupta X-Patchwork-Id: 178523 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp846396ilf; Tue, 5 Nov 2019 06:40:18 -0800 (PST) X-Google-Smtp-Source: APXvYqx2XHPMR0+Fg5WI6NMMTlG+EYnNEFSzMWOnjOSh0Shgpppyk6ZdAQI/mwv5hLyiqlgNfCks X-Received: by 2002:a17:906:1c59:: with SMTP id l25mr2413753ejg.98.1572964816750; Tue, 05 Nov 2019 06:40:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1572964816; cv=none; d=google.com; s=arc-20160816; b=sMslXryzaJJCU/bHnbonKSib539VQLEQcbRplIRXzrslXHRy9tjaUPVlrI+fD7i2zZ xFEPl+IEI5TdtrujvqB0d08NJaEK22F786Ijs2hGmXKpf+olPds3OTObk18RR76nOiGR VWelFyyY64V8rLg72NQyw/mFnr/jKvYc7DtC0UvmaIsJOE1+oXhrCNWOn41xxj6ExOR6 DY570F75q5HzHwlRbFPAGNRMCm8MYv5s0lEph1SPOeCvzZAuus/rDsY+KZ7DDtQp1c6F JtvGjHUIHhtVZNDRAFy6XxWgy07x5IM4jsZ3JQNz4WWehPkfOiCnp9ra/IghiR6FCOph eySg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:references:in-reply-to :message-id:date:cc:to:from; bh=usMVH81zX6+WfJeGvBcjjYMsDqypoCJwV6mzVyIGDqY=; b=z4M681YcoulPztWk6mwsSgxI9jWPuSI61TkPrUoz36V1r7zXYjXc6tlJfjX2mibo9g t1g867mLPRKQ5m028eZfKtlymFAP9twZWcqUxyqZEJvk1ailwf1zrQ/kjC0qThdw59xm +NURNg9jh7i5jPsAbI2F1DLb0tWtXilkiJKGQ8xo6k1jazB+znZqdlDXHbU3k7BHMaxY hNYBdZGN/JmjrGBQ4mKNmNuUlZYnPgx/Tr3m3LT8wlo7dXm4wtEEO0LYh0EAeKwWEJvD ubW6d0kLn6LT0VZ8XXnDSga3OC8wEGXWq8qXK+YPf+wXi8e7pFZbxCtAUa9os2tI5yaa 9qPg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) smtp.mailfrom=dev-bounces@dpdk.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from dpdk.org (dpdk.org. [92.243.14.124]) by mx.google.com with ESMTP id o12si13822219ejn.292.2019.11.05.06.40.15; Tue, 05 Nov 2019 06:40:16 -0800 (PST) Received-SPF: pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) client-ip=92.243.14.124; Authentication-Results: mx.google.com; spf=pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) smtp.mailfrom=dev-bounces@dpdk.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id BE0041BF20; Tue, 5 Nov 2019 15:39:49 +0100 (CET) Received: from inva020.nxp.com (inva020.nxp.com [92.121.34.13]) by dpdk.org (Postfix) with ESMTP id 7A11A1BF08; Tue, 5 Nov 2019 15:39:47 +0100 (CET) Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 3DFF51A01EC; Tue, 5 Nov 2019 15:39:47 +0100 (CET) Received: from invc005.ap-rdc01.nxp.com (invc005.ap-rdc01.nxp.com [165.114.16.14]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id DF6631A00C5; Tue, 5 Nov 2019 15:39:43 +0100 (CET) Received: from GDB1.ap.freescale.net (gdb1.ap.freescale.net [10.232.132.179]) by invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id 5C201402E5; Tue, 5 Nov 2019 22:39:39 +0800 (SGT) From: Nipun Gupta To: dev@dpdk.org Cc: thomas@monjalon.net, ferruh.yigit@intel.com, hemant.agrawal@nxp.com, sachin.saxena@nxp.com, stable@dpdk.org, Nipun Gupta Date: Tue, 5 Nov 2019 19:53:15 +0530 Message-Id: <20191105142321.7478-4-nipun.gupta@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191105142321.7478-1-nipun.gupta@nxp.com> References: <20191011054657.21931-1-nipun.gupta@nxp.com> <20191105142321.7478-1-nipun.gupta@nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP Subject: [dpdk-dev] [PATCH 3/9 v4] common/dpaax: fallback to check separate memory node for VM X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" In Virtual Machine the memory node in the device tree is at '/proc/device-tree/memory/reg' which is separate from the memory node path on the host. This patch enables check on both the paths. Fixes: 2f3d633aa593 ("common/dpaax: add library for PA/VA translation table") Cc: stable@dpdk.org Signed-off-by: Nipun Gupta --- drivers/common/dpaax/dpaax_iova_table.c | 7 +++++-- drivers/common/dpaax/dpaax_iova_table.h | 2 ++ 2 files changed, 7 insertions(+), 2 deletions(-) -- 2.17.1 diff --git a/drivers/common/dpaax/dpaax_iova_table.c b/drivers/common/dpaax/dpaax_iova_table.c index 43c9c72e6..98b076e09 100644 --- a/drivers/common/dpaax/dpaax_iova_table.c +++ b/drivers/common/dpaax/dpaax_iova_table.c @@ -68,9 +68,12 @@ read_memory_node(unsigned int *count) *count = 0; ret = glob(MEM_NODE_PATH_GLOB, 0, NULL, &result); + if (ret != 0) + ret = glob(MEM_NODE_PATH_GLOB_VM, 0, NULL, &result); + if (ret != 0) { - DPAAX_DEBUG("Unable to glob device-tree memory node: (%s)(%d)", - MEM_NODE_PATH_GLOB, ret); + DPAAX_DEBUG("Unable to glob device-tree memory node (err: %d)", + ret); goto out; } diff --git a/drivers/common/dpaax/dpaax_iova_table.h b/drivers/common/dpaax/dpaax_iova_table.h index 138827e7b..fef97f6dd 100644 --- a/drivers/common/dpaax/dpaax_iova_table.h +++ b/drivers/common/dpaax/dpaax_iova_table.h @@ -45,6 +45,8 @@ extern struct dpaax_iova_table *dpaax_iova_table_p; * is SoC dependent, or even Uboot fixup dependent. */ #define MEM_NODE_PATH_GLOB "/proc/device-tree/memory[@0-9]*/reg" +/* For Virtual Machines memory node is at different path (below) */ +#define MEM_NODE_PATH_GLOB_VM "/proc/device-tree/memory/reg" /* Device file should be multiple of 16 bytes, each containing 8 byte of addr * and its length. Assuming max of 5 entries. */