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

Get Memory info from ZOCL using xgq for Built in ps kernel #7564

Merged

Conversation

saifuddin-xilinx
Copy link
Collaborator

Problem solved by the commit

-- Updated the memory manager logic. Now DRM memory manager is initialized with 0 to MAX(uint64).
-- Memory manager will be initialized once with drm init and live till the driver active.
-- Memory allocation will be done based on the BANK information

-- Added a support to communicate the ZOCL memory range using XGQ configuration
-- Added a new query_mem command to exchange the memory info between ZOCL and XOCL
-- For PS kernel memory will be allocated with the configured range

Bug / issue (if any) fixed, which PR introduced the bug, how it was discovered

-- N/A

How problem was solved, alternative solutions (if any) and why they were rejected

N/A

Risks (if any) associated the changes in the commit

N/A

What has been tested and how, request additional testing if necessary

Documentation impact (if any)

Saif and others added 5 commits May 18, 2023 12:10
Signed-off-by: Saif <saifuddi@amd.com>
Signed-off-by: Saifuddin <saifuddi@xilinx.com>
Signed-off-by: Saifuddin <saifuddi@xilinx.com>
Signed-off-by: Saifuddin <saifuddi@xilinx.com>
@gbuildx
Copy link
Collaborator

gbuildx commented May 20, 2023

Build failed :(

@dayeh-xilinx
Copy link

retest this please.

@gbuildx
Copy link
Collaborator

gbuildx commented May 21, 2023

Build failed :(

@saifuddin-xilinx
Copy link
Collaborator Author

retest this please

@gbuildx
Copy link
Collaborator

gbuildx commented May 21, 2023

Build failed :(

@dayeh-xilinx
Copy link

retest this please.

@gbuildx
Copy link
Collaborator

gbuildx commented May 21, 2023

Build failed :(

@dayeh-xilinx
Copy link

retest this please.

@gbuildx
Copy link
Collaborator

gbuildx commented May 22, 2023

Build failed :(

@gbuildx
Copy link
Collaborator

gbuildx commented May 22, 2023

Build Passed!

Copy link
Collaborator

@mamin506 mamin506 left a comment

Choose a reason for hiding this comment

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

Some question and minor changes.

Comment on lines 971 to 976
r->h_mem_info = (u32)((zdev->host_mem & 0xFFFFFFFF00000000LL) >> 32);
break;

case XGQ_CMD_QUERY_MEM_SIZE:
r->l_mem_info = (u32)zdev->host_mem_len;
r->h_mem_info = (u32)((zdev->host_mem_len & 0xFFFFFFFF00000000LL) >> 32);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Value "0xFFFFFFFF00000000LL" shows up twice, right? Can we define it as a macro?

Comment on lines -632 to -638
drm_p->cma_bank_idx = -1;
/* Memory manager initialization is done in two phase.
* Phase 1 is done based on platform and Phase 2 is done
* based on XCLBIN. We have done phase 1 here.
*/
drm_p->xocl_drm_mm_done = true;

Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you explain why this code can be removed?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I have sent a mail with the details.

Copy link
Collaborator

Choose a reason for hiding this comment

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

okay, looks like drm_p->xocl_drm_mm_done is not used anymore. Can we delete it in xocl_drm.h?

{
int err = 0;
int i = 0;
uint64_t mm_end_addr = 0xffffFFFFffffFFFF;
Copy link
Collaborator

Choose a reason for hiding this comment

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

In Linux, you can use macro "U64_MAX"


xocl_info(drm_p->ddev->dev, "drm_mm_init called for the available memory range"
" <%llx - %llx>", mm_start_addr, mm_end_addr);
xocl_info(drm_p->ddev->dev, "drm_mm_init called for the maximum memory range possible");
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why deleted <%llx - %llx>?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We are initializing the max range of memory. Hence, not specifically define any range

@@ -1107,6 +1070,7 @@ static int xocl_cleanup_memory_manager(struct xocl_drm *drm_p)
return 0;
}

#if 0
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this code dead? Why comment it out but not delete it?


ret = xocl_kds_xgq_query_mem(xdev, &XOCL_DRM(xdev)->ps_mem_data);
if (ret)
userpf_info(xdev, "WARN ! Device doesn't configure for PS Kernel memory\n");
Copy link
Collaborator

Choose a reason for hiding this comment

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

Indentation?

@mamin506
Copy link
Collaborator

Hi @saifuddin-xilinx , is there any change in the mem topology section of xclbin?

Signed-off-by: Saifuddin <saifuddi@xilinx.com>
@gbuildx
Copy link
Collaborator

gbuildx commented May 24, 2023

Build failed :(

@saifuddin-xilinx
Copy link
Collaborator Author

retest this please

@gbuildx
Copy link
Collaborator

gbuildx commented May 24, 2023

Build failed :(

@dayeh-xilinx
Copy link

retest this please.

@@ -112,6 +112,7 @@ enum xgq_cmd_opcode {
XGQ_CMD_OP_DATA_INTEGRITY = 0x10e,
XGQ_CMD_OP_EXIT = 0x10f,
XGQ_CMD_OP_UNCFG_CU = 0x110,
XGQ_CMD_OP_QUERY_MEM = 0x111,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please remember to update XGQ command spec page with this new command.
https://confluence.xilinx.com/pages/viewpage.action?pageId=302345261

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sure
Thanks

@gbuildx
Copy link
Collaborator

gbuildx commented May 24, 2023

Build failed :(

@dayeh-xilinx
Copy link

retest this please.

Signed-off-by: Saifuddin <saifuddi@xilinx.com>
@gbuildx
Copy link
Collaborator

gbuildx commented May 25, 2023

Build failed :(

Signed-off-by: Saifuddin <saifuddi@xilinx.com>
@gbuildx
Copy link
Collaborator

gbuildx commented May 25, 2023

Build failed :(

@saifuddin-xilinx
Copy link
Collaborator Author

retest this please

@gbuildx
Copy link
Collaborator

gbuildx commented May 26, 2023

Build failed :(

@saifuddin-xilinx
Copy link
Collaborator Author

retest this please

@gbuildx
Copy link
Collaborator

gbuildx commented May 29, 2023

Build failed :(

@gbuildx
Copy link
Collaborator

gbuildx commented May 30, 2023

Build Passed!

@chvamshi-xilinx chvamshi-xilinx merged commit 47b38ea into Xilinx:master May 30, 2023
ManojTakasi pushed a commit to ManojTakasi/XRT that referenced this pull request Jun 18, 2023
* Fixed xgq assignment issue for multislot

Signed-off-by: Saif <saifuddi@amd.com>

* Fixed allignment issues

Signed-off-by: Saifuddin <saifuddi@xilinx.com>

* Cleanup memory manager for built in ps kernel support

Signed-off-by: Saifuddin <saifuddi@xilinx.com>

* Get the ps kernel mem info from zocl through xgq

* Fix issue to Get the ps kernel mem info from zocl through xgq

Signed-off-by: Saifuddin <saifuddi@xilinx.com>

* Not to fail the driver is PS kernel memory is not configured

* Fixed review comments

Signed-off-by: Saifuddin <saifuddi@xilinx.com>

* Added memory management changes to this branch

Signed-off-by: Saifuddin <saifuddi@xilinx.com>

* Delete unused variable

Signed-off-by: Saifuddin <saifuddi@xilinx.com>

* Fixed one issue

Signed-off-by: Saifuddin <saifuddi@xilinx.com>

* Remove the multislot fix from PS memory fix branch

Signed-off-by: Saifuddin <saifuddi@xilinx.com>

---------

Signed-off-by: Saif <saifuddi@amd.com>
Signed-off-by: Saifuddin <saifuddi@xilinx.com>
Co-authored-by: Saif <saifuddi@amd.com>
(cherry picked from commit 47b38ea)
chvamshi-xilinx pushed a commit that referenced this pull request Jun 19, 2023
…7596)

* Fixed xgq assignment issue for multislot

Signed-off-by: Saif <saifuddi@amd.com>

* Fixed allignment issues

Signed-off-by: Saifuddin <saifuddi@xilinx.com>

* Cleanup memory manager for built in ps kernel support

Signed-off-by: Saifuddin <saifuddi@xilinx.com>

* Get the ps kernel mem info from zocl through xgq

* Fix issue to Get the ps kernel mem info from zocl through xgq

Signed-off-by: Saifuddin <saifuddi@xilinx.com>

* Not to fail the driver is PS kernel memory is not configured

* Fixed review comments

Signed-off-by: Saifuddin <saifuddi@xilinx.com>

* Added memory management changes to this branch

Signed-off-by: Saifuddin <saifuddi@xilinx.com>

* Delete unused variable

Signed-off-by: Saifuddin <saifuddi@xilinx.com>

* Fixed one issue

Signed-off-by: Saifuddin <saifuddi@xilinx.com>

* Remove the multislot fix from PS memory fix branch

Signed-off-by: Saifuddin <saifuddi@xilinx.com>

---------

Signed-off-by: Saif <saifuddi@amd.com>
Signed-off-by: Saifuddin <saifuddi@xilinx.com>
Co-authored-by: Saif <saifuddi@amd.com>
(cherry picked from commit 47b38ea)

Co-authored-by: Saifuddin Kaijar <54270703+saifuddin-xilinx@users.noreply.github.com>
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