hw/arm/virt: Dynamic ACPI v5.1 table generation
cover hw/arm/virt: Dynamic ACPI v5.1 table generation
Currently, the virt machine model generates Device Tree information dynamically based on the existing devices in the system. This patch series extends the same concept but for ACPI information instead. A total of seven tables have been implemented in this patch series, which is the minimum for a basic ARM support.
The set of generated tables are:
- RSDP
- XSDT
- MADT
- GTDT
- FADT
- FACS
- DSDT
The tables are created in standalone buffers, taking into account the needed information passed from the virt machine model. When the generation is finalized, the individual buffers are compacted to a single ACPI binary blob, where it is injected on the guest memory space in a fixed location. The guest kernel can find the ACPI tables by providing to it the physical address of the ACPI blob (e.g. acpi_rsdp=0x47000000 boot argument).
This series has been tested on the Foundation Model 0.8 build 5206 and the Juno development board. For kernel and driver support it is based on the "Introduce ACPI for ARM64 based on ACPI 5.1" and "Drivers for Juno to boot from ACPI" patch series from Hanjun Guo.
Alexander Spyridakis (7):
hw/i386: Move ACPI header definitions in an arch-independent location hw/arm/virt-acpi: Basic skeleton for dynamic generation of ACPI tables hw/arm/virt-acpi: Generate RSDP and XSDT, add helper functions hw/arm/virt-acpi: Generate FACS and FADT, update ACPI headers hw/arm/virt-acpi: GIC and Arch Timer definitions in MADT and GTDT hw/arm/virt-acpi: Generation of DSDT including virt devices hw/arm/virt: Enable dynamic generation of ACPI v5.1 tables
hw/arm/Makefile.objs | 2 +- hw/arm/boot.c | 26 +++ hw/arm/virt-acpi.c | 555 ++++++++++++++++++++++++++++++++++++++++++++ hw/arm/virt.c | 54 ++++- hw/i386/acpi-build.c | 2 +- hw/i386/acpi-defs.h | 368 ----------------------------- include/hw/acpi/acpi-defs.h | 535 ++++++++++++++++++++++++++++++++++++++++++ include/hw/arm/arm.h | 2 + include/hw/arm/virt-acpi.h | 73 ++++++ tests/bios-tables-test.c | 2 +- 10 files changed, 1244 insertions(+), 375 deletions(-) create mode 100644 hw/arm/virt-acpi.c delete mode 100644 hw/i386/acpi-defs.h create mode 100644 include/hw/acpi/acpi-defs.h create mode 100644 include/hw/arm/virt-acpi.h
Signature · 1 line
1.9.1
Quoted 12 lines · Alexander Spyridakis
Currently, the virt machine model generates Device Tree information dynamically based on the existing devices in the system. This patch series extends the same concept but for ACPI information instead. A total of seven tables have been implemented in this patch series, which is the minimum for a basic ARM support.
The set of generated tables are:
- RSDP
- XSDT
- MADT
- GTDT
- FADT
- FACS
- DSDT
Quoted 6 lines
The tables are created in standalone buffers, taking into account the needed information passed from the virt machine model. When the generation is finalized, the individual buffers are compacted to a single ACPI binary blob, where it is injected on the guest memory space in a fixed location. The guest kernel can find the ACPI tables by providing to it the physical address of the ACPI blob (e.g. acpi_rsdp=0x47000000 boot argument).
(Sorry, I should have waited for the cover letter to arrive before replying.)
I think this is definitely the wrong approach. We already have to generate device tree information for the hardware we have, and having an equivalent parallel infrastructure for generating ACPI as well seems like it would be a tremendous mess. We should support guests that require ACPI by having QEMU boot a UEFI bios blob and have that UEFI code generate ACPI tables based on the DTB we hand it. (Chances seem good that any guest that wants ACPI is going to want UEFI runtime services anyway.)
thanks
-- PMM
Quoted 23 lines · Peter Maydell
Quoted 12 lines · Alexander Spyridakis
Currently, the virt machine model generates Device Tree information dynamically based on the existing devices in the system. This patch series extends the same concept but for ACPI information instead. A total of seven tables have been implemented in this patch series, which is the minimum for a basic ARM support.
The set of generated tables are:
- RSDP
- XSDT
- MADT
- GTDT
- FADT
- FACS
- DSDTQuoted 6 lines
The tables are created in standalone buffers, taking into account the needed information passed from the virt machine model. When the generation is finalized, the individual buffers are compacted to a single ACPI binary blob, where it is injected on the guest memory space in a fixed location. The guest kernel can find the ACPI tables by providing to it the physical address of the ACPI blob (e.g. acpi_rsdp=0x47000000 boot argument).
(Sorry, I should have waited for the cover letter to arrive before replying.)
Quoted 8 lines
I think this is definitely the wrong approach. We already have to generate device tree information for the hardware we have, and having an equivalent parallel infrastructure for generating ACPI as well seems like it would be a tremendous mess. We should support guests that require ACPI by having QEMU boot a UEFI bios blob and have that UEFI code generate ACPI tables based on the DTB we hand it. (Chances seem good that any guest that wants ACPI is going to want UEFI runtime services anyway.)
Depending on why people want ACPI in a guest environment, generating ACPI tables from a DTB might not be possible (e.g. if they want to use AML for some reason).
So the important question is _why_ the guest needs to see an ACPI environment. What exactly can ACPI provide to the guest that DT does not already provide, and why is that necessary? What infrastrucutre is needed for that use case?
Translating DT tables into the equivalent ACPI tables seems like a waste of effort unless it enables something we can't do at the moment.
Thanks,
Mark.
Hi all,
Quoted 42 lines · Mark Rutland
Quoted 23 lines · Peter Maydell
Quoted 12 lines · Alexander Spyridakis
Currently, the virt machine model generates Device Tree information dynamically based on the existing devices in the system. This patch series extends the same concept but for ACPI information instead. A total of seven tables have been implemented in this patch series, which is the minimum for a basic ARM support.
The set of generated tables are:
- RSDP
- XSDT
- MADT
- GTDT
- FADT
- FACS
- DSDTQuoted 6 lines
The tables are created in standalone buffers, taking into account the needed information passed from the virt machine model. When the generation is finalized, the individual buffers are compacted to a single ACPI binary blob, where it is injected on the guest memory space in a fixed location. The guest kernel can find the ACPI tables by providing to it the physical address of the ACPI blob (e.g. acpi_rsdp=0x47000000 boot argument).
(Sorry, I should have waited for the cover letter to arrive before replying.)
Quoted 8 lines
I think this is definitely the wrong approach. We already have to generate device tree information for the hardware we have, and having an equivalent parallel infrastructure for generating ACPI as well seems like it would be a tremendous mess. We should support guests that require ACPI by having QEMU boot a UEFI bios blob and have that UEFI code generate ACPI tables based on the DTB we hand it. (Chances seem good that any guest that wants ACPI is going to want UEFI runtime services anyway.)
Depending on why people want ACPI in a guest environment, generating ACPI tables from a DTB might not be possible (e.g. if they want to use AML for some reason).
So the important question is _why_ the guest needs to see an ACPI environment. What exactly can ACPI provide to the guest that DT does not already provide, and why is that necessary? What infrastrucutre is needed for that use case?
Quoted 6 lines
Translating DT tables into the equivalent ACPI tables seems like a waste of effort unless it enables something we can't do at the moment.
Thanks,
Mark.
Please correct me if I am wrong, my understanding at the moment is that for X86 there is an ACPI implementation in hw/acpi, with the table generation happening in hw/i386/acpi-build.c .
Couldn't there be some unification where part of the infrastructure for ACPI is reused, with arch-specific code specializing for X86 and ARM? Why are ACPI tables created for X86, but cannot be created likewise for ARM?
We need ACPI guest support in QEMU for AArch64 over here, with all features (including the ability to run ACPI code and add specific tables), for ACPI-based guests.
Thanks,
Claudio
Quoted 6 lines · Claudio Fontana
Please correct me if I am wrong, my understanding at the moment is that for X86 there is an ACPI implementation in hw/acpi, with the table generation happening in
hw/i386/acpi-build.c.
Couldn't there be some unification where part of the infrastructure for ACPI is reused, with arch-specific code specializing for X86 and ARM? Why are ACPI tables created for X86, but cannot be created likewise for ARM?
Because then for ARM boards we'd be creating a description of the hardware twice, once in device tree and once in ACPI, which seems like unnecessary duplication.
Quoted 3 lines
We need ACPI guest support in QEMU for AArch64 over here, with all features (including the ability to run ACPI code and add specific tables), for ACPI-based guests.
The plan for providing ACPI to guests is that we run a UEFI BIOS blob which is what is responsible for providing ACPI and UEFI runtime services to guests which need them. (The UEFI blob finds out about its hardware by looking at a device tree that QEMU passes it, but that's a detail between QEMU and its bios blob). This pretty much looks like what x86 QEMU used to do with ACPI for a very long time, so we know it's a feasible approach.
thanks
-- PMM
Quoted 16 lines · On Thu, 6 Nov 2014 12:44:04 +0000 Peter Maydell <[email protected]>…
Quoted 6 lines · Claudio Fontana
Please correct me if I am wrong, my understanding at the moment is that for X86 there is an ACPI implementation in hw/acpi, with the table generation happening in
hw/i386/acpi-build.c.
Couldn't there be some unification where part of the infrastructure for ACPI is reused, with arch-specific code specializing for X86 and ARM? Why are ACPI tables created for X86, but cannot be created likewise for ARM?Because then for ARM boards we'd be creating a description of the hardware twice, once in device tree and once in ACPI, which seems like unnecessary duplication.
Quoted 3 lines
We need ACPI guest support in QEMU for AArch64 over here, with all features (including the ability to run ACPI code and add specific tables), for ACPI-based guests.
Quoted 7 lines
The plan for providing ACPI to guests is that we run a UEFI BIOS blob which is what is responsible for providing ACPI and UEFI runtime services to guests which need them. (The UEFI blob finds out about its hardware by looking at a device tree that QEMU passes it, but that's a detail between QEMU and its bios blob). This pretty much looks like what x86 QEMU used to do with ACPI for a very long time, so we know it's a feasible approach.
ACPI in BIOS had also led to necessity to
1. update BIOS and QEMU in lockstep if fix/feature is must to have
2. adding compatibility hooks so it it would work with mismatched
versions.
3. never ending expansion of PV QEMU-BIOS interface
That's the reasons why ACPI tables are build by QEMU now, and we probably should learn on x86 experience instead of going through the same issues second time.
Quoted 4 lines
thanks
-- PMM
Quoted 6 lines · Peter Maydell
Quoted 5 lines
We need ACPI guest support in QEMU for AArch64 over here, with all features (including the ability to run ACPI code and add specific tables), for ACPI-based guests.
Quoted 7 lines
The plan for providing ACPI to guests is that we run a UEFI BIOS blob which is what is responsible for providing ACPI and UEFI runtime services to guests which need them. (The UEFI blob finds out about its hardware by looking at a device tree that QEMU passes it, but that's a detail between QEMU and its bios blob). This pretty much looks like what x86 QEMU used to do with ACPI for a very long time, so we know it's a feasible approach.
Hi Peter,
The rational in the proposed approach is meant for cases where the user does not want to rely on external firmware layers. While UEFI could do what you are describing, the point is to avoid this not so trivial overhead in the booting process. Especially in the case of thin guests, where another software dependency is undesired.
Regards.
Quoted 5 lines · Alexander Spyridakis
The rational in the proposed approach is meant for cases where the user does not want to rely on external firmware layers. While UEFI could do what you are describing, the point is to avoid this not so trivial overhead in the booting process. Especially in the case of thin guests, where another software dependency is undesired.
Can you boot an x86 QEMU/KVM ACPI-using guest without running the BIOS?
-- PMM
Hi,
Quoted 15 lines · Alexander Spyridakis
Quoted 6 lines · Peter Maydell
Quoted 5 lines
We need ACPI guest support in QEMU for AArch64 over here, with all features (including the ability to run ACPI code and add specific tables), for ACPI-based guests.
Quoted 7 lines
The plan for providing ACPI to guests is that we run a UEFI BIOS blob which is what is responsible for providing ACPI and UEFI runtime services to guests which need them. (The UEFI blob finds out about its hardware by looking at a device tree that QEMU passes it, but that's a detail between QEMU and its bios blob). This pretty much looks like what x86 QEMU used to do with ACPI for a very long time, so we know it's a feasible approach.
Quoted 7 lines
Hi Peter,
The rational in the proposed approach is meant for cases where the user does not want to rely on external firmware layers. While UEFI could do what you are describing, the point is to avoid this not so trivial overhead in the booting process. Especially in the case of thin guests, where another software dependency is undesired.
I'm not sure how you plan to use ACPI without UEFI, as there are several pieces of information which ACPI misses, such as the memory map, which must be discovered from UEFI. How do you intend to discover the memory map without UEFI?
Additionally, with Linux and other generic OSs, the expectation is that the ACPI tables are discovered via the UEFI system table. How do you intend to discover the ACPI tables? Or other system information?
Quoted 1 line
From experience with Linux, querying this information from UEFI is a
trivial overhead, though a UEFI implementation might take a while to boot to the point where that is possible. It would be more generally helpful to have an optimized virtualised UEFI for this case (or perhaps just a UEFI frontend that presents the same interface to EFI applications but doesn't have to do any heavy lifting at boot).
So far the general trend with AArch64 at the system level is to use generic interfaces as far as possible. The generic interface for discovering ACPI tables is to boot as an EFI application and then to query the tables from UEFI. That is the interface others are likely to follow, and ACPI without UEFI is unlikely to be of much use to anyone else.
Why is it worth expending the effort on the boot protocol you suggest (which so far is not well defined) when there is already a portable, well-defined standard that others are already following?
Thanks,
Mark.
Quoted 26 lines · Mark Rutland
Hi,
Quoted 15 lines · Alexander Spyridakis
Quoted 6 lines · Peter Maydell
Quoted 5 lines
We need ACPI guest support in QEMU for AArch64 over here, with all features (including the ability to run ACPI code and add specific tables), for ACPI-based guests.
Quoted 7 lines
The plan for providing ACPI to guests is that we run a UEFI BIOS blob which is what is responsible for providing ACPI and UEFI runtime services to guests which need them. (The UEFI blob finds out about its hardware by looking at a device tree that QEMU passes it, but that's a detail between QEMU and its bios blob). This pretty much looks like what x86 QEMU used to do with ACPI for a very long time, so we know it's a feasible approach.
Quoted 7 lines
Hi Peter,
The rational in the proposed approach is meant for cases where the user does not want to rely on external firmware layers. While UEFI could do what you are describing, the point is to avoid this not so trivial overhead in the booting process. Especially in the case of thin guests, where another software dependency is undesired.
Quoted 8 lines
I'm not sure how you plan to use ACPI without UEFI, as there are several pieces of information which ACPI misses, such as the memory map, which must be discovered from UEFI. How do you intend to discover the memory map without UEFI?
Additionally, with Linux and other generic OSs, the expectation is that the ACPI tables are discovered via the UEFI system table. How do you intend to discover the ACPI tables? Or other system information?
FWIW, Xen needs to pass the RDSP pointer along with a tiny DT containing the command line and memory information to Dom0 as well. We are currently suggesting adding an RDSP property to the chosen node in the tiny DT, but a command-line arguement like kexec proposed could be another option I guess, albeit not a very pretty one.
But, what I hear from Huawei is that they don't want any DT and don't want any UEFI, so not sure how they plan on accomplishing that.
-Christoffer
Hi Christoffer,
Quoted 32 lines · Christoffer Dall
Quoted 31 lines · Mark Rutland
Hi,
Quoted 15 lines · Alexander Spyridakis
Quoted 6 lines · Peter Maydell
Quoted 5 lines
We need ACPI guest support in QEMU for AArch64 over here, with all features (including the ability to run ACPI code and add specific tables), for ACPI-based guests.
Quoted 7 lines
The plan for providing ACPI to guests is that we run a UEFI BIOS blob which is what is responsible for providing ACPI and UEFI runtime services to guests which need them. (The UEFI blob finds out about its hardware by looking at a device tree that QEMU passes it, but that's a detail between QEMU and its bios blob). This pretty much looks like what x86 QEMU used to do with ACPI for a very long time, so we know it's a feasible approach.
Quoted 7 lines
Hi Peter,
The rational in the proposed approach is meant for cases where the user does not want to rely on external firmware layers. While UEFI could do what you are describing, the point is to avoid this not so trivial overhead in the booting process. Especially in the case of thin guests, where another software dependency is undesired.
I'm not sure how you plan to use ACPI without UEFI, as there are several pieces of information which ACPI misses, such as the memory map, which must be discovered from UEFI. How do you intend to discover the memory map without UEFI?
Quoted 6 lines
Quoted 3 lines
Additionally, with Linux and other generic OSs, the expectation is that the ACPI tables are discovered via the UEFI system table. How do you intend to discover the ACPI tables? Or other system information?
FWIW, Xen needs to pass the RDSP pointer along with a tiny DT containing the command line and memory information to Dom0 as well.
When you say "memory information", is that pointers to a UEFI memory map, or memory nodes? The former should work for ACPI, but I don't think the latter will. I think there's a need for some discussion regarding the Dom0 boot flow for ACPI. Is there any tree I can take a peek at?
Passing just the RDSP will mean that Dom0 won't get SMBIOS tables and other potentially useful things, in addition to simply being yet another potential boot configuration. I'm a little concerned about that.
Quoted 3 lines
We are currently suggesting adding an RDSP property to the chosen node in the tiny DT, but a command-line arguement like kexec proposed could be another option I guess, albeit not a very pretty one.
I'm not sure what an RDSP command line property would have to do with kexec. I'll assume I've misunderstood something.
Quoted 2 lines
But, what I hear from Huawei is that they don't want any DT and don't want any UEFI, so not sure how they plan on accomplishing that.
Indeed.
Thanks,
Mark.
Quoted 39 lines · Mark Rutland
Hi Christoffer,
Quoted 36 lines · Christoffer Dall
Quoted 34 lines · Mark Rutland
Hi,
Quoted 15 lines · Alexander Spyridakis
Quoted 6 lines · Peter Maydell
Quoted 5 lines
We need ACPI guest support in QEMU for AArch64 over here, with all features (including the ability to run ACPI code and add specific tables), for ACPI-based guests.
Quoted 7 lines
The plan for providing ACPI to guests is that we run a UEFI BIOS blob which is what is responsible for providing ACPI and UEFI runtime services to guests which need them. (The UEFI blob finds out about its hardware by looking at a device tree that QEMU passes it, but that's a detail between QEMU and its bios blob). This pretty much looks like what x86 QEMU used to do with ACPI for a very long time, so we know it's a feasible approach.
Quoted 7 lines
Hi Peter,
The rational in the proposed approach is meant for cases where the user does not want to rely on external firmware layers. While UEFI could do what you are describing, the point is to avoid this not so trivial overhead in the booting process. Especially in the case of thin guests, where another software dependency is undesired.
I'm not sure how you plan to use ACPI without UEFI, as there are several pieces of information which ACPI misses, such as the memory map, which must be discovered from UEFI. How do you intend to discover the memory map without UEFI?
Additionally, with Linux and other generic OSs, the expectation is that the ACPI tables are discovered via the UEFI system table. How do you intend to discover the ACPI tables? Or other system information?
Quoted 7 lines
Quoted 2 lines
FWIW, Xen needs to pass the RDSP pointer along with a tiny DT containing the command line and memory information to Dom0 as well.
When you say "memory information", is that pointers to a UEFI memory map, or memory nodes? The former should work for ACPI, but I don't think the latter will. I think there's a need for some discussion regarding the Dom0 boot flow for ACPI. Is there any tree I can take a peek at?
Plain memory nodes. There is no UEFI instance for Dom0. AFAIU x86 does something similar (although with some custom PV thing instead of DT), and when Dom0 needs UEFI runtime services, this is done through specific hypercalls.
The Xen code is incomplete for this work, but can be followed here:
https://git.linaro.org/people/parth.dixit/acpi-rsdp/xen.git/shortlog/refs/heads/explore-rsdp
The Linux side is stuff based on the LEG kernel I think, not sure if it's pushed anywhere yet.
I'm cc'ing Parth and Julien here, but I agree that having a discussion on this could probably be good.
Quoted 5 lines
Passing just the RDSP will mean that Dom0 won't get SMBIOS tables and other potentially useful things, in addition to simply being yet another potential boot configuration. I'm a little concerned about that.
I share your concern, but running another UEFI instance for Dom0 doesn't seem like a viable alternative either. Why is this a problem on ARM and not on x86 though?
Quoted 7 lines
Quoted 3 lines
We are currently suggesting adding an RDSP property to the chosen node in the tiny DT, but a command-line arguement like kexec proposed could be another option I guess, albeit not a very pretty one.
I'm not sure what an RDSP command line property would have to do with kexec. I'll assume I've misunderstood something.
I thought the kexec patches proposed passing the RDSP on the command-line to boot the secondary kernel, so if that ended up being supported by the kernel for kexec, maybe that could be leveraged by Xen's boot protocol. It was an idea someone brought to me, just thought I'd mention it.
-Christoffer
Quoted 48 lines · Christoffer Dall
Quoted 39 lines · Mark Rutland
Hi Christoffer,
Quoted 36 lines · Christoffer Dall
Quoted 34 lines · Mark Rutland
Hi,
Quoted 15 lines · Alexander Spyridakis
Quoted 6 lines · Peter Maydell
Quoted 5 lines
We need ACPI guest support in QEMU for AArch64 over here, with all features (including the ability to run ACPI code and add specific tables), for ACPI-based guests.
Quoted 7 lines
The plan for providing ACPI to guests is that we run a UEFI BIOS blob which is what is responsible for providing ACPI and UEFI runtime services to guests which need them. (The UEFI blob finds out about its hardware by looking at a device tree that QEMU passes it, but that's a detail between QEMU and its bios blob). This pretty much looks like what x86 QEMU used to do with ACPI for a very long time, so we know it's a feasible approach.
Quoted 7 lines
Hi Peter,
The rational in the proposed approach is meant for cases where the user does not want to rely on external firmware layers. While UEFI could do what you are describing, the point is to avoid this not so trivial overhead in the booting process. Especially in the case of thin guests, where another software dependency is undesired.
I'm not sure how you plan to use ACPI without UEFI, as there are several pieces of information which ACPI misses, such as the memory map, which must be discovered from UEFI. How do you intend to discover the memory map without UEFI?
Additionally, with Linux and other generic OSs, the expectation is that the ACPI tables are discovered via the UEFI system table. How do you intend to discover the ACPI tables? Or other system information?
Quoted 7 lines
Quoted 2 lines
FWIW, Xen needs to pass the RDSP pointer along with a tiny DT containing the command line and memory information to Dom0 as well.
When you say "memory information", is that pointers to a UEFI memory map, or memory nodes? The former should work for ACPI, but I don't think the latter will. I think there's a need for some discussion regarding the Dom0 boot flow for ACPI. Is there any tree I can take a peek at?
Quoted 7 lines
Plain memory nodes. There is no UEFI instance for Dom0. AFAIU x86 does something similar (although with some custom PV thing instead of DT), and when Dom0 needs UEFI runtime services, this is done through specific hypercalls.
The Xen code is incomplete for this work, but can be followed here:
https://git.linaro.org/people/parth.dixit/acpi-rsdp/xen.git/shortlog/refs/heads/explore-rsdp
Thanks.
Quoted 5 lines
The Linux side is stuff based on the LEG kernel I think, not sure if it's pushed anywhere yet.
I'm cc'ing Parth and Julien here, but I agree that having a discussion on this could probably be good.
Sounds good to me. That might be worth running as a separate thread so as not to confuse matters.
Perhaps just using memory nodes is fine, but so far all of the discussions I've been in (on mailing lists and in person) regarding ACPI have had the fundamental assumption that ACPI would require UEFI, and the UEFI memory map is in use. Given that assumption seems to be broken for this case, we need to revisit those discussions.
There's also a problem in that this opens the possibility of non-Xen !UEFI + ACPI configurations, which I don't think is something we want to encourage. Xen is somewhat a special case because of the symbiotic relationship with Dom0.
Quoted 8 lines
Quoted 4 lines
Passing just the RDSP will mean that Dom0 won't get SMBIOS tables and other potentially useful things, in addition to simply being yet another potential boot configuration. I'm a little concerned about that.
I share your concern, but running another UEFI instance for Dom0 doesn't seem like a viable alternative either. Why is this a problem on ARM and not on x86 though?
I believe that on x86 the fallback for !UEFI would be the e820 memory map, which provides info regarding the type of the memory mapping, as opposed to just the base + size. That said, I'm not that familiar with e820, and from a quick look the provided information doesn't seem to be that detailed.
Quoted 8 lines
Quoted 7 lines
Quoted 3 lines
We are currently suggesting adding an RDSP property to the chosen node in the tiny DT, but a command-line arguement like kexec proposed could be another option I guess, albeit not a very pretty one.
I'm not sure what an RDSP command line property would have to do with kexec. I'll assume I've misunderstood something.
Quoted 5 lines
I thought the kexec patches proposed passing the RDSP on the command-line to boot the secondary kernel, so if that ended up being supported by the kernel for kexec, maybe that could be leveraged by Xen's boot protocol. It was an idea someone brought to me, just thought I'd mention it.
Ah, that's not something I'd heard of.
I'm not a fan of placing fundamentally required system description on the command line. It's fine for explicit overrides but I don't think it should be the default mechanism as that causes its own set of problems (who wants to fight with their hypervisor to pass a command line to a guest kernel?).
Thanks,
Mark.
Quoted 59 lines · Mark Rutland
Quoted 48 lines · Christoffer Dall
Quoted 39 lines · Mark Rutland
Hi Christoffer,
Quoted 36 lines · Christoffer Dall
Quoted 34 lines · Mark Rutland
Hi,
Quoted 15 lines · Alexander Spyridakis
Quoted 6 lines · Peter Maydell
Quoted 5 lines
We need ACPI guest support in QEMU for AArch64 over here, with all features (including the ability to run ACPI code and add specific tables), for ACPI-based guests.
Quoted 7 lines
The plan for providing ACPI to guests is that we run a UEFI BIOS blob which is what is responsible for providing ACPI and UEFI runtime services to guests which need them. (The UEFI blob finds out about its hardware by looking at a device tree that QEMU passes it, but that's a detail between QEMU and its bios blob). This pretty much looks like what x86 QEMU used to do with ACPI for a very long time, so we know it's a feasible approach.
Quoted 7 lines
Hi Peter,
The rational in the proposed approach is meant for cases where the user does not want to rely on external firmware layers. While UEFI could do what you are describing, the point is to avoid this not so trivial overhead in the booting process. Especially in the case of thin guests, where another software dependency is undesired.
I'm not sure how you plan to use ACPI without UEFI, as there are several pieces of information which ACPI misses, such as the memory map, which must be discovered from UEFI. How do you intend to discover the memory map without UEFI?
Additionally, with Linux and other generic OSs, the expectation is that the ACPI tables are discovered via the UEFI system table. How do you intend to discover the ACPI tables? Or other system information?
Quoted 7 lines
Quoted 2 lines
FWIW, Xen needs to pass the RDSP pointer along with a tiny DT containing the command line and memory information to Dom0 as well.
When you say "memory information", is that pointers to a UEFI memory map, or memory nodes? The former should work for ACPI, but I don't think the latter will. I think there's a need for some discussion regarding the Dom0 boot flow for ACPI. Is there any tree I can take a peek at?
Quoted 7 lines
Plain memory nodes. There is no UEFI instance for Dom0. AFAIU x86 does something similar (although with some custom PV thing instead of DT), and when Dom0 needs UEFI runtime services, this is done through specific hypercalls.
The Xen code is incomplete for this work, but can be followed here:
https://git.linaro.org/people/parth.dixit/acpi-rsdp/xen.git/shortlog/refs/heads/explore-rsdpThanks.
Quoted 8 lines
Quoted 5 lines
The Linux side is stuff based on the LEG kernel I think, not sure if it's pushed anywhere yet.
I'm cc'ing Parth and Julien here, but I agree that having a discussion on this could probably be good.
Sounds good to me. That might be worth running as a separate thread so as not to confuse matters.
Agreed.
Quoted 21 lines
Perhaps just using memory nodes is fine, but so far all of the discussions I've been in (on mailing lists and in person) regarding ACPI have had the fundamental assumption that ACPI would require UEFI, and the UEFI memory map is in use. Given that assumption seems to be broken for this case, we need to revisit those discussions.
There's also a problem in that this opens the possibility of non-Xen !UEFI + ACPI configurations, which I don't think is something we want to encourage. Xen is somewhat a special case because of the symbiotic relationship with Dom0.
Quoted 8 lines
Quoted 4 lines
Passing just the RDSP will mean that Dom0 won't get SMBIOS tables and other potentially useful things, in addition to simply being yet another potential boot configuration. I'm a little concerned about that.
I share your concern, but running another UEFI instance for Dom0 doesn't seem like a viable alternative either. Why is this a problem on ARM and not on x86 though?
Quoted 6 lines
I believe that on x86 the fallback for !UEFI would be the e820 memory map, which provides info regarding the type of the memory mapping, as opposed to just the base + size. That said, I'm not that familiar with e820, and from a quick look the provided information doesn't seem to be that detailed.
right, the good old PC.
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
Quoted 3 lines
We are currently suggesting adding an RDSP property to the chosen node in the tiny DT, but a command-line arguement like kexec proposed could be another option I guess, albeit not a very pretty one.
I'm not sure what an RDSP command line property would have to do with kexec. I'll assume I've misunderstood something.
Quoted 7 lines
Quoted 5 lines
I thought the kexec patches proposed passing the RDSP on the command-line to boot the secondary kernel, so if that ended up being supported by the kernel for kexec, maybe that could be leveraged by Xen's boot protocol. It was an idea someone brought to me, just thought I'd mention it.
Ah, that's not something I'd heard of.
Maybe there was a misunderstanding then, I thought you were cc'ed on those discussions.
Quoted 7 lines
I'm not a fan of placing fundamentally required system description on the command line. It's fine for explicit overrides but I don't think it should be the default mechanism as that causes its own set of problems (who wants to fight with their hypervisor to pass a command line to a guest kernel?).
Agreed completely, but I've been lacking strong technical arguments against passing this stuff on the cmdline. My personal preferred approach for the Xen Dom0 case is to add a property to the DT.
-Christoffer
Hi,
Quoted 11 lines · Christoffer Dall
Quoted 7 lines
I'm not a fan of placing fundamentally required system description on the command line. It's fine for explicit overrides but I don't think it should be the default mechanism as that causes its own set of problems (who wants to fight with their hypervisor to pass a command line to a guest kernel?).
Agreed completely, but I've been lacking strong technical arguments against passing this stuff on the cmdline. My personal preferred approach for the Xen Dom0 case is to add a property to the DT.
IHMO, the cmdline is OS specific, therefore this solution wouldn't fit to support ACPI on other OS (i.e *BSD) without requiring specific implementation/parsing of the command line.
The DT solution would be cleaner and the bindings are already standardize (and starting to be used on other OS such as FreeBSD).
Regards,
Signature · 1 line
Julien Grall
[...]
Quoted 14 lines
Quoted 14 lines
Quoted 13 lines
Quoted 7 lines
Quoted 3 lines
We are currently suggesting adding an RDSP property to the chosen node in the tiny DT, but a command-line arguement like kexec proposed could be another option I guess, albeit not a very pretty one.
I'm not sure what an RDSP command line property would have to do with kexec. I'll assume I've misunderstood something.
I thought the kexec patches proposed passing the RDSP on the command-line to boot the secondary kernel, so if that ended up being supported by the kernel for kexec, maybe that could be leveraged by Xen's boot protocol. It was an idea someone brought to me, just thought I'd mention it.
Quoted 4 lines
Quoted 1 line
Ah, that's not something I'd heard of.
Maybe there was a misunderstanding then, I thought you were cc'ed on those discussions.
I may just have lost them in my inbox. I'm on a few too many mailing lists these days. Sorry about that.
Quoted 10 lines
Quoted 6 lines
I'm not a fan of placing fundamentally required system description on the command line. It's fine for explicit overrides but I don't think it should be the default mechanism as that causes its own set of problems (who wants to fight with their hypervisor to pass a command line to a guest kernel?).
Agreed completely, but I've been lacking strong technical arguments against passing this stuff on the cmdline. My personal preferred approach for the Xen Dom0 case is to add a property to the DT.
Something under /chosen, or a firmware node would sound preferable to me. For UEFI we pass the system table address as /chosen/linux,uefi-system-table = <... ...>, and I think the RDSP could be handled similarly if necessary. The user can than override that via the command line if desired.
Ideally, the user shouldn't have to place anything on the command line to get a usable system. Obviously some things will be necesarry (where is my rootfs?), but that should be the user's configuration of the system rather than fundamental properties of said system.
The big issue I'm aware of at the moment that forces people to provide a command line (on non-virtualised systems at least) is the default console and the rate thereof, but that's being looked into currently.
Thanks,
Mark.
Quoted 35 lines · Mark Rutland
[...]
Quoted 14 lines
Quoted 14 lines
Quoted 13 lines
Quoted 7 lines
Quoted 3 lines
We are currently suggesting adding an RDSP property to the chosen node in the tiny DT, but a command-line arguement like kexec proposed could be another option I guess, albeit not a very pretty one.
I'm not sure what an RDSP command line property would have to do with kexec. I'll assume I've misunderstood something.
I thought the kexec patches proposed passing the RDSP on the command-line to boot the secondary kernel, so if that ended up being supported by the kernel for kexec, maybe that could be leveraged by Xen's boot protocol. It was an idea someone brought to me, just thought I'd mention it.
Quoted 4 lines
Quoted 1 line
Ah, that's not something I'd heard of.
Maybe there was a misunderstanding then, I thought you were cc'ed on those discussions.
I may just have lost them in my inbox. I'm on a few too many mailing lists these days. Sorry about that.
Quoted 10 lines
Quoted 6 lines
I'm not a fan of placing fundamentally required system description on the command line. It's fine for explicit overrides but I don't think it should be the default mechanism as that causes its own set of problems (who wants to fight with their hypervisor to pass a command line to a guest kernel?).
Agreed completely, but I've been lacking strong technical arguments against passing this stuff on the cmdline. My personal preferred approach for the Xen Dom0 case is to add a property to the DT.
Quoted 6 lines
Something under /chosen, or a firmware node would sound preferable to me. For UEFI we pass the system table address as /chosen/linux,uefi-system-table = <... ...>, and I think the RDSP could be handled similarly if necessary. The user can than override that via the command line if desired.
We have actually done that in the past when we had to support u-boot and bootwrapper as a bootloader. It works fine in the kernel and its a minimal patch to support.
Graeme
Quoted 9 lines · Mark Rutland
Quoted 3 lines
I share your concern, but running another UEFI instance for Dom0 doesn't seem like a viable alternative either. Why is this a problem on ARM and not on x86 though?
I believe that on x86 the fallback for !UEFI would be the e820 memory map, which provides info regarding the type of the memory mapping, as opposed to just the base + size. That said, I'm not that familiar with e820, and from a quick look the provided information doesn't seem to be that detailed.
The e820 memory map is only part of it. On x86 !UEFI you are supposed to scan low memory for magic signatures that provides pointers to the SMBIOS and ACPI tables.
As Christoffer said, "the good old PC". :)
SeaBIOS fishes out information from fw_cfg, and puts it in low memory. On ARM you could use DT binary blobs instead of fw_cfg, as proposed already (I don't remember if it was in this thread or IRC). Then if you want to go !UEFI you can extract the tables from those binary blobs.
Paolo
Quoted 12 lines · Paolo Bonzini
Quoted 9 lines · Mark Rutland
Quoted 3 lines
I share your concern, but running another UEFI instance for Dom0 doesn't seem like a viable alternative either. Why is this a problem on ARM and not on x86 though?
I believe that on x86 the fallback for !UEFI would be the e820 memory map, which provides info regarding the type of the memory mapping, as opposed to just the base + size. That said, I'm not that familiar with e820, and from a quick look the provided information doesn't seem to be that detailed.
Quoted 3 lines
The e820 memory map is only part of it. On x86 !UEFI you are supposed to scan low memory for magic signatures that provides pointers to the SMBIOS and ACPI tables.
Fun...
Quoted 6 lines
As Christoffer said, "the good old PC". :)
SeaBIOS fishes out information from
fw_cfg, and puts it in low memory. On ARM you could use DT binary blobs instead offw_cfg, as proposed already (I don't remember if it was in this thread or IRC). Then if you want to go !UEFI you can extract the tables from those binary blobs.
This sounds broken. I am very much not a fan of shoving binary blobs into DT to workaround a shoddy boot interface.
Mark.
Quoted 6 lines · Mark Rutland
Quoted 4 lines
Quoted 4 lines
SeaBIOS fishes out information from
fw_cfg, and puts it in low memory. On ARM you could use DT binary blobs instead offw_cfg, as proposed already (I don't remember if it was in this thread or IRC). Then if you want to go !UEFI you can extract the tables from those binary blobs.This sounds broken. I am very much not a fan of shoving binary blobs into DT to workaround a shoddy boot interface.
We tried spec-ing everything and building the tables in the firmware on x86. You really do not want to do that; it's painful to have to update firmware in lockstep with QEMU, and when you add the next feature it always seems like you got the bindings wrong.
And we only had one client (SeaBIOS) while you will have at least two (TianoCore and Linux, presumably? or is Huawei targeting OSv only?).
What we do now is we have two blobs, one with the ACPI tables and one that tells the firmware how to relocate pointers from one table to another. It's been working very well for both SeaBIOS and OVMF.
Paolo
Quoted 8 lines · Mark Rutland
Quoted 4 lines · Paolo Bonzini
SeaBIOS fishes out information from
fw_cfg, and puts it in low memory. On ARM you could use DT binary blobs instead offw_cfg, as proposed already (I don't remember if it was in this thread or IRC). Then if you want to go !UEFI you can extract the tables from those binary blobs.This sounds broken. I am very much not a fan of shoving binary blobs into DT to workaround a shoddy boot interface.
My understanding from an IRC conversation yesterday was that at least some of these ACPI blobs contain data which has to be constructed at the point it is requested (ie is not fixed at the point when QEMU starts up), because OVMF will do:
* startup
* prod some parts of the hardware to configure it
* request ACPI tables via fw_cfg
and the ACPI tables have to reflect the statu of the hardware after OVMF's poking, not before.
It wasn't entirely clear to me whether this applies equally to the ARM UEFI setup as to x86 + OVMF, but it does suggest that it would be better to define a memory-mapped variant of fw_cfg rather than stuffing the blobs into the device tree. (I didn't much like throwing the blobs in the dtb myself either.)
If somebody with more x86/ACPI knowledge could clarify what the dynamically-constructed parts of the tables are and whether they're likely to apply to use that would be good. I think they involved PCI in some way, but I don't have access to my irc logs right now to check. (I could imagine that ARM UEFI might not need to prod and configure a PCI bus and devices in the way that an x86 BIOS expects it has to, but that's speculation on my part, and I dunno that I'd care to bake that assumption into the design anyway.)
-- PMM
Quoted 9 lines · Peter Maydell
If somebody with more x86/ACPI knowledge could clarify what the dynamically-constructed parts of the tables are and whether they're likely to apply to use that would be good. I think they involved PCI in some way, but I don't have access to my irc logs right now to check. (I could imagine that ARM UEFI might not need to prod and configure a PCI bus and devices in the way that an x86 BIOS expects it has to, but that's speculation on my part, and I dunno that I'd care to bake that assumption into the design anyway.)
Yes, IIUC it's just for ACPI hotplug on devices behind a PCI-to-PCI bridge. On Linux/x86 we can use the PCI standard hotplug controller (SHPC), but not on Windows. So if it's just PCI, I tend to agree with you. ARM should really just use PCIe and SHPC hotplug and call it a day.
To me that actually goes in favor of putting blobs in the DT. :)
That said, if you really really want to write kernel drivers for stuff that x86 puts in the AML, there's little point in building the ACPI tables in QEMU. You already have a DT interface to talk to non-ACPI devices, Tiano Core can use the same bits to build ACPI tables.
Paolo
Quoted 26 lines · Peter Maydell
Quoted 8 lines · Mark Rutland
Quoted 4 lines · Paolo Bonzini
SeaBIOS fishes out information from
fw_cfg, and puts it in low memory. On ARM you could use DT binary blobs instead offw_cfg, as proposed already (I don't remember if it was in this thread or IRC). Then if you want to go !UEFI you can extract the tables from those binary blobs.This sounds broken. I am very much not a fan of shoving binary blobs into DT to workaround a shoddy boot interface.
My understanding from an IRC conversation yesterday was that at least some of these ACPI blobs contain data which has to be constructed at the point it is requested (ie is not fixed at the point when QEMU starts up), because OVMF will do:
* startup
* prod some parts of the hardware to configure it
* request ACPI tables viafw_cfg
and the ACPI tables have to reflect the statu of the hardware after OVMF's poking, not before.It wasn't entirely clear to me whether this applies equally to the ARM UEFI setup as to x86 + OVMF, but it does suggest that it would be better to define a memory-mapped variant of
fw_cfgrather than stuffing the blobs into the device tree. (I didn't much like throwing the blobs in the dtb myself either.)
Quoted 9 lines
If somebody with more x86/ACPI knowledge could clarify what the dynamically-constructed parts of the tables are and whether they're likely to apply to use that would be good. I think they involved PCI in some way, but I don't have access to my irc logs right now to check. (I could imagine that ARM UEFI might not need to prod and configure a PCI bus and devices in the way that an x86 BIOS expects it has to, but that's speculation on my part, and I dunno that I'd care to bake that assumption into the design anyway.)
Would the last step you mention allow for guests to start with an already existing PCI interrupt map and the BAR registers preprogrammed to point to somewhere sane?
I ask because on OSv at the moment, the situation is that for x86 we don't need to reprogram anything on PCI, as everything is already nicely set up by the time the guest starts, and thus the BAR addresses can be read directly. On ARM we have to reprogram the BARs manually for all devices.
Couldn't we give an easier time to each OS guest by having everything nicely set up on AArch64 as well?
Claudio
Quoted 10 lines · On Wednesday 12 November 2014 16:01:14 Claudio Fontana wrote:
Would the last step you mention allow for guests to start with an already existing PCI interrupt map and the BAR registers preprogrammed to point to somewhere sane?
I ask because on OSv at the moment, the situation is that for x86 we don't need to reprogram anything on PCI, as everything is already nicely set up by the time the guest starts, and thus the BAR addresses can be read directly. On ARM we have to reprogram the BARs manually for all devices.
Couldn't we give an easier time to each OS guest by having everything nicely set up on AArch64 as well?
Definitely, I think having the OS manually program the BARs only makes sense in an environment where you don't have a full-featured boot loader or you don't trust it. In servers and virtual machines, the PCI bus should always come fully set up. This also implies that the OS should not have to deal with registers for setting up the translation between PCI and system address ranges.
Arnd
Quoted 11 lines · Arnd Bergmann
Quoted 9 lines · On Wednesday 12 November 2014 16:01:14 Claudio Fontana wrote:
Would the last step you mention allow for guests to start with an already existing PCI interrupt map and the BAR registers preprogrammed to point to somewhere sane?
I ask because on OSv at the moment, the situation is that for x86 we don't need to reprogram anything on PCI, as everything is already nicely set up by the time the guest starts, and thus the BAR addresses can be read directly. On ARM we have to reprogram the BARs manually for all devices.
Couldn't we give an easier time to each OS guest by having everything nicely set up on AArch64 as well?
Quoted 6 lines
Definitely, I think having the OS manually program the BARs only makes sense in an environment where you don't have a full-featured boot loader or you don't trust it. In servers and virtual machines, the PCI bus should always come fully set up. This also implies that the OS should not have to deal with registers for setting up the translation between PCI and system address ranges.
It seems to me like complicated stuff like that definitely belongs in the UEFI/bootloader blob, though. I'd rather QEMU just modelled the hardware and let the guest (or the firmware, which is guest code from QEMU's point of view) set it up however it wants.
-- PMM
Quoted 11 lines · Peter Maydell
Quoted 6 lines
Definitely, I think having the OS manually program the BARs only makes sense in an environment where you don't have a full-featured boot loader or you don't trust it. In servers and virtual machines, the PCI bus should always come fully set up. This also implies that the OS should not have to deal with registers for setting up the translation between PCI and system address ranges.
It seems to me like complicated stuff like that definitely belongs in the UEFI/bootloader blob, though. I'd rather QEMU just modelled the hardware and let the guest (or the firmware, which is guest code from QEMU's point of view) set it up however it wants.
It definitely doesn't belong in QEMU!
Paolo
Quoted 8 lines · On Wednesday 12 November 2014 16:52:25 Paolo Bonzini wrote:
Quoted 7 lines · Peter Maydell
Quoted 6 lines
Definitely, I think having the OS manually program the BARs only makes sense in an environment where you don't have a full-featured boot loader or you don't trust it. In servers and virtual machines, the PCI bus should always come fully set up. This also implies that the OS should not have to deal with registers for setting up the translation between PCI and system address ranges.
Quoted 6 lines
Quoted 4 lines
It seems to me like complicated stuff like that definitely belongs in the UEFI/bootloader blob, though. I'd rather QEMU just modelled the hardware and let the guest (or the firmware, which is guest code from QEMU's point of view) set it up however it wants.
It definitely doesn't belong in QEMU!
The easiest option would probably be not make all PCI devices have fixed BARs and not even allow them to be changed. I believe this is what kvmtool does, but I can see how supporting both modes is much harder than either one.
How does it work on x86 with qemu?
Arnd
Quoted 11 lines · Arnd Bergmann
Quoted 6 lines
Quoted 4 lines
It seems to me like complicated stuff like that definitely belongs in the UEFI/bootloader blob, though. I'd rather QEMU just modelled the hardware and let the guest (or the firmware, which is guest code from QEMU's point of view) set it up however it wants.
It definitely doesn't belong in QEMU!
The easiest option would probably be not make all PCI devices have fixed BARs and not even allow them to be changed. I believe this is what kvmtool does, but I can see how supporting both modes is much harder than either one.
kvmtool does not have firmware; it starts the kernel directly, so it does all the setup that usually is done by the firmware. It implements a couple real-mode interfaces that Linux uses when booting, but nothing of this deals with PCI.
x86 QEMU always runs firmware. Even if you specify -kernel, the firmware does all the usual initialization and then boots from a small ROM. The ROM contains the bootloader, so it loads and starts the kernel.
Quoted 1 line
How does it work on x86 with qemu?
Same as real hardware. Firmware (SeaBIOS or OVMF) builds the memory map, decides where in the free space the BARs go, and programs the PCI devices accordingly.
kvmtool is the special one here. Xen, VMware, Hyper-V all do the same as QEMU.
Paolo
Quoted 13 lines · On Wednesday 12 November 2014 17:04:30 Paolo Bonzini wrote:
Quoted 11 lines · Arnd Bergmann
Quoted 6 lines
Quoted 4 lines
It seems to me like complicated stuff like that definitely belongs in the UEFI/bootloader blob, though. I'd rather QEMU just modelled the hardware and let the guest (or the firmware, which is guest code from QEMU's point of view) set it up however it wants.
It definitely doesn't belong in QEMU!
The easiest option would probably be not make all PCI devices have fixed BARs and not even allow them to be changed. I believe this is what kvmtool does, but I can see how supporting both modes is much harder than either one.
Quoted 8 lines
kvmtool does not have firmware; it starts the kernel directly, so it does all the setup that usually is done by the firmware. It implements a couple real-mode interfaces that Linux uses when booting, but nothing of this deals with PCI.
x86 QEMU always runs firmware. Even if you specify -kernel, the firmware does all the usual initialization and then boots from a small ROM. The ROM contains the bootloader, so it loads and starts the kernel.
Ok, I see.
Quoted 8 lines
Quoted 1 line
How does it work on x86 with qemu?
Same as real hardware. Firmware (SeaBIOS or OVMF) builds the memory map, decides where in the free space the BARs go, and programs the PCI devices accordingly.
kvmtool is the special one here. Xen, VMware, Hyper-V all do the same as QEMU.
Right. I guess embedded ARM images in qemu are a third way then, because these don't have a guest firmware but also don't set up the hardware the way that kvmtool does.
Claudio's request to do this differently on arm64 seems absolutely reasonable to me, but I guess that implies having UEFI or something like it that does the PCI scan. Not sure what the best default for "qemu -kernel image" should be though if you don't explicitly pass a firmware image.
Arnd
Quoted 11 lines · Arnd Bergmann
Quoted 6 lines
Same as real hardware. Firmware (SeaBIOS or OVMF) builds the memory map, decides where in the free space the BARs go, and programs the PCI devices accordingly.
kvmtool is the special one here. Xen, VMware, Hyper-V all do the same as QEMU.
Right. I guess embedded ARM images in qemu are a third way then, because these don't have a guest firmware but also don't set up the hardware the way that kvmtool does.
Quoted 5 lines
Claudio's request to do this differently on arm64 seems absolutely reasonable to me, but I guess that implies having UEFI or something like it that does the PCI scan. Not sure what the best default for "qemu -kernel image" should be though if you don't explicitly pass a firmware image.
The PowerPC folks are using u-boot as the firmware. I know Peter disagrees, but I don't understand why so I'll throw this up for discussion too; it is definitely lighter-weight than UEFI. Would that make sense for ARM?
I just stumbled upon patches that port u-Boot to bare x86 (no SeaBIOS):
http://thread.gmane.org/gmane.comp.boot-loaders.u-boot/201885 -- they have to do the same PCI BAR initialization that Claudio is doing in OSv. Could Claudio build a u-boot ROM that sets up PCI and then automatically loads the OSv kernel?
Paolo
Quoted 18 lines · Paolo Bonzini
Quoted 11 lines · Arnd Bergmann
Quoted 6 lines
Same as real hardware. Firmware (SeaBIOS or OVMF) builds the memory map, decides where in the free space the BARs go, and programs the PCI devices accordingly.
kvmtool is the special one here. Xen, VMware, Hyper-V all do the same as QEMU.
Right. I guess embedded ARM images in qemu are a third way then, because these don't have a guest firmware but also don't set up the hardware the way that kvmtool does.
Quoted 5 lines
Claudio's request to do this differently on arm64 seems absolutely reasonable to me, but I guess that implies having UEFI or something like it that does the PCI scan. Not sure what the best default for "qemu -kernel image" should be though if you don't explicitly pass a firmware image.
Quoted 4 lines
The PowerPC folks are using u-boot as the firmware. I know Peter disagrees, but I don't understand why so I'll throw this up for discussion too; it is definitely lighter-weight than UEFI. Would that make sense for ARM?
I don't have any objection to people running u-boot firmware if that's what makes sense for them. Historically QEMU's -kernel option on ARM has behaved as "do the extremely bare minimum that the ARM kernel boot protocol demands, as by-hand setup of the CPU before we start executing". Before the advent of multiprocessor this was pretty much just "set up an ATAGS list and then boot the kernel by setting a couple of registers and jumping to it". Bringing in SMP and then the GIC and now device trees has gradually increased the scope of the little bootloader that's built into QEMU, and it is showing the strains a little (especially now it has to cope with some tweaks for some board/SoC models where their SMP secondary boot protocol is different). TrustZone is probably going to complicate the picture further.
Anyway, this approach works because ARMv7 embedded Linux doesn't really demand much of its bootloader. It has the advantage that we haven't needed to carry around ROM images for all our board models (which are a pain to deal with since you get to pick between needing a target CPU toolchain for building, or distributing binary blobs; and in some cases they aren't redistributable at all unless you go to the effort of writing custom firmware just for QEMU). Unlike x86, we wouldn't be able to just have one firmware and be done with it.
ARMv8 Linux at the moment also has a pretty minimal set of booting requirements (the kernel does not require anything like setting up PCI BARs, for instance), and so we've taken a similar approach with the addition of implementing the PSCI firmware interface for CPU power up/down/reset.
You could make a pretty good argument that the QEMU builtin bootloader really has reached the end of its useful life and we should switch to always booting some lump of firmware. (Indeed, the VM spec for ARMv8 mandates a UEFI firmware.) But for any particular new feature in the past we've ended up taking the pragmatic approach of adding it to the builtin loader rather than committing to replacing the whole thing. If ARMv8 Linux starts mandating PCI setup and other complicated setup then the balance probably tilts towards running at least some firmware in all cases.
-- PMM
Hi,
Quoted 4 lines
The PowerPC folks are using u-boot as the firmware. I know Peter disagrees, but I don't understand why so I'll throw this up for discussion too; it is definitely lighter-weight than UEFI. Would that make sense for ARM?
Played around with that. Look here:
https://www.kraxel.org/cgit/jenkins/u-boot/tree/
https://www.kraxel.org/repos/jenkins/u-boot/
[ based on fedora uboot package, some vexpress patches on top ]
Problems I ran into:
* u-boot has no virto support.
* sdcard emulation is painfully slow on arm kvm.
Oh, and working with u-boot upstream is *ahem* a challenge. After trying to get a patch upstream (rpm patch #8) I'm not really surprised any more that there are so many u-boot forks around.
Making edk2 fly on arm looks more promising to me. Especially for aarch64 of course, but also for armv7 + -M virt.
cheers,
Gerd
Quoted 5 lines · Claudio Fontana
I ask because on OSv at the moment, the situation is that for x86 we don't need to reprogram anything on PCI,
as everything is already nicely set up by the time the guest starts, and thus the BAR addresses can be read directly.
On ARM we have to reprogram the BARs manually for all devices.
qemu doesn't do anything here, seabios / ovmf does the pci initialization.
cheers,
Gerd
Hi,
Quoted 9 lines
My understanding from an IRC conversation yesterday was that at least some of these ACPI blobs contain data which has to be constructed at the point it is requested (ie is not fixed at the point when QEMU starts up), because OVMF will do:
* startup
* prod some parts of the hardware to configure it
* request ACPI tables viafw_cfg
and the ACPI tables have to reflect the statu of the hardware after OVMF's poking, not before.
It is this:
[root@fedora ~]# cat /proc/ioports
[ ... ]
0600-063f : 0000:00:01.3
0600-0603 : ACPI PM1a_EVT_BLK
0604-0605 : ACPI PM1a_CNT_BLK
0608-060b : ACPI PM_TMR
0700-070f : 0000:00:01.3
0700-0707 : piix4_smbus[ ... ]
[root@fedora ~]# lspci -vs1.3
00:01.3 Bridge: Intel Corporation 82371AB/EB/MB PIIX4 ACPI (rev 03)
Subsystem: Red Hat, Inc Qemu virtual machine
Flags: medium devsel, IRQ 9
Kernel driver in use: piix4_smbus
Kernel modules: i2c_piix4
A bunch of acpi registers are in a hidden pci bar of the piix4 acpi device (likewise on q35). The firmware must map this somewhere, and this must be done pretty early because the firmware uses the acpi pm timer for timekeeping.
The acpi tables have references to the apci registers, so the acpi table content must match the actual register location.
[ q35 only: similar issue with the pci mmconfig xbar ]
So there are three options to solve that:
(1) Use a fixed address. Doable, but takes away some flexibility.
(2) Have qemu define the address locations. Has some nasty initialization order issues. Also would require (a) a paravirtual interface or (b) a acpi table parser in the firmware.
(3) Have firmware define the address location. This is what we did on x86. No paravirt interface needed, the firmware simply programs the registers as it likes, and qemu adapts the acpi tables accordingly.
Quoted 2 lines
It wasn't entirely clear to me whether this applies equally to the ARM UEFI setup as to x86 + OVMF,
I think on arm doing (2) is alot easier as DT provides a nice way to pass addresses from qemu to firmware/guest.
cheers,
Gerd
Quoted 17 lines · Gerd Hoffmann
Hi,
Quoted 9 lines
My understanding from an IRC conversation yesterday was that at least some of these ACPI blobs contain data which has to be constructed at the point it is requested (ie is not fixed at the point when QEMU starts up), because OVMF will do:
* startup
* prod some parts of the hardware to configure it
* request ACPI tables viafw_cfg
and the ACPI tables have to reflect the statu of the hardware after OVMF's poking, not before.It is this:
[root@fedora ~]# cat
/proc/ioports
[ ... ]
0600-063f : 0000:00:01.3
Quoted 6 lines
0600-0603 : ACPI PM1a_EVT_BLK 0604-0605 : ACPI PM1a_CNT_BLK 0608-060b : ACPI PM_TMR 0700-070f : 0000:00:01.3 0700-0707 : piix4_smbus[ ... ]
So this is problematic: the PM1a_EVT_BLK and PM1a_CNT_BLK should not exist if hardware reduced mode ACPI is being used; the values in the FADT should be zero so there should be no ioports (see section 5.2.9 of the ACPI spec). If this is from an ARM platform, it _should_ be in hardware reduced mode. QEMU will have to take that into account.
Signature · 8 lines
ciao, al ----------------------------------- Al Stone Software Engineer Linaro Enterprise Group [email protected] -----------------------------------
Quoted 9 lines · Al Stone
Quoted 9 lines
Quoted 9 lines
[root@fedora ~]# cat
/proc/ioports
[ ... ]
0600-063f : 0000:00:01.30600-0603 : ACPI PM1a_EVT_BLK 0604-0605 : ACPI PM1a_CNT_BLK 0608-060b : ACPI PM_TMR 0700-070f : 0000:00:01.3 0700-0707 : piix4_smbus[ ... ]
Quoted 5 lines
So this is problematic: the
PM1a_EVT_BLKandPM1a_CNT_BLKshould not exist if hardware reduced mode ACPI is being used; the values in the FADT should be zero so there should be no ioports (see section 5.2.9 of the ACPI spec). If this is from an ARM platform, it _should_ be in hardware reduced mode. QEMU will have to take that into account.
No, this is x86. As mentioned elsewhere in the thread, we'd have to add a GPIO controller (e.g. PL061) to mach-virt, to replace GPE.
Paolo
Quoted 25 lines · Al Stone
Quoted 17 lines · Gerd Hoffmann
Hi,
Quoted 9 lines
My understanding from an IRC conversation yesterday was that at least some of these ACPI blobs contain data which has to be constructed at the point it is requested (ie is not fixed at the point when QEMU starts up), because OVMF will do:
* startup
* prod some parts of the hardware to configure it
* request ACPI tables viafw_cfg
and the ACPI tables have to reflect the statu of the hardware after OVMF's poking, not before.It is this:
[root@fedora ~]# cat
/proc/ioports
[ ... ]
0600-063f : 0000:00:01.3Quoted 6 lines
0600-0603 : ACPI PM1a_EVT_BLK 0604-0605 : ACPI PM1a_CNT_BLK 0608-060b : ACPI PM_TMR 0700-070f : 0000:00:01.3 0700-0707 : piix4_smbus[ ... ]
Quoted 2 lines
So this is problematic: the
PM1a_EVT_BLKandPM1a_CNT_BLKshould not exist if hardware reduced mode ACPI is being used;
This is x86 and gives some background on why the "firmware inits hardware -> qemu adjusts addresses in acpi tables -> firmware loads acpi tables via fw_cfg" init sequence is used there.
Figuring whenever you have similar problems / requirements on arm or if you can simply go with static acpi tables is up to you ;)
cheers,
Gerd
Quoted 49 lines · Mark Rutland
Hi,
Quoted 15 lines · Alexander Spyridakis
Quoted 6 lines · Peter Maydell
Quoted 5 lines
We need ACPI guest support in QEMU for AArch64 over here, with all features (including the ability to run ACPI code and add specific tables), for ACPI-based guests.
Quoted 7 lines
The plan for providing ACPI to guests is that we run a UEFI BIOS blob which is what is responsible for providing ACPI and UEFI runtime services to guests which need them. (The UEFI blob finds out about its hardware by looking at a device tree that QEMU passes it, but that's a detail between QEMU and its bios blob). This pretty much looks like what x86 QEMU used to do with ACPI for a very long time, so we know it's a feasible approach.
Quoted 7 lines
Hi Peter,
The rational in the proposed approach is meant for cases where the user does not want to rely on external firmware layers. While UEFI could do what you are describing, the point is to avoid this not so trivial overhead in the booting process. Especially in the case of thin guests, where another software dependency is undesired.
I'm not sure how you plan to use ACPI without UEFI, as there are several pieces of information which ACPI misses, such as the memory map, which must be discovered from UEFI. How do you intend to discover the memory map without UEFI?
Additionally, with Linux and other generic OSs, the expectation is that the ACPI tables are discovered via the UEFI system table. How do you intend to discover the ACPI tables? Or other system information?
From experience with Linux, querying this information from UEFI is a trivial overhead, though a UEFI implementation might take a while to boot to the point where that is possible. It would be more generally helpful to have an optimized virtualised UEFI for this case (or perhaps just a UEFI frontend that presents the same interface to EFI applications but doesn't have to do any heavy lifting at boot).
So far the general trend with AArch64 at the system level is to use generic interfaces as far as possible. The generic interface for discovering ACPI tables is to boot as an EFI application and then to query the tables from UEFI. That is the interface others are likely to follow, and ACPI without UEFI is unlikely to be of much use to anyone else.
Quoted 7 lines
Why is it worth expending the effort on the boot protocol you suggest (which so far is not well defined) when there is already a portable, well-defined standard that others are already following?
Thanks,
Mark.
Hi,
I tend to mostly agree with this, we might look for alternative solutions for speeding up guest startup in the future but in general if getting ACPI in the guest for ARM64 requires also getting UEFI, then I can personally live with that, especially if we strive to have the kind of optimized virtualized UEFI you mention.
We can in the meantime use these patches to test the "fast path" to the guest by just hardcoding or passing on the command line what is needed to be able to test information reading from ACPI from the guest side.
I cc: my colleagues Jani and Paul which have more the use case in mind and might correct me there.
For x86 though what is the state of UEFI in QEMU? Is it relying on the OVMF project to provide the firmware images if I understand correctly.. How is it working out in practice?
Should the same kind of approach be taken for ARM64?
As mentioned by others, I'd rather see an implementation of ACPI in QEMU which learns from the experience of X86 (and possibly shares some code if possible), rather than going in a different direction by creating device trees first, and then converting them to ACPI tables somewhere in the firmware, just because device trees are "already there", for the reasons which have already been mentioned before by Igor and others.
I wouldn't want for ACPI to be "sort of" supported in QEMU, but with a limited functionality which makes it not fully useful in practice. I'd rather see it as a first class citizen instead, including the ability to run AML code.
Thanks,
Claudio
Quoted 58 lines · Claudio Fontana
Quoted 49 lines · Mark Rutland
Hi,
Quoted 15 lines · Alexander Spyridakis
Quoted 6 lines · Peter Maydell
Quoted 5 lines
We need ACPI guest support in QEMU for AArch64 over here, with all features (including the ability to run ACPI code and add specific tables), for ACPI-based guests.
Quoted 7 lines
The plan for providing ACPI to guests is that we run a UEFI BIOS blob which is what is responsible for providing ACPI and UEFI runtime services to guests which need them. (The UEFI blob finds out about its hardware by looking at a device tree that QEMU passes it, but that's a detail between QEMU and its bios blob). This pretty much looks like what x86 QEMU used to do with ACPI for a very long time, so we know it's a feasible approach.
Quoted 7 lines
Hi Peter,
The rational in the proposed approach is meant for cases where the user does not want to rely on external firmware layers. While UEFI could do what you are describing, the point is to avoid this not so trivial overhead in the booting process. Especially in the case of thin guests, where another software dependency is undesired.
I'm not sure how you plan to use ACPI without UEFI, as there are several pieces of information which ACPI misses, such as the memory map, which must be discovered from UEFI. How do you intend to discover the memory map without UEFI?
Additionally, with Linux and other generic OSs, the expectation is that the ACPI tables are discovered via the UEFI system table. How do you intend to discover the ACPI tables? Or other system information?
From experience with Linux, querying this information from UEFI is a trivial overhead, though a UEFI implementation might take a while to boot to the point where that is possible. It would be more generally helpful to have an optimized virtualised UEFI for this case (or perhaps just a UEFI frontend that presents the same interface to EFI applications but doesn't have to do any heavy lifting at boot).
So far the general trend with AArch64 at the system level is to use generic interfaces as far as possible. The generic interface for discovering ACPI tables is to boot as an EFI application and then to query the tables from UEFI. That is the interface others are likely to follow, and ACPI without UEFI is unlikely to be of much use to anyone else.
Quoted 7 lines
Why is it worth expending the effort on the boot protocol you suggest (which so far is not well defined) when there is already a portable, well-defined standard that others are already following?
Thanks,
Mark.
Quoted 7 lines
Hi,
I tend to mostly agree with this, we might look for alternative solutions for speeding up guest startup in the future but in general if getting ACPI in the guest for ARM64 requires also getting UEFI, then I can personally live with that, especially if we strive to have the kind of optimized virtualized UEFI you mention.
Given that UEFI will be required for other guests (e.g. if you want to boot a distribution's ISO image), I hope that virtualised UEFI will see some optimisation work.
Quoted 9 lines
We can in the meantime use these patches to test the "fast path" to the guest by just hardcoding or passing on the command line what is needed to be able to test information reading from ACPI from the guest side.
I cc: my colleagues Jani and Paul which have more the use case in mind and
might correct me there.
Quoted 5 lines
For x86 though what is the state of UEFI in QEMU? Is it relying on the OVMF project to provide the firmware images if I understand correctly..
How is it working out in practice?
Should the same kind of approach be taken for ARM64?
I'm unfortunately not familiar enough with OVMF to answer any of these questions.
Quoted 7 lines
As mentioned by others, I'd rather see an implementation of ACPI in QEMU which learns from the experience of X86 (and possibly shares some code if possible), rather than going in a different direction by creating device trees first, and then converting them to ACPI tables somewhere in the firmware, just because device trees are "already there", for the reasons which have already been mentioned before by Igor and others.
For the features which ACPI provides which device trees do not (e.g. the dynamic addition and removal of memory and CPUs), there will need to be some sort of interface between QEMU and the ACPI implementation. That's already outside of the realm of DT, so as previously mentioned a simple conversion doesn't cover the general case.
For most static things, device tree should be suitable as-is (i.e. without translation to ACPI) for all currently supported guests.
I think any ACPI implemenation for a hypervisor should provide a demonstrable useful feature (e.g. hot-add of CPUs) before merging so we know the infrastructure is suitable.
Quoted 4 lines
I wouldn't want for ACPI to be "sort of" supported in QEMU, but with a limited functionality which makes it not fully useful in practice. I'd rather see it as a first class citizen instead, including the ability to run AML code.
I agree that there's no point in having ACPI in a guest unless it provides something which dt does not. I don't know how it should be structured to provide those useful features.
Thanks,
Mark.
Quoted 9 lines · On Wednesday 12 November 2014 10:56:40 Mark Rutland wrote:
Quoted 7 lines · Claudio Fontana
On 11.11.2014 16:29, Mark Rutland wrote:
I tend to mostly agree with this, we might look for alternative solutions for speeding up guest startup in the future but in general if getting ACPI in the guest for ARM64 requires also getting UEFI, then I can personally live with that, especially if we strive to have the kind of optimized virtualized UEFI you mention.
Quoted 3 lines
Given that UEFI will be required for other guests (e.g. if you want to boot a distribution's ISO image), I hope that virtualised UEFI will see some optimisation work.
I think the requirement it just for KVM to provide something that behaves exactly like UEFI, it doesn't have to be the full Tianocore implementation if it's easier to reimplement the boot interface.
Quoted 8 lines
Quoted 7 lines
As mentioned by others, I'd rather see an implementation of ACPI in QEMU which learns from the experience of X86 (and possibly shares some code if possible), rather than going in a different direction by creating device trees first, and then converting them to ACPI tables somewhere in the firmware, just because device trees are "already there", for the reasons which have already been mentioned before by Igor and others.
Quoted 5 lines
For the features which ACPI provides which device trees do not (e.g. the dynamic addition and removal of memory and CPUs), there will need to be some sort of interface between QEMU and the ACPI implementation. That's already outside of the realm of DT, so as previously mentioned a simple conversion doesn't cover the general case.
I think we need to support the low-level interfaces in the kernel for this anyway, we should not have to use ACPI just to do memory and CPU hotplugging in KVM, that would be silly. If ACPI is present, it can provide a wrapper for the same interface, but KVM should not need to be aware of the fact that ACPI is used in the guest, after it has passed the initial ACPI blob to the kernel.
Quoted 4 lines
I think any ACPI implemenation for a hypervisor should provide a demonstrable useful feature (e.g. hot-add of CPUs) before merging so we know the infrastructure is suitable.
Quoted 8 lines
Quoted 4 lines
I wouldn't want for ACPI to be "sort of" supported in QEMU, but with a limited functionality which makes it not fully useful in practice. I'd rather see it as a first class citizen instead, including the ability to run AML code.
I agree that there's no point in having ACPI in a guest unless it provides something which dt does not. I don't know how it should be structured to provide those useful features.
I see it the opposite way: we shouldn't have to use ACPI just to make use of some feature in Linux, the only reason why you'd want ACPI support in KVM is to be able to run Windows. It makes sense for the ACPI implementation to be compatible with the Linux ACPI code as well so we can test it better.
Arnd
Quoted 10 lines · Arnd Bergmann
Quoted 9 lines · On Wednesday 12 November 2014 10:56:40 Mark Rutland wrote:
Quoted 7 lines · Claudio Fontana
On 11.11.2014 16:29, Mark Rutland wrote:
I tend to mostly agree with this, we might look for alternative solutions for speeding up guest startup in the future but in general if getting ACPI in the guest for ARM64 requires also getting UEFI, then I can personally live with that, especially if we strive to have the kind of optimized virtualized UEFI you mention.
Quoted 7 lines
Quoted 3 lines
Given that UEFI will be required for other guests (e.g. if you want to boot a distribution's ISO image), I hope that virtualised UEFI will see some optimisation work.
I think the requirement it just for KVM to provide something that behaves exactly like UEFI, it doesn't have to be the full Tianocore implementation if it's easier to reimplement the boot interface.
We already have a port of Tinaocode that works for virt, but yes, implementing something ligther is certainly possible.
Quoted 15 lines
Quoted 9 lines
Quoted 8 lines
As mentioned by others, I'd rather see an implementation of ACPI in QEMU which learns from the experience of X86 (and possibly shares some code if possible), rather than going in a different direction by creating device trees first, and then converting them to ACPI tables somewhere in the firmware, just because device trees are "already there", for the reasons which have already been mentioned before by Igor and others.
Quoted 5 lines
For the features which ACPI provides which device trees do not (e.g. the dynamic addition and removal of memory and CPUs), there will need to be some sort of interface between QEMU and the ACPI implementation. That's already outside of the realm of DT, so as previously mentioned a simple conversion doesn't cover the general case.
Quoted 3 lines
I think we need to support the low-level interfaces in the kernel for this anyway, we should not have to use ACPI just to do memory and CPU hotplugging in KVM, that would be silly.
I had that same intuitive feeling, but lacked good tecnical arguments for it. Care to elaborate on that?
Quoted 5 lines
If ACPI is present, it can
provide a wrapper for the same interface, but KVM should not need to be aware of the fact that ACPI is used in the guest, after it has passed the initial ACPI blob to the kernel.
That's where things begin to be a bit foggy for me. AFAIU ACPI already has a method for doing this and I speculate that there is some IRQ assigned to an ACPI event that causes some AML code to be interpreted by your OS. Wouldn't it be a matter of QEMU putting the right AML table fragments in place to wire this up then?
-Christoffer
Quoted 1 line · Christoffer Dall
AFAIU ACPI already has a method for doing this
It's not defined in the spec. QEMU defines a bunch of registers to do that, and provides AML that works with those registers.
While these registers can be separated from the ACPI code in QEMU...
Quoted 3 lines
and I speculate that there is some IRQ
assigned to an ACPI event that causes some AML code to be interpreted by your OS.
... QEMU does exactly this, it uses the "general purpose event" (GPE) mechanism to trigger the parsing of the AML. When you hot-plug/unplug a CPU or memory, an SCI (system control interrupt - the ACPI IRQ) is triggered in the guest and that's not entirely disconnected from ACPI.
Perhaps you could treat it as a shared level-triggered interrupt in DT?
I don't know.
Quoted 2 lines
Wouldn't it be a matter of QEMU putting the right AML table fragments in place to wire this up then?
Yes.
Paolo
Quoted 6 lines · Paolo Bonzini
Quoted 1 line · Christoffer Dall
AFAIU ACPI already has a method for doing this
It's not defined in the spec. QEMU defines a bunch of registers to do that, and provides AML that works with those registers.
Huh? SCI + AML is the method, and that's defined by the spec.
The registers the AML pokes are an implementation detail abstracted by the AML, and as such are irrelevant to the spec.
Quoted 6 lines
While these registers can be separated from the ACPI code in QEMU...
Quoted 3 lines
and I speculate that there is some IRQ
assigned to an ACPI event that causes some AML code to be interpreted by your OS.
Quoted 7 lines
... QEMU does exactly this, it uses the "general purpose event" (GPE) mechanism to trigger the parsing of the AML. When you hot-plug/unplug a CPU or memory, an SCI (system control interrupt - the ACPI IRQ) is triggered in the guest and that's not entirely disconnected from ACPI.
Perhaps you could treat it as a shared level-triggered interrupt in DT?
I don't know.
Putting an interrupt in DT is trivial. The hard part is the rest of the interface, which so far there is no specification for.
Thanks,
Mark.
Quoted 9 lines · Mark Rutland
Quoted 6 lines · Paolo Bonzini
Quoted 1 line · Christoffer Dall
AFAIU ACPI already has a method for doing this
It's not defined in the spec. QEMU defines a bunch of registers to do that, and provides AML that works with those registers.
Huh? SCI + AML is the method, and that's defined by the spec.
I thought Christoffer meant a method to do the actual hotplug, not just to signal events. If you want to "support the low-level interfaces in the kernel for this anyway", you certainly need to know the details underneath the AML.
Quoted 5 lines
Quoted 2 lines
Perhaps you could treat it as a shared level-triggered interrupt in DT?
I don't know.Putting an interrupt in DT is trivial. The hard part is the rest of the interface, which so far there is no specification for.
Have you looked at docs/specs/acpi_{cpu,mem}_hotplug.txt? Writing a DT binding for it is trivial too. Or are we talking about two different things?
Paolo
Quoted 11 lines · Paolo Bonzini
Quoted 8 lines · Mark Rutland
Quoted 6 lines · Paolo Bonzini
Quoted 1 line · Christoffer Dall
AFAIU ACPI already has a method for doing this
It's not defined in the spec. QEMU defines a bunch of registers to do that, and provides AML that works with those registers.
Quoted 7 lines
Quoted 1 line
Huh? SCI + AML is the method, and that's defined by the spec.
I thought Christoffer meant a method to do the actual hotplug, not just to signal events. If you want to "support the low-level interfaces in the kernel for this anyway", you certainly need to know the details underneath the AML.
I was being deliberately vague, because I don't know how this works (I did use the word speculate, didn't I?).
But yes, one of the reasons why I would argue that we're not in a hurry to accept these patches is that we don't know how the actual underlying mechanisms to do the things we want ACPI to facilitate (e.g. cpu and memory hotplug) really work, and thus we cannot verify the implementation or benefit directly from it today.
-Christoffer
Quoted 11 lines · On Wednesday 12 November 2014 13:27:14 Paolo Bonzini wrote:
Quoted 6 lines · Mark Rutland
Quoted 2 lines · Paolo Bonzini
Perhaps you could treat it as a shared level-triggered interrupt in DT?
I don't know.Putting an interrupt in DT is trivial. The hard part is the rest of the interface, which so far there is no specification for.
Have you looked at
docs/specs/acpi_{cpu,mem}_hotplug.txt? Writing a DT binding for it is trivial too. Or are we talking about two different things?
Interesting. I agree that doing a DT binding for these will be trivial, and the implementation in Linux should also be straightforward, thanks for pointing these out.
However, it seems that the implementation that qemu uses is incompatible with ARM64, since GPE is not part of the ACPI hardware reduced mode.
Arnd
Quoted 7 lines · Arnd Bergmann
Quoted 6 lines
Quoted 2 lines
Putting an interrupt in DT is trivial. The hard part is the rest of the interface, which so far there is no specification for.
Have you looked at
docs/specs/acpi_{cpu,mem}_hotplug.txt? Writing a DT binding for it is trivial too. Or are we talking about two different things?
Quoted 6 lines
Interesting. I agree that doing a DT binding for these will be trivial, and the implementation in Linux should also be straightforward, thanks for pointing these out.
However, it seems that the implementation that qemu uses is incompatible with ARM64, since GPE is not part of the ACPI hardware reduced mode.
That makes it even simpler because you do not have to use SCI.
-M virt currently doesn't have a GPIO controller, but it's easy to add a PL061 and specify a random GPIO pin in the DT bindings. Then you can use GPIO-signaled ACPI events in the AML, just move _Lxx methods move from \_GPE to \_SB.GPIO under the GPIO controller.
Paolo
Quoted 11 lines · Paolo Bonzini
Quoted 8 lines · Mark Rutland
Quoted 6 lines · Paolo Bonzini
Quoted 1 line · Christoffer Dall
AFAIU ACPI already has a method for doing this
It's not defined in the spec. QEMU defines a bunch of registers to do that, and provides AML that works with those registers.
Quoted 6 lines
Quoted 1 line
Huh? SCI + AML is the method, and that's defined by the spec.
I thought Christoffer meant a method to do the actual hotplug, not just to signal events. If you want to "support the low-level interfaces in the kernel for this anyway", you certainly need to know the details underneath the AML.
I think when Christoffer said that ACPI already had a mechanism he was referring to the SCI + AML, as opposed to the underlying implementation.
Quoted 9 lines
Quoted 5 lines
Quoted 2 lines
Perhaps you could treat it as a shared level-triggered interrupt in DT?
I don't know.Putting an interrupt in DT is trivial. The hard part is the rest of the interface, which so far there is no specification for.
Have you looked at
docs/specs/acpi_{cpu,mem}_hotplug.txt? Writing a DT binding for it is trivial too. Or are we talking about two different things?
Writing a binding for the partiuclar device might be trivial. How this would fit with the DT model is more complicated, and needs to be specified. As far as I can see, those documents are quite strongly tied to x86 ACPI (they talk in terms of OSPM, OST, GPE, APIC IDs).
I agree that we could do CPU and memory hotplug without ACPI, but we need to specify the full firmware interface for doing so, and how this interacts with the initial DTB if using DT. We can't just pick-and-mix portions of ACPI and state that it's specified and standard.
Thanks,
Mark.
Quoted 4 lines · Mark Rutland
Writing a binding for the partiuclar device might be trivial. How this would fit with the DT model is more complicated, and needs to be specified. As far as I can see, those documents are quite strongly tied to x86 ACPI (they talk in terms of OSPM, OST, GPE, APIC IDs).
OSPM -> replace with kernel driver
OST -> used to generate events, doesn't need to be implemented in the
kernel driver. Or just define the meaning based on the ACPI _OST spec.
GPE -> replace with GPIO
APIC ID -> replace with whatever id ARM CPUs have
Quoted 3 lines
I agree that we could do CPU and memory hotplug without ACPI, but we need to specify the full firmware interface for doing so, and how this interacts with the initial DTB if using DT.
The initial DTB has to expose the IDs for hotpluggable CPUs and the range for hotpluggable memory. In the ACPI case this goes in the SRAT.
But none of this is insurmountable.
Quoted 2 lines
We can't just pick-and-mix
portions of ACPI and state that it's specified and standard.
But that's what you already do if you want to build ACPI tables from DT.
You are already picking-and-mixing the variable portions of the ACPI
tables and make a DT bindings for them.
All that's left is to de-x86ify the existing spec (which is really easy), and to figure out a DT binding for it. It's really not unlike any other MMIO device.
Paolo
Quoted 15 lines · Paolo Bonzini
Quoted 4 lines · Mark Rutland
Writing a binding for the partiuclar device might be trivial. How this would fit with the DT model is more complicated, and needs to be specified. As far as I can see, those documents are quite strongly tied to x86 ACPI (they talk in terms of OSPM, OST, GPE, APIC IDs).
OSPM -> replace with kernel driver
OST -> used to generate events, doesn't need to be implemented in the
kernel driver. Or just define the meaning based on the ACPI_OSTspec.
GPE -> replace with GPIO
APIC ID -> replace with whatever id ARM CPUs have
Quoted 7 lines
Quoted 3 lines
I agree that we could do CPU and memory hotplug without ACPI, but we need to specify the full firmware interface for doing so, and how this interacts with the initial DTB if using DT.
The initial DTB has to expose the IDs for hotpluggable CPUs and the range for hotpluggable memory. In the ACPI case this goes in the SRAT.
But none of this is insurmountable.
My only point is that it needs to be defined, not that this definition is impossible. That does trickle into a few places -- we currently have no way of defining a CPU in DT which is possible but not present, for example (the status property historically means something different per ePAPR).
Quoted 6 lines
Quoted 2 lines
We can't just pick-and-mix
portions of ACPI and state that it's specified and standard.But that's what you already do if you want to build ACPI tables from DT.
You are already picking-and-mixing the variable portions of the ACPI
tables and make a DT bindings for them.
I don't follow. I argued _against_ trying to build ACPI tables from DT because the two don't quite match up anyway. I argued _against_ trying to convert ACPI tables to DT in prior discussions for similar reasons.
Quoted 3 lines
All that's left is to de-x86ify the existing spec (which is really easy), and to figure out a DT binding for it. It's really not unlike any other MMIO device.
In addition to fixing up the other specs which are affected by this (e.g. how we describe those additional CPUs). There's also some de-ACPIing to be done in addition to de-x86ification, and we need to be careful to ensure we have access to all the information we require in the absence of ACPI, and that we have a well defined behaviour on both sides of the interface for what would previously have been implicit in ACPI.
I'm not saying that this is impossible. It's just a greater body of work than modifying one spec.
Thanks,
Mark.
Quoted 10 lines · Mark Rutland
Quoted 6 lines
Quoted 2 lines
We can't just pick-and-mix
portions of ACPI and state that it's specified and standard.But that's what you already do if you want to build ACPI tables from DT.
You are already picking-and-mixing the variable portions of the ACPI
tables and make a DT bindings for them.I don't follow. I argued _against_ trying to build ACPI tables from DT because the two don't quite match up anyway. I argued _against_ trying to convert ACPI tables to DT in prior discussions for similar reasons.
Sorry, that was not you-Mark, but more you-ARM.
And in fact I'd tend to agree with you, but if there are people that want not to use ACPI or UEFI or both, I think it's better if the UEFI firmware swallows the same pill and builds ACPI from DT.
Quoted 7 lines
In addition to fixing up the other specs which are affected by this (e.g. how we describe those additional CPUs). There's also some de-ACPIing to be done in addition to de-x86ification, and we need to be careful to ensure we have access to all the information we require in the absence of ACPI, and that we have a well defined behaviour on both sides of the interface for what would previously have been implicit in ACPI.
Yes, I agree. On the QEMU side the de-ACPIfication would have to be done anyway (no GPE because of the reduced hardware), but you need extra de-ACPIfication for stuff like the SRAT.
Quoted 2 lines
I'm not saying that this is impossible. It's just a greater body of work than modifying one spec.
No doubt about that.
Paolo
Quoted 9 lines · On Wednesday 12 November 2014 12:34:01 Christoffer Dall wrote:
Quoted 8 lines · Arnd Bergmann
Quoted 6 lines · On Wednesday 12 November 2014 10:56:40 Mark Rutland wrote:
For the features which ACPI provides which device trees do not (e.g. the dynamic addition and removal of memory and CPUs), there will need to be some sort of interface between QEMU and the ACPI implementation. That's already outside of the realm of DT, so as previously mentioned a simple conversion doesn't cover the general case.
Quoted 6 lines
Quoted 3 lines
I think we need to support the low-level interfaces in the kernel for this anyway, we should not have to use ACPI just to do memory and CPU hotplugging in KVM, that would be silly.
I had that same intuitive feeling, but lacked good tecnical arguments for it. Care to elaborate on that?
ACPI always has to interface back to the hypervisor to do anything that changes the hardware configuration, so it essentially has to perform a hypercall or touch some virtual register.
If we need to architect that interface in qemu anyway, we should make it sane enough for the kernel to use directly, without having to go through ACPI, as not everyone will want to run ACPI.
Quoted 10 lines
Quoted 4 lines
If ACPI is present, it can
provide a wrapper for the same interface, but KVM should not need to be aware of the fact that ACPI is used in the guest, after it has passed the initial ACPI blob to the kernel.That's where things begin to be a bit foggy for me. AFAIU ACPI already has a method for doing this and I speculate that there is some IRQ assigned to an ACPI event that causes some AML code to be interpreted by your OS. Wouldn't it be a matter of QEMU putting the right AML table fragments in place to wire this up then?
Yes, that is what I meant with a wrapper. The two choices are:
1. have an interrupt and a hypercall or mmio interface. When the interrupt gets triggered, we ask the interface what happened and do something on the same interface depending on the state of the system.
2. have an interrupt that causes AML code to be run, that code will use the hypercall or mmio interface to find out what happened and create an ACPI event. This event is enqueued to the generic ACPI hotplug handler, which depending on the state of the system decides to do something by calling into AML code again, which will trigger the underlying interface.
Quoted 1 line
From qemu's point of view, the two are doing exactly the same thing,
except that the MMIO access can be hidden in AML so the OS doesn't have to know the interface. Note that in case of Xen, the use of hypercalls means that the OS has to know the interface after all, so the second half of the process is handled by drivers/xen/xen-acpi-*hotplug.c.
Note how the implementation that uses the ACPI wrapper is much more complex than the native one that does the same thing:
-rw-r--r-- 1 arnd arnd 2119 Nov 10 16:43 drivers/xen/cpu_hotplug.c -rw-r--r-- 1 arnd arnd 10987 Nov 10 16:43 drivers/xen/xen-acpi-cpuhotplug.c
-rw-r--r-- 1 arnd arnd 6894 Nov 10 16:43 drivers/xen/xen-balloon.c -rw-r--r-- 1 arnd arnd 12085 Nov 10 16:43 drivers/xen/xen-acpi-memhotplug.c
Arnd
Quoted 17 lines · Arnd Bergmann
Quoted 9 lines · On Wednesday 12 November 2014 12:34:01 Christoffer Dall wrote:
Quoted 8 lines · Arnd Bergmann
Quoted 6 lines · On Wednesday 12 November 2014 10:56:40 Mark Rutland wrote:
For the features which ACPI provides which device trees do not (e.g. the dynamic addition and removal of memory and CPUs), there will need to be some sort of interface between QEMU and the ACPI implementation. That's already outside of the realm of DT, so as previously mentioned a simple conversion doesn't cover the general case.
Quoted 6 lines
Quoted 3 lines
I think we need to support the low-level interfaces in the kernel for this anyway, we should not have to use ACPI just to do memory and CPU hotplugging in KVM, that would be silly.
I had that same intuitive feeling, but lacked good tecnical arguments for it. Care to elaborate on that?
Quoted 8 lines
ACPI always has to interface back to the hypervisor to do anything that changes the hardware configuration, so it essentially has to perform a hypercall or touch some virtual register.
If we need to architect that interface in qemu anyway, we should make it sane enough for the kernel to use directly, without having to go through ACPI, as not everyone will want to run ACPI.
With the usual benefits of doing it in ACPI will not require updates on both sides if we need to fix something, but also the usual downside of having something obscure and pseduo-hidden, which may be broken underneath, I suppose.
Quoted 25 lines
Quoted 10 lines
Quoted 4 lines
If ACPI is present, it can
provide a wrapper for the same interface, but KVM should not need to be aware of the fact that ACPI is used in the guest, after it has passed the initial ACPI blob to the kernel.That's where things begin to be a bit foggy for me. AFAIU ACPI already has a method for doing this and I speculate that there is some IRQ assigned to an ACPI event that causes some AML code to be interpreted by your OS. Wouldn't it be a matter of QEMU putting the right AML table fragments in place to wire this up then?
Yes, that is what I meant with a wrapper. The two choices are:
1. have an interrupt and a hypercall or mmio interface. When the interrupt gets triggered, we ask the interface what happened and do something on the same interface depending on the state of the system.
2. have an interrupt that causes AML code to be run, that code will use the hypercall or mmio interface to find out what happened and create an ACPI event. This event is enqueued to the generic ACPI hotplug handler, which depending on the state of the system decides to do something by calling into AML code again, which will trigger the underlying interface.
Quoted 3 lines
From qemu's point of view, the two are doing exactly the same thing, except that the MMIO access can be hidden in AML so the OS doesn't have to know the interface.
right, thanks for the explanation.
Review
Quoted 13 lines
Note that in case of Xen, the use of hypercalls
means that the OS has to know the interface after all, so the second half of the process is handled bydrivers/xen/xen-acpi-*hotplug.c.Note how the implementation that uses the ACPI wrapper is much more complex than the native one that does the same thing:
(quoted diff) +0
-4-rw-r--r-- 1 arnd arnd 2119 Nov 10 16:43 drivers/xen/cpu_hotplug.c -rw-r--r-- 1 arnd arnd 10987 Nov 10 16:43 drivers/xen/xen-acpi-cpuhotplug.c -rw-r--r-- 1 arnd arnd 6894 Nov 10 16:43 drivers/xen/xen-balloon.c -rw-r--r-- 1 arnd arnd 12085 Nov 10 16:43 drivers/xen/xen-acpi-memhotplug.c
Interesting.
-Christoffer
Quoted 10 lines · Arnd Bergmann
Quoted 9 lines · On Wednesday 12 November 2014 10:56:40 Mark Rutland wrote:
Quoted 7 lines · Claudio Fontana
On 11.11.2014 16:29, Mark Rutland wrote:
I tend to mostly agree with this, we might look for alternative solutions for speeding up guest startup in the future but in general if getting ACPI in the guest for ARM64 requires also getting UEFI, then I can personally live with that, especially if we strive to have the kind of optimized virtualized UEFI you mention.
Quoted 7 lines
Quoted 3 lines
Given that UEFI will be required for other guests (e.g. if you want to boot a distribution's ISO image), I hope that virtualised UEFI will see some optimisation work.
I think the requirement it just for KVM to provide something that behaves exactly like UEFI, it doesn't have to be the full Tianocore implementation if it's easier to reimplement the boot interface.
I agree that we don't need a full Tianocore, but whatever we have must implement the minimal interface UEFI requires (which is more than just the boot interface).
For a "boot this EFI application" workflow you can skip most of the BDS stuff, but you still need boot services and runtime services provided to the application.
Quoted 14 lines
Quoted 8 lines
Quoted 7 lines
As mentioned by others, I'd rather see an implementation of ACPI in QEMU which learns from the experience of X86 (and possibly shares some code if possible), rather than going in a different direction by creating device trees first, and then converting them to ACPI tables somewhere in the firmware, just because device trees are "already there", for the reasons which have already been mentioned before by Igor and others.
Quoted 5 lines
For the features which ACPI provides which device trees do not (e.g. the dynamic addition and removal of memory and CPUs), there will need to be some sort of interface between QEMU and the ACPI implementation. That's already outside of the realm of DT, so as previously mentioned a simple conversion doesn't cover the general case.
Quoted 6 lines
I think we need to support the low-level interfaces in the kernel for this anyway, we should not have to use ACPI just to do memory and CPU hotplugging in KVM, that would be silly. If ACPI is present, it can provide a wrapper for the same interface, but KVM should not need to be aware of the fact that ACPI is used in the guest, after it has passed the initial ACPI blob to the kernel.
The difficulty here is that there is currently no common low-level interface between the guest and any specific hypervisor for these facilities. This would be up to kvm tool or QEMU, not KVM itself. So we'd have to spec one for !ACPI.
With ACPI, the interface should be common (following the ACPI spec), but we don't have a common interface underlying that.
I am not averse to having mechanisms for !ACPI, but we'd need to spec something.
Quoted 13 lines
Quoted 4 lines
I think any ACPI implemenation for a hypervisor should provide a demonstrable useful feature (e.g. hot-add of CPUs) before merging so we know the infrastructure is suitable.
Quoted 8 lines
Quoted 4 lines
I wouldn't want for ACPI to be "sort of" supported in QEMU, but with a limited functionality which makes it not fully useful in practice. I'd rather see it as a first class citizen instead, including the ability to run AML code.
I agree that there's no point in having ACPI in a guest unless it provides something which dt does not. I don't know how it should be structured to provide those useful features.
Quoted 5 lines
I see it the opposite way: we shouldn't have to use ACPI just to make use of some feature in Linux, the only reason why you'd want ACPI support in KVM is to be able to run Windows. It makes sense for the ACPI implementation to be compatible with the Linux ACPI code as well so we can test it better.
At the moment, ACPI specifies how these features should work. So without inventing a whole new interface, ACPI is the way of providing those features.
Thanks,
Mark.
Quoted 6 lines · Claudio Fontana
As mentioned by others, I'd rather see an implementation of ACPI in QEMU which learns from the experience of X86 (and possibly shares some code if possible), rather than going in a different direction by creating device trees first, and then converting them to ACPI tables somewhere in the firmware, just because device trees are "already there", for the reasons which have already been mentioned before by Igor and others.
I think the motivation for "leave ACPI entirely to the firmware" is not just that the device trees are already there, but because it allows for a cleaner separation of concerns between QEMU and the firmware and thus makes QEMU simpler and easier to maintain in future. However as a result of the discussion in this thread and on IRC about what x86 QEMU/OVMF do and what the complexities of handling this in UEFI are, I'm not as sure as I was that it's actually feasible in practice.
I agree with you that if we have QEMU generating ACPI information itself then we should definitely follow the existing tested approach that x86 QEMU+OVMF have, and share code, both in QEMU and in the UEFI firmware. (As I understand it there is a common source code base between OVMF and the Tianocore code we're using for the ARM QEMU UEFI firmware. I've probably got the project names wrong here; I'm not familiar with the distinctions between Tianocore, EDK2, OVMF, etc.)
The x86 QEMU-generating-APCI approach is more complicated than what this RFC patchset does, since it generates various separate tables and hands them individually to the firmware, rather than creating a single (non-relocatable) complete ACPI blob. I would hope we didn't need to support both "provide separated tables to firmware" and "provide a single blob to a standalone guest kernel"; if we're agreed that ACPI should imply UEFI we can forget about the latter, though.
thanks
-- PMM
Quoted 26 lines · Peter Maydell
Quoted 6 lines · Claudio Fontana
As mentioned by others, I'd rather see an implementation of ACPI in QEMU which learns from the experience of X86 (and possibly shares some code if possible), rather than going in a different direction by creating device trees first, and then converting them to ACPI tables somewhere in the firmware, just because device trees are "already there", for the reasons which have already been mentioned before by Igor and others.
I think the motivation for "leave ACPI entirely to the firmware" is not just that the device trees are already there, but because it allows for a cleaner separation of concerns between QEMU and the firmware and thus makes QEMU simpler and easier to maintain in future. However as a result of the discussion in this thread and on IRC about what x86 QEMU/OVMF do and what the complexities of handling this in UEFI are, I'm not as sure as I was that it's actually feasible in practice.
I agree with you that if we have QEMU generating ACPI information itself then we should definitely follow the existing tested approach that x86 QEMU+OVMF have, and share code, both in QEMU and in the UEFI firmware. (As I understand it there is a common source code base between OVMF and the Tianocore code we're using for the ARM QEMU UEFI firmware. I've probably got the project names wrong here; I'm not familiar with the distinctions between Tianocore, EDK2, OVMF, etc.)
Quoted 2 lines
The x86 QEMU-generating-APCI approach is more complicated than what this RFC patchset does,
I think that the RFC was useful in its goal, as it generated a lot of comments, and we will also be using it to do some internal early tests with ACPI on the guest to speed up development.
I agree with you that as a result of this discussion, the solution for QEMU upstreaming purposes needs to take everything discussed (possibly more) into account.
Quoted 8 lines
since it generates various separate
tables and hands them individually to the firmware, rather than creating a single (non-relocatable) complete ACPI blob. I would hope we didn't need to support both "provide separated tables to firmware" and "provide a single blob to a standalone guest kernel"; if we're agreed that ACPI should imply UEFI we can forget about the latter, though.
As I mentioned I am personally fine with the ACPI -> UEFI implication, also Paul (who represents my employer here) mentioned that we can live with this implication if we have to.
The hope is to try to keep what needs to be implemented under control, as to have as small an impact on boot time as possible, while still complying to the specifications.
Thanks,
Claudio
Quoted 3 lines · Claudio Fontana
I agree with you that as a result of this discussion, the solution for QEMU upstreaming purposes needs to take everything discussed (possibly more) into account.
(Picking this email as a reasonable if slightly arbitrary place to try to summarise this discussion thread...)
Everybody agrees that we need to support guests that want to use ACPI. There are several possible approaches to this that have been proposed:
1. all-in-QEMU: generate a complete single ACPI table in QEMU and pass it to the guest and/or firmware, as this RFC does
2. all-in-UEFI: don't do any ACPI table generation in QEMU; just create a device tree (and some standardised interfaces for hotplugging, etc), and let the UEFI firmware put together the ACPI tables accordingly
3. mixed-mode: follow the x86/QEMU practice, and have QEMU generate a set of ACPI table fragments, which UEFI then has to stitch together in combination with any extras it wants to add itself before passing the result to the guest. [Some of these fragments might need to be generated on-demand and supplied via a fw_cfg-like conduit device; this is necessary on x86 and might be also for ARM.]
My opinion about the best approach has swung all over the place during the course of this discussion, but at the moment I think mixed-mode is the way to go.
The most common use case for ACPI is going to be with UEFI, and I'm told that the details of Tianocore and the ACPI binary format mean that it's not possible for UEFI to edit a complete ACPI blob to add any extra items it needs to, so for this use case the all-in-QEMU approach won't work. We could in theory support all-in-QEMU as an extra boot protocol for directly booting a guest that used ACPI without UEFI, alongside one of the other two methods, but I'm pretty reluctant to support multiple ways of constructing the ACPI tables and I think we have agreement that we don't need to do that. That means we can drop 'all-in-QEMU' from consideration and concentrate on the other two options.
The all-in-UEFI approach is potentially workable, and from a QEMU maintainer's perspective it has the attraction of a clean
separation: QEMU only has to describe hardware in one way, and all the ACPI related code is in the firmware. However it also has some definite demerits:
* we'd need code in UEFI to create ACPI tables based on the device tree information, which is at minimum code that nobody's written yet, and could be difficult even given the restriction that it only has to cope with the particular subset of dtb that QEMU generates
* adding support for something like "hotplug-$FOO" needs changes in QEMU and also in UEFI, even if UEFI would otherwise not need to care about the hotplugging, because it has to translate the relevant dtb entries into ACPI
* we would need to specify and define dt bindings for any (virtual) hardware used for notifying and controlling hotplug type features rather than these being an implementation detail of QEMU (though we might want to define these anyway so that you can use hotplug etc from a non-ACPI non-UEFI guest, of course)
Going with mixed-mode does mean we end up with a sort of triplication of code (once to create the board model, once to describe it in DT and once to describe it in ACPI), but the payoff is that we get to handle ACPI the same way as we do on x86, which includes a lot of preexisting code both in QEMU and in UEFI. We also don't need to update the UEFI code when we add new hotplug features.
Does anybody have an approach that I've missed from my list of three, or any advantages/disadvantages to add that might tilt the decision in a different direction?
thanks
-- PMM
Quoted 33 lines · Mark Rutland
Quoted 23 lines · Peter Maydell
Quoted 12 lines · Alexander Spyridakis
Currently, the virt machine model generates Device Tree information dynamically based on the existing devices in the system. This patch series extends the same concept but for ACPI information instead. A total of seven tables have been implemented in this patch series, which is the minimum for a basic ARM support.
The set of generated tables are:
- RSDP
- XSDT
- MADT
- GTDT
- FADT
- FACS
- DSDTQuoted 6 lines
The tables are created in standalone buffers, taking into account the needed information passed from the virt machine model. When the generation is finalized, the individual buffers are compacted to a single ACPI binary blob, where it is injected on the guest memory space in a fixed location. The guest kernel can find the ACPI tables by providing to it the physical address of the ACPI blob (e.g. acpi_rsdp=0x47000000 boot argument).
(Sorry, I should have waited for the cover letter to arrive before replying.)
Quoted 8 lines
I think this is definitely the wrong approach. We already have to generate device tree information for the hardware we have, and having an equivalent parallel infrastructure for generating ACPI as well seems like it would be a tremendous mess. We should support guests that require ACPI by having QEMU boot a UEFI bios blob and have that UEFI code generate ACPI tables based on the DTB we hand it. (Chances seem good that any guest that wants ACPI is going to want UEFI runtime services anyway.)
Quoted 3 lines
Depending on why people want ACPI in a guest environment, generating ACPI tables from a DTB might not be possible (e.g. if they want to use AML for some reason).
Agreed.
Quoted 5 lines
So the important question is _why_ the guest needs to see an ACPI environment. What exactly can ACPI provide to the guest that DT does not already provide, and why is that necessary? What infrastrucutre is needed for that use case?
There is important feature called system device dynamic reconfiguration, you know, hot-add/remove, if a gust need more/less memory or CPU, can we add or remove them dynamically with DT? ACPI can do this, but I have no idea if DT can. (Sorry, I don't know much about DT)
Thanks
Hanjun
Quoted 46 lines · Hanjun Guo
Quoted 33 lines · Mark Rutland
Quoted 23 lines · Peter Maydell
Quoted 12 lines · Alexander Spyridakis
Currently, the virt machine model generates Device Tree information dynamically based on the existing devices in the system. This patch series extends the same concept but for ACPI information instead. A total of seven tables have been implemented in this patch series, which is the minimum for a basic ARM support.
The set of generated tables are:
- RSDP
- XSDT
- MADT
- GTDT
- FADT
- FACS
- DSDTQuoted 6 lines
The tables are created in standalone buffers, taking into account the needed information passed from the virt machine model. When the generation is finalized, the individual buffers are compacted to a single ACPI binary blob, where it is injected on the guest memory space in a fixed location. The guest kernel can find the ACPI tables by providing to it the physical address of the ACPI blob (e.g. acpi_rsdp=0x47000000 boot argument).
(Sorry, I should have waited for the cover letter to arrive before replying.)
Quoted 8 lines
I think this is definitely the wrong approach. We already have to generate device tree information for the hardware we have, and having an equivalent parallel infrastructure for generating ACPI as well seems like it would be a tremendous mess. We should support guests that require ACPI by having QEMU boot a UEFI bios blob and have that UEFI code generate ACPI tables based on the DTB we hand it. (Chances seem good that any guest that wants ACPI is going to want UEFI runtime services anyway.)
Quoted 3 lines
Depending on why people want ACPI in a guest environment, generating ACPI tables from a DTB might not be possible (e.g. if they want to use AML for some reason).
Agreed.
Quoted 5 lines
So the important question is _why_ the guest needs to see an ACPI environment. What exactly can ACPI provide to the guest that DT does not already provide, and why is that necessary? What infrastrucutre is needed for that use case?
Quoted 4 lines
There is important feature called system device dynamic reconfiguration, you know, hot-add/remove, if a gust need more/less memory or CPU, can we add or remove them dynamically with DT? ACPI can do this, but I have no idea if DT can. (Sorry, I don't know much about DT)
There is no way of doing this with DT. There has been work into DT fragments/overlays where portions can be added to the tree dynamically, but that's controlled by the OS rather than the hypervisor, and there's no standard for communicating what has been hotplugged to trigger changes to the tree, so it's not quite the same. It really only works for tightly coupled hw/kernel/userspace combinations (i.e. embedded).
Depending on how you implement the hot-add/remove you might be able to get away with an initial static configuration translated from DT. If you need to describe what might be hotplugged from the start, then I suspect you cannot get away with translating a DT in general.
Thanks,
Mark.
Quoted 8 lines · On Thursday 06 November 2014 13:30:01 Mark Rutland wrote:
There is no way of doing this with DT. There has been work into DT fragments/overlays where portions can be added to the tree dynamically, but that's controlled by the OS rather than the hypervisor, and there's no standard for communicating what has been hotplugged to trigger changes to the tree, so it's not quite the same. It really only works for tightly coupled hw/kernel/userspace combinations (i.e. embedded).
Quoted 4 lines
Depending on how you implement the hot-add/remove you might be able to get away with an initial static configuration translated from DT. If you need to describe what might be hotplugged from the start, then I suspect you cannot get away with translating a DT in general.
I believe IBM POWER 5/6/7 servers have an interface to update the DT from the hypervisor, but it's not a nice interface, so we may want to avoid duplicating that.
Arnd
Quoted 9 lines · Hanjun Guo
Quoted 4 lines
So the important question is _why_ the guest needs to see an ACPI environment. What exactly can ACPI provide to the guest that DT does not already provide, and why is that necessary? What infrastrucutre is needed for that use case?
There is important feature called system device dynamic reconfiguration, you know, hot-add/remove, if a gust need more/less memory or CPU, can we add or remove them dynamically with DT? ACPI can do this, but I have no idea if DT can. (Sorry, I don't know much about DT)
Indeed hot-add/remove is the single biggest AML user in x86 QEMU. Whether you really need it, it depends on what you are adding/removing.
For PCI there is no problem. We can use PCIe from the beginning, and use PCIe hotplug support that is already in QEMU.
Memory and CPU are more problematic. For memory we could perhaps use a PCI memory device, though I'm not sure if that would require drivers in the OS or everything just works.
CPU hotplug, however, probably requires AML. Of course it can be generated in the firmware, like we used to do for x86, but Igor explained why it wasn't a great idea. That said, one of the problems ("never ending expansion of PV QEMU-BIOS interface") could be less important since ARM DT is a better interface than x86 fw_cfg.
Paolo
Quoted 14 lines · On Thu, 06 Nov 2014 16:57:47 +0100 Paolo Bonzini <[email protected]> wrote:
Quoted 9 lines · Hanjun Guo
Quoted 4 lines
So the important question is _why_ the guest needs to see an ACPI environment. What exactly can ACPI provide to the guest that DT does not already provide, and why is that necessary? What infrastrucutre is needed for that use case?
There is important feature called system device dynamic reconfiguration, you know, hot-add/remove, if a gust need more/less memory or CPU, can we add or remove them dynamically with DT? ACPI can do this, but I have no idea if DT can. (Sorry, I don't know much about DT)
Indeed hot-add/remove is the single biggest AML user in x86 QEMU. Whether you really need it, it depends on what you are adding/removing.
Quoted 6 lines
For PCI there is no problem. We can use PCIe from the beginning, and use PCIe hotplug support that is already in QEMU.
Memory and CPU are more problematic. For memory we could perhaps use a PCI memory device, though I'm not sure if that would require drivers in the OS or everything just works.
BTW what's PCI memory device? Is there any reference I could read about it?
Quoted 5 lines
CPU hotplug, however, probably requires AML. Of course it can be generated in the firmware, like we used to do for x86, but Igor explained why it wasn't a great idea. That said, one of the problems ("never ending expansion of PV QEMU-BIOS interface") could be less important since ARM DT is a better interface than x86
fw_cfg.
Unfortunately we still would need to teach UEFI to recognize QEMU specific DT entries that were just invented,
it doesn't matter what transport is used (DT or fw_cfg) to convey new information to UEFI/BIOS.
Quoted 3 lines
Paolo
Quoted 17 lines · Igor Mammedov
Quoted 14 lines · On Thu, 06 Nov 2014 16:57:47 +0100 Paolo Bonzini <[email protected]> wrote:
Quoted 9 lines · Hanjun Guo
Quoted 4 lines
So the important question is _why_ the guest needs to see an ACPI environment. What exactly can ACPI provide to the guest that DT does not already provide, and why is that necessary? What infrastrucutre is needed for that use case?
There is important feature called system device dynamic reconfiguration, you know, hot-add/remove, if a gust need more/less memory or CPU, can we add or remove them dynamically with DT? ACPI can do this, but I have no idea if DT can. (Sorry, I don't know much about DT)
Indeed hot-add/remove is the single biggest AML user in x86 QEMU. Whether you really need it, it depends on what you are adding/removing.
Quoted 8 lines
Quoted 6 lines
For PCI there is no problem. We can use PCIe from the beginning, and use PCIe hotplug support that is already in QEMU.
Memory and CPU are more problematic. For memory we could perhaps use a PCI memory device, though I'm not sure if that would require drivers in the OS or everything just works.
BTW what's PCI memory device? Is there any reference I could read about it?
Just something with a huge BAR. Like ivshmem, but teaching the OS to see it as memory.
Quoted 9 lines
Quoted 5 lines
CPU hotplug, however, probably requires AML. Of course it can be generated in the firmware, like we used to do for x86, but Igor explained why it wasn't a great idea. That said, one of the problems ("never ending expansion of PV QEMU-BIOS interface") could be less important since ARM DT is a better interface than x86
fw_cfg.Unfortunately we still would need to teach UEFI to recognize QEMU specific DT entries that were just invented,
it doesn't matter what transport is used (DT orfw_cfg) to convey new information to UEFI/BIOS.
Right, it's just a bit more organized than fw_cfg.
Paolo
Quoted 14 lines · Paolo Bonzini
Quoted 9 lines · Hanjun Guo
Quoted 4 lines
So the important question is _why_ the guest needs to see an ACPI environment. What exactly can ACPI provide to the guest that DT does not already provide, and why is that necessary? What infrastrucutre is needed for that use case?
There is important feature called system device dynamic reconfiguration, you know, hot-add/remove, if a gust need more/less memory or CPU, can we add or remove them dynamically with DT? ACPI can do this, but I have no idea if DT can. (Sorry, I don't know much about DT)
Indeed hot-add/remove is the single biggest AML user in x86 QEMU. Whether you really need it, it depends on what you are adding/removing.
Quoted 6 lines
For PCI there is no problem. We can use PCIe from the beginning, and use PCIe hotplug support that is already in QEMU.
Memory and CPU are more problematic. For memory we could perhaps use a PCI memory device, though I'm not sure if that would require drivers in the OS or everything just works.
I didn't see some code for hot-adding system memory as PCI device, but people from Fujitsu is working on that in another solution - QEmu memory hot unplug support:
https://www.mail-archive.com/[email protected]/msg251355.html
for the guest, ACPI based memory hot-add/remove was already supported.
Thanks
Hanjun
Sorry for being late to the party, missed this set when it went out.
Quoted 21 lines · Peter Maydell
Quoted 12 lines · Alexander Spyridakis
Currently, the virt machine model generates Device Tree information dynamically based on the existing devices in the system. This patch series extends the same concept but for ACPI information instead. A total of seven tables have been implemented in this patch series, which is the minimum for a basic ARM support.
The set of generated tables are:
- RSDP
- XSDT
- MADT
- GTDT
- FADT
- FACS
- DSDTQuoted 6 lines
The tables are created in standalone buffers, taking into account the needed information passed from the virt machine model. When the generation is finalized, the individual buffers are compacted to a single ACPI binary blob, where it is injected on the guest memory space in a fixed location. The guest kernel can find the ACPI tables by providing to it the physical address of the ACPI blob (e.g. acpi_rsdp=0x47000000 boot argument).
Quoted 6 lines
(Sorry, I should have waited for the cover letter to arrive before replying.)
I think this is definitely the wrong approach. We already have to generate device tree information for the hardware we have, and having an equivalent parallel infrastructure for generating ACPI as well seems like it would be a tremendous mess.
I don't see this as duplication, I see this as platform completeness. And it would be really useful for firmware validation.
Quoted 5 lines
We should support guests
that require ACPI by having QEMU boot a UEFI bios blob and have that UEFI code generate ACPI tables based on the DTB we hand it. (Chances seem good that any guest that wants ACPI is going to want UEFI runtime services anyway.)
Yes, we could do that, but in doing so we would be treating ACPI as some artificial tickbox thing rather than a platform property. And it would introduce an entirely new class of ARM-specific errors.
Moreover, we currently have separate EDK2 platforms for ARM*/x86 QEMU (ArmVirtualizationQEMU vs. Ovmf). The goal there is to progressively move towards greater amounts of shared code between the two, and hopefully merge them into one eventually.
Deferring specifically on ARM the responsibility of generating (all) ACPI tables to the firmware leads to reduced amount of code shared between ARM/x86 in both QEMU and EDK2. And reduced ability to share future developments in that area (x86 QEMU seems well on the way towards letting you inject AML blobs from the command line).
/
Leif
Quoted 1 line · Leif Lindholm
Sorry for being late to the party, missed this set when it went out.
You seem to be replying to an email thread which is now many months old and at a part of the conversation which was obsoleted by the subsequent discussion in this thread...
Summary-of-consensus email from this thread:
http://lists.nongnu.org/archive/html/qemu-devel/2014-11/msg02529.html
I think this is the most recent patchset, implementing the "mixed-mode" design:
http://lists.gnu.org/archive/html/qemu-devel/2015-02/msg03290.html
(I might have missed an update, though, I've been on holiday and not tracking the list as closely the last few weeks.)
thanks
-- PMM
Quoted 9 lines · Peter Maydell
Quoted 1 line · Leif Lindholm
Quoted 1 line
Sorry for being late to the party, missed this set when it went out.
You seem to be replying to an email thread which is now many months old and at a part of the conversation which was obsoleted by the subsequent discussion in this thread...
Summary-of-consensus email from this thread:
http://lists.nongnu.org/archive/html/qemu-devel/2014-11/msg02529.html
Quoted 6 lines
I think this is the most recent patchset, implementing the "mixed-mode" design:
http://lists.gnu.org/archive/html/qemu-devel/2015-02/msg03290.html(I might have missed an update, though, I've been on holiday and not tracking the list as closely the last few weeks.)
Hi Peter,
You haven't missed it. I don't send an update version since V3. I'm waiting for the dependencies(the patches of Igor, Marcel, Michael) to be settled down. Then I'll send a new version.
Signature · 2 lines
Thanks, Shannon
Quoted 6 lines · Peter Maydell
Quoted 1 line · Leif Lindholm
Sorry for being late to the party, missed this set when it went out.
You seem to be replying to an email thread which is now many months old and at a part of the conversation which was obsoleted by the subsequent discussion in this thread...
And here I was getting all prepared to have to argue :)
Quoted 2 lines
Summary-of-consensus email from this thread:
http://lists.nongnu.org/archive/html/qemu-devel/2014-11/msg02529.html
Thanks!
Quoted 3 lines
I think this is the most recent patchset, implementing the "mixed-mode" design:
http://lists.gnu.org/archive/html/qemu-devel/2015-02/msg03290.html
Excellent, that looks like exactly what I was hoping for. I'll give that a spin - thanks again and sorry for the noise.
/
Leif
RFC PATCH 1/7 hw/i386: Move ACPI header definitions in an arch-independent location
In reply to Alexander SpyridakisThe ACPI related header file acpi-defs.h, includes definitions that apply on other architectures as well. Move it in include/hw/acpi/ to sanely include it from other architectures.
--- hw/i386/acpi-build.c | 2 +- hw/i386/acpi-defs.h | 368 -------------------------------------------- include/hw/acpi/acpi-defs.h | 368 ++++++++++++++++++++++++++++++++++++++++++++ tests/bios-tables-test.c | 2 +- 4 files changed, 370 insertions(+), 370 deletions(-) delete mode 100644 hw/i386/acpi-defs.h create mode 100644 include/hw/acpi/acpi-defs.h
hw/i386/acpi-build.c +1 -1
@@ -33,7 +33,7 @@#include "hw/i386/pc.h" #include "target-i386/cpu.h" #include "hw/timer/hpet.h" -#include "hw/i386/acpi-defs.h" +#include "hw/acpi/acpi-defs.h" #include "hw/acpi/acpi.h" #include "hw/nvram/fw_cfg.h" #include "bios-linker-loader.h"
hw/i386/acpi-defs.h deleted +0 -368
368 lines not on this page · raw message
include/hw/acpi/acpi-defs.h new file +368 -0
368 lines not on this page · raw message
tests/bios-tables-test.c +1 -1
@@ -17,7 +17,7 @@#include "qemu-common.h" #include "libqtest.h" #include "qemu/compiler.h" -#include "hw/i386/acpi-defs.h" +#include "hw/acpi/acpi-defs.h" #include "hw/i386/smbios.h" #include "qemu/bitmap.h"
Signature · 1 line
1.9.1
RFC PATCH 2/7 hw/arm/virt-acpi: Basic skeleton for dynamic generation of ACPI tables
In reply to Alexander SpyridakisIntroduce a preliminary skeleton in virt-acpi.c with the main ACPI build functions. The virt machine model is meant to call 'acpi_build_tables' after platform devices are created and pass all needed information. From that point each table will be created in a separate memory buffer and finally be copied to the guest memory as a single binary blob.
The minimum required ACPI v5.1 tables for ARM are:
- RSDP: Initial table that points to XSDT
- XSDT: Points to all other tables (except FACS & DSDT)
- FADT: Generic information about the machine
- DSDT: Holds all information about system devices/peripherals
- FACS: Needs to be pointed from FADT
--- hw/arm/Makefile.objs | 2 +- hw/arm/virt-acpi.c | 84 ++++++++++++++++++++++++++++++++++++++++++++++ include/hw/arm/virt-acpi.h | 52 ++++++++++++++++++++++++++++ 3 files changed, 137 insertions(+), 1 deletion(-) create mode 100644 hw/arm/virt-acpi.c create mode 100644 include/hw/arm/virt-acpi.h
hw/arm/Makefile.objs +1 -1
@@ -2,7 +2,7 @@ obj-y += boot.o collie.o exynos4_boards.o gumstix.o highbank.o obj-$(CONFIG_DIGIC) += digic_boards.o obj-y += integratorcp.o kzm.o mainstone.o musicpal.o nseries.o obj-y += omap_sx1.o palm.o realview.o spitz.o stellaris.o -obj-y += tosa.o versatilepb.o vexpress.o virt.o xilinx_zynq.o z2.o +obj-y += tosa.o versatilepb.o vexpress.o virt.o virt-acpi.o xilinx_zynq.o z2.o obj-y += armv7m.o exynos4210.o pxa2xx.o pxa2xx_gpio.o pxa2xx_pic.o obj-$(CONFIG_DIGIC) += digic.o
hw/arm/virt-acpi.c new file +84 -0
84 lines not on this page · raw message
include/hw/arm/virt-acpi.h new file +52 -0
52 lines not on this page · raw message
Signature · 1 line
1.9.1
Re: [Qemu-devel] [RFC PATCH 2/7] hw/arm/virt-acpi: Basic skeleton for dynamic generation of ACPI tables
Quoted 6 lines · Alexander Spyridakis
Introduce a preliminary skeleton in
virt-acpi.cwith the main ACPI build functions. The virt machine model is meant to call 'acpi_build_tables' after platform devices are created and pass all needed information. From that point each table will be created in a separate memory buffer and finally be copied to the guest memory as a single binary blob.
Please, no. ACPI should be the guest's problem, not QEMU's. We provide the guest with a device tree it can look at to figure out what h/w is present.
-- PMM