Skip to content

Commit 45a1b8c

Browse files
committed
Merge tag 'x86_misc_for_7.0-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull misc x86 updates from Dave Hansen: "The usual smattering of x86/misc changes. The IPv6 patch in here surprised me in a couple of ways. First, the function it inlines is able to eat a lot more CPU time than I would have expected. Second, the inlining does not seem to bloat the kernel, at least in the configs folks have tested. - Inline x86-specific IPv6 checksum helper - Update IOMMU docs to use stable identifiers - Print unhashed pointers on fatal stack overflows" * tag 'x86_misc_for_7.0-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: x86/traps: Print unhashed pointers on stack overflow Documentation/x86: Update IOMMU spec references to use stable identifiers x86/lib: Inline csum_ipv6_magic()
2 parents 6f7e639 + 6b32c93 commit 45a1b8c

4 files changed

Lines changed: 38 additions & 38 deletions

File tree

Documentation/arch/x86/iommu.rst

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22
x86 IOMMU Support
33
=================
44

5-
The architecture specs can be obtained from the below locations.
5+
The architecture specs can be obtained from the vendor websites.
6+
Search for the following documents to obtain the latest versions:
67

7-
- Intel: http://www.intel.com/content/dam/www/public/us/en/documents/product-specifications/vt-directed-io-spec.pdf
8-
- AMD: https://www.amd.com/content/dam/amd/en/documents/processor-tech-docs/specifications/48882_3_07_PUB.pdf
8+
- Intel: Intel Virtualization Technology for Directed I/O Architecture Specification (ID: D51397)
9+
- AMD: AMD I/O Virtualization Technology (IOMMU) Specification (ID: 48882)
910

1011
This guide gives a quick cheat sheet for some basic understanding.
1112

arch/x86/include/asm/checksum_64.h

Lines changed: 33 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
*/
1010

1111
#include <linux/compiler.h>
12+
#include <linux/in6.h>
1213
#include <asm/byteorder.h>
1314

1415
/**
@@ -145,6 +146,17 @@ extern __wsum csum_partial_copy_nocheck(const void *src, void *dst, int len);
145146
*/
146147
extern __sum16 ip_compute_csum(const void *buff, int len);
147148

149+
static inline unsigned add32_with_carry(unsigned a, unsigned b)
150+
{
151+
asm("addl %2,%0\n\t"
152+
"adcl $0,%0"
153+
: "=r" (a)
154+
: "0" (a), "rm" (b));
155+
return a;
156+
}
157+
158+
#define _HAVE_ARCH_IPV6_CSUM 1
159+
148160
/**
149161
* csum_ipv6_magic - Compute checksum of an IPv6 pseudo header.
150162
* @saddr: source address
@@ -158,20 +170,29 @@ extern __sum16 ip_compute_csum(const void *buff, int len);
158170
* Returns the unfolded 32bit checksum.
159171
*/
160172

161-
struct in6_addr;
173+
static inline __sum16 csum_ipv6_magic(
174+
const struct in6_addr *_saddr, const struct in6_addr *_daddr,
175+
__u32 len, __u8 proto, __wsum sum)
176+
{
177+
const unsigned long *saddr = (const unsigned long *)_saddr;
178+
const unsigned long *daddr = (const unsigned long *)_daddr;
179+
__u64 sum64;
162180

163-
#define _HAVE_ARCH_IPV6_CSUM 1
164-
extern __sum16
165-
csum_ipv6_magic(const struct in6_addr *saddr, const struct in6_addr *daddr,
166-
__u32 len, __u8 proto, __wsum sum);
181+
sum64 = (__force __u64)htonl(len) + (__force __u64)htons(proto) +
182+
(__force __u64)sum;
167183

168-
static inline unsigned add32_with_carry(unsigned a, unsigned b)
169-
{
170-
asm("addl %2,%0\n\t"
171-
"adcl $0,%0"
172-
: "=r" (a)
173-
: "0" (a), "rm" (b));
174-
return a;
184+
asm(" addq %1,%[sum64]\n"
185+
" adcq %2,%[sum64]\n"
186+
" adcq %3,%[sum64]\n"
187+
" adcq %4,%[sum64]\n"
188+
" adcq $0,%[sum64]\n"
189+
190+
: [sum64] "+r" (sum64)
191+
: "m" (saddr[0]), "m" (saddr[1]),
192+
"m" (daddr[0]), "m" (daddr[1]));
193+
194+
return csum_fold(
195+
(__force __wsum)add32_with_carry(sum64 & 0xffffffff, sum64>>32));
175196
}
176197

177198
#define HAVE_ARCH_CSUM_ADD

arch/x86/kernel/traps.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,7 @@ __visible void __noreturn handle_stack_overflow(struct pt_regs *regs,
549549
{
550550
const char *name = stack_type_name(info->type);
551551

552-
printk(KERN_EMERG "BUG: %s stack guard page was hit at %p (stack is %p..%p)\n",
552+
printk(KERN_EMERG "BUG: %s stack guard page was hit at %px (stack is %px..%px)\n",
553553
name, (void *)fault_address, info->begin, info->end);
554554

555555
die("stack guard page", regs, 0);

arch/x86/lib/csum-wrappers_64.c

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -68,25 +68,3 @@ csum_partial_copy_nocheck(const void *src, void *dst, int len)
6868
}
6969
EXPORT_SYMBOL(csum_partial_copy_nocheck);
7070

71-
__sum16 csum_ipv6_magic(const struct in6_addr *saddr,
72-
const struct in6_addr *daddr,
73-
__u32 len, __u8 proto, __wsum sum)
74-
{
75-
__u64 rest, sum64;
76-
77-
rest = (__force __u64)htonl(len) + (__force __u64)htons(proto) +
78-
(__force __u64)sum;
79-
80-
asm(" addq (%[saddr]),%[sum]\n"
81-
" adcq 8(%[saddr]),%[sum]\n"
82-
" adcq (%[daddr]),%[sum]\n"
83-
" adcq 8(%[daddr]),%[sum]\n"
84-
" adcq $0,%[sum]\n"
85-
86-
: [sum] "=r" (sum64)
87-
: "[sum]" (rest), [saddr] "r" (saddr), [daddr] "r" (daddr));
88-
89-
return csum_fold(
90-
(__force __wsum)add32_with_carry(sum64 & 0xffffffff, sum64>>32));
91-
}
92-
EXPORT_SYMBOL(csum_ipv6_magic);

0 commit comments

Comments
 (0)