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

nxp: imx8/imx8x: switch to Zephyr native drivers #8863

Merged
merged 6 commits into from
Apr 23, 2024

Conversation

LaurentiuM1234
Copy link
Contributor

@LaurentiuM1234 LaurentiuM1234 commented Feb 14, 2024

Note: cleanup will be done in separate PRs after this is merged

@paulstelian97
Copy link
Collaborator

paulstelian97 commented Feb 29, 2024

Hi there, I thought of checking what's happening around here. I noticed that there may be an opportunity to break bisection (though I may misunderstand something) between the last two commits (a place where you no longer initialise a DMA domain, yet the topology still specifies one). Did you consider swapping the last two commits to avoid this?

Other than that I like how this looks! (well except the build errors from the DT, but I guess you're already working on those)

@LaurentiuM1234
Copy link
Contributor Author

I noticed that there may be an opportunity to break bisection (though I may misunderstand something) between the last two commits (a place where you no longer initialise a DMA domain, yet the topology still specifies one)

yep, you're right

Did you consider swapping the last two commits to avoid this?

that will also break git bisect since the timer domain doesn't work right without the native switch. I think the solution would be to just squash the last 2 commits.

@iuliana-prodan
Copy link
Contributor

I noticed that there may be an opportunity to break bisection (though I may misunderstand something) between the last two commits (a place where you no longer initialise a DMA domain, yet the topology still specifies one)

yep, you're right

Did you consider swapping the last two commits to avoid this?

that will also break git bisect since the timer domain doesn't work right without the native switch. I think the solution would be to just squash the last 2 commits.

And use in commit message "switch to native drivers and timer domain", since a lot of changes are also related to timer domain.
IMO you should do the same in PR #8859

Copy link
Member

@lgirdwood lgirdwood left a comment

Choose a reason for hiding this comment

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

LGTM, giving my +1 so NXP can schedule the merging after validation is complete.

@LaurentiuM1234
Copy link
Contributor Author

V2 changes

  1. Commit that changes the topologies to timer domain and commit that does transition to native drivers have been squashed into a single one.
  2. Adapted to HWMv2.

@LaurentiuM1234
Copy link
Contributor Author

V3 changes

  1. Rebased
  2. All Zephyr dependencies merged. Added zephyr hash bump.

Opening this up for reviews. Will remove the [DNM] tag when testing is done.

@marc-hb
Copy link
Collaborator

marc-hb commented Apr 5, 2024

This PR introduces a small and surprising, imx8/zephyr.lst disassembly difference between the Linux and Windows build:

https://github.com/thesofproject/sof/actions/runs/8552063499?pr=8863

--- win/build-sof-staging/sof-info/imx8x/zephyr.lst	2024-04-04 09:13:44
+++ lin/build-sof-staging/sof-info/imx8x/zephyr.lst	2024-04-04 09:12:34
@@ -81127,20 +81127,26 @@
 92433b0e:	430c                          	movi.n	a3, 4
 #if !(defined(FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL) && FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL)
 
         uint32_t instance = LPUART_GetInstance(base);
 
         /* Enable lpuart clock */
         (void)CLOCK_EnableClock(s_lpuartClock[instance]);
 92433b10:	833441                      	l32r	a4, 924147e0 <_stext+0x1598> (92413034 <s_lpuartClock>)
 92433b13:	a03340                      	addx4	a3, a3, a4
 92433b16:	03a8                          	l32i.n	a10, a3, 0
+ * @param name  Which clock to enable, see \ref clock_ip_name_t.
+ * @return true for success, false for failure.
+ */
+static inline bool CLOCK_EnableClock(clock_ip_name_t name)
+{
+    return CLOCK_EnableClockExt(name, 0);
 92433b18:	31e9                          	s32i.n	a14, a1, 12
 92433b1a:	00a0b2                      	movi	a11, 0
 92433b1d:	ffcfa5                      	call8	92433818 <CLOCK_EnableClockExt>
     base->GLOBAL |= LPUART_GLOBAL_RST_MASK;
 92433b20:	0020c0                      	memw
 92433b23:	2238                          	l32i.n	a3, a2, 8
 92433b25:	240c                          	movi.n	a4, 2
 92433b27:	203340                      	or	a3, a3, a4
 92433b2a:	0020c0                      	memw
 92433b2d:	2239                          	s32i.n	a3, a2, 8

It is triggered by this PR because daily builds are ok:
https://github.com/thesofproject/sof/actions/runs/8563182403

In light of recent events I hope everything understands the importance of reproducible builds.

The first thing is to submit the west.yml separately:
https://docs.zephyrproject.org/latest/contribute/contributor_expectations.html#defining-smaller-prs
Not just for reviewers but also for Continous integration.

Then, if you don't have BOTH one Linux and one Windows build system, could you please submit draft/throw-away PRs with subsets of this (pretty big) PR to isolate the trigger?

@marc-hb
Copy link
Collaborator

marc-hb commented Apr 5, 2024

The first thing is to submit the west.yml separately:

... unless there is a two-way dependency between this west.yml bump and some of the code changes in this PR. In that case they must be part of the same commit so every commit works.

Copy link
Collaborator

@marc-hb marc-hb left a comment

Choose a reason for hiding this comment

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

Need to root-cause the reproducible builds issue

@LaurentiuM1234
Copy link
Contributor Author

This PR introduces a small and surprising, imx8/zephyr.lst disassembly difference between the Linux and Windows build:

https://github.com/thesofproject/sof/actions/runs/8552063499?pr=8863

--- win/build-sof-staging/sof-info/imx8x/zephyr.lst	2024-04-04 09:13:44
+++ lin/build-sof-staging/sof-info/imx8x/zephyr.lst	2024-04-04 09:12:34
@@ -81127,20 +81127,26 @@
 92433b0e:	430c                          	movi.n	a3, 4
 #if !(defined(FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL) && FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL)
 
         uint32_t instance = LPUART_GetInstance(base);
 
         /* Enable lpuart clock */
         (void)CLOCK_EnableClock(s_lpuartClock[instance]);
 92433b10:	833441                      	l32r	a4, 924147e0 <_stext+0x1598> (92413034 <s_lpuartClock>)
 92433b13:	a03340                      	addx4	a3, a3, a4
 92433b16:	03a8                          	l32i.n	a10, a3, 0
+ * @param name  Which clock to enable, see \ref clock_ip_name_t.
+ * @return true for success, false for failure.
+ */
+static inline bool CLOCK_EnableClock(clock_ip_name_t name)
+{
+    return CLOCK_EnableClockExt(name, 0);
 92433b18:	31e9                          	s32i.n	a14, a1, 12
 92433b1a:	00a0b2                      	movi	a11, 0
 92433b1d:	ffcfa5                      	call8	92433818 <CLOCK_EnableClockExt>
     base->GLOBAL |= LPUART_GLOBAL_RST_MASK;
 92433b20:	0020c0                      	memw
 92433b23:	2238                          	l32i.n	a3, a2, 8
 92433b25:	240c                          	movi.n	a4, 2
 92433b27:	203340                      	or	a3, a3, a4
 92433b2a:	0020c0                      	memw
 92433b2d:	2239                          	s32i.n	a3, a2, 8

It is triggered by this PR because daily builds are ok: https://github.com/thesofproject/sof/actions/runs/8563182403

In light of recent events I hope everything understands the importance of reproducible builds.

The first thing is to submit the west.yml separately: https://docs.zephyrproject.org/latest/contribute/contributor_expectations.html#defining-smaller-prs Not just for reviewers but also for Continous integration.

Then, if you don't have BOTH one Linux and one Windows build system, could you please submit draft/throw-away PRs with subsets of this (pretty big) PR to isolate the trigger?

ACK, started with the west.yml change: #9010, which seems to be ok w.r.t the reproducible builds. Anyways, if I were to guess based on the log you've provided, I'd say the change that enables the serial interface causes this issue.

@LaurentiuM1234
Copy link
Contributor Author

Rebased

@lgirdwood
Copy link
Member

@LaurentiuM1234 is building on Windows priority for you, it seems the compiler has different behavior here for this platform only. I would say here that this is a second order test vs the 1st order runtime functional test for this platform.

I would suggest we comment this platform out from the OS reproducability test and comment in the test that the compiler is generating different code here on Windows vs Linux. You can reference the GH PR and BUG in the comment. We can then move on. @dbaluta this also good with you ?

@marc-hb
Copy link
Collaborator

marc-hb commented Apr 18, 2024

Comparing Windows and Linux is the only way the reproducibility test work.

@lgirdwood
Copy link
Member

Comparing Windows and Linux is the only way the reproducibility test work.

That fine when the tools are deterministsic and align when used on different OSes, in this case effort is being spent to workaround a compiler bug for a second order test. Today we need to comment out this platform in the test (or report and ignore result for this platform). The compiler will update over time and may align in a future version (when we can re-enable).

@marc-hb
Copy link
Collaborator

marc-hb commented Apr 18, 2024

Switch to using Zephyr logging on imx8 and imx8x to
prepare for using native Zephyr drivers.

Signed-off-by: Laurentiu Mihalcea <[email protected]>
Add nodes for the following IPs: SAI, EDMA and ESAI. Also,
add node for HOST_DMA. These are all required for switching
to Zephyr native drivers.

Signed-off-by: Laurentiu Mihalcea <[email protected]>
Add entry for NXP's ESAI IP in dai_set_config().

Signed-off-by: Laurentiu Mihalcea <[email protected]>
Add entry for NXP's ESAI IP inside the "zephyr_dev" array.
What the entry does is it fetches all "struct device"s for
ESAI nodes marked as "okay".

Signed-off-by: Laurentiu Mihalcea <[email protected]>
Add entries for EDMA0 and HOST_DMA nodes.

Signed-off-by: Laurentiu Mihalcea <[email protected]>
This commit includes all necessary changes for switching
to timer domain and Zephyr native drivers on imx8 and imx8x.
This consists of:
	1) Switching all imx8 topologies to timer domain.
	2) Disabling Zephyr DMA domain
	3) Various interrupt-related fixes via Kconfig-related
	ifdef logic.

This commit includes all necessary changes for switching
to native Zephyr drivers on imx8/imx8x.

Signed-off-by: Laurentiu Mihalcea <[email protected]>
@LaurentiuM1234
Copy link
Contributor Author

Rebased. Let's see the repro builds results after #9071.

@LaurentiuM1234
Copy link
Contributor Author

Repro builds are green. Dropping the DNM tag.

@LaurentiuM1234 LaurentiuM1234 changed the title [DNM] nxp: imx8/imx8x: switch to Zephyr native drivers nxp: imx8/imx8x: switch to Zephyr native drivers Apr 23, 2024
@lgirdwood lgirdwood merged commit 9737e12 into thesofproject:main Apr 23, 2024
43 of 45 checks passed
LaurentiuM1234 added a commit to LaurentiuM1234/sof that referenced this pull request Apr 23, 2024
XTOS is no longer supported on imx8. As a consequence,
some calls from imx8's platform_init() have become
redundant. Remove these calls/initializations as well
as those who are redundant because of some configurations
that are not enabled (e.g: `CONFIG_TRACE`, or `CONFIG_HAVE_AGENT`).

This is a followup for thesofproject#8863.

Signed-off-by: Laurentiu Mihalcea <[email protected]>
kv2019i pushed a commit that referenced this pull request Apr 29, 2024
XTOS is no longer supported on imx8. As a consequence,
some calls from imx8's platform_init() have become
redundant. Remove these calls/initializations as well
as those who are redundant because of some configurations
that are not enabled (e.g: `CONFIG_TRACE`, or `CONFIG_HAVE_AGENT`).

This is a followup for #8863.

Signed-off-by: Laurentiu Mihalcea <[email protected]>
eddy1021 pushed a commit to eddy1021/sof that referenced this pull request Jul 15, 2024
XTOS is no longer supported on imx8. As a consequence,
some calls from imx8's platform_init() have become
redundant. Remove these calls/initializations as well
as those who are redundant because of some configurations
that are not enabled (e.g: `CONFIG_TRACE`, or `CONFIG_HAVE_AGENT`).

This is a followup for thesofproject#8863.

Signed-off-by: Laurentiu Mihalcea <[email protected]>
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.

5 participants