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

Add support of Xen PV console via UART-like driver #36691

Merged
merged 4 commits into from
Oct 29, 2021

Conversation

firscity
Copy link
Contributor

@firscity firscity commented Jul 2, 2021

This commit series adds initial items for Xen features development (some of public headers, hypercall interface etc).

Also it adds minimal implementation of Xen PV console in Zephyr (via UART-like driver with poll API). It allows to get boot log and application stdout directly from domain hypervisor console, instead of emulated PL011 SBSA.

As addition, this console also supports console_io interface. It can be used for early boot log - driver introduces printk/stdout char-based hooks, that allow to receive kernel messages quickly after start, but require debug version of Xen (compiled with CONFIG_DEBUG option).

Fixes #37239

Copy link

@bertrand-marquis bertrand-marquis left a comment

Choose a reason for hiding this comment

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

Xen 4.16 is not release yet so if you took current headers status they might change before the 4.16 release in 6 month or so.
I would suggest to use a stable release when importing public headers (4.15.0)

@@ -88,13 +77,17 @@ configuration would not boot on your hardware. In this case you need to update
configuration by altering device tree and Kconfig options. This will be covered
in detail in next section.

No Xen-specific features are supported at the moment. This includes:
Most of Xen-specific features are supported at the moment. This includes:

Choose a reason for hiding this comment

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

This changes looks weird.
Most of the features listed after are under development or not supported at all (xenbus for example).
More then that is is incoherent with the next chapter saying "now only following feature are supported".
Could this change be a mistake ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, sorry, agree. I missed "not" and context was broken. Of course, these feature are NOT supported yet.

Thank you for careful review!

@firscity
Copy link
Contributor Author

firscity commented Jul 2, 2021

Xen 4.16 is not release yet so if you took current headers status they might change before the 4.16 release in 6 month or so.
I would suggest to use a stable release when importing public headers (4.15.0)

I agree, did not pay enough attention for that. Xen public headers did not pass Zephyr code style and license check, so I decided to fix it altogether with your suggestion. Current headers were taken from Xen RELEASE-4.15.0 branch and modified to comply with Zephyr code-style.

Thank you for comment!

@firscity firscity force-pushed the xen_pvconsole_pr branch 4 times, most recently from d3f1d0d to e37ca86 Compare July 2, 2021 16:08
@firscity
Copy link
Contributor Author

firscity commented Jul 2, 2021

I need someone, who can clarify me few moment with Zephyr CI checks. The only 2 problems left in this PR according to CI report:

  1. 2 spacing errors in macro definition :
-:852: ERROR:SPACING: need consistent spacing around '*' (ctx:WxV)
852: FILE: include/xen/public/arch-arm.h:177:
+	typedef union { type *p; unsigned long q; }	\

It looks like style checker identify it as multiplication instead of pointer definition and produce spacing error (false-positive).

  1. Licensing. Is it allowed to use MIT-licensed headers in Apache 2.0 Zephyr?
    CI checker marked such headers as errors:
Error: * scan/include/xen/public/arch-arm.h is not apache-2.0 licensed: mit
* scan/include/xen/public/event_channel.h is not apache-2.0 licensed: mit
...

But as I can see, MIT headers/files are already present in Zephyr tree (e.g. include/net/http_parser.h). Is it possible to use original Xen public headers or I should create my own Apache 2.0 licensed files?

@carlocaione
Copy link
Collaborator

One think I don't like is that we now have arch/arm64/xen when the proper place for this should be arch/arm64/core/xen if we want to follow what all archs are doing.

@firscity
Copy link
Contributor Author

firscity commented Jul 5, 2021

One think I don't like is that we now have arch/arm64/xen when the proper place for this should be arch/arm64/core/xen if we want to follow what all archs are doing.

Fixed, hypercall interface moved to arch/arm64/core/xen.

@dcpleung
Copy link
Member

I think first step is to send a quick email to TSC mailing list about the licensing. Hopefully it would be easy since it's BSD.

@carlescufi
Copy link
Member

@firscity sorry for the delay. I've included this in this week's TSC agenda.

@firscity
Copy link
Contributor Author

@carlescufi, thank you a lot for help, I will wait for results. In case of TSC approval, I will prepare this PR for merge ASAP (fix merge conflicts).

@cfriedt
Copy link
Member

cfriedt commented Sep 7, 2021

@firscity - please rebase

@firscity firscity force-pushed the xen_pvconsole_pr branch 2 times, most recently from e37ca86 to 8398ac4 Compare September 7, 2021 17:51
@firscity
Copy link
Contributor Author

firscity commented Sep 8, 2021

@cfriedt, done.

@cfriedt
Copy link
Member

cfriedt commented Sep 9, 2021

@firscity - the TSC has decided to hold off merging this, but I would imagine it will go in in the near future. Thanks for your patience.

@nashif nashif removed the TSC Topics that need TSC discussion label Sep 15, 2021
@nashif nashif added this to the v3.0.0 milestone Sep 15, 2021
@firscity
Copy link
Contributor Author

In 2.7 release CONFIG_UART_CONSOLE_ON_DEV_NAME Kconfig option was removed, so it was needed to change this PR a bit. This option was removed from xenvm_defconfig and console selection was moved to chosen device-tree node.

No functional changes were made by last force-push.

@firscity
Copy link
Contributor Author

firscity commented Oct 27, 2021

Is there any update for this pull request? Or v3.0.0 PRs are not ready for merge now?

@carlocaione
Copy link
Collaborator

Is there any update for this pull request? Or v3.0.0 PRs are not ready for merge now?

you need to rebase and fix the CI errors.

@firscity
Copy link
Contributor Author

@carlocaione, done, failed CI tests are licensing and format false positives (described in comments above).

@carlescufi
Copy link
Member

@firscity can you please rebase and solve the conflicts?

This commit adds few Xen public headers, which are needed for further
development of Xen features in Zephyr. Headers were taken from
include/public directory of Xen RELEASE-4.15.0 branch, filtered and
cleaned up to leave only parts, which are now required.

Directory structure were saved (public, public/io, public/hvm), so
public headers content can be supplemented if nessesary.

Signed-off-by: Dmytro Firsov <dmytro_firsov@epam.com>
This commit adds Xen hypervisor call interface for arm64 architecture.
This is needed for further development of Xen features in Zephyr.

Signed-off-by: Dmytro Firsov <dmytro_firsov@epam.com>
This commit adds minimal support of Xen hypervisor console via UART-like
driver. Implementation allows to use poll_in/poll_out char interface for
uart_console.c driver directly to HV console instead of using Xen
virtual PL011 UART. Future implementation will support interrupt driven
interface on Xen event channels, currently it is under development.

Also this commit introduces early console_io Xen interface, which allows
to receive printk/stdout messages quickly after start, but requires Xen,
built with CONFIG_DEBUG option.

Signed-off-by: Dmytro Firsov <dmytro_firsov@epam.com>
This commit removes usage of Xen emulated PL011 SBSA UART in favor of
Xen PV console minimal implementation. Now boot log and application
output can be directly taken from hypervisor domain console, instead of
virtual UART.

Also Xen VM doc was updated according to these changes.

Signed-off-by: Dmytro Firsov <dmytro_firsov@epam.com>
@firscity
Copy link
Contributor Author

@carlescufi yes, sure. Done.

@carlescufi carlescufi merged commit 5451674 into zephyrproject-rtos:main Oct 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: API Changes to public APIs area: ARM64 ARM (64-bit) Architecture area: Boards area: Devicetree area: Documentation area: UART Universal Asynchronous Receiver-Transmitter Licensing The PR has licensing issues => licensing expert to review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Initial Xen public headers adding
9 participants