Re: Proposal: Magic number in boot register
atishp@...
On Fri, 2020-06-26 at 15:12 -0400, Jonathan Behrens wrote:
already available with kernel. Even though kernel looks at DT, before
looking at EFI system table, it removes all the memory mappings from DT
for efi boot and reinitilizes all memory blocks from efi memory
mappings.
unlike x86. We may have to follow similar approach for RISC-V as well
in future.
everything in a compatiable way. For Linux land, we try to keep single
Linux kernel image booting all platforms (supporting S-mode).
Regards,
Atish
Yes. ACPI is only usable via UEFI boot. Thus, EFI system table is
On Wed, Jun 24, 2020 at 1:55 PM Atish Patra <Atish.Patra@...>
wrote:On Wed, 2020-06-24 at 13:04 -0400, Jonathan Behrens wrote:From that link it looks like the OS already has access to the kernelBut how will the booting OS know whether to look at ACPI tablesorthe device tree? Wouldn't you need some register to indicatewhichone is being used?I am not sure how it will be implemented in RISC-V when we have
ACPI.
However, this is process followed in ARM64[1]
ACPI tables are passed via UEFI system configuration table while DT
address will be passed in x0. Kernel tries to use DT first if ACPI
is
not preferred choice from kernel commandline. If it fails to find a
DT,
it will try to use ACPI table if exists.
[1] https://lwn.net/Articles/642050/
command line and the EFI system table before it starts looking at the
DT / ACPI tables?
already available with kernel. Even though kernel looks at DT, before
looking at EFI system table, it removes all the memory mappings from DT
for efi boot and reinitilizes all memory blocks from efi memory
mappings.
In that case, the bootloader has already passed enough relevantI guess ARM has to do it because it had to support both DT & ACPI
information for the OS to know that it isn't about to dereference a
bad pointer or something when trying to read from the DT.
However, perhaps I've been too pessimistic about the RISC-V ecosystem
all conforming to the Unix-class platform spec. I'm way more familiar
with x86 which didn't really manage to achieve something like this,
but it looks like maybe ARM did?
unlike x86. We may have to follow similar approach for RISC-V as well
in future.
If changes like adding ACPI tables or whatever are all done in aI am hoping there will not be any conflicting standards and we add
compatible way (say by having a stub DT) there there is no need for a
magic number. If there are going to be multiple conflicting
standards, then proactively using one out of the 31 registers to tell
the apart might be worthwhile.
everything in a compatiable way. For Linux land, we try to keep single
Linux kernel image booting all platforms (supporting S-mode).
Jonathan--
PS: I started this thread focusing on a small/not too technical
question partially in the hope of generating more discussion on this
mailing list. Please chime in if you have thoughts!On Wed, Jun 24, 2020 at 11:18 AM Atish Patra via lists.riscv.org<atish.patra=wdc.com@...> wrote:Atish.Patra@...>On Tue, 2020-06-23 at 16:37 -0400, Jonathan Behrens wrote:
On Fri, Jun 19, 2020 at 5:42 PM Atish Patra <SBIwrote:behrensj@...>On Jun 19, 2020, at 1:26 PM, Jonathan Behrens <wrote:
Thanks for that clarification! It is good to know thatsbi_get_spec_version.v0.1valuesimplementations are consistent about returning negativefor functions they don't recognize likeorThis however doesn't work for environments which cannotreturn todon'twant to implement the SBI at all (what value do youtheresaythere is no SBI?)
Once RISC-V is more widely deployed, it is likely thatevenwillbe more platform specs written by other committees, ormaygroups entirely outside of the RISC-V foundation. Theyhavenotwant to require ecalls to detect capabilities, or mightwriteother constraints. Yet, developers will likely want towherekernels that can boot across a range of these different
environments. This has certainly been the case on x86youtheirthere's lots of different bootloaders that each work withown conventions.Yes. That’s a possibility. If I understand you correctly,/chosenwantsome identifier that let supervisor know that the M-mode
firmware is an SBI based one.
If that’s the only case, how about a DT property underthisnodeinstead of reserving a register for a fixed value.The register value would also signal the other elements oftreeplatform spec are being followed. Notably including that a1actuallypoints to a valid device tree. If we could count on a deviceroutealways being present then I agree that going the /chosengowouldbe cleaner, but if a future third party standard decided totowithACPI tables or something instead then they may not be willingtable.require a dummy device tree just to allow software to blindlyFor ACPI tables, a similar property can be added in the ACPI
dereference a1.asWe anyways have to add other run time properties to ACPI tableup,we do
currently for the device tree.JonathanTo give one case where this already seems to be comingknowLinuxconfiguredcan run in M-mode instead of S-mode but only if it isthat way at compile time. If Linux had a better way touse awhether there was firmware present, it might be able towrote:Atish.Patra@...>shared kernel binary for both cases.
Best,
Jonathan
On Wed, Jun 17, 2020 at 2:56 PM Atish Patra <wrote:On Tue, 2020-06-16 at 09:54 -0400, Jonathan Behrensshould goHi everyone,
To start off discussion about requirements thatregistersoftware:into theplatform spec, I propose a simple change to current
When entering S-mode for the first time, the a2Supervisorlookshouldcontain the value 0x54414c5058494e55 ("UNIXPLAT").
The intention here is that software should be able tofor thisvalue and know that it has been booted in aonlyplatformExecutionEnvironment that is compliant with the Unix-classspec. Thiswould distinguish both from old implementations thatversionthatsupport SBIv0.1, but also possible future execution environmentsdesigned byother groups.For SBI version, supervisor systems should use
"sbi_get_spec_version"
API to identify what is the SBI version of the SBI
implementation. For
v0.1, the above call will return a -ve value indicatingthis is a
v0.1.
That's how linux kernel currently detects the SBIdynamically.Jonathan
Regards,
Atish