]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
x86_64: Remove pointless set_64bit() usage
authorPeter Zijlstra <peterz@infradead.org>
Fri, 21 Oct 2022 12:11:38 +0000 (14:11 +0200)
committerDave Hansen <dave.hansen@linux.intel.com>
Thu, 15 Dec 2022 18:37:27 +0000 (10:37 -0800)
The use of set_64bit() in X86_64 only code is pretty pointless, seeing
how it's a direct assignment. Remove all this nonsense.

[nathanchance: unbreak irte]
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20221022114425.168036718%40infradead.org
arch/um/include/asm/pgtable-3level.h
arch/x86/include/asm/cmpxchg_64.h
drivers/iommu/intel/irq_remapping.c

index cb896e6121c8e611641e32c491dd97687bd781eb..8a5032ec231fd969b7e0dc916e76073a9c0105b7 100644 (file)
 #define pud_populate(mm, pud, pmd) \
        set_pud(pud, __pud(_PAGE_TABLE + __pa(pmd)))
 
-#ifdef CONFIG_64BIT
-#define set_pud(pudptr, pudval) set_64bit((u64 *) (pudptr), pud_val(pudval))
-#else
 #define set_pud(pudptr, pudval) (*(pudptr) = (pudval))
-#endif
 
 static inline int pgd_newpage(pgd_t pgd)
 {
@@ -71,11 +67,7 @@ static inline int pgd_newpage(pgd_t pgd)
 
 static inline void pgd_mkuptodate(pgd_t pgd) { pgd_val(pgd) &= ~_PAGE_NEWPAGE; }
 
-#ifdef CONFIG_64BIT
-#define set_pmd(pmdptr, pmdval) set_64bit((u64 *) (pmdptr), pmd_val(pmdval))
-#else
 #define set_pmd(pmdptr, pmdval) (*(pmdptr) = (pmdval))
-#endif
 
 static inline void pud_clear (pud_t *pud)
 {
index 250187ac824842a4dabcb77bf394902447c0609a..0d3beb27b7fe4fbc43c25f204f5ce76c592409a1 100644 (file)
@@ -2,11 +2,6 @@
 #ifndef _ASM_X86_CMPXCHG_64_H
 #define _ASM_X86_CMPXCHG_64_H
 
-static inline void set_64bit(volatile u64 *ptr, u64 val)
-{
-       *ptr = val;
-}
-
 #define arch_cmpxchg64(ptr, o, n)                                      \
 ({                                                                     \
        BUILD_BUG_ON(sizeof(*(ptr)) != 8);                              \
index 5962bb5027d06af10f93c56c54cdb31b541b0178..5d176168bb7607c65bc07526e8f3e213e85555d1 100644 (file)
@@ -173,7 +173,6 @@ static int modify_irte(struct irq_2_iommu *irq_iommu,
        index = irq_iommu->irte_index + irq_iommu->sub_handle;
        irte = &iommu->ir_table->base[index];
 
-#if defined(CONFIG_HAVE_CMPXCHG_DOUBLE)
        if ((irte->pst == 1) || (irte_modified->pst == 1)) {
                bool ret;
 
@@ -187,11 +186,9 @@ static int modify_irte(struct irq_2_iommu *irq_iommu,
                 * same as the old value.
                 */
                WARN_ON(!ret);
-       } else
-#endif
-       {
-               set_64bit(&irte->low, irte_modified->low);
-               set_64bit(&irte->high, irte_modified->high);
+       } else {
+               WRITE_ONCE(irte->low, irte_modified->low);
+               WRITE_ONCE(irte->high, irte_modified->high);
        }
        __iommu_flush_cache(iommu, irte, sizeof(*irte));
 
@@ -249,8 +246,8 @@ static int clear_entries(struct irq_2_iommu *irq_iommu)
        end = start + (1 << irq_iommu->irte_mask);
 
        for (entry = start; entry < end; entry++) {
-               set_64bit(&entry->low, 0);
-               set_64bit(&entry->high, 0);
+               WRITE_ONCE(entry->low, 0);
+               WRITE_ONCE(entry->high, 0);
        }
        bitmap_release_region(iommu->ir_table->bitmap, index,
                              irq_iommu->irte_mask);