Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp554507rwb; Thu, 11 Aug 2022 06:20:46 -0700 (PDT) X-Google-Smtp-Source: AA6agR4R24AG4KzmHp+1ETf4MemfuvcCzZVzJNA4+r0s/upuj9ZLNrxWuFUtTQSnUFWfuDf6cll6 X-Received: by 2002:a17:90b:1d0a:b0:1f5:76c0:f142 with SMTP id on10-20020a17090b1d0a00b001f576c0f142mr8758724pjb.192.1660224046173; Thu, 11 Aug 2022 06:20:46 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1660224046; cv=pass; d=google.com; s=arc-20160816; b=gR9Wi7ZgKCrAJhyL6pVEp4xwG5K+8tSa3GBqVoLMmVmH96TpL9pY0yO8n2Zp12yHDO W31mD738j7zZD60vt9nscoV5IessMiCJyT7Qd/6e1koKSZwp5DaSmfmLD6ZhoWMlHa3p lTaRIE56EPe8WClzXXaRIaCNUgxPnIpopTu8EeOAg/Q1fRZviekih6fZ6xKTffRnGwxs aKW5WUP1OmKdFTjwA35dQN5QmFBn9WZ/zK2DjnIy9WFNWR3Tbqr0wQcT4pAVacLyLc4r 94bJM1YbFJ1UfyujNH16eOA/oVjFhHsVxvnxb+J+yOO6c8mhihKBoGwKT84SrMX/I3pf 8qMQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=wvDmQPsFpUzzlzT6cpXiZvGIiABgfERnaavB60hctpY=; b=iAaqsHHrUn2WvmARW4JcLEWF3Ej8QQfoCTGogYIn7uE75t9WTDDxPZ6pfogVboCkY3 jfmX0t0yb6jz8RPFujz/HK1kDT0jgNsoW1pDInV2oKIQdu/DgIizgUmdw2remBVtcj2a ocU5SYn8OfBpABj0Io9by7wQo0NkisQxKml1E/mCl/hM/kL/x5C/NYfWlZab8lOOOhep QYTeyAdopFhw9Iu8Jxm7gfv3pPf8nBuulzH0Ojrw+YvTsEK/ut6e7r7Ezr3BCVC2rqhA nDi3zfTlFaEnXtDCjQcsD+e34M5japgYLVMVXj5dIeTPNqbZFrFsmUmB5T9q2+/92BsS eOGA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=qL7JYbMH; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a64-20020a639043000000b00419f8572858si18605019pge.755.2022.08.11.06.20.30; Thu, 11 Aug 2022 06:20:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=qL7JYbMH; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235205AbiHKMdU (ORCPT + 99 others); Thu, 11 Aug 2022 08:33:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42130 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234248AbiHKMdS (ORCPT ); Thu, 11 Aug 2022 08:33:18 -0400 Received: from NAM02-DM3-obe.outbound.protection.outlook.com (mail-dm3nam02on2068.outbound.protection.outlook.com [40.107.95.68]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ED7AFDECF; Thu, 11 Aug 2022 05:33:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ClOvMSNaTdtk8HjtBVEgWCWbMr0hBb8CQaPsYIpU2VdiJwc/8/65VO1oeHzEz38X1vhtATwwOLXdKVd/qOlS4SfWD/RBnL5Ss1vq/prlevyaP0bomM32qfNMW1qSEhaykCTRf5wv5TdsjHcaTi8eWogAEHTC2c/XOwb8TPwZNnB6AcbDjS4XvKJ8eB2UJ9/BYL8FJiN607CmvU/OX+XHTBZJj8CEUc6rpk0CeoYHXLPVmTEaXRMEDLW2QAOQ08kmo8zP8F1dBWgkvQ4MRYyfKGxONsMEg7jV0KE0MChRi9byGvLh5Hj+xFsOp0AFiO8Gk/NHomQKGCap8mNBzCMKoQ== 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=wvDmQPsFpUzzlzT6cpXiZvGIiABgfERnaavB60hctpY=; b=R+JiFXwFp1xHoOLb5F4TLPZeIOA3fHFuuOxPEFcThsQflr339QsvzfLKeu4b+hLPsQOW5HstydjpSjJ2onkU2flaX3w+B2HswmbUkrDa3lCm7/K+nto3cZ8QdoslSSHMysZCbmDIM6UDj/KWA1szz4Oxsa5vwbSsoJIK9VUQzL9ceKbHG1m8wPX8IXLgbxrNgPMJynAGggj4HCpbKcrIaYUQNFO9l8wevw1H2qIDA1Y3wNrTCD5NCdBJFBLS2XK1oB8gJKtobTyg9o05gEHli996mq4I66RfkngE5rR5d41+N0z3KsSzU7ENvugg30vhFa9YsRRUtF/Sl+zOL1yOAA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=vger.kernel.org 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 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=wvDmQPsFpUzzlzT6cpXiZvGIiABgfERnaavB60hctpY=; b=qL7JYbMHlmLa6Lg7QSxLU5JxU1CjxsaYbz5gjGXZN0d7UvY1deh69DkiaM+QG707LDZGhlRS+uIhCI2DTYVwfPyRnSmawewwJoLt+Kr0eOe+YUmfMH67WcADsyQQxztmtJU8OX3NbAQ+92dWJcCj+aAUcjYFZnS7czo0VZTtoxQ= Received: from MW4PR04CA0323.namprd04.prod.outlook.com (2603:10b6:303:82::28) by DM6PR12MB2730.namprd12.prod.outlook.com (2603:10b6:5:41::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5504.16; Thu, 11 Aug 2022 12:33:14 +0000 Received: from CO1NAM11FT063.eop-nam11.prod.protection.outlook.com (2603:10b6:303:82:cafe::fb) by MW4PR04CA0323.outlook.office365.com (2603:10b6:303:82::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5504.14 via Frontend Transport; Thu, 11 Aug 2022 12:33: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 CO1NAM11FT063.mail.protection.outlook.com (10.13.175.37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5525.11 via Frontend Transport; Thu, 11 Aug 2022 12:33:14 +0000 Received: from sindhu.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.2375.28; Thu, 11 Aug 2022 07:33:08 -0500 From: Sandipan Das To: , , CC: , , , , , , , , , , , , , , , Subject: [PATCH 04/13] x86/cpufeatures: Add LbrExtV2 feature bit Date: Thu, 11 Aug 2022 17:59:52 +0530 Message-ID: <172d2b0df39306ed77221c45ee1aa62e8ae0548d.1660211399.git.sandipan.das@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: 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-Office365-Filtering-Correlation-Id: 69d00bd6-fda8-4713-93f1-08da7b95a912 X-MS-TrafficTypeDiagnostic: DM6PR12MB2730:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: QCWZnRGtFhyRMzBhxXuTGYeIGT2jKAZHKJ3sVDd3Wte4HtD94Jyotd2ACvxM8LeH5Is5RpvRM9YkseB5icauhvZe2FYuzICnW8Webj/m69+YMmBXWxucKH1htxDVYQaWC5pkgrYnJ6YdrRDw/NSRTkRej5PKOy6rJvrxZ6qfviyDynsx2yFGqS/8WrnnbPFHB4VkBaTzNpxkUaWmC2ZFjjgz+/JL0y8XsVfvrU23+KGwOF9yeA8R1ZOiVEkvxVtGaZ75TgOXsrFvFAfOXKssFGUz2/9WGeMrofvn4KCoX2BVjJ/SfBUlAU71J5lE4DMalFRqxLeWep7nVM4Ybem5UMsVZZBeC/Al1prPJbVJvUiUxPo7Lb+H6JSWDgJdFwxCrbOeGG+Fu9Wl228ZVLCOKsqld4OwdQNO5VZbWLBPkiKljSwSsJBPRrEpHJ0kAJV8KkH9+ixFk3+1Z9Dse7zl3sp1CXmmRPxnLPpG1qqxGKqh81UEpN4prZUhf46q699m6uP0U+B8rLInorsI1DCKcra15HXmuRkXUhvNMpLZbPYwetEwUHxo82bb/clnVZnmidaPMLg/u9t/yw1Y17wMlojruYjeBLhMZkr7Zu1uM8iunUBj1WEzqR9vJ/iIz/e6oY70iQgWbu9d3lzZW+Bu3vPXB59oSjb+AcvPaTG23qHM1oNv0aVI/CTJPbF+mbCj2pzbs40RQTjVIQTtqqBh42kzQ4CIpxj2EI+0Cv79LfTPpCy6ClCoFKenNex/NjtzEvtRKPRyDUA/qBbvG4W/iEyYOZlIVF6XI8MT3FaksvAnFXueKwd4OFbHxzp9rOUov/3YD2CgeKhbsRQ/tkuAQA== 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:(13230016)(4636009)(346002)(396003)(136003)(39860400002)(376002)(46966006)(36840700001)(40470700004)(426003)(16526019)(336012)(7416002)(5660300002)(47076005)(478600001)(186003)(86362001)(316002)(54906003)(110136005)(82740400003)(7696005)(40480700001)(26005)(2616005)(44832011)(41300700001)(6666004)(4326008)(36860700001)(81166007)(83380400001)(8936002)(70206006)(8676002)(70586007)(82310400005)(36756003)(40460700003)(356005)(2906002)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Aug 2022 12:33:14.1382 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 69d00bd6-fda8-4713-93f1-08da7b95a912 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: CO1NAM11FT063.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB2730 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org CPUID leaf 0x80000022 i.e. ExtPerfMonAndDbg advertises some new performance monitoring features for AMD processors. Bit 1 of EAX indicates support for Last Branch Record Extension Version 2 (LbrExtV2) features. If found to be set during PMU initialization, the EBX bits of the same leaf can be used to determine the number of available LBR entries. For better utilization of feature words, LbrExtV2 is added as a scattered feature bit. Signed-off-by: Sandipan Das --- arch/x86/include/asm/cpufeatures.h | 2 +- arch/x86/kernel/cpu/scattered.c | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/x86/include/asm/cpufeatures.h b/arch/x86/include/asm/cpufeatures.h index 393f2bbb5e3a..e3fa476a24b0 100644 --- a/arch/x86/include/asm/cpufeatures.h +++ b/arch/x86/include/asm/cpufeatures.h @@ -96,7 +96,7 @@ #define X86_FEATURE_SYSCALL32 ( 3*32+14) /* "" syscall in IA32 userspace */ #define X86_FEATURE_SYSENTER32 ( 3*32+15) /* "" sysenter in IA32 userspace */ #define X86_FEATURE_REP_GOOD ( 3*32+16) /* REP microcode works well */ -/* FREE! ( 3*32+17) */ +#define X86_FEATURE_LBREXT_V2 ( 3*32+17) /* AMD Last Branch Record Extension Version 2 */ #define X86_FEATURE_LFENCE_RDTSC ( 3*32+18) /* "" LFENCE synchronizes RDTSC */ #define X86_FEATURE_ACC_POWER ( 3*32+19) /* AMD Accumulated Power Mechanism */ #define X86_FEATURE_NOPL ( 3*32+20) /* The NOPL (0F 1F) instructions */ diff --git a/arch/x86/kernel/cpu/scattered.c b/arch/x86/kernel/cpu/scattered.c index dbaa8326d6f2..6be46dffddbf 100644 --- a/arch/x86/kernel/cpu/scattered.c +++ b/arch/x86/kernel/cpu/scattered.c @@ -44,6 +44,7 @@ static const struct cpuid_bit cpuid_bits[] = { { X86_FEATURE_PROC_FEEDBACK, CPUID_EDX, 11, 0x80000007, 0 }, { X86_FEATURE_MBA, CPUID_EBX, 6, 0x80000008, 0 }, { X86_FEATURE_PERFMON_V2, CPUID_EAX, 0, 0x80000022, 0 }, + { X86_FEATURE_LBREXT_V2, CPUID_EAX, 1, 0x80000022, 0 }, { 0, 0, 0, 0, 0 } }; -- 2.34.1