From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2607:f8b0:4003:c06::22a; helo=mail-oi0-x22a.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-oi0-x22a.google.com (mail-oi0-x22a.google.com [IPv6:2607:f8b0:4003:c06::22a]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 22F3F223972AD for ; Tue, 6 Feb 2018 10:55:22 -0800 (PST) Received: by mail-oi0-x22a.google.com with SMTP id c189so2133191oib.12 for ; Tue, 06 Feb 2018 11:01:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=TMTZnRf9IZmhyYnlrom13Ns7zmPIyUyTB1geosoh4j0=; b=WI9N3KAVamsS7jGriLGt/d3f2kF+udMMUmR+EvGBZUrKDsWcNjX6qWYH5sjTD1sdwi l9bjxngQQDTx7vMkeBtKW65TfbBne02r3K1jLQZsVox/tN0wJ+jo9nWxfPB6QDaJH6a+ GIOyOPb9WhaZyvyzCStGBQI929VYe1R6poiYE= 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=TMTZnRf9IZmhyYnlrom13Ns7zmPIyUyTB1geosoh4j0=; b=YipMwtwz6ghkDM/brNzvcW4v6aDM72zY9QBsqGGoMPLVoEPk9hvDPh89QuL7rknVSe v1Jf8nsrG0DVDxfIjAX6oXK/IXddckWn/8UfvxiZ943eHfSK3bCy0W+6L94dL6UgX3gd n+Ia64DzASNzv1gdiQdYc62LmwAeH65j85wAofAoL1jHyynxBQiyvoN0T/vI4r4XABjC 0XNRyOuY0cY/mqgdSt3ldY8XrhneK7XHlfBz2B06FRxecZtxWtIJyCzQvV9BmYPzqY3r 4x6xZyFPhDG2qFhS+xXUPn1vS+99GxZvWtlF80kT+vd9v3c+MwEndSzvxnT8csNQLjIl fi5g== X-Gm-Message-State: APf1xPBnLTo90zBtm4Rwu6cpRYAUlDy5I8GDgcw1kuFMPR94eWNypgPL xS9/jbCvLwJFheELlPBqjHTVbm4bvy5SDlfKHyIPZg== X-Google-Smtp-Source: AH8x224A7DVruTQuEF/UGzLvvJ7OTKqadbPzNgWxAnh/RUvu01t1Bl/YaOk+g0tgiPv2f8uOtt4/b8ZXD7p85i87NOE= X-Received: by 10.84.64.14 with SMTP id x14mr2078389oie.280.1517943664860; Tue, 06 Feb 2018 11:01:04 -0800 (PST) MIME-Version: 1.0 Received: by 10.157.81.100 with HTTP; Tue, 6 Feb 2018 11:01:04 -0800 (PST) In-Reply-To: <20bc6e59-61a2-3cfc-20b9-010b8e7eb8f8@arm.com> References: <20180206120416.17462-1-ard.biesheuvel@linaro.org> <20bc6e59-61a2-3cfc-20b9-010b8e7eb8f8@arm.com> From: Ard Biesheuvel Date: Tue, 6 Feb 2018 19:01:04 +0000 Message-ID: To: Marc Zyngier Cc: "edk2-devel@lists.01.org" , Leif Lindholm 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: Tue, 06 Feb 2018 18:55:23 -0000 Content-Type: text/plain; charset="UTF-8" On 6 February 2018 at 14:55, Marc Zyngier wrote: > On 06/02/18 12: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. > > This fixes the problem I was seeing, so here's my: > > Tested-by: Marc Zyngier > > Thanks a lot Ard! > Pushed as 61a7b0ec634fa3288f47929ba3ced05ff48de739 Thanks.