From patchwork Mon May 11 08:41:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mahesh J Salgaonkar X-Patchwork-Id: 1288188 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49Ln05522dz9sRR for ; Tue, 12 May 2020 15:48:05 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.ibm.com Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 49Ln0512yKzDqgB for ; Tue, 12 May 2020 15:48:05 +1000 (AEST) X-Original-To: pdbg@lists.ozlabs.org Delivered-To: pdbg@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=linux.ibm.com (client-ip=148.163.158.5; helo=mx0a-001b2d01.pphosted.com; envelope-from=mahesh@linux.ibm.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.ibm.com Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 49LDv85BCnzDqbF for ; Mon, 11 May 2020 18:41:56 +1000 (AEST) Received: from pps.filterd (m0098419.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 04B8VN8F073281; Mon, 11 May 2020 04:41:52 -0400 Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com with ESMTP id 30ws9y4tjj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 11 May 2020 04:41:52 -0400 Received: from m0098419.ppops.net (m0098419.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 04B8fq6h108889; Mon, 11 May 2020 04:41:52 -0400 Received: from ppma05fra.de.ibm.com (6c.4a.5195.ip4.static.sl-reverse.com [149.81.74.108]) by mx0b-001b2d01.pphosted.com with ESMTP id 30ws9y4thy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 11 May 2020 04:41:52 -0400 Received: from pps.filterd (ppma05fra.de.ibm.com [127.0.0.1]) by ppma05fra.de.ibm.com (8.16.0.27/8.16.0.27) with SMTP id 04B8Z0Fo008750; Mon, 11 May 2020 08:41:50 GMT Received: from b06cxnps3075.portsmouth.uk.ibm.com (d06relay10.portsmouth.uk.ibm.com [9.149.109.195]) by ppma05fra.de.ibm.com with ESMTP id 30wm55hkv7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 11 May 2020 08:41:50 +0000 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 04B8fmh564094288 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 11 May 2020 08:41:48 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3E7DCAE057; Mon, 11 May 2020 08:41:48 +0000 (GMT) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 66427AE055; Mon, 11 May 2020 08:41:47 +0000 (GMT) Received: from [192.168.0.24] (unknown [9.199.58.67]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTP; Mon, 11 May 2020 08:41:47 +0000 (GMT) From: Mahesh Salgaonkar To: pdbg Date: Mon, 11 May 2020 14:11:46 +0530 Message-ID: <158918650638.16822.2953054547382650577.stgit@jupiter> In-Reply-To: <158918648405.16822.8656222589108716359.stgit@jupiter> References: <158918648405.16822.8656222589108716359.stgit@jupiter> User-Agent: StGit/unknown-version MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.216, 18.0.676 definitions=2020-05-11_02:2020-05-08, 2020-05-11 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 bulkscore=0 malwarescore=0 clxscore=1015 priorityscore=1501 adultscore=0 impostorscore=0 phishscore=0 mlxlogscore=999 mlxscore=0 spamscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2003020000 definitions=main-2005110066 X-Mailman-Approved-At: Tue, 12 May 2020 15:47:51 +1000 Subject: [Pdbg] [PATCH RFC 4/4] pdbg: Add timer facility TOD error injections. X-BeenThere: pdbg@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "mailing list for https://github.com/open-power/pdbg development" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Nicholas Piggin Errors-To: pdbg-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Pdbg" Add TOD error injections. # ./pdbg -p0 inject tod pp0_reg_parity p0: 0x40031 = 0x1000000000000000 # Signed-off-by: Mahesh Salgaonkar --- src/timefac_error.c | 81 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) diff --git a/src/timefac_error.c b/src/timefac_error.c index cb6c9ac..92ccfc2 100644 --- a/src/timefac_error.c +++ b/src/timefac_error.c @@ -33,6 +33,9 @@ /* SPR_MODE scom address */ #define P9_SCOM_SPR_MODE 0x20010A84 +/* TOD Error inject register scom address */ +#define TOD_ERROR_INJECT 0x40031 + /* TB Errors */ #define TB_ERROR_MASK PPC_BITMASK(10, 15) /* Core level TB errors */ @@ -44,6 +47,21 @@ #define TB_ERROR_SPURR_PARITY 0x5 #define TB_ERROR_DEC_PARITY 0x6 +/* TOD Errors */ +#define TOD_ERR_MPATH_CREG_PARITY PPC_BIT(0) +#define TOD_ERR_PPORT0_CREG_PARITY PPC_BIT(3) +#define TOD_ERR_PPORT1_CREG_PARITY PPC_BIT(4) +#define TOD_ERR_SPORT0_CREG_PARITY PPC_BIT(5) +#define TOD_ERR_SPORT1_CREG_PARITY PPC_BIT(6) +#define TOD_ERR_SPATH_CREG_PARITY PPC_BIT(7) +#define TOD_ERR_IPATH_CREG_PARITY PPC_BIT(8) +#define TOD_ERR_PSMS_CREG_PARITY PPC_BIT(9) +#define TOD_ERR_PSS_HAMMING_DISTANCE PPC_BIT(18) +#define TOD_ERR_DELAY_COMPL_PARITY PPC_BIT(22) +#define TOD_ERR_CTCR_PARITY PPC_BIT(32) +#define TOD_ERR_TOD_SYNC_CHECK PPC_BIT(33) +#define TOD_ERR_TOD_FSM_PARITY PPC_BIT(34) + typedef struct error_type { char *name; char *desc; @@ -59,6 +77,45 @@ static error_type_t tb_error_type[] = { { "dec_parity", "DEC parity error", TB_ERROR_DEC_PARITY }, }; +static error_type_t tod_error_type[] = { + { "mp_reg_parity", + "Master path control register (0x00): data parity error", + TOD_ERR_MPATH_CREG_PARITY }, + { "pp0_reg_parity", + "port-0 primary configuration register (0x01): data parity error", + TOD_ERR_PPORT0_CREG_PARITY }, + { "pp1_reg_parity", + "port-1 primary configuration register (0x02): data parity error", + TOD_ERR_PPORT1_CREG_PARITY }, + { "sp0_reg_parity", + "port-0 secondary configuration register (0x03): data parity error", + TOD_ERR_SPORT0_CREG_PARITY }, + { "sp1_reg_parity", + "port-1 secondary configuration register (0x04): data parity error", + TOD_ERR_SPORT1_CREG_PARITY }, + { "sp_reg_parity", + "slave path control register (0x05): data parity error", + TOD_ERR_SPATH_CREG_PARITY }, + { "ip_reg_parity", + "internal path control register (0x06): data parity error", + TOD_ERR_IPATH_CREG_PARITY }, + { "psms_reg_parity", + "primary/secondary master/slave control register (0x07): data parity error", + TOD_ERR_PSMS_CREG_PARITY }, + { "pss_hum_dist", "PSS Hamming Distance", + TOD_ERR_PSS_HAMMING_DISTANCE }, + { "delay_parity", + "internal path: delay, STEP check components: parity error", + TOD_ERR_DELAY_COMPL_PARITY }, + { "ch_reg_parity", + "chip control register (0x10): data parity error", + TOD_ERR_CTCR_PARITY }, + { "sync_check", "internal path: SYNC check error", + TOD_ERR_TOD_SYNC_CHECK }, + { "fsm_st_parity", "internal path: FSM state parity error", + TOD_ERR_TOD_FSM_PARITY }, +}; + static int timefac_inject_tb_error(struct pdbg_target *target, void *data) { int target_type = 0; @@ -101,6 +158,23 @@ static int timefac_inject_tb_error(struct pdbg_target *target, void *data) return rc; } +static int timefac_inject_tod_error(struct pdbg_target *target, void *data) +{ + uint64_t err_val; + int rc; + + err_val = *((uint64_t *)data); + + if (TARGET_TYPE_PROC != get_target_type(target)) + return -EINVAL; + + rc = target_inject_error(target, TOD_ERROR_INJECT, err_val); + if (rc) { + printf("Failed to inject\n"); + } + return rc; +} + void timefac_err_init(void) { int i; @@ -111,4 +185,11 @@ void timefac_err_init(void) tb_error_type[i].desc, timefac_inject_tb_error, &tb_error_type[i].error); + /* Register TOD error injects */ + for (i = 0; i < ARRAY_SIZE(tod_error_type); i++) + register_error_inject("tod", tod_error_type[i].name, + tod_error_type[i].desc, + timefac_inject_tod_error, + &tod_error_type[i].error); + }