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

Zephyr v3.6.0 xt rpi5 dom0 wip #94

Merged

Conversation

GrygiriiS
Copy link

First iteration of enabling RPI 5 in Zephyr and adding Dom0 functionality

@GrygiriiS GrygiriiS requested review from lorc and firscity as code owners April 17, 2024 13:55
@GrygiriiS
Copy link
Author

@oleksiimoisieiev
Copy link

lgtm
Acked-by: Oleksii Moisieiev <[email protected]>

@GrygiriiS
Copy link
Author

GrygiriiS commented Apr 18, 2024

Some checks failed on RPI5 initial patches as those patches ported as is from Zephyr ML. Those patches will need to be updated later any way when (if) they'll be merged in Zephyr ML. I have no intention to fix those CI warnings now.

UPD: fixed

@GrygiriiS GrygiriiS force-pushed the zephyr-v3.6.0-xt-rpi5-dom0-wip branch from 293d630 to 0fce7ee Compare April 18, 2024 10:56
Copy link

github-actions bot commented Apr 19, 2024

The following west manifest projects have been modified in this Pull Request:

Name Old Revision New Revision Diff

Note: This message is automatically posted and updated by the Manifest GitHub Action.

Copy link
Collaborator

@firscity firscity left a comment

Choose a reason for hiding this comment

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

Please, fix checkpatch warnings.

Also commits

  1. dts: arm64: broadcom: bcm2712: add psci and compatible - add proper explanation for this
  2. drivers: xen: add XEN_EVENTS Kconfig option
    but thay might be not used. - > but they might be not used.
  3. boards: arm64: xenvm: reduce hypervisor node memory - please, mark this as a "WA" in commit topic, I will provide a proper solution soon.

boards/arm64/xenvm/xenvm_defconfig Show resolved Hide resolved
boards/arm64/rpi_5/Kconfig.board Outdated Show resolved Hide resolved
submanifests/zephyr-xenlib.yaml Outdated Show resolved Hide resolved
include/zephyr/xen/public/domctl.h Show resolved Hide resolved
boards/arm64/rpi_5/Kconfig.defconfig Outdated Show resolved Hide resolved
@GrygiriiS GrygiriiS force-pushed the zephyr-v3.6.0-xt-rpi5-dom0-wip branch 2 times, most recently from f05c1a3 to 99a0bdc Compare April 26, 2024 13:40
@GrygiriiS
Copy link
Author

RPI5 commits went upstream, so cherry-picked and noted.
Other comments fixed.

drivers/xen/Kconfig Show resolved Hide resolved
@@ -69,7 +69,7 @@

hypervisor: hypervisor@38000000 {
compatible = "xen,xen";
reg = <0x00 0x38000000 0x00 0x1000000>;
reg = <0x00 0x38000000 0x00 0x10000>;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should be removed after #96 will be merged

boards/arm64/rpi_5/doc/index.rst Outdated Show resolved Hide resolved
boards/arm64/rpi_5/doc/index.rst Outdated Show resolved Hide resolved
boards/arm64/rpi_5/doc/index.rst Outdated Show resolved Hide resolved
The Raspberry Pi 5 platform can be used to run as Xen Zephyr DomU with RPI 5 HW support.
For such purposes the `rpi_5_xen_domd` can be used.

Run below command as an example of RPI 5 Zephyr build as Dom0:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Run below command -> Run the command below

example of RPI 5 Zephyr build as Dom0 - probably copy-paste issue

Copy link
Author

Choose a reason for hiding this comment

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

fixed

boards/arm64/rpi_5/doc/index.rst Show resolved Hide resolved
boards/arm64/rpi_5/doc/index.rst Outdated Show resolved Hide resolved
@GrygiriiS GrygiriiS force-pushed the zephyr-v3.6.0-xt-rpi5-dom0-wip branch from 99a0bdc to fa8c762 Compare April 30, 2024 08:57

static int gpio_brcmstb_pin_configure(const struct device *port, gpio_pin_t pin, gpio_flags_t flags)
{
struct gpio_brcmstb_data *data = port->data;
Copy link

Choose a reason for hiding this comment

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

Null check?

Copy link
Author

Choose a reason for hiding this comment

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

First it's not my patch and it's explicitly marked as back-ported (with "cherry picked from commit 31badda", so probably right place for comments is in Zephyr mainline zephyrproject-rtos#70538.

Second, those functions are not called directly, but through the gpio APIs and null is impossible here.


static int gpio_brcmstb_port_get_raw(const struct device *port, gpio_port_value_t *value)
{
struct gpio_brcmstb_data *data = port->data;
Copy link

Choose a reason for hiding this comment

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

Same, please check all pointers for NULL value.

Copy link
Author

Choose a reason for hiding this comment

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

the same as above

# SPDX-License-Identifier: Apache-2.0
zephyr_sources_ifdef(CONFIG_ARM_MMU mmu_regions.c)

set(SOC_LINKER_SCRIPT ${ZEPHYR_BASE}/include/zephyr/arch/arm64/scripts/linker.ld CACHE INTERNAL "")
Copy link

Choose a reason for hiding this comment

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

Could you add some comments describing why is this needed pls?

Copy link
Author

Choose a reason for hiding this comment

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

same as above

@@ -0,0 +1,17 @@
.. _rpi_5_xen_domd:

RPI 5 Xen DomD: snippet for XEN HW domain
Copy link

Choose a reason for hiding this comment

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

Do we really need separate snippets for DomD and DomUs? AFAIK there is no real difference between them, so what is the reason for explicitly specifying DomD here?

Copy link
Author

Choose a reason for hiding this comment

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

if you look at code ypu'll see DomD based on xenvm DT + passedthrough HW, Dom0 has different Xen specific DT and no HW for now. Those are NOT compatible.

Lahyllas and others added 8 commits May 3, 2024 10:59
Add GPIO driver for brcmstb, required by Raspberry Pi 5.

Signed-off-by: Junho Lee <[email protected]>
(cherry picked from commit 31badda)
Signed-off-by: Grygorii Strashko <[email protected]>
Add support for BCM2712, SoC of Raspberry Pi 5.

Signed-off-by: Junho Lee <[email protected]>
(cherry picked from commit 76ec481)
Signed-off-by: Grygorii Strashko <[email protected]>
Add support for Raspberry Pi 5.
Currently only internal GPIO(gio_aon) is supported.
'Blinky' is the only sample that is working for now.

Signed-off-by: Junho Lee <[email protected]>
(cherry picked from commit 73f4102)
Signed-off-by: Grygorii Strashko <[email protected]>
Enable serial communication through UART port between HDMI ports.

Signed-off-by: Myeonghyeon Park <[email protected]>
Signed-off-by: Junho Lee <[email protected]>
(cherry picked from commit 63692c1)
Signed-off-by: Grygorii Strashko <[email protected]>
Mainline zephyr is moved to HWM v2 which rearranged *soc* and *boards*
which prevents usage of patches [1] as is.

Hence backport bcm2712 to old HWM.

Not for upstream.

[1] zephyrproject-rtos#70538
Signed-off-by: Grygorii Strashko <[email protected]>
Mainline zephyr is moved to HWM v2 which rearranged *soc* and *boards*
which prevents usage of patches [1] as is.

Hence backport RPI5 board to old HWM.

Not for upstream.

[1] zephyrproject-rtos#70538
Signed-off-by: Grygorii Strashko <[email protected]>
The XEN events consume 72K of RAM, but they might be not used.

Add XEN EVENTS Kconfig option so XEN events could be gracefully disabled
if not needed.

Signed-off-by: Grygorii Strashko <[email protected]>
The current "hypervisor" node defined to use 16M of MMIO memory, which is
way too much. reduce it to 65K. Otherwise it's required to allocate bug
number of grant frames for domain (max_grant_frames).

As suggested by Dmytro Firsov.

Signed-off-by: Grygorii Strashko <[email protected]>
Grygorii Strashko added 5 commits May 3, 2024 10:59
The CONFIG_XEN_REGIONS is enabled by default, but second memory range is
not defined for "hypervisor" node which causes build failure.

Hence, disable CONFIG_XEN_REGIONS for xenvm platform.

Signed-off-by: Grygorii Strashko <[email protected]>
Tmp adjust XEN_DOMCTL_INTERFACE_VERSION to start with XEN 4.19.

See commit bdb1184d4f6bf4e0121fda34a6c1cb51fe270e7d ("domctl: bump
interface version"), there were no Xen interface struct changes.

Signed-off-by: Grygorii Strashko <[email protected]>
Add RPI5 board support.

Signed-off-by: Grygorii Strashko <[email protected]>
Add rpi_5_xen_domd snippet to demonstrate enabling RPI 5 HW in Xen domain.
Only GPIO LED is supported.

Signed-off-by: Grygorii Strashko <[email protected]>
Add Xen specific documentation.

Signed-off-by: Grygorii Strashko <[email protected]>
@GrygiriiS GrygiriiS force-pushed the zephyr-v3.6.0-xt-rpi5-dom0-wip branch from fa8c762 to dd6cfaf Compare May 3, 2024 08:01
@firscity firscity merged commit 03c3eb6 into xen-troops:rpi5_dev May 3, 2024
9 checks passed
@GrygiriiS GrygiriiS deleted the zephyr-v3.6.0-xt-rpi5-dom0-wip branch May 9, 2024 11:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants