Skip to content

Make aie mailbox message send, platform independent for aie2, aie4#1103

Closed
donwalkarsoham wants to merge 2 commits intoamd:mainfrom
donwalkarsoham:dev1
Closed

Make aie mailbox message send, platform independent for aie2, aie4#1103
donwalkarsoham wants to merge 2 commits intoamd:mainfrom
donwalkarsoham:dev1

Conversation

@donwalkarsoham
Copy link
Copy Markdown
Contributor

@donwalkarsoham donwalkarsoham commented Feb 21, 2026

Problem solved by the commit
Add common mailbox message send method for both aie2 and aie4

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
1> Added common logging and mail box message send API for aie2 and aie4
2> Made necessary changes in AIE2. In subsequent PRs AIE4 related changes will be added.

Risks (if any) associated the changes in the commit
N/A

What has been tested and how, request additional testing if necessary
1> Driver installation successful.
2> ./xrt_test 0 1 2 4 7 8 9 ran successfully on Medusa board for below FW version: 0.0.16.125

Documentation impact (if any)
N/A

@AMDGithubSCIMAdmin
Copy link
Copy Markdown

Can one of the admins verify this patch?

@donwalkarsoham donwalkarsoham changed the title Dev1 Make aie mailbox message send, platform independent for aie2, aie4 Feb 21, 2026
Comment thread src/driver/amdxdna/aie2_message.c Outdated
}

return ret;
drm_WARN_ON(&ndev->xdna->ddev, !mutex_is_locked(&ndev->aie2_lock));
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

adding the lock here is the right approach I think.

I'd you also add a function for aie4_message.c so people can have a whole picture what code is made common.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I was thinking of adding it in the upcoming PRs using other patches. Have mentioned the same in this PR description. But can add it here too.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@xdavidz added the changes in aie4_message.c to use common send message APIs. As discussed offline, removed the AMDXDNA_DEVEL specific timeouts used for simnow specific debugging for aie4 as we are moving towards common aie2 and aie4 code and the common timeouts are enough for silicon.

@xdavidz xdavidz requested a review from hlaccabu February 23, 2026 01:15
Comment thread src/driver/amdxdna/aie4_message.h Outdated
Comment thread src/driver/amdxdna/aie_message.c Outdated
#include "aie_message.h"

int aie_send_msg_wait(struct amdxdna_dev *xdna,
struct mailbox_channel **chann,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I got additional comments from lizhi, please wait for me update my patcheset, then you should syncup with my patcheset.

hlaccabu
hlaccabu previously approved these changes Feb 24, 2026
@hlaccabu
Copy link
Copy Markdown
Contributor

Should common files be aie_message.* or amdxdna_message.? Most common code is amdxdna_ already, no?

@xdavidz
Copy link
Copy Markdown
Contributor

xdavidz commented Feb 26, 2026

Should common files be aie_message.* or amdxdna_message._? Most common code is amdxdna__ already, no?

Should common files be aie_message.* or amdxdna_message._? Most common code is amdxdna__ already, no?

Lizhi keeps commenting on the upstream patches. Soham's work is to sync-up with the code that I provided.

The file name is pretty much decided.

Comment thread src/driver/amdxdna/aie2_message.c Outdated

return ret;
drm_WARN_ON(&ndev->xdna->ddev, !mutex_is_locked(&ndev->aie2_lock));
return aie_send_msg_wait(ndev->xdna, &ndev->mgmt_chann, msg);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@donwalkarsoham this is not in sync with latest upstream match set.

Comment thread src/driver/amdxdna/aie_message.h Outdated
#define DECLARE_AIE_MSG(name, op) DECLARE_XDNA_MSG_COMMON(name, op, -1)

int aie_send_msg_wait(struct amdxdna_dev *xdna,
struct mailbox_channel **chann,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The **chann has been changed. Please re-sync your PR.

xdavidz
xdavidz previously approved these changes Mar 3, 2026
@NishadSaraf
Copy link
Copy Markdown
Member

retest this please

Comment thread src/driver/amdxdna/amdxdna_mailbox.c Outdated
// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (C) 2022-2025, Advanced Micro Devices, Inc.
* Copyright (C) 2022-2026, Advanced Micro Devices, Inc.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

remove this change, no change in this file

Comment thread src/driver/amdxdna/aie4_message.h Outdated
@@ -1,44 +1,17 @@
/* SPDX-License-Identifier: GPL-2.0 */
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

delete this file

Comment thread src/driver/amdxdna/aie4_sriov.c Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

do not include aie4_message.h


#include <linux/pci.h>

#include "aie4_pci.h"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

#include "amdxdna_pci_drv.h"
#include "aie4_pci.h"
#include "aie4_msg_priv.h"
#include "aie_message.h"

use this include

Comment thread src/driver/amdxdna/aie4_sriov.c Outdated

return (num_vfs == 0) ? aie4_sriov_stop(ndev) : aie4_sriov_start(ndev, num_vfs);
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

remove empty line
checkpatch will not be clean

void aie4_put_cert_comp(struct cert_comp *comp);

#endif /* _AIE4_PCI_H_ */

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

remove empty line

@xdavidz
Copy link
Copy Markdown
Contributor

xdavidz commented Mar 7, 2026

this needs some additional work.

xdavidz
xdavidz previously approved these changes Mar 7, 2026
@xdavidz
Copy link
Copy Markdown
Contributor

xdavidz commented Mar 7, 2026

@donwalkarsoham can you please squash all commits to one and retest it?

@donwalkarsoham
Copy link
Copy Markdown
Contributor Author

@donwalkarsoham can you please squash all commits to one and retest it?

Hi @xdavidz, squashed the commits to a single commit.
Hi @NishadSaraf @maxzhen, can you please review and merge this change.

@maxzhen
Copy link
Copy Markdown
Collaborator

maxzhen commented Mar 8, 2026

retest this please

@donwalkarsoham donwalkarsoham changed the title Make aie mailbox message send, platform independent for aie2, aie4 Do not merge: Make aie mailbox message send, platform independent for aie2, aie4 Mar 8, 2026
@xdavidz
Copy link
Copy Markdown
Contributor

xdavidz commented Mar 8, 2026

@donwalkarsoham please fix the conflicts, we cannot merge this due to the conflicts.

@xdavidz xdavidz changed the title Do not merge: Make aie mailbox message send, platform independent for aie2, aie4 Make aie mailbox message send, platform independent for aie2, aie4 Mar 8, 2026
@donwalkarsoham
Copy link
Copy Markdown
Contributor Author

donwalkarsoham commented Mar 8, 2026

@donwalkarsoham please fix the conflicts, we cannot merge this due to the conflicts.
Waiting for #1157 to be merged. Once done, this PR will rebased and can fix any resultant conflicts.

@xdavidz
Copy link
Copy Markdown
Contributor

xdavidz commented Mar 19, 2026

we'd obsolete this because we made message.c even common further, will need to sync-up again if necessary, so close this.

@xdavidz xdavidz closed this Mar 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants