Skip to content

Conversation

@Avenger-285714
Copy link
Member

@Avenger-285714 Avenger-285714 commented Feb 17, 2025

commit 12c35c5 upstream.

Suspend will disable pcie device. Thus, resume should do full hw initialization again.
Add some APIs to ast_drm_thaw() before ast_post_gpu() to fix the issue.

v2:

  • fix function-call arguments

Fixes: 5b71707 ("drm/ast: Enable and unlock device access early during init")
Reported-by: Cary Garrett cogarre@gmail.com
Closes: https://lore.kernel.org/dri-devel/8ce1e1cc351153a890b65e62fed93b54ccd43f6a.camel@gmail.com/
Cc: Thomas Zimmermann tzimmermann@suse.de
Cc: Jocelyn Falempe jfalempe@redhat.com
Cc: Dave Airlie airlied@redhat.com
Cc: dri-devel@lists.freedesktop.org
Cc: stable@vger.kernel.org # v6.6+

Reviewed-by: Thomas Zimmermann tzimmermann@suse.de

Link: https://patchwork.freedesktop.org/patch/msgid/20240718030352.654155-1-jammy_huang@aspeedtech.com
[ wxiat: Redefine some APIs to fix compile error. ]

[ deepin: Backport - keep out-of-tree, unlikely to merge 6.6.y. ]

Summary by Sourcery

Re-initialize the AST hardware after resuming from sleep. This fix addresses an IO access error that occurs when the PCIe device is disabled during suspend and not properly re-initialized upon resume.

Bug Fixes:

  • Fix io access error when resuming from sleep by re-initializing the hardware after resuming from suspend and disabling the PCIe device.
  • Fix compile error by redefining some APIs

commit 12c35c5 upstream.

Suspend will disable pcie device. Thus, resume should do full hw
initialization again.
Add some APIs to ast_drm_thaw() before ast_post_gpu() to fix the issue.

v2:
- fix function-call arguments

Fixes: 5b71707 ("drm/ast: Enable and unlock device access early during init")
Reported-by: Cary Garrett <cogarre@gmail.com>
Closes: https://lore.kernel.org/dri-devel/8ce1e1cc351153a890b65e62fed93b54ccd43f6a.camel@gmail.com/
Cc: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Jocelyn Falempe <jfalempe@redhat.com>
Cc: Dave Airlie <airlied@redhat.com>
Cc: dri-devel@lists.freedesktop.org
Cc: <stable@vger.kernel.org> # v6.6+
Signed-off-by: Jammy Huang <jammy_huang@aspeedtech.com>
Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20240718030352.654155-1-jammy_huang@aspeedtech.com
[ wxiat: Redefine some APIs to fix compile error. ]
Signed-off-by: Zhou Xuemei <zhouxuemei@wxiat.com>
[ deepin: Backport - keep out-of-tree, unlikely to merge 6.6.y. ]
Signed-off-by: wenlunpeng <wenlunpeng@uniontech.com>
Signed-off-by: WangYuli <wangyuli@uniontech.com>
@sourcery-ai
Copy link

sourcery-ai bot commented Feb 17, 2025

Reviewer's Guide by Sourcery

This pull request addresses an issue where the Aspeed GPU fails to properly resume after a suspend operation. The fix involves re-enabling VGA and MMIO access during the resume sequence within the ast_drm_thaw function. Additionally, the ast_open_key function was moved to the header file and made inline.

Sequence diagram for ast_drm_thaw function

sequenceDiagram
    participant DRM Device
    participant ast_device

    DRM Device->>ast_device: ast_drm_thaw()
    activate ast_device
    ast_device->>DRM Device: ast_enable_vga(dev)
    DRM Device->>ast_device: ast_open_key(ast)
    DRM Device->>ast_device: ast_enable_mmio(ast)
    DRM Device->>DRM Device: ast_post_gpu(dev)
    DRM Device->>DRM Device: drm_mode_config_helper_resume(dev)
    deactivate ast_device
Loading

File-Level Changes

Change Details Files
The VGA and MMIO enabling functions, along with the key opening function, are now called during the resume process to reinitialize the hardware after a suspend.
  • Call ast_enable_vga in ast_drm_thaw.
  • Call ast_open_key in ast_drm_thaw.
  • Call ast_enable_mmio in ast_drm_thaw.
drivers/gpu/drm/ast/ast_drv.c
The ast_enable_vga and ast_enable_mmio functions are now exported.
  • Made ast_enable_vga global.
  • Made ast_enable_mmio global.
  • Added declarations for ast_enable_vga and ast_enable_mmio to ast_drv.h.
drivers/gpu/drm/ast/ast_main.c
drivers/gpu/drm/ast/ast_drv.h
The ast_open_key function is now defined as an inline function in the header file.
  • Moved the definition of ast_open_key to ast_drv.h and made it an inline function.
  • Removed the ast_open_key function from ast_main.c.
drivers/gpu/drm/ast/ast_main.c
drivers/gpu/drm/ast/ast_drv.h

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!
  • Generate a plan of action for an issue: Comment @sourcery-ai plan on
    an issue to generate a plan of action for it.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @Avenger-285714 - I've reviewed your changes - here's some feedback:

Overall Comments:

  • It looks like ast_open_key was moved to the header file, but it wasn't declared static inline there - is that intentional?
Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@deepin-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: sourcery-ai[bot]
Once this PR has been reviewed and has the lgtm label, please ask for approval from avenger-285714. For more information see the Code Review Process.

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

Details 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

@Avenger-285714 Avenger-285714 merged commit 4e2dcfe into deepin-community:linux-6.6.y Feb 17, 2025
4 of 5 checks 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.

2 participants