Page MenuHomeFreeBSD

gdb: Fix the cache sync in write_instr()
Needs ReviewPublic

Authored by markj on Wed, Nov 12, 9:32 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Nov 13, 11:11 AM
Unknown Object (File)
Thu, Nov 13, 10:31 AM
Unknown Object (File)
Thu, Nov 13, 5:18 AM
Unknown Object (File)
Thu, Nov 13, 2:55 AM
Unknown Object (File)
Thu, Nov 13, 2:13 AM
Unknown Object (File)
Thu, Nov 13, 1:22 AM

Details

Reviewers
andrew
Group Reviewers
bhyve
Summary

Previously this code simply wasn't compiled since it tests arm64
instead of aarch64. It was also wrong since it tried to use the
broadcast variant of "ic", which can't be executed in EL0.

Use builtin_clear_cache() instead. It clears the virtual address
range to point of unification and invalidates the corresponding range in
the icache.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 68583
Build 65466: arc lint + arc unit

Event Timeline

markj requested review of this revision.Wed, Nov 12, 9:32 PM

__clear_cache may not work for this use on CPUs with a VIPT i-cache. It will only invalidate the i-cache by virtual address, if the instruction is in the guests i-cache it will not be handled correctly.

Having talked to a Linux dev who is familiar with the kvm code I think we need to:

  1. ensure all VCPUs are stopped
  2. write the instruction
  3. clean the d-cache to the point of unification
  4. if we have a VIPT icache and CTR_EL0.DIC == 0 then perform the i-cache maintenance in the kernel