Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755961AbdC2KhN (ORCPT ); Wed, 29 Mar 2017 06:37:13 -0400 Received: from mail-ve1eur01on0083.outbound.protection.outlook.com ([104.47.1.83]:29184 "EHLO EUR01-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1755527AbdC2KhJ (ORCPT ); Wed, 29 Mar 2017 06:37:09 -0400 Authentication-Results: huawei.com; dkim=none (message not signed) header.d=none;huawei.com; dmarc=none action=none header.from=arm.com; Date: Wed, 29 Mar 2017 11:36:59 +0100 From: Achin Gupta To: gengdongjiu CC: , , , , , James Morse , Christoffer Dall , , Marc Zyngier , , , , , , , , , , , , , , , , , Subject: Re: [PATCH] kvm: pass the virtual SEI syndrome to guest OS Message-ID: <20170329103658.GQ23682@e104320-lin> References: <76795e20-2f20-1e54-cfa5-7444f28b18ee@huawei.com> <20170321113428.GC15920@cbox> <58D17AF0.2010802@arm.com> <20170321193933.GB31111@cbox> <58DA3F68.6090901@arm.com> <20170328112328.GA31156@cbox> <20170328115413.GJ23682@e104320-lin> <58DA67BA.8070404@arm.com> <5b7352f4-4965-3ed5-3879-db871797be47@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <5b7352f4-4965-3ed5-3879-db871797be47@huawei.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-Originating-IP: [217.140.96.140] X-ClientProxiedBy: AM5PR04CA0009.eurprd04.prod.outlook.com (2603:10a6:206:1::22) To DB5PR08MB1080.eurprd08.prod.outlook.com (2a01:111:e400:c585::15) X-MS-Office365-Filtering-Correlation-Id: 47157378-0cc4-4d23-42ad-08d4768f7777 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001)(48565401081)(201703131423075)(201703031133081);SRVR:DB5PR08MB1080; X-Microsoft-Exchange-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JCoX+AtrzxkO5HtqqpA6q5rcxz5Mq5f1j8eOybJ22skqf6OLjPRJqMtK05Tl/wrAdaJzCOcEGw1UzvkjdZUL8iWGyYOr5Sq+DKB7NkR5APExlbuoxcVvK6YKLfk2AG;20:DNbBtf1n2PKmLGX7VhR2p4WdawkicO7ZmL+Fb918gvgfCw7mOvw6kTBB0VQbEROCQUcKsXOTpSFVswD5aeD0pit1yybOfzHR27lLomJTrEljcZO8dlw/sTcYEU4aJmk2bREJRGUzRGt2+GNwAGULvWYwSklsiMf3NC3hzLm87kA= NoDisclaimer: True X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(20558992708506)(192374486261705)(35073007944872); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040449)(601004)(2401047)(8121501046)(5005006)(10201501046)(3002001)(6055026)(6041248)(20161123560025)(20161123555025)(201703131423074)(201702281528074)(201703061421074)(201703061406074)(20161123558025)(20161123564025)(20161123562025)(6072148);SRVR:DB5PR08MB1080;BCL:0;PCL:0;RULEID:;SRVR:DB5PR08MB1080; X-Microsoft-Exchange-Diagnostics: 1;DB5PR08MB1080;4:bU1gOvWnNWWN0mv1ZlHS1pD00f4kFtexqFRTL4jqNpnWsiug/1EowqbZvlyRpHgzPr+mERuWpmsiJht3MQvhXaH3l+Fk1h0e/w+clKEuVuAgd/V/5mWGE9zCepfAc20EiMRoA4CpyO9SMVCPFFF7I//U2mMgca62zylAWEXtGEuLR4c0kv9VGwtuMtRFuiRzEUb2zBn7k86XcSW/cyxEc6AixbwtqJPOMg5tqN3kPehnlaZ5O1/HMGxx0Dm+CgUdD+TBe1itWmAKKpuh0yM9W+MWZ3A//c8wHlaKYWDm3Dsq5mElyfx7KvfPIknpq00qKSer1JCFKNPDTaNLqWuqERHuSETtRnv7r0CcmkA/zseIn/CO78YEbZbEGgq1MhmwAwm5BcPz/9he8MwqjmqmIUyTgRV8d+mkpyUF95zwUB06DLDFTjuxld16CYIeNGkqMLluQO1q7EjZ8rueg0sqMrcnjGqeEeBKp54neUfGDf996qRJS0DWm9JxI4OLOSQsIRd/PO1aSrtm4QfL4RLksY8moWeZwtrmCTMMW0vkeUPX1gb8r20d8M2dMqGbIa8nM6KTUsm3Qs30ALQoVhfzObFgdseYRCcEuk7IB0DUSh2SL08jSRoH4TLc3GNW2lq4BF66a8cqHUFCTjEcebVzwRDIr0H5DYB5yigtDq/FQrLMGHS2u3Hpvtr+ZO6/aazD1oQDveayDOBWQBstPCJ3im/oTkm9BNL6atbbUgC8NBjAF9dYosGiMTwZ7t4FuT14eIypKrp289Q3zUtdWs4p673eeAw3S3CFJ+j5e20TyM+78h0k4+ejVWtHIlYXP12uwWzL/itSwNBL2VWVyUeOXKFiXBfAM/TLWUdls+3Zl73rVuZexs+CcKtQOMa/dxOI X-Forefront-PRVS: 0261CCEEDF X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(4630300001)(6009001)(39400400002)(39450400003)(39860400002)(39840400002)(39410400002)(39850400002)(24454002)(23676002)(5660300001)(50466002)(66066001)(93886004)(7416002)(47776003)(33656002)(55016002)(9686003)(33716001)(189998001)(38730400002)(53936002)(6496005)(53546009)(86362001)(110136004)(4001350100001)(81166006)(2950100002)(83506001)(25786009)(76176999)(3846002)(1076002)(50986999)(8676002)(305945005)(6116002)(229853002)(42186005)(6246003)(6916009)(2906002)(6666003)(7736002)(54356999)(2870700001)(4326008)(18370500001)(107986001);DIR:OUT;SFP:1101;SCL:1;SRVR:DB5PR08MB1080;H:e104320-lin;FPR:;SPF:None;MLV:sfv;LANG:en; X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtEQjVQUjA4TUIxMDgwOzIzOnZlTHE0VmhsWTNJenZyV0ZJVG1oTHljbENk?= =?utf-8?B?K2Y1USszdHZtL1FZaGd1ZFR2eW8yMVJGNjZ4V0RXK0NvaFBHWlh6aStBbm83?= =?utf-8?B?L1NXNGluZGc0L0lDSXMrNFR6QmprREVZdGd1NjAwSHcwdVVm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YcdJ2sdxj+Sm3zGwzKgrpf3NTYy3fMj93KYt5dJxBDum55LvTP1aUj9gCkRavRMaWxQ2OrWJ2W2WSE/L0ibI6Jzaj/9ZH0ZslEk+a6cbX9DL2qW4McK35SwoXlJQTsQ4qC0WLeMCcg0sSOwwqIxy23kXt2wQNGST19udii9BATaO4U/1xxq6Lqpa30Ri4AZDR5IhLX4HuB4umbTFWQ=;5:oNYygag/EXu9T6pYmPnZb8A+PPP1yDGVRrpySxdjVHhJBmqDgWchig8zOwU2G9GVUIKJxCK94qO7a0X4d31hFAjfhr2/djDtX+L+QlbLUqqSJEsOF9tuBsrNQs8WXsD9F9M3oaxnt5z8gNFIjuFiig==;24:O05UfraOhxW+rs7h5zcONxNnia7MJq2uh+ym6knvp7n87ikQGWnCaLwK1D0gojhUTtr8yu1EWeuaA2+fw6N6QkFNaUIqCPSUJkqY2BYdOYs= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;DB5PR08MB1080;7:Q4y6LL4V7rOJNWoY+MAbrHIIaOowoOmWCQv0qC/d1ebh3Uwggodi8linRugsp9GvnlKxiDFDH/vMsFwgD2AKR3mz4WpmPm30wHDe4FWd/iYZ/D/g/A5Umf0viZ0zhc95Re7Ryz5p0dzZagHgR8DqO2Y4D8QJyOqK8d6fWu3OXjxhfkm2Ti3jy/B5WdC5tmr7OKt/YcFASRXjeniuZ9X76eEXbwP+bj5Mg02297mvySNh0HSfujVf7ujd1zFDWvMxRFjom0BHIB+fCbN39Am6OdG7fdleBQZ7Rx6tlhhuWCOO7uzqKWo7/4hbC+iKBxGlCVYlSyqwWI3d9d4Wqa+CWg== X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Mar 2017 10:36:30.9847 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB5PR08MB1080 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 5035 Lines: 111 Hi gengdongjiu, On Wed, Mar 29, 2017 at 05:36:37PM +0800, gengdongjiu wrote: > > Hi Laszlo/Biesheuvel/Qemu developer, > > Now I encounter a issue and want to consult with you in ARM64 platform, as described below: > > when guest OS happen synchronous or asynchronous abort, kvm needs to send the error address to Qemu or UEFI through sigbus to dynamically generate APEI table. from my investigation, there are two ways: > > (1) Qemu get the error address, and generate the APEI table, then notify UEFI to know this generation, then inject abort error to guest OS, guest OS read the APEI table. > (2) Qemu get the error address, and let UEFI to generate the APEI table, then inject abort error to guest OS, guest OS read the APEI table. Just being pedantic! I don't think we are talking about creating the APEI table dynamically here. The issue is: Once KVM has received an error that is destined for a guest it will raise a SIGBUS to Qemu. Now before Qemu can inject the error into the guest OS, a CPER (Common Platform Error Record) has to be generated corresponding to the error source (GHES corresponding to memory subsystem, processor etc) to allow the guest OS to do anything meaningful with the error. So who should create the CPER is the question. At the EL3/EL2 interface (Secure Firmware and OS/Hypervisor), an error arrives at EL3 and secure firmware (at EL3 or a lower secure exception level) is responsible for creating the CPER. ARM is experimenting with using a Standalone MM EDK2 image in the secure world to do the CPER creation. This will avoid adding the same code in ARM TF in EL3 (better for security). The error will then be injected into the OS/Hypervisor (through SEA/SEI/SDEI) through ARM Trusted Firmware. Qemu is essentially fulfilling the role of secure firmware at the EL2/EL1 interface (as discussed with Christoffer below). So it should generate the CPER before injecting the error. This is corresponds to (1) above apart from notifying UEFI (I am assuming you mean guest UEFI). At this time, the guest OS already knows where to pick up the CPER from through the HEST. Qemu has to create the CPER and populate its address at the address exported in the HEST. Guest UEFI should not be involved in this flow. Its job was to create the HEST at boot and that has been done by this stage. Qemu folk will be able to add but it looks like support for CPER generation will need to be added to Qemu. We need to resolve this. Do shout if I am missing anything above. cheers, Achin > > > Do you think which modules generates the APEI table is better? UEFI or Qemu? > > > > > On 2017/3/28 21:40, James Morse wrote: > > Hi gengdongjiu, > > > > On 28/03/17 13:16, gengdongjiu wrote: > >> On 2017/3/28 19:54, Achin Gupta wrote: > >>> On Tue, Mar 28, 2017 at 01:23:28PM +0200, Christoffer Dall wrote: > >>>> On Tue, Mar 28, 2017 at 11:48:08AM +0100, James Morse wrote: > >>>>> On the host, part of UEFI is involved to generate the CPER records. > >>>>> In a guest?, I don't know. > >>>>> Qemu could generate the records, or drive some other component to do it. > >>>> > >>>> I think I am beginning to understand this a bit. Since the guet UEFI > >>>> instance is specifically built for the machine it runs on, QEMU's virt > >>>> machine in this case, they could simply agree (by some contract) to > >>>> place the records at some specific location in memory, and if the guest > >>>> kernel asks its guest UEFI for that location, things should just work by > >>>> having logic in QEMU to process error reports and populate guest memory. > >>>> > >>>> Is this how others see the world too? > >>> > >>> I think so! > >>> > >>> AFAIU, the memory where CPERs will reside should be specified in a GHES entry in > >>> the HEST. Is this not the case with a guest kernel i.e. the guest UEFI creates a > >>> HEST for the guest Kernel? > >>> > >>> If so, then the question is how the guest UEFI finds out where QEMU (acting as > >>> EL3 firmware) will populate the CPERs. This could either be a contract between > >>> the two or a guest DXE driver uses the MM_COMMUNICATE call (see [1]) to ask QEMU > >>> where the memory is. > >> > >> whether invoke the guest UEFI will be complex? not see the advantage. it seems x86 Qemu > >> directly generate the ACPI table, but I am not sure, we are checking the qemu > > logical. > >> let Qemu generate CPER record may be clear. > > > > At boot UEFI in the guest will need to make sure the areas of memory that may be > > used for CPER records are reserved. Whether UEFI or Qemu decides where these are > > needs deciding, (but probably not here)... > > > > At runtime, when an error has occurred, I agree it would be simpler (fewer > > components involved) if Qemu generates the CPER records. But if UEFI made the > > memory choice above they need to interact and it gets complicated again. The > > CPER records are defined in the UEFI spec, so I would expect UEFI to contain > > code to generate/parse them. > > > > > > Thanks, > > > > James > > > > > > . > > >