--
You received this message because you are subscribed to the Google Groups "RISC-V ISA Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to isa-dev+u...@groups.riscv.org.
To post to this group, send email to isa...@groups.riscv.org.
Visit this group at https://groups.google.com/a/groups.riscv.org/group/isa-dev/.
To view this discussion on the web visit https://groups.google.com/a/groups.riscv.org/d/msgid/isa-dev/CAEz%3Dso%3DHh%2BUMn4MGxd9WjyPkYFTZLAGtWobuJ1KTTP-3rJLbRA%40mail.gmail.com.
On 3 Nov 2016, at 4:22 PM, Andrew Waterman <and...@sifive.com> wrote:Config string is probably a better way to communicate info to the
kernel than the ELF auxiliary vector, because it is more flexible.
--
You received this message because you are subscribed to the Google Groups "RISC-V ISA Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to isa-dev+u...@groups.riscv.org.
To post to this group, send email to isa...@groups.riscv.org.
Visit this group at https://groups.google.com/a/groups.riscv.org/group/isa-dev/.
To view this discussion on the web visit https://groups.google.com/a/groups.riscv.org/d/msgid/isa-dev/10CB9EE4-232A-4B50-8572-94ECADAE9AA5%40mac.com.
--
You received this message because you are subscribed to the Google Groups "RISC-V ISA Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to isa-dev+u...@groups.riscv.org.
To post to this group, send email to isa...@groups.riscv.org.
Visit this group at https://groups.google.com/a/groups.riscv.org/group/isa-dev/.
To view this discussion on the web visit https://groups.google.com/a/groups.riscv.org/d/msgid/isa-dev/CADJ6UvMn1e7rP5mEQzxq%3DF5qhPmMj%2BqKAT8NQCYF6GECO8B0iw%40mail.gmail.com.
There is an easier solution that does not rely on firmware assistance.
The kernel can walk any 4KiB mapping and simply count how many levels of
page tables it traverses before reaching a leaf.
Please do; comments will be helpful, since the asynchronous I/O facility
is still a pretty vague outline and I am planning another revision of
the proposal to flesh it out.
The SBI should guarantee that the kernel text is mapped contiguously
in physical memory. So it actually is possible to figure this out
dynamically. Look at two adjacent leaf PTEs and examine the deltas
between their PPNs; that gives you the size of a leaf page. Then from
the depth of the tree you can infer the virtual address space size.
On 5 Nov 2016, at 4:45 AM, ron minnich <rmin...@gmail.com> wrote:The page table design is great but we need to communicate more info to the supervisor than I see today, and I have yet to see anything that rises to the level of needing an SBI call. Could we just define the prototype of main() as follows:void main(void *config_string, void *fdt)
--
You received this message because you are subscribed to the Google Groups "RISC-V ISA Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to isa-dev+u...@groups.riscv.org.
To post to this group, send email to isa...@groups.riscv.org.
Visit this group at https://groups.google.com/a/groups.riscv.org/group/isa-dev/.
To view this discussion on the web visit https://groups.google.com/a/groups.riscv.org/d/msgid/isa-dev/F607547C-9D34-4B3A-91CE-28626DD674A5%40mac.com.
<snip>
> For the first few years of LinuxBIOS existence, starting in 1999, we settled
> on ELF as the standard format for payloads and booting (part of what made
> kexec the way it was, as it happens; ebeiderman hoped we could settle on
> ELF as the standard format for starting everything). We dropped ELF in 2006
> as our standard firmware payload format for a simple reason: people keep
> messing up ELF parsers and compilers keep messing up creating ELF files
> (search for openbsd elf exploit -- if those guys can't get this perfect,
> what hope have I). There's a lot of subtle issues in parsing ELF and it's
> easy to write seemingly perfect ELF parsers or generators that have bad
> problems. You don't want to learn that after you just flashed thousands of
> machines with a new firmware image. You want all that checking done first,
> and then translated into a simple format, then burned into flash. We
> decided we did not want to parse or generate ELF in firmware and dropped
> that format in 2006. We replaced it with a far simpler format called SELF
> (Simple ELF).
>
>
> So, as interesting as all these ideas revolving around ELF annotations are,
> ultimately I don't think they're the right way to go for passing info from
> firmware to hypervisor/kernel.
So, this is fascinating info I'd not seen before! Would you mind giving some
additional details on SELF? In particular, is it a subset of ELF (such that a
valid SELF is a valid ELF), or is it disjoint?
On 5 Nov 2016, at 11:51 AM, Michael Clark <michae...@mac.com> wrote:
On 5 Nov 2016, at 11:38 AM, Jacob Bachmeyer <jcb6...@gmail.com> wrote:
Andrew Waterman wrote:On Fri, Nov 4, 2016 at 8:45 AM, ron minnich <rmin...@gmail.com> wrote:The page table design is great but we need to communicate more info to the
supervisor than I see today, and I have yet to see anything that rises to
the level of needing an SBI call. Could we just define the prototype of
main() as follows:
void main(void *config_string, void *fdt)
and let firmware/hypervisor set those things up? I don't see this stated
anywhere but it would be useful.
I've been thinking of something along those lines. It's fundamentally
not too different than Michael Clark's proposal of using the ELF AUX
vector. But if we can get away with only passing the config string,
this would be the simplest ABI.
The problem with passing the config string to the supervisor's entry point, whether as an argument or in the ELF auxv, is that device hotplug could *change* the config string while the system is running. Further, some supervisors expect other information, like the kernel command line in Linux. I suggest keeping the standard "main(int argc, char ** argv, char ** envp)" prototype and making the configuration string accessible through SBI calls (the minimal form of the "SBI virtio" I proposed earlier is one way to do this--I have since found that "virtio" was a poor choice of name for that proposal). I still do not know what use the environment would be to a supervisor, but it seems reasonable to have. Perhaps the initial configuration string could be the first entry in the environment?
We understand there is a hotplug use case, and the config string can describe MMIO regions of devices present at boot time.
- hotplug use case
- config string describes MMIO regions of devices present at boot time
- this will include an interrupt controller that is Virtual or Physically optimised
- outbound signalling for interrupt acknowledge is easier using a CSR than an MMIO due to the 4K page dirty handling
I’m trying to see what requirement makes us implement some dangerous proc filesystem type interface in the SBI (versus in the Hypervisor).
- device plug could be an interrupt on one of the devices set up at boot
- this would be similar to dynamically discoverable hardware i.e. PCI host bridge, or USB host bridge
- a Virtual host bridge could receive interrupts for virtual device hotplug
- this supports virtual PCI and or USB plugging
The reason why I am push this way is to reduce the API attack surface on the SBI interface, especially anything more complex than interrupt and circular ring buffers (mimicking hardware). I don’t thing we want to add a proc_fs type interface to the SBI. I think that would be bad.
Michael.
--
You received this message because you are subscribed to the Google Groups "RISC-V ISA Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to isa-dev+u...@groups.riscv.org.
To post to this group, send email to isa...@groups.riscv.org.
Visit this group at https://groups.google.com/a/groups.riscv.org/group/isa-dev/.
To view this discussion on the web visit https://groups.google.com/a/groups.riscv.org/d/msgid/isa-dev/5523F420-C60D-474F-93AA-7BEC878F405D%40mac.com.
The problem with passing the config string to the supervisor's entry
point, whether as an argument or in the ELF auxv, is that device hotplug
could *change* the config string while the system is running.
Further,
some supervisors expect other information, like the kernel command line
in Linux.
I suggest keeping the standard "main(int argc, char ** argv,
char ** envp)"
On 5 Nov 2016, at 3:08 PM, Jacob Bachmeyer <jcb6...@gmail.com> wrote:--
TOP OF STACK
AUX_DATA
AT_PHDR /* pointer to loaded ELF PHdr (guest) */
AT_RV_CONFIG /* pointer to config (host) */
AT_RV_SCRATCH /* scratch stack frame size */
ENV /* NVRAM */
ARGV /* boot command line */
ARGC
SP
Ick! Too much complexity! Too many places for bugs to hide! Too many places to hide backdoors!
On Wed, Nov 2, 2016 at 8:14 PM, Michael Clark <michae...@mac.com> wrote:
>
>
>
> Sent from my iPhone
>> On 3/11/2016, at 10:01 AM, Stefan O'Rear <sor...@gmail.com> wrote:
>>
>>> On Wed, Nov 2, 2016 at 1:45 PM, ron minnich <rmin...@gmail.com> wrote:
>>> an SBI call I would rather not see.
>>>
>>> I was surprised to see that the # page level mappings was not communicated
>>> to s-mode in some way as a bit in sstatus. This is the kind of thing a
>>> kernel needs to know.
>>
>> My understanding of the situation is that you're expected to just pick
>> a VM mode, then put it in the ELF header somewhere so that the
>> bootloader can set it.
>>
>> See also https://groups.google.com/a/groups.riscv.org/d/msg/isa-dev/cV9DEHo1XYU/-PTKEEVICwAJ
>
> It doesn't seem appropriate to put a dynamic property into a static ELF attribute. It means the same kernel cannot run on hardware with different paging extensions.
Not necessarily... Sv48 systems will generally support Sv39 (the
hardware cost is immeasurable), so kernels that require less address
space can run on systems that support more.
On Dec 2, 2016 3:38 AM, "Michael Clark" <michae...@mac.com> wrote:
>
> The supervisor should be able to change the VM mode. Somehow... maybe SBI... it requires a trampoline procedure and a cache line aligned code sequence or an SBI call.
>
> It would still be possible to read the boot command line, environment (NVRAM), and Auxiliary vector variables AT_BASE (pointer to start of ELF), AT_RISCV_CONFIG (pointer to config) as an entry protocol with scratch page tables set up and sp pointing to argc just below top of this scratch stack.
>
> S-mode boot1 can set up new PTEs and csrrw stvec, csrrw sptbr, csrrw sstatus.VM, sfence.vm, j stvec and then trap into the new mode as subsequent instruction fetches will cause a fetch fault and jump to stvec in the new VM mode or reach the jump instruction which will have a TLB miss and activate the new paging mode.
>
> The tiny trampoline code sequence probably has to fit in a cache line unless VM only takes effect after sfence.VM. This may not be the case with current implementations for which the VM mode may take effect immediately i.e. the next TLB miss.
This is probably the first case where I've thought that x86's approach is straight-up better. On x86:
1. Identity-map a trampoline.
2. Turn off paging.
3. Load new page tables that still identity-map the trampoline.
4. Turn paging back on.
If RISC-V lets S-mode control the paging format and one of the choices is no paging at all, then there's no problem here.