-
Notifications
You must be signed in to change notification settings - Fork 318
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
base_fw: update mem_state_info TLV #8871
base_fw: update mem_state_info TLV #8871
Conversation
@@ -47,7 +47,8 @@ | |||
#define L2HSBPM(x) (0x17A800 + 0x0008 * (x)) | |||
#define SHIM_HSPGCTL(x) (L2HSBPM(x) + 0x0000) | |||
|
|||
#define LSPGCTL 0x71D80 | |||
#define LSPGCTL0 0x71D80 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dnikodem can we read this from Zephyr headers today ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dnikodem sorry I mean we should use the Zephyr header for these HW specific macros (and not use any duplicated values from the SOF directory which is deprecated).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, I will update this PR, thanks.
Added zephyrproject-rtos/zephyr#70221 - this is the first step to clean up SOF headers. |
src/audio/base_fw.c
Outdated
#endif | ||
} | ||
tuple_data[index++] = info.page_alloc_struct.page_alloc_count; | ||
ptr = (uint16_t *)(tuple_data + index); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this of course changes the behaviour significantly. Before this commit index
was incremented twice in lines 226 and 228, now it isn't any more. Is this intended? Was that a bug?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The tuple_data should contain the correct number of LPSRAM PGCTL register values (in the same way as it is done for HPSRAM). In the previous solution, if the number of ebb_state_dword_count equaled 0, a dword was added in tuple_data with the PGCTL status value for a non-existing/not used LPSRAM bank.
Therefore, the parser that is using data from tuple_data should not expect an "extra" LSPGCTL status value in the tuple_data, and then it could misinterpret it as some other type of data or status.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dnikodem right, but if ebb_state_dword_count != 0
? Then you'd add several register values into tuple_data
without incrementing index
, so after the loop you'd overwrite the first of those values... I think you actually wanted to do
for (i = 0; i < info.ebb_state_dword_count; i++) {
#ifdef INTEL_ADSP
tuple_data[index++] = LPSRAM_REGS(i)->USxPGCTL;
#else
tuple_data[index++] = 0;
#endif
}
if (info.ebb_state_dword_count)
tuple_data[index++] = info.page_alloc_struct.page_alloc_count;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lyakh Fixed, thanks
a2f6588
to
749e8a4
Compare
src/audio/base_fw.c
Outdated
#endif | ||
} | ||
tuple_data[index++] = info.page_alloc_struct.page_alloc_count; | ||
ptr = (uint16_t *)(tuple_data + index); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dnikodem right, but if ebb_state_dword_count != 0
? Then you'd add several register values into tuple_data
without incrementing index
, so after the loop you'd overwrite the first of those values... I think you actually wanted to do
for (i = 0; i < info.ebb_state_dword_count; i++) {
#ifdef INTEL_ADSP
tuple_data[index++] = LPSRAM_REGS(i)->USxPGCTL;
#else
tuple_data[index++] = 0;
#endif
}
if (info.ebb_state_dword_count)
tuple_data[index++] = info.page_alloc_struct.page_alloc_count;
749e8a4
to
72de4c0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dnikodem I assume you will make non draft after the Zephyr part is merged and we can rebase/merge.
correct, we need firstly zephyr part merged. |
72de4c0
to
2a9a70c
Compare
oh, yeah - this one was blocked on Zephyr PR merging (now merged). @dnikodem do we need a west update ? I think @kv2019i did a west update a few days ago so we may be good just to rebase this ? |
Yes, the west was updated by Kai and points on correct commit. Here is needed to rebase / resolve conflict with base_fw_platform.c file. I will do this today. |
2a9a70c
to
e1c8e7d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just one question on ifdefs, but otherwise LGTM.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @dnikodem , this is a welcome update. Code looks good, but I think you can go a bit further and drop the ifdefs as this code is now only compiled for Intel targets that have enabled the IPC4 basefw Intel extensions (so should cover all platforms now covered by INTEL_ADSP ifdef guard).
src/audio/base_fw_intel.c
Outdated
@@ -154,7 +156,13 @@ static int basefw_mem_state_info(uint32_t *data_offset, char *data) | |||
index = 0; | |||
tuple_data[index++] = info.free_phys_mem_pages; | |||
tuple_data[index++] = info.ebb_state_dword_count; | |||
tuple_data[index++] = io_reg_read(LSPGCTL); | |||
for (i = 0; i < info.ebb_state_dword_count; i++) { | |||
#ifdef INTEL_ADSP |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Likewise here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed, thanks :)
This commit refactors the memory power management register access to use the HPSRAM_REGS and LPSRAM_REGS macros instead of direct io_reg_read calls. Signed-off-by: Damian Nikodem <damian.nikodem@intel.com>
e1c8e7d
to
7d2af0d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, looks good now!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice to remove all the old macros :)
This change improves the TLV assembly algorithm in accordance with how the part for hpsram is assembled. In the case when ebb_state_dword_count is equal to 0, we skip adding the LSPGCTL register value for lpsram.
The following PR must be merged into the Zephyr repository before we can merge this PR: