From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=45.249.212.191; helo=huawei.com; envelope-from=zhaoshenglong@huawei.com; receiver=edk2-devel@lists.01.org Received: from huawei.com (szxga05-in.huawei.com [45.249.212.191]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 5AD1E22146720 for ; Wed, 21 Mar 2018 06:10:08 -0700 (PDT) Received: from DGGEMS413-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id CE2EFCB14BC48; Wed, 21 Mar 2018 21:16:20 +0800 (CST) Received: from [127.0.0.1] (10.177.16.142) by DGGEMS413-HUB.china.huawei.com (10.3.19.213) with Microsoft SMTP Server id 14.3.361.1; Wed, 21 Mar 2018 21:16:17 +0800 Message-ID: <5AB25B09.9050200@huawei.com> Date: Wed, 21 Mar 2018 21:15:53 +0800 From: Shannon Zhao User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:24.0) Gecko/20100101 Thunderbird/24.4.0 MIME-Version: 1.0 To: Ard Biesheuvel , , References: <20180206120416.17462-1-ard.biesheuvel@linaro.org> In-Reply-To: <20180206120416.17462-1-ard.biesheuvel@linaro.org> X-Originating-IP: [10.177.16.142] X-CFilter-Loop: Reflected Subject: Re: [PATCH] ArmPkg/Gic: force GIC driver to run before CPU arch protocol driver X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 13:10:10 -0000 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit Hi Ard, On 2018/2/6 20:04, Ard Biesheuvel wrote: > Currently, the GIC driver has a static dependency on the CPU arch protocol > driver, so it can register its IRQ handler at init time. This means there > is a window between dispatch of the CPU driver and dispatch of the GIC > driver where any unexpected GIC state may trigger an interrupt which we > are not set up to handle yet. Note that this is even the case if we enter > UEFI with interrupts disabled at the CPU, given that any TPL manipulation > involving TPL_HIGH_LEVEL will unconditionally enable IRQs at the CPU side > regardless of whether they were enabled to begin with (but only as soon as > the CPU arch protocol is actually installed) > > So let's reorder the GIC driver with the CPU driver, and let it run its > initialization that puts the GIC into a known state before enabling > interrupts. Move its installation of its IRQ handler to a protocol notify > callback on the CPU arch protocol so that it runs as soon as it becomes > available. > > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Ard Biesheuvel > --- > > This fixes an issue observed with GICv3 guests running under KVM. I'm backporting this patch to the branch UDK2017 with three extra patches. 3ba3528 ArmPkg/Gic: force GIC driver to run before CPU arch protocol driver c397d52 ArmPkg/ArmGicDxe: Expose HardwareInterrupt2 protocol 9a73ffd EmbeddedPkg: Introduce HardwareInterrupt2 protocol 29d33ba ArmPkg: Tidy GIC code before changes. But when I start a VM using the new edk2 binary, it throws below error. ASSERT_EFI_ERROR (Status = Device Error) ASSERT [Shell] /root/rpmbuild/BUILD/edk2-2.7.0/Build/ArmVirtQemu-AARCH64/RELEASE_GCC49/AARCH64/ShellPkg/Application/Shell/Shell/DEBUG/AutoGen.c(885): !EFI_ERROR (Status) Synchronous Exception at 0x000000023866A1F0 X0 0x00000000000000FF X1 0x000000000000000A X2 0x00000000000000AB X3 0x000000023F2A2B80 X4 0x0000000000000001 X5 0x0000000000000001 X6 0x0000000000000000 X7 0x0000000000000002 X8 0x0000000000000000 X9 0x0000000700000000 X10 0x0000000238B60000 X11 0x000000023AD86FFF X12 0x0000000000000000 X13 0x0000000000000001 X14 0x0000000000000000 X15 0x0000000000000000 X16 0x0000000000000000 X17 0x0000000000672E50 X18 0x0000000000672E50 X19 0x000000023B2ECE98 X20 0x000000023BFF0018 X21 0x8000000000000007 X22 0x000000023F2CB088 X23 0x0000000000000000 X24 0x000000023B2ED438 X25 0x000000023B2ED440 X26 0x000000023F2CA3D8 X27 0x0000000000000095 X28 0x000000004007E010 FP 0x0000000000000000 LR 0x000000023861E844 V0 0x0000000000000000 0000000000000000 V1 0x63702F6666666666 6666666666666666 V2 0x7363732F312C3140 6567646972622D69 V3 0x0000000000000000 0000000000000000 V4 0x0000000000100000 0000000000000000 V5 0x4010040140100401 4010040140100401 V6 0x0010000000000000 0010000000000000 V7 0x0000000000000000 0000000000000000 V8 0x0000000000000000 0000000000000000 V9 0x0000000000000000 0000000000000000 V10 0x0000000000000000 0000000000000000 V11 0x0000000000000000 0000000000000000 V12 0x0000000000000000 0000000000000000 V13 0x0000000000000000 0000000000000000 V14 0x0000000000000000 0000000000000000 V15 0x0000000000000000 0000000000000000 V16 0x0000000000000000 0000000000000000 V17 0x0000000000000000 0000000000000000 V18 0x0000000000000000 0000000000000000 V19 0x0000000000000000 0000000000000000 V20 0x0000000000000000 0000000000000000 V21 0x0000000000000000 0000000000000000 V22 0x0000000000000000 0000000000000000 V23 0x0000000000000000 0000000000000000 V24 0x0000000000000000 0000000000000000 V25 0x0000000000000000 0000000000000000 V26 0x0000000000000000 0000000000000000 V27 0x0000000000000000 0000000000000000 V28 0x0000000000000000 0000000000000000 V29 0x0000000000000000 0000000000000000 V30 0x0000000000000000 0000000000000000 V31 0x0000000000000000 0000000000000000 SP 0x000000023F2A2B70 ELR 0x000000023866A1F0 SPSR 0x60000305 FPSR 0x00000000 ESR 0x5600DBDB FAR 0x1DE7EC7EDBADC0DE ESR : EC 0x15 IL 0x1 ISS 0x0000DBDB SVC executed in AArch64 Stack dump: 000023F2A2A70: 000000023861E820 000000023BFF0018 000000023F2A2B70 000000023F2A2B70 000023F2A2A90: 000000023F2A2B40 FFFFFF80FFFFFFD8 000000023F2A2B70 000000023F2A2B70 000023F2A2AB0: 000000023F2A2B40 FFFFFF80FFFFFFD8 0000000000000000 0000000000000000 000023F2A2AD0: 6666666666666666 63702F6666666666 6567646972622D69 7363732F312C3140 000023F2A2AF0: 0000000000000000 0000000000000000 0000000000000000 0000000000100000 000023F2A2B10: 4010040140100401 4010040140100401 0010000000000000 0010000000000000 000023F2A2B30: 000000023F2A2C2A 000000023866A74C 000000023B2ECE98 000000023BFF0018 000023F2A2B50: 8000000000000007 000000023F2CB088 0000000000000000 000000023861E834 > 000023F2A2B70: 000000023860B4A4 0010000000000000 5B20545245535341 2F205D6C6C656853 000023F2A2B90: 6D70722F746F6F72 55422F646C697562 326B64652F444C49 422F302E372E322D 000023F2A2BB0: 6D72412F646C6975 756D655174726956 343648435241412D 455341454C45522F 000023F2A2BD0: 412F39344343475F 532F343648435241 2F676B506C6C6568 746163696C707041 000023F2A2BF0: 6C6568532F6E6F69 2F6C6C6568532F6C 75412F4755424544 28632E6E65476F74 000023F2A2C10: 4521203A29353838 524F5252455F4946 7375746174532820 40100401000A0D29 000023F2A2C30: 0010000000000000 0010000000000000 0000000000000000 0000000000000000 000023F2A2C50: 8000000000000007 46987762DD9E7534 AA25A61785F5148C 000000023F2A2C6B Thanks, -- Shannon