From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-SN1-obe.outbound.protection.outlook.com (mail-sn1nam01on0083.outbound.protection.outlook.com [104.47.32.83]) by dpdk.org (Postfix) with ESMTP id 7ED992BF6 for ; Thu, 15 Dec 2016 07:34:34 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=oES2AhH/OidqtGTxaL//Z8EMy2EJuMrtOEGE0cYsk+k=; b=c//MEOzNCQF0ncbiNqZmnG+rEg7YqL0PAngwixxRNQ0HiGdtiScDXCEFd63mRdGwudin7E4LZW757GNAmJjo43xnbcUHFhrIyuxZISA8No4urI20IeDe2oMkAmN/P8Ov2SnWDUG5NNwbsiOwvsfBefY7M/HIO53wAIefYEgYU4s= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Jerin.Jacob@cavium.com; Received: from localhost.localdomain (122.166.153.127) by CY1PR0701MB1727.namprd07.prod.outlook.com (10.163.21.141) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.693.12; Thu, 15 Dec 2016 06:34:29 +0000 Date: Thu, 15 Dec 2016 12:04:10 +0530 From: Jerin Jacob To: Hemant Agrawal CC: , , , Message-ID: <20161215063409.GC19354@localhost.localdomain> References: <1480875447-23680-1-git-send-email-hemant.agrawal@nxp.com> <1480875447-23680-17-git-send-email-hemant.agrawal@nxp.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <1480875447-23680-17-git-send-email-hemant.agrawal@nxp.com> User-Agent: Mutt/1.7.1 (2016-10-04) X-Originating-IP: [122.166.153.127] X-ClientProxiedBy: MA1PR01CA0069.INDPRD01.PROD.OUTLOOK.COM (10.164.116.169) To CY1PR0701MB1727.namprd07.prod.outlook.com (10.163.21.141) X-Microsoft-Exchange-Diagnostics: 1; CY1PR0701MB1727; 2:zo45RiMrwdbkf4h+NxYQdlittDG7nuuNfXTGFaLmkLBBwIGfPYBKpIBXy6ym+kci4ilBPUOBogLZBd0E68Ve4LcBaxwBvCpmGNVCnyqzXceQ0S9K04hz92KRwbltg6Zks+xuENRe6fbssDg6VhT4I+eMLGy/R0YBw8lQmXMcerQ=; 3:S+xkq5EGxWPSRRFvgbaPp4gXblFHnJZ2aHhDbHXbrAM2qu8OIoOG7H/L+MQUw9h4I88C57Zij5WZs6uezGjBdYPFr3HKW4u1ButzVDUIp/oos/jQdMMuCETvQr1SNc5RPvib2ecydPTPg2e9TWq9GvgEEaESILejCmROMOUPPjw=; 25:xVOfSNxZpnjyXm3zst53daqlmUGwf8ZHw4t86NbTRk2zeHSLFm/QACxaMZ/vx0ftgeHWWjkkWLXxSLE/KwXbIIqiVx5t+/KU0++jUyHoOWHjMA79EsJaWsZEH8KF1gqePxdAPoT02rsByEvYgJG3H3s0AN8ZM2E/WnHDehBIScEiahpVVU8CSLEYJYMfDxSdYTwMR9E2D7H3qFFwOo53ema0r2WWMwURk6RTcD6/Pl/TzwjZL5tLBPDHCkdtnxfZnrsG3clKeawu8bg7u02/QO2dUa3PkYPvv2hRLSv+/pdZ0Ep9lZgzJVJw/BDzIVkkIAtld6p3YkDhRFmYBPIzSd+jcBEc8tUNJbqHc8biCmA1+0e0wol/+gTtw64+G0B9Dn5Lpp4jkbuZc/g+0j404PSWEtdPcvBofywhFSu7bT+OQU1wJ870vm04LbTA2AvWLjovMGLUgJS+Nhbt8fwqIQ== X-MS-Office365-Filtering-Correlation-Id: 30d61a78-23e2-4f7a-424c-08d424b46de5 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:CY1PR0701MB1727; X-Microsoft-Exchange-Diagnostics: 1; CY1PR0701MB1727; 31:XOWYgBNKKxOJcYOSuICFYqkwysO1IKreedrZaXptK8yqd5kgT7SPCSIkh1UCoon0Vc/dlTF/DThOzvwHufcp9nyTQsYFGjGt4AjtbDcxVJhLhC4k5JJGeDn5B0Q/wM/5QO6Q+Qx2EfbQcYeRfebYuIVXuqHYeoHZQ+zOE3B7Pj1gW3VpWFBWLZoH2o4Yb20rPvUf1Ex1trgaWEWf3OVbMMIcsthcxTKer5j+s8gobt6eKjkz6KxdvOlndENfvbJNzbplz3HCowGCL/reiGVoU2X6f49LJBSg3QyVtsFBBKM=; 20:4dtz5Z9xv/TxsTH9tZHHfioCAf28KX4pi0g4waoqRrsrNUnBpMqXUT6WOpzfXt1XWQf5m87xujCf9cL1P7+2w8l4w7gzMNxJibyBYpxhiVZKGWjhIiPeNFnW94e6VrDWjX2KAzzhvnPNEGxcTaUpXRY8cQAtH4Zje6uLK0pTxveH7QPTNjLvmUdR1sFcq7PbYFJbPq5XJ4Mftq/uQYAIHIOoo/1nj1TPNqlg+1cvQpqgiYcdUft3IHk4jYMcRGQbbcfkYsXXN/BW6iGvYR7Nq/cP9ZYEwnFGDjBhv3d8gjIn075ksjKSi5wBxXAhcnxLydc22i7jDREN/TKdXsIo654b8gXogtAirYuJphLc3Tl7azu2UbaGu8NCMVShWEFi68uOmt6p31SP0QR3S6xTaF12niF/bCDOVmuyi4nLYCT7/QK4AZDCofr/s2mb9Req9dHSi51OuUmIc4b/NA9F2HBW1y+QCtmzIR6/iU3LhftOIUCruiIv06VdeQQe/OztoaM2GFlOhCKjYkn601m7XxidqLeFUxXFdwRlyrHCUW42JHLG8Isr0wO3dQw5QKL8rxhzEY97IBikuLGtnt5RJjgY4jM5aIlc7Pw2w8wg+0s= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040375)(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046)(6041248)(20161123560025)(20161123562025)(20161123558021)(20161123564025)(20161123555025)(6072148); SRVR:CY1PR0701MB1727; BCL:0; PCL:0; RULEID:; SRVR:CY1PR0701MB1727; X-Microsoft-Exchange-Diagnostics: 1; CY1PR0701MB1727; 4:Uo3qsxjc2wU4B+5lfhW+QS6/la87PvT5iFcZTWkXNh6uY4iATHEPPnpW05g2kG7x1ZF3QC/uV/menaWs7FNz21SE2JGTgfHOAZzMH4UCK3ZqS1UMWDkid4pzuccTFmDwfHlIhuU3ng2z60Z3TuvuWQyt7GH2ftMh3hXpn/d0lLZwGrkdw0mEa4KFaaEanuVi4pU/3ZMxuVqT5OZdhEQP72J3ZVXUZq0V5EwcaA05yLnt+smszr4gjGCSLRlGyhRFaUBiUVCMyG7MvXgKrnWzpNpVfo8Qegv5e790HGRwIWpbTqKHvJSYFLuk2j5McChd90gHsjpX9eY9LKxj3QkG/W5cvYvy1Sy2Yw7aPRiul6F19fIF0tb1yWEhEpGSsNPJgh6mB4gdeqppQTdkqYnEYzsaOHRSbMlCcKPdlb3tcRKZMJOxYyR4pePAKkUDUoDgVmWqrweaHu2iDLxaorZsLKjQ0d7Tynft/uVYpOTjXx+D8kA/ex3OfBQiUUYaQejtQV6dl2KRHOF0KIad6pts04KU5MQksYumBJgtskD8Dhvh3LNE7i9LimBHwixWf5xxSyC+8NrbpuKoIvgexMdse9RQ+pC7fHPu0lC7JwnarefRwLDOouC/24a5Fj/HViBAPgbpuWc2tlYeav2pXhqGlA== X-Forefront-PRVS: 0157DEB61B X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6069001)(6009001)(7916002)(39840400002)(39450400003)(39410400002)(24454002)(189002)(199003)(4001350100001)(6116002)(97736004)(189998001)(8676002)(47776003)(66066001)(81166006)(50466002)(6506006)(229853002)(33656002)(9686002)(38730400001)(25786008)(97756001)(83506001)(3846002)(23726003)(81156014)(68736007)(50986999)(76176999)(54356999)(101416001)(106356001)(110136003)(8666005)(92566002)(2950100002)(7736002)(305945005)(105586002)(1076002)(4326007)(6916009)(42882006)(6666003)(61506002)(46406003)(2906002)(5660300001)(42186005)(18370500001)(7059030); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR0701MB1727; H:localhost.localdomain; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY1PR0701MB1727; 23:40+RN/kHpSXB4n+BsTp04WKUcAsnwhVSEM5ZKYs?= =?us-ascii?Q?nJ1Bp5KjRmSYKxz36EW9iNQmHgl5NLOMXyPzsU4ha2xQ2Z0vu+VU22uzFw8O?= =?us-ascii?Q?p6m9rOrVyurhr/jpnTkq8nlUIfBYM3oCp+U/ZaimwTNZuG44kCjZY2AsGF3Y?= =?us-ascii?Q?XaSwoEuGnaSskCxkD+sR4XCnwMQVGNNylWoew3Xa+yx0RbUuiKsRTTZY18CH?= =?us-ascii?Q?NOdOOiL0+ZH7NBaSXGXjZhKGE4jFrdiHD4Jg6TyKflmeBhMqsN+E0slPQ3MR?= =?us-ascii?Q?EvUiDpoPrZc5aQ+BD5r63WHXaDHkj/B3ui0tIhtHJ9vG58jUnRJybPqnJGdj?= =?us-ascii?Q?cZHDEvL1d3fUPK4N3sLv+pu3oWJ0klONP7AG9xU+8U0oDBCgJ6D2QHmBwAfC?= =?us-ascii?Q?bK1J5iDXL6aFhLeus4vNgEA6S6yJikiK2AtM6VzJptqKr3pLdoS6YfOFBleF?= =?us-ascii?Q?78x9pgrlOJeh8NEWZ27RSPaFitEJ7oO8y+aWcpUIAujE8inR5Nw54PMT/q8x?= =?us-ascii?Q?UsK9Ke44NJp1wiiOVQ3aYolKroVSjJgovDXkWvBx7QNUwGLYXARjinDO9o7R?= =?us-ascii?Q?9Me+MROAteTeN8DCVpmgyP98p7UM5FpCazExDacIUqc8Kd5grGrgH3tlbErt?= =?us-ascii?Q?+HmL5eWAmu2UN4M3AWkhlTV5FxepC5WzY44py1WgPeoKUiJH+zq21iH7afdY?= =?us-ascii?Q?RAOc9pxLn5lN2p0ZNEpPmu4DPi3Mj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x/8sfqi+VU6Y+p7/64B6ulv3WO5xWagXihYcAZ83QZ0cZfrORdPj2oy4tIILWmJ6uWMZvbWVlO/VtkroJdsN2a05s; 5:ROJ6Nvd+eEGw4vBdrG+NvTab/5FQpjY6HF20nwUlAVZJuq3laWjfHi4puftkJBG+OOU8E1yguiwEt68PFNnX52NeeKw1I5cwSKnLamQrdJqVTsibMJ4ECd7SOWkAPD/VYwIvsTJOWCTIdFfgc/2Wgw==; 24:Fg8SLIwmSD2hAPphuz1shwOqd9YT5Cp0aodFIuTGv7R/24aVmNPj5FEfP6aLN2ksR//YckSzMPYyd+rzmSQuDquzTC/eLNZ10VRN+4ApxPo= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CY1PR0701MB1727; 7:lyaKsgAJWDUyiv8I8xnoHAkPYjiRKUvpMkgMzHtmI71OOg0+UxP8RkWZyJtmcGX7ZLhiIIyv+L0Br5B2KrsnhOMOD8aCEDieTbRJYex4+Wo28kjcDeQ6+cc/Y8Xsvw0ffBM2KQ7Bh9uc3pQYHa73j4eN87wm2Jidz0P6wRSjqtt/ciWUPgJd3848jC5YejPJwQ5UKR10ogeZCRzERNCnNi2wfOWT+B45HwdreRXT6dfDipNjqM+stTvhvVL5b/11PDxj+dKPy8tDLodzHIuKcdIfSrTxPBvylurxntVWZf4c6+ahM11xLz7A9zVZ5EBbU7EtLtaMQnYRXz51dTRZ/caYLJoQQ0yAW0tsn2d7G+E= X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Dec 2016 06:34:29.9966 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR0701MB1727 Subject: Re: [dpdk-dev] [PATCH 16/32] net/dpaa2: dpio add support to check SOC type 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: , X-List-Received-Date: Thu, 15 Dec 2016 06:34:36 -0000 On Sun, Dec 04, 2016 at 11:47:11PM +0530, Hemant Agrawal wrote: > Signed-off-by: Hemant Agrawal > --- > drivers/net/dpaa2/base/dpaa2_hw_dpio.c | 74 ++++++++++++++++++++++++++++++++++ > 1 file changed, 74 insertions(+) > > diff --git a/drivers/net/dpaa2/base/dpaa2_hw_dpio.c b/drivers/net/dpaa2/base/dpaa2_hw_dpio.c > index 9c6eb96..3b8f87d 100644 > --- a/drivers/net/dpaa2/base/dpaa2_hw_dpio.c > +++ b/drivers/net/dpaa2/base/dpaa2_hw_dpio.c > @@ -70,6 +70,18 @@ > static struct dpio_device_list *dpio_dev_list; /*!< DPIO device list */ > static uint32_t io_space_count; > > +#define ARM_CORTEX_A53 0xD03 > +#define ARM_CORTEX_A57 0xD07 > +#define ARM_CORTEX_A72 0xD08 May not be good idea to have generic ARM part number definition in driver file. > + > +static int dpaa2_soc_core = ARM_CORTEX_A72; > + > +#define NXP_LS2085 1 > +#define NXP_LS2088 2 > +#define NXP_LS1088 3 > + > +static int dpaa2_soc_family = NXP_LS2088; > + > /*Stashing Macros default for LS208x*/ > static int dpaa2_core_cluster_base = 0x04; > static int dpaa2_cluster_sz = 2; > @@ -101,6 +113,58 @@ > return dpaa2_core_cluster_base + x; > } > > +static int cpuinfo_arm(FILE *file) > +{ > + char str[128], *pos; > + int part = -1; > + > + #define ARM_CORTEX_A53_INFO "Cortex-A53" > + #define ARM_CORTEX_A57_INFO "Cortex-A57" > + #define ARM_CORTEX_A72_INFO "Cortex-A72" > + > + while (fgets(str, sizeof(str), file) != NULL) { > + if (part >= 0) > + break; > + pos = strstr(str, "CPU part"); > + if (pos != NULL) { > + pos = strchr(pos, ':'); > + if (pos != NULL) > + sscanf(++pos, "%x", &part); > + } > + } > + > + dpaa2_soc_core = part; > + if (part == ARM_CORTEX_A53) { > + dpaa2_soc_family = NXP_LS1088; > + printf("\n########## Detected NXP LS108x with %s\n", > + ARM_CORTEX_A53_INFO); > + } else if (part == ARM_CORTEX_A57) { > + dpaa2_soc_family = NXP_LS2085; > + printf("\n########## Detected NXP LS208x Rev1.0 with %s\n", > + ARM_CORTEX_A57_INFO); > + } else if (part == ARM_CORTEX_A72) { > + dpaa2_soc_family = NXP_LS2088; > + printf("\n########## Detected NXP LS208x with %s\n", > + ARM_CORTEX_A72_INFO); > + } > + return 0; > +} > + > +static void > +check_cpu_part(void) > +{ > + FILE *stream; > + > + stream = fopen("/proc/cpuinfo", "r"); > + if (!stream) { > + PMD_INIT_LOG(WARNING, "Unable to open /proc/cpuinfo\n"); > + return; > + } > + cpuinfo_arm(stream); > + > + fclose(stream); > +} > + > static int > configure_dpio_qbman_swp(struct dpaa2_dpio_dev *dpio_dev) > { > @@ -326,6 +390,16 @@ static inline struct dpaa2_dpio_dev *dpaa2_get_qbman_swp(void) > { > struct dpaa2_dpio_dev *dpio_dev; > struct vfio_region_info reg_info = { .argsz = sizeof(reg_info)}; > + static int first_time; > + > + if (!first_time) { > + check_cpu_part(); > + if (dpaa2_soc_family == NXP_LS1088) { > + dpaa2_core_cluster_base = 0x02; > + dpaa2_cluster_sz = 4; Can this device configuration information passed through dt/the means where you are populating the fsl bus for dpio ? if not arm64 cpu part identification code can go in arm64 common code. Even better if we have EAL API for same. Looks like x86 similar attribute called "model"