-
Notifications
You must be signed in to change notification settings - Fork 472
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
CR-1156386 Default and Backup FPT sysfs nodes impl #7715
CR-1156386 Default and Backup FPT sysfs nodes impl #7715
Conversation
Can one of the admins verify this patch? |
XGQ_CMD_LOG_PLM_LOG = 0x8, | ||
XGQ_CMD_LOG_APU_LOG = 0x9, | ||
XGQ_CMD_LOG_SHELL_INTERFACE_UUID = 0xa, | ||
XGQ_CMD_LOG_DEFAULT_FPT = 0xb, |
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.
alignment changes made to keep consistency with vmr common header file
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.
look ok as long as the vmr changes made in vmr.
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 looks ok, but I realized that there is a potential bug in our driver, that every log_page request might return a big size back. We need to valid the size before call vmalloc.
I think just add a code to make sure the returned size should be within request size. Does this make sense?
Adjust my request a little bit. Actually, we did have checking code in the log_page request for each set of data. Can you please take a look at the vmr_apu_log_read as an example? Including fpt, system dtb, fw_log, plm_log, apu_log. The shell interface uuid is special, this one can be cached. |
ok to test |
|
||
mutex_lock(&xgq->xgq_lock); | ||
|
||
blob = xgq->xgq_vmr_backup_fpt; | ||
size = xgq->xgq_vmr_backup_fpt_size; | ||
|
||
if (off >= size) | ||
goto out; | ||
|
||
if (off + count > size) | ||
count = size - off; | ||
memcpy(buf, blob + off, count); | ||
|
||
ret = count; | ||
out: | ||
mutex_unlock(&xgq->xgq_lock); | ||
return ret; |
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.
worth creating a function for here and L3062-3078?
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.
there are indeed 3+ places dup code. could prapul fix this?
reset this please |
7b71112
to
87af11f
Compare
*/ | ||
if (off == 0) | ||
ret = xgq_refresh_system_dtb(xgq); | ||
if (off > 0) |
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 looks incorrect. why off cannot be bigger than 0? It might be more than 4096 per linux sysfs request for the blob data. we are also able to return data with any offset.
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.
Non-zero offset means there is some data returned per read request. This is more like a boundary check to avoid infinite looping of this API call because, after read and return, the offset seeks back to zero and automatically keeps calling this API by the behavior of sysfs.
87af11f
to
82814d3
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.
overall look ok to me, those nits are optional.
But the memory leak has to be fixed in all 4 places.
82814d3
to
8b9ef21
Compare
ret = count; | ||
done: | ||
vfree(log_buf); | ||
XGQ_INFO(xgq,"Offset = %d, count = %d, ret = %d\n",(int)off,(int)count,(int)ret); |
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.
nits: to avoid compiling warning, the more cleaner way: offset and count is %ld, ret is %d
Signed-off-by: Prapul Krishnamurthy <[email protected]>
8b9ef21
to
c19308c
Compare
retest this please. |
Build Passed! |
Problem solved by the commit
Bug / issue (if any) fixed, which PR introduced the bug, how it was discovered
This is an implementation of sysfs nodes for debug purposes. Sysfs nodes for reading raw meta data from Default FPT and Backup FPT through VMR.
How problem was solved, alternative solutions (if any) and why they were rejected
Added changes in both XRT and corresponding VMR compatible changes.
Risks (if any) associated the changes in the commit
What has been tested and how, request additional testing if necessary
Tested on V70 base 3 2023.2 and found the hexdump to be matching between default and backup dumps
Test results are attached in the VMR PR here:- https://github.com/Xilinx/VMR/pull/335
Documentation impact (if any)