diff mbox series

[2/2] x86/shadow: further correct MMIO handling in _sh_propagate()

Message ID b05d3911-a6c7-68f1-0e48-255630ab6516@suse.com (mailing list archive)
State New, archived
Headers show
Series x86/shadow: MMIO treatment | expand

Commit Message

Jan Beulich Jan. 13, 2023, 8:48 a.m. UTC
While c61a6f74f80e ("x86: enforce consistent cachability of MMIO
mappings") correctly converted one !mfn_valid() check there, two others
were wrongly left untouched: Both cachability control and log-dirty
tracking ought to be uniformly handled/excluded for all (non-)MMIO
ranges, not just ones qualifiable by mfn_valid().

Signed-off-by: Jan Beulich <jbeulich@suse.com>
---
Note that this is orthogonal to there looking to be plans to undo other
aspects of said commit (XSA-154).

Comments

Andrew Cooper Jan. 13, 2023, 10:20 a.m. UTC | #1
On 13/01/2023 8:48 am, Jan Beulich wrote:
> While c61a6f74f80e ("x86: enforce consistent cachability of MMIO
> mappings") correctly converted one !mfn_valid() check there, two others
> were wrongly left untouched: Both cachability control and log-dirty
> tracking ought to be uniformly handled/excluded for all (non-)MMIO
> ranges, not just ones qualifiable by mfn_valid().
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
diff mbox series

Patch

--- a/xen/arch/x86/mm/shadow/multi.c
+++ b/xen/arch/x86/mm/shadow/multi.c
@@ -543,8 +543,7 @@  _sh_propagate(struct vcpu *v,
      * caching attributes in the shadows to match what was asked for.
      */
     if ( (level == 1) && is_hvm_domain(d) &&
-         (!mfn_valid(target_mfn) ||
-          !is_special_page(mfn_to_page(target_mfn))) )
+         (mmio_mfn || !is_special_page(mfn_to_page(target_mfn))) )
     {
         int type;
 
@@ -655,8 +654,7 @@  _sh_propagate(struct vcpu *v,
      * (We handle log-dirty entirely inside the shadow code, without using the
      * p2m_ram_logdirty p2m type: only HAP uses that.)
      */
-    if ( level == 1 && unlikely(shadow_mode_log_dirty(d)) &&
-         mfn_valid(target_mfn) )
+    if ( level == 1 && unlikely(shadow_mode_log_dirty(d)) && !mmio_mfn )
     {
         if ( ft & FETCH_TYPE_WRITE )
             paging_mark_dirty(d, target_mfn);