From: sam.falvo@gmail.com (Samuel Falvo II) To: linux-riscv@lists.infradead.org Subject: [sw-dev] SBI extension proposal v2 Date: Sat, 10 Nov 2018 09:41:47 -0800 [thread overview] Message-ID: <CAEz=sokxTJk=0EnRnLeG6LkaZiW-Dr4nmz=2JDgZm893NM-adQ@mail.gmail.com> (raw) In-Reply-To: <CAP6exYKfhtgXz4nVSwXasicbE+8ZbKwp-15_xGFHfFoK9yi9-g@mail.gmail.com> on sat, nov 10, 2018 at 8:46 am ron minnich <rminnich@gmail.com> wrote: > which is why i'm a bit unhappy to see this (to me) cancerous growth in > proposals for m- mode code. ppp in firmware? really? multiple serial i'm inclined to agree with the overall sentiment of the concerns raised herein (omitted for brevity), but i feel that it might go a bit too far. the bios has its roots with cp/m, i think we all can agree with this, and there the bios was well-matched to its task: booting cp/m. nothing more, nothing less. you had i/o routines for teletype output, keyboard input, paper tape input, and punch output. as well, you had basic primitives for reading and writing sectors on mass storage devices. and, unless you were porting cp/m itself to a completely new platform, you never had to *really* worry about the physical constraints of those mass storage devices. maximum number of sectors and tracks were about the extent of things. you never had to call back into anything, either. in other words, bios was a *library*, not a *framework.* it was *deliberately* designed and scoped to just deal with booting into a cp/m environment. originally, the pc bios was built the same way -- it was what you used to boot pc-dos (nee ms-dos). only *later* did massive api changes get lumped into the bios. things like protected memory support, acpi power mode settings, etc. all but required changing the bios away from being a library and into more of a framework/miniature os unto itself. i think the real lessons to be learned here are: 1) the bios interface was dictated by the demands of booting and running a preferred (though not the only) os. in other words, the *os* dictated the bios interface. bios literally was what one would call a "hal" (hardware abstraction layer) these days. the fact that others have technically used bios to boot into other, non-sanctioned oses over the years is, technically, an abuse of the interface that just happens to work. 2) bios was strictly a library. the maximum extent to which bios was a framework stopped firmly at loading in the master boot record and dispatching control to it. from then on, you were utterly on your own. note: no security hoo-haw here. no signed anything. no pe executables. no rom-filesystems. no dedicated uefi partitions. et. al. just read in 512b to 1kb of raw binary blob, and run it. that's it. from then on, bios was a library first and always. anything we come up with for an sbi must, in my opinion, behave the same way. oh, btw, before people get the idea that uefi allows per-partition filesystems, please note that os/2 used "micro-filesystem drivers" to achieve this same effect with nothing more sophisticated than the partition table located in a dos 3.3 mbr. don't drink the uefi kool-aid. 3) corrallary to (2): because bios was just a library, you could throw it away en mass at any time (and after booting into the os of your choice, it frequently was). you could, if you were clever enough with page tables and the like, even replace the bios with your own image if you wanted to. this speaks to what ron has discussed in prior threads over the concerns of not being able to replace m-mode software. 4) support for multiple devices is not necessarily a bad thing; just, don't go hog wild with it. there's no need to support 256 possible serial ports, for example. ok, you have a debugger interface, a resident console, and maybe one more for auxiliary purposes (for example, my kestrel-3 design so far needs *two* serial interfaces to the host pc, one which is the user's console, and one which is used to access mass storage). each of these devices should have their own read/write interface, thus making it impeccably clear in the source code what it is you're trying to do. no need to "open" things. my point here is, going back to the needs of the *os* and not the bios for bios' sake, the interface exposed by the bios should match the overall expectations of the os you're booting. in my case, i *need* two serial interfaces for my prototype computer to function: ergo, it makes perfect sense for my firmware to provide support for two serial interfaces. for the linux, this need not be the case; maybe only one interface is required. > the sbi should be hard to add to, deliberately. it should be used only > when there are no possible alternatives. it needs to be open source > and held in common. it should be possible for a kernel to replace or > at least measure it. and, further, there needs to be some work done on > why you add to it, and why you don't, with bias against adding to it. i'm reposting this block of test because i agree completely with it, and want to point out that it doesn't contradict what i wrote above. > p.s. for interleaving debug and console output firmware, use the > oldest trick in the book: ascii is 7 bits. since console out is 8 > bits, reserve 128 values for console out, and 128 for debug stream, > and if the debug stream needs 8 bit for some words, you know what to > do. it's very easy and doesn't require that we add multiple uart > support to sbi. another option is to use escape sequences preceding each output. escape byte 1 would mean "future bytes are sent to the debugger", while byte 2 would mean "future bytes are intended for console output." this gives you support for all 8-bits (if your debugger interface happens to be binary), with the occasional overhead of escaping escape bytes. trivial to implement both on the receiving and transmitting sides, possibly even simpler than the bit-7-target-address approach above. the only disadvantage is that it's stateful; but if you have a serial connection reliable enough to use with a binary debugging interface, it'll almost certainly be reliable enough for this too. -- samuel a. falvo ii
WARNING: multiple messages have this Message-ID (diff)
From: Samuel Falvo II <sam.falvo@gmail.com> To: ron minnich <rminnich@gmail.com> Cc: mark.rutland@arm.com, hch@infradead.org, Damien.LeMoal@wdc.com, olof.johansson@gmail.com, alankao@andestech.com, "Chang, Abner" <abner.chang@hpe.com>, Anup Patel <anup@brainfault.org>, Palmer Dabbelt <palmer@sifive.com>, agraf@suse.de, zong@andestech.com, atish.patra@wdc.com, sw-dev@groups.riscv.org, paul.walmsley@sifive.com, mick@ics.forth.gr, Alistair.Francis@wdc.com, Luke Kenneth Casson Leighton <lkcl@lkcl.net>, linux-riscv@lists.infradead.org, Andrew Waterman <andrew@sifive.com> Subject: Re: [sw-dev] SBI extension proposal v2 Date: Sat, 10 Nov 2018 09:41:47 -0800 [thread overview] Message-ID: <CAEz=sokxTJk=0EnRnLeG6LkaZiW-Dr4nmz=2JDgZm893NM-adQ@mail.gmail.com> (raw) Message-ID: <20181110174147.BU3CkVRgleHMYYeEJf0ieMiIT1J3wUHqzVzhzf5-qY4@z> (raw) In-Reply-To: <CAP6exYKfhtgXz4nVSwXasicbE+8ZbKwp-15_xGFHfFoK9yi9-g@mail.gmail.com> on sat, nov 10, 2018 at 8:46 am ron minnich <rminnich@gmail.com> wrote: > which is why i'm a bit unhappy to see this (to me) cancerous growth in > proposals for m- mode code. ppp in firmware? really? multiple serial i'm inclined to agree with the overall sentiment of the concerns raised herein (omitted for brevity), but i feel that it might go a bit too far. the bios has its roots with cp/m, i think we all can agree with this, and there the bios was well-matched to its task: booting cp/m. nothing more, nothing less. you had i/o routines for teletype output, keyboard input, paper tape input, and punch output. as well, you had basic primitives for reading and writing sectors on mass storage devices. and, unless you were porting cp/m itself to a completely new platform, you never had to *really* worry about the physical constraints of those mass storage devices. maximum number of sectors and tracks were about the extent of things. you never had to call back into anything, either. in other words, bios was a *library*, not a *framework.* it was *deliberately* designed and scoped to just deal with booting into a cp/m environment. originally, the pc bios was built the same way -- it was what you used to boot pc-dos (nee ms-dos). only *later* did massive api changes get lumped into the bios. things like protected memory support, acpi power mode settings, etc. all but required changing the bios away from being a library and into more of a framework/miniature os unto itself. i think the real lessons to be learned here are: 1) the bios interface was dictated by the demands of booting and running a preferred (though not the only) os. in other words, the *os* dictated the bios interface. bios literally was what one would call a "hal" (hardware abstraction layer) these days. the fact that others have technically used bios to boot into other, non-sanctioned oses over the years is, technically, an abuse of the interface that just happens to work. 2) bios was strictly a library. the maximum extent to which bios was a framework stopped firmly at loading in the master boot record and dispatching control to it. from then on, you were utterly on your own. note: no security hoo-haw here. no signed anything. no pe executables. no rom-filesystems. no dedicated uefi partitions. et. al. just read in 512b to 1kb of raw binary blob, and run it. that's it. from then on, bios was a library first and always. anything we come up with for an sbi must, in my opinion, behave the same way. oh, btw, before people get the idea that uefi allows per-partition filesystems, please note that os/2 used "micro-filesystem drivers" to achieve this same effect with nothing more sophisticated than the partition table located in a dos 3.3 mbr. don't drink the uefi kool-aid. 3) corrallary to (2): because bios was just a library, you could throw it away en mass at any time (and after booting into the os of your choice, it frequently was). you could, if you were clever enough with page tables and the like, even replace the bios with your own image if you wanted to. this speaks to what ron has discussed in prior threads over the concerns of not being able to replace m-mode software. 4) support for multiple devices is not necessarily a bad thing; just, don't go hog wild with it. there's no need to support 256 possible serial ports, for example. ok, you have a debugger interface, a resident console, and maybe one more for auxiliary purposes (for example, my kestrel-3 design so far needs *two* serial interfaces to the host pc, one which is the user's console, and one which is used to access mass storage). each of these devices should have their own read/write interface, thus making it impeccably clear in the source code what it is you're trying to do. no need to "open" things. my point here is, going back to the needs of the *os* and not the bios for bios' sake, the interface exposed by the bios should match the overall expectations of the os you're booting. in my case, i *need* two serial interfaces for my prototype computer to function: ergo, it makes perfect sense for my firmware to provide support for two serial interfaces. for the linux, this need not be the case; maybe only one interface is required. > the sbi should be hard to add to, deliberately. it should be used only > when there are no possible alternatives. it needs to be open source > and held in common. it should be possible for a kernel to replace or > at least measure it. and, further, there needs to be some work done on > why you add to it, and why you don't, with bias against adding to it. i'm reposting this block of test because i agree completely with it, and want to point out that it doesn't contradict what i wrote above. > p.s. for interleaving debug and console output firmware, use the > oldest trick in the book: ascii is 7 bits. since console out is 8 > bits, reserve 128 values for console out, and 128 for debug stream, > and if the debug stream needs 8 bit for some words, you know what to > do. it's very easy and doesn't require that we add multiple uart > support to sbi. another option is to use escape sequences preceding each output. escape byte 1 would mean "future bytes are sent to the debugger", while byte 2 would mean "future bytes are intended for console output." this gives you support for all 8-bits (if your debugger interface happens to be binary), with the occasional overhead of escaping escape bytes. trivial to implement both on the receiving and transmitting sides, possibly even simpler than the bit-7-target-address approach above. the only disadvantage is that it's stateful; but if you have a serial connection reliable enough to use with a binary debugging interface, it'll almost certainly be reliable enough for this too. -- samuel a. falvo ii _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv
next prev parent reply other threads:[~2018-11-10 17:41 UTC|newest] Thread overview: 100+ messages / expand[flat|nested] mbox.gz Atom feed top 2018-11-10 2:42 SBI extension proposal v2 Atish Patra 2018-11-10 2:42 ` Atish Patra 2018-11-10 5:12 ` [sw-dev] " Luke Kenneth Casson Leighton 2018-11-10 5:12 ` Luke Kenneth Casson Leighton 2018-11-10 14:50 ` Nick Kossifidis 2018-11-10 14:50 ` Nick Kossifidis 2018-11-10 15:48 ` Luke Kenneth Casson Leighton 2018-11-10 15:48 ` Luke Kenneth Casson Leighton 2018-11-10 16:46 ` ron minnich 2018-11-10 16:46 ` ron minnich 2018-11-10 17:40 ` Luke Kenneth Casson Leighton 2018-11-10 17:40 ` Luke Kenneth Casson Leighton 2018-11-10 17:41 ` Samuel Falvo II [this message] 2018-11-10 17:41 ` Samuel Falvo II 2018-11-10 17:42 ` Luke Kenneth Casson Leighton 2018-11-10 17:42 ` Luke Kenneth Casson Leighton 2018-11-10 17:51 ` Samuel Falvo II 2018-11-10 17:51 ` Samuel Falvo II 2018-11-10 17:55 ` Luke Kenneth Casson Leighton 2018-11-10 17:55 ` Luke Kenneth Casson Leighton 2018-11-10 18:03 ` Samuel Falvo II 2018-11-10 18:03 ` Samuel Falvo II 2018-11-10 17:43 ` Samuel Falvo II 2018-11-10 17:43 ` Samuel Falvo II 2018-11-10 17:41 ` Olof Johansson 2018-11-10 17:41 ` Olof Johansson 2018-11-10 17:47 ` Luke Kenneth Casson Leighton 2018-11-10 17:47 ` Luke Kenneth Casson Leighton 2018-11-10 17:59 ` Nick Kossifidis 2018-11-10 17:59 ` Nick Kossifidis 2018-11-10 18:01 ` ron minnich 2018-11-10 18:01 ` ron minnich 2018-11-10 19:33 ` Luke Kenneth Casson Leighton 2018-11-10 19:33 ` Luke Kenneth Casson Leighton 2018-11-10 19:39 ` Luke Kenneth Casson Leighton 2018-11-10 19:39 ` Luke Kenneth Casson Leighton 2018-11-11 3:15 ` Nick Kossifidis 2018-11-11 3:15 ` Nick Kossifidis 2018-11-11 7:14 ` Luke Kenneth Casson Leighton 2018-11-11 7:14 ` Luke Kenneth Casson Leighton 2018-11-11 13:17 ` Nick Kossifidis 2018-11-11 13:17 ` Nick Kossifidis 2018-11-12 2:08 ` Palmer Dabbelt 2018-11-12 2:08 ` Palmer Dabbelt 2018-11-10 18:02 ` Olof Johansson 2018-11-10 18:02 ` Olof Johansson 2018-11-10 19:34 ` Luke Kenneth Casson Leighton 2018-11-10 19:34 ` Luke Kenneth Casson Leighton 2018-11-13 1:22 ` Michael Clark 2018-11-13 1:22 ` Michael Clark 2018-11-10 17:54 ` Nick Kossifidis 2018-11-10 17:54 ` Nick Kossifidis 2018-11-10 17:59 ` ron minnich 2018-11-10 17:59 ` ron minnich 2018-11-11 3:58 ` Atish Patra 2018-11-11 3:58 ` Atish Patra 2018-12-02 6:18 ` Benjamin Herrenschmidt 2019-01-28 12:31 ` Alexander Graf 2019-01-28 16:33 ` Luke Kenneth Casson Leighton 2019-01-28 16:38 ` Alexander Graf 2019-01-28 16:47 ` Nick Kossifidis 2019-01-28 19:43 ` Alexander Graf 2019-01-28 19:47 ` Atish Patra 2019-01-28 19:48 ` Alexander Graf 2019-01-28 19:40 ` ron minnich 2019-01-28 19:55 ` Alexander Graf 2019-01-28 20:18 ` ron minnich 2019-01-28 20:37 ` Alexander Graf 2019-01-28 22:23 ` ron minnich 2019-01-29 8:53 ` Alexander Graf 2019-01-29 15:52 ` ron minnich 2019-01-28 23:46 ` Luke Kenneth Casson Leighton 2019-01-28 23:22 ` Bruce Hoult 2019-01-29 0:03 ` Luke Kenneth Casson Leighton 2019-01-29 4:28 ` ron minnich [not found] ` <CANs6eMk4z-ZibLW_5o03onu8AQe23uMa2hSieceHFqKS7igLDQ@mail.gmail.com> 2019-01-30 0:05 ` Luke Kenneth Casson Leighton 2019-01-30 0:17 ` ron minnich 2019-01-30 0:49 ` Bruce Hoult 2019-01-30 3:15 ` Luke Kenneth Casson Leighton [not found] ` <09bede45-6ecf-4ded-8615-0be38aac33fc@groups.riscv.org> 2019-01-29 3:58 ` Samuel Falvo II 2019-01-29 4:33 ` ron minnich 2019-02-05 22:29 ` Benjamin Herrenschmidt 2019-02-05 23:02 ` Luís Marques 2019-02-06 7:03 ` ron minnich 2019-02-06 7:54 ` Damien Le Moal 2019-02-07 3:56 ` Paul Walmsley 2019-02-07 7:17 ` Anup Patel 2019-02-07 7:19 ` Anup Patel 2019-01-29 22:41 ` Palmer Dabbelt 2018-11-10 17:43 ` Nick Kossifidis 2018-11-10 17:43 ` Nick Kossifidis 2018-11-10 17:51 ` Luke Kenneth Casson Leighton 2018-11-10 17:51 ` Luke Kenneth Casson Leighton 2018-11-10 5:36 ` David Abdurachmanov 2018-11-10 5:36 ` David Abdurachmanov [not found] ` <CA++6G0BTdybjhqaXm9EhAz0HsgpwfozK6OEL7DuzbS48RbEChA@mail.gmail.com> 2018-11-10 15:09 ` Nick Kossifidis 2018-11-10 15:09 ` Nick Kossifidis 2018-11-12 4:33 ` Nick Kossifidis 2018-11-12 4:33 ` Nick Kossifidis 2018-12-04 23:22 ` [sw-dev] " Atish Patra
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to='CAEz=sokxTJk=0EnRnLeG6LkaZiW-Dr4nmz=2JDgZm893NM-adQ@mail.gmail.com' \ --to=sam.falvo@gmail.com \ --cc=linux-riscv@lists.infradead.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).