New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
plat: Migrate pl011 to drivers/uktty #1025
plat: Migrate pl011 to drivers/uktty #1025
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
Signed-off-by: Michalis Pappas <michalis@unikraft.io>
1a5bc52
to
37118c8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, just a few typos in the commit messages:
Approved-by: Razvan Virtan virtanrazvan@gmail.com
Add skeleton for the `uktty` subsystem. This subsystem contains drivers for console devices such as UART and VGA. Signed-off-by: Michalis Pappas <michalis@unikraft.io>
37118c8
to
846fd85
Compare
@razvanvirtan thanks a lot for reviewing. Both typos are fixed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @michpappas! Thanks for not letting this PR rot 🙏 ! Had a quick look over the changes. I will have another run tomorrow on this and the others from your side I am assigned as reviewer to.
drivers/uktty/pl011/pl011.c
Outdated
@@ -128,7 +128,7 @@ void pl011_console_init(const void *dtb) | |||
UK_CRASH("Could not find proper size cells!\n"); | |||
|
|||
regs = fdt_getprop(dtb, offset, "reg", &len); | |||
if (regs == NULL || (len < (int)sizeof(fdt32_t) * (naddr + nsize))) | |||
if (!regs || (len < (int)sizeof(fdt32_t) * (naddr + nsize))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's use unlikely
on all UK_CRASH
cases?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, I'll do that. Thanks 👍🏼
@@ -90,7 +90,7 @@ static void init_pl011(__u64 bas) | |||
|
|||
/* Mask all interrupts */ | |||
PL011_REG_WRITE(REG_UARTIMSC_OFFSET, | |||
PL011_REG_READ(REG_UARTIMSC_OFFSET) & 0xf800); | |||
PL011_REG_READ(REG_UARTIMSC_OFFSET) & 0xf800); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we maybe have drivers/uktty/pl011: Whitespace fixes for checkpatch
squashed into the migration commit? 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's also one possible way of many. I considered both that option as well as the possibility to do all checkpatch changes in one commit (or even in the same one as the migration), but in the end I concluded it would be cleaner to do this in discrete steps. If you have a strong opinion / reasoning about it I don't mind to change it though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you have a strong opinion / reasoning about it I don't mind to change it though.
Nah, my only concern is usually when it comes to bisecting and looking at git history to not be unnecessarily contaminated.
I concluded it would be cleaner to do this in discrete steps
Ok I see. Sure, it's just one commit after all. Let's keep it like this if you say you considered it already and believe it to be cleaner: migration and checkpatch fixes. 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a tiny comment. Other than that, LGTM!
Reviewed-by: Sergiu Moga sergiu.moga@unikraft.io
drivers/uktty/pl011/pl011.c
Outdated
static uint8_t pl011_uart_initialized = 1; | ||
static uint64_t pl011_uart_bas = CONFIG_EARLY_PRINT_PL011_UART_ADDR; | ||
static uint64_t pl011_uart_bas = CONFIG_LIBUKTTY_PL011_EARLY_CONSOLE_BASE; | ||
#else |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An /* !CONFIG_LIBUKTTY_PL011_EARLY_CONSOLE_BASE */
here?
Migrate the pl011 driver to the newly introduced uktty subsystem. Signed-off-by: Michalis Pappas <michalis@unikraft.io>
The `pl011` does not depend on the standand library. Replace stdint types with kernel types. Signed-off-by: Michalis Pappas <michalis@unikraft.io>
Replace bit shifts with UK_BIT in macros to comply with checkpath. Signed-off-by: Michalis Pappas <michalis@unikraft.io>
Various whitespace fixes to comply with checkpatch. Signed-off-by: Michalis Pappas <michalis@unikraft.io>
Use shorhand syntax for checks against NULL to comply with checkpatch. Signed-off-by: Michalis Pappas <michalis@unikraft.io>
Fixes an issue when early console is not enabled where no output would be sent to the console due to the driver ignoring calls when the initialized flag is not set. Signed-off-by: Michalis Pappas <michalis@unikraft.io>
Use the `unlikely` macro in error conditions to hint the compiler to optimize the for the probable path. Signed-off-by: Michalis Pappas <michalis@unikraft.io>
8da0f1b
to
f29b5b8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved-by: Razvan Deaconescu razvand@unikraft.io
Add skeleton for the `uktty` subsystem. This subsystem contains drivers for console devices such as UART and VGA. Signed-off-by: Michalis Pappas <michalis@unikraft.io> Reviewed-by: Sergiu Moga <sergiu.moga@unikraft.io> Approved-by: Razvan Deaconescu <razvand@unikraft.io> GitHub-Closes: #1025
Migrate the pl011 driver to the newly introduced uktty subsystem. Signed-off-by: Michalis Pappas <michalis@unikraft.io> Reviewed-by: Sergiu Moga <sergiu.moga@unikraft.io> Approved-by: Razvan Deaconescu <razvand@unikraft.io> GitHub-Closes: #1025
The `pl011` does not depend on the standand library. Replace stdint types with kernel types. Signed-off-by: Michalis Pappas <michalis@unikraft.io> Reviewed-by: Sergiu Moga <sergiu.moga@unikraft.io> Approved-by: Razvan Deaconescu <razvand@unikraft.io> GitHub-Closes: #1025
Replace bit shifts with UK_BIT in macros to comply with checkpath. Signed-off-by: Michalis Pappas <michalis@unikraft.io> Reviewed-by: Sergiu Moga <sergiu.moga@unikraft.io> Approved-by: Razvan Deaconescu <razvand@unikraft.io> GitHub-Closes: #1025
Various whitespace fixes to comply with checkpatch. Signed-off-by: Michalis Pappas <michalis@unikraft.io> Reviewed-by: Sergiu Moga <sergiu.moga@unikraft.io> Approved-by: Razvan Deaconescu <razvand@unikraft.io> GitHub-Closes: #1025
Use shorhand syntax for checks against NULL to comply with checkpatch. Signed-off-by: Michalis Pappas <michalis@unikraft.io> Reviewed-by: Sergiu Moga <sergiu.moga@unikraft.io> Approved-by: Razvan Deaconescu <razvand@unikraft.io> GitHub-Closes: #1025
Fixes an issue when early console is not enabled where no output would be sent to the console due to the driver ignoring calls when the initialized flag is not set. Signed-off-by: Michalis Pappas <michalis@unikraft.io> Reviewed-by: Sergiu Moga <sergiu.moga@unikraft.io> Approved-by: Razvan Deaconescu <razvand@unikraft.io> GitHub-Closes: #1025
Use the `unlikely` macro in error conditions to hint the compiler to optimize the for the probable path. Signed-off-by: Michalis Pappas <michalis@unikraft.io> Reviewed-by: Sergiu Moga <sergiu.moga@unikraft.io> Approved-by: Razvan Deaconescu <razvand@unikraft.io> GitHub-Closes: #1025
Prerequisite checklist
checkpatch.uk
on your commit series before opening this PR;Base target
Additional configuration
Description of changes
Migrate the PL011 driver to
drivers/uktty