Date
1 - 20 of 21
SBI Debug Console Extension Proposal (Draft v1)
Hi All,
Below is the draft proposal for SBI Debug Console Extension.
Please review it and provide feedback.
Thanks,
Anup
Debug Console Extension (EID #0x4442434E "DBCN")
================================================
The debug console extension defines a generic mechanism for boot-time
early prints from supervisor-mode software which allows users to catch
boot-time issues in supervisor-mode software.
This extension replaces legacy console putchar (EID #0x01) extension
and it is better in following ways:
1) It follows the new calling convention defined for SBI v1.0
(or higher).
2) It is based on a shared memory area between SBI implementation
and supervisor-mode software so multiple characters can be
printed using a single SBI call.
The supervisor-mode software must set the shared memory area before
printing characters on the debug console. Also, all HARTs share the
same shared memory area so only one HART needs to set it at boot-time.
Function: Set Console Area (FID #0)
-----------------------------------
struct sbiret sbi_debug_console_set_area(unsigned long addr_div_by_4,
unsigned long size)
Set the shared memory area specified by `addr_div_by_2` and `size`
parameters. The `addr_div_by_4` parameter is base address of the
shared memory area right shifted by 2 whereas `size` parameter is
the size of shared memory area in bytes.
The shared memory area should be normal cacheable memory for the
supervisor-mode software. Also, the shared memory area is global
across all HARTs so SBI implementation must ensure atomicity in
setting the shared memory area.
Errors:
SBI_SUCCESS - Shared memory area set successfully.
SBI_ERR_INVALID_ADDRESS - The shared memory area pointed by
`addr_div_by_2` and `size` parameters
is not normal cacheable memory or not
accessible to supervisor-mode software.
Function: Console Puts (FID #1)
-------------------------------
struct sbiret sbi_debug_console_puts(unsigned long area_offset,
unsigned long num_chars)
Print the string specified by `area_offset` and `num_chars` on
the debug console. The `area_offset` parameter is the start of
string in the shard memory area whereas `num_chars` parameter
is the number of characters (or bytes) in the string.
This is a blocking SBI call and will only return after printing
all characters of the string.
Errors:
SBI_SUCCESS - Characters printed successfully.
SBI_ERR_INVALID_ADDRESS - The start of the string (i.e.
`area_offset`) or end of the string
(i.e. `area_offset + num_chars`) is
outside shared memory area.
Below is the draft proposal for SBI Debug Console Extension.
Please review it and provide feedback.
Thanks,
Anup
Debug Console Extension (EID #0x4442434E "DBCN")
================================================
The debug console extension defines a generic mechanism for boot-time
early prints from supervisor-mode software which allows users to catch
boot-time issues in supervisor-mode software.
This extension replaces legacy console putchar (EID #0x01) extension
and it is better in following ways:
1) It follows the new calling convention defined for SBI v1.0
(or higher).
2) It is based on a shared memory area between SBI implementation
and supervisor-mode software so multiple characters can be
printed using a single SBI call.
The supervisor-mode software must set the shared memory area before
printing characters on the debug console. Also, all HARTs share the
same shared memory area so only one HART needs to set it at boot-time.
Function: Set Console Area (FID #0)
-----------------------------------
struct sbiret sbi_debug_console_set_area(unsigned long addr_div_by_4,
unsigned long size)
Set the shared memory area specified by `addr_div_by_2` and `size`
parameters. The `addr_div_by_4` parameter is base address of the
shared memory area right shifted by 2 whereas `size` parameter is
the size of shared memory area in bytes.
The shared memory area should be normal cacheable memory for the
supervisor-mode software. Also, the shared memory area is global
across all HARTs so SBI implementation must ensure atomicity in
setting the shared memory area.
Errors:
SBI_SUCCESS - Shared memory area set successfully.
SBI_ERR_INVALID_ADDRESS - The shared memory area pointed by
`addr_div_by_2` and `size` parameters
is not normal cacheable memory or not
accessible to supervisor-mode software.
Function: Console Puts (FID #1)
-------------------------------
struct sbiret sbi_debug_console_puts(unsigned long area_offset,
unsigned long num_chars)
Print the string specified by `area_offset` and `num_chars` on
the debug console. The `area_offset` parameter is the start of
string in the shard memory area whereas `num_chars` parameter
is the number of characters (or bytes) in the string.
This is a blocking SBI call and will only return after printing
all characters of the string.
Errors:
SBI_SUCCESS - Characters printed successfully.
SBI_ERR_INVALID_ADDRESS - The start of the string (i.e.
`area_offset`) or end of the string
(i.e. `area_offset + num_chars`) is
outside shared memory area.
Heinrich Schuchardt
On 6/1/22 18:17, Anup Patel wrote:
Do we need an ecall that closes the SBI console to further access?
Can we avoid this extra function?
Can we simply assume that the caller of sbi_debug_console_puts() provides a physical address pointer to a memory area that is suitable?
But why is an alignment needed here at all? And why 4 aligned?
Do we need num_chars? Are we expecting to provide binary output? Using 0x00 as terminator would be adequate in most cases.
What is the requirement on the console? Does it have to support 8bit output to allow for UTF-8?
Do we make any assumptions about encoding?
How would we handle a console set up to 7bit + parity if a character > 0x7f is sent?
* set up of the UART failed in OpenSBI
* no UART defined in the device-tree
* ...
So let us add SBI_ERR_FAILED to the list.
Best regards
Heinrich
Hi All,Thanks for starting to close this gap.
Below is the draft proposal for SBI Debug Console Extension.
Please review it and provide feedback.
Thanks,
Anup
Debug Console Extension (EID #0x4442434E "DBCN")
================================================
The debug console extension defines a generic mechanism for boot-time
early prints from supervisor-mode software which allows users to catch
boot-time issues in supervisor-mode software.
This extension replaces legacy console putchar (EID #0x01) extension
and it is better in following ways:
1) It follows the new calling convention defined for SBI v1.0I miss a discussion of the conflicts that can arise if the configuration of the serial console is changed by the caller.
(or higher).
2) It is based on a shared memory area between SBI implementation
and supervisor-mode software so multiple characters can be
printed using a single SBI call.
Do we need an ecall that closes the SBI console to further access?
The supervisor-mode software must set the shared memory area beforeIsn't it M-mode software that has to program the MMU to allow all harts in M-mode and S-mode access to the memory area? What is the S-mode software to do about the memory area prior to calling sbi_debug_console_set_area()?
printing characters on the debug console. Also, all HARTs share the
same shared memory area so only one HART needs to set it at boot-time.
Function: Set Console Area (FID #0)The console output is needed on the very start of the S-mode software, before setting up anything.
-----------------------------------
struct sbiret sbi_debug_console_set_area(unsigned long addr_div_by_4,
unsigned long size)
Can we avoid this extra function?
Can we simply assume that the caller of sbi_debug_console_puts() provides a physical address pointer to a memory area that is suitable?
Set the shared memory area specified by `addr_div_by_2` and `size`%s/addr_div_by_2/addr_div_by_4/
parameters. The `addr_div_by_4` parameter is base address of the%s/is base/is the base/
shared memory area right shifted by 2 whereas `size` parameter isWhy shifting the address? I would prefer to keep it simple for the caller. If the alignment is not suitable, return an error.
the size of shared memory area in bytes.
But why is an alignment needed here at all? And why 4 aligned?
The shared memory area should be normal cacheable memory for theI would prefer to simply pass a physical address pointer here with no requirements on alignment. And no prior SBI call.
supervisor-mode software. Also, the shared memory area is global
across all HARTs so SBI implementation must ensure atomicity in
setting the shared memory area.
Errors:
SBI_SUCCESS - Shared memory area set successfully.
SBI_ERR_INVALID_ADDRESS - The shared memory area pointed by
`addr_div_by_2` and `size` parameters
is not normal cacheable memory or not
accessible to supervisor-mode software.
Function: Console Puts (FID #1)
-------------------------------
struct sbiret sbi_debug_console_puts(unsigned long area_offset,
unsigned long num_chars)
Do we need num_chars? Are we expecting to provide binary output? Using 0x00 as terminator would be adequate in most cases.
What is the requirement on the console? Does it have to support 8bit output to allow for UTF-8?
Do we make any assumptions about encoding?
How would we handle a console set up to 7bit + parity if a character > 0x7f is sent?
Print the string specified by `area_offset` and `num_chars` on%s/shard/shared/
the debug console. The `area_offset` parameter is the start of
string in the shard memory area whereas `num_chars` parameter
is the number of characters (or bytes) in the string.There could be other reasons of failures:
This is a blocking SBI call and will only return after printing
all characters of the string.
Errors:
SBI_SUCCESS - Characters printed successfully.
SBI_ERR_INVALID_ADDRESS - The start of the string (i.e.
`area_offset`) or end of the string
(i.e. `area_offset + num_chars`) is
outside shared memory area.
* set up of the UART failed in OpenSBI
* no UART defined in the device-tree
* ...
So let us add SBI_ERR_FAILED to the list.
Best regards
Heinrich
Heiko Stuebner <heiko@...>
Hi Anup,
Am Mittwoch, 1. Juni 2022, 18:17:32 CEST schrieb Anup Patel:
characters, so this will probably improve performance quite a bit :-)
I guess I still would like to have an _additional_ single-character
putc call. As mentioned in the other thread [0], especially on consumer
hardware [where there is no elaborate debug infrastructure] this can
be a very handy debugging tool even in the earliest stages of a
booting kernel (both before relocation and even inside the startup
assembly).
I.e. just doing a
li a7, 1
li a6, 0
li a0, 36
ecall
in any kernel assembly will just output a "$" character right now, without
needing any preparation at all - same with using the current
sbi_console_putchar() directly in c-code.
This _can_ be very helpful in some cases, so I guess it would be nice
to keep such a functionality around also in the new spec.
Thanks
Heiko
[0] http://lists.infradead.org/pipermail/opensbi/2022-June/002796.html
Am Mittwoch, 1. Juni 2022, 18:17:32 CEST schrieb Anup Patel:
Hi All,typo in the "div_by_2" (not 4 like below and in the function itself) ?
Below is the draft proposal for SBI Debug Console Extension.
Please review it and provide feedback.
Thanks,
Anup
Debug Console Extension (EID #0x4442434E "DBCN")
================================================
The debug console extension defines a generic mechanism for boot-time
early prints from supervisor-mode software which allows users to catch
boot-time issues in supervisor-mode software.
This extension replaces legacy console putchar (EID #0x01) extension
and it is better in following ways:
1) It follows the new calling convention defined for SBI v1.0
(or higher).
2) It is based on a shared memory area between SBI implementation
and supervisor-mode software so multiple characters can be
printed using a single SBI call.
The supervisor-mode software must set the shared memory area before
printing characters on the debug console. Also, all HARTs share the
same shared memory area so only one HART needs to set it at boot-time.
Function: Set Console Area (FID #0)
-----------------------------------
struct sbiret sbi_debug_console_set_area(unsigned long addr_div_by_4,
unsigned long size)
Set the shared memory area specified by `addr_div_by_2` and `size`
parameters. The `addr_div_by_4` parameter is base address of theThis will vastly reduce the number of needed ecalls when outputting
shared memory area right shifted by 2 whereas `size` parameter is
the size of shared memory area in bytes.
The shared memory area should be normal cacheable memory for the
supervisor-mode software. Also, the shared memory area is global
across all HARTs so SBI implementation must ensure atomicity in
setting the shared memory area.
Errors:
SBI_SUCCESS - Shared memory area set successfully.
SBI_ERR_INVALID_ADDRESS - The shared memory area pointed by
`addr_div_by_2` and `size` parameters
is not normal cacheable memory or not
accessible to supervisor-mode software.
Function: Console Puts (FID #1)
-------------------------------
struct sbiret sbi_debug_console_puts(unsigned long area_offset,
unsigned long num_chars)
Print the string specified by `area_offset` and `num_chars` on
the debug console. The `area_offset` parameter is the start of
string in the shard memory area whereas `num_chars` parameter
is the number of characters (or bytes) in the string.
This is a blocking SBI call and will only return after printing
all characters of the string.
Errors:
SBI_SUCCESS - Characters printed successfully.
SBI_ERR_INVALID_ADDRESS - The start of the string (i.e.
`area_offset`) or end of the string
(i.e. `area_offset + num_chars`) is
outside shared memory area.
characters, so this will probably improve performance quite a bit :-)
I guess I still would like to have an _additional_ single-character
putc call. As mentioned in the other thread [0], especially on consumer
hardware [where there is no elaborate debug infrastructure] this can
be a very handy debugging tool even in the earliest stages of a
booting kernel (both before relocation and even inside the startup
assembly).
I.e. just doing a
li a7, 1
li a6, 0
li a0, 36
ecall
in any kernel assembly will just output a "$" character right now, without
needing any preparation at all - same with using the current
sbi_console_putchar() directly in c-code.
This _can_ be very helpful in some cases, so I guess it would be nice
to keep such a functionality around also in the new spec.
Thanks
Heiko
[0] http://lists.infradead.org/pipermail/opensbi/2022-June/002796.html
On Wed, Jun 1, 2022 at 11:59 PM Heinrich Schuchardt
<heinrich.schuchardt@...> wrote:
status and data registers so for most serial ports support the M-mode
firmware will adapt to serial port configuration changes.
In fact, this is why we never had a special SBI call for serial port
reconfiguration in legacy SBI v0.1 as well.
In case of virtualization, the serial port (or console) is emulated so
the special SBI call is not useful for virtualization.
its memory to be used as shared memory. The proposal only mandates
that whatever memory is selected by S-mode software should be a
regular cacheable memory (not IO memory). Also, if Svpbmt is available
then S-mode software should only use memory type 0 in the PTEs.
but it will complicate things in future when we have supervisor software
encrypting it's own memory (using special ISA support) because in this
case supervisor software will have to unprotect memory every time the
sbi_debug_console_puts() is called and protect it again after the call.
"unsigned long" is 32bits wide. This is because Sv32 PTEs allow
34bits of PPN. In fact, even instructions such as HFENCE.GVMA
have this "address right shift by 2" requirement based on this rationale.
a large per-populated string in shared memory. Assuming that string
is always terminated by 0x00 in sbi_debug_console_puts() will break
this flexibility.
I am of the opinion to keep such encoding related assumptions to be
minimal.
Anup
<heinrich.schuchardt@...> wrote:
Usually, the serial port related code in M-mode firmware only uses
On 6/1/22 18:17, Anup Patel wrote:Hi All,Thanks for starting to close this gap.
Below is the draft proposal for SBI Debug Console Extension.
Please review it and provide feedback.
Thanks,
Anup
Debug Console Extension (EID #0x4442434E "DBCN")
================================================
The debug console extension defines a generic mechanism for boot-time
early prints from supervisor-mode software which allows users to catch
boot-time issues in supervisor-mode software.
This extension replaces legacy console putchar (EID #0x01) extension
and it is better in following ways:1) It follows the new calling convention defined for SBI v1.0I miss a discussion of the conflicts that can arise if the configuration
(or higher).
2) It is based on a shared memory area between SBI implementation
and supervisor-mode software so multiple characters can be
printed using a single SBI call.
of the serial console is changed by the caller.
Do we need an ecall that closes the SBI console to further access?
status and data registers so for most serial ports support the M-mode
firmware will adapt to serial port configuration changes.
In fact, this is why we never had a special SBI call for serial port
reconfiguration in legacy SBI v0.1 as well.
In case of virtualization, the serial port (or console) is emulated so
the special SBI call is not useful for virtualization.
Actually, it's the S-mode software which is voluntarily giving a portion ofIsn't it M-mode software that has to program the MMU to allow all harts
The supervisor-mode software must set the shared memory area before
printing characters on the debug console. Also, all HARTs share the
same shared memory area so only one HART needs to set it at boot-time.
in M-mode and S-mode access to the memory area? What is the S-mode
software to do about the memory area prior to calling
sbi_debug_console_set_area()?
its memory to be used as shared memory. The proposal only mandates
that whatever memory is selected by S-mode software should be a
regular cacheable memory (not IO memory). Also, if Svpbmt is available
then S-mode software should only use memory type 0 in the PTEs.
Theoretically, we can avoid the extra function to set shared memory areaThe console output is needed on the very start of the S-mode software,
Function: Set Console Area (FID #0)
-----------------------------------
struct sbiret sbi_debug_console_set_area(unsigned long addr_div_by_4,
unsigned long size)
before setting up anything.
Can we avoid this extra function?
Can we simply assume that the caller of sbi_debug_console_puts()
provides a physical address pointer to a memory area that is suitable?
but it will complicate things in future when we have supervisor software
encrypting it's own memory (using special ISA support) because in this
case supervisor software will have to unprotect memory every time the
sbi_debug_console_puts() is called and protect it again after the call.
Okay, I will update.%s/addr_div_by_2/addr_div_by_4/
Set the shared memory area specified by `addr_div_by_2` and `size`
Okay, I will update.parameters. The `addr_div_by_4` parameter is base address of the%s/is base/is the base/
For RV32 S-mode, the physical address space is 34bits wide butshared memory area right shifted by 2 whereas `size` parameter isWhy shifting the address? I would prefer to keep it simple for the
the size of shared memory area in bytes.
caller. If the alignment is not suitable, return an error.
But why is an alignment needed here at all? And why 4 aligned?
"unsigned long" is 32bits wide. This is because Sv32 PTEs allow
34bits of PPN. In fact, even instructions such as HFENCE.GVMA
have this "address right shift by 2" requirement based on this rationale.
Bare-metal tests (or assembly sources) can print sub-strings fromI would prefer to simply pass a physical address pointer here with no
The shared memory area should be normal cacheable memory for the
supervisor-mode software. Also, the shared memory area is global
across all HARTs so SBI implementation must ensure atomicity in
setting the shared memory area.
Errors:
SBI_SUCCESS - Shared memory area set successfully.
SBI_ERR_INVALID_ADDRESS - The shared memory area pointed by
`addr_div_by_2` and `size` parameters
is not normal cacheable memory or not
accessible to supervisor-mode software.
Function: Console Puts (FID #1)
-------------------------------
struct sbiret sbi_debug_console_puts(unsigned long area_offset,
unsigned long num_chars)
requirements on alignment. And no prior SBI call.
Do we need num_chars? Are we expecting to provide binary output? Using
0x00 as terminator would be adequate in most cases.
a large per-populated string in shared memory. Assuming that string
is always terminated by 0x00 in sbi_debug_console_puts() will break
this flexibility.
We need to clarify this. Suggestions ?
What is the requirement on the console? Does it have to support 8bit
output to allow for UTF-8?
Same as above, this needs more clarification. Suggestions ?
Do we make any assumptions about encoding?
I am of the opinion to keep such encoding related assumptions to be
minimal.
I would consider this to be part of the clarification we add for encoding.
How would we handle a console set up to 7bit + parity if a character >
0x7f is sent?
Okay, I will update.%s/shard/shared/
Print the string specified by `area_offset` and `num_chars` on
the debug console. The `area_offset` parameter is the start of
string in the shard memory area whereas `num_chars` parameter
Okay, I will add.is the number of characters (or bytes) in the string.There could be other reasons of failures:
This is a blocking SBI call and will only return after printing
all characters of the string.
Errors:
SBI_SUCCESS - Characters printed successfully.
SBI_ERR_INVALID_ADDRESS - The start of the string (i.e.
`area_offset`) or end of the string
(i.e. `area_offset + num_chars`) is
outside shared memory area.
* set up of the UART failed in OpenSBI
* no UART defined in the device-tree
* ...
So let us add SBI_ERR_FAILED to the list.
Regards,
Best regards
Heinrich
Anup
On Thu, Jun 2, 2022 at 12:02 AM Heiko Stübner <heiko@...> wrote:
assembly sources. Just set the base address of pre-populated strings
once on boot hart and print from anywhere using usual 4-5 instruction
(similar to what posted above).
Anup
You can easily create multiple pre-populated strings using ".asciiz" in
Hi Anup,
Am Mittwoch, 1. Juni 2022, 18:17:32 CEST schrieb Anup Patel:Hi All,typo in the "div_by_2" (not 4 like below and in the function itself) ?
Below is the draft proposal for SBI Debug Console Extension.
Please review it and provide feedback.
Thanks,
Anup
Debug Console Extension (EID #0x4442434E "DBCN")
================================================
The debug console extension defines a generic mechanism for boot-time
early prints from supervisor-mode software which allows users to catch
boot-time issues in supervisor-mode software.
This extension replaces legacy console putchar (EID #0x01) extension
and it is better in following ways:
1) It follows the new calling convention defined for SBI v1.0
(or higher).
2) It is based on a shared memory area between SBI implementation
and supervisor-mode software so multiple characters can be
printed using a single SBI call.
The supervisor-mode software must set the shared memory area before
printing characters on the debug console. Also, all HARTs share the
same shared memory area so only one HART needs to set it at boot-time.
Function: Set Console Area (FID #0)
-----------------------------------
struct sbiret sbi_debug_console_set_area(unsigned long addr_div_by_4,
unsigned long size)
Set the shared memory area specified by `addr_div_by_2` and `size`parameters. The `addr_div_by_4` parameter is base address of theThis will vastly reduce the number of needed ecalls when outputting
shared memory area right shifted by 2 whereas `size` parameter is
the size of shared memory area in bytes.
The shared memory area should be normal cacheable memory for the
supervisor-mode software. Also, the shared memory area is global
across all HARTs so SBI implementation must ensure atomicity in
setting the shared memory area.
Errors:
SBI_SUCCESS - Shared memory area set successfully.
SBI_ERR_INVALID_ADDRESS - The shared memory area pointed by
`addr_div_by_2` and `size` parameters
is not normal cacheable memory or not
accessible to supervisor-mode software.
Function: Console Puts (FID #1)
-------------------------------
struct sbiret sbi_debug_console_puts(unsigned long area_offset,
unsigned long num_chars)
Print the string specified by `area_offset` and `num_chars` on
the debug console. The `area_offset` parameter is the start of
string in the shard memory area whereas `num_chars` parameter
is the number of characters (or bytes) in the string.
This is a blocking SBI call and will only return after printing
all characters of the string.
Errors:
SBI_SUCCESS - Characters printed successfully.
SBI_ERR_INVALID_ADDRESS - The start of the string (i.e.
`area_offset`) or end of the string
(i.e. `area_offset + num_chars`) is
outside shared memory area.
characters, so this will probably improve performance quite a bit :-)
I guess I still would like to have an _additional_ single-character
putc call. As mentioned in the other thread [0], especially on consumer
hardware [where there is no elaborate debug infrastructure] this can
be a very handy debugging tool even in the earliest stages of a
booting kernel (both before relocation and even inside the startup
assembly).
I.e. just doing a
li a7, 1
li a6, 0
li a0, 36
ecall
in any kernel assembly will just output a "$" character right now, without
needing any preparation at all - same with using the current
sbi_console_putchar() directly in c-code.
This _can_ be very helpful in some cases, so I guess it would be nice
to keep such a functionality around also in the new spec.
assembly sources. Just set the base address of pre-populated strings
once on boot hart and print from anywhere using usual 4-5 instruction
(similar to what posted above).
Regards,
Thanks
Heiko
[0] http://lists.infradead.org/pipermail/opensbi/2022-June/002796.html
Anup
On Thu, Jun 2, 2022 at 9:14 AM Xiang W <wxjstz@...> wrote:
his comment.
Regards,
Anup
Heinrich has a similar suggestion so please see my response to
在 2022-06-01星期三的 21:47 +0530,Anup Patel写道:Hi All,The use of these two APIs is too complicated, and the supervisor-mode
Below is the draft proposal for SBI Debug Console Extension.
Please review it and provide feedback.
Thanks,
Anup
software needs to create a data structure to manage the Console Area.
I recommend using the simpler interface:
struct sbiret sbi_debug_console_puts(unsigned long addr,
unsigned long num_chars)
his comment.
Regards,
Anup
Regards,
Xiang W
Debug Console Extension (EID #0x4442434E "DBCN")
================================================
The debug console extension defines a generic mechanism for boot-time
early prints from supervisor-mode software which allows users to catch
boot-time issues in supervisor-mode software.
This extension replaces legacy console putchar (EID #0x01) extension
and it is better in following ways:
1) It follows the new calling convention defined for SBI v1.0
(or higher).
2) It is based on a shared memory area between SBI implementation
and supervisor-mode software so multiple characters can be
printed using a single SBI call.
The supervisor-mode software must set the shared memory area before
printing characters on the debug console. Also, all HARTs share the
same shared memory area so only one HART needs to set it at boot-time.
Function: Set Console Area (FID #0)
-----------------------------------
struct sbiret sbi_debug_console_set_area(unsigned long addr_div_by_4,
unsigned long size)
Set the shared memory area specified by `addr_div_by_2` and `size`
parameters. The `addr_div_by_4` parameter is base address of the
shared memory area right shifted by 2 whereas `size` parameter is
the size of shared memory area in bytes.
The shared memory area should be normal cacheable memory for the
supervisor-mode software. Also, the shared memory area is global
across all HARTs so SBI implementation must ensure atomicity in
setting the shared memory area.
Errors:
SBI_SUCCESS - Shared memory area set successfully.
SBI_ERR_INVALID_ADDRESS - The shared memory area pointed by
`addr_div_by_2` and `size` parameters
is not normal cacheable memory or not
accessible to supervisor-mode software.
Function: Console Puts (FID #1)
-------------------------------
struct sbiret sbi_debug_console_puts(unsigned long area_offset,
unsigned long num_chars)
Print the string specified by `area_offset` and `num_chars` on
the debug console. The `area_offset` parameter is the start of
string in the shard memory area whereas `num_chars` parameter
is the number of characters (or bytes) in the string.
This is a blocking SBI call and will only return after printing
all characters of the string.
Errors:
SBI_SUCCESS - Characters printed successfully.
SBI_ERR_INVALID_ADDRESS - The start of the string (i.e.
`area_offset`) or end of the string
(i.e. `area_offset + num_chars`) is
outside shared memory area.
--
opensbi mailing list
opensbi@...
http://lists.infradead.org/mailman/listinfo/opensbi
Heiko Stuebner <heiko@...>
Am Donnerstag, 2. Juni 2022, 10:47:58 CEST schrieb Anup Patel:
On Thu, Jun 2, 2022 at 12:02 AM Heiko Stübner <heiko@...> wrote:ok, sounds like a plan as well :-)You can easily create multiple pre-populated strings using ".asciiz" in
Hi Anup,
Am Mittwoch, 1. Juni 2022, 18:17:32 CEST schrieb Anup Patel:Hi All,typo in the "div_by_2" (not 4 like below and in the function itself) ?
Below is the draft proposal for SBI Debug Console Extension.
Please review it and provide feedback.
Thanks,
Anup
Debug Console Extension (EID #0x4442434E "DBCN")
================================================
The debug console extension defines a generic mechanism for boot-time
early prints from supervisor-mode software which allows users to catch
boot-time issues in supervisor-mode software.
This extension replaces legacy console putchar (EID #0x01) extension
and it is better in following ways:
1) It follows the new calling convention defined for SBI v1.0
(or higher).
2) It is based on a shared memory area between SBI implementation
and supervisor-mode software so multiple characters can be
printed using a single SBI call.
The supervisor-mode software must set the shared memory area before
printing characters on the debug console. Also, all HARTs share the
same shared memory area so only one HART needs to set it at boot-time.
Function: Set Console Area (FID #0)
-----------------------------------
struct sbiret sbi_debug_console_set_area(unsigned long addr_div_by_4,
unsigned long size)
Set the shared memory area specified by `addr_div_by_2` and `size`parameters. The `addr_div_by_4` parameter is base address of theThis will vastly reduce the number of needed ecalls when outputting
shared memory area right shifted by 2 whereas `size` parameter is
the size of shared memory area in bytes.
The shared memory area should be normal cacheable memory for the
supervisor-mode software. Also, the shared memory area is global
across all HARTs so SBI implementation must ensure atomicity in
setting the shared memory area.
Errors:
SBI_SUCCESS - Shared memory area set successfully.
SBI_ERR_INVALID_ADDRESS - The shared memory area pointed by
`addr_div_by_2` and `size` parameters
is not normal cacheable memory or not
accessible to supervisor-mode software.
Function: Console Puts (FID #1)
-------------------------------
struct sbiret sbi_debug_console_puts(unsigned long area_offset,
unsigned long num_chars)
Print the string specified by `area_offset` and `num_chars` on
the debug console. The `area_offset` parameter is the start of
string in the shard memory area whereas `num_chars` parameter
is the number of characters (or bytes) in the string.
This is a blocking SBI call and will only return after printing
all characters of the string.
Errors:
SBI_SUCCESS - Characters printed successfully.
SBI_ERR_INVALID_ADDRESS - The start of the string (i.e.
`area_offset`) or end of the string
(i.e. `area_offset + num_chars`) is
outside shared memory area.
characters, so this will probably improve performance quite a bit :-)
I guess I still would like to have an _additional_ single-character
putc call. As mentioned in the other thread [0], especially on consumer
hardware [where there is no elaborate debug infrastructure] this can
be a very handy debugging tool even in the earliest stages of a
booting kernel (both before relocation and even inside the startup
assembly).
I.e. just doing a
li a7, 1
li a6, 0
li a0, 36
ecall
in any kernel assembly will just output a "$" character right now, without
needing any preparation at all - same with using the current
sbi_console_putchar() directly in c-code.
This _can_ be very helpful in some cases, so I guess it would be nice
to keep such a functionality around also in the new spec.
assembly sources. Just set the base address of pre-populated strings
once on boot hart and print from anywhere using usual 4-5 instruction
(similar to what posted above).
[0] http://lists.infradead.org/pipermail/opensbi/2022-June/002796.htmlRegards,
Anup
Heinrich Schuchardt
On 6/2/22 10:44, Anup Patel wrote:
The function might be called repeatedly by different threads with different values. How do you want to keep track of all of these different areas?
Memory shared between different security realms will arise in many different scenarios. As this is not console specific it should be in a separate extension. That extension should be defined once we have clarity about how security realms are managed.
The easiest thing is to just ignore the extra bits. So let't state this here.
Best regards
Heinrich
On Wed, Jun 1, 2022 at 11:59 PM Heinrich SchuchardtCurrently this function is just a nop(). It is not needed in this revision of the extension.
<heinrich.schuchardt@...> wrote:Usually, the serial port related code in M-mode firmware only uses
On 6/1/22 18:17, Anup Patel wrote:Hi All,Thanks for starting to close this gap.
Below is the draft proposal for SBI Debug Console Extension.
Please review it and provide feedback.
Thanks,
Anup
Debug Console Extension (EID #0x4442434E "DBCN")
================================================
The debug console extension defines a generic mechanism for boot-time
early prints from supervisor-mode software which allows users to catch
boot-time issues in supervisor-mode software.
This extension replaces legacy console putchar (EID #0x01) extension
and it is better in following ways:1) It follows the new calling convention defined for SBI v1.0I miss a discussion of the conflicts that can arise if the configuration
(or higher).
2) It is based on a shared memory area between SBI implementation
and supervisor-mode software so multiple characters can be
printed using a single SBI call.
of the serial console is changed by the caller.
Do we need an ecall that closes the SBI console to further access?
status and data registers so for most serial ports support the M-mode
firmware will adapt to serial port configuration changes.
In fact, this is why we never had a special SBI call for serial port
reconfiguration in legacy SBI v0.1 as well.
In case of virtualization, the serial port (or console) is emulated so
the special SBI call is not useful for virtualization.Actually, it's the S-mode software which is voluntarily giving a portion ofIsn't it M-mode software that has to program the MMU to allow all harts
The supervisor-mode software must set the shared memory area before
printing characters on the debug console. Also, all HARTs share the
same shared memory area so only one HART needs to set it at boot-time.
in M-mode and S-mode access to the memory area? What is the S-mode
software to do about the memory area prior to calling
sbi_debug_console_set_area()?
its memory to be used as shared memory. The proposal only mandates
that whatever memory is selected by S-mode software should be a
regular cacheable memory (not IO memory). Also, if Svpbmt is available
then S-mode software should only use memory type 0 in the PTEs.Theoretically, we can avoid the extra function to set shared memory areaThe console output is needed on the very start of the S-mode software,
Function: Set Console Area (FID #0)
-----------------------------------
struct sbiret sbi_debug_console_set_area(unsigned long addr_div_by_4,
unsigned long size)
before setting up anything.
Can we avoid this extra function?
Can we simply assume that the caller of sbi_debug_console_puts()
provides a physical address pointer to a memory area that is suitable?
but it will complicate things in future when we have supervisor software
encrypting it's own memory (using special ISA support) because in this
case supervisor software will have to unprotect memory every time the
sbi_debug_console_puts() is called and protect it again after the call.
The function might be called repeatedly by different threads with different values. How do you want to keep track of all of these different areas?
Memory shared between different security realms will arise in many different scenarios. As this is not console specific it should be in a separate extension. That extension should be defined once we have clarity about how security realms are managed.
sbi_debug_console_set_area() might be called with different values by different threads. An offset is ambiguous as it does not define to which of the different shared areas it relates. Please, use a pointer.Okay, I will update.%s/addr_div_by_2/addr_div_by_4/
Set the shared memory area specified by `addr_div_by_2` and `size`Okay, I will update.parameters. The `addr_div_by_4` parameter is base address of the%s/is base/is the base/For RV32 S-mode, the physical address space is 34bits wide butshared memory area right shifted by 2 whereas `size` parameter isWhy shifting the address? I would prefer to keep it simple for the
the size of shared memory area in bytes.
caller. If the alignment is not suitable, return an error.
But why is an alignment needed here at all? And why 4 aligned?
"unsigned long" is 32bits wide. This is because Sv32 PTEs allow
34bits of PPN. In fact, even instructions such as HFENCE.GVMA
have this "address right shift by 2" requirement based on this rationale.I would prefer to simply pass a physical address pointer here with no
The shared memory area should be normal cacheable memory for the
supervisor-mode software. Also, the shared memory area is global
across all HARTs so SBI implementation must ensure atomicity in
setting the shared memory area.
Errors:
SBI_SUCCESS - Shared memory area set successfully.
SBI_ERR_INVALID_ADDRESS - The shared memory area pointed by
`addr_div_by_2` and `size` parameters
is not normal cacheable memory or not
accessible to supervisor-mode software.
Function: Console Puts (FID #1)
-------------------------------
struct sbiret sbi_debug_console_puts(unsigned long area_offset,
unsigned long num_chars)
requirements on alignment. And no prior SBI call.
OKBare-metal tests (or assembly sources) can print sub-strings from
Do we need num_chars? Are we expecting to provide binary output? Using
0x00 as terminator would be adequate in most cases.
a large per-populated string in shared memory. Assuming that string
is always terminated by 0x00 in sbi_debug_console_puts() will break
this flexibility.
The platform specification would be the right place to require 8-bit support for the console.We need to clarify this. Suggestions ?
What is the requirement on the console? Does it have to support 8bit
output to allow for UTF-8?
We should add to the platform specification that UTF-8 output is assumed on the serial console.Same as above, this needs more clarification. Suggestions ?
Do we make any assumptions about encoding?
I am of the opinion to keep such encoding related assumptions to beWe should state if extra bits are ignored or the bytes are not send.
minimal.I would consider this to be part of the clarification we add for encoding.
How would we handle a console set up to 7bit + parity if a character >
0x7f is sent?
The easiest thing is to just ignore the extra bits. So let't state this here.
Best regards
Heinrich
Okay, I will update.%s/shard/shared/
Print the string specified by `area_offset` and `num_chars` on
the debug console. The `area_offset` parameter is the start of
string in the shard memory area whereas `num_chars` parameterOkay, I will add.is the number of characters (or bytes) in the string.There could be other reasons of failures:
This is a blocking SBI call and will only return after printing
all characters of the string.
Errors:
SBI_SUCCESS - Characters printed successfully.
SBI_ERR_INVALID_ADDRESS - The start of the string (i.e.
`area_offset`) or end of the string
(i.e. `area_offset + num_chars`) is
outside shared memory area.
* set up of the UART failed in OpenSBI
* no UART defined in the device-tree
* ...
So let us add SBI_ERR_FAILED to the list.Regards,
Best regards
Heinrich
Anup
Heiko Stuebner <heiko@...>
Am Donnerstag, 2. Juni 2022, 10:50:56 CEST schrieb Heiko Stübner:
I.e. in response to Heinrich's mail you talk about svpbmt, so I guess you
expect virtual memory there, so what is the expected value-type before
the mmu is setup in S-mode ?
Am Donnerstag, 2. Juni 2022, 10:47:58 CEST schrieb Anup Patel:though, how does that relate to the time before MMU setup?On Thu, Jun 2, 2022 at 12:02 AM Heiko Stübner <heiko@...> wrote:ok, sounds like a plan as well :-)You can easily create multiple pre-populated strings using ".asciiz" in
Hi Anup,
Am Mittwoch, 1. Juni 2022, 18:17:32 CEST schrieb Anup Patel:Hi All,typo in the "div_by_2" (not 4 like below and in the function itself) ?
Below is the draft proposal for SBI Debug Console Extension.
Please review it and provide feedback.
Thanks,
Anup
Debug Console Extension (EID #0x4442434E "DBCN")
================================================
The debug console extension defines a generic mechanism for boot-time
early prints from supervisor-mode software which allows users to catch
boot-time issues in supervisor-mode software.
This extension replaces legacy console putchar (EID #0x01) extension
and it is better in following ways:
1) It follows the new calling convention defined for SBI v1.0
(or higher).
2) It is based on a shared memory area between SBI implementation
and supervisor-mode software so multiple characters can be
printed using a single SBI call.
The supervisor-mode software must set the shared memory area before
printing characters on the debug console. Also, all HARTs share the
same shared memory area so only one HART needs to set it at boot-time.
Function: Set Console Area (FID #0)
-----------------------------------
struct sbiret sbi_debug_console_set_area(unsigned long addr_div_by_4,
unsigned long size)
Set the shared memory area specified by `addr_div_by_2` and `size`parameters. The `addr_div_by_4` parameter is base address of theThis will vastly reduce the number of needed ecalls when outputting
shared memory area right shifted by 2 whereas `size` parameter is
the size of shared memory area in bytes.
The shared memory area should be normal cacheable memory for the
supervisor-mode software. Also, the shared memory area is global
across all HARTs so SBI implementation must ensure atomicity in
setting the shared memory area.
Errors:
SBI_SUCCESS - Shared memory area set successfully.
SBI_ERR_INVALID_ADDRESS - The shared memory area pointed by
`addr_div_by_2` and `size` parameters
is not normal cacheable memory or not
accessible to supervisor-mode software.
Function: Console Puts (FID #1)
-------------------------------
struct sbiret sbi_debug_console_puts(unsigned long area_offset,
unsigned long num_chars)
Print the string specified by `area_offset` and `num_chars` on
the debug console. The `area_offset` parameter is the start of
string in the shard memory area whereas `num_chars` parameter
is the number of characters (or bytes) in the string.
This is a blocking SBI call and will only return after printing
all characters of the string.
Errors:
SBI_SUCCESS - Characters printed successfully.
SBI_ERR_INVALID_ADDRESS - The start of the string (i.e.
`area_offset`) or end of the string
(i.e. `area_offset + num_chars`) is
outside shared memory area.
characters, so this will probably improve performance quite a bit :-)
I guess I still would like to have an _additional_ single-character
putc call. As mentioned in the other thread [0], especially on consumer
hardware [where there is no elaborate debug infrastructure] this can
be a very handy debugging tool even in the earliest stages of a
booting kernel (both before relocation and even inside the startup
assembly).
I.e. just doing a
li a7, 1
li a6, 0
li a0, 36
ecall
in any kernel assembly will just output a "$" character right now, without
needing any preparation at all - same with using the current
sbi_console_putchar() directly in c-code.
This _can_ be very helpful in some cases, so I guess it would be nice
to keep such a functionality around also in the new spec.
assembly sources. Just set the base address of pre-populated strings
once on boot hart and print from anywhere using usual 4-5 instruction
(similar to what posted above).
I.e. in response to Heinrich's mail you talk about svpbmt, so I guess you
expect virtual memory there, so what is the expected value-type before
the mmu is setup in S-mode ?
[0] http://lists.infradead.org/pipermail/opensbi/2022-June/002796.htmlRegards,
Anup
On Thu, Jun 2, 2022 at 10:08 AM Xiang W <wxjstz@...> wrote:
then we will end-up with such memory management calls. Memory allocators
are generally hard to get it right and this also adds lot of bookkeeping and
state management in SBI implementations (e.g. OpenSBI, KVM RISC-V,
and various hypervisors).
Further, some of the SBI extensions (such as Steal Time Accounting) will
have separate shared memory for each HART whereas some (such as
Debug Console) will have global shared memory for all HARTs.
For clean and modular SBI implementations, I would recommend that
each SBI extension define its own shared memory setup API.
Regards,
Anup
Clearly, if we have a separate SBI extension to manage shared memory
在 2022-06-01星期三的 21:47 +0530,Anup Patel写道:Hi All,Shared memory can be a single extension. The three interfaces are as follows
Below is the draft proposal for SBI Debug Console Extension.
Please review it and provide feedback.
Thanks,
Anup
Debug Console Extension (EID #0x4442434E "DBCN")
================================================
The debug console extension defines a generic mechanism for boot-time
early prints from supervisor-mode software which allows users to catch
boot-time issues in supervisor-mode software.
This extension replaces legacy console putchar (EID #0x01) extension
and it is better in following ways:
1) It follows the new calling convention defined for SBI v1.0
(or higher).
2) It is based on a shared memory area between SBI implementation
and supervisor-mode software so multiple characters can be
printed using a single SBI call.
The supervisor-mode software must set the shared memory area before
printing characters on the debug console. Also, all HARTs share the
same shared memory area so only one HART needs to set it at boot-time.
Function: Set Console Area (FID #0)
-----------------------------------
struct sbiret sbi_debug_console_set_area(unsigned long addr_div_by_4,
unsigned long size)
Set the shared memory area specified by `addr_div_by_2` and `size`
parameters. The `addr_div_by_4` parameter is base address of the
shared memory area right shifted by 2 whereas `size` parameter is
the size of shared memory area in bytes.
The shared memory area should be normal cacheable memory for the
supervisor-mode software. Also, the shared memory area is global
across all HARTs so SBI implementation must ensure atomicity in
setting the shared memory area.
Errors:
SBI_SUCCESS - Shared memory area set successfully.
SBI_ERR_INVALID_ADDRESS - The shared memory area pointed by
`addr_div_by_2` and `size` parameters
is not normal cacheable memory or not
accessible to supervisor-mode software.
/* The supervisor hands a piece of physical memory to sbi for shared memory */
struct sbiret sbi_shared_memory_extrend(unsigned long addr, unsigned long size);
/* The supervisor applies for a piece of physical memory from sbi */
struct sbiret sbi_shared_memory_alloc(unsigned long size);
/* The supervisor notifies sbi to release the requested memory */
struct sbiret sbi_shared_memory_free(unsigned long addr);
then we will end-up with such memory management calls. Memory allocators
are generally hard to get it right and this also adds lot of bookkeeping and
state management in SBI implementations (e.g. OpenSBI, KVM RISC-V,
and various hypervisors).
Further, some of the SBI extensions (such as Steal Time Accounting) will
have separate shared memory for each HART whereas some (such as
Debug Console) will have global shared memory for all HARTs.
For clean and modular SBI implementations, I would recommend that
each SBI extension define its own shared memory setup API.
Regards,
Anup
Function: Console Puts (FID #1)
-------------------------------
struct sbiret sbi_debug_console_puts(unsigned long area_offset,
unsigned long num_chars)
Print the string specified by `area_offset` and `num_chars` on
the debug console. The `area_offset` parameter is the start of
string in the shard memory area whereas `num_chars` parameter
is the number of characters (or bytes) in the string.
This is a blocking SBI call and will only return after printing
all characters of the string.
Errors:
SBI_SUCCESS - Characters printed successfully.
SBI_ERR_INVALID_ADDRESS - The start of the string (i.e.
`area_offset`) or end of the string
(i.e. `area_offset + num_chars`) is
outside shared memory area.
On Thu, Jun 2, 2022 at 2:58 PM Heiko Stübner <heiko@...> wrote:
SBI implementation and supervisor software. Before MMU setup, the
memory type is by default 0 (i.e. PMA) so we don't have to mandate
any memory type for MMU disabled case.
We only have issue on systems with Svpmbt where supervisor software
can potentially map the shared memory as non-cacheable or IO (memory
type != 0) using PTE memory type bits.
In addition to above, a SBI implementation must ensure that the shared
memory address provided by supervisor software is a regular memory
(not MMIO device). This can be easily achieved in OpenSBI, KVM RISC-V,
and various hypervisors.
Regards,
Anup
The memory type should be 0 (i.e. PMA) for the shared memory between
Am Donnerstag, 2. Juni 2022, 10:50:56 CEST schrieb Heiko Stübner:Am Donnerstag, 2. Juni 2022, 10:47:58 CEST schrieb Anup Patel:though, how does that relate to the time before MMU setup?On Thu, Jun 2, 2022 at 12:02 AM Heiko Stübner <heiko@...> wrote:ok, sounds like a plan as well :-)You can easily create multiple pre-populated strings using ".asciiz" in
Hi Anup,
Am Mittwoch, 1. Juni 2022, 18:17:32 CEST schrieb Anup Patel:Hi All,typo in the "div_by_2" (not 4 like below and in the function itself) ?
Below is the draft proposal for SBI Debug Console Extension.
Please review it and provide feedback.
Thanks,
Anup
Debug Console Extension (EID #0x4442434E "DBCN")
================================================
The debug console extension defines a generic mechanism for boot-time
early prints from supervisor-mode software which allows users to catch
boot-time issues in supervisor-mode software.
This extension replaces legacy console putchar (EID #0x01) extension
and it is better in following ways:
1) It follows the new calling convention defined for SBI v1.0
(or higher).
2) It is based on a shared memory area between SBI implementation
and supervisor-mode software so multiple characters can be
printed using a single SBI call.
The supervisor-mode software must set the shared memory area before
printing characters on the debug console. Also, all HARTs share the
same shared memory area so only one HART needs to set it at boot-time.
Function: Set Console Area (FID #0)
-----------------------------------
struct sbiret sbi_debug_console_set_area(unsigned long addr_div_by_4,
unsigned long size)
Set the shared memory area specified by `addr_div_by_2` and `size`parameters. The `addr_div_by_4` parameter is base address of theThis will vastly reduce the number of needed ecalls when outputting
shared memory area right shifted by 2 whereas `size` parameter is
the size of shared memory area in bytes.
The shared memory area should be normal cacheable memory for the
supervisor-mode software. Also, the shared memory area is global
across all HARTs so SBI implementation must ensure atomicity in
setting the shared memory area.
Errors:
SBI_SUCCESS - Shared memory area set successfully.
SBI_ERR_INVALID_ADDRESS - The shared memory area pointed by
`addr_div_by_2` and `size` parameters
is not normal cacheable memory or not
accessible to supervisor-mode software.
Function: Console Puts (FID #1)
-------------------------------
struct sbiret sbi_debug_console_puts(unsigned long area_offset,
unsigned long num_chars)
Print the string specified by `area_offset` and `num_chars` on
the debug console. The `area_offset` parameter is the start of
string in the shard memory area whereas `num_chars` parameter
is the number of characters (or bytes) in the string.
This is a blocking SBI call and will only return after printing
all characters of the string.
Errors:
SBI_SUCCESS - Characters printed successfully.
SBI_ERR_INVALID_ADDRESS - The start of the string (i.e.
`area_offset`) or end of the string
(i.e. `area_offset + num_chars`) is
outside shared memory area.
characters, so this will probably improve performance quite a bit :-)
I guess I still would like to have an _additional_ single-character
putc call. As mentioned in the other thread [0], especially on consumer
hardware [where there is no elaborate debug infrastructure] this can
be a very handy debugging tool even in the earliest stages of a
booting kernel (both before relocation and even inside the startup
assembly).
I.e. just doing a
li a7, 1
li a6, 0
li a0, 36
ecall
in any kernel assembly will just output a "$" character right now, without
needing any preparation at all - same with using the current
sbi_console_putchar() directly in c-code.
This _can_ be very helpful in some cases, so I guess it would be nice
to keep such a functionality around also in the new spec.
assembly sources. Just set the base address of pre-populated strings
once on boot hart and print from anywhere using usual 4-5 instruction
(similar to what posted above).
I.e. in response to Heinrich's mail you talk about svpbmt, so I guess you
expect virtual memory there, so what is the expected value-type before
the mmu is setup in S-mode ?
SBI implementation and supervisor software. Before MMU setup, the
memory type is by default 0 (i.e. PMA) so we don't have to mandate
any memory type for MMU disabled case.
We only have issue on systems with Svpmbt where supervisor software
can potentially map the shared memory as non-cacheable or IO (memory
type != 0) using PTE memory type bits.
In addition to above, a SBI implementation must ensure that the shared
memory address provided by supervisor software is a regular memory
(not MMIO device). This can be easily achieved in OpenSBI, KVM RISC-V,
and various hypervisors.
Regards,
Anup
[0] http://lists.infradead.org/pipermail/opensbi/2022-June/002796.htmlRegards,
Anup
Ved Shanbhogue
Should we keep this simple in the SBI - only have register based inputs - to send and receive 1 byte in each call?
Keeping it a simple out_byte or in_byte - a serial port like interface seems the simplest and most secure.
I worry about bugs/security issues that can be caused by M-mode firmware accessing strings in untrusted memory.
The API as defined does not say whether the address is a virtual address or a physical address.
If it is a virtual address then the SBI call will need to use a MPRV load/store to gather this data and will also need to deal with page fault, access faults, etc. that may occur on such accesses.
Based on discussion it did not seem like it needs to be much fancier than this as this is for early OS/VMM code till it has enough functionality to directly interact with a uart.
regards
ved
On Thu, Jun 2, 2022 at 7:43 AM Anup Patel <apatel@...> wrote:
On Thu, Jun 2, 2022 at 2:58 PM Heiko Stübner <heiko@...> wrote:
>
> Am Donnerstag, 2. Juni 2022, 10:50:56 CEST schrieb Heiko Stübner:
> > Am Donnerstag, 2. Juni 2022, 10:47:58 CEST schrieb Anup Patel:
> > > On Thu, Jun 2, 2022 at 12:02 AM Heiko Stübner <heiko@...> wrote:
> > > >
> > > > Hi Anup,
> > > >
> > > > Am Mittwoch, 1. Juni 2022, 18:17:32 CEST schrieb Anup Patel:
> > > > > Hi All,
> > > > >
> > > > > Below is the draft proposal for SBI Debug Console Extension.
> > > > >
> > > > > Please review it and provide feedback.
> > > > >
> > > > > Thanks,
> > > > > Anup
> > > > >
> > > > > Debug Console Extension (EID #0x4442434E "DBCN")
> > > > > ================================================
> > > > >
> > > > > The debug console extension defines a generic mechanism for boot-time
> > > > > early prints from supervisor-mode software which allows users to catch
> > > > > boot-time issues in supervisor-mode software.
> > > > >
> > > > > This extension replaces legacy console putchar (EID #0x01) extension
> > > > > and it is better in following ways:
> > > > > 1) It follows the new calling convention defined for SBI v1.0
> > > > > (or higher).
> > > > > 2) It is based on a shared memory area between SBI implementation
> > > > > and supervisor-mode software so multiple characters can be
> > > > > printed using a single SBI call.
> > > > >
> > > > > The supervisor-mode software must set the shared memory area before
> > > > > printing characters on the debug console. Also, all HARTs share the
> > > > > same shared memory area so only one HART needs to set it at boot-time.
> > > > >
> > > > > Function: Set Console Area (FID #0)
> > > > > -----------------------------------
> > > > >
> > > > > struct sbiret sbi_debug_console_set_area(unsigned long addr_div_by_4,
> > > > > unsigned long size)
> > > > >
> > > > > Set the shared memory area specified by `addr_div_by_2` and `size`
> > > >
> > > > typo in the "div_by_2" (not 4 like below and in the function itself) ?
> > > >
> > > >
> > > > > parameters. The `addr_div_by_4` parameter is base address of the
> > > > > shared memory area right shifted by 2 whereas `size` parameter is
> > > > > the size of shared memory area in bytes.
> > > > >
> > > > > The shared memory area should be normal cacheable memory for the
> > > > > supervisor-mode software. Also, the shared memory area is global
> > > > > across all HARTs so SBI implementation must ensure atomicity in
> > > > > setting the shared memory area.
> > > > >
> > > > > Errors:
> > > > > SBI_SUCCESS - Shared memory area set successfully.
> > > > > SBI_ERR_INVALID_ADDRESS - The shared memory area pointed by
> > > > > `addr_div_by_2` and `size` parameters
> > > > > is not normal cacheable memory or not
> > > > > accessible to supervisor-mode software.
> > > > >
> > > > > Function: Console Puts (FID #1)
> > > > > -------------------------------
> > > > >
> > > > > struct sbiret sbi_debug_console_puts(unsigned long area_offset,
> > > > > unsigned long num_chars)
> > > > >
> > > > > Print the string specified by `area_offset` and `num_chars` on
> > > > > the debug console. The `area_offset` parameter is the start of
> > > > > string in the shard memory area whereas `num_chars` parameter
> > > > > is the number of characters (or bytes) in the string.
> > > > >
> > > > > This is a blocking SBI call and will only return after printing
> > > > > all characters of the string.
> > > > >
> > > > > Errors:
> > > > > SBI_SUCCESS - Characters printed successfully.
> > > > > SBI_ERR_INVALID_ADDRESS - The start of the string (i.e.
> > > > > `area_offset`) or end of the string
> > > > > (i.e. `area_offset + num_chars`) is
> > > > > outside shared memory area.
> > > >
> > > > This will vastly reduce the number of needed ecalls when outputting
> > > > characters, so this will probably improve performance quite a bit :-)
> > > >
> > > >
> > > > I guess I still would like to have an _additional_ single-character
> > > > putc call. As mentioned in the other thread [0], especially on consumer
> > > > hardware [where there is no elaborate debug infrastructure] this can
> > > > be a very handy debugging tool even in the earliest stages of a
> > > > booting kernel (both before relocation and even inside the startup
> > > > assembly).
> > > >
> > > > I.e. just doing a
> > > > li a7, 1
> > > > li a6, 0
> > > > li a0, 36
> > > > ecall
> > > >
> > > > in any kernel assembly will just output a "$" character right now, without
> > > > needing any preparation at all - same with using the current
> > > > sbi_console_putchar() directly in c-code.
> > > >
> > > > This _can_ be very helpful in some cases, so I guess it would be nice
> > > > to keep such a functionality around also in the new spec.
> > >
> > > You can easily create multiple pre-populated strings using ".asciiz" in
> > > assembly sources. Just set the base address of pre-populated strings
> > > once on boot hart and print from anywhere using usual 4-5 instruction
> > > (similar to what posted above).
> >
> > ok, sounds like a plan as well :-)
>
> though, how does that relate to the time before MMU setup?
>
> I.e. in response to Heinrich's mail you talk about svpbmt, so I guess you
> expect virtual memory there, so what is the expected value-type before
> the mmu is setup in S-mode ?
The memory type should be 0 (i.e. PMA) for the shared memory between
SBI implementation and supervisor software. Before MMU setup, the
memory type is by default 0 (i.e. PMA) so we don't have to mandate
any memory type for MMU disabled case.
We only have issue on systems with Svpmbt where supervisor software
can potentially map the shared memory as non-cacheable or IO (memory
type != 0) using PTE memory type bits.
In addition to above, a SBI implementation must ensure that the shared
memory address provided by supervisor software is a regular memory
(not MMIO device). This can be easily achieved in OpenSBI, KVM RISC-V,
and various hypervisors.
Regards,
Anup
>
>
> > > > [0] http://lists.infradead.org/pipermail/opensbi/2022-June/002796.html
> > > >
> > > >
> > > >
> > >
> > > Regards,
> > > Anup
> > >
> >
> >
>
>
>
>
On Thu, Jun 2, 2022 at 2:43 PM Heinrich Schuchardt
<heinrich.schuchardt@...> wrote:
across all HARTs so the SBI implementation will ensure atomicity
in setting/reading shared memory coordinates. This way multiple
HARTs can call the sbi_debug_console_set_area() but only the
last call will be in effect.
Following text in the proposal explains above:
"The supervisor-mode software must set the shared memory area before
printing characters on the debug console. Also, all HARTs share the
same shared memory area so only one HART needs to set it at boot-time."
Maybe this text is not giving a clear picture ?
HARTs and it mostly contains bytes to be printed. In case of steal
time accounting, the shared memory is separate for each HART and
it is a well-defined data structure.
Clearly, the usage of shared memory is extension specific.
The VirtIO devices are a good (and time tested) example of shared
memory based approaches. Over there as well, the shared memory
(i.e. various VirtIO rings) are setup by Guest and there is no central
pool of shared memory (i.e no dedicated VirtIO device managing
shared memory).
Similar to VirtIO world, we should let SBI extension define its own
shared memory usage and API.
Regards,
Anup
<heinrich.schuchardt@...> wrote:
The shared memory area in case of this SBI extension will be shared
On 6/2/22 10:44, Anup Patel wrote:On Wed, Jun 1, 2022 at 11:59 PM Heinrich SchuchardtCurrently this function is just a nop(). It is not needed in this
<heinrich.schuchardt@...> wrote:Usually, the serial port related code in M-mode firmware only uses
On 6/1/22 18:17, Anup Patel wrote:Hi All,Thanks for starting to close this gap.
Below is the draft proposal for SBI Debug Console Extension.
Please review it and provide feedback.
Thanks,
Anup
Debug Console Extension (EID #0x4442434E "DBCN")
================================================
The debug console extension defines a generic mechanism for boot-time
early prints from supervisor-mode software which allows users to catch
boot-time issues in supervisor-mode software.
This extension replaces legacy console putchar (EID #0x01) extension
and it is better in following ways:1) It follows the new calling convention defined for SBI v1.0I miss a discussion of the conflicts that can arise if the configuration
(or higher).
2) It is based on a shared memory area between SBI implementation
and supervisor-mode software so multiple characters can be
printed using a single SBI call.
of the serial console is changed by the caller.
Do we need an ecall that closes the SBI console to further access?
status and data registers so for most serial ports support the M-mode
firmware will adapt to serial port configuration changes.
In fact, this is why we never had a special SBI call for serial port
reconfiguration in legacy SBI v0.1 as well.
In case of virtualization, the serial port (or console) is emulated so
the special SBI call is not useful for virtualization.Actually, it's the S-mode software which is voluntarily giving a portion ofIsn't it M-mode software that has to program the MMU to allow all harts
The supervisor-mode software must set the shared memory area before
printing characters on the debug console. Also, all HARTs share the
same shared memory area so only one HART needs to set it at boot-time.
in M-mode and S-mode access to the memory area? What is the S-mode
software to do about the memory area prior to calling
sbi_debug_console_set_area()?
its memory to be used as shared memory. The proposal only mandates
that whatever memory is selected by S-mode software should be a
regular cacheable memory (not IO memory). Also, if Svpbmt is available
then S-mode software should only use memory type 0 in the PTEs.Theoretically, we can avoid the extra function to set shared memory areaThe console output is needed on the very start of the S-mode software,
Function: Set Console Area (FID #0)
-----------------------------------
struct sbiret sbi_debug_console_set_area(unsigned long addr_div_by_4,
unsigned long size)
before setting up anything.
Can we avoid this extra function?
Can we simply assume that the caller of sbi_debug_console_puts()
provides a physical address pointer to a memory area that is suitable?
but it will complicate things in future when we have supervisor software
encrypting it's own memory (using special ISA support) because in this
case supervisor software will have to unprotect memory every time the
sbi_debug_console_puts() is called and protect it again after the call.
revision of the extension.
The function might be called repeatedly by different threads with
different values. How do you want to keep track of all of these
different areas?
across all HARTs so the SBI implementation will ensure atomicity
in setting/reading shared memory coordinates. This way multiple
HARTs can call the sbi_debug_console_set_area() but only the
last call will be in effect.
Following text in the proposal explains above:
"The supervisor-mode software must set the shared memory area before
printing characters on the debug console. Also, all HARTs share the
same shared memory area so only one HART needs to set it at boot-time."
Maybe this text is not giving a clear picture ?
In the case of this extension, the shared memory is global across all
Memory shared between different security realms will arise in many
different scenarios. As this is not console specific it should be in a
separate extension. That extension should be defined once we have
clarity about how security realms are managed.
HARTs and it mostly contains bytes to be printed. In case of steal
time accounting, the shared memory is separate for each HART and
it is a well-defined data structure.
Clearly, the usage of shared memory is extension specific.
The VirtIO devices are a good (and time tested) example of shared
memory based approaches. Over there as well, the shared memory
(i.e. various VirtIO rings) are setup by Guest and there is no central
pool of shared memory (i.e no dedicated VirtIO device managing
shared memory).
Similar to VirtIO world, we should let SBI extension define its own
shared memory usage and API.
Regards,
Anup
sbi_debug_console_set_area() might be called with different values byOkay, I will update.%s/addr_div_by_2/addr_div_by_4/
Set the shared memory area specified by `addr_div_by_2` and `size`Okay, I will update.parameters. The `addr_div_by_4` parameter is base address of the%s/is base/is the base/For RV32 S-mode, the physical address space is 34bits wide butshared memory area right shifted by 2 whereas `size` parameter isWhy shifting the address? I would prefer to keep it simple for the
the size of shared memory area in bytes.
caller. If the alignment is not suitable, return an error.
But why is an alignment needed here at all? And why 4 aligned?
"unsigned long" is 32bits wide. This is because Sv32 PTEs allow
34bits of PPN. In fact, even instructions such as HFENCE.GVMA
have this "address right shift by 2" requirement based on this rationale.I would prefer to simply pass a physical address pointer here with no
The shared memory area should be normal cacheable memory for the
supervisor-mode software. Also, the shared memory area is global
across all HARTs so SBI implementation must ensure atomicity in
setting the shared memory area.
Errors:
SBI_SUCCESS - Shared memory area set successfully.
SBI_ERR_INVALID_ADDRESS - The shared memory area pointed by
`addr_div_by_2` and `size` parameters
is not normal cacheable memory or not
accessible to supervisor-mode software.
Function: Console Puts (FID #1)
-------------------------------
struct sbiret sbi_debug_console_puts(unsigned long area_offset,
unsigned long num_chars)
requirements on alignment. And no prior SBI call.
different threads. An offset is ambiguous as it does not define to which
of the different shared areas it relates. Please, use a pointer.OKBare-metal tests (or assembly sources) can print sub-strings from
Do we need num_chars? Are we expecting to provide binary output? Using
0x00 as terminator would be adequate in most cases.
a large per-populated string in shared memory. Assuming that string
is always terminated by 0x00 in sbi_debug_console_puts() will break
this flexibility.The platform specification would be the right place to require 8-bitWe need to clarify this. Suggestions ?
What is the requirement on the console? Does it have to support 8bit
output to allow for UTF-8?
support for the console.We should add to the platform specification that UTF-8 output is assumedSame as above, this needs more clarification. Suggestions ?
Do we make any assumptions about encoding?
on the serial console.We should state if extra bits are ignored or the bytes are not send.
I am of the opinion to keep such encoding related assumptions to be
minimal.I would consider this to be part of the clarification we add for encoding.
How would we handle a console set up to 7bit + parity if a character >
0x7f is sent?
The easiest thing is to just ignore the extra bits. So let't state this
here.
Best regards
HeinrichOkay, I will update.%s/shard/shared/
Print the string specified by `area_offset` and `num_chars` on
the debug console. The `area_offset` parameter is the start of
string in the shard memory area whereas `num_chars` parameterOkay, I will add.is the number of characters (or bytes) in the string.There could be other reasons of failures:
This is a blocking SBI call and will only return after printing
all characters of the string.
Errors:
SBI_SUCCESS - Characters printed successfully.
SBI_ERR_INVALID_ADDRESS - The start of the string (i.e.
`area_offset`) or end of the string
(i.e. `area_offset + num_chars`) is
outside shared memory area.
* set up of the UART failed in OpenSBI
* no UART defined in the device-tree
* ...
So let us add SBI_ERR_FAILED to the list.Regards,
Best regards
Heinrich
Anup
Hello!
Glad to see a new proposal to the SBI standard. Besides to discussion before, I may (if possible or proper) suggest an idea of not implementing this extension, for SBI should provide transparency of peripherals to kernel other than wrap every possible drivers in SBI itself. Am I totally wrong, or are there any further ideas to this topic? Thanks :)
Best Regards,
Luo Jia
Glad to see a new proposal to the SBI standard. Besides to discussion before, I may (if possible or proper) suggest an idea of not implementing this extension, for SBI should provide transparency of peripherals to kernel other than wrap every possible drivers in SBI itself. Am I totally wrong, or are there any further ideas to this topic? Thanks :)
Best Regards,
Luo Jia
On Thu, Jun 2, 2022 at 6:29 PM Ved Shanbhogue <ved@...> wrote:
This is very slow for virtualized world particularly KVM RISC-V because each
SBI v0.1 putchar() or getchar() will trap to KVM RISC-V and KVM RISC-V will
forward it to user-space QEMU or KVMTOOL. This means each early print
character using SBI v0.1 putchar() will go all the way to host user-space and
come back. This is horribly slow for KVM Guest. This becomes further slower
for nested virtualization.
The MMIO based early prints are further worse because we have at least two
MMIO traps for every character where each MMIO exits to host user-space.
The shared memory based SBI puts() drastically reduces the number of SBI
traps hence reducing boot time with early prints enabled.
it is possible to address security concerns related to shared memory.
particularly due to page faults. These are prevalent in some of the
legacy SBI v0.1 calls. With SBI v0.2 (or higher), we have tried to
ensure that we don't use virtual addresses as parameter in newer SBI
calls.
minimize the number of traps which in-turn helps virtualization to
drastically reduce boot-time.
Regards,
Anup
The legacy SBI v0.1 putchar() and getchar() are byte-level send/receive calls.
Should we keep this simple in the SBI - only have register based inputs - to send and receive 1 byte in each call?
Keeping it a simple out_byte or in_byte - a serial port like interface seems the simplest and most secure.
This is very slow for virtualized world particularly KVM RISC-V because each
SBI v0.1 putchar() or getchar() will trap to KVM RISC-V and KVM RISC-V will
forward it to user-space QEMU or KVMTOOL. This means each early print
character using SBI v0.1 putchar() will go all the way to host user-space and
come back. This is horribly slow for KVM Guest. This becomes further slower
for nested virtualization.
The MMIO based early prints are further worse because we have at least two
MMIO traps for every character where each MMIO exits to host user-space.
The shared memory based SBI puts() drastically reduces the number of SBI
traps hence reducing boot time with early prints enabled.
I worry about bugs/security issues that can be caused by M-mode firmware accessing strings in untrusted memory.The VirtIO based para-virt devices rely heavily on shared memory so I think
it is possible to address security concerns related to shared memory.
The API as defined does not say whether the address is a virtual address or a physical address.It is a physical address. I will clarify this in Draft v2.
If it is a virtual address then the SBI call will need to use a MPRV load/store to gather this data and will also need to deal with page fault, access faults, etc. that may occur on such accesses.Yes, MPRV (or HLV/HSV) based load/store have performance issues
particularly due to page faults. These are prevalent in some of the
legacy SBI v0.1 calls. With SBI v0.2 (or higher), we have tried to
ensure that we don't use virtual addresses as parameter in newer SBI
calls.
Based on discussion it did not seem like it needs to be much fancier than this as this is for early OS/VMM code till it has enough functionality to directly interact with a uart.The goal of the shared memory based SBI call for early prints is to
minimize the number of traps which in-turn helps virtualization to
drastically reduce boot-time.
Regards,
Anup
regards
ved
On Thu, Jun 2, 2022 at 7:43 AM Anup Patel <apatel@...> wrote:
On Thu, Jun 2, 2022 at 2:58 PM Heiko Stübner <heiko@...> wrote:The memory type should be 0 (i.e. PMA) for the shared memory between
Am Donnerstag, 2. Juni 2022, 10:50:56 CEST schrieb Heiko Stübner:Am Donnerstag, 2. Juni 2022, 10:47:58 CEST schrieb Anup Patel:though, how does that relate to the time before MMU setup?On Thu, Jun 2, 2022 at 12:02 AM Heiko Stübner <heiko@...> wrote:ok, sounds like a plan as well :-)You can easily create multiple pre-populated strings using ".asciiz" in
Hi Anup,
Am Mittwoch, 1. Juni 2022, 18:17:32 CEST schrieb Anup Patel:Hi All,typo in the "div_by_2" (not 4 like below and in the function itself) ?
Below is the draft proposal for SBI Debug Console Extension.
Please review it and provide feedback.
Thanks,
Anup
Debug Console Extension (EID #0x4442434E "DBCN")
================================================
The debug console extension defines a generic mechanism for boot-time
early prints from supervisor-mode software which allows users to catch
boot-time issues in supervisor-mode software.
This extension replaces legacy console putchar (EID #0x01) extension
and it is better in following ways:
1) It follows the new calling convention defined for SBI v1.0
(or higher).
2) It is based on a shared memory area between SBI implementation
and supervisor-mode software so multiple characters can be
printed using a single SBI call.
The supervisor-mode software must set the shared memory area before
printing characters on the debug console. Also, all HARTs share the
same shared memory area so only one HART needs to set it at boot-time.
Function: Set Console Area (FID #0)
-----------------------------------
struct sbiret sbi_debug_console_set_area(unsigned long addr_div_by_4,
unsigned long size)
Set the shared memory area specified by `addr_div_by_2` and `size`parameters. The `addr_div_by_4` parameter is base address of theThis will vastly reduce the number of needed ecalls when outputting
shared memory area right shifted by 2 whereas `size` parameter is
the size of shared memory area in bytes.
The shared memory area should be normal cacheable memory for the
supervisor-mode software. Also, the shared memory area is global
across all HARTs so SBI implementation must ensure atomicity in
setting the shared memory area.
Errors:
SBI_SUCCESS - Shared memory area set successfully.
SBI_ERR_INVALID_ADDRESS - The shared memory area pointed by
`addr_div_by_2` and `size` parameters
is not normal cacheable memory or not
accessible to supervisor-mode software.
Function: Console Puts (FID #1)
-------------------------------
struct sbiret sbi_debug_console_puts(unsigned long area_offset,
unsigned long num_chars)
Print the string specified by `area_offset` and `num_chars` on
the debug console. The `area_offset` parameter is the start of
string in the shard memory area whereas `num_chars` parameter
is the number of characters (or bytes) in the string.
This is a blocking SBI call and will only return after printing
all characters of the string.
Errors:
SBI_SUCCESS - Characters printed successfully.
SBI_ERR_INVALID_ADDRESS - The start of the string (i.e.
`area_offset`) or end of the string
(i.e. `area_offset + num_chars`) is
outside shared memory area.
characters, so this will probably improve performance quite a bit :-)
I guess I still would like to have an _additional_ single-character
putc call. As mentioned in the other thread [0], especially on consumer
hardware [where there is no elaborate debug infrastructure] this can
be a very handy debugging tool even in the earliest stages of a
booting kernel (both before relocation and even inside the startup
assembly).
I.e. just doing a
li a7, 1
li a6, 0
li a0, 36
ecall
in any kernel assembly will just output a "$" character right now, without
needing any preparation at all - same with using the current
sbi_console_putchar() directly in c-code.
This _can_ be very helpful in some cases, so I guess it would be nice
to keep such a functionality around also in the new spec.
assembly sources. Just set the base address of pre-populated strings
once on boot hart and print from anywhere using usual 4-5 instruction
(similar to what posted above).
I.e. in response to Heinrich's mail you talk about svpbmt, so I guess you
expect virtual memory there, so what is the expected value-type before
the mmu is setup in S-mode ?
SBI implementation and supervisor software. Before MMU setup, the
memory type is by default 0 (i.e. PMA) so we don't have to mandate
any memory type for MMU disabled case.
We only have issue on systems with Svpmbt where supervisor software
can potentially map the shared memory as non-cacheable or IO (memory
type != 0) using PTE memory type bits.
In addition to above, a SBI implementation must ensure that the shared
memory address provided by supervisor software is a regular memory
(not MMIO device). This can be easily achieved in OpenSBI, KVM RISC-V,
and various hypervisors.
Regards,
Anup[0] http://lists.infradead.org/pipermail/opensbi/2022-June/002796.htmlRegards,
Anup
Ved Shanbhogue
On Thu, Jun 02, 2022 at 07:52:55PM +0530, Anup Patel wrote:
boots up to use a VFIO based char driver provided by the VMM, I am not sure
that the slowness matters.
Even this SBI call I expected the VMM to intercept and if the VMM has all emulation in the user space VMM - e.g. the console tty is open by the user
space VMM, I am not sure this would avoid that trip to user space. If the motivation is primarily VM debug then perhaps a standardized set of
hypercalls implemented by KVM makes more sense than SBI calls that would
need to be built into the M-mode firmware?
I am not understanding why we would want to push all of this into
M-mode firmware vs. defining a set of standardized pv-ops to be used
by guest OSes.
regards
ved
On Thu, Jun 2, 2022 at 6:29 PM Ved Shanbhogue <ved@...> wrote:Since this is for debug and really early phase debug till enough of the guest
This is very slow for virtualized world particularly KVM RISC-V because each
SBI v0.1 putchar() or getchar() will trap to KVM RISC-V and KVM RISC-V will
forward it to user-space QEMU or KVMTOOL. This means each early print
character using SBI v0.1 putchar() will go all the way to host user-space and
come back. This is horribly slow for KVM Guest. This becomes further slower
for nested virtualization.
boots up to use a VFIO based char driver provided by the VMM, I am not sure
that the slowness matters.
Even this SBI call I expected the VMM to intercept and if the VMM has all emulation in the user space VMM - e.g. the console tty is open by the user
space VMM, I am not sure this would avoid that trip to user space. If the motivation is primarily VM debug then perhaps a standardized set of
hypercalls implemented by KVM makes more sense than SBI calls that would
need to be built into the M-mode firmware?
Yes, and now that I understand the motivation better why dont we define this as a hypercall/pv-ops interface to a VMM than a SBI call to the M-mode firmware and needing to build a virt-io like framework in firmware.I worry about bugs/security issues that can be caused by M-mode firmware accessing strings in untrusted memory.The VirtIO based para-virt devices rely heavily on shared memory so I think
it is possible to address security concerns related to shared memory.
Thanks. I was not sure since we had all the discussion about Svpbmt.The API as defined does not say whether the address is a virtual address or a physical address.It is a physical address. I will clarify this in Draft v2.
Understand that better now. But if that is the main motivation thenBased on discussion it did not seem like it needs to be much fancier than this as this is for early OS/VMM code till it has enough functionality to directly interact with a uart.The goal of the shared memory based SBI call for early prints is to
minimize the number of traps which in-turn helps virtualization to
drastically reduce boot-time.
I am not understanding why we would want to push all of this into
M-mode firmware vs. defining a set of standardized pv-ops to be used
by guest OSes.
regards
ved
On Thu, Jun 2, 2022 at 8:30 PM Ved Shanbhogue <ved@...> wrote:
of UART for early prints but there were objections on selecting one type of UART
over another.
This SBI debug console extension is also a way to avoid standardizing a
particular type of UART in OS-A platform spec.
shared memory without any formatted data structure.
supervisor software running natively (directly under M-mode) irrespective
of the type of UART/Console available on the console so it's not just
for a virtualized world. Although, the virtualized world has an added
performance advantage due to reduced traps.
Regards,
Anup
We have a requirement in the OS-A platform spec to mandate a particular type
On Thu, Jun 02, 2022 at 07:52:55PM +0530, Anup Patel wrote:On Thu, Jun 2, 2022 at 6:29 PM Ved Shanbhogue <ved@...> wrote:Since this is for debug and really early phase debug till enough of the guest
This is very slow for virtualized world particularly KVM RISC-V because each
SBI v0.1 putchar() or getchar() will trap to KVM RISC-V and KVM RISC-V will
forward it to user-space QEMU or KVMTOOL. This means each early print
character using SBI v0.1 putchar() will go all the way to host user-space and
come back. This is horribly slow for KVM Guest. This becomes further slower
for nested virtualization.
boots up to use a VFIO based char driver provided by the VMM, I am not sure
that the slowness matters.
Even this SBI call I expected the VMM to intercept and if the VMM has all
emulation in the user space VMM - e.g. the console tty is open by the user
space VMM, I am not sure this would avoid that trip to user space.
If the motivation is primarily VM debug then perhaps a standardized set of
hypercalls implemented by KVM makes more sense than SBI calls that would
need to be built into the M-mode firmware?
of UART for early prints but there were objections on selecting one type of UART
over another.
This SBI debug console extension is also a way to avoid standardizing a
particular type of UART in OS-A platform spec.
The VirtIO framework has rings in shared memory but over here it is justYes, and now that I understand the motivation better why dont we define thisI worry about bugs/security issues that can be caused by M-mode firmware accessing strings in untrusted memory.The VirtIO based para-virt devices rely heavily on shared memory so I think
it is possible to address security concerns related to shared memory.
as a hypercall/pv-ops interface to a VMM than a SBI call to the M-mode
firmware and needing to build a virt-io like framework in firmware.
shared memory without any formatted data structure.
The SBI debug console also provides a standard way of early prints forThanks. I was not sure since we had all the discussion about Svpbmt.The API as defined does not say whether the address is a virtual address or a physical address.It is a physical address. I will clarify this in Draft v2.Understand that better now. But if that is the main motivation thenBased on discussion it did not seem like it needs to be much fancier than this as this is for early OS/VMM code till it has enough functionality to directly interact with a uart.The goal of the shared memory based SBI call for early prints is to
minimize the number of traps which in-turn helps virtualization to
drastically reduce boot-time.
I am not understanding why we would want to push all of this into
M-mode firmware vs. defining a set of standardized pv-ops to be used
by guest OSes.
supervisor software running natively (directly under M-mode) irrespective
of the type of UART/Console available on the console so it's not just
for a virtualized world. Although, the virtualized world has an added
performance advantage due to reduced traps.
Regards,
Anup
atishp@...
On Thu, Jun 2, 2022 at 2:13 AM Heinrich Schuchardt
<heinrich.schuchardt@...> wrote:
Can you please elaborate on this ?
As you pointed out, there are other possible use cases(e.g STA, PMU)
for shared memory between
S & M mode or VS & HS mode. It would be good to address these concerns right now
instead of discussing those in each individual extension context.
<heinrich.schuchardt@...> wrote:
I would like to understand more about the security concerns you raised.
On 6/2/22 10:44, Anup Patel wrote:On Wed, Jun 1, 2022 at 11:59 PM Heinrich SchuchardtCurrently this function is just a nop(). It is not needed in this
<heinrich.schuchardt@...> wrote:Usually, the serial port related code in M-mode firmware only uses
On 6/1/22 18:17, Anup Patel wrote:Hi All,Thanks for starting to close this gap.
Below is the draft proposal for SBI Debug Console Extension.
Please review it and provide feedback.
Thanks,
Anup
Debug Console Extension (EID #0x4442434E "DBCN")
================================================
The debug console extension defines a generic mechanism for boot-time
early prints from supervisor-mode software which allows users to catch
boot-time issues in supervisor-mode software.
This extension replaces legacy console putchar (EID #0x01) extension
and it is better in following ways:1) It follows the new calling convention defined for SBI v1.0I miss a discussion of the conflicts that can arise if the configuration
(or higher).
2) It is based on a shared memory area between SBI implementation
and supervisor-mode software so multiple characters can be
printed using a single SBI call.
of the serial console is changed by the caller.
Do we need an ecall that closes the SBI console to further access?
status and data registers so for most serial ports support the M-mode
firmware will adapt to serial port configuration changes.
In fact, this is why we never had a special SBI call for serial port
reconfiguration in legacy SBI v0.1 as well.
In case of virtualization, the serial port (or console) is emulated so
the special SBI call is not useful for virtualization.Actually, it's the S-mode software which is voluntarily giving a portion ofIsn't it M-mode software that has to program the MMU to allow all harts
The supervisor-mode software must set the shared memory area before
printing characters on the debug console. Also, all HARTs share the
same shared memory area so only one HART needs to set it at boot-time.
in M-mode and S-mode access to the memory area? What is the S-mode
software to do about the memory area prior to calling
sbi_debug_console_set_area()?
its memory to be used as shared memory. The proposal only mandates
that whatever memory is selected by S-mode software should be a
regular cacheable memory (not IO memory). Also, if Svpbmt is available
then S-mode software should only use memory type 0 in the PTEs.Theoretically, we can avoid the extra function to set shared memory areaThe console output is needed on the very start of the S-mode software,
Function: Set Console Area (FID #0)
-----------------------------------
struct sbiret sbi_debug_console_set_area(unsigned long addr_div_by_4,
unsigned long size)
before setting up anything.
Can we avoid this extra function?
Can we simply assume that the caller of sbi_debug_console_puts()
provides a physical address pointer to a memory area that is suitable?
but it will complicate things in future when we have supervisor software
encrypting it's own memory (using special ISA support) because in this
case supervisor software will have to unprotect memory every time the
sbi_debug_console_puts() is called and protect it again after the call.
revision of the extension.
The function might be called repeatedly by different threads with
different values. How do you want to keep track of all of these
different areas?
Memory shared between different security realms will arise in many
different scenarios. As this is not console specific it should be in a
separate extension. That extension should be defined once we have
clarity about how security realms are managed.
Can you please elaborate on this ?
As you pointed out, there are other possible use cases(e.g STA, PMU)
for shared memory between
S & M mode or VS & HS mode. It would be good to address these concerns right now
instead of discussing those in each individual extension context.
sbi_debug_console_set_area() might be called with different values byOkay, I will update.%s/addr_div_by_2/addr_div_by_4/
Set the shared memory area specified by `addr_div_by_2` and `size`Okay, I will update.parameters. The `addr_div_by_4` parameter is base address of the%s/is base/is the base/For RV32 S-mode, the physical address space is 34bits wide butshared memory area right shifted by 2 whereas `size` parameter isWhy shifting the address? I would prefer to keep it simple for the
the size of shared memory area in bytes.
caller. If the alignment is not suitable, return an error.
But why is an alignment needed here at all? And why 4 aligned?
"unsigned long" is 32bits wide. This is because Sv32 PTEs allow
34bits of PPN. In fact, even instructions such as HFENCE.GVMA
have this "address right shift by 2" requirement based on this rationale.I would prefer to simply pass a physical address pointer here with no
The shared memory area should be normal cacheable memory for the
supervisor-mode software. Also, the shared memory area is global
across all HARTs so SBI implementation must ensure atomicity in
setting the shared memory area.
Errors:
SBI_SUCCESS - Shared memory area set successfully.
SBI_ERR_INVALID_ADDRESS - The shared memory area pointed by
`addr_div_by_2` and `size` parameters
is not normal cacheable memory or not
accessible to supervisor-mode software.
Function: Console Puts (FID #1)
-------------------------------
struct sbiret sbi_debug_console_puts(unsigned long area_offset,
unsigned long num_chars)
requirements on alignment. And no prior SBI call.
different threads. An offset is ambiguous as it does not define to which
of the different shared areas it relates. Please, use a pointer.OKBare-metal tests (or assembly sources) can print sub-strings from
Do we need num_chars? Are we expecting to provide binary output? Using
0x00 as terminator would be adequate in most cases.
a large per-populated string in shared memory. Assuming that string
is always terminated by 0x00 in sbi_debug_console_puts() will break
this flexibility.The platform specification would be the right place to require 8-bitWe need to clarify this. Suggestions ?
What is the requirement on the console? Does it have to support 8bit
output to allow for UTF-8?
support for the console.We should add to the platform specification that UTF-8 output is assumedSame as above, this needs more clarification. Suggestions ?
Do we make any assumptions about encoding?
on the serial console.We should state if extra bits are ignored or the bytes are not send.
I am of the opinion to keep such encoding related assumptions to be
minimal.I would consider this to be part of the clarification we add for encoding.
How would we handle a console set up to 7bit + parity if a character >
0x7f is sent?
The easiest thing is to just ignore the extra bits. So let't state this
here.
Best regards
HeinrichOkay, I will update.%s/shard/shared/
Print the string specified by `area_offset` and `num_chars` on
the debug console. The `area_offset` parameter is the start of
string in the shard memory area whereas `num_chars` parameterOkay, I will add.is the number of characters (or bytes) in the string.There could be other reasons of failures:
This is a blocking SBI call and will only return after printing
all characters of the string.
Errors:
SBI_SUCCESS - Characters printed successfully.
SBI_ERR_INVALID_ADDRESS - The start of the string (i.e.
`area_offset`) or end of the string
(i.e. `area_offset + num_chars`) is
outside shared memory area.
* set up of the UART failed in OpenSBI
* no UART defined in the device-tree
* ...
So let us add SBI_ERR_FAILED to the list.Regards,
Best regards
Heinrich
Anup
Heinrich Schuchardt
On 6/3/22 08:56, Atish Kumar Patra wrote:
Best regards
Heinrich
On Thu, Jun 2, 2022 at 2:13 AM Heinrich SchuchardtI have no security concerns. My thought was that it might be better to manage shared memory in a separate extension for all use cases.
<heinrich.schuchardt@...> wrote:I would like to understand more about the security concerns you raised.
On 6/2/22 10:44, Anup Patel wrote:On Wed, Jun 1, 2022 at 11:59 PM Heinrich SchuchardtCurrently this function is just a nop(). It is not needed in this
<heinrich.schuchardt@...> wrote:Usually, the serial port related code in M-mode firmware only uses
On 6/1/22 18:17, Anup Patel wrote:Hi All,Thanks for starting to close this gap.
Below is the draft proposal for SBI Debug Console Extension.
Please review it and provide feedback.
Thanks,
Anup
Debug Console Extension (EID #0x4442434E "DBCN")
================================================
The debug console extension defines a generic mechanism for boot-time
early prints from supervisor-mode software which allows users to catch
boot-time issues in supervisor-mode software.
This extension replaces legacy console putchar (EID #0x01) extension
and it is better in following ways:1) It follows the new calling convention defined for SBI v1.0I miss a discussion of the conflicts that can arise if the configuration
(or higher).
2) It is based on a shared memory area between SBI implementation
and supervisor-mode software so multiple characters can be
printed using a single SBI call.
of the serial console is changed by the caller.
Do we need an ecall that closes the SBI console to further access?
status and data registers so for most serial ports support the M-mode
firmware will adapt to serial port configuration changes.
In fact, this is why we never had a special SBI call for serial port
reconfiguration in legacy SBI v0.1 as well.
In case of virtualization, the serial port (or console) is emulated so
the special SBI call is not useful for virtualization.Actually, it's the S-mode software which is voluntarily giving a portion ofIsn't it M-mode software that has to program the MMU to allow all harts
The supervisor-mode software must set the shared memory area before
printing characters on the debug console. Also, all HARTs share the
same shared memory area so only one HART needs to set it at boot-time.
in M-mode and S-mode access to the memory area? What is the S-mode
software to do about the memory area prior to calling
sbi_debug_console_set_area()?
its memory to be used as shared memory. The proposal only mandates
that whatever memory is selected by S-mode software should be a
regular cacheable memory (not IO memory). Also, if Svpbmt is available
then S-mode software should only use memory type 0 in the PTEs.Theoretically, we can avoid the extra function to set shared memory areaThe console output is needed on the very start of the S-mode software,
Function: Set Console Area (FID #0)
-----------------------------------
struct sbiret sbi_debug_console_set_area(unsigned long addr_div_by_4,
unsigned long size)
before setting up anything.
Can we avoid this extra function?
Can we simply assume that the caller of sbi_debug_console_puts()
provides a physical address pointer to a memory area that is suitable?
but it will complicate things in future when we have supervisor software
encrypting it's own memory (using special ISA support) because in this
case supervisor software will have to unprotect memory every time the
sbi_debug_console_puts() is called and protect it again after the call.
revision of the extension.
The function might be called repeatedly by different threads with
different values. How do you want to keep track of all of these
different areas?
Memory shared between different security realms will arise in many
different scenarios. As this is not console specific it should be in a
separate extension. That extension should be defined once we have
clarity about how security realms are managed.
Can you please elaborate on this ?
Best regards
Heinrich
As you pointed out, there are other possible use cases(e.g STA, PMU)
for shared memory between
S & M mode or VS & HS mode. It would be good to address these concerns right now
instead of discussing those in each individual extension context.sbi_debug_console_set_area() might be called with different values byOkay, I will update.%s/addr_div_by_2/addr_div_by_4/
Set the shared memory area specified by `addr_div_by_2` and `size`Okay, I will update.parameters. The `addr_div_by_4` parameter is base address of the%s/is base/is the base/For RV32 S-mode, the physical address space is 34bits wide butshared memory area right shifted by 2 whereas `size` parameter isWhy shifting the address? I would prefer to keep it simple for the
the size of shared memory area in bytes.
caller. If the alignment is not suitable, return an error.
But why is an alignment needed here at all? And why 4 aligned?
"unsigned long" is 32bits wide. This is because Sv32 PTEs allow
34bits of PPN. In fact, even instructions such as HFENCE.GVMA
have this "address right shift by 2" requirement based on this rationale.I would prefer to simply pass a physical address pointer here with no
The shared memory area should be normal cacheable memory for the
supervisor-mode software. Also, the shared memory area is global
across all HARTs so SBI implementation must ensure atomicity in
setting the shared memory area.
Errors:
SBI_SUCCESS - Shared memory area set successfully.
SBI_ERR_INVALID_ADDRESS - The shared memory area pointed by
`addr_div_by_2` and `size` parameters
is not normal cacheable memory or not
accessible to supervisor-mode software.
Function: Console Puts (FID #1)
-------------------------------
struct sbiret sbi_debug_console_puts(unsigned long area_offset,
unsigned long num_chars)
requirements on alignment. And no prior SBI call.
different threads. An offset is ambiguous as it does not define to which
of the different shared areas it relates. Please, use a pointer.OKBare-metal tests (or assembly sources) can print sub-strings from
Do we need num_chars? Are we expecting to provide binary output? Using
0x00 as terminator would be adequate in most cases.
a large per-populated string in shared memory. Assuming that string
is always terminated by 0x00 in sbi_debug_console_puts() will break
this flexibility.The platform specification would be the right place to require 8-bitWe need to clarify this. Suggestions ?
What is the requirement on the console? Does it have to support 8bit
output to allow for UTF-8?
support for the console.We should add to the platform specification that UTF-8 output is assumedSame as above, this needs more clarification. Suggestions ?
Do we make any assumptions about encoding?
on the serial console.We should state if extra bits are ignored or the bytes are not send.
I am of the opinion to keep such encoding related assumptions to be
minimal.I would consider this to be part of the clarification we add for encoding.
How would we handle a console set up to 7bit + parity if a character >
0x7f is sent?
The easiest thing is to just ignore the extra bits. So let't state this
here.
Best regards
HeinrichOkay, I will update.%s/shard/shared/
Print the string specified by `area_offset` and `num_chars` on
the debug console. The `area_offset` parameter is the start of
string in the shard memory area whereas `num_chars` parameterOkay, I will add.is the number of characters (or bytes) in the string.There could be other reasons of failures:
This is a blocking SBI call and will only return after printing
all characters of the string.
Errors:
SBI_SUCCESS - Characters printed successfully.
SBI_ERR_INVALID_ADDRESS - The start of the string (i.e.
`area_offset`) or end of the string
(i.e. `area_offset + num_chars`) is
outside shared memory area.
* set up of the UART failed in OpenSBI
* no UART defined in the device-tree
* ...
So let us add SBI_ERR_FAILED to the list.Regards,
Best regards
Heinrich
Anup
atishp@...
On Fri, Jun 3, 2022 at 12:23 AM Heinrich Schuchardt
<heinrich.schuchardt@...> wrote:
The designated shared memory for debug console is shared across
the platforms while STA or PMU use case will have per cpu shared memory.
I agree that all the concerns related to shared memory can be discussed
together and all the common constraints can be described at one place.
But defining a separate extension for the shared memory may be problematic
as we need to manage the extension dependencies.
<heinrich.schuchardt@...> wrote:
Ahh I see. Sorry I misunderstood your comment.
On 6/3/22 08:56, Atish Kumar Patra wrote:On Thu, Jun 2, 2022 at 2:13 AM Heinrich SchuchardtI have no security concerns. My thought was that it might be better to
<heinrich.schuchardt@...> wrote:I would like to understand more about the security concerns you raised.
On 6/2/22 10:44, Anup Patel wrote:On Wed, Jun 1, 2022 at 11:59 PM Heinrich SchuchardtCurrently this function is just a nop(). It is not needed in this
<heinrich.schuchardt@...> wrote:Usually, the serial port related code in M-mode firmware only uses
On 6/1/22 18:17, Anup Patel wrote:Hi All,Thanks for starting to close this gap.
Below is the draft proposal for SBI Debug Console Extension.
Please review it and provide feedback.
Thanks,
Anup
Debug Console Extension (EID #0x4442434E "DBCN")
================================================
The debug console extension defines a generic mechanism for boot-time
early prints from supervisor-mode software which allows users to catch
boot-time issues in supervisor-mode software.
This extension replaces legacy console putchar (EID #0x01) extension
and it is better in following ways:1) It follows the new calling convention defined for SBI v1.0I miss a discussion of the conflicts that can arise if the configuration
(or higher).
2) It is based on a shared memory area between SBI implementation
and supervisor-mode software so multiple characters can be
printed using a single SBI call.
of the serial console is changed by the caller.
Do we need an ecall that closes the SBI console to further access?
status and data registers so for most serial ports support the M-mode
firmware will adapt to serial port configuration changes.
In fact, this is why we never had a special SBI call for serial port
reconfiguration in legacy SBI v0.1 as well.
In case of virtualization, the serial port (or console) is emulated so
the special SBI call is not useful for virtualization.Actually, it's the S-mode software which is voluntarily giving a portion ofIsn't it M-mode software that has to program the MMU to allow all harts
The supervisor-mode software must set the shared memory area before
printing characters on the debug console. Also, all HARTs share the
same shared memory area so only one HART needs to set it at boot-time.
in M-mode and S-mode access to the memory area? What is the S-mode
software to do about the memory area prior to calling
sbi_debug_console_set_area()?
its memory to be used as shared memory. The proposal only mandates
that whatever memory is selected by S-mode software should be a
regular cacheable memory (not IO memory). Also, if Svpbmt is available
then S-mode software should only use memory type 0 in the PTEs.Theoretically, we can avoid the extra function to set shared memory areaThe console output is needed on the very start of the S-mode software,
Function: Set Console Area (FID #0)
-----------------------------------
struct sbiret sbi_debug_console_set_area(unsigned long addr_div_by_4,
unsigned long size)
before setting up anything.
Can we avoid this extra function?
Can we simply assume that the caller of sbi_debug_console_puts()
provides a physical address pointer to a memory area that is suitable?
but it will complicate things in future when we have supervisor software
encrypting it's own memory (using special ISA support) because in this
case supervisor software will have to unprotect memory every time the
sbi_debug_console_puts() is called and protect it again after the call.
revision of the extension.
The function might be called repeatedly by different threads with
different values. How do you want to keep track of all of these
different areas?
Memory shared between different security realms will arise in many
different scenarios. As this is not console specific it should be in a
separate extension. That extension should be defined once we have
clarity about how security realms are managed.
Can you please elaborate on this ?
manage shared memory in a separate extension for all use cases.
The designated shared memory for debug console is shared across
the platforms while STA or PMU use case will have per cpu shared memory.
I agree that all the concerns related to shared memory can be discussed
together and all the common constraints can be described at one place.
But defining a separate extension for the shared memory may be problematic
as we need to manage the extension dependencies.
Best regards
Heinrich
As you pointed out, there are other possible use cases(e.g STA, PMU)
for shared memory between
S & M mode or VS & HS mode. It would be good to address these concerns right now
instead of discussing those in each individual extension context.sbi_debug_console_set_area() might be called with different values byOkay, I will update.%s/addr_div_by_2/addr_div_by_4/
Set the shared memory area specified by `addr_div_by_2` and `size`Okay, I will update.parameters. The `addr_div_by_4` parameter is base address of the%s/is base/is the base/For RV32 S-mode, the physical address space is 34bits wide butshared memory area right shifted by 2 whereas `size` parameter isWhy shifting the address? I would prefer to keep it simple for the
the size of shared memory area in bytes.
caller. If the alignment is not suitable, return an error.
But why is an alignment needed here at all? And why 4 aligned?
"unsigned long" is 32bits wide. This is because Sv32 PTEs allow
34bits of PPN. In fact, even instructions such as HFENCE.GVMA
have this "address right shift by 2" requirement based on this rationale.I would prefer to simply pass a physical address pointer here with no
The shared memory area should be normal cacheable memory for the
supervisor-mode software. Also, the shared memory area is global
across all HARTs so SBI implementation must ensure atomicity in
setting the shared memory area.
Errors:
SBI_SUCCESS - Shared memory area set successfully.
SBI_ERR_INVALID_ADDRESS - The shared memory area pointed by
`addr_div_by_2` and `size` parameters
is not normal cacheable memory or not
accessible to supervisor-mode software.
Function: Console Puts (FID #1)
-------------------------------
struct sbiret sbi_debug_console_puts(unsigned long area_offset,
unsigned long num_chars)
requirements on alignment. And no prior SBI call.
different threads. An offset is ambiguous as it does not define to which
of the different shared areas it relates. Please, use a pointer.OKBare-metal tests (or assembly sources) can print sub-strings from
Do we need num_chars? Are we expecting to provide binary output? Using
0x00 as terminator would be adequate in most cases.
a large per-populated string in shared memory. Assuming that string
is always terminated by 0x00 in sbi_debug_console_puts() will break
this flexibility.The platform specification would be the right place to require 8-bitWe need to clarify this. Suggestions ?
What is the requirement on the console? Does it have to support 8bit
output to allow for UTF-8?
support for the console.We should add to the platform specification that UTF-8 output is assumedSame as above, this needs more clarification. Suggestions ?
Do we make any assumptions about encoding?
on the serial console.We should state if extra bits are ignored or the bytes are not send.
I am of the opinion to keep such encoding related assumptions to be
minimal.I would consider this to be part of the clarification we add for encoding.
How would we handle a console set up to 7bit + parity if a character >
0x7f is sent?
The easiest thing is to just ignore the extra bits. So let't state this
here.
Best regards
HeinrichOkay, I will update.%s/shard/shared/
Print the string specified by `area_offset` and `num_chars` on
the debug console. The `area_offset` parameter is the start of
string in the shard memory area whereas `num_chars` parameterOkay, I will add.is the number of characters (or bytes) in the string.There could be other reasons of failures:
This is a blocking SBI call and will only return after printing
all characters of the string.
Errors:
SBI_SUCCESS - Characters printed successfully.
SBI_ERR_INVALID_ADDRESS - The start of the string (i.e.
`area_offset`) or end of the string
(i.e. `area_offset + num_chars`) is
outside shared memory area.
* set up of the UART failed in OpenSBI
* no UART defined in the device-tree
* ...
So let us add SBI_ERR_FAILED to the list.Regards,
Best regards
Heinrich
Anup