Merge branch 'x86-rdrand-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
authorLinus Torvalds <torvalds@linux-foundation.org>
Fri, 28 Oct 2011 12:29:07 +0000 (05:29 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 28 Oct 2011 12:29:07 +0000 (05:29 -0700)
* 'x86-rdrand-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  x86, random: Verify RDRAND functionality and allow it to be disabled
  x86, random: Architectural inlines to get random integers with RDRAND
  random: Add support for architectural random hooks

Fix up trivial conflicts in drivers/char/random.c: the architectural
random hooks touched "get_random_int()" that was simplified to use MD5
and not do the keyptr thing any more (see commit 6e5714eaf77d: "net:
Compute protocol sequence numbers and fragment IDs using MD5").

1  2 
Documentation/kernel-parameters.txt
arch/x86/Kconfig
arch/x86/kernel/cpu/Makefile
arch/x86/kernel/cpu/common.c
drivers/char/random.c
include/linux/random.h

@@@ -40,7 -40,6 +40,7 @@@ parameter is applicable
        ALSA    ALSA sound support is enabled.
        APIC    APIC support is enabled.
        APM     Advanced Power Management support is enabled.
 +      ARM     ARM architecture is enabled.
        AVR32   AVR32 architecture is enabled.
        AX25    Appropriate AX.25 support is enabled.
        BLACKFIN Blackfin architecture is enabled.
@@@ -49,9 -48,7 +49,9 @@@
        EDD     BIOS Enhanced Disk Drive Services (EDD) is enabled
        EFI     EFI Partitioning (GPT) is enabled
        EIDE    EIDE/ATAPI support is enabled.
 +      EVM     Extended Verification Module
        FB      The frame buffer device is enabled.
 +      FTRACE  Function tracing enabled.
        GCOV    GCOV profiling is enabled.
        HW      Appropriate hardware is enabled.
        IA-64   IA-64 architecture is enabled.
@@@ -72,7 -69,6 +72,7 @@@
                        Documentation/m68k/kernel-options.txt.
        MCA     MCA bus support is enabled.
        MDA     MDA console support is enabled.
 +      MIPS    MIPS architecture is enabled.
        MOUSE   Appropriate mouse support is enabled.
        MSI     Message Signaled Interrupts (PCI).
        MTD     MTD (Memory Technology Device) support is enabled.
        SPARC   Sparc architecture is enabled.
        SWSUSP  Software suspend (hibernation) is enabled.
        SUSPEND System suspend states are enabled.
 -      FTRACE  Function tracing enabled.
        TPM     TPM drivers are enabled.
        TS      Appropriate touchscreen support is enabled.
        UMS     USB Mass Storage support is enabled.
        X86-64  X86-64 architecture is enabled.
                        More X86-64 boot options can be found in
                        Documentation/x86/x86_64/boot-options.txt .
 -      X86     Either 32bit or 64bit x86 (same as X86-32+X86-64)
 +      X86     Either 32-bit or 64-bit x86 (same as X86-32+X86-64)
        XEN     Xen support is enabled
  
  In addition, the following text indicates that the option:
@@@ -164,12 -161,7 +164,12 @@@ bytes respectively. Such letter suffixe
                        rsdt -- prefer RSDT over (default) XSDT
                        copy_dsdt -- copy DSDT to memory
  
 -                      See also Documentation/power/pm.txt, pci=noacpi
 +                      See also Documentation/power/runtime_pm.txt, pci=noacpi
 +
 +      acpi_rsdp=      [ACPI,EFI,KEXEC]
 +                      Pass the RSDP address to the kernel, mostly used
 +                      on machines running EFI runtime service to boot the
 +                      second kernel for kdump.
  
        acpi_apic_instance=     [ACPI, IOAPIC]
                        Format: <int>
                        behaviour to be specified.  Bit 0 enables warnings,
                        bit 1 enables fixups, and bit 2 sends a segfault.
  
 +      align_va_addr=  [X86-64]
 +                      Align virtual addresses by clearing slice [14:12] when
 +                      allocating a VMA at process creation time. This option
 +                      gives you up to 3% performance improvement on AMD F15h
 +                      machines (where it is enabled by default) for a
 +                      CPU-intensive style benchmark, and it can vary highly in
 +                      a microbenchmark depending on workload and compiler.
 +
 +                      1: only for 32-bit processes
 +                      2: only for 64-bit processes
 +                      on: enable for both 32- and 64-bit processes
 +                      off: disable for both 32- and 64-bit processes
 +
        amd_iommu=      [HW,X86-84]
                        Pass parameters to the AMD IOMMU driver in the system.
                        Possible values are:
        amijoy.map=     [HW,JOY] Amiga joystick support
                        Map of devices attached to JOY0DAT and JOY1DAT
                        Format: <a>,<b>
 -                      See also Documentation/kernel/input/joystick.txt
 +                      See also Documentation/input/joystick.txt
  
        analog.map=     [HW,JOY] Analog joystick and gamepad support
                        Specifies type or capabilities of an analog joystick
        atkbd.softrepeat= [HW]
                        Use software keyboard repeat
  
 -      autotest        [IA64]
 +      autotest        [IA-64]
  
        baycom_epp=     [HW,AX25]
                        Format: <io>,<mode>
        bttv.radio=     Most important insmod options are available as
                        kernel args too.
        bttv.pll=       See Documentation/video4linux/bttv/Insmod-options
 -      bttv.tuner=     and Documentation/video4linux/bttv/CARDLIST
 +      bttv.tuner=
  
        bulk_remove=off [PPC]  This parameter disables the use of the pSeries
                        firmware feature for flushing multiple hpte entries
                        /proc/<pid>/coredump_filter.
                        See also Documentation/filesystems/proc.txt.
  
 +      cpuidle.off=1   [CPU_IDLE]
 +                      disable the cpuidle sub-system
 +
        cpcihp_generic= [HW,PCI] Generic port I/O CompactPCI driver
                        Format:
                        <first_slot>,<last_slot>,<port>,<enum_bit>[,<debug>]
                uart[8250],mmio32,<addr>[,options]
                        Start an early, polled-mode console on the 8250/16550
                        UART at the specified I/O port or MMIO address.
 -                      MMIO inter-register address stride is either 8bit (mmio)
 -                        or 32bit (mmio32).
 +                      MMIO inter-register address stride is either 8-bit
 +                      (mmio) or 32-bit (mmio32).
                        The options are the same as for ttyS, above.
  
        earlyprintk=    [X86,SH,BLACKFIN]
  
        elevator=       [IOSCHED]
                        Format: {"cfq" | "deadline" | "noop"}
 -                      See Documentation/block/as-iosched.txt and
 +                      See Documentation/block/cfq-iosched.txt and
                        Documentation/block/deadline-iosched.txt for details.
  
 -      elfcorehdr=     [IA64,PPC,SH,X86]
 +      elfcorehdr=     [IA-64,PPC,SH,X86]
                        Specifies physical address of start of kernel core
                        image elf header. Generally kexec loader will
                        pass this option to capture kernel.
                        This option is obsoleted by the "netdev=" option, which
                        has equivalent usage. See its documentation for details.
  
 +      evm=            [EVM]
 +                      Format: { "fix" }
 +                      Permit 'security.evm' to be updated regardless of
 +                      current integrity status.
 +
        failslab=
        fail_page_alloc=
        fail_make_request=[KNL]
                        General fault injection mechanism.
                        Format: <interval>,<probability>,<space>,<times>
 -                      See also /Documentation/fault-injection/.
 +                      See also Documentation/fault-injection/.
  
        floppy=         [HW]
                        See Documentation/blockdev/floppy.txt.
                        tracer at boot up. function-list is a comma separated
                        list of functions. This list can be changed at run
                        time by the set_ftrace_filter file in the debugfs
 -                      tracing directory. 
 +                      tracing directory.
  
        ftrace_notrace=[function-list]
                        [FTRACE] Do not trace the functions specified in
  
        hashdist=       [KNL,NUMA] Large hashes allocated during boot
                        are distributed across NUMA nodes.  Defaults on
 -                      for 64bit NUMA, off otherwise.
 +                      for 64-bit NUMA, off otherwise.
                        Format: 0 | 1 (for off | on)
  
        hcl=            [IA-64] SGI's Hardware Graph compatibility layer
                        DMA.
                forcedac [x86_64]
                        With this option iommu will not optimize to look
 -                      for io virtual address below 32 bit forcing dual
 +                      for io virtual address below 32-bit forcing dual
                        address cycle on pci bus for cards supporting greater
 -                      than 32 bit addressing. The default is to look
 -                      for translation below 32 bit and if not available
 +                      than 32-bit addressing. The default is to look
 +                      for translation below 32-bit and if not available
                        then look in the higher range.
                strict [Default Off]
                        With this option on every unmap_single operation will
                        has the capability. With this option, super page will
                        not be supported.
        intremap=       [X86-64, Intel-IOMMU]
 -                      Format: { on (default) | off | nosid }
                        on      enable Interrupt Remapping (default)
                        off     disable Interrupt Remapping
                        nosid   disable Source ID checking
 +                      no_x2apic_optout
 +                              BIOS x2APIC opt-out request will be ignored
  
 -      inttest=        [IA64]
 +      inttest=        [IA-64]
  
        iomem=          Disable strict checking of access to MMIO memory
                strict  regions from userspace.
                nomerge
                forcesac
                soft
 -              pt      [x86, IA64]
 +              pt      [x86, IA-64]
  
        io7=            [HW] IO7 for Marvel based alpha systems
                        See comment before marvel_specify_io7 in
  
        kvm-amd.npt=    [KVM,AMD] Disable nested paging (virtualized MMU)
                        for all guests.
 -                      Default is 1 (enabled) if in 64bit or 32bit-PAE mode
 -
 -      kvm-intel.bypass_guest_pf=
 -                      [KVM,Intel] Disables bypassing of guest page faults
 -                      on Intel chips. Default is 1 (enabled)
 +                      Default is 1 (enabled) if in 64-bit or 32-bit PAE mode.
  
        kvm-intel.ept=  [KVM,Intel] Disable extended page tables
                        (virtualized MMU) support on capable Intel chips.
                        libata.dma=0      Disable all PATA and SATA DMA
                        libata.dma=1      PATA and SATA Disk DMA only
                        libata.dma=2      ATAPI (CDROM) DMA only
 -                      libata.dma=4      Compact Flash DMA only 
 +                      libata.dma=4      Compact Flash DMA only
                        Combinations also work, so libata.dma=3 enables DMA
                        for disks and CDROMs, but not CFs.
 -      
 +
        libata.ignore_hpa=      [LIBATA] Ignore HPA limit
                        libata.ignore_hpa=0       keep BIOS limits (default)
                        libata.ignore_hpa=1       ignore limits, using full disk
        ltpc=           [NET]
                        Format: <io>,<irq>,<dma>
  
 -      machvec=        [IA64] Force the use of a particular machine-vector
 +      machvec=        [IA-64] Force the use of a particular machine-vector
                        (machvec) in a generic kernel.
                        Example: machvec=hpzx1_swiotlb
  
                        it is equivalent to "nosmp", which also disables
                        the IO APIC.
  
 -      max_loop=       [LOOP] Maximum number of loopback devices that can
 -                      be mounted
 -                      Format: <1-256>
 +      max_loop=       [LOOP] The number of loop block devices that get
 +      (loop.max_loop) unconditionally pre-created at init time. The default
 +                      number is configured by BLK_DEV_LOOP_MIN_COUNT. Instead
 +                      of statically allocating a predefined number, loop
 +                      devices can be requested on-demand with the
 +                      /dev/loop-control interface.
  
        mcatest=        [IA-64]
  
  
        nointroute      [IA-64]
  
 -      nojitter        [IA64] Disables jitter checking for ITC timers.
 +      nojitter        [IA-64] Disables jitter checking for ITC timers.
  
        no-kvmclock     [X86,KVM] Disable paravirtualized KVM clock driver
  
        no-kvmapf       [X86,KVM] Disable paravirtualized asynchronous page
                        fault handling.
  
 +      no-steal-acc    [X86,KVM] Disable paravirtualized steal time accounting.
 +                      steal time is computed, but won't influence scheduler
 +                      behaviour
 +
        nolapic         [X86-32,APIC] Do not enable or use the local APIC.
  
        nolapic_timer   [X86-32,APIC] Do not use the local APIC timer.
  
        noresidual      [PPC] Don't use residual data on PReP machines.
  
+       nordrand        [X86] Disable the direct use of the RDRAND
+                       instruction even if it is supported by the
+                       processor.  RDRAND is still available to user
+                       space applications.
        noresume        [SWSUSP] Disables resume and restores original swap
                        space.
  
  
        nox2apic        [X86-64,APIC] Do not enable x2APIC mode.
  
 -      nptcg=          [IA64] Override max number of concurrent global TLB
 +      nptcg=          [IA-64] Override max number of concurrent global TLB
                        purges which is reported from either PAL_VM_SUMMARY or
                        SAL PALO.
  
                        See Documentation/sound/oss/oss-parameters.txt
  
        panic=          [KNL] Kernel behaviour on panic: delay <timeout>
 -                      seconds before rebooting
 +                      timeout > 0: seconds before rebooting
 +                      timeout = 0: wait forever
 +                      timeout < 0: reboot immediately
                        Format: <timeout>
  
        parkbd.port=    [HW] Parallel port number the keyboard adapter is
                        Format: { parport<nr> | timid | 0 }
                        See also Documentation/parport.txt.
  
 -      pmtmr=          [X86] Manual setup of pmtmr I/O Port. 
 +      pmtmr=          [X86] Manual setup of pmtmr I/O Port.
                        Override pmtimer IOPort with a hex value.
                        e.g. pmtmr=0x508
  
 -      pnp.debug       [PNP]
 -                      Enable PNP debug messages.  This depends on the
 -                      CONFIG_PNP_DEBUG_MESSAGES option.
 +      pnp.debug=1     [PNP]
 +                      Enable PNP debug messages (depends on the
 +                      CONFIG_PNP_DEBUG_MESSAGES option).  Change at run-time
 +                      via /sys/module/pnp/parameters/debug.  We always show
 +                      current resource usage; turning this on also shows
 +                      possible settings and some assignment information.
  
        pnpacpi=        [ACPI]
                        { off }
                        [HW,MOUSE] Controls Logitech smartscroll autorepeat.
                        0 = disabled, 1 = enabled (default).
  
 +      pstore.backend= Specify the name of the pstore backend to use
 +
        pt.             [PARIDE]
                        See Documentation/blockdev/paride.txt.
  
                        in <PAGE_SIZE> units (needed only for swap files).
                        See  Documentation/power/swsusp-and-swap-files.txt
  
 +      resumedelay=    [HIBERNATION] Delay (in seconds) to pause before attempting to
 +                      read the resume files
 +
 +      resumewait      [HIBERNATION] Wait (indefinitely) for resume device to show up.
 +                      Useful for devices that are detected asynchronously
 +                      (e.g. USB and MMC devices).
 +
        hibernate=      [HIBERNATION]
                noresume        Don't check if there's a hibernation image
                                present during boot.
        ro              [KNL] Mount root device read-only on boot
  
        root=           [KNL] Root filesystem
 +                      See name_to_dev_t comment in init/do_mounts.c.
  
        rootdelay=      [KNL] Delay (in seconds) to pause before attempting to
                        mount the root filesystem
                        Format: <integer>
  
        sonypi.*=       [HW] Sony Programmable I/O Control Device driver
 -                      See Documentation/sonypi.txt
 +                      See Documentation/laptops/sonypi.txt
  
        specialix=      [HW,SERIAL] Specialix multi-serial port adapter
                        See Documentation/serial/specialix.txt.
                        <port#>,<js1>,<js2>,<js3>,<js4>,<js5>,<js6>,<js7>
                        See also Documentation/input/joystick-parport.txt
  
 +      udbg-immortal   [PPC] When debugging early kernel crashes that
 +                      happen after console_init() and before a proper 
 +                      console driver takes over, this boot options might
 +                      help "seeing" what's going on.
 +
        uhash_entries=  [KNL,NET]
                        Set number of hash buckets for UDP/UDP-Lite connections
  
        unknown_nmi_panic
                        [X86] Cause panic on unknown NMI.
  
 +      usbcore.authorized_default=
 +                      [USB] Default USB device authorization:
 +                      (default -1 = authorized except for wireless USB,
 +                      0 = not authorized, 1 = authorized)
 +
        usbcore.autosuspend=
                        [USB] The autosuspend time delay (in seconds) used
                        for newly-detected USB devices (default 2).  This
                                        medium is write-protected).
                        Example: quirks=0419:aaf5:rl,0421:0433:rc
  
 +      user_debug=     [KNL,ARM]
 +                      Format: <int>
 +                      See arch/arm/Kconfig.debug help text.
 +                               1 - undefined instruction events
 +                               2 - system calls
 +                               4 - invalid data aborts
 +                               8 - SIGSEGV faults
 +                              16 - SIGBUS faults
 +                      Example: user_debug=31
 +
        userpte=
                        [X86] Flags controlling user PTE allocations.
  
        vmpoff=         [KNL,S390] Perform z/VM CP command after power off.
                        Format: <command>
  
 +      vsyscall=       [X86-64]
 +                      Controls the behavior of vsyscalls (i.e. calls to
 +                      fixed addresses of 0xffffffffff600x00 from legacy
 +                      code).  Most statically-linked binaries and older
 +                      versions of glibc use these calls.  Because these
 +                      functions are at fixed addresses, they make nice
 +                      targets for exploits that can control RIP.
 +
 +                      emulate     Vsyscalls turn into traps and are emulated
 +                                  reasonably safely.
 +
 +                      native      [default] Vsyscalls are native syscall
 +                                  instructions.
 +                                  This is a little bit faster than trapping
 +                                  and makes a few dynamic recompilers work
 +                                  better than they would in emulation mode.
 +                                  It also makes exploits much easier to write.
 +
 +                      none        Vsyscalls don't work at all.  This makes
 +                                  them quite hard to use for exploits but
 +                                  might break your system.
 +
        vt.cur_default= [VT] Default cursor shape.
                        Format: 0xCCBBAA, where AA, BB, and CC are the same as
                        the parameters of the <Esc>[?A;B;Cc escape sequence;
diff --combined arch/x86/Kconfig
@@@ -20,7 -20,6 +20,7 @@@ config X8
        select HAVE_UNSTABLE_SCHED_CLOCK
        select HAVE_IDE
        select HAVE_OPROFILE
 +      select HAVE_PCSPKR_PLATFORM
        select HAVE_PERF_EVENTS
        select HAVE_IRQ_WORK
        select HAVE_IOREMAP_PROT
        select HAVE_TEXT_POKE_SMP
        select HAVE_GENERIC_HARDIRQS
        select HAVE_SPARSE_IRQ
 +      select SPARSE_IRQ
        select GENERIC_FIND_FIRST_BIT
        select GENERIC_IRQ_PROBE
        select GENERIC_PENDING_IRQ if SMP
        select GENERIC_IRQ_SHOW
 +      select GENERIC_CLOCKEVENTS_MIN_ADJUST
        select IRQ_FORCED_THREADING
        select USE_GENERIC_SMP_HELPERS if SMP
        select HAVE_BPF_JIT if (X86_64 && NET)
 +      select CLKEVT_I8253
 +      select ARCH_HAVE_NMI_SAFE_CMPXCHG
  
  config INSTRUCTION_DECODER
        def_bool (KPROBES || PERF_EVENTS)
@@@ -98,10 -93,6 +98,10 @@@ config CLOCKSOURCE_WATCHDO
  config GENERIC_CLOCKEVENTS
        def_bool y
  
 +config ARCH_CLOCKSOURCE_DATA
 +      def_bool y
 +      depends on X86_64
 +
  config GENERIC_CLOCKEVENTS_BROADCAST
        def_bool y
        depends on X86_64 || (X86_32 && X86_LOCAL_APIC)
@@@ -132,7 -123,7 +132,7 @@@ config SBU
        bool
  
  config NEED_DMA_MAP_STATE
 -       def_bool (X86_64 || DMAR || DMA_API_DEBUG)
 +       def_bool (X86_64 || INTEL_IOMMU || DMA_API_DEBUG)
  
  config NEED_SG_DMA_LENGTH
        def_bool y
@@@ -222,7 -213,7 +222,7 @@@ config ARCH_SUPPORTS_DEBUG_PAGEALLO
  
  config HAVE_INTEL_TXT
        def_bool y
 -      depends on EXPERIMENTAL && DMAR && ACPI
 +      depends on EXPERIMENTAL && INTEL_IOMMU && ACPI
  
  config X86_32_SMP
        def_bool y
@@@ -281,7 -272,7 +281,7 @@@ config SM
          Y to "Enhanced Real Time Clock Support", below. The "Advanced Power
          Management" code will be disabled if you say Y here.
  
 -        See also <file:Documentation/i386/IO-APIC.txt>,
 +        See also <file:Documentation/x86/i386/IO-APIC.txt>,
          <file:Documentation/nmi_watchdog.txt> and the SMP-HOWTO available at
          <http://www.tldp.org/docs.html#howto>.
  
  
  config X86_X2APIC
        bool "Support x2apic"
 -      depends on X86_LOCAL_APIC && X86_64 && INTR_REMAP
 +      depends on X86_LOCAL_APIC && X86_64 && IRQ_REMAP
        ---help---
          This enables x2apic support on CPUs that have this feature.
  
@@@ -393,21 -384,12 +393,21 @@@ config X86_INTEL_C
          This option compiles in support for the CE4100 SOC for settop
          boxes and media devices.
  
 +config X86_INTEL_MID
 +      bool "Intel MID platform support"
 +      depends on X86_32
 +      depends on X86_EXTENDED_PLATFORM
 +      ---help---
 +        Select to build a kernel capable of supporting Intel MID platform
 +        systems which do not have the PCI legacy interfaces (Moorestown,
 +        Medfield). If you are building for a PC class system say N here.
 +
 +if X86_INTEL_MID
 +
  config X86_MRST
         bool "Moorestown MID platform"
        depends on PCI
        depends on PCI_GOANY
 -      depends on X86_32
 -      depends on X86_EXTENDED_PLATFORM
        depends on X86_IO_APIC
        select APB_TIMER
        select I2C
          nor standard legacy replacement devices/features. e.g. Moorestown does
          not contain i8259, i8254, HPET, legacy BIOS, most of the io ports.
  
 +endif
 +
  config X86_RDC321X
        bool "RDC R-321x SoC"
        depends on X86_32
@@@ -532,18 -512,6 +532,18 @@@ menuconfig PARAVIRT_GUES
  
  if PARAVIRT_GUEST
  
 +config PARAVIRT_TIME_ACCOUNTING
 +      bool "Paravirtual steal time accounting"
 +      select PARAVIRT
 +      default n
 +      ---help---
 +        Select this option to enable fine granularity task steal time
 +        accounting. Time spent executing other tasks in parallel with
 +        the current vCPU is discounted from the vCPU power. To account for
 +        that, there can be a small performance impact.
 +
 +        If in doubt, say N here.
 +
  source "arch/x86/xen/Kconfig"
  
  config KVM_CLOCK
@@@ -649,7 -617,6 +649,7 @@@ config HPET_EMULATE_RT
  config APB_TIMER
         def_bool y if MRST
         prompt "Langwell APB Timer Support" if X86_MRST
 +       select DW_APB_TIMER
         help
           APB timer is the replacement for 8254, HPET on X86 MID platforms.
           The APBT provides a stable time base on SMP
@@@ -713,6 -680,33 +713,6 @@@ config CALGARY_IOMMU_ENABLED_BY_DEFAUL
          Calgary anyway, pass 'iommu=calgary' on the kernel command line.
          If unsure, say Y.
  
 -config AMD_IOMMU
 -      bool "AMD IOMMU support"
 -      select SWIOTLB
 -      select PCI_MSI
 -      select PCI_IOV
 -      depends on X86_64 && PCI && ACPI
 -      ---help---
 -        With this option you can enable support for AMD IOMMU hardware in
 -        your system. An IOMMU is a hardware component which provides
 -        remapping of DMA memory accesses from devices. With an AMD IOMMU you
 -        can isolate the the DMA memory of different devices and protect the
 -        system from misbehaving device drivers or hardware.
 -
 -        You can find out if your system has an AMD IOMMU if you look into
 -        your BIOS for an option to enable it or if you have an IVRS ACPI
 -        table.
 -
 -config AMD_IOMMU_STATS
 -      bool "Export AMD IOMMU statistics to debugfs"
 -      depends on AMD_IOMMU
 -      select DEBUG_FS
 -      ---help---
 -        This option enables code in the AMD IOMMU driver to collect various
 -        statistics about whats happening in the driver and exports that
 -        information to userspace via debugfs.
 -        If unsure, say N.
 -
  # need this always selected by IOMMU for the VIA workaround
  config SWIOTLB
        def_bool y if X86_64
  config IOMMU_HELPER
        def_bool (CALGARY_IOMMU || GART_IOMMU || SWIOTLB || AMD_IOMMU)
  
 -config IOMMU_API
 -      def_bool (AMD_IOMMU || DMAR)
 -
  config MAXSMP
        bool "Enable Maximum number of SMP Processors and NUMA Nodes"
        depends on X86_64 && SMP && DEBUG_KERNEL && EXPERIMENTAL
@@@ -1454,6 -1451,15 +1454,15 @@@ config ARCH_USES_PG_UNCACHE
        def_bool y
        depends on X86_PAT
  
+ config ARCH_RANDOM
+       def_bool y
+       prompt "x86 architectural random number generator" if EXPERT
+       ---help---
+         Enable the x86 architectural RDRAND instruction
+         (Intel Bull Mountain technology) to generate random numbers.
+         If supported, this is a high bandwidth, cryptographically
+         secure hardware random number generator.
  config EFI
        bool "EFI runtime service support"
        depends on ACPI
@@@ -1740,8 -1746,8 +1749,8 @@@ menuconfig AP
          machines with more than one CPU.
  
          In order to use APM, you will need supporting software. For location
 -        and more information, read <file:Documentation/power/pm.txt> and the
 -        Battery Powered Linux mini-HOWTO, available from
 +        and more information, read <file:Documentation/power/apm-acpi.txt>
 +        and the Battery Powered Linux mini-HOWTO, available from
          <http://www.tldp.org/docs.html#howto>.
  
          This driver does not spin down disk drives (see the hdparm(8)
@@@ -1908,7 -1914,7 +1917,7 @@@ config PCI_BIO
  # x86-64 doesn't support PCI BIOS access from long mode so always go direct.
  config PCI_DIRECT
        def_bool y
 -      depends on PCI && (X86_64 || (PCI_GODIRECT || PCI_GOANY || PCI_GOOLPC))
 +      depends on PCI && (X86_64 || (PCI_GODIRECT || PCI_GOANY || PCI_GOOLPC || PCI_GOMMCONFIG))
  
  config PCI_MMCONFIG
        def_bool y
@@@ -1945,6 -1951,55 +1954,6 @@@ config PCI_CNB20LE_QUIR
  
          You should say N unless you know you need this.
  
 -config DMAR
 -      bool "Support for DMA Remapping Devices (EXPERIMENTAL)"
 -      depends on PCI_MSI && ACPI && EXPERIMENTAL
 -      help
 -        DMA remapping (DMAR) devices support enables independent address
 -        translations for Direct Memory Access (DMA) from devices.
 -        These DMA remapping devices are reported via ACPI tables
 -        and include PCI device scope covered by these DMA
 -        remapping devices.
 -
 -config DMAR_DEFAULT_ON
 -      def_bool y
 -      prompt "Enable DMA Remapping Devices by default"
 -      depends on DMAR
 -      help
 -        Selecting this option will enable a DMAR device at boot time if
 -        one is found. If this option is not selected, DMAR support can
 -        be enabled by passing intel_iommu=on to the kernel. It is
 -        recommended you say N here while the DMAR code remains
 -        experimental.
 -
 -config DMAR_BROKEN_GFX_WA
 -      bool "Workaround broken graphics drivers (going away soon)"
 -      depends on DMAR && BROKEN
 -      ---help---
 -        Current Graphics drivers tend to use physical address
 -        for DMA and avoid using DMA APIs. Setting this config
 -        option permits the IOMMU driver to set a unity map for
 -        all the OS-visible memory. Hence the driver can continue
 -        to use physical addresses for DMA, at least until this
 -        option is removed in the 2.6.32 kernel.
 -
 -config DMAR_FLOPPY_WA
 -      def_bool y
 -      depends on DMAR
 -      ---help---
 -        Floppy disk drivers are known to bypass DMA API calls
 -        thereby failing to work when IOMMU is enabled. This
 -        workaround will setup a 1:1 mapping for the first
 -        16MiB to make floppy (an ISA device) work.
 -
 -config INTR_REMAP
 -      bool "Support for Interrupt Remapping (EXPERIMENTAL)"
 -      depends on X86_64 && X86_IO_APIC && PCI_MSI && ACPI && EXPERIMENTAL
 -      ---help---
 -        Supports Interrupt remapping for IO-APIC and MSI devices.
 -        To use x2apic mode in the CPU's which support x2APIC enhancements or
 -        to support platforms with CPU's having > 8 bit APIC ID, say Y.
 -
  source "drivers/pci/pcie/Kconfig"
  
  source "drivers/pci/Kconfig"
@@@ -2027,58 -2082,11 +2036,58 @@@ config OLP
          Add support for detecting the unique features of the OLPC
          XO hardware.
  
 -config OLPC_XO1
 -      tristate "OLPC XO-1 support"
 -      depends on OLPC && MFD_CS5535
 +config OLPC_XO1_PM
 +      bool "OLPC XO-1 Power Management"
 +      depends on OLPC && MFD_CS5535 && PM_SLEEP
 +      select MFD_CORE
 +      ---help---
 +        Add support for poweroff and suspend of the OLPC XO-1 laptop.
 +
 +config OLPC_XO1_RTC
 +      bool "OLPC XO-1 Real Time Clock"
 +      depends on OLPC_XO1_PM && RTC_DRV_CMOS
 +      ---help---
 +        Add support for the XO-1 real time clock, which can be used as a
 +        programmable wakeup source.
 +
 +config OLPC_XO1_SCI
 +      bool "OLPC XO-1 SCI extras"
 +      depends on OLPC && OLPC_XO1_PM
 +      select POWER_SUPPLY
 +      select GPIO_CS5535
 +      select MFD_CORE
 +      ---help---
 +        Add support for SCI-based features of the OLPC XO-1 laptop:
 +         - EC-driven system wakeups
 +         - Power button
 +         - Ebook switch
 +         - Lid switch
 +         - AC adapter status updates
 +         - Battery status updates
 +
 +config OLPC_XO15_SCI
 +      bool "OLPC XO-1.5 SCI extras"
 +      depends on OLPC && ACPI
 +      select POWER_SUPPLY
 +      ---help---
 +        Add support for SCI-based features of the OLPC XO-1.5 laptop:
 +         - EC-driven system wakeups
 +         - AC adapter status updates
 +         - Battery status updates
 +
 +config ALIX
 +      bool "PCEngines ALIX System Support (LED setup)"
 +      select GPIOLIB
        ---help---
 -        Add support for non-essential features of the OLPC XO-1 laptop.
 +        This option enables system support for the PCEngines ALIX.
 +        At present this just sets up LEDs for GPIO control on
 +        ALIX2/3/6 boards.  However, other system specific setup should
 +        get added here.
 +
 +        Note: You must still enable the drivers for GPIO and LED support
 +        (GPIO_CS5535 & LEDS_GPIO) to actually use the LEDs
 +
 +        Note: You have to set alix.force=1 for boards with Award BIOS.
  
  endif # X86_32
  
@@@ -15,6 -15,7 +15,7 @@@ CFLAGS_common.o               := $(nostackp
  obj-y                 := intel_cacheinfo.o scattered.o topology.o
  obj-y                 += proc.o capflags.o powerflags.o common.o
  obj-y                 += vmware.o hypervisor.o sched.o mshyperv.o
+ obj-y                 += rdrand.o
  
  obj-$(CONFIG_X86_32)  += bugs.o
  obj-$(CONFIG_X86_64)  += bugs_64.o
@@@ -28,15 -29,10 +29,15 @@@ obj-$(CONFIG_CPU_SUP_UMC_32)               += umc.
  
  obj-$(CONFIG_PERF_EVENTS)             += perf_event.o
  
 +ifdef CONFIG_PERF_EVENTS
 +obj-$(CONFIG_CPU_SUP_AMD)             += perf_event_amd.o
 +obj-$(CONFIG_CPU_SUP_INTEL)           += perf_event_p6.o perf_event_p4.o perf_event_intel_lbr.o perf_event_intel_ds.o perf_event_intel.o
 +endif
 +
  obj-$(CONFIG_X86_MCE)                 += mcheck/
  obj-$(CONFIG_MTRR)                    += mtrr/
  
 -obj-$(CONFIG_X86_LOCAL_APIC)          += perfctr-watchdog.o
 +obj-$(CONFIG_X86_LOCAL_APIC)          += perfctr-watchdog.o perf_event_amd_ibs.o
  
  quiet_cmd_mkcapflags = MKCAP   $@
        cmd_mkcapflags = $(PERL) $(srctree)/$(src)/mkcapflags.pl $< $@
  #include <asm/stackprotector.h>
  #include <asm/perf_event.h>
  #include <asm/mmu_context.h>
+ #include <asm/archrandom.h>
  #include <asm/hypervisor.h>
  #include <asm/processor.h>
  #include <asm/sections.h>
  #include <linux/topology.h>
  #include <linux/cpumask.h>
  #include <asm/pgtable.h>
 -#include <asm/atomic.h>
 +#include <linux/atomic.h>
  #include <asm/proto.h>
  #include <asm/setup.h>
  #include <asm/apic.h>
@@@ -681,9 -682,6 +682,9 @@@ static void __init early_identify_cpu(s
        filter_cpuid_features(c, false);
  
        setup_smep(c);
 +
 +      if (this_cpu->c_bsp_init)
 +              this_cpu->c_bsp_init(c);
  }
  
  void __init early_cpu_init(void)
@@@ -860,6 -858,7 +861,7 @@@ static void __cpuinit identify_cpu(stru
  #endif
  
        init_hypervisor(c);
+       x86_init_rdrand(c);
  
        /*
         * Clear/Set all flags overriden by options, need do it
diff --combined drivers/char/random.c
@@@ -932,7 -932,21 +932,21 @@@ static ssize_t extract_entropy_user(str
   */
  void get_random_bytes(void *buf, int nbytes)
  {
-       extract_entropy(&nonblocking_pool, buf, nbytes, 0, 0);
+       char *p = buf;
+       while (nbytes) {
+               unsigned long v;
+               int chunk = min(nbytes, (int)sizeof(unsigned long));
+               
+               if (!arch_get_random_long(&v))
+                       break;
+               
+               memcpy(buf, &v, chunk);
+               p += chunk;
+               nbytes -= chunk;
+       }
+       extract_entropy(&nonblocking_pool, p, nbytes, 0, 0);
  }
  EXPORT_SYMBOL(get_random_bytes);
  
@@@ -1300,14 -1314,330 +1314,14 @@@ ctl_table random_table[] = 
  };
  #endif        /* CONFIG_SYSCTL */
  
 -/********************************************************************
 - *
 - * Random functions for networking
 - *
 - ********************************************************************/
 -
 -/*
 - * TCP initial sequence number picking.  This uses the random number
 - * generator to pick an initial secret value.  This value is hashed
 - * along with the TCP endpoint information to provide a unique
 - * starting point for each pair of TCP endpoints.  This defeats
 - * attacks which rely on guessing the initial TCP sequence number.
 - * This algorithm was suggested by Steve Bellovin.
 - *
 - * Using a very strong hash was taking an appreciable amount of the total
 - * TCP connection establishment time, so this is a weaker hash,
 - * compensated for by changing the secret periodically.
 - */
 -
 -/* F, G and H are basic MD4 functions: selection, majority, parity */
 -#define F(x, y, z) ((z) ^ ((x) & ((y) ^ (z))))
 -#define G(x, y, z) (((x) & (y)) + (((x) ^ (y)) & (z)))
 -#define H(x, y, z) ((x) ^ (y) ^ (z))
 -
 -/*
 - * The generic round function.  The application is so specific that
 - * we don't bother protecting all the arguments with parens, as is generally
 - * good macro practice, in favor of extra legibility.
 - * Rotation is separate from addition to prevent recomputation
 - */
 -#define ROUND(f, a, b, c, d, x, s)    \
 -      (a += f(b, c, d) + x, a = (a << s) | (a >> (32 - s)))
 -#define K1 0
 -#define K2 013240474631UL
 -#define K3 015666365641UL
 +static u32 random_int_secret[MD5_MESSAGE_BYTES / 4] ____cacheline_aligned;
  
 -#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
 -
 -static __u32 twothirdsMD4Transform(__u32 const buf[4], __u32 const in[12])
 +static int __init random_int_secret_init(void)
  {
 -      __u32 a = buf[0], b = buf[1], c = buf[2], d = buf[3];
 -
 -      /* Round 1 */
 -      ROUND(F, a, b, c, d, in[ 0] + K1,  3);
 -      ROUND(F, d, a, b, c, in[ 1] + K1,  7);
 -      ROUND(F, c, d, a, b, in[ 2] + K1, 11);
 -      ROUND(F, b, c, d, a, in[ 3] + K1, 19);
 -      ROUND(F, a, b, c, d, in[ 4] + K1,  3);
 -      ROUND(F, d, a, b, c, in[ 5] + K1,  7);
 -      ROUND(F, c, d, a, b, in[ 6] + K1, 11);
 -      ROUND(F, b, c, d, a, in[ 7] + K1, 19);
 -      ROUND(F, a, b, c, d, in[ 8] + K1,  3);
 -      ROUND(F, d, a, b, c, in[ 9] + K1,  7);
 -      ROUND(F, c, d, a, b, in[10] + K1, 11);
 -      ROUND(F, b, c, d, a, in[11] + K1, 19);
 -
 -      /* Round 2 */
 -      ROUND(G, a, b, c, d, in[ 1] + K2,  3);
 -      ROUND(G, d, a, b, c, in[ 3] + K2,  5);
 -      ROUND(G, c, d, a, b, in[ 5] + K2,  9);
 -      ROUND(G, b, c, d, a, in[ 7] + K2, 13);
 -      ROUND(G, a, b, c, d, in[ 9] + K2,  3);
 -      ROUND(G, d, a, b, c, in[11] + K2,  5);
 -      ROUND(G, c, d, a, b, in[ 0] + K2,  9);
 -      ROUND(G, b, c, d, a, in[ 2] + K2, 13);
 -      ROUND(G, a, b, c, d, in[ 4] + K2,  3);
 -      ROUND(G, d, a, b, c, in[ 6] + K2,  5);
 -      ROUND(G, c, d, a, b, in[ 8] + K2,  9);
 -      ROUND(G, b, c, d, a, in[10] + K2, 13);
 -
 -      /* Round 3 */
 -      ROUND(H, a, b, c, d, in[ 3] + K3,  3);
 -      ROUND(H, d, a, b, c, in[ 7] + K3,  9);
 -      ROUND(H, c, d, a, b, in[11] + K3, 11);
 -      ROUND(H, b, c, d, a, in[ 2] + K3, 15);
 -      ROUND(H, a, b, c, d, in[ 6] + K3,  3);
 -      ROUND(H, d, a, b, c, in[10] + K3,  9);
 -      ROUND(H, c, d, a, b, in[ 1] + K3, 11);
 -      ROUND(H, b, c, d, a, in[ 5] + K3, 15);
 -      ROUND(H, a, b, c, d, in[ 9] + K3,  3);
 -      ROUND(H, d, a, b, c, in[ 0] + K3,  9);
 -      ROUND(H, c, d, a, b, in[ 4] + K3, 11);
 -      ROUND(H, b, c, d, a, in[ 8] + K3, 15);
 -
 -      return buf[1] + b; /* "most hashed" word */
 -      /* Alternative: return sum of all words? */
 -}
 -#endif
 -
 -#undef ROUND
 -#undef F
 -#undef G
 -#undef H
 -#undef K1
 -#undef K2
 -#undef K3
 -
 -/* This should not be decreased so low that ISNs wrap too fast. */
 -#define REKEY_INTERVAL (300 * HZ)
 -/*
 - * Bit layout of the tcp sequence numbers (before adding current time):
 - * bit 24-31: increased after every key exchange
 - * bit 0-23: hash(source,dest)
 - *
 - * The implementation is similar to the algorithm described
 - * in the Appendix of RFC 1185, except that
 - * - it uses a 1 MHz clock instead of a 250 kHz clock
 - * - it performs a rekey every 5 minutes, which is equivalent
 - *    to a (source,dest) tulple dependent forward jump of the
 - *    clock by 0..2^(HASH_BITS+1)
 - *
 - * Thus the average ISN wraparound time is 68 minutes instead of
 - * 4.55 hours.
 - *
 - * SMP cleanup and lock avoidance with poor man's RCU.
 - *                    Manfred Spraul <manfred@colorfullife.com>
 - *
 - */
 -#define COUNT_BITS 8
 -#define COUNT_MASK ((1 << COUNT_BITS) - 1)
 -#define HASH_BITS 24
 -#define HASH_MASK ((1 << HASH_BITS) - 1)
 -
 -static struct keydata {
 -      __u32 count; /* already shifted to the final position */
 -      __u32 secret[12];
 -} ____cacheline_aligned ip_keydata[2];
 -
 -static unsigned int ip_cnt;
 -
 -static void rekey_seq_generator(struct work_struct *work);
 -
 -static DECLARE_DELAYED_WORK(rekey_work, rekey_seq_generator);
 -
 -/*
 - * Lock avoidance:
 - * The ISN generation runs lockless - it's just a hash over random data.
 - * State changes happen every 5 minutes when the random key is replaced.
 - * Synchronization is performed by having two copies of the hash function
 - * state and rekey_seq_generator always updates the inactive copy.
 - * The copy is then activated by updating ip_cnt.
 - * The implementation breaks down if someone blocks the thread
 - * that processes SYN requests for more than 5 minutes. Should never
 - * happen, and even if that happens only a not perfectly compliant
 - * ISN is generated, nothing fatal.
 - */
 -static void rekey_seq_generator(struct work_struct *work)
 -{
 -      struct keydata *keyptr = &ip_keydata[1 ^ (ip_cnt & 1)];
 -
 -      get_random_bytes(keyptr->secret, sizeof(keyptr->secret));
 -      keyptr->count = (ip_cnt & COUNT_MASK) << HASH_BITS;
 -      smp_wmb();
 -      ip_cnt++;
 -      schedule_delayed_work(&rekey_work,
 -                            round_jiffies_relative(REKEY_INTERVAL));
 -}
 -
 -static inline struct keydata *get_keyptr(void)
 -{
 -      struct keydata *keyptr = &ip_keydata[ip_cnt & 1];
 -
 -      smp_rmb();
 -
 -      return keyptr;
 -}
 -
 -static __init int seqgen_init(void)
 -{
 -      rekey_seq_generator(NULL);
 +      get_random_bytes(random_int_secret, sizeof(random_int_secret));
        return 0;
  }
 -late_initcall(seqgen_init);
 -
 -#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
 -__u32 secure_tcpv6_sequence_number(__be32 *saddr, __be32 *daddr,
 -                                 __be16 sport, __be16 dport)
 -{
 -      __u32 seq;
 -      __u32 hash[12];
 -      struct keydata *keyptr = get_keyptr();
 -
 -      /* The procedure is the same as for IPv4, but addresses are longer.
 -       * Thus we must use twothirdsMD4Transform.
 -       */
 -
 -      memcpy(hash, saddr, 16);
 -      hash[4] = ((__force u16)sport << 16) + (__force u16)dport;
 -      memcpy(&hash[5], keyptr->secret, sizeof(__u32) * 7);
 -
 -      seq = twothirdsMD4Transform((const __u32 *)daddr, hash) & HASH_MASK;
 -      seq += keyptr->count;
 -
 -      seq += ktime_to_ns(ktime_get_real());
 -
 -      return seq;
 -}
 -EXPORT_SYMBOL(secure_tcpv6_sequence_number);
 -#endif
 -
 -/*  The code below is shamelessly stolen from secure_tcp_sequence_number().
 - *  All blames to Andrey V. Savochkin <saw@msu.ru>.
 - */
 -__u32 secure_ip_id(__be32 daddr)
 -{
 -      struct keydata *keyptr;
 -      __u32 hash[4];
 -
 -      keyptr = get_keyptr();
 -
 -      /*
 -       *  Pick a unique starting offset for each IP destination.
 -       *  The dest ip address is placed in the starting vector,
 -       *  which is then hashed with random data.
 -       */
 -      hash[0] = (__force __u32)daddr;
 -      hash[1] = keyptr->secret[9];
 -      hash[2] = keyptr->secret[10];
 -      hash[3] = keyptr->secret[11];
 -
 -      return half_md4_transform(hash, keyptr->secret);
 -}
 -
 -#ifdef CONFIG_INET
 -
 -__u32 secure_tcp_sequence_number(__be32 saddr, __be32 daddr,
 -                               __be16 sport, __be16 dport)
 -{
 -      __u32 seq;
 -      __u32 hash[4];
 -      struct keydata *keyptr = get_keyptr();
 -
 -      /*
 -       *  Pick a unique starting offset for each TCP connection endpoints
 -       *  (saddr, daddr, sport, dport).
 -       *  Note that the words are placed into the starting vector, which is
 -       *  then mixed with a partial MD4 over random data.
 -       */
 -      hash[0] = (__force u32)saddr;
 -      hash[1] = (__force u32)daddr;
 -      hash[2] = ((__force u16)sport << 16) + (__force u16)dport;
 -      hash[3] = keyptr->secret[11];
 -
 -      seq = half_md4_transform(hash, keyptr->secret) & HASH_MASK;
 -      seq += keyptr->count;
 -      /*
 -       *      As close as possible to RFC 793, which
 -       *      suggests using a 250 kHz clock.
 -       *      Further reading shows this assumes 2 Mb/s networks.
 -       *      For 10 Mb/s Ethernet, a 1 MHz clock is appropriate.
 -       *      For 10 Gb/s Ethernet, a 1 GHz clock should be ok, but
 -       *      we also need to limit the resolution so that the u32 seq
 -       *      overlaps less than one time per MSL (2 minutes).
 -       *      Choosing a clock of 64 ns period is OK. (period of 274 s)
 -       */
 -      seq += ktime_to_ns(ktime_get_real()) >> 6;
 -
 -      return seq;
 -}
 -
 -/* Generate secure starting point for ephemeral IPV4 transport port search */
 -u32 secure_ipv4_port_ephemeral(__be32 saddr, __be32 daddr, __be16 dport)
 -{
 -      struct keydata *keyptr = get_keyptr();
 -      u32 hash[4];
 -
 -      /*
 -       *  Pick a unique starting offset for each ephemeral port search
 -       *  (saddr, daddr, dport) and 48bits of random data.
 -       */
 -      hash[0] = (__force u32)saddr;
 -      hash[1] = (__force u32)daddr;
 -      hash[2] = (__force u32)dport ^ keyptr->secret[10];
 -      hash[3] = keyptr->secret[11];
 -
 -      return half_md4_transform(hash, keyptr->secret);
 -}
 -EXPORT_SYMBOL_GPL(secure_ipv4_port_ephemeral);
 -
 -#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
 -u32 secure_ipv6_port_ephemeral(const __be32 *saddr, const __be32 *daddr,
 -                             __be16 dport)
 -{
 -      struct keydata *keyptr = get_keyptr();
 -      u32 hash[12];
 -
 -      memcpy(hash, saddr, 16);
 -      hash[4] = (__force u32)dport;
 -      memcpy(&hash[5], keyptr->secret, sizeof(__u32) * 7);
 -
 -      return twothirdsMD4Transform((const __u32 *)daddr, hash);
 -}
 -#endif
 -
 -#if defined(CONFIG_IP_DCCP) || defined(CONFIG_IP_DCCP_MODULE)
 -/* Similar to secure_tcp_sequence_number but generate a 48 bit value
 - * bit's 32-47 increase every key exchange
 - *       0-31  hash(source, dest)
 - */
 -u64 secure_dccp_sequence_number(__be32 saddr, __be32 daddr,
 -                              __be16 sport, __be16 dport)
 -{
 -      u64 seq;
 -      __u32 hash[4];
 -      struct keydata *keyptr = get_keyptr();
 -
 -      hash[0] = (__force u32)saddr;
 -      hash[1] = (__force u32)daddr;
 -      hash[2] = ((__force u16)sport << 16) + (__force u16)dport;
 -      hash[3] = keyptr->secret[11];
 -
 -      seq = half_md4_transform(hash, keyptr->secret);
 -      seq |= ((u64)keyptr->count) << (32 - HASH_BITS);
 -
 -      seq += ktime_to_ns(ktime_get_real());
 -      seq &= (1ull << 48) - 1;
 -
 -      return seq;
 -}
 -EXPORT_SYMBOL(secure_dccp_sequence_number);
 -#endif
 -
 -#endif /* CONFIG_INET */
 -
 +late_initcall(random_int_secret_init);
  
  /*
   * Get a random word for internal kernel use only. Similar to urandom but
   * value is not cryptographically secure but for several uses the cost of
   * depleting entropy is too high
   */
 -DEFINE_PER_CPU(__u32 [4], get_random_int_hash);
 +DEFINE_PER_CPU(__u32 [MD5_DIGEST_WORDS], get_random_int_hash);
  unsigned int get_random_int(void)
  {
-       __u32 *hash = get_cpu_var(get_random_int_hash);
 -      struct keydata *keyptr;
+       __u32 *hash;
        unsigned int ret;
  
 -      keyptr = get_keyptr();
+       if (arch_get_random_int(&ret))
+               return ret;
+       hash = get_cpu_var(get_random_int_hash);
        hash[0] += current->pid + jiffies + get_cycles();
 -
 -      ret = half_md4_transform(hash, keyptr->secret);
 +      md5_transform(hash, random_int_secret);
 +      ret = hash[0];
        put_cpu_var(get_random_int_hash);
  
        return ret;
diff --combined include/linux/random.h
@@@ -57,6 -57,17 +57,6 @@@ extern void add_interrupt_randomness(in
  extern void get_random_bytes(void *buf, int nbytes);
  void generate_random_uuid(unsigned char uuid_out[16]);
  
 -extern __u32 secure_ip_id(__be32 daddr);
 -extern u32 secure_ipv4_port_ephemeral(__be32 saddr, __be32 daddr, __be16 dport);
 -extern u32 secure_ipv6_port_ephemeral(const __be32 *saddr, const __be32 *daddr,
 -                                    __be16 dport);
 -extern __u32 secure_tcp_sequence_number(__be32 saddr, __be32 daddr,
 -                                      __be16 sport, __be16 dport);
 -extern __u32 secure_tcpv6_sequence_number(__be32 *saddr, __be32 *daddr,
 -                                        __be16 sport, __be16 dport);
 -extern u64 secure_dccp_sequence_number(__be32 saddr, __be32 daddr,
 -                                     __be16 sport, __be16 dport);
 -
  #ifndef MODULE
  extern const struct file_operations random_fops, urandom_fops;
  #endif
@@@ -91,6 -102,19 +91,19 @@@ static inline void prandom32_seed(struc
        state->s3 = __seed(i, 15);
  }
  
+ #ifdef CONFIG_ARCH_RANDOM
+ # include <asm/archrandom.h>
+ #else
+ static inline int arch_get_random_long(unsigned long *v)
+ {
+       return 0;
+ }
+ static inline int arch_get_random_int(unsigned int *v)
+ {
+       return 0;
+ }
+ #endif
  #endif /* __KERNEL___ */
  
  #endif /* _LINUX_RANDOM_H */