Skip to content

Commit 79caa6c

Browse files
committed
Merge tag 'asm-generic-3.13' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/asm-generic
Pull asm-generic updates from Arnd Bergmann: "These are a number of unrelated cleanups, generally simplifying the architecture specific header files: - A series from Al Viro simplifies asm/vga.h, after it turns out that most of it can be generalized. - A series from Julian Vetter adds a common version of memcpy_{to,from}io() and memset_io() and changes most architectures to use that instead of their own implementation - A series from Niklas Schnelle concludes his work to make PC style inb()/outb() optional - Nicolas Pitre contributes improvements for the generic do_div() helper - Christoph Hellwig adds a generic version of page_to_phys() and phys_to_page(), replacing the slightly different architecture specific definitions. - Uwe Kleine-Koenig has a minor cleanup for ioctl definitions" * tag 'asm-generic-3.13' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/asm-generic: (24 commits) empty include/asm-generic/vga.h sparc: get rid of asm/vga.h asm/vga.h: don't bother with scr_mem{cpy,move}v() unless we need to vt_buffer.h: get rid of dead code in default scr_...() instances tty: serial: export serial_8250_warn_need_ioport lib/iomem_copy: fix kerneldoc format style hexagon: simplify asm/io.h for !HAS_IOPORT loongarch: Use new fallback IO memcpy/memset csky: Use new fallback IO memcpy/memset arm64: Use new fallback IO memcpy/memset New implementation for IO memcpy and IO memset watchdog: Add HAS_IOPORT dependency for SBC8360 and SBC7240 __arch_xprod64(): make __always_inline when optimizing for performance ARM: div64: improve __arch_xprod_64() asm-generic/div64: optimize/simplify __div64_const32() lib/math/test_div64: add some edge cases relevant to __div64_const32() asm-generic: add an optional pfn_valid check to page_to_phys asm-generic: provide generic page_to_phys and phys_to_page implementations asm-generic/io.h: Remove I/O port accessors for HAS_IOPORT=n tty: serial: handle HAS_IOPORT dependencies ...
2 parents c66fbc6 + 0af8e32 commit 79caa6c

File tree

63 files changed

+487
-930
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+487
-930
lines changed

arch/alpha/include/asm/io.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ static inline void * phys_to_virt(unsigned long address)
8888

8989
#define virt_to_phys virt_to_phys
9090
#define phys_to_virt phys_to_virt
91-
#define page_to_phys(page) page_to_pa(page)
9291

9392
/* Maximum PIO space address supported? */
9493
#define IO_SPACE_LIMIT 0xffff

arch/arc/include/asm/io.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,6 @@ static inline void ioport_unmap(void __iomem *addr)
4242
#define iowrite16be(v,p) ({ __iowmb(); __raw_writew((__force u16)cpu_to_be16(v), p); })
4343
#define iowrite32be(v,p) ({ __iowmb(); __raw_writel((__force u32)cpu_to_be32(v), p); })
4444

45-
/* Change struct page to physical address */
46-
#define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT)
47-
4845
#define __raw_readb __raw_readb
4946
static inline u8 __raw_readb(const volatile void __iomem *addr)
5047
{

arch/arm/include/asm/div64.h

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,18 +52,25 @@ static inline uint32_t __div64_32(uint64_t *n, uint32_t base)
5252

5353
#else
5454

55-
static inline uint64_t __arch_xprod_64(uint64_t m, uint64_t n, bool bias)
55+
#ifdef CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE
56+
static __always_inline
57+
#else
58+
static inline
59+
#endif
60+
uint64_t __arch_xprod_64(uint64_t m, uint64_t n, bool bias)
5661
{
5762
unsigned long long res;
5863
register unsigned int tmp asm("ip") = 0;
64+
bool no_ovf = __builtin_constant_p(m) &&
65+
((m >> 32) + (m & 0xffffffff) < 0x100000000);
5966

6067
if (!bias) {
6168
asm ( "umull %Q0, %R0, %Q1, %Q2\n\t"
6269
"mov %Q0, #0"
6370
: "=&r" (res)
6471
: "r" (m), "r" (n)
6572
: "cc");
66-
} else if (!(m & ((1ULL << 63) | (1ULL << 31)))) {
73+
} else if (no_ovf) {
6774
res = m;
6875
asm ( "umlal %Q0, %R0, %Q1, %Q2\n\t"
6976
"mov %Q0, #0"
@@ -80,7 +87,7 @@ static inline uint64_t __arch_xprod_64(uint64_t m, uint64_t n, bool bias)
8087
: "cc");
8188
}
8289

83-
if (!(m & ((1ULL << 63) | (1ULL << 31)))) {
90+
if (no_ovf) {
8491
asm ( "umlal %R0, %Q0, %R1, %Q2\n\t"
8592
"umlal %R0, %Q0, %Q1, %R2\n\t"
8693
"mov %R0, #0\n\t"

arch/arm/include/asm/memory.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -147,12 +147,6 @@ extern unsigned long vectors_base;
147147
#define DTCM_OFFSET UL(0xfffe8000)
148148
#endif
149149

150-
/*
151-
* Convert a page to/from a physical address
152-
*/
153-
#define page_to_phys(page) (__pfn_to_phys(page_to_pfn(page)))
154-
#define phys_to_page(phys) (pfn_to_page(__phys_to_pfn(phys)))
155-
156150
/*
157151
* PLAT_PHYS_OFFSET is the offset (from zero) of the start of physical
158152
* memory. This is used for XIP and NoMMU kernels, and on platforms that don't

arch/arm64/include/asm/io.h

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -129,17 +129,6 @@ static __always_inline u64 __raw_readq(const volatile void __iomem *addr)
129129
#define IO_SPACE_LIMIT (PCI_IO_SIZE - 1)
130130
#define PCI_IOBASE ((void __iomem *)PCI_IO_START)
131131

132-
/*
133-
* String version of I/O memory access operations.
134-
*/
135-
extern void __memcpy_fromio(void *, const volatile void __iomem *, size_t);
136-
extern void __memcpy_toio(volatile void __iomem *, const void *, size_t);
137-
extern void __memset_io(volatile void __iomem *, int, size_t);
138-
139-
#define memset_io(c,v,l) __memset_io((c),(v),(l))
140-
#define memcpy_fromio(a,c,l) __memcpy_fromio((a),(c),(l))
141-
#define memcpy_toio(c,a,l) __memcpy_toio((c),(a),(l))
142-
143132
/*
144133
* The ARM64 iowrite implementation is intended to support drivers that want to
145134
* use write combining. For instance PCI drivers using write combining with a 64

arch/arm64/include/asm/memory.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -353,12 +353,6 @@ extern phys_addr_t __phys_addr_symbol(unsigned long x);
353353
#define __phys_to_virt(x) ((unsigned long)((x) - PHYS_OFFSET) | PAGE_OFFSET)
354354
#define __phys_to_kimg(x) ((unsigned long)((x) + kimage_voffset))
355355

356-
/*
357-
* Convert a page to/from a physical address
358-
*/
359-
#define page_to_phys(page) (__pfn_to_phys(page_to_pfn(page)))
360-
#define phys_to_page(phys) (pfn_to_page(__phys_to_pfn(phys)))
361-
362356
/*
363357
* Note: Drivers should NOT use these. They are the wrong
364358
* translation for translating DMA addresses. Use the driver

arch/arm64/kernel/io.c

Lines changed: 0 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -9,34 +9,6 @@
99
#include <linux/types.h>
1010
#include <linux/io.h>
1111

12-
/*
13-
* Copy data from IO memory space to "real" memory space.
14-
*/
15-
void __memcpy_fromio(void *to, const volatile void __iomem *from, size_t count)
16-
{
17-
while (count && !IS_ALIGNED((unsigned long)from, 8)) {
18-
*(u8 *)to = __raw_readb(from);
19-
from++;
20-
to++;
21-
count--;
22-
}
23-
24-
while (count >= 8) {
25-
*(u64 *)to = __raw_readq(from);
26-
from += 8;
27-
to += 8;
28-
count -= 8;
29-
}
30-
31-
while (count) {
32-
*(u8 *)to = __raw_readb(from);
33-
from++;
34-
to++;
35-
count--;
36-
}
37-
}
38-
EXPORT_SYMBOL(__memcpy_fromio);
39-
4012
/*
4113
* This generates a memcpy that works on a from/to address which is aligned to
4214
* bits. Count is in terms of the number of bits sized quantities to copy. It
@@ -78,62 +50,3 @@ void __iowrite32_copy_full(void __iomem *to, const void *from, size_t count)
7850
dgh();
7951
}
8052
EXPORT_SYMBOL(__iowrite32_copy_full);
81-
82-
/*
83-
* Copy data from "real" memory space to IO memory space.
84-
*/
85-
void __memcpy_toio(volatile void __iomem *to, const void *from, size_t count)
86-
{
87-
while (count && !IS_ALIGNED((unsigned long)to, 8)) {
88-
__raw_writeb(*(u8 *)from, to);
89-
from++;
90-
to++;
91-
count--;
92-
}
93-
94-
while (count >= 8) {
95-
__raw_writeq(*(u64 *)from, to);
96-
from += 8;
97-
to += 8;
98-
count -= 8;
99-
}
100-
101-
while (count) {
102-
__raw_writeb(*(u8 *)from, to);
103-
from++;
104-
to++;
105-
count--;
106-
}
107-
}
108-
EXPORT_SYMBOL(__memcpy_toio);
109-
110-
/*
111-
* "memset" on IO memory space.
112-
*/
113-
void __memset_io(volatile void __iomem *dst, int c, size_t count)
114-
{
115-
u64 qc = (u8)c;
116-
117-
qc |= qc << 8;
118-
qc |= qc << 16;
119-
qc |= qc << 32;
120-
121-
while (count && !IS_ALIGNED((unsigned long)dst, 8)) {
122-
__raw_writeb(c, dst);
123-
dst++;
124-
count--;
125-
}
126-
127-
while (count >= 8) {
128-
__raw_writeq(qc, dst);
129-
dst += 8;
130-
count -= 8;
131-
}
132-
133-
while (count) {
134-
__raw_writeb(c, dst);
135-
dst++;
136-
count--;
137-
}
138-
}
139-
EXPORT_SYMBOL(__memset_io);

arch/csky/include/asm/io.h

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,6 @@
3131
#define writel(v,c) ({ wmb(); writel_relaxed((v),(c)); mb(); })
3232
#endif
3333

34-
/*
35-
* String version of I/O memory access operations.
36-
*/
37-
extern void __memcpy_fromio(void *, const volatile void __iomem *, size_t);
38-
extern void __memcpy_toio(volatile void __iomem *, const void *, size_t);
39-
extern void __memset_io(volatile void __iomem *, int, size_t);
40-
41-
#define memset_io(c,v,l) __memset_io((c),(v),(l))
42-
#define memcpy_fromio(a,c,l) __memcpy_fromio((a),(c),(l))
43-
#define memcpy_toio(c,a,l) __memcpy_toio((c),(a),(l))
44-
4534
/*
4635
* I/O memory mapping functions.
4736
*/

arch/csky/include/asm/page.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,6 @@ extern void *memcpy(void *to, const void *from, size_t l);
3939
#define clear_page(page) memset((page), 0, PAGE_SIZE)
4040
#define copy_page(to, from) memcpy((to), (from), PAGE_SIZE)
4141

42-
#define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT)
43-
#define phys_to_page(paddr) (pfn_to_page(PFN_DOWN(paddr)))
44-
4542
struct page;
4643

4744
#include <abi/page.h>

arch/csky/kernel/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
extra-y := vmlinux.lds
33

44
obj-y += head.o entry.o atomic.o signal.o traps.o irq.o time.o vdso.o vdso/
5-
obj-y += power.o syscall.o syscall_table.o setup.o io.o
5+
obj-y += power.o syscall.o syscall_table.o setup.o
66
obj-y += process.o cpu-probe.o ptrace.o stacktrace.o
77
obj-y += probes/
88

0 commit comments

Comments
 (0)