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

iommu/arm-smmu-v3: Add suspend and resume support #236

Merged

Conversation

wangzhimin1179
Copy link
Contributor

Add suspend and resume support for smmuv3. The smmu is stopped when suspending and started when resuming.

When the smmu is suspended, it is powered off and the registers are cleared. So saves the msi_msg context during msi interrupt initialization of smmu. When resume happens it calls arm_smmu_device_reset() to restore the registers.

Closes: https://gitee.com/openeuler/kernel/issues/I4DZ7Q

@deepin-ci-robot
Copy link

Hi @wangzhimin1179. Thanks for your PR.

I'm waiting for a deepin-community member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

/* Saves the msg (base addr of msi irq) and restores it during resume */
desc->msg.address_lo = msg->address_lo;
desc->msg.address_hi = msg->address_hi;
desc->msg.data = msg->data;
Copy link
Member

Choose a reason for hiding this comment

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

下面3222行只用到了address_hi和address_lo,这个data没用到? 是不是不用赋值?

@wangzhimin1179 wangzhimin1179 force-pushed the linux-6.6.y-arm-smmu-v3 branch from 2215d1c to 4043b2e Compare June 26, 2024 02:52
@wangzhimin1179
Copy link
Contributor Author

已更新

@deepin-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign zccrs for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@opsiff
Copy link
Member

opsiff commented Jun 26, 2024

已更新

已更新

https://github.com/deepin-community/kernel/pull/236/files#diff-f2b3410b995706f9fbf007319c770309cb3072969636ce95bb0303bb6fb56870R3225

这里有用到desc->msg->data 第一版本的是对的

Add suspend and resume support for smmuv3. The smmu is stopped when
suspending and started when resuming.

When the smmu is suspended, it is powered off and the registers are
cleared. So saves the msi_msg context during msi interrupt initialization
of smmu. When resume happens it calls arm_smmu_device_reset() to restore
the registers.

Closes: https://gitee.com/openeuler/kernel/issues/I4DZ7Q

Signed-off-by: Bixuan Cui <cuibixuan@huawei.com>
Signed-off-by: Zhou Guanghui <zhouguanghui1@huawei.com>
Reviewed-by: Hanjun Guo <guohanjun@huawei.com>
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Signed-off-by: Wang Xu <wangxu@phytium.com.cn>
Signed-off-by: Li Mingzhe <limingzhe1839@phytium.com.cn>
Signed-off-by: Wang Zhimin <wangzhimin1179@phytium.com.cn>
@wangzhimin1179 wangzhimin1179 force-pushed the linux-6.6.y-arm-smmu-v3 branch from 4043b2e to 9ce9ded Compare June 26, 2024 03:07
@opsiff
Copy link
Member

opsiff commented Jun 26, 2024

/ok-to-test

@opsiff opsiff merged commit 14b1159 into deepin-community:linux-6.6.y Jun 26, 2024
3 of 4 checks passed
@deepin-ci-robot
Copy link

deepin pr auto review

关键摘要:

  • arm_smmu_write_msi_msg函数中,desc->msg.address_lodesc->msg.address_hi的赋值应该在doorbell的计算之后,以确保正确的地址。
  • arm_smmu_resume_msis函数中,desc->msg.address_lodesc->msg.address_hi的恢复操作应该在smmu->dev->msi.domain不为0时执行,以确保不会恢复无效的MSI消息。
  • arm_smmu_setup_unique_irqs函数中,arm_smmu_resume_msis的调用应该在!resume为真时跳过,以避免在恢复模式下执行恢复操作。
  • arm_smmu_setup_irqs函数中,arm_smmu_resume_msis的调用应该在!resume为真时跳过,以避免在恢复模式下执行恢复操作。
  • arm_smmu_device_reset函数中,arm_smmu_setup_irqs的调用应该在!smmu->bypass为真时跳过,以避免在 bypass 模式下执行设置操作。
  • arm_smmu_pm_ops结构体中,arm_smmu_suspendarm_smmu_resume函数的调用应该在CONFIG_PM_SLEEP为真时执行,以确保在休眠状态下正确地管理设备。

是否建议立即修改:

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.

3 participants