From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46927) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aJINK-0006E2-EK for qemu-devel@nongnu.org; Wed, 13 Jan 2016 05:09:59 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aJINJ-0003i7-Es for qemu-devel@nongnu.org; Wed, 13 Jan 2016 05:09:58 -0500 References: <1452612274-30218-1-git-send-email-shannon.zhao@linaro.org> From: Laszlo Ersek Message-ID: <5696226D.2050001@redhat.com> Date: Wed, 13 Jan 2016 11:09:49 +0100 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] ARM: Virt: Don't generate RTC ACPI node when using UEFI List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell , Shannon Zhao Cc: Shannon Zhao , edk2-devel@ml01.01.org, qemu-arm , QEMU Developers , Ard Biesheuvel On 01/12/16 16:30, Peter Maydell wrote: > On 12 January 2016 at 15:24, Shannon Zhao wrote: >> When booting VM through UEFI, UEFI takes ownership of the RTC hardware. >> To DTB UEFI could call libfdt api to disable the RTC device node, but to >> ACPI it couldn't do that. Therefore, we don't generate the RTC ACPI >> device in QEMU when using UEFI. > > I don't really understand this. I thought that if we were > using ACPI then we would always be doing it via UEFI? Yes. Let my try to summarize here too: - kernel booted without UEFI: consumes DTB, accesses RTC directly - kernel booted with UEFI, consumes DTB: UEFI owns RTC, kernel uses UEFI services, UEFI keeps kernel from directly accessing the RTC by disabling the RTC node in the DTB, using libfdt - kernel booted with UEFI, consumes ACPI: UEFI owns RTC, kernel uses UEFI services, UEFI keeps kernel from directly accessing the RTC by..., well, it can't, because we don't *parse* AML in UEFI. > Also I think if UEFI wants to take command of some of the > hardware it ought to be UEFI's job to adjust the tables > accordingly before it passes them on to the guest OS. In theory, maybe. In practice, no; we have the ACPI linker/loader for that. Either the generated AML must not contain the RTC node, or else some linker/loader script command(s) have to be added that cause the guest firmware's linker/loader client to patch the device out. Generally speaking however, the linker/loader can only patch data tables, not definition blocks (AML). You might ask why the DTB is different then. Why aren't I suggesting, in paralle, that the DTB generator behave similarly in QEMU? The answer is that the firmware needs the RTC node in the DTB for its *own* purposes as well, so the RTC node must be in the DTB in any case. ACPI is different. The firmware downloads it, patches it blindly (= processes the linker/loader script), then passes it to the OS. That's all. Formatting AML is doable in the firmware; parsing / modifying AML that was originally generated by QEMU is practically impossible. If you recall the *original* introducion of the ACPI interpreter into the kernel -- there was a huge uproar. Today Linux has a customized version of the ACPI CA framework. edk2 doesn't, and shouldn't. Plus, *intelligently* modifying AML in the firmware defeats the purpose of the ACPI linker/loader -- which is to allow the firmware to remain ignorant about ACPI. Thanks Laszlo