Skip to content
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

Merged
merged 8 commits into from Dec 23, 2023

Conversation

michpappas
Copy link
Member

@michpappas michpappas commented Aug 7, 2023

Prerequisite checklist

  • Read the contribution guidelines regarding submitting new changes to the project;
  • Tested your changes against relevant architectures and platforms;
  • Ran the checkpatch.uk on your commit series before opening this PR;
  • Updated relevant documentation.

Base target

  • Architecture(s): [N/A]
  • Platform(s): [N/A]
  • Application(s): [N/A]

Additional configuration

Description of changes

Migrate the PL011 driver to drivers/uktty

@michpappas michpappas requested review from a team as code owners August 7, 2023 14:41
@michpappas

This comment was marked as outdated.

@unikraft-bot unikraft-bot added arch/arm arch/arm64 arch/x86_64 area/arch Unikraft Architecture area/include Part of include/uk area/kconfig Part of the Unikraft KConfig option system area/lib Internal Unikraft Microlibrary area/makefile Part of the Unikraft Makefile build system area/plat Unikraft Patform lang/c Issues or PRs to do with C/C++ lang/python Issues or PRs to do with Python lib/ukboot plat/common Common to all platforms plat/driver plat/driver/gic plat/driver/pci plat/driver/virtio plat/kvm Unikraft for KVM plat/xen Unikraft for Xen labels Aug 7, 2023
michpappas added a commit to michpappas/unikraft that referenced this pull request Dec 17, 2023
Signed-off-by: Michalis Pappas <michalis@unikraft.io>
@michpappas michpappas force-pushed the migrate_pl011_to_drivers branch 2 times, most recently from 1a5bc52 to 37118c8 Compare December 17, 2023 18:54
Copy link
Contributor

@razvanvirtan razvanvirtan left a 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>
@michpappas
Copy link
Member Author

@razvanvirtan thanks a lot for reviewing. Both typos are fixed.

Copy link
Member

@mogasergiu mogasergiu left a 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.

@@ -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)))
Copy link
Member

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?

Copy link
Member Author

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);
Copy link
Member

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? 🤔

Copy link
Member Author

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.

Copy link
Member

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. 👍

Copy link
Member

@mogasergiu mogasergiu left a 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

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
Copy link
Member

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>
Copy link
Contributor

@razvand razvand left a 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

@razvand razvand changed the base branch from staging to staging-1025 December 23, 2023 14:26
@razvand razvand merged commit 1c7f7f0 into unikraft:staging-1025 Dec 23, 2023
10 checks passed
razvand pushed a commit that referenced this pull request Dec 23, 2023
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
razvand pushed a commit that referenced this pull request Dec 23, 2023
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
razvand pushed a commit that referenced this pull request Dec 23, 2023
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
razvand pushed a commit that referenced this pull request Dec 23, 2023
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
razvand pushed a commit that referenced this pull request Dec 23, 2023
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
razvand pushed a commit that referenced this pull request Dec 23, 2023
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
razvand pushed a commit that referenced this pull request Dec 23, 2023
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
razvand pushed a commit that referenced this pull request Dec 23, 2023
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arch/arm arch/arm64 arch/x86_64 area/arch Unikraft Architecture area/include Part of include/uk area/kconfig Part of the Unikraft KConfig option system area/lib Internal Unikraft Microlibrary area/makefile Part of the Unikraft Makefile build system area/plat Unikraft Patform lang/c Issues or PRs to do with C/C++ lang/python Issues or PRs to do with Python lib/ukboot plat/common Common to all platforms plat/driver/gic plat/driver/pci plat/driver/virtio plat/driver plat/kvm Unikraft for KVM plat/xen Unikraft for Xen
Projects
Status: Done
Status: Done!
Development

Successfully merging this pull request may close these issues.

None yet

8 participants