From patchwork Tue May 11 15:25:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naveen Krishna Chatradhi X-Patchwork-Id: 12251365 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6B645C433B4 for ; Tue, 11 May 2021 15:26:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 30FFD61400 for ; Tue, 11 May 2021 15:26:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231779AbhEKP13 (ORCPT ); Tue, 11 May 2021 11:27:29 -0400 Received: from mail-eopbgr760087.outbound.protection.outlook.com ([40.107.76.87]:3470 "EHLO NAM02-CY1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S231955AbhEKP11 (ORCPT ); Tue, 11 May 2021 11:27:27 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=U88Rapyyd//kCW3FhXVffcVPCKZUtDPW0XSMhkkoqNyRdmrNTfpnEsvjUieh3+XMPAgY9HnrmXBjSp/v+KcnQO2ypYM23BjnLpSvcCDIZtsuEya/3FZ4KsTOUEi/LGd64UKGzsWvExi1QzG4LD+AM/cyxEK8JF2RagViY4Y15xWssvZPkSffz7nGnqafDtwMskUkBsI6CNenaoXAq59maMGv3K7eyu7tV38dbt/zl4NM4FJBscr/0Q2ZhKtOZbxWBNE6gJ8gL1JsUqMtaQkQ/iF6gKb/gAwb9SFXtRrrVnXHgyNBl/qX04ClYLHAyD6SBDXjybN0UsFLFvseCcDFig== 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-SenderADCheck; bh=vgSeeTandTe6p0eSaEd9ZH1d9GD6Y+BiMlYioOJiR2c=; b=F5swrPdz7TGFF/fhtbwOjicEjc5o4fmofHpzinN7CTmj3hCwuRurjQGd2i49OuAqn+HIhNqw6qb0Xeks8nsBlhkT9YXSRwHhgcTrJ/DU/WUV1YRqzS5uTpSke3vCZTHESiOmrSNBbwXaUHEg8kdzkVomksGUiaHrmbmcSdsj5LzG9E5gsIrX0iXkScQGz3sJBIdd1bdhs212/4gctwKHPcOLUkYyB4XPrseNNhewGl3jd+MDH3fdFgl8jEyH6fyy5oF7tOoDR2gSw2briIq5MrPx7iDcs8cckouwegs/SqgeXU/6W6yXCR1Pv0xzSUtQnsDnDsieBPQa/poolUDutA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; 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=vgSeeTandTe6p0eSaEd9ZH1d9GD6Y+BiMlYioOJiR2c=; b=sFfOXSLk09UqCPZ8PztcksF5gHW08viHe8K/ojGyLmAOGbprT5dp0Gv0jyPKqyldB9Lv+mf66DTOZ4DPPvE/rzEfjLweOYAj9uC2yZz/FRVW/AhJyg3QLdzit/oAfwp8qZXVvNREEl8CQY4PC0TlXJwYWjNzhl0jemu32xSwlPQ= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=amd.com; Received: from DM6PR12MB4388.namprd12.prod.outlook.com (2603:10b6:5:2a9::10) by DM6PR12MB4402.namprd12.prod.outlook.com (2603:10b6:5:2a5::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4129.25; Tue, 11 May 2021 15:26:18 +0000 Received: from DM6PR12MB4388.namprd12.prod.outlook.com ([fe80::9030:4dbb:df11:c961]) by DM6PR12MB4388.namprd12.prod.outlook.com ([fe80::9030:4dbb:df11:c961%5]) with mapi id 15.20.4108.032; Tue, 11 May 2021 15:26:18 +0000 From: Naveen Krishna Chatradhi To: linux-edac@vger.kernel.org, x86@kernel.org Cc: linux-kernel@vger.kernel.org, bp@alien8.de, mingo@redhat.com, mchehab@kernel.org, Mukul Joshi Subject: [PATCH 2/3] x86/MCE/AMD: Helper function to check UMC v2 Date: Tue, 11 May 2021 20:55:37 +0530 Message-Id: <20210511152538.148084-2-nchatrad@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210511152538.148084-1-nchatrad@amd.com> References: <20210511152538.148084-1-nchatrad@amd.com> X-Originating-IP: [165.204.156.251] X-ClientProxiedBy: MA1PR0101CA0004.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:21::14) To DM6PR12MB4388.namprd12.prod.outlook.com (2603:10b6:5:2a9::10) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from milan-ETHANOL-X.amd.com (165.204.156.251) by MA1PR0101CA0004.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:21::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.25 via Frontend Transport; Tue, 11 May 2021 15:26:15 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 97d8850f-948a-43d7-9609-08d914911f50 X-MS-TrafficTypeDiagnostic: DM6PR12MB4402: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1051; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 8A+cNYrqAHdBhd/tSg8mMwzigIuRuiaegYcSjcc9MJC19wUf//WwRP9TTEy+s/bfXPZ8sUJMstpbPJb8bFXP1HNFh7rPuf5s9Fi8VN7mIqgvlMvIGzzPjS8Od3pdWvg1Mh4XKr5CWOs/DqbKGvjTkiEPOSU7CnlVgORHSlOVXb/PAn/ug+wpz4b9Seiz/DWUDXmyFLtKIXyNa+g3i/UPB2BEU0R8jpxiJ021MoOjB/KK8Oadfhv9VcwRJ85zp/q0AQ52tOyxqJmn2tos4Be2KPOJb6uayZGHOabrXzZ2hdQem9r6dobLcl/NoKewDrdTcWSpmhrDz+HmWnvtNG7vOwaBi6TcdHVxvSHehqeb4Q8R6i9A34dX9ODcTdV6lU4WHPd2Scaez5EGFTjhOeeAPWYohWs0hTofE2dn7JkAOPgq9xKkYTOocICfKfxKeP7A0wuiO10BKMQjsYRvMWjc9jMLKQTjPiV2XKmXUP61vnlnJ6tIBV3115YSne0V7vaxaGpd0PsqG2KFbe2zCeYu5Lw2EybWC1aez/y+hk7gK9X0SVqWJ1aCWrWxbLTKS1S1EPkgolnh9sCUnYSALCmO+NC8bHe93qbQMXFa+kyTL15LgZn2sZu+Z3C+T24Enk+Rd6exueU4Gk7oHc9QMd/12w== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM6PR12MB4388.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(376002)(39860400002)(346002)(396003)(366004)(136003)(2616005)(66946007)(4326008)(1076003)(316002)(83380400001)(2906002)(6486002)(52116002)(7696005)(6666004)(16526019)(186003)(8936002)(8676002)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JWvTkp7uC5cHVMsMc7CI4iCN/qrf6+XPuGXoOF7ITlQ1NakFnIp2tpymYA78MkJPqntPKqDrALG0rJnIi4vQEQOgG11OwMNgCdkI6ObaDQgtGdFhbsDrVGB/bLkJ8R1SC7b+v8/RIfHt5deu8E0zY9IHmSkCB2e/GLXvi9wSvWJRKw0YvD5DL36sXf7crtHL6JrJZINrj7jHgE+Bz5ifHXU7nddg1I6NgXUeoOze9JmMqQFwxFHt9owi4MRvkTGaDHFnUIfCEt4k/qAbm42Lk1/LQ7MTmk1erHRUE2JdlEFXe+IguCMzmh75Shl5YPCVrdyd1Lk02DNGAIb9rWE2ZwvctrzyUSRqwjTFV+P2gR+X7Fa7Hxi9NKsHrBNu X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 97d8850f-948a-43d7-9609-08d914911f50 X-MS-Exchange-CrossTenant-AuthSource: DM6PR12MB4388.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 May 2021 15:26:17.9656 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: ZNyJ0cPq1Me6wHiQg3L2qYKUdB0+ZEeW/Xe/uqX2Ash6nOcMi7MLlkr3kq+5Q5tP3ajZ2QXOxwop/38b4wi0wQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4402 Precedence: bulk List-ID: X-Mailing-List: linux-edac@vger.kernel.org From: Mukul Joshi Add a helper function to check if a given bank is UMCv2 or not. Signed-off-by: Mukul Joshi Reviewed-by: John Clements Reviewed-by: Yazen Ghannam --- arch/x86/include/asm/mce.h | 2 ++ arch/x86/kernel/cpu/mce/amd.c | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/arch/x86/include/asm/mce.h b/arch/x86/include/asm/mce.h index cf7f35fdf2c8..8cbe7221a253 100644 --- a/arch/x86/include/asm/mce.h +++ b/arch/x86/include/asm/mce.h @@ -357,6 +357,7 @@ extern int mce_threshold_remove_device(unsigned int cpu); void mce_amd_feature_init(struct cpuinfo_x86 *c); int umc_normaddr_to_sysaddr(u64 norm_addr, u16 nid, u8 umc, u64 *sys_addr); +bool is_smca_umc_v2(int bank); #else @@ -366,6 +367,7 @@ static inline bool amd_mce_is_memory_error(struct mce *m) { return false; }; static inline void mce_amd_feature_init(struct cpuinfo_x86 *c) { } static inline int umc_normaddr_to_sysaddr(u64 norm_addr, u16 nid, u8 umc, u64 *sys_addr) { return -EINVAL; }; +static inline bool is_smca_umc_v2(int bank) { return false; }; #endif static inline void mce_hygon_feature_init(struct cpuinfo_x86 *c) { return mce_amd_feature_init(c); } diff --git a/arch/x86/kernel/cpu/mce/amd.c b/arch/x86/kernel/cpu/mce/amd.c index 055f3a0acf5e..41718e3111f2 100644 --- a/arch/x86/kernel/cpu/mce/amd.c +++ b/arch/x86/kernel/cpu/mce/amd.c @@ -1542,3 +1542,9 @@ int mce_threshold_create_device(unsigned int cpu) mce_threshold_remove_device(cpu); return err; } + +bool is_smca_umc_v2(int bank) +{ + return (smca_get_bank_type(bank) == SMCA_UMC_V2); +} +EXPORT_SYMBOL_GPL(is_smca_umc_v2);