From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id B22F6432DE; Thu, 9 Nov 2023 06:29:18 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 788484021F; Thu, 9 Nov 2023 06:29:18 +0100 (CET) Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2074.outbound.protection.outlook.com [40.107.237.74]) by mails.dpdk.org (Postfix) with ESMTP id 3C6664013F for ; Thu, 9 Nov 2023 06:29:16 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Pffv1ICRYGhnvn6Wj+ePh8jma/wzQE5fRPoRfE0XU8m+dvsRGmBWAjhXLd5BHMCvAseHuot8eD5z8gIGlWV708PL4vlHIGjp5rzD7uyKSY5+ysOtru/zan2QPkC9zEkM30UdPpIpZncIMKkS8oxeBSKqoH9p+53uLrwU+XOGjAfsfjM5Eg4cCl5QqC3CzOq6xm44AmjUHxt2H5zDpu8olAKWtsU50Lcf7cWcHrjrSelw6fgGCH1R/29cMVAbMsSjmzT0vrGgJjihomXFLTTBA7z3ejprwpaJ42gOqJcMKMnB2YMIfl/LcQMk4HYR8SxFxuiacwxghScONWVNV/MpcA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=befRWGxNJx/m1qUJdkggU7HrFpmHyNf9SRObAWWkpt8=; b=GtweYg7FIcR0sLSetmzSfzps2KSQc8gB1qKVM5YG0VEXw04lYtHP1JlpLmt3mklK7vpVcQH0S5QxvwOwxBXqszVgK54MfEy+DnB5QnrXM7RCd8/oC9fgjHqcm7id4JjMtNdTc/mFlOWOHVS+bAkcR/XTLmxpBk8McUWCw9UKrLH4Mgn732JJYHofQNWe+jj7hXae22cMoo1pozUUC2YpC7XqUTXHzT/GBPRWn6VBHiEAnWr6dukax/XMZLVQVycTY0kYVAMeQMl28q207MGkzbSn2Qbb5kzVStNJyW5wlko1EtjmmjWa1Y4w8KMxSsNi0fhNuVJ/DNPnQTqci86+og== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=intel.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=befRWGxNJx/m1qUJdkggU7HrFpmHyNf9SRObAWWkpt8=; b=LvpUnTT+9aE4v2NCFn2lMIpfmLzOmITXaftKBdahvUrZE3t9XhRwpNkxyyBu8zie/gSpLGWk58ISVsAOD3nL1yiT8IoE8axM4KTWjFiRaDWrUFAotlhPaop2UgumSTK3FkKYMgOeC4ADdoB+otEb5pIKioTSPyv4C3q4Id8J0SI= Received: from SA1P222CA0177.NAMP222.PROD.OUTLOOK.COM (2603:10b6:806:3c4::25) by CY8PR12MB7220.namprd12.prod.outlook.com (2603:10b6:930:58::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6977.19; Thu, 9 Nov 2023 05:29:14 +0000 Received: from SA2PEPF0000150A.namprd04.prod.outlook.com (2603:10b6:806:3c4:cafe::ad) by SA1P222CA0177.outlook.office365.com (2603:10b6:806:3c4::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6977.19 via Frontend Transport; Thu, 9 Nov 2023 05:29:14 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by SA2PEPF0000150A.mail.protection.outlook.com (10.167.242.42) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6977.16 via Frontend Transport; Thu, 9 Nov 2023 05:29:14 +0000 Received: from telco-siena.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.32; Wed, 8 Nov 2023 23:29:13 -0600 From: Sivaprasad Tummala To: , CC: , Subject: [PATCH] eal/x86: add vendor ID checks for specific implementation Date: Wed, 8 Nov 2023 21:28:20 -0800 Message-ID: <20231109052820.2129745-1-sivaprasad.tummala@amd.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SA2PEPF0000150A:EE_|CY8PR12MB7220:EE_ X-MS-Office365-Filtering-Correlation-Id: 66232f3a-b899-4f5d-fb93-08dbe0e4cf7e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 3l6kD/xH1oYcBT9RmFfW5BgmDZPCE+bGb8mpNFT9c1f1TZUgnVOsjSIVz2n6siv+43HVLjVxdw5vt2pxW9/Owzw5fSYRtqobZe/Dzqiq1U38RQs6+ROClTZ7KyGuX8p00FNDJZoUBLUitQ+V029ja+1qq1JC9z51TnQZq0qJ6vnk5B3yPpysjBzX+urtRPBCHGFwwhnVqyy6n1QMsXd2JNqWz0FLVTj1Q+ZSJEDuzLwf0rLHPsrP+md3CD0h2zSH6sK/CyHm3RS+Hq4rCYMRUIXOZ9K6LOxrrphdENl8Cy5U2xh+LsK3c9nxAoi8Y2X/3eVGqxHNPTwUmD3kInof/0BCx3KH12nE6v/fbV53uOcmluxK/FOQJLWcmIFBPiHKGZoE+dCbJV8A4SG5+dPFX/Nn3Orbe3uDyGzNNIVE0nN/W2sQvpjBaxnplY81dkFIhaos93AUR1IsKo6Se3b2iQb90Ivxqv1JA3J/+OnBC/oMpm8NLpeHYSWdN+6Z7zZ/5rvEn29JUtGlewd3U5SiJckAx7gCxWLIkr71gaDx73/JR6+RVVbVk2C+jM4cJEe6Yaie1m6f655ZYT5qHCckGM5J9+jRduFg82OMxWTZUx+VMhg2zrAix5fv62c3Pub7QzvWLHFrA5xWvZu53ry4yvtWUm1T5/XULhWbYWL/XD9aeXGXsutlMKiw201chX5Qyq7SY4nt/QoeCV0lXa0BS9++VrRPedlaKf8SpfAcmBH0fioxDNh6rLFn/pKfp8nffGHmndJLAVpGozfSA8jeBw== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230031)(4636009)(396003)(346002)(136003)(376002)(39860400002)(230922051799003)(1800799009)(451199024)(186009)(64100799003)(82310400011)(36840700001)(46966006)(40470700004)(16526019)(26005)(336012)(41300700001)(1076003)(40460700003)(2616005)(47076005)(81166007)(356005)(36756003)(86362001)(82740400003)(36860700001)(83380400001)(426003)(478600001)(2906002)(110136005)(54906003)(316002)(44832011)(70586007)(70206006)(5660300002)(6666004)(8936002)(40480700001)(7696005)(8676002)(4326008)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Nov 2023 05:29:14.0959 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 66232f3a-b899-4f5d-fb93-08dbe0e4cf7e X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: SA2PEPF0000150A.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR12MB7220 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 Current get_tsc_freq_arch() implementation is specific for Intel processors. Added vendor checks to gracefully return on AMD EPYC processors. Signed-off-by: Sivaprasad Tummala --- lib/eal/x86/rte_cycles.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/lib/eal/x86/rte_cycles.c b/lib/eal/x86/rte_cycles.c index 69ed59b4f0..f147a5231d 100644 --- a/lib/eal/x86/rte_cycles.c +++ b/lib/eal/x86/rte_cycles.c @@ -10,6 +10,10 @@ #include #endif +#define x86_vendor_amd(t1, t2, t3) \ + ((t1 == 0x68747541) && /* htuA */ \ + (t2 == 0x444d4163) && /* DMAc */ \ + (t3 == 0x69746e65)) /* itne */ #include "eal_private.h" @@ -110,6 +114,18 @@ get_tsc_freq_arch(void) uint8_t mult, model; int32_t ret; +#ifdef RTE_TOOLCHAIN_MSVC + __cpuid(cpuinfo, 0); + a = cpuinfo[0]; + b = cpuinfo[1]; + c = cpuinfo[2]; + d = cpuinfo[3]; +#else + __cpuid(0, a, b, c, d); +#endif + if (x86_vendor_amd(b, c, d)) + return 0; + /* * Time Stamp Counter and Nominal Core Crystal Clock * Information Leaf -- 2.34.1