Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752587AbbFBU1V (ORCPT ); Tue, 2 Jun 2015 16:27:21 -0400 Received: from mail-bn1on0141.outbound.protection.outlook.com ([157.56.110.141]:8704 "EHLO na01-bn1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751854AbbFBU0S (ORCPT ); Tue, 2 Jun 2015 16:26:18 -0400 Authentication-Results: spf=none (sender IP is 165.204.84.222) smtp.mailfrom=amd.com; alien8.de; dkim=none (message not signed) header.d=none; X-WSS-ID: 0NPC3FO-08-TLE-02 X-M-MSG: From: Aravind Gopalakrishnan To: , , CC: , , Subject: [PATCH V2 4/9] edac, mce_amd_inj: Add capability to trigger apic interrupts Date: Tue, 2 Jun 2015 15:35:57 -0500 Message-ID: <1433277362-10911-5-git-send-email-Aravind.Gopalakrishnan@amd.com> X-Mailer: git-send-email 2.4.0 In-Reply-To: <1433277362-10911-1-git-send-email-Aravind.Gopalakrishnan@amd.com> References: <1433277362-10911-1-git-send-email-Aravind.Gopalakrishnan@amd.com> MIME-Version: 1.0 Content-Type: text/plain X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1;BN1BFFO11FD033;1:pM06s/wwNeznXkb/OnxsALhM4Zt00IAGl4sKQAbL864XnW/KfoiXGVlv1/0tJ5MwijzBTmvEUqsDhZbIkeL1YZoEQgfWPz9Ac5YAGgmpzfz2w97JJ+v4kRBxk8ojPFfvxagO0+jr31Zl+/Pm5H+ayn080omhXKmI72EppEoxbYJ7lcIhEU1VzQKikpvXgBWpYaLXjxeBGMpqUqzQMn40XJMRGRJ65uuXOFdLuNPvPt0BoH680vOfcQhp/7GGq8caSzIWip/fo0IqpcYEBb6Wfg== X-Forefront-Antispam-Report: CIP:165.204.84.222;CTRY:US;IPV:NLI;EFV:NLI;SFV:NSPM;SFS:(10019020)(6009001)(428002)(199003)(189002)(19580395003)(19580405001)(48376002)(106466001)(189998001)(92566002)(53416004)(105586002)(47776003)(64706001)(229853001)(76176999)(50466002)(50226001)(50986999)(87936001)(36756003)(77156002)(62966003)(5001830100001)(5001860100001)(101416001)(2201001)(86362001)(2950100001)(77096005)(46102003)(68736005)(5001770100001)(97736004)(4001540100001);DIR:OUT;SFP:1102;SCL:1;SRVR:BLUPR02MB1105;H:atltwp02.amd.com;FPR:;SPF:None;PTR:InfoDomainNonexistent;A:1;MX:1;LANG:en; X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BLUPR02MB1105; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(520003)(5005006)(3002001);SRVR:BLUPR02MB1105;BCL:0;PCL:0;RULEID:;SRVR:BLUPR02MB1105; X-Forefront-PRVS: 05954A7C45 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Jun 2015 20:26:16.3329 (UTC) X-MS-Exchange-CrossTenant-Id: fde4dada-be84-483f-92cc-e026cbee8e96 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=fde4dada-be84-483f-92cc-e026cbee8e96;Ip=[165.204.84.222];Helo=[atltwp02.amd.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR02MB1105 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2643 Lines: 100 With this extension to the flags attribute, deferred error interrupts and threshold interrupts can be triggered to test the apic interrupt handler functionality for these type of errors Signed-off-by: Aravind Gopalakrishnan --- drivers/edac/mce_amd_inj.c | 41 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 39 insertions(+), 2 deletions(-) diff --git a/drivers/edac/mce_amd_inj.c b/drivers/edac/mce_amd_inj.c index c129a8d..377fd6c 100644 --- a/drivers/edac/mce_amd_inj.c +++ b/drivers/edac/mce_amd_inj.c @@ -29,17 +29,21 @@ static struct dentry *dfs_inj; static u8 n_banks; -#define MAX_FLAG_OPT_SIZE 3 +#define MAX_FLAG_OPT_SIZE 4 enum injection_type { SW_INJ = 0, /* SW injection, simply decode the error */ HW_INJ, /* Trigger a #MC */ + DFR_INT_INJ, /* Trigger Deferred error interrupt */ + THR_INT_INJ, /* Trigger threshold interrupt */ N_INJ_TYPES, }; static const char * const flags_options[] = { [SW_INJ] = "sw", [HW_INJ] = "hw", + [DFR_INT_INJ] = "dfr", + [THR_INT_INJ] = "thr", NULL }; @@ -186,6 +190,16 @@ static void trigger_mce(void *info) asm volatile("int $18"); } +static void trigger_dfr_int(void *info) +{ + asm volatile("int %0" :: "i" (DEFERRED_ERROR_VECTOR)); +} + +static void trigger_thr_int(void *info) +{ + asm volatile("int %0" :: "i" (THRESHOLD_APIC_VECTOR)); +} + static void do_inject(void) { u64 mcg_status = 0; @@ -197,6 +211,20 @@ static void do_inject(void) return; } + if (inj_type == DFR_INT_INJ) { + /* + * Ensure necessary status bits for deferred errors: + * a. MCx_STATUS[Deferred] is set - + * This is to ensure the error will be handled by the + * interrupt handler + * b. unset MCx_STATUS[UC] + * As deferred errors are _not_ UC + */ + + i_mce.status |= MCI_STATUS_DEFERRED; + i_mce.status |= (i_mce.status & ~MCI_STATUS_UC); + } + get_online_cpus(); if (!cpu_online(cpu)) goto err; @@ -223,7 +251,16 @@ static void do_inject(void) toggle_hw_mce_inject(cpu, false); - smp_call_function_single(cpu, trigger_mce, NULL, 0); + switch (inj_type) { + case DFR_INT_INJ: + smp_call_function_single(cpu, trigger_dfr_int, NULL, 0); + break; + case THR_INT_INJ: + smp_call_function_single(cpu, trigger_thr_int, NULL, 0); + break; + default: + smp_call_function_single(cpu, trigger_mce, NULL, 0); + } err: put_online_cpus(); -- 2.4.0 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/