Skip to content

Commit 9ee850a

Browse files
Peter Zijlstrahansendc
authored andcommitted
x86_64: Remove pointless set_64bit() usage
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) <[email protected]> Link: https://lkml.kernel.org/r/20221022114425.168036718%40infradead.org
1 parent b7301f2 commit 9ee850a

File tree

3 files changed

+5
-21
lines changed

3 files changed

+5
-21
lines changed

arch/um/include/asm/pgtable-3level.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,7 @@
5858
#define pud_populate(mm, pud, pmd) \
5959
set_pud(pud, __pud(_PAGE_TABLE + __pa(pmd)))
6060

61-
#ifdef CONFIG_64BIT
62-
#define set_pud(pudptr, pudval) set_64bit((u64 *) (pudptr), pud_val(pudval))
63-
#else
6461
#define set_pud(pudptr, pudval) (*(pudptr) = (pudval))
65-
#endif
6662

6763
static inline int pgd_newpage(pgd_t pgd)
6864
{
@@ -71,11 +67,7 @@ static inline int pgd_newpage(pgd_t pgd)
7167

7268
static inline void pgd_mkuptodate(pgd_t pgd) { pgd_val(pgd) &= ~_PAGE_NEWPAGE; }
7369

74-
#ifdef CONFIG_64BIT
75-
#define set_pmd(pmdptr, pmdval) set_64bit((u64 *) (pmdptr), pmd_val(pmdval))
76-
#else
7770
#define set_pmd(pmdptr, pmdval) (*(pmdptr) = (pmdval))
78-
#endif
7971

8072
static inline void pud_clear (pud_t *pud)
8173
{

arch/x86/include/asm/cmpxchg_64.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,6 @@
22
#ifndef _ASM_X86_CMPXCHG_64_H
33
#define _ASM_X86_CMPXCHG_64_H
44

5-
static inline void set_64bit(volatile u64 *ptr, u64 val)
6-
{
7-
*ptr = val;
8-
}
9-
105
#define arch_cmpxchg64(ptr, o, n) \
116
({ \
127
BUILD_BUG_ON(sizeof(*(ptr)) != 8); \

drivers/iommu/intel/irq_remapping.c

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,6 @@ static int modify_irte(struct irq_2_iommu *irq_iommu,
173173
index = irq_iommu->irte_index + irq_iommu->sub_handle;
174174
irte = &iommu->ir_table->base[index];
175175

176-
#if defined(CONFIG_HAVE_CMPXCHG_DOUBLE)
177176
if ((irte->pst == 1) || (irte_modified->pst == 1)) {
178177
bool ret;
179178

@@ -187,11 +186,9 @@ static int modify_irte(struct irq_2_iommu *irq_iommu,
187186
* same as the old value.
188187
*/
189188
WARN_ON(!ret);
190-
} else
191-
#endif
192-
{
193-
set_64bit(&irte->low, irte_modified->low);
194-
set_64bit(&irte->high, irte_modified->high);
189+
} else {
190+
WRITE_ONCE(irte->low, irte_modified->low);
191+
WRITE_ONCE(irte->high, irte_modified->high);
195192
}
196193
__iommu_flush_cache(iommu, irte, sizeof(*irte));
197194

@@ -249,8 +246,8 @@ static int clear_entries(struct irq_2_iommu *irq_iommu)
249246
end = start + (1 << irq_iommu->irte_mask);
250247

251248
for (entry = start; entry < end; entry++) {
252-
set_64bit(&entry->low, 0);
253-
set_64bit(&entry->high, 0);
249+
WRITE_ONCE(entry->low, 0);
250+
WRITE_ONCE(entry->high, 0);
254251
}
255252
bitmap_release_region(iommu->ir_table->bitmap, index,
256253
irq_iommu->irte_mask);

0 commit comments

Comments
 (0)