* Inline x86-specific IPv6 checksum helper

* Update IOMMU docs to use stable identifiers
  * Print unhashed pointers on fatal stack overflows
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEV76QKkVc4xCGURexaDWVMHDJkrAFAmmKE4oACgkQaDWVMHDJ
 krCDng//eWBbJAODZYO/mNgLNUzRzB2swtvVJhn+uZJGkTgtEN/Qpfu7f6PpPHrF
 oSl2/Sa62NVRH1BkyRTehxiAaBPqZVl3qQD3pkoi2niSGw61fzRSusZVZrEdA9kQ
 25QTXBubjnnxMKQeQQX92WzRfk6o+1gtacrHZRcTcX1iOJNKtg1Cx3BrfD50bMqH
 WFCd7IoNwvEbNYalIoH4T8XDj6icSsE/T5xt66Z4HyFOG3R3hpiOSB1+gVZN8nvc
 dwA5W51IvmjtjbaL2dyEtDMJ2pxTf/WmuJ8Z+93GVie0xOZUGOrpFMwW3SAaPxAy
 XiisNdfFlYq3FUt9Uuhe8RVMmlmRXGF4vAUx8j0RB7GBMRIigCRuuSigsDsdBBM6
 30bgAm6mukqttgheNNA4Q7I4fNjWBGJT7wOzO7gffcZpdV4RpiOKOV1U2tpfekDx
 zw4Dyl9RvIEXY3jXVWzOhwQp0KKk1NUJLS8xBuIPBnTM28F2GTsbado2tE39IDdy
 saUhhuidh0e11wOkHnLOiCbjrshR4CzCFQtMondZDL3rmlgT5GfEQA3j4vxBogme
 /XgcgWh8hk4fW5r4VKoKPz4kHvZqeoHMXlFMJw5HSgHMJT3uTfC8GvdzfObytLYl
 TvMof8LpRVZeaG/OxVEA5HoBbI5JOj5DSvdIgff/fW8ZBakni6M=
 =Rqoq
 -----END PGP SIGNATURE-----

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()
This commit is contained in:
Linus Torvalds 2026-02-10 19:52:18 -08:00
commit 45a1b8cc6c
4 changed files with 39 additions and 39 deletions

View File

@ -2,10 +2,11 @@
x86 IOMMU Support
=================
The architecture specs can be obtained from the below locations.
The architecture specs can be obtained from the vendor websites.
Search for the following documents to obtain the latest versions:
- Intel: http://www.intel.com/content/dam/www/public/us/en/documents/product-specifications/vt-directed-io-spec.pdf
- AMD: https://www.amd.com/content/dam/amd/en/documents/processor-tech-docs/specifications/48882_3_07_PUB.pdf
- Intel: Intel Virtualization Technology for Directed I/O Architecture Specification (ID: D51397)
- AMD: AMD I/O Virtualization Technology (IOMMU) Specification (ID: 48882)
This guide gives a quick cheat sheet for some basic understanding.

View File

@ -9,6 +9,7 @@
*/
#include <linux/compiler.h>
#include <linux/in6.h>
#include <asm/byteorder.h>
/**
@ -145,6 +146,17 @@ extern __wsum csum_partial_copy_nocheck(const void *src, void *dst, int len);
*/
extern __sum16 ip_compute_csum(const void *buff, int len);
static inline unsigned add32_with_carry(unsigned a, unsigned b)
{
asm("addl %2,%0\n\t"
"adcl $0,%0"
: "=r" (a)
: "0" (a), "rm" (b));
return a;
}
#define _HAVE_ARCH_IPV6_CSUM 1
/**
* csum_ipv6_magic - Compute checksum of an IPv6 pseudo header.
* @saddr: source address
@ -158,20 +170,29 @@ extern __sum16 ip_compute_csum(const void *buff, int len);
* Returns the unfolded 32bit checksum.
*/
struct in6_addr;
#define _HAVE_ARCH_IPV6_CSUM 1
extern __sum16
csum_ipv6_magic(const struct in6_addr *saddr, const struct in6_addr *daddr,
__u32 len, __u8 proto, __wsum sum);
static inline unsigned add32_with_carry(unsigned a, unsigned b)
static inline __sum16 csum_ipv6_magic(
const struct in6_addr *_saddr, const struct in6_addr *_daddr,
__u32 len, __u8 proto, __wsum sum)
{
asm("addl %2,%0\n\t"
"adcl $0,%0"
: "=r" (a)
: "0" (a), "rm" (b));
return a;
const unsigned long *saddr = (const unsigned long *)_saddr;
const unsigned long *daddr = (const unsigned long *)_daddr;
__u64 sum64;
sum64 = (__force __u64)htonl(len) + (__force __u64)htons(proto) +
(__force __u64)sum;
asm(" addq %1,%[sum64]\n"
" adcq %2,%[sum64]\n"
" adcq %3,%[sum64]\n"
" adcq %4,%[sum64]\n"
" adcq $0,%[sum64]\n"
: [sum64] "+r" (sum64)
: "m" (saddr[0]), "m" (saddr[1]),
"m" (daddr[0]), "m" (daddr[1]));
return csum_fold(
(__force __wsum)add32_with_carry(sum64 & 0xffffffff, sum64>>32));
}
#define HAVE_ARCH_CSUM_ADD

View File

@ -549,7 +549,7 @@ __visible void __noreturn handle_stack_overflow(struct pt_regs *regs,
{
const char *name = stack_type_name(info->type);
printk(KERN_EMERG "BUG: %s stack guard page was hit at %p (stack is %p..%p)\n",
printk(KERN_EMERG "BUG: %s stack guard page was hit at %px (stack is %px..%px)\n",
name, (void *)fault_address, info->begin, info->end);
die("stack guard page", regs, 0);

View File

@ -68,25 +68,3 @@ csum_partial_copy_nocheck(const void *src, void *dst, int len)
}
EXPORT_SYMBOL(csum_partial_copy_nocheck);
__sum16 csum_ipv6_magic(const struct in6_addr *saddr,
const struct in6_addr *daddr,
__u32 len, __u8 proto, __wsum sum)
{
__u64 rest, sum64;
rest = (__force __u64)htonl(len) + (__force __u64)htons(proto) +
(__force __u64)sum;
asm(" addq (%[saddr]),%[sum]\n"
" adcq 8(%[saddr]),%[sum]\n"
" adcq (%[daddr]),%[sum]\n"
" adcq 8(%[daddr]),%[sum]\n"
" adcq $0,%[sum]\n"
: [sum] "=r" (sum64)
: "[sum]" (rest), [saddr] "r" (saddr), [daddr] "r" (daddr));
return csum_fold(
(__force __wsum)add32_with_carry(sum64 & 0xffffffff, sum64>>32));
}
EXPORT_SYMBOL(csum_ipv6_magic);