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

arm64/xen: Introduce xen support for aarch64 architecture #726

Merged
merged 21 commits into from Jan 25, 2024

Conversation

oleksiimoisieiev
Copy link
Contributor

@oleksiimoisieiev oleksiimoisieiev commented Jan 23, 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.pl on your commit series before opening this PR;
  • Updated relevant documentation.

Base target

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

Additional configuration

  • CONFIG_ARCH_ARM_64=y
  • CONFIG_PLAT_XEN=y
  • CONFIG_XEN_GNTTAB=y
  • CONFIG_LIBXEN_XENBUS=y
  • CONFIG_XEN_KERNEL_HV_CONSOLE=y
  • CONFIG_XEN_KERNEL_EMG_CONSOLE=y
  • CONFIG_XEN_DEBUG_HV_CONSOLE=y
  • CONFIG_XEN_DEBUG_EMG_CONSOLE=y
  • CONFIG_LIBXEN_NETFRONT=y
  • CONFIG_LIBXEN_BLKFRONT=y
  • CONFIG_LIBXEN_BLKFRONT_GREFPOOL=y

Description of changes

This is the implementation of the arm64 support for XEN hypervisor. Includes the following features:

  • Implemented of the loaders and image header for arm64 architecture;
  • Implemented all basic drivers, that are essential for work on XEN, such as: memory management, gnttab, xenbus and console drivers;
  • Updated and tested frontend drivers for the devices: 9p, blkfront and netfront;
  • Ported pvcalls-frontend driver from the Linux Kernel implementation,

GitHub-DependsOn: #1269

@oleksiimoisieiev oleksiimoisieiev requested review from a team as code owners January 23, 2023 14:52
@razvand razvand added plat/xen Unikraft for Xen arch/arm64 labels Jan 23, 2023
@razvand razvand added this to the v0.13.0 (Atlas) milestone Jan 23, 2023
@razvand razvand requested review from mariasfiraiala and michpappas and removed request for a team January 23, 2023 15:03
@razvand razvand added lang/c Issues or PRs to do with C/C++ area/plat Unikraft Patform labels Jan 23, 2023
@razvand
Copy link
Contributor

razvand commented Jan 23, 2023

Thanks, @oleksiimoisieiev. I've added tags, reviewers and assignees. We'll aim to get the work done for release 0.13 in late April.

@unikraft-bot unikraft-bot added arch/arm area/arch Unikraft Architecture area/include Part of include/uk area/lib Internal Unikraft Microlibrary lib/ukring plat/common Common to all platforms plat/driver plat/driver/gic labels Jan 23, 2023
@michpappas
Copy link
Member

michpappas commented Jan 25, 2024

oleksiimoisieiev many thanks.

Approved-by: Michalis Pappas michalis@unikraft.io

Copy link
Member

@craciunoiuc craciunoiuc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't mind me, just leaving the tag again.

Approved-by: Michalis Pappas michalis@unikraft.io

@craciunoiuc craciunoiuc self-assigned this Jan 25, 2024
@razvand razvand changed the base branch from staging to staging-726 January 25, 2024 10:32
@razvand razvand merged commit b7acd2b into unikraft:staging-726 Jan 25, 2024
11 of 12 checks passed
razvand pushed a commit that referenced this pull request Jan 25, 2024
Changes in this commit were extracted from Mini-OS and implement arm64
loader support for the Unikraft.
Implemented features on this stage are the following:
 * create unikernel binary both ELF and ZBOOT (include ZBOOT entry)
 * initialization of the basic hardware
 * enable emergency console to show program output
 * modify configuration to allow selecting XEN guest for aarch64
 * event channels implementation
 * hypervisor console implementation

Checkpatch-Ignore: AVOID_BUG
Checkpatch-Ignore: AVOID_EXTERNS
Reviewed-by: Oleksandr Grytsov <Oleksandr_Grytsov@epam.com>
Signed-off-by: Oleksii Moisieiev <oleksii_moisieiev@epam.com>
Reviewed-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Andrei Stan <andreistan2003@gmail.com>
Approved-by: Michalis Pappas <michalis@unikraft.io>
GitHub-Closes: #726
razvand pushed a commit that referenced this pull request Jan 25, 2024
Implementation of the grant-table support and interrupt support.
Partly moved from Mini-OS and from plat/xen/kvm.
Interrupt support was adopted to use gicv2 and gicv3.

Checkpatch-Ignore: AVOID_BUG
Checkpatch-Ignore: AVOID_EXTERNS
Reviewed-by: Oleksandr Grytsov <Oleksandr_Grytsov@epam.com>
Signed-off-by: Oleksii Moisieiev <oleksii_moisieiev@epam.com>
Reviewed-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Andrei Stan <andreistan2003@gmail.com>
Approved-by: Michalis Pappas <michalis@unikraft.io>
GitHub-Closes: #726
razvand pushed a commit that referenced this pull request Jan 25, 2024
Some platforms may require additional steps to init interrupt
controller properly. That's why introducing platform_specific init
function which is called after address read and before probe finish
for interrupt controller.
This function accepts struct uk_intctlr_plat_data pointer as input
parameter and generic pointer as output parameter which has to be
interpreted by interrupt controller. If function was not defined
- it just returns 0.
For aarch64 Xen platform struct uk_intctlr_plat_probe accepts
address of destributor/redistributor address from GIC pair and
returns mapped address that can be used to access registers.

Signed-off-by: Oleksii Moisieiev <oleksii_moisieiev@epam.com>
Reviewed-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Andrei Stan <andreistan2003@gmail.com>
Approved-by: Michalis Pappas <michalis@unikraft.io>
GitHub-Closes: #726
razvand pushed a commit that referenced this pull request Jan 25, 2024
uk_intctlr_plat_probe is platform specific initialization for GIC
drivers. It maps destributor/redistributor address to the page table
so system can access registers and returns mapped addresses to
GIC driver.

Signed-off-by: Oleksii Moisieiev <oleksii_moisieiev@epam.com>
Reviewed-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Andrei Stan <andreistan2003@gmail.com>
Approved-by: Michalis Pappas <michalis@unikraft.io>
GitHub-Closes: #726
razvand pushed a commit that referenced this pull request Jan 25, 2024
Add platform specific init support for GIC drivers.
Some platforms, such as Xen may require GIC
destributor/redistributor address to be mapped to the mmu
tables so system can access registers. So addresses are
passed to the uk_intctlr_plat_probe and mapped addresses
are expected.

Signed-off-by: Oleksii Moisieiev <oleksii_moisieiev@epam.com>
Reviewed-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Andrei Stan <andreistan2003@gmail.com>
Approved-by: Michalis Pappas <michalis@unikraft.io>
GitHub-Closes: #726
razvand pushed a commit that referenced this pull request Jan 25, 2024
arch_timer implemented for arm32 is not suitable for aarch64 because
it doesn't use interrupts so makes system to wait forever during
sleep call.
Added support for generic interrupt based timer.

Reviewed-by: Oleksandr Grytsov <Oleksandr_Grytsov@epam.com>
Signed-off-by: Oleksii Moisieiev <oleksii_moisieiev@epam.com>
Reviewed-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Andrei Stan <andreistan2003@gmail.com>
Approved-by: Michalis Pappas <michalis@unikraft.io>
GitHub-Closes: #726
razvand pushed a commit that referenced this pull request Jan 25, 2024
Added check to __XEN_INTERFACE_VERSION__ being empty. In this case
default value should also be set.

Reviewed-by: Oleksandr Grytsov <Oleksandr_Grytsov@epam.com>
Signed-off-by: Oleksii Moisieiev <oleksii_moisieiev@epam.com>
Reviewed-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Andrei Stan <andreistan2003@gmail.com>
Approved-by: Michalis Pappas <michalis@unikraft.io>
GitHub-Closes: #726
razvand pushed a commit that referenced this pull request Jan 25, 2024
Adaptation of the netfront and 9p drivers to compile and start
on aarch64.

Reviewed-by: Oleksandr Grytsov <Oleksandr_Grytsov@epam.com>
Signed-off-by: Oleksii Moisieiev <oleksii_moisieiev@epam.com>
Reviewed-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Andrei Stan <andreistan2003@gmail.com>
Approved-by: Michalis Pappas <michalis@unikraft.io>
GitHub-Closes: #726
razvand pushed a commit that referenced this pull request Jan 25, 2024
When multiprocessor configuration is enabled, run and wakeup
interrupts should be registered.

Signed-off-by: Oleksii Moisieiev <oleksii_moisieiev@epam.com>
Reviewed-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Andrei Stan <andreistan2003@gmail.com>
Approved-by: Michalis Pappas <michalis@unikraft.io>
GitHub-Closes: #726
razvand pushed a commit that referenced this pull request Jan 25, 2024
Event IRQ (31) is responsible for getting responses from event
channels.

Signed-off-by: Oleksii Moisieiev <oleksii_moisieiev@epam.com>
Reviewed-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Andrei Stan <andreistan2003@gmail.com>
Approved-by: Michalis Pappas <michalis@unikraft.io>
GitHub-Closes: #726
razvand pushed a commit that referenced this pull request Jan 25, 2024
Moving to common place to prevent copying code.

Signed-off-by: Oleksii Moisieiev <oleksii_moisieiev@epam.com>
Reviewed-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Andrei Stan <andreistan2003@gmail.com>
Approved-by: Michalis Pappas <michalis@unikraft.io>
GitHub-Closes: #726
razvand pushed a commit that referenced this pull request Jan 25, 2024
grant_table region, reading from the DTB has an address, which is
outside of the memory region, allocated for the domain. That's why
grant_table region should be mapped to the page table.
Also removed setup_table call because it shouldn't be called with
XENMEM_add_to_physmap.

Signed-off-by: Oleksii Moisieiev <oleksii_moisieiev@epam.com>
Reviewed-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Andrei Stan <andreistan2003@gmail.com>
Approved-by: Michalis Pappas <michalis@unikraft.io>
GitHub-Closes: #726
razvand pushed a commit that referenced this pull request Jan 25, 2024
Signed-off-by: Oleksii Moisieiev <oleksii_moisieiev@epam.com>
Reviewed-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Andrei Stan <andreistan2003@gmail.com>
Approved-by: Michalis Pappas <michalis@unikraft.io>
GitHub-Closes: #726
razvand pushed a commit that referenced this pull request Jan 25, 2024
MAIR values should be programed to different slots, which are made
by MAIR macro. It moves MAIR_* mask left on MT_* * 8 bits so MAIR
masks won't overlap.

Signed-off-by: Volodymyr Babchuk <volodymyr_babchuk@epam.com>
Reviewed-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Andrei Stan <andreistan2003@gmail.com>
Approved-by: Michalis Pappas <michalis@unikraft.io>
GitHub-Closes: #726
razvand pushed a commit that referenced this pull request Jan 25, 2024
fdt64_ld function generate correct memory-aligned value.
This call is safer than fdt_to_cpu because it accepts pointer,
which potentially can be an array. For example libfdt is
using fdt64_ld_ function to parse addresses (although it's
a wrapper around fdt64_to_cpu.

Signed-off-by: Oleksii Moisieiev <oleksii_moisieiev@epam.com>
Reviewed-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Andrei Stan <andreistan2003@gmail.com>
Approved-by: Michalis Pappas <michalis@unikraft.io>
GitHub-Closes: #726
razvand pushed a commit that referenced this pull request Jan 25, 2024
When building PLAT_XEN for ARCH_ARM_64 enable GICv3 as default
interrupt controller for the platform.

Signed-off-by: Oleksii Moisieiev <oleksii_moisieiev@epam.com>
Reviewed-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Andrei Stan <andreistan2003@gmail.com>
Approved-by: Michalis Pappas <michalis@unikraft.io>
GitHub-Closes: #726
razvand pushed a commit that referenced this pull request Jan 25, 2024
During xenbus state switch function checks if state was already set.
There should be used state_path instead of xenbus->nodename to read
the correct state information.

Signed-off-by: Oleksii Moisieiev <oleksii_moisieiev@epam.com>
Reviewed-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Andrei Stan <andreistan2003@gmail.com>
Approved-by: Michalis Pappas <michalis@unikraft.io>
GitHub-Closes: #726
razvand pushed a commit that referenced this pull request Jan 25, 2024
Set vaddr as pbase in mrd region to handle correctly heap region space.

Signed-off-by: Oleksii Moisieiev <oleksii_moisieiev@epam.com>
Reviewed-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Andrei Stan <andreistan2003@gmail.com>
Approved-by: Michalis Pappas <michalis@unikraft.io>
GitHub-Closes: #726
razvand pushed a commit that referenced this pull request Jan 25, 2024
There is no need to stop probe sequence when some devtype probe was
failed. For example if system can't probe 9pfs it shouldn't skip
probing other device types, such as netdev or blkdev. System is
workable without 9pfs support.

Signed-off-by: Oleksii Moisieiev <oleksii_moisieiev@epam.com>
Reviewed-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Andrei Stan <andreistan2003@gmail.com>
Approved-by: Michalis Pappas <michalis@unikraft.io>
GitHub-Closes: #726
razvand pushed a commit that referenced this pull request Jan 25, 2024
Sets correct permissions for the segments and assigns sections to the
correct segments for Xen Arm64 architecture.
This is an enhancement of the PHDRs introduced in:
Commit c2245ac ("build: Place
sections into segments with correct permissions")

Signed-off-by: Oleksii Moisieiev <oleksii_moisieiev@epam.com>
Reviewed-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Andrei Stan <andreistan2003@gmail.com>
Approved-by: Michalis Pappas <michalis@unikraft.io>
GitHub-Closes: #726
razvand pushed a commit that referenced this pull request Jan 25, 2024
According to the new driver model, XEN related drivers
were moved from plat and placed in drivers directory
with conditional build.

Signed-off-by: Oleksii Moisieiev <oleksii_moisieiev@epam.com>
Reviewed-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Andrei Stan <andreistan2003@gmail.com>
Approved-by: Michalis Pappas <michalis@unikraft.io>
GitHub-Closes: #726
@nderjung nderjung added the release-note Denotes a PR that will be considered when it comes time to generate release notes. label Jan 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arch/arm arch/arm64 area/arch Unikraft Architecture area/include Part of include/uk area/lib Internal Unikraft Microlibrary area/plat Unikraft Patform lang/c Issues or PRs to do with C/C++ lib/isrlib lib/nolibc Only neccessary subset of libc functionality lib/ukring lib/vfscore VFS Core Interface plat/common Common to all platforms plat/driver/gic plat/driver plat/kvm Unikraft for KVM plat/xen Unikraft for Xen release-note Denotes a PR that will be considered when it comes time to generate release notes. size/large Large PR, takes some time to review
Projects
Status: Done!
Development

Successfully merging this pull request may close these issues.

Xen arm64 (aarch64) support