Skip to contentSkip to conversation

x86/EPT: minor local variable adjustment in ept_set_entry()

PATCH In review Jan Beulich 3 participants 3 messages Apr 12, 2021 – Apr 13, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/EPT: minor local variable adjustment in ept_set_entry()

Not having direct_mmio (used only once anyway) as a local variable gets the epte_get_entry_emt() invocation here in better sync with the other ones. While at it also reduce ipat's scope.

xen/arch/x86/mm/p2m-ept.c +3 -3
@@ -677,8 +677,6 @@ ept_set_entry(struct p2m_domain *p2m, gf
     unsigned long fn_mask = !mfn_eq(mfn, INVALID_MFN) ? (gfn | mfn_x(mfn)) : gfn;
     int ret, rc = 0;
     bool_t entry_written = 0;
-    bool_t direct_mmio = (p2mt == p2m_mmio_direct);
-    uint8_t ipat = 0;
     bool_t need_modify_vtd_table = 1;
     bool_t vtd_pte_present = 0;
     unsigned int iommu_flags = p2m_get_iommu_flags(p2mt, mfn);
@@ -790,8 +788,10 @@ ept_set_entry(struct p2m_domain *p2m, gf
 
     if ( mfn_valid(mfn) || p2m_allows_invalid_mfn(p2mt) )
     {
+        uint8_t ipat = 0;
         int emt = epte_get_entry_emt(p2m->domain, gfn, mfn,
-                                     i * EPT_TABLE_ORDER, &ipat, direct_mmio);
+                                     i * EPT_TABLE_ORDER, &ipat,
+                                     p2mt == p2m_mmio_direct);
 
         if ( emt >= 0 )
             new_entry.emt = emt;
Reviewed-by on v1 1/1
#2 lore raw
In reply to Jan Beulich
Quoted 7 lines

From: Jan Beulich <[email protected]>
Sent: Monday, April 12, 2021 7:34 PM
Not having direct_mmio (used only once anyway) as a local variable gets the epte_get_entry_emt() invocation here in better sync with the other ones. While at it also reduce ipat's scope.

Quoted 25 lines
xen/arch/x86/mm/p2m-ept.c +0 -2
@@ -677,8 +677,6 @@ ept_set_entry(struct p2m_domain *p2m, gf
     unsigned long fn_mask = !mfn_eq(mfn, INVALID_MFN) ? (gfn |
 mfn_x(mfn)) : gfn;
     int ret, rc = 0;
     bool_t entry_written = 0;
-    bool_t direct_mmio = (p2mt == p2m_mmio_direct);
-    uint8_t ipat = 0;
     bool_t need_modify_vtd_table = 1;
     bool_t vtd_pte_present = 0;
     unsigned int iommu_flags = p2m_get_iommu_flags(p2mt, mfn);
xen/arch/x86/mm/p2m-ept.c +3 -1
@@ -790,8 +788,10 @@ ept_set_entry(struct p2m_domain *p2m, gf
 
     if ( mfn_valid(mfn) || p2m_allows_invalid_mfn(p2mt) )
     {
+        uint8_t ipat = 0;
         int emt = epte_get_entry_emt(p2m->domain, gfn, mfn,
-                                     i * EPT_TABLE_ORDER, &ipat, direct_mmio);
+                                     i * EPT_TABLE_ORDER, &ipat,
+                                     p2mt == p2m_mmio_direct);
 
         if ( emt >= 0 )
             new_entry.emt = emt;