Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

ArmPkg/ArmMmuLib AARCH64: Add missing ISB after page table update #4418

Merged
merged 1 commit into from
May 23, 2023

Conversation

ardbiesheuvel
Copy link
Member

The helper that updates live page table entries writes a zero entry, invalidates the covered address range from the TLBs, and finally writes the actual entry. This ensures that no TLB conflicts can occur.

Writing the final entry needs to complete before any translations can be performed, as otherwise, the zero entry, which describes an invalid translation, may be observed by the page table walker, resulting in a translation fault. For this reason, the final write is followed by a DSB barrier instruction.

However, this barrier will not stall the pipeline, and instruction fetches may still hit this invalid translation, as has been observed and reported by Oliver. To ensure that the new translation is fully active before returning from this helper, we have to insert an ISB barrier as well.

Reported-by: Oliver Steffen osteffen@redhat.com
Tested-by: Oliver Steffen osteffen@redhat.com
Reviewed-by: Leif Lindholm quic_llindhol@quicinc.com
Acked-by: Michael D Kinney michael.d.kinney@intel.com

The helper that updates live page table entries writes a zero entry,
invalidates the covered address range from the TLBs, and finally writes
the actual entry. This ensures that no TLB conflicts can occur.

Writing the final entry needs to complete before any translations can be
performed, as otherwise, the zero entry, which describes an invalid
translation, may be observed by the page table walker, resulting in a
translation fault. For this reason, the final write is followed by a DSB
barrier instruction.

However, this barrier will not stall the pipeline, and instruction
fetches may still hit this invalid translation, as has been observed and
reported by Oliver. To ensure that the new translation is fully active
before returning from this helper, we have to insert an ISB barrier as
well.

Reported-by: Oliver Steffen <osteffen@redhat.com>
Tested-by: Oliver Steffen <osteffen@redhat.com>
Reviewed-by: Leif Lindholm <quic_llindhol@quicinc.com>
Acked-by: Michael D Kinney <michael.d.kinney@intel.com>
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
@mdkinney mdkinney added the push Auto push patch series in PR if all checks pass label May 23, 2023
@mergify mergify bot merged commit 5ce29ae into tianocore:master May 23, 2023
@ardbiesheuvel ardbiesheuvel deleted the pull-early-idmap-isb-fix branch May 23, 2023 06:56
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
push Auto push patch series in PR if all checks pass
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants