-
Notifications
You must be signed in to change notification settings - Fork 349
sof-ctl: Allow setting arbitrary size for controls #5487
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
Conversation
|
@lkoenig I assume no impact for userspace clients or FW ABI that may use this command ? |
|
FW ABI is unchanged. Prior this change |
tools/ctl/ctl.c
Outdated
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 thinking for the arm folk, if this is running on arm 32-bit, isn't an unsigned int 16bits? Shouldnt this be uint32_t?
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.
@dbaluta @paulstelian97 @afq984 @kuanhsuncheng any comments here for ARM32 ?
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.
if this is running on arm 32-bit, isn't an unsigned int 16bits?
I believe it depends on the toolchain (edit: or ABI?), but it's 4 on clang 11 and gcc 11: https://godbolt.org/z/bo8r5as1b
The comment use unsigned int to ensure alignment sounds a bit confusing to me. It doesn't ensure a misaligned pointer can't be stored into the buffer such as buffer = (unsigned int*)(uintptr_t)3.
Does it mean access to the buffer must be have an address of a multiple of 4?
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.
@lgirdwood I have no idea about 32-bit ARM issues since all the variants of i.MX8 are 64-bit.
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.
Using the uint32_t and friends here would guarantee compliance no matter the underlying architecture. @lkoenig is this something you can update ?
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.
Agreed, I think we should in general be defaulting to inttypes
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.
I did some update there.
sof-ctl assumed the binary control were of size of a multiple of unsigned integer. This caused the control byte array to be truncated when the size of the control was 6 bytes. This change allow setting any size of control in binary form. Using CSV will always end up with a number of unsigned integer size. I tested this change using the Google RTC Audio processing with control of size: - 6 bytes, - 2 bytes - and 4 bytes. Signed-off-by: Lionel Koenig <lionelk@google.com>
lgirdwood
left a comment
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 @lkoenig - this should be fine for 32bit users.
sof-ctl assumed the binary control were of size of a
multiple of unsigned integer.
This caused the control byte array to be truncated when the
size of the control was 6 bytes.
This change allow setting any size of control in binary form.
Using CSV will always end up with a number of unsigned integer size.
I tested this change using the Google RTC Audio processing with control size of
6 bytes, 2 bytes and 4 bytes.
Signed-off-by: Lionel Koenig lionelk@google.com