Skip to content

accel/amdxdna: Enable AIE4 runtime suspend/resume#1502

Merged
NishadSaraf merged 2 commits into
amd:mainfrom
xdavidz:upstream
Jul 20, 2026
Merged

accel/amdxdna: Enable AIE4 runtime suspend/resume#1502
NishadSaraf merged 2 commits into
amd:mainfrom
xdavidz:upstream

Conversation

@xdavidz

@xdavidz xdavidz commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Add separate runtime_suspend/runtime_resume ops to amdxdna_dev_ops, distinct from the S3/S4 suspend/resume ops, allowing device-specific runtime PM behavior independent of system sleep.

AIE4 VF runtime suspend clean up existing hwctxs and resume hwctxs.

AIE4 PF checks if there are active VF or pass-through to VM. The runtime suspend is blocked if there is active VF.

Adjust aie4_sriov_stop ordering to disable sriov first in case of unnecessary communication warnings after destroy_vfs being called.

Copilot AI left a comment

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.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Copilot AI left a comment

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.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Copilot AI left a comment

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.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Copilot AI review requested due to automatic review settings July 17, 2026 00:49

Copilot AI left a comment

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.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Comment thread drivers/accel/amdxdna/aie4_sriov.c
Comment thread drivers/accel/amdxdna/aie4_sriov.c
Copilot AI review requested due to automatic review settings July 17, 2026 16:50

Copilot AI left a comment

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.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated no new comments.

hlaccabu
hlaccabu previously approved these changes Jul 17, 2026
@xdavidz

xdavidz commented Jul 17, 2026

Copy link
Copy Markdown
Contributor Author

@maxzhen do you prefer adding this block comment into the code or leave in my document?

/*                       
   * AIE4 Suspend/Resume steps per device type.
   * -> SUSPEND                                                                                                
   * <- RESUME                                                                                                 
   *                                                                                                           
   * PF     = PF S3/S4      PF-RTM = PF Runtime PM                                                             
   * VF     = VF S3/S4      VF-RTM = VF Runtime PM                                                             
   *                                                                                                           
   *                              | PF  | PF-RTM | VF  | VF-RTM | Classic                                      
   * -----------------------------|-----|--------|-----|--------|--------                                      
   * -> vfs_alive                 |  -  |   Y    |  -  |   -    |   -                                          
   * -> hwctx_suspend_all         |  -  |   -    |  Y  |   Y    |   Y                                          
   * -> partition_fini            |  -  |   -    | (1) |   Y    |   Y                                          
   * -> suspend_fw                |  Y  |   Y    |  -  |   -    |   Y                                          
   * -> mailbox_fini              |  Y  |   Y    |  Y  |   Y    |   Y                                          
   * -> free_async_buffer         |  -  |   -    |  Y  |   Y    |   Y                                          
   * -> stop_psp/smu              |  Y  |   Y    |  -  |   -    |   Y                                          
   *    ---- power boundary ----                                                                               
   * <- pci_enable + set_master   |  Y  |   Y    |  Y  |   Y    |   Y                                          
   * <- start_smu/psp             |  Y  |   Y    | (2) |  (2)   |   Y                                          
   * <- mailbox_init              |  Y  |   Y    |  Y  |   Y    |   Y                                          
   * <- calibrate_clock           |  Y  |   Y    |  -  |   -    |   Y
   * <- attach_work_buffer        |  Y  |   Y    |  -  |   -    |   Y                                          
   * <- query_fw                  |  Y  |   Y    |  -  |   -    |   Y
   * <- query_aie                 |  -  |   -    |  Y  |   Y    |   Y                                          
   * <- partition_init            |  -  |   -    |  Y  |   Y    |   Y
   * <- alloc_async_event         |  -  |   -    |  Y  |   Y    |   Y                                          
   * <- hwctx_resume_all          |  -  |   -    |  Y  |   Y    |   Y
   * <- restore VFs               |  Y  |   Y    |  -  |   -    |   -                                          
   *              
   * (1) VF S3/S4 skips partition_fini: PF tears down stateless FW.                                            
   *     VF RTM must send partition_fini to firmware explicitly.                                               
   * (2) VF skips start_smu/psp: PF boots firmware on behalf of all VFs.
   */ 

@maxzhen

maxzhen commented Jul 17, 2026

Copy link
Copy Markdown
Collaborator

@maxzhen do you prefer adding this block comment into the code or leave in my document?

/*                       
   * AIE4 Suspend/Resume steps per device type.
   * -> SUSPEND                                                                                                
   * <- RESUME                                                                                                 
   *                                                                                                           
   * PF     = PF S3/S4      PF-RTM = PF Runtime PM                                                             
   * VF     = VF S3/S4      VF-RTM = VF Runtime PM                                                             
   *                                                                                                           
   *                              | PF  | PF-RTM | VF  | VF-RTM | Classic                                      
   * -----------------------------|-----|--------|-----|--------|--------                                      
   * -> vfs_alive                 |  -  |   Y    |  -  |   -    |   -                                          
   * -> hwctx_suspend_all         |  -  |   -    |  Y  |   Y    |   Y                                          
   * -> partition_fini            |  -  |   -    | (1) |   Y    |   Y                                          
   * -> suspend_fw                |  Y  |   Y    |  -  |   -    |   Y                                          
   * -> mailbox_fini              |  Y  |   Y    |  Y  |   Y    |   Y                                          
   * -> free_async_buffer         |  -  |   -    |  Y  |   Y    |   Y                                          
   * -> stop_psp/smu              |  Y  |   Y    |  -  |   -    |   Y                                          
   *    ---- power boundary ----                                                                               
   * <- pci_enable + set_master   |  Y  |   Y    |  Y  |   Y    |   Y                                          
   * <- start_smu/psp             |  Y  |   Y    | (2) |  (2)   |   Y                                          
   * <- mailbox_init              |  Y  |   Y    |  Y  |   Y    |   Y                                          
   * <- calibrate_clock           |  Y  |   Y    |  -  |   -    |   Y
   * <- attach_work_buffer        |  Y  |   Y    |  -  |   -    |   Y                                          
   * <- query_fw                  |  Y  |   Y    |  -  |   -    |   Y
   * <- query_aie                 |  -  |   -    |  Y  |   Y    |   Y                                          
   * <- partition_init            |  -  |   -    |  Y  |   Y    |   Y
   * <- alloc_async_event         |  -  |   -    |  Y  |   Y    |   Y                                          
   * <- hwctx_resume_all          |  -  |   -    |  Y  |   Y    |   Y
   * <- restore VFs               |  Y  |   Y    |  -  |   -    |   -                                          
   *              
   * (1) VF S3/S4 skips partition_fini: PF tears down stateless FW.                                            
   *     VF RTM must send partition_fini to firmware explicitly.                                               
   * (2) VF skips start_smu/psp: PF boots firmware on behalf of all VFs.
   */ 

In the code :-)

xdavidz added 2 commits July 17, 2026 13:23
Add separate runtime_suspend/runtime_resume ops to amdxdna_dev_ops,
distinct from the S3/S4 suspend/resume ops, allowing device-specific
runtime PM behavior independent of system sleep.

AIE4 VF runtime suspend clean up existing hwctxs and resume hwctxs.

AIE4 PF checks if there are active VF or pass-through to VM. The runtime
suspend is blocked if there is active VF.

Adjust aie4_sriov_stop ordering to disable sriov first in case of
unnecessary communication warnings after destroy_vfs being called.

Signed-off-by: David Zhang <yidong.zhang@amd.com>
Signed-off-by: David Zhang <yidong.zhang@amd.com>
Copilot AI review requested due to automatic review settings July 17, 2026 20:26

Copilot AI left a comment

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.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Comment thread drivers/accel/amdxdna/aie4_sriov.c
@NishadSaraf
NishadSaraf merged commit 8b70389 into amd:main Jul 20, 2026
1 check passed
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.

5 participants