Received: by 10.192.165.156 with SMTP id m28csp1532400imm; Wed, 11 Apr 2018 22:04:28 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/n9iMj6v7iXQPSfJBrOygN3P8QEZzcwSGypynegvOsABSEDXgbG/ZPqeWQP5wcUp21v2Ny X-Received: by 2002:a17:902:bb0c:: with SMTP id l12-v6mr7949355pls.347.1523509468861; Wed, 11 Apr 2018 22:04:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523509468; cv=none; d=google.com; s=arc-20160816; b=wgZucNGfQrm1J9K5zTO/qkK0CWOFs7zv/UvOzlNXZ1Z29Ks0mdCLDO2zPtEhklfsP0 5rwcfKhqFi2Hp9xVVZXG1zJrkF1LA1bLy+TWp2NMrl7bg5Rf/0SbVOy5sZ8t90jMxn+i Z39H8w3iKgh9kYh1NhuokcYh/GzDGZNWZXpSgh/yN/rEyS0ZJdswNhlTxzdMXlaup+Z3 rRuEecbcK7DNMxvw/GYBH/jnHOwPwBUmGD7q8gpnh+77SKgmN6HhJE0CYdS4ZZ7gJifH n6givQhnY+i0eeo4w4xGhdvYgZquzctprqxGmgvuqfwxP8EWHUD+93AbxmpJqeCkmmLQ XZCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=32bpMdQslqwhhp7QJUG32Bdfu17N8b018r4cR9fS/i8=; b=qETL+Dt+IomZUzImiE11avf6R/PdJt+v71oSIa/8GQ5NOVGfKlqqItWOj/VqN1ltw6 9912QVcmVdcl+81zC8r1FOt17sX+2PKJrqOLz22ce4EW+hyA5B64nFUlEp64jU1UnFt6 D47X5fzpVM1+UEoMEKXeECpH5JS9O/+tNpEKIVOu5FqIa2qcuVzj1i5Mw83lX3aU4HjD wHKl4FS5Z5AZB7bT0LvbvHXToK6Rx1il+3gP78+tnejRMQPFtR/U5FRceGNuiywU7mui xIFPizvaWiQhGmzzdAOvW8dyLGJXDffwSh2T1SdG0n6M0aOxIdoqxYUJxDhfUcdSgZXE 5r5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Qd9DAdio; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 1-v6si2574808plw.143.2018.04.11.22.03.41; Wed, 11 Apr 2018 22:04:28 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Qd9DAdio; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751909AbeDLFAZ (ORCPT + 99 others); Thu, 12 Apr 2018 01:00:25 -0400 Received: from mail-ua0-f196.google.com ([209.85.217.196]:40529 "EHLO mail-ua0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750957AbeDLFAX (ORCPT ); Thu, 12 Apr 2018 01:00:23 -0400 Received: by mail-ua0-f196.google.com with SMTP id n20so2649558ual.7; Wed, 11 Apr 2018 22:00:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=32bpMdQslqwhhp7QJUG32Bdfu17N8b018r4cR9fS/i8=; b=Qd9DAdio27Tz64uatw4Zz2ljWeGBP0HlG2C+KLfgNYAWE4HF3EjbIhLmsGMY2pbtLn CViQq+vG8xM3YcUADAfGYh2Tif7OmM/nJ9RD1f6I21/26Q6KSWGIKYavxZnOnd9EpIj4 rgpjwM9ipJxUJCKby3WizC2sMbCiq4Gq2qoNTQl2do0AcCWgZWlR9VT8PjjoJ5jqROZT GqpFtLlNo9vQ5oFMIkdkNNJgFLpYJbdPcu4C2KviUdz6iBFu3i3Y2pVwz4aLrK5TOJw6 uS7JY0yj2WGFArMC6eXEKRr80RRzll1nW0BHoTqP31ZiGXK8Axfe7kb0iCuexNt0ArA5 r7ew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=32bpMdQslqwhhp7QJUG32Bdfu17N8b018r4cR9fS/i8=; b=Eco2PhtffXABoEfNRZCmASBCxNJeb5O1/7rvugo4+J+ro5Wubld61vRJuP6C5SJJX2 wG3sqKSeHM39jwk2D2iX9QTplVqTFTfTTxpVDn+f72/eb/7+6DZIFj/OvnJQMFXDMZQ1 ZGPMfsPWTPLEQIAOijHFQcFPujEHkzgLwdF2RGNl2cvzT5EwxsgjdZavc282FyrAab57 /ZXJVw+uScYTwOfzzYVY68MRlqNhEK+tT8/A7gykY4Px6zNX2kTS9NKNqqu5FwsJE5U3 /Po5x1q8bCQuE24v9x8ggx3cVOEW/eRCpP40tPvuoaL4V5IPGRaMyZ/CYZ2pnArF7dym iRMQ== X-Gm-Message-State: ALQs6tBszFNoTMEWMVAIAoFwYyhq8e8WIJddh6KExHg4odSXTqkCNvdV a869oqoAEvNpUDZ65XSoREdcpAqQnP7HMlQEApY= X-Received: by 10.176.89.11 with SMTP id n11mr5522958uad.181.1523509222914; Wed, 11 Apr 2018 22:00:22 -0700 (PDT) MIME-Version: 1.0 Received: by 10.103.116.197 with HTTP; Wed, 11 Apr 2018 22:00:22 -0700 (PDT) In-Reply-To: <5A85C97C.5080605@arm.com> References: <0184EA26B2509940AA629AE1405DD7F201AC71DE@DGGEMA503-MBS.china.huawei.com> <5A85C97C.5080605@arm.com> From: gengdongjiu Date: Thu, 12 Apr 2018 13:00:22 +0800 Message-ID: Subject: Re: [PATCH v9 3/7] acpi: apei: Add SEI notification type support for ARMv8 To: James Morse , lishuo1@hisilicon.com, merry.libing@hisilicon.com Cc: gengdongjiu , "linux-arm-kernel@lists.infradead.org" , "Liujun (Jun Liu)" , "linux-kernel@vger.kernel.org" , "corbet@lwn.net" , "marc.zyngier@arm.com" , "catalin.marinas@arm.com" , "linux-doc@vger.kernel.org" , "rjw@rjwysocki.net" , "linux@armlinux.org.uk" , "will.deacon@arm.com" , "robert.moore@intel.com" , "linux-acpi@vger.kernel.org" , "bp@alien8.de" , "lv.zheng@intel.com" , Huangshaoyu , "kvmarm@lists.cs.columbia.edu" , "devel@acpica.org" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Dear James, Thanks for this mail and sorry for my late response. 2018-02-16 1:55 GMT+08:00 James Morse : > Hi gengdongjiu, liu jun > > On 05/02/18 11:24, gengdongjiu wrote: [....] >> >>> Is the emulated SError routed following the routing rules for HCR_EL2.{AMO, >>> TGE}? >> >> Yes, it is. > > ... and yet ... > > >>> What does your firmware do when it wants to emulate SError but its masked? >>> (e.g.1: The physical-SError interrupted EL2 and the SPSR shows EL2 had >>> PSTATE.A set. >>> e.g.2: The physical-SError interrupted EL2 but HCR_EL2 indicates the >>> emulated SError should go to EL1. This effectively masks SError.) >> >> Currently we does not consider much about the mask status(SPSR). > > .. this is a problem. > > If you ignore SPSR_EL3 you may deliver an SError to EL1 when the exception > interrupted EL2. Even if you setup the EL1 register correctly, EL1 can't eret to > EL2. This should never happen, SError is effectively masked if you are running > at an EL higher than the one its routed to. > > More obviously: if the exception came from the EL that SError should be routed > to, but PSTATE.A was set, you can't deliver SError. Masking SError is the only James, I summarized the masking and routing rules for SError to confirm with you for the firmware first solution, 1. If the HCR_EL2.{AMO,TGE} is set, which means the SError should route to EL2, When system happens SError and trap to EL3, If EL3 find HCR_EL2.{AMO,TGE} and SPSR_EL3.A are both set, and find this SError come from EL2, it will not deliver an SError: store the RAS error in the BERT and 'reboot'; but if it find that this SError come from EL1 or EL0, it also need to deliver an SError, right? 2. If the HCR_EL2.{AMO,TGE} is not set, which means the SError should route to EL1, When system happens SError and trap to EL3, If EL3 find HCR_EL2.{AMO,TGE} and SPSR_EL3.A are both not set, and find this SError come from EL1, it will not deliver an SError: store the RAS error in the BERT and 'reboot'; but if it find that this SError come from EL0, it also need to deliver an SError, right? > way the OS has to indicate it can't take an exception right now. VBAR_EL1 may be > 'wrong' if we're doing some power-management, the FAR/ELR/ESR/SPSR registers may > contain live values that the OS would lose if you deliver another exception over > the top. > > If you deliver an emulated-SError as the OS eret's, your new ELR will point at > the eret instruction and the CPU will spin on this instruction forever. > > You have to honour the masking and routing rules for SError, otherwise no OS can > run safely with this firmware. > > >> I remember that you ever suggested firmware should reboot if the mask status >> is set(SPSR), right? > > Yes, this is my suggestion of what to do if you can't deliver an SError: store > the RAS error in the BERT and 'reboot'. > > >> I CC "liu jun" who is our UEFI firmware Architect, >> if you have firmware requirements, you can raise again. > > (UEFI? I didn't think there was any of that at EL3, but I'm not familiar with > all the 'PI' bits). > > The requirement is your emulated-SError from EL3 looks exactly like a > physical-SError as if EL3 wasn't implemented. > Your CPU has to handle cases where it can't deliver an SError, your emulation > has to do the same. > > This is not something any OS can work around. > > >>> Answers to these let us determine whether a bug is in the firmware or the >>> kernel. If firmware is expecting the OS to do something special, I'd like to know >>> about it from the beginning! >> >> I know your meaning, thanks for raising it again. > > > Happy new year, > > James > _______________________________________________ > kvmarm mailing list > kvmarm@lists.cs.columbia.edu > https://lists.cs.columbia.edu/mailman/listinfo/kvmarm