Message ID | 20200816170039.364608-2-anup.patel@wdc.com |
---|---|
State | Superseded |
Headers | show
Return-Path: <opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org> X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2001:8b0:10b:1231::1; helo=merlin.infradead.org; envelope-from=opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=<UNKNOWN>) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=wdc.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=merlin.20170209 header.b=qlI4cYYs; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=wdc.com header.i=@wdc.com header.a=rsa-sha256 header.s=dkim.wdc.com header.b=NoXJ3Cv9; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=sharedspace.onmicrosoft.com header.i=@sharedspace.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-sharedspace-onmicrosoft-com header.b=KFPOSrBB; dkim-atps=neutral Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) (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 4BV3Nm5Fh2z9sR4 for <incoming@patchwork.ozlabs.org>; Mon, 17 Aug 2020 03:01:28 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=VJlnokQhwEhhBEfmIGiLM42ItQ3CoD0w6uqLpE9L0Ew=; b=qlI4cYYsRoE04XGL6V7QtXPdk +5aUbk9cbpRCvxD8Gee9pdIdiAg0mevKpeEwXxzyPmHEnlSmh6U0JPoVpm4EoOleXsSHzuLhSxrLh JHh6AloXZgERjkYo8UqcNmy7IaFffyIHSetkRFZMciR9sB+/IP8jUkLeK3+KFc4ZWr1T1AW0Yo2xF p41iVYsI6I09GQwXWPfaBzEBf0ltqBpIL+5Dr3DM43f7iJRHF4HS4ROyrUSExwbQ1O/IhBuq3xQFJ 0OhyXRs8nJDYoIGNpxCXlQTvlb920FyDa0zhk2f+3O4S9HiQSwicE6O7Nj7YlL9a0BuAsdwjn2xZ3 UEw/NiqHg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1k7M26-0000UX-Cz; Sun, 16 Aug 2020 17:01:22 +0000 Received: from esa5.hgst.iphmx.com ([216.71.153.144]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1k7M24-0000Ta-AC for opensbi@lists.infradead.org; Sun, 16 Aug 2020 17:01:21 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1597597280; x=1629133280; h=from:to:cc:subject:date:message-id:in-reply-to: references:content-transfer-encoding:mime-version; bh=/2Q7QQyqvhwl817VFw9a5W+sD6eD09QxAtCCyQO0vQ8=; b=NoXJ3Cv9SHk4PdtEoB/jtHR58lcMR+X82y1R+v/Kmahyv79u//JeWDjR TIU8XrEASZRnrghWlEWe4H9A3HuQpIcdP24k1C6rt6IuN2wZZ/ICDeBcE wefIAuPcnZAAoHn5eHonMYHgHw6e5jrX8vIRZZj/BpXrK1bwodmK7MFSm FTMPDjmc6EqGDgCrnFlvQ1UxaLiqvVs6gA5QcLJeWFFYTzVj4KjxA8oMc WBELvSqAB65NDB0kXvzpZUC/MFnQ3x9hirk30oDhcTPoZ2NzUUhyLFCXQ LZ0H2ZfJ0/W0JVvJxTmSrIIPNlArj3DYjgRYAklTbuNrrsgBnXbFvpQjT Q==; IronPort-SDR: M0hhj40edHlV2G++5cyOShCc5mc1wkz2L4JqrNS4mVJC1AnmldZvZ3unqzf7k9ztMHlZBXKxCt exEKeTcF/gynyfpyS//KZ5LEEAblyRlwJ90qzutbLlNpRueprzzU20naS+EE0YaYx5NlEsF/dt 3hUPcqxTOS0PMKfgEa2YvxNQbQfdNoqjeD2SIAI4VwxmRAPGOFeYfhyJ3c7lkXSupgXnNj8oOU vS8xfxY3yjAMlpSA9pE0f+VMOV3Bf9anx4VGkO1P5Au8+dLj3aSBi4uf6VoMBR+f/p7vzZKXRG T7E= X-IronPort-AV: E=Sophos;i="5.76,321,1592841600"; d="scan'208";a="145089820" Received: from mail-bn3nam04lp2055.outbound.protection.outlook.com (HELO NAM04-BN3-obe.outbound.protection.outlook.com) ([104.47.46.55]) by ob1.hgst.iphmx.com with ESMTP; 17 Aug 2020 01:01:15 +0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BlsBzCvhNb4Q3wZ0WZ/Vn+0XPDSLdjpszT0c1wc1DFqm5cbHb6WQHrRmBLMMfVBsD7BsdsCN3CzS6kJ0cehvDRAGSQk4mHNQdJ7zYc625gh/14jW56hUl18/o2s4TboC7MEP+qIUgIOoktefKV+ccguIU5U6xoife8Xi4CPGCYUc8Bo9uHrKJvwR+59mA6ZNla+rYQ8BnQX0LTX31nhnI9Mful9RvCAjlrVROXTArpoSVgHFs7S4ZB0qWKAK3eMgSeThim819duh8N7VPVt7nb+eJFp+xgczZc2DKL+lUfnvz33GtFIdGIkdOVynnFKr7EiOUpuTM8HE+qBOi0etrg== 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=hQ05yCOW33DucCT5s+EbHEdaMnzkDSa7QYQWgxpPg/I=; b=FxvQPEct26j2/an3nfm9XuX5jOWkf3R4BO3pAAm3RwVn0V0OTQ0EaD+vdoQ/TSCOipMgohaT+azYr040/Aj8J2z8wt2lp6YbPXpFh7JEVQUhSsDUP4Dz5J9cYqOcTO4f/++iXXHUUwEv8co691gbvfKYQKk59fiZe9hq8j/SW5OCpmmU6ENJEALjXhPAWk60f1z7wPXBgshtbq0jqSuaueteZKKkLXZVGhtcoMfhL8nmn1qC8hF06DVNSqrBguK7sYe3Sz/TGlzXsmCsq1L8NcSMrznplNN1ZcCjXdKo6D0KtbQYKlOGJsGy74IQqL1zyqUiA1pLMgJghSD1P+jz3A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=wdc.com; dmarc=pass action=none header.from=wdc.com; dkim=pass header.d=wdc.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sharedspace.onmicrosoft.com; s=selector2-sharedspace-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=hQ05yCOW33DucCT5s+EbHEdaMnzkDSa7QYQWgxpPg/I=; b=KFPOSrBBXv/aSQRwjp374b+4iRRET1YYK6SOLMxFcZfZL+wKyeq+/Rl6ClNXUapIc3kYYtxJbnVHvLkjoWagYEbwjFbr+vAcARDeS+3wRDWnKfXA2TUsydLf6l6udrghK0tK6F2Sm68VobLf6UrJz8IuxQGnfaodC5IETt+wxJY= Authentication-Results: wdc.com; dkim=none (message not signed) header.d=none;wdc.com; dmarc=none action=none header.from=wdc.com; Received: from DM6PR04MB6201.namprd04.prod.outlook.com (2603:10b6:5:127::32) by DM6PR04MB4329.namprd04.prod.outlook.com (2603:10b6:5:9a::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3283.24; Sun, 16 Aug 2020 17:01:14 +0000 Received: from DM6PR04MB6201.namprd04.prod.outlook.com ([fe80::607a:44ed:1477:83e]) by DM6PR04MB6201.namprd04.prod.outlook.com ([fe80::607a:44ed:1477:83e%7]) with mapi id 15.20.3283.027; Sun, 16 Aug 2020 17:01:14 +0000 From: Anup Patel <anup.patel@wdc.com> To: Atish Patra <atish.patra@wdc.com>, Alistair Francis <Alistair.Francis@wdc.com> Subject: [PATCH v2 2/2] lib: sbi: Handle the case where MTVAL has illegal instruction address Date: Sun, 16 Aug 2020 22:30:39 +0530 Message-Id: <20200816170039.364608-2-anup.patel@wdc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200816170039.364608-1-anup.patel@wdc.com> References: <20200816170039.364608-1-anup.patel@wdc.com> X-ClientProxiedBy: BM1PR0101CA0069.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00:19::31) To DM6PR04MB6201.namprd04.prod.outlook.com (2603:10b6:5:127::32) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from wdc.com (103.15.59.21) by BM1PR0101CA0069.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00:19::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3283.16 via Frontend Transport; Sun, 16 Aug 2020 17:01:11 +0000 X-Mailer: git-send-email 2.25.1 X-Originating-IP: [103.15.59.21] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: a47bad75-5645-4e6c-4b07-08d84205fbe8 X-MS-TrafficTypeDiagnostic: DM6PR04MB4329: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: <DM6PR04MB43290EEF096EC4C69B237C708D5E0@DM6PR04MB4329.namprd04.prod.outlook.com> WDCIPOUTBOUND: EOP-TRUE X-MS-Oob-TLC-OOBClassifiers: OLM:6430; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: zZGfxZxkeOZL9FlgMCmWHduS7H92df+KliTqAEuNA5pQQGp32V4NtximprNX3J8KAOe/ZmPZ5lSczVV8F0nblKCy0M9eBihyWQeeGvDjzoRT18P7QCZgkiTepcSbxoAvuZiegjNhvnaqK85DqcV7SFEUG07NULX5x9eY5vxlYPP5KNN4ZLaWEtN4g+kRq0pn0h8G3Sc8gtVRrbo0wmGl1u31qJu32vnbX09x/rKVAYYCqpWDQbxOEpm7wlLM+L2hC0+GzZWE8xlX2xvXKJ9NV16XVzP5bF8juGQJAZx3rJ+2mnHoiIrU1upx+WBEbzm9 X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR04MB6201.namprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(39860400002)(136003)(346002)(376002)(366004)(396003)(8676002)(110136005)(8886007)(2616005)(316002)(66946007)(956004)(54906003)(6666004)(8936002)(4326008)(44832011)(52116002)(6636002)(66556008)(66476007)(7696005)(86362001)(55016002)(83380400001)(26005)(478600001)(36756003)(1076003)(5660300002)(16526019)(2906002)(186003); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: VvbkF2FU/y2vdWnsWUmSmuMS6TpJGLyLFgKWY4EuqiJohlswoabwmaLDtq96Z/+3uG4MWM2vf17TTPPpJ2+ydQenZvYouriXF1TT2DrPtpbpU2s38ubxqS9pZc66XqSlb+d3I8cIi7cfFuWHqlYSiftpr+CRb35k5rcyJbqsoAPOHs8nHVzLFCKVQwbWJQJb16Da9xcJIj1BcaMWm+Jn1gnlmGI99GkEJ+15WIWTFZarzPHfqiRWOFBA2JjxO4VBD6AkxC/TbGa9MnE1oOCB1OYAasWoAWsq/aNXpUMbIkGNhncr0aJoVqQMMyyFD16eqGIb+wnwLCLFoqXTtfJmQEg4A7fDGVn5s/C0MVoBz56B1KfTVnGj7SNXv7XspQQqJaasa21n9eMVRcYazsF0ztMTkHwYLI6rUcjlQraxN63NbL6RsaBf0mvfxoifRnxNsRCTuN+M/KNNNvTE5Qu02vUUiJRyFm56Kd2VjaDK7dOCzX95dV4KQT8JFar7QxE1vsAURANlmIDwxds89Ggon3A+p/erFEE09EBggYPKk80JB6e72bhveR9n8hON5X25bP3rmDifZCNOXSUK+HDhPyXAEnEgdWDb7pxvFbKzZaQdYkB4cfwxhhcdOHecXrIa4tnNkxc5jytt6rX4jVyuJA== X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-Network-Message-Id: a47bad75-5645-4e6c-4b07-08d84205fbe8 X-MS-Exchange-CrossTenant-AuthSource: DM6PR04MB6201.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Aug 2020 17:01:14.3048 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: b61c8803-16f3-4c35-9b17-6f65f441df86 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: yzCOHno7RaHiqY6xZtn1kgdXIgspuxI44OwSkUB7iE/BSWLy5MWHbEpJ7teb9CiNCEZvqxXsVq9kcvGnn5Getg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR04MB4329 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200816_130120_666533_FDEB5E7E X-CRM114-Status: GOOD ( 14.23 ) X-Spam-Score: -2.5 (--) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-2.5 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [216.71.153.144 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.0 MSGID_FROM_MTA_HEADER Message-Id was added by a relay X-BeenThere: opensbi@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: <opensbi.lists.infradead.org> List-Unsubscribe: <http://lists.infradead.org/mailman/options/opensbi>, <mailto:opensbi-request@lists.infradead.org?subject=unsubscribe> List-Archive: <http://lists.infradead.org/pipermail/opensbi/> List-Post: <mailto:opensbi@lists.infradead.org> List-Help: <mailto:opensbi-request@lists.infradead.org?subject=help> List-Subscribe: <http://lists.infradead.org/mailman/listinfo/opensbi>, <mailto:opensbi-request@lists.infradead.org?subject=subscribe> Cc: Bin Meng <bin.meng@windriver.com>, Heinrich Schuchardt <xypron.glpk@gmx.de>, Anup Patel <anup.patel@wdc.com>, opensbi@lists.infradead.org, Anup Patel <anup@brainfault.org> Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "opensbi" <opensbi-bounces@lists.infradead.org> Errors-To: opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org |
Series |
[v2,1/2] lib: sbi_init: Avoid thundering hurd problem with coldbook_lock
|
expand
|
diff --git a/lib/sbi/sbi_illegal_insn.c b/lib/sbi/sbi_illegal_insn.c index 0e5523f..9af3d24 100644 --- a/lib/sbi/sbi_illegal_insn.c +++ b/lib/sbi/sbi_illegal_insn.c @@ -118,13 +118,22 @@ int sbi_illegal_insn_handler(ulong insn, struct sbi_trap_regs *regs) { struct sbi_trap_info uptrap; + /* + * We only deal with 32-bit (or longer) illegal instructions. If we + * see instruction is zero OR instruction is 16-bit then we fetch and + * check the instruction encoding using unprivilege access. + * + * The program counter (PC) in RISC-V world is always 2-byte aligned + * so handling only 32-bit (or longer) illegal instructions also help + * the case where MTVAL CSR contains instruction address for illegal + * instruction trap. + */ + if (unlikely((insn & 3) != 3)) { - if (insn == 0) { - insn = sbi_get_insn(regs->mepc, &uptrap); - if (uptrap.cause) { - uptrap.epc = regs->mepc; - return sbi_trap_redirect(regs, &uptrap); - } + insn = sbi_get_insn(regs->mepc, &uptrap); + if (uptrap.cause) { + uptrap.epc = regs->mepc; + return sbi_trap_redirect(regs, &uptrap); } if ((insn & 3) != 3) return truly_illegal_insn(insn, regs);