From patchwork Fri Mar 31 13:07:52 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Chen X-Patchwork-Id: 9656377 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 36B9060351 for ; Fri, 31 Mar 2017 13:11:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2876227F93 for ; Fri, 31 Mar 2017 13:11:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1C24628669; Fri, 31 Mar 2017 13:11:15 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 8DCFB27F93 for ; Fri, 31 Mar 2017 13:11:14 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ctwIM-0008E1-W0; Fri, 31 Mar 2017 13:08:50 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ctwIL-0008Bt-Sj for xen-devel@lists.xen.org; Fri, 31 Mar 2017 13:08:50 +0000 Received: from [193.109.254.147] by server-7.bemta-6.messagelabs.com id C8/34-04817-1E45ED85; Fri, 31 Mar 2017 13:08:49 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA1VSa0hTYRj2O5ftlJ44zsXeWS6c2Y1cSlRGYFI Q/SmsjGZ/7KyO22JT21m26M/UTDQt15WG5N2kJCTMC5Z0M0qxVCqW5fBSaBZZlqndz/FMs+/X 837P87zP+8JL4YpRMpjiHHbOlsxatLK5hGmV37qI3nivPtIzoYou/1xGxKKtLU0/sDi0lzQnG 1Ic+0iTp+YnSs1Z4viYXSh3oneaXDSXIhgnDoN5JwixUDAVGHTlZWK5aI5QtGCQVb9eJBDTha Cp5RIuqZoRpA8+8hUuDNxnq0nJUoSgxK0SsYwJhXxXOiFiJRMC13IL5SLGmUwE1ye3iDiIiYe Mhvu4iAkmHO50/5mKppmNkNV6FokYGA28fJIzpZkj/He1l/rGi4FJZ6Nc0gfC40tvCKk/wN2h IVzShMDF1+2+Pmp48bJD0FMCDoPW49vF+YHpJODplW65pKkloS9fLeFt0N9XQUj4JIK2B0rJc JOAgbE6JBXNMij8NTjlnscooL73FiYRdRi873uLSXYLlFeN+iI2QOeFIpkkysTB5R0hC1CEe9 Ya7llrFCPsKlrGc7Y0zhYRtUZnsJmNJruVNVsioiLX6qwcz7NGzsIaeN3+FOsNJNyCn/Aa0Lf KuHtITWHa+fT4QI9eMc+QcuCoieVNibbDFo6/hxZSlBboU7u8ekWgjTNyjiSzRTioaRqoAK2S frtToGk+lbXyZqNEtaLQYBWdI/oYkTAdTp6xTZ9iFwoJDqKRMIgiIJWzWc32//lhpKKQNogOF 7sEmJPtM92HhWBMCI4e6xGD7ew/KtiJipQ150acNB6j2e9OYolX8bs3D5D3dQUZQxOfG9vvOm pWH6v0O+PSKQ7FnP+gLPX/vmWp/mHbbY99eVUZqWP1ncPE19KUxd5P/t4O5wK1N29Tiex9+JE w06LnO1xfEhJrPacteIb8tzoM1RRf7szuzqh+dlC1JrZtz8r+8TRNgpbgTWzUCtzGs38Bf+53 iYUDAAA= X-Env-Sender: Wei.Chen@arm.com X-Msg-Ref: server-4.tower-27.messagelabs.com!1490965727!94072732!1 X-Originating-IP: [104.47.0.55] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.2.3; banners=-,-,- X-VirusChecked: Checked Received: (qmail 27532 invoked from network); 31 Mar 2017 13:08:48 -0000 Received: from mail-he1eur01on0055.outbound.protection.outlook.com (HELO EUR01-HE1-obe.outbound.protection.outlook.com) (104.47.0.55) by server-4.tower-27.messagelabs.com with AES256-SHA256 encrypted SMTP; 31 Mar 2017 13:08:48 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector1-arm-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=xiwvZ9v4zJG9Jp7UkLvngKceP4BEjNznluqlnq0Nw0M=; b=mTkjEx+YdZFVC+FuItPBhtVr4p+6Ws7V2FeCMKQMOquQYC+hiMlot6wyvQbInhM3OfuBJicc4Pwt3ZN3zbThL+B8DZyWxVUttJZvM898sFv9is7UyaLcoJNFvAhpsr3PCKXV4SLIcR1Eql9iVRpjbKmjk6r+wF1h3Am1gzU8kAQ= Received: from DB6PR0802CA0036.eurprd08.prod.outlook.com (2603:10a6:4:a3::22) by AM2PR08MB0212.eurprd08.prod.outlook.com (2a01:111:e400:8431::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1005.10; Fri, 31 Mar 2017 13:08:46 +0000 Received: from DB5EUR03FT029.eop-EUR03.prod.protection.outlook.com (2a01:111:f400:7e0a::207) by DB6PR0802CA0036.outlook.office365.com (2603:10a6:4:a3::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1005.10 via Frontend Transport; Fri, 31 Mar 2017 13:08:45 +0000 Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 217.140.96.140 as permitted sender) receiver=protection.outlook.com; client-ip=217.140.96.140; helo=nebula.arm.com; Received: from nebula.arm.com (217.140.96.140) by DB5EUR03FT029.mail.protection.outlook.com (10.152.20.131) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.1005.5 via Frontend Transport; Fri, 31 Mar 2017 13:08:45 +0000 Received: from P300.p300.shanghai.arm.com (10.1.2.79) by mail.arm.com (10.1.106.66) with Microsoft SMTP Server id 14.3.294.0; Fri, 31 Mar 2017 14:08:33 +0100 From: Wei Chen To: Date: Fri, 31 Mar 2017 21:07:52 +0800 Message-ID: <1490965679-619-13-git-send-email-Wei.Chen@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1490965679-619-1-git-send-email-Wei.Chen@arm.com> References: <1490965679-619-1-git-send-email-Wei.Chen@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:217.140.96.140; IPV:CAL; SCL:-1; CTRY:GB; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(39410400002)(39850400002)(39400400002)(39860400002)(39450400003)(39840400002)(2980300002)(438002)(189002)(199003)(110136004)(5003940100001)(2351001)(76176999)(50986999)(38730400002)(356003)(305945005)(4326008)(189998001)(106466001)(104016004)(50226002)(2906002)(36756003)(8676002)(47776003)(8936002)(6666003)(5660300001)(86362001)(48376002)(6916009)(2950100002)(77096006)(54906002); DIR:OUT; SFP:1101; SCL:1; SRVR:AM2PR08MB0212; H:nebula.arm.com; FPR:; SPF:Pass; MLV:sfv; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; DB5EUR03FT029; 1:JmuKluR8HUJszSihHJFrka7v0fVmIkLYTFa061smRuIoF+iajTc3QMzeqkHh59ENMAyMYSLVLcy9/8CuWVvixeUE2Xa1KDUBx+odf07+o37kWpWifNL4Ti9N254uLc6NUqX+RNamII9QEwoeEyhncC3QiPWWR7pT5SUijP+J8b1zV9d2MlZCji/AFH0p9Ce2tC6U2rYl9B1jFAAvutR5nodmqwf8/9zE+qNWAsnyVMJ3CwRBg6HeIVU4+DGLRSsd3huhoHE0uC29Q68/q5ITdwWBIDjNz8tN7JbMIVUMNjBmfmKB46LmGc6EsNrW4pA8Ur+7Z4FxflKkDgX0i22nDajSpnp0FVr2gIMWY9ss6kRIXQkw9cvo46ejywwU4F4I0m8AjO7B1opZnvtX+wgqPJCYhXBuC4jG43XnvOc1h8d7QAcqHIo6TU/L3/QJzIgNWoUbI9YEt8KFO2yCZxReBSfQvxjQAbIqVIlIyLuMoKyMweheifB9D6foHAZRif/6E1lWymz3Y1MSOWdhqb66JyZo5GPqj8jWrfji6JSW1uBBRyo/B9RkXrOMYFyCk+jMtibsNRmbDzF8L9fQJDVaKOyUpAqFTySFCbcfHuXLViPr3OPJ3SIbFvVeIN3fSm28 X-MS-Office365-Filtering-Correlation-Id: c0993f4d-29d1-43ce-4af3-08d47837104a X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(8251501002)(2017030254075)(201703131423075)(201703031133081); SRVR:AM2PR08MB0212; X-Microsoft-Exchange-Diagnostics: 1; AM2PR08MB0212; 3:QrSHqefUPDgYiBICYJjHMX0UKHpoRf1oPfhxMn9sj8r/oI4pe/D9r82OfIbwA89Q6DtwzTxpfMBTd3tSi/g7M7m++4d4yGW0PdPNZQK8ZJmHcSGc7PhKzypfbxQTRwTQNT6RqpV1HNYf9eyqWBI1NYzl6jV5tELSIdDydEdyLMkLq/ecxlASJiwvBvPw+A3yjxW2SVPDFOZ/ply46Y97pFK55/yhqYWqdezwAzDM6ftexVqiCG56p219CvTLOsEs301+AR6xB0rtiWOjrS55NoWIB1fCJvPJSJoqwPPm3bGwEd5L0NFlkcx/Jbv9QienLzS0FRkCwpqnjfDb2w6se19TsYFQ4eT1wJ47+bEM2YbabPYHNWP+JSjFK1ZJhpscLqH44gHXb06NCE4oa8qGvvuRCxPqBfNENe6sTEFP8odGZIs06f2w0gf4Tt4ePUQC1xtj7zyD3XZJlM69Ijx+74cMi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OHPoITfJAB2jw6c3GhMkYs1fgS1z7Mtl5r52WRr6f60dXqNdLtC+KIWeRJb+959rgtIXKTyx1Vnjq X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(180628864354917); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040450)(601004)(2401047)(13013025)(13023025)(13020025)(13024025)(8121501046)(5005006)(10201501046)(3002001)(93006095)(93004095)(6055026)(6041248)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(20161123562025)(20161123560025)(20161123555025)(6072148); SRVR:AM2PR08MB0212; BCL:0; PCL:0; RULEID:; SRVR:AM2PR08MB0212; X-Microsoft-Exchange-Diagnostics: 1; AM2PR08MB0212; 4:suF39636CXSj8Q6TqhMjwRi5yIXCK2sEm7zF4vzO9qYxRfAxMWZEFEsA83Kw2vmw2dMMPBQjJpGCs87PyXWB43zDYrxnp32iiALUCb03KbCRZAPUfLJku0GnH/VIGNfvn9hjay6QswBu6VFhcP9qiBqyFtICqdV7mtEGg++2t2omVyR3TT9j6uP+6eT7LwNLMX4HYuajX3XLJb+NcGKrdryTJTMViVCsAF96yZjjl/3eqwSfYnrTLC5l23GjjNoRi4Cd3TUbc31ySd1M6J0sfBFDxJAPVRiMONEm8rheSDSRehNijDvA4A1NVNw7TR9nKiZd1WFyGwVZknDn8BYGe+rRc8+fTxl2jAm6ahX+T88wUei51uN0LDhxB27BnHSpuXurc/fTo2rQhEc1vuMPVdLsmQxOiWRoXN7F3TeeVg5tr7/FO7k6bfSpNwtBErx8aI6U317JbITDp+4NzVswkj7HHvzqJnz0LNGhtL9GEr/6LOwzV5FvmdkggHcjWTFHCeHFhOAPcvE/VB57m/+0FQuv7zyjXjlCv6NwXBMEc0KMTEudeTM43l5QKJmTFufmNyWKRc5ShiD2edmYptOZ13d+DvWS1YoctPPEDjrJjMSYN97KR25JiU0mc7Wy+W7hiF+wOUFfrk6pl9NQ+rjrKRBOIQRAPY178SePNMDEaqp9U2Kq83m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g2YYcMw8zW1QDI5EeJu70y4hPp+7yfj3/9aOweAdfQI971/YesdT/9F3O6BxGOCBBGLEA/ByTU+WYPbZ3d+YfoDfPA3p78pTECChI5vV67tXlzyE0xhCob00 X-Microsoft-Exchange-Diagnostics: 1; AM2PR08MB0212; 6:4JHVmmZdIUl1t9R+gfgFa1BGfBORkc3gtzklB6F+ncyZYKZcl78PHY547bYHJW0fZ2N1fY+aTNy0/1ubjwm6yW8f4a4y+wWIDG5e0tvO0K/rYA0uYZktIAy1z58T4xJF1sbx9nElPfNJ2D99Om6hety8xgpJQj6r58y/quNNaIPqFgdZGXkw8NXbEhpD3AIL4X8se0e8N1lCD8dq9ARA4h+3TxxT1Yi8lo3sn8wSaWRWUODrds5i8bAsQ0MydVHDqsfLmF2CGgBwSfHSy9U1vU4P8y140UZ5WUTKgnyyqrNcMSe2DqscytBR//m8/yhfmu7Yb1E/ys5t8QvE67tJU6YH/U3iBXTCRYWlusohYyIepb6dUNzK9EBvYgFu43xECULg16vfWv69zYQCcBdttW9VY2duERY9VvDK+1W3/3k=; 5:EL1Gggy9875QhWwsg3Isnw7uMQu89igdEjR56lpdslVuS/Ych+lgXk9mrOwdL1c8PJa/xhxX43SbNyS1XbrXAVtjh/8kuXDtjLKeoN1sqjsCKMRCJmGmiieAp19Y+dIgKRb9EQqvGEAIhv9GALhy34lHZ1fY2tMwFI4igesa62U=; 24:8H0IGLf+VGs5XwNrBDB+dC9hcEabju9Q6JSPdH3dnZ1cz0p6phki1sAkkQxHsT0ZbWxpSzDAtkOmkKcjKS4eD6IuK2j9t9KUTFVjAWkEOE0= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; AM2PR08MB0212; 7:sV05msiXBRVMy810iCnfrb0K8nBbhsKVfU6HJ3S1gjovWSY3J8s2V5OL8wKYOkTzBunWAw2OBrpgNjglmqWCbQUS2J2sw/5Hx499TioJfCAhydS1Zm6PoxCXU3f2UMbxkwNG1CV5pZJhEJbCPBTbdk2o/sovB31g5bhXX0nLbYxYI2GrL/nQ//KllLnlcDIEHjVpuBYEDNz+8R69mO0aFj1lAhmnR7bZmEXfUwGmU5ArJyQNdMhRCms6bJ4F4lMsw8islTrtfuLI9HtHGHRskuYa2wtJXd9Ohg2GvaE0wVnZOVlNO7mdGucf+vE/P8TFlhw5s51u0jMF31R/oacf1w== X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Mar 2017 13:08:45.5421 (UTC) X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[217.140.96.140]; Helo=[nebula.arm.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM2PR08MB0212 Cc: sstabellini@kernel.org, wei.chen@arm.com, steve.capper@arm.com, Kaly.Xin@arm.com, julien.grall@arm.com, nd@arm.com Subject: [Xen-devel] [PATCH v3 12/19] xen/arm: Introduce new helpers to handle guest/hyp SErrors X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP Currently, ARM32 and ARM64 has different SError exception handlers. These handlers include lots of code to check SError handle options and code to distinguish guest-generated SErrors from hypervisor SErrors. The new helpers: do_trap_guest_serror and do_trap_hyp_serror are wrappers of __do_trap_serror with constant guest/hyp parameters. __do_trap_serror moves the option checking code and SError checking code from assembly to C source. This will make the code become more readable and avoid placing check code in too many places. These two helpers only handle the following 3 types of SErrors: 1) Guest-generated SError and had been delivered in EL1 and then been forwarded to EL2. 2) Guest-generated SError but hadn't been delivered in EL1 before trapping to EL2. This SError would be caught in EL2 as soon as we just unmasked the PSTATE.A bit. 3) Hypervisor generated native SError, that would be a bug. In the new helpers, we have used the function "inject_vabt_exception" which was disabled by "#if 0" before. Now, we can remove the "#if 0" to make this function to be available. Signed-off-by: Wei Chen Reviewed-by: Stefano Stabellini --- xen/arch/arm/traps.c | 69 +++++++++++++++++++++++++++++++++++++++-- xen/include/asm-arm/processor.h | 4 +++ 2 files changed, 71 insertions(+), 2 deletions(-) diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c index 9d4ee39..4b53b7e 100644 --- a/xen/arch/arm/traps.c +++ b/xen/arch/arm/traps.c @@ -646,7 +646,6 @@ static void inject_dabt_exception(struct cpu_user_regs *regs, #endif } -#if 0 /* Inject a virtual Abort/SError into the guest. */ static void inject_vabt_exception(struct cpu_user_regs *regs) { @@ -677,7 +676,59 @@ static void inject_vabt_exception(struct cpu_user_regs *regs) current->arch.hcr_el2 |= HCR_VA; WRITE_SYSREG(current->arch.hcr_el2, HCR_EL2); } -#endif + +/* + * SError exception handler. We only handle the following 3 types of SErrors: + * 1) Guest-generated SError and had been delivered in EL1 and then + * been forwarded to EL2. + * 2) Guest-generated SError but hadn't been delivered in EL1 before + * trapping to EL2. This SError would be caught in EL2 as soon as + * we just unmasked the PSTATE.A bit. + * 3) Hypervisor generated native SError, that would be a bug. + * + * A true parameter "guest" means that the SError is type#1 or type#2. + */ +static void __do_trap_serror(struct cpu_user_regs *regs, bool guest) +{ + /* + * Only "DIVERSE" option needs to distinguish the guest-generated SErrors + * from hypervisor SErrors. + */ + if ( serrors_op == SERRORS_DIVERSE ) + { + /* Forward the type#1 and type#2 SErrors to guests. */ + if ( guest ) + return inject_vabt_exception(regs); + + /* Type#3 SErrors will panic the whole system */ + goto crash_system; + } + + /* + * The "FORWARD" option will forward all SErrors to the guests, except + * idle domain generated SErrors. + */ + if ( serrors_op == SERRORS_FORWARD ) + { + /* + * Because the idle domain doesn't have the ability to handle the + * SErrors, we have to crash the whole system while we get a SError + * generated by idle domain. + */ + if ( is_idle_vcpu(current) ) + goto crash_system; + + return inject_vabt_exception(regs); + } + +crash_system: + /* Three possibilities to crash the whole system: + * 1) "DIVERSE" option with Hypervisor generated SErrors. + * 2) "FORWARD" option with Idle Domain generated SErrors. + * 3) "PANIC" option with all SErrors. + */ + do_unexpected_trap("SError", regs); +} struct reg_ctxt { /* Guest-side state */ @@ -2864,6 +2915,20 @@ asmlinkage void do_trap_guest_error(struct cpu_user_regs *regs) domain_crash_synchronous(); } +asmlinkage void do_trap_hyp_serror(struct cpu_user_regs *regs) +{ + enter_hypervisor_head(regs); + + __do_trap_serror(regs, VABORT_GEN_BY_GUEST(regs)); +} + +asmlinkage void do_trap_guest_serror(struct cpu_user_regs *regs) +{ + enter_hypervisor_head(regs); + + __do_trap_serror(regs, true); +} + asmlinkage void do_trap_irq(struct cpu_user_regs *regs) { enter_hypervisor_head(regs); diff --git a/xen/include/asm-arm/processor.h b/xen/include/asm-arm/processor.h index 163c39c..81227aa 100644 --- a/xen/include/asm-arm/processor.h +++ b/xen/include/asm-arm/processor.h @@ -709,6 +709,10 @@ int call_smc(register_t function_id, register_t arg0, register_t arg1, void do_trap_guest_error(struct cpu_user_regs *regs); +void do_trap_hyp_serror(struct cpu_user_regs *regs); + +void do_trap_guest_serror(struct cpu_user_regs *regs); + register_t get_default_hcr_flags(void); /* Functions for pending virtual abort checking window. */