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

Build SOF with zephyr on acp_6_0 platform #9578

Merged
merged 11 commits into from
Oct 18, 2024

Conversation

DINESHKUMARK1
Copy link
Contributor

@DINESHKUMARK1 DINESHKUMARK1 commented Oct 15, 2024

Integrate Zephyr support into the SOF build for AMD platforms.

@sofci
Copy link
Collaborator

sofci commented Oct 15, 2024

Can one of the admins verify this patch?

reply test this please to run this test once

@DINESHKUMARK1 DINESHKUMARK1 changed the title Integrate Zephyr support into the SOF build for AMD platforms. Build SOF with zephyr on acp_6_0 platform Oct 15, 2024
@lgirdwood
Copy link
Member

test this please

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.

@DINESHKUMARK1 I think this is almost ready to go, it does need proper formatting and descriptions for all commit messages though. I also assume you have some Zephyr upstream dependencies and there will be a west update to include those ?

src/drivers/amd/common/acp_dma.c Show resolved Hide resolved
Copy link
Collaborator

@lyakh lyakh left a comment

Choose a reason for hiding this comment

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

empty commit "Update acp_dma.c?" Maybe file flags changed or something? As mentioned in one of the comments, please improve some of your "Update X" commit descriptions, remember that those commits will stay forever in git log

@@ -168,6 +168,12 @@ class PlatformConfig:
"imx", "imx95_evk/mimx9596/m7/ddr",
"", "", "", ""
),
"acp_6_0" : PlatformConfig(
Copy link
Collaborator

Choose a reason for hiding this comment

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

As you see above, the convention is to put a line like " platforms" for each vendor, please do the same for AMD to avoid it looking like an NXP platform

Copy link
Collaborator

Choose a reason for hiding this comment

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

Since you have no toolchain yet, move this to extra_platform_configs = for now, it's not ready for platform_configs_all = yet.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

)

# Zephyr DMA domain should only be used with zephyr_ll
if (NOT(CONFIG_DMA_DOMAIN))
Copy link
Collaborator

Choose a reason for hiding this comment

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

nitpick: maybe easier to use a positive form if (CONFIG_DMA_DOMAIN) and swap the branches below

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

static SHARED_DATA struct timer timer = {
.id = TIMER0,
.irq = IRQ_NUM_TIMER0,
};
};
Copy link
Collaborator

Choose a reason for hiding this comment

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

the brace placement was correct

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

sof->platform_timer = &timer;
sof->cpu_timers = &timer;
#endif
#ifdef __ZEPHYR__
Copy link
Collaborator

Choose a reason for hiding this comment

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

#else and maybe swap to use a positive #ifdef __ZEPHYR__

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@@ -172,6 +172,8 @@ static inline void *platform_rfree_prepare(void *ptr)

#endif /* __PLATFORM_LIB_MEMORY_H__ */

#endif /* __PLATFORM_LIB_MEMORY_H__ */
Copy link
Collaborator

Choose a reason for hiding this comment

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

bad merge?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

return 0;
tr_err(&acp_dmic_dma_rmb_tr, "timed out for dma start");
return -ETIME;
}
Copy link
Collaborator

@lyakh lyakh Oct 16, 2024

Choose a reason for hiding this comment

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

1 TAB fewer would make this hunk much smaller

Copy link
Collaborator

Choose a reason for hiding this comment

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

missed this one? In fact, can you use sof_cycle_get_64()?

defined(CONFIG_ZEPHYR_POSIX) || (defined(CONFIG_IMX) && !defined(CONFIG_IMX8M)) \
|| defined(CONFIG_AMD)
defined(CONFIG_ZEPHYR_POSIX) || \
(defined(CONFIG_IMX) && !defined(CONFIG_IMX8M)) || defined(CONFIG_AMD)
Copy link
Collaborator

Choose a reason for hiding this comment

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

please, make commit titles and preferably bodies a bit more descriptive, at least mention AMD and Zephyr

@@ -50,7 +50,7 @@ static inline int interrupt_get_irq(unsigned int irq, const char *cascade)
{
#if defined(CONFIG_LIBRARY) || defined(CONFIG_ACE) || defined(CONFIG_CAVS) || \
defined(CONFIG_ZEPHYR_POSIX) || \
(defined(CONFIG_IMX) && !defined(CONFIG_IMX8M)) || defined(CONFIG_AMD)
(defined(CONFIG_IMX) && !defined(CONFIG_IMX8M)) || defined(CONFIG_AMD)
Copy link
Collaborator

Choose a reason for hiding this comment

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

please drop this commit

@kv2019i
Copy link
Collaborator

kv2019i commented Oct 17, 2024

I guess this depends on zephyrproject-rtos/zephyr#79796 , but I'm ok to merge separately given this is initial enabling and not covered by any public CI yet (so merging SOF PR first will not break anything).

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.

Just FYI: you just sent a separate Github notification every time you replied "done". You can very easily batch these notifications with the "Start Review" green button:

https://docs.zephyrproject.org/latest/contribute/contributor_expectations.html#workflow-suggestions-that-help-reviewers

That page has other, unrelated but fantastic advice.

Copy link
Collaborator

@lyakh lyakh left a comment

Choose a reason for hiding this comment

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

Thanks for addressing the comments! Maybe timer code could still be simplified a bit more

return 0;
tr_err(&acp_dmic_dma_rmb_tr, "timed out for dma start");
return -ETIME;
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

missed this one? In fact, can you use sof_cycle_get_64()?

Add config file for acp_6_0: amd_acp_6_0_adsp.conf.

Signed-off-by: DineshKumar Kalva <[email protected]>
Add support to build sof for acp_6_0 platform.

Signed-off-by: DineshKumar Kalva <[email protected]>
…nabling irqsteer with zephyr.

For the functions platform_interrupt_clear and platform_interrupt_set,
the existing definitions based on arch_interrupt_* do not compile with
the xt-clang 2023 toolchain for acp_6_0. Use the Zephyr wrapper
implementations for those for now.

Signed-off-by: DineshKumar Kalva <[email protected]>
This commit introduces support in the CMakeLists.txt of Zephyr for
building SOF for acp_6_0 platform.

Signed-off-by: DineshKumar Kalva <[email protected]>
…tform

There are a mapping between LOCAL and HOST on platform, then add macro
local_to_host, host_to_local.

DSP memory region has mapped to host memory region on acp_6_0.
Then if we want access the address from host, need to convert the address.

Signed-off-by: DineshKumar Kalva <[email protected]>
Replaced sof timer related functions with Zephyr alternative.

Signed-off-by: DineshKumar Kalva <[email protected]>
add heap memory allocation for .heap_mem section.

Signed-off-by: DineshKumar Kalva <[email protected]>
… zephyr.

With Zephyr, SOF uses k_cycle_get_64() API in order to
count clock cycles.this API have a 64bit counter (e.g acp_6_0 dsp integration
only has xtensa timer which is limited to 32 bits).

Signed-off-by: DineshKumar Kalva <[email protected]>
…tform.

In order to avoid  first level interrupt handling from
wrapper.c second level interrupt handling go through interrupt.c
define macros to rename the duplicated functions

Signed-off-by: DineshKumar Kalva <[email protected]>
… build.

Definitions of mm_heap.h interface are not needed in Zephyr builds,
added a no-op version for Zephyr.

Signed-off-by: DineshKumar Kalva <[email protected]>
Add acp_6_0 toml file to support sof-acp_6_0.ri binary build.

Signed-off-by: DineshKumar Kalva <[email protected]>
@lgirdwood lgirdwood merged commit edd20ae into thesofproject:main Oct 18, 2024
43 of 49 checks passed
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.

7 participants