xen/x86: Replace mandatory barriers with compiler barriers
authorAndrew Cooper <andrew.cooper3@citrix.com>
Wed, 16 Aug 2017 17:07:27 +0000 (18:07 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Mon, 11 Sep 2017 16:14:09 +0000 (17:14 +0100)
In this case, rmb() is being used for its compiler barrier property.  Replace
it with an explicit barrer() and comment, to avoid it becoming an unnecessary
lfence instruction (when rmb() gets fixed) or looking like an SMP issue.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
xen/drivers/passthrough/amd/iommu_init.c

index a459e99fb0eaa5011b0fdc2975146ec773bea51e..474992a75a2a0e2ded39f8a29a85768d50b9c55c 100644 (file)
@@ -558,7 +558,7 @@ static void parse_event_log_entry(struct amd_iommu *iommu, u32 entry[])
             return;
         }
         udelay(1);
-        rmb();
+        barrier(); /* Prevent hoisting of the entry[] read. */
         code = get_field_from_reg_u32(entry[1], IOMMU_EVENT_CODE_MASK,
                                       IOMMU_EVENT_CODE_SHIFT);
     }
@@ -663,7 +663,7 @@ void parse_ppr_log_entry(struct amd_iommu *iommu, u32 entry[])
             return;
         }
         udelay(1);
-        rmb();
+        barrier(); /* Prevent hoisting of the entry[] read. */
         code = get_field_from_reg_u32(entry[1], IOMMU_PPR_LOG_CODE_MASK,
                                       IOMMU_PPR_LOG_CODE_SHIFT);
     }