-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for setting up SMP
on ARM64
through ACPI
#912
Conversation
aee5e14
to
6f11e49
Compare
@mogasergiu I looked on the code and tested with One minor comment: in the 9801546 commit message, you have one repetition: "fetch the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me, thanks for the great work @mogasergiu!
Reviewed-by: Razvan Virtan virtanrazvan@gmail.com
Split secondary cores enumeration in two methods: - if CONFIG_UKPLAT_ACPI is enabled then get the information through the `MADT`'s `GICC` structures - else rely on the `Devicetree`'s `cpu@` nodes Signed-off-by: Sergiu Moga <sergiu.moga@protonmail.com>
Allow the existence of two ways to enumerate secondary cores: `ACPI` and `Devicetree`. Signed-off-by: Sergiu Moga <sergiu.moga@protonmail.com>
Add the alternative of fetching the `PSCI` method from `ACPI`'s `FADT`'s `ARM Boot Flags` field. Signed-off-by: Sergiu Moga <sergiu.moga@protonmail.com>
Since this applies for both `GICv2` and `GICv3`, implement a generic method of fetching the unique `GICD` structure from the `MADT`. Unlike `Devicetree`'s `reg` property, `ACPI` does not inform us of the length of the `GIC Distributor`'s address space and therefore one must assume the page-aligned default size from the specification: - for GICv2: ARM Generic Interrupt Controller Architecture version 2.0 Issue B.b - for GICv3: ARM Generic Interrupt Controller Architecture version 3 and version 4 Issue H Signed-off-by: Sergiu Moga <sergiu.moga@protonmail.com>
If `ACPI` is enabled, rely on it for probing the `GICv2`. Thus, we need to take two steps for this: - fetch the GIC CPU interface's base address and default length from the `GICC` `MADT` entry. Since there is only one `Redistributor`, all `GICC`'s must have the same physical base address. - fetch the `GIC Distributor`'s physical base address from `MADT`'s `GICD` structure and check that the size is compliant with that of `GICv2`. `GICR Base Address` must be set to 0, otherwise this is `GICv3/4`. Furthermore, separate the two ways of probing `GICv2` in two: one for `ACPI` and one for `Devicetree`. Signed-off-by: Sergiu Moga <sergiu.moga@protonmail.com>
If `ACPI` is enabled, rely on it for probing the `GICv3`. Thus, we need to take two steps for this: - fetch the GIC Redistributor's base address and address range length from the `GICR` `MADT` entry. Normally we should check first if there exists a Redistributor. If there is none then we must get its address from the `GICC` structure, since that means that the Redistributors are not in an always-on power domain. Otherwise there could be a `GICR` for each Redistributor region and the `DT` probe version does not support multiple regions anyway. So, until there is need for that (not the case for QEMU Virt), align `ACPI` probe with `DT` probe and assume we only have one Redistributor region. - fetch the `GIC Distributor`'s physical base address from `MADT`'s `GICD` structure and check that the size is compliant with that of `GICv3`. Furthermore, separate the two ways of probing `GICv3` in two: one for `ACPI` and one for `Devicetree`. As a reminder, add a `TODO` in the `DT` probe for when someone decides to actually improve this driver. Signed-off-by: Sergiu Moga <sergiu.moga@protonmail.com>
Now that we have separated the ways we probe the `GIC` (`Devicetree` vs `ACPI`) and the `Devicetree` parts can fetch the `Devicetree` on their own, remove the no longer necessary `fdt` function parameters from the related functions. Signed-off-by: Sergiu Moga <sergiu.moga@protonmail.com>
6f11e49
to
519a44f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed-by: Michalis Pappas michalis@unikraft.io
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved-by: Razvan Deaconescu razvand@unikraft.io
Allow the existence of two ways to enumerate secondary cores: `ACPI` and `Devicetree`. Signed-off-by: Sergiu Moga <sergiu.moga@protonmail.com> Reviewed-by: Razvan Virtan <virtanrazvan@gmail.com> Reviewed-by: Michalis Pappas <michalis@unikraft.io> Approved-by: Razvan Deaconescu <razvand@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: #912
Add the alternative of fetching the `PSCI` method from `ACPI`'s `FADT`'s `ARM Boot Flags` field. Signed-off-by: Sergiu Moga <sergiu.moga@protonmail.com> Reviewed-by: Razvan Virtan <virtanrazvan@gmail.com> Reviewed-by: Michalis Pappas <michalis@unikraft.io> Approved-by: Razvan Deaconescu <razvand@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: #912
Since this applies for both `GICv2` and `GICv3`, implement a generic method of fetching the unique `GICD` structure from the `MADT`. Unlike `Devicetree`'s `reg` property, `ACPI` does not inform us of the length of the `GIC Distributor`'s address space and therefore one must assume the page-aligned default size from the specification: - for GICv2: ARM Generic Interrupt Controller Architecture version 2.0 Issue B.b - for GICv3: ARM Generic Interrupt Controller Architecture version 3 and version 4 Issue H Signed-off-by: Sergiu Moga <sergiu.moga@protonmail.com> Reviewed-by: Razvan Virtan <virtanrazvan@gmail.com> Reviewed-by: Michalis Pappas <michalis@unikraft.io> Approved-by: Razvan Deaconescu <razvand@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: #912
If `ACPI` is enabled, rely on it for probing the `GICv2`. Thus, we need to take two steps for this: - fetch the GIC CPU interface's base address and default length from the `GICC` `MADT` entry. Since there is only one `Redistributor`, all `GICC`'s must have the same physical base address. - fetch the `GIC Distributor`'s physical base address from `MADT`'s `GICD` structure and check that the size is compliant with that of `GICv2`. `GICR Base Address` must be set to 0, otherwise this is `GICv3/4`. Furthermore, separate the two ways of probing `GICv2` in two: one for `ACPI` and one for `Devicetree`. Signed-off-by: Sergiu Moga <sergiu.moga@protonmail.com> Reviewed-by: Razvan Virtan <virtanrazvan@gmail.com> Reviewed-by: Michalis Pappas <michalis@unikraft.io> Approved-by: Razvan Deaconescu <razvand@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: #912
If `ACPI` is enabled, rely on it for probing the `GICv3`. Thus, we need to take two steps for this: - fetch the GIC Redistributor's base address and address range length from the `GICR` `MADT` entry. Normally we should check first if there exists a Redistributor. If there is none then we must get its address from the `GICC` structure, since that means that the Redistributors are not in an always-on power domain. Otherwise there could be a `GICR` for each Redistributor region and the `DT` probe version does not support multiple regions anyway. So, until there is need for that (not the case for QEMU Virt), align `ACPI` probe with `DT` probe and assume we only have one Redistributor region. - fetch the `GIC Distributor`'s physical base address from `MADT`'s `GICD` structure and check that the size is compliant with that of `GICv3`. Furthermore, separate the two ways of probing `GICv3` in two: one for `ACPI` and one for `Devicetree`. As a reminder, add a `TODO` in the `DT` probe for when someone decides to actually improve this driver. Signed-off-by: Sergiu Moga <sergiu.moga@protonmail.com> Reviewed-by: Razvan Virtan <virtanrazvan@gmail.com> Reviewed-by: Michalis Pappas <michalis@unikraft.io> Approved-by: Razvan Deaconescu <razvand@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: #912
Now that we have separated the ways we probe the `GIC` (`Devicetree` vs `ACPI`) and the `Devicetree` parts can fetch the `Devicetree` on their own, remove the no longer necessary `fdt` function parameters from the related functions. Signed-off-by: Sergiu Moga <sergiu.moga@protonmail.com> Reviewed-by: Razvan Virtan <virtanrazvan@gmail.com> Reviewed-by: Michalis Pappas <michalis@unikraft.io> Approved-by: Razvan Deaconescu <razvand@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: #912
Beep boop! I ran Unikraft's
Truncated logs starting from first warning 61b580f:
View complete logs | Learn more about Unikraft's coding style and contribution guidelines. |
Prerequisite checklist
checkpatch.pl
on your commit series before opening this PR;Base target
arm64
kvm
Additional configuration
Description of changes
Add support for setting up
SMP
onARM64
throughACPI
.This PR depends on #772 #848 #908 #909 #910 and #911, therefore it includes.
NOTE
This is part of a larger set of Pull Requests. To make things easier and to ensure that things build as expected, it is recommended that testing is done based on #912, which includes everything. The splitting has been done to ease the review process.
To make testing easier, use the script from #910 to build the Unikraft images. You will need an
OVMF BIOS
image first.