From 6412cb57e9e2b655a007a221e5ff6a0f3d62ee27 Mon Sep 17 00:00:00 2001 From: "David S. Miller" Date: Tue, 2 Oct 2012 22:34:04 -0400 Subject: [PATCH] --- yaml --- r: 330204 b: refs/heads/master c: da1586461e53a4dd045738cce309ab488970f0ef h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/Documentation/ABI/testing/ima_policy | 25 +- .../ABI/testing/sysfs-devices-system-cpu | 11 - .../ABI/testing/sysfs-driver-ppi | 70 - trunk/Documentation/CodingStyle | 10 - trunk/Documentation/DocBook/drm.tmpl | 2835 ++------- trunk/Documentation/aoe/aoe.txt | 58 +- trunk/Documentation/aoe/mkdevs.sh | 41 + trunk/Documentation/aoe/mkshelf.sh | 28 + trunk/Documentation/aoe/status.sh | 3 - trunk/Documentation/cpu-freq/boost.txt | 93 - trunk/Documentation/cpuidle/sysfs.txt | 10 +- .../bindings/arm/calxeda/combophy.txt | 17 - .../devicetree/bindings/ata/ahci-platform.txt | 9 - .../devicetree/bindings/ata/pata-arasan.txt | 17 - .../bindings/cpufreq/cpufreq-cpu0.txt | 55 - .../devicetree/bindings/crypto/fsl-sec4.txt | 51 - .../devicetree/bindings/dma/arm-pl330.txt | 3 - .../interrupt-controller/interrupts.txt | 95 - .../devicetree/bindings/mfd/88pm860x.txt | 85 - .../devicetree/bindings/mfd/syscon.txt | 20 - .../devicetree/bindings/mfd/tps65910.txt | 4 - .../devicetree/bindings/mfd/twl4030-audio.txt | 46 - .../devicetree/bindings/mfd/twl6040.txt | 9 +- .../devicetree/bindings/net/calxeda-xgmac.txt | 3 - .../devicetree/bindings/power/opp.txt | 25 - .../devicetree/bindings/pwm/mxs-pwm.txt | 2 +- .../bindings/regulator/88pm860x.txt | 30 - .../devicetree/bindings/regulator/max8907.txt | 69 - .../bindings/regulator/tps6586x.txt | 6 - .../devicetree/bindings/rtc/snvs-rtc.txt | 1 - .../bindings/serial/fsl-imx-uart.txt | 35 - .../bindings/video/backlight/88pm860x.txt | 15 - trunk/Documentation/filesystems/jfs.txt | 19 +- trunk/Documentation/kbuild/makefiles.txt | 8 +- trunk/Documentation/kernel-parameters.txt | 11 - trunk/Documentation/printk-formats.txt | 1 - trunk/Documentation/remoteproc.txt | 7 - trunk/Documentation/rtc.txt | 5 +- .../Documentation/scsi/ChangeLog.megaraid_sas | 10 - trunk/Documentation/scsi/LICENSE.qla2xxx | 2 +- trunk/Documentation/scsi/LICENSE.qla4xxx | 2 +- trunk/Documentation/scsi/st.txt | 6 +- trunk/Documentation/security/Smack.txt | 10 +- trunk/Documentation/smsc_ece1099.txt | 56 - trunk/Documentation/sysctl/kernel.txt | 2 - trunk/Documentation/virtual/kvm/api.txt | 33 +- .../Documentation/virtual/kvm/hypercalls.txt | 66 - trunk/Documentation/virtual/kvm/msr.txt | 32 +- trunk/Documentation/virtual/kvm/ppc-pv.txt | 22 - trunk/MAINTAINERS | 57 +- trunk/Makefile | 43 +- trunk/arch/alpha/include/uapi/asm/Kbuild | 3 - trunk/arch/alpha/kernel/osf_sys.c | 13 +- trunk/arch/arm/Makefile | 1 - trunk/arch/arm/boot/dts/highbank.dts | 18 - trunk/arch/arm/boot/dts/imx6q.dtsi | 9 +- trunk/arch/arm/boot/dts/pxa910-dkb.dts | 137 - trunk/arch/arm/boot/dts/pxa910.dtsi | 4 - trunk/arch/arm/configs/sam9_l9260_defconfig | 2 +- trunk/arch/arm/crypto/Makefile | 9 - trunk/arch/arm/crypto/aes-armv4.S | 1112 ---- trunk/arch/arm/crypto/aes_glue.c | 108 - trunk/arch/arm/crypto/sha1-armv4-large.S | 503 -- trunk/arch/arm/crypto/sha1_glue.c | 179 - trunk/arch/arm/include/asm/barrier.h | 7 +- trunk/arch/arm/include/asm/dma-mapping.h | 1 - trunk/arch/arm/include/asm/memory.h | 8 + trunk/arch/arm/include/asm/page.h | 2 +- trunk/arch/arm/include/asm/pgtable.h | 2 +- trunk/arch/arm/include/asm/vfpmacros.h | 2 +- trunk/arch/arm/include/uapi/asm/Kbuild | 3 - trunk/arch/arm/kernel/smp.c | 54 - trunk/arch/arm/mach-at91/clock.c | 2 +- .../arm/mach-davinci/board-tnetv107x-evm.c | 6 +- trunk/arch/arm/mach-davinci/da830.c | 48 +- trunk/arch/arm/mach-davinci/da850.c | 6 +- trunk/arch/arm/mach-highbank/highbank.c | 52 - trunk/arch/arm/mach-imx/Kconfig | 2 +- trunk/arch/arm/mach-imx/mach-imx6q.c | 47 +- trunk/arch/arm/mach-msm/board-qsd8x50.c | 4 +- trunk/arch/arm/mach-omap2/display.c | 6 +- trunk/arch/arm/mach-omap2/usb-host.c | 31 +- trunk/arch/arm/mach-shmobile/Makefile | 2 +- trunk/arch/arm/mach-shmobile/board-ap4evb.c | 21 +- .../arm/mach-shmobile/board-armadillo800eva.c | 6 +- trunk/arch/arm/mach-shmobile/board-mackerel.c | 34 +- trunk/arch/arm/mach-shmobile/common.c | 24 + trunk/arch/arm/mach-shmobile/cpuidle.c | 39 +- .../arm/mach-shmobile/include/mach/common.h | 14 +- .../mach-shmobile/include/mach/pm-rmobile.h | 35 +- .../arm/mach-shmobile/include/mach/r8a7740.h | 6 +- .../arm/mach-shmobile/include/mach/r8a7779.h | 12 +- .../arm/mach-shmobile/include/mach/sh7372.h | 20 +- trunk/arch/arm/mach-shmobile/pm-r8a7740.c | 42 +- trunk/arch/arm/mach-shmobile/pm-r8a7779.c | 71 +- trunk/arch/arm/mach-shmobile/pm-rmobile.c | 33 +- trunk/arch/arm/mach-shmobile/pm-sh7372.c | 283 +- trunk/arch/arm/mach-shmobile/setup-r8a7740.c | 27 +- trunk/arch/arm/mach-shmobile/setup-r8a7779.c | 5 +- trunk/arch/arm/mach-shmobile/setup-sh7372.c | 69 +- trunk/arch/arm/mach-u300/i2c.c | 2 +- trunk/arch/arm/mm/dma-mapping.c | 264 +- trunk/arch/arm/mm/mmu.c | 11 + trunk/arch/arm/plat-omap/include/plat/usb.h | 7 - trunk/arch/arm64/include/asm/compat.h | 60 +- trunk/arch/arm64/include/uapi/asm/Kbuild | 3 - trunk/arch/arm64/kernel/signal32.c | 53 + trunk/arch/avr32/include/asm/elf.h | 3 +- trunk/arch/avr32/include/uapi/asm/Kbuild | 3 - trunk/arch/blackfin/include/asm/elf.h | 3 +- trunk/arch/blackfin/include/uapi/asm/Kbuild | 3 - trunk/arch/c6x/include/asm/elf.h | 3 +- trunk/arch/c6x/include/uapi/asm/Kbuild | 3 - trunk/arch/cris/Kconfig | 5 + trunk/arch/cris/Makefile | 4 +- .../arch/cris/arch-v32/drivers/axisflashmap.c | 29 + trunk/arch/cris/arch-v32/drivers/pci/bios.c | 25 + trunk/arch/cris/arch-v32/kernel/head.S | 58 +- trunk/arch/cris/arch-v32/kernel/kgdb.c | 14 + trunk/arch/cris/arch-v32/mach-a3/Makefile | 2 + trunk/arch/cris/arch-v32/mach-a3/vcs_hook.c | 103 + trunk/arch/cris/arch-v32/mach-a3/vcs_hook.h | 58 + trunk/arch/cris/arch-v32/mach-fs/Makefile | 2 + trunk/arch/cris/arch-v32/mach-fs/vcs_hook.c | 100 + trunk/arch/cris/arch-v32/mach-fs/vcs_hook.h | 42 + trunk/arch/cris/arch-v32/mm/init.c | 8 + .../cris/include/arch-v10/arch/sv_addr_ag.h | 2 +- .../arch/cris/include/arch-v10/arch/svinto.h | 2 +- trunk/arch/cris/include/arch-v32/arch/dma.h | 2 +- .../cris/include/arch-v32/arch/hwregs/dma.h | 2 +- trunk/arch/cris/include/arch-v32/arch/page.h | 5 + .../cris/include/arch-v32/arch/processor.h | 6 +- .../include/arch-v32/mach-fs/mach/startup.inc | 6 + trunk/arch/cris/include/asm/elf.h | 3 +- trunk/arch/cris/include/asm/pci.h | 1 + .../cris/include/uapi/arch-v10/arch/Kbuild | 1 - .../cris/include/uapi/arch-v32/arch/Kbuild | 1 - trunk/arch/cris/include/uapi/asm/Kbuild | 5 - trunk/arch/frv/include/asm/elf.h | 3 +- trunk/arch/frv/include/uapi/asm/Kbuild | 3 - trunk/arch/frv/kernel/pm.c | 19 +- trunk/arch/frv/kernel/setup.c | 2 +- trunk/arch/frv/mb93090-mb00/pci-irq.c | 2 +- trunk/arch/h8300/include/asm/elf.h | 3 +- trunk/arch/h8300/include/uapi/asm/Kbuild | 3 - trunk/arch/h8300/kernel/sys_h8300.c | 1 - trunk/arch/h8300/kernel/timer/itu.c | 2 +- trunk/arch/h8300/kernel/timer/timer16.c | 2 +- trunk/arch/h8300/kernel/timer/timer8.c | 2 +- trunk/arch/h8300/kernel/timer/tpu.c | 2 +- trunk/arch/h8300/platform/h8300h/irq.c | 4 +- trunk/arch/h8300/platform/h8s/irq.c | 4 +- trunk/arch/hexagon/include/asm/elf.h | 3 +- trunk/arch/hexagon/include/uapi/asm/Kbuild | 3 - trunk/arch/ia64/include/asm/xen/interface.h | 7 +- trunk/arch/ia64/include/uapi/asm/Kbuild | 3 - trunk/arch/ia64/kernel/perfmon.c | 18 +- trunk/arch/ia64/kvm/kvm-ia64.c | 41 +- trunk/arch/ia64/xen/irq_xen.c | 2 +- trunk/arch/ia64/xen/irq_xen.h | 2 +- trunk/arch/m32r/include/asm/elf.h | 3 +- trunk/arch/m32r/include/uapi/asm/Kbuild | 3 - trunk/arch/m68k/include/asm/cacheflush.h | 4 +- trunk/arch/m68k/include/asm/elf.h | 3 +- trunk/arch/m68k/include/asm/io.h | 4 +- trunk/arch/m68k/include/asm/m68360.h | 8 +- trunk/arch/m68k/include/asm/m68360_enet.h | 2 +- trunk/arch/m68k/include/asm/page.h | 4 +- trunk/arch/m68k/include/asm/pgtable.h | 4 +- trunk/arch/m68k/include/asm/q40_master.h | 2 +- trunk/arch/m68k/include/asm/uaccess.h | 4 +- trunk/arch/m68k/include/uapi/asm/Kbuild | 3 - trunk/arch/microblaze/include/asm/elf.h | 3 +- .../arch/microblaze/include/asm/mmu_context.h | 2 +- trunk/arch/microblaze/include/uapi/asm/Kbuild | 3 - .../arch/mips/bcm63xx/boards/board_bcm963xx.c | 2 +- trunk/arch/mips/include/asm/compat-signal.h | 62 + trunk/arch/mips/include/asm/compat.h | 69 +- .../include/asm/mach-bcm63xx/bcm63xx_io.h | 2 +- .../arch/mips/include/asm/mach-pnx833x/gpio.h | 2 +- trunk/arch/mips/include/asm/octeon/cvmx-asm.h | 2 +- .../mips/include/asm/octeon/cvmx-cmd-queue.h | 2 +- trunk/arch/mips/include/asm/octeon/cvmx-fpa.h | 4 +- .../include/asm/octeon/cvmx-helper-board.h | 2 +- .../mips/include/asm/octeon/cvmx-helper.h | 20 +- .../arch/mips/include/asm/octeon/cvmx-mdio.h | 2 +- trunk/arch/mips/include/asm/octeon/cvmx-pip.h | 6 +- trunk/arch/mips/include/asm/octeon/cvmx-pko.h | 8 +- trunk/arch/mips/include/asm/octeon/cvmx-pow.h | 4 +- trunk/arch/mips/include/asm/octeon/cvmx-spi.h | 2 +- .../mips/include/asm/octeon/cvmx-spinlock.h | 2 +- trunk/arch/mips/include/asm/octeon/cvmx-wqe.h | 2 +- trunk/arch/mips/include/asm/octeon/cvmx.h | 36 +- .../mips/include/asm/octeon/octeon-model.h | 2 +- trunk/arch/mips/include/asm/octeon/octeon.h | 2 +- .../mips/include/asm/sibyte/bcm1480_int.h | 2 +- .../mips/include/asm/sibyte/bcm1480_l2c.h | 2 +- .../arch/mips/include/asm/sibyte/bcm1480_mc.h | 2 +- .../mips/include/asm/sibyte/bcm1480_regs.h | 4 +- .../mips/include/asm/sibyte/bcm1480_scd.h | 4 +- .../arch/mips/include/asm/sibyte/sb1250_dma.h | 2 +- .../mips/include/asm/sibyte/sb1250_genbus.h | 2 +- .../arch/mips/include/asm/sibyte/sb1250_int.h | 2 +- .../arch/mips/include/asm/sibyte/sb1250_l2c.h | 2 +- .../arch/mips/include/asm/sibyte/sb1250_ldt.h | 2 +- .../arch/mips/include/asm/sibyte/sb1250_mac.h | 2 +- .../arch/mips/include/asm/sibyte/sb1250_mc.h | 2 +- .../mips/include/asm/sibyte/sb1250_regs.h | 2 +- .../arch/mips/include/asm/sibyte/sb1250_scd.h | 2 +- .../mips/include/asm/sibyte/sb1250_smbus.h | 2 +- .../mips/include/asm/sibyte/sb1250_syncser.h | 2 +- .../mips/include/asm/sibyte/sb1250_uart.h | 2 +- trunk/arch/mips/include/uapi/asm/Kbuild | 3 - trunk/arch/mips/pci/pci-octeon.c | 2 +- trunk/arch/mn10300/Makefile | 2 +- trunk/arch/mn10300/include/asm/elf.h | 3 +- trunk/arch/mn10300/include/uapi/asm/Kbuild | 3 - trunk/arch/openrisc/include/asm/elf.h | 3 +- trunk/arch/openrisc/include/uapi/asm/Kbuild | 3 - trunk/arch/parisc/Kconfig | 1 - trunk/arch/parisc/hpux/fs.c | 17 +- trunk/arch/parisc/include/asm/compat.h | 59 +- trunk/arch/parisc/include/uapi/asm/Kbuild | 3 - trunk/arch/parisc/kernel/signal32.h | 52 + trunk/arch/powerpc/configs/ppc64_defconfig | 3 +- trunk/arch/powerpc/configs/pseries_defconfig | 3 +- trunk/arch/powerpc/include/asm/bitops.h | 10 - trunk/arch/powerpc/include/asm/compat.h | 60 +- trunk/arch/powerpc/include/asm/kvm_host.h | 3 - trunk/arch/powerpc/include/asm/ps3.h | 2 +- trunk/arch/powerpc/include/asm/siginfo.h | 1 + trunk/arch/powerpc/include/asm/systbl.h | 4 +- trunk/arch/powerpc/include/asm/ucc_fast.h | 2 +- trunk/arch/powerpc/include/asm/ucc_slow.h | 2 +- trunk/arch/powerpc/include/asm/unistd.h | 1 - trunk/arch/powerpc/include/uapi/asm/Kbuild | 3 - trunk/arch/powerpc/kernel/ppc32.h | 51 + trunk/arch/powerpc/kernel/prom_init.c | 66 +- trunk/arch/powerpc/kernel/sys_ppc32.c | 45 +- trunk/arch/powerpc/kvm/44x_tlb.c | 1 + trunk/arch/powerpc/kvm/book3s_64_mmu_hv.c | 51 +- trunk/arch/powerpc/kvm/book3s_hv_rm_mmu.c | 6 +- trunk/arch/powerpc/kvm/book3s_pr.c | 4 +- trunk/arch/powerpc/kvm/e500_tlb.c | 3 +- trunk/arch/powerpc/kvm/powerpc.c | 14 +- .../powerpc/platforms/40x/ppc40x_simple.c | 2 +- .../powerpc/platforms/512x/mpc5121_generic.c | 2 +- trunk/arch/powerpc/platforms/52xx/lite5200.c | 2 +- trunk/arch/powerpc/platforms/52xx/media5200.c | 2 +- .../arch/powerpc/platforms/83xx/mpc837x_rdb.c | 2 +- trunk/arch/powerpc/platforms/85xx/tqm85xx.c | 2 +- .../powerpc/platforms/cell/spu_syscalls.c | 21 +- .../powerpc/platforms/cell/spufs/coredump.c | 40 +- trunk/arch/s390/crypto/aes_s390.c | 5 + trunk/arch/s390/crypto/des_s390.c | 10 + trunk/arch/s390/crypto/ghash_s390.c | 1 + trunk/arch/s390/hypfs/inode.c | 2 + trunk/arch/s390/include/asm/compat.h | 75 +- trunk/arch/s390/include/asm/processor.h | 1 - trunk/arch/s390/include/uapi/asm/Kbuild | 3 - trunk/arch/s390/kernel/compat_linux.h | 68 + trunk/arch/s390/kernel/dis.c | 27 - trunk/arch/s390/kvm/Kconfig | 1 - trunk/arch/s390/kvm/diag.c | 4 - trunk/arch/s390/kvm/intercept.c | 11 - trunk/arch/s390/kvm/interrupt.c | 25 +- trunk/arch/s390/kvm/kvm-s390.c | 17 +- trunk/arch/s390/kvm/priv.c | 9 +- trunk/arch/s390/kvm/sigp.c | 2 - trunk/arch/s390/kvm/trace-s390.h | 210 - trunk/arch/s390/kvm/trace.h | 341 -- trunk/arch/score/Kconfig | 1 - trunk/arch/score/include/asm/elf.h | 2 +- trunk/arch/score/include/uapi/asm/Kbuild | 3 - trunk/arch/score/kernel/sys_score.c | 1 - trunk/arch/sh/include/asm/bl_bit.h | 4 +- trunk/arch/sh/include/asm/cache_insns.h | 4 +- trunk/arch/sh/include/asm/checksum.h | 2 +- trunk/arch/sh/include/asm/elf.h | 3 +- trunk/arch/sh/include/asm/io.h | 2 +- trunk/arch/sh/include/asm/mmu_context.h | 4 +- trunk/arch/sh/include/asm/posix_types.h | 8 +- trunk/arch/sh/include/asm/processor.h | 4 +- trunk/arch/sh/include/asm/ptrace.h | 4 +- trunk/arch/sh/include/asm/string.h | 4 +- trunk/arch/sh/include/asm/switch_to.h | 4 +- trunk/arch/sh/include/asm/syscall.h | 4 +- trunk/arch/sh/include/asm/syscalls.h | 4 +- trunk/arch/sh/include/asm/tlb.h | 2 +- trunk/arch/sh/include/asm/traps.h | 4 +- trunk/arch/sh/include/asm/uaccess.h | 4 +- trunk/arch/sh/include/asm/unistd.h | 8 +- .../sh/include/mach-ecovec24/mach/romimage.h | 2 +- .../sh/include/mach-kfr2r09/mach/romimage.h | 2 +- trunk/arch/sh/include/uapi/asm/Kbuild | 3 - trunk/arch/sh/kernel/ioport.c | 2 +- trunk/arch/sparc/include/asm/compat.h | 61 +- trunk/arch/sparc/include/asm/elf_32.h | 3 +- trunk/arch/sparc/include/asm/oplib_32.h | 2 +- trunk/arch/sparc/include/asm/oplib_64.h | 2 +- trunk/arch/sparc/include/asm/siginfo.h | 1 + trunk/arch/sparc/include/asm/unistd.h | 1 - trunk/arch/sparc/include/uapi/asm/Kbuild | 5 - trunk/arch/sparc/kernel/hvapi.c | 2 +- trunk/arch/sparc/kernel/prom_64.c | 2 +- trunk/arch/sparc/kernel/signal32.c | 52 + trunk/arch/sparc/kernel/sys32.S | 2 +- trunk/arch/sparc/kernel/sys_sparc32.c | 46 + trunk/arch/sparc/kernel/traps_64.c | 2 +- trunk/arch/sparc/lib/NG2memcpy.S | 46 +- trunk/arch/sparc/mm/init_64.c | 7 +- trunk/arch/sparc/mm/iommu.c | 4 +- trunk/arch/tile/include/asm/compat.h | 62 - trunk/arch/tile/include/asm/elf.h | 4 +- trunk/arch/tile/include/gxio/dma_queue.h | 2 +- trunk/arch/tile/include/gxio/mpipe.h | 4 +- trunk/arch/tile/include/gxio/trio.h | 4 +- trunk/arch/tile/include/gxio/usb_host.h | 2 +- trunk/arch/tile/include/hv/iorpc.h | 2 +- trunk/arch/tile/include/uapi/arch/Kbuild | 1 - trunk/arch/tile/include/uapi/asm/Kbuild | 3 - trunk/arch/tile/kernel/compat_signal.c | 57 + trunk/arch/um/Makefile | 4 +- trunk/arch/um/drivers/mconsole_kern.c | 99 +- trunk/arch/unicore32/Kconfig | 1 - trunk/arch/unicore32/include/mach/PKUnity.h | 36 +- trunk/arch/unicore32/include/mach/hardware.h | 2 +- .../arch/unicore32/include/mach/uncompress.h | 4 +- trunk/arch/unicore32/include/uapi/asm/Kbuild | 3 - trunk/arch/x86/Kconfig | 21 +- trunk/arch/x86/boot/Makefile | 4 +- trunk/arch/x86/boot/mkcpustr.c | 2 - trunk/arch/x86/crypto/Makefile | 4 - trunk/arch/x86/crypto/aes_glue.c | 1 + trunk/arch/x86/crypto/aesni-intel_glue.c | 258 +- trunk/arch/x86/crypto/blowfish_glue.c | 4 + trunk/arch/x86/crypto/camellia_glue.c | 1382 ++--- .../arch/x86/crypto/cast5-avx-x86_64-asm_64.S | 376 -- trunk/arch/x86/crypto/cast5_avx_glue.c | 530 -- .../arch/x86/crypto/cast6-avx-x86_64-asm_64.S | 383 -- trunk/arch/x86/crypto/cast6_avx_glue.c | 648 -- .../x86/crypto/ghash-clmulni-intel_glue.c | 2 + trunk/arch/x86/crypto/glue_helper.c | 2 +- trunk/arch/x86/crypto/salsa20_glue.c | 1 + trunk/arch/x86/crypto/serpent_avx_glue.c | 10 + trunk/arch/x86/crypto/serpent_sse2_glue.c | 10 + .../x86/crypto/twofish-avx-x86_64-asm_64.S | 227 +- trunk/arch/x86/crypto/twofish_avx_glue.c | 10 + trunk/arch/x86/crypto/twofish_glue.c | 1 + trunk/arch/x86/crypto/twofish_glue_3way.c | 5 + trunk/arch/x86/include/asm/Kbuild | 4 + trunk/arch/x86/include/asm/apic.h | 2 +- trunk/arch/x86/include/asm/atomic.h | 4 +- trunk/arch/x86/include/asm/calling.h | 2 +- trunk/arch/x86/include/asm/checksum.h | 4 +- trunk/arch/x86/include/asm/cmpxchg.h | 4 +- trunk/arch/x86/include/asm/compat.h | 74 +- trunk/arch/x86/include/asm/cpufeature.h | 2 - trunk/arch/x86/include/asm/ia32.h | 67 + trunk/arch/x86/include/asm/kvm.h | 1 - trunk/arch/x86/include/asm/kvm_emulate.h | 48 +- trunk/arch/x86/include/asm/kvm_host.h | 36 +- trunk/arch/x86/include/asm/kvm_para.h | 6 +- trunk/arch/x86/include/asm/mmzone.h | 4 +- trunk/arch/x86/include/asm/msr-index.h | 3 - trunk/arch/x86/include/asm/mutex.h | 4 +- trunk/arch/x86/include/asm/numa.h | 4 +- trunk/arch/x86/include/asm/pci.h | 2 +- trunk/arch/x86/include/asm/pgtable.h | 4 +- trunk/arch/x86/include/asm/pgtable_types.h | 4 +- trunk/arch/x86/include/asm/posix_types.h | 10 +- trunk/arch/x86/include/asm/seccomp.h | 4 +- trunk/arch/x86/include/asm/string.h | 4 +- trunk/arch/x86/include/asm/suspend.h | 4 +- trunk/arch/x86/include/asm/uaccess.h | 4 +- trunk/arch/x86/include/asm/user.h | 4 +- trunk/arch/x86/include/asm/xen/interface.h | 11 +- trunk/arch/x86/include/asm/xen/swiotlb-xen.h | 2 - trunk/arch/x86/include/asm/xor.h | 4 +- trunk/arch/x86/include/asm/xor_32.h | 2 +- trunk/arch/x86/include/asm/xor_64.h | 2 +- trunk/arch/x86/include/uapi/asm/Kbuild | 6 - trunk/arch/x86/kernel/Makefile | 3 +- trunk/arch/x86/kernel/apic/apic_numachip.c | 4 +- trunk/arch/x86/kernel/cpu/mkcapflags.pl | 5 +- trunk/arch/x86/kernel/kvm.c | 3 +- trunk/arch/x86/kernel/rtc.c | 2 +- trunk/arch/x86/kernel/setup.c | 2 +- trunk/arch/x86/kvm/Kconfig | 2 - trunk/arch/x86/kvm/Makefile | 2 +- trunk/arch/x86/kvm/cpuid.c | 14 +- trunk/arch/x86/kvm/emulate.c | 538 +- trunk/arch/x86/kvm/i8254.c | 64 +- trunk/arch/x86/kvm/i8254.h | 6 +- trunk/arch/x86/kvm/i8259.c | 70 +- trunk/arch/x86/kvm/irq.h | 2 +- trunk/arch/x86/kvm/kvm_timer.h | 18 + trunk/arch/x86/kvm/lapic.c | 484 +- trunk/arch/x86/kvm/lapic.h | 61 +- trunk/arch/x86/kvm/mmu.c | 240 +- trunk/arch/x86/kvm/mmu.h | 25 +- trunk/arch/x86/kvm/mmu_audit.c | 8 +- trunk/arch/x86/kvm/paging_tmpl.h | 199 +- trunk/arch/x86/kvm/pmu.c | 2 +- trunk/arch/x86/kvm/svm.c | 82 +- trunk/arch/x86/kvm/timer.c | 47 + trunk/arch/x86/kvm/vmx.c | 233 +- trunk/arch/x86/kvm/x86.c | 384 +- trunk/arch/x86/kvm/x86.h | 1 - trunk/arch/x86/lib/insn.c | 4 - trunk/arch/x86/syscalls/Makefile | 17 +- trunk/arch/x86/tools/Makefile | 2 +- trunk/arch/x86/xen/apic.c | 3 +- trunk/arch/x86/xen/enlighten.c | 15 +- trunk/arch/x86/xen/mmu.c | 190 +- trunk/arch/x86/xen/p2m.c | 92 +- trunk/arch/x86/xen/pci-swiotlb-xen.c | 52 +- trunk/arch/x86/xen/platform-pci-unplug.c | 1 - trunk/arch/x86/xen/setup.c | 18 - trunk/arch/x86/xen/vga.c | 7 - trunk/arch/x86/xen/xen-head.S | 56 +- trunk/arch/x86/xen/xen-ops.h | 3 +- trunk/arch/xtensa/include/asm/elf.h | 3 +- trunk/arch/xtensa/include/uapi/asm/Kbuild | 3 - trunk/crypto/842.c | 182 - trunk/crypto/Kconfig | 76 - trunk/crypto/Makefile | 5 +- trunk/crypto/aes_generic.c | 1 + trunk/crypto/ansi_cprng.c | 63 +- trunk/crypto/anubis.c | 1 + trunk/crypto/blowfish_generic.c | 1 + trunk/crypto/camellia_generic.c | 1 + trunk/crypto/{cast5_generic.c => cast5.c} | 80 +- trunk/crypto/{cast6_generic.c => cast6.c} | 73 +- trunk/crypto/crypto_null.c | 57 +- trunk/crypto/crypto_user.c | 2 +- trunk/crypto/deflate.c | 1 + trunk/crypto/des_generic.c | 25 +- trunk/crypto/fcrypt.c | 1 + trunk/crypto/ghash-generic.c | 1 + trunk/crypto/khazad.c | 1 + trunk/crypto/krng.c | 1 + trunk/crypto/lzo.c | 1 + trunk/crypto/salsa20_generic.c | 1 + trunk/crypto/seed.c | 1 + trunk/crypto/serpent_generic.c | 53 +- trunk/crypto/sha256_generic.c | 25 +- trunk/crypto/sha512_generic.c | 20 +- trunk/crypto/shash.c | 36 - trunk/crypto/tcrypt.c | 95 +- trunk/crypto/tcrypt.h | 1 - trunk/crypto/tea.c | 41 +- trunk/crypto/testmgr.c | 472 +- trunk/crypto/testmgr.h | 5443 +++-------------- trunk/crypto/tgr192.c | 38 +- trunk/crypto/twofish_generic.c | 1 + trunk/crypto/vmac.c | 10 +- trunk/crypto/wp512.c | 39 +- trunk/drivers/acpi/processor_driver.c | 8 +- trunk/drivers/acpi/processor_idle.c | 40 +- trunk/drivers/acpi/processor_perflib.c | 30 - trunk/drivers/acpi/video.c | 8 +- trunk/drivers/ata/Kconfig | 8 - trunk/drivers/ata/Makefile | 1 - trunk/drivers/ata/ahci.h | 16 - trunk/drivers/ata/ahci_platform.c | 58 +- trunk/drivers/ata/libahci.c | 97 +- trunk/drivers/ata/libata-core.c | 101 +- trunk/drivers/ata/libata-eh.c | 14 +- trunk/drivers/ata/libata-scsi.c | 255 +- trunk/drivers/ata/libata.h | 2 - trunk/drivers/ata/pata_arasan_cf.c | 14 +- trunk/drivers/ata/sata_fsl.c | 39 +- trunk/drivers/ata/sata_highbank.c | 450 -- trunk/drivers/ata/sata_mv.c | 8 +- trunk/drivers/atm/eni.c | 2 +- trunk/drivers/base/dma-buf.c | 3 +- trunk/drivers/base/dma-contiguous.c | 18 +- trunk/drivers/base/firmware_class.c | 76 +- trunk/drivers/base/platform.c | 2 - trunk/drivers/base/power/domain.c | 244 +- trunk/drivers/base/power/main.c | 66 +- trunk/drivers/base/power/opp.c | 47 - trunk/drivers/base/power/power.h | 36 +- trunk/drivers/base/power/runtime.c | 3 - trunk/drivers/base/power/wakeup.c | 46 +- trunk/drivers/block/aoe/aoe.h | 93 +- trunk/drivers/block/aoe/aoeblk.c | 91 +- trunk/drivers/block/aoe/aoechr.c | 13 +- trunk/drivers/block/aoe/aoecmd.c | 1232 ++-- trunk/drivers/block/aoe/aoedev.c | 265 +- trunk/drivers/block/aoe/aoemain.c | 10 +- trunk/drivers/block/aoe/aoenet.c | 61 +- trunk/drivers/block/nbd.c | 23 +- trunk/drivers/char/agp/intel-gtt.c | 62 +- trunk/drivers/char/hw_random/Kconfig | 13 - trunk/drivers/char/hw_random/Makefile | 1 - trunk/drivers/char/hw_random/mxc-rnga.c | 108 +- trunk/drivers/char/hw_random/octeon-rng.c | 17 +- trunk/drivers/char/hw_random/tpm-rng.c | 50 - trunk/drivers/char/mbcs.c | 2 +- trunk/drivers/char/tpm/Kconfig | 19 - trunk/drivers/char/tpm/Makefile | 8 - trunk/drivers/char/tpm/tpm.c | 74 +- trunk/drivers/char/tpm/tpm.h | 35 +- trunk/drivers/char/tpm/tpm_acpi.c | 109 - .../char/tpm/{tpm_eventlog.c => tpm_bios.c} | 147 +- trunk/drivers/char/tpm/tpm_eventlog.h | 86 - trunk/drivers/char/tpm/tpm_i2c_infineon.c | 695 --- trunk/drivers/char/tpm/tpm_ibmvtpm.c | 749 --- trunk/drivers/char/tpm/tpm_ibmvtpm.h | 77 - trunk/drivers/char/tpm/tpm_of.c | 73 - trunk/drivers/char/tpm/tpm_ppi.c | 461 -- trunk/drivers/char/tpm/tpm_tis.c | 3 +- trunk/drivers/clocksource/sh_cmt.c | 71 +- trunk/drivers/clocksource/sh_mtu2.c | 41 +- trunk/drivers/clocksource/sh_tmu.c | 112 +- trunk/drivers/cpufreq/Kconfig | 11 - trunk/drivers/cpufreq/Kconfig.x86 | 18 +- trunk/drivers/cpufreq/Makefile | 4 +- trunk/drivers/cpufreq/acpi-cpufreq.c | 272 +- trunk/drivers/cpufreq/cpufreq-cpu0.c | 269 - trunk/drivers/cpufreq/cpufreq_conservative.c | 2 - trunk/drivers/cpufreq/cpufreq_ondemand.c | 1 - trunk/drivers/cpufreq/longhaul.h | 26 +- trunk/drivers/cpufreq/omap-cpufreq.c | 39 +- trunk/drivers/cpufreq/powernow-k8.c | 406 +- trunk/drivers/cpufreq/powernow-k8.h | 32 + trunk/drivers/cpuidle/driver.c | 18 +- trunk/drivers/cpuidle/governors/ladder.c | 6 +- trunk/drivers/crypto/Kconfig | 22 +- trunk/drivers/crypto/amcc/crypto4xx_core.c | 1 - trunk/drivers/crypto/atmel-aes.c | 7 + trunk/drivers/crypto/atmel-sha.c | 5 + trunk/drivers/crypto/atmel-tdes.c | 6 + trunk/drivers/crypto/caam/caamalg.c | 51 +- trunk/drivers/crypto/caam/caamhash.c | 22 +- trunk/drivers/crypto/caam/caamrng.c | 9 +- trunk/drivers/crypto/caam/compat.h | 1 - trunk/drivers/crypto/caam/ctrl.c | 6 +- trunk/drivers/crypto/caam/error.c | 2 + trunk/drivers/crypto/caam/key_gen.c | 4 - trunk/drivers/crypto/geode-aes.c | 18 +- trunk/drivers/crypto/hifn_795x.c | 5 +- trunk/drivers/crypto/nx/Kconfig | 26 - trunk/drivers/crypto/nx/Makefile | 5 +- trunk/drivers/crypto/nx/nx-842.c | 1617 ----- trunk/drivers/crypto/nx/nx-aes-cbc.c | 1 + trunk/drivers/crypto/nx/nx-aes-ccm.c | 2 + trunk/drivers/crypto/nx/nx-aes-ctr.c | 2 + trunk/drivers/crypto/nx/nx-aes-ecb.c | 1 + trunk/drivers/crypto/nx/nx-aes-gcm.c | 2 + trunk/drivers/crypto/omap-aes.c | 1 + trunk/drivers/crypto/padlock-aes.c | 3 + trunk/drivers/crypto/s5p-sss.c | 1 + trunk/drivers/crypto/talitos.c | 442 +- trunk/drivers/crypto/tegra-aes.c | 3 +- trunk/drivers/crypto/ux500/cryp/cryp_core.c | 1 - trunk/drivers/crypto/ux500/hash/hash_core.c | 1 + trunk/drivers/dma/dmaengine.c | 2 +- trunk/drivers/firewire/core-device.c | 3 - trunk/drivers/firewire/core-transaction.c | 33 +- trunk/drivers/firewire/ohci.c | 28 +- trunk/drivers/gpio/Kconfig | 7 - trunk/drivers/gpio/Makefile | 1 - trunk/drivers/gpio/gpio-ich.c | 79 +- trunk/drivers/gpio/gpio-twl6040.c | 137 - trunk/drivers/gpu/drm/Kconfig | 19 +- trunk/drivers/gpu/drm/Makefile | 3 - trunk/drivers/gpu/drm/ast/ast_drv.c | 5 +- trunk/drivers/gpu/drm/ast/ast_drv.h | 13 +- trunk/drivers/gpu/drm/ast/ast_fb.c | 7 +- trunk/drivers/gpu/drm/ast/ast_main.c | 6 +- trunk/drivers/gpu/drm/ast/ast_mode.c | 8 +- trunk/drivers/gpu/drm/ast/ast_post.c | 2 +- trunk/drivers/gpu/drm/ast/ast_ttm.c | 2 +- trunk/drivers/gpu/drm/ati_pcigart.c | 2 +- trunk/drivers/gpu/drm/cirrus/cirrus_drv.c | 3 +- trunk/drivers/gpu/drm/cirrus/cirrus_drv.h | 11 +- trunk/drivers/gpu/drm/cirrus/cirrus_fbdev.c | 5 +- trunk/drivers/gpu/drm/cirrus/cirrus_main.c | 5 +- trunk/drivers/gpu/drm/cirrus/cirrus_mode.c | 5 +- trunk/drivers/gpu/drm/cirrus/cirrus_ttm.c | 2 +- trunk/drivers/gpu/drm/drm_agpsupport.c | 2 +- trunk/drivers/gpu/drm/drm_auth.c | 2 +- trunk/drivers/gpu/drm/drm_buffer.c | 2 +- trunk/drivers/gpu/drm/drm_bufs.c | 2 +- trunk/drivers/gpu/drm/drm_cache.c | 30 +- trunk/drivers/gpu/drm/drm_context.c | 2 +- trunk/drivers/gpu/drm/drm_crtc.c | 148 +- trunk/drivers/gpu/drm/drm_crtc_helper.c | 12 +- trunk/drivers/gpu/drm/drm_debugfs.c | 2 +- trunk/drivers/gpu/drm/drm_dma.c | 2 +- trunk/drivers/gpu/drm/drm_dp_i2c_helper.c | 4 +- trunk/drivers/gpu/drm/drm_drv.c | 26 +- trunk/drivers/gpu/drm/drm_edid.c | 212 +- trunk/drivers/gpu/drm/drm_edid_load.c | 37 +- trunk/drivers/gpu/drm/drm_edid_modes.h | 46 +- trunk/drivers/gpu/drm/drm_encoder_slave.c | 2 +- trunk/drivers/gpu/drm/drm_fb_cma_helper.c | 406 -- trunk/drivers/gpu/drm/drm_fb_helper.c | 18 +- trunk/drivers/gpu/drm/drm_fops.c | 2 +- trunk/drivers/gpu/drm/drm_gem.c | 2 +- trunk/drivers/gpu/drm/drm_gem_cma_helper.c | 251 - trunk/drivers/gpu/drm/drm_global.c | 2 +- trunk/drivers/gpu/drm/drm_hashtab.c | 4 +- trunk/drivers/gpu/drm/drm_info.c | 2 +- trunk/drivers/gpu/drm/drm_ioc32.c | 4 +- trunk/drivers/gpu/drm/drm_ioctl.c | 8 +- trunk/drivers/gpu/drm/drm_irq.c | 4 +- trunk/drivers/gpu/drm/drm_lock.c | 2 +- trunk/drivers/gpu/drm/drm_memory.c | 2 +- trunk/drivers/gpu/drm/drm_mm.c | 4 +- trunk/drivers/gpu/drm/drm_modes.c | 5 +- trunk/drivers/gpu/drm/drm_pci.c | 2 +- trunk/drivers/gpu/drm/drm_platform.c | 2 +- trunk/drivers/gpu/drm/drm_prime.c | 2 +- trunk/drivers/gpu/drm/drm_proc.c | 2 +- trunk/drivers/gpu/drm/drm_scatter.c | 2 +- trunk/drivers/gpu/drm/drm_stub.c | 4 +- trunk/drivers/gpu/drm/drm_sysfs.c | 6 +- trunk/drivers/gpu/drm/drm_trace_points.c | 2 +- trunk/drivers/gpu/drm/drm_usb.c | 2 +- trunk/drivers/gpu/drm/drm_vm.c | 13 +- trunk/drivers/gpu/drm/exynos/exynos_ddc.c | 2 +- trunk/drivers/gpu/drm/exynos/exynos_drm_buf.c | 5 +- .../gpu/drm/exynos/exynos_drm_connector.c | 8 +- .../drivers/gpu/drm/exynos/exynos_drm_core.c | 2 +- .../drivers/gpu/drm/exynos/exynos_drm_crtc.c | 4 +- .../gpu/drm/exynos/exynos_drm_dmabuf.c | 5 +- trunk/drivers/gpu/drm/exynos/exynos_drm_drv.c | 5 +- trunk/drivers/gpu/drm/exynos/exynos_drm_drv.h | 1 + .../gpu/drm/exynos/exynos_drm_encoder.c | 4 +- trunk/drivers/gpu/drm/exynos/exynos_drm_fb.c | 8 +- .../drivers/gpu/drm/exynos/exynos_drm_fbdev.c | 12 +- .../drivers/gpu/drm/exynos/exynos_drm_fimd.c | 2 +- trunk/drivers/gpu/drm/exynos/exynos_drm_g2d.c | 4 +- trunk/drivers/gpu/drm/exynos/exynos_drm_gem.c | 3 +- .../drivers/gpu/drm/exynos/exynos_drm_hdmi.c | 2 +- .../drivers/gpu/drm/exynos/exynos_drm_plane.c | 4 +- .../drivers/gpu/drm/exynos/exynos_drm_vidi.c | 19 +- trunk/drivers/gpu/drm/exynos/exynos_hdmi.c | 6 +- trunk/drivers/gpu/drm/exynos/exynos_hdmiphy.c | 2 +- trunk/drivers/gpu/drm/exynos/exynos_mixer.c | 2 +- trunk/drivers/gpu/drm/gma500/Makefile | 5 +- trunk/drivers/gpu/drm/gma500/backlight.c | 45 - trunk/drivers/gpu/drm/gma500/cdv_device.c | 74 +- .../gpu/drm/gma500/cdv_intel_display.c | 236 +- trunk/drivers/gpu/drm/gma500/cdv_intel_dp.c | 1950 ------ trunk/drivers/gpu/drm/gma500/cdv_intel_hdmi.c | 6 +- trunk/drivers/gpu/drm/gma500/cdv_intel_lvds.c | 12 +- trunk/drivers/gpu/drm/gma500/framebuffer.c | 7 - trunk/drivers/gpu/drm/gma500/gem.c | 11 +- trunk/drivers/gpu/drm/gma500/gem_glue.c | 90 + trunk/drivers/gpu/drm/gma500/gem_glue.h | 2 + trunk/drivers/gpu/drm/gma500/intel_bios.c | 103 +- trunk/drivers/gpu/drm/gma500/intel_bios.h | 46 - trunk/drivers/gpu/drm/gma500/intel_gmbus.c | 5 +- .../drivers/gpu/drm/gma500/mdfld_dsi_output.c | 13 +- trunk/drivers/gpu/drm/gma500/mid_bios.c | 10 +- .../drivers/gpu/drm/gma500/oaktrail_device.c | 2 +- trunk/drivers/gpu/drm/gma500/oaktrail_hdmi.c | 1 + trunk/drivers/gpu/drm/gma500/opregion.c | 3 +- trunk/drivers/gpu/drm/gma500/psb_device.c | 3 +- trunk/drivers/gpu/drm/gma500/psb_drv.c | 2 +- trunk/drivers/gpu/drm/gma500/psb_drv.h | 24 +- trunk/drivers/gpu/drm/gma500/psb_intel_drv.h | 28 +- trunk/drivers/gpu/drm/gma500/psb_intel_lvds.c | 13 +- trunk/drivers/gpu/drm/gma500/psb_intel_reg.h | 197 +- trunk/drivers/gpu/drm/gma500/psb_intel_sdvo.c | 13 +- trunk/drivers/gpu/drm/i2c/ch7006_drv.c | 16 +- trunk/drivers/gpu/drm/i2c/ch7006_priv.h | 8 +- trunk/drivers/gpu/drm/i2c/sil164_drv.c | 8 +- trunk/drivers/gpu/drm/i810/i810_dma.c | 5 +- trunk/drivers/gpu/drm/i810/i810_drv.c | 7 +- trunk/drivers/gpu/drm/i915/Makefile | 1 - trunk/drivers/gpu/drm/i915/dvo.h | 21 +- trunk/drivers/gpu/drm/i915/dvo_ch7017.c | 21 +- trunk/drivers/gpu/drm/i915/dvo_ch7xxx.c | 17 +- trunk/drivers/gpu/drm/i915/dvo_ivch.c | 23 +- trunk/drivers/gpu/drm/i915/dvo_ns2501.c | 588 -- trunk/drivers/gpu/drm/i915/dvo_sil164.c | 20 +- trunk/drivers/gpu/drm/i915/dvo_tfp410.c | 18 +- trunk/drivers/gpu/drm/i915/i915_debugfs.c | 256 +- trunk/drivers/gpu/drm/i915/i915_dma.c | 82 +- trunk/drivers/gpu/drm/i915/i915_drv.c | 68 +- trunk/drivers/gpu/drm/i915/i915_drv.h | 239 +- trunk/drivers/gpu/drm/i915/i915_gem.c | 1537 +++-- trunk/drivers/gpu/drm/i915/i915_gem_context.c | 69 +- trunk/drivers/gpu/drm/i915/i915_gem_debug.c | 5 +- trunk/drivers/gpu/drm/i915/i915_gem_dmabuf.c | 176 +- trunk/drivers/gpu/drm/i915/i915_gem_evict.c | 49 +- .../gpu/drm/i915/i915_gem_execbuffer.c | 396 +- trunk/drivers/gpu/drm/i915/i915_gem_gtt.c | 149 +- trunk/drivers/gpu/drm/i915/i915_gem_stolen.c | 5 +- trunk/drivers/gpu/drm/i915/i915_gem_tiling.c | 25 +- trunk/drivers/gpu/drm/i915/i915_ioc32.c | 5 +- trunk/drivers/gpu/drm/i915/i915_irq.c | 199 +- trunk/drivers/gpu/drm/i915/i915_reg.h | 328 +- trunk/drivers/gpu/drm/i915/i915_suspend.c | 5 +- trunk/drivers/gpu/drm/i915/i915_sysfs.c | 220 +- trunk/drivers/gpu/drm/i915/i915_trace.h | 25 +- trunk/drivers/gpu/drm/i915/intel_acpi.c | 2 +- trunk/drivers/gpu/drm/i915/intel_bios.c | 5 +- trunk/drivers/gpu/drm/i915/intel_bios.h | 2 +- trunk/drivers/gpu/drm/i915/intel_crt.c | 176 +- trunk/drivers/gpu/drm/i915/intel_ddi.c | 144 +- trunk/drivers/gpu/drm/i915/intel_display.c | 2175 ++----- trunk/drivers/gpu/drm/i915/intel_dp.c | 412 +- trunk/drivers/gpu/drm/i915/intel_drv.h | 155 +- trunk/drivers/gpu/drm/i915/intel_dvo.c | 122 +- trunk/drivers/gpu/drm/i915/intel_fb.c | 9 +- trunk/drivers/gpu/drm/i915/intel_hdmi.c | 230 +- trunk/drivers/gpu/drm/i915/intel_i2c.c | 5 +- trunk/drivers/gpu/drm/i915/intel_lvds.c | 108 +- trunk/drivers/gpu/drm/i915/intel_modes.c | 5 +- trunk/drivers/gpu/drm/i915/intel_opregion.c | 27 +- trunk/drivers/gpu/drm/i915/intel_overlay.c | 65 +- trunk/drivers/gpu/drm/i915/intel_pm.c | 420 +- trunk/drivers/gpu/drm/i915/intel_ringbuffer.c | 157 +- trunk/drivers/gpu/drm/i915/intel_ringbuffer.h | 20 +- trunk/drivers/gpu/drm/i915/intel_sdvo.c | 219 +- trunk/drivers/gpu/drm/i915/intel_sprite.c | 8 +- trunk/drivers/gpu/drm/i915/intel_tv.c | 79 +- trunk/drivers/gpu/drm/mga/mga_dma.c | 6 +- trunk/drivers/gpu/drm/mga/mga_drv.c | 7 +- trunk/drivers/gpu/drm/mga/mga_ioc32.c | 5 +- trunk/drivers/gpu/drm/mga/mga_irq.c | 5 +- trunk/drivers/gpu/drm/mga/mga_state.c | 5 +- trunk/drivers/gpu/drm/mga/mga_warp.c | 5 +- trunk/drivers/gpu/drm/mgag200/mgag200_drv.c | 5 +- trunk/drivers/gpu/drm/mgag200/mgag200_drv.h | 13 +- trunk/drivers/gpu/drm/mgag200/mgag200_fb.c | 5 +- trunk/drivers/gpu/drm/mgag200/mgag200_i2c.c | 3 +- trunk/drivers/gpu/drm/mgag200/mgag200_main.c | 5 +- trunk/drivers/gpu/drm/mgag200/mgag200_mode.c | 6 +- trunk/drivers/gpu/drm/mgag200/mgag200_ttm.c | 2 +- trunk/drivers/gpu/drm/nouveau/Kconfig | 36 +- trunk/drivers/gpu/drm/nouveau/Makefile | 225 +- .../gpu/drm/nouveau/core/core/client.c | 103 - .../gpu/drm/nouveau/core/core/engctx.c | 236 - .../gpu/drm/nouveau/core/core/engine.c | 55 - .../gpu/drm/nouveau/core/core/gpuobj.c | 318 - .../gpu/drm/nouveau/core/core/handle.c | 223 - .../gpu/drm/nouveau/core/core/namedb.c | 203 - .../gpu/drm/nouveau/core/core/object.c | 468 -- .../gpu/drm/nouveau/core/core/option.c | 131 - .../gpu/drm/nouveau/core/core/parent.c | 139 - .../gpu/drm/nouveau/core/core/printk.c | 74 - .../drivers/gpu/drm/nouveau/core/core/ramht.c | 109 - .../gpu/drm/nouveau/core/core/subdev.c | 115 - .../gpu/drm/nouveau/core/engine/bsp/nv84.c | 175 - .../gpu/drm/nouveau/core/engine/copy/nva3.c | 222 - .../gpu/drm/nouveau/core/engine/copy/nvc0.c | 265 - .../gpu/drm/nouveau/core/engine/copy/nve0.c | 156 - .../gpu/drm/nouveau/core/engine/crypt/nv84.c | 217 - .../gpu/drm/nouveau/core/engine/crypt/nv98.c | 208 - .../gpu/drm/nouveau/core/engine/disp/nv04.c | 90 - .../gpu/drm/nouveau/core/engine/disp/nv50.c | 125 - .../gpu/drm/nouveau/core/engine/disp/nvd0.c | 118 - .../gpu/drm/nouveau/core/engine/disp/vga.c | 215 - .../gpu/drm/nouveau/core/engine/dmaobj/base.c | 87 - .../gpu/drm/nouveau/core/engine/dmaobj/nv04.c | 185 - .../gpu/drm/nouveau/core/engine/dmaobj/nv50.c | 173 - .../gpu/drm/nouveau/core/engine/dmaobj/nvc0.c | 99 - .../gpu/drm/nouveau/core/engine/fifo/base.c | 181 - .../gpu/drm/nouveau/core/engine/fifo/nv04.c | 630 -- .../gpu/drm/nouveau/core/engine/fifo/nv04.h | 178 - .../gpu/drm/nouveau/core/engine/fifo/nv10.c | 171 - .../gpu/drm/nouveau/core/engine/fifo/nv17.c | 208 - .../gpu/drm/nouveau/core/engine/fifo/nv40.c | 349 -- .../gpu/drm/nouveau/core/engine/fifo/nv50.c | 502 -- .../gpu/drm/nouveau/core/engine/fifo/nv50.h | 36 - .../gpu/drm/nouveau/core/engine/fifo/nv84.c | 420 -- .../gpu/drm/nouveau/core/engine/fifo/nvc0.c | 647 -- .../gpu/drm/nouveau/core/engine/fifo/nve0.c | 628 -- .../drm/nouveau/core/engine/graph/ctxnvc0.c | 3039 --------- .../drm/nouveau/core/engine/graph/ctxnve0.c | 2788 --------- .../nouveau/core/engine/graph/fuc/gpcnve0.fuc | 451 -- .../core/engine/graph/fuc/gpcnve0.fuc.h | 530 -- .../nouveau/core/engine/graph/fuc/hubnve0.fuc | 780 --- .../core/engine/graph/fuc/hubnve0.fuc.h | 857 --- .../nouveau/core/engine/graph/fuc/nve0.fuc | 400 -- .../gpu/drm/nouveau/core/engine/graph/nv04.c | 1387 ----- .../gpu/drm/nouveau/core/engine/graph/nv10.c | 1314 ---- .../gpu/drm/nouveau/core/engine/graph/nv20.c | 381 -- .../gpu/drm/nouveau/core/engine/graph/nv20.h | 31 - .../gpu/drm/nouveau/core/engine/graph/nv25.c | 167 - .../gpu/drm/nouveau/core/engine/graph/nv2a.c | 134 - .../gpu/drm/nouveau/core/engine/graph/nv30.c | 238 - .../gpu/drm/nouveau/core/engine/graph/nv34.c | 168 - .../gpu/drm/nouveau/core/engine/graph/nv35.c | 166 - .../gpu/drm/nouveau/core/engine/graph/nv40.c | 495 -- .../gpu/drm/nouveau/core/engine/graph/nv40.h | 21 - .../gpu/drm/nouveau/core/engine/graph/nv50.c | 888 --- .../gpu/drm/nouveau/core/engine/graph/nv50.h | 7 - .../gpu/drm/nouveau/core/engine/graph/nvc0.c | 955 --- .../gpu/drm/nouveau/core/engine/graph/nvc0.h | 171 - .../gpu/drm/nouveau/core/engine/graph/nve0.c | 576 -- .../gpu/drm/nouveau/core/engine/graph/regs.h | 269 - .../gpu/drm/nouveau/core/engine/mpeg/nv31.c | 308 - .../gpu/drm/nouveau/core/engine/mpeg/nv40.c | 144 - .../gpu/drm/nouveau/core/engine/mpeg/nv50.c | 240 - .../gpu/drm/nouveau/core/engine/mpeg/nv84.c | 104 - .../gpu/drm/nouveau/core/engine/ppp/nv98.c | 175 - .../drm/nouveau/core/engine/software/nv04.c | 147 - .../drm/nouveau/core/engine/software/nv10.c | 129 - .../drm/nouveau/core/engine/software/nv50.c | 199 - .../drm/nouveau/core/engine/software/nvc0.c | 181 - .../gpu/drm/nouveau/core/engine/vp/nv84.c | 175 - .../gpu/drm/nouveau/core/include/core/class.h | 118 - .../drm/nouveau/core/include/core/client.h | 42 - .../gpu/drm/nouveau/core/include/core/debug.h | 13 - .../drm/nouveau/core/include/core/device.h | 136 - .../drm/nouveau/core/include/core/engctx.h | 51 - .../drm/nouveau/core/include/core/engine.h | 57 - .../gpu/drm/nouveau/core/include/core/enum.h | 23 - .../drm/nouveau/core/include/core/gpuobj.h | 71 - .../drm/nouveau/core/include/core/handle.h | 31 - .../gpu/drm/nouveau/core/include/core/math.h | 16 - .../gpu/drm/nouveau/core/include/core/mm.h | 33 - .../drm/nouveau/core/include/core/namedb.h | 56 - .../drm/nouveau/core/include/core/object.h | 188 - .../drm/nouveau/core/include/core/option.h | 11 - .../drm/nouveau/core/include/core/parent.h | 64 - .../drm/nouveau/core/include/core/printk.h | 39 - .../gpu/drm/nouveau/core/include/core/ramht.h | 23 - .../drm/nouveau/core/include/core/subdev.h | 118 - .../gpu/drm/nouveau/core/include/engine/bsp.h | 45 - .../drm/nouveau/core/include/engine/copy.h | 49 - .../drm/nouveau/core/include/engine/crypt.h | 46 - .../drm/nouveau/core/include/engine/disp.h | 44 - .../drm/nouveau/core/include/engine/dmaobj.h | 57 - .../drm/nouveau/core/include/engine/fifo.h | 111 - .../drm/nouveau/core/include/engine/graph.h | 72 - .../drm/nouveau/core/include/engine/mpeg.h | 61 - .../gpu/drm/nouveau/core/include/engine/ppp.h | 45 - .../nouveau/core/include/engine/software.h | 60 - .../gpu/drm/nouveau/core/include/engine/vp.h | 45 - .../gpu/drm/nouveau/core/include/subdev/bar.h | 55 - .../drm/nouveau/core/include/subdev/bios.h | 34 - .../nouveau/core/include/subdev/bios/bit.h | 13 - .../nouveau/core/include/subdev/bios/bmp.h | 39 - .../nouveau/core/include/subdev/bios/conn.h | 27 - .../nouveau/core/include/subdev/bios/dcb.h | 90 - .../drm/nouveau/core/include/subdev/bios/dp.h | 8 - .../nouveau/core/include/subdev/bios/extdev.h | 30 - .../nouveau/core/include/subdev/bios/gpio.h | 33 - .../nouveau/core/include/subdev/bios/i2c.h | 25 - .../nouveau/core/include/subdev/bios/init.h | 21 - .../nouveau/core/include/subdev/bios/mxm.h | 9 - .../nouveau/core/include/subdev/bios/perf.h | 14 - .../nouveau/core/include/subdev/bios/pll.h | 77 - .../nouveau/core/include/subdev/bios/therm.h | 46 - .../drm/nouveau/core/include/subdev/clock.h | 59 - .../drm/nouveau/core/include/subdev/device.h | 24 - .../drm/nouveau/core/include/subdev/devinit.h | 40 - .../gpu/drm/nouveau/core/include/subdev/fb.h | 134 - .../drm/nouveau/core/include/subdev/gpio.h | 64 - .../gpu/drm/nouveau/core/include/subdev/i2c.h | 60 - .../drm/nouveau/core/include/subdev/ibus.h | 34 - .../drm/nouveau/core/include/subdev/instmem.h | 73 - .../drm/nouveau/core/include/subdev/ltcg.h | 33 - .../gpu/drm/nouveau/core/include/subdev/mc.h | 49 - .../gpu/drm/nouveau/core/include/subdev/mxm.h | 37 - .../drm/nouveau/core/include/subdev/therm.h | 58 - .../drm/nouveau/core/include/subdev/timer.h | 53 - .../gpu/drm/nouveau/core/include/subdev/vga.h | 30 - trunk/drivers/gpu/drm/nouveau/core/os.h | 47 - .../gpu/drm/nouveau/core/subdev/bar/base.c | 135 - .../gpu/drm/nouveau/core/subdev/bar/nv50.c | 263 - .../gpu/drm/nouveau/core/subdev/bar/nvc0.c | 215 - .../gpu/drm/nouveau/core/subdev/bios/base.c | 479 -- .../gpu/drm/nouveau/core/subdev/bios/bit.c | 52 - .../gpu/drm/nouveau/core/subdev/bios/conn.c | 56 - .../gpu/drm/nouveau/core/subdev/bios/dcb.c | 135 - .../gpu/drm/nouveau/core/subdev/bios/dp.c | 76 - .../gpu/drm/nouveau/core/subdev/bios/extdev.c | 100 - .../gpu/drm/nouveau/core/subdev/bios/gpio.c | 121 - .../gpu/drm/nouveau/core/subdev/bios/i2c.c | 129 - .../gpu/drm/nouveau/core/subdev/bios/init.c | 2120 ------- .../gpu/drm/nouveau/core/subdev/bios/mxm.c | 135 - .../gpu/drm/nouveau/core/subdev/bios/perf.c | 75 - .../gpu/drm/nouveau/core/subdev/bios/pll.c | 417 -- .../gpu/drm/nouveau/core/subdev/bios/therm.c | 177 - .../gpu/drm/nouveau/core/subdev/clock/nv04.c | 359 -- .../gpu/drm/nouveau/core/subdev/clock/nv50.c | 105 - .../gpu/drm/nouveau/core/subdev/clock/nva3.c | 95 - .../gpu/drm/nouveau/core/subdev/clock/nvc0.c | 94 - .../gpu/drm/nouveau/core/subdev/clock/pll.h | 9 - .../drm/nouveau/core/subdev/clock/pllnv04.c | 242 - .../gpu/drm/nouveau/core/subdev/device/base.c | 472 -- .../gpu/drm/nouveau/core/subdev/device/nv04.c | 86 - .../gpu/drm/nouveau/core/subdev/device/nv10.c | 195 - .../gpu/drm/nouveau/core/subdev/device/nv20.c | 126 - .../gpu/drm/nouveau/core/subdev/device/nv30.c | 147 - .../gpu/drm/nouveau/core/subdev/device/nv40.c | 375 -- .../gpu/drm/nouveau/core/subdev/device/nv50.c | 410 -- .../gpu/drm/nouveau/core/subdev/device/nvc0.c | 285 - .../gpu/drm/nouveau/core/subdev/device/nve0.c | 109 - .../drm/nouveau/core/subdev/devinit/fbmem.h | 98 - .../drm/nouveau/core/subdev/devinit/nv04.c | 189 - .../drm/nouveau/core/subdev/devinit/nv05.c | 159 - .../drm/nouveau/core/subdev/devinit/nv10.c | 124 - .../drm/nouveau/core/subdev/devinit/nv20.c | 96 - .../drm/nouveau/core/subdev/devinit/nv50.c | 87 - .../gpu/drm/nouveau/core/subdev/fb/base.c | 130 - .../gpu/drm/nouveau/core/subdev/fb/nv04.c | 130 - .../gpu/drm/nouveau/core/subdev/fb/nv10.c | 120 - .../gpu/drm/nouveau/core/subdev/fb/nv20.c | 136 - .../gpu/drm/nouveau/core/subdev/fb/nv30.c | 148 - .../gpu/drm/nouveau/core/subdev/fb/nv40.c | 178 - .../gpu/drm/nouveau/core/subdev/fb/nv50.c | 498 -- .../gpu/drm/nouveau/core/subdev/fb/nvc0.c | 245 - .../gpu/drm/nouveau/core/subdev/gpio/base.c | 271 - .../gpu/drm/nouveau/core/subdev/gpio/nv10.c | 169 - .../gpu/drm/nouveau/core/subdev/gpio/nv50.c | 194 - .../gpu/drm/nouveau/core/subdev/gpio/nvd0.c | 104 - .../gpu/drm/nouveau/core/subdev/i2c/aux.c | 212 - .../gpu/drm/nouveau/core/subdev/i2c/base.c | 407 -- .../gpu/drm/nouveau/core/subdev/i2c/bit.c | 230 - .../gpu/drm/nouveau/core/subdev/ibus/nvc0.c | 123 - .../gpu/drm/nouveau/core/subdev/ibus/nve0.c | 123 - .../drm/nouveau/core/subdev/instmem/base.c | 135 - .../drm/nouveau/core/subdev/instmem/nv04.c | 198 - .../drm/nouveau/core/subdev/instmem/nv04.h | 39 - .../drm/nouveau/core/subdev/instmem/nv40.c | 138 - .../drm/nouveau/core/subdev/instmem/nv50.c | 172 - .../gpu/drm/nouveau/core/subdev/ltcg/nvc0.c | 93 - .../gpu/drm/nouveau/core/subdev/mc/base.c | 49 - .../gpu/drm/nouveau/core/subdev/mc/nv04.c | 83 - .../gpu/drm/nouveau/core/subdev/mc/nv44.c | 74 - .../gpu/drm/nouveau/core/subdev/mc/nv50.c | 80 - .../gpu/drm/nouveau/core/subdev/mc/nv98.c | 73 - .../gpu/drm/nouveau/core/subdev/mc/nvc0.c | 75 - .../gpu/drm/nouveau/core/subdev/mxm/base.c | 290 - .../gpu/drm/nouveau/core/subdev/mxm/mxms.c | 193 - .../gpu/drm/nouveau/core/subdev/mxm/mxms.h | 22 - .../gpu/drm/nouveau/core/subdev/mxm/nv50.c | 233 - .../gpu/drm/nouveau/core/subdev/therm/base.c | 144 - .../gpu/drm/nouveau/core/subdev/therm/fan.c | 234 - .../gpu/drm/nouveau/core/subdev/therm/ic.c | 116 - .../gpu/drm/nouveau/core/subdev/therm/nv40.c | 163 - .../gpu/drm/nouveau/core/subdev/therm/nv50.c | 157 - .../gpu/drm/nouveau/core/subdev/therm/priv.h | 73 - .../gpu/drm/nouveau/core/subdev/therm/temp.c | 81 - .../gpu/drm/nouveau/core/subdev/timer/base.c | 87 - .../gpu/drm/nouveau/core/subdev/timer/nv04.c | 249 - .../gpu/drm/nouveau/core/subdev/vm/nv04.c | 151 - .../gpu/drm/nouveau/core/subdev/vm/nv04.h | 19 - .../gpu/drm/nouveau/core/subdev/vm/nv41.c | 158 - .../gpu/drm/nouveau/core/subdev/vm/nv44.c | 248 - trunk/drivers/gpu/drm/nouveau/nouveau_abi16.c | 426 +- trunk/drivers/gpu/drm/nouveau/nouveau_abi16.h | 32 - trunk/drivers/gpu/drm/nouveau/nouveau_acpi.c | 28 +- trunk/drivers/gpu/drm/nouveau/nouveau_acpi.h | 22 - trunk/drivers/gpu/drm/nouveau/nouveau_agp.c | 152 - trunk/drivers/gpu/drm/nouveau/nouveau_agp.h | 10 - .../gpu/drm/nouveau/nouveau_backlight.c | 92 +- trunk/drivers/gpu/drm/nouveau/nouveau_bios.c | 4613 +++++++++++++- trunk/drivers/gpu/drm/nouveau/nouveau_bios.h | 178 +- trunk/drivers/gpu/drm/nouveau/nouveau_bo.c | 437 +- trunk/drivers/gpu/drm/nouveau/nouveau_bo.h | 99 - trunk/drivers/gpu/drm/nouveau/nouveau_calc.c | 237 +- trunk/drivers/gpu/drm/nouveau/nouveau_chan.c | 400 -- trunk/drivers/gpu/drm/nouveau/nouveau_chan.h | 47 - .../drivers/gpu/drm/nouveau/nouveau_channel.c | 397 ++ .../gpu/drm/nouveau/nouveau_connector.c | 225 +- .../gpu/drm/nouveau/nouveau_connector.h | 5 +- .../drivers/gpu/drm/nouveau/nouveau_debugfs.c | 196 + .../drivers/gpu/drm/nouveau/nouveau_display.c | 263 +- .../drivers/gpu/drm/nouveau/nouveau_display.h | 94 - trunk/drivers/gpu/drm/nouveau/nouveau_dma.c | 56 +- trunk/drivers/gpu/drm/nouveau/nouveau_dma.h | 51 +- trunk/drivers/gpu/drm/nouveau/nouveau_dp.c | 282 +- trunk/drivers/gpu/drm/nouveau/nouveau_drm.c | 693 --- trunk/drivers/gpu/drm/nouveau/nouveau_drm.h | 144 - trunk/drivers/gpu/drm/nouveau/nouveau_drv.c | 513 ++ trunk/drivers/gpu/drm/nouveau/nouveau_drv.h | 1655 +++++ .../drivers/gpu/drm/nouveau/nouveau_encoder.h | 24 +- trunk/drivers/gpu/drm/nouveau/nouveau_fb.h | 47 + trunk/drivers/gpu/drm/nouveau/nouveau_fbcon.c | 233 +- trunk/drivers/gpu/drm/nouveau/nouveau_fbcon.h | 5 +- trunk/drivers/gpu/drm/nouveau/nouveau_fence.c | 30 +- trunk/drivers/gpu/drm/nouveau/nouveau_fence.h | 41 +- trunk/drivers/gpu/drm/nouveau/nouveau_fifo.h | 32 + trunk/drivers/gpu/drm/nouveau/nouveau_gem.c | 176 +- trunk/drivers/gpu/drm/nouveau/nouveau_gem.h | 43 - trunk/drivers/gpu/drm/nouveau/nouveau_gpio.c | 400 ++ trunk/drivers/gpu/drm/nouveau/nouveau_gpio.h | 71 + .../drivers/gpu/drm/nouveau/nouveau_gpuobj.c | 808 +++ .../engine/graph/ctx.h => nouveau_grctx.h} | 26 +- trunk/drivers/gpu/drm/nouveau/nouveau_hdmi.c | 43 +- trunk/drivers/gpu/drm/nouveau/nouveau_hw.c | 437 +- trunk/drivers/gpu/drm/nouveau/nouveau_hw.h | 184 +- trunk/drivers/gpu/drm/nouveau/nouveau_i2c.c | 394 ++ .../subdev/devinit/nv1a.c => nouveau_i2c.h} | 65 +- trunk/drivers/gpu/drm/nouveau/nouveau_ioc32.c | 5 +- trunk/drivers/gpu/drm/nouveau/nouveau_ioctl.h | 6 - trunk/drivers/gpu/drm/nouveau/nouveau_irq.c | 131 +- trunk/drivers/gpu/drm/nouveau/nouveau_irq.h | 11 - trunk/drivers/gpu/drm/nouveau/nouveau_mem.c | 744 ++- .../nouveau/{core/core/mm.c => nouveau_mm.c} | 174 +- trunk/drivers/gpu/drm/nouveau/nouveau_mm.h | 67 + trunk/drivers/gpu/drm/nouveau/nouveau_mxm.c | 723 +++ .../gpu/drm/nouveau/nouveau_notifier.c | 163 + trunk/drivers/gpu/drm/nouveau/nouveau_perf.c | 67 +- trunk/drivers/gpu/drm/nouveau/nouveau_pm.c | 462 +- trunk/drivers/gpu/drm/nouveau/nouveau_pm.h | 186 +- trunk/drivers/gpu/drm/nouveau/nouveau_prime.c | 10 +- trunk/drivers/gpu/drm/nouveau/nouveau_ramht.c | 309 + .../subdev/clock/nv40.c => nouveau_ramht.h} | 56 +- trunk/drivers/gpu/drm/nouveau/nouveau_sgdma.c | 377 +- .../gpu/drm/nouveau/nouveau_software.h | 56 + trunk/drivers/gpu/drm/nouveau/nouveau_state.c | 1306 ++++ trunk/drivers/gpu/drm/nouveau/nouveau_temp.c | 331 + trunk/drivers/gpu/drm/nouveau/nouveau_ttm.c | 354 +- trunk/drivers/gpu/drm/nouveau/nouveau_ttm.h | 25 - .../{core/core/enum.c => nouveau_util.c} | 47 +- trunk/drivers/gpu/drm/nouveau/nouveau_util.h | 49 + trunk/drivers/gpu/drm/nouveau/nouveau_vga.c | 99 - trunk/drivers/gpu/drm/nouveau/nouveau_vga.h | 8 - .../{core/subdev/vm/base.c => nouveau_vm.c} | 163 +- .../include/subdev/vm.h => nouveau_vm.h} | 87 +- trunk/drivers/gpu/drm/nouveau/nouveau_volt.c | 55 +- trunk/drivers/gpu/drm/nouveau/nv04_crtc.c | 146 +- trunk/drivers/gpu/drm/nouveau/nv04_cursor.c | 12 +- trunk/drivers/gpu/drm/nouveau/nv04_dac.c | 152 +- trunk/drivers/gpu/drm/nouveau/nv04_dfp.c | 138 +- trunk/drivers/gpu/drm/nouveau/nv04_display.c | 134 +- trunk/drivers/gpu/drm/nouveau/nv04_display.h | 184 - trunk/drivers/gpu/drm/nouveau/nv04_fb.c | 55 + trunk/drivers/gpu/drm/nouveau/nv04_fbcon.c | 70 +- trunk/drivers/gpu/drm/nouveau/nv04_fence.c | 67 +- trunk/drivers/gpu/drm/nouveau/nv04_fifo.c | 506 ++ trunk/drivers/gpu/drm/nouveau/nv04_graph.c | 1326 ++++ trunk/drivers/gpu/drm/nouveau/nv04_instmem.c | 193 + trunk/drivers/gpu/drm/nouveau/nv04_mc.c | 24 + trunk/drivers/gpu/drm/nouveau/nv04_pm.c | 39 +- trunk/drivers/gpu/drm/nouveau/nv04_software.c | 147 + trunk/drivers/gpu/drm/nouveau/nv04_timer.c | 84 + trunk/drivers/gpu/drm/nouveau/nv04_tv.c | 42 +- trunk/drivers/gpu/drm/nouveau/nv10_fb.c | 104 + trunk/drivers/gpu/drm/nouveau/nv10_fence.c | 103 +- trunk/drivers/gpu/drm/nouveau/nv10_fifo.c | 138 + trunk/drivers/gpu/drm/nouveau/nv10_gpio.c | 123 + trunk/drivers/gpu/drm/nouveau/nv10_graph.c | 1189 ++++ trunk/drivers/gpu/drm/nouveau/nv17_fifo.c | 177 + trunk/drivers/gpu/drm/nouveau/nv17_tv.c | 102 +- trunk/drivers/gpu/drm/nouveau/nv17_tv.h | 6 +- trunk/drivers/gpu/drm/nouveau/nv17_tv_modes.c | 9 +- trunk/drivers/gpu/drm/nouveau/nv20_fb.c | 148 + trunk/drivers/gpu/drm/nouveau/nv20_graph.c | 836 +++ trunk/drivers/gpu/drm/nouveau/nv30_fb.c | 116 + trunk/drivers/gpu/drm/nouveau/nv31_mpeg.c | 346 ++ trunk/drivers/gpu/drm/nouveau/nv40_fb.c | 163 + trunk/drivers/gpu/drm/nouveau/nv40_fifo.c | 210 + trunk/drivers/gpu/drm/nouveau/nv40_graph.c | 467 ++ .../engine/graph/ctxnv40.c => nv40_grctx.c} | 133 +- trunk/drivers/gpu/drm/nouveau/nv40_mc.c | 28 + trunk/drivers/gpu/drm/nouveau/nv40_pm.c | 184 +- .../subdev/clock/pllnva3.c => nv50_calc.c} | 69 +- trunk/drivers/gpu/drm/nouveau/nv50_crtc.c | 123 +- trunk/drivers/gpu/drm/nouveau/nv50_cursor.c | 35 +- trunk/drivers/gpu/drm/nouveau/nv50_dac.c | 93 +- trunk/drivers/gpu/drm/nouveau/nv50_display.c | 553 +- trunk/drivers/gpu/drm/nouveau/nv50_display.h | 32 +- trunk/drivers/gpu/drm/nouveau/nv50_evo.c | 270 +- trunk/drivers/gpu/drm/nouveau/nv50_fb.c | 296 + trunk/drivers/gpu/drm/nouveau/nv50_fbcon.c | 36 +- trunk/drivers/gpu/drm/nouveau/nv50_fence.c | 127 - trunk/drivers/gpu/drm/nouveau/nv50_fifo.c | 294 + trunk/drivers/gpu/drm/nouveau/nv50_gpio.c | 155 + trunk/drivers/gpu/drm/nouveau/nv50_graph.c | 868 +++ .../engine/graph/ctxnv50.c => nv50_grctx.c} | 561 +- trunk/drivers/gpu/drm/nouveau/nv50_instmem.c | 428 ++ trunk/drivers/gpu/drm/nouveau/nv50_mc.c | 40 + trunk/drivers/gpu/drm/nouveau/nv50_mpeg.c | 241 + trunk/drivers/gpu/drm/nouveau/nv50_pm.c | 249 +- trunk/drivers/gpu/drm/nouveau/nv50_software.c | 203 + trunk/drivers/gpu/drm/nouveau/nv50_sor.c | 137 +- .../{core/subdev/vm/nv50.c => nv50_vm.c} | 118 +- trunk/drivers/gpu/drm/nouveau/nv50_vram.c | 237 + trunk/drivers/gpu/drm/nouveau/nv84_bsp.c | 83 + trunk/drivers/gpu/drm/nouveau/nv84_crypt.c | 205 + trunk/drivers/gpu/drm/nouveau/nv84_fence.c | 127 +- trunk/drivers/gpu/drm/nouveau/nv84_fifo.c | 250 + trunk/drivers/gpu/drm/nouveau/nv84_vp.c | 83 + trunk/drivers/gpu/drm/nouveau/nv98_crypt.c | 216 + .../crypt/fuc/nv98.fuc => nv98_crypt.fuc} | 2 +- .../crypt/fuc/nv98.fuc.h => nv98_crypt.fuc.h} | 4 +- .../subdev/devinit/base.c => nv98_ppp.c} | 69 +- trunk/drivers/gpu/drm/nouveau/nva3_copy.c | 203 + .../copy/fuc/nva3.fuc => nva3_copy.fuc} | 0 .../copy/fuc/nva3.fuc.h => nva3_copy.fuc.h} | 4 +- trunk/drivers/gpu/drm/nouveau/nva3_pm.c | 276 +- trunk/drivers/gpu/drm/nouveau/nvc0_copy.c | 243 + .../copy/fuc/nvc0.fuc.h => nvc0_copy.fuc.h} | 4 +- trunk/drivers/gpu/drm/nouveau/nvc0_fb.c | 135 + trunk/drivers/gpu/drm/nouveau/nvc0_fbcon.c | 31 +- trunk/drivers/gpu/drm/nouveau/nvc0_fence.c | 150 +- trunk/drivers/gpu/drm/nouveau/nvc0_fifo.c | 477 ++ trunk/drivers/gpu/drm/nouveau/nvc0_graph.c | 897 +++ .../graph/fuc/nvc0.fuc => nvc0_graph.fuc} | 0 trunk/drivers/gpu/drm/nouveau/nvc0_graph.h | 97 + trunk/drivers/gpu/drm/nouveau/nvc0_grctx.c | 2878 +++++++++ .../graph/fuc/gpcnvc0.fuc => nvc0_grgpc.fuc} | 8 +- .../fuc/gpcnvc0.fuc.h => nvc0_grgpc.fuc.h} | 66 - .../graph/fuc/hubnvc0.fuc => nvc0_grhub.fuc} | 8 +- .../fuc/hubnvc0.fuc.h => nvc0_grhub.fuc.h} | 89 - trunk/drivers/gpu/drm/nouveau/nvc0_instmem.c | 223 + trunk/drivers/gpu/drm/nouveau/nvc0_pm.c | 178 +- trunk/drivers/gpu/drm/nouveau/nvc0_software.c | 153 + .../{core/subdev/vm/nvc0.c => nvc0_vm.c} | 123 +- trunk/drivers/gpu/drm/nouveau/nvc0_vram.c | 160 + trunk/drivers/gpu/drm/nouveau/nvd0_display.c | 508 +- trunk/drivers/gpu/drm/nouveau/nve0_fifo.c | 453 ++ trunk/drivers/gpu/drm/nouveau/nve0_graph.c | 831 +++ trunk/drivers/gpu/drm/nouveau/nve0_graph.h | 89 + trunk/drivers/gpu/drm/nouveau/nve0_grctx.c | 2777 +++++++++ trunk/drivers/gpu/drm/r128/r128_cce.c | 5 +- trunk/drivers/gpu/drm/r128/r128_drv.c | 7 +- trunk/drivers/gpu/drm/r128/r128_ioc32.c | 5 +- trunk/drivers/gpu/drm/r128/r128_irq.c | 5 +- trunk/drivers/gpu/drm/r128/r128_state.c | 5 +- trunk/drivers/gpu/drm/radeon/atom.h | 2 +- trunk/drivers/gpu/drm/radeon/atombios_crtc.c | 663 +- trunk/drivers/gpu/drm/radeon/atombios_dp.c | 10 +- .../gpu/drm/radeon/atombios_encoders.c | 373 +- trunk/drivers/gpu/drm/radeon/atombios_i2c.c | 4 +- trunk/drivers/gpu/drm/radeon/evergreen.c | 286 +- .../gpu/drm/radeon/evergreen_blit_kms.c | 5 +- trunk/drivers/gpu/drm/radeon/evergreen_cs.c | 63 +- trunk/drivers/gpu/drm/radeon/evergreen_hdmi.c | 4 +- trunk/drivers/gpu/drm/radeon/evergreen_reg.h | 2 - trunk/drivers/gpu/drm/radeon/evergreend.h | 7 - trunk/drivers/gpu/drm/radeon/ni.c | 138 +- trunk/drivers/gpu/drm/radeon/nid.h | 1 - trunk/drivers/gpu/drm/radeon/r100.c | 101 +- trunk/drivers/gpu/drm/radeon/r200.c | 5 +- trunk/drivers/gpu/drm/radeon/r300.c | 6 +- trunk/drivers/gpu/drm/radeon/r300_cmdbuf.c | 7 +- trunk/drivers/gpu/drm/radeon/r420.c | 2 +- trunk/drivers/gpu/drm/radeon/r520.c | 6 +- trunk/drivers/gpu/drm/radeon/r600.c | 41 +- trunk/drivers/gpu/drm/radeon/r600_audio.c | 2 +- trunk/drivers/gpu/drm/radeon/r600_blit.c | 120 +- trunk/drivers/gpu/drm/radeon/r600_blit_kms.c | 57 +- .../gpu/drm/radeon/r600_blit_shaders.h | 1 - trunk/drivers/gpu/drm/radeon/r600_cp.c | 5 +- trunk/drivers/gpu/drm/radeon/r600_cs.c | 7 +- trunk/drivers/gpu/drm/radeon/r600_hdmi.c | 6 +- trunk/drivers/gpu/drm/radeon/radeon.h | 192 +- trunk/drivers/gpu/drm/radeon/radeon_acpi.c | 613 +- trunk/drivers/gpu/drm/radeon/radeon_acpi.h | 445 -- trunk/drivers/gpu/drm/radeon/radeon_agp.c | 5 +- trunk/drivers/gpu/drm/radeon/radeon_asic.c | 93 +- trunk/drivers/gpu/drm/radeon/radeon_asic.h | 28 +- .../drivers/gpu/drm/radeon/radeon_atombios.c | 19 +- .../gpu/drm/radeon/radeon_atpx_handler.c | 411 +- trunk/drivers/gpu/drm/radeon/radeon_bios.c | 2 +- trunk/drivers/gpu/drm/radeon/radeon_clocks.c | 4 +- trunk/drivers/gpu/drm/radeon/radeon_combios.c | 13 +- .../gpu/drm/radeon/radeon_connectors.c | 53 +- trunk/drivers/gpu/drm/radeon/radeon_cp.c | 6 +- trunk/drivers/gpu/drm/radeon/radeon_cs.c | 87 +- trunk/drivers/gpu/drm/radeon/radeon_cursor.c | 4 +- trunk/drivers/gpu/drm/radeon/radeon_device.c | 11 +- trunk/drivers/gpu/drm/radeon/radeon_display.c | 8 +- trunk/drivers/gpu/drm/radeon/radeon_drv.c | 11 +- .../drivers/gpu/drm/radeon/radeon_encoders.c | 25 +- trunk/drivers/gpu/drm/radeon/radeon_fb.c | 27 +- trunk/drivers/gpu/drm/radeon/radeon_fence.c | 5 +- trunk/drivers/gpu/drm/radeon/radeon_gart.c | 606 +- trunk/drivers/gpu/drm/radeon/radeon_gem.c | 59 +- trunk/drivers/gpu/drm/radeon/radeon_i2c.c | 6 +- trunk/drivers/gpu/drm/radeon/radeon_ioc32.c | 7 +- trunk/drivers/gpu/drm/radeon/radeon_irq.c | 5 +- trunk/drivers/gpu/drm/radeon/radeon_irq_kms.c | 49 +- trunk/drivers/gpu/drm/radeon/radeon_kms.c | 22 +- .../gpu/drm/radeon/radeon_legacy_crtc.c | 7 +- .../gpu/drm/radeon/radeon_legacy_encoders.c | 71 +- .../drivers/gpu/drm/radeon/radeon_legacy_tv.c | 4 +- trunk/drivers/gpu/drm/radeon/radeon_mem.c | 5 +- trunk/drivers/gpu/drm/radeon/radeon_mode.h | 60 +- trunk/drivers/gpu/drm/radeon/radeon_object.c | 24 +- trunk/drivers/gpu/drm/radeon/radeon_object.h | 4 +- trunk/drivers/gpu/drm/radeon/radeon_pm.c | 106 +- trunk/drivers/gpu/drm/radeon/radeon_prime.c | 5 +- trunk/drivers/gpu/drm/radeon/radeon_ring.c | 34 +- trunk/drivers/gpu/drm/radeon/radeon_sa.c | 23 +- .../drivers/gpu/drm/radeon/radeon_semaphore.c | 3 +- trunk/drivers/gpu/drm/radeon/radeon_state.c | 8 +- trunk/drivers/gpu/drm/radeon/radeon_test.c | 2 +- .../gpu/drm/radeon/radeon_trace_points.c | 2 +- trunk/drivers/gpu/drm/radeon/radeon_ttm.c | 2 +- trunk/drivers/gpu/drm/radeon/rs400.c | 6 +- trunk/drivers/gpu/drm/radeon/rs600.c | 51 +- trunk/drivers/gpu/drm/radeon/rs690.c | 8 +- trunk/drivers/gpu/drm/radeon/rv515.c | 20 +- trunk/drivers/gpu/drm/radeon/rv770.c | 14 +- trunk/drivers/gpu/drm/radeon/si.c | 117 +- trunk/drivers/gpu/drm/radeon/sid.h | 15 - trunk/drivers/gpu/drm/savage/savage_bci.c | 6 +- trunk/drivers/gpu/drm/savage/savage_drv.c | 6 +- trunk/drivers/gpu/drm/savage/savage_state.c | 4 +- trunk/drivers/gpu/drm/shmobile/Kconfig | 10 - trunk/drivers/gpu/drm/shmobile/Makefile | 7 - .../gpu/drm/shmobile/shmob_drm_backlight.c | 90 - .../gpu/drm/shmobile/shmob_drm_backlight.h | 23 - .../drivers/gpu/drm/shmobile/shmob_drm_crtc.c | 763 --- .../drivers/gpu/drm/shmobile/shmob_drm_crtc.h | 60 - .../drivers/gpu/drm/shmobile/shmob_drm_drv.c | 361 -- .../drivers/gpu/drm/shmobile/shmob_drm_drv.h | 47 - .../drivers/gpu/drm/shmobile/shmob_drm_kms.c | 160 - .../drivers/gpu/drm/shmobile/shmob_drm_kms.h | 34 - .../gpu/drm/shmobile/shmob_drm_plane.c | 268 - .../gpu/drm/shmobile/shmob_drm_plane.h | 22 - .../drivers/gpu/drm/shmobile/shmob_drm_regs.h | 311 - trunk/drivers/gpu/drm/sis/sis_drv.c | 6 +- trunk/drivers/gpu/drm/sis/sis_drv.h | 2 +- trunk/drivers/gpu/drm/sis/sis_mm.c | 4 +- trunk/drivers/gpu/drm/tdfx/tdfx_drv.c | 4 +- trunk/drivers/gpu/drm/ttm/ttm_agp_backend.c | 8 +- trunk/drivers/gpu/drm/ttm/ttm_bo.c | 6 +- trunk/drivers/gpu/drm/ttm/ttm_bo_manager.c | 8 +- trunk/drivers/gpu/drm/ttm/ttm_bo_util.c | 6 +- trunk/drivers/gpu/drm/ttm/ttm_execbuf_util.c | 6 +- trunk/drivers/gpu/drm/ttm/ttm_lock.c | 4 +- trunk/drivers/gpu/drm/ttm/ttm_memory.c | 6 +- trunk/drivers/gpu/drm/ttm/ttm_module.c | 4 +- trunk/drivers/gpu/drm/ttm/ttm_object.c | 4 +- trunk/drivers/gpu/drm/ttm/ttm_page_alloc.c | 4 +- .../drivers/gpu/drm/ttm/ttm_page_alloc_dma.c | 9 +- trunk/drivers/gpu/drm/ttm/ttm_tt.c | 28 +- trunk/drivers/gpu/drm/udl/udl_connector.c | 11 +- trunk/drivers/gpu/drm/udl/udl_drv.c | 4 +- trunk/drivers/gpu/drm/udl/udl_encoder.c | 8 +- trunk/drivers/gpu/drm/udl/udl_fb.c | 35 +- trunk/drivers/gpu/drm/udl/udl_gem.c | 9 +- trunk/drivers/gpu/drm/udl/udl_main.c | 9 +- trunk/drivers/gpu/drm/udl/udl_modeset.c | 8 +- trunk/drivers/gpu/drm/udl/udl_transfer.c | 10 +- trunk/drivers/gpu/drm/via/via_dma.c | 5 +- trunk/drivers/gpu/drm/via/via_dmablit.c | 4 +- trunk/drivers/gpu/drm/via/via_drv.c | 6 +- trunk/drivers/gpu/drm/via/via_drv.h | 2 +- trunk/drivers/gpu/drm/via/via_irq.c | 5 +- trunk/drivers/gpu/drm/via/via_map.c | 4 +- trunk/drivers/gpu/drm/via/via_mm.c | 4 +- trunk/drivers/gpu/drm/via/via_verifier.c | 5 +- trunk/drivers/gpu/drm/via/via_video.c | 4 +- trunk/drivers/gpu/drm/vmwgfx/vmwgfx_buffer.c | 6 +- trunk/drivers/gpu/drm/vmwgfx/vmwgfx_dmabuf.c | 4 +- trunk/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 11 +- trunk/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h | 18 +- trunk/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c | 4 +- trunk/drivers/gpu/drm/vmwgfx/vmwgfx_fb.c | 4 +- trunk/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c | 2 +- trunk/drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c | 4 +- trunk/drivers/gpu/drm/vmwgfx/vmwgfx_gmr.c | 4 +- .../gpu/drm/vmwgfx/vmwgfx_gmrid_manager.c | 6 +- trunk/drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c | 2 +- trunk/drivers/gpu/drm/vmwgfx/vmwgfx_irq.c | 2 +- trunk/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 1 + trunk/drivers/gpu/drm/vmwgfx/vmwgfx_kms.h | 4 +- trunk/drivers/gpu/drm/vmwgfx/vmwgfx_overlay.c | 4 +- .../drivers/gpu/drm/vmwgfx/vmwgfx_resource.c | 8 +- .../drivers/gpu/drm/vmwgfx/vmwgfx_ttm_glue.c | 2 +- trunk/drivers/i2c/i2c-core.c | 2 +- trunk/drivers/ide/aec62xx.c | 2 +- trunk/drivers/ide/ali14xx.c | 4 +- trunk/drivers/ide/alim15x3.c | 2 +- trunk/drivers/ide/amd74xx.c | 2 +- trunk/drivers/ide/atiixp.c | 2 +- trunk/drivers/ide/cmd640.c | 2 +- trunk/drivers/ide/cmd64x.c | 2 +- trunk/drivers/ide/cs5520.c | 2 +- trunk/drivers/ide/cs5530.c | 2 +- trunk/drivers/ide/cs5535.c | 2 +- trunk/drivers/ide/cy82c693.c | 2 +- trunk/drivers/ide/dtc2278.c | 2 +- trunk/drivers/ide/hpt366.c | 24 +- trunk/drivers/ide/ht6560b.c | 2 +- trunk/drivers/ide/icside.c | 2 +- trunk/drivers/ide/ide-pci-generic.c | 2 +- trunk/drivers/ide/it8172.c | 2 +- trunk/drivers/ide/it8213.c | 2 +- trunk/drivers/ide/it821x.c | 2 +- trunk/drivers/ide/jmicron.c | 2 +- trunk/drivers/ide/ns87415.c | 2 +- trunk/drivers/ide/opti621.c | 2 +- trunk/drivers/ide/pdc202xx_new.c | 2 +- trunk/drivers/ide/pdc202xx_old.c | 2 +- trunk/drivers/ide/piix.c | 2 +- trunk/drivers/ide/qd65xx.c | 2 +- trunk/drivers/ide/rz1000.c | 2 +- trunk/drivers/ide/sc1200.c | 2 +- trunk/drivers/ide/scc_pata.c | 2 +- trunk/drivers/ide/serverworks.c | 2 +- trunk/drivers/ide/siimage.c | 2 +- trunk/drivers/ide/sis5513.c | 2 +- trunk/drivers/ide/sl82c105.c | 2 +- trunk/drivers/ide/slc90e66.c | 2 +- trunk/drivers/ide/tc86c001.c | 2 +- trunk/drivers/ide/triflex.c | 2 +- trunk/drivers/ide/trm290.c | 2 +- trunk/drivers/ide/tx4938ide.c | 2 +- trunk/drivers/ide/tx4939ide.c | 2 +- trunk/drivers/ide/umc8672.c | 2 +- trunk/drivers/ide/via82cxxx.c | 2 +- trunk/drivers/infiniband/core/cm.c | 2 +- trunk/drivers/infiniband/core/ucma.c | 10 +- trunk/drivers/infiniband/core/uverbs_cmd.c | 21 +- trunk/drivers/infiniband/core/uverbs_main.c | 11 +- trunk/drivers/infiniband/hw/mlx4/cm.c | 2 +- trunk/drivers/input/misc/twl4030-vibra.c | 18 +- trunk/drivers/input/touchscreen/88pm860x-ts.c | 127 +- trunk/drivers/leds/leds-88pm860x.c | 205 +- trunk/drivers/macintosh/macio_asic.c | 2 +- trunk/drivers/message/fusion/mptbase.c | 18 +- trunk/drivers/mfd/88pm860x-core.c | 805 +-- trunk/drivers/mfd/88pm860x-i2c.c | 174 +- trunk/drivers/mfd/Kconfig | 75 +- trunk/drivers/mfd/Makefile | 12 +- trunk/drivers/mfd/ab3100-core.c | 1 - trunk/drivers/mfd/ab8500-core.c | 37 +- trunk/drivers/mfd/anatop-mfd.c | 124 + trunk/drivers/mfd/arizona-irq.c | 56 +- trunk/drivers/mfd/da9055-core.c | 423 -- trunk/drivers/mfd/da9055-i2c.c | 93 - trunk/drivers/mfd/db8500-prcmu.c | 47 +- trunk/drivers/mfd/lp8788-irq.c | 198 - trunk/drivers/mfd/lp8788.c | 245 - trunk/drivers/mfd/lpc_ich.c | 43 +- trunk/drivers/mfd/max8907.c | 351 -- trunk/drivers/mfd/max8925-core.c | 427 +- trunk/drivers/mfd/mc13xxx-core.c | 1 + trunk/drivers/mfd/omap-usb-host.c | 238 +- trunk/drivers/mfd/omap-usb-tll.c | 471 -- trunk/drivers/mfd/palmas.c | 149 +- trunk/drivers/mfd/rc5t583-irq.c | 2 +- trunk/drivers/mfd/rc5t583.c | 2 +- trunk/drivers/mfd/smsc-ece1099.c | 113 - trunk/drivers/mfd/syscon.c | 176 - trunk/drivers/mfd/tc3589x.c | 112 +- trunk/drivers/mfd/tps65090.c | 2 +- trunk/drivers/mfd/tps65217.c | 3 - trunk/drivers/mfd/tps6586x.c | 19 - trunk/drivers/mfd/tps65910.c | 32 - trunk/drivers/mfd/twl-core.c | 156 +- trunk/drivers/mfd/twl4030-audio.c | 105 +- .../{pwm/pwm-twl6030.c => mfd/twl6030-pwm.c} | 119 +- trunk/drivers/mfd/twl6040-core.c | 17 +- trunk/drivers/mfd/wm5110-tables.c | 96 +- trunk/drivers/mfd/wm831x-core.c | 66 +- trunk/drivers/mfd/wm8994-core.c | 8 +- trunk/drivers/mfd/wm8994-regmap.c | 2 +- trunk/drivers/mmc/host/sdhci-pci.c | 2 +- trunk/drivers/mtd/mtdpart.c | 12 +- trunk/drivers/mtd/ubi/Kconfig | 40 +- trunk/drivers/mtd/ubi/attach.c | 46 +- trunk/drivers/mtd/ubi/build.c | 204 +- trunk/drivers/mtd/ubi/cdev.c | 18 +- trunk/drivers/mtd/ubi/debug.c | 153 +- trunk/drivers/mtd/ubi/debug.h | 12 +- trunk/drivers/mtd/ubi/eba.c | 33 +- trunk/drivers/mtd/ubi/gluebi.c | 30 +- trunk/drivers/mtd/ubi/io.c | 80 +- trunk/drivers/mtd/ubi/misc.c | 14 +- trunk/drivers/mtd/ubi/ubi.h | 16 +- trunk/drivers/mtd/ubi/vtbl.c | 10 +- trunk/drivers/mtd/ubi/wl.c | 48 +- trunk/drivers/net/can/slcan.c | 2 +- trunk/drivers/net/can/vcan.c | 2 +- trunk/drivers/net/ethernet/8390/ne3210.c | 2 +- trunk/drivers/net/ethernet/adaptec/starfire.c | 2 +- .../net/ethernet/atheros/atl1c/atl1c_main.c | 2 +- .../drivers/net/ethernet/atheros/atlx/atl2.c | 2 +- .../drivers/net/ethernet/dec/tulip/de2104x.c | 7 +- trunk/drivers/net/ethernet/dec/tulip/eeprom.c | 2 +- .../net/ethernet/dec/tulip/tulip_core.c | 7 +- .../net/ethernet/dec/tulip/winbond-840.c | 2 +- trunk/drivers/net/ethernet/dlink/sundance.c | 2 +- trunk/drivers/net/ethernet/fealnx.c | 2 +- .../net/ethernet/oki-semi/pch_gbe/Kconfig | 2 +- .../net/ethernet/qlogic/qlcnic/qlcnic_hw.c | 2 +- trunk/drivers/net/ethernet/realtek/8139too.c | 2 +- trunk/drivers/net/ethernet/sfc/efx.c | 4 +- trunk/drivers/net/ethernet/sfc/net_driver.h | 12 + trunk/drivers/net/ethernet/sfc/nic.c | 4 +- trunk/drivers/net/ethernet/sis/sis190.c | 2 +- trunk/drivers/net/hamradio/6pack.c | 6 +- trunk/drivers/net/hamradio/bpqether.c | 2 +- trunk/drivers/net/hamradio/mkiss.c | 6 +- trunk/drivers/net/hamradio/scc.c | 2 +- trunk/drivers/net/hamradio/yam.c | 2 +- trunk/drivers/net/rionet.c | 141 +- trunk/drivers/net/wan/z85230.c | 2 +- trunk/drivers/net/xen-netback/netback.c | 11 +- trunk/drivers/of/address.c | 35 +- trunk/drivers/of/base.c | 23 - trunk/drivers/of/irq.c | 1 - trunk/drivers/of/of_i2c.c | 3 - trunk/drivers/of/platform.c | 16 +- trunk/drivers/pci/pci-driver.c | 17 + trunk/drivers/pci/xen-pcifront.c | 15 +- trunk/drivers/platform/x86/amilo-rfkill.c | 2 +- trunk/drivers/platform/x86/fujitsu-tablet.c | 10 +- trunk/drivers/platform/x86/thinkpad_acpi.c | 2 +- trunk/drivers/pps/pps.c | 2 +- trunk/drivers/pwm/Kconfig | 9 - trunk/drivers/pwm/Makefile | 1 - trunk/drivers/rapidio/devices/tsi721.c | 94 +- trunk/drivers/rapidio/devices/tsi721.h | 15 +- trunk/drivers/rapidio/rio-scan.c | 335 +- trunk/drivers/rapidio/rio.c | 95 +- trunk/drivers/regulator/88pm8607.c | 136 +- trunk/drivers/regulator/Kconfig | 2 +- trunk/drivers/regulator/ab3100.c | 1 - trunk/drivers/regulator/anatop-regulator.c | 31 +- trunk/drivers/regulator/max8925-regulator.c | 35 +- trunk/drivers/regulator/palmas-regulator.c | 127 +- trunk/drivers/regulator/wm831x-dcdc.c | 12 +- trunk/drivers/regulator/wm831x-isink.c | 4 +- trunk/drivers/regulator/wm831x-ldo.c | 12 +- trunk/drivers/remoteproc/Kconfig | 14 - trunk/drivers/remoteproc/Makefile | 1 - trunk/drivers/remoteproc/omap_remoteproc.c | 3 - trunk/drivers/remoteproc/remoteproc_core.c | 209 +- trunk/drivers/remoteproc/remoteproc_debugfs.c | 85 +- .../drivers/remoteproc/remoteproc_internal.h | 1 - trunk/drivers/remoteproc/ste_modem_rproc.c | 322 - trunk/drivers/rtc/Kconfig | 87 +- trunk/drivers/rtc/Makefile | 5 - trunk/drivers/rtc/class.c | 9 +- trunk/drivers/rtc/hctosys.c | 4 +- trunk/drivers/rtc/rtc-88pm860x.c | 43 +- trunk/drivers/rtc/rtc-at91sam9.c | 13 +- trunk/drivers/rtc/rtc-coh901331.c | 3 +- trunk/drivers/rtc/rtc-ds1672.c | 26 +- trunk/drivers/rtc/rtc-ds2404.c | 303 - trunk/drivers/rtc/rtc-em3027.c | 17 +- trunk/drivers/rtc/rtc-isl1208.c | 21 +- trunk/drivers/rtc/rtc-jz4740.c | 2 +- trunk/drivers/rtc/rtc-m41t80.c | 157 +- trunk/drivers/rtc/rtc-max8907.c | 244 - trunk/drivers/rtc/rtc-mxc.c | 30 +- trunk/drivers/rtc/rtc-pcf8563.c | 13 +- trunk/drivers/rtc/rtc-proc.c | 24 +- trunk/drivers/rtc/rtc-rc5t583.c | 331 - trunk/drivers/rtc/rtc-rs5c372.c | 7 +- trunk/drivers/rtc/rtc-s35390a.c | 129 +- trunk/drivers/rtc/rtc-s3c.c | 4 +- trunk/drivers/rtc/rtc-snvs.c | 350 -- trunk/drivers/rtc/rtc-spear.c | 12 +- trunk/drivers/rtc/rtc-sysfs.c | 6 - trunk/drivers/rtc/rtc-tps65910.c | 349 -- trunk/drivers/rtc/rtc-x1205.c | 92 +- trunk/drivers/s390/scsi/zfcp_aux.c | 1 - trunk/drivers/s390/scsi/zfcp_ccw.c | 80 +- trunk/drivers/s390/scsi/zfcp_cfdc.c | 2 +- trunk/drivers/s390/scsi/zfcp_dbf.c | 22 +- trunk/drivers/s390/scsi/zfcp_dbf.h | 1 - trunk/drivers/s390/scsi/zfcp_def.h | 2 - trunk/drivers/s390/scsi/zfcp_erp.c | 2 +- trunk/drivers/s390/scsi/zfcp_ext.h | 4 - trunk/drivers/s390/scsi/zfcp_fc.c | 23 +- trunk/drivers/s390/scsi/zfcp_fsf.c | 59 +- trunk/drivers/s390/scsi/zfcp_qdio.c | 16 +- trunk/drivers/s390/scsi/zfcp_sysfs.c | 18 +- trunk/drivers/s390/scsi/zfcp_unit.c | 36 +- trunk/drivers/scsi/aacraid/linit.c | 2 +- trunk/drivers/scsi/aic94xx/aic94xx_init.c | 2 +- trunk/drivers/scsi/atp870u.c | 11 +- trunk/drivers/scsi/be2iscsi/be_cmds.c | 160 +- trunk/drivers/scsi/be2iscsi/be_cmds.h | 27 - trunk/drivers/scsi/be2iscsi/be_iscsi.c | 355 +- trunk/drivers/scsi/be2iscsi/be_main.c | 890 ++- trunk/drivers/scsi/be2iscsi/be_main.h | 40 +- trunk/drivers/scsi/be2iscsi/be_mgmt.c | 314 +- trunk/drivers/scsi/be2iscsi/be_mgmt.h | 11 - trunk/drivers/scsi/bfa/bfa_core.c | 21 +- trunk/drivers/scsi/bfa/bfa_cs.h | 4 +- trunk/drivers/scsi/bfa/bfa_defs_fcs.h | 18 - trunk/drivers/scsi/bfa/bfa_fc.h | 10 - trunk/drivers/scsi/bfa/bfa_fcbuild.c | 21 - trunk/drivers/scsi/bfa/bfa_fcbuild.h | 2 - trunk/drivers/scsi/bfa/bfa_fcpim.c | 12 +- trunk/drivers/scsi/bfa/bfa_fcs.c | 182 +- trunk/drivers/scsi/bfa/bfa_fcs.h | 66 +- trunk/drivers/scsi/bfa/bfa_fcs_fcpim.c | 129 +- trunk/drivers/scsi/bfa/bfa_fcs_lport.c | 632 +- trunk/drivers/scsi/bfa/bfa_fcs_rport.c | 466 +- trunk/drivers/scsi/bfa/bfa_ioc.c | 24 +- trunk/drivers/scsi/bfa/bfa_ioc.h | 2 - trunk/drivers/scsi/bfa/bfa_modules.h | 1 - trunk/drivers/scsi/bfa/bfa_svc.c | 95 +- trunk/drivers/scsi/bfa/bfa_svc.h | 23 +- trunk/drivers/scsi/bfa/bfad.c | 236 +- trunk/drivers/scsi/bfa/bfad_attr.c | 46 +- trunk/drivers/scsi/bfa/bfad_bsg.c | 39 +- trunk/drivers/scsi/bfa/bfad_bsg.h | 2 - trunk/drivers/scsi/bfa/bfad_drv.h | 5 +- trunk/drivers/scsi/bfa/bfad_im.c | 9 - trunk/drivers/scsi/bnx2fc/bnx2fc_io.c | 2 +- trunk/drivers/scsi/constants.c | 3 +- .../scsi/device_handler/scsi_dh_alua.c | 3 +- .../scsi/device_handler/scsi_dh_rdac.c | 26 +- trunk/drivers/scsi/hpsa.c | 39 +- trunk/drivers/scsi/ibmvscsi/Makefile | 6 +- trunk/drivers/scsi/ibmvscsi/ibmvfc.c | 36 +- trunk/drivers/scsi/ibmvscsi/ibmvfc.h | 4 +- trunk/drivers/scsi/ibmvscsi/ibmvscsi.c | 352 +- trunk/drivers/scsi/ibmvscsi/ibmvscsi.h | 22 + trunk/drivers/scsi/ibmvscsi/rpa_vscsi.c | 368 ++ trunk/drivers/scsi/ipr.c | 168 +- trunk/drivers/scsi/ipr.h | 5 +- trunk/drivers/scsi/isci/host.c | 24 +- trunk/drivers/scsi/isci/host.h | 2 +- trunk/drivers/scsi/isci/init.c | 59 +- trunk/drivers/scsi/isci/phy.c | 4 +- trunk/drivers/scsi/isci/probe_roms.c | 1 + trunk/drivers/scsi/isci/remote_node_context.h | 2 +- trunk/drivers/scsi/iscsi_tcp.c | 2 +- trunk/drivers/scsi/libsas/sas_ata.c | 91 +- trunk/drivers/scsi/libsas/sas_discover.c | 69 +- trunk/drivers/scsi/libsas/sas_dump.c | 1 - trunk/drivers/scsi/libsas/sas_event.c | 4 +- trunk/drivers/scsi/libsas/sas_init.c | 90 +- trunk/drivers/scsi/libsas/sas_internal.h | 1 - trunk/drivers/scsi/libsas/sas_phy.c | 21 - trunk/drivers/scsi/libsas/sas_port.c | 52 +- trunk/drivers/scsi/lpfc/lpfc.h | 6 +- trunk/drivers/scsi/lpfc/lpfc_attr.c | 76 +- trunk/drivers/scsi/lpfc/lpfc_bsg.c | 8 +- trunk/drivers/scsi/lpfc/lpfc_crtn.h | 6 +- trunk/drivers/scsi/lpfc/lpfc_ct.c | 16 +- trunk/drivers/scsi/lpfc/lpfc_debugfs.c | 494 +- trunk/drivers/scsi/lpfc/lpfc_debugfs.h | 72 +- trunk/drivers/scsi/lpfc/lpfc_disc.h | 10 +- trunk/drivers/scsi/lpfc/lpfc_els.c | 186 +- trunk/drivers/scsi/lpfc/lpfc_hbadisc.c | 98 +- trunk/drivers/scsi/lpfc/lpfc_hw.h | 18 +- trunk/drivers/scsi/lpfc/lpfc_hw4.h | 42 +- trunk/drivers/scsi/lpfc/lpfc_init.c | 839 +-- trunk/drivers/scsi/lpfc/lpfc_mbox.c | 38 +- trunk/drivers/scsi/lpfc/lpfc_mem.c | 6 +- trunk/drivers/scsi/lpfc/lpfc_nportdisc.c | 127 - trunk/drivers/scsi/lpfc/lpfc_scsi.c | 144 +- trunk/drivers/scsi/lpfc/lpfc_sli.c | 621 +- trunk/drivers/scsi/lpfc/lpfc_sli.h | 42 +- trunk/drivers/scsi/lpfc/lpfc_sli4.h | 63 +- trunk/drivers/scsi/lpfc/lpfc_version.h | 7 +- trunk/drivers/scsi/megaraid/megaraid_sas.h | 8 +- .../drivers/scsi/megaraid/megaraid_sas_base.c | 39 +- .../scsi/megaraid/megaraid_sas_fusion.c | 12 +- trunk/drivers/scsi/mpt2sas/Kconfig | 2 +- trunk/drivers/scsi/mpt2sas/mpi/mpi2.h | 14 +- trunk/drivers/scsi/mpt2sas/mpi/mpi2_init.h | 9 +- trunk/drivers/scsi/mpt2sas/mpi/mpi2_ioc.h | 8 +- trunk/drivers/scsi/mpt2sas/mpi/mpi2_raid.h | 7 +- trunk/drivers/scsi/mpt2sas/mpt2sas_base.c | 6 +- trunk/drivers/scsi/mpt2sas/mpt2sas_base.h | 14 +- trunk/drivers/scsi/mpt2sas/mpt2sas_config.c | 38 +- trunk/drivers/scsi/mpt2sas/mpt2sas_ctl.c | 80 +- trunk/drivers/scsi/mpt2sas/mpt2sas_ctl.h | 2 +- trunk/drivers/scsi/mpt2sas/mpt2sas_debug.h | 2 +- trunk/drivers/scsi/mpt2sas/mpt2sas_scsih.c | 59 +- .../drivers/scsi/mpt2sas/mpt2sas_transport.c | 2 +- trunk/drivers/scsi/mvsas/mv_sas.c | 2 +- trunk/drivers/scsi/qla2xxx/qla_attr.c | 147 +- trunk/drivers/scsi/qla2xxx/qla_bsg.c | 376 +- trunk/drivers/scsi/qla2xxx/qla_bsg.h | 30 +- trunk/drivers/scsi/qla2xxx/qla_dbg.c | 29 +- trunk/drivers/scsi/qla2xxx/qla_dbg.h | 2 +- trunk/drivers/scsi/qla2xxx/qla_def.h | 166 +- trunk/drivers/scsi/qla2xxx/qla_dfs.c | 2 +- trunk/drivers/scsi/qla2xxx/qla_fw.h | 49 +- trunk/drivers/scsi/qla2xxx/qla_gbl.h | 39 +- trunk/drivers/scsi/qla2xxx/qla_gs.c | 4 +- trunk/drivers/scsi/qla2xxx/qla_init.c | 565 +- trunk/drivers/scsi/qla2xxx/qla_inline.h | 28 +- trunk/drivers/scsi/qla2xxx/qla_iocb.c | 261 +- trunk/drivers/scsi/qla2xxx/qla_isr.c | 437 +- trunk/drivers/scsi/qla2xxx/qla_mbx.c | 224 +- trunk/drivers/scsi/qla2xxx/qla_mid.c | 5 +- trunk/drivers/scsi/qla2xxx/qla_nx.c | 151 +- trunk/drivers/scsi/qla2xxx/qla_nx.h | 17 +- trunk/drivers/scsi/qla2xxx/qla_os.c | 770 +-- trunk/drivers/scsi/qla2xxx/qla_settings.h | 2 +- trunk/drivers/scsi/qla2xxx/qla_sup.c | 67 +- trunk/drivers/scsi/qla2xxx/qla_version.h | 6 +- trunk/drivers/scsi/qla4xxx/Kconfig | 4 +- trunk/drivers/scsi/qla4xxx/Makefile | 2 +- trunk/drivers/scsi/qla4xxx/ql4_83xx.c | 1611 ----- trunk/drivers/scsi/qla4xxx/ql4_83xx.h | 283 - trunk/drivers/scsi/qla4xxx/ql4_attr.c | 26 +- trunk/drivers/scsi/qla4xxx/ql4_dbg.c | 32 +- trunk/drivers/scsi/qla4xxx/ql4_dbg.h | 2 +- trunk/drivers/scsi/qla4xxx/ql4_def.h | 65 +- trunk/drivers/scsi/qla4xxx/ql4_fw.h | 59 +- trunk/drivers/scsi/qla4xxx/ql4_glbl.h | 94 +- trunk/drivers/scsi/qla4xxx/ql4_init.c | 23 +- trunk/drivers/scsi/qla4xxx/ql4_inline.h | 2 +- trunk/drivers/scsi/qla4xxx/ql4_iocb.c | 28 +- trunk/drivers/scsi/qla4xxx/ql4_isr.c | 406 +- trunk/drivers/scsi/qla4xxx/ql4_mbx.c | 186 +- trunk/drivers/scsi/qla4xxx/ql4_nvram.c | 2 +- trunk/drivers/scsi/qla4xxx/ql4_nvram.h | 2 +- trunk/drivers/scsi/qla4xxx/ql4_nx.c | 1432 ++--- trunk/drivers/scsi/qla4xxx/ql4_nx.h | 198 +- trunk/drivers/scsi/qla4xxx/ql4_os.c | 494 +- trunk/drivers/scsi/qla4xxx/ql4_version.h | 4 +- trunk/drivers/scsi/scsi_debug.c | 30 +- trunk/drivers/scsi/scsi_devinfo.c | 1 - trunk/drivers/scsi/scsi_lib.c | 3 +- trunk/drivers/scsi/scsi_scan.c | 3 - trunk/drivers/scsi/scsi_sysfs.c | 30 +- trunk/drivers/scsi/sd.c | 80 +- trunk/drivers/scsi/sd.h | 2 +- trunk/drivers/scsi/sd_dif.c | 25 +- trunk/drivers/scsi/st.c | 416 +- trunk/drivers/scsi/st.h | 5 +- trunk/drivers/spi/spi-s3c64xx.c | 7 +- trunk/drivers/staging/android/binder.c | 111 +- trunk/drivers/staging/dgrp/dgrp_common.c | 4 +- .../drivers/staging/omapdrm/omap_connector.c | 5 +- trunk/drivers/staging/omapdrm/omap_fbdev.c | 4 +- trunk/drivers/staging/omapdrm/omap_gem.c | 3 +- trunk/drivers/thermal/thermal_sys.c | 2 +- trunk/drivers/tty/hvc/hvc_xen.c | 2 - trunk/drivers/tty/tty_io.c | 45 +- trunk/drivers/usb/gadget/f_fs.c | 4 +- trunk/drivers/vfio/vfio.c | 15 +- trunk/drivers/vhost/vhost.c | 8 +- trunk/drivers/video/aty/aty128fb.c | 2 +- trunk/drivers/video/backlight/88pm860x_bl.c | 146 +- trunk/drivers/video/backlight/Kconfig | 30 +- trunk/drivers/video/backlight/Makefile | 4 +- trunk/drivers/video/backlight/da9052_bl.c | 4 +- trunk/drivers/video/backlight/kb3886_bl.c | 4 +- trunk/drivers/video/backlight/lm3630_bl.c | 475 -- trunk/drivers/video/backlight/lm3639_bl.c | 437 -- trunk/drivers/video/backlight/ltv350qv.c | 6 +- trunk/drivers/video/backlight/max8925_bl.c | 79 +- trunk/drivers/video/backlight/platform_lcd.c | 10 - trunk/drivers/video/backlight/progear_bl.c | 162 + trunk/drivers/video/backlight/tps65217_bl.c | 342 -- trunk/drivers/video/geode/gx1fb_core.c | 2 +- trunk/drivers/video/gxt4500.c | 4 +- trunk/drivers/video/i810/i810_main.c | 2 +- trunk/drivers/video/jz4740_fb.c | 2 +- trunk/drivers/video/msm/mdp.c | 12 +- trunk/drivers/watchdog/iTCO_wdt.c | 1 - trunk/drivers/xen/events.c | 18 +- trunk/drivers/xen/gntdev.c | 2 +- trunk/drivers/xen/grant-table.c | 67 +- trunk/drivers/xen/privcmd.c | 135 +- trunk/drivers/xen/swiotlb-xen.c | 119 +- trunk/drivers/xen/sys-hypervisor.c | 13 +- trunk/drivers/xen/tmem.c | 1 - trunk/drivers/xen/xen-acpi-processor.c | 1 + trunk/drivers/xen/xen-pciback/pci_stub.c | 136 +- trunk/drivers/xen/xenbus/xenbus_client.c | 6 +- trunk/drivers/xen/xenbus/xenbus_comms.c | 2 +- trunk/drivers/xen/xenbus/xenbus_dev_backend.c | 2 +- trunk/drivers/xen/xenbus/xenbus_probe.c | 56 +- .../xen/xenbus/xenbus_probe_frontend.c | 1 - trunk/drivers/xen/xenbus/xenbus_xs.c | 3 +- trunk/fs/9p/v9fs.c | 5 - trunk/fs/Kconfig.binfmt | 8 - trunk/fs/Makefile | 1 - trunk/fs/adfs/super.c | 5 - trunk/fs/affs/super.c | 5 - trunk/fs/afs/super.c | 5 - trunk/fs/attr.c | 2 - trunk/fs/autofs4/dev-ioctl.c | 18 +- trunk/fs/autofs4/waitq.c | 3 +- trunk/fs/befs/linuxvfs.c | 5 - trunk/fs/bfs/inode.c | 5 - trunk/fs/binfmt_aout.c | 54 +- trunk/fs/binfmt_elf.c | 168 +- trunk/fs/binfmt_elf_fdpic.c | 6 +- trunk/fs/binfmt_flat.c | 2 +- trunk/fs/btrfs/extent_io.c | 6 - trunk/fs/btrfs/inode.c | 5 - trunk/fs/btrfs/ioctl.c | 32 +- trunk/fs/btrfs/reada.c | 18 +- trunk/fs/ceph/inode.c | 4 +- trunk/fs/ceph/super.c | 5 - trunk/fs/cifs/cifsfs.c | 5 - trunk/fs/coda/inode.c | 37 +- trunk/fs/compat.c | 112 +- trunk/fs/compat_binfmt_elf.c | 7 - trunk/fs/compat_ioctl.c | 27 +- trunk/fs/coredump.c | 692 --- trunk/fs/coredump.h | 6 - trunk/fs/dcache.c | 2 +- trunk/fs/ecryptfs/main.c | 6 - trunk/fs/efs/super.c | 5 - trunk/fs/eventpoll.c | 61 +- trunk/fs/exec.c | 691 ++- trunk/fs/exofs/super.c | 5 - trunk/fs/ext2/super.c | 5 - trunk/fs/ext3/super.c | 13 +- trunk/fs/ext4/ioctl.c | 15 +- trunk/fs/ext4/super.c | 5 - trunk/fs/fat/Makefile | 2 +- trunk/fs/fat/cache.c | 10 +- trunk/fs/fat/dir.c | 56 +- trunk/fs/fat/fat.h | 97 +- trunk/fs/fat/fatent.c | 13 +- trunk/fs/fat/inode.c | 192 +- trunk/fs/fat/namei_msdos.c | 7 +- trunk/fs/fat/namei_vfat.c | 5 +- trunk/fs/fat/nfs.c | 101 - trunk/fs/fcntl.c | 166 +- trunk/fs/fhandle.c | 17 +- trunk/fs/file.c | 573 +- trunk/fs/file_table.c | 108 +- trunk/fs/freevxfs/vxfs_super.c | 5 - trunk/fs/fuse/dev.c | 3 +- trunk/fs/fuse/inode.c | 6 - trunk/fs/hfs/super.c | 6 - trunk/fs/hfsplus/super.c | 6 - trunk/fs/hpfs/anode.c | 6 +- trunk/fs/hpfs/dnode.c | 28 +- trunk/fs/hpfs/super.c | 5 - trunk/fs/hugetlbfs/inode.c | 5 - trunk/fs/ioctl.c | 25 +- trunk/fs/isofs/inode.c | 5 - trunk/fs/jbd/commit.c | 45 +- trunk/fs/jbd/transaction.c | 64 +- trunk/fs/jffs2/super.c | 6 - trunk/fs/jfs/Makefile | 2 +- trunk/fs/jfs/ioctl.c | 43 +- trunk/fs/jfs/jfs_discard.c | 117 - trunk/fs/jfs/jfs_discard.h | 26 - trunk/fs/jfs/jfs_dmap.c | 126 +- trunk/fs/jfs/jfs_dmap.h | 2 - trunk/fs/jfs/jfs_filsys.h | 3 - trunk/fs/jfs/jfs_incore.h | 1 - trunk/fs/jfs/jfs_txnmgr.c | 9 +- trunk/fs/jfs/super.c | 77 +- trunk/fs/locks.c | 20 +- trunk/fs/logfs/inode.c | 5 - trunk/fs/minix/inode.c | 5 - trunk/fs/namei.c | 41 +- trunk/fs/ncpfs/inode.c | 5 - trunk/fs/nfs/inode.c | 5 - trunk/fs/nfsd/nfs4state.c | 3 +- trunk/fs/nilfs2/super.c | 6 - trunk/fs/notify/fanotify/fanotify_user.c | 87 +- trunk/fs/notify/inotify/inotify_user.c | 28 +- trunk/fs/ntfs/super.c | 6 - trunk/fs/ocfs2/cluster/heartbeat.c | 38 +- trunk/fs/ocfs2/dlmfs/dlmfs.c | 5 - trunk/fs/ocfs2/super.c | 5 - trunk/fs/omfs/file.c | 5 +- trunk/fs/open.c | 130 +- trunk/fs/openpromfs/inode.c | 5 - trunk/fs/pipe.c | 31 +- trunk/fs/proc/Makefile | 2 +- trunk/fs/proc/base.c | 417 +- trunk/fs/proc/fd.c | 367 -- trunk/fs/proc/fd.h | 14 - trunk/fs/proc/generic.c | 15 +- trunk/fs/proc/inode.c | 1 + trunk/fs/proc/internal.h | 48 - trunk/fs/proc/proc_sysctl.c | 3 +- trunk/fs/proc/root.c | 2 +- trunk/fs/qnx4/inode.c | 5 - trunk/fs/qnx6/inode.c | 5 - trunk/fs/read_write.c | 180 +- trunk/fs/read_write.h | 2 - trunk/fs/readdir.c | 36 +- trunk/fs/reiserfs/super.c | 5 - trunk/fs/reiserfs/xattr.c | 2 +- trunk/fs/romfs/super.c | 5 - trunk/fs/select.c | 31 +- trunk/fs/signalfd.c | 13 +- trunk/fs/splice.c | 69 +- trunk/fs/squashfs/super.c | 5 - trunk/fs/stat.c | 10 +- trunk/fs/statfs.c | 9 +- trunk/fs/super.c | 8 +- trunk/fs/sync.c | 33 +- trunk/fs/sysv/inode.c | 5 - trunk/fs/timerfd.c | 45 +- trunk/fs/ubifs/budget.c | 5 +- trunk/fs/ubifs/commit.c | 8 +- trunk/fs/ubifs/compress.c | 7 +- trunk/fs/ubifs/debug.c | 633 +- trunk/fs/ubifs/debug.h | 15 +- trunk/fs/ubifs/dir.c | 4 +- trunk/fs/ubifs/file.c | 4 +- trunk/fs/ubifs/gc.c | 6 +- trunk/fs/ubifs/log.c | 14 +- trunk/fs/ubifs/lprops.c | 66 +- trunk/fs/ubifs/lpt.c | 5 +- trunk/fs/ubifs/lpt_commit.c | 58 +- trunk/fs/ubifs/orphan.c | 7 +- trunk/fs/ubifs/recovery.c | 11 +- trunk/fs/ubifs/replay.c | 16 +- trunk/fs/ubifs/sb.c | 19 +- trunk/fs/ubifs/scan.c | 15 +- trunk/fs/ubifs/super.c | 125 +- trunk/fs/ubifs/tnc_misc.c | 4 +- trunk/fs/ubifs/ubifs.h | 13 +- trunk/fs/udf/file.c | 9 - trunk/fs/udf/inode.c | 59 +- trunk/fs/udf/super.c | 5 - trunk/fs/ufs/super.c | 5 - trunk/fs/utimes.c | 11 +- trunk/fs/xattr.c | 58 +- trunk/fs/xfs/xfs_dfrag.c | 34 +- trunk/fs/xfs/xfs_file.c | 379 +- trunk/fs/xfs/xfs_ialloc.c | 2 +- trunk/fs/xfs/xfs_ioctl.c | 10 +- trunk/fs/xfs/xfs_mount.c | 43 +- trunk/fs/xfs/xfs_mount.h | 5 + trunk/fs/xfs/xfs_super.c | 100 +- trunk/fs/xfs/xfs_super.h | 2 - trunk/fs/xfs/xfs_trace.h | 1 - trunk/include/acpi/acpi.h | 18 +- trunk/include/acpi/acpiosxf.h | 4 +- trunk/include/acpi/acpixf.h | 6 +- trunk/include/acpi/platform/acenv.h | 2 +- trunk/include/acpi/platform/aclinux.h | 2 +- trunk/include/acpi/processor.h | 9 +- trunk/include/asm-generic/Kbuild.asm | 46 +- trunk/include/asm-generic/bitops/le.h | 10 - trunk/include/crypto/cast5.h | 27 - trunk/include/crypto/cast6.h | 28 - trunk/include/crypto/internal/hash.h | 2 - trunk/include/drm/drm.h | 2 +- trunk/include/drm/drmP.h | 18 +- trunk/include/drm/drm_buffer.h | 2 +- trunk/include/drm/drm_crtc.h | 25 +- trunk/include/drm/drm_encoder_slave.h | 4 +- trunk/include/drm/drm_fb_cma_helper.h | 27 - trunk/include/drm/drm_fourcc.h | 2 - trunk/include/drm/drm_gem_cma_helper.h | 44 - trunk/include/drm/drm_memory.h | 2 +- trunk/include/drm/drm_sarea.h | 4 +- trunk/include/drm/exynos_drm.h | 2 +- trunk/include/drm/i915_drm.h | 38 +- trunk/include/drm/intel-gtt.h | 10 +- trunk/include/drm/mga_drm.h | 2 +- trunk/include/drm/radeon_drm.h | 2 +- trunk/include/drm/ttm/ttm_bo_api.h | 2 +- trunk/include/drm/ttm/ttm_bo_driver.h | 16 +- trunk/include/drm/ttm/ttm_execbuf_util.h | 2 +- trunk/include/drm/ttm/ttm_lock.h | 2 +- trunk/include/drm/ttm/ttm_object.h | 2 +- trunk/include/drm/ttm/ttm_page_alloc.h | 4 +- trunk/include/drm/via_drm.h | 2 +- trunk/include/linux/Kbuild | 2 + trunk/include/linux/ata.h | 30 +- trunk/include/linux/audit.h | 206 +- trunk/include/linux/bcma/bcma.h | 2 +- trunk/include/linux/binfmts.h | 3 +- trunk/include/linux/ceph/ceph_fs.h | 4 +- trunk/include/linux/ceph/debugfs.h | 4 +- trunk/include/linux/ceph/decode.h | 2 +- trunk/include/linux/ceph/libceph.h | 14 +- trunk/include/linux/ceph/mdsmap.h | 2 +- trunk/include/linux/ceph/messenger.h | 4 +- trunk/include/linux/ceph/mon_client.h | 2 +- trunk/include/linux/ceph/msgpool.h | 2 +- trunk/include/linux/ceph/osdmap.h | 4 +- trunk/include/linux/ceph/rados.h | 2 +- trunk/include/linux/ceph/types.h | 6 +- trunk/include/linux/clockchips.h | 8 - trunk/include/linux/compat.h | 8 +- trunk/include/linux/coredump.h | 5 - trunk/include/linux/crush/mapper.h | 2 +- trunk/include/linux/device.h | 7 - trunk/include/linux/drbd_tag_magic.h | 8 +- trunk/include/linux/elf.h | 6 - trunk/include/linux/eventpoll.h | 1 - trunk/include/linux/fdtable.h | 39 +- trunk/include/linux/file.h | 35 +- trunk/include/linux/firewire.h | 12 +- trunk/include/linux/frontswap.h | 2 - trunk/include/linux/fs.h | 10 +- trunk/include/linux/genalloc.h | 27 - trunk/include/linux/i2c/twl.h | 1 - trunk/include/linux/idr.h | 10 +- trunk/include/linux/ima.h | 27 - trunk/include/linux/init.h | 27 +- trunk/include/linux/integrity.h | 7 +- trunk/include/linux/ioport.h | 3 +- trunk/include/linux/kvm.h | 25 +- trunk/include/linux/kvm_host.h | 145 +- trunk/include/linux/libata.h | 19 +- trunk/include/linux/mfd/88pm860x.h | 48 +- trunk/include/linux/mfd/ab3100.h | 129 - trunk/include/linux/mfd/abx500.h | 117 +- trunk/include/linux/mfd/abx500/ab8500.h | 2 + trunk/include/linux/mfd/anatop.h | 40 + trunk/include/linux/mfd/da9055/core.h | 94 - trunk/include/linux/mfd/da9055/pdata.h | 32 - trunk/include/linux/mfd/da9055/reg.h | 699 --- trunk/include/linux/mfd/lp8788-isink.h | 52 - trunk/include/linux/mfd/lp8788.h | 364 -- trunk/include/linux/mfd/lpc_ich.h | 1 - trunk/include/linux/mfd/max8907.h | 252 - trunk/include/linux/mfd/max8925.h | 26 +- trunk/include/linux/mfd/palmas.h | 232 +- trunk/include/linux/mfd/rc5t583.h | 22 - trunk/include/linux/mfd/smsc.h | 109 - trunk/include/linux/mfd/syscon.h | 23 - .../linux/mfd/syscon/imx6q-iomuxc-gpr.h | 319 - trunk/include/linux/mfd/tc3589x.h | 1 - trunk/include/linux/mfd/tps65217.h | 18 - trunk/include/linux/mfd/tps6586x.h | 1 - trunk/include/linux/mfd/tps65910.h | 13 - trunk/include/linux/mfd/twl6040.h | 11 +- trunk/include/linux/mtd/partitions.h | 3 +- trunk/include/linux/nbd.h | 15 +- trunk/include/linux/net.h | 3 +- .../linux/netfilter/nf_conntrack_h323_asn1.h | 2 +- trunk/include/linux/nx842.h | 11 - trunk/include/linux/of.h | 8 - trunk/include/linux/of_address.h | 1 - trunk/include/linux/opp.h | 8 - trunk/include/linux/pci_ids.h | 1 - trunk/include/linux/percpu.h | 2 +- trunk/include/linux/pinctrl/consumer.h | 2 +- trunk/include/linux/pinctrl/machine.h | 2 +- trunk/include/linux/pinctrl/pinctrl.h | 2 +- trunk/include/linux/pinctrl/pinmux.h | 2 +- trunk/include/linux/platform_data/lm3630_bl.h | 57 - trunk/include/linux/platform_data/lm3639_bl.h | 69 - trunk/include/linux/platform_data/lp855x.h | 2 - .../linux/platform_data/remoteproc-omap.h | 2 - trunk/include/linux/platform_data/shmob_drm.h | 99 - trunk/include/linux/pm.h | 2 - trunk/include/linux/pm_domain.h | 92 +- trunk/include/linux/ptrace.h | 2 + trunk/include/linux/remoteproc.h | 24 - trunk/include/linux/rio.h | 21 +- trunk/include/linux/rio_drv.h | 5 - trunk/include/linux/rtc-ds2404.h | 20 - trunk/include/linux/rtc.h | 2 +- trunk/include/linux/security.h | 31 - trunk/include/linux/ste_modem_shm.h | 56 - trunk/include/linux/swiotlb.h | 1 - trunk/include/linux/tpm.h | 4 - trunk/include/linux/xattr.h | 3 - trunk/include/mtd/ubi-user.h | 16 +- trunk/include/net/net_namespace.h | 2 - trunk/include/scsi/libsas.h | 20 +- trunk/include/scsi/osd_attributes.h | 2 +- trunk/include/scsi/osd_initiator.h | 4 +- trunk/include/scsi/osd_sec.h | 4 +- trunk/include/scsi/sas_ata.h | 10 - trunk/include/scsi/scsi_bsg_fc.h | 2 + trunk/include/scsi/scsi_device.h | 4 - trunk/include/scsi/scsi_devinfo.h | 1 - trunk/include/scsi/scsi_host.h | 6 - trunk/include/sound/ac97_codec.h | 6 +- trunk/include/sound/ad1816a.h | 6 +- trunk/include/sound/ak4531_codec.h | 4 +- trunk/include/sound/emu10k1_synth.h | 4 +- trunk/include/sound/emu8000.h | 4 +- trunk/include/sound/emux_legacy.h | 2 +- trunk/include/sound/emux_synth.h | 14 +- trunk/include/sound/es1688.h | 4 +- trunk/include/sound/gus.h | 10 +- trunk/include/sound/mpu401.h | 2 +- trunk/include/sound/pcm.h | 2 +- trunk/include/sound/rawmidi.h | 2 +- trunk/include/sound/sb.h | 4 +- trunk/include/sound/sb16_csp.h | 4 +- trunk/include/sound/seq_kernel.h | 2 +- trunk/include/sound/seq_midi_emul.h | 2 +- trunk/include/sound/seq_midi_event.h | 2 +- trunk/include/sound/seq_oss.h | 4 +- trunk/include/sound/seq_virmidi.h | 4 +- trunk/include/sound/snd_wavefront.h | 8 +- trunk/include/sound/soundfont.h | 4 +- trunk/include/sound/tea6330t.h | 2 +- trunk/include/sound/wss.h | 8 +- trunk/include/trace/events/compaction.h | 2 +- trunk/include/trace/events/kmem.h | 2 +- trunk/include/trace/events/vmscan.h | 2 +- trunk/include/uapi/Kbuild | 14 - trunk/include/uapi/asm-generic/Kbuild | 1 - trunk/include/uapi/asm-generic/Kbuild.asm | 49 - trunk/include/uapi/drm/Kbuild | 1 - trunk/include/uapi/linux/Kbuild | 24 - trunk/include/uapi/linux/byteorder/Kbuild | 1 - trunk/include/uapi/linux/caif/Kbuild | 1 - trunk/include/uapi/linux/can/Kbuild | 1 - trunk/include/uapi/linux/dvb/Kbuild | 1 - trunk/include/uapi/linux/hdlc/Kbuild | 1 - trunk/include/uapi/linux/hsi/Kbuild | 1 - trunk/include/uapi/linux/isdn/Kbuild | 1 - trunk/include/uapi/linux/mmc/Kbuild | 1 - trunk/include/uapi/linux/netfilter/Kbuild | 2 - .../include/uapi/linux/netfilter/ipset/Kbuild | 1 - trunk/include/uapi/linux/netfilter_arp/Kbuild | 1 - .../uapi/linux/netfilter_bridge/Kbuild | 1 - .../include/uapi/linux/netfilter_ipv4/Kbuild | 1 - .../include/uapi/linux/netfilter_ipv6/Kbuild | 1 - trunk/include/uapi/linux/nfsd/Kbuild | 1 - trunk/include/uapi/linux/raid/Kbuild | 1 - trunk/include/uapi/linux/spi/Kbuild | 1 - trunk/include/uapi/linux/sunrpc/Kbuild | 1 - trunk/include/uapi/linux/tc_act/Kbuild | 1 - trunk/include/uapi/linux/tc_ematch/Kbuild | 1 - trunk/include/uapi/linux/usb/Kbuild | 1 - trunk/include/uapi/linux/wimax/Kbuild | 1 - trunk/include/uapi/mtd/Kbuild | 1 - trunk/include/uapi/rdma/Kbuild | 1 - trunk/include/uapi/scsi/Kbuild | 2 - trunk/include/uapi/scsi/fc/Kbuild | 1 - trunk/include/uapi/sound/Kbuild | 1 - trunk/include/uapi/video/Kbuild | 1 - trunk/include/uapi/xen/Kbuild | 1 - trunk/include/xen/grant_table.h | 12 - trunk/include/xen/interface/callback.h | 2 +- trunk/include/xen/interface/grant_table.h | 12 +- trunk/include/xen/interface/hvm/params.h | 2 +- trunk/include/xen/interface/io/blkif.h | 4 +- trunk/include/xen/interface/io/netif.h | 4 +- trunk/include/xen/interface/memory.h | 9 +- trunk/include/xen/interface/platform.h | 9 +- trunk/include/xen/interface/sched.h | 2 +- trunk/include/xen/interface/version.h | 5 +- trunk/include/xen/interface/xen.h | 8 +- trunk/include/xen/privcmd.h | 27 +- trunk/include/xen/swiotlb-xen.h | 11 +- trunk/init/Kconfig | 7 - trunk/ipc/mqueue.c | 78 +- trunk/kernel/auditsc.c | 85 +- trunk/kernel/events/core.c | 72 +- trunk/kernel/exit.c | 97 +- trunk/kernel/jump_label.c | 1 - trunk/kernel/kexec.c | 1 + trunk/kernel/power/Kconfig | 4 - trunk/kernel/power/poweroff.c | 2 +- trunk/kernel/power/process.c | 2 +- trunk/kernel/power/qos.c | 1 - trunk/kernel/ptrace.c | 3 +- trunk/kernel/resource.c | 50 +- trunk/kernel/signal.c | 3 +- trunk/kernel/sys.c | 17 +- trunk/kernel/sysctl.c | 12 +- trunk/kernel/taskstats.c | 12 +- trunk/kernel/time/clockevents.c | 24 - trunk/kernel/time/timekeeping.c | 2 - trunk/lib/Kconfig.debug | 9 +- trunk/lib/crc32.c | 9 +- trunk/lib/decompress.c | 9 +- trunk/lib/gcd.c | 3 - trunk/lib/gen_crc32table.c | 6 +- trunk/lib/genalloc.c | 88 +- trunk/lib/idr.c | 32 +- trunk/lib/parser.c | 10 +- trunk/lib/plist.c | 4 +- trunk/lib/scatterlist.c | 16 +- trunk/lib/spinlock_debug.c | 32 +- trunk/lib/swiotlb.c | 33 +- trunk/lib/vsprintf.c | 139 +- trunk/mm/fadvise.c | 34 +- trunk/mm/fremap.c | 3 +- trunk/mm/frontswap.c | 34 +- trunk/mm/mmap.c | 3 +- trunk/mm/nommu.c | 6 +- trunk/mm/percpu.c | 2 +- trunk/mm/readahead.c | 14 +- trunk/net/9p/trans_fd.c | 16 +- trunk/net/can/af_can.c | 2 +- trunk/net/can/bcm.c | 2 +- trunk/net/can/gw.c | 2 +- trunk/net/can/raw.c | 2 +- trunk/net/compat.c | 3 +- trunk/net/core/netprio_cgroup.c | 38 +- trunk/net/core/scm.c | 3 +- trunk/net/decnet/dn_rules.c | 2 +- trunk/net/ipv4/fib_rules.c | 2 +- trunk/net/ipv4/ipmr.c | 2 +- trunk/net/ipv6/addrlabel.c | 2 +- trunk/net/ipv6/fib6_rules.c | 2 +- trunk/net/ipv6/ip6mr.c | 2 +- trunk/net/sctp/socket.c | 25 +- trunk/net/socket.c | 68 +- trunk/samples/seccomp/Makefile | 24 +- trunk/samples/seccomp/bpf-helper.h | 15 +- trunk/scripts/Kbuild.include | 2 +- trunk/scripts/Makefile.headersinst | 52 +- trunk/scripts/checkpatch.pl | 37 +- trunk/scripts/dtc/Makefile.dtc | 13 +- trunk/scripts/dtc/checks.c | 203 +- trunk/scripts/dtc/data.c | 124 +- trunk/scripts/dtc/dtc-lexer.l | 65 +- trunk/scripts/dtc/dtc-lexer.lex.c_shipped | 503 +- trunk/scripts/dtc/dtc-parser.tab.c_shipped | 780 +-- trunk/scripts/dtc/dtc-parser.tab.h_shipped | 47 +- trunk/scripts/dtc/dtc-parser.y | 255 +- trunk/scripts/dtc/dtc.c | 21 +- trunk/scripts/dtc/dtc.h | 51 +- trunk/scripts/dtc/fdtdump.c | 162 - trunk/scripts/dtc/fdtget.c | 366 -- trunk/scripts/dtc/fdtput.c | 362 -- trunk/scripts/dtc/flattree.c | 3 - trunk/scripts/dtc/libfdt/Makefile.libfdt | 6 +- trunk/scripts/dtc/libfdt/fdt.c | 61 +- trunk/scripts/dtc/libfdt/fdt_empty_tree.c | 84 - trunk/scripts/dtc/libfdt/fdt_ro.c | 275 +- trunk/scripts/dtc/libfdt/fdt_rw.c | 29 - trunk/scripts/dtc/libfdt/fdt_sw.c | 11 +- trunk/scripts/dtc/libfdt/fdt_wip.c | 41 +- trunk/scripts/dtc/libfdt/libfdt.h | 440 +- trunk/scripts/dtc/libfdt/libfdt_env.h | 16 +- trunk/scripts/dtc/libfdt/libfdt_internal.h | 2 +- trunk/scripts/dtc/livetree.c | 128 +- trunk/scripts/dtc/srcpos.c | 98 +- trunk/scripts/dtc/srcpos.h | 31 - trunk/scripts/dtc/treesource.c | 2 - trunk/scripts/dtc/util.c | 272 - trunk/scripts/dtc/util.h | 97 - trunk/scripts/headers_install.pl | 14 +- trunk/scripts/kernel-doc | 23 +- trunk/security/device_cgroup.c | 373 +- trunk/security/integrity/evm/evm_main.c | 3 - trunk/security/integrity/iint.c | 64 +- trunk/security/integrity/ima/Kconfig | 16 - trunk/security/integrity/ima/Makefile | 1 - trunk/security/integrity/ima/ima.h | 39 +- trunk/security/integrity/ima/ima_api.c | 86 +- trunk/security/integrity/ima/ima_appraise.c | 263 - trunk/security/integrity/ima/ima_crypto.c | 8 +- trunk/security/integrity/ima/ima_main.c | 93 +- trunk/security/integrity/ima/ima_policy.c | 195 +- trunk/security/integrity/integrity.h | 22 +- trunk/security/keys/trusted.c | 54 +- trunk/security/security.c | 27 - trunk/security/selinux/hooks.c | 73 +- trunk/security/smack/smack_lsm.c | 51 +- trunk/security/smack/smackfs.c | 75 - trunk/security/yama/Kconfig | 8 - trunk/security/yama/yama_lsm.c | 16 +- trunk/sound/core/pcm_native.c | 13 +- trunk/sound/soc/codecs/wm5100.c | 2 +- trunk/tools/testing/selftests/Makefile | 2 +- trunk/tools/testing/selftests/epoll/Makefile | 11 - .../testing/selftests/epoll/test_epoll.c | 344 -- trunk/virt/kvm/Kconfig | 3 - trunk/virt/kvm/async_pf.c | 11 +- trunk/virt/kvm/eventfd.c | 150 +- trunk/virt/kvm/ioapic.c | 37 +- trunk/virt/kvm/iommu.c | 16 +- trunk/virt/kvm/irq_comm.c | 17 +- trunk/virt/kvm/kvm_main.c | 544 +- 2160 files changed, 64726 insertions(+), 134086 deletions(-) delete mode 100644 trunk/Documentation/ABI/testing/sysfs-driver-ppi create mode 100644 trunk/Documentation/aoe/mkdevs.sh create mode 100644 trunk/Documentation/aoe/mkshelf.sh delete mode 100644 trunk/Documentation/cpu-freq/boost.txt delete mode 100644 trunk/Documentation/devicetree/bindings/arm/calxeda/combophy.txt delete mode 100644 trunk/Documentation/devicetree/bindings/ata/pata-arasan.txt delete mode 100644 trunk/Documentation/devicetree/bindings/cpufreq/cpufreq-cpu0.txt delete mode 100644 trunk/Documentation/devicetree/bindings/interrupt-controller/interrupts.txt delete mode 100644 trunk/Documentation/devicetree/bindings/mfd/88pm860x.txt delete mode 100644 trunk/Documentation/devicetree/bindings/mfd/syscon.txt delete mode 100644 trunk/Documentation/devicetree/bindings/mfd/twl4030-audio.txt delete mode 100644 trunk/Documentation/devicetree/bindings/power/opp.txt delete mode 100644 trunk/Documentation/devicetree/bindings/regulator/88pm860x.txt delete mode 100644 trunk/Documentation/devicetree/bindings/regulator/max8907.txt delete mode 100644 trunk/Documentation/devicetree/bindings/rtc/snvs-rtc.txt delete mode 100644 trunk/Documentation/devicetree/bindings/serial/fsl-imx-uart.txt delete mode 100644 trunk/Documentation/devicetree/bindings/video/backlight/88pm860x.txt delete mode 100644 trunk/Documentation/smsc_ece1099.txt delete mode 100644 trunk/Documentation/virtual/kvm/hypercalls.txt delete mode 100644 trunk/arch/alpha/include/uapi/asm/Kbuild delete mode 100644 trunk/arch/arm/crypto/Makefile delete mode 100644 trunk/arch/arm/crypto/aes-armv4.S delete mode 100644 trunk/arch/arm/crypto/aes_glue.c delete mode 100644 trunk/arch/arm/crypto/sha1-armv4-large.S delete mode 100644 trunk/arch/arm/crypto/sha1_glue.c delete mode 100644 trunk/arch/arm/include/uapi/asm/Kbuild create mode 100644 trunk/arch/arm/mach-shmobile/common.c delete mode 100644 trunk/arch/arm64/include/uapi/asm/Kbuild delete mode 100644 trunk/arch/avr32/include/uapi/asm/Kbuild delete mode 100644 trunk/arch/blackfin/include/uapi/asm/Kbuild delete mode 100644 trunk/arch/c6x/include/uapi/asm/Kbuild create mode 100644 trunk/arch/cris/arch-v32/mach-a3/vcs_hook.c create mode 100644 trunk/arch/cris/arch-v32/mach-a3/vcs_hook.h create mode 100644 trunk/arch/cris/arch-v32/mach-fs/vcs_hook.c create mode 100644 trunk/arch/cris/arch-v32/mach-fs/vcs_hook.h delete mode 100644 trunk/arch/cris/include/uapi/arch-v10/arch/Kbuild delete mode 100644 trunk/arch/cris/include/uapi/arch-v32/arch/Kbuild delete mode 100644 trunk/arch/cris/include/uapi/asm/Kbuild delete mode 100644 trunk/arch/frv/include/uapi/asm/Kbuild delete mode 100644 trunk/arch/h8300/include/uapi/asm/Kbuild delete mode 100644 trunk/arch/hexagon/include/uapi/asm/Kbuild delete mode 100644 trunk/arch/ia64/include/uapi/asm/Kbuild delete mode 100644 trunk/arch/m32r/include/uapi/asm/Kbuild delete mode 100644 trunk/arch/m68k/include/uapi/asm/Kbuild delete mode 100644 trunk/arch/microblaze/include/uapi/asm/Kbuild delete mode 100644 trunk/arch/mips/include/uapi/asm/Kbuild delete mode 100644 trunk/arch/mn10300/include/uapi/asm/Kbuild delete mode 100644 trunk/arch/openrisc/include/uapi/asm/Kbuild delete mode 100644 trunk/arch/parisc/include/uapi/asm/Kbuild delete mode 100644 trunk/arch/powerpc/include/uapi/asm/Kbuild delete mode 100644 trunk/arch/s390/include/uapi/asm/Kbuild delete mode 100644 trunk/arch/s390/kvm/trace-s390.h delete mode 100644 trunk/arch/s390/kvm/trace.h delete mode 100644 trunk/arch/score/include/uapi/asm/Kbuild delete mode 100644 trunk/arch/sh/include/uapi/asm/Kbuild delete mode 100644 trunk/arch/sparc/include/uapi/asm/Kbuild delete mode 100644 trunk/arch/tile/include/uapi/arch/Kbuild delete mode 100644 trunk/arch/tile/include/uapi/asm/Kbuild delete mode 100644 trunk/arch/unicore32/include/uapi/asm/Kbuild delete mode 100644 trunk/arch/x86/crypto/cast5-avx-x86_64-asm_64.S delete mode 100644 trunk/arch/x86/crypto/cast5_avx_glue.c delete mode 100644 trunk/arch/x86/crypto/cast6-avx-x86_64-asm_64.S delete mode 100644 trunk/arch/x86/crypto/cast6_avx_glue.c delete mode 100644 trunk/arch/x86/include/uapi/asm/Kbuild create mode 100644 trunk/arch/x86/kvm/kvm_timer.h create mode 100644 trunk/arch/x86/kvm/timer.c delete mode 100644 trunk/arch/xtensa/include/uapi/asm/Kbuild delete mode 100644 trunk/crypto/842.c rename trunk/crypto/{cast5_generic.c => cast5.c} (95%) rename trunk/crypto/{cast6_generic.c => cast6.c} (93%) delete mode 100644 trunk/drivers/ata/sata_highbank.c delete mode 100644 trunk/drivers/char/hw_random/tpm-rng.c delete mode 100644 trunk/drivers/char/tpm/tpm_acpi.c rename trunk/drivers/char/tpm/{tpm_eventlog.c => tpm_bios.c} (75%) delete mode 100644 trunk/drivers/char/tpm/tpm_eventlog.h delete mode 100644 trunk/drivers/char/tpm/tpm_i2c_infineon.c delete mode 100644 trunk/drivers/char/tpm/tpm_ibmvtpm.c delete mode 100644 trunk/drivers/char/tpm/tpm_ibmvtpm.h delete mode 100644 trunk/drivers/char/tpm/tpm_of.c delete mode 100644 trunk/drivers/char/tpm/tpm_ppi.c delete mode 100644 trunk/drivers/cpufreq/cpufreq-cpu0.c delete mode 100644 trunk/drivers/crypto/nx/Kconfig delete mode 100644 trunk/drivers/crypto/nx/nx-842.c delete mode 100644 trunk/drivers/gpio/gpio-twl6040.c delete mode 100644 trunk/drivers/gpu/drm/drm_fb_cma_helper.c delete mode 100644 trunk/drivers/gpu/drm/drm_gem_cma_helper.c delete mode 100644 trunk/drivers/gpu/drm/gma500/cdv_intel_dp.c create mode 100644 trunk/drivers/gpu/drm/gma500/gem_glue.c create mode 100644 trunk/drivers/gpu/drm/gma500/gem_glue.h delete mode 100644 trunk/drivers/gpu/drm/i915/dvo_ns2501.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/core/client.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/core/engctx.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/core/engine.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/core/gpuobj.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/core/handle.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/core/namedb.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/core/object.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/core/option.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/core/parent.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/core/printk.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/core/ramht.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/core/subdev.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/engine/bsp/nv84.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/engine/copy/nva3.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/engine/copy/nvc0.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/engine/copy/nve0.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/engine/crypt/nv84.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/engine/crypt/nv98.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/engine/disp/nv04.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/engine/disp/nv50.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/engine/disp/nvd0.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/engine/disp/vga.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/engine/dmaobj/base.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/engine/dmaobj/nv04.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/engine/dmaobj/nv50.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/engine/dmaobj/nvc0.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/engine/fifo/base.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/engine/fifo/nv04.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/engine/fifo/nv04.h delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/engine/fifo/nv10.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/engine/fifo/nv17.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/engine/fifo/nv40.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/engine/fifo/nv50.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/engine/fifo/nv50.h delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/engine/fifo/nv84.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/engine/fifo/nvc0.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/engine/fifo/nve0.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/engine/graph/ctxnvc0.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/engine/graph/ctxnve0.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/engine/graph/fuc/gpcnve0.fuc delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/engine/graph/fuc/gpcnve0.fuc.h delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnve0.fuc delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnve0.fuc.h delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/engine/graph/fuc/nve0.fuc delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/engine/graph/nv04.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/engine/graph/nv10.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/engine/graph/nv20.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/engine/graph/nv20.h delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/engine/graph/nv25.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/engine/graph/nv2a.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/engine/graph/nv30.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/engine/graph/nv34.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/engine/graph/nv35.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/engine/graph/nv40.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/engine/graph/nv40.h delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/engine/graph/nv50.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/engine/graph/nv50.h delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/engine/graph/nvc0.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/engine/graph/nvc0.h delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/engine/graph/nve0.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/engine/graph/regs.h delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/engine/mpeg/nv31.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/engine/mpeg/nv40.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/engine/mpeg/nv50.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/engine/mpeg/nv84.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/engine/ppp/nv98.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/engine/software/nv04.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/engine/software/nv10.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/engine/software/nv50.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/engine/software/nvc0.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/engine/vp/nv84.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/include/core/class.h delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/include/core/client.h delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/include/core/debug.h delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/include/core/device.h delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/include/core/engctx.h delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/include/core/engine.h delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/include/core/enum.h delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/include/core/gpuobj.h delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/include/core/handle.h delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/include/core/math.h delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/include/core/mm.h delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/include/core/namedb.h delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/include/core/object.h delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/include/core/option.h delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/include/core/parent.h delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/include/core/printk.h delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/include/core/ramht.h delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/include/core/subdev.h delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/include/engine/bsp.h delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/include/engine/copy.h delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/include/engine/crypt.h delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/include/engine/disp.h delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/include/engine/dmaobj.h delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/include/engine/fifo.h delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/include/engine/graph.h delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/include/engine/mpeg.h delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/include/engine/ppp.h delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/include/engine/software.h delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/include/engine/vp.h delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/include/subdev/bar.h delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/include/subdev/bios.h delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/include/subdev/bios/bit.h delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/include/subdev/bios/bmp.h delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/include/subdev/bios/conn.h delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/include/subdev/bios/dcb.h delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/include/subdev/bios/dp.h delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/include/subdev/bios/extdev.h delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/include/subdev/bios/gpio.h delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/include/subdev/bios/i2c.h delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/include/subdev/bios/init.h delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/include/subdev/bios/mxm.h delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/include/subdev/bios/perf.h delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/include/subdev/bios/pll.h delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/include/subdev/bios/therm.h delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/include/subdev/clock.h delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/include/subdev/device.h delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/include/subdev/devinit.h delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/include/subdev/fb.h delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/include/subdev/gpio.h delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/include/subdev/i2c.h delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/include/subdev/ibus.h delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/include/subdev/instmem.h delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/include/subdev/ltcg.h delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/include/subdev/mc.h delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/include/subdev/mxm.h delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/include/subdev/therm.h delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/include/subdev/timer.h delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/include/subdev/vga.h delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/os.h delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/subdev/bar/base.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/subdev/bar/nv50.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/subdev/bar/nvc0.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/subdev/bios/base.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/subdev/bios/bit.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/subdev/bios/conn.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/subdev/bios/dcb.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/subdev/bios/dp.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/subdev/bios/extdev.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/subdev/bios/gpio.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/subdev/bios/i2c.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/subdev/bios/init.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/subdev/bios/mxm.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/subdev/bios/perf.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/subdev/bios/pll.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/subdev/bios/therm.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/subdev/clock/nv04.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/subdev/clock/nv50.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/subdev/clock/nva3.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/subdev/clock/nvc0.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/subdev/clock/pll.h delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/subdev/clock/pllnv04.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/subdev/device/base.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/subdev/device/nv04.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/subdev/device/nv10.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/subdev/device/nv20.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/subdev/device/nv30.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/subdev/device/nv40.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/subdev/device/nv50.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/subdev/device/nvc0.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/subdev/device/nve0.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/subdev/devinit/fbmem.h delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/subdev/devinit/nv04.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/subdev/devinit/nv05.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/subdev/devinit/nv10.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/subdev/devinit/nv20.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/subdev/devinit/nv50.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/subdev/fb/base.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/subdev/fb/nv04.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/subdev/fb/nv10.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/subdev/fb/nv20.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/subdev/fb/nv30.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/subdev/fb/nv40.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/subdev/fb/nv50.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/subdev/fb/nvc0.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/subdev/gpio/base.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/subdev/gpio/nv10.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/subdev/gpio/nv50.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/subdev/gpio/nvd0.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/subdev/i2c/aux.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/subdev/i2c/base.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/subdev/i2c/bit.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/subdev/ibus/nvc0.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/subdev/ibus/nve0.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/subdev/instmem/base.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/subdev/instmem/nv04.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/subdev/instmem/nv04.h delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/subdev/instmem/nv40.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/subdev/instmem/nv50.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/subdev/ltcg/nvc0.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/subdev/mc/base.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/subdev/mc/nv04.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/subdev/mc/nv44.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/subdev/mc/nv50.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/subdev/mc/nv98.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/subdev/mc/nvc0.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/subdev/mxm/base.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/subdev/mxm/mxms.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/subdev/mxm/mxms.h delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/subdev/mxm/nv50.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/subdev/therm/base.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/subdev/therm/fan.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/subdev/therm/ic.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/subdev/therm/nv40.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/subdev/therm/nv50.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/subdev/therm/priv.h delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/subdev/therm/temp.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/subdev/timer/base.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/subdev/timer/nv04.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/subdev/vm/nv04.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/subdev/vm/nv04.h delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/subdev/vm/nv41.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/core/subdev/vm/nv44.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/nouveau_acpi.h delete mode 100644 trunk/drivers/gpu/drm/nouveau/nouveau_agp.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/nouveau_agp.h delete mode 100644 trunk/drivers/gpu/drm/nouveau/nouveau_bo.h delete mode 100644 trunk/drivers/gpu/drm/nouveau/nouveau_chan.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/nouveau_chan.h create mode 100644 trunk/drivers/gpu/drm/nouveau/nouveau_channel.c create mode 100644 trunk/drivers/gpu/drm/nouveau/nouveau_debugfs.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/nouveau_display.h delete mode 100644 trunk/drivers/gpu/drm/nouveau/nouveau_drm.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/nouveau_drm.h create mode 100644 trunk/drivers/gpu/drm/nouveau/nouveau_drv.c create mode 100644 trunk/drivers/gpu/drm/nouveau/nouveau_drv.h create mode 100644 trunk/drivers/gpu/drm/nouveau/nouveau_fb.h create mode 100644 trunk/drivers/gpu/drm/nouveau/nouveau_fifo.h delete mode 100644 trunk/drivers/gpu/drm/nouveau/nouveau_gem.h create mode 100644 trunk/drivers/gpu/drm/nouveau/nouveau_gpio.c create mode 100644 trunk/drivers/gpu/drm/nouveau/nouveau_gpio.h create mode 100644 trunk/drivers/gpu/drm/nouveau/nouveau_gpuobj.c rename trunk/drivers/gpu/drm/nouveau/{core/engine/graph/ctx.h => nouveau_grctx.h} (84%) create mode 100644 trunk/drivers/gpu/drm/nouveau/nouveau_i2c.c rename trunk/drivers/gpu/drm/nouveau/{core/subdev/devinit/nv1a.c => nouveau_i2c.h} (52%) delete mode 100644 trunk/drivers/gpu/drm/nouveau/nouveau_ioctl.h delete mode 100644 trunk/drivers/gpu/drm/nouveau/nouveau_irq.h rename trunk/drivers/gpu/drm/nouveau/{core/core/mm.c => nouveau_mm.c} (53%) create mode 100644 trunk/drivers/gpu/drm/nouveau/nouveau_mm.h create mode 100644 trunk/drivers/gpu/drm/nouveau/nouveau_mxm.c create mode 100644 trunk/drivers/gpu/drm/nouveau/nouveau_notifier.c create mode 100644 trunk/drivers/gpu/drm/nouveau/nouveau_ramht.c rename trunk/drivers/gpu/drm/nouveau/{core/subdev/clock/nv40.c => nouveau_ramht.h} (55%) create mode 100644 trunk/drivers/gpu/drm/nouveau/nouveau_software.h create mode 100644 trunk/drivers/gpu/drm/nouveau/nouveau_state.c create mode 100644 trunk/drivers/gpu/drm/nouveau/nouveau_temp.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/nouveau_ttm.h rename trunk/drivers/gpu/drm/nouveau/{core/core/enum.c => nouveau_util.c} (86%) create mode 100644 trunk/drivers/gpu/drm/nouveau/nouveau_util.h delete mode 100644 trunk/drivers/gpu/drm/nouveau/nouveau_vga.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/nouveau_vga.h rename trunk/drivers/gpu/drm/nouveau/{core/subdev/vm/base.c => nouveau_vm.c} (72%) rename trunk/drivers/gpu/drm/nouveau/{core/include/subdev/vm.h => nouveau_vm.h} (60%) delete mode 100644 trunk/drivers/gpu/drm/nouveau/nv04_display.h create mode 100644 trunk/drivers/gpu/drm/nouveau/nv04_fb.c create mode 100644 trunk/drivers/gpu/drm/nouveau/nv04_fifo.c create mode 100644 trunk/drivers/gpu/drm/nouveau/nv04_graph.c create mode 100644 trunk/drivers/gpu/drm/nouveau/nv04_instmem.c create mode 100644 trunk/drivers/gpu/drm/nouveau/nv04_mc.c create mode 100644 trunk/drivers/gpu/drm/nouveau/nv04_software.c create mode 100644 trunk/drivers/gpu/drm/nouveau/nv04_timer.c create mode 100644 trunk/drivers/gpu/drm/nouveau/nv10_fb.c create mode 100644 trunk/drivers/gpu/drm/nouveau/nv10_fifo.c create mode 100644 trunk/drivers/gpu/drm/nouveau/nv10_gpio.c create mode 100644 trunk/drivers/gpu/drm/nouveau/nv10_graph.c create mode 100644 trunk/drivers/gpu/drm/nouveau/nv17_fifo.c create mode 100644 trunk/drivers/gpu/drm/nouveau/nv20_fb.c create mode 100644 trunk/drivers/gpu/drm/nouveau/nv20_graph.c create mode 100644 trunk/drivers/gpu/drm/nouveau/nv30_fb.c create mode 100644 trunk/drivers/gpu/drm/nouveau/nv31_mpeg.c create mode 100644 trunk/drivers/gpu/drm/nouveau/nv40_fb.c create mode 100644 trunk/drivers/gpu/drm/nouveau/nv40_fifo.c create mode 100644 trunk/drivers/gpu/drm/nouveau/nv40_graph.c rename trunk/drivers/gpu/drm/nouveau/{core/engine/graph/ctxnv40.c => nv40_grctx.c} (85%) create mode 100644 trunk/drivers/gpu/drm/nouveau/nv40_mc.c rename trunk/drivers/gpu/drm/nouveau/{core/subdev/clock/pllnva3.c => nv50_calc.c} (52%) create mode 100644 trunk/drivers/gpu/drm/nouveau/nv50_fb.c delete mode 100644 trunk/drivers/gpu/drm/nouveau/nv50_fence.c create mode 100644 trunk/drivers/gpu/drm/nouveau/nv50_fifo.c create mode 100644 trunk/drivers/gpu/drm/nouveau/nv50_gpio.c create mode 100644 trunk/drivers/gpu/drm/nouveau/nv50_graph.c rename trunk/drivers/gpu/drm/nouveau/{core/engine/graph/ctxnv50.c => nv50_grctx.c} (91%) create mode 100644 trunk/drivers/gpu/drm/nouveau/nv50_instmem.c create mode 100644 trunk/drivers/gpu/drm/nouveau/nv50_mc.c create mode 100644 trunk/drivers/gpu/drm/nouveau/nv50_mpeg.c create mode 100644 trunk/drivers/gpu/drm/nouveau/nv50_software.c rename trunk/drivers/gpu/drm/nouveau/{core/subdev/vm/nv50.c => nv50_vm.c} (59%) create mode 100644 trunk/drivers/gpu/drm/nouveau/nv50_vram.c create mode 100644 trunk/drivers/gpu/drm/nouveau/nv84_bsp.c create mode 100644 trunk/drivers/gpu/drm/nouveau/nv84_crypt.c create mode 100644 trunk/drivers/gpu/drm/nouveau/nv84_fifo.c create mode 100644 trunk/drivers/gpu/drm/nouveau/nv84_vp.c create mode 100644 trunk/drivers/gpu/drm/nouveau/nv98_crypt.c rename trunk/drivers/gpu/drm/nouveau/{core/engine/crypt/fuc/nv98.fuc => nv98_crypt.fuc} (99%) rename trunk/drivers/gpu/drm/nouveau/{core/engine/crypt/fuc/nv98.fuc.h => nv98_crypt.fuc.h} (99%) rename trunk/drivers/gpu/drm/nouveau/{core/subdev/devinit/base.c => nv98_ppp.c} (52%) create mode 100644 trunk/drivers/gpu/drm/nouveau/nva3_copy.c rename trunk/drivers/gpu/drm/nouveau/{core/engine/copy/fuc/nva3.fuc => nva3_copy.fuc} (100%) rename trunk/drivers/gpu/drm/nouveau/{core/engine/copy/fuc/nva3.fuc.h => nva3_copy.fuc.h} (99%) create mode 100644 trunk/drivers/gpu/drm/nouveau/nvc0_copy.c rename trunk/drivers/gpu/drm/nouveau/{core/engine/copy/fuc/nvc0.fuc.h => nvc0_copy.fuc.h} (99%) create mode 100644 trunk/drivers/gpu/drm/nouveau/nvc0_fb.c create mode 100644 trunk/drivers/gpu/drm/nouveau/nvc0_fifo.c create mode 100644 trunk/drivers/gpu/drm/nouveau/nvc0_graph.c rename trunk/drivers/gpu/drm/nouveau/{core/engine/graph/fuc/nvc0.fuc => nvc0_graph.fuc} (100%) create mode 100644 trunk/drivers/gpu/drm/nouveau/nvc0_graph.h create mode 100644 trunk/drivers/gpu/drm/nouveau/nvc0_grctx.c rename trunk/drivers/gpu/drm/nouveau/{core/engine/graph/fuc/gpcnvc0.fuc => nvc0_grgpc.fuc} (98%) rename trunk/drivers/gpu/drm/nouveau/{core/engine/graph/fuc/gpcnvc0.fuc.h => nvc0_grgpc.fuc.h} (78%) rename trunk/drivers/gpu/drm/nouveau/{core/engine/graph/fuc/hubnvc0.fuc => nvc0_grhub.fuc} (99%) rename trunk/drivers/gpu/drm/nouveau/{core/engine/graph/fuc/hubnvc0.fuc.h => nvc0_grhub.fuc.h} (81%) create mode 100644 trunk/drivers/gpu/drm/nouveau/nvc0_instmem.c create mode 100644 trunk/drivers/gpu/drm/nouveau/nvc0_software.c rename trunk/drivers/gpu/drm/nouveau/{core/subdev/vm/nvc0.c => nvc0_vm.c} (53%) create mode 100644 trunk/drivers/gpu/drm/nouveau/nvc0_vram.c create mode 100644 trunk/drivers/gpu/drm/nouveau/nve0_fifo.c create mode 100644 trunk/drivers/gpu/drm/nouveau/nve0_graph.c create mode 100644 trunk/drivers/gpu/drm/nouveau/nve0_graph.h create mode 100644 trunk/drivers/gpu/drm/nouveau/nve0_grctx.c delete mode 100644 trunk/drivers/gpu/drm/radeon/radeon_acpi.h delete mode 100644 trunk/drivers/gpu/drm/shmobile/Kconfig delete mode 100644 trunk/drivers/gpu/drm/shmobile/Makefile delete mode 100644 trunk/drivers/gpu/drm/shmobile/shmob_drm_backlight.c delete mode 100644 trunk/drivers/gpu/drm/shmobile/shmob_drm_backlight.h delete mode 100644 trunk/drivers/gpu/drm/shmobile/shmob_drm_crtc.c delete mode 100644 trunk/drivers/gpu/drm/shmobile/shmob_drm_crtc.h delete mode 100644 trunk/drivers/gpu/drm/shmobile/shmob_drm_drv.c delete mode 100644 trunk/drivers/gpu/drm/shmobile/shmob_drm_drv.h delete mode 100644 trunk/drivers/gpu/drm/shmobile/shmob_drm_kms.c delete mode 100644 trunk/drivers/gpu/drm/shmobile/shmob_drm_kms.h delete mode 100644 trunk/drivers/gpu/drm/shmobile/shmob_drm_plane.c delete mode 100644 trunk/drivers/gpu/drm/shmobile/shmob_drm_plane.h delete mode 100644 trunk/drivers/gpu/drm/shmobile/shmob_drm_regs.h create mode 100644 trunk/drivers/mfd/anatop-mfd.c delete mode 100644 trunk/drivers/mfd/da9055-core.c delete mode 100644 trunk/drivers/mfd/da9055-i2c.c delete mode 100644 trunk/drivers/mfd/lp8788-irq.c delete mode 100644 trunk/drivers/mfd/lp8788.c delete mode 100644 trunk/drivers/mfd/max8907.c delete mode 100644 trunk/drivers/mfd/omap-usb-tll.c delete mode 100644 trunk/drivers/mfd/smsc-ece1099.c delete mode 100644 trunk/drivers/mfd/syscon.c rename trunk/drivers/{pwm/pwm-twl6030.c => mfd/twl6030-pwm.c} (55%) delete mode 100644 trunk/drivers/remoteproc/ste_modem_rproc.c delete mode 100644 trunk/drivers/rtc/rtc-ds2404.c delete mode 100644 trunk/drivers/rtc/rtc-max8907.c delete mode 100644 trunk/drivers/rtc/rtc-rc5t583.c delete mode 100644 trunk/drivers/rtc/rtc-snvs.c delete mode 100644 trunk/drivers/rtc/rtc-tps65910.c create mode 100644 trunk/drivers/scsi/ibmvscsi/rpa_vscsi.c delete mode 100644 trunk/drivers/scsi/qla4xxx/ql4_83xx.c delete mode 100644 trunk/drivers/scsi/qla4xxx/ql4_83xx.h delete mode 100644 trunk/drivers/video/backlight/lm3630_bl.c delete mode 100644 trunk/drivers/video/backlight/lm3639_bl.c create mode 100644 trunk/drivers/video/backlight/progear_bl.c delete mode 100644 trunk/drivers/video/backlight/tps65217_bl.c delete mode 100644 trunk/fs/coredump.c delete mode 100644 trunk/fs/coredump.h delete mode 100644 trunk/fs/fat/nfs.c delete mode 100644 trunk/fs/jfs/jfs_discard.c delete mode 100644 trunk/fs/jfs/jfs_discard.h delete mode 100644 trunk/fs/proc/fd.c delete mode 100644 trunk/fs/proc/fd.h delete mode 100644 trunk/include/crypto/cast5.h delete mode 100644 trunk/include/crypto/cast6.h delete mode 100644 trunk/include/drm/drm_fb_cma_helper.h delete mode 100644 trunk/include/drm/drm_gem_cma_helper.h delete mode 100644 trunk/include/linux/mfd/ab3100.h create mode 100644 trunk/include/linux/mfd/anatop.h delete mode 100644 trunk/include/linux/mfd/da9055/core.h delete mode 100644 trunk/include/linux/mfd/da9055/pdata.h delete mode 100644 trunk/include/linux/mfd/da9055/reg.h delete mode 100644 trunk/include/linux/mfd/lp8788-isink.h delete mode 100644 trunk/include/linux/mfd/lp8788.h delete mode 100644 trunk/include/linux/mfd/max8907.h delete mode 100644 trunk/include/linux/mfd/smsc.h delete mode 100644 trunk/include/linux/mfd/syscon.h delete mode 100644 trunk/include/linux/mfd/syscon/imx6q-iomuxc-gpr.h delete mode 100644 trunk/include/linux/nx842.h delete mode 100644 trunk/include/linux/platform_data/lm3630_bl.h delete mode 100644 trunk/include/linux/platform_data/lm3639_bl.h delete mode 100644 trunk/include/linux/platform_data/shmob_drm.h delete mode 100644 trunk/include/linux/rtc-ds2404.h delete mode 100644 trunk/include/linux/ste_modem_shm.h delete mode 100644 trunk/include/uapi/Kbuild delete mode 100644 trunk/include/uapi/asm-generic/Kbuild delete mode 100644 trunk/include/uapi/asm-generic/Kbuild.asm delete mode 100644 trunk/include/uapi/drm/Kbuild delete mode 100644 trunk/include/uapi/linux/Kbuild delete mode 100644 trunk/include/uapi/linux/byteorder/Kbuild delete mode 100644 trunk/include/uapi/linux/caif/Kbuild delete mode 100644 trunk/include/uapi/linux/can/Kbuild delete mode 100644 trunk/include/uapi/linux/dvb/Kbuild delete mode 100644 trunk/include/uapi/linux/hdlc/Kbuild delete mode 100644 trunk/include/uapi/linux/hsi/Kbuild delete mode 100644 trunk/include/uapi/linux/isdn/Kbuild delete mode 100644 trunk/include/uapi/linux/mmc/Kbuild delete mode 100644 trunk/include/uapi/linux/netfilter/Kbuild delete mode 100644 trunk/include/uapi/linux/netfilter/ipset/Kbuild delete mode 100644 trunk/include/uapi/linux/netfilter_arp/Kbuild delete mode 100644 trunk/include/uapi/linux/netfilter_bridge/Kbuild delete mode 100644 trunk/include/uapi/linux/netfilter_ipv4/Kbuild delete mode 100644 trunk/include/uapi/linux/netfilter_ipv6/Kbuild delete mode 100644 trunk/include/uapi/linux/nfsd/Kbuild delete mode 100644 trunk/include/uapi/linux/raid/Kbuild delete mode 100644 trunk/include/uapi/linux/spi/Kbuild delete mode 100644 trunk/include/uapi/linux/sunrpc/Kbuild delete mode 100644 trunk/include/uapi/linux/tc_act/Kbuild delete mode 100644 trunk/include/uapi/linux/tc_ematch/Kbuild delete mode 100644 trunk/include/uapi/linux/usb/Kbuild delete mode 100644 trunk/include/uapi/linux/wimax/Kbuild delete mode 100644 trunk/include/uapi/mtd/Kbuild delete mode 100644 trunk/include/uapi/rdma/Kbuild delete mode 100644 trunk/include/uapi/scsi/Kbuild delete mode 100644 trunk/include/uapi/scsi/fc/Kbuild delete mode 100644 trunk/include/uapi/sound/Kbuild delete mode 100644 trunk/include/uapi/video/Kbuild delete mode 100644 trunk/include/uapi/xen/Kbuild delete mode 100644 trunk/scripts/dtc/fdtdump.c delete mode 100644 trunk/scripts/dtc/fdtget.c delete mode 100644 trunk/scripts/dtc/fdtput.c delete mode 100644 trunk/scripts/dtc/libfdt/fdt_empty_tree.c delete mode 100644 trunk/security/integrity/ima/ima_appraise.c delete mode 100644 trunk/tools/testing/selftests/epoll/Makefile delete mode 100644 trunk/tools/testing/selftests/epoll/test_epoll.c diff --git a/[refs] b/[refs] index c0a4b947a80b..9c7fa92a2586 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 11126c611e10abb18b6f1ed0300c0548c3906b54 +refs/heads/master: da1586461e53a4dd045738cce309ab488970f0ef diff --git a/trunk/Documentation/ABI/testing/ima_policy b/trunk/Documentation/ABI/testing/ima_policy index 986946613542..6cd6daefaaed 100644 --- a/trunk/Documentation/ABI/testing/ima_policy +++ b/trunk/Documentation/ABI/testing/ima_policy @@ -12,14 +12,11 @@ Description: then closing the file. The new policy takes effect after the file ima/policy is closed. - IMA appraisal, if configured, uses these file measurements - for local measurement appraisal. - rule format: action [condition ...] - action: measure | dont_measure | appraise | dont_appraise | audit + action: measure | dont_measure condition:= base | lsm - base: [[func=] [mask=] [fsmagic=] [uid=] [fowner]] + base: [[func=] [mask=] [fsmagic=] [uid=]] lsm: [[subj_user=] [subj_role=] [subj_type=] [obj_user=] [obj_role=] [obj_type=]] @@ -27,50 +24,36 @@ Description: mask:= [MAY_READ] [MAY_WRITE] [MAY_APPEND] [MAY_EXEC] fsmagic:= hex value uid:= decimal value - fowner:=decimal value lsm: are LSM specific default policy: # PROC_SUPER_MAGIC dont_measure fsmagic=0x9fa0 - dont_appraise fsmagic=0x9fa0 # SYSFS_MAGIC dont_measure fsmagic=0x62656572 - dont_appraise fsmagic=0x62656572 # DEBUGFS_MAGIC dont_measure fsmagic=0x64626720 - dont_appraise fsmagic=0x64626720 # TMPFS_MAGIC dont_measure fsmagic=0x01021994 - dont_appraise fsmagic=0x01021994 - # RAMFS_MAGIC - dont_measure fsmagic=0x858458f6 - dont_appraise fsmagic=0x858458f6 # SECURITYFS_MAGIC dont_measure fsmagic=0x73636673 - dont_appraise fsmagic=0x73636673 measure func=BPRM_CHECK measure func=FILE_MMAP mask=MAY_EXEC measure func=FILE_CHECK mask=MAY_READ uid=0 - appraise fowner=0 The default policy measures all executables in bprm_check, all files mmapped executable in file_mmap, and all files - open for read by root in do_filp_open. The default appraisal - policy appraises all files owned by root. + open for read by root in do_filp_open. Examples of LSM specific definitions: SELinux: # SELINUX_MAGIC - dont_measure fsmagic=0xf97cff8c - dont_appraise fsmagic=0xf97cff8c + dont_measure fsmagic=0xF97CFF8C dont_measure obj_type=var_log_t - dont_appraise obj_type=var_log_t dont_measure obj_type=auditd_log_t - dont_appraise obj_type=auditd_log_t measure subj_user=system_u func=FILE_CHECK mask=MAY_READ measure subj_role=system_r func=FILE_CHECK mask=MAY_READ diff --git a/trunk/Documentation/ABI/testing/sysfs-devices-system-cpu b/trunk/Documentation/ABI/testing/sysfs-devices-system-cpu index 6943133afcb8..5dab36448b44 100644 --- a/trunk/Documentation/ABI/testing/sysfs-devices-system-cpu +++ b/trunk/Documentation/ABI/testing/sysfs-devices-system-cpu @@ -176,14 +176,3 @@ Description: Disable L3 cache indices All AMD processors with L3 caches provide this functionality. For details, see BKDGs at http://developer.amd.com/documentation/guides/Pages/default.aspx - - -What: /sys/devices/system/cpu/cpufreq/boost -Date: August 2012 -Contact: Linux kernel mailing list -Description: Processor frequency boosting control - - This switch controls the boost setting for the whole system. - Boosting allows the CPU and the firmware to run at a frequency - beyound it's nominal limit. - More details can be found in Documentation/cpu-freq/boost.txt diff --git a/trunk/Documentation/ABI/testing/sysfs-driver-ppi b/trunk/Documentation/ABI/testing/sysfs-driver-ppi deleted file mode 100644 index 97a003ee058b..000000000000 --- a/trunk/Documentation/ABI/testing/sysfs-driver-ppi +++ /dev/null @@ -1,70 +0,0 @@ -What: /sys/devices/pnp0//ppi/ -Date: August 2012 -Kernel Version: 3.6 -Contact: xiaoyan.zhang@intel.com -Description: - This folder includes the attributes related with PPI (Physical - Presence Interface). Only if TPM is supported by BIOS, this - folder makes sence. The folder path can be got by command - 'find /sys/ -name 'pcrs''. For the detail information of PPI, - please refer to the PPI specification from - http://www.trustedcomputinggroup.org/ - -What: /sys/devices/pnp0//ppi/version -Date: August 2012 -Contact: xiaoyan.zhang@intel.com -Description: - This attribute shows the version of the PPI supported by the - platform. - This file is readonly. - -What: /sys/devices/pnp0//ppi/request -Date: August 2012 -Contact: xiaoyan.zhang@intel.com -Description: - This attribute shows the request for an operation to be - executed in the pre-OS environment. It is the only input from - the OS to the pre-OS environment. The request should be an - integer value range from 1 to 160, and 0 means no request. - This file can be read and written. - -What: /sys/devices/pnp0/00:/ppi/response -Date: August 2012 -Contact: xiaoyan.zhang@intel.com -Description: - This attribute shows the response to the most recent operation - request it acted upon. The format is " - : ". - This file is readonly. - -What: /sys/devices/pnp0//ppi/transition_action -Date: August 2012 -Contact: xiaoyan.zhang@intel.com -Description: - This attribute shows the platform-specific action that should - take place in order to transition to the BIOS for execution of - a requested operation. The format is ": ". - This file is readonly. - -What: /sys/devices/pnp0//ppi/tcg_operations -Date: August 2012 -Contact: xiaoyan.zhang@intel.com -Description: - This attribute shows whether it is allowed to request an - operation to be executed in the pre-OS environment by the BIOS - for the requests defined by TCG, i.e. requests from 1 to 22. - The format is " : ". - This attribute is only supported by PPI version 1.2+. - This file is readonly. - -What: /sys/devices/pnp0//ppi/vs_operations -Date: August 2012 -Contact: xiaoyan.zhang@intel.com -Description: - This attribute shows whether it is allowed to request an - operation to be executed in the pre-OS environment by the BIOS - for the verdor specific requests, i.e. requests from 128 to - 255. The format is same with tcg_operations. This attribute - is also only supported by PPI version 1.2+. - This file is readonly. diff --git a/trunk/Documentation/CodingStyle b/trunk/Documentation/CodingStyle index 495e5ba1634c..cb9258b8fd35 100644 --- a/trunk/Documentation/CodingStyle +++ b/trunk/Documentation/CodingStyle @@ -454,16 +454,6 @@ The preferred style for long (multi-line) comments is: * with beginning and ending almost-blank lines. */ -For files in net/ and drivers/net/ the preferred style for long (multi-line) -comments is a little different. - - /* The preferred comment style for files in net/ and drivers/net - * looks like this. - * - * It is nearly the same as the generally preferred comment style, - * but there is no initial almost-blank line. - */ - It's also important to comment data, whether they are basic types or derived types. To this end, use just one data declaration per line (no commas for multiple data declarations). This leaves you room for a small comment on each diff --git a/trunk/Documentation/DocBook/drm.tmpl b/trunk/Documentation/DocBook/drm.tmpl index b0300529ab13..196b8b9dba11 100644 --- a/trunk/Documentation/DocBook/drm.tmpl +++ b/trunk/Documentation/DocBook/drm.tmpl @@ -6,36 +6,11 @@ Linux DRM Developer's Guide - - - Jesse - Barnes - Initial version - - Intel Corporation -
- jesse.barnes@intel.com -
-
-
- - Laurent - Pinchart - Driver internals - - Ideas on board SPRL -
- laurent.pinchart@ideasonboard.com -
-
-
-
- 2008-2009 - 2012 - Intel Corporation - Laurent Pinchart + + Intel Corporation (Jesse Barnes <jesse.barnes@intel.com>) + @@ -45,17 +20,6 @@ the kernel source COPYING file. - - - - - 1.0 - 2012-07-13 - LP - Added extensive documentation about driver internals. - - -
@@ -108,361 +72,342 @@ submission & fencing, suspend/resume support, and DMA services. + + The core of every DRM driver is struct drm_driver. Drivers + typically statically initialize a drm_driver structure, + then pass it to drm_init() at load time. + - Driver Initialization - - At the core of every DRM driver is a drm_driver - structure. Drivers typically statically initialize a drm_driver structure, - and then pass it to one of the drm_*_init() functions - to register it with the DRM subsystem. + Driver initialization + + Before calling the DRM initialization routines, the driver must + first create and fill out a struct drm_driver structure. + + + static struct drm_driver driver = { + /* Don't use MTRRs here; the Xserver or userspace app should + * deal with them for Intel hardware. + */ + .driver_features = + DRIVER_USE_AGP | DRIVER_REQUIRE_AGP | + DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED | DRIVER_MODESET, + .load = i915_driver_load, + .unload = i915_driver_unload, + .firstopen = i915_driver_firstopen, + .lastclose = i915_driver_lastclose, + .preclose = i915_driver_preclose, + .save = i915_save, + .restore = i915_restore, + .device_is_agp = i915_driver_device_is_agp, + .get_vblank_counter = i915_get_vblank_counter, + .enable_vblank = i915_enable_vblank, + .disable_vblank = i915_disable_vblank, + .irq_preinstall = i915_driver_irq_preinstall, + .irq_postinstall = i915_driver_irq_postinstall, + .irq_uninstall = i915_driver_irq_uninstall, + .irq_handler = i915_driver_irq_handler, + .reclaim_buffers = drm_core_reclaim_buffers, + .get_map_ofs = drm_core_get_map_ofs, + .get_reg_ofs = drm_core_get_reg_ofs, + .fb_probe = intelfb_probe, + .fb_remove = intelfb_remove, + .fb_resize = intelfb_resize, + .master_create = i915_master_create, + .master_destroy = i915_master_destroy, +#if defined(CONFIG_DEBUG_FS) + .debugfs_init = i915_debugfs_init, + .debugfs_cleanup = i915_debugfs_cleanup, +#endif + .gem_init_object = i915_gem_init_object, + .gem_free_object = i915_gem_free_object, + .gem_vm_ops = &i915_gem_vm_ops, + .ioctls = i915_ioctls, + .fops = { + .owner = THIS_MODULE, + .open = drm_open, + .release = drm_release, + .ioctl = drm_ioctl, + .mmap = drm_mmap, + .poll = drm_poll, + .fasync = drm_fasync, +#ifdef CONFIG_COMPAT + .compat_ioctl = i915_compat_ioctl, +#endif + .llseek = noop_llseek, + }, + .pci_driver = { + .name = DRIVER_NAME, + .id_table = pciidlist, + .probe = probe, + .remove = __devexit_p(drm_cleanup_pci), + }, + .name = DRIVER_NAME, + .desc = DRIVER_DESC, + .date = DRIVER_DATE, + .major = DRIVER_MAJOR, + .minor = DRIVER_MINOR, + .patchlevel = DRIVER_PATCHLEVEL, + }; + + + In the example above, taken from the i915 DRM driver, the driver + sets several flags indicating what core features it supports; + we go over the individual callbacks in later sections. Since + flags indicate which features your driver supports to the DRM + core, you need to set most of them prior to calling drm_init(). Some, + like DRIVER_MODESET can be set later based on user supplied parameters, + but that's the exception rather than the rule. + + + Driver flags + + DRIVER_USE_AGP + + Driver uses AGP interface + + + + DRIVER_REQUIRE_AGP + + Driver needs AGP interface to function. + + + + DRIVER_USE_MTRR + + + Driver uses MTRR interface for mapping memory. Deprecated. + + + + + DRIVER_PCI_DMA + + Driver is capable of PCI DMA. Deprecated. + + + + DRIVER_SG + + Driver can perform scatter/gather DMA. Deprecated. + + + + DRIVER_HAVE_DMA + Driver supports DMA. Deprecated. + + + DRIVER_HAVE_IRQDRIVER_IRQ_SHARED + + + DRIVER_HAVE_IRQ indicates whether the driver has an IRQ + handler. DRIVER_IRQ_SHARED indicates whether the device & + handler support shared IRQs (note that this is required of + PCI drivers). + + + + + DRIVER_DMA_QUEUE + + + Should be set if the driver queues DMA requests and completes them + asynchronously. Deprecated. + + + + + DRIVER_FB_DMA + + + Driver supports DMA to/from the framebuffer. Deprecated. + + + + + DRIVER_MODESET + + + Driver supports mode setting interfaces. + + + + + + In this specific case, the driver requires AGP and supports + IRQs. DMA, as discussed later, is handled by device-specific ioctls + in this case. It also supports the kernel mode setting APIs, though + unlike in the actual i915 driver source, this example unconditionally + exports KMS capability. - - The drm_driver structure contains static - information that describes the driver and features it supports, and - pointers to methods that the DRM core will call to implement the DRM API. - We will first go through the drm_driver static - information fields, and will then describe individual operations in - details as they get used in later sections. + + + + + + Driver load + + In the previous section, we saw what a typical drm_driver + structure might look like. One of the more important fields in + the structure is the hook for the load function. + + + static struct drm_driver driver = { + ... + .load = i915_driver_load, + ... + }; + + + The load function has many responsibilities: allocating a driver + private structure, specifying supported performance counters, + configuring the device (e.g. mapping registers & command + buffers), initializing the memory manager, and setting up the + initial output configuration. + + + If compatibility is a concern (e.g. with drivers converted over + to the new interfaces from the old ones), care must be taken to + prevent device initialization and control that is incompatible with + currently active userspace drivers. For instance, if user + level mode setting drivers are in use, it would be problematic + to perform output discovery & configuration at load time. + Likewise, if user-level drivers unaware of memory management are + in use, memory management and command buffer setup may need to + be omitted. These requirements are driver-specific, and care + needs to be taken to keep both old and new applications and + libraries working. The i915 driver supports the "modeset" + module parameter to control whether advanced features are + enabled at load time or in legacy fashion. + - Driver Information - - Driver Features - - Drivers inform the DRM core about their requirements and supported - features by setting appropriate flags in the - driver_features field. Since those flags - influence the DRM core behaviour since registration time, most of them - must be set to registering the drm_driver - instance. - - u32 driver_features; - - Driver Feature Flags - - DRIVER_USE_AGP - - Driver uses AGP interface, the DRM core will manage AGP resources. - - - - DRIVER_REQUIRE_AGP - - Driver needs AGP interface to function. AGP initialization failure - will become a fatal error. - - - - DRIVER_USE_MTRR - - Driver uses MTRR interface for mapping memory, the DRM core will - manage MTRR resources. Deprecated. - - - - DRIVER_PCI_DMA - - Driver is capable of PCI DMA, mapping of PCI DMA buffers to - userspace will be enabled. Deprecated. - - - - DRIVER_SG - - Driver can perform scatter/gather DMA, allocation and mapping of - scatter/gather buffers will be enabled. Deprecated. - - - - DRIVER_HAVE_DMA - - Driver supports DMA, the userspace DMA API will be supported. - Deprecated. - - - - DRIVER_HAVE_IRQDRIVER_IRQ_SHARED - - DRIVER_HAVE_IRQ indicates whether the driver has an IRQ handler. The - DRM core will automatically register an interrupt handler when the - flag is set. DRIVER_IRQ_SHARED indicates whether the device & - handler support shared IRQs (note that this is required of PCI - drivers). - - - - DRIVER_IRQ_VBL - Unused. Deprecated. - - - DRIVER_DMA_QUEUE - - Should be set if the driver queues DMA requests and completes them - asynchronously. Deprecated. - - - - DRIVER_FB_DMA - - Driver supports DMA to/from the framebuffer, mapping of frambuffer - DMA buffers to userspace will be supported. Deprecated. - - - - DRIVER_IRQ_VBL2 - Unused. Deprecated. - - - DRIVER_GEM - - Driver use the GEM memory manager. - - - - DRIVER_MODESET - - Driver supports mode setting interfaces (KMS). - - - - DRIVER_PRIME - - Driver implements DRM PRIME buffer sharing. - - - - - - Major, Minor and Patchlevel - int major; -int minor; -int patchlevel; - - The DRM core identifies driver versions by a major, minor and patch - level triplet. The information is printed to the kernel log at - initialization time and passed to userspace through the - DRM_IOCTL_VERSION ioctl. - - - The major and minor numbers are also used to verify the requested driver - API version passed to DRM_IOCTL_SET_VERSION. When the driver API changes - between minor versions, applications can call DRM_IOCTL_SET_VERSION to - select a specific version of the API. If the requested major isn't equal - to the driver major, or the requested minor is larger than the driver - minor, the DRM_IOCTL_SET_VERSION call will return an error. Otherwise - the driver's set_version() method will be called with the requested - version. - - - - Name, Description and Date - char *name; -char *desc; -char *date; - - The driver name is printed to the kernel log at initialization time, - used for IRQ registration and passed to userspace through - DRM_IOCTL_VERSION. - - - The driver description is a purely informative string passed to - userspace through the DRM_IOCTL_VERSION ioctl and otherwise unused by - the kernel. - - - The driver date, formatted as YYYYMMDD, is meant to identify the date of - the latest modification to the driver. However, as most drivers fail to - update it, its value is mostly useless. The DRM core prints it to the - kernel log at initialization time and passes it to userspace through the - DRM_IOCTL_VERSION ioctl. - - - - - Driver Load + Driver private & performance counters - The load method is the driver and device - initialization entry point. The method is responsible for allocating and - initializing driver private data, specifying supported performance - counters, performing resource allocation and mapping (e.g. acquiring - clocks, mapping registers or allocating command buffers), initializing - the memory manager (), installing - the IRQ handler (), setting up - vertical blanking handling (), mode - setting () and initial output - configuration (). + The driver private hangs off the main drm_device structure and + can be used for tracking various device-specific bits of + information, like register offsets, command buffer status, + register state for suspend/resume, etc. At load time, a + driver may simply allocate one and set drm_device.dev_priv + appropriately; it should be freed and drm_device.dev_priv set + to NULL when the driver is unloaded. - - If compatibility is a concern (e.g. with drivers converted over from - User Mode Setting to Kernel Mode Setting), care must be taken to prevent - device initialization and control that is incompatible with currently - active userspace drivers. For instance, if user level mode setting - drivers are in use, it would be problematic to perform output discovery - & configuration at load time. Likewise, if user-level drivers - unaware of memory management are in use, memory management and command - buffer setup may need to be omitted. These requirements are - driver-specific, and care needs to be taken to keep both old and new - applications and libraries working. - - int (*load) (struct drm_device *, unsigned long flags); - The method takes two arguments, a pointer to the newly created - drm_device and flags. The flags are used to - pass the driver_data field of the device id - corresponding to the device passed to drm_*_init(). - Only PCI devices currently use this, USB and platform DRM drivers have - their load method called with flags to 0. + The DRM supports several counters which may be used for rough + performance characterization. Note that the DRM stat counter + system is not often used by applications, and supporting + additional counters is completely optional. + + + These interfaces are deprecated and should not be used. If performance + monitoring is desired, the developer should investigate and + potentially enhance the kernel perf and tracing infrastructure to export + GPU related performance information for consumption by performance + monitoring tools and applications. - - Driver Private & Performance Counters - - The driver private hangs off the main - drm_device structure and can be used for - tracking various device-specific bits of information, like register - offsets, command buffer status, register state for suspend/resume, etc. - At load time, a driver may simply allocate one and set - drm_device.dev_priv - appropriately; it should be freed and - drm_device.dev_priv - set to NULL when the driver is unloaded. - - - DRM supports several counters which were used for rough performance - characterization. This stat counter system is deprecated and should not - be used. If performance monitoring is desired, the developer should - investigate and potentially enhance the kernel perf and tracing - infrastructure to export GPU related performance information for - consumption by performance monitoring tools and applications. - - - - IRQ Registration - - The DRM core tries to facilitate IRQ handler registration and - unregistration by providing drm_irq_install and - drm_irq_uninstall functions. Those functions only - support a single interrupt per device. - - - - Both functions get the device IRQ by calling - drm_dev_to_irq. This inline function will call a - bus-specific operation to retrieve the IRQ number. For platform devices, - platform_get_irq(..., 0) is used to retrieve the - IRQ number. - - - drm_irq_install starts by calling the - irq_preinstall driver operation. The operation - is optional and must make sure that the interrupt will not get fired by - clearing all pending interrupt flags or disabling the interrupt. - - - The IRQ will then be requested by a call to - request_irq. If the DRIVER_IRQ_SHARED driver - feature flag is set, a shared (IRQF_SHARED) IRQ handler will be - requested. - - - The IRQ handler function must be provided as the mandatory irq_handler - driver operation. It will get passed directly to - request_irq and thus has the same prototype as all - IRQ handlers. It will get called with a pointer to the DRM device as the - second argument. - - - Finally the function calls the optional - irq_postinstall driver operation. The operation - usually enables interrupts (excluding the vblank interrupt, which is - enabled separately), but drivers may choose to enable/disable interrupts - at a different time. - - - drm_irq_uninstall is similarly used to uninstall an - IRQ handler. It starts by waking up all processes waiting on a vblank - interrupt to make sure they don't hang, and then calls the optional - irq_uninstall driver operation. The operation - must disable all hardware interrupts. Finally the function frees the IRQ - by calling free_irq. - - - - Memory Manager Initialization - - Every DRM driver requires a memory manager which must be initialized at - load time. DRM currently contains two memory managers, the Translation - Table Manager (TTM) and the Graphics Execution Manager (GEM). - This document describes the use of the GEM memory manager only. See - for details. - - - - Miscellaneous Device Configuration - - Another task that may be necessary for PCI devices during configuration - is mapping the video BIOS. On many devices, the VBIOS describes device - configuration, LCD panel timings (if any), and contains flags indicating - device state. Mapping the BIOS can be done using the pci_map_rom() call, - a convenience function that takes care of mapping the actual ROM, - whether it has been shadowed into memory (typically at address 0xc0000) - or exists on the PCI device in the ROM BAR. Note that after the ROM has - been mapped and any necessary information has been extracted, it should - be unmapped; on many devices, the ROM address decoder is shared with - other BARs, so leaving it mapped could cause undesired behaviour like - hangs or memory corruption. - - - - - + + Configuring the device + + Obviously, device configuration is device-specific. + However, there are several common operations: finding a + device's PCI resources, mapping them, and potentially setting + up an IRQ handler. + + + Finding & mapping resources is fairly straightforward. The + DRM wrapper functions, drm_get_resource_start() and + drm_get_resource_len(), may be used to find BARs on the given + drm_device struct. Once those values have been retrieved, the + driver load function can call drm_addmap() to create a new + mapping for the BAR in question. Note that you probably want a + drm_local_map_t in your driver private structure to track any + mappings you create. + + + + + if compatibility with other operating systems isn't a concern + (DRM drivers can run under various BSD variants and OpenSolaris), + native Linux calls may be used for the above, e.g. pci_resource_* + and iomap*/iounmap. See the Linux device driver book for more + info. + + + Once you have a register map, you may use the DRM_READn() and + DRM_WRITEn() macros to access the registers on your device, or + use driver-specific versions to offset into your MMIO space + relative to a driver-specific base pointer (see I915_READ for + an example). + + + If your device supports interrupt generation, you may want to + set up an interrupt handler when the driver is loaded. This + is done using the drm_irq_install() function. If your device + supports vertical blank interrupts, it should call + drm_vblank_init() to initialize the core vblank handling code before + enabling interrupts on your device. This ensures the vblank related + structures are allocated and allows the core to handle vblank events. + + + + Once your interrupt handler is registered (it uses your + drm_driver.irq_handler as the actual interrupt handling + function), you can safely enable interrupts on your device, + assuming any other state your interrupt handler uses is also + initialized. + + + Another task that may be necessary during configuration is + mapping the video BIOS. On many devices, the VBIOS describes + device configuration, LCD panel timings (if any), and contains + flags indicating device state. Mapping the BIOS can be done + using the pci_map_rom() call, a convenience function that + takes care of mapping the actual ROM, whether it has been + shadowed into memory (typically at address 0xc0000) or exists + on the PCI device in the ROM BAR. Note that after the ROM + has been mapped and any necessary information has been extracted, + it should be unmapped; on many devices, the ROM address decoder is + shared with other BARs, so leaving it mapped could cause + undesired behavior like hangs or memory corruption. + + + - - Memory management - - Modern Linux systems require large amount of graphics memory to store - frame buffers, textures, vertices and other graphics-related data. Given - the very dynamic nature of many of that data, managing graphics memory - efficiently is thus crucial for the graphics stack and plays a central - role in the DRM infrastructure. - - - The DRM core includes two memory managers, namely Translation Table Maps - (TTM) and Graphics Execution Manager (GEM). TTM was the first DRM memory - manager to be developed and tried to be a one-size-fits-them all - solution. It provides a single userspace API to accomodate the need of - all hardware, supporting both Unified Memory Architecture (UMA) devices - and devices with dedicated video RAM (i.e. most discrete video cards). - This resulted in a large, complex piece of code that turned out to be - hard to use for driver development. - - - GEM started as an Intel-sponsored project in reaction to TTM's - complexity. Its design philosophy is completely different: instead of - providing a solution to every graphics memory-related problems, GEM - identified common code between drivers and created a support library to - share it. GEM has simpler initialization and execution requirements than - TTM, but has no video RAM management capabitilies and is thus limited to - UMA devices. - - The Translation Table Manager (TTM) + Memory manager initialization - TTM design background and information belongs here. + In order to allocate command buffers, cursor memory, scanout + buffers, etc., as well as support the latest features provided + by packages like Mesa and the X.Org X server, your driver + should support a memory manager. + + + If your driver supports memory management (it should!), you + need to set that up at load time as well. How you initialize + it depends on which memory manager you're using: TTM or GEM. TTM initialization - This section is outdated. - - Drivers wishing to support TTM must fill out a drm_bo_driver - structure. The structure contains several fields with function - pointers for initializing the TTM, allocating and freeing memory, - waiting for command completion and fence synchronization, and memory - migration. See the radeon_ttm.c file for an example of usage. + + TTM (for Translation Table Manager) manages video memory and + aperture space for graphics devices. TTM supports both UMA devices + and devices with dedicated video RAM (VRAM), i.e. most discrete + graphics devices. If your device has dedicated RAM, supporting + TTM is desirable. TTM also integrates tightly with your + driver-specific buffer execution function. See the radeon + driver for examples. + + + The core TTM structure is the ttm_bo_driver struct. It contains + several fields with function pointers for initializing the TTM, + allocating and freeing memory, waiting for command completion + and fence synchronization, and memory migration. See the + radeon_ttm.c file for an example of usage. The ttm_global_reference structure is made up of several fields: @@ -500,1081 +445,82 @@ char *date; count for the TTM, which will call your initialization function. - - - The Graphics Execution Manager (GEM) - - The GEM design approach has resulted in a memory manager that doesn't - provide full coverage of all (or even all common) use cases in its - userspace or kernel API. GEM exposes a set of standard memory-related - operations to userspace and a set of helper functions to drivers, and let - drivers implement hardware-specific operations with their own private API. - - - The GEM userspace API is described in the - GEM - the Graphics - Execution Manager article on LWN. While slightly - outdated, the document provides a good overview of the GEM API principles. - Buffer allocation and read and write operations, described as part of the - common GEM API, are currently implemented using driver-specific ioctls. - - - GEM is data-agnostic. It manages abstract buffer objects without knowing - what individual buffers contain. APIs that require knowledge of buffer - contents or purpose, such as buffer allocation or synchronization - primitives, are thus outside of the scope of GEM and must be implemented - using driver-specific ioctls. - - - On a fundamental level, GEM involves several operations: - - Memory allocation and freeing - Command execution - Aperture management at command execution time - - Buffer object allocation is relatively straightforward and largely - provided by Linux's shmem layer, which provides memory to back each - object. - - - Device-specific operations, such as command execution, pinning, buffer - read & write, mapping, and domain ownership transfers are left to - driver-specific ioctls. - - - GEM Initialization - - Drivers that use GEM must set the DRIVER_GEM bit in the struct - drm_driver - driver_features field. The DRM core will - then automatically initialize the GEM core before calling the - load operation. Behind the scene, this will - create a DRM Memory Manager object which provides an address space - pool for object allocation. - - - In a KMS configuration, drivers need to allocate and initialize a - command ring buffer following core GEM initialization if required by - the hardware. UMA devices usually have what is called a "stolen" - memory region, which provides space for the initial framebuffer and - large, contiguous memory regions required by the device. This space is - typically not managed by GEM, and must be initialized separately into - its own DRM MM object. - - - - GEM Objects Creation - - GEM splits creation of GEM objects and allocation of the memory that - backs them in two distinct operations. - - - GEM objects are represented by an instance of struct - drm_gem_object. Drivers usually need to extend - GEM objects with private information and thus create a driver-specific - GEM object structure type that embeds an instance of struct - drm_gem_object. - - - To create a GEM object, a driver allocates memory for an instance of its - specific GEM object type and initializes the embedded struct - drm_gem_object with a call to - drm_gem_object_init. The function takes a pointer to - the DRM device, a pointer to the GEM object and the buffer object size - in bytes. - - - GEM uses shmem to allocate anonymous pageable memory. - drm_gem_object_init will create an shmfs file of - the requested size and store it into the struct - drm_gem_object filp - field. The memory is used as either main storage for the object when the - graphics hardware uses system memory directly or as a backing store - otherwise. - - - Drivers are responsible for the actual physical pages allocation by - calling shmem_read_mapping_page_gfp for each page. - Note that they can decide to allocate pages when initializing the GEM - object, or to delay allocation until the memory is needed (for instance - when a page fault occurs as a result of a userspace memory access or - when the driver needs to start a DMA transfer involving the memory). - - - Anonymous pageable memory allocation is not always desired, for instance - when the hardware requires physically contiguous system memory as is - often the case in embedded devices. Drivers can create GEM objects with - no shmfs backing (called private GEM objects) by initializing them with - a call to drm_gem_private_object_init instead of - drm_gem_object_init. Storage for private GEM - objects must be managed by drivers. - - - Drivers that do not need to extend GEM objects with private information - can call the drm_gem_object_alloc function to - allocate and initialize a struct drm_gem_object - instance. The GEM core will call the optional driver - gem_init_object operation after initializing - the GEM object with drm_gem_object_init. - int (*gem_init_object) (struct drm_gem_object *obj); - - - No alloc-and-init function exists for private GEM objects. - - - - GEM Objects Lifetime - - All GEM objects are reference-counted by the GEM core. References can be - acquired and release by calling drm_gem_object_reference - and drm_gem_object_unreference respectively. The - caller must hold the drm_device - struct_mutex lock. As a convenience, GEM - provides the drm_gem_object_reference_unlocked and - drm_gem_object_unreference_unlocked functions that - can be called without holding the lock. - - - When the last reference to a GEM object is released the GEM core calls - the drm_driver - gem_free_object operation. That operation is - mandatory for GEM-enabled drivers and must free the GEM object and all - associated resources. - - - void (*gem_free_object) (struct drm_gem_object *obj); - Drivers are responsible for freeing all GEM object resources, including - the resources created by the GEM core. If an mmap offset has been - created for the object (in which case - drm_gem_object::map_list::map - is not NULL) it must be freed by a call to - drm_gem_free_mmap_offset. The shmfs backing store - must be released by calling drm_gem_object_release - (that function can safely be called if no shmfs backing store has been - created). - - - - GEM Objects Naming - - Communication between userspace and the kernel refers to GEM objects - using local handles, global names or, more recently, file descriptors. - All of those are 32-bit integer values; the usual Linux kernel limits - apply to the file descriptors. - - - GEM handles are local to a DRM file. Applications get a handle to a GEM - object through a driver-specific ioctl, and can use that handle to refer - to the GEM object in other standard or driver-specific ioctls. Closing a - DRM file handle frees all its GEM handles and dereferences the - associated GEM objects. - - - To create a handle for a GEM object drivers call - drm_gem_handle_create. The function takes a pointer - to the DRM file and the GEM object and returns a locally unique handle. - When the handle is no longer needed drivers delete it with a call to - drm_gem_handle_delete. Finally the GEM object - associated with a handle can be retrieved by a call to - drm_gem_object_lookup. - - - Handles don't take ownership of GEM objects, they only take a reference - to the object that will be dropped when the handle is destroyed. To - avoid leaking GEM objects, drivers must make sure they drop the - reference(s) they own (such as the initial reference taken at object - creation time) as appropriate, without any special consideration for the - handle. For example, in the particular case of combined GEM object and - handle creation in the implementation of the - dumb_create operation, drivers must drop the - initial reference to the GEM object before returning the handle. - - - GEM names are similar in purpose to handles but are not local to DRM - files. They can be passed between processes to reference a GEM object - globally. Names can't be used directly to refer to objects in the DRM - API, applications must convert handles to names and names to handles - using the DRM_IOCTL_GEM_FLINK and DRM_IOCTL_GEM_OPEN ioctls - respectively. The conversion is handled by the DRM core without any - driver-specific support. - - - Similar to global names, GEM file descriptors are also used to share GEM - objects across processes. They offer additional security: as file - descriptors must be explictly sent over UNIX domain sockets to be shared - between applications, they can't be guessed like the globally unique GEM - names. - - - Drivers that support GEM file descriptors, also known as the DRM PRIME - API, must set the DRIVER_PRIME bit in the struct - drm_driver - driver_features field, and implement the - prime_handle_to_fd and - prime_fd_to_handle operations. - - - int (*prime_handle_to_fd)(struct drm_device *dev, - struct drm_file *file_priv, uint32_t handle, - uint32_t flags, int *prime_fd); - int (*prime_fd_to_handle)(struct drm_device *dev, - struct drm_file *file_priv, int prime_fd, - uint32_t *handle); - Those two operations convert a handle to a PRIME file descriptor and - vice versa. Drivers must use the kernel dma-buf buffer sharing framework - to manage the PRIME file descriptors. - - - While non-GEM drivers must implement the operations themselves, GEM - drivers must use the drm_gem_prime_handle_to_fd - and drm_gem_prime_fd_to_handle helper functions. - Those helpers rely on the driver - gem_prime_export and - gem_prime_import operations to create a dma-buf - instance from a GEM object (dma-buf exporter role) and to create a GEM - object from a dma-buf instance (dma-buf importer role). - - - struct dma_buf * (*gem_prime_export)(struct drm_device *dev, - struct drm_gem_object *obj, - int flags); - struct drm_gem_object * (*gem_prime_import)(struct drm_device *dev, - struct dma_buf *dma_buf); - These two operations are mandatory for GEM drivers that support DRM - PRIME. - - - - GEM Objects Mapping - - Because mapping operations are fairly heavyweight GEM favours - read/write-like access to buffers, implemented through driver-specific - ioctls, over mapping buffers to userspace. However, when random access - to the buffer is needed (to perform software rendering for instance), - direct access to the object can be more efficient. - - - The mmap system call can't be used directly to map GEM objects, as they - don't have their own file handle. Two alternative methods currently - co-exist to map GEM objects to userspace. The first method uses a - driver-specific ioctl to perform the mapping operation, calling - do_mmap under the hood. This is often considered - dubious, seems to be discouraged for new GEM-enabled drivers, and will - thus not be described here. - - - The second method uses the mmap system call on the DRM file handle. - void *mmap(void *addr, size_t length, int prot, int flags, int fd, - off_t offset); - DRM identifies the GEM object to be mapped by a fake offset passed - through the mmap offset argument. Prior to being mapped, a GEM object - must thus be associated with a fake offset. To do so, drivers must call - drm_gem_create_mmap_offset on the object. The - function allocates a fake offset range from a pool and stores the - offset divided by PAGE_SIZE in - obj->map_list.hash.key. Care must be taken not to - call drm_gem_create_mmap_offset if a fake offset - has already been allocated for the object. This can be tested by - obj->map_list.map being non-NULL. - - - Once allocated, the fake offset value - (obj->map_list.hash.key << PAGE_SHIFT) - must be passed to the application in a driver-specific way and can then - be used as the mmap offset argument. - - - The GEM core provides a helper method drm_gem_mmap - to handle object mapping. The method can be set directly as the mmap - file operation handler. It will look up the GEM object based on the - offset value and set the VMA operations to the - drm_driver gem_vm_ops - field. Note that drm_gem_mmap doesn't map memory to - userspace, but relies on the driver-provided fault handler to map pages - individually. - - - To use drm_gem_mmap, drivers must fill the struct - drm_driver gem_vm_ops - field with a pointer to VM operations. - - - struct vm_operations_struct *gem_vm_ops - - struct vm_operations_struct { - void (*open)(struct vm_area_struct * area); - void (*close)(struct vm_area_struct * area); - int (*fault)(struct vm_area_struct *vma, struct vm_fault *vmf); - }; - - - The open and close - operations must update the GEM object reference count. Drivers can use - the drm_gem_vm_open and - drm_gem_vm_close helper functions directly as open - and close handlers. - - - The fault operation handler is responsible for mapping individual pages - to userspace when a page fault occurs. Depending on the memory - allocation scheme, drivers can allocate pages at fault time, or can - decide to allocate memory for the GEM object at the time the object is - created. - - - Drivers that want to map the GEM object upfront instead of handling page - faults can implement their own mmap file operation handler. - - - - Dumb GEM Objects - - The GEM API doesn't standardize GEM objects creation and leaves it to - driver-specific ioctls. While not an issue for full-fledged graphics - stacks that include device-specific userspace components (in libdrm for - instance), this limit makes DRM-based early boot graphics unnecessarily - complex. - - - Dumb GEM objects partly alleviate the problem by providing a standard - API to create dumb buffers suitable for scanout, which can then be used - to create KMS frame buffers. - - - To support dumb GEM objects drivers must implement the - dumb_create, - dumb_destroy and - dumb_map_offset operations. - - - - int (*dumb_create)(struct drm_file *file_priv, struct drm_device *dev, - struct drm_mode_create_dumb *args); - - The dumb_create operation creates a GEM - object suitable for scanout based on the width, height and depth - from the struct drm_mode_create_dumb - argument. It fills the argument's handle, - pitch and size - fields with a handle for the newly created GEM object and its line - pitch and size in bytes. - - - - int (*dumb_destroy)(struct drm_file *file_priv, struct drm_device *dev, - uint32_t handle); - - The dumb_destroy operation destroys a dumb - GEM object created by dumb_create. - - - - int (*dumb_map_offset)(struct drm_file *file_priv, struct drm_device *dev, - uint32_t handle, uint64_t *offset); - - The dumb_map_offset operation associates an - mmap fake offset with the GEM object given by the handle and returns - it. Drivers must use the - drm_gem_create_mmap_offset function to - associate the fake offset as described in - . - - - - - - Memory Coherency - - When mapped to the device or used in a command buffer, backing pages - for an object are flushed to memory and marked write combined so as to - be coherent with the GPU. Likewise, if the CPU accesses an object - after the GPU has finished rendering to the object, then the object - must be made coherent with the CPU's view of memory, usually involving - GPU cache flushing of various kinds. This core CPU<->GPU - coherency management is provided by a device-specific ioctl, which - evaluates an object's current domain and performs any necessary - flushing or synchronization to put the object into the desired - coherency domain (note that the object may be busy, i.e. an active - render target; in that case, setting the domain blocks the client and - waits for rendering to complete before performing any necessary - flushing operations). - - - Command Execution - - Perhaps the most important GEM function for GPU devices is providing a - command execution interface to clients. Client programs construct - command buffers containing references to previously allocated memory - objects, and then submit them to GEM. At that point, GEM takes care to - bind all the objects into the GTT, execute the buffer, and provide - necessary synchronization between clients accessing the same buffers. - This often involves evicting some objects from the GTT and re-binding - others (a fairly expensive operation), and providing relocation - support which hides fixed GTT offsets from clients. Clients must take - care not to submit command buffers that reference more objects than - can fit in the GTT; otherwise, GEM will reject them and no rendering - will occur. Similarly, if several objects in the buffer require fence - registers to be allocated for correct rendering (e.g. 2D blits on - pre-965 chips), care must be taken not to require more fence registers - than are available to the client. Such resource management should be - abstracted from the client in libdrm. - - - - - - - - - Mode Setting - - Drivers must initialize the mode setting core by calling - drm_mode_config_init on the DRM device. The function - initializes the drm_device - mode_config field and never fails. Once done, - mode configuration must be setup by initializing the following fields. - - - - int min_width, min_height; -int max_width, max_height; - - Minimum and maximum width and height of the frame buffers in pixel - units. + GEM initialization + + GEM is an alternative to TTM, designed specifically for UMA + devices. It has simpler initialization and execution requirements + than TTM, but has no VRAM management capability. Core GEM + is initialized by calling drm_mm_init() to create + a GTT DRM MM object, which provides an address space pool for + object allocation. In a KMS configuration, the driver + needs to allocate and initialize a command ring buffer following + core GEM initialization. A UMA device usually has what is called a + "stolen" memory region, which provides space for the initial + framebuffer and large, contiguous memory regions required by the + device. This space is not typically managed by GEM, and it must + be initialized separately into its own DRM MM object. + + + Initialization is driver-specific. In the case of Intel + integrated graphics chips like 965GM, GEM initialization can + be done by calling the internal GEM init function, + i915_gem_do_init(). Since the 965GM is a UMA device + (i.e. it doesn't have dedicated VRAM), GEM manages + making regular RAM available for GPU operations. Memory set + aside by the BIOS (called "stolen" memory by the i915 + driver) is managed by the DRM memrange allocator; the + rest of the aperture is managed by GEM. + + /* Basic memrange allocator for stolen space (aka vram) */ + drm_memrange_init(&dev_priv->vram, 0, prealloc_size); + /* Let GEM Manage from end of prealloc space to end of aperture */ + i915_gem_do_init(dev, prealloc_size, agp_size); + + + + + Once the memory manager has been set up, we may allocate the + command buffer. In the i915 case, this is also done with a + GEM function, i915_gem_init_ringbuffer(). - - - struct drm_mode_config_funcs *funcs; - Mode setting functions. - - - - Frame Buffer Creation - struct drm_framebuffer *(*fb_create)(struct drm_device *dev, - struct drm_file *file_priv, - struct drm_mode_fb_cmd2 *mode_cmd); - - Frame buffers are abstract memory objects that provide a source of - pixels to scanout to a CRTC. Applications explicitly request the - creation of frame buffers through the DRM_IOCTL_MODE_ADDFB(2) ioctls and - receive an opaque handle that can be passed to the KMS CRTC control, - plane configuration and page flip functions. - - - Frame buffers rely on the underneath memory manager for low-level memory - operations. When creating a frame buffer applications pass a memory - handle (or a list of memory handles for multi-planar formats) through - the drm_mode_fb_cmd2 argument. This document - assumes that the driver uses GEM, those handles thus reference GEM - objects. - - - Drivers must first validate the requested frame buffer parameters passed - through the mode_cmd argument. In particular this is where invalid - sizes, pixel formats or pitches can be caught. - - - If the parameters are deemed valid, drivers then create, initialize and - return an instance of struct drm_framebuffer. - If desired the instance can be embedded in a larger driver-specific - structure. The new instance is initialized with a call to - drm_framebuffer_init which takes a pointer to DRM - frame buffer operations (struct - drm_framebuffer_funcs). Frame buffer operations are - - - int (*create_handle)(struct drm_framebuffer *fb, - struct drm_file *file_priv, unsigned int *handle); - - Create a handle to the frame buffer underlying memory object. If - the frame buffer uses a multi-plane format, the handle will - reference the memory object associated with the first plane. - - - Drivers call drm_gem_handle_create to create - the handle. - - - - void (*destroy)(struct drm_framebuffer *framebuffer); - - Destroy the frame buffer object and frees all associated - resources. Drivers must call - drm_framebuffer_cleanup to free resources - allocated by the DRM core for the frame buffer object, and must - make sure to unreference all memory objects associated with the - frame buffer. Handles created by the - create_handle operation are released by - the DRM core. - - - - int (*dirty)(struct drm_framebuffer *framebuffer, - struct drm_file *file_priv, unsigned flags, unsigned color, - struct drm_clip_rect *clips, unsigned num_clips); - - This optional operation notifies the driver that a region of the - frame buffer has changed in response to a DRM_IOCTL_MODE_DIRTYFB - ioctl call. - - - - - - After initializing the drm_framebuffer - instance drivers must fill its width, - height, pitches, - offsets, depth, - bits_per_pixel and - pixel_format fields from the values passed - through the drm_mode_fb_cmd2 argument. They - should call the drm_helper_mode_fill_fb_struct - helper function to do so. - - - - Output Polling - void (*output_poll_changed)(struct drm_device *dev); - - This operation notifies the driver that the status of one or more - connectors has changed. Drivers that use the fb helper can just call the - drm_fb_helper_hotplug_event function to handle this - operation. - - - - - - - - KMS Initialization and Cleanup - - A KMS device is abstracted and exposed as a set of planes, CRTCs, encoders - and connectors. KMS drivers must thus create and initialize all those - objects at load time after initializing mode setting. - - - CRTCs (struct <structname>drm_crtc</structname>) - - A CRTC is an abstraction representing a part of the chip that contains a - pointer to a scanout buffer. Therefore, the number of CRTCs available - determines how many independent scanout buffers can be active at any - given time. The CRTC structure contains several fields to support this: - a pointer to some video memory (abstracted as a frame buffer object), a - display mode, and an (x, y) offset into the video memory to support - panning or configurations where one piece of video memory spans multiple - CRTCs. - - - CRTC Initialization - - A KMS device must create and register at least one struct - drm_crtc instance. The instance is allocated - and zeroed by the driver, possibly as part of a larger structure, and - registered with a call to drm_crtc_init with a - pointer to CRTC functions. - - - - CRTC Operations - - Set Configuration - int (*set_config)(struct drm_mode_set *set); - - Apply a new CRTC configuration to the device. The configuration - specifies a CRTC, a frame buffer to scan out from, a (x,y) position in - the frame buffer, a display mode and an array of connectors to drive - with the CRTC if possible. - - - If the frame buffer specified in the configuration is NULL, the driver - must detach all encoders connected to the CRTC and all connectors - attached to those encoders and disable them. - - - This operation is called with the mode config lock held. - - - FIXME: How should set_config interact with DPMS? If the CRTC is - suspended, should it be resumed? - - - - Page Flipping - int (*page_flip)(struct drm_crtc *crtc, struct drm_framebuffer *fb, - struct drm_pending_vblank_event *event); - - Schedule a page flip to the given frame buffer for the CRTC. This - operation is called with the mode config mutex held. - - - Page flipping is a synchronization mechanism that replaces the frame - buffer being scanned out by the CRTC with a new frame buffer during - vertical blanking, avoiding tearing. When an application requests a page - flip the DRM core verifies that the new frame buffer is large enough to - be scanned out by the CRTC in the currently configured mode and then - calls the CRTC page_flip operation with a - pointer to the new frame buffer. - - - The page_flip operation schedules a page flip. - Once any pending rendering targetting the new frame buffer has - completed, the CRTC will be reprogrammed to display that frame buffer - after the next vertical refresh. The operation must return immediately - without waiting for rendering or page flip to complete and must block - any new rendering to the frame buffer until the page flip completes. - - - If a page flip is already pending, the - page_flip operation must return - -EBUSY. - - - To synchronize page flip to vertical blanking the driver will likely - need to enable vertical blanking interrupts. It should call - drm_vblank_get for that purpose, and call - drm_vblank_put after the page flip completes. - - - If the application has requested to be notified when page flip completes - the page_flip operation will be called with a - non-NULL event argument pointing to a - drm_pending_vblank_event instance. Upon page - flip completion the driver must fill the - event::event - sequence, tv_sec - and tv_usec fields with the associated - vertical blanking count and timestamp, add the event to the - drm_file list of events to be signaled, and wake - up any waiting process. This can be performed with - event.sequence = drm_vblank_count_and_time(..., &now); - event->event.tv_sec = now.tv_sec; - event->event.tv_usec = now.tv_usec; - - spin_lock_irqsave(&dev->event_lock, flags); - list_add_tail(&event->base.link, &event->base.file_priv->event_list); - wake_up_interruptible(&event->base.file_priv->event_wait); - spin_unlock_irqrestore(&dev->event_lock, flags); - ]]> - - - FIXME: Could drivers that don't need to wait for rendering to complete - just add the event to dev->vblank_event_list and - let the DRM core handle everything, as for "normal" vertical blanking - events? - - - While waiting for the page flip to complete, the - event->base.link list head can be used freely by - the driver to store the pending event in a driver-specific list. - - - If the file handle is closed before the event is signaled, drivers must - take care to destroy the event in their - preclose operation (and, if needed, call - drm_vblank_put). - - - - Miscellaneous - - - void (*gamma_set)(struct drm_crtc *crtc, u16 *r, u16 *g, u16 *b, - uint32_t start, uint32_t size); - - Apply a gamma table to the device. The operation is optional. - - - - void (*destroy)(struct drm_crtc *crtc); - - Destroy the CRTC when not needed anymore. See - . - - - - - - - - Planes (struct <structname>drm_plane</structname>) - - A plane represents an image source that can be blended with or overlayed - on top of a CRTC during the scanout process. Planes are associated with - a frame buffer to crop a portion of the image memory (source) and - optionally scale it to a destination size. The result is then blended - with or overlayed on top of a CRTC. - - - Plane Initialization - - Planes are optional. To create a plane, a KMS drivers allocates and - zeroes an instances of struct drm_plane - (possibly as part of a larger structure) and registers it with a call - to drm_plane_init. The function takes a bitmask - of the CRTCs that can be associated with the plane, a pointer to the - plane functions and a list of format supported formats. - - - - Plane Operations - - - int (*update_plane)(struct drm_plane *plane, struct drm_crtc *crtc, - struct drm_framebuffer *fb, int crtc_x, int crtc_y, - unsigned int crtc_w, unsigned int crtc_h, - uint32_t src_x, uint32_t src_y, - uint32_t src_w, uint32_t src_h); - - Enable and configure the plane to use the given CRTC and frame buffer. - - - The source rectangle in frame buffer memory coordinates is given by - the src_x, src_y, - src_w and src_h - parameters (as 16.16 fixed point values). Devices that don't support - subpixel plane coordinates can ignore the fractional part. - - - The destination rectangle in CRTC coordinates is given by the - crtc_x, crtc_y, - crtc_w and crtc_h - parameters (as integer values). Devices scale the source rectangle to - the destination rectangle. If scaling is not supported, and the source - rectangle size doesn't match the destination rectangle size, the - driver must return a -EINVAL error. - - - - int (*disable_plane)(struct drm_plane *plane); - - Disable the plane. The DRM core calls this method in response to a - DRM_IOCTL_MODE_SETPLANE ioctl call with the frame buffer ID set to 0. - Disabled planes must not be processed by the CRTC. - - - - void (*destroy)(struct drm_plane *plane); - - Destroy the plane when not needed anymore. See - . - - - - - - - Encoders (struct <structname>drm_encoder</structname>) - - An encoder takes pixel data from a CRTC and converts it to a format - suitable for any attached connectors. On some devices, it may be - possible to have a CRTC send data to more than one encoder. In that - case, both encoders would receive data from the same scanout buffer, - resulting in a "cloned" display configuration across the connectors - attached to each encoder. - - - Encoder Initialization - - As for CRTCs, a KMS driver must create, initialize and register at - least one struct drm_encoder instance. The - instance is allocated and zeroed by the driver, possibly as part of a - larger structure. - - - Drivers must initialize the struct drm_encoder - possible_crtcs and - possible_clones fields before registering the - encoder. Both fields are bitmasks of respectively the CRTCs that the - encoder can be connected to, and sibling encoders candidate for cloning. - - - After being initialized, the encoder must be registered with a call to - drm_encoder_init. The function takes a pointer to - the encoder functions and an encoder type. Supported types are - - - DRM_MODE_ENCODER_DAC for VGA and analog on DVI-I/DVI-A - - - DRM_MODE_ENCODER_TMDS for DVI, HDMI and (embedded) DisplayPort - - - DRM_MODE_ENCODER_LVDS for display panels - - - DRM_MODE_ENCODER_TVDAC for TV output (Composite, S-Video, Component, - SCART) - - - DRM_MODE_ENCODER_VIRTUAL for virtual machine displays - - - - - Encoders must be attached to a CRTC to be used. DRM drivers leave - encoders unattached at initialization time. Applications (or the fbdev - compatibility layer when implemented) are responsible for attaching the - encoders they want to use to a CRTC. - - - - Encoder Operations - - - void (*destroy)(struct drm_encoder *encoder); - - Called to destroy the encoder when not needed anymore. See - . - - - + - Connectors (struct <structname>drm_connector</structname>) + Output configuration - A connector is the final destination for pixel data on a device, and - usually connects directly to an external display device like a monitor - or laptop panel. A connector can only be attached to one encoder at a - time. The connector is also the structure where information about the - attached display is kept, so it contains fields for display data, EDID - data, DPMS & connection status, and information about modes - supported on the attached displays. + The final initialization task is output configuration. This involves: + + + Finding and initializing the CRTCs, encoders, and connectors + for the device. + + + Creating an initial configuration. + + + Registering a framebuffer console driver. + + - Connector Initialization - - Finally a KMS driver must create, initialize, register and attach at - least one struct drm_connector instance. The - instance is created as other KMS objects and initialized by setting the - following fields. - - - - interlace_allowed - - Whether the connector can handle interlaced modes. - - - - doublescan_allowed - - Whether the connector can handle doublescan. - - - - display_info - - - Display information is filled from EDID information when a display - is detected. For non hot-pluggable displays such as flat panels in - embedded systems, the driver should initialize the - display_info.width_mm - and - display_info.height_mm - fields with the physical size of the display. - - - - polled - - Connector polling mode, a combination of - - - DRM_CONNECTOR_POLL_HPD - - The connector generates hotplug events and doesn't need to be - periodically polled. The CONNECT and DISCONNECT flags must not - be set together with the HPD flag. - - - - DRM_CONNECTOR_POLL_CONNECT - - Periodically poll the connector for connection. - - - - DRM_CONNECTOR_POLL_DISCONNECT - - Periodically poll the connector for disconnection. - - - - Set to 0 for connectors that don't support connection status - discovery. - - - - - The connector is then registered with a call to - drm_connector_init with a pointer to the connector - functions and a connector type, and exposed through sysfs with a call to - drm_sysfs_connector_add. - - - Supported connector types are - - DRM_MODE_CONNECTOR_VGA - DRM_MODE_CONNECTOR_DVII - DRM_MODE_CONNECTOR_DVID - DRM_MODE_CONNECTOR_DVIA - DRM_MODE_CONNECTOR_Composite - DRM_MODE_CONNECTOR_SVIDEO - DRM_MODE_CONNECTOR_LVDS - DRM_MODE_CONNECTOR_Component - DRM_MODE_CONNECTOR_9PinDIN - DRM_MODE_CONNECTOR_DisplayPort - DRM_MODE_CONNECTOR_HDMIA - DRM_MODE_CONNECTOR_HDMIB - DRM_MODE_CONNECTOR_TV - DRM_MODE_CONNECTOR_eDP - DRM_MODE_CONNECTOR_VIRTUAL - - - - Connectors must be attached to an encoder to be used. For devices that - map connectors to encoders 1:1, the connector should be attached at - initialization time with a call to - drm_mode_connector_attach_encoder. The driver must - also set the drm_connector - encoder field to point to the attached - encoder. - - - Finally, drivers must initialize the connectors state change detection - with a call to drm_kms_helper_poll_init. If at - least one connector is pollable but can't generate hotplug interrupts - (indicated by the DRM_CONNECTOR_POLL_CONNECT and - DRM_CONNECTOR_POLL_DISCONNECT connector flags), a delayed work will - automatically be queued to periodically poll for changes. Connectors - that can generate hotplug interrupts must be marked with the - DRM_CONNECTOR_POLL_HPD flag instead, and their interrupt handler must - call drm_helper_hpd_irq_event. The function will - queue a delayed work to check the state of all connectors, but no - periodic polling will be done. - - - - Connector Operations - - Unless otherwise state, all operations are mandatory. - - - DPMS - void (*dpms)(struct drm_connector *connector, int mode); - - The DPMS operation sets the power state of a connector. The mode - argument is one of - - DRM_MODE_DPMS_ON - DRM_MODE_DPMS_STANDBY - DRM_MODE_DPMS_SUSPEND - DRM_MODE_DPMS_OFF - - - - In all but DPMS_ON mode the encoder to which the connector is attached - should put the display in low-power mode by driving its signals - appropriately. If more than one connector is attached to the encoder - care should be taken not to change the power state of other displays as - a side effect. Low-power mode should be propagated to the encoders and - CRTCs when all related connectors are put in low-power mode. - - - - Modes - int (*fill_modes)(struct drm_connector *connector, uint32_t max_width, - uint32_t max_height); - - Fill the mode list with all supported modes for the connector. If the - max_width and max_height - arguments are non-zero, the implementation must ignore all modes wider - than max_width or higher than - max_height. - - - The connector must also fill in this operation its - display_info - width_mm and - height_mm fields with the connected display - physical size in millimeters. The fields should be set to 0 if the value - isn't known or is not applicable (for instance for projector devices). - - - - Connection Status - - The connection status is updated through polling or hotplug events when - supported (see ). The status - value is reported to userspace through ioctls and must not be used - inside the driver, as it only gets initialized by a call to - drm_mode_getconnector from userspace. - - enum drm_connector_status (*detect)(struct drm_connector *connector, - bool force); - - Check to see if anything is attached to the connector. The - force parameter is set to false whilst polling or - to true when checking the connector due to user request. - force can be used by the driver to avoid - expensive, destructive operations during automated probing. - - - Return connector_status_connected if something is connected to the - connector, connector_status_disconnected if nothing is connected and - connector_status_unknown if the connection state isn't known. - - - Drivers should only return connector_status_connected if the connection - status has really been probed as connected. Connectors that can't detect - the connection status, or failed connection status probes, should return - connector_status_unknown. - - - - Miscellaneous - - - void (*destroy)(struct drm_connector *connector); - - Destroy the connector when not needed anymore. See - . - - - - - - - - Cleanup - - The DRM core manages its objects' lifetime. When an object is not needed - anymore the core calls its destroy function, which must clean up and - free every resource allocated for the object. Every - drm_*_init call must be matched with a - corresponding drm_*_cleanup call to cleanup CRTCs - (drm_crtc_cleanup), planes - (drm_plane_cleanup), encoders - (drm_encoder_cleanup) and connectors - (drm_connector_cleanup). Furthermore, connectors - that have been added to sysfs must be removed by a call to - drm_sysfs_connector_remove before calling - drm_connector_cleanup. - - - Connectors state change detection must be cleanup up with a call to - drm_kms_helper_poll_fini. - - - - Output discovery and initialization example - Output discovery and initialization + + Several core functions exist to create CRTCs, encoders, and + connectors, namely: drm_crtc_init(), drm_connector_init(), and + drm_encoder_init(), along with several "helper" functions to + perform common tasks. + + + Connectors should be registered with sysfs once they've been + detected and initialized, using the + drm_sysfs_connector_add() function. Likewise, when they're + removed from the system, they should be destroyed with + drm_sysfs_connector_remove(). + + + - - In the example above (taken from the i915 driver), a CRTC, connector and - encoder combination is created. A device-specific i2c bus is also - created for fetching EDID data and performing monitor detection. Once - the process is complete, the new connector is registered with sysfs to - make its properties available to applications. - +} +]]> + + + In the example above (again, taken from the i915 driver), a + CRT connector and encoder combination is created. A device-specific + i2c bus is also created for fetching EDID data and + performing monitor detection. Once the process is complete, + the new connector is registered with sysfs to make its + properties available to applications. + + + Helper functions and core functions + + Since many PC-class graphics devices have similar display output + designs, the DRM provides a set of helper functions to make + output management easier. The core helper routines handle + encoder re-routing and the disabling of unused functions following + mode setting. Using the helpers is optional, but recommended for + devices with PC-style architectures (i.e. a set of display planes + for feeding pixels to encoders which are in turn routed to + connectors). Devices with more complex requirements needing + finer grained management may opt to use the core callbacks + directly. + + + [Insert typical diagram here.] [Insert OMAP style config here.] + + + + Each encoder object needs to provide: + + + A DPMS (basically on/off) function. + + + A mode-fixup function (for converting requested modes into + native hardware timings). + + + Functions (prepare, set, and commit) for use by the core DRM + helper functions. + + + Connector helpers need to provide functions (mode-fetch, validity, + and encoder-matching) for returning an ideal encoder for a given + connector. The core connector functions include a DPMS callback, + save/restore routines (deprecated), detection, mode probing, + property handling, and cleanup functions. + + + + + - + - Mid-layer Helper Functions + VBlank event handling - The CRTC, encoder and connector functions provided by the drivers - implement the DRM API. They're called by the DRM core and ioctl handlers - to handle device state changes and configuration request. As implementing - those functions often requires logic not specific to drivers, mid-layer - helper functions are available to avoid duplicating boilerplate code. - - - The DRM core contains one mid-layer implementation. The mid-layer provides - implementations of several CRTC, encoder and connector functions (called - from the top of the mid-layer) that pre-process requests and call - lower-level functions provided by the driver (at the bottom of the - mid-layer). For instance, the - drm_crtc_helper_set_config function can be used to - fill the struct drm_crtc_funcs - set_config field. When called, it will split - the set_config operation in smaller, simpler - operations and call the driver to handle them. + The DRM core exposes two vertical blank related ioctls: + + + DRM_IOCTL_WAIT_VBLANK + + + This takes a struct drm_wait_vblank structure as its argument, + and it is used to block or request a signal when a specified + vblank event occurs. + + + + + DRM_IOCTL_MODESET_CTL + + + This should be called by application level drivers before and + after mode setting, since on many devices the vertical blank + counter is reset at that time. Internally, the DRM snapshots + the last vblank count when the ioctl is called with the + _DRM_PRE_MODESET command, so that the counter won't go backwards + (which is dealt with when _DRM_POST_MODESET is used). + + + + + - To use the mid-layer, drivers call drm_crtc_helper_add, - drm_encoder_helper_add and - drm_connector_helper_add functions to install their - mid-layer bottom operations handlers, and fill the - drm_crtc_funcs, - drm_encoder_funcs and - drm_connector_funcs structures with pointers to - the mid-layer top API functions. Installing the mid-layer bottom operation - handlers is best done right after registering the corresponding KMS object. + To support the functions above, the DRM core provides several + helper functions for tracking vertical blank counters, and + requires drivers to provide several callbacks: + get_vblank_counter(), enable_vblank() and disable_vblank(). The + core uses get_vblank_counter() to keep the counter accurate + across interrupt disable periods. It should return the current + vertical blank event count, which is often tracked in a device + register. The enable and disable vblank callbacks should enable + and disable vertical blank interrupts, respectively. In the + absence of DRM clients waiting on vblank events, the core DRM + code uses the disable_vblank() function to disable + interrupts, which saves power. They are re-enabled again when + a client calls the vblank wait ioctl above. - The mid-layer is not split between CRTC, encoder and connector operations. - To use it, a driver must provide bottom functions for all of the three KMS - entities. + A device that doesn't provide a count register may simply use an + internal atomic counter incremented on every vertical blank + interrupt (and then treat the enable_vblank() and disable_vblank() + callbacks as no-ops). - - Helper Functions - - - int drm_crtc_helper_set_config(struct drm_mode_set *set); - - The drm_crtc_helper_set_config helper function - is a CRTC set_config implementation. It - first tries to locate the best encoder for each connector by calling - the connector best_encoder helper - operation. - - - After locating the appropriate encoders, the helper function will - call the mode_fixup encoder and CRTC helper - operations to adjust the requested mode, or reject it completely in - which case an error will be returned to the application. If the new - configuration after mode adjustment is identical to the current - configuration the helper function will return without performing any - other operation. - - - If the adjusted mode is identical to the current mode but changes to - the frame buffer need to be applied, the - drm_crtc_helper_set_config function will call - the CRTC mode_set_base helper operation. If - the adjusted mode differs from the current mode, or if the - mode_set_base helper operation is not - provided, the helper function performs a full mode set sequence by - calling the prepare, - mode_set and - commit CRTC and encoder helper operations, - in that order. - - - - void drm_helper_connector_dpms(struct drm_connector *connector, int mode); - - The drm_helper_connector_dpms helper function - is a connector dpms implementation that - tracks power state of connectors. To use the function, drivers must - provide dpms helper operations for CRTCs - and encoders to apply the DPMS state to the device. - - - The mid-layer doesn't track the power state of CRTCs and encoders. - The dpms helper operations can thus be - called with a mode identical to the currently active mode. - - - - int drm_helper_probe_single_connector_modes(struct drm_connector *connector, - uint32_t maxX, uint32_t maxY); - - The drm_helper_probe_single_connector_modes helper - function is a connector fill_modes - implementation that updates the connection status for the connector - and then retrieves a list of modes by calling the connector - get_modes helper operation. - - - The function filters out modes larger than - max_width and max_height - if specified. It then calls the connector - mode_valid helper operation for each mode in - the probed list to check whether the mode is valid for the connector. - - - - - - CRTC Helper Operations - - - bool (*mode_fixup)(struct drm_crtc *crtc, - const struct drm_display_mode *mode, - struct drm_display_mode *adjusted_mode); - - Let CRTCs adjust the requested mode or reject it completely. This - operation returns true if the mode is accepted (possibly after being - adjusted) or false if it is rejected. - - - The mode_fixup operation should reject the - mode if it can't reasonably use it. The definition of "reasonable" - is currently fuzzy in this context. One possible behaviour would be - to set the adjusted mode to the panel timings when a fixed-mode - panel is used with hardware capable of scaling. Another behaviour - would be to accept any input mode and adjust it to the closest mode - supported by the hardware (FIXME: This needs to be clarified). - - - - int (*mode_set_base)(struct drm_crtc *crtc, int x, int y, - struct drm_framebuffer *old_fb) - - Move the CRTC on the current frame buffer (stored in - crtc->fb) to position (x,y). Any of the frame - buffer, x position or y position may have been modified. - - - This helper operation is optional. If not provided, the - drm_crtc_helper_set_config function will fall - back to the mode_set helper operation. - - - FIXME: Why are x and y passed as arguments, as they can be accessed - through crtc->x and - crtc->y? - - - - void (*prepare)(struct drm_crtc *crtc); - - Prepare the CRTC for mode setting. This operation is called after - validating the requested mode. Drivers use it to perform - device-specific operations required before setting the new mode. - - - - int (*mode_set)(struct drm_crtc *crtc, struct drm_display_mode *mode, - struct drm_display_mode *adjusted_mode, int x, int y, - struct drm_framebuffer *old_fb); - - Set a new mode, position and frame buffer. Depending on the device - requirements, the mode can be stored internally by the driver and - applied in the commit operation, or - programmed to the hardware immediately. - - - The mode_set operation returns 0 on success - or a negative error code if an error occurs. - - - - void (*commit)(struct drm_crtc *crtc); - - Commit a mode. This operation is called after setting the new mode. - Upon return the device must use the new mode and be fully - operational. - - - - - - Encoder Helper Operations - - - bool (*mode_fixup)(struct drm_encoder *encoder, - const struct drm_display_mode *mode, - struct drm_display_mode *adjusted_mode); - - FIXME: The mode argument be const, but the i915 driver modifies - mode->clock in intel_dp_mode_fixup. - - - Let encoders adjust the requested mode or reject it completely. This - operation returns true if the mode is accepted (possibly after being - adjusted) or false if it is rejected. See the - mode_fixup CRTC helper - operation for an explanation of the allowed adjustments. - - - - void (*prepare)(struct drm_encoder *encoder); - - Prepare the encoder for mode setting. This operation is called after - validating the requested mode. Drivers use it to perform - device-specific operations required before setting the new mode. - - - - void (*mode_set)(struct drm_encoder *encoder, - struct drm_display_mode *mode, - struct drm_display_mode *adjusted_mode); - - Set a new mode. Depending on the device requirements, the mode can - be stored internally by the driver and applied in the - commit operation, or programmed to the - hardware immediately. - - - - void (*commit)(struct drm_encoder *encoder); - - Commit a mode. This operation is called after setting the new mode. - Upon return the device must use the new mode and be fully - operational. - - - - - - Connector Helper Operations - - - struct drm_encoder *(*best_encoder)(struct drm_connector *connector); - - Return a pointer to the best encoder for the connecter. Device that - map connectors to encoders 1:1 simply return the pointer to the - associated encoder. This operation is mandatory. - - - - int (*get_modes)(struct drm_connector *connector); - - Fill the connector's probed_modes list - by parsing EDID data with drm_add_edid_modes or - calling drm_mode_probed_add directly for every - supported mode and return the number of modes it has detected. This - operation is mandatory. - - - When adding modes manually the driver creates each mode with a call to - drm_mode_create and must fill the following fields. - - - __u32 type; - - Mode type bitmask, a combination of - - - DRM_MODE_TYPE_BUILTIN - not used? - - - DRM_MODE_TYPE_CLOCK_C - not used? - - - DRM_MODE_TYPE_CRTC_C - not used? - - - - DRM_MODE_TYPE_PREFERRED - The preferred mode for the connector - - - not used? - - - - DRM_MODE_TYPE_DEFAULT - not used? - - - DRM_MODE_TYPE_USERDEF - not used? - - - DRM_MODE_TYPE_DRIVER - - - The mode has been created by the driver (as opposed to - to user-created modes). - - - - - Drivers must set the DRM_MODE_TYPE_DRIVER bit for all modes they - create, and set the DRM_MODE_TYPE_PREFERRED bit for the preferred - mode. - - - - __u32 clock; - Pixel clock frequency in kHz unit - - - __u16 hdisplay, hsync_start, hsync_end, htotal; - __u16 vdisplay, vsync_start, vsync_end, vtotal; - Horizontal and vertical timing information - <----------------><-------------><--------------> - - //////////////////////| - ////////////////////// | - ////////////////////// |.................. ................ - _______________ - - <----- [hv]display -----> - <------------- [hv]sync_start ------------> - <--------------------- [hv]sync_end ---------------------> - <-------------------------------- [hv]total -----------------------------> -]]> - - - __u16 hskew; - __u16 vscan; - Unknown - - - __u32 flags; - - Mode flags, a combination of - - - DRM_MODE_FLAG_PHSYNC - - Horizontal sync is active high - - - - DRM_MODE_FLAG_NHSYNC - - Horizontal sync is active low - - - - DRM_MODE_FLAG_PVSYNC - - Vertical sync is active high - - - - DRM_MODE_FLAG_NVSYNC - - Vertical sync is active low - - - - DRM_MODE_FLAG_INTERLACE - - Mode is interlaced - - - - DRM_MODE_FLAG_DBLSCAN - - Mode uses doublescan - - - - DRM_MODE_FLAG_CSYNC - - Mode uses composite sync - - - - DRM_MODE_FLAG_PCSYNC - - Composite sync is active high - - - - DRM_MODE_FLAG_NCSYNC - - Composite sync is active low - - - - DRM_MODE_FLAG_HSKEW - - hskew provided (not used?) - - - - DRM_MODE_FLAG_BCAST - - not used? - - - - DRM_MODE_FLAG_PIXMUX - - not used? - - - - DRM_MODE_FLAG_DBLCLK - - not used? - - - - DRM_MODE_FLAG_CLKDIV2 - - ? - - - - - - Note that modes marked with the INTERLACE or DBLSCAN flags will be - filtered out by - drm_helper_probe_single_connector_modes if - the connector's interlace_allowed or - doublescan_allowed field is set to 0. - - - - char name[DRM_DISPLAY_MODE_LEN]; - - Mode name. The driver must call - drm_mode_set_name to fill the mode name from - hdisplay, - vdisplay and interlace flag after - filling the corresponding fields. - - - - - - The vrefresh value is computed by - drm_helper_probe_single_connector_modes. - - - When parsing EDID data, drm_add_edid_modes fill the - connector display_info - width_mm and - height_mm fields. When creating modes - manually the get_modes helper operation must - set the display_info - width_mm and - height_mm fields if they haven't been set - already (for instance at initilization time when a fixed-size panel is - attached to the connector). The mode width_mm - and height_mm fields are only used internally - during EDID parsing and should not be set when creating modes manually. - - - - int (*mode_valid)(struct drm_connector *connector, - struct drm_display_mode *mode); - - Verify whether a mode is valid for the connector. Return MODE_OK for - supported modes and one of the enum drm_mode_status values (MODE_*) - for unsupported modes. This operation is mandatory. - - - As the mode rejection reason is currently not used beside for - immediately removing the unsupported mode, an implementation can - return MODE_BAD regardless of the exact reason why the mode is not - valid. - - - Note that the mode_valid helper operation is - only called for modes detected by the device, and - not for modes set by the user through the CRTC - set_config operation. - - - - - - - - Vertical Blanking - - Vertical blanking plays a major role in graphics rendering. To achieve - tear-free display, users must synchronize page flips and/or rendering to - vertical blanking. The DRM API offers ioctls to perform page flips - synchronized to vertical blanking and wait for vertical blanking. - - - The DRM core handles most of the vertical blanking management logic, which - involves filtering out spurious interrupts, keeping race-free blanking - counters, coping with counter wrap-around and resets and keeping use - counts. It relies on the driver to generate vertical blanking interrupts - and optionally provide a hardware vertical blanking counter. Drivers must - implement the following operations. - - - - int (*enable_vblank) (struct drm_device *dev, int crtc); -void (*disable_vblank) (struct drm_device *dev, int crtc); - - Enable or disable vertical blanking interrupts for the given CRTC. - - - - u32 (*get_vblank_counter) (struct drm_device *dev, int crtc); - - Retrieve the value of the vertical blanking counter for the given - CRTC. If the hardware maintains a vertical blanking counter its value - should be returned. Otherwise drivers can use the - drm_vblank_count helper function to handle this - operation. - - - - - Drivers must initialize the vertical blanking handling core with a call to - drm_vblank_init in their - load operation. The function will set the struct - drm_device - vblank_disable_allowed field to 0. This will - keep vertical blanking interrupts enabled permanently until the first mode - set operation, where vblank_disable_allowed is - set to 1. The reason behind this is not clear. Drivers can set the field - to 1 after calling drm_vblank_init to make vertical - blanking interrupts dynamically managed from the beginning. - - - Vertical blanking interrupts can be enabled by the DRM core or by drivers - themselves (for instance to handle page flipping operations). The DRM core - maintains a vertical blanking use count to ensure that the interrupts are - not disabled while a user still needs them. To increment the use count, - drivers call drm_vblank_get. Upon return vertical - blanking interrupts are guaranteed to be enabled. - - - To decrement the use count drivers call - drm_vblank_put. Only when the use count drops to zero - will the DRM core disable the vertical blanking interrupts after a delay - by scheduling a timer. The delay is accessible through the vblankoffdelay - module parameter or the drm_vblank_offdelay global - variable and expressed in milliseconds. Its default value is 5000 ms. - - - When a vertical blanking interrupt occurs drivers only need to call the - drm_handle_vblank function to account for the - interrupt. - + + Memory management - Resources allocated by drm_vblank_init must be freed - with a call to drm_vblank_cleanup in the driver - unload operation handler. + The memory manager lies at the heart of many DRM operations; it + is required to support advanced client features like OpenGL + pbuffers. The DRM currently contains two memory managers: TTM + and GEM. - - - - - Open/Close, File Operations and IOCTLs - Open and Close - int (*firstopen) (struct drm_device *); -void (*lastclose) (struct drm_device *); -int (*open) (struct drm_device *, struct drm_file *); -void (*preclose) (struct drm_device *, struct drm_file *); -void (*postclose) (struct drm_device *, struct drm_file *); - Open and close handlers. None of those methods are mandatory. - - - The firstopen method is called by the DRM core - when an application opens a device that has no other opened file handle. - Similarly the lastclose method is called when - the last application holding a file handle opened on the device closes - it. Both methods are mostly used for UMS (User Mode Setting) drivers to - acquire and release device resources which should be done in the - load and unload - methods for KMS drivers. - - - Note that the lastclose method is also called - at module unload time or, for hot-pluggable devices, when the device is - unplugged. The firstopen and - lastclose calls can thus be unbalanced. - - - The open method is called every time the device - is opened by an application. Drivers can allocate per-file private data - in this method and store them in the struct - drm_file driver_priv - field. Note that the open method is called - before firstopen. - + The Translation Table Manager (TTM) - The close operation is split into preclose and - postclose methods. Drivers must stop and - cleanup all per-file operations in the preclose - method. For instance pending vertical blanking and page flip events must - be cancelled. No per-file operation is allowed on the file handle after - returning from the preclose method. + TTM was developed by Tungsten Graphics, primarily by Thomas + Hellström, and is intended to be a flexible, high performance + graphics memory manager. - Finally the postclose method is called as the - last step of the close operation, right before calling the - lastclose method if no other open file handle - exists for the device. Drivers that have allocated per-file private data - in the open method should free it here. + Drivers wishing to support TTM must fill out a drm_bo_driver + structure. - The lastclose method should restore CRTC and - plane properties to default value, so that a subsequent open of the - device will not inherit state from the previous user. + TTM design background and information belongs here. + - File Operations - const struct file_operations *fops - File operations for the DRM device node. - - Drivers must define the file operations structure that forms the DRM - userspace API entry point, even though most of those operations are - implemented in the DRM core. The open, - release and ioctl - operations are handled by - - .owner = THIS_MODULE, - .open = drm_open, - .release = drm_release, - .unlocked_ioctl = drm_ioctl, - #ifdef CONFIG_COMPAT - .compat_ioctl = drm_compat_ioctl, - #endif - - - - Drivers that implement private ioctls that requires 32/64bit - compatibility support must provide their own - compat_ioctl handler that processes private - ioctls and calls drm_compat_ioctl for core ioctls. - - - The read and poll - operations provide support for reading DRM events and polling them. They - are implemented by - - .poll = drm_poll, - .read = drm_read, - .fasync = drm_fasync, - .llseek = no_llseek, - - - - The memory mapping implementation varies depending on how the driver - manages memory. Pre-GEM drivers will use drm_mmap, - while GEM-aware drivers will use drm_gem_mmap. See - . - - .mmap = drm_gem_mmap, - - + The Graphics Execution Manager (GEM) - No other file operation is supported by the DRM API. + GEM is an Intel project, authored by Eric Anholt and Keith + Packard. It provides simpler interfaces than TTM, and is well + suited for UMA devices. - - - IOCTLs - struct drm_ioctl_desc *ioctls; -int num_ioctls; - Driver-specific ioctls descriptors table. - Driver-specific ioctls numbers start at DRM_COMMAND_BASE. The ioctls - descriptors table is indexed by the ioctl number offset from the base - value. Drivers can use the DRM_IOCTL_DEF_DRV() macro to initialize the - table entries. + GEM-enabled drivers must provide gem_init_object() and + gem_free_object() callbacks to support the core memory + allocation routines. They should also provide several driver-specific + ioctls to support command execution, pinning, buffer + read & write, mapping, and domain ownership transfers. - DRM_IOCTL_DEF_DRV(ioctl, func, flags) - - ioctl is the ioctl name. Drivers must define - the DRM_##ioctl and DRM_IOCTL_##ioctl macros to the ioctl number - offset from DRM_COMMAND_BASE and the ioctl number respectively. The - first macro is private to the device while the second must be exposed - to userspace in a public header. - - - func is a pointer to the ioctl handler function - compatible with the drm_ioctl_t type. - typedef int drm_ioctl_t(struct drm_device *dev, void *data, - struct drm_file *file_priv); - - - flags is a bitmask combination of the following - values. It restricts how the ioctl is allowed to be called. - - - DRM_AUTH - Only authenticated callers allowed - - - DRM_MASTER - The ioctl can only be called on the master file - handle - - - DRM_ROOT_ONLY - Only callers with the SYSADMIN capability allowed - - - DRM_CONTROL_ALLOW - The ioctl can only be called on a control - device - - - DRM_UNLOCKED - The ioctl handler will be called without locking - the DRM global mutex - - - + On a fundamental level, GEM involves several operations: + + Memory allocation and freeing + Command execution + Aperture management at command execution time + + Buffer object allocation is relatively + straightforward and largely provided by Linux's shmem layer, which + provides memory to back each object. When mapped into the GTT + or used in a command buffer, the backing pages for an object are + flushed to memory and marked write combined so as to be coherent + with the GPU. Likewise, if the CPU accesses an object after the GPU + has finished rendering to the object, then the object must be made + coherent with the CPU's view + of memory, usually involving GPU cache flushing of various kinds. + This core CPU<->GPU coherency management is provided by a + device-specific ioctl, which evaluates an object's current domain and + performs any necessary flushing or synchronization to put the object + into the desired coherency domain (note that the object may be busy, + i.e. an active render target; in that case, setting the domain + blocks the client and waits for rendering to complete before + performing any necessary flushing operations). + + + Perhaps the most important GEM function is providing a command + execution interface to clients. Client programs construct command + buffers containing references to previously allocated memory objects, + and then submit them to GEM. At that point, GEM takes care to bind + all the objects into the GTT, execute the buffer, and provide + necessary synchronization between clients accessing the same buffers. + This often involves evicting some objects from the GTT and re-binding + others (a fairly expensive operation), and providing relocation + support which hides fixed GTT offsets from clients. Clients must + take care not to submit command buffers that reference more objects + than can fit in the GTT; otherwise, GEM will reject them and no rendering + will occur. Similarly, if several objects in the buffer require + fence registers to be allocated for correct rendering (e.g. 2D blits + on pre-965 chips), care must be taken not to require more fence + registers than are available to the client. Such resource management + should be abstracted from the client in libdrm. + + - Command submission & fencing + Output management - This should cover a few device-specific command submission - implementations. + At the core of the DRM output management code is a set of + structures representing CRTCs, encoders, and connectors. + + + A CRTC is an abstraction representing a part of the chip that + contains a pointer to a scanout buffer. Therefore, the number + of CRTCs available determines how many independent scanout + buffers can be active at any given time. The CRTC structure + contains several fields to support this: a pointer to some video + memory, a display mode, and an (x, y) offset into the video + memory to support panning or configurations where one piece of + video memory spans multiple CRTCs. + + + An encoder takes pixel data from a CRTC and converts it to a + format suitable for any attached connectors. On some devices, + it may be possible to have a CRTC send data to more than one + encoder. In that case, both encoders would receive data from + the same scanout buffer, resulting in a "cloned" display + configuration across the connectors attached to each encoder. + + + A connector is the final destination for pixel data on a device, + and usually connects directly to an external display device like + a monitor or laptop panel. A connector can only be attached to + one encoder at a time. The connector is also the structure + where information about the attached display is kept, so it + contains fields for display data, EDID data, DPMS & + connection status, and information about modes supported on the + attached displays. + - + + Framebuffer management + + Clients need to provide a framebuffer object which provides a source + of pixels for a CRTC to deliver to the encoder(s) and ultimately the + connector(s). A framebuffer is fundamentally a driver-specific memory + object, made into an opaque handle by the DRM's addfb() function. + Once a framebuffer has been created this way, it may be passed to the + KMS mode setting routines for use in a completed configuration. + + - Suspend/Resume + Command submission & fencing - The DRM core provides some suspend/resume code, but drivers wanting full - suspend/resume support should provide save() and restore() functions. - These are called at suspend, hibernate, or resume time, and should perform - any state save or restore required by your device across suspend or - hibernate states. + This should cover a few device-specific command submission + implementations. - int (*suspend) (struct drm_device *, pm_message_t state); -int (*resume) (struct drm_device *); + + + + Suspend/resume - Those are legacy suspend and resume methods. New driver should use the - power management interface provided by their bus type (usually through - the struct device_driver dev_pm_ops) and set - these methods to NULL. + The DRM core provides some suspend/resume code, but drivers + wanting full suspend/resume support should provide save() and + restore() functions. These are called at suspend, + hibernate, or resume time, and should perform any state save or + restore required by your device across suspend or hibernate + states. @@ -2385,35 +833,6 @@ int (*resume) (struct drm_device *); - - @@ -2434,42 +853,6 @@ int (*resume) (struct drm_device *); Cover generic ioctls and sysfs layout here. We only need high-level info, since man pages should cover the rest. - - - - - VBlank event handling - - The DRM core exposes two vertical blank related ioctls: - - - DRM_IOCTL_WAIT_VBLANK - - - This takes a struct drm_wait_vblank structure as its argument, - and it is used to block or request a signal when a specified - vblank event occurs. - - - - - DRM_IOCTL_MODESET_CTL - - - This should be called by application level drivers before and - after mode setting, since on many devices the vertical blank - counter is reset at that time. Internally, the DRM snapshots - the last vblank count when the ioctl is called with the - _DRM_PRE_MODESET command, so that the counter won't go backwards - (which is dealt with when _DRM_POST_MODESET is used). - - - - - - - - diff --git a/trunk/Documentation/aoe/aoe.txt b/trunk/Documentation/aoe/aoe.txt index bfc9cb19abcd..5f5aa16047ff 100644 --- a/trunk/Documentation/aoe/aoe.txt +++ b/trunk/Documentation/aoe/aoe.txt @@ -1,16 +1,8 @@ -ATA over Ethernet is a network protocol that provides simple access to -block storage on the LAN. +The EtherDrive (R) HOWTO for users of 2.6 kernels is found at ... - http://support.coraid.com/documents/AoEr11.txt + http://www.coraid.com/SUPPORT/EtherDrive-HBA -The EtherDrive (R) HOWTO for 2.6 and 3.x kernels is found at ... - - http://support.coraid.com/support/linux/EtherDrive-2.6-HOWTO.html - -It has many tips and hints! Please see, especially, recommended -tunings for virtual memory: - - http://support.coraid.com/support/linux/EtherDrive-2.6-HOWTO-5.html#ss5.19 + It has many tips and hints! The aoetools are userland programs that are designed to work with this driver. The aoetools are on sourceforge. @@ -31,12 +23,20 @@ CREATING DEVICE NODES There is a udev-install.sh script that shows how to install these rules on your system. + If you are not using udev, two scripts are provided in + Documentation/aoe as examples of static device node creation for + using the aoe driver. + + rm -rf /dev/etherd + sh Documentation/aoe/mkdevs.sh /dev/etherd + + ... or to make just one shelf's worth of block device nodes ... + + sh Documentation/aoe/mkshelf.sh /dev/etherd 0 + There is also an autoload script that shows how to edit /etc/modprobe.d/aoe.conf to ensure that the aoe module is loaded when - necessary. Preloading the aoe module is preferable to autoloading, - however, because AoE discovery takes a few seconds. It can be - confusing when an AoE device is not present the first time the a - command is run but appears a second later. + necessary. USING DEVICE NODES @@ -51,9 +51,9 @@ USING DEVICE NODES "echo > /dev/etherd/discover" tells the driver to find out what AoE devices are available. - In the future these character devices may disappear and be replaced - by sysfs counterparts. Using the commands in aoetools insulates - users from these implementation details. + These character devices may disappear and be replaced by sysfs + counterparts. Using the commands in aoetools insulates users from + these implementation details. The block devices are named like this: @@ -76,8 +76,8 @@ USING SYSFS The netif attribute is the network interface on the localhost through which we are communicating with the remote AoE device. - There is a script in this directory that formats this information in - a convenient way. Users with aoetools should use the aoe-stat + There is a script in this directory that formats this information + in a convenient way. Users with aoetools can use the aoe-stat command. root@makki root# sh Documentation/aoe/status.sh @@ -121,21 +121,3 @@ DRIVER OPTIONS usage example for the module parameter. modprobe aoe_iflist="eth1 eth3" - - The aoe_deadsecs module parameter determines the maximum number of - seconds that the driver will wait for an AoE device to provide a - response to an AoE command. After aoe_deadsecs seconds have - elapsed, the AoE device will be marked as "down". - - The aoe_maxout module parameter has a default of 128. This is the - maximum number of unresponded packets that will be sent to an AoE - target at one time. - - The aoe_dyndevs module parameter defaults to 1, meaning that the - driver will assign a block device minor number to a discovered AoE - target based on the order of its discovery. With dynamic minor - device numbers in use, a greater range of AoE shelf and slot - addresses can be supported. Users with udev will never have to - think about minor numbers. Using aoe_dyndevs=0 allows device nodes - to be pre-created using a static minor-number scheme with the - aoe-mkshelf script in the aoetools. diff --git a/trunk/Documentation/aoe/mkdevs.sh b/trunk/Documentation/aoe/mkdevs.sh new file mode 100644 index 000000000000..44c0ab702432 --- /dev/null +++ b/trunk/Documentation/aoe/mkdevs.sh @@ -0,0 +1,41 @@ +#!/bin/sh + +n_shelves=${n_shelves:-10} +n_partitions=${n_partitions:-16} + +if test "$#" != "1"; then + echo "Usage: sh `basename $0` {dir}" 1>&2 + echo " n_partitions=16 sh `basename $0` {dir}" 1>&2 + exit 1 +fi +dir=$1 + +MAJOR=152 + +echo "Creating AoE devnode files in $dir ..." + +set -e + +mkdir -p $dir + +# (Status info is in sysfs. See status.sh.) +# rm -f $dir/stat +# mknod -m 0400 $dir/stat c $MAJOR 1 +rm -f $dir/err +mknod -m 0400 $dir/err c $MAJOR 2 +rm -f $dir/discover +mknod -m 0200 $dir/discover c $MAJOR 3 +rm -f $dir/interfaces +mknod -m 0200 $dir/interfaces c $MAJOR 4 +rm -f $dir/revalidate +mknod -m 0200 $dir/revalidate c $MAJOR 5 +rm -f $dir/flush +mknod -m 0200 $dir/flush c $MAJOR 6 + +export n_partitions +mkshelf=`echo $0 | sed 's!mkdevs!mkshelf!'` +i=0 +while test $i -lt $n_shelves; do + sh -xc "sh $mkshelf $dir $i" + i=`expr $i + 1` +done diff --git a/trunk/Documentation/aoe/mkshelf.sh b/trunk/Documentation/aoe/mkshelf.sh new file mode 100644 index 000000000000..32615814271c --- /dev/null +++ b/trunk/Documentation/aoe/mkshelf.sh @@ -0,0 +1,28 @@ +#! /bin/sh + +if test "$#" != "2"; then + echo "Usage: sh `basename $0` {dir} {shelfaddress}" 1>&2 + echo " n_partitions=16 sh `basename $0` {dir} {shelfaddress}" 1>&2 + exit 1 +fi +n_partitions=${n_partitions:-16} +dir=$1 +shelf=$2 +nslots=16 +maxslot=`echo $nslots 1 - p | dc` +MAJOR=152 + +set -e + +minor=`echo $nslots \* $shelf \* $n_partitions | bc` +endp=`echo $n_partitions - 1 | bc` +for slot in `seq 0 $maxslot`; do + for part in `seq 0 $endp`; do + name=e$shelf.$slot + test "$part" != "0" && name=${name}p$part + rm -f $dir/$name + mknod -m 0660 $dir/$name b $MAJOR $minor + + minor=`expr $minor + 1` + done +done diff --git a/trunk/Documentation/aoe/status.sh b/trunk/Documentation/aoe/status.sh index eeec7baae57a..751f3be514b8 100644 --- a/trunk/Documentation/aoe/status.sh +++ b/trunk/Documentation/aoe/status.sh @@ -1,8 +1,5 @@ #! /bin/sh # collate and present sysfs information about AoE storage -# -# A more complete version of this script is aoe-stat, in the -# aoetools. set -e format="%8s\t%8s\t%8s\n" diff --git a/trunk/Documentation/cpu-freq/boost.txt b/trunk/Documentation/cpu-freq/boost.txt deleted file mode 100644 index 9b4edfcf486f..000000000000 --- a/trunk/Documentation/cpu-freq/boost.txt +++ /dev/null @@ -1,93 +0,0 @@ -Processor boosting control - - - information for users - - -Quick guide for the impatient: --------------------- -/sys/devices/system/cpu/cpufreq/boost -controls the boost setting for the whole system. You can read and write -that file with either "0" (boosting disabled) or "1" (boosting allowed). -Reading or writing 1 does not mean that the system is boosting at this -very moment, but only that the CPU _may_ raise the frequency at it's -discretion. --------------------- - -Introduction -------------- -Some CPUs support a functionality to raise the operating frequency of -some cores in a multi-core package if certain conditions apply, mostly -if the whole chip is not fully utilized and below it's intended thermal -budget. This is done without operating system control by a combination -of hardware and firmware. -On Intel CPUs this is called "Turbo Boost", AMD calls it "Turbo-Core", -in technical documentation "Core performance boost". In Linux we use -the term "boost" for convenience. - -Rationale for disable switch ----------------------------- - -Though the idea is to just give better performance without any user -intervention, sometimes the need arises to disable this functionality. -Most systems offer a switch in the (BIOS) firmware to disable the -functionality at all, but a more fine-grained and dynamic control would -be desirable: -1. While running benchmarks, reproducible results are important. Since - the boosting functionality depends on the load of the whole package, - single thread performance can vary. By explicitly disabling the boost - functionality at least for the benchmark's run-time the system will run - at a fixed frequency and results are reproducible again. -2. To examine the impact of the boosting functionality it is helpful - to do tests with and without boosting. -3. Boosting means overclocking the processor, though under controlled - conditions. By raising the frequency and the voltage the processor - will consume more power than without the boosting, which may be - undesirable for instance for mobile users. Disabling boosting may - save power here, though this depends on the workload. - - -User controlled switch ----------------------- - -To allow the user to toggle the boosting functionality, the acpi-cpufreq -driver exports a sysfs knob to disable it. There is a file: -/sys/devices/system/cpu/cpufreq/boost -which can either read "0" (boosting disabled) or "1" (boosting enabled). -Reading the file is always supported, even if the processor does not -support boosting. In this case the file will be read-only and always -reads as "0". Explicitly changing the permissions and writing to that -file anyway will return EINVAL. - -On supported CPUs one can write either a "0" or a "1" into this file. -This will either disable the boost functionality on all cores in the -whole system (0) or will allow the hardware to boost at will (1). - -Writing a "1" does not explicitly boost the system, but just allows the -CPU (and the firmware) to boost at their discretion. Some implementations -take external factors like the chip's temperature into account, so -boosting once does not necessarily mean that it will occur every time -even using the exact same software setup. - - -AMD legacy cpb switch ---------------------- -The AMD powernow-k8 driver used to support a very similar switch to -disable or enable the "Core Performance Boost" feature of some AMD CPUs. -This switch was instantiated in each CPU's cpufreq directory -(/sys/devices/system/cpu[0-9]*/cpufreq) and was called "cpb". -Though the per CPU existence hints at a more fine grained control, the -actual implementation only supported a system-global switch semantics, -which was simply reflected into each CPU's file. Writing a 0 or 1 into it -would pull the other CPUs to the same state. -For compatibility reasons this file and its behavior is still supported -on AMD CPUs, though it is now protected by a config switch -(X86_ACPI_CPUFREQ_CPB). On Intel CPUs this file will never be created, -even with the config option set. -This functionality is considered legacy and will be removed in some future -kernel version. - -More fine grained boosting control ----------------------------------- - -Technically it is possible to switch the boosting functionality at least -on a per package basis, for some CPUs even per core. Currently the driver -does not support it, but this may be implemented in the future. diff --git a/trunk/Documentation/cpuidle/sysfs.txt b/trunk/Documentation/cpuidle/sysfs.txt index b6f44f490ed7..9d28a3406e74 100644 --- a/trunk/Documentation/cpuidle/sysfs.txt +++ b/trunk/Documentation/cpuidle/sysfs.txt @@ -76,17 +76,9 @@ total 0 * desc : Small description about the idle state (string) -* disable : Option to disable this idle state (bool) -> see note below +* disable : Option to disable this idle state (bool) * latency : Latency to exit out of this idle state (in microseconds) * name : Name of the idle state (string) * power : Power consumed while in this idle state (in milliwatts) * time : Total time spent in this idle state (in microseconds) * usage : Number of times this state was entered (count) - -Note: -The behavior and the effect of the disable variable depends on the -implementation of a particular governor. In the ladder governor, for -example, it is not coherent, i.e. if one is disabling a light state, -then all deeper states are disabled as well, but the disable variable -does not reflect it. Likewise, if one enables a deep state but a lighter -state still is disabled, then this has no effect. diff --git a/trunk/Documentation/devicetree/bindings/arm/calxeda/combophy.txt b/trunk/Documentation/devicetree/bindings/arm/calxeda/combophy.txt deleted file mode 100644 index 6622bdb2e8bc..000000000000 --- a/trunk/Documentation/devicetree/bindings/arm/calxeda/combophy.txt +++ /dev/null @@ -1,17 +0,0 @@ -Calxeda Highbank Combination Phys for SATA - -Properties: -- compatible : Should be "calxeda,hb-combophy" -- #phy-cells: Should be 1. -- reg : Address and size for Combination Phy registers. -- phydev: device ID for programming the combophy. - -Example: - - combophy5: combo-phy@fff5d000 { - compatible = "calxeda,hb-combophy"; - #phy-cells = <1>; - reg = <0xfff5d000 0x1000>; - phydev = <31>; - }; - diff --git a/trunk/Documentation/devicetree/bindings/ata/ahci-platform.txt b/trunk/Documentation/devicetree/bindings/ata/ahci-platform.txt index b519f9b699c3..8bb8a76d42e8 100644 --- a/trunk/Documentation/devicetree/bindings/ata/ahci-platform.txt +++ b/trunk/Documentation/devicetree/bindings/ata/ahci-platform.txt @@ -8,18 +8,9 @@ Required properties: - interrupts : - reg : -Optional properties: -- calxeda,port-phys: phandle-combophy and lane assignment, which maps each - SATA port to a combophy and a lane within that - combophy -- dma-coherent : Present if dma operations are coherent - Example: sata@ffe08000 { compatible = "calxeda,hb-ahci"; reg = <0xffe08000 0x1000>; interrupts = <115>; - calxeda,port-phys = <&combophy5 0 &combophy0 0 &combophy0 1 - &combophy0 2 &combophy0 3>; - }; diff --git a/trunk/Documentation/devicetree/bindings/ata/pata-arasan.txt b/trunk/Documentation/devicetree/bindings/ata/pata-arasan.txt deleted file mode 100644 index 95ec7f825ede..000000000000 --- a/trunk/Documentation/devicetree/bindings/ata/pata-arasan.txt +++ /dev/null @@ -1,17 +0,0 @@ -* ARASAN PATA COMPACT FLASH CONTROLLER - -Required properties: -- compatible: "arasan,cf-spear1340" -- reg: Address range of the CF registers -- interrupt-parent: Should be the phandle for the interrupt controller - that services interrupts for this device -- interrupt: Should contain the CF interrupt number - -Example: - - cf@fc000000 { - compatible = "arasan,cf-spear1340"; - reg = <0xfc000000 0x1000>; - interrupt-parent = <&vic1>; - interrupts = <12>; - }; diff --git a/trunk/Documentation/devicetree/bindings/cpufreq/cpufreq-cpu0.txt b/trunk/Documentation/devicetree/bindings/cpufreq/cpufreq-cpu0.txt deleted file mode 100644 index 4416ccc33472..000000000000 --- a/trunk/Documentation/devicetree/bindings/cpufreq/cpufreq-cpu0.txt +++ /dev/null @@ -1,55 +0,0 @@ -Generic CPU0 cpufreq driver - -It is a generic cpufreq driver for CPU0 frequency management. It -supports both uniprocessor (UP) and symmetric multiprocessor (SMP) -systems which share clock and voltage across all CPUs. - -Both required and optional properties listed below must be defined -under node /cpus/cpu@0. - -Required properties: -- operating-points: Refer to Documentation/devicetree/bindings/power/opp.txt - for details - -Optional properties: -- clock-latency: Specify the possible maximum transition latency for clock, - in unit of nanoseconds. -- voltage-tolerance: Specify the CPU voltage tolerance in percentage. - -Examples: - -cpus { - #address-cells = <1>; - #size-cells = <0>; - - cpu@0 { - compatible = "arm,cortex-a9"; - reg = <0>; - next-level-cache = <&L2>; - operating-points = < - /* kHz uV */ - 792000 1100000 - 396000 950000 - 198000 850000 - >; - transition-latency = <61036>; /* two CLK32 periods */ - }; - - cpu@1 { - compatible = "arm,cortex-a9"; - reg = <1>; - next-level-cache = <&L2>; - }; - - cpu@2 { - compatible = "arm,cortex-a9"; - reg = <2>; - next-level-cache = <&L2>; - }; - - cpu@3 { - compatible = "arm,cortex-a9"; - reg = <3>; - next-level-cache = <&L2>; - }; -}; diff --git a/trunk/Documentation/devicetree/bindings/crypto/fsl-sec4.txt b/trunk/Documentation/devicetree/bindings/crypto/fsl-sec4.txt index bd7ce120bc13..bf57ecd5d73a 100644 --- a/trunk/Documentation/devicetree/bindings/crypto/fsl-sec4.txt +++ b/trunk/Documentation/devicetree/bindings/crypto/fsl-sec4.txt @@ -9,7 +9,6 @@ Copyright (C) 2008-2011 Freescale Semiconductor Inc. -Run Time Integrity Check (RTIC) Node -Run Time Integrity Check (RTIC) Memory Node -Secure Non-Volatile Storage (SNVS) Node - -Secure Non-Volatile Storage (SNVS) Low Power (LP) RTC Node -Full Example NOTE: the SEC 4 is also known as Freescale's Cryptographic Accelerator @@ -295,27 +294,6 @@ Secure Non-Volatile Storage (SNVS) Node address and length of the SEC4 configuration registers. - - #address-cells - Usage: required - Value type: - Definition: A standard property. Defines the number of cells - for representing physical addresses in child nodes. Must - have a value of 1. - - - #size-cells - Usage: required - Value type: - Definition: A standard property. Defines the number of cells - for representing the size of physical addresses in - child nodes. Must have a value of 1. - - - ranges - Usage: required - Value type: - Definition: A standard property. Specifies the physical address - range of the SNVS register space. A triplet that includes - the child address, parent address, & length. - - interrupts Usage: required Value type: @@ -336,33 +314,10 @@ EXAMPLE sec_mon@314000 { compatible = "fsl,sec-v4.0-mon"; reg = <0x314000 0x1000>; - ranges = <0 0x314000 0x1000>; interrupt-parent = <&mpic>; interrupts = <93 2>; }; -===================================================================== -Secure Non-Volatile Storage (SNVS) Low Power (LP) RTC Node - - A SNVS child node that defines SNVS LP RTC. - - - compatible - Usage: required - Value type: - Definition: Must include "fsl,sec-v4.0-mon-rtc-lp". - - - reg - Usage: required - Value type: - Definition: A standard property. Specifies the physical - address and length of the SNVS LP configuration registers. - -EXAMPLE - sec_mon_rtc_lp@314000 { - compatible = "fsl,sec-v4.0-mon-rtc-lp"; - reg = <0x34 0x58>; - }; - ===================================================================== FULL EXAMPLE @@ -435,14 +390,8 @@ FULL EXAMPLE sec_mon: sec_mon@314000 { compatible = "fsl,sec-v4.0-mon"; reg = <0x314000 0x1000>; - ranges = <0 0x314000 0x1000>; interrupt-parent = <&mpic>; interrupts = <93 2>; - - sec_mon_rtc_lp@34 { - compatible = "fsl,sec-v4.0-mon-rtc-lp"; - reg = <0x34 0x58>; - }; }; ===================================================================== diff --git a/trunk/Documentation/devicetree/bindings/dma/arm-pl330.txt b/trunk/Documentation/devicetree/bindings/dma/arm-pl330.txt index 36e27d54260b..a4cd273b2a67 100644 --- a/trunk/Documentation/devicetree/bindings/dma/arm-pl330.txt +++ b/trunk/Documentation/devicetree/bindings/dma/arm-pl330.txt @@ -9,9 +9,6 @@ Required properties: region. - interrupts: interrupt number to the cpu. -Optional properties: -- dma-coherent : Present if dma operations are coherent - Example: pdma0: pdma@12680000 { diff --git a/trunk/Documentation/devicetree/bindings/interrupt-controller/interrupts.txt b/trunk/Documentation/devicetree/bindings/interrupt-controller/interrupts.txt deleted file mode 100644 index 72a06c0ab1db..000000000000 --- a/trunk/Documentation/devicetree/bindings/interrupt-controller/interrupts.txt +++ /dev/null @@ -1,95 +0,0 @@ -Specifying interrupt information for devices -============================================ - -1) Interrupt client nodes -------------------------- - -Nodes that describe devices which generate interrupts must contain an -"interrupts" property. This property must contain a list of interrupt -specifiers, one per output interrupt. The format of the interrupt specifier is -determined by the interrupt controller to which the interrupts are routed; see -section 2 below for details. - -The "interrupt-parent" property is used to specify the controller to which -interrupts are routed and contains a single phandle referring to the interrupt -controller node. This property is inherited, so it may be specified in an -interrupt client node or in any of its parent nodes. - -2) Interrupt controller nodes ------------------------------ - -A device is marked as an interrupt controller with the "interrupt-controller" -property. This is a empty, boolean property. An additional "#interrupt-cells" -property defines the number of cells needed to specify a single interrupt. - -It is the responsibility of the interrupt controller's binding to define the -length and format of the interrupt specifier. The following two variants are -commonly used: - - a) one cell - ----------- - The #interrupt-cells property is set to 1 and the single cell defines the - index of the interrupt within the controller. - - Example: - - vic: intc@10140000 { - compatible = "arm,versatile-vic"; - interrupt-controller; - #interrupt-cells = <1>; - reg = <0x10140000 0x1000>; - }; - - sic: intc@10003000 { - compatible = "arm,versatile-sic"; - interrupt-controller; - #interrupt-cells = <1>; - reg = <0x10003000 0x1000>; - interrupt-parent = <&vic>; - interrupts = <31>; /* Cascaded to vic */ - }; - - b) two cells - ------------ - The #interrupt-cells property is set to 2 and the first cell defines the - index of the interrupt within the controller, while the second cell is used - to specify any of the following flags: - - bits[3:0] trigger type and level flags - 1 = low-to-high edge triggered - 2 = high-to-low edge triggered - 4 = active high level-sensitive - 8 = active low level-sensitive - - Example: - - i2c@7000c000 { - gpioext: gpio-adnp@41 { - compatible = "ad,gpio-adnp"; - reg = <0x41>; - - interrupt-parent = <&gpio>; - interrupts = <160 1>; - - gpio-controller; - #gpio-cells = <1>; - - interrupt-controller; - #interrupt-cells = <2>; - - nr-gpios = <64>; - }; - - sx8634@2b { - compatible = "smtc,sx8634"; - reg = <0x2b>; - - interrupt-parent = <&gpioext>; - interrupts = <3 0x8>; - - #address-cells = <1>; - #size-cells = <0>; - - threshold = <0x40>; - sensitivity = <7>; - }; - }; diff --git a/trunk/Documentation/devicetree/bindings/mfd/88pm860x.txt b/trunk/Documentation/devicetree/bindings/mfd/88pm860x.txt deleted file mode 100644 index 63f3ee33759c..000000000000 --- a/trunk/Documentation/devicetree/bindings/mfd/88pm860x.txt +++ /dev/null @@ -1,85 +0,0 @@ -* Marvell 88PM860x Power Management IC - -Required parent device properties: -- compatible : "marvell,88pm860x" -- reg : the I2C slave address for the 88pm860x chip -- interrupts : IRQ line for the 88pm860x chip -- interrupt-controller: describes the 88pm860x as an interrupt controller (has its own domain) -- #interrupt-cells : should be 1. - - The cell is the 88pm860x local IRQ number - -Optional parent device properties: -- marvell,88pm860x-irq-read-clr: inicates whether interrupt status is cleared by read -- marvell,88pm860x-slave-addr: 88pm860x are two chips solution. stores the I2C address - of one chip, and this property stores the I2C address of - another chip. - -88pm860x consists of a large and varied group of sub-devices: - -Device Supply Names Description ------- ------------ ----------- -88pm860x-onkey : : On key -88pm860x-rtc : : RTC -88pm8607 : : Regulators -88pm860x-backlight : : Backlight -88pm860x-led : : Led -88pm860x-touch : : Touchscreen - -Example: - - pmic: 88pm860x@34 { - compatible = "marvell,88pm860x"; - reg = <0x34>; - interrupts = <4>; - interrupt-parent = <&intc>; - interrupt-controller; - #interrupt-cells = <1>; - - marvell,88pm860x-irq-read-clr; - marvell,88pm860x-slave-addr = <0x11>; - - regulators { - BUCK1 { - regulator-min-microvolt = <1000000>; - regulator-max-microvolt = <1500000>; - regulator-boot-on; - regulator-always-on; - }; - LDO1 { - regulator-min-microvolt = <1200000>; - regulator-max-microvolt = <2800000>; - regulator-boot-on; - regulator-always-on; - }; - }; - rtc { - marvell,88pm860x-vrtc = <1>; - }; - touch { - marvell,88pm860x-gpadc-prebias = <1>; - marvell,88pm860x-gpadc-slot-cycle = <1>; - marvell,88pm860x-tsi-prebias = <6>; - marvell,88pm860x-pen-prebias = <16>; - marvell,88pm860x-pen-prechg = <2>; - marvell,88pm860x-resistor-X = <300>; - }; - backlights { - backlight-0 { - marvell,88pm860x-iset = <4>; - marvell,88pm860x-pwm = <3>; - }; - backlight-2 { - }; - }; - leds { - led0-red { - marvell,88pm860x-iset = <12>; - }; - led0-green { - marvell,88pm860x-iset = <12>; - }; - led0-blue { - marvell,88pm860x-iset = <12>; - }; - }; - }; diff --git a/trunk/Documentation/devicetree/bindings/mfd/syscon.txt b/trunk/Documentation/devicetree/bindings/mfd/syscon.txt deleted file mode 100644 index fe8150bb3248..000000000000 --- a/trunk/Documentation/devicetree/bindings/mfd/syscon.txt +++ /dev/null @@ -1,20 +0,0 @@ -* System Controller Registers R/W driver - -System controller node represents a register region containing a set -of miscellaneous registers. The registers are not cohesive enough to -represent as any specific type of device. The typical use-case is for -some other node's driver, or platform-specific code, to acquire a -reference to the syscon node (e.g. by phandle, node path, or search -using a specific compatible value), interrogate the node (or associated -OS driver) to determine the location of the registers, and access the -registers directly. - -Required properties: -- compatible: Should contain "syscon". -- reg: the register region can be accessed from syscon - -Examples: -gpr: iomuxc-gpr@020e0000 { - compatible = "fsl,imx6q-iomuxc-gpr", "syscon"; - reg = <0x020e0000 0x38>; -}; diff --git a/trunk/Documentation/devicetree/bindings/mfd/tps65910.txt b/trunk/Documentation/devicetree/bindings/mfd/tps65910.txt index 2e3304888ffc..db03599ae4dc 100644 --- a/trunk/Documentation/devicetree/bindings/mfd/tps65910.txt +++ b/trunk/Documentation/devicetree/bindings/mfd/tps65910.txt @@ -59,8 +59,6 @@ Optional properties: in TPS6591X datasheet) - ti,en-gpio-sleep: enable sleep control for gpios There should be 9 entries here, one for each gpio. -- ti,system-power-controller: Telling whether or not this pmic is controlling - the system power. Regulator Optional properties: - ti,regulator-ext-sleep-control: enable external sleep @@ -81,8 +79,6 @@ Example: #interrupt-cells = <2>; interrupt-controller; - ti,system-power-controller; - ti,vmbch-threshold = 0; ti,vmbch2-threshold = 0; ti,en-ck32k-xtal; diff --git a/trunk/Documentation/devicetree/bindings/mfd/twl4030-audio.txt b/trunk/Documentation/devicetree/bindings/mfd/twl4030-audio.txt deleted file mode 100644 index 414d2ae0adf6..000000000000 --- a/trunk/Documentation/devicetree/bindings/mfd/twl4030-audio.txt +++ /dev/null @@ -1,46 +0,0 @@ -Texas Instruments TWL family (twl4030) audio module - -The audio module inside the TWL family consist of an audio codec and a vibra -driver. - -Required properties: -- compatible : must be "ti,twl4030-audio" - -Optional properties, nodes: - -Audio functionality: -- codec { }: Need to be present if the audio functionality is used. Within this - section the following options can be used: -- ti,digimic_delay: Delay need after enabling the digimic to reduce artifacts - from the start of the recorded sample (in ms) --ti,ramp_delay_value: HS ramp delay configuration to reduce pop noise --ti,hs_extmute: Use external mute for HS pop reduction --ti,hs_extmute_gpio: Use external GPIO to control the external mute --ti,offset_cncl_path: Offset cancellation path selection, refer to TRM for the - valid values. - -Vibra functionality -- ti,enable-vibra: Need to be set to <1> if the vibra functionality is used. if - missing or it is 0, the vibra functionality is disabled. - -Example: -&i2c1 { - clock-frequency = <2600000>; - - twl: twl@48 { - reg = <0x48>; - interrupts = <7>; /* SYS_NIRQ cascaded to intc */ - interrupt-parent = <&intc>; - - twl_audio: audio { - compatible = "ti,twl4030-audio"; - - ti,enable-vibra = <1>; - - codec { - ti,ramp_delay_value = <3>; - }; - - }; - }; -}; diff --git a/trunk/Documentation/devicetree/bindings/mfd/twl6040.txt b/trunk/Documentation/devicetree/bindings/mfd/twl6040.txt index 0f5dd709d752..c855240f3a0e 100644 --- a/trunk/Documentation/devicetree/bindings/mfd/twl6040.txt +++ b/trunk/Documentation/devicetree/bindings/mfd/twl6040.txt @@ -1,7 +1,7 @@ Texas Instruments TWL6040 family -The TWL6040s are 8-channel high quality low-power audio codecs providing audio, -vibra and GPO functionality on OMAP4+ platforms. +The TWL6040s are 8-channel high quality low-power audio codecs providing audio +and vibra functionality on OMAP4+ platforms. They are connected ot the host processor via i2c for commands, McPDM for audio data and commands. @@ -10,8 +10,6 @@ Required properties: - reg: must be 0x4b for i2c address - interrupts: twl6040 has one interrupt line connecteded to the main SoC - interrupt-parent: The parent interrupt controller -- gpio-controller: -- #gpio-cells = <1>: twl6040 provides GPO lines. - twl6040,audpwron-gpio: Power on GPIO line for the twl6040 - vio-supply: Regulator for the twl6040 VIO supply @@ -39,6 +37,7 @@ Example: &i2c1 { twl6040: twl@4b { compatible = "ti,twl6040"; + reg = <0x4b>; interrupts = <0 119 4>; interrupt-parent = <&gic>; @@ -61,5 +60,3 @@ Example: }; }; }; - -/include/ "twl6040.dtsi" diff --git a/trunk/Documentation/devicetree/bindings/net/calxeda-xgmac.txt b/trunk/Documentation/devicetree/bindings/net/calxeda-xgmac.txt index c8ae996bd8f2..411727a3f82d 100644 --- a/trunk/Documentation/devicetree/bindings/net/calxeda-xgmac.txt +++ b/trunk/Documentation/devicetree/bindings/net/calxeda-xgmac.txt @@ -6,9 +6,6 @@ Required properties: - interrupts : Should contain 3 xgmac interrupts. The 1st is main interrupt. The 2nd is pwr mgt interrupt. The 3rd is low power state interrupt. -Optional properties: -- dma-coherent : Present if dma operations are coherent - Example: ethernet@fff50000 { diff --git a/trunk/Documentation/devicetree/bindings/power/opp.txt b/trunk/Documentation/devicetree/bindings/power/opp.txt deleted file mode 100644 index 74499e5033fc..000000000000 --- a/trunk/Documentation/devicetree/bindings/power/opp.txt +++ /dev/null @@ -1,25 +0,0 @@ -* Generic OPP Interface - -SoCs have a standard set of tuples consisting of frequency and -voltage pairs that the device will support per voltage domain. These -are called Operating Performance Points or OPPs. - -Properties: -- operating-points: An array of 2-tuples items, and each item consists - of frequency and voltage like . - freq: clock frequency in kHz - vol: voltage in microvolt - -Examples: - -cpu@0 { - compatible = "arm,cortex-a9"; - reg = <0>; - next-level-cache = <&L2>; - operating-points = < - /* kHz uV */ - 792000 1100000 - 396000 950000 - 198000 850000 - >; -}; diff --git a/trunk/Documentation/devicetree/bindings/pwm/mxs-pwm.txt b/trunk/Documentation/devicetree/bindings/pwm/mxs-pwm.txt index 11963e4d6bc4..b16f4a57d111 100644 --- a/trunk/Documentation/devicetree/bindings/pwm/mxs-pwm.txt +++ b/trunk/Documentation/devicetree/bindings/pwm/mxs-pwm.txt @@ -11,7 +11,7 @@ Example: pwm: pwm@80064000 { compatible = "fsl,imx28-pwm", "fsl,imx23-pwm"; - reg = <0x80064000 0x2000>; + reg = <0x80064000 2000>; #pwm-cells = <2>; fsl,pwm-number = <8>; }; diff --git a/trunk/Documentation/devicetree/bindings/regulator/88pm860x.txt b/trunk/Documentation/devicetree/bindings/regulator/88pm860x.txt deleted file mode 100644 index 1267b3e1a2cc..000000000000 --- a/trunk/Documentation/devicetree/bindings/regulator/88pm860x.txt +++ /dev/null @@ -1,30 +0,0 @@ -Marvell 88PM860x regulator - -Required properties: -- compatible: "marvell,88pm860x" -- reg: I2C slave address -- regulators: A node that houses a sub-node for each regulator within the - device. Each sub-node is identified using the regulator-compatible - property, with valid values listed below. - -Example: - - pmic: 88pm860x@34 { - compatible = "marvell,88pm860x"; - reg = <0x34>; - - regulators { - BUCK1 { - regulator-min-microvolt = <1000000>; - regulator-max-microvolt = <1500000>; - regulator-boot-on; - regulator-always-on; - }; - BUCK3 { - regulator-min-microvolt = <1000000>; - regulator-max-microvolt = <3000000>; - regulator-boot-on; - regulator-always-on; - }; - }; - }; diff --git a/trunk/Documentation/devicetree/bindings/regulator/max8907.txt b/trunk/Documentation/devicetree/bindings/regulator/max8907.txt deleted file mode 100644 index 371eccd1cd68..000000000000 --- a/trunk/Documentation/devicetree/bindings/regulator/max8907.txt +++ /dev/null @@ -1,69 +0,0 @@ -MAX8907 regulator - -Required properties: -- compatible: "maxim,max8907" -- reg: I2C slave address -- interrupts: The interrupt output of the controller -- mbatt-supply: The input supply for MBATT, BBAT, SDBY, VRTC. -- in-v1-supply: The input supply for SD1. -- in-v2-supply: The input supply for SD2. -- in-v3-supply: The input supply for SD3. -- in1-supply: The input supply for LDO1. -... -- in20-supply: The input supply for LDO20. -- regulators: A node that houses a sub-node for each regulator within the - device. Each sub-node is identified using the node's name (or the deprecated - regulator-compatible property if present), with valid values listed below. - The content of each sub-node is defined by the standard binding for - regulators; see regulator.txt. - -Optional properties: -- maxim,system-power-controller: Boolean property indicating that the PMIC - controls the overall system power. - -The valid names for regulators are: - - sd1, sd2, sd3, ldo1, ldo2, ldo3, ldo4, ldo5, ldo6, ldo7, ldo8, ldo9, ldo10, - ldo11, ldo12, ldo13, ldo14, ldo15, ldo16, ldo17, ldo18, ldo19, ldo20, out5v, - out33v, bbat, sdby, vrtc. - -Example: - - max8907@3c { - compatible = "maxim,max8907"; - reg = <0x3c>; - interrupts = <0 86 0x4>; - - maxim,system-power-controller; - - mbatt-supply = <&some_reg>; - in-v1-supply = <&mbatt_reg>; - ... - in1-supply = <&mbatt_reg>; - ... - - regulators { - mbatt_reg: mbatt { - regulator-name = "vbat_pmu"; - regulator-min-microvolt = <5000000>; - regulator-max-microvolt = <5000000>; - regulator-always-on; - }; - - sd1 { - regulator-name = "nvvdd_sv1,vdd_cpu_pmu"; - regulator-min-microvolt = <1000000>; - regulator-max-microvolt = <1000000>; - regulator-always-on; - }; - - sd2 { - regulator-name = "nvvdd_sv2,vdd_core"; - regulator-min-microvolt = <1200000>; - regulator-max-microvolt = <1200000>; - regulator-always-on; - }; -... - }; - }; - }; diff --git a/trunk/Documentation/devicetree/bindings/regulator/tps6586x.txt b/trunk/Documentation/devicetree/bindings/regulator/tps6586x.txt index 8b40cac24d93..07b9ef6e49d5 100644 --- a/trunk/Documentation/devicetree/bindings/regulator/tps6586x.txt +++ b/trunk/Documentation/devicetree/bindings/regulator/tps6586x.txt @@ -22,10 +22,6 @@ Required properties: - vinldo678-supply: The input supply for the LDO6, LDO7 and LDO8 - vinldo9-supply: The input supply for the LDO9 -Optional properties: -- ti,system-power-controller: Telling whether or not this pmic is controlling - the system power. - Each regulator is defined using the standard binding for regulators. Note: LDO5 and LDO_RTC is supplied by SYS regulator internally and driver @@ -41,8 +37,6 @@ Example: #gpio-cells = <2>; gpio-controller; - ti,system-power-controller; - sys-supply = <&some_reg>; vin-sm0-supply = <&some_reg>; vin-sm1-supply = <&some_reg>; diff --git a/trunk/Documentation/devicetree/bindings/rtc/snvs-rtc.txt b/trunk/Documentation/devicetree/bindings/rtc/snvs-rtc.txt deleted file mode 100644 index fb61ed77ada3..000000000000 --- a/trunk/Documentation/devicetree/bindings/rtc/snvs-rtc.txt +++ /dev/null @@ -1 +0,0 @@ -See Documentation/devicetree/bindings/crypto/fsl-sec4.txt for details. diff --git a/trunk/Documentation/devicetree/bindings/serial/fsl-imx-uart.txt b/trunk/Documentation/devicetree/bindings/serial/fsl-imx-uart.txt deleted file mode 100644 index c58573b5b1a4..000000000000 --- a/trunk/Documentation/devicetree/bindings/serial/fsl-imx-uart.txt +++ /dev/null @@ -1,35 +0,0 @@ -* Freescale i.MX UART controller - -Required properties: -- compatible : should be "fsl,imx21-uart" -- reg : Address and length of the register set for the device -- interrupts : Should contain UART interrupt number - -Optional properties: -- fsl,uart-has-rtscts: indicate that RTS/CTS signals are used - -Note: Each uart controller should have an alias correctly numbered -in "aliases" node. - -Example: - -- From imx51.dtsi: -aliases { - serial0 = &uart1; - serial1 = &uart2; - serial2 = &uart3; -}; - -uart1: serial@73fbc000 { - compatible = "fsl,imx51-uart", "fsl,imx21-uart"; - reg = <0x73fbc000 0x4000>; - interrupts = <31>; - status = "disabled"; -} - -- From imx51-babbage.dts: -uart1: serial@73fbc000 { - fsl,uart-has-rtscts; - status = "okay"; -}; - diff --git a/trunk/Documentation/devicetree/bindings/video/backlight/88pm860x.txt b/trunk/Documentation/devicetree/bindings/video/backlight/88pm860x.txt deleted file mode 100644 index 261df2799315..000000000000 --- a/trunk/Documentation/devicetree/bindings/video/backlight/88pm860x.txt +++ /dev/null @@ -1,15 +0,0 @@ -88pm860x-backlight bindings - -Optional properties: - - marvell,88pm860x-iset: Current supplies on backlight device. - - marvell,88pm860x-pwm: PWM frequency on backlight device. - -Example: - - backlights { - backlight-0 { - marvell,88pm860x-iset = <4>; - marvell,88pm860x-pwm = <3>; - }; - backlight-2 { - }; diff --git a/trunk/Documentation/filesystems/jfs.txt b/trunk/Documentation/filesystems/jfs.txt index f7433355394a..26ebde77e821 100644 --- a/trunk/Documentation/filesystems/jfs.txt +++ b/trunk/Documentation/filesystems/jfs.txt @@ -3,7 +3,6 @@ IBM's Journaled File System (JFS) for Linux JFS Homepage: http://jfs.sourceforge.net/ The following mount options are supported: -(*) == default iocharset=name Character set to use for converting from Unicode to ASCII. The default is to do no conversion. Use @@ -22,12 +21,12 @@ nointegrity Do not write to the journal. The primary use of this option from backup media. The integrity of the volume is not guaranteed if the system abnormally abends. -integrity(*) Commit metadata changes to the journal. Use this option to - remount a volume where the nointegrity option was +integrity Default. Commit metadata changes to the journal. Use this + option to remount a volume where the nointegrity option was previously specified in order to restore normal behavior. errors=continue Keep going on a filesystem error. -errors=remount-ro(*) Remount the filesystem read-only on an error. +errors=remount-ro Default. Remount the filesystem read-only on an error. errors=panic Panic and halt the machine if an error occurs. uid=value Override on-disk uid with specified value @@ -36,17 +35,7 @@ umask=value Override on-disk umask with specified octal value. For directories, the execute bit will be set if the corresponding read bit is set. -discard=minlen This enables/disables the use of discard/TRIM commands. -discard The discard/TRIM commands are sent to the underlying -nodiscard(*) block device when blocks are freed. This is useful for SSD - devices and sparse/thinly-provisioned LUNs. The FITRIM ioctl - command is also available together with the nodiscard option. - The value of minlen specifies the minimum blockcount, when - a TRIM command to the block device is considered usefull. - When no value is given to the discard option, it defaults to - 64 blocks, which means 256KiB in JFS. - The minlen value of discard overrides the minlen value given - on an FITRIM ioctl(). +Please send bugs, comments, cards and letters to shaggy@linux.vnet.ibm.com. The JFS mailing list can be subscribed to by using the link labeled "Mail list Subscribe" at our web page http://jfs.sourceforge.net/ diff --git a/trunk/Documentation/kbuild/makefiles.txt b/trunk/Documentation/kbuild/makefiles.txt index ec9ae6708691..ab0a984530d8 100644 --- a/trunk/Documentation/kbuild/makefiles.txt +++ b/trunk/Documentation/kbuild/makefiles.txt @@ -45,7 +45,7 @@ This document describes the Linux kernel Makefiles. === 7 Kbuild syntax for exported headers --- 7.1 header-y - --- 7.2 genhdr-y + --- 7.2 objhdr-y --- 7.3 destination-y --- 7.4 generic-y @@ -1282,15 +1282,15 @@ See subsequent chapter for the syntax of the Kbuild file. Subdirectories are visited before their parent directories. - --- 7.2 genhdr-y + --- 7.2 objhdr-y - genhdr-y specifies generated files to be exported. + objhdr-y specifies generated files to be exported. Generated files are special as they need to be looked up in another directory when doing 'make O=...' builds. Example: #include/linux/Kbuild - genhdr-y += version.h + objhdr-y += version.h --- 7.3 destination-y diff --git a/trunk/Documentation/kernel-parameters.txt b/trunk/Documentation/kernel-parameters.txt index f777fa96243d..df43807bb5da 100644 --- a/trunk/Documentation/kernel-parameters.txt +++ b/trunk/Documentation/kernel-parameters.txt @@ -1051,14 +1051,6 @@ bytes respectively. Such letter suffixes can also be entirely omitted. ihash_entries= [KNL] Set number of hash buckets for inode cache. - ima_appraise= [IMA] appraise integrity measurements - Format: { "off" | "enforce" | "fix" } - default: "enforce" - - ima_appraise_tcb [IMA] - The builtin appraise policy appraises all files - owned by uid=0. - ima_audit= [IMA] Format: { "0" | "1" } 0 -- integrity auditing messages. (Default) @@ -1358,9 +1350,6 @@ bytes respectively. Such letter suffixes can also be entirely omitted. * nohrst, nosrst, norst: suppress hard, soft and both resets. - * rstonce: only attempt one reset during - hot-unplug link recovery - * dump_id: dump IDENTIFY data. If there are multiple matching configurations changing diff --git a/trunk/Documentation/printk-formats.txt b/trunk/Documentation/printk-formats.txt index 8ffb274367c7..7561d7ed8e11 100644 --- a/trunk/Documentation/printk-formats.txt +++ b/trunk/Documentation/printk-formats.txt @@ -69,7 +69,6 @@ MAC/FDDI addresses: %pMR 05:04:03:02:01:00 %pMF 00-01-02-03-04-05 %pm 000102030405 - %pmR 050403020100 For printing 6-byte MAC/FDDI addresses in hex notation. The 'M' and 'm' specifiers result in a printed address with ('M') or without ('m') byte diff --git a/trunk/Documentation/remoteproc.txt b/trunk/Documentation/remoteproc.txt index e6469fdcf89a..23a09b884bc7 100644 --- a/trunk/Documentation/remoteproc.txt +++ b/trunk/Documentation/remoteproc.txt @@ -129,13 +129,6 @@ int dummy_rproc_example(struct rproc *my_rproc) Returns 0 on success and -EINVAL if @rproc isn't valid. - void rproc_report_crash(struct rproc *rproc, enum rproc_crash_type type) - - Report a crash in a remoteproc - This function must be called every time a crash is detected by the - platform specific rproc implementation. This should not be called from a - non-remoteproc driver. This function can be called from atomic/interrupt - context. - 5. Implementation callbacks These callbacks should be provided by platform-specific remoteproc diff --git a/trunk/Documentation/rtc.txt b/trunk/Documentation/rtc.txt index 32aa4002de4a..250160469d83 100644 --- a/trunk/Documentation/rtc.txt +++ b/trunk/Documentation/rtc.txt @@ -119,9 +119,8 @@ three different userspace interfaces: * /sys/class/rtc/rtcN ... sysfs attributes support readonly access to some RTC attributes. - * /proc/driver/rtc ... the system clock RTC may expose itself - using a procfs interface. If there is no RTC for the system clock, - rtc0 is used by default. More information is (currently) shown + * /proc/driver/rtc ... the first RTC (rtc0) may expose itself + using a procfs interface. More information is (currently) shown here than through sysfs. The RTC Class framework supports a wide variety of RTCs, ranging from those diff --git a/trunk/Documentation/scsi/ChangeLog.megaraid_sas b/trunk/Documentation/scsi/ChangeLog.megaraid_sas index 3a3079411a3d..80441ab608e4 100644 --- a/trunk/Documentation/scsi/ChangeLog.megaraid_sas +++ b/trunk/Documentation/scsi/ChangeLog.megaraid_sas @@ -1,13 +1,3 @@ -Release Date : Tue. Jun 17, 2012 17:00:00 PST 2012 - - (emaild-id:megaraidlinux@lsi.com) - Adam Radford/Kashyap Desai -Current Version : 00.00.06.18-rc1 -Old Version : 00.00.06.15-rc1 - 1. Fix Copyright dates. - 2. Add throttlequeuedepth module parameter. - 3. Add resetwaittime module parameter. - 4. Move poll_aen_lock initializer. -------------------------------------------------------------------------------- Release Date : Mon. Mar 19, 2012 17:00:00 PST 2012 - (emaild-id:megaraidlinux@lsi.com) Adam Radford diff --git a/trunk/Documentation/scsi/LICENSE.qla2xxx b/trunk/Documentation/scsi/LICENSE.qla2xxx index 27a91cf43d6d..ce0fdf349a81 100644 --- a/trunk/Documentation/scsi/LICENSE.qla2xxx +++ b/trunk/Documentation/scsi/LICENSE.qla2xxx @@ -1,4 +1,4 @@ -Copyright (c) 2003-2012 QLogic Corporation +Copyright (c) 2003-2011 QLogic Corporation QLogic Linux FC-FCoE Driver This program includes a device driver for Linux 3.x. diff --git a/trunk/Documentation/scsi/LICENSE.qla4xxx b/trunk/Documentation/scsi/LICENSE.qla4xxx index 78c169f0d7c6..ab899591ecb7 100644 --- a/trunk/Documentation/scsi/LICENSE.qla4xxx +++ b/trunk/Documentation/scsi/LICENSE.qla4xxx @@ -1,4 +1,4 @@ -Copyright (c) 2003-2012 QLogic Corporation +Copyright (c) 2003-2011 QLogic Corporation QLogic Linux iSCSI Driver This program includes a device driver for Linux 3.x. diff --git a/trunk/Documentation/scsi/st.txt b/trunk/Documentation/scsi/st.txt index f346abbdd6ff..685bf3582abe 100644 --- a/trunk/Documentation/scsi/st.txt +++ b/trunk/Documentation/scsi/st.txt @@ -112,8 +112,10 @@ attempted). MINOR NUMBERS -The tape driver currently supports up to 2^17 drives if 4 modes for -each drive are used. +The tape driver currently supports 128 drives by default. This number +can be increased by editing st.h and recompiling the driver if +necessary. The upper limit is 2^17 drives if 4 modes for each drive +are used. The minor numbers consist of the following bit fields: diff --git a/trunk/Documentation/security/Smack.txt b/trunk/Documentation/security/Smack.txt index 8a177e4b6e21..a416479b8a1c 100644 --- a/trunk/Documentation/security/Smack.txt +++ b/trunk/Documentation/security/Smack.txt @@ -28,11 +28,12 @@ Smack kernels use the CIPSO IP option. Some network configurations are intolerant of IP options and can impede access to systems that use them as Smack does. -The current git repository for Smack user space is: +The current git repositories for Smack user space are: - git://github.com/smack-team/smack.git + git@gitorious.org:meego-platform-security/smackutil.git + git@gitorious.org:meego-platform-security/libsmack.git -This should make and install on most modern distributions. +These should make and install on most modern distributions. There are three commands included in smackutil: smackload - properly formats data for writing to /smack/load @@ -193,9 +194,6 @@ onlycap these capabilities are effective at for processes with any label. The value is set by writing the desired label to the file or cleared by writing "-" to the file. -revoke-subject - Writing a Smack label here sets the access to '-' for all access - rules with that subject label. You can add access rules in /etc/smack/accesses. They take the form: diff --git a/trunk/Documentation/smsc_ece1099.txt b/trunk/Documentation/smsc_ece1099.txt deleted file mode 100644 index 6b492e82b43d..000000000000 --- a/trunk/Documentation/smsc_ece1099.txt +++ /dev/null @@ -1,56 +0,0 @@ -What is smsc-ece1099? ----------------------- - -The ECE1099 is a 40-Pin 3.3V Keyboard Scan Expansion -or GPIO Expansion device. The device supports a keyboard -scan matrix of 23x8. The device is connected to a Master -via the SMSC BC-Link interface or via the SMBus. -Keypad scan Input(KSI) and Keypad Scan Output(KSO) signals -are multiplexed with GPIOs. - -Interrupt generation --------------------- - -Interrupts can be generated by an edge detection on a GPIO -pin or an edge detection on one of the bus interface pins. -Interrupts can also be detected on the keyboard scan interface. -The bus interrupt pin (BC_INT# or SMBUS_INT#) is asserted if -any bit in one of the Interrupt Status registers is 1 and -the corresponding Interrupt Mask bit is also 1. - -In order for software to determine which device is the source -of an interrupt, it should first read the Group Interrupt Status Register -to determine which Status register group is a source for the interrupt. -Software should read both the Status register and the associated Mask register, -then AND the two values together. Bits that are 1 in the result of the AND -are active interrupts. Software clears an interrupt by writing a 1 to the -corresponding bit in the Status register. - -Communication Protocol ----------------------- - -- SMbus slave Interface - The host processor communicates with the ECE1099 device - through a series of read/write registers via the SMBus - interface. SMBus is a serial communication protocol between - a computer host and its peripheral devices. The SMBus data - rate is 10KHz minimum to 400 KHz maximum - -- Slave Bus Interface - The ECE1099 device SMBus implementation is a subset of the - SMBus interface to the host. The device is a slave-only SMBus device. - The implementation in the device is a subset of SMBus since it - only supports four protocols. - - The Write Byte, Read Byte, Send Byte, and Receive Byte protocols are the - only valid SMBus protocols for the device. - -- BC-LinkTM Interface - The BC-Link is a proprietary bus that allows communication - between a Master device and a Companion device. The Master - device uses this serial bus to read and write registers - located on the Companion device. The bus comprises three signals, - BC_CLK, BC_DAT and BC_INT#. The Master device always provides the - clock, BC_CLK, and the Companion device is the source for an - independent asynchronous interrupt signal, BC_INT#. The ECE1099 - supports BC-Link speeds up to 24MHz. diff --git a/trunk/Documentation/sysctl/kernel.txt b/trunk/Documentation/sysctl/kernel.txt index 2907ba6c3607..6d78841fd416 100644 --- a/trunk/Documentation/sysctl/kernel.txt +++ b/trunk/Documentation/sysctl/kernel.txt @@ -181,8 +181,6 @@ core_pattern is used to specify a core dumpfile pattern name. %p pid %u uid %g gid - %d dump mode, matches PR_SET_DUMPABLE and - /proc/sys/fs/suid_dumpable %s signal number %t UNIX time of dump %h hostname diff --git a/trunk/Documentation/virtual/kvm/api.txt b/trunk/Documentation/virtual/kvm/api.txt index f6ec3a92e621..bf33aaa4c59f 100644 --- a/trunk/Documentation/virtual/kvm/api.txt +++ b/trunk/Documentation/virtual/kvm/api.txt @@ -857,8 +857,7 @@ struct kvm_userspace_memory_region { }; /* for kvm_memory_region::flags */ -#define KVM_MEM_LOG_DIRTY_PAGES (1UL << 0) -#define KVM_MEM_READONLY (1UL << 1) +#define KVM_MEM_LOG_DIRTY_PAGES 1UL This ioctl allows the user to create or modify a guest physical memory slot. When changing an existing slot, it may be moved in the guest @@ -874,17 +873,14 @@ It is recommended that the lower 21 bits of guest_phys_addr and userspace_addr be identical. This allows large pages in the guest to be backed by large pages in the host. -The flags field supports two flag, KVM_MEM_LOG_DIRTY_PAGES, which instructs -kvm to keep track of writes to memory within the slot. See KVM_GET_DIRTY_LOG -ioctl. The KVM_CAP_READONLY_MEM capability indicates the availability of the -KVM_MEM_READONLY flag. When this flag is set for a memory region, KVM only -allows read accesses. Writes will be posted to userspace as KVM_EXIT_MMIO -exits. +The flags field supports just one flag, KVM_MEM_LOG_DIRTY_PAGES, which +instructs kvm to keep track of writes to memory within the slot. See +the KVM_GET_DIRTY_LOG ioctl. -When the KVM_CAP_SYNC_MMU capability is available, changes in the backing of -the memory region are automatically reflected into the guest. For example, an -mmap() that affects the region will be made visible immediately. Another -example is madvise(MADV_DROP). +When the KVM_CAP_SYNC_MMU capability, changes in the backing of the memory +region are automatically reflected into the guest. For example, an mmap() +that affects the region will be made visible immediately. Another example +is madvise(MADV_DROP). It is recommended to use this API instead of the KVM_SET_MEMORY_REGION ioctl. The KVM_SET_MEMORY_REGION does not allow fine grained control over memory @@ -1950,19 +1946,6 @@ the guest using the specified gsi pin. The irqfd is removed using the KVM_IRQFD_FLAG_DEASSIGN flag, specifying both kvm_irqfd.fd and kvm_irqfd.gsi. -With KVM_CAP_IRQFD_RESAMPLE, KVM_IRQFD supports a de-assert and notify -mechanism allowing emulation of level-triggered, irqfd-based -interrupts. When KVM_IRQFD_FLAG_RESAMPLE is set the user must pass an -additional eventfd in the kvm_irqfd.resamplefd field. When operating -in resample mode, posting of an interrupt through kvm_irq.fd asserts -the specified gsi in the irqchip. When the irqchip is resampled, such -as from an EOI, the gsi is de-asserted and the user is notifed via -kvm_irqfd.resamplefd. It is the user's responsibility to re-queue -the interrupt if the device making use of it still requires service. -Note that closing the resamplefd is not sufficient to disable the -irqfd. The KVM_IRQFD_FLAG_RESAMPLE is only necessary on assignment -and need not be specified with KVM_IRQFD_FLAG_DEASSIGN. - 4.76 KVM_PPC_ALLOCATE_HTAB Capability: KVM_CAP_PPC_ALLOC_HTAB diff --git a/trunk/Documentation/virtual/kvm/hypercalls.txt b/trunk/Documentation/virtual/kvm/hypercalls.txt deleted file mode 100644 index ea113b5d87a4..000000000000 --- a/trunk/Documentation/virtual/kvm/hypercalls.txt +++ /dev/null @@ -1,66 +0,0 @@ -Linux KVM Hypercall: -=================== -X86: - KVM Hypercalls have a three-byte sequence of either the vmcall or the vmmcall - instruction. The hypervisor can replace it with instructions that are - guaranteed to be supported. - - Up to four arguments may be passed in rbx, rcx, rdx, and rsi respectively. - The hypercall number should be placed in rax and the return value will be - placed in rax. No other registers will be clobbered unless explicitly stated - by the particular hypercall. - -S390: - R2-R7 are used for parameters 1-6. In addition, R1 is used for hypercall - number. The return value is written to R2. - - S390 uses diagnose instruction as hypercall (0x500) along with hypercall - number in R1. - - PowerPC: - It uses R3-R10 and hypercall number in R11. R4-R11 are used as output registers. - Return value is placed in R3. - - KVM hypercalls uses 4 byte opcode, that are patched with 'hypercall-instructions' - property inside the device tree's /hypervisor node. - For more information refer to Documentation/virtual/kvm/ppc-pv.txt - -KVM Hypercalls Documentation -=========================== -The template for each hypercall is: -1. Hypercall name. -2. Architecture(s) -3. Status (deprecated, obsolete, active) -4. Purpose - -1. KVM_HC_VAPIC_POLL_IRQ ------------------------- -Architecture: x86 -Status: active -Purpose: Trigger guest exit so that the host can check for pending -interrupts on reentry. - -2. KVM_HC_MMU_OP ------------------------- -Architecture: x86 -Status: deprecated. -Purpose: Support MMU operations such as writing to PTE, -flushing TLB, release PT. - -3. KVM_HC_FEATURES ------------------------- -Architecture: PPC -Status: active -Purpose: Expose hypercall availability to the guest. On x86 platforms, cpuid -used to enumerate which hypercalls are available. On PPC, either device tree -based lookup ( which is also what EPAPR dictates) OR KVM specific enumeration -mechanism (which is this hypercall) can be used. - -4. KVM_HC_PPC_MAP_MAGIC_PAGE ------------------------- -Architecture: PPC -Status: active -Purpose: To enable communication between the hypervisor and guest there is a -shared page that contains parts of supervisor visible register state. -The guest can map this shared page to access its supervisor register through -memory using this hypercall. diff --git a/trunk/Documentation/virtual/kvm/msr.txt b/trunk/Documentation/virtual/kvm/msr.txt index 6d470ae7b073..730471048583 100644 --- a/trunk/Documentation/virtual/kvm/msr.txt +++ b/trunk/Documentation/virtual/kvm/msr.txt @@ -34,12 +34,9 @@ MSR_KVM_WALL_CLOCK_NEW: 0x4b564d00 time information and check that they are both equal and even. An odd version indicates an in-progress update. - sec: number of seconds for wallclock at time of boot. + sec: number of seconds for wallclock. - nsec: number of nanoseconds for wallclock at time of boot. - - In order to get the current wallclock time, the system_time from - MSR_KVM_SYSTEM_TIME_NEW needs to be added. + nsec: number of nanoseconds for wallclock. Note that although MSRs are per-CPU entities, the effect of this particular MSR is global. @@ -85,25 +82,20 @@ MSR_KVM_SYSTEM_TIME_NEW: 0x4b564d01 time at the time this structure was last updated. Unit is nanoseconds. - tsc_to_system_mul: multiplier to be used when converting - tsc-related quantity to nanoseconds + tsc_to_system_mul: a function of the tsc frequency. One has + to multiply any tsc-related quantity by this value to get + a value in nanoseconds, besides dividing by 2^tsc_shift - tsc_shift: shift to be used when converting tsc-related - quantity to nanoseconds. This shift will ensure that - multiplication with tsc_to_system_mul does not overflow. - A positive value denotes a left shift, a negative value - a right shift. + tsc_shift: cycle to nanosecond divider, as a power of two, to + allow for shift rights. One has to shift right any tsc-related + quantity by this value to get a value in nanoseconds, besides + multiplying by tsc_to_system_mul. - The conversion from tsc to nanoseconds involves an additional - right shift by 32 bits. With this information, guests can - derive per-CPU time by doing: + With this information, guests can derive per-CPU time by + doing: time = (current_tsc - tsc_timestamp) - if (tsc_shift >= 0) - time <<= tsc_shift; - else - time >>= -tsc_shift; - time = (time * tsc_to_system_mul) >> 32 + time = (time * tsc_to_system_mul) >> tsc_shift time = time + system_time flags: bits in this field indicate extended capabilities diff --git a/trunk/Documentation/virtual/kvm/ppc-pv.txt b/trunk/Documentation/virtual/kvm/ppc-pv.txt index 4cd076febb02..4911cf95c67e 100644 --- a/trunk/Documentation/virtual/kvm/ppc-pv.txt +++ b/trunk/Documentation/virtual/kvm/ppc-pv.txt @@ -174,25 +174,3 @@ following: That way we can inject an arbitrary amount of code as replacement for a single instruction. This allows us to check for pending interrupts when setting EE=1 for example. - -Hypercall ABIs in KVM on PowerPC -================================= -1) KVM hypercalls (ePAPR) - -These are ePAPR compliant hypercall implementation (mentioned above). Even -generic hypercalls are implemented here, like the ePAPR idle hcall. These are -available on all targets. - -2) PAPR hypercalls - -PAPR hypercalls are needed to run server PowerPC PAPR guests (-M pseries in QEMU). -These are the same hypercalls that pHyp, the POWER hypervisor implements. Some of -them are handled in the kernel, some are handled in user space. This is only -available on book3s_64. - -3) OSI hypercalls - -Mac-on-Linux is another user of KVM on PowerPC, which has its own hypercall (long -before KVM). This is supported to maintain compatibility. All these hypercalls get -forwarded to user space. This is only useful on book3s_32, but can be used with -book3s_64 as well. diff --git a/trunk/MAINTAINERS b/trunk/MAINTAINERS index 0976bd1381b5..78336396a432 100644 --- a/trunk/MAINTAINERS +++ b/trunk/MAINTAINERS @@ -572,7 +572,7 @@ F: drivers/net/appletalk/ F: net/appletalk/ ARASAN COMPACT FLASH PATA CONTROLLER -M: Viresh Kumar +M: Viresh Kumar L: linux-ide@vger.kernel.org S: Maintained F: include/linux/pata_arasan_cf_data.h @@ -760,7 +760,6 @@ S: Maintained T: git git://git.pengutronix.de/git/imx/linux-2.6.git F: arch/arm/mach-imx/ F: arch/arm/plat-mxc/ -F: arch/arm/configs/imx*_defconfig ARM/FREESCALE IMX6 M: Shawn Guo @@ -1246,7 +1245,7 @@ F: include/linux/i2c/at24.h ATA OVER ETHERNET (AOE) DRIVER M: "Ed L. Cashin" -W: http://support.coraid.com/support/linux +W: http://www.coraid.com/support/linux S: Supported F: Documentation/aoe/ F: drivers/block/aoe/ @@ -1651,6 +1650,7 @@ F: drivers/bcma/ F: include/linux/bcma/ BROCADE BFA FC SCSI DRIVER +M: Jing Huang M: Krishna C Gudipati L: linux-scsi@vger.kernel.org S: Supported @@ -2632,18 +2632,6 @@ T: git git://git.alsa-project.org/alsa-kernel.git S: Maintained F: sound/usb/misc/ua101.c -EXTENSIBLE FIRMWARE INTERFACE (EFI) -M: Matt Fleming -L: linux-efi@vger.kernel.org -S: Maintained -F: Documentation/x86/efi-stub.txt -F: arch/ia64/kernel/efi.c -F: arch/x86/boot/compressed/eboot.[ch] -F: arch/x86/include/asm/efi.h -F: arch/x86/platform/efi/* -F: drivers/firmware/efivars.c -F: include/linux/efi*.h - EFIFB FRAMEBUFFER DRIVER L: linux-fbdev@vger.kernel.org M: Peter Jones @@ -3124,7 +3112,6 @@ T: git git://git.secretlab.ca/git/linux-2.6.git F: Documentation/gpio.txt F: drivers/gpio/ F: include/linux/gpio* -F: include/asm-generic/gpio.h GRE DEMULTIPLEXER DRIVER M: Dmitry Kozlov @@ -3440,18 +3427,6 @@ T: git git://git.kernel.org/pub/scm/linux/kernel/git/aegl/linux.git S: Maintained F: arch/ia64/ -IBM Power in-Nest Crypto Acceleration -M: Kent Yoder -L: linux-crypto@vger.kernel.org -S: Supported -F: drivers/crypto/nx/ - -IBM Power 842 compression accelerator -M: Robert Jennings -S: Supported -F: drivers/crypto/nx/nx-842.c -F: include/linux/nx842.h - IBM Power Linux RAID adapter M: Brian King S: Supported @@ -3463,13 +3438,6 @@ L: netdev@vger.kernel.org S: Supported F: drivers/net/ethernet/ibm/ibmveth.* -IBM Power Virtual SCSI/FC Device Drivers -M: Robert Jennings -L: linux-scsi@vger.kernel.org -S: Supported -F: drivers/scsi/ibmvscsi/ -X: drivers/scsi/ibmvscsi/ibmvstgt.c - IBM ServeRAID RAID DRIVER P: Jack Hammer M: Dave Jeffery @@ -5081,7 +5049,6 @@ S: Maintained F: Documentation/devicetree F: drivers/of F: include/linux/of*.h -F: scripts/dtc K: of_get_property K: of_match_table @@ -5267,7 +5234,7 @@ F: include/linux/i2c-algo-pca.h F: include/linux/i2c-pca-platform.h PCDP - PRIMARY CONSOLE AND DEBUG PORT -M: Khalid Aziz +M: Khalid Aziz S: Maintained F: drivers/firmware/pcdp.* @@ -5556,7 +5523,7 @@ S: Maintained W: http://linuxptp.sourceforge.net/ F: Documentation/ABI/testing/sysfs-ptp F: Documentation/ptp/* -F: drivers/net/ethernet/freescale/gianfar_ptp.c +F: drivers/net/gianfar_ptp.c F: drivers/net/phy/dp83640* F: drivers/ptp/* F: include/linux/ptp_cl* @@ -5988,7 +5955,7 @@ S: Maintained F: drivers/tty/serial SYNOPSYS DESIGNWARE DMAC DRIVER -M: Viresh Kumar +M: Viresh Kumar S: Maintained F: include/linux/dw_dmac.h F: drivers/dma/dw_dmac_regs.h @@ -6136,7 +6103,7 @@ S: Maintained F: drivers/mmc/host/sdhci-s3c.c SECURE DIGITAL HOST CONTROLLER INTERFACE (SDHCI) ST SPEAR DRIVER -M: Viresh Kumar +M: Viresh Kumar L: spear-devel@list.st.com L: linux-mmc@vger.kernel.org S: Maintained @@ -6501,7 +6468,7 @@ S: Maintained F: include/linux/compiler.h SPEAR PLATFORM SUPPORT -M: Viresh Kumar +M: Viresh Kumar M: Shiraz Hashim L: spear-devel@list.st.com L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) @@ -6510,7 +6477,7 @@ S: Maintained F: arch/arm/plat-spear/ SPEAR13XX MACHINE SUPPORT -M: Viresh Kumar +M: Viresh Kumar M: Shiraz Hashim L: spear-devel@list.st.com L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) @@ -6519,7 +6486,7 @@ S: Maintained F: arch/arm/mach-spear13xx/ SPEAR3XX MACHINE SUPPORT -M: Viresh Kumar +M: Viresh Kumar M: Shiraz Hashim L: spear-devel@list.st.com L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) @@ -6530,7 +6497,7 @@ F: arch/arm/mach-spear3xx/ SPEAR6XX MACHINE SUPPORT M: Rajeev Kumar M: Shiraz Hashim -M: Viresh Kumar +M: Viresh Kumar L: spear-devel@list.st.com L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) W: http://www.st.com/spear @@ -6538,7 +6505,7 @@ S: Maintained F: arch/arm/mach-spear6xx/ SPEAR CLOCK FRAMEWORK SUPPORT -M: Viresh Kumar +M: Viresh Kumar L: spear-devel@list.st.com L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) W: http://www.st.com/spear diff --git a/trunk/Makefile b/trunk/Makefile index 86eb6acb3978..846dd7607854 100644 --- a/trunk/Makefile +++ b/trunk/Makefile @@ -350,22 +350,12 @@ AFLAGS_KERNEL = CFLAGS_GCOV = -fprofile-arcs -ftest-coverage -# Use USERINCLUDE when you must reference the UAPI directories only. -USERINCLUDE := \ - -I$(srctree)/arch/$(hdr-arch)/include/uapi \ - -Iarch/$(hdr-arch)/include/generated/uapi \ - -I$(srctree)/include/uapi \ - -Iinclude/generated/uapi \ - -include $(srctree)/include/linux/kconfig.h - # Use LINUXINCLUDE when you must reference the include/ directory. # Needed to be compatible with the O= option -LINUXINCLUDE := \ - -I$(srctree)/arch/$(hdr-arch)/include \ - -Iarch/$(hdr-arch)/include/generated \ - $(if $(KBUILD_SRC), -I$(srctree)/include) \ - -Iinclude \ - $(USERINCLUDE) +LINUXINCLUDE := -I$(srctree)/arch/$(hdr-arch)/include \ + -Iarch/$(hdr-arch)/include/generated -Iinclude \ + $(if $(KBUILD_SRC), -I$(srctree)/include) \ + -include $(srctree)/include/linux/kconfig.h KBUILD_CPPFLAGS := -D__KERNEL__ @@ -447,11 +437,9 @@ asm-generic: # Detect when mixed targets is specified, and make a second invocation # of make so .config is not included in this case either (for *config). -version_h := include/generated/uapi/linux/version.h - no-dot-config-targets := clean mrproper distclean \ cscope gtags TAGS tags help %docs check% coccicheck \ - $(version_h) headers_% archheaders archscripts \ + include/linux/version.h headers_% archheaders archscripts \ kernelversion %src-pkg config-targets := 0 @@ -821,7 +809,7 @@ endif # prepare2 creates a makefile if using a separate output directory prepare2: prepare3 outputmakefile asm-generic -prepare1: prepare2 $(version_h) include/generated/utsrelease.h \ +prepare1: prepare2 include/linux/version.h include/generated/utsrelease.h \ include/config/auto.conf $(cmd_crmodverdir) @@ -854,7 +842,7 @@ define filechk_version.h echo '#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))';) endef -$(version_h): $(srctree)/Makefile FORCE +include/linux/version.h: $(srctree)/Makefile FORCE $(call filechk,version.h) include/generated/utsrelease.h: include/config/kernel.release FORCE @@ -899,7 +887,7 @@ PHONY += archscripts archscripts: PHONY += __headers -__headers: $(version_h) scripts_basic asm-generic archheaders archscripts FORCE +__headers: include/linux/version.h scripts_basic asm-generic archheaders archscripts FORCE $(Q)$(MAKE) $(build)=scripts build_unifdef PHONY += headers_install_all @@ -908,10 +896,10 @@ headers_install_all: PHONY += headers_install headers_install: __headers - $(if $(wildcard $(srctree)/arch/$(hdr-arch)/include/uapi/asm/Kbuild),, \ - $(error Headers not exportable for the $(SRCARCH) architecture)) - $(Q)$(MAKE) $(hdr-inst)=include/uapi - $(Q)$(MAKE) $(hdr-inst)=arch/$(hdr-arch)/include/uapi/asm $(hdr-dst) + $(if $(wildcard $(srctree)/arch/$(hdr-arch)/include/asm/Kbuild),, \ + $(error Headers not exportable for the $(SRCARCH) architecture)) + $(Q)$(MAKE) $(hdr-inst)=include + $(Q)$(MAKE) $(hdr-inst)=arch/$(hdr-arch)/include/asm $(hdr-dst) PHONY += headers_check_all headers_check_all: headers_install_all @@ -919,8 +907,8 @@ headers_check_all: headers_install_all PHONY += headers_check headers_check: headers_install - $(Q)$(MAKE) $(hdr-inst)=include/uapi HDRCHECK=1 - $(Q)$(MAKE) $(hdr-inst)=arch/$(hdr-arch)/include/uapi/asm $(hdr-dst) HDRCHECK=1 + $(Q)$(MAKE) $(hdr-inst)=include HDRCHECK=1 + $(Q)$(MAKE) $(hdr-inst)=arch/$(hdr-arch)/include/asm $(hdr-dst) HDRCHECK=1 # --------------------------------------------------------------------------- # Modules @@ -1009,7 +997,8 @@ CLEAN_DIRS += $(MODVERDIR) # Directories & files removed with 'make mrproper' MRPROPER_DIRS += include/config usr/include include/generated \ arch/*/include/generated -MRPROPER_FILES += .config .config.old .version .old_version $(version_h) \ +MRPROPER_FILES += .config .config.old .version .old_version \ + include/linux/version.h \ Module.symvers tags TAGS cscope* GPATH GTAGS GRTAGS GSYMS # clean - Delete most, but leave enough to build external modules diff --git a/trunk/arch/alpha/include/uapi/asm/Kbuild b/trunk/arch/alpha/include/uapi/asm/Kbuild deleted file mode 100644 index baebb3da1d44..000000000000 --- a/trunk/arch/alpha/include/uapi/asm/Kbuild +++ /dev/null @@ -1,3 +0,0 @@ -# UAPI Header export list -include include/uapi/asm-generic/Kbuild.asm - diff --git a/trunk/arch/alpha/kernel/osf_sys.c b/trunk/arch/alpha/kernel/osf_sys.c index 63e77e3944ce..9503a4be40f6 100644 --- a/trunk/arch/alpha/kernel/osf_sys.c +++ b/trunk/arch/alpha/kernel/osf_sys.c @@ -145,24 +145,27 @@ SYSCALL_DEFINE4(osf_getdirentries, unsigned int, fd, long __user *, basep) { int error; - struct fd arg = fdget(fd); + struct file *file; struct osf_dirent_callback buf; - if (!arg.file) - return -EBADF; + error = -EBADF; + file = fget(fd); + if (!file) + goto out; buf.dirent = dirent; buf.basep = basep; buf.count = count; buf.error = 0; - error = vfs_readdir(arg.file, osf_filldir, &buf); + error = vfs_readdir(file, osf_filldir, &buf); if (error >= 0) error = buf.error; if (count != buf.count) error = count - buf.count; - fdput(arg); + fput(file); + out: return error; } diff --git a/trunk/arch/arm/Makefile b/trunk/arch/arm/Makefile index b86e57ef146b..770da51242c4 100644 --- a/trunk/arch/arm/Makefile +++ b/trunk/arch/arm/Makefile @@ -254,7 +254,6 @@ core-$(CONFIG_VFP) += arch/arm/vfp/ # If we have a machine-specific directory, then include it in the build. core-y += arch/arm/kernel/ arch/arm/mm/ arch/arm/common/ core-y += arch/arm/net/ -core-y += arch/arm/crypto/ core-y += $(machdirs) $(platdirs) drivers-$(CONFIG_OPROFILE) += arch/arm/oprofile/ diff --git a/trunk/arch/arm/boot/dts/highbank.dts b/trunk/arch/arm/boot/dts/highbank.dts index 0c6fc34821f9..9fecf1ae777b 100644 --- a/trunk/arch/arm/boot/dts/highbank.dts +++ b/trunk/arch/arm/boot/dts/highbank.dts @@ -121,10 +121,6 @@ compatible = "calxeda,hb-ahci"; reg = <0xffe08000 0x10000>; interrupts = <0 83 4>; - calxeda,port-phys = <&combophy5 0 &combophy0 0 - &combophy0 1 &combophy0 2 - &combophy0 3>; - dma-coherent; }; sdhci@ffe0e000 { @@ -310,19 +306,5 @@ reg = <0xfff51000 0x1000>; interrupts = <0 80 4 0 81 4 0 82 4>; }; - - combophy0: combo-phy@fff58000 { - compatible = "calxeda,hb-combophy"; - #phy-cells = <1>; - reg = <0xfff58000 0x1000>; - phydev = <5>; - }; - - combophy5: combo-phy@fff5d000 { - compatible = "calxeda,hb-combophy"; - #phy-cells = <1>; - reg = <0xfff5d000 0x1000>; - phydev = <31>; - }; }; }; diff --git a/trunk/arch/arm/boot/dts/imx6q.dtsi b/trunk/arch/arm/boot/dts/imx6q.dtsi index f3990b04fecf..35e5895ba3df 100644 --- a/trunk/arch/arm/boot/dts/imx6q.dtsi +++ b/trunk/arch/arm/boot/dts/imx6q.dtsi @@ -400,8 +400,8 @@ #clock-cells = <1>; }; - anatop: anatop@020c8000 { - compatible = "fsl,imx6q-anatop", "syscon", "simple-bus"; + anatop@020c8000 { + compatible = "fsl,imx6q-anatop"; reg = <0x020c8000 0x1000>; interrupts = <0 49 0x04 0 54 0x04 0 127 0x04>; @@ -531,11 +531,6 @@ interrupts = <0 89 0x04 0 90 0x04>; }; - gpr: iomuxc-gpr@020e0000 { - compatible = "fsl,imx6q-iomuxc-gpr", "syscon"; - reg = <0x020e0000 0x38>; - }; - iomuxc@020e0000 { compatible = "fsl,imx6q-iomuxc"; reg = <0x020e0000 0x4000>; diff --git a/trunk/arch/arm/boot/dts/pxa910-dkb.dts b/trunk/arch/arm/boot/dts/pxa910-dkb.dts index 595492aa5053..e92be5a474e7 100644 --- a/trunk/arch/arm/boot/dts/pxa910-dkb.dts +++ b/trunk/arch/arm/boot/dts/pxa910-dkb.dts @@ -29,143 +29,6 @@ }; twsi1: i2c@d4011000 { status = "okay"; - - pmic: 88pm860x@34 { - compatible = "marvell,88pm860x"; - reg = <0x34>; - interrupts = <4>; - interrupt-parent = <&intc>; - interrupt-controller; - #interrupt-cells = <1>; - - marvell,88pm860x-irq-read-clr; - marvell,88pm860x-slave-addr = <0x11>; - - regulators { - BUCK1 { - regulator-min-microvolt = <1000000>; - regulator-max-microvolt = <1500000>; - regulator-boot-on; - regulator-always-on; - }; - BUCK2 { - regulator-min-microvolt = <1000000>; - regulator-max-microvolt = <1500000>; - regulator-boot-on; - regulator-always-on; - }; - BUCK3 { - regulator-min-microvolt = <1000000>; - regulator-max-microvolt = <3000000>; - regulator-boot-on; - regulator-always-on; - }; - LDO1 { - regulator-min-microvolt = <1200000>; - regulator-max-microvolt = <2800000>; - regulator-boot-on; - regulator-always-on; - }; - LDO2 { - regulator-min-microvolt = <1800000>; - regulator-max-microvolt = <3300000>; - regulator-boot-on; - regulator-always-on; - }; - LDO3 { - regulator-min-microvolt = <1800000>; - regulator-max-microvolt = <3300000>; - regulator-boot-on; - regulator-always-on; - }; - LDO4 { - regulator-min-microvolt = <1800000>; - regulator-max-microvolt = <3300000>; - regulator-always-on; - }; - LDO5 { - regulator-min-microvolt = <2900000>; - regulator-max-microvolt = <3300000>; - regulator-boot-on; - regulator-always-on; - }; - LDO6 { - regulator-min-microvolt = <1800000>; - regulator-max-microvolt = <3300000>; - regulator-boot-on; - regulator-always-on; - }; - LDO7 { - regulator-min-microvolt = <1800000>; - regulator-max-microvolt = <2900000>; - regulator-boot-on; - regulator-always-on; - }; - LDO8 { - regulator-min-microvolt = <1800000>; - regulator-max-microvolt = <2900000>; - regulator-boot-on; - regulator-always-on; - }; - LDO9 { - regulator-min-microvolt = <1800000>; - regulator-max-microvolt = <3300000>; - regulator-boot-on; - regulator-always-on; - }; - LDO10 { - regulator-min-microvolt = <1200000>; - regulator-max-microvolt = <3300000>; - regulator-boot-on; - regulator-always-on; - }; - LDO12 { - regulator-min-microvolt = <1200000>; - regulator-max-microvolt = <3300000>; - regulator-always-on; - }; - LDO13 { - regulator-min-microvolt = <1200000>; - regulator-max-microvolt = <3300000>; - regulator-always-on; - }; - LDO14 { - regulator-min-microvolt = <1800000>; - regulator-max-microvolt = <3300000>; - regulator-always-on; - }; - }; - rtc { - marvell,88pm860x-vrtc = <1>; - }; - touch { - marvell,88pm860x-gpadc-prebias = <1>; - marvell,88pm860x-gpadc-slot-cycle = <1>; - marvell,88pm860x-tsi-prebias = <6>; - marvell,88pm860x-pen-prebias = <16>; - marvell,88pm860x-pen-prechg = <2>; - marvell,88pm860x-resistor-X = <300>; - }; - backlights { - backlight-0 { - marvell,88pm860x-iset = <4>; - marvell,88pm860x-pwm = <3>; - }; - backlight-2 { - }; - }; - leds { - led0-red { - marvell,88pm860x-iset = <12>; - }; - led0-green { - marvell,88pm860x-iset = <12>; - }; - led0-blue { - marvell,88pm860x-iset = <12>; - }; - }; - }; }; rtc: rtc@d4010000 { status = "okay"; diff --git a/trunk/arch/arm/boot/dts/pxa910.dtsi b/trunk/arch/arm/boot/dts/pxa910.dtsi index 825aaca33034..a3be44d86bcd 100644 --- a/trunk/arch/arm/boot/dts/pxa910.dtsi +++ b/trunk/arch/arm/boot/dts/pxa910.dtsi @@ -120,8 +120,6 @@ twsi1: i2c@d4011000 { compatible = "mrvl,mmp-twsi"; - #address-cells = <1>; - #size-cells = <0>; reg = <0xd4011000 0x1000>; interrupts = <7>; mrvl,i2c-fast-mode; @@ -130,8 +128,6 @@ twsi2: i2c@d4037000 { compatible = "mrvl,mmp-twsi"; - #address-cells = <1>; - #size-cells = <0>; reg = <0xd4037000 0x1000>; interrupts = <54>; status = "disabled"; diff --git a/trunk/arch/arm/configs/sam9_l9260_defconfig b/trunk/arch/arm/configs/sam9_l9260_defconfig index b4384af1bea6..ecf2531523a1 100644 --- a/trunk/arch/arm/configs/sam9_l9260_defconfig +++ b/trunk/arch/arm/configs/sam9_l9260_defconfig @@ -39,7 +39,7 @@ CONFIG_MTD_NAND=y CONFIG_MTD_NAND_ATMEL=y CONFIG_MTD_NAND_PLATFORM=y CONFIG_MTD_UBI=y -CONFIG_MTD_UBI_BEB_LIMIT=25 +CONFIG_MTD_UBI_BEB_RESERVE=3 CONFIG_MTD_UBI_GLUEBI=y CONFIG_BLK_DEV_LOOP=y CONFIG_BLK_DEV_RAM=y diff --git a/trunk/arch/arm/crypto/Makefile b/trunk/arch/arm/crypto/Makefile deleted file mode 100644 index a2c83851bc90..000000000000 --- a/trunk/arch/arm/crypto/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -# -# Arch-specific CryptoAPI modules. -# - -obj-$(CONFIG_CRYPTO_AES_ARM) += aes-arm.o -obj-$(CONFIG_CRYPTO_SHA1_ARM) += sha1-arm.o - -aes-arm-y := aes-armv4.o aes_glue.o -sha1-arm-y := sha1-armv4-large.o sha1_glue.o diff --git a/trunk/arch/arm/crypto/aes-armv4.S b/trunk/arch/arm/crypto/aes-armv4.S deleted file mode 100644 index e59b1d505d6c..000000000000 --- a/trunk/arch/arm/crypto/aes-armv4.S +++ /dev/null @@ -1,1112 +0,0 @@ -#define __ARM_ARCH__ __LINUX_ARM_ARCH__ -@ ==================================================================== -@ Written by Andy Polyakov for the OpenSSL -@ project. The module is, however, dual licensed under OpenSSL and -@ CRYPTOGAMS licenses depending on where you obtain it. For further -@ details see http://www.openssl.org/~appro/cryptogams/. -@ ==================================================================== - -@ AES for ARMv4 - -@ January 2007. -@ -@ Code uses single 1K S-box and is >2 times faster than code generated -@ by gcc-3.4.1. This is thanks to unique feature of ARMv4 ISA, which -@ allows to merge logical or arithmetic operation with shift or rotate -@ in one instruction and emit combined result every cycle. The module -@ is endian-neutral. The performance is ~42 cycles/byte for 128-bit -@ key [on single-issue Xscale PXA250 core]. - -@ May 2007. -@ -@ AES_set_[en|de]crypt_key is added. - -@ July 2010. -@ -@ Rescheduling for dual-issue pipeline resulted in 12% improvement on -@ Cortex A8 core and ~25 cycles per byte processed with 128-bit key. - -@ February 2011. -@ -@ Profiler-assisted and platform-specific optimization resulted in 16% -@ improvement on Cortex A8 core and ~21.5 cycles per byte. - -@ A little glue here to select the correct code below for the ARM CPU -@ that is being targetted. - -.text -.code 32 - -.type AES_Te,%object -.align 5 -AES_Te: -.word 0xc66363a5, 0xf87c7c84, 0xee777799, 0xf67b7b8d -.word 0xfff2f20d, 0xd66b6bbd, 0xde6f6fb1, 0x91c5c554 -.word 0x60303050, 0x02010103, 0xce6767a9, 0x562b2b7d -.word 0xe7fefe19, 0xb5d7d762, 0x4dababe6, 0xec76769a -.word 0x8fcaca45, 0x1f82829d, 0x89c9c940, 0xfa7d7d87 -.word 0xeffafa15, 0xb25959eb, 0x8e4747c9, 0xfbf0f00b -.word 0x41adadec, 0xb3d4d467, 0x5fa2a2fd, 0x45afafea -.word 0x239c9cbf, 0x53a4a4f7, 0xe4727296, 0x9bc0c05b -.word 0x75b7b7c2, 0xe1fdfd1c, 0x3d9393ae, 0x4c26266a -.word 0x6c36365a, 0x7e3f3f41, 0xf5f7f702, 0x83cccc4f -.word 0x6834345c, 0x51a5a5f4, 0xd1e5e534, 0xf9f1f108 -.word 0xe2717193, 0xabd8d873, 0x62313153, 0x2a15153f -.word 0x0804040c, 0x95c7c752, 0x46232365, 0x9dc3c35e -.word 0x30181828, 0x379696a1, 0x0a05050f, 0x2f9a9ab5 -.word 0x0e070709, 0x24121236, 0x1b80809b, 0xdfe2e23d -.word 0xcdebeb26, 0x4e272769, 0x7fb2b2cd, 0xea75759f -.word 0x1209091b, 0x1d83839e, 0x582c2c74, 0x341a1a2e -.word 0x361b1b2d, 0xdc6e6eb2, 0xb45a5aee, 0x5ba0a0fb -.word 0xa45252f6, 0x763b3b4d, 0xb7d6d661, 0x7db3b3ce -.word 0x5229297b, 0xdde3e33e, 0x5e2f2f71, 0x13848497 -.word 0xa65353f5, 0xb9d1d168, 0x00000000, 0xc1eded2c -.word 0x40202060, 0xe3fcfc1f, 0x79b1b1c8, 0xb65b5bed -.word 0xd46a6abe, 0x8dcbcb46, 0x67bebed9, 0x7239394b -.word 0x944a4ade, 0x984c4cd4, 0xb05858e8, 0x85cfcf4a -.word 0xbbd0d06b, 0xc5efef2a, 0x4faaaae5, 0xedfbfb16 -.word 0x864343c5, 0x9a4d4dd7, 0x66333355, 0x11858594 -.word 0x8a4545cf, 0xe9f9f910, 0x04020206, 0xfe7f7f81 -.word 0xa05050f0, 0x783c3c44, 0x259f9fba, 0x4ba8a8e3 -.word 0xa25151f3, 0x5da3a3fe, 0x804040c0, 0x058f8f8a -.word 0x3f9292ad, 0x219d9dbc, 0x70383848, 0xf1f5f504 -.word 0x63bcbcdf, 0x77b6b6c1, 0xafdada75, 0x42212163 -.word 0x20101030, 0xe5ffff1a, 0xfdf3f30e, 0xbfd2d26d -.word 0x81cdcd4c, 0x180c0c14, 0x26131335, 0xc3ecec2f -.word 0xbe5f5fe1, 0x359797a2, 0x884444cc, 0x2e171739 -.word 0x93c4c457, 0x55a7a7f2, 0xfc7e7e82, 0x7a3d3d47 -.word 0xc86464ac, 0xba5d5de7, 0x3219192b, 0xe6737395 -.word 0xc06060a0, 0x19818198, 0x9e4f4fd1, 0xa3dcdc7f -.word 0x44222266, 0x542a2a7e, 0x3b9090ab, 0x0b888883 -.word 0x8c4646ca, 0xc7eeee29, 0x6bb8b8d3, 0x2814143c -.word 0xa7dede79, 0xbc5e5ee2, 0x160b0b1d, 0xaddbdb76 -.word 0xdbe0e03b, 0x64323256, 0x743a3a4e, 0x140a0a1e -.word 0x924949db, 0x0c06060a, 0x4824246c, 0xb85c5ce4 -.word 0x9fc2c25d, 0xbdd3d36e, 0x43acacef, 0xc46262a6 -.word 0x399191a8, 0x319595a4, 0xd3e4e437, 0xf279798b -.word 0xd5e7e732, 0x8bc8c843, 0x6e373759, 0xda6d6db7 -.word 0x018d8d8c, 0xb1d5d564, 0x9c4e4ed2, 0x49a9a9e0 -.word 0xd86c6cb4, 0xac5656fa, 0xf3f4f407, 0xcfeaea25 -.word 0xca6565af, 0xf47a7a8e, 0x47aeaee9, 0x10080818 -.word 0x6fbabad5, 0xf0787888, 0x4a25256f, 0x5c2e2e72 -.word 0x381c1c24, 0x57a6a6f1, 0x73b4b4c7, 0x97c6c651 -.word 0xcbe8e823, 0xa1dddd7c, 0xe874749c, 0x3e1f1f21 -.word 0x964b4bdd, 0x61bdbddc, 0x0d8b8b86, 0x0f8a8a85 -.word 0xe0707090, 0x7c3e3e42, 0x71b5b5c4, 0xcc6666aa -.word 0x904848d8, 0x06030305, 0xf7f6f601, 0x1c0e0e12 -.word 0xc26161a3, 0x6a35355f, 0xae5757f9, 0x69b9b9d0 -.word 0x17868691, 0x99c1c158, 0x3a1d1d27, 0x279e9eb9 -.word 0xd9e1e138, 0xebf8f813, 0x2b9898b3, 0x22111133 -.word 0xd26969bb, 0xa9d9d970, 0x078e8e89, 0x339494a7 -.word 0x2d9b9bb6, 0x3c1e1e22, 0x15878792, 0xc9e9e920 -.word 0x87cece49, 0xaa5555ff, 0x50282878, 0xa5dfdf7a -.word 0x038c8c8f, 0x59a1a1f8, 0x09898980, 0x1a0d0d17 -.word 0x65bfbfda, 0xd7e6e631, 0x844242c6, 0xd06868b8 -.word 0x824141c3, 0x299999b0, 0x5a2d2d77, 0x1e0f0f11 -.word 0x7bb0b0cb, 0xa85454fc, 0x6dbbbbd6, 0x2c16163a -@ Te4[256] -.byte 0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5 -.byte 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76 -.byte 0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0 -.byte 0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0 -.byte 0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc -.byte 0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8, 0x31, 0x15 -.byte 0x04, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x05, 0x9a -.byte 0x07, 0x12, 0x80, 0xe2, 0xeb, 0x27, 0xb2, 0x75 -.byte 0x09, 0x83, 0x2c, 0x1a, 0x1b, 0x6e, 0x5a, 0xa0 -.byte 0x52, 0x3b, 0xd6, 0xb3, 0x29, 0xe3, 0x2f, 0x84 -.byte 0x53, 0xd1, 0x00, 0xed, 0x20, 0xfc, 0xb1, 0x5b -.byte 0x6a, 0xcb, 0xbe, 0x39, 0x4a, 0x4c, 0x58, 0xcf -.byte 0xd0, 0xef, 0xaa, 0xfb, 0x43, 0x4d, 0x33, 0x85 -.byte 0x45, 0xf9, 0x02, 0x7f, 0x50, 0x3c, 0x9f, 0xa8 -.byte 0x51, 0xa3, 0x40, 0x8f, 0x92, 0x9d, 0x38, 0xf5 -.byte 0xbc, 0xb6, 0xda, 0x21, 0x10, 0xff, 0xf3, 0xd2 -.byte 0xcd, 0x0c, 0x13, 0xec, 0x5f, 0x97, 0x44, 0x17 -.byte 0xc4, 0xa7, 0x7e, 0x3d, 0x64, 0x5d, 0x19, 0x73 -.byte 0x60, 0x81, 0x4f, 0xdc, 0x22, 0x2a, 0x90, 0x88 -.byte 0x46, 0xee, 0xb8, 0x14, 0xde, 0x5e, 0x0b, 0xdb -.byte 0xe0, 0x32, 0x3a, 0x0a, 0x49, 0x06, 0x24, 0x5c -.byte 0xc2, 0xd3, 0xac, 0x62, 0x91, 0x95, 0xe4, 0x79 -.byte 0xe7, 0xc8, 0x37, 0x6d, 0x8d, 0xd5, 0x4e, 0xa9 -.byte 0x6c, 0x56, 0xf4, 0xea, 0x65, 0x7a, 0xae, 0x08 -.byte 0xba, 0x78, 0x25, 0x2e, 0x1c, 0xa6, 0xb4, 0xc6 -.byte 0xe8, 0xdd, 0x74, 0x1f, 0x4b, 0xbd, 0x8b, 0x8a -.byte 0x70, 0x3e, 0xb5, 0x66, 0x48, 0x03, 0xf6, 0x0e -.byte 0x61, 0x35, 0x57, 0xb9, 0x86, 0xc1, 0x1d, 0x9e -.byte 0xe1, 0xf8, 0x98, 0x11, 0x69, 0xd9, 0x8e, 0x94 -.byte 0x9b, 0x1e, 0x87, 0xe9, 0xce, 0x55, 0x28, 0xdf -.byte 0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68 -.byte 0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16 -@ rcon[] -.word 0x01000000, 0x02000000, 0x04000000, 0x08000000 -.word 0x10000000, 0x20000000, 0x40000000, 0x80000000 -.word 0x1B000000, 0x36000000, 0, 0, 0, 0, 0, 0 -.size AES_Te,.-AES_Te - -@ void AES_encrypt(const unsigned char *in, unsigned char *out, -@ const AES_KEY *key) { -.global AES_encrypt -.type AES_encrypt,%function -.align 5 -AES_encrypt: - sub r3,pc,#8 @ AES_encrypt - stmdb sp!,{r1,r4-r12,lr} - mov r12,r0 @ inp - mov r11,r2 - sub r10,r3,#AES_encrypt-AES_Te @ Te -#if __ARM_ARCH__<7 - ldrb r0,[r12,#3] @ load input data in endian-neutral - ldrb r4,[r12,#2] @ manner... - ldrb r5,[r12,#1] - ldrb r6,[r12,#0] - orr r0,r0,r4,lsl#8 - ldrb r1,[r12,#7] - orr r0,r0,r5,lsl#16 - ldrb r4,[r12,#6] - orr r0,r0,r6,lsl#24 - ldrb r5,[r12,#5] - ldrb r6,[r12,#4] - orr r1,r1,r4,lsl#8 - ldrb r2,[r12,#11] - orr r1,r1,r5,lsl#16 - ldrb r4,[r12,#10] - orr r1,r1,r6,lsl#24 - ldrb r5,[r12,#9] - ldrb r6,[r12,#8] - orr r2,r2,r4,lsl#8 - ldrb r3,[r12,#15] - orr r2,r2,r5,lsl#16 - ldrb r4,[r12,#14] - orr r2,r2,r6,lsl#24 - ldrb r5,[r12,#13] - ldrb r6,[r12,#12] - orr r3,r3,r4,lsl#8 - orr r3,r3,r5,lsl#16 - orr r3,r3,r6,lsl#24 -#else - ldr r0,[r12,#0] - ldr r1,[r12,#4] - ldr r2,[r12,#8] - ldr r3,[r12,#12] -#ifdef __ARMEL__ - rev r0,r0 - rev r1,r1 - rev r2,r2 - rev r3,r3 -#endif -#endif - bl _armv4_AES_encrypt - - ldr r12,[sp],#4 @ pop out -#if __ARM_ARCH__>=7 -#ifdef __ARMEL__ - rev r0,r0 - rev r1,r1 - rev r2,r2 - rev r3,r3 -#endif - str r0,[r12,#0] - str r1,[r12,#4] - str r2,[r12,#8] - str r3,[r12,#12] -#else - mov r4,r0,lsr#24 @ write output in endian-neutral - mov r5,r0,lsr#16 @ manner... - mov r6,r0,lsr#8 - strb r4,[r12,#0] - strb r5,[r12,#1] - mov r4,r1,lsr#24 - strb r6,[r12,#2] - mov r5,r1,lsr#16 - strb r0,[r12,#3] - mov r6,r1,lsr#8 - strb r4,[r12,#4] - strb r5,[r12,#5] - mov r4,r2,lsr#24 - strb r6,[r12,#6] - mov r5,r2,lsr#16 - strb r1,[r12,#7] - mov r6,r2,lsr#8 - strb r4,[r12,#8] - strb r5,[r12,#9] - mov r4,r3,lsr#24 - strb r6,[r12,#10] - mov r5,r3,lsr#16 - strb r2,[r12,#11] - mov r6,r3,lsr#8 - strb r4,[r12,#12] - strb r5,[r12,#13] - strb r6,[r12,#14] - strb r3,[r12,#15] -#endif -#if __ARM_ARCH__>=5 - ldmia sp!,{r4-r12,pc} -#else - ldmia sp!,{r4-r12,lr} - tst lr,#1 - moveq pc,lr @ be binary compatible with V4, yet - .word 0xe12fff1e @ interoperable with Thumb ISA:-) -#endif -.size AES_encrypt,.-AES_encrypt - -.type _armv4_AES_encrypt,%function -.align 2 -_armv4_AES_encrypt: - str lr,[sp,#-4]! @ push lr - ldmia r11!,{r4-r7} - eor r0,r0,r4 - ldr r12,[r11,#240-16] - eor r1,r1,r5 - eor r2,r2,r6 - eor r3,r3,r7 - sub r12,r12,#1 - mov lr,#255 - - and r7,lr,r0 - and r8,lr,r0,lsr#8 - and r9,lr,r0,lsr#16 - mov r0,r0,lsr#24 -.Lenc_loop: - ldr r4,[r10,r7,lsl#2] @ Te3[s0>>0] - and r7,lr,r1,lsr#16 @ i0 - ldr r5,[r10,r8,lsl#2] @ Te2[s0>>8] - and r8,lr,r1 - ldr r6,[r10,r9,lsl#2] @ Te1[s0>>16] - and r9,lr,r1,lsr#8 - ldr r0,[r10,r0,lsl#2] @ Te0[s0>>24] - mov r1,r1,lsr#24 - - ldr r7,[r10,r7,lsl#2] @ Te1[s1>>16] - ldr r8,[r10,r8,lsl#2] @ Te3[s1>>0] - ldr r9,[r10,r9,lsl#2] @ Te2[s1>>8] - eor r0,r0,r7,ror#8 - ldr r1,[r10,r1,lsl#2] @ Te0[s1>>24] - and r7,lr,r2,lsr#8 @ i0 - eor r5,r5,r8,ror#8 - and r8,lr,r2,lsr#16 @ i1 - eor r6,r6,r9,ror#8 - and r9,lr,r2 - ldr r7,[r10,r7,lsl#2] @ Te2[s2>>8] - eor r1,r1,r4,ror#24 - ldr r8,[r10,r8,lsl#2] @ Te1[s2>>16] - mov r2,r2,lsr#24 - - ldr r9,[r10,r9,lsl#2] @ Te3[s2>>0] - eor r0,r0,r7,ror#16 - ldr r2,[r10,r2,lsl#2] @ Te0[s2>>24] - and r7,lr,r3 @ i0 - eor r1,r1,r8,ror#8 - and r8,lr,r3,lsr#8 @ i1 - eor r6,r6,r9,ror#16 - and r9,lr,r3,lsr#16 @ i2 - ldr r7,[r10,r7,lsl#2] @ Te3[s3>>0] - eor r2,r2,r5,ror#16 - ldr r8,[r10,r8,lsl#2] @ Te2[s3>>8] - mov r3,r3,lsr#24 - - ldr r9,[r10,r9,lsl#2] @ Te1[s3>>16] - eor r0,r0,r7,ror#24 - ldr r7,[r11],#16 - eor r1,r1,r8,ror#16 - ldr r3,[r10,r3,lsl#2] @ Te0[s3>>24] - eor r2,r2,r9,ror#8 - ldr r4,[r11,#-12] - eor r3,r3,r6,ror#8 - - ldr r5,[r11,#-8] - eor r0,r0,r7 - ldr r6,[r11,#-4] - and r7,lr,r0 - eor r1,r1,r4 - and r8,lr,r0,lsr#8 - eor r2,r2,r5 - and r9,lr,r0,lsr#16 - eor r3,r3,r6 - mov r0,r0,lsr#24 - - subs r12,r12,#1 - bne .Lenc_loop - - add r10,r10,#2 - - ldrb r4,[r10,r7,lsl#2] @ Te4[s0>>0] - and r7,lr,r1,lsr#16 @ i0 - ldrb r5,[r10,r8,lsl#2] @ Te4[s0>>8] - and r8,lr,r1 - ldrb r6,[r10,r9,lsl#2] @ Te4[s0>>16] - and r9,lr,r1,lsr#8 - ldrb r0,[r10,r0,lsl#2] @ Te4[s0>>24] - mov r1,r1,lsr#24 - - ldrb r7,[r10,r7,lsl#2] @ Te4[s1>>16] - ldrb r8,[r10,r8,lsl#2] @ Te4[s1>>0] - ldrb r9,[r10,r9,lsl#2] @ Te4[s1>>8] - eor r0,r7,r0,lsl#8 - ldrb r1,[r10,r1,lsl#2] @ Te4[s1>>24] - and r7,lr,r2,lsr#8 @ i0 - eor r5,r8,r5,lsl#8 - and r8,lr,r2,lsr#16 @ i1 - eor r6,r9,r6,lsl#8 - and r9,lr,r2 - ldrb r7,[r10,r7,lsl#2] @ Te4[s2>>8] - eor r1,r4,r1,lsl#24 - ldrb r8,[r10,r8,lsl#2] @ Te4[s2>>16] - mov r2,r2,lsr#24 - - ldrb r9,[r10,r9,lsl#2] @ Te4[s2>>0] - eor r0,r7,r0,lsl#8 - ldrb r2,[r10,r2,lsl#2] @ Te4[s2>>24] - and r7,lr,r3 @ i0 - eor r1,r1,r8,lsl#16 - and r8,lr,r3,lsr#8 @ i1 - eor r6,r9,r6,lsl#8 - and r9,lr,r3,lsr#16 @ i2 - ldrb r7,[r10,r7,lsl#2] @ Te4[s3>>0] - eor r2,r5,r2,lsl#24 - ldrb r8,[r10,r8,lsl#2] @ Te4[s3>>8] - mov r3,r3,lsr#24 - - ldrb r9,[r10,r9,lsl#2] @ Te4[s3>>16] - eor r0,r7,r0,lsl#8 - ldr r7,[r11,#0] - ldrb r3,[r10,r3,lsl#2] @ Te4[s3>>24] - eor r1,r1,r8,lsl#8 - ldr r4,[r11,#4] - eor r2,r2,r9,lsl#16 - ldr r5,[r11,#8] - eor r3,r6,r3,lsl#24 - ldr r6,[r11,#12] - - eor r0,r0,r7 - eor r1,r1,r4 - eor r2,r2,r5 - eor r3,r3,r6 - - sub r10,r10,#2 - ldr pc,[sp],#4 @ pop and return -.size _armv4_AES_encrypt,.-_armv4_AES_encrypt - -.global private_AES_set_encrypt_key -.type private_AES_set_encrypt_key,%function -.align 5 -private_AES_set_encrypt_key: -_armv4_AES_set_encrypt_key: - sub r3,pc,#8 @ AES_set_encrypt_key - teq r0,#0 - moveq r0,#-1 - beq .Labrt - teq r2,#0 - moveq r0,#-1 - beq .Labrt - - teq r1,#128 - beq .Lok - teq r1,#192 - beq .Lok - teq r1,#256 - movne r0,#-1 - bne .Labrt - -.Lok: stmdb sp!,{r4-r12,lr} - sub r10,r3,#_armv4_AES_set_encrypt_key-AES_Te-1024 @ Te4 - - mov r12,r0 @ inp - mov lr,r1 @ bits - mov r11,r2 @ key - -#if __ARM_ARCH__<7 - ldrb r0,[r12,#3] @ load input data in endian-neutral - ldrb r4,[r12,#2] @ manner... - ldrb r5,[r12,#1] - ldrb r6,[r12,#0] - orr r0,r0,r4,lsl#8 - ldrb r1,[r12,#7] - orr r0,r0,r5,lsl#16 - ldrb r4,[r12,#6] - orr r0,r0,r6,lsl#24 - ldrb r5,[r12,#5] - ldrb r6,[r12,#4] - orr r1,r1,r4,lsl#8 - ldrb r2,[r12,#11] - orr r1,r1,r5,lsl#16 - ldrb r4,[r12,#10] - orr r1,r1,r6,lsl#24 - ldrb r5,[r12,#9] - ldrb r6,[r12,#8] - orr r2,r2,r4,lsl#8 - ldrb r3,[r12,#15] - orr r2,r2,r5,lsl#16 - ldrb r4,[r12,#14] - orr r2,r2,r6,lsl#24 - ldrb r5,[r12,#13] - ldrb r6,[r12,#12] - orr r3,r3,r4,lsl#8 - str r0,[r11],#16 - orr r3,r3,r5,lsl#16 - str r1,[r11,#-12] - orr r3,r3,r6,lsl#24 - str r2,[r11,#-8] - str r3,[r11,#-4] -#else - ldr r0,[r12,#0] - ldr r1,[r12,#4] - ldr r2,[r12,#8] - ldr r3,[r12,#12] -#ifdef __ARMEL__ - rev r0,r0 - rev r1,r1 - rev r2,r2 - rev r3,r3 -#endif - str r0,[r11],#16 - str r1,[r11,#-12] - str r2,[r11,#-8] - str r3,[r11,#-4] -#endif - - teq lr,#128 - bne .Lnot128 - mov r12,#10 - str r12,[r11,#240-16] - add r6,r10,#256 @ rcon - mov lr,#255 - -.L128_loop: - and r5,lr,r3,lsr#24 - and r7,lr,r3,lsr#16 - ldrb r5,[r10,r5] - and r8,lr,r3,lsr#8 - ldrb r7,[r10,r7] - and r9,lr,r3 - ldrb r8,[r10,r8] - orr r5,r5,r7,lsl#24 - ldrb r9,[r10,r9] - orr r5,r5,r8,lsl#16 - ldr r4,[r6],#4 @ rcon[i++] - orr r5,r5,r9,lsl#8 - eor r5,r5,r4 - eor r0,r0,r5 @ rk[4]=rk[0]^... - eor r1,r1,r0 @ rk[5]=rk[1]^rk[4] - str r0,[r11],#16 - eor r2,r2,r1 @ rk[6]=rk[2]^rk[5] - str r1,[r11,#-12] - eor r3,r3,r2 @ rk[7]=rk[3]^rk[6] - str r2,[r11,#-8] - subs r12,r12,#1 - str r3,[r11,#-4] - bne .L128_loop - sub r2,r11,#176 - b .Ldone - -.Lnot128: -#if __ARM_ARCH__<7 - ldrb r8,[r12,#19] - ldrb r4,[r12,#18] - ldrb r5,[r12,#17] - ldrb r6,[r12,#16] - orr r8,r8,r4,lsl#8 - ldrb r9,[r12,#23] - orr r8,r8,r5,lsl#16 - ldrb r4,[r12,#22] - orr r8,r8,r6,lsl#24 - ldrb r5,[r12,#21] - ldrb r6,[r12,#20] - orr r9,r9,r4,lsl#8 - orr r9,r9,r5,lsl#16 - str r8,[r11],#8 - orr r9,r9,r6,lsl#24 - str r9,[r11,#-4] -#else - ldr r8,[r12,#16] - ldr r9,[r12,#20] -#ifdef __ARMEL__ - rev r8,r8 - rev r9,r9 -#endif - str r8,[r11],#8 - str r9,[r11,#-4] -#endif - - teq lr,#192 - bne .Lnot192 - mov r12,#12 - str r12,[r11,#240-24] - add r6,r10,#256 @ rcon - mov lr,#255 - mov r12,#8 - -.L192_loop: - and r5,lr,r9,lsr#24 - and r7,lr,r9,lsr#16 - ldrb r5,[r10,r5] - and r8,lr,r9,lsr#8 - ldrb r7,[r10,r7] - and r9,lr,r9 - ldrb r8,[r10,r8] - orr r5,r5,r7,lsl#24 - ldrb r9,[r10,r9] - orr r5,r5,r8,lsl#16 - ldr r4,[r6],#4 @ rcon[i++] - orr r5,r5,r9,lsl#8 - eor r9,r5,r4 - eor r0,r0,r9 @ rk[6]=rk[0]^... - eor r1,r1,r0 @ rk[7]=rk[1]^rk[6] - str r0,[r11],#24 - eor r2,r2,r1 @ rk[8]=rk[2]^rk[7] - str r1,[r11,#-20] - eor r3,r3,r2 @ rk[9]=rk[3]^rk[8] - str r2,[r11,#-16] - subs r12,r12,#1 - str r3,[r11,#-12] - subeq r2,r11,#216 - beq .Ldone - - ldr r7,[r11,#-32] - ldr r8,[r11,#-28] - eor r7,r7,r3 @ rk[10]=rk[4]^rk[9] - eor r9,r8,r7 @ rk[11]=rk[5]^rk[10] - str r7,[r11,#-8] - str r9,[r11,#-4] - b .L192_loop - -.Lnot192: -#if __ARM_ARCH__<7 - ldrb r8,[r12,#27] - ldrb r4,[r12,#26] - ldrb r5,[r12,#25] - ldrb r6,[r12,#24] - orr r8,r8,r4,lsl#8 - ldrb r9,[r12,#31] - orr r8,r8,r5,lsl#16 - ldrb r4,[r12,#30] - orr r8,r8,r6,lsl#24 - ldrb r5,[r12,#29] - ldrb r6,[r12,#28] - orr r9,r9,r4,lsl#8 - orr r9,r9,r5,lsl#16 - str r8,[r11],#8 - orr r9,r9,r6,lsl#24 - str r9,[r11,#-4] -#else - ldr r8,[r12,#24] - ldr r9,[r12,#28] -#ifdef __ARMEL__ - rev r8,r8 - rev r9,r9 -#endif - str r8,[r11],#8 - str r9,[r11,#-4] -#endif - - mov r12,#14 - str r12,[r11,#240-32] - add r6,r10,#256 @ rcon - mov lr,#255 - mov r12,#7 - -.L256_loop: - and r5,lr,r9,lsr#24 - and r7,lr,r9,lsr#16 - ldrb r5,[r10,r5] - and r8,lr,r9,lsr#8 - ldrb r7,[r10,r7] - and r9,lr,r9 - ldrb r8,[r10,r8] - orr r5,r5,r7,lsl#24 - ldrb r9,[r10,r9] - orr r5,r5,r8,lsl#16 - ldr r4,[r6],#4 @ rcon[i++] - orr r5,r5,r9,lsl#8 - eor r9,r5,r4 - eor r0,r0,r9 @ rk[8]=rk[0]^... - eor r1,r1,r0 @ rk[9]=rk[1]^rk[8] - str r0,[r11],#32 - eor r2,r2,r1 @ rk[10]=rk[2]^rk[9] - str r1,[r11,#-28] - eor r3,r3,r2 @ rk[11]=rk[3]^rk[10] - str r2,[r11,#-24] - subs r12,r12,#1 - str r3,[r11,#-20] - subeq r2,r11,#256 - beq .Ldone - - and r5,lr,r3 - and r7,lr,r3,lsr#8 - ldrb r5,[r10,r5] - and r8,lr,r3,lsr#16 - ldrb r7,[r10,r7] - and r9,lr,r3,lsr#24 - ldrb r8,[r10,r8] - orr r5,r5,r7,lsl#8 - ldrb r9,[r10,r9] - orr r5,r5,r8,lsl#16 - ldr r4,[r11,#-48] - orr r5,r5,r9,lsl#24 - - ldr r7,[r11,#-44] - ldr r8,[r11,#-40] - eor r4,r4,r5 @ rk[12]=rk[4]^... - ldr r9,[r11,#-36] - eor r7,r7,r4 @ rk[13]=rk[5]^rk[12] - str r4,[r11,#-16] - eor r8,r8,r7 @ rk[14]=rk[6]^rk[13] - str r7,[r11,#-12] - eor r9,r9,r8 @ rk[15]=rk[7]^rk[14] - str r8,[r11,#-8] - str r9,[r11,#-4] - b .L256_loop - -.Ldone: mov r0,#0 - ldmia sp!,{r4-r12,lr} -.Labrt: tst lr,#1 - moveq pc,lr @ be binary compatible with V4, yet - .word 0xe12fff1e @ interoperable with Thumb ISA:-) -.size private_AES_set_encrypt_key,.-private_AES_set_encrypt_key - -.global private_AES_set_decrypt_key -.type private_AES_set_decrypt_key,%function -.align 5 -private_AES_set_decrypt_key: - str lr,[sp,#-4]! @ push lr -#if 0 - @ kernel does both of these in setkey so optimise this bit out by - @ expecting the key to already have the enc_key work done (see aes_glue.c) - bl _armv4_AES_set_encrypt_key -#else - mov r0,#0 -#endif - teq r0,#0 - ldrne lr,[sp],#4 @ pop lr - bne .Labrt - - stmdb sp!,{r4-r12} - - ldr r12,[r2,#240] @ AES_set_encrypt_key preserves r2, - mov r11,r2 @ which is AES_KEY *key - mov r7,r2 - add r8,r2,r12,lsl#4 - -.Linv: ldr r0,[r7] - ldr r1,[r7,#4] - ldr r2,[r7,#8] - ldr r3,[r7,#12] - ldr r4,[r8] - ldr r5,[r8,#4] - ldr r6,[r8,#8] - ldr r9,[r8,#12] - str r0,[r8],#-16 - str r1,[r8,#16+4] - str r2,[r8,#16+8] - str r3,[r8,#16+12] - str r4,[r7],#16 - str r5,[r7,#-12] - str r6,[r7,#-8] - str r9,[r7,#-4] - teq r7,r8 - bne .Linv - ldr r0,[r11,#16]! @ prefetch tp1 - mov r7,#0x80 - mov r8,#0x1b - orr r7,r7,#0x8000 - orr r8,r8,#0x1b00 - orr r7,r7,r7,lsl#16 - orr r8,r8,r8,lsl#16 - sub r12,r12,#1 - mvn r9,r7 - mov r12,r12,lsl#2 @ (rounds-1)*4 - -.Lmix: and r4,r0,r7 - and r1,r0,r9 - sub r4,r4,r4,lsr#7 - and r4,r4,r8 - eor r1,r4,r1,lsl#1 @ tp2 - - and r4,r1,r7 - and r2,r1,r9 - sub r4,r4,r4,lsr#7 - and r4,r4,r8 - eor r2,r4,r2,lsl#1 @ tp4 - - and r4,r2,r7 - and r3,r2,r9 - sub r4,r4,r4,lsr#7 - and r4,r4,r8 - eor r3,r4,r3,lsl#1 @ tp8 - - eor r4,r1,r2 - eor r5,r0,r3 @ tp9 - eor r4,r4,r3 @ tpe - eor r4,r4,r1,ror#24 - eor r4,r4,r5,ror#24 @ ^= ROTATE(tpb=tp9^tp2,8) - eor r4,r4,r2,ror#16 - eor r4,r4,r5,ror#16 @ ^= ROTATE(tpd=tp9^tp4,16) - eor r4,r4,r5,ror#8 @ ^= ROTATE(tp9,24) - - ldr r0,[r11,#4] @ prefetch tp1 - str r4,[r11],#4 - subs r12,r12,#1 - bne .Lmix - - mov r0,#0 -#if __ARM_ARCH__>=5 - ldmia sp!,{r4-r12,pc} -#else - ldmia sp!,{r4-r12,lr} - tst lr,#1 - moveq pc,lr @ be binary compatible with V4, yet - .word 0xe12fff1e @ interoperable with Thumb ISA:-) -#endif -.size private_AES_set_decrypt_key,.-private_AES_set_decrypt_key - -.type AES_Td,%object -.align 5 -AES_Td: -.word 0x51f4a750, 0x7e416553, 0x1a17a4c3, 0x3a275e96 -.word 0x3bab6bcb, 0x1f9d45f1, 0xacfa58ab, 0x4be30393 -.word 0x2030fa55, 0xad766df6, 0x88cc7691, 0xf5024c25 -.word 0x4fe5d7fc, 0xc52acbd7, 0x26354480, 0xb562a38f -.word 0xdeb15a49, 0x25ba1b67, 0x45ea0e98, 0x5dfec0e1 -.word 0xc32f7502, 0x814cf012, 0x8d4697a3, 0x6bd3f9c6 -.word 0x038f5fe7, 0x15929c95, 0xbf6d7aeb, 0x955259da -.word 0xd4be832d, 0x587421d3, 0x49e06929, 0x8ec9c844 -.word 0x75c2896a, 0xf48e7978, 0x99583e6b, 0x27b971dd -.word 0xbee14fb6, 0xf088ad17, 0xc920ac66, 0x7dce3ab4 -.word 0x63df4a18, 0xe51a3182, 0x97513360, 0x62537f45 -.word 0xb16477e0, 0xbb6bae84, 0xfe81a01c, 0xf9082b94 -.word 0x70486858, 0x8f45fd19, 0x94de6c87, 0x527bf8b7 -.word 0xab73d323, 0x724b02e2, 0xe31f8f57, 0x6655ab2a -.word 0xb2eb2807, 0x2fb5c203, 0x86c57b9a, 0xd33708a5 -.word 0x302887f2, 0x23bfa5b2, 0x02036aba, 0xed16825c -.word 0x8acf1c2b, 0xa779b492, 0xf307f2f0, 0x4e69e2a1 -.word 0x65daf4cd, 0x0605bed5, 0xd134621f, 0xc4a6fe8a -.word 0x342e539d, 0xa2f355a0, 0x058ae132, 0xa4f6eb75 -.word 0x0b83ec39, 0x4060efaa, 0x5e719f06, 0xbd6e1051 -.word 0x3e218af9, 0x96dd063d, 0xdd3e05ae, 0x4de6bd46 -.word 0x91548db5, 0x71c45d05, 0x0406d46f, 0x605015ff -.word 0x1998fb24, 0xd6bde997, 0x894043cc, 0x67d99e77 -.word 0xb0e842bd, 0x07898b88, 0xe7195b38, 0x79c8eedb -.word 0xa17c0a47, 0x7c420fe9, 0xf8841ec9, 0x00000000 -.word 0x09808683, 0x322bed48, 0x1e1170ac, 0x6c5a724e -.word 0xfd0efffb, 0x0f853856, 0x3daed51e, 0x362d3927 -.word 0x0a0fd964, 0x685ca621, 0x9b5b54d1, 0x24362e3a -.word 0x0c0a67b1, 0x9357e70f, 0xb4ee96d2, 0x1b9b919e -.word 0x80c0c54f, 0x61dc20a2, 0x5a774b69, 0x1c121a16 -.word 0xe293ba0a, 0xc0a02ae5, 0x3c22e043, 0x121b171d -.word 0x0e090d0b, 0xf28bc7ad, 0x2db6a8b9, 0x141ea9c8 -.word 0x57f11985, 0xaf75074c, 0xee99ddbb, 0xa37f60fd -.word 0xf701269f, 0x5c72f5bc, 0x44663bc5, 0x5bfb7e34 -.word 0x8b432976, 0xcb23c6dc, 0xb6edfc68, 0xb8e4f163 -.word 0xd731dcca, 0x42638510, 0x13972240, 0x84c61120 -.word 0x854a247d, 0xd2bb3df8, 0xaef93211, 0xc729a16d -.word 0x1d9e2f4b, 0xdcb230f3, 0x0d8652ec, 0x77c1e3d0 -.word 0x2bb3166c, 0xa970b999, 0x119448fa, 0x47e96422 -.word 0xa8fc8cc4, 0xa0f03f1a, 0x567d2cd8, 0x223390ef -.word 0x87494ec7, 0xd938d1c1, 0x8ccaa2fe, 0x98d40b36 -.word 0xa6f581cf, 0xa57ade28, 0xdab78e26, 0x3fadbfa4 -.word 0x2c3a9de4, 0x5078920d, 0x6a5fcc9b, 0x547e4662 -.word 0xf68d13c2, 0x90d8b8e8, 0x2e39f75e, 0x82c3aff5 -.word 0x9f5d80be, 0x69d0937c, 0x6fd52da9, 0xcf2512b3 -.word 0xc8ac993b, 0x10187da7, 0xe89c636e, 0xdb3bbb7b -.word 0xcd267809, 0x6e5918f4, 0xec9ab701, 0x834f9aa8 -.word 0xe6956e65, 0xaaffe67e, 0x21bccf08, 0xef15e8e6 -.word 0xbae79bd9, 0x4a6f36ce, 0xea9f09d4, 0x29b07cd6 -.word 0x31a4b2af, 0x2a3f2331, 0xc6a59430, 0x35a266c0 -.word 0x744ebc37, 0xfc82caa6, 0xe090d0b0, 0x33a7d815 -.word 0xf104984a, 0x41ecdaf7, 0x7fcd500e, 0x1791f62f -.word 0x764dd68d, 0x43efb04d, 0xccaa4d54, 0xe49604df -.word 0x9ed1b5e3, 0x4c6a881b, 0xc12c1fb8, 0x4665517f -.word 0x9d5eea04, 0x018c355d, 0xfa877473, 0xfb0b412e -.word 0xb3671d5a, 0x92dbd252, 0xe9105633, 0x6dd64713 -.word 0x9ad7618c, 0x37a10c7a, 0x59f8148e, 0xeb133c89 -.word 0xcea927ee, 0xb761c935, 0xe11ce5ed, 0x7a47b13c -.word 0x9cd2df59, 0x55f2733f, 0x1814ce79, 0x73c737bf -.word 0x53f7cdea, 0x5ffdaa5b, 0xdf3d6f14, 0x7844db86 -.word 0xcaaff381, 0xb968c43e, 0x3824342c, 0xc2a3405f -.word 0x161dc372, 0xbce2250c, 0x283c498b, 0xff0d9541 -.word 0x39a80171, 0x080cb3de, 0xd8b4e49c, 0x6456c190 -.word 0x7bcb8461, 0xd532b670, 0x486c5c74, 0xd0b85742 -@ Td4[256] -.byte 0x52, 0x09, 0x6a, 0xd5, 0x30, 0x36, 0xa5, 0x38 -.byte 0xbf, 0x40, 0xa3, 0x9e, 0x81, 0xf3, 0xd7, 0xfb -.byte 0x7c, 0xe3, 0x39, 0x82, 0x9b, 0x2f, 0xff, 0x87 -.byte 0x34, 0x8e, 0x43, 0x44, 0xc4, 0xde, 0xe9, 0xcb -.byte 0x54, 0x7b, 0x94, 0x32, 0xa6, 0xc2, 0x23, 0x3d -.byte 0xee, 0x4c, 0x95, 0x0b, 0x42, 0xfa, 0xc3, 0x4e -.byte 0x08, 0x2e, 0xa1, 0x66, 0x28, 0xd9, 0x24, 0xb2 -.byte 0x76, 0x5b, 0xa2, 0x49, 0x6d, 0x8b, 0xd1, 0x25 -.byte 0x72, 0xf8, 0xf6, 0x64, 0x86, 0x68, 0x98, 0x16 -.byte 0xd4, 0xa4, 0x5c, 0xcc, 0x5d, 0x65, 0xb6, 0x92 -.byte 0x6c, 0x70, 0x48, 0x50, 0xfd, 0xed, 0xb9, 0xda -.byte 0x5e, 0x15, 0x46, 0x57, 0xa7, 0x8d, 0x9d, 0x84 -.byte 0x90, 0xd8, 0xab, 0x00, 0x8c, 0xbc, 0xd3, 0x0a -.byte 0xf7, 0xe4, 0x58, 0x05, 0xb8, 0xb3, 0x45, 0x06 -.byte 0xd0, 0x2c, 0x1e, 0x8f, 0xca, 0x3f, 0x0f, 0x02 -.byte 0xc1, 0xaf, 0xbd, 0x03, 0x01, 0x13, 0x8a, 0x6b -.byte 0x3a, 0x91, 0x11, 0x41, 0x4f, 0x67, 0xdc, 0xea -.byte 0x97, 0xf2, 0xcf, 0xce, 0xf0, 0xb4, 0xe6, 0x73 -.byte 0x96, 0xac, 0x74, 0x22, 0xe7, 0xad, 0x35, 0x85 -.byte 0xe2, 0xf9, 0x37, 0xe8, 0x1c, 0x75, 0xdf, 0x6e -.byte 0x47, 0xf1, 0x1a, 0x71, 0x1d, 0x29, 0xc5, 0x89 -.byte 0x6f, 0xb7, 0x62, 0x0e, 0xaa, 0x18, 0xbe, 0x1b -.byte 0xfc, 0x56, 0x3e, 0x4b, 0xc6, 0xd2, 0x79, 0x20 -.byte 0x9a, 0xdb, 0xc0, 0xfe, 0x78, 0xcd, 0x5a, 0xf4 -.byte 0x1f, 0xdd, 0xa8, 0x33, 0x88, 0x07, 0xc7, 0x31 -.byte 0xb1, 0x12, 0x10, 0x59, 0x27, 0x80, 0xec, 0x5f -.byte 0x60, 0x51, 0x7f, 0xa9, 0x19, 0xb5, 0x4a, 0x0d -.byte 0x2d, 0xe5, 0x7a, 0x9f, 0x93, 0xc9, 0x9c, 0xef -.byte 0xa0, 0xe0, 0x3b, 0x4d, 0xae, 0x2a, 0xf5, 0xb0 -.byte 0xc8, 0xeb, 0xbb, 0x3c, 0x83, 0x53, 0x99, 0x61 -.byte 0x17, 0x2b, 0x04, 0x7e, 0xba, 0x77, 0xd6, 0x26 -.byte 0xe1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0c, 0x7d -.size AES_Td,.-AES_Td - -@ void AES_decrypt(const unsigned char *in, unsigned char *out, -@ const AES_KEY *key) { -.global AES_decrypt -.type AES_decrypt,%function -.align 5 -AES_decrypt: - sub r3,pc,#8 @ AES_decrypt - stmdb sp!,{r1,r4-r12,lr} - mov r12,r0 @ inp - mov r11,r2 - sub r10,r3,#AES_decrypt-AES_Td @ Td -#if __ARM_ARCH__<7 - ldrb r0,[r12,#3] @ load input data in endian-neutral - ldrb r4,[r12,#2] @ manner... - ldrb r5,[r12,#1] - ldrb r6,[r12,#0] - orr r0,r0,r4,lsl#8 - ldrb r1,[r12,#7] - orr r0,r0,r5,lsl#16 - ldrb r4,[r12,#6] - orr r0,r0,r6,lsl#24 - ldrb r5,[r12,#5] - ldrb r6,[r12,#4] - orr r1,r1,r4,lsl#8 - ldrb r2,[r12,#11] - orr r1,r1,r5,lsl#16 - ldrb r4,[r12,#10] - orr r1,r1,r6,lsl#24 - ldrb r5,[r12,#9] - ldrb r6,[r12,#8] - orr r2,r2,r4,lsl#8 - ldrb r3,[r12,#15] - orr r2,r2,r5,lsl#16 - ldrb r4,[r12,#14] - orr r2,r2,r6,lsl#24 - ldrb r5,[r12,#13] - ldrb r6,[r12,#12] - orr r3,r3,r4,lsl#8 - orr r3,r3,r5,lsl#16 - orr r3,r3,r6,lsl#24 -#else - ldr r0,[r12,#0] - ldr r1,[r12,#4] - ldr r2,[r12,#8] - ldr r3,[r12,#12] -#ifdef __ARMEL__ - rev r0,r0 - rev r1,r1 - rev r2,r2 - rev r3,r3 -#endif -#endif - bl _armv4_AES_decrypt - - ldr r12,[sp],#4 @ pop out -#if __ARM_ARCH__>=7 -#ifdef __ARMEL__ - rev r0,r0 - rev r1,r1 - rev r2,r2 - rev r3,r3 -#endif - str r0,[r12,#0] - str r1,[r12,#4] - str r2,[r12,#8] - str r3,[r12,#12] -#else - mov r4,r0,lsr#24 @ write output in endian-neutral - mov r5,r0,lsr#16 @ manner... - mov r6,r0,lsr#8 - strb r4,[r12,#0] - strb r5,[r12,#1] - mov r4,r1,lsr#24 - strb r6,[r12,#2] - mov r5,r1,lsr#16 - strb r0,[r12,#3] - mov r6,r1,lsr#8 - strb r4,[r12,#4] - strb r5,[r12,#5] - mov r4,r2,lsr#24 - strb r6,[r12,#6] - mov r5,r2,lsr#16 - strb r1,[r12,#7] - mov r6,r2,lsr#8 - strb r4,[r12,#8] - strb r5,[r12,#9] - mov r4,r3,lsr#24 - strb r6,[r12,#10] - mov r5,r3,lsr#16 - strb r2,[r12,#11] - mov r6,r3,lsr#8 - strb r4,[r12,#12] - strb r5,[r12,#13] - strb r6,[r12,#14] - strb r3,[r12,#15] -#endif -#if __ARM_ARCH__>=5 - ldmia sp!,{r4-r12,pc} -#else - ldmia sp!,{r4-r12,lr} - tst lr,#1 - moveq pc,lr @ be binary compatible with V4, yet - .word 0xe12fff1e @ interoperable with Thumb ISA:-) -#endif -.size AES_decrypt,.-AES_decrypt - -.type _armv4_AES_decrypt,%function -.align 2 -_armv4_AES_decrypt: - str lr,[sp,#-4]! @ push lr - ldmia r11!,{r4-r7} - eor r0,r0,r4 - ldr r12,[r11,#240-16] - eor r1,r1,r5 - eor r2,r2,r6 - eor r3,r3,r7 - sub r12,r12,#1 - mov lr,#255 - - and r7,lr,r0,lsr#16 - and r8,lr,r0,lsr#8 - and r9,lr,r0 - mov r0,r0,lsr#24 -.Ldec_loop: - ldr r4,[r10,r7,lsl#2] @ Td1[s0>>16] - and r7,lr,r1 @ i0 - ldr r5,[r10,r8,lsl#2] @ Td2[s0>>8] - and r8,lr,r1,lsr#16 - ldr r6,[r10,r9,lsl#2] @ Td3[s0>>0] - and r9,lr,r1,lsr#8 - ldr r0,[r10,r0,lsl#2] @ Td0[s0>>24] - mov r1,r1,lsr#24 - - ldr r7,[r10,r7,lsl#2] @ Td3[s1>>0] - ldr r8,[r10,r8,lsl#2] @ Td1[s1>>16] - ldr r9,[r10,r9,lsl#2] @ Td2[s1>>8] - eor r0,r0,r7,ror#24 - ldr r1,[r10,r1,lsl#2] @ Td0[s1>>24] - and r7,lr,r2,lsr#8 @ i0 - eor r5,r8,r5,ror#8 - and r8,lr,r2 @ i1 - eor r6,r9,r6,ror#8 - and r9,lr,r2,lsr#16 - ldr r7,[r10,r7,lsl#2] @ Td2[s2>>8] - eor r1,r1,r4,ror#8 - ldr r8,[r10,r8,lsl#2] @ Td3[s2>>0] - mov r2,r2,lsr#24 - - ldr r9,[r10,r9,lsl#2] @ Td1[s2>>16] - eor r0,r0,r7,ror#16 - ldr r2,[r10,r2,lsl#2] @ Td0[s2>>24] - and r7,lr,r3,lsr#16 @ i0 - eor r1,r1,r8,ror#24 - and r8,lr,r3,lsr#8 @ i1 - eor r6,r9,r6,ror#8 - and r9,lr,r3 @ i2 - ldr r7,[r10,r7,lsl#2] @ Td1[s3>>16] - eor r2,r2,r5,ror#8 - ldr r8,[r10,r8,lsl#2] @ Td2[s3>>8] - mov r3,r3,lsr#24 - - ldr r9,[r10,r9,lsl#2] @ Td3[s3>>0] - eor r0,r0,r7,ror#8 - ldr r7,[r11],#16 - eor r1,r1,r8,ror#16 - ldr r3,[r10,r3,lsl#2] @ Td0[s3>>24] - eor r2,r2,r9,ror#24 - - ldr r4,[r11,#-12] - eor r0,r0,r7 - ldr r5,[r11,#-8] - eor r3,r3,r6,ror#8 - ldr r6,[r11,#-4] - and r7,lr,r0,lsr#16 - eor r1,r1,r4 - and r8,lr,r0,lsr#8 - eor r2,r2,r5 - and r9,lr,r0 - eor r3,r3,r6 - mov r0,r0,lsr#24 - - subs r12,r12,#1 - bne .Ldec_loop - - add r10,r10,#1024 - - ldr r5,[r10,#0] @ prefetch Td4 - ldr r6,[r10,#32] - ldr r4,[r10,#64] - ldr r5,[r10,#96] - ldr r6,[r10,#128] - ldr r4,[r10,#160] - ldr r5,[r10,#192] - ldr r6,[r10,#224] - - ldrb r0,[r10,r0] @ Td4[s0>>24] - ldrb r4,[r10,r7] @ Td4[s0>>16] - and r7,lr,r1 @ i0 - ldrb r5,[r10,r8] @ Td4[s0>>8] - and r8,lr,r1,lsr#16 - ldrb r6,[r10,r9] @ Td4[s0>>0] - and r9,lr,r1,lsr#8 - - ldrb r7,[r10,r7] @ Td4[s1>>0] - ldrb r1,[r10,r1,lsr#24] @ Td4[s1>>24] - ldrb r8,[r10,r8] @ Td4[s1>>16] - eor r0,r7,r0,lsl#24 - ldrb r9,[r10,r9] @ Td4[s1>>8] - eor r1,r4,r1,lsl#8 - and r7,lr,r2,lsr#8 @ i0 - eor r5,r5,r8,lsl#8 - and r8,lr,r2 @ i1 - ldrb r7,[r10,r7] @ Td4[s2>>8] - eor r6,r6,r9,lsl#8 - ldrb r8,[r10,r8] @ Td4[s2>>0] - and r9,lr,r2,lsr#16 - - ldrb r2,[r10,r2,lsr#24] @ Td4[s2>>24] - eor r0,r0,r7,lsl#8 - ldrb r9,[r10,r9] @ Td4[s2>>16] - eor r1,r8,r1,lsl#16 - and r7,lr,r3,lsr#16 @ i0 - eor r2,r5,r2,lsl#16 - and r8,lr,r3,lsr#8 @ i1 - ldrb r7,[r10,r7] @ Td4[s3>>16] - eor r6,r6,r9,lsl#16 - ldrb r8,[r10,r8] @ Td4[s3>>8] - and r9,lr,r3 @ i2 - - ldrb r9,[r10,r9] @ Td4[s3>>0] - ldrb r3,[r10,r3,lsr#24] @ Td4[s3>>24] - eor r0,r0,r7,lsl#16 - ldr r7,[r11,#0] - eor r1,r1,r8,lsl#8 - ldr r4,[r11,#4] - eor r2,r9,r2,lsl#8 - ldr r5,[r11,#8] - eor r3,r6,r3,lsl#24 - ldr r6,[r11,#12] - - eor r0,r0,r7 - eor r1,r1,r4 - eor r2,r2,r5 - eor r3,r3,r6 - - sub r10,r10,#1024 - ldr pc,[sp],#4 @ pop and return -.size _armv4_AES_decrypt,.-_armv4_AES_decrypt -.asciz "AES for ARMv4, CRYPTOGAMS by " -.align 2 diff --git a/trunk/arch/arm/crypto/aes_glue.c b/trunk/arch/arm/crypto/aes_glue.c deleted file mode 100644 index 59f7877ead6a..000000000000 --- a/trunk/arch/arm/crypto/aes_glue.c +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Glue Code for the asm optimized version of the AES Cipher Algorithm - */ - -#include -#include -#include - -#define AES_MAXNR 14 - -typedef struct { - unsigned int rd_key[4 *(AES_MAXNR + 1)]; - int rounds; -} AES_KEY; - -struct AES_CTX { - AES_KEY enc_key; - AES_KEY dec_key; -}; - -asmlinkage void AES_encrypt(const u8 *in, u8 *out, AES_KEY *ctx); -asmlinkage void AES_decrypt(const u8 *in, u8 *out, AES_KEY *ctx); -asmlinkage int private_AES_set_decrypt_key(const unsigned char *userKey, const int bits, AES_KEY *key); -asmlinkage int private_AES_set_encrypt_key(const unsigned char *userKey, const int bits, AES_KEY *key); - -static void aes_encrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src) -{ - struct AES_CTX *ctx = crypto_tfm_ctx(tfm); - AES_encrypt(src, dst, &ctx->enc_key); -} - -static void aes_decrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src) -{ - struct AES_CTX *ctx = crypto_tfm_ctx(tfm); - AES_decrypt(src, dst, &ctx->dec_key); -} - -static int aes_set_key(struct crypto_tfm *tfm, const u8 *in_key, - unsigned int key_len) -{ - struct AES_CTX *ctx = crypto_tfm_ctx(tfm); - - switch (key_len) { - case AES_KEYSIZE_128: - key_len = 128; - break; - case AES_KEYSIZE_192: - key_len = 192; - break; - case AES_KEYSIZE_256: - key_len = 256; - break; - default: - tfm->crt_flags |= CRYPTO_TFM_RES_BAD_KEY_LEN; - return -EINVAL; - } - - if (private_AES_set_encrypt_key(in_key, key_len, &ctx->enc_key) == -1) { - tfm->crt_flags |= CRYPTO_TFM_RES_BAD_KEY_LEN; - return -EINVAL; - } - /* private_AES_set_decrypt_key expects an encryption key as input */ - ctx->dec_key = ctx->enc_key; - if (private_AES_set_decrypt_key(in_key, key_len, &ctx->dec_key) == -1) { - tfm->crt_flags |= CRYPTO_TFM_RES_BAD_KEY_LEN; - return -EINVAL; - } - return 0; -} - -static struct crypto_alg aes_alg = { - .cra_name = "aes", - .cra_driver_name = "aes-asm", - .cra_priority = 200, - .cra_flags = CRYPTO_ALG_TYPE_CIPHER, - .cra_blocksize = AES_BLOCK_SIZE, - .cra_ctxsize = sizeof(struct AES_CTX), - .cra_module = THIS_MODULE, - .cra_list = LIST_HEAD_INIT(aes_alg.cra_list), - .cra_u = { - .cipher = { - .cia_min_keysize = AES_MIN_KEY_SIZE, - .cia_max_keysize = AES_MAX_KEY_SIZE, - .cia_setkey = aes_set_key, - .cia_encrypt = aes_encrypt, - .cia_decrypt = aes_decrypt - } - } -}; - -static int __init aes_init(void) -{ - return crypto_register_alg(&aes_alg); -} - -static void __exit aes_fini(void) -{ - crypto_unregister_alg(&aes_alg); -} - -module_init(aes_init); -module_exit(aes_fini); - -MODULE_DESCRIPTION("Rijndael (AES) Cipher Algorithm (ASM)"); -MODULE_LICENSE("GPL"); -MODULE_ALIAS("aes"); -MODULE_ALIAS("aes-asm"); -MODULE_AUTHOR("David McCullough "); diff --git a/trunk/arch/arm/crypto/sha1-armv4-large.S b/trunk/arch/arm/crypto/sha1-armv4-large.S deleted file mode 100644 index 7050ab133b9d..000000000000 --- a/trunk/arch/arm/crypto/sha1-armv4-large.S +++ /dev/null @@ -1,503 +0,0 @@ -#define __ARM_ARCH__ __LINUX_ARM_ARCH__ -@ ==================================================================== -@ Written by Andy Polyakov for the OpenSSL -@ project. The module is, however, dual licensed under OpenSSL and -@ CRYPTOGAMS licenses depending on where you obtain it. For further -@ details see http://www.openssl.org/~appro/cryptogams/. -@ ==================================================================== - -@ sha1_block procedure for ARMv4. -@ -@ January 2007. - -@ Size/performance trade-off -@ ==================================================================== -@ impl size in bytes comp cycles[*] measured performance -@ ==================================================================== -@ thumb 304 3212 4420 -@ armv4-small 392/+29% 1958/+64% 2250/+96% -@ armv4-compact 740/+89% 1552/+26% 1840/+22% -@ armv4-large 1420/+92% 1307/+19% 1370/+34%[***] -@ full unroll ~5100/+260% ~1260/+4% ~1300/+5% -@ ==================================================================== -@ thumb = same as 'small' but in Thumb instructions[**] and -@ with recurring code in two private functions; -@ small = detached Xload/update, loops are folded; -@ compact = detached Xload/update, 5x unroll; -@ large = interleaved Xload/update, 5x unroll; -@ full unroll = interleaved Xload/update, full unroll, estimated[!]; -@ -@ [*] Manually counted instructions in "grand" loop body. Measured -@ performance is affected by prologue and epilogue overhead, -@ i-cache availability, branch penalties, etc. -@ [**] While each Thumb instruction is twice smaller, they are not as -@ diverse as ARM ones: e.g., there are only two arithmetic -@ instructions with 3 arguments, no [fixed] rotate, addressing -@ modes are limited. As result it takes more instructions to do -@ the same job in Thumb, therefore the code is never twice as -@ small and always slower. -@ [***] which is also ~35% better than compiler generated code. Dual- -@ issue Cortex A8 core was measured to process input block in -@ ~990 cycles. - -@ August 2010. -@ -@ Rescheduling for dual-issue pipeline resulted in 13% improvement on -@ Cortex A8 core and in absolute terms ~870 cycles per input block -@ [or 13.6 cycles per byte]. - -@ February 2011. -@ -@ Profiler-assisted and platform-specific optimization resulted in 10% -@ improvement on Cortex A8 core and 12.2 cycles per byte. - -.text - -.global sha1_block_data_order -.type sha1_block_data_order,%function - -.align 2 -sha1_block_data_order: - stmdb sp!,{r4-r12,lr} - add r2,r1,r2,lsl#6 @ r2 to point at the end of r1 - ldmia r0,{r3,r4,r5,r6,r7} -.Lloop: - ldr r8,.LK_00_19 - mov r14,sp - sub sp,sp,#15*4 - mov r5,r5,ror#30 - mov r6,r6,ror#30 - mov r7,r7,ror#30 @ [6] -.L_00_15: -#if __ARM_ARCH__<7 - ldrb r10,[r1,#2] - ldrb r9,[r1,#3] - ldrb r11,[r1,#1] - add r7,r8,r7,ror#2 @ E+=K_00_19 - ldrb r12,[r1],#4 - orr r9,r9,r10,lsl#8 - eor r10,r5,r6 @ F_xx_xx - orr r9,r9,r11,lsl#16 - add r7,r7,r3,ror#27 @ E+=ROR(A,27) - orr r9,r9,r12,lsl#24 -#else - ldr r9,[r1],#4 @ handles unaligned - add r7,r8,r7,ror#2 @ E+=K_00_19 - eor r10,r5,r6 @ F_xx_xx - add r7,r7,r3,ror#27 @ E+=ROR(A,27) -#ifdef __ARMEL__ - rev r9,r9 @ byte swap -#endif -#endif - and r10,r4,r10,ror#2 - add r7,r7,r9 @ E+=X[i] - eor r10,r10,r6,ror#2 @ F_00_19(B,C,D) - str r9,[r14,#-4]! - add r7,r7,r10 @ E+=F_00_19(B,C,D) -#if __ARM_ARCH__<7 - ldrb r10,[r1,#2] - ldrb r9,[r1,#3] - ldrb r11,[r1,#1] - add r6,r8,r6,ror#2 @ E+=K_00_19 - ldrb r12,[r1],#4 - orr r9,r9,r10,lsl#8 - eor r10,r4,r5 @ F_xx_xx - orr r9,r9,r11,lsl#16 - add r6,r6,r7,ror#27 @ E+=ROR(A,27) - orr r9,r9,r12,lsl#24 -#else - ldr r9,[r1],#4 @ handles unaligned - add r6,r8,r6,ror#2 @ E+=K_00_19 - eor r10,r4,r5 @ F_xx_xx - add r6,r6,r7,ror#27 @ E+=ROR(A,27) -#ifdef __ARMEL__ - rev r9,r9 @ byte swap -#endif -#endif - and r10,r3,r10,ror#2 - add r6,r6,r9 @ E+=X[i] - eor r10,r10,r5,ror#2 @ F_00_19(B,C,D) - str r9,[r14,#-4]! - add r6,r6,r10 @ E+=F_00_19(B,C,D) -#if __ARM_ARCH__<7 - ldrb r10,[r1,#2] - ldrb r9,[r1,#3] - ldrb r11,[r1,#1] - add r5,r8,r5,ror#2 @ E+=K_00_19 - ldrb r12,[r1],#4 - orr r9,r9,r10,lsl#8 - eor r10,r3,r4 @ F_xx_xx - orr r9,r9,r11,lsl#16 - add r5,r5,r6,ror#27 @ E+=ROR(A,27) - orr r9,r9,r12,lsl#24 -#else - ldr r9,[r1],#4 @ handles unaligned - add r5,r8,r5,ror#2 @ E+=K_00_19 - eor r10,r3,r4 @ F_xx_xx - add r5,r5,r6,ror#27 @ E+=ROR(A,27) -#ifdef __ARMEL__ - rev r9,r9 @ byte swap -#endif -#endif - and r10,r7,r10,ror#2 - add r5,r5,r9 @ E+=X[i] - eor r10,r10,r4,ror#2 @ F_00_19(B,C,D) - str r9,[r14,#-4]! - add r5,r5,r10 @ E+=F_00_19(B,C,D) -#if __ARM_ARCH__<7 - ldrb r10,[r1,#2] - ldrb r9,[r1,#3] - ldrb r11,[r1,#1] - add r4,r8,r4,ror#2 @ E+=K_00_19 - ldrb r12,[r1],#4 - orr r9,r9,r10,lsl#8 - eor r10,r7,r3 @ F_xx_xx - orr r9,r9,r11,lsl#16 - add r4,r4,r5,ror#27 @ E+=ROR(A,27) - orr r9,r9,r12,lsl#24 -#else - ldr r9,[r1],#4 @ handles unaligned - add r4,r8,r4,ror#2 @ E+=K_00_19 - eor r10,r7,r3 @ F_xx_xx - add r4,r4,r5,ror#27 @ E+=ROR(A,27) -#ifdef __ARMEL__ - rev r9,r9 @ byte swap -#endif -#endif - and r10,r6,r10,ror#2 - add r4,r4,r9 @ E+=X[i] - eor r10,r10,r3,ror#2 @ F_00_19(B,C,D) - str r9,[r14,#-4]! - add r4,r4,r10 @ E+=F_00_19(B,C,D) -#if __ARM_ARCH__<7 - ldrb r10,[r1,#2] - ldrb r9,[r1,#3] - ldrb r11,[r1,#1] - add r3,r8,r3,ror#2 @ E+=K_00_19 - ldrb r12,[r1],#4 - orr r9,r9,r10,lsl#8 - eor r10,r6,r7 @ F_xx_xx - orr r9,r9,r11,lsl#16 - add r3,r3,r4,ror#27 @ E+=ROR(A,27) - orr r9,r9,r12,lsl#24 -#else - ldr r9,[r1],#4 @ handles unaligned - add r3,r8,r3,ror#2 @ E+=K_00_19 - eor r10,r6,r7 @ F_xx_xx - add r3,r3,r4,ror#27 @ E+=ROR(A,27) -#ifdef __ARMEL__ - rev r9,r9 @ byte swap -#endif -#endif - and r10,r5,r10,ror#2 - add r3,r3,r9 @ E+=X[i] - eor r10,r10,r7,ror#2 @ F_00_19(B,C,D) - str r9,[r14,#-4]! - add r3,r3,r10 @ E+=F_00_19(B,C,D) - teq r14,sp - bne .L_00_15 @ [((11+4)*5+2)*3] -#if __ARM_ARCH__<7 - ldrb r10,[r1,#2] - ldrb r9,[r1,#3] - ldrb r11,[r1,#1] - add r7,r8,r7,ror#2 @ E+=K_00_19 - ldrb r12,[r1],#4 - orr r9,r9,r10,lsl#8 - eor r10,r5,r6 @ F_xx_xx - orr r9,r9,r11,lsl#16 - add r7,r7,r3,ror#27 @ E+=ROR(A,27) - orr r9,r9,r12,lsl#24 -#else - ldr r9,[r1],#4 @ handles unaligned - add r7,r8,r7,ror#2 @ E+=K_00_19 - eor r10,r5,r6 @ F_xx_xx - add r7,r7,r3,ror#27 @ E+=ROR(A,27) -#ifdef __ARMEL__ - rev r9,r9 @ byte swap -#endif -#endif - and r10,r4,r10,ror#2 - add r7,r7,r9 @ E+=X[i] - eor r10,r10,r6,ror#2 @ F_00_19(B,C,D) - str r9,[r14,#-4]! - add r7,r7,r10 @ E+=F_00_19(B,C,D) - ldr r9,[r14,#15*4] - ldr r10,[r14,#13*4] - ldr r11,[r14,#7*4] - add r6,r8,r6,ror#2 @ E+=K_xx_xx - ldr r12,[r14,#2*4] - eor r9,r9,r10 - eor r11,r11,r12 @ 1 cycle stall - eor r10,r4,r5 @ F_xx_xx - mov r9,r9,ror#31 - add r6,r6,r7,ror#27 @ E+=ROR(A,27) - eor r9,r9,r11,ror#31 - str r9,[r14,#-4]! - and r10,r3,r10,ror#2 @ F_xx_xx - @ F_xx_xx - add r6,r6,r9 @ E+=X[i] - eor r10,r10,r5,ror#2 @ F_00_19(B,C,D) - add r6,r6,r10 @ E+=F_00_19(B,C,D) - ldr r9,[r14,#15*4] - ldr r10,[r14,#13*4] - ldr r11,[r14,#7*4] - add r5,r8,r5,ror#2 @ E+=K_xx_xx - ldr r12,[r14,#2*4] - eor r9,r9,r10 - eor r11,r11,r12 @ 1 cycle stall - eor r10,r3,r4 @ F_xx_xx - mov r9,r9,ror#31 - add r5,r5,r6,ror#27 @ E+=ROR(A,27) - eor r9,r9,r11,ror#31 - str r9,[r14,#-4]! - and r10,r7,r10,ror#2 @ F_xx_xx - @ F_xx_xx - add r5,r5,r9 @ E+=X[i] - eor r10,r10,r4,ror#2 @ F_00_19(B,C,D) - add r5,r5,r10 @ E+=F_00_19(B,C,D) - ldr r9,[r14,#15*4] - ldr r10,[r14,#13*4] - ldr r11,[r14,#7*4] - add r4,r8,r4,ror#2 @ E+=K_xx_xx - ldr r12,[r14,#2*4] - eor r9,r9,r10 - eor r11,r11,r12 @ 1 cycle stall - eor r10,r7,r3 @ F_xx_xx - mov r9,r9,ror#31 - add r4,r4,r5,ror#27 @ E+=ROR(A,27) - eor r9,r9,r11,ror#31 - str r9,[r14,#-4]! - and r10,r6,r10,ror#2 @ F_xx_xx - @ F_xx_xx - add r4,r4,r9 @ E+=X[i] - eor r10,r10,r3,ror#2 @ F_00_19(B,C,D) - add r4,r4,r10 @ E+=F_00_19(B,C,D) - ldr r9,[r14,#15*4] - ldr r10,[r14,#13*4] - ldr r11,[r14,#7*4] - add r3,r8,r3,ror#2 @ E+=K_xx_xx - ldr r12,[r14,#2*4] - eor r9,r9,r10 - eor r11,r11,r12 @ 1 cycle stall - eor r10,r6,r7 @ F_xx_xx - mov r9,r9,ror#31 - add r3,r3,r4,ror#27 @ E+=ROR(A,27) - eor r9,r9,r11,ror#31 - str r9,[r14,#-4]! - and r10,r5,r10,ror#2 @ F_xx_xx - @ F_xx_xx - add r3,r3,r9 @ E+=X[i] - eor r10,r10,r7,ror#2 @ F_00_19(B,C,D) - add r3,r3,r10 @ E+=F_00_19(B,C,D) - - ldr r8,.LK_20_39 @ [+15+16*4] - sub sp,sp,#25*4 - cmn sp,#0 @ [+3], clear carry to denote 20_39 -.L_20_39_or_60_79: - ldr r9,[r14,#15*4] - ldr r10,[r14,#13*4] - ldr r11,[r14,#7*4] - add r7,r8,r7,ror#2 @ E+=K_xx_xx - ldr r12,[r14,#2*4] - eor r9,r9,r10 - eor r11,r11,r12 @ 1 cycle stall - eor r10,r5,r6 @ F_xx_xx - mov r9,r9,ror#31 - add r7,r7,r3,ror#27 @ E+=ROR(A,27) - eor r9,r9,r11,ror#31 - str r9,[r14,#-4]! - eor r10,r4,r10,ror#2 @ F_xx_xx - @ F_xx_xx - add r7,r7,r9 @ E+=X[i] - add r7,r7,r10 @ E+=F_20_39(B,C,D) - ldr r9,[r14,#15*4] - ldr r10,[r14,#13*4] - ldr r11,[r14,#7*4] - add r6,r8,r6,ror#2 @ E+=K_xx_xx - ldr r12,[r14,#2*4] - eor r9,r9,r10 - eor r11,r11,r12 @ 1 cycle stall - eor r10,r4,r5 @ F_xx_xx - mov r9,r9,ror#31 - add r6,r6,r7,ror#27 @ E+=ROR(A,27) - eor r9,r9,r11,ror#31 - str r9,[r14,#-4]! - eor r10,r3,r10,ror#2 @ F_xx_xx - @ F_xx_xx - add r6,r6,r9 @ E+=X[i] - add r6,r6,r10 @ E+=F_20_39(B,C,D) - ldr r9,[r14,#15*4] - ldr r10,[r14,#13*4] - ldr r11,[r14,#7*4] - add r5,r8,r5,ror#2 @ E+=K_xx_xx - ldr r12,[r14,#2*4] - eor r9,r9,r10 - eor r11,r11,r12 @ 1 cycle stall - eor r10,r3,r4 @ F_xx_xx - mov r9,r9,ror#31 - add r5,r5,r6,ror#27 @ E+=ROR(A,27) - eor r9,r9,r11,ror#31 - str r9,[r14,#-4]! - eor r10,r7,r10,ror#2 @ F_xx_xx - @ F_xx_xx - add r5,r5,r9 @ E+=X[i] - add r5,r5,r10 @ E+=F_20_39(B,C,D) - ldr r9,[r14,#15*4] - ldr r10,[r14,#13*4] - ldr r11,[r14,#7*4] - add r4,r8,r4,ror#2 @ E+=K_xx_xx - ldr r12,[r14,#2*4] - eor r9,r9,r10 - eor r11,r11,r12 @ 1 cycle stall - eor r10,r7,r3 @ F_xx_xx - mov r9,r9,ror#31 - add r4,r4,r5,ror#27 @ E+=ROR(A,27) - eor r9,r9,r11,ror#31 - str r9,[r14,#-4]! - eor r10,r6,r10,ror#2 @ F_xx_xx - @ F_xx_xx - add r4,r4,r9 @ E+=X[i] - add r4,r4,r10 @ E+=F_20_39(B,C,D) - ldr r9,[r14,#15*4] - ldr r10,[r14,#13*4] - ldr r11,[r14,#7*4] - add r3,r8,r3,ror#2 @ E+=K_xx_xx - ldr r12,[r14,#2*4] - eor r9,r9,r10 - eor r11,r11,r12 @ 1 cycle stall - eor r10,r6,r7 @ F_xx_xx - mov r9,r9,ror#31 - add r3,r3,r4,ror#27 @ E+=ROR(A,27) - eor r9,r9,r11,ror#31 - str r9,[r14,#-4]! - eor r10,r5,r10,ror#2 @ F_xx_xx - @ F_xx_xx - add r3,r3,r9 @ E+=X[i] - add r3,r3,r10 @ E+=F_20_39(B,C,D) - teq r14,sp @ preserve carry - bne .L_20_39_or_60_79 @ [+((12+3)*5+2)*4] - bcs .L_done @ [+((12+3)*5+2)*4], spare 300 bytes - - ldr r8,.LK_40_59 - sub sp,sp,#20*4 @ [+2] -.L_40_59: - ldr r9,[r14,#15*4] - ldr r10,[r14,#13*4] - ldr r11,[r14,#7*4] - add r7,r8,r7,ror#2 @ E+=K_xx_xx - ldr r12,[r14,#2*4] - eor r9,r9,r10 - eor r11,r11,r12 @ 1 cycle stall - eor r10,r5,r6 @ F_xx_xx - mov r9,r9,ror#31 - add r7,r7,r3,ror#27 @ E+=ROR(A,27) - eor r9,r9,r11,ror#31 - str r9,[r14,#-4]! - and r10,r4,r10,ror#2 @ F_xx_xx - and r11,r5,r6 @ F_xx_xx - add r7,r7,r9 @ E+=X[i] - add r7,r7,r10 @ E+=F_40_59(B,C,D) - add r7,r7,r11,ror#2 - ldr r9,[r14,#15*4] - ldr r10,[r14,#13*4] - ldr r11,[r14,#7*4] - add r6,r8,r6,ror#2 @ E+=K_xx_xx - ldr r12,[r14,#2*4] - eor r9,r9,r10 - eor r11,r11,r12 @ 1 cycle stall - eor r10,r4,r5 @ F_xx_xx - mov r9,r9,ror#31 - add r6,r6,r7,ror#27 @ E+=ROR(A,27) - eor r9,r9,r11,ror#31 - str r9,[r14,#-4]! - and r10,r3,r10,ror#2 @ F_xx_xx - and r11,r4,r5 @ F_xx_xx - add r6,r6,r9 @ E+=X[i] - add r6,r6,r10 @ E+=F_40_59(B,C,D) - add r6,r6,r11,ror#2 - ldr r9,[r14,#15*4] - ldr r10,[r14,#13*4] - ldr r11,[r14,#7*4] - add r5,r8,r5,ror#2 @ E+=K_xx_xx - ldr r12,[r14,#2*4] - eor r9,r9,r10 - eor r11,r11,r12 @ 1 cycle stall - eor r10,r3,r4 @ F_xx_xx - mov r9,r9,ror#31 - add r5,r5,r6,ror#27 @ E+=ROR(A,27) - eor r9,r9,r11,ror#31 - str r9,[r14,#-4]! - and r10,r7,r10,ror#2 @ F_xx_xx - and r11,r3,r4 @ F_xx_xx - add r5,r5,r9 @ E+=X[i] - add r5,r5,r10 @ E+=F_40_59(B,C,D) - add r5,r5,r11,ror#2 - ldr r9,[r14,#15*4] - ldr r10,[r14,#13*4] - ldr r11,[r14,#7*4] - add r4,r8,r4,ror#2 @ E+=K_xx_xx - ldr r12,[r14,#2*4] - eor r9,r9,r10 - eor r11,r11,r12 @ 1 cycle stall - eor r10,r7,r3 @ F_xx_xx - mov r9,r9,ror#31 - add r4,r4,r5,ror#27 @ E+=ROR(A,27) - eor r9,r9,r11,ror#31 - str r9,[r14,#-4]! - and r10,r6,r10,ror#2 @ F_xx_xx - and r11,r7,r3 @ F_xx_xx - add r4,r4,r9 @ E+=X[i] - add r4,r4,r10 @ E+=F_40_59(B,C,D) - add r4,r4,r11,ror#2 - ldr r9,[r14,#15*4] - ldr r10,[r14,#13*4] - ldr r11,[r14,#7*4] - add r3,r8,r3,ror#2 @ E+=K_xx_xx - ldr r12,[r14,#2*4] - eor r9,r9,r10 - eor r11,r11,r12 @ 1 cycle stall - eor r10,r6,r7 @ F_xx_xx - mov r9,r9,ror#31 - add r3,r3,r4,ror#27 @ E+=ROR(A,27) - eor r9,r9,r11,ror#31 - str r9,[r14,#-4]! - and r10,r5,r10,ror#2 @ F_xx_xx - and r11,r6,r7 @ F_xx_xx - add r3,r3,r9 @ E+=X[i] - add r3,r3,r10 @ E+=F_40_59(B,C,D) - add r3,r3,r11,ror#2 - teq r14,sp - bne .L_40_59 @ [+((12+5)*5+2)*4] - - ldr r8,.LK_60_79 - sub sp,sp,#20*4 - cmp sp,#0 @ set carry to denote 60_79 - b .L_20_39_or_60_79 @ [+4], spare 300 bytes -.L_done: - add sp,sp,#80*4 @ "deallocate" stack frame - ldmia r0,{r8,r9,r10,r11,r12} - add r3,r8,r3 - add r4,r9,r4 - add r5,r10,r5,ror#2 - add r6,r11,r6,ror#2 - add r7,r12,r7,ror#2 - stmia r0,{r3,r4,r5,r6,r7} - teq r1,r2 - bne .Lloop @ [+18], total 1307 - -#if __ARM_ARCH__>=5 - ldmia sp!,{r4-r12,pc} -#else - ldmia sp!,{r4-r12,lr} - tst lr,#1 - moveq pc,lr @ be binary compatible with V4, yet - .word 0xe12fff1e @ interoperable with Thumb ISA:-) -#endif -.align 2 -.LK_00_19: .word 0x5a827999 -.LK_20_39: .word 0x6ed9eba1 -.LK_40_59: .word 0x8f1bbcdc -.LK_60_79: .word 0xca62c1d6 -.size sha1_block_data_order,.-sha1_block_data_order -.asciz "SHA1 block transform for ARMv4, CRYPTOGAMS by " -.align 2 diff --git a/trunk/arch/arm/crypto/sha1_glue.c b/trunk/arch/arm/crypto/sha1_glue.c deleted file mode 100644 index 76cd976230bc..000000000000 --- a/trunk/arch/arm/crypto/sha1_glue.c +++ /dev/null @@ -1,179 +0,0 @@ -/* - * Cryptographic API. - * Glue code for the SHA1 Secure Hash Algorithm assembler implementation - * - * This file is based on sha1_generic.c and sha1_ssse3_glue.c - * - * Copyright (c) Alan Smithee. - * Copyright (c) Andrew McDonald - * Copyright (c) Jean-Francois Dive - * Copyright (c) Mathias Krause - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the Free - * Software Foundation; either version 2 of the License, or (at your option) - * any later version. - * - */ - -#include -#include -#include -#include -#include -#include -#include - -struct SHA1_CTX { - uint32_t h0,h1,h2,h3,h4; - u64 count; - u8 data[SHA1_BLOCK_SIZE]; -}; - -asmlinkage void sha1_block_data_order(struct SHA1_CTX *digest, - const unsigned char *data, unsigned int rounds); - - -static int sha1_init(struct shash_desc *desc) -{ - struct SHA1_CTX *sctx = shash_desc_ctx(desc); - memset(sctx, 0, sizeof(*sctx)); - sctx->h0 = SHA1_H0; - sctx->h1 = SHA1_H1; - sctx->h2 = SHA1_H2; - sctx->h3 = SHA1_H3; - sctx->h4 = SHA1_H4; - return 0; -} - - -static int __sha1_update(struct SHA1_CTX *sctx, const u8 *data, - unsigned int len, unsigned int partial) -{ - unsigned int done = 0; - - sctx->count += len; - - if (partial) { - done = SHA1_BLOCK_SIZE - partial; - memcpy(sctx->data + partial, data, done); - sha1_block_data_order(sctx, sctx->data, 1); - } - - if (len - done >= SHA1_BLOCK_SIZE) { - const unsigned int rounds = (len - done) / SHA1_BLOCK_SIZE; - sha1_block_data_order(sctx, data + done, rounds); - done += rounds * SHA1_BLOCK_SIZE; - } - - memcpy(sctx->data, data + done, len - done); - return 0; -} - - -static int sha1_update(struct shash_desc *desc, const u8 *data, - unsigned int len) -{ - struct SHA1_CTX *sctx = shash_desc_ctx(desc); - unsigned int partial = sctx->count % SHA1_BLOCK_SIZE; - int res; - - /* Handle the fast case right here */ - if (partial + len < SHA1_BLOCK_SIZE) { - sctx->count += len; - memcpy(sctx->data + partial, data, len); - return 0; - } - res = __sha1_update(sctx, data, len, partial); - return res; -} - - -/* Add padding and return the message digest. */ -static int sha1_final(struct shash_desc *desc, u8 *out) -{ - struct SHA1_CTX *sctx = shash_desc_ctx(desc); - unsigned int i, index, padlen; - __be32 *dst = (__be32 *)out; - __be64 bits; - static const u8 padding[SHA1_BLOCK_SIZE] = { 0x80, }; - - bits = cpu_to_be64(sctx->count << 3); - - /* Pad out to 56 mod 64 and append length */ - index = sctx->count % SHA1_BLOCK_SIZE; - padlen = (index < 56) ? (56 - index) : ((SHA1_BLOCK_SIZE+56) - index); - /* We need to fill a whole block for __sha1_update() */ - if (padlen <= 56) { - sctx->count += padlen; - memcpy(sctx->data + index, padding, padlen); - } else { - __sha1_update(sctx, padding, padlen, index); - } - __sha1_update(sctx, (const u8 *)&bits, sizeof(bits), 56); - - /* Store state in digest */ - for (i = 0; i < 5; i++) - dst[i] = cpu_to_be32(((u32 *)sctx)[i]); - - /* Wipe context */ - memset(sctx, 0, sizeof(*sctx)); - return 0; -} - - -static int sha1_export(struct shash_desc *desc, void *out) -{ - struct SHA1_CTX *sctx = shash_desc_ctx(desc); - memcpy(out, sctx, sizeof(*sctx)); - return 0; -} - - -static int sha1_import(struct shash_desc *desc, const void *in) -{ - struct SHA1_CTX *sctx = shash_desc_ctx(desc); - memcpy(sctx, in, sizeof(*sctx)); - return 0; -} - - -static struct shash_alg alg = { - .digestsize = SHA1_DIGEST_SIZE, - .init = sha1_init, - .update = sha1_update, - .final = sha1_final, - .export = sha1_export, - .import = sha1_import, - .descsize = sizeof(struct SHA1_CTX), - .statesize = sizeof(struct SHA1_CTX), - .base = { - .cra_name = "sha1", - .cra_driver_name= "sha1-asm", - .cra_priority = 150, - .cra_flags = CRYPTO_ALG_TYPE_SHASH, - .cra_blocksize = SHA1_BLOCK_SIZE, - .cra_module = THIS_MODULE, - } -}; - - -static int __init sha1_mod_init(void) -{ - return crypto_register_shash(&alg); -} - - -static void __exit sha1_mod_fini(void) -{ - crypto_unregister_shash(&alg); -} - - -module_init(sha1_mod_init); -module_exit(sha1_mod_fini); - -MODULE_LICENSE("GPL"); -MODULE_DESCRIPTION("SHA1 Secure Hash Algorithm (ARM)"); -MODULE_ALIAS("sha1"); -MODULE_AUTHOR("David McCullough "); diff --git a/trunk/arch/arm/include/asm/barrier.h b/trunk/arch/arm/include/asm/barrier.h index 8dcd9c702d90..05112380dc53 100644 --- a/trunk/arch/arm/include/asm/barrier.h +++ b/trunk/arch/arm/include/asm/barrier.h @@ -44,9 +44,10 @@ #define rmb() dsb() #define wmb() mb() #else -#define mb() barrier() -#define rmb() barrier() -#define wmb() barrier() +#include +#define mb() do { if (arch_is_coherent()) dmb(); else barrier(); } while (0) +#define rmb() do { if (arch_is_coherent()) dmb(); else barrier(); } while (0) +#define wmb() do { if (arch_is_coherent()) dmb(); else barrier(); } while (0) #endif #ifndef CONFIG_SMP diff --git a/trunk/arch/arm/include/asm/dma-mapping.h b/trunk/arch/arm/include/asm/dma-mapping.h index 23004847bb05..5c44dcb0987b 100644 --- a/trunk/arch/arm/include/asm/dma-mapping.h +++ b/trunk/arch/arm/include/asm/dma-mapping.h @@ -13,7 +13,6 @@ #define DMA_ERROR_CODE (~0) extern struct dma_map_ops arm_dma_ops; -extern struct dma_map_ops arm_coherent_dma_ops; static inline struct dma_map_ops *get_dma_ops(struct device *dev) { diff --git a/trunk/arch/arm/include/asm/memory.h b/trunk/arch/arm/include/asm/memory.h index 73cf03aa981e..5f6ddcc56452 100644 --- a/trunk/arch/arm/include/asm/memory.h +++ b/trunk/arch/arm/include/asm/memory.h @@ -275,6 +275,14 @@ static inline __deprecated void *bus_to_virt(unsigned long x) #define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT) #define virt_addr_valid(kaddr) ((unsigned long)(kaddr) >= PAGE_OFFSET && (unsigned long)(kaddr) < (unsigned long)high_memory) +/* + * Optional coherency support. Currently used only by selected + * Intel XSC3-based systems. + */ +#ifndef arch_is_coherent +#define arch_is_coherent() 0 +#endif + #endif #include diff --git a/trunk/arch/arm/include/asm/page.h b/trunk/arch/arm/include/asm/page.h index 812a4944e783..ecf901902e44 100644 --- a/trunk/arch/arm/include/asm/page.h +++ b/trunk/arch/arm/include/asm/page.h @@ -19,7 +19,7 @@ #ifndef CONFIG_MMU -#include +#include "page-nommu.h" #else diff --git a/trunk/arch/arm/include/asm/pgtable.h b/trunk/arch/arm/include/asm/pgtable.h index 08c12312a1f9..41dc31f834c3 100644 --- a/trunk/arch/arm/include/asm/pgtable.h +++ b/trunk/arch/arm/include/asm/pgtable.h @@ -16,7 +16,7 @@ #ifndef CONFIG_MMU #include -#include +#include "pgtable-nommu.h" #else diff --git a/trunk/arch/arm/include/asm/vfpmacros.h b/trunk/arch/arm/include/asm/vfpmacros.h index a7aadbd9a6dd..3d5fc41ae8d3 100644 --- a/trunk/arch/arm/include/asm/vfpmacros.h +++ b/trunk/arch/arm/include/asm/vfpmacros.h @@ -5,7 +5,7 @@ */ #include -#include +#include "vfp.h" @ Macros to allow building with old toolkits (with no VFP support) .macro VFPFMRX, rd, sysreg, cond diff --git a/trunk/arch/arm/include/uapi/asm/Kbuild b/trunk/arch/arm/include/uapi/asm/Kbuild deleted file mode 100644 index baebb3da1d44..000000000000 --- a/trunk/arch/arm/include/uapi/asm/Kbuild +++ /dev/null @@ -1,3 +0,0 @@ -# UAPI Header export list -include include/uapi/asm-generic/Kbuild.asm - diff --git a/trunk/arch/arm/kernel/smp.c b/trunk/arch/arm/kernel/smp.c index dea7a925c7e2..aa4ffe6e5ecf 100644 --- a/trunk/arch/arm/kernel/smp.c +++ b/trunk/arch/arm/kernel/smp.c @@ -24,7 +24,6 @@ #include #include #include -#include #include #include @@ -651,56 +650,3 @@ int setup_profiling_timer(unsigned int multiplier) { return -EINVAL; } - -#ifdef CONFIG_CPU_FREQ - -static DEFINE_PER_CPU(unsigned long, l_p_j_ref); -static DEFINE_PER_CPU(unsigned long, l_p_j_ref_freq); -static unsigned long global_l_p_j_ref; -static unsigned long global_l_p_j_ref_freq; - -static int cpufreq_callback(struct notifier_block *nb, - unsigned long val, void *data) -{ - struct cpufreq_freqs *freq = data; - int cpu = freq->cpu; - - if (freq->flags & CPUFREQ_CONST_LOOPS) - return NOTIFY_OK; - - if (!per_cpu(l_p_j_ref, cpu)) { - per_cpu(l_p_j_ref, cpu) = - per_cpu(cpu_data, cpu).loops_per_jiffy; - per_cpu(l_p_j_ref_freq, cpu) = freq->old; - if (!global_l_p_j_ref) { - global_l_p_j_ref = loops_per_jiffy; - global_l_p_j_ref_freq = freq->old; - } - } - - if ((val == CPUFREQ_PRECHANGE && freq->old < freq->new) || - (val == CPUFREQ_POSTCHANGE && freq->old > freq->new) || - (val == CPUFREQ_RESUMECHANGE || val == CPUFREQ_SUSPENDCHANGE)) { - loops_per_jiffy = cpufreq_scale(global_l_p_j_ref, - global_l_p_j_ref_freq, - freq->new); - per_cpu(cpu_data, cpu).loops_per_jiffy = - cpufreq_scale(per_cpu(l_p_j_ref, cpu), - per_cpu(l_p_j_ref_freq, cpu), - freq->new); - } - return NOTIFY_OK; -} - -static struct notifier_block cpufreq_notifier = { - .notifier_call = cpufreq_callback, -}; - -static int __init register_cpufreq_notifier(void) -{ - return cpufreq_register_notifier(&cpufreq_notifier, - CPUFREQ_TRANSITION_NOTIFIER); -} -core_initcall(register_cpufreq_notifier); - -#endif diff --git a/trunk/arch/arm/mach-at91/clock.c b/trunk/arch/arm/mach-at91/clock.c index 33361505c0cd..188c82971ebd 100644 --- a/trunk/arch/arm/mach-at91/clock.c +++ b/trunk/arch/arm/mach-at91/clock.c @@ -625,7 +625,7 @@ static unsigned __init at91_pll_calc(unsigned main_freq, unsigned out_freq) return 0; } -static struct clk *const standard_pmc_clocks[] __initconst = { +static struct clk *const standard_pmc_clocks[] __initdata = { /* four primary clocks */ &clk32k, &main_clk, diff --git a/trunk/arch/arm/mach-davinci/board-tnetv107x-evm.c b/trunk/arch/arm/mach-davinci/board-tnetv107x-evm.c index be3099733b1f..ac4e003ad863 100644 --- a/trunk/arch/arm/mach-davinci/board-tnetv107x-evm.c +++ b/trunk/arch/arm/mach-davinci/board-tnetv107x-evm.c @@ -88,7 +88,7 @@ static struct davinci_mmc_config mmc_config = { .version = MMC_CTLR_VERSION_1, }; -static const short sdio1_pins[] __initconst = { +static const short sdio1_pins[] __initdata = { TNETV107X_SDIO1_CLK_1, TNETV107X_SDIO1_CMD_1, TNETV107X_SDIO1_DATA0_1, TNETV107X_SDIO1_DATA1_1, TNETV107X_SDIO1_DATA2_1, TNETV107X_SDIO1_DATA3_1, @@ -96,12 +96,12 @@ static const short sdio1_pins[] __initconst = { -1 }; -static const short uart1_pins[] __initconst = { +static const short uart1_pins[] __initdata = { TNETV107X_UART1_RD, TNETV107X_UART1_TD, -1 }; -static const short ssp_pins[] __initconst = { +static const short ssp_pins[] __initdata = { TNETV107X_SSP0_0, TNETV107X_SSP0_1, TNETV107X_SSP0_2, TNETV107X_SSP1_0, TNETV107X_SSP1_1, TNETV107X_SSP1_2, TNETV107X_SSP1_3, -1 diff --git a/trunk/arch/arm/mach-davinci/da830.c b/trunk/arch/arm/mach-davinci/da830.c index 510648e0394b..deee5c2da754 100644 --- a/trunk/arch/arm/mach-davinci/da830.c +++ b/trunk/arch/arm/mach-davinci/da830.c @@ -838,7 +838,7 @@ static const struct mux_config da830_pins[] = { #endif }; -const short da830_emif25_pins[] __initconst = { +const short da830_emif25_pins[] __initdata = { DA830_EMA_D_0, DA830_EMA_D_1, DA830_EMA_D_2, DA830_EMA_D_3, DA830_EMA_D_4, DA830_EMA_D_5, DA830_EMA_D_6, DA830_EMA_D_7, DA830_EMA_D_8, DA830_EMA_D_9, DA830_EMA_D_10, DA830_EMA_D_11, @@ -853,19 +853,19 @@ const short da830_emif25_pins[] __initconst = { -1 }; -const short da830_spi0_pins[] __initconst = { +const short da830_spi0_pins[] __initdata = { DA830_SPI0_SOMI_0, DA830_SPI0_SIMO_0, DA830_SPI0_CLK, DA830_NSPI0_ENA, DA830_NSPI0_SCS_0, -1 }; -const short da830_spi1_pins[] __initconst = { +const short da830_spi1_pins[] __initdata = { DA830_SPI1_SOMI_0, DA830_SPI1_SIMO_0, DA830_SPI1_CLK, DA830_NSPI1_ENA, DA830_NSPI1_SCS_0, -1 }; -const short da830_mmc_sd_pins[] __initconst = { +const short da830_mmc_sd_pins[] __initdata = { DA830_MMCSD_DAT_0, DA830_MMCSD_DAT_1, DA830_MMCSD_DAT_2, DA830_MMCSD_DAT_3, DA830_MMCSD_DAT_4, DA830_MMCSD_DAT_5, DA830_MMCSD_DAT_6, DA830_MMCSD_DAT_7, DA830_MMCSD_CLK, @@ -873,32 +873,32 @@ const short da830_mmc_sd_pins[] __initconst = { -1 }; -const short da830_uart0_pins[] __initconst = { +const short da830_uart0_pins[] __initdata = { DA830_NUART0_CTS, DA830_NUART0_RTS, DA830_UART0_RXD, DA830_UART0_TXD, -1 }; -const short da830_uart1_pins[] __initconst = { +const short da830_uart1_pins[] __initdata = { DA830_UART1_RXD, DA830_UART1_TXD, -1 }; -const short da830_uart2_pins[] __initconst = { +const short da830_uart2_pins[] __initdata = { DA830_UART2_RXD, DA830_UART2_TXD, -1 }; -const short da830_usb20_pins[] __initconst = { +const short da830_usb20_pins[] __initdata = { DA830_USB0_DRVVBUS, DA830_USB_REFCLKIN, -1 }; -const short da830_usb11_pins[] __initconst = { +const short da830_usb11_pins[] __initdata = { DA830_USB_REFCLKIN, -1 }; -const short da830_uhpi_pins[] __initconst = { +const short da830_uhpi_pins[] __initdata = { DA830_UHPI_HD_0, DA830_UHPI_HD_1, DA830_UHPI_HD_2, DA830_UHPI_HD_3, DA830_UHPI_HD_4, DA830_UHPI_HD_5, DA830_UHPI_HD_6, DA830_UHPI_HD_7, DA830_UHPI_HD_8, DA830_UHPI_HD_9, DA830_UHPI_HD_10, DA830_UHPI_HD_11, @@ -909,14 +909,14 @@ const short da830_uhpi_pins[] __initconst = { -1 }; -const short da830_cpgmac_pins[] __initconst = { +const short da830_cpgmac_pins[] __initdata = { DA830_RMII_TXD_0, DA830_RMII_TXD_1, DA830_RMII_TXEN, DA830_RMII_CRS_DV, DA830_RMII_RXD_0, DA830_RMII_RXD_1, DA830_RMII_RXER, DA830_MDIO_CLK, DA830_MDIO_D, -1 }; -const short da830_emif3c_pins[] __initconst = { +const short da830_emif3c_pins[] __initdata = { DA830_EMB_SDCKE, DA830_EMB_CLK_GLUE, DA830_EMB_CLK, DA830_NEMB_CS_0, DA830_NEMB_CAS, DA830_NEMB_RAS, DA830_NEMB_WE, DA830_EMB_BA_1, DA830_EMB_BA_0, DA830_EMB_A_0, DA830_EMB_A_1, DA830_EMB_A_2, @@ -935,7 +935,7 @@ const short da830_emif3c_pins[] __initconst = { -1 }; -const short da830_mcasp0_pins[] __initconst = { +const short da830_mcasp0_pins[] __initdata = { DA830_AHCLKX0, DA830_ACLKX0, DA830_AFSX0, DA830_AHCLKR0, DA830_ACLKR0, DA830_AFSR0, DA830_AMUTE0, DA830_AXR0_0, DA830_AXR0_1, DA830_AXR0_2, DA830_AXR0_3, @@ -945,7 +945,7 @@ const short da830_mcasp0_pins[] __initconst = { -1 }; -const short da830_mcasp1_pins[] __initconst = { +const short da830_mcasp1_pins[] __initdata = { DA830_AHCLKX1, DA830_ACLKX1, DA830_AFSX1, DA830_AHCLKR1, DA830_ACLKR1, DA830_AFSR1, DA830_AMUTE1, DA830_AXR1_0, DA830_AXR1_1, DA830_AXR1_2, DA830_AXR1_3, @@ -954,24 +954,24 @@ const short da830_mcasp1_pins[] __initconst = { -1 }; -const short da830_mcasp2_pins[] __initconst = { +const short da830_mcasp2_pins[] __initdata = { DA830_AHCLKX2, DA830_ACLKX2, DA830_AFSX2, DA830_AHCLKR2, DA830_ACLKR2, DA830_AFSR2, DA830_AMUTE2, DA830_AXR2_0, DA830_AXR2_1, DA830_AXR2_2, DA830_AXR2_3, -1 }; -const short da830_i2c0_pins[] __initconst = { +const short da830_i2c0_pins[] __initdata = { DA830_I2C0_SDA, DA830_I2C0_SCL, -1 }; -const short da830_i2c1_pins[] __initconst = { +const short da830_i2c1_pins[] __initdata = { DA830_I2C1_SCL, DA830_I2C1_SDA, -1 }; -const short da830_lcdcntl_pins[] __initconst = { +const short da830_lcdcntl_pins[] __initdata = { DA830_LCD_D_0, DA830_LCD_D_1, DA830_LCD_D_2, DA830_LCD_D_3, DA830_LCD_D_4, DA830_LCD_D_5, DA830_LCD_D_6, DA830_LCD_D_7, DA830_LCD_D_8, DA830_LCD_D_9, DA830_LCD_D_10, DA830_LCD_D_11, @@ -981,34 +981,34 @@ const short da830_lcdcntl_pins[] __initconst = { -1 }; -const short da830_pwm_pins[] __initconst = { +const short da830_pwm_pins[] __initdata = { DA830_ECAP0_APWM0, DA830_ECAP1_APWM1, DA830_EPWM0B, DA830_EPWM0A, DA830_EPWMSYNCI, DA830_EPWMSYNC0, DA830_ECAP2_APWM2, DA830_EHRPWMGLUETZ, DA830_EPWM2B, DA830_EPWM2A, DA830_EPWM1B, DA830_EPWM1A, -1 }; -const short da830_ecap0_pins[] __initconst = { +const short da830_ecap0_pins[] __initdata = { DA830_ECAP0_APWM0, -1 }; -const short da830_ecap1_pins[] __initconst = { +const short da830_ecap1_pins[] __initdata = { DA830_ECAP1_APWM1, -1 }; -const short da830_ecap2_pins[] __initconst = { +const short da830_ecap2_pins[] __initdata = { DA830_ECAP2_APWM2, -1 }; -const short da830_eqep0_pins[] __initconst = { +const short da830_eqep0_pins[] __initdata = { DA830_EQEP0I, DA830_EQEP0S, DA830_EQEP0A, DA830_EQEP0B, -1 }; -const short da830_eqep1_pins[] __initconst = { +const short da830_eqep1_pins[] __initdata = { DA830_EQEP1I, DA830_EQEP1S, DA830_EQEP1A, DA830_EQEP1B, -1 }; diff --git a/trunk/arch/arm/mach-davinci/da850.c b/trunk/arch/arm/mach-davinci/da850.c index 6676dee7104e..b44dc844e15e 100644 --- a/trunk/arch/arm/mach-davinci/da850.c +++ b/trunk/arch/arm/mach-davinci/da850.c @@ -576,17 +576,17 @@ static const struct mux_config da850_pins[] = { #endif }; -const short da850_i2c0_pins[] __initconst = { +const short da850_i2c0_pins[] __initdata = { DA850_I2C0_SDA, DA850_I2C0_SCL, -1 }; -const short da850_i2c1_pins[] __initconst = { +const short da850_i2c1_pins[] __initdata = { DA850_I2C1_SCL, DA850_I2C1_SDA, -1 }; -const short da850_lcdcntl_pins[] __initconst = { +const short da850_lcdcntl_pins[] __initdata = { DA850_LCD_D_0, DA850_LCD_D_1, DA850_LCD_D_2, DA850_LCD_D_3, DA850_LCD_D_4, DA850_LCD_D_5, DA850_LCD_D_6, DA850_LCD_D_7, DA850_LCD_D_8, DA850_LCD_D_9, DA850_LCD_D_10, DA850_LCD_D_11, diff --git a/trunk/arch/arm/mach-highbank/highbank.c b/trunk/arch/arm/mach-highbank/highbank.c index 40e36a50304c..af1da34ccf9d 100644 --- a/trunk/arch/arm/mach-highbank/highbank.c +++ b/trunk/arch/arm/mach-highbank/highbank.c @@ -15,7 +15,6 @@ */ #include #include -#include #include #include #include @@ -24,7 +23,6 @@ #include #include #include -#include #include #include @@ -151,61 +149,11 @@ static void highbank_power_off(void) cpu_do_idle(); } -static int highbank_platform_notifier(struct notifier_block *nb, - unsigned long event, void *__dev) -{ - struct resource *res; - int reg = -1; - struct device *dev = __dev; - - if (event != BUS_NOTIFY_ADD_DEVICE) - return NOTIFY_DONE; - - if (of_device_is_compatible(dev->of_node, "calxeda,hb-ahci")) - reg = 0xc; - else if (of_device_is_compatible(dev->of_node, "calxeda,hb-sdhci")) - reg = 0x18; - else if (of_device_is_compatible(dev->of_node, "arm,pl330")) - reg = 0x20; - else if (of_device_is_compatible(dev->of_node, "calxeda,hb-xgmac")) { - res = platform_get_resource(to_platform_device(dev), - IORESOURCE_MEM, 0); - if (res) { - if (res->start == 0xfff50000) - reg = 0; - else if (res->start == 0xfff51000) - reg = 4; - } - } - - if (reg < 0) - return NOTIFY_DONE; - - if (of_property_read_bool(dev->of_node, "dma-coherent")) { - writel(0xff31, sregs_base + reg); - set_dma_ops(dev, &arm_coherent_dma_ops); - } else - writel(0, sregs_base + reg); - - return NOTIFY_OK; -} - -static struct notifier_block highbank_amba_nb = { - .notifier_call = highbank_platform_notifier, -}; - -static struct notifier_block highbank_platform_nb = { - .notifier_call = highbank_platform_notifier, -}; - static void __init highbank_init(void) { pm_power_off = highbank_power_off; highbank_pm_init(); - bus_register_notifier(&platform_bus_type, &highbank_platform_nb); - bus_register_notifier(&amba_bustype, &highbank_amba_nb); - of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); } diff --git a/trunk/arch/arm/mach-imx/Kconfig b/trunk/arch/arm/mach-imx/Kconfig index 32197c117afe..3a2042fb9712 100644 --- a/trunk/arch/arm/mach-imx/Kconfig +++ b/trunk/arch/arm/mach-imx/Kconfig @@ -758,7 +758,7 @@ config SOC_IMX6Q select HAVE_IMX_MMDC select HAVE_IMX_SRC select HAVE_SMP - select MFD_SYSCON + select MFD_ANATOP select PINCTRL select PINCTRL_IMX6Q diff --git a/trunk/arch/arm/mach-imx/mach-imx6q.c b/trunk/arch/arm/mach-imx/mach-imx6q.c index 47c91f7185d2..36979d3dfe34 100644 --- a/trunk/arch/arm/mach-imx/mach-imx6q.c +++ b/trunk/arch/arm/mach-imx/mach-imx6q.c @@ -23,9 +23,8 @@ #include #include #include -#include #include -#include +#include #include #include #include @@ -119,7 +118,20 @@ static void __init imx6q_sabrelite_init(void) static void __init imx6q_usb_init(void) { - struct regmap *anatop; + struct device_node *np; + struct platform_device *pdev = NULL; + struct anatop *adata = NULL; + + np = of_find_compatible_node(NULL, NULL, "fsl,imx6q-anatop"); + if (np) + pdev = of_find_device_by_node(np); + if (pdev) + adata = platform_get_drvdata(pdev); + if (!adata) { + if (np) + of_node_put(np); + return; + } #define HW_ANADIG_USB1_CHRG_DETECT 0x000001b0 #define HW_ANADIG_USB2_CHRG_DETECT 0x00000210 @@ -127,21 +139,20 @@ static void __init imx6q_usb_init(void) #define BM_ANADIG_USB_CHRG_DETECT_EN_B 0x00100000 #define BM_ANADIG_USB_CHRG_DETECT_CHK_CHRG_B 0x00080000 - anatop = syscon_regmap_lookup_by_compatible("fsl,imx6q-anatop"); - if (!IS_ERR(anatop)) { - /* - * The external charger detector needs to be disabled, - * or the signal at DP will be poor - */ - regmap_write(anatop, HW_ANADIG_USB1_CHRG_DETECT, - BM_ANADIG_USB_CHRG_DETECT_EN_B - | BM_ANADIG_USB_CHRG_DETECT_CHK_CHRG_B); - regmap_write(anatop, HW_ANADIG_USB2_CHRG_DETECT, - BM_ANADIG_USB_CHRG_DETECT_EN_B | - BM_ANADIG_USB_CHRG_DETECT_CHK_CHRG_B); - } else { - pr_warn("failed to find fsl,imx6q-anatop regmap\n"); - } + /* + * The external charger detector needs to be disabled, + * or the signal at DP will be poor + */ + anatop_write_reg(adata, HW_ANADIG_USB1_CHRG_DETECT, + BM_ANADIG_USB_CHRG_DETECT_EN_B + | BM_ANADIG_USB_CHRG_DETECT_CHK_CHRG_B, + ~0); + anatop_write_reg(adata, HW_ANADIG_USB2_CHRG_DETECT, + BM_ANADIG_USB_CHRG_DETECT_EN_B | + BM_ANADIG_USB_CHRG_DETECT_CHK_CHRG_B, + ~0); + + of_node_put(np); } static void __init imx6q_init_machine(void) diff --git a/trunk/arch/arm/mach-msm/board-qsd8x50.c b/trunk/arch/arm/mach-msm/board-qsd8x50.c index 2448fcf09eb1..a344a373928b 100644 --- a/trunk/arch/arm/mach-msm/board-qsd8x50.c +++ b/trunk/arch/arm/mach-msm/board-qsd8x50.c @@ -37,8 +37,8 @@ #include "devices.h" #include "common.h" -static const resource_size_t qsd8x50_surf_smc91x_base __initconst = 0x70000300; -static const unsigned qsd8x50_surf_smc91x_gpio __initconst = 156; +static const resource_size_t qsd8x50_surf_smc91x_base __initdata = 0x70000300; +static const unsigned qsd8x50_surf_smc91x_gpio __initdata = 156; /* Leave smc91x resources empty here, as we'll fill them in * at run-time: they vary from board to board, and the true diff --git a/trunk/arch/arm/mach-omap2/display.c b/trunk/arch/arm/mach-omap2/display.c index e470c6e50acd..af1ed7d24a1f 100644 --- a/trunk/arch/arm/mach-omap2/display.c +++ b/trunk/arch/arm/mach-omap2/display.c @@ -76,14 +76,14 @@ struct omap_dss_hwmod_data { const int id; }; -static const struct omap_dss_hwmod_data omap2_dss_hwmod_data[] __initconst = { +static const struct omap_dss_hwmod_data omap2_dss_hwmod_data[] __initdata = { { "dss_core", "omapdss_dss", -1 }, { "dss_dispc", "omapdss_dispc", -1 }, { "dss_rfbi", "omapdss_rfbi", -1 }, { "dss_venc", "omapdss_venc", -1 }, }; -static const struct omap_dss_hwmod_data omap3_dss_hwmod_data[] __initconst = { +static const struct omap_dss_hwmod_data omap3_dss_hwmod_data[] __initdata = { { "dss_core", "omapdss_dss", -1 }, { "dss_dispc", "omapdss_dispc", -1 }, { "dss_rfbi", "omapdss_rfbi", -1 }, @@ -91,7 +91,7 @@ static const struct omap_dss_hwmod_data omap3_dss_hwmod_data[] __initconst = { { "dss_dsi1", "omapdss_dsi", 0 }, }; -static const struct omap_dss_hwmod_data omap4_dss_hwmod_data[] __initconst = { +static const struct omap_dss_hwmod_data omap4_dss_hwmod_data[] __initdata = { { "dss_core", "omapdss_dss", -1 }, { "dss_dispc", "omapdss_dispc", -1 }, { "dss_rfbi", "omapdss_rfbi", -1 }, diff --git a/trunk/arch/arm/mach-omap2/usb-host.c b/trunk/arch/arm/mach-omap2/usb-host.c index 3c434498e12e..ac95daaa4702 100644 --- a/trunk/arch/arm/mach-omap2/usb-host.c +++ b/trunk/arch/arm/mach-omap2/usb-host.c @@ -33,12 +33,10 @@ #ifdef CONFIG_MFD_OMAP_USB_HOST #define OMAP_USBHS_DEVICE "usbhs_omap" -#define OMAP_USBTLL_DEVICE "usbhs_tll" #define USBHS_UHH_HWMODNAME "usb_host_hs" #define USBHS_TLL_HWMODNAME "usb_tll_hs" static struct usbhs_omap_platform_data usbhs_data; -static struct usbtll_omap_platform_data usbtll_data; static struct ehci_hcd_omap_platform_data ehci_data; static struct ohci_hcd_omap_platform_data ohci_data; @@ -487,14 +485,13 @@ void __init setup_4430ohci_io_mux(const enum usbhs_omap_port_mode *port_mode) void __init usbhs_init(const struct usbhs_omap_board_data *pdata) { - struct omap_hwmod *uhh_hwm, *tll_hwm; + struct omap_hwmod *oh[2]; struct platform_device *pdev; int bus_id = -1; int i; for (i = 0; i < OMAP3_HS_USB_PORTS; i++) { usbhs_data.port_mode[i] = pdata->port_mode[i]; - usbtll_data.port_mode[i] = pdata->port_mode[i]; ohci_data.port_mode[i] = pdata->port_mode[i]; ehci_data.port_mode[i] = pdata->port_mode[i]; ehci_data.reset_gpio_port[i] = pdata->reset_gpio_port[i]; @@ -513,35 +510,25 @@ void __init usbhs_init(const struct usbhs_omap_board_data *pdata) setup_4430ohci_io_mux(pdata->port_mode); } - uhh_hwm = omap_hwmod_lookup(USBHS_UHH_HWMODNAME); - if (!uhh_hwm) { + oh[0] = omap_hwmod_lookup(USBHS_UHH_HWMODNAME); + if (!oh[0]) { pr_err("Could not look up %s\n", USBHS_UHH_HWMODNAME); return; } - tll_hwm = omap_hwmod_lookup(USBHS_TLL_HWMODNAME); - if (!tll_hwm) { + oh[1] = omap_hwmod_lookup(USBHS_TLL_HWMODNAME); + if (!oh[1]) { pr_err("Could not look up %s\n", USBHS_TLL_HWMODNAME); return; } - pdev = omap_device_build(OMAP_USBTLL_DEVICE, bus_id, tll_hwm, - &usbtll_data, sizeof(usbtll_data), + pdev = omap_device_build_ss(OMAP_USBHS_DEVICE, bus_id, oh, 2, + (void *)&usbhs_data, sizeof(usbhs_data), omap_uhhtll_latency, ARRAY_SIZE(omap_uhhtll_latency), false); if (IS_ERR(pdev)) { - pr_err("Could not build hwmod device %s\n", - USBHS_TLL_HWMODNAME); - return; - } - - pdev = omap_device_build(OMAP_USBHS_DEVICE, bus_id, uhh_hwm, - &usbhs_data, sizeof(usbhs_data), - omap_uhhtll_latency, - ARRAY_SIZE(omap_uhhtll_latency), false); - if (IS_ERR(pdev)) { - pr_err("Could not build hwmod devices %s\n", - USBHS_UHH_HWMODNAME); + pr_err("Could not build hwmod devices %s,%s\n", + USBHS_UHH_HWMODNAME, USBHS_TLL_HWMODNAME); return; } } diff --git a/trunk/arch/arm/mach-shmobile/Makefile b/trunk/arch/arm/mach-shmobile/Makefile index fe2c97c179d1..0df5ae6740c6 100644 --- a/trunk/arch/arm/mach-shmobile/Makefile +++ b/trunk/arch/arm/mach-shmobile/Makefile @@ -3,7 +3,7 @@ # # Common objects -obj-y := timer.o console.o clock.o +obj-y := timer.o console.o clock.o common.o # CPU objects obj-$(CONFIG_ARCH_SH7367) += setup-sh7367.o clock-sh7367.o intc-sh7367.o diff --git a/trunk/arch/arm/mach-shmobile/board-ap4evb.c b/trunk/arch/arm/mach-shmobile/board-ap4evb.c index 790dc68c4312..bc3b5da59e25 100644 --- a/trunk/arch/arm/mach-shmobile/board-ap4evb.c +++ b/trunk/arch/arm/mach-shmobile/board-ap4evb.c @@ -1231,15 +1231,6 @@ static struct i2c_board_info i2c1_devices[] = { #define USCCR1 IOMEM(0xE6058144) static void __init ap4evb_init(void) { - struct pm_domain_device domain_devices[] = { - { "A4LC", &lcdc1_device, }, - { "A4LC", &lcdc_device, }, - { "A4MP", &fsi_device, }, - { "A3SP", &sh_mmcif_device, }, - { "A3SP", &sdhi0_device, }, - { "A3SP", &sdhi1_device, }, - { "A4R", &ceu_device, }, - }; u32 srcr4; struct clk *clk; @@ -1472,8 +1463,14 @@ static void __init ap4evb_init(void) platform_add_devices(ap4evb_devices, ARRAY_SIZE(ap4evb_devices)); - rmobile_add_devices_to_domains(domain_devices, - ARRAY_SIZE(domain_devices)); + rmobile_add_device_to_domain(&sh7372_pd_a4lc, &lcdc1_device); + rmobile_add_device_to_domain(&sh7372_pd_a4lc, &lcdc_device); + rmobile_add_device_to_domain(&sh7372_pd_a4mp, &fsi_device); + + rmobile_add_device_to_domain(&sh7372_pd_a3sp, &sh_mmcif_device); + rmobile_add_device_to_domain(&sh7372_pd_a3sp, &sdhi0_device); + rmobile_add_device_to_domain(&sh7372_pd_a3sp, &sdhi1_device); + rmobile_add_device_to_domain(&sh7372_pd_a4r, &ceu_device); hdmi_init_pm_clock(); fsi_init_pm_clock(); @@ -1488,6 +1485,6 @@ MACHINE_START(AP4EVB, "ap4evb") .init_irq = sh7372_init_irq, .handle_irq = shmobile_handle_irq_intc, .init_machine = ap4evb_init, - .init_late = sh7372_pm_init_late, + .init_late = shmobile_init_late, .timer = &shmobile_timer, MACHINE_END diff --git a/trunk/arch/arm/mach-shmobile/board-armadillo800eva.c b/trunk/arch/arm/mach-shmobile/board-armadillo800eva.c index 2912eab3b967..c6593d394273 100644 --- a/trunk/arch/arm/mach-shmobile/board-armadillo800eva.c +++ b/trunk/arch/arm/mach-shmobile/board-armadillo800eva.c @@ -1209,10 +1209,10 @@ static void __init eva_init(void) eva_clock_init(); - rmobile_add_device_to_domain("A4LC", &lcdc0_device); - rmobile_add_device_to_domain("A4LC", &hdmi_lcdc_device); + rmobile_add_device_to_domain(&r8a7740_pd_a4lc, &lcdc0_device); + rmobile_add_device_to_domain(&r8a7740_pd_a4lc, &hdmi_lcdc_device); if (usb) - rmobile_add_device_to_domain("A3SP", usb); + rmobile_add_device_to_domain(&r8a7740_pd_a3sp, usb); } static void __init eva_earlytimer_init(void) diff --git a/trunk/arch/arm/mach-shmobile/board-mackerel.c b/trunk/arch/arm/mach-shmobile/board-mackerel.c index 0c27c810cf99..62783b5d8813 100644 --- a/trunk/arch/arm/mach-shmobile/board-mackerel.c +++ b/trunk/arch/arm/mach-shmobile/board-mackerel.c @@ -1412,22 +1412,6 @@ static struct i2c_board_info i2c1_devices[] = { #define USCCR1 IOMEM(0xE6058144) static void __init mackerel_init(void) { - struct pm_domain_device domain_devices[] = { - { "A4LC", &lcdc_device, }, - { "A4LC", &hdmi_lcdc_device, }, - { "A4LC", &meram_device, }, - { "A4MP", &fsi_device, }, - { "A3SP", &usbhs0_device, }, - { "A3SP", &usbhs1_device, }, - { "A3SP", &nand_flash_device, }, - { "A3SP", &sh_mmcif_device, }, - { "A3SP", &sdhi0_device, }, -#if !defined(CONFIG_MMC_SH_MMCIF) && !defined(CONFIG_MMC_SH_MMCIF_MODULE) - { "A3SP", &sdhi1_device, }, -#endif - { "A3SP", &sdhi2_device, }, - { "A4R", &ceu_device, }, - }; u32 srcr4; struct clk *clk; @@ -1642,8 +1626,20 @@ static void __init mackerel_init(void) platform_add_devices(mackerel_devices, ARRAY_SIZE(mackerel_devices)); - rmobile_add_devices_to_domains(domain_devices, - ARRAY_SIZE(domain_devices)); + rmobile_add_device_to_domain(&sh7372_pd_a4lc, &lcdc_device); + rmobile_add_device_to_domain(&sh7372_pd_a4lc, &hdmi_lcdc_device); + rmobile_add_device_to_domain(&sh7372_pd_a4lc, &meram_device); + rmobile_add_device_to_domain(&sh7372_pd_a4mp, &fsi_device); + rmobile_add_device_to_domain(&sh7372_pd_a3sp, &usbhs0_device); + rmobile_add_device_to_domain(&sh7372_pd_a3sp, &usbhs1_device); + rmobile_add_device_to_domain(&sh7372_pd_a3sp, &nand_flash_device); + rmobile_add_device_to_domain(&sh7372_pd_a3sp, &sh_mmcif_device); + rmobile_add_device_to_domain(&sh7372_pd_a3sp, &sdhi0_device); +#if !defined(CONFIG_MMC_SH_MMCIF) && !defined(CONFIG_MMC_SH_MMCIF_MODULE) + rmobile_add_device_to_domain(&sh7372_pd_a3sp, &sdhi1_device); +#endif + rmobile_add_device_to_domain(&sh7372_pd_a3sp, &sdhi2_device); + rmobile_add_device_to_domain(&sh7372_pd_a4r, &ceu_device); hdmi_init_pm_clock(); sh7372_pm_init(); @@ -1657,6 +1653,6 @@ MACHINE_START(MACKEREL, "mackerel") .init_irq = sh7372_init_irq, .handle_irq = shmobile_handle_irq_intc, .init_machine = mackerel_init, - .init_late = sh7372_pm_init_late, + .init_late = shmobile_init_late, .timer = &shmobile_timer, MACHINE_END diff --git a/trunk/arch/arm/mach-shmobile/common.c b/trunk/arch/arm/mach-shmobile/common.c new file mode 100644 index 000000000000..608aba9d60d7 --- /dev/null +++ b/trunk/arch/arm/mach-shmobile/common.c @@ -0,0 +1,24 @@ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + */ +#include +#include +#include + +void __init shmobile_init_late(void) +{ + shmobile_suspend_init(); + shmobile_cpuidle_init(); +} diff --git a/trunk/arch/arm/mach-shmobile/cpuidle.c b/trunk/arch/arm/mach-shmobile/cpuidle.c index 9e050268cde4..7b541e911ab4 100644 --- a/trunk/arch/arm/mach-shmobile/cpuidle.c +++ b/trunk/arch/arm/mach-shmobile/cpuidle.c @@ -16,38 +16,51 @@ #include #include -int shmobile_enter_wfi(struct cpuidle_device *dev, struct cpuidle_driver *drv, - int index) +static void shmobile_enter_wfi(void) { cpu_do_idle(); - return 0; +} + +void (*shmobile_cpuidle_modes[CPUIDLE_STATE_MAX])(void) = { + shmobile_enter_wfi, /* regular sleep mode */ +}; + +static int shmobile_cpuidle_enter(struct cpuidle_device *dev, + struct cpuidle_driver *drv, + int index) +{ + shmobile_cpuidle_modes[index](); + + return index; } static struct cpuidle_device shmobile_cpuidle_dev; -static struct cpuidle_driver shmobile_cpuidle_default_driver = { +static struct cpuidle_driver shmobile_cpuidle_driver = { .name = "shmobile_cpuidle", .owner = THIS_MODULE, .en_core_tk_irqen = 1, .states[0] = ARM_CPUIDLE_WFI_STATE, - .states[0].enter = shmobile_enter_wfi, .safe_state_index = 0, /* C1 */ .state_count = 1, }; -static struct cpuidle_driver *cpuidle_drv = &shmobile_cpuidle_default_driver; - -void shmobile_cpuidle_set_driver(struct cpuidle_driver *drv) -{ - cpuidle_drv = drv; -} +void (*shmobile_cpuidle_setup)(struct cpuidle_driver *drv); int shmobile_cpuidle_init(void) { struct cpuidle_device *dev = &shmobile_cpuidle_dev; + struct cpuidle_driver *drv = &shmobile_cpuidle_driver; + int i; + + for (i = 0; i < CPUIDLE_STATE_MAX; i++) + drv->states[i].enter = shmobile_cpuidle_enter; + + if (shmobile_cpuidle_setup) + shmobile_cpuidle_setup(drv); - cpuidle_register_driver(cpuidle_drv); + cpuidle_register_driver(drv); - dev->state_count = cpuidle_drv->state_count; + dev->state_count = drv->state_count; cpuidle_register_device(dev); return 0; diff --git a/trunk/arch/arm/mach-shmobile/include/mach/common.h b/trunk/arch/arm/mach-shmobile/include/mach/common.h index ed77ab8c9143..f80f9c549393 100644 --- a/trunk/arch/arm/mach-shmobile/include/mach/common.h +++ b/trunk/arch/arm/mach-shmobile/include/mach/common.h @@ -13,10 +13,8 @@ extern int shmobile_clk_init(void); extern void shmobile_handle_irq_intc(struct pt_regs *); extern struct platform_suspend_ops shmobile_suspend_ops; struct cpuidle_driver; -struct cpuidle_device; -extern int shmobile_enter_wfi(struct cpuidle_device *dev, - struct cpuidle_driver *drv, int index); -extern void shmobile_cpuidle_set_driver(struct cpuidle_driver *drv); +extern void (*shmobile_cpuidle_modes[])(void); +extern void (*shmobile_cpuidle_setup)(struct cpuidle_driver *drv); extern void sh7367_init_irq(void); extern void sh7367_map_io(void); @@ -77,6 +75,8 @@ extern void r8a7740_meram_workaround(void); extern void r8a7779_register_twd(void); +extern void shmobile_init_late(void); + #ifdef CONFIG_SUSPEND int shmobile_suspend_init(void); #else @@ -100,10 +100,4 @@ static inline int shmobile_cpu_is_dead(unsigned int cpu) { return 1; } extern void shmobile_smp_init_cpus(unsigned int ncores); -static inline void shmobile_init_late(void) -{ - shmobile_suspend_init(); - shmobile_cpuidle_init(); -} - #endif /* __ARCH_MACH_COMMON_H */ diff --git a/trunk/arch/arm/mach-shmobile/include/mach/pm-rmobile.h b/trunk/arch/arm/mach-shmobile/include/mach/pm-rmobile.h index 690553a06887..5a402840fe28 100644 --- a/trunk/arch/arm/mach-shmobile/include/mach/pm-rmobile.h +++ b/trunk/arch/arm/mach-shmobile/include/mach/pm-rmobile.h @@ -12,8 +12,6 @@ #include -#define DEFAULT_DEV_LATENCY_NS 250000 - struct platform_device; struct rmobile_pm_domain { @@ -31,33 +29,16 @@ struct rmobile_pm_domain *to_rmobile_pd(struct generic_pm_domain *d) return container_of(d, struct rmobile_pm_domain, genpd); } -struct pm_domain_device { - const char *domain_name; - struct platform_device *pdev; -}; - #ifdef CONFIG_PM -extern void rmobile_init_domains(struct rmobile_pm_domain domains[], int num); -extern void rmobile_add_device_to_domain_td(const char *domain_name, - struct platform_device *pdev, - struct gpd_timing_data *td); - -static inline void rmobile_add_device_to_domain(const char *domain_name, - struct platform_device *pdev) -{ - rmobile_add_device_to_domain_td(domain_name, pdev, NULL); -} - -extern void rmobile_add_devices_to_domains(struct pm_domain_device data[], - int size); +extern void rmobile_init_pm_domain(struct rmobile_pm_domain *rmobile_pd); +extern void rmobile_add_device_to_domain(struct rmobile_pm_domain *rmobile_pd, + struct platform_device *pdev); +extern void rmobile_pm_add_subdomain(struct rmobile_pm_domain *rmobile_pd, + struct rmobile_pm_domain *rmobile_sd); #else - -#define rmobile_init_domains(domains, num) do { } while (0) -#define rmobile_add_device_to_domain_td(name, pdev, td) do { } while (0) -#define rmobile_add_device_to_domain(name, pdev) do { } while (0) - -static inline void rmobile_add_devices_to_domains(struct pm_domain_device d[], - int size) {} +#define rmobile_init_pm_domain(pd) do { } while (0) +#define rmobile_add_device_to_domain(pd, pdev) do { } while (0) +#define rmobile_pm_add_subdomain(pd, sd) do { } while (0) #endif /* CONFIG_PM */ #endif /* PM_RMOBILE_H */ diff --git a/trunk/arch/arm/mach-shmobile/include/mach/r8a7740.h b/trunk/arch/arm/mach-shmobile/include/mach/r8a7740.h index 59d252f4cf97..7143147780df 100644 --- a/trunk/arch/arm/mach-shmobile/include/mach/r8a7740.h +++ b/trunk/arch/arm/mach-shmobile/include/mach/r8a7740.h @@ -607,9 +607,9 @@ enum { }; #ifdef CONFIG_PM -extern void __init r8a7740_init_pm_domains(void); -#else -static inline void r8a7740_init_pm_domains(void) {} +extern struct rmobile_pm_domain r8a7740_pd_a4s; +extern struct rmobile_pm_domain r8a7740_pd_a3sp; +extern struct rmobile_pm_domain r8a7740_pd_a4lc; #endif /* CONFIG_PM */ #endif /* __ASM_R8A7740_H__ */ diff --git a/trunk/arch/arm/mach-shmobile/include/mach/r8a7779.h b/trunk/arch/arm/mach-shmobile/include/mach/r8a7779.h index 499f52d2a4a1..f504c5e81b47 100644 --- a/trunk/arch/arm/mach-shmobile/include/mach/r8a7779.h +++ b/trunk/arch/arm/mach-shmobile/include/mach/r8a7779.h @@ -347,9 +347,17 @@ extern int r8a7779_sysc_power_down(struct r8a7779_pm_ch *r8a7779_ch); extern int r8a7779_sysc_power_up(struct r8a7779_pm_ch *r8a7779_ch); #ifdef CONFIG_PM -extern void __init r8a7779_init_pm_domains(void); +extern struct r8a7779_pm_domain r8a7779_sh4a; +extern struct r8a7779_pm_domain r8a7779_sgx; +extern struct r8a7779_pm_domain r8a7779_vdp1; +extern struct r8a7779_pm_domain r8a7779_impx3; + +extern void r8a7779_init_pm_domain(struct r8a7779_pm_domain *r8a7779_pd); +extern void r8a7779_add_device_to_domain(struct r8a7779_pm_domain *r8a7779_pd, + struct platform_device *pdev); #else -static inline void r8a7779_init_pm_domains(void) {} +#define r8a7779_init_pm_domain(pd) do { } while (0) +#define r8a7779_add_device_to_domain(pd, pdev) do { } while (0) #endif /* CONFIG_PM */ extern struct smp_operations r8a7779_smp_ops; diff --git a/trunk/arch/arm/mach-shmobile/include/mach/sh7372.h b/trunk/arch/arm/mach-shmobile/include/mach/sh7372.h index eb98b45c5089..b59048e6d8fd 100644 --- a/trunk/arch/arm/mach-shmobile/include/mach/sh7372.h +++ b/trunk/arch/arm/mach-shmobile/include/mach/sh7372.h @@ -478,17 +478,21 @@ extern struct clk sh7372_fsibck_clk; extern struct clk sh7372_fsidiva_clk; extern struct clk sh7372_fsidivb_clk; +#ifdef CONFIG_PM +extern struct rmobile_pm_domain sh7372_pd_a4lc; +extern struct rmobile_pm_domain sh7372_pd_a4mp; +extern struct rmobile_pm_domain sh7372_pd_d4; +extern struct rmobile_pm_domain sh7372_pd_a4r; +extern struct rmobile_pm_domain sh7372_pd_a3rv; +extern struct rmobile_pm_domain sh7372_pd_a3ri; +extern struct rmobile_pm_domain sh7372_pd_a4s; +extern struct rmobile_pm_domain sh7372_pd_a3sp; +extern struct rmobile_pm_domain sh7372_pd_a3sg; +#endif /* CONFIG_PM */ + extern void sh7372_intcs_suspend(void); extern void sh7372_intcs_resume(void); extern void sh7372_intca_suspend(void); extern void sh7372_intca_resume(void); -#ifdef CONFIG_PM -extern void __init sh7372_init_pm_domains(void); -#else -static inline void sh7372_init_pm_domains(void) {} -#endif - -extern void __init sh7372_pm_init_late(void); - #endif /* __ASM_SH7372_H__ */ diff --git a/trunk/arch/arm/mach-shmobile/pm-r8a7740.c b/trunk/arch/arm/mach-shmobile/pm-r8a7740.c index 21e5316d2d88..893504d012a6 100644 --- a/trunk/arch/arm/mach-shmobile/pm-r8a7740.c +++ b/trunk/arch/arm/mach-shmobile/pm-r8a7740.c @@ -21,6 +21,14 @@ static int r8a7740_pd_a4s_suspend(void) return -EBUSY; } +struct rmobile_pm_domain r8a7740_pd_a4s = { + .genpd.name = "A4S", + .bit_shift = 10, + .gov = &pm_domain_always_on_gov, + .no_debug = true, + .suspend = r8a7740_pd_a4s_suspend, +}; + static int r8a7740_pd_a3sp_suspend(void) { /* @@ -30,31 +38,17 @@ static int r8a7740_pd_a3sp_suspend(void) return console_suspend_enabled ? 0 : -EBUSY; } -static struct rmobile_pm_domain r8a7740_pm_domains[] = { - { - .genpd.name = "A4S", - .bit_shift = 10, - .gov = &pm_domain_always_on_gov, - .no_debug = true, - .suspend = r8a7740_pd_a4s_suspend, - }, - { - .genpd.name = "A3SP", - .bit_shift = 11, - .gov = &pm_domain_always_on_gov, - .no_debug = true, - .suspend = r8a7740_pd_a3sp_suspend, - }, - { - .genpd.name = "A4LC", - .bit_shift = 1, - }, +struct rmobile_pm_domain r8a7740_pd_a3sp = { + .genpd.name = "A3SP", + .bit_shift = 11, + .gov = &pm_domain_always_on_gov, + .no_debug = true, + .suspend = r8a7740_pd_a3sp_suspend, }; -void __init r8a7740_init_pm_domains(void) -{ - rmobile_init_domains(r8a7740_pm_domains, ARRAY_SIZE(r8a7740_pm_domains)); - pm_genpd_add_subdomain_names("A4S", "A3SP"); -} +struct rmobile_pm_domain r8a7740_pd_a4lc = { + .genpd.name = "A4LC", + .bit_shift = 1, +}; #endif /* CONFIG_PM */ diff --git a/trunk/arch/arm/mach-shmobile/pm-r8a7779.c b/trunk/arch/arm/mach-shmobile/pm-r8a7779.c index d50a8e9b94a4..a18a4ae16d2b 100644 --- a/trunk/arch/arm/mach-shmobile/pm-r8a7779.c +++ b/trunk/arch/arm/mach-shmobile/pm-r8a7779.c @@ -183,7 +183,7 @@ static bool pd_active_wakeup(struct device *dev) return true; } -static void r8a7779_init_pm_domain(struct r8a7779_pm_domain *r8a7779_pd) +void r8a7779_init_pm_domain(struct r8a7779_pm_domain *r8a7779_pd) { struct generic_pm_domain *genpd = &r8a7779_pd->genpd; @@ -199,45 +199,44 @@ static void r8a7779_init_pm_domain(struct r8a7779_pm_domain *r8a7779_pd) pd_power_up(&r8a7779_pd->genpd); } -static struct r8a7779_pm_domain r8a7779_pm_domains[] = { - { - .genpd.name = "SH4A", - .ch = { - .chan_offs = 0x80, /* PWRSR1 .. PWRER1 */ - .isr_bit = 16, /* SH4A */ - }, - }, - { - .genpd.name = "SGX", - .ch = { - .chan_offs = 0xc0, /* PWRSR2 .. PWRER2 */ - .isr_bit = 20, /* SGX */ - }, - }, - { - .genpd.name = "VDP1", - .ch = { - .chan_offs = 0x100, /* PWRSR3 .. PWRER3 */ - .isr_bit = 21, /* VDP */ - }, - }, - { - .genpd.name = "IMPX3", - .ch = { - .chan_offs = 0x140, /* PWRSR4 .. PWRER4 */ - .isr_bit = 24, /* IMP */ - }, - }, -}; - -void __init r8a7779_init_pm_domains(void) +void r8a7779_add_device_to_domain(struct r8a7779_pm_domain *r8a7779_pd, + struct platform_device *pdev) { - int j; + struct device *dev = &pdev->dev; - for (j = 0; j < ARRAY_SIZE(r8a7779_pm_domains); j++) - r8a7779_init_pm_domain(&r8a7779_pm_domains[j]); + pm_genpd_add_device(&r8a7779_pd->genpd, dev); + if (pm_clk_no_clocks(dev)) + pm_clk_add(dev, NULL); } +struct r8a7779_pm_domain r8a7779_sh4a = { + .ch = { + .chan_offs = 0x80, /* PWRSR1 .. PWRER1 */ + .isr_bit = 16, /* SH4A */ + } +}; + +struct r8a7779_pm_domain r8a7779_sgx = { + .ch = { + .chan_offs = 0xc0, /* PWRSR2 .. PWRER2 */ + .isr_bit = 20, /* SGX */ + } +}; + +struct r8a7779_pm_domain r8a7779_vdp1 = { + .ch = { + .chan_offs = 0x100, /* PWRSR3 .. PWRER3 */ + .isr_bit = 21, /* VDP */ + } +}; + +struct r8a7779_pm_domain r8a7779_impx3 = { + .ch = { + .chan_offs = 0x140, /* PWRSR4 .. PWRER4 */ + .isr_bit = 24, /* IMP */ + } +}; + #endif /* CONFIG_PM */ void __init r8a7779_pm_init(void) diff --git a/trunk/arch/arm/mach-shmobile/pm-rmobile.c b/trunk/arch/arm/mach-shmobile/pm-rmobile.c index 1fc05d9453d0..32e177275e47 100644 --- a/trunk/arch/arm/mach-shmobile/pm-rmobile.c +++ b/trunk/arch/arm/mach-shmobile/pm-rmobile.c @@ -134,7 +134,7 @@ static int rmobile_pd_start_dev(struct device *dev) return ret; } -static void rmobile_init_pm_domain(struct rmobile_pm_domain *rmobile_pd) +void rmobile_init_pm_domain(struct rmobile_pm_domain *rmobile_pd) { struct generic_pm_domain *genpd = &rmobile_pd->genpd; struct dev_power_governor *gov = rmobile_pd->gov; @@ -149,38 +149,19 @@ static void rmobile_init_pm_domain(struct rmobile_pm_domain *rmobile_pd) __rmobile_pd_power_up(rmobile_pd, false); } -void rmobile_init_domains(struct rmobile_pm_domain domains[], int num) -{ - int j; - - for (j = 0; j < num; j++) - rmobile_init_pm_domain(&domains[j]); -} - -void rmobile_add_device_to_domain_td(const char *domain_name, - struct platform_device *pdev, - struct gpd_timing_data *td) +void rmobile_add_device_to_domain(struct rmobile_pm_domain *rmobile_pd, + struct platform_device *pdev) { struct device *dev = &pdev->dev; - __pm_genpd_name_add_device(domain_name, dev, td); + pm_genpd_add_device(&rmobile_pd->genpd, dev); if (pm_clk_no_clocks(dev)) pm_clk_add(dev, NULL); } -void rmobile_add_devices_to_domains(struct pm_domain_device data[], - int size) +void rmobile_pm_add_subdomain(struct rmobile_pm_domain *rmobile_pd, + struct rmobile_pm_domain *rmobile_sd) { - struct gpd_timing_data latencies = { - .stop_latency_ns = DEFAULT_DEV_LATENCY_NS, - .start_latency_ns = DEFAULT_DEV_LATENCY_NS, - .save_state_latency_ns = DEFAULT_DEV_LATENCY_NS, - .restore_state_latency_ns = DEFAULT_DEV_LATENCY_NS, - }; - int j; - - for (j = 0; j < size; j++) - rmobile_add_device_to_domain_td(data[j].domain_name, - data[j].pdev, &latencies); + pm_genpd_add_subdomain(&rmobile_pd->genpd, &rmobile_sd->genpd); } #endif /* CONFIG_PM */ diff --git a/trunk/arch/arm/mach-shmobile/pm-sh7372.c b/trunk/arch/arm/mach-shmobile/pm-sh7372.c index a0826a48dd08..162121842a2b 100644 --- a/trunk/arch/arm/mach-shmobile/pm-sh7372.c +++ b/trunk/arch/arm/mach-shmobile/pm-sh7372.c @@ -21,7 +21,6 @@ #include #include #include -#include #include #include #include @@ -73,7 +72,20 @@ #ifdef CONFIG_PM -#define PM_DOMAIN_ON_OFF_LATENCY_NS 250000 +struct rmobile_pm_domain sh7372_pd_a4lc = { + .genpd.name = "A4LC", + .bit_shift = 1, +}; + +struct rmobile_pm_domain sh7372_pd_a4mp = { + .genpd.name = "A4MP", + .bit_shift = 2, +}; + +struct rmobile_pm_domain sh7372_pd_d4 = { + .genpd.name = "D4", + .bit_shift = 3, +}; static int sh7372_a4r_pd_suspend(void) { @@ -82,25 +94,39 @@ static int sh7372_a4r_pd_suspend(void) return 0; } -static bool a4s_suspend_ready; +struct rmobile_pm_domain sh7372_pd_a4r = { + .genpd.name = "A4R", + .bit_shift = 5, + .suspend = sh7372_a4r_pd_suspend, + .resume = sh7372_intcs_resume, +}; -static int sh7372_a4s_pd_suspend(void) +struct rmobile_pm_domain sh7372_pd_a3rv = { + .genpd.name = "A3RV", + .bit_shift = 6, +}; + +struct rmobile_pm_domain sh7372_pd_a3ri = { + .genpd.name = "A3RI", + .bit_shift = 8, +}; + +static int sh7372_pd_a4s_suspend(void) { /* * The A4S domain contains the CPU core and therefore it should - * only be turned off if the CPU is not in use. This may happen - * during system suspend, when SYSC is going to be used for generating - * resume signals and a4s_suspend_ready is set to let - * sh7372_enter_suspend() know that it can turn A4S off. + * only be turned off if the CPU is in use. */ - a4s_suspend_ready = true; return -EBUSY; } -static void sh7372_a4s_pd_resume(void) -{ - a4s_suspend_ready = false; -} +struct rmobile_pm_domain sh7372_pd_a4s = { + .genpd.name = "A4S", + .bit_shift = 10, + .gov = &pm_domain_always_on_gov, + .no_debug = true, + .suspend = sh7372_pd_a4s_suspend, +}; static int sh7372_a3sp_pd_suspend(void) { @@ -111,80 +137,18 @@ static int sh7372_a3sp_pd_suspend(void) return console_suspend_enabled ? 0 : -EBUSY; } -static struct rmobile_pm_domain sh7372_pm_domains[] = { - { - .genpd.name = "A4LC", - .genpd.power_on_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS, - .genpd.power_off_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS, - .bit_shift = 1, - }, - { - .genpd.name = "A4MP", - .genpd.power_on_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS, - .genpd.power_off_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS, - .bit_shift = 2, - }, - { - .genpd.name = "D4", - .genpd.power_on_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS, - .genpd.power_off_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS, - .bit_shift = 3, - }, - { - .genpd.name = "A4R", - .genpd.power_on_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS, - .genpd.power_off_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS, - .bit_shift = 5, - .suspend = sh7372_a4r_pd_suspend, - .resume = sh7372_intcs_resume, - }, - { - .genpd.name = "A3RV", - .genpd.power_on_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS, - .genpd.power_off_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS, - .bit_shift = 6, - }, - { - .genpd.name = "A3RI", - .genpd.power_on_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS, - .genpd.power_off_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS, - .bit_shift = 8, - }, - { - .genpd.name = "A4S", - .genpd.power_on_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS, - .genpd.power_off_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS, - .bit_shift = 10, - .gov = &pm_domain_always_on_gov, - .no_debug = true, - .suspend = sh7372_a4s_pd_suspend, - .resume = sh7372_a4s_pd_resume, - }, - { - .genpd.name = "A3SP", - .genpd.power_on_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS, - .genpd.power_off_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS, - .bit_shift = 11, - .gov = &pm_domain_always_on_gov, - .no_debug = true, - .suspend = sh7372_a3sp_pd_suspend, - }, - { - .genpd.name = "A3SG", - .genpd.power_on_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS, - .genpd.power_off_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS, - .bit_shift = 13, - }, +struct rmobile_pm_domain sh7372_pd_a3sp = { + .genpd.name = "A3SP", + .bit_shift = 11, + .gov = &pm_domain_always_on_gov, + .no_debug = true, + .suspend = sh7372_a3sp_pd_suspend, }; -void __init sh7372_init_pm_domains(void) -{ - rmobile_init_domains(sh7372_pm_domains, ARRAY_SIZE(sh7372_pm_domains)); - pm_genpd_add_subdomain_names("A4LC", "A3RV"); - pm_genpd_add_subdomain_names("A4R", "A4LC"); - pm_genpd_add_subdomain_names("A4S", "A3SG"); - pm_genpd_add_subdomain_names("A4S", "A3SP"); -} +struct rmobile_pm_domain sh7372_pd_a3sg = { + .genpd.name = "A3SG", + .bit_shift = 13, +}; #endif /* CONFIG_PM */ @@ -340,21 +304,6 @@ static void sh7372_enter_a3sm_common(int pllc0_on) sh7372_set_reset_vector(__pa(sh7372_resume_core_standby_sysc)); sh7372_enter_sysc(pllc0_on, 1 << 12); } - -static void sh7372_enter_a4s_common(int pllc0_on) -{ - sh7372_intca_suspend(); - sh7372_set_reset_vector(SMFRAM); - sh7372_enter_sysc(pllc0_on, 1 << 10); - sh7372_intca_resume(); -} - -static void sh7372_pm_setup_smfram(void) -{ - memcpy((void *)SMFRAM, sh7372_resume_core_standby_sysc, 0x100); -} -#else -static inline void sh7372_pm_setup_smfram(void) {} #endif /* CONFIG_SUSPEND || CONFIG_CPU_IDLE */ #ifdef CONFIG_CPU_IDLE @@ -364,8 +313,7 @@ static int sh7372_do_idle_core_standby(unsigned long unused) return 0; } -static int sh7372_enter_core_standby(struct cpuidle_device *dev, - struct cpuidle_driver *drv, int index) +static void sh7372_enter_core_standby(void) { sh7372_set_reset_vector(__pa(sh7372_resume_core_standby_sysc)); @@ -376,102 +324,83 @@ static int sh7372_enter_core_standby(struct cpuidle_device *dev, /* disable reset vector translation */ __raw_writel(0, SBAR); - - return 1; } -static int sh7372_enter_a3sm_pll_on(struct cpuidle_device *dev, - struct cpuidle_driver *drv, int index) +static void sh7372_enter_a3sm_pll_on(void) { sh7372_enter_a3sm_common(1); - return 2; } -static int sh7372_enter_a3sm_pll_off(struct cpuidle_device *dev, - struct cpuidle_driver *drv, int index) +static void sh7372_enter_a3sm_pll_off(void) { sh7372_enter_a3sm_common(0); - return 3; } -static int sh7372_enter_a4s(struct cpuidle_device *dev, - struct cpuidle_driver *drv, int index) +static void sh7372_cpuidle_setup(struct cpuidle_driver *drv) { - unsigned long msk, msk2; - - if (!sh7372_sysc_valid(&msk, &msk2)) - return sh7372_enter_a3sm_pll_off(dev, drv, index); - - sh7372_setup_sysc(msk, msk2); - sh7372_enter_a4s_common(0); - return 4; + struct cpuidle_state *state = &drv->states[drv->state_count]; + + snprintf(state->name, CPUIDLE_NAME_LEN, "C2"); + strncpy(state->desc, "Core Standby Mode", CPUIDLE_DESC_LEN); + state->exit_latency = 10; + state->target_residency = 20 + 10; + state->flags = CPUIDLE_FLAG_TIME_VALID; + shmobile_cpuidle_modes[drv->state_count] = sh7372_enter_core_standby; + drv->state_count++; + + state = &drv->states[drv->state_count]; + snprintf(state->name, CPUIDLE_NAME_LEN, "C3"); + strncpy(state->desc, "A3SM PLL ON", CPUIDLE_DESC_LEN); + state->exit_latency = 20; + state->target_residency = 30 + 20; + state->flags = CPUIDLE_FLAG_TIME_VALID; + shmobile_cpuidle_modes[drv->state_count] = sh7372_enter_a3sm_pll_on; + drv->state_count++; + + state = &drv->states[drv->state_count]; + snprintf(state->name, CPUIDLE_NAME_LEN, "C4"); + strncpy(state->desc, "A3SM PLL OFF", CPUIDLE_DESC_LEN); + state->exit_latency = 120; + state->target_residency = 30 + 120; + state->flags = CPUIDLE_FLAG_TIME_VALID; + shmobile_cpuidle_modes[drv->state_count] = sh7372_enter_a3sm_pll_off; + drv->state_count++; } -static struct cpuidle_driver sh7372_cpuidle_driver = { - .name = "sh7372_cpuidle", - .owner = THIS_MODULE, - .en_core_tk_irqen = 1, - .state_count = 5, - .safe_state_index = 0, /* C1 */ - .states[0] = ARM_CPUIDLE_WFI_STATE, - .states[0].enter = shmobile_enter_wfi, - .states[1] = { - .name = "C2", - .desc = "Core Standby Mode", - .exit_latency = 10, - .target_residency = 20 + 10, - .flags = CPUIDLE_FLAG_TIME_VALID, - .enter = sh7372_enter_core_standby, - }, - .states[2] = { - .name = "C3", - .desc = "A3SM PLL ON", - .exit_latency = 20, - .target_residency = 30 + 20, - .flags = CPUIDLE_FLAG_TIME_VALID, - .enter = sh7372_enter_a3sm_pll_on, - }, - .states[3] = { - .name = "C4", - .desc = "A3SM PLL OFF", - .exit_latency = 120, - .target_residency = 30 + 120, - .flags = CPUIDLE_FLAG_TIME_VALID, - .enter = sh7372_enter_a3sm_pll_off, - }, - .states[4] = { - .name = "C5", - .desc = "A4S PLL OFF", - .exit_latency = 240, - .target_residency = 30 + 240, - .flags = CPUIDLE_FLAG_TIME_VALID, - .enter = sh7372_enter_a4s, - .disabled = true, - }, -}; - static void sh7372_cpuidle_init(void) { - shmobile_cpuidle_set_driver(&sh7372_cpuidle_driver); + shmobile_cpuidle_setup = sh7372_cpuidle_setup; } #else static void sh7372_cpuidle_init(void) {} #endif #ifdef CONFIG_SUSPEND +static void sh7372_enter_a4s_common(int pllc0_on) +{ + sh7372_intca_suspend(); + memcpy((void *)SMFRAM, sh7372_resume_core_standby_sysc, 0x100); + sh7372_set_reset_vector(SMFRAM); + sh7372_enter_sysc(pllc0_on, 1 << 10); + sh7372_intca_resume(); +} + static int sh7372_enter_suspend(suspend_state_t suspend_state) { unsigned long msk, msk2; /* check active clocks to determine potential wakeup sources */ - if (sh7372_sysc_valid(&msk, &msk2) && a4s_suspend_ready) { - /* convert INTC mask/sense to SYSC mask/sense */ - sh7372_setup_sysc(msk, msk2); - - /* enter A4S sleep with PLLC0 off */ - pr_debug("entering A4S\n"); - sh7372_enter_a4s_common(0); - return 0; + if (sh7372_sysc_valid(&msk, &msk2)) { + if (!console_suspend_enabled && + sh7372_pd_a4s.genpd.status == GPD_STATE_POWER_OFF) { + /* convert INTC mask/sense to SYSC mask/sense */ + sh7372_setup_sysc(msk, msk2); + + /* enter A4S sleep with PLLC0 off */ + pr_debug("entering A4S\n"); + sh7372_enter_a4s_common(0); + return 0; + } } /* default to enter A3SM sleep with PLLC0 off */ @@ -497,7 +426,7 @@ static int sh7372_pm_notifier_fn(struct notifier_block *notifier, * executed during system suspend and resume, respectively, so * that those functions don't crash while accessing the INTCS. */ - pm_genpd_name_poweron("A4R"); + pm_genpd_poweron(&sh7372_pd_a4r.genpd); break; case PM_POST_SUSPEND: pm_genpd_poweroff_unused(); @@ -526,14 +455,6 @@ void __init sh7372_pm_init(void) /* do not convert A3SM, A3SP, A3SG, A4R power down into A4S */ __raw_writel(0, PDNSEL); - sh7372_pm_setup_smfram(); - sh7372_suspend_init(); sh7372_cpuidle_init(); } - -void __init sh7372_pm_init_late(void) -{ - shmobile_init_late(); - pm_genpd_name_attach_cpuidle("A4S", 4); -} diff --git a/trunk/arch/arm/mach-shmobile/setup-r8a7740.c b/trunk/arch/arm/mach-shmobile/setup-r8a7740.c index 11bb1d984197..78948a9dba0e 100644 --- a/trunk/arch/arm/mach-shmobile/setup-r8a7740.c +++ b/trunk/arch/arm/mach-shmobile/setup-r8a7740.c @@ -673,7 +673,12 @@ void __init r8a7740_add_standard_devices(void) r8a7740_i2c_workaround(&i2c0_device); r8a7740_i2c_workaround(&i2c1_device); - r8a7740_init_pm_domains(); + /* PM domain */ + rmobile_init_pm_domain(&r8a7740_pd_a4s); + rmobile_init_pm_domain(&r8a7740_pd_a3sp); + rmobile_init_pm_domain(&r8a7740_pd_a4lc); + + rmobile_pm_add_subdomain(&r8a7740_pd_a4s, &r8a7740_pd_a3sp); /* add devices */ platform_add_devices(r8a7740_early_devices, @@ -683,16 +688,16 @@ void __init r8a7740_add_standard_devices(void) /* add devices to PM domain */ - rmobile_add_device_to_domain("A3SP", &scif0_device); - rmobile_add_device_to_domain("A3SP", &scif1_device); - rmobile_add_device_to_domain("A3SP", &scif2_device); - rmobile_add_device_to_domain("A3SP", &scif3_device); - rmobile_add_device_to_domain("A3SP", &scif4_device); - rmobile_add_device_to_domain("A3SP", &scif5_device); - rmobile_add_device_to_domain("A3SP", &scif6_device); - rmobile_add_device_to_domain("A3SP", &scif7_device); - rmobile_add_device_to_domain("A3SP", &scifb_device); - rmobile_add_device_to_domain("A3SP", &i2c1_device); + rmobile_add_device_to_domain(&r8a7740_pd_a3sp, &scif0_device); + rmobile_add_device_to_domain(&r8a7740_pd_a3sp, &scif1_device); + rmobile_add_device_to_domain(&r8a7740_pd_a3sp, &scif2_device); + rmobile_add_device_to_domain(&r8a7740_pd_a3sp, &scif3_device); + rmobile_add_device_to_domain(&r8a7740_pd_a3sp, &scif4_device); + rmobile_add_device_to_domain(&r8a7740_pd_a3sp, &scif5_device); + rmobile_add_device_to_domain(&r8a7740_pd_a3sp, &scif6_device); + rmobile_add_device_to_domain(&r8a7740_pd_a3sp, &scif7_device); + rmobile_add_device_to_domain(&r8a7740_pd_a3sp, &scifb_device); + rmobile_add_device_to_domain(&r8a7740_pd_a3sp, &i2c1_device); } static void __init r8a7740_earlytimer_init(void) diff --git a/trunk/arch/arm/mach-shmobile/setup-r8a7779.c b/trunk/arch/arm/mach-shmobile/setup-r8a7779.c index 2917668f0091..e98e46f6cf55 100644 --- a/trunk/arch/arm/mach-shmobile/setup-r8a7779.c +++ b/trunk/arch/arm/mach-shmobile/setup-r8a7779.c @@ -251,7 +251,10 @@ void __init r8a7779_add_standard_devices(void) #endif r8a7779_pm_init(); - r8a7779_init_pm_domains(); + r8a7779_init_pm_domain(&r8a7779_sh4a); + r8a7779_init_pm_domain(&r8a7779_sgx); + r8a7779_init_pm_domain(&r8a7779_vdp1); + r8a7779_init_pm_domain(&r8a7779_impx3); platform_add_devices(r8a7779_early_devices, ARRAY_SIZE(r8a7779_early_devices)); diff --git a/trunk/arch/arm/mach-shmobile/setup-sh7372.c b/trunk/arch/arm/mach-shmobile/setup-sh7372.c index a07954fbcd22..838a87be1d5c 100644 --- a/trunk/arch/arm/mach-shmobile/setup-sh7372.c +++ b/trunk/arch/arm/mach-shmobile/setup-sh7372.c @@ -1001,34 +1001,21 @@ static struct platform_device *sh7372_late_devices[] __initdata = { void __init sh7372_add_standard_devices(void) { - struct pm_domain_device domain_devices[] = { - { "A3RV", &vpu_device, }, - { "A4MP", &spu0_device, }, - { "A4MP", &spu1_device, }, - { "A3SP", &scif0_device, }, - { "A3SP", &scif1_device, }, - { "A3SP", &scif2_device, }, - { "A3SP", &scif3_device, }, - { "A3SP", &scif4_device, }, - { "A3SP", &scif5_device, }, - { "A3SP", &scif6_device, }, - { "A3SP", &iic1_device, }, - { "A3SP", &dma0_device, }, - { "A3SP", &dma1_device, }, - { "A3SP", &dma2_device, }, - { "A3SP", &usb_dma0_device, }, - { "A3SP", &usb_dma1_device, }, - { "A4R", &iic0_device, }, - { "A4R", &veu0_device, }, - { "A4R", &veu1_device, }, - { "A4R", &veu2_device, }, - { "A4R", &veu3_device, }, - { "A4R", &jpu_device, }, - { "A4R", &tmu00_device, }, - { "A4R", &tmu01_device, }, - }; - - sh7372_init_pm_domains(); + rmobile_init_pm_domain(&sh7372_pd_a4lc); + rmobile_init_pm_domain(&sh7372_pd_a4mp); + rmobile_init_pm_domain(&sh7372_pd_d4); + rmobile_init_pm_domain(&sh7372_pd_a4r); + rmobile_init_pm_domain(&sh7372_pd_a3rv); + rmobile_init_pm_domain(&sh7372_pd_a3ri); + rmobile_init_pm_domain(&sh7372_pd_a4s); + rmobile_init_pm_domain(&sh7372_pd_a3sp); + rmobile_init_pm_domain(&sh7372_pd_a3sg); + + rmobile_pm_add_subdomain(&sh7372_pd_a4lc, &sh7372_pd_a3rv); + rmobile_pm_add_subdomain(&sh7372_pd_a4r, &sh7372_pd_a4lc); + + rmobile_pm_add_subdomain(&sh7372_pd_a4s, &sh7372_pd_a3sg); + rmobile_pm_add_subdomain(&sh7372_pd_a4s, &sh7372_pd_a3sp); platform_add_devices(sh7372_early_devices, ARRAY_SIZE(sh7372_early_devices)); @@ -1036,8 +1023,30 @@ void __init sh7372_add_standard_devices(void) platform_add_devices(sh7372_late_devices, ARRAY_SIZE(sh7372_late_devices)); - rmobile_add_devices_to_domains(domain_devices, - ARRAY_SIZE(domain_devices)); + rmobile_add_device_to_domain(&sh7372_pd_a3rv, &vpu_device); + rmobile_add_device_to_domain(&sh7372_pd_a4mp, &spu0_device); + rmobile_add_device_to_domain(&sh7372_pd_a4mp, &spu1_device); + rmobile_add_device_to_domain(&sh7372_pd_a3sp, &scif0_device); + rmobile_add_device_to_domain(&sh7372_pd_a3sp, &scif1_device); + rmobile_add_device_to_domain(&sh7372_pd_a3sp, &scif2_device); + rmobile_add_device_to_domain(&sh7372_pd_a3sp, &scif3_device); + rmobile_add_device_to_domain(&sh7372_pd_a3sp, &scif4_device); + rmobile_add_device_to_domain(&sh7372_pd_a3sp, &scif5_device); + rmobile_add_device_to_domain(&sh7372_pd_a3sp, &scif6_device); + rmobile_add_device_to_domain(&sh7372_pd_a3sp, &iic1_device); + rmobile_add_device_to_domain(&sh7372_pd_a3sp, &dma0_device); + rmobile_add_device_to_domain(&sh7372_pd_a3sp, &dma1_device); + rmobile_add_device_to_domain(&sh7372_pd_a3sp, &dma2_device); + rmobile_add_device_to_domain(&sh7372_pd_a3sp, &usb_dma0_device); + rmobile_add_device_to_domain(&sh7372_pd_a3sp, &usb_dma1_device); + rmobile_add_device_to_domain(&sh7372_pd_a4r, &iic0_device); + rmobile_add_device_to_domain(&sh7372_pd_a4r, &veu0_device); + rmobile_add_device_to_domain(&sh7372_pd_a4r, &veu1_device); + rmobile_add_device_to_domain(&sh7372_pd_a4r, &veu2_device); + rmobile_add_device_to_domain(&sh7372_pd_a4r, &veu3_device); + rmobile_add_device_to_domain(&sh7372_pd_a4r, &jpu_device); + rmobile_add_device_to_domain(&sh7372_pd_a4r, &tmu00_device); + rmobile_add_device_to_domain(&sh7372_pd_a4r, &tmu01_device); } static void __init sh7372_earlytimer_init(void) diff --git a/trunk/arch/arm/mach-u300/i2c.c b/trunk/arch/arm/mach-u300/i2c.c index 96800aa1316d..0d4620ed853c 100644 --- a/trunk/arch/arm/mach-u300/i2c.c +++ b/trunk/arch/arm/mach-u300/i2c.c @@ -9,7 +9,7 @@ */ #include #include -#include +#include #include #include #include diff --git a/trunk/arch/arm/mm/dma-mapping.c b/trunk/arch/arm/mm/dma-mapping.c index 477a2d23ddf1..13f555d62491 100644 --- a/trunk/arch/arm/mm/dma-mapping.c +++ b/trunk/arch/arm/mm/dma-mapping.c @@ -73,18 +73,11 @@ static dma_addr_t arm_dma_map_page(struct device *dev, struct page *page, unsigned long offset, size_t size, enum dma_data_direction dir, struct dma_attrs *attrs) { - if (!dma_get_attr(DMA_ATTR_SKIP_CPU_SYNC, attrs)) + if (!arch_is_coherent() && !dma_get_attr(DMA_ATTR_SKIP_CPU_SYNC, attrs)) __dma_page_cpu_to_dev(page, offset, size, dir); return pfn_to_dma(dev, page_to_pfn(page)) + offset; } -static dma_addr_t arm_coherent_dma_map_page(struct device *dev, struct page *page, - unsigned long offset, size_t size, enum dma_data_direction dir, - struct dma_attrs *attrs) -{ - return pfn_to_dma(dev, page_to_pfn(page)) + offset; -} - /** * arm_dma_unmap_page - unmap a buffer previously mapped through dma_map_page() * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices @@ -103,7 +96,7 @@ static void arm_dma_unmap_page(struct device *dev, dma_addr_t handle, size_t size, enum dma_data_direction dir, struct dma_attrs *attrs) { - if (!dma_get_attr(DMA_ATTR_SKIP_CPU_SYNC, attrs)) + if (!arch_is_coherent() && !dma_get_attr(DMA_ATTR_SKIP_CPU_SYNC, attrs)) __dma_page_dev_to_cpu(pfn_to_page(dma_to_pfn(dev, handle)), handle & ~PAGE_MASK, size, dir); } @@ -113,7 +106,8 @@ static void arm_dma_sync_single_for_cpu(struct device *dev, { unsigned int offset = handle & (PAGE_SIZE - 1); struct page *page = pfn_to_page(dma_to_pfn(dev, handle-offset)); - __dma_page_dev_to_cpu(page, offset, size, dir); + if (!arch_is_coherent()) + __dma_page_dev_to_cpu(page, offset, size, dir); } static void arm_dma_sync_single_for_device(struct device *dev, @@ -121,7 +115,8 @@ static void arm_dma_sync_single_for_device(struct device *dev, { unsigned int offset = handle & (PAGE_SIZE - 1); struct page *page = pfn_to_page(dma_to_pfn(dev, handle-offset)); - __dma_page_cpu_to_dev(page, offset, size, dir); + if (!arch_is_coherent()) + __dma_page_cpu_to_dev(page, offset, size, dir); } static int arm_dma_set_mask(struct device *dev, u64 dma_mask); @@ -143,22 +138,6 @@ struct dma_map_ops arm_dma_ops = { }; EXPORT_SYMBOL(arm_dma_ops); -static void *arm_coherent_dma_alloc(struct device *dev, size_t size, - dma_addr_t *handle, gfp_t gfp, struct dma_attrs *attrs); -static void arm_coherent_dma_free(struct device *dev, size_t size, void *cpu_addr, - dma_addr_t handle, struct dma_attrs *attrs); - -struct dma_map_ops arm_coherent_dma_ops = { - .alloc = arm_coherent_dma_alloc, - .free = arm_coherent_dma_free, - .mmap = arm_dma_mmap, - .get_sgtable = arm_dma_get_sgtable, - .map_page = arm_coherent_dma_map_page, - .map_sg = arm_dma_map_sg, - .set_dma_mask = arm_dma_set_mask, -}; -EXPORT_SYMBOL(arm_coherent_dma_ops); - static u64 get_coherent_dma_mask(struct device *dev) { u64 mask = (u64)arm_dma_limit; @@ -607,7 +586,7 @@ static void *__alloc_simple_buffer(struct device *dev, size_t size, gfp_t gfp, static void *__dma_alloc(struct device *dev, size_t size, dma_addr_t *handle, - gfp_t gfp, pgprot_t prot, bool is_coherent, const void *caller) + gfp_t gfp, pgprot_t prot, const void *caller) { u64 mask = get_coherent_dma_mask(dev); struct page *page; @@ -640,7 +619,7 @@ static void *__dma_alloc(struct device *dev, size_t size, dma_addr_t *handle, *handle = DMA_ERROR_CODE; size = PAGE_ALIGN(size); - if (is_coherent || nommu()) + if (arch_is_coherent() || nommu()) addr = __alloc_simple_buffer(dev, size, gfp, &page); else if (gfp & GFP_ATOMIC) addr = __alloc_from_pool(size, &page); @@ -668,20 +647,7 @@ void *arm_dma_alloc(struct device *dev, size_t size, dma_addr_t *handle, if (dma_alloc_from_coherent(dev, size, handle, &memory)) return memory; - return __dma_alloc(dev, size, handle, gfp, prot, false, - __builtin_return_address(0)); -} - -static void *arm_coherent_dma_alloc(struct device *dev, size_t size, - dma_addr_t *handle, gfp_t gfp, struct dma_attrs *attrs) -{ - pgprot_t prot = __get_dma_pgprot(attrs, pgprot_kernel); - void *memory; - - if (dma_alloc_from_coherent(dev, size, handle, &memory)) - return memory; - - return __dma_alloc(dev, size, handle, gfp, prot, true, + return __dma_alloc(dev, size, handle, gfp, prot, __builtin_return_address(0)); } @@ -718,9 +684,8 @@ int arm_dma_mmap(struct device *dev, struct vm_area_struct *vma, /* * Free a buffer as defined by the above mapping. */ -static void __arm_dma_free(struct device *dev, size_t size, void *cpu_addr, - dma_addr_t handle, struct dma_attrs *attrs, - bool is_coherent) +void arm_dma_free(struct device *dev, size_t size, void *cpu_addr, + dma_addr_t handle, struct dma_attrs *attrs) { struct page *page = pfn_to_page(dma_to_pfn(dev, handle)); @@ -729,7 +694,7 @@ static void __arm_dma_free(struct device *dev, size_t size, void *cpu_addr, size = PAGE_ALIGN(size); - if (is_coherent || nommu()) { + if (arch_is_coherent() || nommu()) { __dma_free_buffer(page, size); } else if (__free_from_pool(cpu_addr, size)) { return; @@ -745,18 +710,6 @@ static void __arm_dma_free(struct device *dev, size_t size, void *cpu_addr, } } -void arm_dma_free(struct device *dev, size_t size, void *cpu_addr, - dma_addr_t handle, struct dma_attrs *attrs) -{ - __arm_dma_free(dev, size, cpu_addr, handle, attrs, false); -} - -static void arm_coherent_dma_free(struct device *dev, size_t size, void *cpu_addr, - dma_addr_t handle, struct dma_attrs *attrs) -{ - __arm_dma_free(dev, size, cpu_addr, handle, attrs, true); -} - int arm_dma_get_sgtable(struct device *dev, struct sg_table *sgt, void *cpu_addr, dma_addr_t handle, size_t size, struct dma_attrs *attrs) @@ -1059,12 +1012,11 @@ static struct page **__iommu_alloc_buffer(struct device *dev, size_t size, gfp_t if (!pages[i]) goto error; - if (order) { + if (order) split_page(pages[i], order); - j = 1 << order; - while (--j) - pages[i + j] = pages[i] + j; - } + j = 1 << order; + while (--j) + pages[i + j] = pages[i] + j; __dma_clear_buffer(pages[i], PAGE_SIZE << order); i += 1 << order; @@ -1351,8 +1303,7 @@ static int arm_iommu_get_sgtable(struct device *dev, struct sg_table *sgt, */ static int __map_sg_chunk(struct device *dev, struct scatterlist *sg, size_t size, dma_addr_t *handle, - enum dma_data_direction dir, struct dma_attrs *attrs, - bool is_coherent) + enum dma_data_direction dir, struct dma_attrs *attrs) { struct dma_iommu_mapping *mapping = dev->archdata.mapping; dma_addr_t iova, iova_base; @@ -1371,8 +1322,8 @@ static int __map_sg_chunk(struct device *dev, struct scatterlist *sg, phys_addr_t phys = page_to_phys(sg_page(s)); unsigned int len = PAGE_ALIGN(s->offset + s->length); - if (!is_coherent && - !dma_get_attr(DMA_ATTR_SKIP_CPU_SYNC, attrs)) + if (!arch_is_coherent() && + !dma_get_attr(DMA_ATTR_SKIP_CPU_SYNC, attrs)) __dma_page_cpu_to_dev(sg_page(s), s->offset, s->length, dir); ret = iommu_map(mapping->domain, iova, phys, len, 0); @@ -1390,9 +1341,20 @@ static int __map_sg_chunk(struct device *dev, struct scatterlist *sg, return ret; } -static int __iommu_map_sg(struct device *dev, struct scatterlist *sg, int nents, - enum dma_data_direction dir, struct dma_attrs *attrs, - bool is_coherent) +/** + * arm_iommu_map_sg - map a set of SG buffers for streaming mode DMA + * @dev: valid struct device pointer + * @sg: list of buffers + * @nents: number of buffers to map + * @dir: DMA transfer direction + * + * Map a set of buffers described by scatterlist in streaming mode for DMA. + * The scatter gather list elements are merged together (if possible) and + * tagged with the appropriate dma address and length. They are obtained via + * sg_dma_{address,length}. + */ +int arm_iommu_map_sg(struct device *dev, struct scatterlist *sg, int nents, + enum dma_data_direction dir, struct dma_attrs *attrs) { struct scatterlist *s = sg, *dma = sg, *start = sg; int i, count = 0; @@ -1408,7 +1370,7 @@ static int __iommu_map_sg(struct device *dev, struct scatterlist *sg, int nents, if (s->offset || (size & ~PAGE_MASK) || size + s->length > max) { if (__map_sg_chunk(dev, start, size, &dma->dma_address, - dir, attrs, is_coherent) < 0) + dir, attrs) < 0) goto bad_mapping; dma->dma_address += offset; @@ -1421,8 +1383,7 @@ static int __iommu_map_sg(struct device *dev, struct scatterlist *sg, int nents, } size += s->length; } - if (__map_sg_chunk(dev, start, size, &dma->dma_address, dir, attrs, - is_coherent) < 0) + if (__map_sg_chunk(dev, start, size, &dma->dma_address, dir, attrs) < 0) goto bad_mapping; dma->dma_address += offset; @@ -1437,44 +1398,17 @@ static int __iommu_map_sg(struct device *dev, struct scatterlist *sg, int nents, } /** - * arm_coherent_iommu_map_sg - map a set of SG buffers for streaming mode DMA - * @dev: valid struct device pointer - * @sg: list of buffers - * @nents: number of buffers to map - * @dir: DMA transfer direction - * - * Map a set of i/o coherent buffers described by scatterlist in streaming - * mode for DMA. The scatter gather list elements are merged together (if - * possible) and tagged with the appropriate dma address and length. They are - * obtained via sg_dma_{address,length}. - */ -int arm_coherent_iommu_map_sg(struct device *dev, struct scatterlist *sg, - int nents, enum dma_data_direction dir, struct dma_attrs *attrs) -{ - return __iommu_map_sg(dev, sg, nents, dir, attrs, true); -} - -/** - * arm_iommu_map_sg - map a set of SG buffers for streaming mode DMA + * arm_iommu_unmap_sg - unmap a set of SG buffers mapped by dma_map_sg * @dev: valid struct device pointer * @sg: list of buffers - * @nents: number of buffers to map - * @dir: DMA transfer direction + * @nents: number of buffers to unmap (same as was passed to dma_map_sg) + * @dir: DMA transfer direction (same as was passed to dma_map_sg) * - * Map a set of buffers described by scatterlist in streaming mode for DMA. - * The scatter gather list elements are merged together (if possible) and - * tagged with the appropriate dma address and length. They are obtained via - * sg_dma_{address,length}. + * Unmap a set of streaming mode DMA translations. Again, CPU access + * rules concerning calls here are the same as for dma_unmap_single(). */ -int arm_iommu_map_sg(struct device *dev, struct scatterlist *sg, - int nents, enum dma_data_direction dir, struct dma_attrs *attrs) -{ - return __iommu_map_sg(dev, sg, nents, dir, attrs, false); -} - -static void __iommu_unmap_sg(struct device *dev, struct scatterlist *sg, - int nents, enum dma_data_direction dir, struct dma_attrs *attrs, - bool is_coherent) +void arm_iommu_unmap_sg(struct device *dev, struct scatterlist *sg, int nents, + enum dma_data_direction dir, struct dma_attrs *attrs) { struct scatterlist *s; int i; @@ -1483,45 +1417,13 @@ static void __iommu_unmap_sg(struct device *dev, struct scatterlist *sg, if (sg_dma_len(s)) __iommu_remove_mapping(dev, sg_dma_address(s), sg_dma_len(s)); - if (!is_coherent && + if (!arch_is_coherent() && !dma_get_attr(DMA_ATTR_SKIP_CPU_SYNC, attrs)) __dma_page_dev_to_cpu(sg_page(s), s->offset, s->length, dir); } } -/** - * arm_coherent_iommu_unmap_sg - unmap a set of SG buffers mapped by dma_map_sg - * @dev: valid struct device pointer - * @sg: list of buffers - * @nents: number of buffers to unmap (same as was passed to dma_map_sg) - * @dir: DMA transfer direction (same as was passed to dma_map_sg) - * - * Unmap a set of streaming mode DMA translations. Again, CPU access - * rules concerning calls here are the same as for dma_unmap_single(). - */ -void arm_coherent_iommu_unmap_sg(struct device *dev, struct scatterlist *sg, - int nents, enum dma_data_direction dir, struct dma_attrs *attrs) -{ - __iommu_unmap_sg(dev, sg, nents, dir, attrs, true); -} - -/** - * arm_iommu_unmap_sg - unmap a set of SG buffers mapped by dma_map_sg - * @dev: valid struct device pointer - * @sg: list of buffers - * @nents: number of buffers to unmap (same as was passed to dma_map_sg) - * @dir: DMA transfer direction (same as was passed to dma_map_sg) - * - * Unmap a set of streaming mode DMA translations. Again, CPU access - * rules concerning calls here are the same as for dma_unmap_single(). - */ -void arm_iommu_unmap_sg(struct device *dev, struct scatterlist *sg, int nents, - enum dma_data_direction dir, struct dma_attrs *attrs) -{ - __iommu_unmap_sg(dev, sg, nents, dir, attrs, false); -} - /** * arm_iommu_sync_sg_for_cpu * @dev: valid struct device pointer @@ -1536,7 +1438,8 @@ void arm_iommu_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, int i; for_each_sg(sg, s, nents, i) - __dma_page_dev_to_cpu(sg_page(s), s->offset, s->length, dir); + if (!arch_is_coherent()) + __dma_page_dev_to_cpu(sg_page(s), s->offset, s->length, dir); } @@ -1554,21 +1457,22 @@ void arm_iommu_sync_sg_for_device(struct device *dev, struct scatterlist *sg, int i; for_each_sg(sg, s, nents, i) - __dma_page_cpu_to_dev(sg_page(s), s->offset, s->length, dir); + if (!arch_is_coherent()) + __dma_page_cpu_to_dev(sg_page(s), s->offset, s->length, dir); } /** - * arm_coherent_iommu_map_page + * arm_iommu_map_page * @dev: valid struct device pointer * @page: page that buffer resides in * @offset: offset into page for start of buffer * @size: size of buffer to map * @dir: DMA transfer direction * - * Coherent IOMMU aware version of arm_dma_map_page() + * IOMMU aware version of arm_dma_map_page() */ -static dma_addr_t arm_coherent_iommu_map_page(struct device *dev, struct page *page, +static dma_addr_t arm_iommu_map_page(struct device *dev, struct page *page, unsigned long offset, size_t size, enum dma_data_direction dir, struct dma_attrs *attrs) { @@ -1576,6 +1480,9 @@ static dma_addr_t arm_coherent_iommu_map_page(struct device *dev, struct page *p dma_addr_t dma_addr; int ret, len = PAGE_ALIGN(size + offset); + if (!arch_is_coherent() && !dma_get_attr(DMA_ATTR_SKIP_CPU_SYNC, attrs)) + __dma_page_cpu_to_dev(page, offset, size, dir); + dma_addr = __alloc_iova(mapping, len); if (dma_addr == DMA_ERROR_CODE) return dma_addr; @@ -1590,51 +1497,6 @@ static dma_addr_t arm_coherent_iommu_map_page(struct device *dev, struct page *p return DMA_ERROR_CODE; } -/** - * arm_iommu_map_page - * @dev: valid struct device pointer - * @page: page that buffer resides in - * @offset: offset into page for start of buffer - * @size: size of buffer to map - * @dir: DMA transfer direction - * - * IOMMU aware version of arm_dma_map_page() - */ -static dma_addr_t arm_iommu_map_page(struct device *dev, struct page *page, - unsigned long offset, size_t size, enum dma_data_direction dir, - struct dma_attrs *attrs) -{ - if (!dma_get_attr(DMA_ATTR_SKIP_CPU_SYNC, attrs)) - __dma_page_cpu_to_dev(page, offset, size, dir); - - return arm_coherent_iommu_map_page(dev, page, offset, size, dir, attrs); -} - -/** - * arm_coherent_iommu_unmap_page - * @dev: valid struct device pointer - * @handle: DMA address of buffer - * @size: size of buffer (same as passed to dma_map_page) - * @dir: DMA transfer direction (same as passed to dma_map_page) - * - * Coherent IOMMU aware version of arm_dma_unmap_page() - */ -static void arm_coherent_iommu_unmap_page(struct device *dev, dma_addr_t handle, - size_t size, enum dma_data_direction dir, - struct dma_attrs *attrs) -{ - struct dma_iommu_mapping *mapping = dev->archdata.mapping; - dma_addr_t iova = handle & PAGE_MASK; - int offset = handle & ~PAGE_MASK; - int len = PAGE_ALIGN(size + offset); - - if (!iova) - return; - - iommu_unmap(mapping->domain, iova, len); - __free_iova(mapping, iova, len); -} - /** * arm_iommu_unmap_page * @dev: valid struct device pointer @@ -1657,7 +1519,7 @@ static void arm_iommu_unmap_page(struct device *dev, dma_addr_t handle, if (!iova) return; - if (!dma_get_attr(DMA_ATTR_SKIP_CPU_SYNC, attrs)) + if (!arch_is_coherent() && !dma_get_attr(DMA_ATTR_SKIP_CPU_SYNC, attrs)) __dma_page_dev_to_cpu(page, offset, size, dir); iommu_unmap(mapping->domain, iova, len); @@ -1675,7 +1537,8 @@ static void arm_iommu_sync_single_for_cpu(struct device *dev, if (!iova) return; - __dma_page_dev_to_cpu(page, offset, size, dir); + if (!arch_is_coherent()) + __dma_page_dev_to_cpu(page, offset, size, dir); } static void arm_iommu_sync_single_for_device(struct device *dev, @@ -1709,19 +1572,6 @@ struct dma_map_ops iommu_ops = { .sync_sg_for_device = arm_iommu_sync_sg_for_device, }; -struct dma_map_ops iommu_coherent_ops = { - .alloc = arm_iommu_alloc_attrs, - .free = arm_iommu_free_attrs, - .mmap = arm_iommu_mmap_attrs, - .get_sgtable = arm_iommu_get_sgtable, - - .map_page = arm_coherent_iommu_map_page, - .unmap_page = arm_coherent_iommu_unmap_page, - - .map_sg = arm_coherent_iommu_map_sg, - .unmap_sg = arm_coherent_iommu_unmap_sg, -}; - /** * arm_iommu_create_mapping * @bus: pointer to the bus holding the client device (for IOMMU calls) @@ -1815,7 +1665,7 @@ int arm_iommu_attach_device(struct device *dev, dev->archdata.mapping = mapping; set_dma_ops(dev, &iommu_ops); - pr_debug("Attached IOMMU controller to %s device.\n", dev_name(dev)); + pr_info("Attached IOMMU controller to %s device.\n", dev_name(dev)); return 0; } diff --git a/trunk/arch/arm/mm/mmu.c b/trunk/arch/arm/mm/mmu.c index 941dfb9e9a78..18144e6a3115 100644 --- a/trunk/arch/arm/mm/mmu.c +++ b/trunk/arch/arm/mm/mmu.c @@ -422,6 +422,17 @@ static void __init build_mem_type_table(void) cp = &cache_policies[cachepolicy]; vecs_pgprot = kern_pgprot = user_pgprot = cp->pte; + /* + * Enable CPU-specific coherency if supported. + * (Only available on XSC3 at the moment.) + */ + if (arch_is_coherent() && cpu_is_xsc3()) { + mem_types[MT_MEMORY].prot_sect |= PMD_SECT_S; + mem_types[MT_MEMORY].prot_pte |= L_PTE_SHARED; + mem_types[MT_MEMORY_DMA_READY].prot_pte |= L_PTE_SHARED; + mem_types[MT_MEMORY_NONCACHED].prot_sect |= PMD_SECT_S; + mem_types[MT_MEMORY_NONCACHED].prot_pte |= L_PTE_SHARED; + } /* * ARMv6 and above have extended page tables. */ diff --git a/trunk/arch/arm/plat-omap/include/plat/usb.h b/trunk/arch/arm/plat-omap/include/plat/usb.h index 87ee140fefaa..bd20588c356b 100644 --- a/trunk/arch/arm/plat-omap/include/plat/usb.h +++ b/trunk/arch/arm/plat-omap/include/plat/usb.h @@ -4,7 +4,6 @@ #define __ASM_ARCH_OMAP_USB_H #include -#include #include #define OMAP3_HS_USB_PORTS 3 @@ -64,10 +63,6 @@ struct usbhs_omap_platform_data { struct ehci_hcd_omap_platform_data *ehci_data; struct ohci_hcd_omap_platform_data *ohci_data; }; - -struct usbtll_omap_platform_data { - enum usbhs_omap_port_mode port_mode[OMAP3_HS_USB_PORTS]; -}; /*-------------------------------------------------------------------------*/ struct omap_musb_board_data { @@ -86,8 +81,6 @@ enum musb_interface {MUSB_INTERFACE_ULPI, MUSB_INTERFACE_UTMI}; extern void usb_musb_init(struct omap_musb_board_data *board_data); extern void usbhs_init(const struct usbhs_omap_board_data *pdata); -extern int omap_tll_enable(void); -extern int omap_tll_disable(void); extern int omap4430_phy_power(struct device *dev, int ID, int on); extern int omap4430_phy_set_clk(struct device *dev, int on); diff --git a/trunk/arch/arm64/include/asm/compat.h b/trunk/arch/arm64/include/asm/compat.h index 37e610dc084e..a670a33ad736 100644 --- a/trunk/arch/arm64/include/asm/compat.h +++ b/trunk/arch/arm64/include/asm/compat.h @@ -55,7 +55,6 @@ typedef s64 compat_s64; typedef u32 compat_uint_t; typedef u32 compat_ulong_t; typedef u64 compat_u64; -typedef u32 compat_uptr_t; struct compat_timespec { compat_time_t tv_sec; @@ -131,64 +130,6 @@ typedef u32 compat_old_sigset_t; typedef u32 compat_sigset_word; -typedef union compat_sigval { - compat_int_t sival_int; - compat_uptr_t sival_ptr; -} compat_sigval_t; - -typedef struct compat_siginfo { - int si_signo; - int si_errno; - int si_code; - - union { - /* The padding is the same size as AArch64. */ - int _pad[128/sizeof(int) - 3]; - - /* kill() */ - struct { - compat_pid_t _pid; /* sender's pid */ - __compat_uid32_t _uid; /* sender's uid */ - } _kill; - - /* POSIX.1b timers */ - struct { - compat_timer_t _tid; /* timer id */ - int _overrun; /* overrun count */ - compat_sigval_t _sigval; /* same as below */ - int _sys_private; /* not to be passed to user */ - } _timer; - - /* POSIX.1b signals */ - struct { - compat_pid_t _pid; /* sender's pid */ - __compat_uid32_t _uid; /* sender's uid */ - compat_sigval_t _sigval; - } _rt; - - /* SIGCHLD */ - struct { - compat_pid_t _pid; /* which child */ - __compat_uid32_t _uid; /* sender's uid */ - int _status; /* exit code */ - compat_clock_t _utime; - compat_clock_t _stime; - } _sigchld; - - /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */ - struct { - compat_uptr_t _addr; /* faulting insn/memory ref. */ - short _addr_lsb; /* LSB of the reported address */ - } _sigfault; - - /* SIGPOLL */ - struct { - compat_long_t _band; /* POLL_IN, POLL_OUT, POLL_MSG */ - int _fd; - } _sigpoll; - } _sifields; -} compat_siginfo_t; - #define COMPAT_OFF_T_MAX 0x7fffffff #define COMPAT_LOFF_T_MAX 0x7fffffffffffffffL @@ -198,6 +139,7 @@ typedef struct compat_siginfo { * as pointers because the syscall entry code will have * appropriately converted them already. */ +typedef u32 compat_uptr_t; static inline void __user *compat_ptr(compat_uptr_t uptr) { diff --git a/trunk/arch/arm64/include/uapi/asm/Kbuild b/trunk/arch/arm64/include/uapi/asm/Kbuild deleted file mode 100644 index baebb3da1d44..000000000000 --- a/trunk/arch/arm64/include/uapi/asm/Kbuild +++ /dev/null @@ -1,3 +0,0 @@ -# UAPI Header export list -include include/uapi/asm-generic/Kbuild.asm - diff --git a/trunk/arch/arm64/kernel/signal32.c b/trunk/arch/arm64/kernel/signal32.c index 0790a87a4346..ac74c2f261e3 100644 --- a/trunk/arch/arm64/kernel/signal32.c +++ b/trunk/arch/arm64/kernel/signal32.c @@ -30,6 +30,59 @@ #include #include +typedef struct compat_siginfo { + int si_signo; + int si_errno; + int si_code; + + union { + /* The padding is the same size as AArch64. */ + int _pad[SI_PAD_SIZE]; + + /* kill() */ + struct { + compat_pid_t _pid; /* sender's pid */ + __compat_uid32_t _uid; /* sender's uid */ + } _kill; + + /* POSIX.1b timers */ + struct { + compat_timer_t _tid; /* timer id */ + int _overrun; /* overrun count */ + compat_sigval_t _sigval; /* same as below */ + int _sys_private; /* not to be passed to user */ + } _timer; + + /* POSIX.1b signals */ + struct { + compat_pid_t _pid; /* sender's pid */ + __compat_uid32_t _uid; /* sender's uid */ + compat_sigval_t _sigval; + } _rt; + + /* SIGCHLD */ + struct { + compat_pid_t _pid; /* which child */ + __compat_uid32_t _uid; /* sender's uid */ + int _status; /* exit code */ + compat_clock_t _utime; + compat_clock_t _stime; + } _sigchld; + + /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */ + struct { + compat_uptr_t _addr; /* faulting insn/memory ref. */ + short _addr_lsb; /* LSB of the reported address */ + } _sigfault; + + /* SIGPOLL */ + struct { + compat_long_t _band; /* POLL_IN, POLL_OUT, POLL_MSG */ + int _fd; + } _sigpoll; + } _sifields; +} compat_siginfo_t; + struct compat_sigaction { compat_uptr_t sa_handler; compat_ulong_t sa_flags; diff --git a/trunk/arch/avr32/include/asm/elf.h b/trunk/arch/avr32/include/asm/elf.h index e2c328739808..3b3159b710d4 100644 --- a/trunk/arch/avr32/include/asm/elf.h +++ b/trunk/arch/avr32/include/asm/elf.h @@ -102,7 +102,6 @@ typedef struct user_fpu_struct elf_fpregset_t; #define ELF_PLATFORM (NULL) -#define SET_PERSONALITY(ex) \ - set_personality(PER_LINUX_32BIT | (current->personality & (~PER_MASK))) +#define SET_PERSONALITY(ex) set_personality(PER_LINUX_32BIT) #endif /* __ASM_AVR32_ELF_H */ diff --git a/trunk/arch/avr32/include/uapi/asm/Kbuild b/trunk/arch/avr32/include/uapi/asm/Kbuild deleted file mode 100644 index baebb3da1d44..000000000000 --- a/trunk/arch/avr32/include/uapi/asm/Kbuild +++ /dev/null @@ -1,3 +0,0 @@ -# UAPI Header export list -include include/uapi/asm-generic/Kbuild.asm - diff --git a/trunk/arch/blackfin/include/asm/elf.h b/trunk/arch/blackfin/include/asm/elf.h index 14bc98ff668f..e6c6812a9abd 100644 --- a/trunk/arch/blackfin/include/asm/elf.h +++ b/trunk/arch/blackfin/include/asm/elf.h @@ -132,7 +132,6 @@ do { \ #define ELF_PLATFORM (NULL) -#define SET_PERSONALITY(ex) \ - set_personality(PER_LINUX | (current->personality & (~PER_MASK))) +#define SET_PERSONALITY(ex) set_personality(PER_LINUX) #endif diff --git a/trunk/arch/blackfin/include/uapi/asm/Kbuild b/trunk/arch/blackfin/include/uapi/asm/Kbuild deleted file mode 100644 index baebb3da1d44..000000000000 --- a/trunk/arch/blackfin/include/uapi/asm/Kbuild +++ /dev/null @@ -1,3 +0,0 @@ -# UAPI Header export list -include include/uapi/asm-generic/Kbuild.asm - diff --git a/trunk/arch/c6x/include/asm/elf.h b/trunk/arch/c6x/include/asm/elf.h index 32b997126adf..f4552db20b4a 100644 --- a/trunk/arch/c6x/include/asm/elf.h +++ b/trunk/arch/c6x/include/asm/elf.h @@ -77,8 +77,7 @@ do { \ #define ELF_PLATFORM (NULL) -#define SET_PERSONALITY(ex) \ - set_personality(PER_LINUX | (current->personality & (~PER_MASK))) +#define SET_PERSONALITY(ex) set_personality(PER_LINUX) /* C6X specific section types */ #define SHT_C6000_UNWIND 0x70000001 diff --git a/trunk/arch/c6x/include/uapi/asm/Kbuild b/trunk/arch/c6x/include/uapi/asm/Kbuild deleted file mode 100644 index baebb3da1d44..000000000000 --- a/trunk/arch/c6x/include/uapi/asm/Kbuild +++ /dev/null @@ -1,3 +0,0 @@ -# UAPI Header export list -include include/uapi/asm-generic/Kbuild.asm - diff --git a/trunk/arch/cris/Kconfig b/trunk/arch/cris/Kconfig index 72bd5ae50a89..e92215428a37 100644 --- a/trunk/arch/cris/Kconfig +++ b/trunk/arch/cris/Kconfig @@ -138,6 +138,11 @@ config CRIS_MACH_ARTPEC3 endchoice +config ETRAX_VCS_SIM + bool "VCS Simulator" + help + Setup hardware to be run in the VCS simulator. + config ETRAX_ARCH_V10 bool default y if ETRAX100LX || ETRAX100LX_V2 diff --git a/trunk/arch/cris/Makefile b/trunk/arch/cris/Makefile index 39dc7d00083e..29c2ceb38a76 100644 --- a/trunk/arch/cris/Makefile +++ b/trunk/arch/cris/Makefile @@ -23,9 +23,7 @@ mach-$(CONFIG_ETRAXFS) := fs ifneq ($(arch-y),) SARCH := arch-$(arch-y) -inc := -Iarch/cris/include/uapi/$(SARCH) -inc += -Iarch/cris/include/$(SARCH) -inc += -Iarch/cris/include/uapi/$(SARCH)/arch +inc := -Iarch/cris/include/$(SARCH) inc += -Iarch/cris/include/$(SARCH)/arch else SARCH := diff --git a/trunk/arch/cris/arch-v32/drivers/axisflashmap.c b/trunk/arch/cris/arch-v32/drivers/axisflashmap.c index 1b6ad6247204..b34438e026be 100644 --- a/trunk/arch/cris/arch-v32/drivers/axisflashmap.c +++ b/trunk/arch/cris/arch-v32/drivers/axisflashmap.c @@ -329,6 +329,7 @@ static int __init init_axis_flash(void) } #endif +#ifndef CONFIG_ETRAX_VCS_SIM main_mtd = flash_probe(); if (main_mtd) printk(KERN_INFO "%s: 0x%08x bytes of NOR flash memory.\n", @@ -602,7 +603,34 @@ static int __init init_axis_flash(void) "partition %d\n", part); } } +#endif /* CONFIG_EXTRAX_VCS_SIM */ +#ifdef CONFIG_ETRAX_VCS_SIM + /* For simulator, always use a RAM partition. + * The rootfs will be found after the kernel in RAM, + * with romfs_start and romfs_end indicating location and size. + */ + struct mtd_info *mtd_ram; + + mtd_ram = kmalloc(sizeof(struct mtd_info), GFP_KERNEL); + if (!mtd_ram) { + panic("axisflashmap: Couldn't allocate memory for " + "mtd_info!\n"); + } + + printk(KERN_INFO "axisflashmap: Adding RAM partition for romfs, " + "at %u, size %u\n", + (unsigned) romfs_start, (unsigned) romfs_length); + + err = mtdram_init_device(mtd_ram, (void *)romfs_start, + romfs_length, "romfs"); + if (err) { + panic("axisflashmap: Could not initialize MTD RAM " + "device!\n"); + } +#endif /* CONFIG_EXTRAX_VCS_SIM */ + +#ifndef CONFIG_ETRAX_VCS_SIM if (aux_mtd) { aux_partition.size = aux_mtd->size; err = mtd_device_register(aux_mtd, &aux_partition, 1); @@ -611,6 +639,7 @@ static int __init init_axis_flash(void) "aux mtd device!\n"); } +#endif /* CONFIG_EXTRAX_VCS_SIM */ return err; } diff --git a/trunk/arch/cris/arch-v32/drivers/pci/bios.c b/trunk/arch/cris/arch-v32/drivers/pci/bios.c index e3dfc72d0cfd..5b1ee82f63c5 100644 --- a/trunk/arch/cris/arch-v32/drivers/pci/bios.c +++ b/trunk/arch/cris/arch-v32/drivers/pci/bios.c @@ -97,3 +97,28 @@ int pcibios_enable_device(struct pci_dev *dev, int mask) pcibios_enable_irq(dev); return 0; } + +int pcibios_assign_resources(void) +{ + struct pci_dev *dev = NULL; + int idx; + struct resource *r; + + while ((dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) { + int class = dev->class >> 8; + + /* Don't touch classless devices and host bridges */ + if (!class || class == PCI_CLASS_BRIDGE_HOST) + continue; + + for(idx=0; idx<6; idx++) { + r = &dev->resource[idx]; + + if (!r->start && r->end) + pci_assign_resource(dev, idx); + } + } + return 0; +} + +EXPORT_SYMBOL(pcibios_assign_resources); diff --git a/trunk/arch/cris/arch-v32/kernel/head.S b/trunk/arch/cris/arch-v32/kernel/head.S index 51e34165ece7..5d502b9ab56d 100644 --- a/trunk/arch/cris/arch-v32/kernel/head.S +++ b/trunk/arch/cris/arch-v32/kernel/head.S @@ -36,6 +36,13 @@ .global nand_boot .global swapper_pg_dir + ;; Dummy section to make it bootable with current VCS simulator +#ifdef CONFIG_ETRAX_VCS_SIM + .section ".boot", "ax" + ba tstart + nop +#endif + .text tstart: ;; This is the entry point of the kernel. The CPU is currently in @@ -68,10 +75,17 @@ secondary_cpu_entry: /* Entry point for secondary CPUs */ | REG_FIELD(mmu, rw_mm_kbase_hi, base_c, 4) \ | REG_FIELD(mmu, rw_mm_kbase_hi, base_d, 5) \ | REG_FIELD(mmu, rw_mm_kbase_hi, base_b, 0xb), $r0 -#else +#elif !defined(CONFIG_ETRAX_VCS_SIM) move.d REG_FIELD(mmu, rw_mm_kbase_hi, base_e, 8) \ | REG_FIELD(mmu, rw_mm_kbase_hi, base_c, 4) \ | REG_FIELD(mmu, rw_mm_kbase_hi, base_b, 0xb), $r0 +#else + ;; Map the virtual DRAM to the RW eprom area at address 0. + ;; Also map 0xa for the hook calls, + move.d REG_FIELD(mmu, rw_mm_kbase_hi, base_e, 8) \ + | REG_FIELD(mmu, rw_mm_kbase_hi, base_c, 4) \ + | REG_FIELD(mmu, rw_mm_kbase_hi, base_b, 0xb) \ + | REG_FIELD(mmu, rw_mm_kbase_hi, base_a, 0xa), $r0 #endif ;; Temporary map of 0x40 -> 0x40 and 0x00 -> 0x00. @@ -112,7 +126,7 @@ secondary_cpu_entry: /* Entry point for secondary CPUs */ | REG_STATE(mmu, rw_mm_cfg, seg_2, page) \ | REG_STATE(mmu, rw_mm_cfg, seg_1, page) \ | REG_STATE(mmu, rw_mm_cfg, seg_0, linear), $r2 -#else +#elif !defined(CONFIG_ETRAX_VCS_SIM) move.d REG_STATE(mmu, rw_mm_cfg, we, on) \ | REG_STATE(mmu, rw_mm_cfg, acc, on) \ | REG_STATE(mmu, rw_mm_cfg, ex, on) \ @@ -133,6 +147,27 @@ secondary_cpu_entry: /* Entry point for secondary CPUs */ | REG_STATE(mmu, rw_mm_cfg, seg_2, page) \ | REG_STATE(mmu, rw_mm_cfg, seg_1, page) \ | REG_STATE(mmu, rw_mm_cfg, seg_0, linear), $r2 +#else + move.d REG_STATE(mmu, rw_mm_cfg, we, on) \ + | REG_STATE(mmu, rw_mm_cfg, acc, on) \ + | REG_STATE(mmu, rw_mm_cfg, ex, on) \ + | REG_STATE(mmu, rw_mm_cfg, inv, on) \ + | REG_STATE(mmu, rw_mm_cfg, seg_f, linear) \ + | REG_STATE(mmu, rw_mm_cfg, seg_e, linear) \ + | REG_STATE(mmu, rw_mm_cfg, seg_d, page) \ + | REG_STATE(mmu, rw_mm_cfg, seg_c, linear) \ + | REG_STATE(mmu, rw_mm_cfg, seg_b, linear) \ + | REG_STATE(mmu, rw_mm_cfg, seg_a, linear) \ + | REG_STATE(mmu, rw_mm_cfg, seg_9, page) \ + | REG_STATE(mmu, rw_mm_cfg, seg_8, page) \ + | REG_STATE(mmu, rw_mm_cfg, seg_7, page) \ + | REG_STATE(mmu, rw_mm_cfg, seg_6, page) \ + | REG_STATE(mmu, rw_mm_cfg, seg_5, page) \ + | REG_STATE(mmu, rw_mm_cfg, seg_4, linear) \ + | REG_STATE(mmu, rw_mm_cfg, seg_3, page) \ + | REG_STATE(mmu, rw_mm_cfg, seg_2, page) \ + | REG_STATE(mmu, rw_mm_cfg, seg_1, page) \ + | REG_STATE(mmu, rw_mm_cfg, seg_0, linear), $r2 #endif ;; Update instruction MMU. @@ -191,6 +226,7 @@ master_cpu: move.d secondary_cpu_entry, $r1 move.d $r1, [$r0] #endif +#ifndef CONFIG_ETRAX_VCS_SIM ; Check if starting from DRAM (network->RAM boot or unpacked ; compressed kernel), or directly from flash. lapcq ., $r0 @@ -198,6 +234,7 @@ master_cpu: cmp.d 0x10000, $r0 ; Arbitrary, something above this code. blo _inflash0 nop +#endif jump _inram ; Jump to cached RAM. nop @@ -289,6 +326,7 @@ move_cramfs: move.d romfs_length, $r1 move.d $r0, [$r1] +#ifndef CONFIG_ETRAX_VCS_SIM ;; The kernel could have been unpacked to DRAM by the loader, but ;; the cramfs image could still be in the flash immediately ;; following the compressed kernel image. The loader passes the address @@ -297,6 +335,10 @@ move_cramfs: cmp.d 0x0ffffff8, $r9 bhs _no_romfs_in_flash ; R9 points outside the flash area. nop +#else + ba _no_romfs_in_flash + nop +#endif ;; cramfs rootfs might to be in flash. Check for it. move.d [$r9], $r0 ; cramfs_super.magic cmp.d CRAMFS_MAGIC, $r0 @@ -354,6 +396,7 @@ _no_romfs_in_flash: move.d romfs_length, $r3 move.d $r2, [$r3] ; store size at romfs_length +#ifndef CONFIG_ETRAX_VCS_SIM add.d $r2, $r0 ; copy from end and downwards add.d $r2, $r1 @@ -367,6 +410,7 @@ _no_romfs_in_flash: subq 1, $r2 bne 1b nop +#endif 4: ;; BSS move done. @@ -411,6 +455,7 @@ no_command_line: move.d etrax_irv, $r1 ; Set the exception base register and pointer. move.d $r0, [$r1] +#ifndef CONFIG_ETRAX_VCS_SIM ;; Clear the BSS region from _bss_start to _end. move.d __bss_start, $r0 move.d _end, $r1 @@ -418,6 +463,15 @@ no_command_line: cmp.d $r1, $r0 blo 1b nop +#endif + +#ifdef CONFIG_ETRAX_VCS_SIM + /* Set the watchdog timeout to something big. Will be removed when */ + /* watchdog can be disabled with command line option */ + move.d 0x7fffffff, $r10 + jsr CPU_WATCHDOG_TIMEOUT + nop +#endif ; Initialize registers to increase determinism move.d __bss_start, $r0 diff --git a/trunk/arch/cris/arch-v32/kernel/kgdb.c b/trunk/arch/cris/arch-v32/kernel/kgdb.c index b06813aeb120..8c1d35cdf00a 100644 --- a/trunk/arch/cris/arch-v32/kernel/kgdb.c +++ b/trunk/arch/cris/arch-v32/kernel/kgdb.c @@ -381,9 +381,23 @@ static int read_register(char regno, unsigned int *valptr); /* Serial port, reads one character. ETRAX 100 specific. from debugport.c */ int getDebugChar(void); +#ifdef CONFIG_ETRAX_VCS_SIM +int getDebugChar(void) +{ + return socketread(); +} +#endif + /* Serial port, writes one character. ETRAX 100 specific. from debugport.c */ void putDebugChar(int val); +#ifdef CONFIG_ETRAX_VCS_SIM +void putDebugChar(int val) +{ + socketwrite((char *)&val, 1); +} +#endif + /* Returns the integer equivalent of a hexadecimal character. */ static int hex(char ch); diff --git a/trunk/arch/cris/arch-v32/mach-a3/Makefile b/trunk/arch/cris/arch-v32/mach-a3/Makefile index d366e0891988..41fa6a6893a9 100644 --- a/trunk/arch/cris/arch-v32/mach-a3/Makefile +++ b/trunk/arch/cris/arch-v32/mach-a3/Makefile @@ -1,8 +1,10 @@ +# $Id: Makefile,v 1.3 2007/03/13 11:57:46 starvik Exp $ # # Makefile for the linux kernel. # obj-y := dma.o pinmux.o io.o arbiter.o +obj-$(CONFIG_ETRAX_VCS_SIM) += vcs_hook.o obj-$(CONFIG_CPU_FREQ) += cpufreq.o clean: diff --git a/trunk/arch/cris/arch-v32/mach-a3/vcs_hook.c b/trunk/arch/cris/arch-v32/mach-a3/vcs_hook.c new file mode 100644 index 000000000000..58b1a5469fd7 --- /dev/null +++ b/trunk/arch/cris/arch-v32/mach-a3/vcs_hook.c @@ -0,0 +1,103 @@ +/* + * Simulator hook mechanism + */ + +#include "vcs_hook.h" +#include +#include + +#define HOOK_TRIG_ADDR 0xb7000000 +#define HOOK_MEM_BASE_ADDR 0xce000000 + +static volatile unsigned *hook_base; + +#define HOOK_DATA(offset) hook_base[offset] +#define VHOOK_DATA(offset) hook_base[offset] +#define HOOK_TRIG(funcid) \ + do { \ + *((unsigned *) HOOK_TRIG_ADDR) = funcid; \ + } while (0) +#define HOOK_DATA_BYTE(offset) ((unsigned char *)hook_base)[offset] + +static void hook_init(void) +{ + static int first = 1; + if (first) { + first = 0; + hook_base = ioremap(HOOK_MEM_BASE_ADDR, 8192); + } +} + +static unsigned hook_trig(unsigned id) +{ + unsigned ret; + + /* preempt_disable(); */ + + /* Dummy read from mem to make sure data has propagated to memory + * before trigging */ + ret = *hook_base; + + /* trigger hook */ + HOOK_TRIG(id); + + /* wait for call to finish */ + while (VHOOK_DATA(0) > 0) ; + + /* extract return value */ + + ret = VHOOK_DATA(1); + + return ret; +} + +int hook_call(unsigned id, unsigned pcnt, ...) +{ + va_list ap; + int i; + unsigned ret; + + hook_init(); + + HOOK_DATA(0) = id; + + va_start(ap, pcnt); + for (i = 1; i <= pcnt; i++) + HOOK_DATA(i) = va_arg(ap, unsigned); + va_end(ap); + + ret = hook_trig(id); + + return ret; +} + +int hook_call_str(unsigned id, unsigned size, const char *str) +{ + int i; + unsigned ret; + + hook_init(); + + HOOK_DATA(0) = id; + HOOK_DATA(1) = size; + + for (i = 0; i < size; i++) + HOOK_DATA_BYTE(8 + i) = str[i]; + HOOK_DATA_BYTE(8 + i) = 0; + + ret = hook_trig(id); + + return ret; +} + +void print_str(const char *str) +{ + int i; + /* find null at end of string */ + for (i = 1; str[i]; i++) ; + hook_call(hook_print_str, i, str); +} + +void CPU_WATCHDOG_TIMEOUT(unsigned t) +{ +} diff --git a/trunk/arch/cris/arch-v32/mach-a3/vcs_hook.h b/trunk/arch/cris/arch-v32/mach-a3/vcs_hook.h new file mode 100644 index 000000000000..8b73d0e8392d --- /dev/null +++ b/trunk/arch/cris/arch-v32/mach-a3/vcs_hook.h @@ -0,0 +1,58 @@ +/* + * Simulator hook call mechanism + */ + +#ifndef __hook_h__ +#define __hook_h__ + +int hook_call(unsigned id, unsigned pcnt, ...); +int hook_call_str(unsigned id, unsigned size, const char *str); + +enum hook_ids { + hook_debug_on = 1, + hook_debug_off, + hook_stop_sim_ok, + hook_stop_sim_fail, + hook_alloc_shared, + hook_ptr_shared, + hook_free_shared, + hook_file2shared, + hook_cmp_shared, + hook_print_params, + hook_sim_time, + hook_stop_sim, + hook_kick_dog, + hook_dog_timeout, + hook_rand, + hook_srand, + hook_rand_range, + hook_print_str, + hook_print_hex, + hook_cmp_offset_shared, + hook_fill_random_shared, + hook_alloc_random_data, + hook_calloc_random_data, + hook_print_int, + hook_print_uint, + hook_fputc, + hook_init_fd, + hook_sbrk, + hook_print_context_descr, + hook_print_data_descr, + hook_print_group_descr, + hook_fill_shared, + hook_sl_srand, + hook_sl_rand_irange, + hook_sl_rand_urange, + hook_sl_sh_malloc_aligned, + hook_sl_sh_calloc_aligned, + hook_sl_sh_alloc_random_data, + hook_sl_sh_file2mem, + hook_sl_vera_mbox_handle, + hook_sl_vera_mbox_put, + hook_sl_vera_mbox_get, + hook_sl_system, + hook_sl_sh_hexdump +}; + +#endif diff --git a/trunk/arch/cris/arch-v32/mach-fs/Makefile b/trunk/arch/cris/arch-v32/mach-fs/Makefile index d366e0891988..41fa6a6893a9 100644 --- a/trunk/arch/cris/arch-v32/mach-fs/Makefile +++ b/trunk/arch/cris/arch-v32/mach-fs/Makefile @@ -1,8 +1,10 @@ +# $Id: Makefile,v 1.3 2007/03/13 11:57:46 starvik Exp $ # # Makefile for the linux kernel. # obj-y := dma.o pinmux.o io.o arbiter.o +obj-$(CONFIG_ETRAX_VCS_SIM) += vcs_hook.o obj-$(CONFIG_CPU_FREQ) += cpufreq.o clean: diff --git a/trunk/arch/cris/arch-v32/mach-fs/vcs_hook.c b/trunk/arch/cris/arch-v32/mach-fs/vcs_hook.c new file mode 100644 index 000000000000..b11594ae0cb6 --- /dev/null +++ b/trunk/arch/cris/arch-v32/mach-fs/vcs_hook.c @@ -0,0 +1,100 @@ +/* + * Call simulator hook. This is the part running in the + * simulated program. + */ + +#include "vcs_hook.h" +#include +#include +#include + +#define HOOK_TRIG_ADDR 0xb7000000 /* hook cvlog model reg address */ +#define HOOK_MEM_BASE_ADDR 0xa0000000 /* csp4 (shared mem) base addr */ + +#define HOOK_DATA(offset) ((unsigned *)HOOK_MEM_BASE_ADDR)[offset] +#define VHOOK_DATA(offset) ((volatile unsigned *)HOOK_MEM_BASE_ADDR)[offset] +#define HOOK_TRIG(funcid) \ + do { \ + *((unsigned *) HOOK_TRIG_ADDR) = funcid; \ + } while (0) +#define HOOK_DATA_BYTE(offset) ((unsigned char *)HOOK_MEM_BASE_ADDR)[offset] + +int hook_call(unsigned id, unsigned pcnt, ...) +{ + va_list ap; + unsigned i; + unsigned ret; +#ifdef USING_SOS + PREEMPT_OFF_SAVE(); +#endif + + /* pass parameters */ + HOOK_DATA(0) = id; + + /* Have to make hook_print_str a special case since we call with a + * parameter of byte type. Should perhaps be a separate + * hook_call. */ + + if (id == hook_print_str) { + int i; + char *str; + + HOOK_DATA(1) = pcnt; + + va_start(ap, pcnt); + str = (char *)va_arg(ap, unsigned); + + for (i = 0; i != pcnt; i++) + HOOK_DATA_BYTE(8 + i) = str[i]; + + HOOK_DATA_BYTE(8 + i) = 0; /* null byte */ + } else { + va_start(ap, pcnt); + for (i = 1; i <= pcnt; i++) + HOOK_DATA(i) = va_arg(ap, unsigned); + va_end(ap); + } + + /* read from mem to make sure data has propagated to memory before + * trigging */ + ret = *((volatile unsigned *)HOOK_MEM_BASE_ADDR); + + /* trigger hook */ + HOOK_TRIG(id); + + /* wait for call to finish */ + while (VHOOK_DATA(0) > 0) ; + + /* extract return value */ + + ret = VHOOK_DATA(1); + +#ifdef USING_SOS + PREEMPT_RESTORE(); +#endif + return ret; +} + +unsigned hook_buf(unsigned i) +{ + return (HOOK_DATA(i)); +} + +void print_str(const char *str) +{ + int i; + /* find null at end of string */ + for (i = 1; str[i]; i++) ; + hook_call(hook_print_str, i, str); +} + +void CPU_KICK_DOG(void) +{ + (void)hook_call(hook_kick_dog, 0); +} + +void CPU_WATCHDOG_TIMEOUT(unsigned t) +{ + (void)hook_call(hook_dog_timeout, 1, t); +} + diff --git a/trunk/arch/cris/arch-v32/mach-fs/vcs_hook.h b/trunk/arch/cris/arch-v32/mach-fs/vcs_hook.h new file mode 100644 index 000000000000..c000b9fece41 --- /dev/null +++ b/trunk/arch/cris/arch-v32/mach-fs/vcs_hook.h @@ -0,0 +1,42 @@ +/* + * Call simulator hook functions + */ + +#ifndef HOOK_H +#define HOOK_H + +int hook_call(unsigned id, unsigned pcnt, ...); + +enum hook_ids { + hook_debug_on = 1, + hook_debug_off, + hook_stop_sim_ok, + hook_stop_sim_fail, + hook_alloc_shared, + hook_ptr_shared, + hook_free_shared, + hook_file2shared, + hook_cmp_shared, + hook_print_params, + hook_sim_time, + hook_stop_sim, + hook_kick_dog, + hook_dog_timeout, + hook_rand, + hook_srand, + hook_rand_range, + hook_print_str, + hook_print_hex, + hook_cmp_offset_shared, + hook_fill_random_shared, + hook_alloc_random_data, + hook_calloc_random_data, + hook_print_int, + hook_print_uint, + hook_fputc, + hook_init_fd, + hook_sbrk + +}; + +#endif diff --git a/trunk/arch/cris/arch-v32/mm/init.c b/trunk/arch/cris/arch-v32/mm/init.c index 3deca5253d91..0768bc409ca8 100644 --- a/trunk/arch/cris/arch-v32/mm/init.c +++ b/trunk/arch/cris/arch-v32/mm/init.c @@ -73,7 +73,11 @@ void __init cris_mmu_init(void) #endif REG_STATE(mmu, rw_mm_cfg, seg_c, linear) | REG_STATE(mmu, rw_mm_cfg, seg_b, linear) | +#ifndef CONFIG_ETRAX_VCS_SIM REG_STATE(mmu, rw_mm_cfg, seg_a, page) | +#else + REG_STATE(mmu, rw_mm_cfg, seg_a, linear) | +#endif REG_STATE(mmu, rw_mm_cfg, seg_9, page) | REG_STATE(mmu, rw_mm_cfg, seg_8, page) | REG_STATE(mmu, rw_mm_cfg, seg_7, page) | @@ -96,7 +100,11 @@ void __init cris_mmu_init(void) #endif REG_FIELD(mmu, rw_mm_kbase_hi, base_c, 0x4) | REG_FIELD(mmu, rw_mm_kbase_hi, base_b, 0xb) | +#ifndef CONFIG_ETRAX_VCS_SIM REG_FIELD(mmu, rw_mm_kbase_hi, base_a, 0x0) | +#else + REG_FIELD(mmu, rw_mm_kbase_hi, base_a, 0xa) | +#endif REG_FIELD(mmu, rw_mm_kbase_hi, base_9, 0x0) | REG_FIELD(mmu, rw_mm_kbase_hi, base_8, 0x0)); diff --git a/trunk/arch/cris/include/arch-v10/arch/sv_addr_ag.h b/trunk/arch/cris/include/arch-v10/arch/sv_addr_ag.h index 5517f04153a4..e4a6b68b8982 100644 --- a/trunk/arch/cris/include/arch-v10/arch/sv_addr_ag.h +++ b/trunk/arch/cris/include/arch-v10/arch/sv_addr_ag.h @@ -114,7 +114,7 @@ /*------------------------------------------------------------*/ -#include +#include "sv_addr.agh" #if __test_sv_addr__ /* IO_MASK( R_BUS_CONFIG , CE ) */ diff --git a/trunk/arch/cris/include/arch-v10/arch/svinto.h b/trunk/arch/cris/include/arch-v10/arch/svinto.h index da5c15272652..0881a1af7cee 100644 --- a/trunk/arch/cris/include/arch-v10/arch/svinto.h +++ b/trunk/arch/cris/include/arch-v10/arch/svinto.h @@ -1,7 +1,7 @@ #ifndef _ASM_CRIS_SVINTO_H #define _ASM_CRIS_SVINTO_H -#include +#include "sv_addr_ag.h" extern unsigned int genconfig_shadow; /* defined and set in head.S */ diff --git a/trunk/arch/cris/include/arch-v32/arch/dma.h b/trunk/arch/cris/include/arch-v32/arch/dma.h index 6f92f4f23f28..61906153a9af 100644 --- a/trunk/arch/cris/include/arch-v32/arch/dma.h +++ b/trunk/arch/cris/include/arch-v32/arch/dma.h @@ -1 +1 @@ -#include +#include "mach/dma.h" diff --git a/trunk/arch/cris/include/arch-v32/arch/hwregs/dma.h b/trunk/arch/cris/include/arch-v32/arch/hwregs/dma.h index 52bf67907f28..3ce322b5c731 100644 --- a/trunk/arch/cris/include/arch-v32/arch/hwregs/dma.h +++ b/trunk/arch/cris/include/arch-v32/arch/hwregs/dma.h @@ -7,7 +7,7 @@ #define dma_h /* registers */ /* Really needed, since both are listed in sw.list? */ -#include +#include "dma_defs.h" /* descriptors */ diff --git a/trunk/arch/cris/include/arch-v32/arch/page.h b/trunk/arch/cris/include/arch-v32/arch/page.h index e5b5aab52de8..20f1b4806bfe 100644 --- a/trunk/arch/cris/include/arch-v32/arch/page.h +++ b/trunk/arch/cris/include/arch-v32/arch/page.h @@ -11,8 +11,13 @@ * selected bit it's possible to convert between KSEG_x and 0x40000000 where the * DRAM really resides. DRAM is virtually at 0xc. */ +#ifndef CONFIG_ETRAX_VCS_SIM #define __pa(x) ((unsigned long)(x) & 0x7fffffff) #define __va(x) ((void *)((unsigned long)(x) | 0x80000000)) +#else +#define __pa(x) ((unsigned long)(x) & 0x3fffffff) +#define __va(x) ((void *)((unsigned long)(x) | 0xc0000000)) +#endif #define VM_STACK_DEFAULT_FLAGS (VM_READ | VM_WRITE | \ VM_MAYREAD | VM_MAYWRITE) diff --git a/trunk/arch/cris/include/arch-v32/arch/processor.h b/trunk/arch/cris/include/arch-v32/arch/processor.h index a024b7d32fed..9603c907fbc4 100644 --- a/trunk/arch/cris/include/arch-v32/arch/processor.h +++ b/trunk/arch/cris/include/arch-v32/arch/processor.h @@ -21,9 +21,13 @@ struct thread_struct { /* * User-space process size. This is hardcoded into a few places, so don't - * change it unless everything's clear! + * changed it unless everything's clear! */ +#ifndef CONFIG_ETRAX_VCS_SIM #define TASK_SIZE (0xB0000000UL) +#else +#define TASK_SIZE (0xA0000000UL) +#endif /* CCS I=1, enable interrupts. */ #define INIT_THREAD { 0, 0, (1 << I_CCS_BITNR) } diff --git a/trunk/arch/cris/include/arch-v32/mach-fs/mach/startup.inc b/trunk/arch/cris/include/arch-v32/mach-fs/mach/startup.inc index 96c3b0fb62c1..dd1abbdcbc7a 100644 --- a/trunk/arch/cris/include/arch-v32/mach-fs/mach/startup.inc +++ b/trunk/arch/cris/include/arch-v32/mach-fs/mach/startup.inc @@ -71,6 +71,12 @@ move.d REG_ADDR(bif_core, regi_bif_core, rw_grp4_cfg), $r0 move.d CONFIG_ETRAX_MEM_GRP4_CONFIG, $r1 move.d $r1, [$r0] +#ifdef CONFIG_ETRAX_VCS_SIM + ;; Set up minimal flash waitstates + move.d 0, $r10 + move.d REG_ADDR(bif_core, regi_bif_core, rw_grp1_cfg), $r11 + move.d $r10, [$r11] +#endif .endm #endif diff --git a/trunk/arch/cris/include/asm/elf.h b/trunk/arch/cris/include/asm/elf.h index 8182f2dc89d0..8a3d8e2b33c1 100644 --- a/trunk/arch/cris/include/asm/elf.h +++ b/trunk/arch/cris/include/asm/elf.h @@ -86,7 +86,6 @@ typedef unsigned long elf_fpregset_t; #define ELF_PLATFORM (NULL) -#define SET_PERSONALITY(ex) \ - set_personality(PER_LINUX | (current->personality & (~PER_MASK))) +#define SET_PERSONALITY(ex) set_personality(PER_LINUX) #endif diff --git a/trunk/arch/cris/include/asm/pci.h b/trunk/arch/cris/include/asm/pci.h index 146da904cdd8..9f1cd56da28c 100644 --- a/trunk/arch/cris/include/asm/pci.h +++ b/trunk/arch/cris/include/asm/pci.h @@ -19,6 +19,7 @@ extern unsigned long pci_mem_start; void pcibios_config_init(void); struct pci_bus * pcibios_scan_root(int bus); +int pcibios_assign_resources(void); void pcibios_set_master(struct pci_dev *dev); void pcibios_penalize_isa_irq(int irq); diff --git a/trunk/arch/cris/include/uapi/arch-v10/arch/Kbuild b/trunk/arch/cris/include/uapi/arch-v10/arch/Kbuild deleted file mode 100644 index aafaa5aa54d4..000000000000 --- a/trunk/arch/cris/include/uapi/arch-v10/arch/Kbuild +++ /dev/null @@ -1 +0,0 @@ -# UAPI Header export list diff --git a/trunk/arch/cris/include/uapi/arch-v32/arch/Kbuild b/trunk/arch/cris/include/uapi/arch-v32/arch/Kbuild deleted file mode 100644 index aafaa5aa54d4..000000000000 --- a/trunk/arch/cris/include/uapi/arch-v32/arch/Kbuild +++ /dev/null @@ -1 +0,0 @@ -# UAPI Header export list diff --git a/trunk/arch/cris/include/uapi/asm/Kbuild b/trunk/arch/cris/include/uapi/asm/Kbuild deleted file mode 100644 index f50236ae9ca3..000000000000 --- a/trunk/arch/cris/include/uapi/asm/Kbuild +++ /dev/null @@ -1,5 +0,0 @@ -# UAPI Header export list -include include/uapi/asm-generic/Kbuild.asm - -header-y += arch-v10/ -header-y += arch-v32/ diff --git a/trunk/arch/frv/include/asm/elf.h b/trunk/arch/frv/include/asm/elf.h index 9ccbc80f0b11..c3819804a74b 100644 --- a/trunk/arch/frv/include/asm/elf.h +++ b/trunk/arch/frv/include/asm/elf.h @@ -137,7 +137,6 @@ do { \ #define ELF_PLATFORM (NULL) -#define SET_PERSONALITY(ex) \ - set_personality(PER_LINUX | (current->personality & (~PER_MASK))) +#define SET_PERSONALITY(ex) set_personality(PER_LINUX) #endif diff --git a/trunk/arch/frv/include/uapi/asm/Kbuild b/trunk/arch/frv/include/uapi/asm/Kbuild deleted file mode 100644 index baebb3da1d44..000000000000 --- a/trunk/arch/frv/include/uapi/asm/Kbuild +++ /dev/null @@ -1,3 +0,0 @@ -# UAPI Header export list -include include/uapi/asm-generic/Kbuild.asm - diff --git a/trunk/arch/frv/kernel/pm.c b/trunk/arch/frv/kernel/pm.c index 0b579927439d..5fa3889d858b 100644 --- a/trunk/arch/frv/kernel/pm.c +++ b/trunk/arch/frv/kernel/pm.c @@ -153,22 +153,23 @@ static int user_atoi(char __user *ubuf, size_t len) static int sysctl_pm_do_suspend(ctl_table *ctl, int write, void __user *buffer, size_t *lenp, loff_t *fpos) { - int mode; + int retval, mode; if (*lenp <= 0) return -EIO; mode = user_atoi(buffer, *lenp); - switch (mode) { - case 1: - return pm_do_suspend(); - - case 5: - return pm_do_bus_sleep(); + if ((mode != 1) && (mode != 5)) + return -EINVAL; - default: - return -EINVAL; + if (retval == 0) { + if (mode == 5) + retval = pm_do_bus_sleep(); + else + retval = pm_do_suspend(); } + + return retval; } static int try_set_cmode(int new_cmode) diff --git a/trunk/arch/frv/kernel/setup.c b/trunk/arch/frv/kernel/setup.c index 1f1e5efb3385..75cf7f4b2fa8 100644 --- a/trunk/arch/frv/kernel/setup.c +++ b/trunk/arch/frv/kernel/setup.c @@ -184,7 +184,7 @@ static struct clock_cmode __pminitdata clock_cmodes_fr555[16] = { [6] = { _x1, _x1_5, _x1_5, _x4_5, _x0_375 }, }; -static const struct clock_cmode __pminitconst *clock_cmodes; +static const struct clock_cmode __pminitdata *clock_cmodes; static int __pminitdata clock_doubled; static struct uart_port __pminitdata __frv_uart0 = { diff --git a/trunk/arch/frv/mb93090-mb00/pci-irq.c b/trunk/arch/frv/mb93090-mb00/pci-irq.c index c677b9d81d30..20f6497b2cd5 100644 --- a/trunk/arch/frv/mb93090-mb00/pci-irq.c +++ b/trunk/arch/frv/mb93090-mb00/pci-irq.c @@ -28,7 +28,7 @@ * */ -static const uint8_t __initconst pci_bus0_irq_routing[32][4] = { +static const uint8_t __initdata pci_bus0_irq_routing[32][4] = { [0 ] = { IRQ_FPGA_MB86943_PCI_INTA }, [16] = { IRQ_FPGA_RTL8029_INTA }, [17] = { IRQ_FPGA_PCI_INTC, IRQ_FPGA_PCI_INTD, IRQ_FPGA_PCI_INTA, IRQ_FPGA_PCI_INTB }, diff --git a/trunk/arch/h8300/include/asm/elf.h b/trunk/arch/h8300/include/asm/elf.h index 41193c396bff..c24fa250d653 100644 --- a/trunk/arch/h8300/include/asm/elf.h +++ b/trunk/arch/h8300/include/asm/elf.h @@ -54,8 +54,7 @@ typedef unsigned long elf_fpregset_t; #define ELF_PLATFORM (NULL) -#define SET_PERSONALITY(ex) \ - set_personality(PER_LINUX | (current->personality & (~PER_MASK))) +#define SET_PERSONALITY(ex) set_personality(PER_LINUX) #define R_H8_NONE 0 #define R_H8_DIR32 1 diff --git a/trunk/arch/h8300/include/uapi/asm/Kbuild b/trunk/arch/h8300/include/uapi/asm/Kbuild deleted file mode 100644 index baebb3da1d44..000000000000 --- a/trunk/arch/h8300/include/uapi/asm/Kbuild +++ /dev/null @@ -1,3 +0,0 @@ -# UAPI Header export list -include include/uapi/asm-generic/Kbuild.asm - diff --git a/trunk/arch/h8300/kernel/sys_h8300.c b/trunk/arch/h8300/kernel/sys_h8300.c index 4bdc7311784e..aaf5e5a48f93 100644 --- a/trunk/arch/h8300/kernel/sys_h8300.c +++ b/trunk/arch/h8300/kernel/sys_h8300.c @@ -51,7 +51,6 @@ asmlinkage void syscall_print(void *dummy,...) * Do a system call from kernel instead of calling sys_execve so we * end up with proper pt_regs. */ -asmlinkage int kernel_execve(const char *filename, const char *const argv[], const char *const envp[]) diff --git a/trunk/arch/h8300/kernel/timer/itu.c b/trunk/arch/h8300/kernel/timer/itu.c index 0a8b5cd5bf38..a2ae5e952137 100644 --- a/trunk/arch/h8300/kernel/timer/itu.c +++ b/trunk/arch/h8300/kernel/timer/itu.c @@ -62,7 +62,7 @@ static struct irqaction itu_irq = { .flags = IRQF_DISABLED | IRQF_TIMER, }; -static const int __initconst divide_rate[] = {1, 2, 4, 8}; +static const int __initdata divide_rate[] = {1, 2, 4, 8}; void __init h8300_timer_setup(void) { diff --git a/trunk/arch/h8300/kernel/timer/timer16.c b/trunk/arch/h8300/kernel/timer/timer16.c index 462d9f581719..ae0d38161139 100644 --- a/trunk/arch/h8300/kernel/timer/timer16.c +++ b/trunk/arch/h8300/kernel/timer/timer16.c @@ -57,7 +57,7 @@ static struct irqaction timer16_irq = { .flags = IRQF_DISABLED | IRQF_TIMER, }; -static const int __initconst divide_rate[] = {1, 2, 4, 8}; +static const int __initdata divide_rate[] = {1, 2, 4, 8}; void __init h8300_timer_setup(void) { diff --git a/trunk/arch/h8300/kernel/timer/timer8.c b/trunk/arch/h8300/kernel/timer/timer8.c index 505f3415b40f..7a1533fad47d 100644 --- a/trunk/arch/h8300/kernel/timer/timer8.c +++ b/trunk/arch/h8300/kernel/timer/timer8.c @@ -77,7 +77,7 @@ static struct irqaction timer8_irq = { .flags = IRQF_DISABLED | IRQF_TIMER, }; -static const int __initconst divide_rate[] = {8, 64, 8192}; +static const int __initdata divide_rate[] = {8, 64, 8192}; void __init h8300_timer_setup(void) { diff --git a/trunk/arch/h8300/kernel/timer/tpu.c b/trunk/arch/h8300/kernel/timer/tpu.c index 0350f6204ecf..2193a2e2859a 100644 --- a/trunk/arch/h8300/kernel/timer/tpu.c +++ b/trunk/arch/h8300/kernel/timer/tpu.c @@ -66,7 +66,7 @@ static struct irqaction tpu_irq = { .flags = IRQF_DISABLED | IRQF_TIMER, }; -static const int __initconst divide_rate[] = { +static const int __initdata divide_rate[] = { #if CONFIG_H8300_TPU_CH == 0 1,4,16,64,0,0,0,0, #elif (CONFIG_H8300_TPU_CH == 1) || (CONFIG_H8300_TPU_CH == 5) diff --git a/trunk/arch/h8300/platform/h8300h/irq.c b/trunk/arch/h8300/platform/h8300h/irq.c index 0a50353e09d5..bc4f51bceef5 100644 --- a/trunk/arch/h8300/platform/h8300h/irq.c +++ b/trunk/arch/h8300/platform/h8300h/irq.c @@ -14,14 +14,14 @@ #include #include -const int __initconst h8300_saved_vectors[] = { +const int __initdata h8300_saved_vectors[] = { #if defined(CONFIG_GDB_DEBUG) TRAP3_VEC, /* TRAPA #3 is GDB breakpoint */ #endif -1, }; -const h8300_vector __initconst h8300_trap_table[] = { +const h8300_vector __initdata h8300_trap_table[] = { 0, 0, 0, 0, 0, 0, 0, 0, system_call, 0, diff --git a/trunk/arch/h8300/platform/h8s/irq.c b/trunk/arch/h8300/platform/h8s/irq.c index f3a5511c16b1..7b5f29febc07 100644 --- a/trunk/arch/h8300/platform/h8s/irq.c +++ b/trunk/arch/h8300/platform/h8s/irq.c @@ -18,7 +18,7 @@ #include /* saved vector list */ -const int __initconst h8300_saved_vectors[] = { +const int __initdata h8300_saved_vectors[]={ #if defined(CONFIG_GDB_DEBUG) TRACE_VEC, TRAP3_VEC, @@ -27,7 +27,7 @@ const int __initconst h8300_saved_vectors[] = { }; /* trap entry table */ -const H8300_VECTOR __initconst h8300_trap_table[] = { +const H8300_VECTOR __initdata h8300_trap_table[] = { 0,0,0,0,0, trace_break, /* TRACE */ 0,0, diff --git a/trunk/arch/hexagon/include/asm/elf.h b/trunk/arch/hexagon/include/asm/elf.h index 82b499621e05..37976a0d3650 100644 --- a/trunk/arch/hexagon/include/asm/elf.h +++ b/trunk/arch/hexagon/include/asm/elf.h @@ -217,8 +217,7 @@ do { \ #define ELF_PLATFORM (NULL) #ifdef __KERNEL__ -#define SET_PERSONALITY(ex) \ - set_personality(PER_LINUX | (current->personality & (~PER_MASK))) +#define SET_PERSONALITY(ex) set_personality(PER_LINUX) #endif #define ARCH_HAS_SETUP_ADDITIONAL_PAGES 1 diff --git a/trunk/arch/hexagon/include/uapi/asm/Kbuild b/trunk/arch/hexagon/include/uapi/asm/Kbuild deleted file mode 100644 index baebb3da1d44..000000000000 --- a/trunk/arch/hexagon/include/uapi/asm/Kbuild +++ /dev/null @@ -1,3 +0,0 @@ -# UAPI Header export list -include include/uapi/asm-generic/Kbuild.asm - diff --git a/trunk/arch/ia64/include/asm/xen/interface.h b/trunk/arch/ia64/include/asm/xen/interface.h index 3d52a5bbd857..09d5f7fd9db1 100644 --- a/trunk/arch/ia64/include/asm/xen/interface.h +++ b/trunk/arch/ia64/include/asm/xen/interface.h @@ -67,10 +67,6 @@ #define set_xen_guest_handle(hnd, val) do { (hnd).p = val; } while (0) #ifndef __ASSEMBLY__ -/* Explicitly size integers that represent pfns in the public interface - * with Xen so that we could have one ABI that works for 32 and 64 bit - * guests. */ -typedef unsigned long xen_pfn_t; /* Guest handles for primitive C types. */ __DEFINE_GUEST_HANDLE(uchar, unsigned char); __DEFINE_GUEST_HANDLE(uint, unsigned int); @@ -83,6 +79,7 @@ DEFINE_GUEST_HANDLE(void); DEFINE_GUEST_HANDLE(uint64_t); DEFINE_GUEST_HANDLE(uint32_t); +typedef unsigned long xen_pfn_t; DEFINE_GUEST_HANDLE(xen_pfn_t); #define PRI_xen_pfn "lx" #endif @@ -268,8 +265,6 @@ typedef struct xen_callback xen_callback_t; #endif /* !__ASSEMBLY__ */ -#include - /* Size of the shared_info area (this is not related to page size). */ #define XSI_SHIFT 14 #define XSI_SIZE (1 << XSI_SHIFT) diff --git a/trunk/arch/ia64/include/uapi/asm/Kbuild b/trunk/arch/ia64/include/uapi/asm/Kbuild deleted file mode 100644 index baebb3da1d44..000000000000 --- a/trunk/arch/ia64/include/uapi/asm/Kbuild +++ /dev/null @@ -1,3 +0,0 @@ -# UAPI Header export list -include include/uapi/asm-generic/Kbuild.asm - diff --git a/trunk/arch/ia64/kernel/perfmon.c b/trunk/arch/ia64/kernel/perfmon.c index f388b4e18a37..5a5c22245dee 100644 --- a/trunk/arch/ia64/kernel/perfmon.c +++ b/trunk/arch/ia64/kernel/perfmon.c @@ -2306,7 +2306,7 @@ pfm_smpl_buffer_alloc(struct task_struct *task, struct file *filp, pfm_context_t * partially initialize the vma for the sampling buffer */ vma->vm_mm = mm; - vma->vm_file = get_file(filp); + vma->vm_file = filp; vma->vm_flags = VM_READ| VM_MAYREAD |VM_RESERVED; vma->vm_page_prot = PAGE_READONLY; /* XXX may need to change */ @@ -2345,6 +2345,8 @@ pfm_smpl_buffer_alloc(struct task_struct *task, struct file *filp, pfm_context_t goto error; } + get_file(filp); + /* * now insert the vma in the vm list for the process, must be * done with mmap lock held @@ -4780,7 +4782,7 @@ pfm_check_task_state(pfm_context_t *ctx, int cmd, unsigned long flags) asmlinkage long sys_perfmonctl (int fd, int cmd, void __user *arg, int count) { - struct fd f = {NULL, 0}; + struct file *file = NULL; pfm_context_t *ctx = NULL; unsigned long flags = 0UL; void *args_k = NULL; @@ -4877,17 +4879,17 @@ sys_perfmonctl (int fd, int cmd, void __user *arg, int count) ret = -EBADF; - f = fdget(fd); - if (unlikely(f.file == NULL)) { + file = fget(fd); + if (unlikely(file == NULL)) { DPRINT(("invalid fd %d\n", fd)); goto error_args; } - if (unlikely(PFM_IS_FILE(f.file) == 0)) { + if (unlikely(PFM_IS_FILE(file) == 0)) { DPRINT(("fd %d not related to perfmon\n", fd)); goto error_args; } - ctx = f.file->private_data; + ctx = file->private_data; if (unlikely(ctx == NULL)) { DPRINT(("no context for fd %d\n", fd)); goto error_args; @@ -4917,8 +4919,8 @@ sys_perfmonctl (int fd, int cmd, void __user *arg, int count) if (call_made && PFM_CMD_RW_ARG(cmd) && copy_to_user(arg, args_k, base_sz*count)) ret = -EFAULT; error_args: - if (f.file) - fdput(f); + if (file) + fput(file); kfree(args_k); diff --git a/trunk/arch/ia64/kvm/kvm-ia64.c b/trunk/arch/ia64/kvm/kvm-ia64.c index 8b3a9c0e771d..bd77cb507c1c 100644 --- a/trunk/arch/ia64/kvm/kvm-ia64.c +++ b/trunk/arch/ia64/kvm/kvm-ia64.c @@ -924,16 +924,6 @@ int kvm_arch_vcpu_ioctl_set_regs(struct kvm_vcpu *vcpu, struct kvm_regs *regs) return 0; } -int kvm_vm_ioctl_irq_line(struct kvm *kvm, struct kvm_irq_level *irq_event) -{ - if (!irqchip_in_kernel(kvm)) - return -ENXIO; - - irq_event->status = kvm_set_irq(kvm, KVM_USERSPACE_IRQ_SOURCE_ID, - irq_event->irq, irq_event->level); - return 0; -} - long kvm_arch_vm_ioctl(struct file *filp, unsigned int ioctl, unsigned long arg) { @@ -973,6 +963,29 @@ long kvm_arch_vm_ioctl(struct file *filp, goto out; } break; + case KVM_IRQ_LINE_STATUS: + case KVM_IRQ_LINE: { + struct kvm_irq_level irq_event; + + r = -EFAULT; + if (copy_from_user(&irq_event, argp, sizeof irq_event)) + goto out; + r = -ENXIO; + if (irqchip_in_kernel(kvm)) { + __s32 status; + status = kvm_set_irq(kvm, KVM_USERSPACE_IRQ_SOURCE_ID, + irq_event.irq, irq_event.level); + if (ioctl == KVM_IRQ_LINE_STATUS) { + r = -EFAULT; + irq_event.status = status; + if (copy_to_user(argp, &irq_event, + sizeof irq_event)) + goto out; + } + r = 0; + } + break; + } case KVM_GET_IRQCHIP: { /* 0: PIC master, 1: PIC slave, 2: IOAPIC */ struct kvm_irqchip chip; @@ -1613,17 +1626,11 @@ void kvm_arch_commit_memory_region(struct kvm *kvm, return; } -void kvm_arch_flush_shadow_all(struct kvm *kvm) +void kvm_arch_flush_shadow(struct kvm *kvm) { kvm_flush_remote_tlbs(kvm); } -void kvm_arch_flush_shadow_memslot(struct kvm *kvm, - struct kvm_memory_slot *slot) -{ - kvm_arch_flush_shadow_all(); -} - long kvm_arch_dev_ioctl(struct file *filp, unsigned int ioctl, unsigned long arg) { diff --git a/trunk/arch/ia64/xen/irq_xen.c b/trunk/arch/ia64/xen/irq_xen.c index 01f479ee1c43..3bb12230721f 100644 --- a/trunk/arch/ia64/xen/irq_xen.c +++ b/trunk/arch/ia64/xen/irq_xen.c @@ -433,7 +433,7 @@ xen_resend_irq(unsigned int vector) (void)resend_irq_on_evtchn(vector); } -const struct pv_irq_ops xen_irq_ops __initconst = { +const struct pv_irq_ops xen_irq_ops __initdata = { .register_ipi = xen_register_ipi, .assign_irq_vector = xen_assign_irq_vector, diff --git a/trunk/arch/ia64/xen/irq_xen.h b/trunk/arch/ia64/xen/irq_xen.h index 1778517b90fe..26110f330c87 100644 --- a/trunk/arch/ia64/xen/irq_xen.h +++ b/trunk/arch/ia64/xen/irq_xen.h @@ -27,7 +27,7 @@ extern void (*late_time_init)(void); extern char xen_event_callback; void __init xen_init_IRQ(void); -extern const struct pv_irq_ops xen_irq_ops __initconst; +extern const struct pv_irq_ops xen_irq_ops __initdata; extern void xen_smp_intr_init(void); extern void xen_send_ipi(int cpu, int vec); diff --git a/trunk/arch/m32r/include/asm/elf.h b/trunk/arch/m32r/include/asm/elf.h index 70896161c636..b8da7d0574d2 100644 --- a/trunk/arch/m32r/include/asm/elf.h +++ b/trunk/arch/m32r/include/asm/elf.h @@ -128,7 +128,6 @@ typedef elf_fpreg_t elf_fpregset_t; intent than poking at uname or /proc/cpuinfo. */ #define ELF_PLATFORM (NULL) -#define SET_PERSONALITY(ex) \ - set_personality(PER_LINUX | (current->personality & (~PER_MASK))) +#define SET_PERSONALITY(ex) set_personality(PER_LINUX) #endif /* _ASM_M32R__ELF_H */ diff --git a/trunk/arch/m32r/include/uapi/asm/Kbuild b/trunk/arch/m32r/include/uapi/asm/Kbuild deleted file mode 100644 index baebb3da1d44..000000000000 --- a/trunk/arch/m32r/include/uapi/asm/Kbuild +++ /dev/null @@ -1,3 +0,0 @@ -# UAPI Header export list -include include/uapi/asm-generic/Kbuild.asm - diff --git a/trunk/arch/m68k/include/asm/cacheflush.h b/trunk/arch/m68k/include/asm/cacheflush.h index 4fc738209bd1..a70d7319630a 100644 --- a/trunk/arch/m68k/include/asm/cacheflush.h +++ b/trunk/arch/m68k/include/asm/cacheflush.h @@ -1,5 +1,5 @@ #ifdef __uClinux__ -#include +#include "cacheflush_no.h" #else -#include +#include "cacheflush_mm.h" #endif diff --git a/trunk/arch/m68k/include/asm/elf.h b/trunk/arch/m68k/include/asm/elf.h index f83c1d0a87cf..e9b7cda59744 100644 --- a/trunk/arch/m68k/include/asm/elf.h +++ b/trunk/arch/m68k/include/asm/elf.h @@ -113,7 +113,6 @@ typedef struct user_m68kfp_struct elf_fpregset_t; #define ELF_PLATFORM (NULL) -#define SET_PERSONALITY(ex) \ - set_personality(PER_LINUX | (current->personality & (~PER_MASK))) +#define SET_PERSONALITY(ex) set_personality(PER_LINUX) #endif diff --git a/trunk/arch/m68k/include/asm/io.h b/trunk/arch/m68k/include/asm/io.h index c70cc9155003..c7210ba184ea 100644 --- a/trunk/arch/m68k/include/asm/io.h +++ b/trunk/arch/m68k/include/asm/io.h @@ -1,5 +1,5 @@ #ifdef __uClinux__ -#include +#include "io_no.h" #else -#include +#include "io_mm.h" #endif diff --git a/trunk/arch/m68k/include/asm/m68360.h b/trunk/arch/m68k/include/asm/m68360.h index 4664180a3ab3..eb7d39ef2855 100644 --- a/trunk/arch/m68k/include/asm/m68360.h +++ b/trunk/arch/m68k/include/asm/m68360.h @@ -1,7 +1,7 @@ -#include -#include -#include -#include +#include "m68360_regs.h" +#include "m68360_pram.h" +#include "m68360_quicc.h" +#include "m68360_enet.h" #ifdef CONFIG_M68360 diff --git a/trunk/arch/m68k/include/asm/m68360_enet.h b/trunk/arch/m68k/include/asm/m68360_enet.h index 4d04037c78a2..c36f4d059203 100644 --- a/trunk/arch/m68k/include/asm/m68360_enet.h +++ b/trunk/arch/m68k/include/asm/m68360_enet.h @@ -10,7 +10,7 @@ #ifndef __ETHER_H #define __ETHER_H -#include +#include "quicc_simple.h" /* * transmit BD's diff --git a/trunk/arch/m68k/include/asm/page.h b/trunk/arch/m68k/include/asm/page.h index 7c360dac00b7..98baa82a8615 100644 --- a/trunk/arch/m68k/include/asm/page.h +++ b/trunk/arch/m68k/include/asm/page.h @@ -43,9 +43,9 @@ extern unsigned long _ramend; #endif /* !__ASSEMBLY__ */ #ifdef CONFIG_MMU -#include +#include "page_mm.h" #else -#include +#include "page_no.h" #endif #include diff --git a/trunk/arch/m68k/include/asm/pgtable.h b/trunk/arch/m68k/include/asm/pgtable.h index a3d733b524d2..ee6759eb445a 100644 --- a/trunk/arch/m68k/include/asm/pgtable.h +++ b/trunk/arch/m68k/include/asm/pgtable.h @@ -1,5 +1,5 @@ #ifdef __uClinux__ -#include +#include "pgtable_no.h" #else -#include +#include "pgtable_mm.h" #endif diff --git a/trunk/arch/m68k/include/asm/q40_master.h b/trunk/arch/m68k/include/asm/q40_master.h index fc5b36278d04..3907a09d4fca 100644 --- a/trunk/arch/m68k/include/asm/q40_master.h +++ b/trunk/arch/m68k/include/asm/q40_master.h @@ -60,7 +60,7 @@ #define Q40_RTC_WRITE 128 /* define some Q40 specific ints */ -#include +#include "q40ints.h" /* misc defs */ #define DAC_LEFT ((unsigned char *)0xff008000) diff --git a/trunk/arch/m68k/include/asm/uaccess.h b/trunk/arch/m68k/include/asm/uaccess.h index 639c731568b0..38f92dbb9a45 100644 --- a/trunk/arch/m68k/include/asm/uaccess.h +++ b/trunk/arch/m68k/include/asm/uaccess.h @@ -1,5 +1,5 @@ #ifdef __uClinux__ -#include +#include "uaccess_no.h" #else -#include +#include "uaccess_mm.h" #endif diff --git a/trunk/arch/m68k/include/uapi/asm/Kbuild b/trunk/arch/m68k/include/uapi/asm/Kbuild deleted file mode 100644 index baebb3da1d44..000000000000 --- a/trunk/arch/m68k/include/uapi/asm/Kbuild +++ /dev/null @@ -1,3 +0,0 @@ -# UAPI Header export list -include include/uapi/asm-generic/Kbuild.asm - diff --git a/trunk/arch/microblaze/include/asm/elf.h b/trunk/arch/microblaze/include/asm/elf.h index 640ddd4b6a9b..834849f59ae8 100644 --- a/trunk/arch/microblaze/include/asm/elf.h +++ b/trunk/arch/microblaze/include/asm/elf.h @@ -116,8 +116,7 @@ do { \ } while (0) #ifdef __KERNEL__ -#define SET_PERSONALITY(ex) \ - set_personality(PER_LINUX_32BIT | (current->personality & (~PER_MASK))) +#define SET_PERSONALITY(ex) set_personality(PER_LINUX_32BIT) #endif #endif /* __uClinux__ */ diff --git a/trunk/arch/microblaze/include/asm/mmu_context.h b/trunk/arch/microblaze/include/asm/mmu_context.h index 0ccd8c402cd9..24eab1674d3e 100644 --- a/trunk/arch/microblaze/include/asm/mmu_context.h +++ b/trunk/arch/microblaze/include/asm/mmu_context.h @@ -1,5 +1,5 @@ #ifdef CONFIG_MMU -# include +# include "mmu_context_mm.h" #else # include #endif diff --git a/trunk/arch/microblaze/include/uapi/asm/Kbuild b/trunk/arch/microblaze/include/uapi/asm/Kbuild deleted file mode 100644 index baebb3da1d44..000000000000 --- a/trunk/arch/microblaze/include/uapi/asm/Kbuild +++ /dev/null @@ -1,3 +0,0 @@ -# UAPI Header export list -include include/uapi/asm-generic/Kbuild.asm - diff --git a/trunk/arch/mips/bcm63xx/boards/board_bcm963xx.c b/trunk/arch/mips/bcm63xx/boards/board_bcm963xx.c index dd18e4b761a8..feb05258a4d1 100644 --- a/trunk/arch/mips/bcm63xx/boards/board_bcm963xx.c +++ b/trunk/arch/mips/bcm63xx/boards/board_bcm963xx.c @@ -632,7 +632,7 @@ static struct board_info __initdata board_DWVS0 = { /* * all boards */ -static const struct board_info __initconst *bcm963xx_boards[] = { +static const struct board_info __initdata *bcm963xx_boards[] = { #ifdef CONFIG_BCM63XX_CPU_6328 &board_96328avng, #endif diff --git a/trunk/arch/mips/include/asm/compat-signal.h b/trunk/arch/mips/include/asm/compat-signal.h index 6599a901b63e..368a99e5c3e1 100644 --- a/trunk/arch/mips/include/asm/compat-signal.h +++ b/trunk/arch/mips/include/asm/compat-signal.h @@ -10,6 +10,68 @@ #include +#define SI_PAD_SIZE32 ((SI_MAX_SIZE/sizeof(int)) - 3) + +typedef struct compat_siginfo { + int si_signo; + int si_code; + int si_errno; + + union { + int _pad[SI_PAD_SIZE32]; + + /* kill() */ + struct { + compat_pid_t _pid; /* sender's pid */ + compat_uid_t _uid; /* sender's uid */ + } _kill; + + /* SIGCHLD */ + struct { + compat_pid_t _pid; /* which child */ + compat_uid_t _uid; /* sender's uid */ + int _status; /* exit code */ + compat_clock_t _utime; + compat_clock_t _stime; + } _sigchld; + + /* IRIX SIGCHLD */ + struct { + compat_pid_t _pid; /* which child */ + compat_clock_t _utime; + int _status; /* exit code */ + compat_clock_t _stime; + } _irix_sigchld; + + /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */ + struct { + s32 _addr; /* faulting insn/memory ref. */ + } _sigfault; + + /* SIGPOLL, SIGXFSZ (To do ...) */ + struct { + int _band; /* POLL_IN, POLL_OUT, POLL_MSG */ + int _fd; + } _sigpoll; + + /* POSIX.1b timers */ + struct { + timer_t _tid; /* timer id */ + int _overrun; /* overrun count */ + compat_sigval_t _sigval;/* same as below */ + int _sys_private; /* not to be passed to user */ + } _timer; + + /* POSIX.1b signals */ + struct { + compat_pid_t _pid; /* sender's pid */ + compat_uid_t _uid; /* sender's uid */ + compat_sigval_t _sigval; + } _rt; + + } _sifields; +} compat_siginfo_t; + static inline int __copy_conv_sigset_to_user(compat_sigset_t __user *d, const sigset_t *s) { diff --git a/trunk/arch/mips/include/asm/compat.h b/trunk/arch/mips/include/asm/compat.h index 58277e0e9cd4..b77df0366ee6 100644 --- a/trunk/arch/mips/include/asm/compat.h +++ b/trunk/arch/mips/include/asm/compat.h @@ -43,7 +43,6 @@ typedef s64 compat_s64; typedef u32 compat_uint_t; typedef u32 compat_ulong_t; typedef u64 compat_u64; -typedef u32 compat_uptr_t; struct compat_timespec { compat_time_t tv_sec; @@ -125,73 +124,6 @@ typedef u32 compat_old_sigset_t; /* at least 32 bits */ typedef u32 compat_sigset_word; -typedef union compat_sigval { - compat_int_t sival_int; - compat_uptr_t sival_ptr; -} compat_sigval_t; - -#define SI_PAD_SIZE32 (128/sizeof(int) - 3) - -typedef struct compat_siginfo { - int si_signo; - int si_code; - int si_errno; - - union { - int _pad[SI_PAD_SIZE32]; - - /* kill() */ - struct { - compat_pid_t _pid; /* sender's pid */ - __compat_uid_t _uid; /* sender's uid */ - } _kill; - - /* SIGCHLD */ - struct { - compat_pid_t _pid; /* which child */ - __compat_uid_t _uid; /* sender's uid */ - int _status; /* exit code */ - compat_clock_t _utime; - compat_clock_t _stime; - } _sigchld; - - /* IRIX SIGCHLD */ - struct { - compat_pid_t _pid; /* which child */ - compat_clock_t _utime; - int _status; /* exit code */ - compat_clock_t _stime; - } _irix_sigchld; - - /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */ - struct { - s32 _addr; /* faulting insn/memory ref. */ - } _sigfault; - - /* SIGPOLL, SIGXFSZ (To do ...) */ - struct { - int _band; /* POLL_IN, POLL_OUT, POLL_MSG */ - int _fd; - } _sigpoll; - - /* POSIX.1b timers */ - struct { - timer_t _tid; /* timer id */ - int _overrun; /* overrun count */ - compat_sigval_t _sigval;/* same as below */ - int _sys_private; /* not to be passed to user */ - } _timer; - - /* POSIX.1b signals */ - struct { - compat_pid_t _pid; /* sender's pid */ - __compat_uid_t _uid; /* sender's uid */ - compat_sigval_t _sigval; - } _rt; - - } _sifields; -} compat_siginfo_t; - #define COMPAT_OFF_T_MAX 0x7fffffff #define COMPAT_LOFF_T_MAX 0x7fffffffffffffffL @@ -201,6 +133,7 @@ typedef struct compat_siginfo { * as pointers because the syscall entry code will have * appropriately converted them already. */ +typedef u32 compat_uptr_t; static inline void __user *compat_ptr(compat_uptr_t uptr) { diff --git a/trunk/arch/mips/include/asm/mach-bcm63xx/bcm63xx_io.h b/trunk/arch/mips/include/asm/mach-bcm63xx/bcm63xx_io.h index 03a54df5fb86..9203d90e610c 100644 --- a/trunk/arch/mips/include/asm/mach-bcm63xx/bcm63xx_io.h +++ b/trunk/arch/mips/include/asm/mach-bcm63xx/bcm63xx_io.h @@ -1,7 +1,7 @@ #ifndef BCM63XX_IO_H_ #define BCM63XX_IO_H_ -#include +#include "bcm63xx_cpu.h" /* * Physical memory map, RAM is mapped at 0x0. diff --git a/trunk/arch/mips/include/asm/mach-pnx833x/gpio.h b/trunk/arch/mips/include/asm/mach-pnx833x/gpio.h index f192acf4a8af..ed3a88da70f6 100644 --- a/trunk/arch/mips/include/asm/mach-pnx833x/gpio.h +++ b/trunk/arch/mips/include/asm/mach-pnx833x/gpio.h @@ -30,7 +30,7 @@ - including locking between different uses */ -#include +#include "pnx833x.h" #define SET_REG_BIT(reg, bit) do { (reg |= (1 << (bit))); } while (0) #define CLEAR_REG_BIT(reg, bit) do { (reg &= ~(1 << (bit))); } while (0) diff --git a/trunk/arch/mips/include/asm/octeon/cvmx-asm.h b/trunk/arch/mips/include/asm/octeon/cvmx-asm.h index 31eacc24b775..5de5de95311b 100644 --- a/trunk/arch/mips/include/asm/octeon/cvmx-asm.h +++ b/trunk/arch/mips/include/asm/octeon/cvmx-asm.h @@ -32,7 +32,7 @@ #ifndef __CVMX_ASM_H__ #define __CVMX_ASM_H__ -#include +#include "octeon-model.h" /* other useful stuff */ #define CVMX_SYNC asm volatile ("sync" : : : "memory") diff --git a/trunk/arch/mips/include/asm/octeon/cvmx-cmd-queue.h b/trunk/arch/mips/include/asm/octeon/cvmx-cmd-queue.h index fed91125317f..614653b686a0 100644 --- a/trunk/arch/mips/include/asm/octeon/cvmx-cmd-queue.h +++ b/trunk/arch/mips/include/asm/octeon/cvmx-cmd-queue.h @@ -76,7 +76,7 @@ #include -#include +#include "cvmx-fpa.h" /** * By default we disable the max depth support. Most programs * don't use it and it slows down the command queue processing diff --git a/trunk/arch/mips/include/asm/octeon/cvmx-fpa.h b/trunk/arch/mips/include/asm/octeon/cvmx-fpa.h index 541a1ae02b6f..1f04f9658736 100644 --- a/trunk/arch/mips/include/asm/octeon/cvmx-fpa.h +++ b/trunk/arch/mips/include/asm/octeon/cvmx-fpa.h @@ -36,8 +36,8 @@ #ifndef __CVMX_FPA_H__ #define __CVMX_FPA_H__ -#include -#include +#include "cvmx-address.h" +#include "cvmx-fpa-defs.h" #define CVMX_FPA_NUM_POOLS 8 #define CVMX_FPA_MIN_BLOCK_SIZE 128 diff --git a/trunk/arch/mips/include/asm/octeon/cvmx-helper-board.h b/trunk/arch/mips/include/asm/octeon/cvmx-helper-board.h index 442f508eaac9..88527fa835c9 100644 --- a/trunk/arch/mips/include/asm/octeon/cvmx-helper-board.h +++ b/trunk/arch/mips/include/asm/octeon/cvmx-helper-board.h @@ -34,7 +34,7 @@ #ifndef __CVMX_HELPER_BOARD_H__ #define __CVMX_HELPER_BOARD_H__ -#include +#include "cvmx-helper.h" typedef enum { set_phy_link_flags_autoneg = 0x1, diff --git a/trunk/arch/mips/include/asm/octeon/cvmx-helper.h b/trunk/arch/mips/include/asm/octeon/cvmx-helper.h index 691c8142cd4f..0ac6b9f412be 100644 --- a/trunk/arch/mips/include/asm/octeon/cvmx-helper.h +++ b/trunk/arch/mips/include/asm/octeon/cvmx-helper.h @@ -34,9 +34,9 @@ #ifndef __CVMX_HELPER_H__ #define __CVMX_HELPER_H__ -#include -#include -#include +#include "cvmx-config.h" +#include "cvmx-fpa.h" +#include "cvmx-wqe.h" typedef enum { CVMX_HELPER_INTERFACE_MODE_DISABLED, @@ -62,13 +62,13 @@ typedef union { } cvmx_helper_link_info_t; #include -#include -#include -#include -#include -#include -#include -#include +#include "cvmx-helper-loop.h" +#include "cvmx-helper-npi.h" +#include "cvmx-helper-rgmii.h" +#include "cvmx-helper-sgmii.h" +#include "cvmx-helper-spi.h" +#include "cvmx-helper-util.h" +#include "cvmx-helper-xaui.h" /** * cvmx_override_pko_queue_priority(int ipd_port, uint64_t diff --git a/trunk/arch/mips/include/asm/octeon/cvmx-mdio.h b/trunk/arch/mips/include/asm/octeon/cvmx-mdio.h index 6f0cd182cec8..d88ab8d8e37d 100644 --- a/trunk/arch/mips/include/asm/octeon/cvmx-mdio.h +++ b/trunk/arch/mips/include/asm/octeon/cvmx-mdio.h @@ -35,7 +35,7 @@ #ifndef __CVMX_MIO_H__ #define __CVMX_MIO_H__ -#include +#include "cvmx-smix-defs.h" /** * PHY register 0 from the 802.3 spec diff --git a/trunk/arch/mips/include/asm/octeon/cvmx-pip.h b/trunk/arch/mips/include/asm/octeon/cvmx-pip.h index 9e739a640855..78dbce8f2c5e 100644 --- a/trunk/arch/mips/include/asm/octeon/cvmx-pip.h +++ b/trunk/arch/mips/include/asm/octeon/cvmx-pip.h @@ -33,9 +33,9 @@ #ifndef __CVMX_PIP_H__ #define __CVMX_PIP_H__ -#include -#include -#include +#include "cvmx-wqe.h" +#include "cvmx-fpa.h" +#include "cvmx-pip-defs.h" #define CVMX_PIP_NUM_INPUT_PORTS 40 #define CVMX_PIP_NUM_WATCHERS 4 diff --git a/trunk/arch/mips/include/asm/octeon/cvmx-pko.h b/trunk/arch/mips/include/asm/octeon/cvmx-pko.h index c6daeedf1f81..de3412aada5d 100644 --- a/trunk/arch/mips/include/asm/octeon/cvmx-pko.h +++ b/trunk/arch/mips/include/asm/octeon/cvmx-pko.h @@ -58,10 +58,10 @@ #ifndef __CVMX_PKO_H__ #define __CVMX_PKO_H__ -#include -#include -#include -#include +#include "cvmx-fpa.h" +#include "cvmx-pow.h" +#include "cvmx-cmd-queue.h" +#include "cvmx-pko-defs.h" /* Adjust the command buffer size by 1 word so that in the case of using only * two word PKO commands no command words stradle buffers. The useful values diff --git a/trunk/arch/mips/include/asm/octeon/cvmx-pow.h b/trunk/arch/mips/include/asm/octeon/cvmx-pow.h index 92742b241a51..999aefe3274c 100644 --- a/trunk/arch/mips/include/asm/octeon/cvmx-pow.h +++ b/trunk/arch/mips/include/asm/octeon/cvmx-pow.h @@ -53,8 +53,8 @@ #include -#include -#include +#include "cvmx-scratch.h" +#include "cvmx-wqe.h" /* Default to having all POW constancy checks turned on */ #ifndef CVMX_ENABLE_POW_CHECKS diff --git a/trunk/arch/mips/include/asm/octeon/cvmx-spi.h b/trunk/arch/mips/include/asm/octeon/cvmx-spi.h index 3bf53b537bcf..e814648953a5 100644 --- a/trunk/arch/mips/include/asm/octeon/cvmx-spi.h +++ b/trunk/arch/mips/include/asm/octeon/cvmx-spi.h @@ -32,7 +32,7 @@ #ifndef __CVMX_SPI_H__ #define __CVMX_SPI_H__ -#include +#include "cvmx-gmxx-defs.h" /* CSR typedefs have been moved to cvmx-csr-*.h */ diff --git a/trunk/arch/mips/include/asm/octeon/cvmx-spinlock.h b/trunk/arch/mips/include/asm/octeon/cvmx-spinlock.h index a672abb1bc4f..2fbf0871df11 100644 --- a/trunk/arch/mips/include/asm/octeon/cvmx-spinlock.h +++ b/trunk/arch/mips/include/asm/octeon/cvmx-spinlock.h @@ -35,7 +35,7 @@ #ifndef __CVMX_SPINLOCK_H__ #define __CVMX_SPINLOCK_H__ -#include +#include "cvmx-asm.h" /* Spinlocks for Octeon */ diff --git a/trunk/arch/mips/include/asm/octeon/cvmx-wqe.h b/trunk/arch/mips/include/asm/octeon/cvmx-wqe.h index df762389e271..653610953d28 100644 --- a/trunk/arch/mips/include/asm/octeon/cvmx-wqe.h +++ b/trunk/arch/mips/include/asm/octeon/cvmx-wqe.h @@ -40,7 +40,7 @@ #ifndef __CVMX_WQE_H__ #define __CVMX_WQE_H__ -#include +#include "cvmx-packet.h" #define OCT_TAG_TYPE_STRING(x) \ diff --git a/trunk/arch/mips/include/asm/octeon/cvmx.h b/trunk/arch/mips/include/asm/octeon/cvmx.h index db58beab6cb2..740be97a3251 100644 --- a/trunk/arch/mips/include/asm/octeon/cvmx.h +++ b/trunk/arch/mips/include/asm/octeon/cvmx.h @@ -52,24 +52,24 @@ enum cvmx_mips_space { #define CVMX_ADD_IO_SEG(add) CVMX_ADD_SEG(CVMX_IO_SEG, (add)) #endif -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include +#include "cvmx-asm.h" +#include "cvmx-packet.h" +#include "cvmx-sysinfo.h" + +#include "cvmx-ciu-defs.h" +#include "cvmx-gpio-defs.h" +#include "cvmx-iob-defs.h" +#include "cvmx-ipd-defs.h" +#include "cvmx-l2c-defs.h" +#include "cvmx-l2d-defs.h" +#include "cvmx-l2t-defs.h" +#include "cvmx-led-defs.h" +#include "cvmx-mio-defs.h" +#include "cvmx-pow-defs.h" + +#include "cvmx-bootinfo.h" +#include "cvmx-bootmem.h" +#include "cvmx-l2c.h" #ifndef CVMX_ENABLE_DEBUG_PRINTS #define CVMX_ENABLE_DEBUG_PRINTS 1 diff --git a/trunk/arch/mips/include/asm/octeon/octeon-model.h b/trunk/arch/mips/include/asm/octeon/octeon-model.h index 23b895cb260b..4e338a4d9424 100644 --- a/trunk/arch/mips/include/asm/octeon/octeon-model.h +++ b/trunk/arch/mips/include/asm/octeon/octeon-model.h @@ -313,6 +313,6 @@ static inline int __octeon_is_model_runtime__(uint32_t model) const char *octeon_model_get_string(uint32_t chip_id); const char *octeon_model_get_string_buffer(uint32_t chip_id, char *buffer); -#include +#include "octeon-feature.h" #endif /* __OCTEON_MODEL_H__ */ diff --git a/trunk/arch/mips/include/asm/octeon/octeon.h b/trunk/arch/mips/include/asm/octeon/octeon.h index c4a1b31966bb..1e2486e23573 100644 --- a/trunk/arch/mips/include/asm/octeon/octeon.h +++ b/trunk/arch/mips/include/asm/octeon/octeon.h @@ -8,7 +8,7 @@ #ifndef __ASM_OCTEON_OCTEON_H #define __ASM_OCTEON_OCTEON_H -#include +#include "cvmx.h" extern uint64_t octeon_bootmem_alloc_range_phys(uint64_t size, uint64_t alignment, diff --git a/trunk/arch/mips/include/asm/sibyte/bcm1480_int.h b/trunk/arch/mips/include/asm/sibyte/bcm1480_int.h index fffb224d2297..6109557c14e9 100644 --- a/trunk/arch/mips/include/asm/sibyte/bcm1480_int.h +++ b/trunk/arch/mips/include/asm/sibyte/bcm1480_int.h @@ -34,7 +34,7 @@ #ifndef _BCM1480_INT_H #define _BCM1480_INT_H -#include +#include "sb1250_defs.h" /* ********************************************************************* * Interrupt Mapper Constants diff --git a/trunk/arch/mips/include/asm/sibyte/bcm1480_l2c.h b/trunk/arch/mips/include/asm/sibyte/bcm1480_l2c.h index 725d38cb9d1c..fd75817f7ac4 100644 --- a/trunk/arch/mips/include/asm/sibyte/bcm1480_l2c.h +++ b/trunk/arch/mips/include/asm/sibyte/bcm1480_l2c.h @@ -33,7 +33,7 @@ #ifndef _BCM1480_L2C_H #define _BCM1480_L2C_H -#include +#include "sb1250_defs.h" /* * Format of level 2 cache management address (Table 55) diff --git a/trunk/arch/mips/include/asm/sibyte/bcm1480_mc.h b/trunk/arch/mips/include/asm/sibyte/bcm1480_mc.h index 4307a758e3bf..f26a41a82b59 100644 --- a/trunk/arch/mips/include/asm/sibyte/bcm1480_mc.h +++ b/trunk/arch/mips/include/asm/sibyte/bcm1480_mc.h @@ -33,7 +33,7 @@ #ifndef _BCM1480_MC_H #define _BCM1480_MC_H -#include +#include "sb1250_defs.h" /* * Memory Channel Configuration Register (Table 81) diff --git a/trunk/arch/mips/include/asm/sibyte/bcm1480_regs.h b/trunk/arch/mips/include/asm/sibyte/bcm1480_regs.h index 84d168ddfebb..b4077bb72611 100644 --- a/trunk/arch/mips/include/asm/sibyte/bcm1480_regs.h +++ b/trunk/arch/mips/include/asm/sibyte/bcm1480_regs.h @@ -32,14 +32,14 @@ #ifndef _BCM1480_REGS_H #define _BCM1480_REGS_H -#include +#include "sb1250_defs.h" /* ********************************************************************* * Pull in the BCM1250's registers since a great deal of the 1480's * functions are the same as the BCM1250. ********************************************************************* */ -#include +#include "sb1250_regs.h" /* ********************************************************************* diff --git a/trunk/arch/mips/include/asm/sibyte/bcm1480_scd.h b/trunk/arch/mips/include/asm/sibyte/bcm1480_scd.h index 2af3706b9648..25ef24cbb92a 100644 --- a/trunk/arch/mips/include/asm/sibyte/bcm1480_scd.h +++ b/trunk/arch/mips/include/asm/sibyte/bcm1480_scd.h @@ -32,13 +32,13 @@ #ifndef _BCM1480_SCD_H #define _BCM1480_SCD_H -#include +#include "sb1250_defs.h" /* ********************************************************************* * Pull in the BCM1250's SCD since lots of stuff is the same. ********************************************************************* */ -#include +#include "sb1250_scd.h" /* ********************************************************************* * Some general notes: diff --git a/trunk/arch/mips/include/asm/sibyte/sb1250_dma.h b/trunk/arch/mips/include/asm/sibyte/sb1250_dma.h index 6c44dfb52878..bad56171d747 100644 --- a/trunk/arch/mips/include/asm/sibyte/sb1250_dma.h +++ b/trunk/arch/mips/include/asm/sibyte/sb1250_dma.h @@ -36,7 +36,7 @@ #define _SB1250_DMA_H -#include +#include "sb1250_defs.h" /* ********************************************************************* * DMA Registers diff --git a/trunk/arch/mips/include/asm/sibyte/sb1250_genbus.h b/trunk/arch/mips/include/asm/sibyte/sb1250_genbus.h index a96ded17bdc9..94e9c7c8e783 100644 --- a/trunk/arch/mips/include/asm/sibyte/sb1250_genbus.h +++ b/trunk/arch/mips/include/asm/sibyte/sb1250_genbus.h @@ -34,7 +34,7 @@ #ifndef _SB1250_GENBUS_H #define _SB1250_GENBUS_H -#include +#include "sb1250_defs.h" /* * Generic Bus Region Configuration Registers (Table 11-4) diff --git a/trunk/arch/mips/include/asm/sibyte/sb1250_int.h b/trunk/arch/mips/include/asm/sibyte/sb1250_int.h index dbea73ddd2fe..f2850b4bcfd4 100644 --- a/trunk/arch/mips/include/asm/sibyte/sb1250_int.h +++ b/trunk/arch/mips/include/asm/sibyte/sb1250_int.h @@ -33,7 +33,7 @@ #ifndef _SB1250_INT_H #define _SB1250_INT_H -#include +#include "sb1250_defs.h" /* ********************************************************************* * Interrupt Mapper Constants diff --git a/trunk/arch/mips/include/asm/sibyte/sb1250_l2c.h b/trunk/arch/mips/include/asm/sibyte/sb1250_l2c.h index b61a7491607d..6554dcf05cfe 100644 --- a/trunk/arch/mips/include/asm/sibyte/sb1250_l2c.h +++ b/trunk/arch/mips/include/asm/sibyte/sb1250_l2c.h @@ -33,7 +33,7 @@ #ifndef _SB1250_L2C_H #define _SB1250_L2C_H -#include +#include "sb1250_defs.h" /* * Level 2 Cache Tag register (Table 5-3) diff --git a/trunk/arch/mips/include/asm/sibyte/sb1250_ldt.h b/trunk/arch/mips/include/asm/sibyte/sb1250_ldt.h index bf7f320d1a87..1e76cf137995 100644 --- a/trunk/arch/mips/include/asm/sibyte/sb1250_ldt.h +++ b/trunk/arch/mips/include/asm/sibyte/sb1250_ldt.h @@ -33,7 +33,7 @@ #ifndef _SB1250_LDT_H #define _SB1250_LDT_H -#include +#include "sb1250_defs.h" #define K_LDT_VENDOR_SIBYTE 0x166D #define K_LDT_DEVICE_SB1250 0x0002 diff --git a/trunk/arch/mips/include/asm/sibyte/sb1250_mac.h b/trunk/arch/mips/include/asm/sibyte/sb1250_mac.h index cfc4d7870882..77f787284235 100644 --- a/trunk/arch/mips/include/asm/sibyte/sb1250_mac.h +++ b/trunk/arch/mips/include/asm/sibyte/sb1250_mac.h @@ -33,7 +33,7 @@ #ifndef _SB1250_MAC_H #define _SB1250_MAC_H -#include +#include "sb1250_defs.h" /* ********************************************************************* * Ethernet MAC Registers diff --git a/trunk/arch/mips/include/asm/sibyte/sb1250_mc.h b/trunk/arch/mips/include/asm/sibyte/sb1250_mc.h index 15048dcaf22f..1eb1b5a88736 100644 --- a/trunk/arch/mips/include/asm/sibyte/sb1250_mc.h +++ b/trunk/arch/mips/include/asm/sibyte/sb1250_mc.h @@ -33,7 +33,7 @@ #ifndef _SB1250_MC_H #define _SB1250_MC_H -#include +#include "sb1250_defs.h" /* * Memory Channel Config Register (table 6-14) diff --git a/trunk/arch/mips/include/asm/sibyte/sb1250_regs.h b/trunk/arch/mips/include/asm/sibyte/sb1250_regs.h index 29b9f0b26b3a..8f53ec817a5e 100644 --- a/trunk/arch/mips/include/asm/sibyte/sb1250_regs.h +++ b/trunk/arch/mips/include/asm/sibyte/sb1250_regs.h @@ -33,7 +33,7 @@ #ifndef _SB1250_REGS_H #define _SB1250_REGS_H -#include +#include "sb1250_defs.h" /* ********************************************************************* diff --git a/trunk/arch/mips/include/asm/sibyte/sb1250_scd.h b/trunk/arch/mips/include/asm/sibyte/sb1250_scd.h index 615e165dbd21..e49c3e89b5ee 100644 --- a/trunk/arch/mips/include/asm/sibyte/sb1250_scd.h +++ b/trunk/arch/mips/include/asm/sibyte/sb1250_scd.h @@ -32,7 +32,7 @@ #ifndef _SB1250_SCD_H #define _SB1250_SCD_H -#include +#include "sb1250_defs.h" /* ********************************************************************* * System control/debug registers diff --git a/trunk/arch/mips/include/asm/sibyte/sb1250_smbus.h b/trunk/arch/mips/include/asm/sibyte/sb1250_smbus.h index 128d6b75b819..04769923cf1e 100644 --- a/trunk/arch/mips/include/asm/sibyte/sb1250_smbus.h +++ b/trunk/arch/mips/include/asm/sibyte/sb1250_smbus.h @@ -34,7 +34,7 @@ #ifndef _SB1250_SMBUS_H #define _SB1250_SMBUS_H -#include +#include "sb1250_defs.h" /* * SMBus Clock Frequency Register (Table 14-2) diff --git a/trunk/arch/mips/include/asm/sibyte/sb1250_syncser.h b/trunk/arch/mips/include/asm/sibyte/sb1250_syncser.h index 274e9179d326..d4b8558e0bf1 100644 --- a/trunk/arch/mips/include/asm/sibyte/sb1250_syncser.h +++ b/trunk/arch/mips/include/asm/sibyte/sb1250_syncser.h @@ -33,7 +33,7 @@ #ifndef _SB1250_SYNCSER_H #define _SB1250_SYNCSER_H -#include +#include "sb1250_defs.h" /* * Serial Mode Configuration Register diff --git a/trunk/arch/mips/include/asm/sibyte/sb1250_uart.h b/trunk/arch/mips/include/asm/sibyte/sb1250_uart.h index bb99ecac5817..d835bf280140 100644 --- a/trunk/arch/mips/include/asm/sibyte/sb1250_uart.h +++ b/trunk/arch/mips/include/asm/sibyte/sb1250_uart.h @@ -33,7 +33,7 @@ #ifndef _SB1250_UART_H #define _SB1250_UART_H -#include +#include "sb1250_defs.h" /* ********************************************************************** * DUART Registers diff --git a/trunk/arch/mips/include/uapi/asm/Kbuild b/trunk/arch/mips/include/uapi/asm/Kbuild deleted file mode 100644 index baebb3da1d44..000000000000 --- a/trunk/arch/mips/include/uapi/asm/Kbuild +++ /dev/null @@ -1,3 +0,0 @@ -# UAPI Header export list -include include/uapi/asm-generic/Kbuild.asm - diff --git a/trunk/arch/mips/pci/pci-octeon.c b/trunk/arch/mips/pci/pci-octeon.c index 4b0c347d7a82..c5dfb2c87d44 100644 --- a/trunk/arch/mips/pci/pci-octeon.c +++ b/trunk/arch/mips/pci/pci-octeon.c @@ -58,7 +58,7 @@ union octeon_pci_address { } s; }; -int __initconst (*octeon_pcibios_map_irq)(const struct pci_dev *dev, +int __initdata (*octeon_pcibios_map_irq)(const struct pci_dev *dev, u8 slot, u8 pin); enum octeon_dma_bar_type octeon_dma_bar_type = OCTEON_DMA_BAR_TYPE_INVALID; diff --git a/trunk/arch/mn10300/Makefile b/trunk/arch/mn10300/Makefile index a3d0fef3b126..33188b6e81e4 100644 --- a/trunk/arch/mn10300/Makefile +++ b/trunk/arch/mn10300/Makefile @@ -26,7 +26,7 @@ CHECKFLAGS += PROCESSOR := unset UNIT := unset -KBUILD_CFLAGS += -mam33 -DCPU=AM33 $(call cc-option,-mmem-funcs,) +KBUILD_CFLAGS += -mam33 -mmem-funcs -DCPU=AM33 KBUILD_AFLAGS += -mam33 -DCPU=AM33 ifeq ($(CONFIG_MN10300_CURRENT_IN_E2),y) diff --git a/trunk/arch/mn10300/include/asm/elf.h b/trunk/arch/mn10300/include/asm/elf.h index 4ebd6b3a0a1e..8157c9267f42 100644 --- a/trunk/arch/mn10300/include/asm/elf.h +++ b/trunk/arch/mn10300/include/asm/elf.h @@ -151,8 +151,7 @@ do { \ #define ELF_PLATFORM (NULL) #ifdef __KERNEL__ -#define SET_PERSONALITY(ex) \ - set_personality(PER_LINUX | (current->personality & (~PER_MASK))) +#define SET_PERSONALITY(ex) set_personality(PER_LINUX) #endif #endif /* _ASM_ELF_H */ diff --git a/trunk/arch/mn10300/include/uapi/asm/Kbuild b/trunk/arch/mn10300/include/uapi/asm/Kbuild deleted file mode 100644 index baebb3da1d44..000000000000 --- a/trunk/arch/mn10300/include/uapi/asm/Kbuild +++ /dev/null @@ -1,3 +0,0 @@ -# UAPI Header export list -include include/uapi/asm-generic/Kbuild.asm - diff --git a/trunk/arch/openrisc/include/asm/elf.h b/trunk/arch/openrisc/include/asm/elf.h index 225a7ff320ad..a8fe2c513070 100644 --- a/trunk/arch/openrisc/include/asm/elf.h +++ b/trunk/arch/openrisc/include/asm/elf.h @@ -110,8 +110,7 @@ extern void dump_elf_thread(elf_greg_t *dest, struct pt_regs *pt); #define ELF_PLATFORM (NULL) -#define SET_PERSONALITY(ex) \ - set_personality(PER_LINUX | (current->personality & (~PER_MASK))) +#define SET_PERSONALITY(ex) set_personality(PER_LINUX) #endif /* __KERNEL__ */ #endif diff --git a/trunk/arch/openrisc/include/uapi/asm/Kbuild b/trunk/arch/openrisc/include/uapi/asm/Kbuild deleted file mode 100644 index baebb3da1d44..000000000000 --- a/trunk/arch/openrisc/include/uapi/asm/Kbuild +++ /dev/null @@ -1,3 +0,0 @@ -# UAPI Header export list -include include/uapi/asm-generic/Kbuild.asm - diff --git a/trunk/arch/parisc/Kconfig b/trunk/arch/parisc/Kconfig index b87438bb3384..3ff21b536f28 100644 --- a/trunk/arch/parisc/Kconfig +++ b/trunk/arch/parisc/Kconfig @@ -13,7 +13,6 @@ config PARISC select HAVE_PERF_EVENTS select GENERIC_ATOMIC64 if !64BIT select HAVE_GENERIC_HARDIRQS - select BROKEN_RODATA select GENERIC_IRQ_PROBE select GENERIC_PCI_IOMAP select IRQ_PER_CPU diff --git a/trunk/arch/parisc/hpux/fs.c b/trunk/arch/parisc/hpux/fs.c index 6785de7bd2a0..c71eb6c79897 100644 --- a/trunk/arch/parisc/hpux/fs.c +++ b/trunk/arch/parisc/hpux/fs.c @@ -109,32 +109,33 @@ static int filldir(void * __buf, const char * name, int namlen, loff_t offset, int hpux_getdents(unsigned int fd, struct hpux_dirent __user *dirent, unsigned int count) { - struct fd arg; + struct file * file; struct hpux_dirent __user * lastdirent; struct getdents_callback buf; - int error; + int error = -EBADF; - arg = fdget(fd); - if (!arg.file) - return -EBADF; + file = fget(fd); + if (!file) + goto out; buf.current_dir = dirent; buf.previous = NULL; buf.count = count; buf.error = 0; - error = vfs_readdir(arg.file, filldir, &buf); + error = vfs_readdir(file, filldir, &buf); if (error >= 0) error = buf.error; lastdirent = buf.previous; if (lastdirent) { - if (put_user(arg.file->f_pos, &lastdirent->d_off)) + if (put_user(file->f_pos, &lastdirent->d_off)) error = -EFAULT; else error = count - buf.count; } - fdput(arg); + fput(file); +out: return error; } diff --git a/trunk/arch/parisc/include/asm/compat.h b/trunk/arch/parisc/include/asm/compat.h index db7a662691a8..760f331d4fa3 100644 --- a/trunk/arch/parisc/include/asm/compat.h +++ b/trunk/arch/parisc/include/asm/compat.h @@ -36,7 +36,6 @@ typedef s64 compat_s64; typedef u32 compat_uint_t; typedef u32 compat_ulong_t; typedef u64 compat_u64; -typedef u32 compat_uptr_t; struct compat_timespec { compat_time_t tv_sec; @@ -128,63 +127,6 @@ typedef u32 compat_old_sigset_t; /* at least 32 bits */ typedef u32 compat_sigset_word; -typedef union compat_sigval { - compat_int_t sival_int; - compat_uptr_t sival_ptr; -} compat_sigval_t; - -typedef struct compat_siginfo { - int si_signo; - int si_errno; - int si_code; - - union { - int _pad[128/sizeof(int) - 3]; - - /* kill() */ - struct { - unsigned int _pid; /* sender's pid */ - unsigned int _uid; /* sender's uid */ - } _kill; - - /* POSIX.1b timers */ - struct { - compat_timer_t _tid; /* timer id */ - int _overrun; /* overrun count */ - char _pad[sizeof(unsigned int) - sizeof(int)]; - compat_sigval_t _sigval; /* same as below */ - int _sys_private; /* not to be passed to user */ - } _timer; - - /* POSIX.1b signals */ - struct { - unsigned int _pid; /* sender's pid */ - unsigned int _uid; /* sender's uid */ - compat_sigval_t _sigval; - } _rt; - - /* SIGCHLD */ - struct { - unsigned int _pid; /* which child */ - unsigned int _uid; /* sender's uid */ - int _status; /* exit code */ - compat_clock_t _utime; - compat_clock_t _stime; - } _sigchld; - - /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */ - struct { - unsigned int _addr; /* faulting insn/memory ref. */ - } _sigfault; - - /* SIGPOLL */ - struct { - int _band; /* POLL_IN, POLL_OUT, POLL_MSG */ - int _fd; - } _sigpoll; - } _sifields; -} compat_siginfo_t; - #define COMPAT_OFF_T_MAX 0x7fffffff #define COMPAT_LOFF_T_MAX 0x7fffffffffffffffL @@ -194,6 +136,7 @@ typedef struct compat_siginfo { * as pointers because the syscall entry code will have * appropriately converted them already. */ +typedef u32 compat_uptr_t; static inline void __user *compat_ptr(compat_uptr_t uptr) { diff --git a/trunk/arch/parisc/include/uapi/asm/Kbuild b/trunk/arch/parisc/include/uapi/asm/Kbuild deleted file mode 100644 index baebb3da1d44..000000000000 --- a/trunk/arch/parisc/include/uapi/asm/Kbuild +++ /dev/null @@ -1,3 +0,0 @@ -# UAPI Header export list -include include/uapi/asm-generic/Kbuild.asm - diff --git a/trunk/arch/parisc/kernel/signal32.h b/trunk/arch/parisc/kernel/signal32.h index 08a88b5349a2..c7800846422c 100644 --- a/trunk/arch/parisc/kernel/signal32.h +++ b/trunk/arch/parisc/kernel/signal32.h @@ -55,6 +55,58 @@ struct k_sigaction32 { struct compat_sigaction sa; }; +typedef struct compat_siginfo { + int si_signo; + int si_errno; + int si_code; + + union { + int _pad[((128/sizeof(int)) - 3)]; + + /* kill() */ + struct { + unsigned int _pid; /* sender's pid */ + unsigned int _uid; /* sender's uid */ + } _kill; + + /* POSIX.1b timers */ + struct { + compat_timer_t _tid; /* timer id */ + int _overrun; /* overrun count */ + char _pad[sizeof(unsigned int) - sizeof(int)]; + compat_sigval_t _sigval; /* same as below */ + int _sys_private; /* not to be passed to user */ + } _timer; + + /* POSIX.1b signals */ + struct { + unsigned int _pid; /* sender's pid */ + unsigned int _uid; /* sender's uid */ + compat_sigval_t _sigval; + } _rt; + + /* SIGCHLD */ + struct { + unsigned int _pid; /* which child */ + unsigned int _uid; /* sender's uid */ + int _status; /* exit code */ + compat_clock_t _utime; + compat_clock_t _stime; + } _sigchld; + + /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */ + struct { + unsigned int _addr; /* faulting insn/memory ref. */ + } _sigfault; + + /* SIGPOLL */ + struct { + int _band; /* POLL_IN, POLL_OUT, POLL_MSG */ + int _fd; + } _sigpoll; + } _sifields; +} compat_siginfo_t; + int copy_siginfo_to_user32 (compat_siginfo_t __user *to, siginfo_t *from); int copy_siginfo_from_user32 (siginfo_t *to, compat_siginfo_t __user *from); diff --git a/trunk/arch/powerpc/configs/ppc64_defconfig b/trunk/arch/powerpc/configs/ppc64_defconfig index de7c4c53f5cf..06b56245d78c 100644 --- a/trunk/arch/powerpc/configs/ppc64_defconfig +++ b/trunk/arch/powerpc/configs/ppc64_defconfig @@ -486,8 +486,7 @@ CONFIG_CRYPTO_TWOFISH=m CONFIG_CRYPTO_LZO=m # CONFIG_CRYPTO_ANSI_CPRNG is not set CONFIG_CRYPTO_HW=y -CONFIG_CRYPTO_DEV_NX=y -CONFIG_CRYPTO_DEV_NX_ENCRYPT=m +CONFIG_CRYPTO_DEV_NX=m CONFIG_VIRTUALIZATION=y CONFIG_KVM_BOOK3S_64=m CONFIG_KVM_BOOK3S_64_HV=y diff --git a/trunk/arch/powerpc/configs/pseries_defconfig b/trunk/arch/powerpc/configs/pseries_defconfig index 9f4a9368f51b..1f65b3c9b59a 100644 --- a/trunk/arch/powerpc/configs/pseries_defconfig +++ b/trunk/arch/powerpc/configs/pseries_defconfig @@ -369,8 +369,7 @@ CONFIG_CRYPTO_TWOFISH=m CONFIG_CRYPTO_LZO=m # CONFIG_CRYPTO_ANSI_CPRNG is not set CONFIG_CRYPTO_HW=y -CONFIG_CRYPTO_DEV_NX=y -CONFIG_CRYPTO_DEV_NX_ENCRYPT=m +CONFIG_CRYPTO_DEV_NX=m CONFIG_VIRTUALIZATION=y CONFIG_KVM_BOOK3S_64=m CONFIG_KVM_BOOK3S_64_HV=y diff --git a/trunk/arch/powerpc/include/asm/bitops.h b/trunk/arch/powerpc/include/asm/bitops.h index dc2cf9c6d9e6..efdc92618b38 100644 --- a/trunk/arch/powerpc/include/asm/bitops.h +++ b/trunk/arch/powerpc/include/asm/bitops.h @@ -288,16 +288,6 @@ static __inline__ int test_bit_le(unsigned long nr, return (tmp[nr >> 3] >> (nr & 7)) & 1; } -static inline void set_bit_le(int nr, void *addr) -{ - set_bit(nr ^ BITOP_LE_SWIZZLE, addr); -} - -static inline void clear_bit_le(int nr, void *addr) -{ - clear_bit(nr ^ BITOP_LE_SWIZZLE, addr); -} - static inline void __set_bit_le(int nr, void *addr) { __set_bit(nr ^ BITOP_LE_SWIZZLE, addr); diff --git a/trunk/arch/powerpc/include/asm/compat.h b/trunk/arch/powerpc/include/asm/compat.h index 84fdf6857c31..88e602f6430d 100644 --- a/trunk/arch/powerpc/include/asm/compat.h +++ b/trunk/arch/powerpc/include/asm/compat.h @@ -38,7 +38,6 @@ typedef s64 compat_s64; typedef u32 compat_uint_t; typedef u32 compat_ulong_t; typedef u64 compat_u64; -typedef u32 compat_uptr_t; struct compat_timespec { compat_time_t tv_sec; @@ -115,64 +114,6 @@ typedef u32 compat_old_sigset_t; typedef u32 compat_sigset_word; -typedef union compat_sigval { - compat_int_t sival_int; - compat_uptr_t sival_ptr; -} compat_sigval_t; - -#define SI_PAD_SIZE32 (128/sizeof(int) - 3) - -typedef struct compat_siginfo { - int si_signo; - int si_errno; - int si_code; - - union { - int _pad[SI_PAD_SIZE32]; - - /* kill() */ - struct { - compat_pid_t _pid; /* sender's pid */ - __compat_uid_t _uid; /* sender's uid */ - } _kill; - - /* POSIX.1b timers */ - struct { - compat_timer_t _tid; /* timer id */ - int _overrun; /* overrun count */ - compat_sigval_t _sigval; /* same as below */ - int _sys_private; /* not to be passed to user */ - } _timer; - - /* POSIX.1b signals */ - struct { - compat_pid_t _pid; /* sender's pid */ - __compat_uid_t _uid; /* sender's uid */ - compat_sigval_t _sigval; - } _rt; - - /* SIGCHLD */ - struct { - compat_pid_t _pid; /* which child */ - __compat_uid_t _uid; /* sender's uid */ - int _status; /* exit code */ - compat_clock_t _utime; - compat_clock_t _stime; - } _sigchld; - - /* SIGILL, SIGFPE, SIGSEGV, SIGBUS, SIGEMT */ - struct { - unsigned int _addr; /* faulting insn/memory ref. */ - } _sigfault; - - /* SIGPOLL */ - struct { - int _band; /* POLL_IN, POLL_OUT, POLL_MSG */ - int _fd; - } _sigpoll; - } _sifields; -} compat_siginfo_t; - #define COMPAT_OFF_T_MAX 0x7fffffff #define COMPAT_LOFF_T_MAX 0x7fffffffffffffffL @@ -182,6 +123,7 @@ typedef struct compat_siginfo { * as pointers because the syscall entry code will have * appropriately converted them already. */ +typedef u32 compat_uptr_t; static inline void __user *compat_ptr(compat_uptr_t uptr) { diff --git a/trunk/arch/powerpc/include/asm/kvm_host.h b/trunk/arch/powerpc/include/asm/kvm_host.h index 28e8f5e5c63e..a8bf5c673a3c 100644 --- a/trunk/arch/powerpc/include/asm/kvm_host.h +++ b/trunk/arch/powerpc/include/asm/kvm_host.h @@ -53,8 +53,6 @@ struct kvm; extern int kvm_unmap_hva(struct kvm *kvm, unsigned long hva); -extern int kvm_unmap_hva_range(struct kvm *kvm, - unsigned long start, unsigned long end); extern int kvm_age_hva(struct kvm *kvm, unsigned long hva); extern int kvm_test_age_hva(struct kvm *kvm, unsigned long hva); extern void kvm_set_spte_hva(struct kvm *kvm, unsigned long hva, pte_t pte); @@ -222,7 +220,6 @@ struct revmap_entry { #define KVMPPC_GOT_PAGE 0x80 struct kvm_arch_memory_slot { - unsigned long *rmap; }; struct kvm_arch { diff --git a/trunk/arch/powerpc/include/asm/ps3.h b/trunk/arch/powerpc/include/asm/ps3.h index 0e15db4d703b..7f065e178ec4 100644 --- a/trunk/arch/powerpc/include/asm/ps3.h +++ b/trunk/arch/powerpc/include/asm/ps3.h @@ -24,7 +24,7 @@ #include #include #include -#include +#include "cell-pmu.h" union ps3_firmware_version { u64 raw; diff --git a/trunk/arch/powerpc/include/asm/siginfo.h b/trunk/arch/powerpc/include/asm/siginfo.h index ccce3ef5cd86..49495b0534ed 100644 --- a/trunk/arch/powerpc/include/asm/siginfo.h +++ b/trunk/arch/powerpc/include/asm/siginfo.h @@ -10,6 +10,7 @@ #ifdef __powerpc64__ # define __ARCH_SI_PREAMBLE_SIZE (4 * sizeof(int)) +# define SI_PAD_SIZE32 ((SI_MAX_SIZE/sizeof(int)) - 3) #endif #include diff --git a/trunk/arch/powerpc/include/asm/systbl.h b/trunk/arch/powerpc/include/asm/systbl.h index 840838769853..559ae1ee6706 100644 --- a/trunk/arch/powerpc/include/asm/systbl.h +++ b/trunk/arch/powerpc/include/asm/systbl.h @@ -189,7 +189,7 @@ SYSCALL_SPU(getcwd) SYSCALL_SPU(capget) SYSCALL_SPU(capset) COMPAT_SYS(sigaltstack) -SYSX_SPU(sys_sendfile,compat_sys_sendfile_wrapper,sys_sendfile) +SYSX_SPU(sys_sendfile64,compat_sys_sendfile,sys_sendfile) SYSCALL(ni_syscall) SYSCALL(ni_syscall) PPC_SYS(vfork) @@ -229,7 +229,7 @@ COMPAT_SYS_SPU(sched_setaffinity) COMPAT_SYS_SPU(sched_getaffinity) SYSCALL(ni_syscall) SYSCALL(ni_syscall) -SYSX(sys_ni_syscall,compat_sys_sendfile64_wrapper,sys_sendfile64) +SYS32ONLY(sendfile64) COMPAT_SYS_SPU(io_setup) SYSCALL_SPU(io_destroy) COMPAT_SYS_SPU(io_getevents) diff --git a/trunk/arch/powerpc/include/asm/ucc_fast.h b/trunk/arch/powerpc/include/asm/ucc_fast.h index 4644c840e2fa..839aab8bf37d 100644 --- a/trunk/arch/powerpc/include/asm/ucc_fast.h +++ b/trunk/arch/powerpc/include/asm/ucc_fast.h @@ -19,7 +19,7 @@ #include #include -#include +#include "ucc.h" /* Receive BD's status */ #define R_E 0x80000000 /* buffer empty */ diff --git a/trunk/arch/powerpc/include/asm/ucc_slow.h b/trunk/arch/powerpc/include/asm/ucc_slow.h index cf131ffdb8d1..0980e6ad335b 100644 --- a/trunk/arch/powerpc/include/asm/ucc_slow.h +++ b/trunk/arch/powerpc/include/asm/ucc_slow.h @@ -20,7 +20,7 @@ #include #include -#include +#include "ucc.h" /* transmit BD's status */ #define T_R 0x80000000 /* ready bit */ diff --git a/trunk/arch/powerpc/include/asm/unistd.h b/trunk/arch/powerpc/include/asm/unistd.h index c683fa350add..bd377a368611 100644 --- a/trunk/arch/powerpc/include/asm/unistd.h +++ b/trunk/arch/powerpc/include/asm/unistd.h @@ -419,7 +419,6 @@ #define __ARCH_WANT_COMPAT_SYS_TIME #define __ARCH_WANT_COMPAT_SYS_RT_SIGSUSPEND #define __ARCH_WANT_SYS_NEWFSTATAT -#define __ARCH_WANT_COMPAT_SYS_SENDFILE #endif /* diff --git a/trunk/arch/powerpc/include/uapi/asm/Kbuild b/trunk/arch/powerpc/include/uapi/asm/Kbuild deleted file mode 100644 index baebb3da1d44..000000000000 --- a/trunk/arch/powerpc/include/uapi/asm/Kbuild +++ /dev/null @@ -1,3 +0,0 @@ -# UAPI Header export list -include include/uapi/asm-generic/Kbuild.asm - diff --git a/trunk/arch/powerpc/kernel/ppc32.h b/trunk/arch/powerpc/kernel/ppc32.h index 02fb0ee26093..dc16aefe1dd0 100644 --- a/trunk/arch/powerpc/kernel/ppc32.h +++ b/trunk/arch/powerpc/kernel/ppc32.h @@ -16,6 +16,57 @@ /* These are here to support 32-bit syscalls on a 64-bit kernel. */ +typedef struct compat_siginfo { + int si_signo; + int si_errno; + int si_code; + + union { + int _pad[SI_PAD_SIZE32]; + + /* kill() */ + struct { + compat_pid_t _pid; /* sender's pid */ + compat_uid_t _uid; /* sender's uid */ + } _kill; + + /* POSIX.1b timers */ + struct { + compat_timer_t _tid; /* timer id */ + int _overrun; /* overrun count */ + compat_sigval_t _sigval; /* same as below */ + int _sys_private; /* not to be passed to user */ + } _timer; + + /* POSIX.1b signals */ + struct { + compat_pid_t _pid; /* sender's pid */ + compat_uid_t _uid; /* sender's uid */ + compat_sigval_t _sigval; + } _rt; + + /* SIGCHLD */ + struct { + compat_pid_t _pid; /* which child */ + compat_uid_t _uid; /* sender's uid */ + int _status; /* exit code */ + compat_clock_t _utime; + compat_clock_t _stime; + } _sigchld; + + /* SIGILL, SIGFPE, SIGSEGV, SIGBUS, SIGEMT */ + struct { + unsigned int _addr; /* faulting insn/memory ref. */ + } _sigfault; + + /* SIGPOLL */ + struct { + int _band; /* POLL_IN, POLL_OUT, POLL_MSG */ + int _fd; + } _sigpoll; + } _sifields; +} compat_siginfo_t; + #define __old_sigaction32 old_sigaction32 struct __old_sigaction32 { diff --git a/trunk/arch/powerpc/kernel/prom_init.c b/trunk/arch/powerpc/kernel/prom_init.c index 47834a3f4938..0794a3017b1b 100644 --- a/trunk/arch/powerpc/kernel/prom_init.c +++ b/trunk/arch/powerpc/kernel/prom_init.c @@ -705,7 +705,6 @@ static void __init early_cmdline_parse(void) #endif #define OV5_TYPE1_AFFINITY 0x80 /* Type 1 NUMA affinity */ #define OV5_PFO_HW_RNG 0x80 /* PFO Random Number Generator */ -#define OV5_PFO_HW_842 0x40 /* PFO Compression Accelerator */ #define OV5_PFO_HW_ENCR 0x20 /* PFO Encryption Accelerator */ /* Option Vector 6: IBM PAPR hints */ @@ -775,7 +774,8 @@ static unsigned char ibm_architecture_vec[] = { 0, 0, 0, - OV5_PFO_HW_RNG | OV5_PFO_HW_ENCR | OV5_PFO_HW_842, + OV5_PFO_HW_RNG | OV5_PFO_HW_ENCR, + /* option vector 6: IBM PAPR hints */ 4 - 2, /* length */ 0, @@ -1623,63 +1623,6 @@ static void __init prom_instantiate_rtas(void) } #ifdef CONFIG_PPC64 -/* - * Allocate room for and instantiate Stored Measurement Log (SML) - */ -static void __init prom_instantiate_sml(void) -{ - phandle ibmvtpm_node; - ihandle ibmvtpm_inst; - u32 entry = 0, size = 0; - u64 base; - - prom_debug("prom_instantiate_sml: start...\n"); - - ibmvtpm_node = call_prom("finddevice", 1, 1, ADDR("/ibm,vtpm")); - prom_debug("ibmvtpm_node: %x\n", ibmvtpm_node); - if (!PHANDLE_VALID(ibmvtpm_node)) - return; - - ibmvtpm_inst = call_prom("open", 1, 1, ADDR("/ibm,vtpm")); - if (!IHANDLE_VALID(ibmvtpm_inst)) { - prom_printf("opening vtpm package failed (%x)\n", ibmvtpm_inst); - return; - } - - if (call_prom_ret("call-method", 2, 2, &size, - ADDR("sml-get-handover-size"), - ibmvtpm_inst) != 0 || size == 0) { - prom_printf("SML get handover size failed\n"); - return; - } - - base = alloc_down(size, PAGE_SIZE, 0); - if (base == 0) - prom_panic("Could not allocate memory for sml\n"); - - prom_printf("instantiating sml at 0x%x...", base); - - if (call_prom_ret("call-method", 4, 2, &entry, - ADDR("sml-handover"), - ibmvtpm_inst, size, base) != 0 || entry == 0) { - prom_printf("SML handover failed\n"); - return; - } - prom_printf(" done\n"); - - reserve_mem(base, size); - - prom_setprop(ibmvtpm_node, "/ibm,vtpm", "linux,sml-base", - &base, sizeof(base)); - prom_setprop(ibmvtpm_node, "/ibm,vtpm", "linux,sml-size", - &size, sizeof(size)); - - prom_debug("sml base = 0x%x\n", base); - prom_debug("sml size = 0x%x\n", (long)size); - - prom_debug("prom_instantiate_sml: end...\n"); -} - /* * Allocate room for and initialize TCE tables */ @@ -2973,11 +2916,6 @@ unsigned long __init prom_init(unsigned long r3, unsigned long r4, prom_instantiate_opal(); #endif -#ifdef CONFIG_PPC64 - /* instantiate sml */ - prom_instantiate_sml(); -#endif - /* * On non-powermacs, put all CPUs in spin-loops. * diff --git a/trunk/arch/powerpc/kernel/sys_ppc32.c b/trunk/arch/powerpc/kernel/sys_ppc32.c index abd1112da54f..81c570633ead 100644 --- a/trunk/arch/powerpc/kernel/sys_ppc32.c +++ b/trunk/arch/powerpc/kernel/sys_ppc32.c @@ -143,17 +143,48 @@ long compat_sys_ipc(u32 call, u32 first, u32 second, u32 third, compat_uptr_t pt * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode) * and the register representation of a signed int (msr in 64-bit mode) is performed. */ -asmlinkage long compat_sys_sendfile_wrapper(u32 out_fd, u32 in_fd, - compat_off_t __user *offset, u32 count) +asmlinkage long compat_sys_sendfile(u32 out_fd, u32 in_fd, compat_off_t __user * offset, u32 count) { - return compat_sys_sendfile((int)out_fd, (int)in_fd, offset, count); + mm_segment_t old_fs = get_fs(); + int ret; + off_t of; + off_t __user *up; + + if (offset && get_user(of, offset)) + return -EFAULT; + + /* The __user pointer cast is valid because of the set_fs() */ + set_fs(KERNEL_DS); + up = offset ? (off_t __user *) &of : NULL; + ret = sys_sendfile((int)out_fd, (int)in_fd, up, count); + set_fs(old_fs); + + if (offset && put_user(of, offset)) + return -EFAULT; + + return ret; } -asmlinkage long compat_sys_sendfile64_wrapper(u32 out_fd, u32 in_fd, - compat_loff_t __user *offset, u32 count) +asmlinkage int compat_sys_sendfile64(int out_fd, int in_fd, compat_loff_t __user *offset, s32 count) { - return sys_sendfile((int)out_fd, (int)in_fd, - (off_t __user *)offset, count); + mm_segment_t old_fs = get_fs(); + int ret; + loff_t lof; + loff_t __user *up; + + if (offset && get_user(lof, offset)) + return -EFAULT; + + /* The __user pointer cast is valid because of the set_fs() */ + set_fs(KERNEL_DS); + up = offset ? (loff_t __user *) &lof : NULL; + ret = sys_sendfile64(out_fd, in_fd, up, count); + set_fs(old_fs); + + if (offset && put_user(lof, offset)) + return -EFAULT; + + return ret; } long compat_sys_execve(unsigned long a0, unsigned long a1, unsigned long a2, diff --git a/trunk/arch/powerpc/kvm/44x_tlb.c b/trunk/arch/powerpc/kvm/44x_tlb.c index 5dd3ab469976..33aa715dab28 100644 --- a/trunk/arch/powerpc/kvm/44x_tlb.c +++ b/trunk/arch/powerpc/kvm/44x_tlb.c @@ -319,6 +319,7 @@ void kvmppc_mmu_map(struct kvm_vcpu *vcpu, u64 gvaddr, gpa_t gpaddr, if (is_error_page(new_page)) { printk(KERN_ERR "Couldn't get guest page for gfn %llx!\n", (unsigned long long)gfn); + kvm_release_page_clean(new_page); return; } hpaddr = page_to_phys(new_page); diff --git a/trunk/arch/powerpc/kvm/book3s_64_mmu_hv.c b/trunk/arch/powerpc/kvm/book3s_64_mmu_hv.c index d95d11322a15..d03eb6f7b058 100644 --- a/trunk/arch/powerpc/kvm/book3s_64_mmu_hv.c +++ b/trunk/arch/powerpc/kvm/book3s_64_mmu_hv.c @@ -705,7 +705,7 @@ int kvmppc_book3s_hv_page_fault(struct kvm_run *run, struct kvm_vcpu *vcpu, goto out_unlock; hpte[0] = (hpte[0] & ~HPTE_V_ABSENT) | HPTE_V_VALID; - rmap = &memslot->arch.rmap[gfn - memslot->base_gfn]; + rmap = &memslot->rmap[gfn - memslot->base_gfn]; lock_rmap(rmap); /* Check if we might have been invalidated; let the guest retry if so */ @@ -756,12 +756,9 @@ int kvmppc_book3s_hv_page_fault(struct kvm_run *run, struct kvm_vcpu *vcpu, goto out_put; } -static int kvm_handle_hva_range(struct kvm *kvm, - unsigned long start, - unsigned long end, - int (*handler)(struct kvm *kvm, - unsigned long *rmapp, - unsigned long gfn)) +static int kvm_handle_hva(struct kvm *kvm, unsigned long hva, + int (*handler)(struct kvm *kvm, unsigned long *rmapp, + unsigned long gfn)) { int ret; int retval = 0; @@ -770,25 +767,15 @@ static int kvm_handle_hva_range(struct kvm *kvm, slots = kvm_memslots(kvm); kvm_for_each_memslot(memslot, slots) { - unsigned long hva_start, hva_end; - gfn_t gfn, gfn_end; + unsigned long start = memslot->userspace_addr; + unsigned long end; - hva_start = max(start, memslot->userspace_addr); - hva_end = min(end, memslot->userspace_addr + - (memslot->npages << PAGE_SHIFT)); - if (hva_start >= hva_end) - continue; - /* - * {gfn(page) | page intersects with [hva_start, hva_end)} = - * {gfn, gfn+1, ..., gfn_end-1}. - */ - gfn = hva_to_gfn_memslot(hva_start, memslot); - gfn_end = hva_to_gfn_memslot(hva_end + PAGE_SIZE - 1, memslot); - - for (; gfn < gfn_end; ++gfn) { - gfn_t gfn_offset = gfn - memslot->base_gfn; + end = start + (memslot->npages << PAGE_SHIFT); + if (hva >= start && hva < end) { + gfn_t gfn_offset = (hva - start) >> PAGE_SHIFT; - ret = handler(kvm, &memslot->arch.rmap[gfn_offset], gfn); + ret = handler(kvm, &memslot->rmap[gfn_offset], + memslot->base_gfn + gfn_offset); retval |= ret; } } @@ -796,13 +783,6 @@ static int kvm_handle_hva_range(struct kvm *kvm, return retval; } -static int kvm_handle_hva(struct kvm *kvm, unsigned long hva, - int (*handler)(struct kvm *kvm, unsigned long *rmapp, - unsigned long gfn)) -{ - return kvm_handle_hva_range(kvm, hva, hva + 1, handler); -} - static int kvm_unmap_rmapp(struct kvm *kvm, unsigned long *rmapp, unsigned long gfn) { @@ -870,13 +850,6 @@ int kvm_unmap_hva(struct kvm *kvm, unsigned long hva) return 0; } -int kvm_unmap_hva_range(struct kvm *kvm, unsigned long start, unsigned long end) -{ - if (kvm->arch.using_mmu_notifiers) - kvm_handle_hva_range(kvm, start, end, kvm_unmap_rmapp); - return 0; -} - static int kvm_age_rmapp(struct kvm *kvm, unsigned long *rmapp, unsigned long gfn) { @@ -1036,7 +1009,7 @@ long kvmppc_hv_get_dirty_log(struct kvm *kvm, struct kvm_memory_slot *memslot) unsigned long *rmapp, *map; preempt_disable(); - rmapp = memslot->arch.rmap; + rmapp = memslot->rmap; map = memslot->dirty_bitmap; for (i = 0; i < memslot->npages; ++i) { if (kvm_test_clear_dirty(kvm, rmapp)) diff --git a/trunk/arch/powerpc/kvm/book3s_hv_rm_mmu.c b/trunk/arch/powerpc/kvm/book3s_hv_rm_mmu.c index fb0e821622d4..5c70d19494f9 100644 --- a/trunk/arch/powerpc/kvm/book3s_hv_rm_mmu.c +++ b/trunk/arch/powerpc/kvm/book3s_hv_rm_mmu.c @@ -84,7 +84,7 @@ static void remove_revmap_chain(struct kvm *kvm, long pte_index, if (!memslot || (memslot->flags & KVM_MEMSLOT_INVALID)) return; - rmap = real_vmalloc_addr(&memslot->arch.rmap[gfn - memslot->base_gfn]); + rmap = real_vmalloc_addr(&memslot->rmap[gfn - memslot->base_gfn]); lock_rmap(rmap); head = *rmap & KVMPPC_RMAP_INDEX; @@ -180,7 +180,7 @@ long kvmppc_h_enter(struct kvm_vcpu *vcpu, unsigned long flags, if (!slot_is_aligned(memslot, psize)) return H_PARAMETER; slot_fn = gfn - memslot->base_gfn; - rmap = &memslot->arch.rmap[slot_fn]; + rmap = &memslot->rmap[slot_fn]; if (!kvm->arch.using_mmu_notifiers) { physp = kvm->arch.slot_phys[memslot->id]; @@ -197,7 +197,7 @@ long kvmppc_h_enter(struct kvm_vcpu *vcpu, unsigned long flags, pa &= PAGE_MASK; } else { /* Translate to host virtual address */ - hva = __gfn_to_hva_memslot(memslot, gfn); + hva = gfn_to_hva_memslot(memslot, gfn); /* Look up the Linux PTE for the backing page */ pte_size = psize; diff --git a/trunk/arch/powerpc/kvm/book3s_pr.c b/trunk/arch/powerpc/kvm/book3s_pr.c index 05c28f59f77f..a1baec340f7e 100644 --- a/trunk/arch/powerpc/kvm/book3s_pr.c +++ b/trunk/arch/powerpc/kvm/book3s_pr.c @@ -242,8 +242,10 @@ static void kvmppc_patch_dcbz(struct kvm_vcpu *vcpu, struct kvmppc_pte *pte) int i; hpage = gfn_to_page(vcpu->kvm, pte->raddr >> PAGE_SHIFT); - if (is_error_page(hpage)) + if (is_error_page(hpage)) { + kvm_release_page_clean(hpage); return; + } hpage_offset = pte->raddr & ~PAGE_MASK; hpage_offset &= ~0xFFFULL; diff --git a/trunk/arch/powerpc/kvm/e500_tlb.c b/trunk/arch/powerpc/kvm/e500_tlb.c index ff38b664195d..a2b66717813d 100644 --- a/trunk/arch/powerpc/kvm/e500_tlb.c +++ b/trunk/arch/powerpc/kvm/e500_tlb.c @@ -520,10 +520,11 @@ static inline void kvmppc_e500_shadow_map(struct kvmppc_vcpu_e500 *vcpu_e500, if (likely(!pfnmap)) { unsigned long tsize_pages = 1 << (tsize + 10 - PAGE_SHIFT); - pfn = gfn_to_pfn_memslot(slot, gfn); + pfn = gfn_to_pfn_memslot(vcpu_e500->vcpu.kvm, slot, gfn); if (is_error_pfn(pfn)) { printk(KERN_ERR "Couldn't get real page for gfn %lx!\n", (long)gfn); + kvm_release_pfn_clean(pfn); return; } diff --git a/trunk/arch/powerpc/kvm/powerpc.c b/trunk/arch/powerpc/kvm/powerpc.c index 4d213b8b0fb5..87f4dc886076 100644 --- a/trunk/arch/powerpc/kvm/powerpc.c +++ b/trunk/arch/powerpc/kvm/powerpc.c @@ -302,18 +302,10 @@ long kvm_arch_dev_ioctl(struct file *filp, void kvm_arch_free_memslot(struct kvm_memory_slot *free, struct kvm_memory_slot *dont) { - if (!dont || free->arch.rmap != dont->arch.rmap) { - vfree(free->arch.rmap); - free->arch.rmap = NULL; - } } int kvm_arch_create_memslot(struct kvm_memory_slot *slot, unsigned long npages) { - slot->arch.rmap = vzalloc(npages * sizeof(*slot->arch.rmap)); - if (!slot->arch.rmap) - return -ENOMEM; - return 0; } @@ -334,12 +326,8 @@ void kvm_arch_commit_memory_region(struct kvm *kvm, kvmppc_core_commit_memory_region(kvm, mem); } -void kvm_arch_flush_shadow_all(struct kvm *kvm) -{ -} -void kvm_arch_flush_shadow_memslot(struct kvm *kvm, - struct kvm_memory_slot *slot) +void kvm_arch_flush_shadow(struct kvm *kvm) { } diff --git a/trunk/arch/powerpc/platforms/40x/ppc40x_simple.c b/trunk/arch/powerpc/platforms/40x/ppc40x_simple.c index 969dddcf3320..97612068fae3 100644 --- a/trunk/arch/powerpc/platforms/40x/ppc40x_simple.c +++ b/trunk/arch/powerpc/platforms/40x/ppc40x_simple.c @@ -50,7 +50,7 @@ machine_device_initcall(ppc40x_simple, ppc40x_device_probe); * Again, if your board needs to do things differently then create a * board.c file for it rather than adding it to this list. */ -static const char * const board[] __initconst = { +static const char *board[] __initdata = { "amcc,acadia", "amcc,haleakala", "amcc,kilauea", diff --git a/trunk/arch/powerpc/platforms/512x/mpc5121_generic.c b/trunk/arch/powerpc/platforms/512x/mpc5121_generic.c index ca1ca6669990..926731f1ff01 100644 --- a/trunk/arch/powerpc/platforms/512x/mpc5121_generic.c +++ b/trunk/arch/powerpc/platforms/512x/mpc5121_generic.c @@ -26,7 +26,7 @@ /* * list of supported boards */ -static const char * const board[] __initconst = { +static const char *board[] __initdata = { "prt,prtlvt", NULL }; diff --git a/trunk/arch/powerpc/platforms/52xx/lite5200.c b/trunk/arch/powerpc/platforms/52xx/lite5200.c index 448d862bcf3d..01ffa64d2aa7 100644 --- a/trunk/arch/powerpc/platforms/52xx/lite5200.c +++ b/trunk/arch/powerpc/platforms/52xx/lite5200.c @@ -172,7 +172,7 @@ static void __init lite5200_setup_arch(void) mpc52xx_setup_pci(); } -static const char * const board[] __initconst = { +static const char *board[] __initdata = { "fsl,lite5200", "fsl,lite5200b", NULL, diff --git a/trunk/arch/powerpc/platforms/52xx/media5200.c b/trunk/arch/powerpc/platforms/52xx/media5200.c index 070d315dd6cd..17d91b7da315 100644 --- a/trunk/arch/powerpc/platforms/52xx/media5200.c +++ b/trunk/arch/powerpc/platforms/52xx/media5200.c @@ -232,7 +232,7 @@ static void __init media5200_setup_arch(void) } /* list of the supported boards */ -static const char * const board[] __initconst = { +static const char *board[] __initdata = { "fsl,media5200", NULL }; diff --git a/trunk/arch/powerpc/platforms/83xx/mpc837x_rdb.c b/trunk/arch/powerpc/platforms/83xx/mpc837x_rdb.c index eca1f0960fff..16c9c9cbbb7f 100644 --- a/trunk/arch/powerpc/platforms/83xx/mpc837x_rdb.c +++ b/trunk/arch/powerpc/platforms/83xx/mpc837x_rdb.c @@ -60,7 +60,7 @@ static void __init mpc837x_rdb_setup_arch(void) machine_device_initcall(mpc837x_rdb, mpc83xx_declare_of_platform_devices); -static const char * const board[] __initconst = { +static const char *board[] __initdata = { "fsl,mpc8377rdb", "fsl,mpc8378rdb", "fsl,mpc8379rdb", diff --git a/trunk/arch/powerpc/platforms/85xx/tqm85xx.c b/trunk/arch/powerpc/platforms/85xx/tqm85xx.c index b62fa87521a3..3e70a2035e53 100644 --- a/trunk/arch/powerpc/platforms/85xx/tqm85xx.c +++ b/trunk/arch/powerpc/platforms/85xx/tqm85xx.c @@ -125,7 +125,7 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_1520, machine_device_initcall(tqm85xx, mpc85xx_common_publish_devices); -static const char * const board[] __initconst = { +static const char *board[] __initdata = { "tqc,tqm8540", "tqc,tqm8541", "tqc,tqm8548", diff --git a/trunk/arch/powerpc/platforms/cell/spu_syscalls.c b/trunk/arch/powerpc/platforms/cell/spu_syscalls.c index db4e638cf408..714bbfc3162c 100644 --- a/trunk/arch/powerpc/platforms/cell/spu_syscalls.c +++ b/trunk/arch/powerpc/platforms/cell/spu_syscalls.c @@ -69,6 +69,8 @@ SYSCALL_DEFINE4(spu_create, const char __user *, name, unsigned int, flags, umode_t, mode, int, neighbor_fd) { long ret; + struct file *neighbor; + int fput_needed; struct spufs_calls *calls; calls = spufs_calls_get(); @@ -76,11 +78,11 @@ SYSCALL_DEFINE4(spu_create, const char __user *, name, unsigned int, flags, return -ENOSYS; if (flags & SPU_CREATE_AFFINITY_SPU) { - struct fd neighbor = fdget(neighbor_fd); ret = -EBADF; - if (neighbor.file) { - ret = calls->create_thread(name, flags, mode, neighbor.file); - fdput(neighbor); + neighbor = fget_light(neighbor_fd, &fput_needed); + if (neighbor) { + ret = calls->create_thread(name, flags, mode, neighbor); + fput_light(neighbor, fput_needed); } } else ret = calls->create_thread(name, flags, mode, NULL); @@ -92,7 +94,8 @@ SYSCALL_DEFINE4(spu_create, const char __user *, name, unsigned int, flags, asmlinkage long sys_spu_run(int fd, __u32 __user *unpc, __u32 __user *ustatus) { long ret; - struct fd arg; + struct file *filp; + int fput_needed; struct spufs_calls *calls; calls = spufs_calls_get(); @@ -100,10 +103,10 @@ asmlinkage long sys_spu_run(int fd, __u32 __user *unpc, __u32 __user *ustatus) return -ENOSYS; ret = -EBADF; - arg = fdget(fd); - if (arg.file) { - ret = calls->spu_run(arg.file, unpc, ustatus); - fdput(arg); + filp = fget_light(fd, &fput_needed); + if (filp) { + ret = calls->spu_run(filp, unpc, ustatus); + fput_light(filp, fput_needed); } spufs_calls_put(calls); diff --git a/trunk/arch/powerpc/platforms/cell/spufs/coredump.c b/trunk/arch/powerpc/platforms/cell/spufs/coredump.c index 657e3f233a64..c2c5b078ba80 100644 --- a/trunk/arch/powerpc/platforms/cell/spufs/coredump.c +++ b/trunk/arch/powerpc/platforms/cell/spufs/coredump.c @@ -106,17 +106,6 @@ static int spufs_ctx_note_size(struct spu_context *ctx, int dfd) return total; } -static int match_context(const void *v, struct file *file, unsigned fd) -{ - struct spu_context *ctx; - if (file->f_op != &spufs_context_fops) - return 0; - ctx = SPUFS_I(file->f_dentry->d_inode)->i_ctx; - if (ctx->flags & SPU_CREATE_NOSCHED) - return 0; - return fd + 1; -} - /* * The additional architecture-specific notes for Cell are various * context files in the spu context. @@ -126,18 +115,29 @@ static int match_context(const void *v, struct file *file, unsigned fd) * internal functionality to dump them without needing to actually * open the files. */ -/* - * descriptor table is not shared, so files can't change or go away. - */ static struct spu_context *coredump_next_context(int *fd) { + struct fdtable *fdt = files_fdtable(current->files); struct file *file; - int n = iterate_fd(current->files, *fd, match_context, NULL); - if (!n) - return NULL; - *fd = n - 1; - file = fcheck(*fd); - return SPUFS_I(file->f_dentry->d_inode)->i_ctx; + struct spu_context *ctx = NULL; + + for (; *fd < fdt->max_fds; (*fd)++) { + if (!fd_is_open(*fd, fdt)) + continue; + + file = fcheck(*fd); + + if (!file || file->f_op != &spufs_context_fops) + continue; + + ctx = SPUFS_I(file->f_dentry->d_inode)->i_ctx; + if (ctx->flags & SPU_CREATE_NOSCHED) + continue; + + break; + } + + return ctx; } int spufs_coredump_extra_notes_size(void) diff --git a/trunk/arch/s390/crypto/aes_s390.c b/trunk/arch/s390/crypto/aes_s390.c index da3c1a7dcd8e..e402a9dd4eda 100644 --- a/trunk/arch/s390/crypto/aes_s390.c +++ b/trunk/arch/s390/crypto/aes_s390.c @@ -216,6 +216,7 @@ static struct crypto_alg aes_alg = { .cra_blocksize = AES_BLOCK_SIZE, .cra_ctxsize = sizeof(struct s390_aes_ctx), .cra_module = THIS_MODULE, + .cra_list = LIST_HEAD_INIT(aes_alg.cra_list), .cra_init = fallback_init_cip, .cra_exit = fallback_exit_cip, .cra_u = { @@ -397,6 +398,7 @@ static struct crypto_alg ecb_aes_alg = { .cra_ctxsize = sizeof(struct s390_aes_ctx), .cra_type = &crypto_blkcipher_type, .cra_module = THIS_MODULE, + .cra_list = LIST_HEAD_INIT(ecb_aes_alg.cra_list), .cra_init = fallback_init_blk, .cra_exit = fallback_exit_blk, .cra_u = { @@ -506,6 +508,7 @@ static struct crypto_alg cbc_aes_alg = { .cra_ctxsize = sizeof(struct s390_aes_ctx), .cra_type = &crypto_blkcipher_type, .cra_module = THIS_MODULE, + .cra_list = LIST_HEAD_INIT(cbc_aes_alg.cra_list), .cra_init = fallback_init_blk, .cra_exit = fallback_exit_blk, .cra_u = { @@ -707,6 +710,7 @@ static struct crypto_alg xts_aes_alg = { .cra_ctxsize = sizeof(struct s390_xts_ctx), .cra_type = &crypto_blkcipher_type, .cra_module = THIS_MODULE, + .cra_list = LIST_HEAD_INIT(xts_aes_alg.cra_list), .cra_init = xts_fallback_init, .cra_exit = xts_fallback_exit, .cra_u = { @@ -828,6 +832,7 @@ static struct crypto_alg ctr_aes_alg = { .cra_ctxsize = sizeof(struct s390_aes_ctx), .cra_type = &crypto_blkcipher_type, .cra_module = THIS_MODULE, + .cra_list = LIST_HEAD_INIT(ctr_aes_alg.cra_list), .cra_u = { .blkcipher = { .min_keysize = AES_MIN_KEY_SIZE, diff --git a/trunk/arch/s390/crypto/des_s390.c b/trunk/arch/s390/crypto/des_s390.c index b49fb96f4207..1eaa371ca3ee 100644 --- a/trunk/arch/s390/crypto/des_s390.c +++ b/trunk/arch/s390/crypto/des_s390.c @@ -70,6 +70,7 @@ static struct crypto_alg des_alg = { .cra_blocksize = DES_BLOCK_SIZE, .cra_ctxsize = sizeof(struct s390_des_ctx), .cra_module = THIS_MODULE, + .cra_list = LIST_HEAD_INIT(des_alg.cra_list), .cra_u = { .cipher = { .cia_min_keysize = DES_KEY_SIZE, @@ -162,6 +163,7 @@ static struct crypto_alg ecb_des_alg = { .cra_ctxsize = sizeof(struct s390_des_ctx), .cra_type = &crypto_blkcipher_type, .cra_module = THIS_MODULE, + .cra_list = LIST_HEAD_INIT(ecb_des_alg.cra_list), .cra_u = { .blkcipher = { .min_keysize = DES_KEY_SIZE, @@ -204,6 +206,7 @@ static struct crypto_alg cbc_des_alg = { .cra_ctxsize = sizeof(struct s390_des_ctx), .cra_type = &crypto_blkcipher_type, .cra_module = THIS_MODULE, + .cra_list = LIST_HEAD_INIT(cbc_des_alg.cra_list), .cra_u = { .blkcipher = { .min_keysize = DES_KEY_SIZE, @@ -268,6 +271,7 @@ static struct crypto_alg des3_alg = { .cra_blocksize = DES_BLOCK_SIZE, .cra_ctxsize = sizeof(struct s390_des_ctx), .cra_module = THIS_MODULE, + .cra_list = LIST_HEAD_INIT(des3_alg.cra_list), .cra_u = { .cipher = { .cia_min_keysize = DES3_KEY_SIZE, @@ -310,6 +314,8 @@ static struct crypto_alg ecb_des3_alg = { .cra_ctxsize = sizeof(struct s390_des_ctx), .cra_type = &crypto_blkcipher_type, .cra_module = THIS_MODULE, + .cra_list = LIST_HEAD_INIT( + ecb_des3_alg.cra_list), .cra_u = { .blkcipher = { .min_keysize = DES3_KEY_SIZE, @@ -352,6 +358,8 @@ static struct crypto_alg cbc_des3_alg = { .cra_ctxsize = sizeof(struct s390_des_ctx), .cra_type = &crypto_blkcipher_type, .cra_module = THIS_MODULE, + .cra_list = LIST_HEAD_INIT( + cbc_des3_alg.cra_list), .cra_u = { .blkcipher = { .min_keysize = DES3_KEY_SIZE, @@ -444,6 +452,7 @@ static struct crypto_alg ctr_des_alg = { .cra_ctxsize = sizeof(struct s390_des_ctx), .cra_type = &crypto_blkcipher_type, .cra_module = THIS_MODULE, + .cra_list = LIST_HEAD_INIT(ctr_des_alg.cra_list), .cra_u = { .blkcipher = { .min_keysize = DES_KEY_SIZE, @@ -487,6 +496,7 @@ static struct crypto_alg ctr_des3_alg = { .cra_ctxsize = sizeof(struct s390_des_ctx), .cra_type = &crypto_blkcipher_type, .cra_module = THIS_MODULE, + .cra_list = LIST_HEAD_INIT(ctr_des3_alg.cra_list), .cra_u = { .blkcipher = { .min_keysize = DES3_KEY_SIZE, diff --git a/trunk/arch/s390/crypto/ghash_s390.c b/trunk/arch/s390/crypto/ghash_s390.c index 1ebd3a15cca4..b1bd170f24b1 100644 --- a/trunk/arch/s390/crypto/ghash_s390.c +++ b/trunk/arch/s390/crypto/ghash_s390.c @@ -135,6 +135,7 @@ static struct shash_alg ghash_alg = { .cra_blocksize = GHASH_BLOCK_SIZE, .cra_ctxsize = sizeof(struct ghash_ctx), .cra_module = THIS_MODULE, + .cra_list = LIST_HEAD_INIT(ghash_alg.base.cra_list), }, }; diff --git a/trunk/arch/s390/hypfs/inode.c b/trunk/arch/s390/hypfs/inode.c index 06ea69bd387a..124ec1a55cc9 100644 --- a/trunk/arch/s390/hypfs/inode.c +++ b/trunk/arch/s390/hypfs/inode.c @@ -72,6 +72,8 @@ static void hypfs_remove(struct dentry *dentry) struct dentry *parent; parent = dentry->d_parent; + if (!parent || !parent->d_inode) + return; mutex_lock(&parent->d_inode->i_mutex); if (hypfs_positive(dentry)) { if (S_ISDIR(dentry->d_inode->i_mode)) diff --git a/trunk/arch/s390/include/asm/compat.h b/trunk/arch/s390/include/asm/compat.h index a34a9d612fc0..234f1d859cea 100644 --- a/trunk/arch/s390/include/asm/compat.h +++ b/trunk/arch/s390/include/asm/compat.h @@ -65,7 +65,6 @@ typedef s64 compat_s64; typedef u32 compat_uint_t; typedef u32 compat_ulong_t; typedef u64 compat_u64; -typedef u32 compat_uptr_t; struct compat_timespec { compat_time_t tv_sec; @@ -145,79 +144,6 @@ typedef u32 compat_old_sigset_t; /* at least 32 bits */ typedef u32 compat_sigset_word; -typedef union compat_sigval { - compat_int_t sival_int; - compat_uptr_t sival_ptr; -} compat_sigval_t; - -typedef struct compat_siginfo { - int si_signo; - int si_errno; - int si_code; - - union { - int _pad[128/sizeof(int) - 3]; - - /* kill() */ - struct { - pid_t _pid; /* sender's pid */ - uid_t _uid; /* sender's uid */ - } _kill; - - /* POSIX.1b timers */ - struct { - compat_timer_t _tid; /* timer id */ - int _overrun; /* overrun count */ - compat_sigval_t _sigval; /* same as below */ - int _sys_private; /* not to be passed to user */ - } _timer; - - /* POSIX.1b signals */ - struct { - pid_t _pid; /* sender's pid */ - uid_t _uid; /* sender's uid */ - compat_sigval_t _sigval; - } _rt; - - /* SIGCHLD */ - struct { - pid_t _pid; /* which child */ - uid_t _uid; /* sender's uid */ - int _status;/* exit code */ - compat_clock_t _utime; - compat_clock_t _stime; - } _sigchld; - - /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */ - struct { - __u32 _addr; /* faulting insn/memory ref. - pointer */ - } _sigfault; - - /* SIGPOLL */ - struct { - int _band; /* POLL_IN, POLL_OUT, POLL_MSG */ - int _fd; - } _sigpoll; - } _sifields; -} compat_siginfo_t; - -/* - * How these fields are to be accessed. - */ -#define si_pid _sifields._kill._pid -#define si_uid _sifields._kill._uid -#define si_status _sifields._sigchld._status -#define si_utime _sifields._sigchld._utime -#define si_stime _sifields._sigchld._stime -#define si_value _sifields._rt._sigval -#define si_int _sifields._rt._sigval.sival_int -#define si_ptr _sifields._rt._sigval.sival_ptr -#define si_addr _sifields._sigfault._addr -#define si_band _sifields._sigpoll._band -#define si_fd _sifields._sigpoll._fd -#define si_tid _sifields._timer._tid -#define si_overrun _sifields._timer._overrun - #define COMPAT_OFF_T_MAX 0x7fffffff #define COMPAT_LOFF_T_MAX 0x7fffffffffffffffL @@ -227,6 +153,7 @@ typedef struct compat_siginfo { * as pointers because the syscall entry code will have * appropriately converted them already. */ +typedef u32 compat_uptr_t; static inline void __user *compat_ptr(compat_uptr_t uptr) { diff --git a/trunk/arch/s390/include/asm/processor.h b/trunk/arch/s390/include/asm/processor.h index 56831dfa9198..f3e0aabfc6bc 100644 --- a/trunk/arch/s390/include/asm/processor.h +++ b/trunk/arch/s390/include/asm/processor.h @@ -159,7 +159,6 @@ extern unsigned long thread_saved_pc(struct task_struct *t); extern void show_code(struct pt_regs *regs); extern void print_fn_code(unsigned char *code, unsigned long len); -extern int insn_to_mnemonic(unsigned char *instruction, char buf[8]); unsigned long get_wchan(struct task_struct *p); #define task_pt_regs(tsk) ((struct pt_regs *) \ diff --git a/trunk/arch/s390/include/uapi/asm/Kbuild b/trunk/arch/s390/include/uapi/asm/Kbuild deleted file mode 100644 index baebb3da1d44..000000000000 --- a/trunk/arch/s390/include/uapi/asm/Kbuild +++ /dev/null @@ -1,3 +0,0 @@ -# UAPI Header export list -include include/uapi/asm-generic/Kbuild.asm - diff --git a/trunk/arch/s390/kernel/compat_linux.h b/trunk/arch/s390/kernel/compat_linux.h index 90887bd98cf0..9635d759c2b9 100644 --- a/trunk/arch/s390/kernel/compat_linux.h +++ b/trunk/arch/s390/kernel/compat_linux.h @@ -23,6 +23,74 @@ struct old_sigaction32 { __u32 sa_flags; __u32 sa_restorer; /* Another 32 bit pointer */ }; + +typedef struct compat_siginfo { + int si_signo; + int si_errno; + int si_code; + + union { + int _pad[((128/sizeof(int)) - 3)]; + + /* kill() */ + struct { + pid_t _pid; /* sender's pid */ + uid_t _uid; /* sender's uid */ + } _kill; + + /* POSIX.1b timers */ + struct { + compat_timer_t _tid; /* timer id */ + int _overrun; /* overrun count */ + compat_sigval_t _sigval; /* same as below */ + int _sys_private; /* not to be passed to user */ + } _timer; + + /* POSIX.1b signals */ + struct { + pid_t _pid; /* sender's pid */ + uid_t _uid; /* sender's uid */ + compat_sigval_t _sigval; + } _rt; + + /* SIGCHLD */ + struct { + pid_t _pid; /* which child */ + uid_t _uid; /* sender's uid */ + int _status;/* exit code */ + compat_clock_t _utime; + compat_clock_t _stime; + } _sigchld; + + /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */ + struct { + __u32 _addr; /* faulting insn/memory ref. - pointer */ + } _sigfault; + + /* SIGPOLL */ + struct { + int _band; /* POLL_IN, POLL_OUT, POLL_MSG */ + int _fd; + } _sigpoll; + } _sifields; +} compat_siginfo_t; + +/* + * How these fields are to be accessed. + */ +#define si_pid _sifields._kill._pid +#define si_uid _sifields._kill._uid +#define si_status _sifields._sigchld._status +#define si_utime _sifields._sigchld._utime +#define si_stime _sifields._sigchld._stime +#define si_value _sifields._rt._sigval +#define si_int _sifields._rt._sigval.sival_int +#define si_ptr _sifields._rt._sigval.sival_ptr +#define si_addr _sifields._sigfault._addr +#define si_band _sifields._sigpoll._band +#define si_fd _sifields._sigpoll._fd +#define si_tid _sifields._timer._tid +#define si_overrun _sifields._timer._overrun /* asm/sigcontext.h */ typedef union diff --git a/trunk/arch/s390/kernel/dis.c b/trunk/arch/s390/kernel/dis.c index f00286bd2ef9..cc84a24c023f 100644 --- a/trunk/arch/s390/kernel/dis.c +++ b/trunk/arch/s390/kernel/dis.c @@ -1501,33 +1501,6 @@ static struct insn *find_insn(unsigned char *code) return NULL; } -/** - * insn_to_mnemonic - decode an s390 instruction - * @instruction: instruction to decode - * @buf: buffer to fill with mnemonic - * - * Decode the instruction at @instruction and store the corresponding - * mnemonic into @buf. - * @buf is left unchanged if the instruction could not be decoded. - * Returns: - * %0 on success, %-ENOENT if the instruction was not found. - */ -int insn_to_mnemonic(unsigned char *instruction, char buf[8]) -{ - struct insn *insn; - - insn = find_insn(instruction); - if (!insn) - return -ENOENT; - if (insn->name[0] == '\0') - snprintf(buf, sizeof(buf), "%s", - long_insn_name[(int) insn->name[1]]); - else - snprintf(buf, sizeof(buf), "%.5s", insn->name); - return 0; -} -EXPORT_SYMBOL_GPL(insn_to_mnemonic); - static int print_insn(char *buffer, unsigned char *code, unsigned long addr) { struct insn *insn; diff --git a/trunk/arch/s390/kvm/Kconfig b/trunk/arch/s390/kvm/Kconfig index b58dd869cb32..9b04a32e5695 100644 --- a/trunk/arch/s390/kvm/Kconfig +++ b/trunk/arch/s390/kvm/Kconfig @@ -21,7 +21,6 @@ config KVM depends on HAVE_KVM && EXPERIMENTAL select PREEMPT_NOTIFIERS select ANON_INODES - select HAVE_KVM_CPU_RELAX_INTERCEPT ---help--- Support hosting paravirtualized guest machines using the SIE virtualization capability on the mainframe. This should work diff --git a/trunk/arch/s390/kvm/diag.c b/trunk/arch/s390/kvm/diag.c index a390687feb13..c88bb7793390 100644 --- a/trunk/arch/s390/kvm/diag.c +++ b/trunk/arch/s390/kvm/diag.c @@ -14,8 +14,6 @@ #include #include #include "kvm-s390.h" -#include "trace.h" -#include "trace-s390.h" static int diag_release_pages(struct kvm_vcpu *vcpu) { @@ -100,7 +98,6 @@ static int __diag_ipl_functions(struct kvm_vcpu *vcpu) vcpu->run->exit_reason = KVM_EXIT_S390_RESET; VCPU_EVENT(vcpu, 3, "requesting userspace resets %llx", vcpu->run->s390_reset_flags); - trace_kvm_s390_request_resets(vcpu->run->s390_reset_flags); return -EREMOTE; } @@ -108,7 +105,6 @@ int kvm_s390_handle_diag(struct kvm_vcpu *vcpu) { int code = (vcpu->arch.sie_block->ipb & 0xfff0000) >> 16; - trace_kvm_s390_handle_diag(vcpu, code); switch (code) { case 0x10: return diag_release_pages(vcpu); diff --git a/trunk/arch/s390/kvm/intercept.c b/trunk/arch/s390/kvm/intercept.c index 22798ec33fd1..adae539f12e2 100644 --- a/trunk/arch/s390/kvm/intercept.c +++ b/trunk/arch/s390/kvm/intercept.c @@ -19,8 +19,6 @@ #include "kvm-s390.h" #include "gaccess.h" -#include "trace.h" -#include "trace-s390.h" static int handle_lctlg(struct kvm_vcpu *vcpu) { @@ -47,7 +45,6 @@ static int handle_lctlg(struct kvm_vcpu *vcpu) VCPU_EVENT(vcpu, 5, "lctlg r1:%x, r3:%x,b2:%x,d2:%x", reg1, reg3, base2, disp2); - trace_kvm_s390_handle_lctl(vcpu, 1, reg1, reg3, useraddr); do { rc = get_guest_u64(vcpu, useraddr, @@ -85,7 +82,6 @@ static int handle_lctl(struct kvm_vcpu *vcpu) VCPU_EVENT(vcpu, 5, "lctl r1:%x, r3:%x,b2:%x,d2:%x", reg1, reg3, base2, disp2); - trace_kvm_s390_handle_lctl(vcpu, 0, reg1, reg3, useraddr); reg = reg1; do { @@ -139,8 +135,6 @@ static int handle_stop(struct kvm_vcpu *vcpu) vcpu->stat.exit_stop_request++; spin_lock_bh(&vcpu->arch.local_int.lock); - trace_kvm_s390_stop_request(vcpu->arch.local_int.action_bits); - if (vcpu->arch.local_int.action_bits & ACTION_RELOADVCPU_ON_STOP) { vcpu->arch.local_int.action_bits &= ~ACTION_RELOADVCPU_ON_STOP; rc = SIE_INTERCEPT_RERUNVCPU; @@ -177,7 +171,6 @@ static int handle_validity(struct kvm_vcpu *vcpu) int rc; vcpu->stat.exit_validity++; - trace_kvm_s390_intercept_validity(vcpu, viwhy); if (viwhy == 0x37) { vmaddr = gmap_fault(vcpu->arch.sie_block->prefix, vcpu->arch.gmap); @@ -220,9 +213,6 @@ static int handle_instruction(struct kvm_vcpu *vcpu) intercept_handler_t handler; vcpu->stat.exit_instruction++; - trace_kvm_s390_intercept_instruction(vcpu, - vcpu->arch.sie_block->ipa, - vcpu->arch.sie_block->ipb); handler = instruction_handlers[vcpu->arch.sie_block->ipa >> 8]; if (handler) return handler(vcpu); @@ -232,7 +222,6 @@ static int handle_instruction(struct kvm_vcpu *vcpu) static int handle_prog(struct kvm_vcpu *vcpu) { vcpu->stat.exit_program_interruption++; - trace_kvm_s390_intercept_prog(vcpu, vcpu->arch.sie_block->iprcc); return kvm_s390_inject_program_int(vcpu, vcpu->arch.sie_block->iprcc); } diff --git a/trunk/arch/s390/kvm/interrupt.c b/trunk/arch/s390/kvm/interrupt.c index ff1e2f8ef94a..b7bc1aac8ed2 100644 --- a/trunk/arch/s390/kvm/interrupt.c +++ b/trunk/arch/s390/kvm/interrupt.c @@ -19,7 +19,6 @@ #include #include "kvm-s390.h" #include "gaccess.h" -#include "trace-s390.h" static int psw_extint_disabled(struct kvm_vcpu *vcpu) { @@ -131,8 +130,6 @@ static void __do_deliver_interrupt(struct kvm_vcpu *vcpu, case KVM_S390_INT_EMERGENCY: VCPU_EVENT(vcpu, 4, "%s", "interrupt: sigp emerg"); vcpu->stat.deliver_emergency_signal++; - trace_kvm_s390_deliver_interrupt(vcpu->vcpu_id, inti->type, - inti->emerg.code, 0); rc = put_guest_u16(vcpu, __LC_EXT_INT_CODE, 0x1201); if (rc == -EFAULT) exception = 1; @@ -155,8 +152,6 @@ static void __do_deliver_interrupt(struct kvm_vcpu *vcpu, case KVM_S390_INT_EXTERNAL_CALL: VCPU_EVENT(vcpu, 4, "%s", "interrupt: sigp ext call"); vcpu->stat.deliver_external_call++; - trace_kvm_s390_deliver_interrupt(vcpu->vcpu_id, inti->type, - inti->extcall.code, 0); rc = put_guest_u16(vcpu, __LC_EXT_INT_CODE, 0x1202); if (rc == -EFAULT) exception = 1; @@ -180,8 +175,6 @@ static void __do_deliver_interrupt(struct kvm_vcpu *vcpu, VCPU_EVENT(vcpu, 4, "interrupt: sclp parm:%x", inti->ext.ext_params); vcpu->stat.deliver_service_signal++; - trace_kvm_s390_deliver_interrupt(vcpu->vcpu_id, inti->type, - inti->ext.ext_params, 0); rc = put_guest_u16(vcpu, __LC_EXT_INT_CODE, 0x2401); if (rc == -EFAULT) exception = 1; @@ -205,9 +198,6 @@ static void __do_deliver_interrupt(struct kvm_vcpu *vcpu, VCPU_EVENT(vcpu, 4, "interrupt: virtio parm:%x,parm64:%llx", inti->ext.ext_params, inti->ext.ext_params2); vcpu->stat.deliver_virtio_interrupt++; - trace_kvm_s390_deliver_interrupt(vcpu->vcpu_id, inti->type, - inti->ext.ext_params, - inti->ext.ext_params2); rc = put_guest_u16(vcpu, __LC_EXT_INT_CODE, 0x2603); if (rc == -EFAULT) exception = 1; @@ -239,8 +229,6 @@ static void __do_deliver_interrupt(struct kvm_vcpu *vcpu, case KVM_S390_SIGP_STOP: VCPU_EVENT(vcpu, 4, "%s", "interrupt: cpu stop"); vcpu->stat.deliver_stop_signal++; - trace_kvm_s390_deliver_interrupt(vcpu->vcpu_id, inti->type, - 0, 0); __set_intercept_indicator(vcpu, inti); break; @@ -248,16 +236,12 @@ static void __do_deliver_interrupt(struct kvm_vcpu *vcpu, VCPU_EVENT(vcpu, 4, "interrupt: set prefix to %x", inti->prefix.address); vcpu->stat.deliver_prefix_signal++; - trace_kvm_s390_deliver_interrupt(vcpu->vcpu_id, inti->type, - inti->prefix.address, 0); kvm_s390_set_prefix(vcpu, inti->prefix.address); break; case KVM_S390_RESTART: VCPU_EVENT(vcpu, 4, "%s", "interrupt: cpu restart"); vcpu->stat.deliver_restart_signal++; - trace_kvm_s390_deliver_interrupt(vcpu->vcpu_id, inti->type, - 0, 0); rc = copy_to_guest(vcpu, offsetof(struct _lowcore, restart_old_psw), &vcpu->arch.sie_block->gpsw, sizeof(psw_t)); if (rc == -EFAULT) @@ -275,8 +259,6 @@ static void __do_deliver_interrupt(struct kvm_vcpu *vcpu, inti->pgm.code, table[vcpu->arch.sie_block->ipa >> 14]); vcpu->stat.deliver_program_int++; - trace_kvm_s390_deliver_interrupt(vcpu->vcpu_id, inti->type, - inti->pgm.code, 0); rc = put_guest_u16(vcpu, __LC_PGM_INT_CODE, inti->pgm.code); if (rc == -EFAULT) exception = 1; @@ -423,7 +405,9 @@ int kvm_s390_handle_wait(struct kvm_vcpu *vcpu) set_current_state(TASK_INTERRUPTIBLE); spin_unlock_bh(&vcpu->arch.local_int.lock); spin_unlock(&vcpu->arch.local_int.float_int->lock); + vcpu_put(vcpu); schedule(); + vcpu_load(vcpu); spin_lock(&vcpu->arch.local_int.float_int->lock); spin_lock_bh(&vcpu->arch.local_int.lock); } @@ -531,7 +515,6 @@ int kvm_s390_inject_program_int(struct kvm_vcpu *vcpu, u16 code) inti->pgm.code = code; VCPU_EVENT(vcpu, 3, "inject: program check %d (from kernel)", code); - trace_kvm_s390_inject_vcpu(vcpu->vcpu_id, inti->type, code, 0, 1); spin_lock_bh(&li->lock); list_add(&inti->list, &li->list); atomic_set(&li->active, 1); @@ -573,8 +556,6 @@ int kvm_s390_inject_vm(struct kvm *kvm, kfree(inti); return -EINVAL; } - trace_kvm_s390_inject_vm(s390int->type, s390int->parm, s390int->parm64, - 2); mutex_lock(&kvm->lock); fi = &kvm->arch.float_int; @@ -640,8 +621,6 @@ int kvm_s390_inject_vcpu(struct kvm_vcpu *vcpu, kfree(inti); return -EINVAL; } - trace_kvm_s390_inject_vcpu(vcpu->vcpu_id, s390int->type, s390int->parm, - s390int->parm64, 2); mutex_lock(&vcpu->kvm->lock); li = &vcpu->arch.local_int; diff --git a/trunk/arch/s390/kvm/kvm-s390.c b/trunk/arch/s390/kvm/kvm-s390.c index ecced9d18986..d470ccbfabae 100644 --- a/trunk/arch/s390/kvm/kvm-s390.c +++ b/trunk/arch/s390/kvm/kvm-s390.c @@ -32,10 +32,6 @@ #include "kvm-s390.h" #include "gaccess.h" -#define CREATE_TRACE_POINTS -#include "trace.h" -#include "trace-s390.h" - #define VCPU_STAT(x) offsetof(struct kvm_vcpu, stat.x), KVM_STAT_VCPU struct kvm_stats_debugfs_item debugfs_entries[] = { @@ -246,7 +242,6 @@ int kvm_arch_init_vm(struct kvm *kvm, unsigned long type) void kvm_arch_vcpu_destroy(struct kvm_vcpu *vcpu) { VCPU_EVENT(vcpu, 3, "%s", "free cpu"); - trace_kvm_s390_destroy_vcpu(vcpu->vcpu_id); if (!kvm_is_ucontrol(vcpu->kvm)) { clear_bit(63 - vcpu->vcpu_id, (unsigned long *) &vcpu->kvm->arch.sca->mcn); @@ -422,7 +417,6 @@ struct kvm_vcpu *kvm_arch_vcpu_create(struct kvm *kvm, goto out_free_sie_block; VM_EVENT(kvm, 3, "create cpu %d at %p, sie block at %p", id, vcpu, vcpu->arch.sie_block); - trace_kvm_s390_create_vcpu(id, vcpu, vcpu->arch.sie_block); return vcpu; out_free_sie_block: @@ -613,22 +607,18 @@ static int __vcpu_run(struct kvm_vcpu *vcpu) local_irq_enable(); VCPU_EVENT(vcpu, 6, "entering sie flags %x", atomic_read(&vcpu->arch.sie_block->cpuflags)); - trace_kvm_s390_sie_enter(vcpu, - atomic_read(&vcpu->arch.sie_block->cpuflags)); rc = sie64a(vcpu->arch.sie_block, vcpu->run->s.regs.gprs); if (rc) { if (kvm_is_ucontrol(vcpu->kvm)) { rc = SIE_INTERCEPT_UCONTROL; } else { VCPU_EVENT(vcpu, 3, "%s", "fault in sie instruction"); - trace_kvm_s390_sie_fault(vcpu); kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING); rc = 0; } } VCPU_EVENT(vcpu, 6, "exit sie icptcode %d", vcpu->arch.sie_block->icptcode); - trace_kvm_s390_sie_exit(vcpu, vcpu->arch.sie_block->icptcode); local_irq_disable(); kvm_guest_exit(); local_irq_enable(); @@ -969,12 +959,7 @@ void kvm_arch_commit_memory_region(struct kvm *kvm, return; } -void kvm_arch_flush_shadow_all(struct kvm *kvm) -{ -} - -void kvm_arch_flush_shadow_memslot(struct kvm *kvm, - struct kvm_memory_slot *slot) +void kvm_arch_flush_shadow(struct kvm *kvm) { } diff --git a/trunk/arch/s390/kvm/priv.c b/trunk/arch/s390/kvm/priv.c index d768906f15c8..310be61bead7 100644 --- a/trunk/arch/s390/kvm/priv.c +++ b/trunk/arch/s390/kvm/priv.c @@ -20,7 +20,6 @@ #include #include "gaccess.h" #include "kvm-s390.h" -#include "trace.h" static int handle_set_prefix(struct kvm_vcpu *vcpu) { @@ -60,7 +59,6 @@ static int handle_set_prefix(struct kvm_vcpu *vcpu) kvm_s390_set_prefix(vcpu, address); VCPU_EVENT(vcpu, 5, "setting prefix to %x", address); - trace_kvm_s390_handle_prefix(vcpu, 1, address); out: return 0; } @@ -93,7 +91,6 @@ static int handle_store_prefix(struct kvm_vcpu *vcpu) } VCPU_EVENT(vcpu, 5, "storing prefix to %x", address); - trace_kvm_s390_handle_prefix(vcpu, 0, address); out: return 0; } @@ -122,7 +119,6 @@ static int handle_store_cpu_address(struct kvm_vcpu *vcpu) } VCPU_EVENT(vcpu, 5, "storing cpu address to %llx", useraddr); - trace_kvm_s390_handle_stap(vcpu, useraddr); out: return 0; } @@ -168,11 +164,9 @@ static int handle_stfl(struct kvm_vcpu *vcpu) &facility_list, sizeof(facility_list)); if (rc == -EFAULT) kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING); - else { + else VCPU_EVENT(vcpu, 5, "store facility list value %x", facility_list); - trace_kvm_s390_handle_stfl(vcpu, facility_list); - } return 0; } @@ -284,7 +278,6 @@ static int handle_stsi(struct kvm_vcpu *vcpu) kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING); goto out_mem; } - trace_kvm_s390_handle_stsi(vcpu, fc, sel1, sel2, operand2); free_page(mem); vcpu->arch.sie_block->gpsw.mask &= ~(3ul << 44); vcpu->run->s.regs.gprs[0] = 0; diff --git a/trunk/arch/s390/kvm/sigp.c b/trunk/arch/s390/kvm/sigp.c index 566ddf6e8dfb..56f80e1f98f7 100644 --- a/trunk/arch/s390/kvm/sigp.c +++ b/trunk/arch/s390/kvm/sigp.c @@ -18,7 +18,6 @@ #include #include "gaccess.h" #include "kvm-s390.h" -#include "trace.h" static int __sigp_sense(struct kvm_vcpu *vcpu, u16 cpu_addr, u64 *reg) @@ -345,7 +344,6 @@ int kvm_s390_handle_sigp(struct kvm_vcpu *vcpu) else parameter = vcpu->run->s.regs.gprs[r1 + 1]; - trace_kvm_s390_handle_sigp(vcpu, order_code, cpu_addr, parameter); switch (order_code) { case SIGP_SENSE: vcpu->stat.instruction_sigp_sense++; diff --git a/trunk/arch/s390/kvm/trace-s390.h b/trunk/arch/s390/kvm/trace-s390.h deleted file mode 100644 index 90fdf85b5ff7..000000000000 --- a/trunk/arch/s390/kvm/trace-s390.h +++ /dev/null @@ -1,210 +0,0 @@ -#if !defined(_TRACE_KVMS390_H) || defined(TRACE_HEADER_MULTI_READ) -#define _TRACE_KVMS390_H - -#include - -#undef TRACE_SYSTEM -#define TRACE_SYSTEM kvm-s390 -#define TRACE_INCLUDE_PATH . -#undef TRACE_INCLUDE_FILE -#define TRACE_INCLUDE_FILE trace-s390 - -/* - * Trace point for the creation of the kvm instance. - */ -TRACE_EVENT(kvm_s390_create_vm, - TP_PROTO(unsigned long type), - TP_ARGS(type), - - TP_STRUCT__entry( - __field(unsigned long, type) - ), - - TP_fast_assign( - __entry->type = type; - ), - - TP_printk("create vm%s", - __entry->type & KVM_VM_S390_UCONTROL ? " (UCONTROL)" : "") - ); - -/* - * Trace points for creation and destruction of vpcus. - */ -TRACE_EVENT(kvm_s390_create_vcpu, - TP_PROTO(unsigned int id, struct kvm_vcpu *vcpu, - struct kvm_s390_sie_block *sie_block), - TP_ARGS(id, vcpu, sie_block), - - TP_STRUCT__entry( - __field(unsigned int, id) - __field(struct kvm_vcpu *, vcpu) - __field(struct kvm_s390_sie_block *, sie_block) - ), - - TP_fast_assign( - __entry->id = id; - __entry->vcpu = vcpu; - __entry->sie_block = sie_block; - ), - - TP_printk("create cpu %d at %p, sie block at %p", __entry->id, - __entry->vcpu, __entry->sie_block) - ); - -TRACE_EVENT(kvm_s390_destroy_vcpu, - TP_PROTO(unsigned int id), - TP_ARGS(id), - - TP_STRUCT__entry( - __field(unsigned int, id) - ), - - TP_fast_assign( - __entry->id = id; - ), - - TP_printk("destroy cpu %d", __entry->id) - ); - -/* - * Trace points for injection of interrupts, either per machine or - * per vcpu. - */ - -#define kvm_s390_int_type \ - {KVM_S390_SIGP_STOP, "sigp stop"}, \ - {KVM_S390_PROGRAM_INT, "program interrupt"}, \ - {KVM_S390_SIGP_SET_PREFIX, "sigp set prefix"}, \ - {KVM_S390_RESTART, "sigp restart"}, \ - {KVM_S390_INT_VIRTIO, "virtio interrupt"}, \ - {KVM_S390_INT_SERVICE, "sclp interrupt"}, \ - {KVM_S390_INT_EMERGENCY, "sigp emergency"}, \ - {KVM_S390_INT_EXTERNAL_CALL, "sigp ext call"} - -TRACE_EVENT(kvm_s390_inject_vm, - TP_PROTO(__u64 type, __u32 parm, __u64 parm64, int who), - TP_ARGS(type, parm, parm64, who), - - TP_STRUCT__entry( - __field(__u32, inttype) - __field(__u32, parm) - __field(__u64, parm64) - __field(int, who) - ), - - TP_fast_assign( - __entry->inttype = type & 0x00000000ffffffff; - __entry->parm = parm; - __entry->parm64 = parm64; - __entry->who = who; - ), - - TP_printk("inject%s: type:%x (%s) parm:%x parm64:%llx", - (__entry->who == 1) ? " (from kernel)" : - (__entry->who == 2) ? " (from user)" : "", - __entry->inttype, - __print_symbolic(__entry->inttype, kvm_s390_int_type), - __entry->parm, __entry->parm64) - ); - -TRACE_EVENT(kvm_s390_inject_vcpu, - TP_PROTO(unsigned int id, __u64 type, __u32 parm, __u64 parm64, \ - int who), - TP_ARGS(id, type, parm, parm64, who), - - TP_STRUCT__entry( - __field(int, id) - __field(__u32, inttype) - __field(__u32, parm) - __field(__u64, parm64) - __field(int, who) - ), - - TP_fast_assign( - __entry->id = id; - __entry->inttype = type & 0x00000000ffffffff; - __entry->parm = parm; - __entry->parm64 = parm64; - __entry->who = who; - ), - - TP_printk("inject%s (vcpu %d): type:%x (%s) parm:%x parm64:%llx", - (__entry->who == 1) ? " (from kernel)" : - (__entry->who == 2) ? " (from user)" : "", - __entry->id, __entry->inttype, - __print_symbolic(__entry->inttype, kvm_s390_int_type), - __entry->parm, __entry->parm64) - ); - -/* - * Trace point for the actual delivery of interrupts. - */ -TRACE_EVENT(kvm_s390_deliver_interrupt, - TP_PROTO(unsigned int id, __u64 type, __u32 data0, __u64 data1), - TP_ARGS(id, type, data0, data1), - - TP_STRUCT__entry( - __field(int, id) - __field(__u32, inttype) - __field(__u32, data0) - __field(__u64, data1) - ), - - TP_fast_assign( - __entry->id = id; - __entry->inttype = type & 0x00000000ffffffff; - __entry->data0 = data0; - __entry->data1 = data1; - ), - - TP_printk("deliver interrupt (vcpu %d): type:%x (%s) " \ - "data:%08x %016llx", - __entry->id, __entry->inttype, - __print_symbolic(__entry->inttype, kvm_s390_int_type), - __entry->data0, __entry->data1) - ); - -/* - * Trace point for resets that may be requested from userspace. - */ -TRACE_EVENT(kvm_s390_request_resets, - TP_PROTO(__u64 resets), - TP_ARGS(resets), - - TP_STRUCT__entry( - __field(__u64, resets) - ), - - TP_fast_assign( - __entry->resets = resets; - ), - - TP_printk("requesting userspace resets %llx", - __entry->resets) - ); - -/* - * Trace point for a vcpu's stop requests. - */ -TRACE_EVENT(kvm_s390_stop_request, - TP_PROTO(unsigned int action_bits), - TP_ARGS(action_bits), - - TP_STRUCT__entry( - __field(unsigned int, action_bits) - ), - - TP_fast_assign( - __entry->action_bits = action_bits; - ), - - TP_printk("stop request, action_bits = %08x", - __entry->action_bits) - ); - - -#endif /* _TRACE_KVMS390_H */ - -/* This part must be outside protection */ -#include diff --git a/trunk/arch/s390/kvm/trace.h b/trunk/arch/s390/kvm/trace.h deleted file mode 100644 index 2b29e62351d3..000000000000 --- a/trunk/arch/s390/kvm/trace.h +++ /dev/null @@ -1,341 +0,0 @@ -#if !defined(_TRACE_KVM_H) || defined(TRACE_HEADER_MULTI_READ) -#define _TRACE_KVM_H - -#include -#include -#include - -#undef TRACE_SYSTEM -#define TRACE_SYSTEM kvm -#define TRACE_INCLUDE_PATH . -#undef TRACE_INCLUDE_FILE -#define TRACE_INCLUDE_FILE trace - -/* - * Helpers for vcpu-specific tracepoints containing the same information - * as s390dbf VCPU_EVENTs. - */ -#define VCPU_PROTO_COMMON struct kvm_vcpu *vcpu -#define VCPU_ARGS_COMMON vcpu -#define VCPU_FIELD_COMMON __field(int, id) \ - __field(unsigned long, pswmask) \ - __field(unsigned long, pswaddr) -#define VCPU_ASSIGN_COMMON do { \ - __entry->id = vcpu->vcpu_id; \ - __entry->pswmask = vcpu->arch.sie_block->gpsw.mask; \ - __entry->pswaddr = vcpu->arch.sie_block->gpsw.addr; \ - } while (0); -#define VCPU_TP_PRINTK(p_str, p_args...) \ - TP_printk("%02d[%016lx-%016lx]: " p_str, __entry->id, \ - __entry->pswmask, __entry->pswaddr, p_args) - -/* - * Tracepoints for SIE entry and exit. - */ -TRACE_EVENT(kvm_s390_sie_enter, - TP_PROTO(VCPU_PROTO_COMMON, int cpuflags), - TP_ARGS(VCPU_ARGS_COMMON, cpuflags), - - TP_STRUCT__entry( - VCPU_FIELD_COMMON - __field(int, cpuflags) - ), - - TP_fast_assign( - VCPU_ASSIGN_COMMON - __entry->cpuflags = cpuflags; - ), - - VCPU_TP_PRINTK("entering sie flags %x", __entry->cpuflags) - ); - -TRACE_EVENT(kvm_s390_sie_fault, - TP_PROTO(VCPU_PROTO_COMMON), - TP_ARGS(VCPU_ARGS_COMMON), - - TP_STRUCT__entry( - VCPU_FIELD_COMMON - ), - - TP_fast_assign( - VCPU_ASSIGN_COMMON - ), - - VCPU_TP_PRINTK("%s", "fault in sie instruction") - ); - -#define sie_intercept_code \ - {0x04, "Instruction"}, \ - {0x08, "Program interruption"}, \ - {0x0C, "Instruction and program interuption"}, \ - {0x10, "External request"}, \ - {0x14, "External interruption"}, \ - {0x18, "I/O request"}, \ - {0x1C, "Wait state"}, \ - {0x20, "Validity"}, \ - {0x28, "Stop request"} - -TRACE_EVENT(kvm_s390_sie_exit, - TP_PROTO(VCPU_PROTO_COMMON, u8 icptcode), - TP_ARGS(VCPU_ARGS_COMMON, icptcode), - - TP_STRUCT__entry( - VCPU_FIELD_COMMON - __field(u8, icptcode) - ), - - TP_fast_assign( - VCPU_ASSIGN_COMMON - __entry->icptcode = icptcode; - ), - - VCPU_TP_PRINTK("exit sie icptcode %d (%s)", __entry->icptcode, - __print_symbolic(__entry->icptcode, - sie_intercept_code)) - ); - -/* - * Trace point for intercepted instructions. - */ -TRACE_EVENT(kvm_s390_intercept_instruction, - TP_PROTO(VCPU_PROTO_COMMON, __u16 ipa, __u32 ipb), - TP_ARGS(VCPU_ARGS_COMMON, ipa, ipb), - - TP_STRUCT__entry( - VCPU_FIELD_COMMON - __field(__u64, instruction) - __field(char, insn[8]) - ), - - TP_fast_assign( - VCPU_ASSIGN_COMMON - __entry->instruction = ((__u64)ipa << 48) | - ((__u64)ipb << 16); - ), - - VCPU_TP_PRINTK("intercepted instruction %016llx (%s)", - __entry->instruction, - insn_to_mnemonic((unsigned char *) - &__entry->instruction, - __entry->insn) ? - "unknown" : __entry->insn) - ); - -/* - * Trace point for intercepted program interruptions. - */ -TRACE_EVENT(kvm_s390_intercept_prog, - TP_PROTO(VCPU_PROTO_COMMON, __u16 code), - TP_ARGS(VCPU_ARGS_COMMON, code), - - TP_STRUCT__entry( - VCPU_FIELD_COMMON - __field(__u16, code) - ), - - TP_fast_assign( - VCPU_ASSIGN_COMMON - __entry->code = code; - ), - - VCPU_TP_PRINTK("intercepted program interruption %04x", - __entry->code) - ); - -/* - * Trace point for validity intercepts. - */ -TRACE_EVENT(kvm_s390_intercept_validity, - TP_PROTO(VCPU_PROTO_COMMON, __u16 viwhy), - TP_ARGS(VCPU_ARGS_COMMON, viwhy), - - TP_STRUCT__entry( - VCPU_FIELD_COMMON - __field(__u16, viwhy) - ), - - TP_fast_assign( - VCPU_ASSIGN_COMMON - __entry->viwhy = viwhy; - ), - - VCPU_TP_PRINTK("got validity intercept %04x", __entry->viwhy) - ); - -/* - * Trace points for instructions that are of special interest. - */ - -#define sigp_order_codes \ - {SIGP_SENSE, "sense"}, \ - {SIGP_EXTERNAL_CALL, "external call"}, \ - {SIGP_EMERGENCY_SIGNAL, "emergency signal"}, \ - {SIGP_STOP, "stop"}, \ - {SIGP_STOP_AND_STORE_STATUS, "stop and store status"}, \ - {SIGP_SET_ARCHITECTURE, "set architecture"}, \ - {SIGP_SET_PREFIX, "set prefix"}, \ - {SIGP_SENSE_RUNNING, "sense running"}, \ - {SIGP_RESTART, "restart"} - -TRACE_EVENT(kvm_s390_handle_sigp, - TP_PROTO(VCPU_PROTO_COMMON, __u8 order_code, __u16 cpu_addr, \ - __u32 parameter), - TP_ARGS(VCPU_ARGS_COMMON, order_code, cpu_addr, parameter), - - TP_STRUCT__entry( - VCPU_FIELD_COMMON - __field(__u8, order_code) - __field(__u16, cpu_addr) - __field(__u32, parameter) - ), - - TP_fast_assign( - VCPU_ASSIGN_COMMON - __entry->order_code = order_code; - __entry->cpu_addr = cpu_addr; - __entry->parameter = parameter; - ), - - VCPU_TP_PRINTK("handle sigp order %02x (%s), cpu address %04x, " \ - "parameter %08x", __entry->order_code, - __print_symbolic(__entry->order_code, - sigp_order_codes), - __entry->cpu_addr, __entry->parameter) - ); - -#define diagnose_codes \ - {0x10, "release pages"}, \ - {0x44, "time slice end"}, \ - {0x308, "ipl functions"}, \ - {0x500, "kvm hypercall"}, \ - {0x501, "kvm breakpoint"} - -TRACE_EVENT(kvm_s390_handle_diag, - TP_PROTO(VCPU_PROTO_COMMON, __u16 code), - TP_ARGS(VCPU_ARGS_COMMON, code), - - TP_STRUCT__entry( - VCPU_FIELD_COMMON - __field(__u16, code) - ), - - TP_fast_assign( - VCPU_ASSIGN_COMMON - __entry->code = code; - ), - - VCPU_TP_PRINTK("handle diagnose call %04x (%s)", __entry->code, - __print_symbolic(__entry->code, diagnose_codes)) - ); - -TRACE_EVENT(kvm_s390_handle_lctl, - TP_PROTO(VCPU_PROTO_COMMON, int g, int reg1, int reg3, u64 addr), - TP_ARGS(VCPU_ARGS_COMMON, g, reg1, reg3, addr), - - TP_STRUCT__entry( - VCPU_FIELD_COMMON - __field(int, g) - __field(int, reg1) - __field(int, reg3) - __field(u64, addr) - ), - - TP_fast_assign( - VCPU_ASSIGN_COMMON - __entry->g = g; - __entry->reg1 = reg1; - __entry->reg3 = reg3; - __entry->addr = addr; - ), - - VCPU_TP_PRINTK("%s: loading cr %x-%x from %016llx", - __entry->g ? "lctlg" : "lctl", - __entry->reg1, __entry->reg3, __entry->addr) - ); - -TRACE_EVENT(kvm_s390_handle_prefix, - TP_PROTO(VCPU_PROTO_COMMON, int set, u32 address), - TP_ARGS(VCPU_ARGS_COMMON, set, address), - - TP_STRUCT__entry( - VCPU_FIELD_COMMON - __field(int, set) - __field(u32, address) - ), - - TP_fast_assign( - VCPU_ASSIGN_COMMON - __entry->set = set; - __entry->address = address; - ), - - VCPU_TP_PRINTK("%s prefix to %08x", - __entry->set ? "setting" : "storing", - __entry->address) - ); - -TRACE_EVENT(kvm_s390_handle_stap, - TP_PROTO(VCPU_PROTO_COMMON, u64 address), - TP_ARGS(VCPU_ARGS_COMMON, address), - - TP_STRUCT__entry( - VCPU_FIELD_COMMON - __field(u64, address) - ), - - TP_fast_assign( - VCPU_ASSIGN_COMMON - __entry->address = address; - ), - - VCPU_TP_PRINTK("storing cpu address to %016llx", - __entry->address) - ); - -TRACE_EVENT(kvm_s390_handle_stfl, - TP_PROTO(VCPU_PROTO_COMMON, unsigned int facility_list), - TP_ARGS(VCPU_ARGS_COMMON, facility_list), - - TP_STRUCT__entry( - VCPU_FIELD_COMMON - __field(unsigned int, facility_list) - ), - - TP_fast_assign( - VCPU_ASSIGN_COMMON - __entry->facility_list = facility_list; - ), - - VCPU_TP_PRINTK("store facility list value %08x", - __entry->facility_list) - ); - -TRACE_EVENT(kvm_s390_handle_stsi, - TP_PROTO(VCPU_PROTO_COMMON, int fc, int sel1, int sel2, u64 addr), - TP_ARGS(VCPU_ARGS_COMMON, fc, sel1, sel2, addr), - - TP_STRUCT__entry( - VCPU_FIELD_COMMON - __field(int, fc) - __field(int, sel1) - __field(int, sel2) - __field(u64, addr) - ), - - TP_fast_assign( - VCPU_ASSIGN_COMMON - __entry->fc = fc; - __entry->sel1 = sel1; - __entry->sel2 = sel2; - __entry->addr = addr; - ), - - VCPU_TP_PRINTK("STSI %d.%d.%d information stored to %016llx", - __entry->fc, __entry->sel1, __entry->sel2, - __entry->addr) - ); - -#endif /* _TRACE_KVM_H */ - -/* This part must be outside protection */ -#include diff --git a/trunk/arch/score/Kconfig b/trunk/arch/score/Kconfig index 461c23747491..ba0f412920be 100644 --- a/trunk/arch/score/Kconfig +++ b/trunk/arch/score/Kconfig @@ -5,7 +5,6 @@ config SCORE select HAVE_GENERIC_HARDIRQS select GENERIC_IRQ_SHOW select GENERIC_IOMAP - select GENERIC_ATOMIC64 select HAVE_MEMBLOCK select HAVE_MEMBLOCK_NODE_MAP select ARCH_DISCARD_MEMBLOCK diff --git a/trunk/arch/score/include/asm/elf.h b/trunk/arch/score/include/asm/elf.h index 5d566c7a0af2..f478ce94181f 100644 --- a/trunk/arch/score/include/asm/elf.h +++ b/trunk/arch/score/include/asm/elf.h @@ -54,7 +54,7 @@ typedef elf_fpreg_t elf_fpregset_t; #define SET_PERSONALITY(ex) \ do { \ - set_personality(PER_LINUX | (current->personality & (~PER_MASK))); \ + set_personality(PER_LINUX); \ } while (0) struct task_struct; diff --git a/trunk/arch/score/include/uapi/asm/Kbuild b/trunk/arch/score/include/uapi/asm/Kbuild deleted file mode 100644 index baebb3da1d44..000000000000 --- a/trunk/arch/score/include/uapi/asm/Kbuild +++ /dev/null @@ -1,3 +0,0 @@ -# UAPI Header export list -include include/uapi/asm-generic/Kbuild.asm - diff --git a/trunk/arch/score/kernel/sys_score.c b/trunk/arch/score/kernel/sys_score.c index 21e867974066..e478bf9a7e91 100644 --- a/trunk/arch/score/kernel/sys_score.c +++ b/trunk/arch/score/kernel/sys_score.c @@ -112,7 +112,6 @@ score_execve(struct pt_regs *regs) * Do a system call from kernel instead of calling sys_execve so we * end up with proper pt_regs. */ -asmlinkage int kernel_execve(const char *filename, const char *const argv[], const char *const envp[]) diff --git a/trunk/arch/sh/include/asm/bl_bit.h b/trunk/arch/sh/include/asm/bl_bit.h index 06e4163c6746..45e6b9fc37a0 100644 --- a/trunk/arch/sh/include/asm/bl_bit.h +++ b/trunk/arch/sh/include/asm/bl_bit.h @@ -2,9 +2,9 @@ #define __ASM_SH_BL_BIT_H #ifdef CONFIG_SUPERH32 -# include +# include "bl_bit_32.h" #else -# include +# include "bl_bit_64.h" #endif #endif /* __ASM_SH_BL_BIT_H */ diff --git a/trunk/arch/sh/include/asm/cache_insns.h b/trunk/arch/sh/include/asm/cache_insns.h index 355cb06b7a30..d25fbe53090d 100644 --- a/trunk/arch/sh/include/asm/cache_insns.h +++ b/trunk/arch/sh/include/asm/cache_insns.h @@ -3,9 +3,9 @@ #ifdef CONFIG_SUPERH32 -# include +# include "cache_insns_32.h" #else -# include +# include "cache_insns_64.h" #endif #endif /* __ASM_SH_CACHE_INSNS_H */ diff --git a/trunk/arch/sh/include/asm/checksum.h b/trunk/arch/sh/include/asm/checksum.h index 34ae26204524..fc26d1f4b590 100644 --- a/trunk/arch/sh/include/asm/checksum.h +++ b/trunk/arch/sh/include/asm/checksum.h @@ -1,5 +1,5 @@ #ifdef CONFIG_SUPERH32 -# include +# include "checksum_32.h" #else # include #endif diff --git a/trunk/arch/sh/include/asm/elf.h b/trunk/arch/sh/include/asm/elf.h index 37924afa8d8a..f38112be67d2 100644 --- a/trunk/arch/sh/include/asm/elf.h +++ b/trunk/arch/sh/include/asm/elf.h @@ -183,8 +183,7 @@ do { \ } while (0) #endif -#define SET_PERSONALITY(ex) \ - set_personality(PER_LINUX_32BIT | (current->personality & (~PER_MASK))) +#define SET_PERSONALITY(ex) set_personality(PER_LINUX_32BIT) #ifdef CONFIG_VSYSCALL /* vDSO has arch_setup_additional_pages */ diff --git a/trunk/arch/sh/include/asm/io.h b/trunk/arch/sh/include/asm/io.h index 73a23f4617a3..0cf60a628814 100644 --- a/trunk/arch/sh/include/asm/io.h +++ b/trunk/arch/sh/include/asm/io.h @@ -134,7 +134,7 @@ __BUILD_MEMORY_STRING(__raw_, q, u64) * load/store instructions. sh_io_port_base is the virtual address to * which all ports are being mapped. */ -extern unsigned long sh_io_port_base; +extern const unsigned long sh_io_port_base; static inline void __set_io_port_base(unsigned long pbase) { diff --git a/trunk/arch/sh/include/asm/mmu_context.h b/trunk/arch/sh/include/asm/mmu_context.h index 21c5088788da..384c7471a374 100644 --- a/trunk/arch/sh/include/asm/mmu_context.h +++ b/trunk/arch/sh/include/asm/mmu_context.h @@ -46,9 +46,9 @@ #define MMU_VPN_MASK 0xfffff000 #if defined(CONFIG_SUPERH32) -#include +#include "mmu_context_32.h" #else -#include +#include "mmu_context_64.h" #endif /* diff --git a/trunk/arch/sh/include/asm/posix_types.h b/trunk/arch/sh/include/asm/posix_types.h index f08449bcbde7..4eeb723aee7e 100644 --- a/trunk/arch/sh/include/asm/posix_types.h +++ b/trunk/arch/sh/include/asm/posix_types.h @@ -1,13 +1,13 @@ #ifdef __KERNEL__ # ifdef CONFIG_SUPERH32 -# include +# include "posix_types_32.h" # else -# include +# include "posix_types_64.h" # endif #else # ifdef __SH5__ -# include +# include "posix_types_64.h" # else -# include +# include "posix_types_32.h" # endif #endif /* __KERNEL__ */ diff --git a/trunk/arch/sh/include/asm/processor.h b/trunk/arch/sh/include/asm/processor.h index 5448f9bbf4ab..3d14aeaef57c 100644 --- a/trunk/arch/sh/include/asm/processor.h +++ b/trunk/arch/sh/include/asm/processor.h @@ -175,9 +175,9 @@ extern unsigned int instruction_size(unsigned int insn); #endif /* __ASSEMBLY__ */ #ifdef CONFIG_SUPERH32 -# include +# include "processor_32.h" #else -# include +# include "processor_64.h" #endif #endif /* __ASM_SH_PROCESSOR_H */ diff --git a/trunk/arch/sh/include/asm/ptrace.h b/trunk/arch/sh/include/asm/ptrace.h index a4a38dff997a..c7b7e1ed194a 100644 --- a/trunk/arch/sh/include/asm/ptrace.h +++ b/trunk/arch/sh/include/asm/ptrace.h @@ -25,9 +25,9 @@ #define PT_TEXT_LEN 252 #if defined(__SH5__) || defined(CONFIG_CPU_SH5) -#include +#include "ptrace_64.h" #else -#include +#include "ptrace_32.h" #endif #ifdef __KERNEL__ diff --git a/trunk/arch/sh/include/asm/string.h b/trunk/arch/sh/include/asm/string.h index 114011fa08af..8c1ea21dc0ae 100644 --- a/trunk/arch/sh/include/asm/string.h +++ b/trunk/arch/sh/include/asm/string.h @@ -1,5 +1,5 @@ #ifdef CONFIG_SUPERH32 -# include +# include "string_32.h" #else -# include +# include "string_64.h" #endif diff --git a/trunk/arch/sh/include/asm/switch_to.h b/trunk/arch/sh/include/asm/switch_to.h index bcd722fc8347..62b1941813e3 100644 --- a/trunk/arch/sh/include/asm/switch_to.h +++ b/trunk/arch/sh/include/asm/switch_to.h @@ -11,9 +11,9 @@ #define __ASM_SH_SWITCH_TO_H #ifdef CONFIG_SUPERH32 -# include +# include "switch_to_32.h" #else -# include +# include "switch_to_64.h" #endif #endif /* __ASM_SH_SWITCH_TO_H */ diff --git a/trunk/arch/sh/include/asm/syscall.h b/trunk/arch/sh/include/asm/syscall.h index 847128da6eac..aa7777bdc370 100644 --- a/trunk/arch/sh/include/asm/syscall.h +++ b/trunk/arch/sh/include/asm/syscall.h @@ -4,9 +4,9 @@ extern const unsigned long sys_call_table[]; #ifdef CONFIG_SUPERH32 -# include +# include "syscall_32.h" #else -# include +# include "syscall_64.h" #endif #endif /* __ASM_SH_SYSCALL_H */ diff --git a/trunk/arch/sh/include/asm/syscalls.h b/trunk/arch/sh/include/asm/syscalls.h index 3dbfef06f6b2..507725af2e54 100644 --- a/trunk/arch/sh/include/asm/syscalls.h +++ b/trunk/arch/sh/include/asm/syscalls.h @@ -11,9 +11,9 @@ asmlinkage long sys_mmap2(unsigned long addr, unsigned long len, unsigned long fd, unsigned long pgoff); #ifdef CONFIG_SUPERH32 -# include +# include "syscalls_32.h" #else -# include +# include "syscalls_64.h" #endif #endif /* __KERNEL__ */ diff --git a/trunk/arch/sh/include/asm/tlb.h b/trunk/arch/sh/include/asm/tlb.h index e61d43d9f689..ec88bfcdf7ce 100644 --- a/trunk/arch/sh/include/asm/tlb.h +++ b/trunk/arch/sh/include/asm/tlb.h @@ -2,7 +2,7 @@ #define __ASM_SH_TLB_H #ifdef CONFIG_SUPERH64 -# include +# include "tlb_64.h" #endif #ifndef __ASSEMBLY__ diff --git a/trunk/arch/sh/include/asm/traps.h b/trunk/arch/sh/include/asm/traps.h index 9cc149a0dbd1..afd9df8d0641 100644 --- a/trunk/arch/sh/include/asm/traps.h +++ b/trunk/arch/sh/include/asm/traps.h @@ -4,9 +4,9 @@ #include #ifdef CONFIG_SUPERH32 -# include +# include "traps_32.h" #else -# include +# include "traps_64.h" #endif BUILD_TRAP_HANDLER(address_error); diff --git a/trunk/arch/sh/include/asm/uaccess.h b/trunk/arch/sh/include/asm/uaccess.h index 9486376605f4..8698a80ed00c 100644 --- a/trunk/arch/sh/include/asm/uaccess.h +++ b/trunk/arch/sh/include/asm/uaccess.h @@ -97,9 +97,9 @@ struct __large_struct { unsigned long buf[100]; }; }) #ifdef CONFIG_SUPERH32 -# include +# include "uaccess_32.h" #else -# include +# include "uaccess_64.h" #endif extern long strncpy_from_user(char *dest, const char __user *src, long count); diff --git a/trunk/arch/sh/include/asm/unistd.h b/trunk/arch/sh/include/asm/unistd.h index 307201a854f3..7bc67076baac 100644 --- a/trunk/arch/sh/include/asm/unistd.h +++ b/trunk/arch/sh/include/asm/unistd.h @@ -1,8 +1,8 @@ #ifdef __KERNEL__ # ifdef CONFIG_SUPERH32 -# include +# include "unistd_32.h" # else -# include +# include "unistd_64.h" # endif # define __ARCH_WANT_SYS_RT_SIGSUSPEND @@ -40,8 +40,8 @@ #else # ifdef __SH5__ -# include +# include "unistd_64.h" # else -# include +# include "unistd_32.h" # endif #endif diff --git a/trunk/arch/sh/include/mach-ecovec24/mach/romimage.h b/trunk/arch/sh/include/mach-ecovec24/mach/romimage.h index 60f3e8af05fa..d63ef51ec186 100644 --- a/trunk/arch/sh/include/mach-ecovec24/mach/romimage.h +++ b/trunk/arch/sh/include/mach-ecovec24/mach/romimage.h @@ -6,7 +6,7 @@ */ #include -#include +#include "partner-jet-setup.txt" /* execute icbi after enabling cache */ mov.l 1f, r0 diff --git a/trunk/arch/sh/include/mach-kfr2r09/mach/romimage.h b/trunk/arch/sh/include/mach-kfr2r09/mach/romimage.h index 1afae21ced5f..7a883167c846 100644 --- a/trunk/arch/sh/include/mach-kfr2r09/mach/romimage.h +++ b/trunk/arch/sh/include/mach-kfr2r09/mach/romimage.h @@ -6,7 +6,7 @@ */ #include -#include +#include "partner-jet-setup.txt" /* execute icbi after enabling cache */ mov.l 1f, r0 diff --git a/trunk/arch/sh/include/uapi/asm/Kbuild b/trunk/arch/sh/include/uapi/asm/Kbuild deleted file mode 100644 index baebb3da1d44..000000000000 --- a/trunk/arch/sh/include/uapi/asm/Kbuild +++ /dev/null @@ -1,3 +0,0 @@ -# UAPI Header export list -include include/uapi/asm-generic/Kbuild.asm - diff --git a/trunk/arch/sh/kernel/ioport.c b/trunk/arch/sh/kernel/ioport.c index cca14ba84a37..e3ad6103e7c1 100644 --- a/trunk/arch/sh/kernel/ioport.c +++ b/trunk/arch/sh/kernel/ioport.c @@ -11,7 +11,7 @@ #include #include -unsigned long sh_io_port_base __read_mostly = -1; +const unsigned long sh_io_port_base __read_mostly = -1; EXPORT_SYMBOL(sh_io_port_base); void __iomem *__ioport_map(unsigned long addr, unsigned int size) diff --git a/trunk/arch/sparc/include/asm/compat.h b/trunk/arch/sparc/include/asm/compat.h index cef99fbc0a21..b8be20d42a0a 100644 --- a/trunk/arch/sparc/include/asm/compat.h +++ b/trunk/arch/sparc/include/asm/compat.h @@ -36,7 +36,6 @@ typedef s64 compat_s64; typedef u32 compat_uint_t; typedef u32 compat_ulong_t; typedef u64 compat_u64; -typedef u32 compat_uptr_t; struct compat_timespec { compat_time_t tv_sec; @@ -148,65 +147,6 @@ typedef u32 compat_old_sigset_t; typedef u32 compat_sigset_word; -typedef union compat_sigval { - compat_int_t sival_int; - compat_uptr_t sival_ptr; -} compat_sigval_t; - -#define SI_PAD_SIZE32 (128/sizeof(int) - 3) - -typedef struct compat_siginfo { - int si_signo; - int si_errno; - int si_code; - - union { - int _pad[SI_PAD_SIZE32]; - - /* kill() */ - struct { - compat_pid_t _pid; /* sender's pid */ - unsigned int _uid; /* sender's uid */ - } _kill; - - /* POSIX.1b timers */ - struct { - compat_timer_t _tid; /* timer id */ - int _overrun; /* overrun count */ - compat_sigval_t _sigval; /* same as below */ - int _sys_private; /* not to be passed to user */ - } _timer; - - /* POSIX.1b signals */ - struct { - compat_pid_t _pid; /* sender's pid */ - unsigned int _uid; /* sender's uid */ - compat_sigval_t _sigval; - } _rt; - - /* SIGCHLD */ - struct { - compat_pid_t _pid; /* which child */ - unsigned int _uid; /* sender's uid */ - int _status; /* exit code */ - compat_clock_t _utime; - compat_clock_t _stime; - } _sigchld; - - /* SIGILL, SIGFPE, SIGSEGV, SIGBUS, SIGEMT */ - struct { - u32 _addr; /* faulting insn/memory ref. */ - int _trapno; - } _sigfault; - - /* SIGPOLL */ - struct { - int _band; /* POLL_IN, POLL_OUT, POLL_MSG */ - int _fd; - } _sigpoll; - } _sifields; -} compat_siginfo_t; - #define COMPAT_OFF_T_MAX 0x7fffffff #define COMPAT_LOFF_T_MAX 0x7fffffffffffffffL @@ -216,6 +156,7 @@ typedef struct compat_siginfo { * as pointers because the syscall entry code will have * appropriately converted them already. */ +typedef u32 compat_uptr_t; static inline void __user *compat_ptr(compat_uptr_t uptr) { diff --git a/trunk/arch/sparc/include/asm/elf_32.h b/trunk/arch/sparc/include/asm/elf_32.h index ac74a2c98e6d..2d4d755cba9e 100644 --- a/trunk/arch/sparc/include/asm/elf_32.h +++ b/trunk/arch/sparc/include/asm/elf_32.h @@ -128,7 +128,6 @@ typedef struct { #define ELF_PLATFORM (NULL) -#define SET_PERSONALITY(ex) \ - set_personality(PER_LINUX | (current->personality & (~PER_MASK))) +#define SET_PERSONALITY(ex) set_personality(PER_LINUX) #endif /* !(__ASMSPARC_ELF_H) */ diff --git a/trunk/arch/sparc/include/asm/oplib_32.h b/trunk/arch/sparc/include/asm/oplib_32.h index c72f3045820c..27517879a6c2 100644 --- a/trunk/arch/sparc/include/asm/oplib_32.h +++ b/trunk/arch/sparc/include/asm/oplib_32.h @@ -94,7 +94,7 @@ extern int prom_getprev(void); extern void prom_console_write_buf(const char *buf, int len); /* Prom's internal routines, don't use in kernel/boot code. */ -extern __printf(1, 2) void prom_printf(const char *fmt, ...); +extern void prom_printf(const char *fmt, ...); extern void prom_write(const char *buf, unsigned int len); /* Multiprocessor operations... */ diff --git a/trunk/arch/sparc/include/asm/oplib_64.h b/trunk/arch/sparc/include/asm/oplib_64.h index a12dbe3b7762..97a90475c314 100644 --- a/trunk/arch/sparc/include/asm/oplib_64.h +++ b/trunk/arch/sparc/include/asm/oplib_64.h @@ -98,7 +98,7 @@ extern unsigned char prom_get_idprom(char *idp_buffer, int idpbuf_size); extern void prom_console_write_buf(const char *buf, int len); /* Prom's internal routines, don't use in kernel/boot code. */ -extern __printf(1, 2) void prom_printf(const char *fmt, ...); +extern void prom_printf(const char *fmt, ...); extern void prom_write(const char *buf, unsigned int len); /* Multiprocessor operations... */ diff --git a/trunk/arch/sparc/include/asm/siginfo.h b/trunk/arch/sparc/include/asm/siginfo.h index dbc182c438b4..215900fce21b 100644 --- a/trunk/arch/sparc/include/asm/siginfo.h +++ b/trunk/arch/sparc/include/asm/siginfo.h @@ -3,6 +3,7 @@ #if defined(__sparc__) && defined(__arch64__) +#define SI_PAD_SIZE32 ((SI_MAX_SIZE/sizeof(int)) - 3) #define __ARCH_SI_PREAMBLE_SIZE (4 * sizeof(int)) #define __ARCH_SI_BAND_T int diff --git a/trunk/arch/sparc/include/asm/unistd.h b/trunk/arch/sparc/include/asm/unistd.h index d9a677c51926..fb2693464807 100644 --- a/trunk/arch/sparc/include/asm/unistd.h +++ b/trunk/arch/sparc/include/asm/unistd.h @@ -447,7 +447,6 @@ #else #define __ARCH_WANT_COMPAT_SYS_TIME #define __ARCH_WANT_COMPAT_SYS_RT_SIGSUSPEND -#define __ARCH_WANT_COMPAT_SYS_SENDFILE #endif /* diff --git a/trunk/arch/sparc/include/uapi/asm/Kbuild b/trunk/arch/sparc/include/uapi/asm/Kbuild deleted file mode 100644 index 7518ad286963..000000000000 --- a/trunk/arch/sparc/include/uapi/asm/Kbuild +++ /dev/null @@ -1,5 +0,0 @@ -# UAPI Header export list -# User exported sparc header files - -include include/uapi/asm-generic/Kbuild.asm - diff --git a/trunk/arch/sparc/kernel/hvapi.c b/trunk/arch/sparc/kernel/hvapi.c index c0a2de0fd624..1032df43ec95 100644 --- a/trunk/arch/sparc/kernel/hvapi.c +++ b/trunk/arch/sparc/kernel/hvapi.c @@ -194,7 +194,7 @@ void __init sun4v_hvapi_init(void) bad: prom_printf("HVAPI: Cannot register API group " - "%lx with major(%lu) minor(%lu)\n", + "%lx with major(%u) minor(%u)\n", group, major, minor); prom_halt(); } diff --git a/trunk/arch/sparc/kernel/prom_64.c b/trunk/arch/sparc/kernel/prom_64.c index d397d7fc5c28..340c5b976d28 100644 --- a/trunk/arch/sparc/kernel/prom_64.c +++ b/trunk/arch/sparc/kernel/prom_64.c @@ -37,7 +37,7 @@ void * __init prom_early_alloc(unsigned long size) void *ret; if (!paddr) { - prom_printf("prom_early_alloc(%lu) failed\n", size); + prom_printf("prom_early_alloc(%lu) failed\n"); prom_halt(); } diff --git a/trunk/arch/sparc/kernel/signal32.c b/trunk/arch/sparc/kernel/signal32.c index 53e48f721ce3..a53e0a5fd3a3 100644 --- a/trunk/arch/sparc/kernel/signal32.c +++ b/trunk/arch/sparc/kernel/signal32.c @@ -54,6 +54,58 @@ struct signal_frame32 { /* __siginfo_rwin_t * */u32 rwin_save; } __attribute__((aligned(8))); +typedef struct compat_siginfo{ + int si_signo; + int si_errno; + int si_code; + + union { + int _pad[SI_PAD_SIZE32]; + + /* kill() */ + struct { + compat_pid_t _pid; /* sender's pid */ + unsigned int _uid; /* sender's uid */ + } _kill; + + /* POSIX.1b timers */ + struct { + compat_timer_t _tid; /* timer id */ + int _overrun; /* overrun count */ + compat_sigval_t _sigval; /* same as below */ + int _sys_private; /* not to be passed to user */ + } _timer; + + /* POSIX.1b signals */ + struct { + compat_pid_t _pid; /* sender's pid */ + unsigned int _uid; /* sender's uid */ + compat_sigval_t _sigval; + } _rt; + + /* SIGCHLD */ + struct { + compat_pid_t _pid; /* which child */ + unsigned int _uid; /* sender's uid */ + int _status; /* exit code */ + compat_clock_t _utime; + compat_clock_t _stime; + } _sigchld; + + /* SIGILL, SIGFPE, SIGSEGV, SIGBUS, SIGEMT */ + struct { + u32 _addr; /* faulting insn/memory ref. */ + int _trapno; + } _sigfault; + + /* SIGPOLL */ + struct { + int _band; /* POLL_IN, POLL_OUT, POLL_MSG */ + int _fd; + } _sigpoll; + } _sifields; +}compat_siginfo_t; + struct rt_signal_frame32 { struct sparc_stackf32 ss; compat_siginfo_t info; diff --git a/trunk/arch/sparc/kernel/sys32.S b/trunk/arch/sparc/kernel/sys32.S index 44025f4ba41f..d97f3eb72e06 100644 --- a/trunk/arch/sparc/kernel/sys32.S +++ b/trunk/arch/sparc/kernel/sys32.S @@ -90,7 +90,7 @@ SIGN1(sys32_mkdir, sys_mkdir, %o1) SIGN3(sys32_futex, compat_sys_futex, %o1, %o2, %o5) SIGN1(sys32_sysfs, compat_sys_sysfs, %o0) SIGN2(sys32_sendfile, compat_sys_sendfile, %o0, %o1) -SIGN2(sys32_sendfile64, sys_sendfile, %o0, %o1) +SIGN2(sys32_sendfile64, compat_sys_sendfile64, %o0, %o1) SIGN1(sys32_prctl, sys_prctl, %o0) SIGN1(sys32_sched_rr_get_interval, compat_sys_sched_rr_get_interval, %o0) SIGN2(sys32_waitpid, sys_waitpid, %o0, %o2) diff --git a/trunk/arch/sparc/kernel/sys_sparc32.c b/trunk/arch/sparc/kernel/sys_sparc32.c index d862499eb01c..f7392336961f 100644 --- a/trunk/arch/sparc/kernel/sys_sparc32.c +++ b/trunk/arch/sparc/kernel/sys_sparc32.c @@ -506,6 +506,52 @@ long compat_sys_fadvise64_64(int fd, advice); } +asmlinkage long compat_sys_sendfile(int out_fd, int in_fd, + compat_off_t __user *offset, + compat_size_t count) +{ + mm_segment_t old_fs = get_fs(); + int ret; + off_t of; + + if (offset && get_user(of, offset)) + return -EFAULT; + + set_fs(KERNEL_DS); + ret = sys_sendfile(out_fd, in_fd, + offset ? (off_t __user *) &of : NULL, + count); + set_fs(old_fs); + + if (offset && put_user(of, offset)) + return -EFAULT; + + return ret; +} + +asmlinkage long compat_sys_sendfile64(int out_fd, int in_fd, + compat_loff_t __user *offset, + compat_size_t count) +{ + mm_segment_t old_fs = get_fs(); + int ret; + loff_t lof; + + if (offset && get_user(lof, offset)) + return -EFAULT; + + set_fs(KERNEL_DS); + ret = sys_sendfile64(out_fd, in_fd, + offset ? (loff_t __user *) &lof : NULL, + count); + set_fs(old_fs); + + if (offset && put_user(lof, offset)) + return -EFAULT; + + return ret; +} + /* This is just a version for 32-bit applications which does * not force O_LARGEFILE on. */ diff --git a/trunk/arch/sparc/kernel/traps_64.c b/trunk/arch/sparc/kernel/traps_64.c index fa1f1d375ffc..3b05e6697710 100644 --- a/trunk/arch/sparc/kernel/traps_64.c +++ b/trunk/arch/sparc/kernel/traps_64.c @@ -850,7 +850,7 @@ void __init cheetah_ecache_flush_init(void) ecache_flush_physbase = find_ecache_flush_span(ecache_flush_size); if (ecache_flush_physbase == ~0UL) { - prom_printf("cheetah_ecache_flush_init: Cannot find %ld byte " + prom_printf("cheetah_ecache_flush_init: Cannot find %d byte " "contiguous physical memory.\n", ecache_flush_size); prom_halt(); diff --git a/trunk/arch/sparc/lib/NG2memcpy.S b/trunk/arch/sparc/lib/NG2memcpy.S index 2c20ad63ddbf..03eadf66b0d3 100644 --- a/trunk/arch/sparc/lib/NG2memcpy.S +++ b/trunk/arch/sparc/lib/NG2memcpy.S @@ -14,7 +14,7 @@ #define FPRS_FEF 0x04 #ifdef MEMCPY_DEBUG #define VISEntryHalf rd %fprs, %o5; wr %g0, FPRS_FEF, %fprs; \ - clr %g1; clr %g2; clr %g3; clr %g5; subcc %g0, %g0, %g0; + clr %g1; clr %g2; clr %g3; subcc %g0, %g0, %g0; #define VISExitHalf and %o5, FPRS_FEF, %o5; wr %o5, 0x0, %fprs #else #define VISEntryHalf rd %fprs, %o5; wr %g0, FPRS_FEF, %fprs @@ -182,13 +182,13 @@ FUNC_NAME: /* %o0=dst, %o1=src, %o2=len */ cmp %g2, 0 tne %xcc, 5 PREAMBLE - mov %o0, %o3 + mov %o0, GLOBAL_SPARE cmp %o2, 0 be,pn %XCC, 85f - or %o0, %o1, GLOBAL_SPARE + or %o0, %o1, %o3 cmp %o2, 16 blu,a,pn %XCC, 80f - or GLOBAL_SPARE, %o2, GLOBAL_SPARE + or %o3, %o2, %o3 /* 2 blocks (128 bytes) is the minimum we can do the block * copy with. We need to ensure that we'll iterate at least @@ -202,7 +202,7 @@ FUNC_NAME: /* %o0=dst, %o1=src, %o2=len */ */ cmp %o2, (4 * 64) blu,pt %XCC, 75f - andcc GLOBAL_SPARE, 0x7, %g0 + andcc %o3, 0x7, %g0 /* %o0: dst * %o1: src @@ -404,13 +404,13 @@ FUNC_NAME: /* %o0=dst, %o1=src, %o2=len */ * over. If anything is left, we copy it one byte at a time. */ brz,pt %o2, 85f - sub %o0, %o1, GLOBAL_SPARE + sub %o0, %o1, %o3 ba,a,pt %XCC, 90f .align 64 75: /* 16 < len <= 64 */ bne,pn %XCC, 75f - sub %o0, %o1, GLOBAL_SPARE + sub %o0, %o1, %o3 72: andn %o2, 0xf, %o4 @@ -420,9 +420,9 @@ FUNC_NAME: /* %o0=dst, %o1=src, %o2=len */ add %o1, 0x08, %o1 EX_LD(LOAD(ldx, %o1, %g1)) sub %o1, 0x08, %o1 - EX_ST(STORE(stx, %o5, %o1 + GLOBAL_SPARE)) + EX_ST(STORE(stx, %o5, %o1 + %o3)) add %o1, 0x8, %o1 - EX_ST(STORE(stx, %g1, %o1 + GLOBAL_SPARE)) + EX_ST(STORE(stx, %g1, %o1 + %o3)) bgu,pt %XCC, 1b add %o1, 0x8, %o1 73: andcc %o2, 0x8, %g0 @@ -430,14 +430,14 @@ FUNC_NAME: /* %o0=dst, %o1=src, %o2=len */ nop sub %o2, 0x8, %o2 EX_LD(LOAD(ldx, %o1, %o5)) - EX_ST(STORE(stx, %o5, %o1 + GLOBAL_SPARE)) + EX_ST(STORE(stx, %o5, %o1 + %o3)) add %o1, 0x8, %o1 1: andcc %o2, 0x4, %g0 be,pt %XCC, 1f nop sub %o2, 0x4, %o2 EX_LD(LOAD(lduw, %o1, %o5)) - EX_ST(STORE(stw, %o5, %o1 + GLOBAL_SPARE)) + EX_ST(STORE(stw, %o5, %o1 + %o3)) add %o1, 0x4, %o1 1: cmp %o2, 0 be,pt %XCC, 85f @@ -454,11 +454,11 @@ FUNC_NAME: /* %o0=dst, %o1=src, %o2=len */ 1: subcc %g1, 1, %g1 EX_LD(LOAD(ldub, %o1, %o5)) - EX_ST(STORE(stb, %o5, %o1 + GLOBAL_SPARE)) + EX_ST(STORE(stb, %o5, %o1 + %o3)) bgu,pt %icc, 1b add %o1, 1, %o1 -2: add %o1, GLOBAL_SPARE, %o0 +2: add %o1, %o3, %o0 andcc %o1, 0x7, %g1 bne,pt %icc, 8f sll %g1, 3, %g1 @@ -468,16 +468,16 @@ FUNC_NAME: /* %o0=dst, %o1=src, %o2=len */ nop ba,a,pt %xcc, 73b -8: mov 64, GLOBAL_SPARE +8: mov 64, %o3 andn %o1, 0x7, %o1 EX_LD(LOAD(ldx, %o1, %g2)) - sub GLOBAL_SPARE, %g1, GLOBAL_SPARE + sub %o3, %g1, %o3 andn %o2, 0x7, %o4 sllx %g2, %g1, %g2 1: add %o1, 0x8, %o1 EX_LD(LOAD(ldx, %o1, %g3)) subcc %o4, 0x8, %o4 - srlx %g3, GLOBAL_SPARE, %o5 + srlx %g3, %o3, %o5 or %o5, %g2, %o5 EX_ST(STORE(stx, %o5, %o0)) add %o0, 0x8, %o0 @@ -489,32 +489,32 @@ FUNC_NAME: /* %o0=dst, %o1=src, %o2=len */ be,pn %icc, 85f add %o1, %g1, %o1 ba,pt %xcc, 90f - sub %o0, %o1, GLOBAL_SPARE + sub %o0, %o1, %o3 .align 64 80: /* 0 < len <= 16 */ - andcc GLOBAL_SPARE, 0x3, %g0 + andcc %o3, 0x3, %g0 bne,pn %XCC, 90f - sub %o0, %o1, GLOBAL_SPARE + sub %o0, %o1, %o3 1: subcc %o2, 4, %o2 EX_LD(LOAD(lduw, %o1, %g1)) - EX_ST(STORE(stw, %g1, %o1 + GLOBAL_SPARE)) + EX_ST(STORE(stw, %g1, %o1 + %o3)) bgu,pt %XCC, 1b add %o1, 4, %o1 85: retl - mov EX_RETVAL(%o3), %o0 + mov EX_RETVAL(GLOBAL_SPARE), %o0 .align 32 90: subcc %o2, 1, %o2 EX_LD(LOAD(ldub, %o1, %g1)) - EX_ST(STORE(stb, %g1, %o1 + GLOBAL_SPARE)) + EX_ST(STORE(stb, %g1, %o1 + %o3)) bgu,pt %XCC, 90b add %o1, 1, %o1 retl - mov EX_RETVAL(%o3), %o0 + mov EX_RETVAL(GLOBAL_SPARE), %o0 .size FUNC_NAME, .-FUNC_NAME diff --git a/trunk/arch/sparc/mm/init_64.c b/trunk/arch/sparc/mm/init_64.c index 7a9b788c6ced..696bb095e0fc 100644 --- a/trunk/arch/sparc/mm/init_64.c +++ b/trunk/arch/sparc/mm/init_64.c @@ -119,8 +119,7 @@ static void __init read_obp_memory(const char *property, ret = prom_getproperty(node, property, (char *) regs, prop_size); if (ret == -1) { - prom_printf("Couldn't get %s property from /memory.\n", - property); + prom_printf("Couldn't get %s property from /memory.\n"); prom_halt(); } @@ -498,7 +497,7 @@ static void __init read_obp_translations(void) prom_halt(); } if (unlikely(n > sizeof(prom_trans))) { - prom_printf("prom_mappings: Size %d is too big.\n", n); + prom_printf("prom_mappings: Size %Zd is too big.\n", n); prom_halt(); } @@ -560,7 +559,7 @@ static void __init hypervisor_tlb_lock(unsigned long vaddr, unsigned long ret = sun4v_mmu_map_perm_addr(vaddr, 0, pte, mmu); if (ret != 0) { - prom_printf("hypervisor_tlb_lock[%lx:%x:%lx:%lx]: " + prom_printf("hypervisor_tlb_lock[%lx:%lx:%lx:%lx]: " "errors with %lx\n", vaddr, 0, pte, mmu, ret); prom_halt(); } diff --git a/trunk/arch/sparc/mm/iommu.c b/trunk/arch/sparc/mm/iommu.c index 0f4f7191fbba..a8a58cad9d2b 100644 --- a/trunk/arch/sparc/mm/iommu.c +++ b/trunk/arch/sparc/mm/iommu.c @@ -90,8 +90,8 @@ static void __init sbus_iommu_init(struct platform_device *op) it to us. */ tmp = __get_free_pages(GFP_KERNEL, IOMMU_ORDER); if (!tmp) { - prom_printf("Unable to allocate iommu table [0x%lx]\n", - IOMMU_NPTES * sizeof(iopte_t)); + prom_printf("Unable to allocate iommu table [0x%08x]\n", + IOMMU_NPTES*sizeof(iopte_t)); prom_halt(); } iommu->page_table = (iopte_t *)tmp; diff --git a/trunk/arch/tile/include/asm/compat.h b/trunk/arch/tile/include/asm/compat.h index 3063e6fc8daa..6e74450ff0a1 100644 --- a/trunk/arch/tile/include/asm/compat.h +++ b/trunk/arch/tile/include/asm/compat.h @@ -110,68 +110,6 @@ struct compat_flock64 { typedef u32 compat_sigset_word; -typedef union compat_sigval { - compat_int_t sival_int; - compat_uptr_t sival_ptr; -} compat_sigval_t; - -#define COMPAT_SI_PAD_SIZE (128/sizeof(int) - 3) - -typedef struct compat_siginfo { - int si_signo; - int si_errno; - int si_code; - - union { - int _pad[COMPAT_SI_PAD_SIZE]; - - /* kill() */ - struct { - unsigned int _pid; /* sender's pid */ - unsigned int _uid; /* sender's uid */ - } _kill; - - /* POSIX.1b timers */ - struct { - compat_timer_t _tid; /* timer id */ - int _overrun; /* overrun count */ - compat_sigval_t _sigval; /* same as below */ - int _sys_private; /* not to be passed to user */ - int _overrun_incr; /* amount to add to overrun */ - } _timer; - - /* POSIX.1b signals */ - struct { - unsigned int _pid; /* sender's pid */ - unsigned int _uid; /* sender's uid */ - compat_sigval_t _sigval; - } _rt; - - /* SIGCHLD */ - struct { - unsigned int _pid; /* which child */ - unsigned int _uid; /* sender's uid */ - int _status; /* exit code */ - compat_clock_t _utime; - compat_clock_t _stime; - } _sigchld; - - /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */ - struct { - unsigned int _addr; /* faulting insn/memory ref. */ -#ifdef __ARCH_SI_TRAPNO - int _trapno; /* TRAP # which caused the signal */ -#endif - } _sigfault; - - /* SIGPOLL */ - struct { - int _band; /* POLL_IN, POLL_OUT, POLL_MSG */ - int _fd; - } _sigpoll; - } _sifields; -} compat_siginfo_t; - #define COMPAT_OFF_T_MAX 0x7fffffff #define COMPAT_LOFF_T_MAX 0x7fffffffffffffffL diff --git a/trunk/arch/tile/include/asm/elf.h b/trunk/arch/tile/include/asm/elf.h index f8ccf08f6934..d16d006d660e 100644 --- a/trunk/arch/tile/include/asm/elf.h +++ b/trunk/arch/tile/include/asm/elf.h @@ -156,12 +156,12 @@ extern int arch_setup_additional_pages(struct linux_binprm *bprm, #undef SET_PERSONALITY #define SET_PERSONALITY(ex) \ do { \ - set_personality(PER_LINUX | (current->personality & (~PER_MASK))); \ + current->personality = PER_LINUX; \ current_thread_info()->status &= ~TS_COMPAT; \ } while (0) #define COMPAT_SET_PERSONALITY(ex) \ do { \ - set_personality(PER_LINUX | (current->personality & (~PER_MASK))); \ + current->personality = PER_LINUX_32BIT; \ current_thread_info()->status |= TS_COMPAT; \ } while (0) diff --git a/trunk/arch/tile/include/gxio/dma_queue.h b/trunk/arch/tile/include/gxio/dma_queue.h index b9e45e37649e..00654feb7db0 100644 --- a/trunk/arch/tile/include/gxio/dma_queue.h +++ b/trunk/arch/tile/include/gxio/dma_queue.h @@ -19,7 +19,7 @@ * DMA queue management APIs shared between TRIO and mPIPE. */ -#include +#include "common.h" /* The credit counter lives in the high 32 bits. */ #define DMA_QUEUE_CREDIT_SHIFT 32 diff --git a/trunk/arch/tile/include/gxio/mpipe.h b/trunk/arch/tile/include/gxio/mpipe.h index b74f470ed11e..78c598618c97 100644 --- a/trunk/arch/tile/include/gxio/mpipe.h +++ b/trunk/arch/tile/include/gxio/mpipe.h @@ -21,8 +21,8 @@ * resources. */ -#include -#include +#include "common.h" +#include "dma_queue.h" #include diff --git a/trunk/arch/tile/include/gxio/trio.h b/trunk/arch/tile/include/gxio/trio.h index df10a662cc25..77b80cdd46d8 100644 --- a/trunk/arch/tile/include/gxio/trio.h +++ b/trunk/arch/tile/include/gxio/trio.h @@ -140,8 +140,8 @@ #include -#include -#include +#include "common.h" +#include "dma_queue.h" #include #include diff --git a/trunk/arch/tile/include/gxio/usb_host.h b/trunk/arch/tile/include/gxio/usb_host.h index 5eedec0e988e..a60a126e4565 100644 --- a/trunk/arch/tile/include/gxio/usb_host.h +++ b/trunk/arch/tile/include/gxio/usb_host.h @@ -14,7 +14,7 @@ #ifndef _GXIO_USB_H_ #define _GXIO_USB_H_ -#include +#include "common.h" #include #include diff --git a/trunk/arch/tile/include/hv/iorpc.h b/trunk/arch/tile/include/hv/iorpc.h index ddf1604482b3..89c72a5d9341 100644 --- a/trunk/arch/tile/include/hv/iorpc.h +++ b/trunk/arch/tile/include/hv/iorpc.h @@ -248,7 +248,7 @@ #if defined(__HV__) #include #elif defined(__KERNEL__) -#include +#include "hypervisor.h" #include #else #include diff --git a/trunk/arch/tile/include/uapi/arch/Kbuild b/trunk/arch/tile/include/uapi/arch/Kbuild deleted file mode 100644 index aafaa5aa54d4..000000000000 --- a/trunk/arch/tile/include/uapi/arch/Kbuild +++ /dev/null @@ -1 +0,0 @@ -# UAPI Header export list diff --git a/trunk/arch/tile/include/uapi/asm/Kbuild b/trunk/arch/tile/include/uapi/asm/Kbuild deleted file mode 100644 index baebb3da1d44..000000000000 --- a/trunk/arch/tile/include/uapi/asm/Kbuild +++ /dev/null @@ -1,3 +0,0 @@ -# UAPI Header export list -include include/uapi/asm-generic/Kbuild.asm - diff --git a/trunk/arch/tile/kernel/compat_signal.c b/trunk/arch/tile/kernel/compat_signal.c index 7bc0859a9f5e..474571b84085 100644 --- a/trunk/arch/tile/kernel/compat_signal.c +++ b/trunk/arch/tile/kernel/compat_signal.c @@ -55,6 +55,63 @@ struct compat_ucontext { sigset_t uc_sigmask; /* mask last for extensibility */ }; +#define COMPAT_SI_PAD_SIZE ((SI_MAX_SIZE - 3 * sizeof(int)) / sizeof(int)) + +struct compat_siginfo { + int si_signo; + int si_errno; + int si_code; + + union { + int _pad[COMPAT_SI_PAD_SIZE]; + + /* kill() */ + struct { + unsigned int _pid; /* sender's pid */ + unsigned int _uid; /* sender's uid */ + } _kill; + + /* POSIX.1b timers */ + struct { + compat_timer_t _tid; /* timer id */ + int _overrun; /* overrun count */ + compat_sigval_t _sigval; /* same as below */ + int _sys_private; /* not to be passed to user */ + int _overrun_incr; /* amount to add to overrun */ + } _timer; + + /* POSIX.1b signals */ + struct { + unsigned int _pid; /* sender's pid */ + unsigned int _uid; /* sender's uid */ + compat_sigval_t _sigval; + } _rt; + + /* SIGCHLD */ + struct { + unsigned int _pid; /* which child */ + unsigned int _uid; /* sender's uid */ + int _status; /* exit code */ + compat_clock_t _utime; + compat_clock_t _stime; + } _sigchld; + + /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */ + struct { + unsigned int _addr; /* faulting insn/memory ref. */ +#ifdef __ARCH_SI_TRAPNO + int _trapno; /* TRAP # which caused the signal */ +#endif + } _sigfault; + + /* SIGPOLL */ + struct { + int _band; /* POLL_IN, POLL_OUT, POLL_MSG */ + int _fd; + } _sigpoll; + } _sifields; +}; + struct compat_rt_sigframe { unsigned char save_area[C_ABI_SAVE_AREA_SIZE]; /* caller save area */ struct compat_siginfo info; diff --git a/trunk/arch/um/Makefile b/trunk/arch/um/Makefile index 133f7de2a13d..097091059aaa 100644 --- a/trunk/arch/um/Makefile +++ b/trunk/arch/um/Makefile @@ -66,9 +66,7 @@ USER_CFLAGS = $(patsubst $(KERNEL_DEFINES),,$(patsubst -D__KERNEL__,,\ include $(srctree)/$(ARCH_DIR)/Makefile-os-$(OS) KBUILD_CPPFLAGS += -I$(srctree)/$(HOST_DIR)/include \ - -I$(srctree)/$(HOST_DIR)/include/uapi \ - -I$(HOST_DIR)/include/generated \ - -I$(HOST_DIR)/include/generated/uapi + -I$(HOST_DIR)/include/generated # -Derrno=kernel_errno - This turns all kernel references to errno into # kernel_errno to separate them from the libc errno. This allows -fno-common diff --git a/trunk/arch/um/drivers/mconsole_kern.c b/trunk/arch/um/drivers/mconsole_kern.c index 9efeb6da48bc..c17de0db6736 100644 --- a/trunk/arch/um/drivers/mconsole_kern.c +++ b/trunk/arch/um/drivers/mconsole_kern.c @@ -21,9 +21,6 @@ #include #include #include -#include -#include -#include #include #include @@ -121,14 +118,18 @@ void mconsole_log(struct mc_request *req) mconsole_reply(req, "", 0, 0); } +/* This is a more convoluted version of mconsole_proc, which has some stability + * problems; however, we need it fixed, because it is expected that UML users + * mount HPPFS instead of procfs on /proc. And we want mconsole_proc to still + * show the real procfs content, not the ones from hppfs.*/ +#if 0 void mconsole_proc(struct mc_request *req) { struct vfsmount *mnt = current->nsproxy->pid_ns->proc_mnt; - char *buf; - int len; struct file *file; - int first_chunk = 1; - char *ptr = req->request.data; + int n; + char *ptr = req->request.data, *buf; + mm_segment_t old_fs = get_fs(); ptr += strlen("proc"); ptr = skip_spaces(ptr); @@ -136,7 +137,6 @@ void mconsole_proc(struct mc_request *req) file = file_open_root(mnt->mnt_root, mnt, ptr, O_RDONLY); if (IS_ERR(file)) { mconsole_reply(req, "Failed to open file", 1, 0); - printk(KERN_ERR "open /proc/%s: %ld\n", ptr, PTR_ERR(file)); goto out; } @@ -146,13 +146,62 @@ void mconsole_proc(struct mc_request *req) goto out_fput; } - do { - loff_t pos; - mm_segment_t old_fs = get_fs(); - set_fs(KERNEL_DS); - len = vfs_read(file, buf, PAGE_SIZE - 1, &pos); - set_fs(old_fs); - file->f_pos = pos; + if (file->f_op->read) { + do { + loff_t pos; + set_fs(KERNEL_DS); + n = vfs_read(file, buf, PAGE_SIZE - 1, &pos); + file_pos_write(file, pos); + set_fs(old_fs); + if (n >= 0) { + buf[n] = '\0'; + mconsole_reply(req, buf, 0, (n > 0)); + } + else { + mconsole_reply(req, "Read of file failed", + 1, 0); + goto out_free; + } + } while (n > 0); + } + else mconsole_reply(req, "", 0, 0); + + out_free: + kfree(buf); + out_fput: + fput(file); + out: ; +} +#endif + +void mconsole_proc(struct mc_request *req) +{ + char path[64]; + char *buf; + int len; + int fd; + int first_chunk = 1; + char *ptr = req->request.data; + + ptr += strlen("proc"); + ptr = skip_spaces(ptr); + snprintf(path, sizeof(path), "/proc/%s", ptr); + + fd = sys_open(path, 0, 0); + if (fd < 0) { + mconsole_reply(req, "Failed to open file", 1, 0); + printk(KERN_ERR "open %s: %d\n",path,fd); + goto out; + } + + buf = kmalloc(PAGE_SIZE, GFP_KERNEL); + if (buf == NULL) { + mconsole_reply(req, "Failed to allocate buffer", 1, 0); + goto out_close; + } + + for (;;) { + len = sys_read(fd, buf, PAGE_SIZE-1); if (len < 0) { mconsole_reply(req, "Read of file failed", 1, 0); goto out_free; @@ -162,14 +211,22 @@ void mconsole_proc(struct mc_request *req) mconsole_reply(req, "\n", 0, 1); first_chunk = 0; } - buf[len] = '\0'; - mconsole_reply(req, buf, 0, (len > 0)); - } while (len > 0); + if (len == PAGE_SIZE-1) { + buf[len] = '\0'; + mconsole_reply(req, buf, 0, 1); + } else { + buf[len] = '\0'; + mconsole_reply(req, buf, 0, 0); + break; + } + } + out_free: kfree(buf); - out_fput: - fput(file); - out: ; + out_close: + sys_close(fd); + out: + /* nothing */; } #define UML_MCONSOLE_HELPTEXT \ diff --git a/trunk/arch/unicore32/Kconfig b/trunk/arch/unicore32/Kconfig index 1e638e75a6b7..b0a47433341e 100644 --- a/trunk/arch/unicore32/Kconfig +++ b/trunk/arch/unicore32/Kconfig @@ -6,7 +6,6 @@ config UNICORE32 select HAVE_DMA_ATTRS select HAVE_KERNEL_GZIP select HAVE_KERNEL_BZIP2 - select GENERIC_ATOMIC64 select HAVE_KERNEL_LZO select HAVE_KERNEL_LZMA select ARCH_HAVE_CUSTOM_GPIO_H diff --git a/trunk/arch/unicore32/include/mach/PKUnity.h b/trunk/arch/unicore32/include/mach/PKUnity.h index 46705afcbf5a..8040d575dddb 100644 --- a/trunk/arch/unicore32/include/mach/PKUnity.h +++ b/trunk/arch/unicore32/include/mach/PKUnity.h @@ -15,7 +15,7 @@ #error You must include hardware.h not PKUnity.h #endif -#include +#include "bitfield.h" /* * Memory Definitions @@ -32,7 +32,7 @@ * 0x98000000 - 0x9FFFFFFF 128MB PCI PCI-AHB MEM-mapping */ #define PKUNITY_PCI_BASE io_p2v(0x80000000) /* 0x80000000 - 0xBFFFFFFF 1GB */ -#include +#include "regs-pci.h" #define PKUNITY_PCICFG_BASE (PKUNITY_PCI_BASE + 0x0) #define PKUNITY_PCIBRI_BASE (PKUNITY_PCI_BASE + 0x00010000) @@ -50,18 +50,18 @@ #define PKUNITY_ARBITER_BASE (PKUNITY_AHB_BASE + 0x000000) /* AHB-2 */ #define PKUNITY_DDR2CTRL_BASE (PKUNITY_AHB_BASE + 0x100000) /* AHB-3 */ #define PKUNITY_DMAC_BASE (PKUNITY_AHB_BASE + 0x200000) /* AHB-4 */ -#include +#include "regs-dmac.h" #define PKUNITY_UMAL_BASE (PKUNITY_AHB_BASE + 0x300000) /* AHB-5 */ -#include +#include "regs-umal.h" #define PKUNITY_USB_BASE (PKUNITY_AHB_BASE + 0x400000) /* AHB-6 */ #define PKUNITY_SATA_BASE (PKUNITY_AHB_BASE + 0x500000) /* AHB-7 */ #define PKUNITY_SMC_BASE (PKUNITY_AHB_BASE + 0x600000) /* AHB-8 */ /* AHB-9 is for APB bridge */ #define PKUNITY_MME_BASE (PKUNITY_AHB_BASE + 0x700000) /* AHB-10 */ #define PKUNITY_UNIGFX_BASE (PKUNITY_AHB_BASE + 0x800000) /* AHB-11 */ -#include +#include "regs-unigfx.h" #define PKUNITY_NAND_BASE (PKUNITY_AHB_BASE + 0x900000) /* AHB-12 */ -#include +#include "regs-nand.h" #define PKUNITY_H264D_BASE (PKUNITY_AHB_BASE + 0xA00000) /* AHB-13 */ #define PKUNITY_H264E_BASE (PKUNITY_AHB_BASE + 0xB00000) /* AHB-14 */ @@ -72,27 +72,27 @@ #define PKUNITY_UART0_BASE (PKUNITY_APB_BASE + 0x000000) /* APB-0 */ #define PKUNITY_UART1_BASE (PKUNITY_APB_BASE + 0x100000) /* APB-1 */ -#include +#include "regs-uart.h" #define PKUNITY_I2C_BASE (PKUNITY_APB_BASE + 0x200000) /* APB-2 */ -#include +#include "regs-i2c.h" #define PKUNITY_SPI_BASE (PKUNITY_APB_BASE + 0x300000) /* APB-3 */ -#include +#include "regs-spi.h" #define PKUNITY_AC97_BASE (PKUNITY_APB_BASE + 0x400000) /* APB-4 */ -#include +#include "regs-ac97.h" #define PKUNITY_GPIO_BASE (PKUNITY_APB_BASE + 0x500000) /* APB-5 */ -#include +#include "regs-gpio.h" #define PKUNITY_INTC_BASE (PKUNITY_APB_BASE + 0x600000) /* APB-6 */ -#include +#include "regs-intc.h" #define PKUNITY_RTC_BASE (PKUNITY_APB_BASE + 0x700000) /* APB-7 */ -#include +#include "regs-rtc.h" #define PKUNITY_OST_BASE (PKUNITY_APB_BASE + 0x800000) /* APB-8 */ -#include +#include "regs-ost.h" #define PKUNITY_RESETC_BASE (PKUNITY_APB_BASE + 0x900000) /* APB-9 */ -#include +#include "regs-resetc.h" #define PKUNITY_PM_BASE (PKUNITY_APB_BASE + 0xA00000) /* APB-10 */ -#include +#include "regs-pm.h" #define PKUNITY_PS2_BASE (PKUNITY_APB_BASE + 0xB00000) /* APB-11 */ -#include +#include "regs-ps2.h" #define PKUNITY_SDC_BASE (PKUNITY_APB_BASE + 0xC00000) /* APB-12 */ -#include +#include "regs-sdc.h" diff --git a/trunk/arch/unicore32/include/mach/hardware.h b/trunk/arch/unicore32/include/mach/hardware.h index 9e20b5d9ed50..930bea6e129a 100644 --- a/trunk/arch/unicore32/include/mach/hardware.h +++ b/trunk/arch/unicore32/include/mach/hardware.h @@ -15,7 +15,7 @@ #ifndef __MACH_PUV3_HARDWARE_H__ #define __MACH_PUV3_HARDWARE_H__ -#include +#include "PKUnity.h" #ifndef __ASSEMBLY__ #define io_p2v(x) (void __iomem *)((x) - PKUNITY_MMIO_BASE) diff --git a/trunk/arch/unicore32/include/mach/uncompress.h b/trunk/arch/unicore32/include/mach/uncompress.h index 9be67c9d3b53..142d3e7958a9 100644 --- a/trunk/arch/unicore32/include/mach/uncompress.h +++ b/trunk/arch/unicore32/include/mach/uncompress.h @@ -13,8 +13,8 @@ #ifndef __MACH_PUV3_UNCOMPRESS_H__ #define __MACH_PUV3_UNCOMPRESS_H__ -#include -#include +#include "hardware.h" +#include "ocd.h" extern char input_data[]; extern char input_data_end[]; diff --git a/trunk/arch/unicore32/include/uapi/asm/Kbuild b/trunk/arch/unicore32/include/uapi/asm/Kbuild deleted file mode 100644 index baebb3da1d44..000000000000 --- a/trunk/arch/unicore32/include/uapi/asm/Kbuild +++ /dev/null @@ -1,3 +0,0 @@ -# UAPI Header export list -include include/uapi/asm-generic/Kbuild.asm - diff --git a/trunk/arch/x86/Kconfig b/trunk/arch/x86/Kconfig index b72777ff32a9..7f9a395c5254 100644 --- a/trunk/arch/x86/Kconfig +++ b/trunk/arch/x86/Kconfig @@ -586,18 +586,23 @@ config PARAVIRT_TIME_ACCOUNTING source "arch/x86/xen/Kconfig" -config KVM_GUEST - bool "KVM Guest support (including kvmclock)" - select PARAVIRT +config KVM_CLOCK + bool "KVM paravirtualized clock" select PARAVIRT select PARAVIRT_CLOCK - default y if PARAVIRT_GUEST + ---help--- + Turning on this option will allow you to run a paravirtualized clock + when running over the KVM hypervisor. Instead of relying on a PIT + (or probably other) emulation by the underlying device model, the host + provides the guest with timing infrastructure such as time of day, and + system time + +config KVM_GUEST + bool "KVM Guest support" + select PARAVIRT ---help--- This option enables various optimizations for running under the KVM - hypervisor. It includes a paravirtualized clock, so that instead - of relying on a PIT (or probably other) emulation by the - underlying device model, the host provides the guest with - timing infrastructure such as time of day, and system time + hypervisor. source "arch/x86/lguest/Kconfig" diff --git a/trunk/arch/x86/boot/Makefile b/trunk/arch/x86/boot/Makefile index ce03476d8c8f..f7535bedc33f 100644 --- a/trunk/arch/x86/boot/Makefile +++ b/trunk/arch/x86/boot/Makefile @@ -37,7 +37,7 @@ setup-y += video-bios.o targets += $(setup-y) hostprogs-y := mkcpustr tools/build -HOST_EXTRACFLAGS += -I$(srctree)/tools/include $(USERINCLUDE) \ +HOST_EXTRACFLAGS += -I$(srctree)/tools/include $(LINUXINCLUDE) \ -D__EXPORTED_HEADERS__ $(obj)/cpu.o: $(obj)/cpustr.h @@ -52,7 +52,7 @@ $(obj)/cpustr.h: $(obj)/mkcpustr FORCE # How to compile the 16-bit code. Note we always compile for -march=i386, # that way we can complain to the user if the CPU is insufficient. -KBUILD_CFLAGS := $(USERINCLUDE) -g -Os -D_SETUP -D__KERNEL__ \ +KBUILD_CFLAGS := $(LINUXINCLUDE) -g -Os -D_SETUP -D__KERNEL__ \ -DDISABLE_BRANCH_PROFILING \ -Wall -Wstrict-prototypes \ -march=i386 -mregparm=3 \ diff --git a/trunk/arch/x86/boot/mkcpustr.c b/trunk/arch/x86/boot/mkcpustr.c index 4579eff0ef4d..919257f526f2 100644 --- a/trunk/arch/x86/boot/mkcpustr.c +++ b/trunk/arch/x86/boot/mkcpustr.c @@ -15,8 +15,6 @@ #include -#include "../include/asm/required-features.h" -#include "../include/asm/cpufeature.h" #include "../kernel/cpu/capflags.c" int main(void) diff --git a/trunk/arch/x86/crypto/Makefile b/trunk/arch/x86/crypto/Makefile index 5bacb4a226ac..e908e5de82d3 100644 --- a/trunk/arch/x86/crypto/Makefile +++ b/trunk/arch/x86/crypto/Makefile @@ -12,8 +12,6 @@ obj-$(CONFIG_CRYPTO_SERPENT_SSE2_586) += serpent-sse2-i586.o obj-$(CONFIG_CRYPTO_AES_X86_64) += aes-x86_64.o obj-$(CONFIG_CRYPTO_CAMELLIA_X86_64) += camellia-x86_64.o -obj-$(CONFIG_CRYPTO_CAST5_AVX_X86_64) += cast5-avx-x86_64.o -obj-$(CONFIG_CRYPTO_CAST6_AVX_X86_64) += cast6-avx-x86_64.o obj-$(CONFIG_CRYPTO_BLOWFISH_X86_64) += blowfish-x86_64.o obj-$(CONFIG_CRYPTO_TWOFISH_X86_64) += twofish-x86_64.o obj-$(CONFIG_CRYPTO_TWOFISH_X86_64_3WAY) += twofish-x86_64-3way.o @@ -34,8 +32,6 @@ serpent-sse2-i586-y := serpent-sse2-i586-asm_32.o serpent_sse2_glue.o aes-x86_64-y := aes-x86_64-asm_64.o aes_glue.o camellia-x86_64-y := camellia-x86_64-asm_64.o camellia_glue.o -cast5-avx-x86_64-y := cast5-avx-x86_64-asm_64.o cast5_avx_glue.o -cast6-avx-x86_64-y := cast6-avx-x86_64-asm_64.o cast6_avx_glue.o blowfish-x86_64-y := blowfish-x86_64-asm_64.o blowfish_glue.o twofish-x86_64-y := twofish-x86_64-asm_64.o twofish_glue.o twofish-x86_64-3way-y := twofish-x86_64-asm_64-3way.o twofish_glue_3way.o diff --git a/trunk/arch/x86/crypto/aes_glue.c b/trunk/arch/x86/crypto/aes_glue.c index aafe8ce0d65d..59b37deb8c8d 100644 --- a/trunk/arch/x86/crypto/aes_glue.c +++ b/trunk/arch/x86/crypto/aes_glue.c @@ -40,6 +40,7 @@ static struct crypto_alg aes_alg = { .cra_blocksize = AES_BLOCK_SIZE, .cra_ctxsize = sizeof(struct crypto_aes_ctx), .cra_module = THIS_MODULE, + .cra_list = LIST_HEAD_INIT(aes_alg.cra_list), .cra_u = { .cipher = { .cia_min_keysize = AES_MIN_KEY_SIZE, diff --git a/trunk/arch/x86/crypto/aesni-intel_glue.c b/trunk/arch/x86/crypto/aesni-intel_glue.c index 7c04d0da709b..34fdcff4d2c8 100644 --- a/trunk/arch/x86/crypto/aesni-intel_glue.c +++ b/trunk/arch/x86/crypto/aesni-intel_glue.c @@ -28,9 +28,6 @@ #include #include #include -#include -#include -#include #include #include #include @@ -44,10 +41,18 @@ #define HAS_CTR #endif +#if defined(CONFIG_CRYPTO_LRW) || defined(CONFIG_CRYPTO_LRW_MODULE) +#define HAS_LRW +#endif + #if defined(CONFIG_CRYPTO_PCBC) || defined(CONFIG_CRYPTO_PCBC_MODULE) #define HAS_PCBC #endif +#if defined(CONFIG_CRYPTO_XTS) || defined(CONFIG_CRYPTO_XTS_MODULE) +#define HAS_XTS +#endif + /* This data is stored at the end of the crypto_tfm struct. * It's a type of per "session" data storage location. * This needs to be 16 byte aligned. @@ -74,16 +79,6 @@ struct aesni_hash_subkey_req_data { #define AES_BLOCK_MASK (~(AES_BLOCK_SIZE-1)) #define RFC4106_HASH_SUBKEY_SIZE 16 -struct aesni_lrw_ctx { - struct lrw_table_ctx lrw_table; - u8 raw_aes_ctx[sizeof(struct crypto_aes_ctx) + AESNI_ALIGN - 1]; -}; - -struct aesni_xts_ctx { - u8 raw_tweak_ctx[sizeof(struct crypto_aes_ctx) + AESNI_ALIGN - 1]; - u8 raw_crypt_ctx[sizeof(struct crypto_aes_ctx) + AESNI_ALIGN - 1]; -}; - asmlinkage int aesni_set_key(struct crypto_aes_ctx *ctx, const u8 *in_key, unsigned int key_len); asmlinkage void aesni_enc(struct crypto_aes_ctx *ctx, u8 *out, @@ -403,167 +398,26 @@ static int ablk_rfc3686_ctr_init(struct crypto_tfm *tfm) #endif #endif -#ifdef HAS_PCBC -static int ablk_pcbc_init(struct crypto_tfm *tfm) +#ifdef HAS_LRW +static int ablk_lrw_init(struct crypto_tfm *tfm) { - return ablk_init_common(tfm, "fpu(pcbc(__driver-aes-aesni))"); + return ablk_init_common(tfm, "fpu(lrw(__driver-aes-aesni))"); } #endif -static void lrw_xts_encrypt_callback(void *ctx, u8 *blks, unsigned int nbytes) -{ - aesni_ecb_enc(ctx, blks, blks, nbytes); -} - -static void lrw_xts_decrypt_callback(void *ctx, u8 *blks, unsigned int nbytes) -{ - aesni_ecb_dec(ctx, blks, blks, nbytes); -} - -static int lrw_aesni_setkey(struct crypto_tfm *tfm, const u8 *key, - unsigned int keylen) -{ - struct aesni_lrw_ctx *ctx = crypto_tfm_ctx(tfm); - int err; - - err = aes_set_key_common(tfm, ctx->raw_aes_ctx, key, - keylen - AES_BLOCK_SIZE); - if (err) - return err; - - return lrw_init_table(&ctx->lrw_table, key + keylen - AES_BLOCK_SIZE); -} - -static void lrw_aesni_exit_tfm(struct crypto_tfm *tfm) -{ - struct aesni_lrw_ctx *ctx = crypto_tfm_ctx(tfm); - - lrw_free_table(&ctx->lrw_table); -} - -static int lrw_encrypt(struct blkcipher_desc *desc, struct scatterlist *dst, - struct scatterlist *src, unsigned int nbytes) -{ - struct aesni_lrw_ctx *ctx = crypto_blkcipher_ctx(desc->tfm); - be128 buf[8]; - struct lrw_crypt_req req = { - .tbuf = buf, - .tbuflen = sizeof(buf), - - .table_ctx = &ctx->lrw_table, - .crypt_ctx = aes_ctx(ctx->raw_aes_ctx), - .crypt_fn = lrw_xts_encrypt_callback, - }; - int ret; - - desc->flags &= ~CRYPTO_TFM_REQ_MAY_SLEEP; - - kernel_fpu_begin(); - ret = lrw_crypt(desc, dst, src, nbytes, &req); - kernel_fpu_end(); - - return ret; -} - -static int lrw_decrypt(struct blkcipher_desc *desc, struct scatterlist *dst, - struct scatterlist *src, unsigned int nbytes) -{ - struct aesni_lrw_ctx *ctx = crypto_blkcipher_ctx(desc->tfm); - be128 buf[8]; - struct lrw_crypt_req req = { - .tbuf = buf, - .tbuflen = sizeof(buf), - - .table_ctx = &ctx->lrw_table, - .crypt_ctx = aes_ctx(ctx->raw_aes_ctx), - .crypt_fn = lrw_xts_decrypt_callback, - }; - int ret; - - desc->flags &= ~CRYPTO_TFM_REQ_MAY_SLEEP; - - kernel_fpu_begin(); - ret = lrw_crypt(desc, dst, src, nbytes, &req); - kernel_fpu_end(); - - return ret; -} - -static int xts_aesni_setkey(struct crypto_tfm *tfm, const u8 *key, - unsigned int keylen) -{ - struct aesni_xts_ctx *ctx = crypto_tfm_ctx(tfm); - u32 *flags = &tfm->crt_flags; - int err; - - /* key consists of keys of equal size concatenated, therefore - * the length must be even - */ - if (keylen % 2) { - *flags |= CRYPTO_TFM_RES_BAD_KEY_LEN; - return -EINVAL; - } - - /* first half of xts-key is for crypt */ - err = aes_set_key_common(tfm, ctx->raw_crypt_ctx, key, keylen / 2); - if (err) - return err; - - /* second half of xts-key is for tweak */ - return aes_set_key_common(tfm, ctx->raw_tweak_ctx, key + keylen / 2, - keylen / 2); -} - - -static int xts_encrypt(struct blkcipher_desc *desc, struct scatterlist *dst, - struct scatterlist *src, unsigned int nbytes) +#ifdef HAS_PCBC +static int ablk_pcbc_init(struct crypto_tfm *tfm) { - struct aesni_xts_ctx *ctx = crypto_blkcipher_ctx(desc->tfm); - be128 buf[8]; - struct xts_crypt_req req = { - .tbuf = buf, - .tbuflen = sizeof(buf), - - .tweak_ctx = aes_ctx(ctx->raw_tweak_ctx), - .tweak_fn = XTS_TWEAK_CAST(aesni_enc), - .crypt_ctx = aes_ctx(ctx->raw_crypt_ctx), - .crypt_fn = lrw_xts_encrypt_callback, - }; - int ret; - - desc->flags &= ~CRYPTO_TFM_REQ_MAY_SLEEP; - - kernel_fpu_begin(); - ret = xts_crypt(desc, dst, src, nbytes, &req); - kernel_fpu_end(); - - return ret; + return ablk_init_common(tfm, "fpu(pcbc(__driver-aes-aesni))"); } +#endif -static int xts_decrypt(struct blkcipher_desc *desc, struct scatterlist *dst, - struct scatterlist *src, unsigned int nbytes) +#ifdef HAS_XTS +static int ablk_xts_init(struct crypto_tfm *tfm) { - struct aesni_xts_ctx *ctx = crypto_blkcipher_ctx(desc->tfm); - be128 buf[8]; - struct xts_crypt_req req = { - .tbuf = buf, - .tbuflen = sizeof(buf), - - .tweak_ctx = aes_ctx(ctx->raw_tweak_ctx), - .tweak_fn = XTS_TWEAK_CAST(aesni_enc), - .crypt_ctx = aes_ctx(ctx->raw_crypt_ctx), - .crypt_fn = lrw_xts_decrypt_callback, - }; - int ret; - - desc->flags &= ~CRYPTO_TFM_REQ_MAY_SLEEP; - - kernel_fpu_begin(); - ret = xts_crypt(desc, dst, src, nbytes, &req); - kernel_fpu_end(); - - return ret; + return ablk_init_common(tfm, "fpu(xts(__driver-aes-aesni))"); } +#endif #ifdef CONFIG_X86_64 static int rfc4106_init(struct crypto_tfm *tfm) @@ -1181,10 +1035,10 @@ static struct crypto_alg aesni_algs[] = { { }, #endif #endif -#ifdef HAS_PCBC +#ifdef HAS_LRW }, { - .cra_name = "pcbc(aes)", - .cra_driver_name = "pcbc-aes-aesni", + .cra_name = "lrw(aes)", + .cra_driver_name = "lrw-aes-aesni", .cra_priority = 400, .cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_ASYNC, .cra_blocksize = AES_BLOCK_SIZE, @@ -1192,12 +1046,12 @@ static struct crypto_alg aesni_algs[] = { { .cra_alignmask = 0, .cra_type = &crypto_ablkcipher_type, .cra_module = THIS_MODULE, - .cra_init = ablk_pcbc_init, + .cra_init = ablk_lrw_init, .cra_exit = ablk_exit, .cra_u = { .ablkcipher = { - .min_keysize = AES_MIN_KEY_SIZE, - .max_keysize = AES_MAX_KEY_SIZE, + .min_keysize = AES_MIN_KEY_SIZE + AES_BLOCK_SIZE, + .max_keysize = AES_MAX_KEY_SIZE + AES_BLOCK_SIZE, .ivsize = AES_BLOCK_SIZE, .setkey = ablk_set_key, .encrypt = ablk_encrypt, @@ -1205,50 +1059,10 @@ static struct crypto_alg aesni_algs[] = { { }, }, #endif +#ifdef HAS_PCBC }, { - .cra_name = "__lrw-aes-aesni", - .cra_driver_name = "__driver-lrw-aes-aesni", - .cra_priority = 0, - .cra_flags = CRYPTO_ALG_TYPE_BLKCIPHER, - .cra_blocksize = AES_BLOCK_SIZE, - .cra_ctxsize = sizeof(struct aesni_lrw_ctx), - .cra_alignmask = 0, - .cra_type = &crypto_blkcipher_type, - .cra_module = THIS_MODULE, - .cra_exit = lrw_aesni_exit_tfm, - .cra_u = { - .blkcipher = { - .min_keysize = AES_MIN_KEY_SIZE + AES_BLOCK_SIZE, - .max_keysize = AES_MAX_KEY_SIZE + AES_BLOCK_SIZE, - .ivsize = AES_BLOCK_SIZE, - .setkey = lrw_aesni_setkey, - .encrypt = lrw_encrypt, - .decrypt = lrw_decrypt, - }, - }, -}, { - .cra_name = "__xts-aes-aesni", - .cra_driver_name = "__driver-xts-aes-aesni", - .cra_priority = 0, - .cra_flags = CRYPTO_ALG_TYPE_BLKCIPHER, - .cra_blocksize = AES_BLOCK_SIZE, - .cra_ctxsize = sizeof(struct aesni_xts_ctx), - .cra_alignmask = 0, - .cra_type = &crypto_blkcipher_type, - .cra_module = THIS_MODULE, - .cra_u = { - .blkcipher = { - .min_keysize = 2 * AES_MIN_KEY_SIZE, - .max_keysize = 2 * AES_MAX_KEY_SIZE, - .ivsize = AES_BLOCK_SIZE, - .setkey = xts_aesni_setkey, - .encrypt = xts_encrypt, - .decrypt = xts_decrypt, - }, - }, -}, { - .cra_name = "lrw(aes)", - .cra_driver_name = "lrw-aes-aesni", + .cra_name = "pcbc(aes)", + .cra_driver_name = "pcbc-aes-aesni", .cra_priority = 400, .cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_ASYNC, .cra_blocksize = AES_BLOCK_SIZE, @@ -1256,18 +1070,20 @@ static struct crypto_alg aesni_algs[] = { { .cra_alignmask = 0, .cra_type = &crypto_ablkcipher_type, .cra_module = THIS_MODULE, - .cra_init = ablk_init, + .cra_init = ablk_pcbc_init, .cra_exit = ablk_exit, .cra_u = { .ablkcipher = { - .min_keysize = AES_MIN_KEY_SIZE + AES_BLOCK_SIZE, - .max_keysize = AES_MAX_KEY_SIZE + AES_BLOCK_SIZE, + .min_keysize = AES_MIN_KEY_SIZE, + .max_keysize = AES_MAX_KEY_SIZE, .ivsize = AES_BLOCK_SIZE, .setkey = ablk_set_key, .encrypt = ablk_encrypt, .decrypt = ablk_decrypt, }, }, +#endif +#ifdef HAS_XTS }, { .cra_name = "xts(aes)", .cra_driver_name = "xts-aes-aesni", @@ -1278,7 +1094,7 @@ static struct crypto_alg aesni_algs[] = { { .cra_alignmask = 0, .cra_type = &crypto_ablkcipher_type, .cra_module = THIS_MODULE, - .cra_init = ablk_init, + .cra_init = ablk_xts_init, .cra_exit = ablk_exit, .cra_u = { .ablkcipher = { @@ -1290,6 +1106,7 @@ static struct crypto_alg aesni_algs[] = { { .decrypt = ablk_decrypt, }, }, +#endif } }; @@ -1301,7 +1118,7 @@ MODULE_DEVICE_TABLE(x86cpu, aesni_cpu_id); static int __init aesni_init(void) { - int err; + int err, i; if (!x86_match_cpu(aesni_cpu_id)) return -ENODEV; @@ -1310,6 +1127,9 @@ static int __init aesni_init(void) if (err) return err; + for (i = 0; i < ARRAY_SIZE(aesni_algs); i++) + INIT_LIST_HEAD(&aesni_algs[i].cra_list); + return crypto_register_algs(aesni_algs, ARRAY_SIZE(aesni_algs)); } diff --git a/trunk/arch/x86/crypto/blowfish_glue.c b/trunk/arch/x86/crypto/blowfish_glue.c index 50ec333b70e6..7967474de8f7 100644 --- a/trunk/arch/x86/crypto/blowfish_glue.c +++ b/trunk/arch/x86/crypto/blowfish_glue.c @@ -367,6 +367,7 @@ static struct crypto_alg bf_algs[4] = { { .cra_ctxsize = sizeof(struct bf_ctx), .cra_alignmask = 0, .cra_module = THIS_MODULE, + .cra_list = LIST_HEAD_INIT(bf_algs[0].cra_list), .cra_u = { .cipher = { .cia_min_keysize = BF_MIN_KEY_SIZE, @@ -386,6 +387,7 @@ static struct crypto_alg bf_algs[4] = { { .cra_alignmask = 0, .cra_type = &crypto_blkcipher_type, .cra_module = THIS_MODULE, + .cra_list = LIST_HEAD_INIT(bf_algs[1].cra_list), .cra_u = { .blkcipher = { .min_keysize = BF_MIN_KEY_SIZE, @@ -405,6 +407,7 @@ static struct crypto_alg bf_algs[4] = { { .cra_alignmask = 0, .cra_type = &crypto_blkcipher_type, .cra_module = THIS_MODULE, + .cra_list = LIST_HEAD_INIT(bf_algs[2].cra_list), .cra_u = { .blkcipher = { .min_keysize = BF_MIN_KEY_SIZE, @@ -425,6 +428,7 @@ static struct crypto_alg bf_algs[4] = { { .cra_alignmask = 0, .cra_type = &crypto_blkcipher_type, .cra_module = THIS_MODULE, + .cra_list = LIST_HEAD_INIT(bf_algs[3].cra_list), .cra_u = { .blkcipher = { .min_keysize = BF_MIN_KEY_SIZE, diff --git a/trunk/arch/x86/crypto/camellia_glue.c b/trunk/arch/x86/crypto/camellia_glue.c index 42ffd2bbab5b..eeb2b3b743e9 100644 --- a/trunk/arch/x86/crypto/camellia_glue.c +++ b/trunk/arch/x86/crypto/camellia_glue.c @@ -92,715 +92,715 @@ static void camellia_decrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src) /* camellia sboxes */ const u64 camellia_sp10011110[256] = { - 0x7000007070707000ULL, 0x8200008282828200ULL, 0x2c00002c2c2c2c00ULL, - 0xec0000ecececec00ULL, 0xb30000b3b3b3b300ULL, 0x2700002727272700ULL, - 0xc00000c0c0c0c000ULL, 0xe50000e5e5e5e500ULL, 0xe40000e4e4e4e400ULL, - 0x8500008585858500ULL, 0x5700005757575700ULL, 0x3500003535353500ULL, - 0xea0000eaeaeaea00ULL, 0x0c00000c0c0c0c00ULL, 0xae0000aeaeaeae00ULL, - 0x4100004141414100ULL, 0x2300002323232300ULL, 0xef0000efefefef00ULL, - 0x6b00006b6b6b6b00ULL, 0x9300009393939300ULL, 0x4500004545454500ULL, - 0x1900001919191900ULL, 0xa50000a5a5a5a500ULL, 0x2100002121212100ULL, - 0xed0000edededed00ULL, 0x0e00000e0e0e0e00ULL, 0x4f00004f4f4f4f00ULL, - 0x4e00004e4e4e4e00ULL, 0x1d00001d1d1d1d00ULL, 0x6500006565656500ULL, - 0x9200009292929200ULL, 0xbd0000bdbdbdbd00ULL, 0x8600008686868600ULL, - 0xb80000b8b8b8b800ULL, 0xaf0000afafafaf00ULL, 0x8f00008f8f8f8f00ULL, - 0x7c00007c7c7c7c00ULL, 0xeb0000ebebebeb00ULL, 0x1f00001f1f1f1f00ULL, - 0xce0000cececece00ULL, 0x3e00003e3e3e3e00ULL, 0x3000003030303000ULL, - 0xdc0000dcdcdcdc00ULL, 0x5f00005f5f5f5f00ULL, 0x5e00005e5e5e5e00ULL, - 0xc50000c5c5c5c500ULL, 0x0b00000b0b0b0b00ULL, 0x1a00001a1a1a1a00ULL, - 0xa60000a6a6a6a600ULL, 0xe10000e1e1e1e100ULL, 0x3900003939393900ULL, - 0xca0000cacacaca00ULL, 0xd50000d5d5d5d500ULL, 0x4700004747474700ULL, - 0x5d00005d5d5d5d00ULL, 0x3d00003d3d3d3d00ULL, 0xd90000d9d9d9d900ULL, - 0x0100000101010100ULL, 0x5a00005a5a5a5a00ULL, 0xd60000d6d6d6d600ULL, - 0x5100005151515100ULL, 0x5600005656565600ULL, 0x6c00006c6c6c6c00ULL, - 0x4d00004d4d4d4d00ULL, 0x8b00008b8b8b8b00ULL, 0x0d00000d0d0d0d00ULL, - 0x9a00009a9a9a9a00ULL, 0x6600006666666600ULL, 0xfb0000fbfbfbfb00ULL, - 0xcc0000cccccccc00ULL, 0xb00000b0b0b0b000ULL, 0x2d00002d2d2d2d00ULL, - 0x7400007474747400ULL, 0x1200001212121200ULL, 0x2b00002b2b2b2b00ULL, - 0x2000002020202000ULL, 0xf00000f0f0f0f000ULL, 0xb10000b1b1b1b100ULL, - 0x8400008484848400ULL, 0x9900009999999900ULL, 0xdf0000dfdfdfdf00ULL, - 0x4c00004c4c4c4c00ULL, 0xcb0000cbcbcbcb00ULL, 0xc20000c2c2c2c200ULL, - 0x3400003434343400ULL, 0x7e00007e7e7e7e00ULL, 0x7600007676767600ULL, - 0x0500000505050500ULL, 0x6d00006d6d6d6d00ULL, 0xb70000b7b7b7b700ULL, - 0xa90000a9a9a9a900ULL, 0x3100003131313100ULL, 0xd10000d1d1d1d100ULL, - 0x1700001717171700ULL, 0x0400000404040400ULL, 0xd70000d7d7d7d700ULL, - 0x1400001414141400ULL, 0x5800005858585800ULL, 0x3a00003a3a3a3a00ULL, - 0x6100006161616100ULL, 0xde0000dededede00ULL, 0x1b00001b1b1b1b00ULL, - 0x1100001111111100ULL, 0x1c00001c1c1c1c00ULL, 0x3200003232323200ULL, - 0x0f00000f0f0f0f00ULL, 0x9c00009c9c9c9c00ULL, 0x1600001616161600ULL, - 0x5300005353535300ULL, 0x1800001818181800ULL, 0xf20000f2f2f2f200ULL, - 0x2200002222222200ULL, 0xfe0000fefefefe00ULL, 0x4400004444444400ULL, - 0xcf0000cfcfcfcf00ULL, 0xb20000b2b2b2b200ULL, 0xc30000c3c3c3c300ULL, - 0xb50000b5b5b5b500ULL, 0x7a00007a7a7a7a00ULL, 0x9100009191919100ULL, - 0x2400002424242400ULL, 0x0800000808080800ULL, 0xe80000e8e8e8e800ULL, - 0xa80000a8a8a8a800ULL, 0x6000006060606000ULL, 0xfc0000fcfcfcfc00ULL, - 0x6900006969696900ULL, 0x5000005050505000ULL, 0xaa0000aaaaaaaa00ULL, - 0xd00000d0d0d0d000ULL, 0xa00000a0a0a0a000ULL, 0x7d00007d7d7d7d00ULL, - 0xa10000a1a1a1a100ULL, 0x8900008989898900ULL, 0x6200006262626200ULL, - 0x9700009797979700ULL, 0x5400005454545400ULL, 0x5b00005b5b5b5b00ULL, - 0x1e00001e1e1e1e00ULL, 0x9500009595959500ULL, 0xe00000e0e0e0e000ULL, - 0xff0000ffffffff00ULL, 0x6400006464646400ULL, 0xd20000d2d2d2d200ULL, - 0x1000001010101000ULL, 0xc40000c4c4c4c400ULL, 0x0000000000000000ULL, - 0x4800004848484800ULL, 0xa30000a3a3a3a300ULL, 0xf70000f7f7f7f700ULL, - 0x7500007575757500ULL, 0xdb0000dbdbdbdb00ULL, 0x8a00008a8a8a8a00ULL, - 0x0300000303030300ULL, 0xe60000e6e6e6e600ULL, 0xda0000dadadada00ULL, - 0x0900000909090900ULL, 0x3f00003f3f3f3f00ULL, 0xdd0000dddddddd00ULL, - 0x9400009494949400ULL, 0x8700008787878700ULL, 0x5c00005c5c5c5c00ULL, - 0x8300008383838300ULL, 0x0200000202020200ULL, 0xcd0000cdcdcdcd00ULL, - 0x4a00004a4a4a4a00ULL, 0x9000009090909000ULL, 0x3300003333333300ULL, - 0x7300007373737300ULL, 0x6700006767676700ULL, 0xf60000f6f6f6f600ULL, - 0xf30000f3f3f3f300ULL, 0x9d00009d9d9d9d00ULL, 0x7f00007f7f7f7f00ULL, - 0xbf0000bfbfbfbf00ULL, 0xe20000e2e2e2e200ULL, 0x5200005252525200ULL, - 0x9b00009b9b9b9b00ULL, 0xd80000d8d8d8d800ULL, 0x2600002626262600ULL, - 0xc80000c8c8c8c800ULL, 0x3700003737373700ULL, 0xc60000c6c6c6c600ULL, - 0x3b00003b3b3b3b00ULL, 0x8100008181818100ULL, 0x9600009696969600ULL, - 0x6f00006f6f6f6f00ULL, 0x4b00004b4b4b4b00ULL, 0x1300001313131300ULL, - 0xbe0000bebebebe00ULL, 0x6300006363636300ULL, 0x2e00002e2e2e2e00ULL, - 0xe90000e9e9e9e900ULL, 0x7900007979797900ULL, 0xa70000a7a7a7a700ULL, - 0x8c00008c8c8c8c00ULL, 0x9f00009f9f9f9f00ULL, 0x6e00006e6e6e6e00ULL, - 0xbc0000bcbcbcbc00ULL, 0x8e00008e8e8e8e00ULL, 0x2900002929292900ULL, - 0xf50000f5f5f5f500ULL, 0xf90000f9f9f9f900ULL, 0xb60000b6b6b6b600ULL, - 0x2f00002f2f2f2f00ULL, 0xfd0000fdfdfdfd00ULL, 0xb40000b4b4b4b400ULL, - 0x5900005959595900ULL, 0x7800007878787800ULL, 0x9800009898989800ULL, - 0x0600000606060600ULL, 0x6a00006a6a6a6a00ULL, 0xe70000e7e7e7e700ULL, - 0x4600004646464600ULL, 0x7100007171717100ULL, 0xba0000babababa00ULL, - 0xd40000d4d4d4d400ULL, 0x2500002525252500ULL, 0xab0000abababab00ULL, - 0x4200004242424200ULL, 0x8800008888888800ULL, 0xa20000a2a2a2a200ULL, - 0x8d00008d8d8d8d00ULL, 0xfa0000fafafafa00ULL, 0x7200007272727200ULL, - 0x0700000707070700ULL, 0xb90000b9b9b9b900ULL, 0x5500005555555500ULL, - 0xf80000f8f8f8f800ULL, 0xee0000eeeeeeee00ULL, 0xac0000acacacac00ULL, - 0x0a00000a0a0a0a00ULL, 0x3600003636363600ULL, 0x4900004949494900ULL, - 0x2a00002a2a2a2a00ULL, 0x6800006868686800ULL, 0x3c00003c3c3c3c00ULL, - 0x3800003838383800ULL, 0xf10000f1f1f1f100ULL, 0xa40000a4a4a4a400ULL, - 0x4000004040404000ULL, 0x2800002828282800ULL, 0xd30000d3d3d3d300ULL, - 0x7b00007b7b7b7b00ULL, 0xbb0000bbbbbbbb00ULL, 0xc90000c9c9c9c900ULL, - 0x4300004343434300ULL, 0xc10000c1c1c1c100ULL, 0x1500001515151500ULL, - 0xe30000e3e3e3e300ULL, 0xad0000adadadad00ULL, 0xf40000f4f4f4f400ULL, - 0x7700007777777700ULL, 0xc70000c7c7c7c700ULL, 0x8000008080808000ULL, - 0x9e00009e9e9e9e00ULL, + 0x7000007070707000, 0x8200008282828200, 0x2c00002c2c2c2c00, + 0xec0000ecececec00, 0xb30000b3b3b3b300, 0x2700002727272700, + 0xc00000c0c0c0c000, 0xe50000e5e5e5e500, 0xe40000e4e4e4e400, + 0x8500008585858500, 0x5700005757575700, 0x3500003535353500, + 0xea0000eaeaeaea00, 0x0c00000c0c0c0c00, 0xae0000aeaeaeae00, + 0x4100004141414100, 0x2300002323232300, 0xef0000efefefef00, + 0x6b00006b6b6b6b00, 0x9300009393939300, 0x4500004545454500, + 0x1900001919191900, 0xa50000a5a5a5a500, 0x2100002121212100, + 0xed0000edededed00, 0x0e00000e0e0e0e00, 0x4f00004f4f4f4f00, + 0x4e00004e4e4e4e00, 0x1d00001d1d1d1d00, 0x6500006565656500, + 0x9200009292929200, 0xbd0000bdbdbdbd00, 0x8600008686868600, + 0xb80000b8b8b8b800, 0xaf0000afafafaf00, 0x8f00008f8f8f8f00, + 0x7c00007c7c7c7c00, 0xeb0000ebebebeb00, 0x1f00001f1f1f1f00, + 0xce0000cececece00, 0x3e00003e3e3e3e00, 0x3000003030303000, + 0xdc0000dcdcdcdc00, 0x5f00005f5f5f5f00, 0x5e00005e5e5e5e00, + 0xc50000c5c5c5c500, 0x0b00000b0b0b0b00, 0x1a00001a1a1a1a00, + 0xa60000a6a6a6a600, 0xe10000e1e1e1e100, 0x3900003939393900, + 0xca0000cacacaca00, 0xd50000d5d5d5d500, 0x4700004747474700, + 0x5d00005d5d5d5d00, 0x3d00003d3d3d3d00, 0xd90000d9d9d9d900, + 0x0100000101010100, 0x5a00005a5a5a5a00, 0xd60000d6d6d6d600, + 0x5100005151515100, 0x5600005656565600, 0x6c00006c6c6c6c00, + 0x4d00004d4d4d4d00, 0x8b00008b8b8b8b00, 0x0d00000d0d0d0d00, + 0x9a00009a9a9a9a00, 0x6600006666666600, 0xfb0000fbfbfbfb00, + 0xcc0000cccccccc00, 0xb00000b0b0b0b000, 0x2d00002d2d2d2d00, + 0x7400007474747400, 0x1200001212121200, 0x2b00002b2b2b2b00, + 0x2000002020202000, 0xf00000f0f0f0f000, 0xb10000b1b1b1b100, + 0x8400008484848400, 0x9900009999999900, 0xdf0000dfdfdfdf00, + 0x4c00004c4c4c4c00, 0xcb0000cbcbcbcb00, 0xc20000c2c2c2c200, + 0x3400003434343400, 0x7e00007e7e7e7e00, 0x7600007676767600, + 0x0500000505050500, 0x6d00006d6d6d6d00, 0xb70000b7b7b7b700, + 0xa90000a9a9a9a900, 0x3100003131313100, 0xd10000d1d1d1d100, + 0x1700001717171700, 0x0400000404040400, 0xd70000d7d7d7d700, + 0x1400001414141400, 0x5800005858585800, 0x3a00003a3a3a3a00, + 0x6100006161616100, 0xde0000dededede00, 0x1b00001b1b1b1b00, + 0x1100001111111100, 0x1c00001c1c1c1c00, 0x3200003232323200, + 0x0f00000f0f0f0f00, 0x9c00009c9c9c9c00, 0x1600001616161600, + 0x5300005353535300, 0x1800001818181800, 0xf20000f2f2f2f200, + 0x2200002222222200, 0xfe0000fefefefe00, 0x4400004444444400, + 0xcf0000cfcfcfcf00, 0xb20000b2b2b2b200, 0xc30000c3c3c3c300, + 0xb50000b5b5b5b500, 0x7a00007a7a7a7a00, 0x9100009191919100, + 0x2400002424242400, 0x0800000808080800, 0xe80000e8e8e8e800, + 0xa80000a8a8a8a800, 0x6000006060606000, 0xfc0000fcfcfcfc00, + 0x6900006969696900, 0x5000005050505000, 0xaa0000aaaaaaaa00, + 0xd00000d0d0d0d000, 0xa00000a0a0a0a000, 0x7d00007d7d7d7d00, + 0xa10000a1a1a1a100, 0x8900008989898900, 0x6200006262626200, + 0x9700009797979700, 0x5400005454545400, 0x5b00005b5b5b5b00, + 0x1e00001e1e1e1e00, 0x9500009595959500, 0xe00000e0e0e0e000, + 0xff0000ffffffff00, 0x6400006464646400, 0xd20000d2d2d2d200, + 0x1000001010101000, 0xc40000c4c4c4c400, 0x0000000000000000, + 0x4800004848484800, 0xa30000a3a3a3a300, 0xf70000f7f7f7f700, + 0x7500007575757500, 0xdb0000dbdbdbdb00, 0x8a00008a8a8a8a00, + 0x0300000303030300, 0xe60000e6e6e6e600, 0xda0000dadadada00, + 0x0900000909090900, 0x3f00003f3f3f3f00, 0xdd0000dddddddd00, + 0x9400009494949400, 0x8700008787878700, 0x5c00005c5c5c5c00, + 0x8300008383838300, 0x0200000202020200, 0xcd0000cdcdcdcd00, + 0x4a00004a4a4a4a00, 0x9000009090909000, 0x3300003333333300, + 0x7300007373737300, 0x6700006767676700, 0xf60000f6f6f6f600, + 0xf30000f3f3f3f300, 0x9d00009d9d9d9d00, 0x7f00007f7f7f7f00, + 0xbf0000bfbfbfbf00, 0xe20000e2e2e2e200, 0x5200005252525200, + 0x9b00009b9b9b9b00, 0xd80000d8d8d8d800, 0x2600002626262600, + 0xc80000c8c8c8c800, 0x3700003737373700, 0xc60000c6c6c6c600, + 0x3b00003b3b3b3b00, 0x8100008181818100, 0x9600009696969600, + 0x6f00006f6f6f6f00, 0x4b00004b4b4b4b00, 0x1300001313131300, + 0xbe0000bebebebe00, 0x6300006363636300, 0x2e00002e2e2e2e00, + 0xe90000e9e9e9e900, 0x7900007979797900, 0xa70000a7a7a7a700, + 0x8c00008c8c8c8c00, 0x9f00009f9f9f9f00, 0x6e00006e6e6e6e00, + 0xbc0000bcbcbcbc00, 0x8e00008e8e8e8e00, 0x2900002929292900, + 0xf50000f5f5f5f500, 0xf90000f9f9f9f900, 0xb60000b6b6b6b600, + 0x2f00002f2f2f2f00, 0xfd0000fdfdfdfd00, 0xb40000b4b4b4b400, + 0x5900005959595900, 0x7800007878787800, 0x9800009898989800, + 0x0600000606060600, 0x6a00006a6a6a6a00, 0xe70000e7e7e7e700, + 0x4600004646464600, 0x7100007171717100, 0xba0000babababa00, + 0xd40000d4d4d4d400, 0x2500002525252500, 0xab0000abababab00, + 0x4200004242424200, 0x8800008888888800, 0xa20000a2a2a2a200, + 0x8d00008d8d8d8d00, 0xfa0000fafafafa00, 0x7200007272727200, + 0x0700000707070700, 0xb90000b9b9b9b900, 0x5500005555555500, + 0xf80000f8f8f8f800, 0xee0000eeeeeeee00, 0xac0000acacacac00, + 0x0a00000a0a0a0a00, 0x3600003636363600, 0x4900004949494900, + 0x2a00002a2a2a2a00, 0x6800006868686800, 0x3c00003c3c3c3c00, + 0x3800003838383800, 0xf10000f1f1f1f100, 0xa40000a4a4a4a400, + 0x4000004040404000, 0x2800002828282800, 0xd30000d3d3d3d300, + 0x7b00007b7b7b7b00, 0xbb0000bbbbbbbb00, 0xc90000c9c9c9c900, + 0x4300004343434300, 0xc10000c1c1c1c100, 0x1500001515151500, + 0xe30000e3e3e3e300, 0xad0000adadadad00, 0xf40000f4f4f4f400, + 0x7700007777777700, 0xc70000c7c7c7c700, 0x8000008080808000, + 0x9e00009e9e9e9e00, }; const u64 camellia_sp22000222[256] = { - 0xe0e0000000e0e0e0ULL, 0x0505000000050505ULL, 0x5858000000585858ULL, - 0xd9d9000000d9d9d9ULL, 0x6767000000676767ULL, 0x4e4e0000004e4e4eULL, - 0x8181000000818181ULL, 0xcbcb000000cbcbcbULL, 0xc9c9000000c9c9c9ULL, - 0x0b0b0000000b0b0bULL, 0xaeae000000aeaeaeULL, 0x6a6a0000006a6a6aULL, - 0xd5d5000000d5d5d5ULL, 0x1818000000181818ULL, 0x5d5d0000005d5d5dULL, - 0x8282000000828282ULL, 0x4646000000464646ULL, 0xdfdf000000dfdfdfULL, - 0xd6d6000000d6d6d6ULL, 0x2727000000272727ULL, 0x8a8a0000008a8a8aULL, - 0x3232000000323232ULL, 0x4b4b0000004b4b4bULL, 0x4242000000424242ULL, - 0xdbdb000000dbdbdbULL, 0x1c1c0000001c1c1cULL, 0x9e9e0000009e9e9eULL, - 0x9c9c0000009c9c9cULL, 0x3a3a0000003a3a3aULL, 0xcaca000000cacacaULL, - 0x2525000000252525ULL, 0x7b7b0000007b7b7bULL, 0x0d0d0000000d0d0dULL, - 0x7171000000717171ULL, 0x5f5f0000005f5f5fULL, 0x1f1f0000001f1f1fULL, - 0xf8f8000000f8f8f8ULL, 0xd7d7000000d7d7d7ULL, 0x3e3e0000003e3e3eULL, - 0x9d9d0000009d9d9dULL, 0x7c7c0000007c7c7cULL, 0x6060000000606060ULL, - 0xb9b9000000b9b9b9ULL, 0xbebe000000bebebeULL, 0xbcbc000000bcbcbcULL, - 0x8b8b0000008b8b8bULL, 0x1616000000161616ULL, 0x3434000000343434ULL, - 0x4d4d0000004d4d4dULL, 0xc3c3000000c3c3c3ULL, 0x7272000000727272ULL, - 0x9595000000959595ULL, 0xabab000000abababULL, 0x8e8e0000008e8e8eULL, - 0xbaba000000bababaULL, 0x7a7a0000007a7a7aULL, 0xb3b3000000b3b3b3ULL, - 0x0202000000020202ULL, 0xb4b4000000b4b4b4ULL, 0xadad000000adadadULL, - 0xa2a2000000a2a2a2ULL, 0xacac000000acacacULL, 0xd8d8000000d8d8d8ULL, - 0x9a9a0000009a9a9aULL, 0x1717000000171717ULL, 0x1a1a0000001a1a1aULL, - 0x3535000000353535ULL, 0xcccc000000ccccccULL, 0xf7f7000000f7f7f7ULL, - 0x9999000000999999ULL, 0x6161000000616161ULL, 0x5a5a0000005a5a5aULL, - 0xe8e8000000e8e8e8ULL, 0x2424000000242424ULL, 0x5656000000565656ULL, - 0x4040000000404040ULL, 0xe1e1000000e1e1e1ULL, 0x6363000000636363ULL, - 0x0909000000090909ULL, 0x3333000000333333ULL, 0xbfbf000000bfbfbfULL, - 0x9898000000989898ULL, 0x9797000000979797ULL, 0x8585000000858585ULL, - 0x6868000000686868ULL, 0xfcfc000000fcfcfcULL, 0xecec000000ecececULL, - 0x0a0a0000000a0a0aULL, 0xdada000000dadadaULL, 0x6f6f0000006f6f6fULL, - 0x5353000000535353ULL, 0x6262000000626262ULL, 0xa3a3000000a3a3a3ULL, - 0x2e2e0000002e2e2eULL, 0x0808000000080808ULL, 0xafaf000000afafafULL, - 0x2828000000282828ULL, 0xb0b0000000b0b0b0ULL, 0x7474000000747474ULL, - 0xc2c2000000c2c2c2ULL, 0xbdbd000000bdbdbdULL, 0x3636000000363636ULL, - 0x2222000000222222ULL, 0x3838000000383838ULL, 0x6464000000646464ULL, - 0x1e1e0000001e1e1eULL, 0x3939000000393939ULL, 0x2c2c0000002c2c2cULL, - 0xa6a6000000a6a6a6ULL, 0x3030000000303030ULL, 0xe5e5000000e5e5e5ULL, - 0x4444000000444444ULL, 0xfdfd000000fdfdfdULL, 0x8888000000888888ULL, - 0x9f9f0000009f9f9fULL, 0x6565000000656565ULL, 0x8787000000878787ULL, - 0x6b6b0000006b6b6bULL, 0xf4f4000000f4f4f4ULL, 0x2323000000232323ULL, - 0x4848000000484848ULL, 0x1010000000101010ULL, 0xd1d1000000d1d1d1ULL, - 0x5151000000515151ULL, 0xc0c0000000c0c0c0ULL, 0xf9f9000000f9f9f9ULL, - 0xd2d2000000d2d2d2ULL, 0xa0a0000000a0a0a0ULL, 0x5555000000555555ULL, - 0xa1a1000000a1a1a1ULL, 0x4141000000414141ULL, 0xfafa000000fafafaULL, - 0x4343000000434343ULL, 0x1313000000131313ULL, 0xc4c4000000c4c4c4ULL, - 0x2f2f0000002f2f2fULL, 0xa8a8000000a8a8a8ULL, 0xb6b6000000b6b6b6ULL, - 0x3c3c0000003c3c3cULL, 0x2b2b0000002b2b2bULL, 0xc1c1000000c1c1c1ULL, - 0xffff000000ffffffULL, 0xc8c8000000c8c8c8ULL, 0xa5a5000000a5a5a5ULL, - 0x2020000000202020ULL, 0x8989000000898989ULL, 0x0000000000000000ULL, - 0x9090000000909090ULL, 0x4747000000474747ULL, 0xefef000000efefefULL, - 0xeaea000000eaeaeaULL, 0xb7b7000000b7b7b7ULL, 0x1515000000151515ULL, - 0x0606000000060606ULL, 0xcdcd000000cdcdcdULL, 0xb5b5000000b5b5b5ULL, - 0x1212000000121212ULL, 0x7e7e0000007e7e7eULL, 0xbbbb000000bbbbbbULL, - 0x2929000000292929ULL, 0x0f0f0000000f0f0fULL, 0xb8b8000000b8b8b8ULL, - 0x0707000000070707ULL, 0x0404000000040404ULL, 0x9b9b0000009b9b9bULL, - 0x9494000000949494ULL, 0x2121000000212121ULL, 0x6666000000666666ULL, - 0xe6e6000000e6e6e6ULL, 0xcece000000cececeULL, 0xeded000000edededULL, - 0xe7e7000000e7e7e7ULL, 0x3b3b0000003b3b3bULL, 0xfefe000000fefefeULL, - 0x7f7f0000007f7f7fULL, 0xc5c5000000c5c5c5ULL, 0xa4a4000000a4a4a4ULL, - 0x3737000000373737ULL, 0xb1b1000000b1b1b1ULL, 0x4c4c0000004c4c4cULL, - 0x9191000000919191ULL, 0x6e6e0000006e6e6eULL, 0x8d8d0000008d8d8dULL, - 0x7676000000767676ULL, 0x0303000000030303ULL, 0x2d2d0000002d2d2dULL, - 0xdede000000dededeULL, 0x9696000000969696ULL, 0x2626000000262626ULL, - 0x7d7d0000007d7d7dULL, 0xc6c6000000c6c6c6ULL, 0x5c5c0000005c5c5cULL, - 0xd3d3000000d3d3d3ULL, 0xf2f2000000f2f2f2ULL, 0x4f4f0000004f4f4fULL, - 0x1919000000191919ULL, 0x3f3f0000003f3f3fULL, 0xdcdc000000dcdcdcULL, - 0x7979000000797979ULL, 0x1d1d0000001d1d1dULL, 0x5252000000525252ULL, - 0xebeb000000ebebebULL, 0xf3f3000000f3f3f3ULL, 0x6d6d0000006d6d6dULL, - 0x5e5e0000005e5e5eULL, 0xfbfb000000fbfbfbULL, 0x6969000000696969ULL, - 0xb2b2000000b2b2b2ULL, 0xf0f0000000f0f0f0ULL, 0x3131000000313131ULL, - 0x0c0c0000000c0c0cULL, 0xd4d4000000d4d4d4ULL, 0xcfcf000000cfcfcfULL, - 0x8c8c0000008c8c8cULL, 0xe2e2000000e2e2e2ULL, 0x7575000000757575ULL, - 0xa9a9000000a9a9a9ULL, 0x4a4a0000004a4a4aULL, 0x5757000000575757ULL, - 0x8484000000848484ULL, 0x1111000000111111ULL, 0x4545000000454545ULL, - 0x1b1b0000001b1b1bULL, 0xf5f5000000f5f5f5ULL, 0xe4e4000000e4e4e4ULL, - 0x0e0e0000000e0e0eULL, 0x7373000000737373ULL, 0xaaaa000000aaaaaaULL, - 0xf1f1000000f1f1f1ULL, 0xdddd000000ddddddULL, 0x5959000000595959ULL, - 0x1414000000141414ULL, 0x6c6c0000006c6c6cULL, 0x9292000000929292ULL, - 0x5454000000545454ULL, 0xd0d0000000d0d0d0ULL, 0x7878000000787878ULL, - 0x7070000000707070ULL, 0xe3e3000000e3e3e3ULL, 0x4949000000494949ULL, - 0x8080000000808080ULL, 0x5050000000505050ULL, 0xa7a7000000a7a7a7ULL, - 0xf6f6000000f6f6f6ULL, 0x7777000000777777ULL, 0x9393000000939393ULL, - 0x8686000000868686ULL, 0x8383000000838383ULL, 0x2a2a0000002a2a2aULL, - 0xc7c7000000c7c7c7ULL, 0x5b5b0000005b5b5bULL, 0xe9e9000000e9e9e9ULL, - 0xeeee000000eeeeeeULL, 0x8f8f0000008f8f8fULL, 0x0101000000010101ULL, - 0x3d3d0000003d3d3dULL, + 0xe0e0000000e0e0e0, 0x0505000000050505, 0x5858000000585858, + 0xd9d9000000d9d9d9, 0x6767000000676767, 0x4e4e0000004e4e4e, + 0x8181000000818181, 0xcbcb000000cbcbcb, 0xc9c9000000c9c9c9, + 0x0b0b0000000b0b0b, 0xaeae000000aeaeae, 0x6a6a0000006a6a6a, + 0xd5d5000000d5d5d5, 0x1818000000181818, 0x5d5d0000005d5d5d, + 0x8282000000828282, 0x4646000000464646, 0xdfdf000000dfdfdf, + 0xd6d6000000d6d6d6, 0x2727000000272727, 0x8a8a0000008a8a8a, + 0x3232000000323232, 0x4b4b0000004b4b4b, 0x4242000000424242, + 0xdbdb000000dbdbdb, 0x1c1c0000001c1c1c, 0x9e9e0000009e9e9e, + 0x9c9c0000009c9c9c, 0x3a3a0000003a3a3a, 0xcaca000000cacaca, + 0x2525000000252525, 0x7b7b0000007b7b7b, 0x0d0d0000000d0d0d, + 0x7171000000717171, 0x5f5f0000005f5f5f, 0x1f1f0000001f1f1f, + 0xf8f8000000f8f8f8, 0xd7d7000000d7d7d7, 0x3e3e0000003e3e3e, + 0x9d9d0000009d9d9d, 0x7c7c0000007c7c7c, 0x6060000000606060, + 0xb9b9000000b9b9b9, 0xbebe000000bebebe, 0xbcbc000000bcbcbc, + 0x8b8b0000008b8b8b, 0x1616000000161616, 0x3434000000343434, + 0x4d4d0000004d4d4d, 0xc3c3000000c3c3c3, 0x7272000000727272, + 0x9595000000959595, 0xabab000000ababab, 0x8e8e0000008e8e8e, + 0xbaba000000bababa, 0x7a7a0000007a7a7a, 0xb3b3000000b3b3b3, + 0x0202000000020202, 0xb4b4000000b4b4b4, 0xadad000000adadad, + 0xa2a2000000a2a2a2, 0xacac000000acacac, 0xd8d8000000d8d8d8, + 0x9a9a0000009a9a9a, 0x1717000000171717, 0x1a1a0000001a1a1a, + 0x3535000000353535, 0xcccc000000cccccc, 0xf7f7000000f7f7f7, + 0x9999000000999999, 0x6161000000616161, 0x5a5a0000005a5a5a, + 0xe8e8000000e8e8e8, 0x2424000000242424, 0x5656000000565656, + 0x4040000000404040, 0xe1e1000000e1e1e1, 0x6363000000636363, + 0x0909000000090909, 0x3333000000333333, 0xbfbf000000bfbfbf, + 0x9898000000989898, 0x9797000000979797, 0x8585000000858585, + 0x6868000000686868, 0xfcfc000000fcfcfc, 0xecec000000ececec, + 0x0a0a0000000a0a0a, 0xdada000000dadada, 0x6f6f0000006f6f6f, + 0x5353000000535353, 0x6262000000626262, 0xa3a3000000a3a3a3, + 0x2e2e0000002e2e2e, 0x0808000000080808, 0xafaf000000afafaf, + 0x2828000000282828, 0xb0b0000000b0b0b0, 0x7474000000747474, + 0xc2c2000000c2c2c2, 0xbdbd000000bdbdbd, 0x3636000000363636, + 0x2222000000222222, 0x3838000000383838, 0x6464000000646464, + 0x1e1e0000001e1e1e, 0x3939000000393939, 0x2c2c0000002c2c2c, + 0xa6a6000000a6a6a6, 0x3030000000303030, 0xe5e5000000e5e5e5, + 0x4444000000444444, 0xfdfd000000fdfdfd, 0x8888000000888888, + 0x9f9f0000009f9f9f, 0x6565000000656565, 0x8787000000878787, + 0x6b6b0000006b6b6b, 0xf4f4000000f4f4f4, 0x2323000000232323, + 0x4848000000484848, 0x1010000000101010, 0xd1d1000000d1d1d1, + 0x5151000000515151, 0xc0c0000000c0c0c0, 0xf9f9000000f9f9f9, + 0xd2d2000000d2d2d2, 0xa0a0000000a0a0a0, 0x5555000000555555, + 0xa1a1000000a1a1a1, 0x4141000000414141, 0xfafa000000fafafa, + 0x4343000000434343, 0x1313000000131313, 0xc4c4000000c4c4c4, + 0x2f2f0000002f2f2f, 0xa8a8000000a8a8a8, 0xb6b6000000b6b6b6, + 0x3c3c0000003c3c3c, 0x2b2b0000002b2b2b, 0xc1c1000000c1c1c1, + 0xffff000000ffffff, 0xc8c8000000c8c8c8, 0xa5a5000000a5a5a5, + 0x2020000000202020, 0x8989000000898989, 0x0000000000000000, + 0x9090000000909090, 0x4747000000474747, 0xefef000000efefef, + 0xeaea000000eaeaea, 0xb7b7000000b7b7b7, 0x1515000000151515, + 0x0606000000060606, 0xcdcd000000cdcdcd, 0xb5b5000000b5b5b5, + 0x1212000000121212, 0x7e7e0000007e7e7e, 0xbbbb000000bbbbbb, + 0x2929000000292929, 0x0f0f0000000f0f0f, 0xb8b8000000b8b8b8, + 0x0707000000070707, 0x0404000000040404, 0x9b9b0000009b9b9b, + 0x9494000000949494, 0x2121000000212121, 0x6666000000666666, + 0xe6e6000000e6e6e6, 0xcece000000cecece, 0xeded000000ededed, + 0xe7e7000000e7e7e7, 0x3b3b0000003b3b3b, 0xfefe000000fefefe, + 0x7f7f0000007f7f7f, 0xc5c5000000c5c5c5, 0xa4a4000000a4a4a4, + 0x3737000000373737, 0xb1b1000000b1b1b1, 0x4c4c0000004c4c4c, + 0x9191000000919191, 0x6e6e0000006e6e6e, 0x8d8d0000008d8d8d, + 0x7676000000767676, 0x0303000000030303, 0x2d2d0000002d2d2d, + 0xdede000000dedede, 0x9696000000969696, 0x2626000000262626, + 0x7d7d0000007d7d7d, 0xc6c6000000c6c6c6, 0x5c5c0000005c5c5c, + 0xd3d3000000d3d3d3, 0xf2f2000000f2f2f2, 0x4f4f0000004f4f4f, + 0x1919000000191919, 0x3f3f0000003f3f3f, 0xdcdc000000dcdcdc, + 0x7979000000797979, 0x1d1d0000001d1d1d, 0x5252000000525252, + 0xebeb000000ebebeb, 0xf3f3000000f3f3f3, 0x6d6d0000006d6d6d, + 0x5e5e0000005e5e5e, 0xfbfb000000fbfbfb, 0x6969000000696969, + 0xb2b2000000b2b2b2, 0xf0f0000000f0f0f0, 0x3131000000313131, + 0x0c0c0000000c0c0c, 0xd4d4000000d4d4d4, 0xcfcf000000cfcfcf, + 0x8c8c0000008c8c8c, 0xe2e2000000e2e2e2, 0x7575000000757575, + 0xa9a9000000a9a9a9, 0x4a4a0000004a4a4a, 0x5757000000575757, + 0x8484000000848484, 0x1111000000111111, 0x4545000000454545, + 0x1b1b0000001b1b1b, 0xf5f5000000f5f5f5, 0xe4e4000000e4e4e4, + 0x0e0e0000000e0e0e, 0x7373000000737373, 0xaaaa000000aaaaaa, + 0xf1f1000000f1f1f1, 0xdddd000000dddddd, 0x5959000000595959, + 0x1414000000141414, 0x6c6c0000006c6c6c, 0x9292000000929292, + 0x5454000000545454, 0xd0d0000000d0d0d0, 0x7878000000787878, + 0x7070000000707070, 0xe3e3000000e3e3e3, 0x4949000000494949, + 0x8080000000808080, 0x5050000000505050, 0xa7a7000000a7a7a7, + 0xf6f6000000f6f6f6, 0x7777000000777777, 0x9393000000939393, + 0x8686000000868686, 0x8383000000838383, 0x2a2a0000002a2a2a, + 0xc7c7000000c7c7c7, 0x5b5b0000005b5b5b, 0xe9e9000000e9e9e9, + 0xeeee000000eeeeee, 0x8f8f0000008f8f8f, 0x0101000000010101, + 0x3d3d0000003d3d3d, }; const u64 camellia_sp03303033[256] = { - 0x0038380038003838ULL, 0x0041410041004141ULL, 0x0016160016001616ULL, - 0x0076760076007676ULL, 0x00d9d900d900d9d9ULL, 0x0093930093009393ULL, - 0x0060600060006060ULL, 0x00f2f200f200f2f2ULL, 0x0072720072007272ULL, - 0x00c2c200c200c2c2ULL, 0x00abab00ab00ababULL, 0x009a9a009a009a9aULL, - 0x0075750075007575ULL, 0x0006060006000606ULL, 0x0057570057005757ULL, - 0x00a0a000a000a0a0ULL, 0x0091910091009191ULL, 0x00f7f700f700f7f7ULL, - 0x00b5b500b500b5b5ULL, 0x00c9c900c900c9c9ULL, 0x00a2a200a200a2a2ULL, - 0x008c8c008c008c8cULL, 0x00d2d200d200d2d2ULL, 0x0090900090009090ULL, - 0x00f6f600f600f6f6ULL, 0x0007070007000707ULL, 0x00a7a700a700a7a7ULL, - 0x0027270027002727ULL, 0x008e8e008e008e8eULL, 0x00b2b200b200b2b2ULL, - 0x0049490049004949ULL, 0x00dede00de00dedeULL, 0x0043430043004343ULL, - 0x005c5c005c005c5cULL, 0x00d7d700d700d7d7ULL, 0x00c7c700c700c7c7ULL, - 0x003e3e003e003e3eULL, 0x00f5f500f500f5f5ULL, 0x008f8f008f008f8fULL, - 0x0067670067006767ULL, 0x001f1f001f001f1fULL, 0x0018180018001818ULL, - 0x006e6e006e006e6eULL, 0x00afaf00af00afafULL, 0x002f2f002f002f2fULL, - 0x00e2e200e200e2e2ULL, 0x0085850085008585ULL, 0x000d0d000d000d0dULL, - 0x0053530053005353ULL, 0x00f0f000f000f0f0ULL, 0x009c9c009c009c9cULL, - 0x0065650065006565ULL, 0x00eaea00ea00eaeaULL, 0x00a3a300a300a3a3ULL, - 0x00aeae00ae00aeaeULL, 0x009e9e009e009e9eULL, 0x00ecec00ec00ececULL, - 0x0080800080008080ULL, 0x002d2d002d002d2dULL, 0x006b6b006b006b6bULL, - 0x00a8a800a800a8a8ULL, 0x002b2b002b002b2bULL, 0x0036360036003636ULL, - 0x00a6a600a600a6a6ULL, 0x00c5c500c500c5c5ULL, 0x0086860086008686ULL, - 0x004d4d004d004d4dULL, 0x0033330033003333ULL, 0x00fdfd00fd00fdfdULL, - 0x0066660066006666ULL, 0x0058580058005858ULL, 0x0096960096009696ULL, - 0x003a3a003a003a3aULL, 0x0009090009000909ULL, 0x0095950095009595ULL, - 0x0010100010001010ULL, 0x0078780078007878ULL, 0x00d8d800d800d8d8ULL, - 0x0042420042004242ULL, 0x00cccc00cc00ccccULL, 0x00efef00ef00efefULL, - 0x0026260026002626ULL, 0x00e5e500e500e5e5ULL, 0x0061610061006161ULL, - 0x001a1a001a001a1aULL, 0x003f3f003f003f3fULL, 0x003b3b003b003b3bULL, - 0x0082820082008282ULL, 0x00b6b600b600b6b6ULL, 0x00dbdb00db00dbdbULL, - 0x00d4d400d400d4d4ULL, 0x0098980098009898ULL, 0x00e8e800e800e8e8ULL, - 0x008b8b008b008b8bULL, 0x0002020002000202ULL, 0x00ebeb00eb00ebebULL, - 0x000a0a000a000a0aULL, 0x002c2c002c002c2cULL, 0x001d1d001d001d1dULL, - 0x00b0b000b000b0b0ULL, 0x006f6f006f006f6fULL, 0x008d8d008d008d8dULL, - 0x0088880088008888ULL, 0x000e0e000e000e0eULL, 0x0019190019001919ULL, - 0x0087870087008787ULL, 0x004e4e004e004e4eULL, 0x000b0b000b000b0bULL, - 0x00a9a900a900a9a9ULL, 0x000c0c000c000c0cULL, 0x0079790079007979ULL, - 0x0011110011001111ULL, 0x007f7f007f007f7fULL, 0x0022220022002222ULL, - 0x00e7e700e700e7e7ULL, 0x0059590059005959ULL, 0x00e1e100e100e1e1ULL, - 0x00dada00da00dadaULL, 0x003d3d003d003d3dULL, 0x00c8c800c800c8c8ULL, - 0x0012120012001212ULL, 0x0004040004000404ULL, 0x0074740074007474ULL, - 0x0054540054005454ULL, 0x0030300030003030ULL, 0x007e7e007e007e7eULL, - 0x00b4b400b400b4b4ULL, 0x0028280028002828ULL, 0x0055550055005555ULL, - 0x0068680068006868ULL, 0x0050500050005050ULL, 0x00bebe00be00bebeULL, - 0x00d0d000d000d0d0ULL, 0x00c4c400c400c4c4ULL, 0x0031310031003131ULL, - 0x00cbcb00cb00cbcbULL, 0x002a2a002a002a2aULL, 0x00adad00ad00adadULL, - 0x000f0f000f000f0fULL, 0x00caca00ca00cacaULL, 0x0070700070007070ULL, - 0x00ffff00ff00ffffULL, 0x0032320032003232ULL, 0x0069690069006969ULL, - 0x0008080008000808ULL, 0x0062620062006262ULL, 0x0000000000000000ULL, - 0x0024240024002424ULL, 0x00d1d100d100d1d1ULL, 0x00fbfb00fb00fbfbULL, - 0x00baba00ba00babaULL, 0x00eded00ed00ededULL, 0x0045450045004545ULL, - 0x0081810081008181ULL, 0x0073730073007373ULL, 0x006d6d006d006d6dULL, - 0x0084840084008484ULL, 0x009f9f009f009f9fULL, 0x00eeee00ee00eeeeULL, - 0x004a4a004a004a4aULL, 0x00c3c300c300c3c3ULL, 0x002e2e002e002e2eULL, - 0x00c1c100c100c1c1ULL, 0x0001010001000101ULL, 0x00e6e600e600e6e6ULL, - 0x0025250025002525ULL, 0x0048480048004848ULL, 0x0099990099009999ULL, - 0x00b9b900b900b9b9ULL, 0x00b3b300b300b3b3ULL, 0x007b7b007b007b7bULL, - 0x00f9f900f900f9f9ULL, 0x00cece00ce00ceceULL, 0x00bfbf00bf00bfbfULL, - 0x00dfdf00df00dfdfULL, 0x0071710071007171ULL, 0x0029290029002929ULL, - 0x00cdcd00cd00cdcdULL, 0x006c6c006c006c6cULL, 0x0013130013001313ULL, - 0x0064640064006464ULL, 0x009b9b009b009b9bULL, 0x0063630063006363ULL, - 0x009d9d009d009d9dULL, 0x00c0c000c000c0c0ULL, 0x004b4b004b004b4bULL, - 0x00b7b700b700b7b7ULL, 0x00a5a500a500a5a5ULL, 0x0089890089008989ULL, - 0x005f5f005f005f5fULL, 0x00b1b100b100b1b1ULL, 0x0017170017001717ULL, - 0x00f4f400f400f4f4ULL, 0x00bcbc00bc00bcbcULL, 0x00d3d300d300d3d3ULL, - 0x0046460046004646ULL, 0x00cfcf00cf00cfcfULL, 0x0037370037003737ULL, - 0x005e5e005e005e5eULL, 0x0047470047004747ULL, 0x0094940094009494ULL, - 0x00fafa00fa00fafaULL, 0x00fcfc00fc00fcfcULL, 0x005b5b005b005b5bULL, - 0x0097970097009797ULL, 0x00fefe00fe00fefeULL, 0x005a5a005a005a5aULL, - 0x00acac00ac00acacULL, 0x003c3c003c003c3cULL, 0x004c4c004c004c4cULL, - 0x0003030003000303ULL, 0x0035350035003535ULL, 0x00f3f300f300f3f3ULL, - 0x0023230023002323ULL, 0x00b8b800b800b8b8ULL, 0x005d5d005d005d5dULL, - 0x006a6a006a006a6aULL, 0x0092920092009292ULL, 0x00d5d500d500d5d5ULL, - 0x0021210021002121ULL, 0x0044440044004444ULL, 0x0051510051005151ULL, - 0x00c6c600c600c6c6ULL, 0x007d7d007d007d7dULL, 0x0039390039003939ULL, - 0x0083830083008383ULL, 0x00dcdc00dc00dcdcULL, 0x00aaaa00aa00aaaaULL, - 0x007c7c007c007c7cULL, 0x0077770077007777ULL, 0x0056560056005656ULL, - 0x0005050005000505ULL, 0x001b1b001b001b1bULL, 0x00a4a400a400a4a4ULL, - 0x0015150015001515ULL, 0x0034340034003434ULL, 0x001e1e001e001e1eULL, - 0x001c1c001c001c1cULL, 0x00f8f800f800f8f8ULL, 0x0052520052005252ULL, - 0x0020200020002020ULL, 0x0014140014001414ULL, 0x00e9e900e900e9e9ULL, - 0x00bdbd00bd00bdbdULL, 0x00dddd00dd00ddddULL, 0x00e4e400e400e4e4ULL, - 0x00a1a100a100a1a1ULL, 0x00e0e000e000e0e0ULL, 0x008a8a008a008a8aULL, - 0x00f1f100f100f1f1ULL, 0x00d6d600d600d6d6ULL, 0x007a7a007a007a7aULL, - 0x00bbbb00bb00bbbbULL, 0x00e3e300e300e3e3ULL, 0x0040400040004040ULL, - 0x004f4f004f004f4fULL, + 0x0038380038003838, 0x0041410041004141, 0x0016160016001616, + 0x0076760076007676, 0x00d9d900d900d9d9, 0x0093930093009393, + 0x0060600060006060, 0x00f2f200f200f2f2, 0x0072720072007272, + 0x00c2c200c200c2c2, 0x00abab00ab00abab, 0x009a9a009a009a9a, + 0x0075750075007575, 0x0006060006000606, 0x0057570057005757, + 0x00a0a000a000a0a0, 0x0091910091009191, 0x00f7f700f700f7f7, + 0x00b5b500b500b5b5, 0x00c9c900c900c9c9, 0x00a2a200a200a2a2, + 0x008c8c008c008c8c, 0x00d2d200d200d2d2, 0x0090900090009090, + 0x00f6f600f600f6f6, 0x0007070007000707, 0x00a7a700a700a7a7, + 0x0027270027002727, 0x008e8e008e008e8e, 0x00b2b200b200b2b2, + 0x0049490049004949, 0x00dede00de00dede, 0x0043430043004343, + 0x005c5c005c005c5c, 0x00d7d700d700d7d7, 0x00c7c700c700c7c7, + 0x003e3e003e003e3e, 0x00f5f500f500f5f5, 0x008f8f008f008f8f, + 0x0067670067006767, 0x001f1f001f001f1f, 0x0018180018001818, + 0x006e6e006e006e6e, 0x00afaf00af00afaf, 0x002f2f002f002f2f, + 0x00e2e200e200e2e2, 0x0085850085008585, 0x000d0d000d000d0d, + 0x0053530053005353, 0x00f0f000f000f0f0, 0x009c9c009c009c9c, + 0x0065650065006565, 0x00eaea00ea00eaea, 0x00a3a300a300a3a3, + 0x00aeae00ae00aeae, 0x009e9e009e009e9e, 0x00ecec00ec00ecec, + 0x0080800080008080, 0x002d2d002d002d2d, 0x006b6b006b006b6b, + 0x00a8a800a800a8a8, 0x002b2b002b002b2b, 0x0036360036003636, + 0x00a6a600a600a6a6, 0x00c5c500c500c5c5, 0x0086860086008686, + 0x004d4d004d004d4d, 0x0033330033003333, 0x00fdfd00fd00fdfd, + 0x0066660066006666, 0x0058580058005858, 0x0096960096009696, + 0x003a3a003a003a3a, 0x0009090009000909, 0x0095950095009595, + 0x0010100010001010, 0x0078780078007878, 0x00d8d800d800d8d8, + 0x0042420042004242, 0x00cccc00cc00cccc, 0x00efef00ef00efef, + 0x0026260026002626, 0x00e5e500e500e5e5, 0x0061610061006161, + 0x001a1a001a001a1a, 0x003f3f003f003f3f, 0x003b3b003b003b3b, + 0x0082820082008282, 0x00b6b600b600b6b6, 0x00dbdb00db00dbdb, + 0x00d4d400d400d4d4, 0x0098980098009898, 0x00e8e800e800e8e8, + 0x008b8b008b008b8b, 0x0002020002000202, 0x00ebeb00eb00ebeb, + 0x000a0a000a000a0a, 0x002c2c002c002c2c, 0x001d1d001d001d1d, + 0x00b0b000b000b0b0, 0x006f6f006f006f6f, 0x008d8d008d008d8d, + 0x0088880088008888, 0x000e0e000e000e0e, 0x0019190019001919, + 0x0087870087008787, 0x004e4e004e004e4e, 0x000b0b000b000b0b, + 0x00a9a900a900a9a9, 0x000c0c000c000c0c, 0x0079790079007979, + 0x0011110011001111, 0x007f7f007f007f7f, 0x0022220022002222, + 0x00e7e700e700e7e7, 0x0059590059005959, 0x00e1e100e100e1e1, + 0x00dada00da00dada, 0x003d3d003d003d3d, 0x00c8c800c800c8c8, + 0x0012120012001212, 0x0004040004000404, 0x0074740074007474, + 0x0054540054005454, 0x0030300030003030, 0x007e7e007e007e7e, + 0x00b4b400b400b4b4, 0x0028280028002828, 0x0055550055005555, + 0x0068680068006868, 0x0050500050005050, 0x00bebe00be00bebe, + 0x00d0d000d000d0d0, 0x00c4c400c400c4c4, 0x0031310031003131, + 0x00cbcb00cb00cbcb, 0x002a2a002a002a2a, 0x00adad00ad00adad, + 0x000f0f000f000f0f, 0x00caca00ca00caca, 0x0070700070007070, + 0x00ffff00ff00ffff, 0x0032320032003232, 0x0069690069006969, + 0x0008080008000808, 0x0062620062006262, 0x0000000000000000, + 0x0024240024002424, 0x00d1d100d100d1d1, 0x00fbfb00fb00fbfb, + 0x00baba00ba00baba, 0x00eded00ed00eded, 0x0045450045004545, + 0x0081810081008181, 0x0073730073007373, 0x006d6d006d006d6d, + 0x0084840084008484, 0x009f9f009f009f9f, 0x00eeee00ee00eeee, + 0x004a4a004a004a4a, 0x00c3c300c300c3c3, 0x002e2e002e002e2e, + 0x00c1c100c100c1c1, 0x0001010001000101, 0x00e6e600e600e6e6, + 0x0025250025002525, 0x0048480048004848, 0x0099990099009999, + 0x00b9b900b900b9b9, 0x00b3b300b300b3b3, 0x007b7b007b007b7b, + 0x00f9f900f900f9f9, 0x00cece00ce00cece, 0x00bfbf00bf00bfbf, + 0x00dfdf00df00dfdf, 0x0071710071007171, 0x0029290029002929, + 0x00cdcd00cd00cdcd, 0x006c6c006c006c6c, 0x0013130013001313, + 0x0064640064006464, 0x009b9b009b009b9b, 0x0063630063006363, + 0x009d9d009d009d9d, 0x00c0c000c000c0c0, 0x004b4b004b004b4b, + 0x00b7b700b700b7b7, 0x00a5a500a500a5a5, 0x0089890089008989, + 0x005f5f005f005f5f, 0x00b1b100b100b1b1, 0x0017170017001717, + 0x00f4f400f400f4f4, 0x00bcbc00bc00bcbc, 0x00d3d300d300d3d3, + 0x0046460046004646, 0x00cfcf00cf00cfcf, 0x0037370037003737, + 0x005e5e005e005e5e, 0x0047470047004747, 0x0094940094009494, + 0x00fafa00fa00fafa, 0x00fcfc00fc00fcfc, 0x005b5b005b005b5b, + 0x0097970097009797, 0x00fefe00fe00fefe, 0x005a5a005a005a5a, + 0x00acac00ac00acac, 0x003c3c003c003c3c, 0x004c4c004c004c4c, + 0x0003030003000303, 0x0035350035003535, 0x00f3f300f300f3f3, + 0x0023230023002323, 0x00b8b800b800b8b8, 0x005d5d005d005d5d, + 0x006a6a006a006a6a, 0x0092920092009292, 0x00d5d500d500d5d5, + 0x0021210021002121, 0x0044440044004444, 0x0051510051005151, + 0x00c6c600c600c6c6, 0x007d7d007d007d7d, 0x0039390039003939, + 0x0083830083008383, 0x00dcdc00dc00dcdc, 0x00aaaa00aa00aaaa, + 0x007c7c007c007c7c, 0x0077770077007777, 0x0056560056005656, + 0x0005050005000505, 0x001b1b001b001b1b, 0x00a4a400a400a4a4, + 0x0015150015001515, 0x0034340034003434, 0x001e1e001e001e1e, + 0x001c1c001c001c1c, 0x00f8f800f800f8f8, 0x0052520052005252, + 0x0020200020002020, 0x0014140014001414, 0x00e9e900e900e9e9, + 0x00bdbd00bd00bdbd, 0x00dddd00dd00dddd, 0x00e4e400e400e4e4, + 0x00a1a100a100a1a1, 0x00e0e000e000e0e0, 0x008a8a008a008a8a, + 0x00f1f100f100f1f1, 0x00d6d600d600d6d6, 0x007a7a007a007a7a, + 0x00bbbb00bb00bbbb, 0x00e3e300e300e3e3, 0x0040400040004040, + 0x004f4f004f004f4f, }; const u64 camellia_sp00444404[256] = { - 0x0000707070700070ULL, 0x00002c2c2c2c002cULL, 0x0000b3b3b3b300b3ULL, - 0x0000c0c0c0c000c0ULL, 0x0000e4e4e4e400e4ULL, 0x0000575757570057ULL, - 0x0000eaeaeaea00eaULL, 0x0000aeaeaeae00aeULL, 0x0000232323230023ULL, - 0x00006b6b6b6b006bULL, 0x0000454545450045ULL, 0x0000a5a5a5a500a5ULL, - 0x0000edededed00edULL, 0x00004f4f4f4f004fULL, 0x00001d1d1d1d001dULL, - 0x0000929292920092ULL, 0x0000868686860086ULL, 0x0000afafafaf00afULL, - 0x00007c7c7c7c007cULL, 0x00001f1f1f1f001fULL, 0x00003e3e3e3e003eULL, - 0x0000dcdcdcdc00dcULL, 0x00005e5e5e5e005eULL, 0x00000b0b0b0b000bULL, - 0x0000a6a6a6a600a6ULL, 0x0000393939390039ULL, 0x0000d5d5d5d500d5ULL, - 0x00005d5d5d5d005dULL, 0x0000d9d9d9d900d9ULL, 0x00005a5a5a5a005aULL, - 0x0000515151510051ULL, 0x00006c6c6c6c006cULL, 0x00008b8b8b8b008bULL, - 0x00009a9a9a9a009aULL, 0x0000fbfbfbfb00fbULL, 0x0000b0b0b0b000b0ULL, - 0x0000747474740074ULL, 0x00002b2b2b2b002bULL, 0x0000f0f0f0f000f0ULL, - 0x0000848484840084ULL, 0x0000dfdfdfdf00dfULL, 0x0000cbcbcbcb00cbULL, - 0x0000343434340034ULL, 0x0000767676760076ULL, 0x00006d6d6d6d006dULL, - 0x0000a9a9a9a900a9ULL, 0x0000d1d1d1d100d1ULL, 0x0000040404040004ULL, - 0x0000141414140014ULL, 0x00003a3a3a3a003aULL, 0x0000dededede00deULL, - 0x0000111111110011ULL, 0x0000323232320032ULL, 0x00009c9c9c9c009cULL, - 0x0000535353530053ULL, 0x0000f2f2f2f200f2ULL, 0x0000fefefefe00feULL, - 0x0000cfcfcfcf00cfULL, 0x0000c3c3c3c300c3ULL, 0x00007a7a7a7a007aULL, - 0x0000242424240024ULL, 0x0000e8e8e8e800e8ULL, 0x0000606060600060ULL, - 0x0000696969690069ULL, 0x0000aaaaaaaa00aaULL, 0x0000a0a0a0a000a0ULL, - 0x0000a1a1a1a100a1ULL, 0x0000626262620062ULL, 0x0000545454540054ULL, - 0x00001e1e1e1e001eULL, 0x0000e0e0e0e000e0ULL, 0x0000646464640064ULL, - 0x0000101010100010ULL, 0x0000000000000000ULL, 0x0000a3a3a3a300a3ULL, - 0x0000757575750075ULL, 0x00008a8a8a8a008aULL, 0x0000e6e6e6e600e6ULL, - 0x0000090909090009ULL, 0x0000dddddddd00ddULL, 0x0000878787870087ULL, - 0x0000838383830083ULL, 0x0000cdcdcdcd00cdULL, 0x0000909090900090ULL, - 0x0000737373730073ULL, 0x0000f6f6f6f600f6ULL, 0x00009d9d9d9d009dULL, - 0x0000bfbfbfbf00bfULL, 0x0000525252520052ULL, 0x0000d8d8d8d800d8ULL, - 0x0000c8c8c8c800c8ULL, 0x0000c6c6c6c600c6ULL, 0x0000818181810081ULL, - 0x00006f6f6f6f006fULL, 0x0000131313130013ULL, 0x0000636363630063ULL, - 0x0000e9e9e9e900e9ULL, 0x0000a7a7a7a700a7ULL, 0x00009f9f9f9f009fULL, - 0x0000bcbcbcbc00bcULL, 0x0000292929290029ULL, 0x0000f9f9f9f900f9ULL, - 0x00002f2f2f2f002fULL, 0x0000b4b4b4b400b4ULL, 0x0000787878780078ULL, - 0x0000060606060006ULL, 0x0000e7e7e7e700e7ULL, 0x0000717171710071ULL, - 0x0000d4d4d4d400d4ULL, 0x0000abababab00abULL, 0x0000888888880088ULL, - 0x00008d8d8d8d008dULL, 0x0000727272720072ULL, 0x0000b9b9b9b900b9ULL, - 0x0000f8f8f8f800f8ULL, 0x0000acacacac00acULL, 0x0000363636360036ULL, - 0x00002a2a2a2a002aULL, 0x00003c3c3c3c003cULL, 0x0000f1f1f1f100f1ULL, - 0x0000404040400040ULL, 0x0000d3d3d3d300d3ULL, 0x0000bbbbbbbb00bbULL, - 0x0000434343430043ULL, 0x0000151515150015ULL, 0x0000adadadad00adULL, - 0x0000777777770077ULL, 0x0000808080800080ULL, 0x0000828282820082ULL, - 0x0000ecececec00ecULL, 0x0000272727270027ULL, 0x0000e5e5e5e500e5ULL, - 0x0000858585850085ULL, 0x0000353535350035ULL, 0x00000c0c0c0c000cULL, - 0x0000414141410041ULL, 0x0000efefefef00efULL, 0x0000939393930093ULL, - 0x0000191919190019ULL, 0x0000212121210021ULL, 0x00000e0e0e0e000eULL, - 0x00004e4e4e4e004eULL, 0x0000656565650065ULL, 0x0000bdbdbdbd00bdULL, - 0x0000b8b8b8b800b8ULL, 0x00008f8f8f8f008fULL, 0x0000ebebebeb00ebULL, - 0x0000cececece00ceULL, 0x0000303030300030ULL, 0x00005f5f5f5f005fULL, - 0x0000c5c5c5c500c5ULL, 0x00001a1a1a1a001aULL, 0x0000e1e1e1e100e1ULL, - 0x0000cacacaca00caULL, 0x0000474747470047ULL, 0x00003d3d3d3d003dULL, - 0x0000010101010001ULL, 0x0000d6d6d6d600d6ULL, 0x0000565656560056ULL, - 0x00004d4d4d4d004dULL, 0x00000d0d0d0d000dULL, 0x0000666666660066ULL, - 0x0000cccccccc00ccULL, 0x00002d2d2d2d002dULL, 0x0000121212120012ULL, - 0x0000202020200020ULL, 0x0000b1b1b1b100b1ULL, 0x0000999999990099ULL, - 0x00004c4c4c4c004cULL, 0x0000c2c2c2c200c2ULL, 0x00007e7e7e7e007eULL, - 0x0000050505050005ULL, 0x0000b7b7b7b700b7ULL, 0x0000313131310031ULL, - 0x0000171717170017ULL, 0x0000d7d7d7d700d7ULL, 0x0000585858580058ULL, - 0x0000616161610061ULL, 0x00001b1b1b1b001bULL, 0x00001c1c1c1c001cULL, - 0x00000f0f0f0f000fULL, 0x0000161616160016ULL, 0x0000181818180018ULL, - 0x0000222222220022ULL, 0x0000444444440044ULL, 0x0000b2b2b2b200b2ULL, - 0x0000b5b5b5b500b5ULL, 0x0000919191910091ULL, 0x0000080808080008ULL, - 0x0000a8a8a8a800a8ULL, 0x0000fcfcfcfc00fcULL, 0x0000505050500050ULL, - 0x0000d0d0d0d000d0ULL, 0x00007d7d7d7d007dULL, 0x0000898989890089ULL, - 0x0000979797970097ULL, 0x00005b5b5b5b005bULL, 0x0000959595950095ULL, - 0x0000ffffffff00ffULL, 0x0000d2d2d2d200d2ULL, 0x0000c4c4c4c400c4ULL, - 0x0000484848480048ULL, 0x0000f7f7f7f700f7ULL, 0x0000dbdbdbdb00dbULL, - 0x0000030303030003ULL, 0x0000dadadada00daULL, 0x00003f3f3f3f003fULL, - 0x0000949494940094ULL, 0x00005c5c5c5c005cULL, 0x0000020202020002ULL, - 0x00004a4a4a4a004aULL, 0x0000333333330033ULL, 0x0000676767670067ULL, - 0x0000f3f3f3f300f3ULL, 0x00007f7f7f7f007fULL, 0x0000e2e2e2e200e2ULL, - 0x00009b9b9b9b009bULL, 0x0000262626260026ULL, 0x0000373737370037ULL, - 0x00003b3b3b3b003bULL, 0x0000969696960096ULL, 0x00004b4b4b4b004bULL, - 0x0000bebebebe00beULL, 0x00002e2e2e2e002eULL, 0x0000797979790079ULL, - 0x00008c8c8c8c008cULL, 0x00006e6e6e6e006eULL, 0x00008e8e8e8e008eULL, - 0x0000f5f5f5f500f5ULL, 0x0000b6b6b6b600b6ULL, 0x0000fdfdfdfd00fdULL, - 0x0000595959590059ULL, 0x0000989898980098ULL, 0x00006a6a6a6a006aULL, - 0x0000464646460046ULL, 0x0000babababa00baULL, 0x0000252525250025ULL, - 0x0000424242420042ULL, 0x0000a2a2a2a200a2ULL, 0x0000fafafafa00faULL, - 0x0000070707070007ULL, 0x0000555555550055ULL, 0x0000eeeeeeee00eeULL, - 0x00000a0a0a0a000aULL, 0x0000494949490049ULL, 0x0000686868680068ULL, - 0x0000383838380038ULL, 0x0000a4a4a4a400a4ULL, 0x0000282828280028ULL, - 0x00007b7b7b7b007bULL, 0x0000c9c9c9c900c9ULL, 0x0000c1c1c1c100c1ULL, - 0x0000e3e3e3e300e3ULL, 0x0000f4f4f4f400f4ULL, 0x0000c7c7c7c700c7ULL, - 0x00009e9e9e9e009eULL, + 0x0000707070700070, 0x00002c2c2c2c002c, 0x0000b3b3b3b300b3, + 0x0000c0c0c0c000c0, 0x0000e4e4e4e400e4, 0x0000575757570057, + 0x0000eaeaeaea00ea, 0x0000aeaeaeae00ae, 0x0000232323230023, + 0x00006b6b6b6b006b, 0x0000454545450045, 0x0000a5a5a5a500a5, + 0x0000edededed00ed, 0x00004f4f4f4f004f, 0x00001d1d1d1d001d, + 0x0000929292920092, 0x0000868686860086, 0x0000afafafaf00af, + 0x00007c7c7c7c007c, 0x00001f1f1f1f001f, 0x00003e3e3e3e003e, + 0x0000dcdcdcdc00dc, 0x00005e5e5e5e005e, 0x00000b0b0b0b000b, + 0x0000a6a6a6a600a6, 0x0000393939390039, 0x0000d5d5d5d500d5, + 0x00005d5d5d5d005d, 0x0000d9d9d9d900d9, 0x00005a5a5a5a005a, + 0x0000515151510051, 0x00006c6c6c6c006c, 0x00008b8b8b8b008b, + 0x00009a9a9a9a009a, 0x0000fbfbfbfb00fb, 0x0000b0b0b0b000b0, + 0x0000747474740074, 0x00002b2b2b2b002b, 0x0000f0f0f0f000f0, + 0x0000848484840084, 0x0000dfdfdfdf00df, 0x0000cbcbcbcb00cb, + 0x0000343434340034, 0x0000767676760076, 0x00006d6d6d6d006d, + 0x0000a9a9a9a900a9, 0x0000d1d1d1d100d1, 0x0000040404040004, + 0x0000141414140014, 0x00003a3a3a3a003a, 0x0000dededede00de, + 0x0000111111110011, 0x0000323232320032, 0x00009c9c9c9c009c, + 0x0000535353530053, 0x0000f2f2f2f200f2, 0x0000fefefefe00fe, + 0x0000cfcfcfcf00cf, 0x0000c3c3c3c300c3, 0x00007a7a7a7a007a, + 0x0000242424240024, 0x0000e8e8e8e800e8, 0x0000606060600060, + 0x0000696969690069, 0x0000aaaaaaaa00aa, 0x0000a0a0a0a000a0, + 0x0000a1a1a1a100a1, 0x0000626262620062, 0x0000545454540054, + 0x00001e1e1e1e001e, 0x0000e0e0e0e000e0, 0x0000646464640064, + 0x0000101010100010, 0x0000000000000000, 0x0000a3a3a3a300a3, + 0x0000757575750075, 0x00008a8a8a8a008a, 0x0000e6e6e6e600e6, + 0x0000090909090009, 0x0000dddddddd00dd, 0x0000878787870087, + 0x0000838383830083, 0x0000cdcdcdcd00cd, 0x0000909090900090, + 0x0000737373730073, 0x0000f6f6f6f600f6, 0x00009d9d9d9d009d, + 0x0000bfbfbfbf00bf, 0x0000525252520052, 0x0000d8d8d8d800d8, + 0x0000c8c8c8c800c8, 0x0000c6c6c6c600c6, 0x0000818181810081, + 0x00006f6f6f6f006f, 0x0000131313130013, 0x0000636363630063, + 0x0000e9e9e9e900e9, 0x0000a7a7a7a700a7, 0x00009f9f9f9f009f, + 0x0000bcbcbcbc00bc, 0x0000292929290029, 0x0000f9f9f9f900f9, + 0x00002f2f2f2f002f, 0x0000b4b4b4b400b4, 0x0000787878780078, + 0x0000060606060006, 0x0000e7e7e7e700e7, 0x0000717171710071, + 0x0000d4d4d4d400d4, 0x0000abababab00ab, 0x0000888888880088, + 0x00008d8d8d8d008d, 0x0000727272720072, 0x0000b9b9b9b900b9, + 0x0000f8f8f8f800f8, 0x0000acacacac00ac, 0x0000363636360036, + 0x00002a2a2a2a002a, 0x00003c3c3c3c003c, 0x0000f1f1f1f100f1, + 0x0000404040400040, 0x0000d3d3d3d300d3, 0x0000bbbbbbbb00bb, + 0x0000434343430043, 0x0000151515150015, 0x0000adadadad00ad, + 0x0000777777770077, 0x0000808080800080, 0x0000828282820082, + 0x0000ecececec00ec, 0x0000272727270027, 0x0000e5e5e5e500e5, + 0x0000858585850085, 0x0000353535350035, 0x00000c0c0c0c000c, + 0x0000414141410041, 0x0000efefefef00ef, 0x0000939393930093, + 0x0000191919190019, 0x0000212121210021, 0x00000e0e0e0e000e, + 0x00004e4e4e4e004e, 0x0000656565650065, 0x0000bdbdbdbd00bd, + 0x0000b8b8b8b800b8, 0x00008f8f8f8f008f, 0x0000ebebebeb00eb, + 0x0000cececece00ce, 0x0000303030300030, 0x00005f5f5f5f005f, + 0x0000c5c5c5c500c5, 0x00001a1a1a1a001a, 0x0000e1e1e1e100e1, + 0x0000cacacaca00ca, 0x0000474747470047, 0x00003d3d3d3d003d, + 0x0000010101010001, 0x0000d6d6d6d600d6, 0x0000565656560056, + 0x00004d4d4d4d004d, 0x00000d0d0d0d000d, 0x0000666666660066, + 0x0000cccccccc00cc, 0x00002d2d2d2d002d, 0x0000121212120012, + 0x0000202020200020, 0x0000b1b1b1b100b1, 0x0000999999990099, + 0x00004c4c4c4c004c, 0x0000c2c2c2c200c2, 0x00007e7e7e7e007e, + 0x0000050505050005, 0x0000b7b7b7b700b7, 0x0000313131310031, + 0x0000171717170017, 0x0000d7d7d7d700d7, 0x0000585858580058, + 0x0000616161610061, 0x00001b1b1b1b001b, 0x00001c1c1c1c001c, + 0x00000f0f0f0f000f, 0x0000161616160016, 0x0000181818180018, + 0x0000222222220022, 0x0000444444440044, 0x0000b2b2b2b200b2, + 0x0000b5b5b5b500b5, 0x0000919191910091, 0x0000080808080008, + 0x0000a8a8a8a800a8, 0x0000fcfcfcfc00fc, 0x0000505050500050, + 0x0000d0d0d0d000d0, 0x00007d7d7d7d007d, 0x0000898989890089, + 0x0000979797970097, 0x00005b5b5b5b005b, 0x0000959595950095, + 0x0000ffffffff00ff, 0x0000d2d2d2d200d2, 0x0000c4c4c4c400c4, + 0x0000484848480048, 0x0000f7f7f7f700f7, 0x0000dbdbdbdb00db, + 0x0000030303030003, 0x0000dadadada00da, 0x00003f3f3f3f003f, + 0x0000949494940094, 0x00005c5c5c5c005c, 0x0000020202020002, + 0x00004a4a4a4a004a, 0x0000333333330033, 0x0000676767670067, + 0x0000f3f3f3f300f3, 0x00007f7f7f7f007f, 0x0000e2e2e2e200e2, + 0x00009b9b9b9b009b, 0x0000262626260026, 0x0000373737370037, + 0x00003b3b3b3b003b, 0x0000969696960096, 0x00004b4b4b4b004b, + 0x0000bebebebe00be, 0x00002e2e2e2e002e, 0x0000797979790079, + 0x00008c8c8c8c008c, 0x00006e6e6e6e006e, 0x00008e8e8e8e008e, + 0x0000f5f5f5f500f5, 0x0000b6b6b6b600b6, 0x0000fdfdfdfd00fd, + 0x0000595959590059, 0x0000989898980098, 0x00006a6a6a6a006a, + 0x0000464646460046, 0x0000babababa00ba, 0x0000252525250025, + 0x0000424242420042, 0x0000a2a2a2a200a2, 0x0000fafafafa00fa, + 0x0000070707070007, 0x0000555555550055, 0x0000eeeeeeee00ee, + 0x00000a0a0a0a000a, 0x0000494949490049, 0x0000686868680068, + 0x0000383838380038, 0x0000a4a4a4a400a4, 0x0000282828280028, + 0x00007b7b7b7b007b, 0x0000c9c9c9c900c9, 0x0000c1c1c1c100c1, + 0x0000e3e3e3e300e3, 0x0000f4f4f4f400f4, 0x0000c7c7c7c700c7, + 0x00009e9e9e9e009e, }; const u64 camellia_sp02220222[256] = { - 0x00e0e0e000e0e0e0ULL, 0x0005050500050505ULL, 0x0058585800585858ULL, - 0x00d9d9d900d9d9d9ULL, 0x0067676700676767ULL, 0x004e4e4e004e4e4eULL, - 0x0081818100818181ULL, 0x00cbcbcb00cbcbcbULL, 0x00c9c9c900c9c9c9ULL, - 0x000b0b0b000b0b0bULL, 0x00aeaeae00aeaeaeULL, 0x006a6a6a006a6a6aULL, - 0x00d5d5d500d5d5d5ULL, 0x0018181800181818ULL, 0x005d5d5d005d5d5dULL, - 0x0082828200828282ULL, 0x0046464600464646ULL, 0x00dfdfdf00dfdfdfULL, - 0x00d6d6d600d6d6d6ULL, 0x0027272700272727ULL, 0x008a8a8a008a8a8aULL, - 0x0032323200323232ULL, 0x004b4b4b004b4b4bULL, 0x0042424200424242ULL, - 0x00dbdbdb00dbdbdbULL, 0x001c1c1c001c1c1cULL, 0x009e9e9e009e9e9eULL, - 0x009c9c9c009c9c9cULL, 0x003a3a3a003a3a3aULL, 0x00cacaca00cacacaULL, - 0x0025252500252525ULL, 0x007b7b7b007b7b7bULL, 0x000d0d0d000d0d0dULL, - 0x0071717100717171ULL, 0x005f5f5f005f5f5fULL, 0x001f1f1f001f1f1fULL, - 0x00f8f8f800f8f8f8ULL, 0x00d7d7d700d7d7d7ULL, 0x003e3e3e003e3e3eULL, - 0x009d9d9d009d9d9dULL, 0x007c7c7c007c7c7cULL, 0x0060606000606060ULL, - 0x00b9b9b900b9b9b9ULL, 0x00bebebe00bebebeULL, 0x00bcbcbc00bcbcbcULL, - 0x008b8b8b008b8b8bULL, 0x0016161600161616ULL, 0x0034343400343434ULL, - 0x004d4d4d004d4d4dULL, 0x00c3c3c300c3c3c3ULL, 0x0072727200727272ULL, - 0x0095959500959595ULL, 0x00ababab00abababULL, 0x008e8e8e008e8e8eULL, - 0x00bababa00bababaULL, 0x007a7a7a007a7a7aULL, 0x00b3b3b300b3b3b3ULL, - 0x0002020200020202ULL, 0x00b4b4b400b4b4b4ULL, 0x00adadad00adadadULL, - 0x00a2a2a200a2a2a2ULL, 0x00acacac00acacacULL, 0x00d8d8d800d8d8d8ULL, - 0x009a9a9a009a9a9aULL, 0x0017171700171717ULL, 0x001a1a1a001a1a1aULL, - 0x0035353500353535ULL, 0x00cccccc00ccccccULL, 0x00f7f7f700f7f7f7ULL, - 0x0099999900999999ULL, 0x0061616100616161ULL, 0x005a5a5a005a5a5aULL, - 0x00e8e8e800e8e8e8ULL, 0x0024242400242424ULL, 0x0056565600565656ULL, - 0x0040404000404040ULL, 0x00e1e1e100e1e1e1ULL, 0x0063636300636363ULL, - 0x0009090900090909ULL, 0x0033333300333333ULL, 0x00bfbfbf00bfbfbfULL, - 0x0098989800989898ULL, 0x0097979700979797ULL, 0x0085858500858585ULL, - 0x0068686800686868ULL, 0x00fcfcfc00fcfcfcULL, 0x00ececec00ecececULL, - 0x000a0a0a000a0a0aULL, 0x00dadada00dadadaULL, 0x006f6f6f006f6f6fULL, - 0x0053535300535353ULL, 0x0062626200626262ULL, 0x00a3a3a300a3a3a3ULL, - 0x002e2e2e002e2e2eULL, 0x0008080800080808ULL, 0x00afafaf00afafafULL, - 0x0028282800282828ULL, 0x00b0b0b000b0b0b0ULL, 0x0074747400747474ULL, - 0x00c2c2c200c2c2c2ULL, 0x00bdbdbd00bdbdbdULL, 0x0036363600363636ULL, - 0x0022222200222222ULL, 0x0038383800383838ULL, 0x0064646400646464ULL, - 0x001e1e1e001e1e1eULL, 0x0039393900393939ULL, 0x002c2c2c002c2c2cULL, - 0x00a6a6a600a6a6a6ULL, 0x0030303000303030ULL, 0x00e5e5e500e5e5e5ULL, - 0x0044444400444444ULL, 0x00fdfdfd00fdfdfdULL, 0x0088888800888888ULL, - 0x009f9f9f009f9f9fULL, 0x0065656500656565ULL, 0x0087878700878787ULL, - 0x006b6b6b006b6b6bULL, 0x00f4f4f400f4f4f4ULL, 0x0023232300232323ULL, - 0x0048484800484848ULL, 0x0010101000101010ULL, 0x00d1d1d100d1d1d1ULL, - 0x0051515100515151ULL, 0x00c0c0c000c0c0c0ULL, 0x00f9f9f900f9f9f9ULL, - 0x00d2d2d200d2d2d2ULL, 0x00a0a0a000a0a0a0ULL, 0x0055555500555555ULL, - 0x00a1a1a100a1a1a1ULL, 0x0041414100414141ULL, 0x00fafafa00fafafaULL, - 0x0043434300434343ULL, 0x0013131300131313ULL, 0x00c4c4c400c4c4c4ULL, - 0x002f2f2f002f2f2fULL, 0x00a8a8a800a8a8a8ULL, 0x00b6b6b600b6b6b6ULL, - 0x003c3c3c003c3c3cULL, 0x002b2b2b002b2b2bULL, 0x00c1c1c100c1c1c1ULL, - 0x00ffffff00ffffffULL, 0x00c8c8c800c8c8c8ULL, 0x00a5a5a500a5a5a5ULL, - 0x0020202000202020ULL, 0x0089898900898989ULL, 0x0000000000000000ULL, - 0x0090909000909090ULL, 0x0047474700474747ULL, 0x00efefef00efefefULL, - 0x00eaeaea00eaeaeaULL, 0x00b7b7b700b7b7b7ULL, 0x0015151500151515ULL, - 0x0006060600060606ULL, 0x00cdcdcd00cdcdcdULL, 0x00b5b5b500b5b5b5ULL, - 0x0012121200121212ULL, 0x007e7e7e007e7e7eULL, 0x00bbbbbb00bbbbbbULL, - 0x0029292900292929ULL, 0x000f0f0f000f0f0fULL, 0x00b8b8b800b8b8b8ULL, - 0x0007070700070707ULL, 0x0004040400040404ULL, 0x009b9b9b009b9b9bULL, - 0x0094949400949494ULL, 0x0021212100212121ULL, 0x0066666600666666ULL, - 0x00e6e6e600e6e6e6ULL, 0x00cecece00cececeULL, 0x00ededed00edededULL, - 0x00e7e7e700e7e7e7ULL, 0x003b3b3b003b3b3bULL, 0x00fefefe00fefefeULL, - 0x007f7f7f007f7f7fULL, 0x00c5c5c500c5c5c5ULL, 0x00a4a4a400a4a4a4ULL, - 0x0037373700373737ULL, 0x00b1b1b100b1b1b1ULL, 0x004c4c4c004c4c4cULL, - 0x0091919100919191ULL, 0x006e6e6e006e6e6eULL, 0x008d8d8d008d8d8dULL, - 0x0076767600767676ULL, 0x0003030300030303ULL, 0x002d2d2d002d2d2dULL, - 0x00dedede00dededeULL, 0x0096969600969696ULL, 0x0026262600262626ULL, - 0x007d7d7d007d7d7dULL, 0x00c6c6c600c6c6c6ULL, 0x005c5c5c005c5c5cULL, - 0x00d3d3d300d3d3d3ULL, 0x00f2f2f200f2f2f2ULL, 0x004f4f4f004f4f4fULL, - 0x0019191900191919ULL, 0x003f3f3f003f3f3fULL, 0x00dcdcdc00dcdcdcULL, - 0x0079797900797979ULL, 0x001d1d1d001d1d1dULL, 0x0052525200525252ULL, - 0x00ebebeb00ebebebULL, 0x00f3f3f300f3f3f3ULL, 0x006d6d6d006d6d6dULL, - 0x005e5e5e005e5e5eULL, 0x00fbfbfb00fbfbfbULL, 0x0069696900696969ULL, - 0x00b2b2b200b2b2b2ULL, 0x00f0f0f000f0f0f0ULL, 0x0031313100313131ULL, - 0x000c0c0c000c0c0cULL, 0x00d4d4d400d4d4d4ULL, 0x00cfcfcf00cfcfcfULL, - 0x008c8c8c008c8c8cULL, 0x00e2e2e200e2e2e2ULL, 0x0075757500757575ULL, - 0x00a9a9a900a9a9a9ULL, 0x004a4a4a004a4a4aULL, 0x0057575700575757ULL, - 0x0084848400848484ULL, 0x0011111100111111ULL, 0x0045454500454545ULL, - 0x001b1b1b001b1b1bULL, 0x00f5f5f500f5f5f5ULL, 0x00e4e4e400e4e4e4ULL, - 0x000e0e0e000e0e0eULL, 0x0073737300737373ULL, 0x00aaaaaa00aaaaaaULL, - 0x00f1f1f100f1f1f1ULL, 0x00dddddd00ddddddULL, 0x0059595900595959ULL, - 0x0014141400141414ULL, 0x006c6c6c006c6c6cULL, 0x0092929200929292ULL, - 0x0054545400545454ULL, 0x00d0d0d000d0d0d0ULL, 0x0078787800787878ULL, - 0x0070707000707070ULL, 0x00e3e3e300e3e3e3ULL, 0x0049494900494949ULL, - 0x0080808000808080ULL, 0x0050505000505050ULL, 0x00a7a7a700a7a7a7ULL, - 0x00f6f6f600f6f6f6ULL, 0x0077777700777777ULL, 0x0093939300939393ULL, - 0x0086868600868686ULL, 0x0083838300838383ULL, 0x002a2a2a002a2a2aULL, - 0x00c7c7c700c7c7c7ULL, 0x005b5b5b005b5b5bULL, 0x00e9e9e900e9e9e9ULL, - 0x00eeeeee00eeeeeeULL, 0x008f8f8f008f8f8fULL, 0x0001010100010101ULL, - 0x003d3d3d003d3d3dULL, + 0x00e0e0e000e0e0e0, 0x0005050500050505, 0x0058585800585858, + 0x00d9d9d900d9d9d9, 0x0067676700676767, 0x004e4e4e004e4e4e, + 0x0081818100818181, 0x00cbcbcb00cbcbcb, 0x00c9c9c900c9c9c9, + 0x000b0b0b000b0b0b, 0x00aeaeae00aeaeae, 0x006a6a6a006a6a6a, + 0x00d5d5d500d5d5d5, 0x0018181800181818, 0x005d5d5d005d5d5d, + 0x0082828200828282, 0x0046464600464646, 0x00dfdfdf00dfdfdf, + 0x00d6d6d600d6d6d6, 0x0027272700272727, 0x008a8a8a008a8a8a, + 0x0032323200323232, 0x004b4b4b004b4b4b, 0x0042424200424242, + 0x00dbdbdb00dbdbdb, 0x001c1c1c001c1c1c, 0x009e9e9e009e9e9e, + 0x009c9c9c009c9c9c, 0x003a3a3a003a3a3a, 0x00cacaca00cacaca, + 0x0025252500252525, 0x007b7b7b007b7b7b, 0x000d0d0d000d0d0d, + 0x0071717100717171, 0x005f5f5f005f5f5f, 0x001f1f1f001f1f1f, + 0x00f8f8f800f8f8f8, 0x00d7d7d700d7d7d7, 0x003e3e3e003e3e3e, + 0x009d9d9d009d9d9d, 0x007c7c7c007c7c7c, 0x0060606000606060, + 0x00b9b9b900b9b9b9, 0x00bebebe00bebebe, 0x00bcbcbc00bcbcbc, + 0x008b8b8b008b8b8b, 0x0016161600161616, 0x0034343400343434, + 0x004d4d4d004d4d4d, 0x00c3c3c300c3c3c3, 0x0072727200727272, + 0x0095959500959595, 0x00ababab00ababab, 0x008e8e8e008e8e8e, + 0x00bababa00bababa, 0x007a7a7a007a7a7a, 0x00b3b3b300b3b3b3, + 0x0002020200020202, 0x00b4b4b400b4b4b4, 0x00adadad00adadad, + 0x00a2a2a200a2a2a2, 0x00acacac00acacac, 0x00d8d8d800d8d8d8, + 0x009a9a9a009a9a9a, 0x0017171700171717, 0x001a1a1a001a1a1a, + 0x0035353500353535, 0x00cccccc00cccccc, 0x00f7f7f700f7f7f7, + 0x0099999900999999, 0x0061616100616161, 0x005a5a5a005a5a5a, + 0x00e8e8e800e8e8e8, 0x0024242400242424, 0x0056565600565656, + 0x0040404000404040, 0x00e1e1e100e1e1e1, 0x0063636300636363, + 0x0009090900090909, 0x0033333300333333, 0x00bfbfbf00bfbfbf, + 0x0098989800989898, 0x0097979700979797, 0x0085858500858585, + 0x0068686800686868, 0x00fcfcfc00fcfcfc, 0x00ececec00ececec, + 0x000a0a0a000a0a0a, 0x00dadada00dadada, 0x006f6f6f006f6f6f, + 0x0053535300535353, 0x0062626200626262, 0x00a3a3a300a3a3a3, + 0x002e2e2e002e2e2e, 0x0008080800080808, 0x00afafaf00afafaf, + 0x0028282800282828, 0x00b0b0b000b0b0b0, 0x0074747400747474, + 0x00c2c2c200c2c2c2, 0x00bdbdbd00bdbdbd, 0x0036363600363636, + 0x0022222200222222, 0x0038383800383838, 0x0064646400646464, + 0x001e1e1e001e1e1e, 0x0039393900393939, 0x002c2c2c002c2c2c, + 0x00a6a6a600a6a6a6, 0x0030303000303030, 0x00e5e5e500e5e5e5, + 0x0044444400444444, 0x00fdfdfd00fdfdfd, 0x0088888800888888, + 0x009f9f9f009f9f9f, 0x0065656500656565, 0x0087878700878787, + 0x006b6b6b006b6b6b, 0x00f4f4f400f4f4f4, 0x0023232300232323, + 0x0048484800484848, 0x0010101000101010, 0x00d1d1d100d1d1d1, + 0x0051515100515151, 0x00c0c0c000c0c0c0, 0x00f9f9f900f9f9f9, + 0x00d2d2d200d2d2d2, 0x00a0a0a000a0a0a0, 0x0055555500555555, + 0x00a1a1a100a1a1a1, 0x0041414100414141, 0x00fafafa00fafafa, + 0x0043434300434343, 0x0013131300131313, 0x00c4c4c400c4c4c4, + 0x002f2f2f002f2f2f, 0x00a8a8a800a8a8a8, 0x00b6b6b600b6b6b6, + 0x003c3c3c003c3c3c, 0x002b2b2b002b2b2b, 0x00c1c1c100c1c1c1, + 0x00ffffff00ffffff, 0x00c8c8c800c8c8c8, 0x00a5a5a500a5a5a5, + 0x0020202000202020, 0x0089898900898989, 0x0000000000000000, + 0x0090909000909090, 0x0047474700474747, 0x00efefef00efefef, + 0x00eaeaea00eaeaea, 0x00b7b7b700b7b7b7, 0x0015151500151515, + 0x0006060600060606, 0x00cdcdcd00cdcdcd, 0x00b5b5b500b5b5b5, + 0x0012121200121212, 0x007e7e7e007e7e7e, 0x00bbbbbb00bbbbbb, + 0x0029292900292929, 0x000f0f0f000f0f0f, 0x00b8b8b800b8b8b8, + 0x0007070700070707, 0x0004040400040404, 0x009b9b9b009b9b9b, + 0x0094949400949494, 0x0021212100212121, 0x0066666600666666, + 0x00e6e6e600e6e6e6, 0x00cecece00cecece, 0x00ededed00ededed, + 0x00e7e7e700e7e7e7, 0x003b3b3b003b3b3b, 0x00fefefe00fefefe, + 0x007f7f7f007f7f7f, 0x00c5c5c500c5c5c5, 0x00a4a4a400a4a4a4, + 0x0037373700373737, 0x00b1b1b100b1b1b1, 0x004c4c4c004c4c4c, + 0x0091919100919191, 0x006e6e6e006e6e6e, 0x008d8d8d008d8d8d, + 0x0076767600767676, 0x0003030300030303, 0x002d2d2d002d2d2d, + 0x00dedede00dedede, 0x0096969600969696, 0x0026262600262626, + 0x007d7d7d007d7d7d, 0x00c6c6c600c6c6c6, 0x005c5c5c005c5c5c, + 0x00d3d3d300d3d3d3, 0x00f2f2f200f2f2f2, 0x004f4f4f004f4f4f, + 0x0019191900191919, 0x003f3f3f003f3f3f, 0x00dcdcdc00dcdcdc, + 0x0079797900797979, 0x001d1d1d001d1d1d, 0x0052525200525252, + 0x00ebebeb00ebebeb, 0x00f3f3f300f3f3f3, 0x006d6d6d006d6d6d, + 0x005e5e5e005e5e5e, 0x00fbfbfb00fbfbfb, 0x0069696900696969, + 0x00b2b2b200b2b2b2, 0x00f0f0f000f0f0f0, 0x0031313100313131, + 0x000c0c0c000c0c0c, 0x00d4d4d400d4d4d4, 0x00cfcfcf00cfcfcf, + 0x008c8c8c008c8c8c, 0x00e2e2e200e2e2e2, 0x0075757500757575, + 0x00a9a9a900a9a9a9, 0x004a4a4a004a4a4a, 0x0057575700575757, + 0x0084848400848484, 0x0011111100111111, 0x0045454500454545, + 0x001b1b1b001b1b1b, 0x00f5f5f500f5f5f5, 0x00e4e4e400e4e4e4, + 0x000e0e0e000e0e0e, 0x0073737300737373, 0x00aaaaaa00aaaaaa, + 0x00f1f1f100f1f1f1, 0x00dddddd00dddddd, 0x0059595900595959, + 0x0014141400141414, 0x006c6c6c006c6c6c, 0x0092929200929292, + 0x0054545400545454, 0x00d0d0d000d0d0d0, 0x0078787800787878, + 0x0070707000707070, 0x00e3e3e300e3e3e3, 0x0049494900494949, + 0x0080808000808080, 0x0050505000505050, 0x00a7a7a700a7a7a7, + 0x00f6f6f600f6f6f6, 0x0077777700777777, 0x0093939300939393, + 0x0086868600868686, 0x0083838300838383, 0x002a2a2a002a2a2a, + 0x00c7c7c700c7c7c7, 0x005b5b5b005b5b5b, 0x00e9e9e900e9e9e9, + 0x00eeeeee00eeeeee, 0x008f8f8f008f8f8f, 0x0001010100010101, + 0x003d3d3d003d3d3d, }; const u64 camellia_sp30333033[256] = { - 0x3800383838003838ULL, 0x4100414141004141ULL, 0x1600161616001616ULL, - 0x7600767676007676ULL, 0xd900d9d9d900d9d9ULL, 0x9300939393009393ULL, - 0x6000606060006060ULL, 0xf200f2f2f200f2f2ULL, 0x7200727272007272ULL, - 0xc200c2c2c200c2c2ULL, 0xab00ababab00ababULL, 0x9a009a9a9a009a9aULL, - 0x7500757575007575ULL, 0x0600060606000606ULL, 0x5700575757005757ULL, - 0xa000a0a0a000a0a0ULL, 0x9100919191009191ULL, 0xf700f7f7f700f7f7ULL, - 0xb500b5b5b500b5b5ULL, 0xc900c9c9c900c9c9ULL, 0xa200a2a2a200a2a2ULL, - 0x8c008c8c8c008c8cULL, 0xd200d2d2d200d2d2ULL, 0x9000909090009090ULL, - 0xf600f6f6f600f6f6ULL, 0x0700070707000707ULL, 0xa700a7a7a700a7a7ULL, - 0x2700272727002727ULL, 0x8e008e8e8e008e8eULL, 0xb200b2b2b200b2b2ULL, - 0x4900494949004949ULL, 0xde00dedede00dedeULL, 0x4300434343004343ULL, - 0x5c005c5c5c005c5cULL, 0xd700d7d7d700d7d7ULL, 0xc700c7c7c700c7c7ULL, - 0x3e003e3e3e003e3eULL, 0xf500f5f5f500f5f5ULL, 0x8f008f8f8f008f8fULL, - 0x6700676767006767ULL, 0x1f001f1f1f001f1fULL, 0x1800181818001818ULL, - 0x6e006e6e6e006e6eULL, 0xaf00afafaf00afafULL, 0x2f002f2f2f002f2fULL, - 0xe200e2e2e200e2e2ULL, 0x8500858585008585ULL, 0x0d000d0d0d000d0dULL, - 0x5300535353005353ULL, 0xf000f0f0f000f0f0ULL, 0x9c009c9c9c009c9cULL, - 0x6500656565006565ULL, 0xea00eaeaea00eaeaULL, 0xa300a3a3a300a3a3ULL, - 0xae00aeaeae00aeaeULL, 0x9e009e9e9e009e9eULL, 0xec00ececec00ececULL, - 0x8000808080008080ULL, 0x2d002d2d2d002d2dULL, 0x6b006b6b6b006b6bULL, - 0xa800a8a8a800a8a8ULL, 0x2b002b2b2b002b2bULL, 0x3600363636003636ULL, - 0xa600a6a6a600a6a6ULL, 0xc500c5c5c500c5c5ULL, 0x8600868686008686ULL, - 0x4d004d4d4d004d4dULL, 0x3300333333003333ULL, 0xfd00fdfdfd00fdfdULL, - 0x6600666666006666ULL, 0x5800585858005858ULL, 0x9600969696009696ULL, - 0x3a003a3a3a003a3aULL, 0x0900090909000909ULL, 0x9500959595009595ULL, - 0x1000101010001010ULL, 0x7800787878007878ULL, 0xd800d8d8d800d8d8ULL, - 0x4200424242004242ULL, 0xcc00cccccc00ccccULL, 0xef00efefef00efefULL, - 0x2600262626002626ULL, 0xe500e5e5e500e5e5ULL, 0x6100616161006161ULL, - 0x1a001a1a1a001a1aULL, 0x3f003f3f3f003f3fULL, 0x3b003b3b3b003b3bULL, - 0x8200828282008282ULL, 0xb600b6b6b600b6b6ULL, 0xdb00dbdbdb00dbdbULL, - 0xd400d4d4d400d4d4ULL, 0x9800989898009898ULL, 0xe800e8e8e800e8e8ULL, - 0x8b008b8b8b008b8bULL, 0x0200020202000202ULL, 0xeb00ebebeb00ebebULL, - 0x0a000a0a0a000a0aULL, 0x2c002c2c2c002c2cULL, 0x1d001d1d1d001d1dULL, - 0xb000b0b0b000b0b0ULL, 0x6f006f6f6f006f6fULL, 0x8d008d8d8d008d8dULL, - 0x8800888888008888ULL, 0x0e000e0e0e000e0eULL, 0x1900191919001919ULL, - 0x8700878787008787ULL, 0x4e004e4e4e004e4eULL, 0x0b000b0b0b000b0bULL, - 0xa900a9a9a900a9a9ULL, 0x0c000c0c0c000c0cULL, 0x7900797979007979ULL, - 0x1100111111001111ULL, 0x7f007f7f7f007f7fULL, 0x2200222222002222ULL, - 0xe700e7e7e700e7e7ULL, 0x5900595959005959ULL, 0xe100e1e1e100e1e1ULL, - 0xda00dadada00dadaULL, 0x3d003d3d3d003d3dULL, 0xc800c8c8c800c8c8ULL, - 0x1200121212001212ULL, 0x0400040404000404ULL, 0x7400747474007474ULL, - 0x5400545454005454ULL, 0x3000303030003030ULL, 0x7e007e7e7e007e7eULL, - 0xb400b4b4b400b4b4ULL, 0x2800282828002828ULL, 0x5500555555005555ULL, - 0x6800686868006868ULL, 0x5000505050005050ULL, 0xbe00bebebe00bebeULL, - 0xd000d0d0d000d0d0ULL, 0xc400c4c4c400c4c4ULL, 0x3100313131003131ULL, - 0xcb00cbcbcb00cbcbULL, 0x2a002a2a2a002a2aULL, 0xad00adadad00adadULL, - 0x0f000f0f0f000f0fULL, 0xca00cacaca00cacaULL, 0x7000707070007070ULL, - 0xff00ffffff00ffffULL, 0x3200323232003232ULL, 0x6900696969006969ULL, - 0x0800080808000808ULL, 0x6200626262006262ULL, 0x0000000000000000ULL, - 0x2400242424002424ULL, 0xd100d1d1d100d1d1ULL, 0xfb00fbfbfb00fbfbULL, - 0xba00bababa00babaULL, 0xed00ededed00ededULL, 0x4500454545004545ULL, - 0x8100818181008181ULL, 0x7300737373007373ULL, 0x6d006d6d6d006d6dULL, - 0x8400848484008484ULL, 0x9f009f9f9f009f9fULL, 0xee00eeeeee00eeeeULL, - 0x4a004a4a4a004a4aULL, 0xc300c3c3c300c3c3ULL, 0x2e002e2e2e002e2eULL, - 0xc100c1c1c100c1c1ULL, 0x0100010101000101ULL, 0xe600e6e6e600e6e6ULL, - 0x2500252525002525ULL, 0x4800484848004848ULL, 0x9900999999009999ULL, - 0xb900b9b9b900b9b9ULL, 0xb300b3b3b300b3b3ULL, 0x7b007b7b7b007b7bULL, - 0xf900f9f9f900f9f9ULL, 0xce00cecece00ceceULL, 0xbf00bfbfbf00bfbfULL, - 0xdf00dfdfdf00dfdfULL, 0x7100717171007171ULL, 0x2900292929002929ULL, - 0xcd00cdcdcd00cdcdULL, 0x6c006c6c6c006c6cULL, 0x1300131313001313ULL, - 0x6400646464006464ULL, 0x9b009b9b9b009b9bULL, 0x6300636363006363ULL, - 0x9d009d9d9d009d9dULL, 0xc000c0c0c000c0c0ULL, 0x4b004b4b4b004b4bULL, - 0xb700b7b7b700b7b7ULL, 0xa500a5a5a500a5a5ULL, 0x8900898989008989ULL, - 0x5f005f5f5f005f5fULL, 0xb100b1b1b100b1b1ULL, 0x1700171717001717ULL, - 0xf400f4f4f400f4f4ULL, 0xbc00bcbcbc00bcbcULL, 0xd300d3d3d300d3d3ULL, - 0x4600464646004646ULL, 0xcf00cfcfcf00cfcfULL, 0x3700373737003737ULL, - 0x5e005e5e5e005e5eULL, 0x4700474747004747ULL, 0x9400949494009494ULL, - 0xfa00fafafa00fafaULL, 0xfc00fcfcfc00fcfcULL, 0x5b005b5b5b005b5bULL, - 0x9700979797009797ULL, 0xfe00fefefe00fefeULL, 0x5a005a5a5a005a5aULL, - 0xac00acacac00acacULL, 0x3c003c3c3c003c3cULL, 0x4c004c4c4c004c4cULL, - 0x0300030303000303ULL, 0x3500353535003535ULL, 0xf300f3f3f300f3f3ULL, - 0x2300232323002323ULL, 0xb800b8b8b800b8b8ULL, 0x5d005d5d5d005d5dULL, - 0x6a006a6a6a006a6aULL, 0x9200929292009292ULL, 0xd500d5d5d500d5d5ULL, - 0x2100212121002121ULL, 0x4400444444004444ULL, 0x5100515151005151ULL, - 0xc600c6c6c600c6c6ULL, 0x7d007d7d7d007d7dULL, 0x3900393939003939ULL, - 0x8300838383008383ULL, 0xdc00dcdcdc00dcdcULL, 0xaa00aaaaaa00aaaaULL, - 0x7c007c7c7c007c7cULL, 0x7700777777007777ULL, 0x5600565656005656ULL, - 0x0500050505000505ULL, 0x1b001b1b1b001b1bULL, 0xa400a4a4a400a4a4ULL, - 0x1500151515001515ULL, 0x3400343434003434ULL, 0x1e001e1e1e001e1eULL, - 0x1c001c1c1c001c1cULL, 0xf800f8f8f800f8f8ULL, 0x5200525252005252ULL, - 0x2000202020002020ULL, 0x1400141414001414ULL, 0xe900e9e9e900e9e9ULL, - 0xbd00bdbdbd00bdbdULL, 0xdd00dddddd00ddddULL, 0xe400e4e4e400e4e4ULL, - 0xa100a1a1a100a1a1ULL, 0xe000e0e0e000e0e0ULL, 0x8a008a8a8a008a8aULL, - 0xf100f1f1f100f1f1ULL, 0xd600d6d6d600d6d6ULL, 0x7a007a7a7a007a7aULL, - 0xbb00bbbbbb00bbbbULL, 0xe300e3e3e300e3e3ULL, 0x4000404040004040ULL, - 0x4f004f4f4f004f4fULL, + 0x3800383838003838, 0x4100414141004141, 0x1600161616001616, + 0x7600767676007676, 0xd900d9d9d900d9d9, 0x9300939393009393, + 0x6000606060006060, 0xf200f2f2f200f2f2, 0x7200727272007272, + 0xc200c2c2c200c2c2, 0xab00ababab00abab, 0x9a009a9a9a009a9a, + 0x7500757575007575, 0x0600060606000606, 0x5700575757005757, + 0xa000a0a0a000a0a0, 0x9100919191009191, 0xf700f7f7f700f7f7, + 0xb500b5b5b500b5b5, 0xc900c9c9c900c9c9, 0xa200a2a2a200a2a2, + 0x8c008c8c8c008c8c, 0xd200d2d2d200d2d2, 0x9000909090009090, + 0xf600f6f6f600f6f6, 0x0700070707000707, 0xa700a7a7a700a7a7, + 0x2700272727002727, 0x8e008e8e8e008e8e, 0xb200b2b2b200b2b2, + 0x4900494949004949, 0xde00dedede00dede, 0x4300434343004343, + 0x5c005c5c5c005c5c, 0xd700d7d7d700d7d7, 0xc700c7c7c700c7c7, + 0x3e003e3e3e003e3e, 0xf500f5f5f500f5f5, 0x8f008f8f8f008f8f, + 0x6700676767006767, 0x1f001f1f1f001f1f, 0x1800181818001818, + 0x6e006e6e6e006e6e, 0xaf00afafaf00afaf, 0x2f002f2f2f002f2f, + 0xe200e2e2e200e2e2, 0x8500858585008585, 0x0d000d0d0d000d0d, + 0x5300535353005353, 0xf000f0f0f000f0f0, 0x9c009c9c9c009c9c, + 0x6500656565006565, 0xea00eaeaea00eaea, 0xa300a3a3a300a3a3, + 0xae00aeaeae00aeae, 0x9e009e9e9e009e9e, 0xec00ececec00ecec, + 0x8000808080008080, 0x2d002d2d2d002d2d, 0x6b006b6b6b006b6b, + 0xa800a8a8a800a8a8, 0x2b002b2b2b002b2b, 0x3600363636003636, + 0xa600a6a6a600a6a6, 0xc500c5c5c500c5c5, 0x8600868686008686, + 0x4d004d4d4d004d4d, 0x3300333333003333, 0xfd00fdfdfd00fdfd, + 0x6600666666006666, 0x5800585858005858, 0x9600969696009696, + 0x3a003a3a3a003a3a, 0x0900090909000909, 0x9500959595009595, + 0x1000101010001010, 0x7800787878007878, 0xd800d8d8d800d8d8, + 0x4200424242004242, 0xcc00cccccc00cccc, 0xef00efefef00efef, + 0x2600262626002626, 0xe500e5e5e500e5e5, 0x6100616161006161, + 0x1a001a1a1a001a1a, 0x3f003f3f3f003f3f, 0x3b003b3b3b003b3b, + 0x8200828282008282, 0xb600b6b6b600b6b6, 0xdb00dbdbdb00dbdb, + 0xd400d4d4d400d4d4, 0x9800989898009898, 0xe800e8e8e800e8e8, + 0x8b008b8b8b008b8b, 0x0200020202000202, 0xeb00ebebeb00ebeb, + 0x0a000a0a0a000a0a, 0x2c002c2c2c002c2c, 0x1d001d1d1d001d1d, + 0xb000b0b0b000b0b0, 0x6f006f6f6f006f6f, 0x8d008d8d8d008d8d, + 0x8800888888008888, 0x0e000e0e0e000e0e, 0x1900191919001919, + 0x8700878787008787, 0x4e004e4e4e004e4e, 0x0b000b0b0b000b0b, + 0xa900a9a9a900a9a9, 0x0c000c0c0c000c0c, 0x7900797979007979, + 0x1100111111001111, 0x7f007f7f7f007f7f, 0x2200222222002222, + 0xe700e7e7e700e7e7, 0x5900595959005959, 0xe100e1e1e100e1e1, + 0xda00dadada00dada, 0x3d003d3d3d003d3d, 0xc800c8c8c800c8c8, + 0x1200121212001212, 0x0400040404000404, 0x7400747474007474, + 0x5400545454005454, 0x3000303030003030, 0x7e007e7e7e007e7e, + 0xb400b4b4b400b4b4, 0x2800282828002828, 0x5500555555005555, + 0x6800686868006868, 0x5000505050005050, 0xbe00bebebe00bebe, + 0xd000d0d0d000d0d0, 0xc400c4c4c400c4c4, 0x3100313131003131, + 0xcb00cbcbcb00cbcb, 0x2a002a2a2a002a2a, 0xad00adadad00adad, + 0x0f000f0f0f000f0f, 0xca00cacaca00caca, 0x7000707070007070, + 0xff00ffffff00ffff, 0x3200323232003232, 0x6900696969006969, + 0x0800080808000808, 0x6200626262006262, 0x0000000000000000, + 0x2400242424002424, 0xd100d1d1d100d1d1, 0xfb00fbfbfb00fbfb, + 0xba00bababa00baba, 0xed00ededed00eded, 0x4500454545004545, + 0x8100818181008181, 0x7300737373007373, 0x6d006d6d6d006d6d, + 0x8400848484008484, 0x9f009f9f9f009f9f, 0xee00eeeeee00eeee, + 0x4a004a4a4a004a4a, 0xc300c3c3c300c3c3, 0x2e002e2e2e002e2e, + 0xc100c1c1c100c1c1, 0x0100010101000101, 0xe600e6e6e600e6e6, + 0x2500252525002525, 0x4800484848004848, 0x9900999999009999, + 0xb900b9b9b900b9b9, 0xb300b3b3b300b3b3, 0x7b007b7b7b007b7b, + 0xf900f9f9f900f9f9, 0xce00cecece00cece, 0xbf00bfbfbf00bfbf, + 0xdf00dfdfdf00dfdf, 0x7100717171007171, 0x2900292929002929, + 0xcd00cdcdcd00cdcd, 0x6c006c6c6c006c6c, 0x1300131313001313, + 0x6400646464006464, 0x9b009b9b9b009b9b, 0x6300636363006363, + 0x9d009d9d9d009d9d, 0xc000c0c0c000c0c0, 0x4b004b4b4b004b4b, + 0xb700b7b7b700b7b7, 0xa500a5a5a500a5a5, 0x8900898989008989, + 0x5f005f5f5f005f5f, 0xb100b1b1b100b1b1, 0x1700171717001717, + 0xf400f4f4f400f4f4, 0xbc00bcbcbc00bcbc, 0xd300d3d3d300d3d3, + 0x4600464646004646, 0xcf00cfcfcf00cfcf, 0x3700373737003737, + 0x5e005e5e5e005e5e, 0x4700474747004747, 0x9400949494009494, + 0xfa00fafafa00fafa, 0xfc00fcfcfc00fcfc, 0x5b005b5b5b005b5b, + 0x9700979797009797, 0xfe00fefefe00fefe, 0x5a005a5a5a005a5a, + 0xac00acacac00acac, 0x3c003c3c3c003c3c, 0x4c004c4c4c004c4c, + 0x0300030303000303, 0x3500353535003535, 0xf300f3f3f300f3f3, + 0x2300232323002323, 0xb800b8b8b800b8b8, 0x5d005d5d5d005d5d, + 0x6a006a6a6a006a6a, 0x9200929292009292, 0xd500d5d5d500d5d5, + 0x2100212121002121, 0x4400444444004444, 0x5100515151005151, + 0xc600c6c6c600c6c6, 0x7d007d7d7d007d7d, 0x3900393939003939, + 0x8300838383008383, 0xdc00dcdcdc00dcdc, 0xaa00aaaaaa00aaaa, + 0x7c007c7c7c007c7c, 0x7700777777007777, 0x5600565656005656, + 0x0500050505000505, 0x1b001b1b1b001b1b, 0xa400a4a4a400a4a4, + 0x1500151515001515, 0x3400343434003434, 0x1e001e1e1e001e1e, + 0x1c001c1c1c001c1c, 0xf800f8f8f800f8f8, 0x5200525252005252, + 0x2000202020002020, 0x1400141414001414, 0xe900e9e9e900e9e9, + 0xbd00bdbdbd00bdbd, 0xdd00dddddd00dddd, 0xe400e4e4e400e4e4, + 0xa100a1a1a100a1a1, 0xe000e0e0e000e0e0, 0x8a008a8a8a008a8a, + 0xf100f1f1f100f1f1, 0xd600d6d6d600d6d6, 0x7a007a7a7a007a7a, + 0xbb00bbbbbb00bbbb, 0xe300e3e3e300e3e3, 0x4000404040004040, + 0x4f004f4f4f004f4f, }; const u64 camellia_sp44044404[256] = { - 0x7070007070700070ULL, 0x2c2c002c2c2c002cULL, 0xb3b300b3b3b300b3ULL, - 0xc0c000c0c0c000c0ULL, 0xe4e400e4e4e400e4ULL, 0x5757005757570057ULL, - 0xeaea00eaeaea00eaULL, 0xaeae00aeaeae00aeULL, 0x2323002323230023ULL, - 0x6b6b006b6b6b006bULL, 0x4545004545450045ULL, 0xa5a500a5a5a500a5ULL, - 0xeded00ededed00edULL, 0x4f4f004f4f4f004fULL, 0x1d1d001d1d1d001dULL, - 0x9292009292920092ULL, 0x8686008686860086ULL, 0xafaf00afafaf00afULL, - 0x7c7c007c7c7c007cULL, 0x1f1f001f1f1f001fULL, 0x3e3e003e3e3e003eULL, - 0xdcdc00dcdcdc00dcULL, 0x5e5e005e5e5e005eULL, 0x0b0b000b0b0b000bULL, - 0xa6a600a6a6a600a6ULL, 0x3939003939390039ULL, 0xd5d500d5d5d500d5ULL, - 0x5d5d005d5d5d005dULL, 0xd9d900d9d9d900d9ULL, 0x5a5a005a5a5a005aULL, - 0x5151005151510051ULL, 0x6c6c006c6c6c006cULL, 0x8b8b008b8b8b008bULL, - 0x9a9a009a9a9a009aULL, 0xfbfb00fbfbfb00fbULL, 0xb0b000b0b0b000b0ULL, - 0x7474007474740074ULL, 0x2b2b002b2b2b002bULL, 0xf0f000f0f0f000f0ULL, - 0x8484008484840084ULL, 0xdfdf00dfdfdf00dfULL, 0xcbcb00cbcbcb00cbULL, - 0x3434003434340034ULL, 0x7676007676760076ULL, 0x6d6d006d6d6d006dULL, - 0xa9a900a9a9a900a9ULL, 0xd1d100d1d1d100d1ULL, 0x0404000404040004ULL, - 0x1414001414140014ULL, 0x3a3a003a3a3a003aULL, 0xdede00dedede00deULL, - 0x1111001111110011ULL, 0x3232003232320032ULL, 0x9c9c009c9c9c009cULL, - 0x5353005353530053ULL, 0xf2f200f2f2f200f2ULL, 0xfefe00fefefe00feULL, - 0xcfcf00cfcfcf00cfULL, 0xc3c300c3c3c300c3ULL, 0x7a7a007a7a7a007aULL, - 0x2424002424240024ULL, 0xe8e800e8e8e800e8ULL, 0x6060006060600060ULL, - 0x6969006969690069ULL, 0xaaaa00aaaaaa00aaULL, 0xa0a000a0a0a000a0ULL, - 0xa1a100a1a1a100a1ULL, 0x6262006262620062ULL, 0x5454005454540054ULL, - 0x1e1e001e1e1e001eULL, 0xe0e000e0e0e000e0ULL, 0x6464006464640064ULL, - 0x1010001010100010ULL, 0x0000000000000000ULL, 0xa3a300a3a3a300a3ULL, - 0x7575007575750075ULL, 0x8a8a008a8a8a008aULL, 0xe6e600e6e6e600e6ULL, - 0x0909000909090009ULL, 0xdddd00dddddd00ddULL, 0x8787008787870087ULL, - 0x8383008383830083ULL, 0xcdcd00cdcdcd00cdULL, 0x9090009090900090ULL, - 0x7373007373730073ULL, 0xf6f600f6f6f600f6ULL, 0x9d9d009d9d9d009dULL, - 0xbfbf00bfbfbf00bfULL, 0x5252005252520052ULL, 0xd8d800d8d8d800d8ULL, - 0xc8c800c8c8c800c8ULL, 0xc6c600c6c6c600c6ULL, 0x8181008181810081ULL, - 0x6f6f006f6f6f006fULL, 0x1313001313130013ULL, 0x6363006363630063ULL, - 0xe9e900e9e9e900e9ULL, 0xa7a700a7a7a700a7ULL, 0x9f9f009f9f9f009fULL, - 0xbcbc00bcbcbc00bcULL, 0x2929002929290029ULL, 0xf9f900f9f9f900f9ULL, - 0x2f2f002f2f2f002fULL, 0xb4b400b4b4b400b4ULL, 0x7878007878780078ULL, - 0x0606000606060006ULL, 0xe7e700e7e7e700e7ULL, 0x7171007171710071ULL, - 0xd4d400d4d4d400d4ULL, 0xabab00ababab00abULL, 0x8888008888880088ULL, - 0x8d8d008d8d8d008dULL, 0x7272007272720072ULL, 0xb9b900b9b9b900b9ULL, - 0xf8f800f8f8f800f8ULL, 0xacac00acacac00acULL, 0x3636003636360036ULL, - 0x2a2a002a2a2a002aULL, 0x3c3c003c3c3c003cULL, 0xf1f100f1f1f100f1ULL, - 0x4040004040400040ULL, 0xd3d300d3d3d300d3ULL, 0xbbbb00bbbbbb00bbULL, - 0x4343004343430043ULL, 0x1515001515150015ULL, 0xadad00adadad00adULL, - 0x7777007777770077ULL, 0x8080008080800080ULL, 0x8282008282820082ULL, - 0xecec00ececec00ecULL, 0x2727002727270027ULL, 0xe5e500e5e5e500e5ULL, - 0x8585008585850085ULL, 0x3535003535350035ULL, 0x0c0c000c0c0c000cULL, - 0x4141004141410041ULL, 0xefef00efefef00efULL, 0x9393009393930093ULL, - 0x1919001919190019ULL, 0x2121002121210021ULL, 0x0e0e000e0e0e000eULL, - 0x4e4e004e4e4e004eULL, 0x6565006565650065ULL, 0xbdbd00bdbdbd00bdULL, - 0xb8b800b8b8b800b8ULL, 0x8f8f008f8f8f008fULL, 0xebeb00ebebeb00ebULL, - 0xcece00cecece00ceULL, 0x3030003030300030ULL, 0x5f5f005f5f5f005fULL, - 0xc5c500c5c5c500c5ULL, 0x1a1a001a1a1a001aULL, 0xe1e100e1e1e100e1ULL, - 0xcaca00cacaca00caULL, 0x4747004747470047ULL, 0x3d3d003d3d3d003dULL, - 0x0101000101010001ULL, 0xd6d600d6d6d600d6ULL, 0x5656005656560056ULL, - 0x4d4d004d4d4d004dULL, 0x0d0d000d0d0d000dULL, 0x6666006666660066ULL, - 0xcccc00cccccc00ccULL, 0x2d2d002d2d2d002dULL, 0x1212001212120012ULL, - 0x2020002020200020ULL, 0xb1b100b1b1b100b1ULL, 0x9999009999990099ULL, - 0x4c4c004c4c4c004cULL, 0xc2c200c2c2c200c2ULL, 0x7e7e007e7e7e007eULL, - 0x0505000505050005ULL, 0xb7b700b7b7b700b7ULL, 0x3131003131310031ULL, - 0x1717001717170017ULL, 0xd7d700d7d7d700d7ULL, 0x5858005858580058ULL, - 0x6161006161610061ULL, 0x1b1b001b1b1b001bULL, 0x1c1c001c1c1c001cULL, - 0x0f0f000f0f0f000fULL, 0x1616001616160016ULL, 0x1818001818180018ULL, - 0x2222002222220022ULL, 0x4444004444440044ULL, 0xb2b200b2b2b200b2ULL, - 0xb5b500b5b5b500b5ULL, 0x9191009191910091ULL, 0x0808000808080008ULL, - 0xa8a800a8a8a800a8ULL, 0xfcfc00fcfcfc00fcULL, 0x5050005050500050ULL, - 0xd0d000d0d0d000d0ULL, 0x7d7d007d7d7d007dULL, 0x8989008989890089ULL, - 0x9797009797970097ULL, 0x5b5b005b5b5b005bULL, 0x9595009595950095ULL, - 0xffff00ffffff00ffULL, 0xd2d200d2d2d200d2ULL, 0xc4c400c4c4c400c4ULL, - 0x4848004848480048ULL, 0xf7f700f7f7f700f7ULL, 0xdbdb00dbdbdb00dbULL, - 0x0303000303030003ULL, 0xdada00dadada00daULL, 0x3f3f003f3f3f003fULL, - 0x9494009494940094ULL, 0x5c5c005c5c5c005cULL, 0x0202000202020002ULL, - 0x4a4a004a4a4a004aULL, 0x3333003333330033ULL, 0x6767006767670067ULL, - 0xf3f300f3f3f300f3ULL, 0x7f7f007f7f7f007fULL, 0xe2e200e2e2e200e2ULL, - 0x9b9b009b9b9b009bULL, 0x2626002626260026ULL, 0x3737003737370037ULL, - 0x3b3b003b3b3b003bULL, 0x9696009696960096ULL, 0x4b4b004b4b4b004bULL, - 0xbebe00bebebe00beULL, 0x2e2e002e2e2e002eULL, 0x7979007979790079ULL, - 0x8c8c008c8c8c008cULL, 0x6e6e006e6e6e006eULL, 0x8e8e008e8e8e008eULL, - 0xf5f500f5f5f500f5ULL, 0xb6b600b6b6b600b6ULL, 0xfdfd00fdfdfd00fdULL, - 0x5959005959590059ULL, 0x9898009898980098ULL, 0x6a6a006a6a6a006aULL, - 0x4646004646460046ULL, 0xbaba00bababa00baULL, 0x2525002525250025ULL, - 0x4242004242420042ULL, 0xa2a200a2a2a200a2ULL, 0xfafa00fafafa00faULL, - 0x0707000707070007ULL, 0x5555005555550055ULL, 0xeeee00eeeeee00eeULL, - 0x0a0a000a0a0a000aULL, 0x4949004949490049ULL, 0x6868006868680068ULL, - 0x3838003838380038ULL, 0xa4a400a4a4a400a4ULL, 0x2828002828280028ULL, - 0x7b7b007b7b7b007bULL, 0xc9c900c9c9c900c9ULL, 0xc1c100c1c1c100c1ULL, - 0xe3e300e3e3e300e3ULL, 0xf4f400f4f4f400f4ULL, 0xc7c700c7c7c700c7ULL, - 0x9e9e009e9e9e009eULL, + 0x7070007070700070, 0x2c2c002c2c2c002c, 0xb3b300b3b3b300b3, + 0xc0c000c0c0c000c0, 0xe4e400e4e4e400e4, 0x5757005757570057, + 0xeaea00eaeaea00ea, 0xaeae00aeaeae00ae, 0x2323002323230023, + 0x6b6b006b6b6b006b, 0x4545004545450045, 0xa5a500a5a5a500a5, + 0xeded00ededed00ed, 0x4f4f004f4f4f004f, 0x1d1d001d1d1d001d, + 0x9292009292920092, 0x8686008686860086, 0xafaf00afafaf00af, + 0x7c7c007c7c7c007c, 0x1f1f001f1f1f001f, 0x3e3e003e3e3e003e, + 0xdcdc00dcdcdc00dc, 0x5e5e005e5e5e005e, 0x0b0b000b0b0b000b, + 0xa6a600a6a6a600a6, 0x3939003939390039, 0xd5d500d5d5d500d5, + 0x5d5d005d5d5d005d, 0xd9d900d9d9d900d9, 0x5a5a005a5a5a005a, + 0x5151005151510051, 0x6c6c006c6c6c006c, 0x8b8b008b8b8b008b, + 0x9a9a009a9a9a009a, 0xfbfb00fbfbfb00fb, 0xb0b000b0b0b000b0, + 0x7474007474740074, 0x2b2b002b2b2b002b, 0xf0f000f0f0f000f0, + 0x8484008484840084, 0xdfdf00dfdfdf00df, 0xcbcb00cbcbcb00cb, + 0x3434003434340034, 0x7676007676760076, 0x6d6d006d6d6d006d, + 0xa9a900a9a9a900a9, 0xd1d100d1d1d100d1, 0x0404000404040004, + 0x1414001414140014, 0x3a3a003a3a3a003a, 0xdede00dedede00de, + 0x1111001111110011, 0x3232003232320032, 0x9c9c009c9c9c009c, + 0x5353005353530053, 0xf2f200f2f2f200f2, 0xfefe00fefefe00fe, + 0xcfcf00cfcfcf00cf, 0xc3c300c3c3c300c3, 0x7a7a007a7a7a007a, + 0x2424002424240024, 0xe8e800e8e8e800e8, 0x6060006060600060, + 0x6969006969690069, 0xaaaa00aaaaaa00aa, 0xa0a000a0a0a000a0, + 0xa1a100a1a1a100a1, 0x6262006262620062, 0x5454005454540054, + 0x1e1e001e1e1e001e, 0xe0e000e0e0e000e0, 0x6464006464640064, + 0x1010001010100010, 0x0000000000000000, 0xa3a300a3a3a300a3, + 0x7575007575750075, 0x8a8a008a8a8a008a, 0xe6e600e6e6e600e6, + 0x0909000909090009, 0xdddd00dddddd00dd, 0x8787008787870087, + 0x8383008383830083, 0xcdcd00cdcdcd00cd, 0x9090009090900090, + 0x7373007373730073, 0xf6f600f6f6f600f6, 0x9d9d009d9d9d009d, + 0xbfbf00bfbfbf00bf, 0x5252005252520052, 0xd8d800d8d8d800d8, + 0xc8c800c8c8c800c8, 0xc6c600c6c6c600c6, 0x8181008181810081, + 0x6f6f006f6f6f006f, 0x1313001313130013, 0x6363006363630063, + 0xe9e900e9e9e900e9, 0xa7a700a7a7a700a7, 0x9f9f009f9f9f009f, + 0xbcbc00bcbcbc00bc, 0x2929002929290029, 0xf9f900f9f9f900f9, + 0x2f2f002f2f2f002f, 0xb4b400b4b4b400b4, 0x7878007878780078, + 0x0606000606060006, 0xe7e700e7e7e700e7, 0x7171007171710071, + 0xd4d400d4d4d400d4, 0xabab00ababab00ab, 0x8888008888880088, + 0x8d8d008d8d8d008d, 0x7272007272720072, 0xb9b900b9b9b900b9, + 0xf8f800f8f8f800f8, 0xacac00acacac00ac, 0x3636003636360036, + 0x2a2a002a2a2a002a, 0x3c3c003c3c3c003c, 0xf1f100f1f1f100f1, + 0x4040004040400040, 0xd3d300d3d3d300d3, 0xbbbb00bbbbbb00bb, + 0x4343004343430043, 0x1515001515150015, 0xadad00adadad00ad, + 0x7777007777770077, 0x8080008080800080, 0x8282008282820082, + 0xecec00ececec00ec, 0x2727002727270027, 0xe5e500e5e5e500e5, + 0x8585008585850085, 0x3535003535350035, 0x0c0c000c0c0c000c, + 0x4141004141410041, 0xefef00efefef00ef, 0x9393009393930093, + 0x1919001919190019, 0x2121002121210021, 0x0e0e000e0e0e000e, + 0x4e4e004e4e4e004e, 0x6565006565650065, 0xbdbd00bdbdbd00bd, + 0xb8b800b8b8b800b8, 0x8f8f008f8f8f008f, 0xebeb00ebebeb00eb, + 0xcece00cecece00ce, 0x3030003030300030, 0x5f5f005f5f5f005f, + 0xc5c500c5c5c500c5, 0x1a1a001a1a1a001a, 0xe1e100e1e1e100e1, + 0xcaca00cacaca00ca, 0x4747004747470047, 0x3d3d003d3d3d003d, + 0x0101000101010001, 0xd6d600d6d6d600d6, 0x5656005656560056, + 0x4d4d004d4d4d004d, 0x0d0d000d0d0d000d, 0x6666006666660066, + 0xcccc00cccccc00cc, 0x2d2d002d2d2d002d, 0x1212001212120012, + 0x2020002020200020, 0xb1b100b1b1b100b1, 0x9999009999990099, + 0x4c4c004c4c4c004c, 0xc2c200c2c2c200c2, 0x7e7e007e7e7e007e, + 0x0505000505050005, 0xb7b700b7b7b700b7, 0x3131003131310031, + 0x1717001717170017, 0xd7d700d7d7d700d7, 0x5858005858580058, + 0x6161006161610061, 0x1b1b001b1b1b001b, 0x1c1c001c1c1c001c, + 0x0f0f000f0f0f000f, 0x1616001616160016, 0x1818001818180018, + 0x2222002222220022, 0x4444004444440044, 0xb2b200b2b2b200b2, + 0xb5b500b5b5b500b5, 0x9191009191910091, 0x0808000808080008, + 0xa8a800a8a8a800a8, 0xfcfc00fcfcfc00fc, 0x5050005050500050, + 0xd0d000d0d0d000d0, 0x7d7d007d7d7d007d, 0x8989008989890089, + 0x9797009797970097, 0x5b5b005b5b5b005b, 0x9595009595950095, + 0xffff00ffffff00ff, 0xd2d200d2d2d200d2, 0xc4c400c4c4c400c4, + 0x4848004848480048, 0xf7f700f7f7f700f7, 0xdbdb00dbdbdb00db, + 0x0303000303030003, 0xdada00dadada00da, 0x3f3f003f3f3f003f, + 0x9494009494940094, 0x5c5c005c5c5c005c, 0x0202000202020002, + 0x4a4a004a4a4a004a, 0x3333003333330033, 0x6767006767670067, + 0xf3f300f3f3f300f3, 0x7f7f007f7f7f007f, 0xe2e200e2e2e200e2, + 0x9b9b009b9b9b009b, 0x2626002626260026, 0x3737003737370037, + 0x3b3b003b3b3b003b, 0x9696009696960096, 0x4b4b004b4b4b004b, + 0xbebe00bebebe00be, 0x2e2e002e2e2e002e, 0x7979007979790079, + 0x8c8c008c8c8c008c, 0x6e6e006e6e6e006e, 0x8e8e008e8e8e008e, + 0xf5f500f5f5f500f5, 0xb6b600b6b6b600b6, 0xfdfd00fdfdfd00fd, + 0x5959005959590059, 0x9898009898980098, 0x6a6a006a6a6a006a, + 0x4646004646460046, 0xbaba00bababa00ba, 0x2525002525250025, + 0x4242004242420042, 0xa2a200a2a2a200a2, 0xfafa00fafafa00fa, + 0x0707000707070007, 0x5555005555550055, 0xeeee00eeeeee00ee, + 0x0a0a000a0a0a000a, 0x4949004949490049, 0x6868006868680068, + 0x3838003838380038, 0xa4a400a4a4a400a4, 0x2828002828280028, + 0x7b7b007b7b7b007b, 0xc9c900c9c9c900c9, 0xc1c100c1c1c100c1, + 0xe3e300e3e3e300e3, 0xf4f400f4f4f400f4, 0xc7c700c7c7c700c7, + 0x9e9e009e9e9e009e, }; const u64 camellia_sp11101110[256] = { - 0x7070700070707000ULL, 0x8282820082828200ULL, 0x2c2c2c002c2c2c00ULL, - 0xececec00ececec00ULL, 0xb3b3b300b3b3b300ULL, 0x2727270027272700ULL, - 0xc0c0c000c0c0c000ULL, 0xe5e5e500e5e5e500ULL, 0xe4e4e400e4e4e400ULL, - 0x8585850085858500ULL, 0x5757570057575700ULL, 0x3535350035353500ULL, - 0xeaeaea00eaeaea00ULL, 0x0c0c0c000c0c0c00ULL, 0xaeaeae00aeaeae00ULL, - 0x4141410041414100ULL, 0x2323230023232300ULL, 0xefefef00efefef00ULL, - 0x6b6b6b006b6b6b00ULL, 0x9393930093939300ULL, 0x4545450045454500ULL, - 0x1919190019191900ULL, 0xa5a5a500a5a5a500ULL, 0x2121210021212100ULL, - 0xededed00ededed00ULL, 0x0e0e0e000e0e0e00ULL, 0x4f4f4f004f4f4f00ULL, - 0x4e4e4e004e4e4e00ULL, 0x1d1d1d001d1d1d00ULL, 0x6565650065656500ULL, - 0x9292920092929200ULL, 0xbdbdbd00bdbdbd00ULL, 0x8686860086868600ULL, - 0xb8b8b800b8b8b800ULL, 0xafafaf00afafaf00ULL, 0x8f8f8f008f8f8f00ULL, - 0x7c7c7c007c7c7c00ULL, 0xebebeb00ebebeb00ULL, 0x1f1f1f001f1f1f00ULL, - 0xcecece00cecece00ULL, 0x3e3e3e003e3e3e00ULL, 0x3030300030303000ULL, - 0xdcdcdc00dcdcdc00ULL, 0x5f5f5f005f5f5f00ULL, 0x5e5e5e005e5e5e00ULL, - 0xc5c5c500c5c5c500ULL, 0x0b0b0b000b0b0b00ULL, 0x1a1a1a001a1a1a00ULL, - 0xa6a6a600a6a6a600ULL, 0xe1e1e100e1e1e100ULL, 0x3939390039393900ULL, - 0xcacaca00cacaca00ULL, 0xd5d5d500d5d5d500ULL, 0x4747470047474700ULL, - 0x5d5d5d005d5d5d00ULL, 0x3d3d3d003d3d3d00ULL, 0xd9d9d900d9d9d900ULL, - 0x0101010001010100ULL, 0x5a5a5a005a5a5a00ULL, 0xd6d6d600d6d6d600ULL, - 0x5151510051515100ULL, 0x5656560056565600ULL, 0x6c6c6c006c6c6c00ULL, - 0x4d4d4d004d4d4d00ULL, 0x8b8b8b008b8b8b00ULL, 0x0d0d0d000d0d0d00ULL, - 0x9a9a9a009a9a9a00ULL, 0x6666660066666600ULL, 0xfbfbfb00fbfbfb00ULL, - 0xcccccc00cccccc00ULL, 0xb0b0b000b0b0b000ULL, 0x2d2d2d002d2d2d00ULL, - 0x7474740074747400ULL, 0x1212120012121200ULL, 0x2b2b2b002b2b2b00ULL, - 0x2020200020202000ULL, 0xf0f0f000f0f0f000ULL, 0xb1b1b100b1b1b100ULL, - 0x8484840084848400ULL, 0x9999990099999900ULL, 0xdfdfdf00dfdfdf00ULL, - 0x4c4c4c004c4c4c00ULL, 0xcbcbcb00cbcbcb00ULL, 0xc2c2c200c2c2c200ULL, - 0x3434340034343400ULL, 0x7e7e7e007e7e7e00ULL, 0x7676760076767600ULL, - 0x0505050005050500ULL, 0x6d6d6d006d6d6d00ULL, 0xb7b7b700b7b7b700ULL, - 0xa9a9a900a9a9a900ULL, 0x3131310031313100ULL, 0xd1d1d100d1d1d100ULL, - 0x1717170017171700ULL, 0x0404040004040400ULL, 0xd7d7d700d7d7d700ULL, - 0x1414140014141400ULL, 0x5858580058585800ULL, 0x3a3a3a003a3a3a00ULL, - 0x6161610061616100ULL, 0xdedede00dedede00ULL, 0x1b1b1b001b1b1b00ULL, - 0x1111110011111100ULL, 0x1c1c1c001c1c1c00ULL, 0x3232320032323200ULL, - 0x0f0f0f000f0f0f00ULL, 0x9c9c9c009c9c9c00ULL, 0x1616160016161600ULL, - 0x5353530053535300ULL, 0x1818180018181800ULL, 0xf2f2f200f2f2f200ULL, - 0x2222220022222200ULL, 0xfefefe00fefefe00ULL, 0x4444440044444400ULL, - 0xcfcfcf00cfcfcf00ULL, 0xb2b2b200b2b2b200ULL, 0xc3c3c300c3c3c300ULL, - 0xb5b5b500b5b5b500ULL, 0x7a7a7a007a7a7a00ULL, 0x9191910091919100ULL, - 0x2424240024242400ULL, 0x0808080008080800ULL, 0xe8e8e800e8e8e800ULL, - 0xa8a8a800a8a8a800ULL, 0x6060600060606000ULL, 0xfcfcfc00fcfcfc00ULL, - 0x6969690069696900ULL, 0x5050500050505000ULL, 0xaaaaaa00aaaaaa00ULL, - 0xd0d0d000d0d0d000ULL, 0xa0a0a000a0a0a000ULL, 0x7d7d7d007d7d7d00ULL, - 0xa1a1a100a1a1a100ULL, 0x8989890089898900ULL, 0x6262620062626200ULL, - 0x9797970097979700ULL, 0x5454540054545400ULL, 0x5b5b5b005b5b5b00ULL, - 0x1e1e1e001e1e1e00ULL, 0x9595950095959500ULL, 0xe0e0e000e0e0e000ULL, - 0xffffff00ffffff00ULL, 0x6464640064646400ULL, 0xd2d2d200d2d2d200ULL, - 0x1010100010101000ULL, 0xc4c4c400c4c4c400ULL, 0x0000000000000000ULL, - 0x4848480048484800ULL, 0xa3a3a300a3a3a300ULL, 0xf7f7f700f7f7f700ULL, - 0x7575750075757500ULL, 0xdbdbdb00dbdbdb00ULL, 0x8a8a8a008a8a8a00ULL, - 0x0303030003030300ULL, 0xe6e6e600e6e6e600ULL, 0xdadada00dadada00ULL, - 0x0909090009090900ULL, 0x3f3f3f003f3f3f00ULL, 0xdddddd00dddddd00ULL, - 0x9494940094949400ULL, 0x8787870087878700ULL, 0x5c5c5c005c5c5c00ULL, - 0x8383830083838300ULL, 0x0202020002020200ULL, 0xcdcdcd00cdcdcd00ULL, - 0x4a4a4a004a4a4a00ULL, 0x9090900090909000ULL, 0x3333330033333300ULL, - 0x7373730073737300ULL, 0x6767670067676700ULL, 0xf6f6f600f6f6f600ULL, - 0xf3f3f300f3f3f300ULL, 0x9d9d9d009d9d9d00ULL, 0x7f7f7f007f7f7f00ULL, - 0xbfbfbf00bfbfbf00ULL, 0xe2e2e200e2e2e200ULL, 0x5252520052525200ULL, - 0x9b9b9b009b9b9b00ULL, 0xd8d8d800d8d8d800ULL, 0x2626260026262600ULL, - 0xc8c8c800c8c8c800ULL, 0x3737370037373700ULL, 0xc6c6c600c6c6c600ULL, - 0x3b3b3b003b3b3b00ULL, 0x8181810081818100ULL, 0x9696960096969600ULL, - 0x6f6f6f006f6f6f00ULL, 0x4b4b4b004b4b4b00ULL, 0x1313130013131300ULL, - 0xbebebe00bebebe00ULL, 0x6363630063636300ULL, 0x2e2e2e002e2e2e00ULL, - 0xe9e9e900e9e9e900ULL, 0x7979790079797900ULL, 0xa7a7a700a7a7a700ULL, - 0x8c8c8c008c8c8c00ULL, 0x9f9f9f009f9f9f00ULL, 0x6e6e6e006e6e6e00ULL, - 0xbcbcbc00bcbcbc00ULL, 0x8e8e8e008e8e8e00ULL, 0x2929290029292900ULL, - 0xf5f5f500f5f5f500ULL, 0xf9f9f900f9f9f900ULL, 0xb6b6b600b6b6b600ULL, - 0x2f2f2f002f2f2f00ULL, 0xfdfdfd00fdfdfd00ULL, 0xb4b4b400b4b4b400ULL, - 0x5959590059595900ULL, 0x7878780078787800ULL, 0x9898980098989800ULL, - 0x0606060006060600ULL, 0x6a6a6a006a6a6a00ULL, 0xe7e7e700e7e7e700ULL, - 0x4646460046464600ULL, 0x7171710071717100ULL, 0xbababa00bababa00ULL, - 0xd4d4d400d4d4d400ULL, 0x2525250025252500ULL, 0xababab00ababab00ULL, - 0x4242420042424200ULL, 0x8888880088888800ULL, 0xa2a2a200a2a2a200ULL, - 0x8d8d8d008d8d8d00ULL, 0xfafafa00fafafa00ULL, 0x7272720072727200ULL, - 0x0707070007070700ULL, 0xb9b9b900b9b9b900ULL, 0x5555550055555500ULL, - 0xf8f8f800f8f8f800ULL, 0xeeeeee00eeeeee00ULL, 0xacacac00acacac00ULL, - 0x0a0a0a000a0a0a00ULL, 0x3636360036363600ULL, 0x4949490049494900ULL, - 0x2a2a2a002a2a2a00ULL, 0x6868680068686800ULL, 0x3c3c3c003c3c3c00ULL, - 0x3838380038383800ULL, 0xf1f1f100f1f1f100ULL, 0xa4a4a400a4a4a400ULL, - 0x4040400040404000ULL, 0x2828280028282800ULL, 0xd3d3d300d3d3d300ULL, - 0x7b7b7b007b7b7b00ULL, 0xbbbbbb00bbbbbb00ULL, 0xc9c9c900c9c9c900ULL, - 0x4343430043434300ULL, 0xc1c1c100c1c1c100ULL, 0x1515150015151500ULL, - 0xe3e3e300e3e3e300ULL, 0xadadad00adadad00ULL, 0xf4f4f400f4f4f400ULL, - 0x7777770077777700ULL, 0xc7c7c700c7c7c700ULL, 0x8080800080808000ULL, - 0x9e9e9e009e9e9e00ULL, + 0x7070700070707000, 0x8282820082828200, 0x2c2c2c002c2c2c00, + 0xececec00ececec00, 0xb3b3b300b3b3b300, 0x2727270027272700, + 0xc0c0c000c0c0c000, 0xe5e5e500e5e5e500, 0xe4e4e400e4e4e400, + 0x8585850085858500, 0x5757570057575700, 0x3535350035353500, + 0xeaeaea00eaeaea00, 0x0c0c0c000c0c0c00, 0xaeaeae00aeaeae00, + 0x4141410041414100, 0x2323230023232300, 0xefefef00efefef00, + 0x6b6b6b006b6b6b00, 0x9393930093939300, 0x4545450045454500, + 0x1919190019191900, 0xa5a5a500a5a5a500, 0x2121210021212100, + 0xededed00ededed00, 0x0e0e0e000e0e0e00, 0x4f4f4f004f4f4f00, + 0x4e4e4e004e4e4e00, 0x1d1d1d001d1d1d00, 0x6565650065656500, + 0x9292920092929200, 0xbdbdbd00bdbdbd00, 0x8686860086868600, + 0xb8b8b800b8b8b800, 0xafafaf00afafaf00, 0x8f8f8f008f8f8f00, + 0x7c7c7c007c7c7c00, 0xebebeb00ebebeb00, 0x1f1f1f001f1f1f00, + 0xcecece00cecece00, 0x3e3e3e003e3e3e00, 0x3030300030303000, + 0xdcdcdc00dcdcdc00, 0x5f5f5f005f5f5f00, 0x5e5e5e005e5e5e00, + 0xc5c5c500c5c5c500, 0x0b0b0b000b0b0b00, 0x1a1a1a001a1a1a00, + 0xa6a6a600a6a6a600, 0xe1e1e100e1e1e100, 0x3939390039393900, + 0xcacaca00cacaca00, 0xd5d5d500d5d5d500, 0x4747470047474700, + 0x5d5d5d005d5d5d00, 0x3d3d3d003d3d3d00, 0xd9d9d900d9d9d900, + 0x0101010001010100, 0x5a5a5a005a5a5a00, 0xd6d6d600d6d6d600, + 0x5151510051515100, 0x5656560056565600, 0x6c6c6c006c6c6c00, + 0x4d4d4d004d4d4d00, 0x8b8b8b008b8b8b00, 0x0d0d0d000d0d0d00, + 0x9a9a9a009a9a9a00, 0x6666660066666600, 0xfbfbfb00fbfbfb00, + 0xcccccc00cccccc00, 0xb0b0b000b0b0b000, 0x2d2d2d002d2d2d00, + 0x7474740074747400, 0x1212120012121200, 0x2b2b2b002b2b2b00, + 0x2020200020202000, 0xf0f0f000f0f0f000, 0xb1b1b100b1b1b100, + 0x8484840084848400, 0x9999990099999900, 0xdfdfdf00dfdfdf00, + 0x4c4c4c004c4c4c00, 0xcbcbcb00cbcbcb00, 0xc2c2c200c2c2c200, + 0x3434340034343400, 0x7e7e7e007e7e7e00, 0x7676760076767600, + 0x0505050005050500, 0x6d6d6d006d6d6d00, 0xb7b7b700b7b7b700, + 0xa9a9a900a9a9a900, 0x3131310031313100, 0xd1d1d100d1d1d100, + 0x1717170017171700, 0x0404040004040400, 0xd7d7d700d7d7d700, + 0x1414140014141400, 0x5858580058585800, 0x3a3a3a003a3a3a00, + 0x6161610061616100, 0xdedede00dedede00, 0x1b1b1b001b1b1b00, + 0x1111110011111100, 0x1c1c1c001c1c1c00, 0x3232320032323200, + 0x0f0f0f000f0f0f00, 0x9c9c9c009c9c9c00, 0x1616160016161600, + 0x5353530053535300, 0x1818180018181800, 0xf2f2f200f2f2f200, + 0x2222220022222200, 0xfefefe00fefefe00, 0x4444440044444400, + 0xcfcfcf00cfcfcf00, 0xb2b2b200b2b2b200, 0xc3c3c300c3c3c300, + 0xb5b5b500b5b5b500, 0x7a7a7a007a7a7a00, 0x9191910091919100, + 0x2424240024242400, 0x0808080008080800, 0xe8e8e800e8e8e800, + 0xa8a8a800a8a8a800, 0x6060600060606000, 0xfcfcfc00fcfcfc00, + 0x6969690069696900, 0x5050500050505000, 0xaaaaaa00aaaaaa00, + 0xd0d0d000d0d0d000, 0xa0a0a000a0a0a000, 0x7d7d7d007d7d7d00, + 0xa1a1a100a1a1a100, 0x8989890089898900, 0x6262620062626200, + 0x9797970097979700, 0x5454540054545400, 0x5b5b5b005b5b5b00, + 0x1e1e1e001e1e1e00, 0x9595950095959500, 0xe0e0e000e0e0e000, + 0xffffff00ffffff00, 0x6464640064646400, 0xd2d2d200d2d2d200, + 0x1010100010101000, 0xc4c4c400c4c4c400, 0x0000000000000000, + 0x4848480048484800, 0xa3a3a300a3a3a300, 0xf7f7f700f7f7f700, + 0x7575750075757500, 0xdbdbdb00dbdbdb00, 0x8a8a8a008a8a8a00, + 0x0303030003030300, 0xe6e6e600e6e6e600, 0xdadada00dadada00, + 0x0909090009090900, 0x3f3f3f003f3f3f00, 0xdddddd00dddddd00, + 0x9494940094949400, 0x8787870087878700, 0x5c5c5c005c5c5c00, + 0x8383830083838300, 0x0202020002020200, 0xcdcdcd00cdcdcd00, + 0x4a4a4a004a4a4a00, 0x9090900090909000, 0x3333330033333300, + 0x7373730073737300, 0x6767670067676700, 0xf6f6f600f6f6f600, + 0xf3f3f300f3f3f300, 0x9d9d9d009d9d9d00, 0x7f7f7f007f7f7f00, + 0xbfbfbf00bfbfbf00, 0xe2e2e200e2e2e200, 0x5252520052525200, + 0x9b9b9b009b9b9b00, 0xd8d8d800d8d8d800, 0x2626260026262600, + 0xc8c8c800c8c8c800, 0x3737370037373700, 0xc6c6c600c6c6c600, + 0x3b3b3b003b3b3b00, 0x8181810081818100, 0x9696960096969600, + 0x6f6f6f006f6f6f00, 0x4b4b4b004b4b4b00, 0x1313130013131300, + 0xbebebe00bebebe00, 0x6363630063636300, 0x2e2e2e002e2e2e00, + 0xe9e9e900e9e9e900, 0x7979790079797900, 0xa7a7a700a7a7a700, + 0x8c8c8c008c8c8c00, 0x9f9f9f009f9f9f00, 0x6e6e6e006e6e6e00, + 0xbcbcbc00bcbcbc00, 0x8e8e8e008e8e8e00, 0x2929290029292900, + 0xf5f5f500f5f5f500, 0xf9f9f900f9f9f900, 0xb6b6b600b6b6b600, + 0x2f2f2f002f2f2f00, 0xfdfdfd00fdfdfd00, 0xb4b4b400b4b4b400, + 0x5959590059595900, 0x7878780078787800, 0x9898980098989800, + 0x0606060006060600, 0x6a6a6a006a6a6a00, 0xe7e7e700e7e7e700, + 0x4646460046464600, 0x7171710071717100, 0xbababa00bababa00, + 0xd4d4d400d4d4d400, 0x2525250025252500, 0xababab00ababab00, + 0x4242420042424200, 0x8888880088888800, 0xa2a2a200a2a2a200, + 0x8d8d8d008d8d8d00, 0xfafafa00fafafa00, 0x7272720072727200, + 0x0707070007070700, 0xb9b9b900b9b9b900, 0x5555550055555500, + 0xf8f8f800f8f8f800, 0xeeeeee00eeeeee00, 0xacacac00acacac00, + 0x0a0a0a000a0a0a00, 0x3636360036363600, 0x4949490049494900, + 0x2a2a2a002a2a2a00, 0x6868680068686800, 0x3c3c3c003c3c3c00, + 0x3838380038383800, 0xf1f1f100f1f1f100, 0xa4a4a400a4a4a400, + 0x4040400040404000, 0x2828280028282800, 0xd3d3d300d3d3d300, + 0x7b7b7b007b7b7b00, 0xbbbbbb00bbbbbb00, 0xc9c9c900c9c9c900, + 0x4343430043434300, 0xc1c1c100c1c1c100, 0x1515150015151500, + 0xe3e3e300e3e3e300, 0xadadad00adadad00, 0xf4f4f400f4f4f400, + 0x7777770077777700, 0xc7c7c700c7c7c700, 0x8080800080808000, + 0x9e9e9e009e9e9e00, }; /* key constants */ @@ -1601,6 +1601,7 @@ static struct crypto_alg camellia_algs[6] = { { .cra_ctxsize = sizeof(struct camellia_ctx), .cra_alignmask = 0, .cra_module = THIS_MODULE, + .cra_list = LIST_HEAD_INIT(camellia_algs[0].cra_list), .cra_u = { .cipher = { .cia_min_keysize = CAMELLIA_MIN_KEY_SIZE, @@ -1620,6 +1621,7 @@ static struct crypto_alg camellia_algs[6] = { { .cra_alignmask = 0, .cra_type = &crypto_blkcipher_type, .cra_module = THIS_MODULE, + .cra_list = LIST_HEAD_INIT(camellia_algs[1].cra_list), .cra_u = { .blkcipher = { .min_keysize = CAMELLIA_MIN_KEY_SIZE, @@ -1639,6 +1641,7 @@ static struct crypto_alg camellia_algs[6] = { { .cra_alignmask = 0, .cra_type = &crypto_blkcipher_type, .cra_module = THIS_MODULE, + .cra_list = LIST_HEAD_INIT(camellia_algs[2].cra_list), .cra_u = { .blkcipher = { .min_keysize = CAMELLIA_MIN_KEY_SIZE, @@ -1659,6 +1662,7 @@ static struct crypto_alg camellia_algs[6] = { { .cra_alignmask = 0, .cra_type = &crypto_blkcipher_type, .cra_module = THIS_MODULE, + .cra_list = LIST_HEAD_INIT(camellia_algs[3].cra_list), .cra_u = { .blkcipher = { .min_keysize = CAMELLIA_MIN_KEY_SIZE, @@ -1679,6 +1683,7 @@ static struct crypto_alg camellia_algs[6] = { { .cra_alignmask = 0, .cra_type = &crypto_blkcipher_type, .cra_module = THIS_MODULE, + .cra_list = LIST_HEAD_INIT(camellia_algs[4].cra_list), .cra_exit = lrw_exit_tfm, .cra_u = { .blkcipher = { @@ -1702,6 +1707,7 @@ static struct crypto_alg camellia_algs[6] = { { .cra_alignmask = 0, .cra_type = &crypto_blkcipher_type, .cra_module = THIS_MODULE, + .cra_list = LIST_HEAD_INIT(camellia_algs[5].cra_list), .cra_u = { .blkcipher = { .min_keysize = CAMELLIA_MIN_KEY_SIZE * 2, diff --git a/trunk/arch/x86/crypto/cast5-avx-x86_64-asm_64.S b/trunk/arch/x86/crypto/cast5-avx-x86_64-asm_64.S deleted file mode 100644 index a41a3aaba220..000000000000 --- a/trunk/arch/x86/crypto/cast5-avx-x86_64-asm_64.S +++ /dev/null @@ -1,376 +0,0 @@ -/* - * Cast5 Cipher 16-way parallel algorithm (AVX/x86_64) - * - * Copyright (C) 2012 Johannes Goetzfried - * - * - * Copyright © 2012 Jussi Kivilinna - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - * - */ - -.file "cast5-avx-x86_64-asm_64.S" - -.extern cast5_s1 -.extern cast5_s2 -.extern cast5_s3 -.extern cast5_s4 - -/* structure of crypto context */ -#define km 0 -#define kr (16*4) -#define rr ((16*4)+16) - -/* s-boxes */ -#define s1 cast5_s1 -#define s2 cast5_s2 -#define s3 cast5_s3 -#define s4 cast5_s4 - -/********************************************************************** - 16-way AVX cast5 - **********************************************************************/ -#define CTX %rdi - -#define RL1 %xmm0 -#define RR1 %xmm1 -#define RL2 %xmm2 -#define RR2 %xmm3 -#define RL3 %xmm4 -#define RR3 %xmm5 -#define RL4 %xmm6 -#define RR4 %xmm7 - -#define RX %xmm8 - -#define RKM %xmm9 -#define RKR %xmm10 -#define RKRF %xmm11 -#define RKRR %xmm12 - -#define R32 %xmm13 -#define R1ST %xmm14 - -#define RTMP %xmm15 - -#define RID1 %rbp -#define RID1d %ebp -#define RID2 %rsi -#define RID2d %esi - -#define RGI1 %rdx -#define RGI1bl %dl -#define RGI1bh %dh -#define RGI2 %rcx -#define RGI2bl %cl -#define RGI2bh %ch - -#define RGI3 %rax -#define RGI3bl %al -#define RGI3bh %ah -#define RGI4 %rbx -#define RGI4bl %bl -#define RGI4bh %bh - -#define RFS1 %r8 -#define RFS1d %r8d -#define RFS2 %r9 -#define RFS2d %r9d -#define RFS3 %r10 -#define RFS3d %r10d - - -#define lookup_32bit(src, dst, op1, op2, op3, interleave_op, il_reg) \ - movzbl src ## bh, RID1d; \ - movzbl src ## bl, RID2d; \ - shrq $16, src; \ - movl s1(, RID1, 4), dst ## d; \ - op1 s2(, RID2, 4), dst ## d; \ - movzbl src ## bh, RID1d; \ - movzbl src ## bl, RID2d; \ - interleave_op(il_reg); \ - op2 s3(, RID1, 4), dst ## d; \ - op3 s4(, RID2, 4), dst ## d; - -#define dummy(d) /* do nothing */ - -#define shr_next(reg) \ - shrq $16, reg; - -#define F_head(a, x, gi1, gi2, op0) \ - op0 a, RKM, x; \ - vpslld RKRF, x, RTMP; \ - vpsrld RKRR, x, x; \ - vpor RTMP, x, x; \ - \ - vmovq x, gi1; \ - vpextrq $1, x, gi2; - -#define F_tail(a, x, gi1, gi2, op1, op2, op3) \ - lookup_32bit(##gi1, RFS1, op1, op2, op3, shr_next, ##gi1); \ - lookup_32bit(##gi2, RFS3, op1, op2, op3, shr_next, ##gi2); \ - \ - lookup_32bit(##gi1, RFS2, op1, op2, op3, dummy, none); \ - shlq $32, RFS2; \ - orq RFS1, RFS2; \ - lookup_32bit(##gi2, RFS1, op1, op2, op3, dummy, none); \ - shlq $32, RFS1; \ - orq RFS1, RFS3; \ - \ - vmovq RFS2, x; \ - vpinsrq $1, RFS3, x, x; - -#define F_2(a1, b1, a2, b2, op0, op1, op2, op3) \ - F_head(b1, RX, RGI1, RGI2, op0); \ - F_head(b2, RX, RGI3, RGI4, op0); \ - \ - F_tail(b1, RX, RGI1, RGI2, op1, op2, op3); \ - F_tail(b2, RTMP, RGI3, RGI4, op1, op2, op3); \ - \ - vpxor a1, RX, a1; \ - vpxor a2, RTMP, a2; - -#define F1_2(a1, b1, a2, b2) \ - F_2(a1, b1, a2, b2, vpaddd, xorl, subl, addl) -#define F2_2(a1, b1, a2, b2) \ - F_2(a1, b1, a2, b2, vpxor, subl, addl, xorl) -#define F3_2(a1, b1, a2, b2) \ - F_2(a1, b1, a2, b2, vpsubd, addl, xorl, subl) - -#define subround(a1, b1, a2, b2, f) \ - F ## f ## _2(a1, b1, a2, b2); - -#define round(l, r, n, f) \ - vbroadcastss (km+(4*n))(CTX), RKM; \ - vpand R1ST, RKR, RKRF; \ - vpsubq RKRF, R32, RKRR; \ - vpsrldq $1, RKR, RKR; \ - subround(l ## 1, r ## 1, l ## 2, r ## 2, f); \ - subround(l ## 3, r ## 3, l ## 4, r ## 4, f); - -#define enc_preload_rkr() \ - vbroadcastss .L16_mask, RKR; \ - /* add 16-bit rotation to key rotations (mod 32) */ \ - vpxor kr(CTX), RKR, RKR; - -#define dec_preload_rkr() \ - vbroadcastss .L16_mask, RKR; \ - /* add 16-bit rotation to key rotations (mod 32) */ \ - vpxor kr(CTX), RKR, RKR; \ - vpshufb .Lbswap128_mask, RKR, RKR; - -#define transpose_2x4(x0, x1, t0, t1) \ - vpunpckldq x1, x0, t0; \ - vpunpckhdq x1, x0, t1; \ - \ - vpunpcklqdq t1, t0, x0; \ - vpunpckhqdq t1, t0, x1; - -#define inpack_blocks(in, x0, x1, t0, t1, rmask) \ - vmovdqu (0*4*4)(in), x0; \ - vmovdqu (1*4*4)(in), x1; \ - vpshufb rmask, x0, x0; \ - vpshufb rmask, x1, x1; \ - \ - transpose_2x4(x0, x1, t0, t1) - -#define outunpack_blocks(out, x0, x1, t0, t1, rmask) \ - transpose_2x4(x0, x1, t0, t1) \ - \ - vpshufb rmask, x0, x0; \ - vpshufb rmask, x1, x1; \ - vmovdqu x0, (0*4*4)(out); \ - vmovdqu x1, (1*4*4)(out); - -#define outunpack_xor_blocks(out, x0, x1, t0, t1, rmask) \ - transpose_2x4(x0, x1, t0, t1) \ - \ - vpshufb rmask, x0, x0; \ - vpshufb rmask, x1, x1; \ - vpxor (0*4*4)(out), x0, x0; \ - vmovdqu x0, (0*4*4)(out); \ - vpxor (1*4*4)(out), x1, x1; \ - vmovdqu x1, (1*4*4)(out); - -.data - -.align 16 -.Lbswap_mask: - .byte 3, 2, 1, 0, 7, 6, 5, 4, 11, 10, 9, 8, 15, 14, 13, 12 -.Lbswap128_mask: - .byte 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 -.L16_mask: - .byte 16, 16, 16, 16 -.L32_mask: - .byte 32, 0, 0, 0 -.Lfirst_mask: - .byte 0x1f, 0, 0, 0 - -.text - -.align 16 -.global __cast5_enc_blk_16way -.type __cast5_enc_blk_16way,@function; - -__cast5_enc_blk_16way: - /* input: - * %rdi: ctx, CTX - * %rsi: dst - * %rdx: src - * %rcx: bool, if true: xor output - */ - - pushq %rbp; - pushq %rbx; - pushq %rcx; - - vmovdqa .Lbswap_mask, RKM; - vmovd .Lfirst_mask, R1ST; - vmovd .L32_mask, R32; - enc_preload_rkr(); - - leaq 1*(2*4*4)(%rdx), %rax; - inpack_blocks(%rdx, RL1, RR1, RTMP, RX, RKM); - inpack_blocks(%rax, RL2, RR2, RTMP, RX, RKM); - leaq 2*(2*4*4)(%rdx), %rax; - inpack_blocks(%rax, RL3, RR3, RTMP, RX, RKM); - leaq 3*(2*4*4)(%rdx), %rax; - inpack_blocks(%rax, RL4, RR4, RTMP, RX, RKM); - - movq %rsi, %r11; - - round(RL, RR, 0, 1); - round(RR, RL, 1, 2); - round(RL, RR, 2, 3); - round(RR, RL, 3, 1); - round(RL, RR, 4, 2); - round(RR, RL, 5, 3); - round(RL, RR, 6, 1); - round(RR, RL, 7, 2); - round(RL, RR, 8, 3); - round(RR, RL, 9, 1); - round(RL, RR, 10, 2); - round(RR, RL, 11, 3); - - movzbl rr(CTX), %eax; - testl %eax, %eax; - jnz __skip_enc; - - round(RL, RR, 12, 1); - round(RR, RL, 13, 2); - round(RL, RR, 14, 3); - round(RR, RL, 15, 1); - -__skip_enc: - popq %rcx; - popq %rbx; - popq %rbp; - - vmovdqa .Lbswap_mask, RKM; - leaq 1*(2*4*4)(%r11), %rax; - - testb %cl, %cl; - jnz __enc_xor16; - - outunpack_blocks(%r11, RR1, RL1, RTMP, RX, RKM); - outunpack_blocks(%rax, RR2, RL2, RTMP, RX, RKM); - leaq 2*(2*4*4)(%r11), %rax; - outunpack_blocks(%rax, RR3, RL3, RTMP, RX, RKM); - leaq 3*(2*4*4)(%r11), %rax; - outunpack_blocks(%rax, RR4, RL4, RTMP, RX, RKM); - - ret; - -__enc_xor16: - outunpack_xor_blocks(%r11, RR1, RL1, RTMP, RX, RKM); - outunpack_xor_blocks(%rax, RR2, RL2, RTMP, RX, RKM); - leaq 2*(2*4*4)(%r11), %rax; - outunpack_xor_blocks(%rax, RR3, RL3, RTMP, RX, RKM); - leaq 3*(2*4*4)(%r11), %rax; - outunpack_xor_blocks(%rax, RR4, RL4, RTMP, RX, RKM); - - ret; - -.align 16 -.global cast5_dec_blk_16way -.type cast5_dec_blk_16way,@function; - -cast5_dec_blk_16way: - /* input: - * %rdi: ctx, CTX - * %rsi: dst - * %rdx: src - */ - - pushq %rbp; - pushq %rbx; - - vmovdqa .Lbswap_mask, RKM; - vmovd .Lfirst_mask, R1ST; - vmovd .L32_mask, R32; - dec_preload_rkr(); - - leaq 1*(2*4*4)(%rdx), %rax; - inpack_blocks(%rdx, RL1, RR1, RTMP, RX, RKM); - inpack_blocks(%rax, RL2, RR2, RTMP, RX, RKM); - leaq 2*(2*4*4)(%rdx), %rax; - inpack_blocks(%rax, RL3, RR3, RTMP, RX, RKM); - leaq 3*(2*4*4)(%rdx), %rax; - inpack_blocks(%rax, RL4, RR4, RTMP, RX, RKM); - - movq %rsi, %r11; - - movzbl rr(CTX), %eax; - testl %eax, %eax; - jnz __skip_dec; - - round(RL, RR, 15, 1); - round(RR, RL, 14, 3); - round(RL, RR, 13, 2); - round(RR, RL, 12, 1); - -__dec_tail: - round(RL, RR, 11, 3); - round(RR, RL, 10, 2); - round(RL, RR, 9, 1); - round(RR, RL, 8, 3); - round(RL, RR, 7, 2); - round(RR, RL, 6, 1); - round(RL, RR, 5, 3); - round(RR, RL, 4, 2); - round(RL, RR, 3, 1); - round(RR, RL, 2, 3); - round(RL, RR, 1, 2); - round(RR, RL, 0, 1); - - vmovdqa .Lbswap_mask, RKM; - popq %rbx; - popq %rbp; - - leaq 1*(2*4*4)(%r11), %rax; - outunpack_blocks(%r11, RR1, RL1, RTMP, RX, RKM); - outunpack_blocks(%rax, RR2, RL2, RTMP, RX, RKM); - leaq 2*(2*4*4)(%r11), %rax; - outunpack_blocks(%rax, RR3, RL3, RTMP, RX, RKM); - leaq 3*(2*4*4)(%r11), %rax; - outunpack_blocks(%rax, RR4, RL4, RTMP, RX, RKM); - - ret; - -__skip_dec: - vpsrldq $4, RKR, RKR; - jmp __dec_tail; diff --git a/trunk/arch/x86/crypto/cast5_avx_glue.c b/trunk/arch/x86/crypto/cast5_avx_glue.c deleted file mode 100644 index e0ea14f9547f..000000000000 --- a/trunk/arch/x86/crypto/cast5_avx_glue.c +++ /dev/null @@ -1,530 +0,0 @@ -/* - * Glue Code for the AVX assembler implemention of the Cast5 Cipher - * - * Copyright (C) 2012 Johannes Goetzfried - * - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define CAST5_PARALLEL_BLOCKS 16 - -asmlinkage void __cast5_enc_blk_16way(struct cast5_ctx *ctx, u8 *dst, - const u8 *src, bool xor); -asmlinkage void cast5_dec_blk_16way(struct cast5_ctx *ctx, u8 *dst, - const u8 *src); - -static inline void cast5_enc_blk_xway(struct cast5_ctx *ctx, u8 *dst, - const u8 *src) -{ - __cast5_enc_blk_16way(ctx, dst, src, false); -} - -static inline void cast5_enc_blk_xway_xor(struct cast5_ctx *ctx, u8 *dst, - const u8 *src) -{ - __cast5_enc_blk_16way(ctx, dst, src, true); -} - -static inline void cast5_dec_blk_xway(struct cast5_ctx *ctx, u8 *dst, - const u8 *src) -{ - cast5_dec_blk_16way(ctx, dst, src); -} - - -static inline bool cast5_fpu_begin(bool fpu_enabled, unsigned int nbytes) -{ - return glue_fpu_begin(CAST5_BLOCK_SIZE, CAST5_PARALLEL_BLOCKS, - NULL, fpu_enabled, nbytes); -} - -static inline void cast5_fpu_end(bool fpu_enabled) -{ - return glue_fpu_end(fpu_enabled); -} - -static int ecb_crypt(struct blkcipher_desc *desc, struct blkcipher_walk *walk, - bool enc) -{ - bool fpu_enabled = false; - struct cast5_ctx *ctx = crypto_blkcipher_ctx(desc->tfm); - const unsigned int bsize = CAST5_BLOCK_SIZE; - unsigned int nbytes; - int err; - - err = blkcipher_walk_virt(desc, walk); - desc->flags &= ~CRYPTO_TFM_REQ_MAY_SLEEP; - - while ((nbytes = walk->nbytes)) { - u8 *wsrc = walk->src.virt.addr; - u8 *wdst = walk->dst.virt.addr; - - fpu_enabled = cast5_fpu_begin(fpu_enabled, nbytes); - - /* Process multi-block batch */ - if (nbytes >= bsize * CAST5_PARALLEL_BLOCKS) { - do { - if (enc) - cast5_enc_blk_xway(ctx, wdst, wsrc); - else - cast5_dec_blk_xway(ctx, wdst, wsrc); - - wsrc += bsize * CAST5_PARALLEL_BLOCKS; - wdst += bsize * CAST5_PARALLEL_BLOCKS; - nbytes -= bsize * CAST5_PARALLEL_BLOCKS; - } while (nbytes >= bsize * CAST5_PARALLEL_BLOCKS); - - if (nbytes < bsize) - goto done; - } - - /* Handle leftovers */ - do { - if (enc) - __cast5_encrypt(ctx, wdst, wsrc); - else - __cast5_decrypt(ctx, wdst, wsrc); - - wsrc += bsize; - wdst += bsize; - nbytes -= bsize; - } while (nbytes >= bsize); - -done: - err = blkcipher_walk_done(desc, walk, nbytes); - } - - cast5_fpu_end(fpu_enabled); - return err; -} - -static int ecb_encrypt(struct blkcipher_desc *desc, struct scatterlist *dst, - struct scatterlist *src, unsigned int nbytes) -{ - struct blkcipher_walk walk; - - blkcipher_walk_init(&walk, dst, src, nbytes); - return ecb_crypt(desc, &walk, true); -} - -static int ecb_decrypt(struct blkcipher_desc *desc, struct scatterlist *dst, - struct scatterlist *src, unsigned int nbytes) -{ - struct blkcipher_walk walk; - - blkcipher_walk_init(&walk, dst, src, nbytes); - return ecb_crypt(desc, &walk, false); -} - -static unsigned int __cbc_encrypt(struct blkcipher_desc *desc, - struct blkcipher_walk *walk) -{ - struct cast5_ctx *ctx = crypto_blkcipher_ctx(desc->tfm); - const unsigned int bsize = CAST5_BLOCK_SIZE; - unsigned int nbytes = walk->nbytes; - u64 *src = (u64 *)walk->src.virt.addr; - u64 *dst = (u64 *)walk->dst.virt.addr; - u64 *iv = (u64 *)walk->iv; - - do { - *dst = *src ^ *iv; - __cast5_encrypt(ctx, (u8 *)dst, (u8 *)dst); - iv = dst; - - src += 1; - dst += 1; - nbytes -= bsize; - } while (nbytes >= bsize); - - *(u64 *)walk->iv = *iv; - return nbytes; -} - -static int cbc_encrypt(struct blkcipher_desc *desc, struct scatterlist *dst, - struct scatterlist *src, unsigned int nbytes) -{ - struct blkcipher_walk walk; - int err; - - blkcipher_walk_init(&walk, dst, src, nbytes); - err = blkcipher_walk_virt(desc, &walk); - - while ((nbytes = walk.nbytes)) { - nbytes = __cbc_encrypt(desc, &walk); - err = blkcipher_walk_done(desc, &walk, nbytes); - } - - return err; -} - -static unsigned int __cbc_decrypt(struct blkcipher_desc *desc, - struct blkcipher_walk *walk) -{ - struct cast5_ctx *ctx = crypto_blkcipher_ctx(desc->tfm); - const unsigned int bsize = CAST5_BLOCK_SIZE; - unsigned int nbytes = walk->nbytes; - u64 *src = (u64 *)walk->src.virt.addr; - u64 *dst = (u64 *)walk->dst.virt.addr; - u64 ivs[CAST5_PARALLEL_BLOCKS - 1]; - u64 last_iv; - int i; - - /* Start of the last block. */ - src += nbytes / bsize - 1; - dst += nbytes / bsize - 1; - - last_iv = *src; - - /* Process multi-block batch */ - if (nbytes >= bsize * CAST5_PARALLEL_BLOCKS) { - do { - nbytes -= bsize * (CAST5_PARALLEL_BLOCKS - 1); - src -= CAST5_PARALLEL_BLOCKS - 1; - dst -= CAST5_PARALLEL_BLOCKS - 1; - - for (i = 0; i < CAST5_PARALLEL_BLOCKS - 1; i++) - ivs[i] = src[i]; - - cast5_dec_blk_xway(ctx, (u8 *)dst, (u8 *)src); - - for (i = 0; i < CAST5_PARALLEL_BLOCKS - 1; i++) - *(dst + (i + 1)) ^= *(ivs + i); - - nbytes -= bsize; - if (nbytes < bsize) - goto done; - - *dst ^= *(src - 1); - src -= 1; - dst -= 1; - } while (nbytes >= bsize * CAST5_PARALLEL_BLOCKS); - - if (nbytes < bsize) - goto done; - } - - /* Handle leftovers */ - for (;;) { - __cast5_decrypt(ctx, (u8 *)dst, (u8 *)src); - - nbytes -= bsize; - if (nbytes < bsize) - break; - - *dst ^= *(src - 1); - src -= 1; - dst -= 1; - } - -done: - *dst ^= *(u64 *)walk->iv; - *(u64 *)walk->iv = last_iv; - - return nbytes; -} - -static int cbc_decrypt(struct blkcipher_desc *desc, struct scatterlist *dst, - struct scatterlist *src, unsigned int nbytes) -{ - bool fpu_enabled = false; - struct blkcipher_walk walk; - int err; - - blkcipher_walk_init(&walk, dst, src, nbytes); - err = blkcipher_walk_virt(desc, &walk); - desc->flags &= ~CRYPTO_TFM_REQ_MAY_SLEEP; - - while ((nbytes = walk.nbytes)) { - fpu_enabled = cast5_fpu_begin(fpu_enabled, nbytes); - nbytes = __cbc_decrypt(desc, &walk); - err = blkcipher_walk_done(desc, &walk, nbytes); - } - - cast5_fpu_end(fpu_enabled); - return err; -} - -static void ctr_crypt_final(struct blkcipher_desc *desc, - struct blkcipher_walk *walk) -{ - struct cast5_ctx *ctx = crypto_blkcipher_ctx(desc->tfm); - u8 *ctrblk = walk->iv; - u8 keystream[CAST5_BLOCK_SIZE]; - u8 *src = walk->src.virt.addr; - u8 *dst = walk->dst.virt.addr; - unsigned int nbytes = walk->nbytes; - - __cast5_encrypt(ctx, keystream, ctrblk); - crypto_xor(keystream, src, nbytes); - memcpy(dst, keystream, nbytes); - - crypto_inc(ctrblk, CAST5_BLOCK_SIZE); -} - -static unsigned int __ctr_crypt(struct blkcipher_desc *desc, - struct blkcipher_walk *walk) -{ - struct cast5_ctx *ctx = crypto_blkcipher_ctx(desc->tfm); - const unsigned int bsize = CAST5_BLOCK_SIZE; - unsigned int nbytes = walk->nbytes; - u64 *src = (u64 *)walk->src.virt.addr; - u64 *dst = (u64 *)walk->dst.virt.addr; - u64 ctrblk = be64_to_cpu(*(__be64 *)walk->iv); - __be64 ctrblocks[CAST5_PARALLEL_BLOCKS]; - int i; - - /* Process multi-block batch */ - if (nbytes >= bsize * CAST5_PARALLEL_BLOCKS) { - do { - /* create ctrblks for parallel encrypt */ - for (i = 0; i < CAST5_PARALLEL_BLOCKS; i++) { - if (dst != src) - dst[i] = src[i]; - - ctrblocks[i] = cpu_to_be64(ctrblk++); - } - - cast5_enc_blk_xway_xor(ctx, (u8 *)dst, - (u8 *)ctrblocks); - - src += CAST5_PARALLEL_BLOCKS; - dst += CAST5_PARALLEL_BLOCKS; - nbytes -= bsize * CAST5_PARALLEL_BLOCKS; - } while (nbytes >= bsize * CAST5_PARALLEL_BLOCKS); - - if (nbytes < bsize) - goto done; - } - - /* Handle leftovers */ - do { - if (dst != src) - *dst = *src; - - ctrblocks[0] = cpu_to_be64(ctrblk++); - - __cast5_encrypt(ctx, (u8 *)ctrblocks, (u8 *)ctrblocks); - *dst ^= ctrblocks[0]; - - src += 1; - dst += 1; - nbytes -= bsize; - } while (nbytes >= bsize); - -done: - *(__be64 *)walk->iv = cpu_to_be64(ctrblk); - return nbytes; -} - -static int ctr_crypt(struct blkcipher_desc *desc, struct scatterlist *dst, - struct scatterlist *src, unsigned int nbytes) -{ - bool fpu_enabled = false; - struct blkcipher_walk walk; - int err; - - blkcipher_walk_init(&walk, dst, src, nbytes); - err = blkcipher_walk_virt_block(desc, &walk, CAST5_BLOCK_SIZE); - desc->flags &= ~CRYPTO_TFM_REQ_MAY_SLEEP; - - while ((nbytes = walk.nbytes) >= CAST5_BLOCK_SIZE) { - fpu_enabled = cast5_fpu_begin(fpu_enabled, nbytes); - nbytes = __ctr_crypt(desc, &walk); - err = blkcipher_walk_done(desc, &walk, nbytes); - } - - cast5_fpu_end(fpu_enabled); - - if (walk.nbytes) { - ctr_crypt_final(desc, &walk); - err = blkcipher_walk_done(desc, &walk, 0); - } - - return err; -} - - -static struct crypto_alg cast5_algs[6] = { { - .cra_name = "__ecb-cast5-avx", - .cra_driver_name = "__driver-ecb-cast5-avx", - .cra_priority = 0, - .cra_flags = CRYPTO_ALG_TYPE_BLKCIPHER, - .cra_blocksize = CAST5_BLOCK_SIZE, - .cra_ctxsize = sizeof(struct cast5_ctx), - .cra_alignmask = 0, - .cra_type = &crypto_blkcipher_type, - .cra_module = THIS_MODULE, - .cra_u = { - .blkcipher = { - .min_keysize = CAST5_MIN_KEY_SIZE, - .max_keysize = CAST5_MAX_KEY_SIZE, - .setkey = cast5_setkey, - .encrypt = ecb_encrypt, - .decrypt = ecb_decrypt, - }, - }, -}, { - .cra_name = "__cbc-cast5-avx", - .cra_driver_name = "__driver-cbc-cast5-avx", - .cra_priority = 0, - .cra_flags = CRYPTO_ALG_TYPE_BLKCIPHER, - .cra_blocksize = CAST5_BLOCK_SIZE, - .cra_ctxsize = sizeof(struct cast5_ctx), - .cra_alignmask = 0, - .cra_type = &crypto_blkcipher_type, - .cra_module = THIS_MODULE, - .cra_u = { - .blkcipher = { - .min_keysize = CAST5_MIN_KEY_SIZE, - .max_keysize = CAST5_MAX_KEY_SIZE, - .setkey = cast5_setkey, - .encrypt = cbc_encrypt, - .decrypt = cbc_decrypt, - }, - }, -}, { - .cra_name = "__ctr-cast5-avx", - .cra_driver_name = "__driver-ctr-cast5-avx", - .cra_priority = 0, - .cra_flags = CRYPTO_ALG_TYPE_BLKCIPHER, - .cra_blocksize = 1, - .cra_ctxsize = sizeof(struct cast5_ctx), - .cra_alignmask = 0, - .cra_type = &crypto_blkcipher_type, - .cra_module = THIS_MODULE, - .cra_u = { - .blkcipher = { - .min_keysize = CAST5_MIN_KEY_SIZE, - .max_keysize = CAST5_MAX_KEY_SIZE, - .ivsize = CAST5_BLOCK_SIZE, - .setkey = cast5_setkey, - .encrypt = ctr_crypt, - .decrypt = ctr_crypt, - }, - }, -}, { - .cra_name = "ecb(cast5)", - .cra_driver_name = "ecb-cast5-avx", - .cra_priority = 200, - .cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_ASYNC, - .cra_blocksize = CAST5_BLOCK_SIZE, - .cra_ctxsize = sizeof(struct async_helper_ctx), - .cra_alignmask = 0, - .cra_type = &crypto_ablkcipher_type, - .cra_module = THIS_MODULE, - .cra_init = ablk_init, - .cra_exit = ablk_exit, - .cra_u = { - .ablkcipher = { - .min_keysize = CAST5_MIN_KEY_SIZE, - .max_keysize = CAST5_MAX_KEY_SIZE, - .setkey = ablk_set_key, - .encrypt = ablk_encrypt, - .decrypt = ablk_decrypt, - }, - }, -}, { - .cra_name = "cbc(cast5)", - .cra_driver_name = "cbc-cast5-avx", - .cra_priority = 200, - .cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_ASYNC, - .cra_blocksize = CAST5_BLOCK_SIZE, - .cra_ctxsize = sizeof(struct async_helper_ctx), - .cra_alignmask = 0, - .cra_type = &crypto_ablkcipher_type, - .cra_module = THIS_MODULE, - .cra_init = ablk_init, - .cra_exit = ablk_exit, - .cra_u = { - .ablkcipher = { - .min_keysize = CAST5_MIN_KEY_SIZE, - .max_keysize = CAST5_MAX_KEY_SIZE, - .ivsize = CAST5_BLOCK_SIZE, - .setkey = ablk_set_key, - .encrypt = __ablk_encrypt, - .decrypt = ablk_decrypt, - }, - }, -}, { - .cra_name = "ctr(cast5)", - .cra_driver_name = "ctr-cast5-avx", - .cra_priority = 200, - .cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_ASYNC, - .cra_blocksize = 1, - .cra_ctxsize = sizeof(struct async_helper_ctx), - .cra_alignmask = 0, - .cra_type = &crypto_ablkcipher_type, - .cra_module = THIS_MODULE, - .cra_init = ablk_init, - .cra_exit = ablk_exit, - .cra_u = { - .ablkcipher = { - .min_keysize = CAST5_MIN_KEY_SIZE, - .max_keysize = CAST5_MAX_KEY_SIZE, - .ivsize = CAST5_BLOCK_SIZE, - .setkey = ablk_set_key, - .encrypt = ablk_encrypt, - .decrypt = ablk_encrypt, - .geniv = "chainiv", - }, - }, -} }; - -static int __init cast5_init(void) -{ - u64 xcr0; - - if (!cpu_has_avx || !cpu_has_osxsave) { - pr_info("AVX instructions are not detected.\n"); - return -ENODEV; - } - - xcr0 = xgetbv(XCR_XFEATURE_ENABLED_MASK); - if ((xcr0 & (XSTATE_SSE | XSTATE_YMM)) != (XSTATE_SSE | XSTATE_YMM)) { - pr_info("AVX detected but unusable.\n"); - return -ENODEV; - } - - return crypto_register_algs(cast5_algs, ARRAY_SIZE(cast5_algs)); -} - -static void __exit cast5_exit(void) -{ - crypto_unregister_algs(cast5_algs, ARRAY_SIZE(cast5_algs)); -} - -module_init(cast5_init); -module_exit(cast5_exit); - -MODULE_DESCRIPTION("Cast5 Cipher Algorithm, AVX optimized"); -MODULE_LICENSE("GPL"); -MODULE_ALIAS("cast5"); diff --git a/trunk/arch/x86/crypto/cast6-avx-x86_64-asm_64.S b/trunk/arch/x86/crypto/cast6-avx-x86_64-asm_64.S deleted file mode 100644 index 218d283772f4..000000000000 --- a/trunk/arch/x86/crypto/cast6-avx-x86_64-asm_64.S +++ /dev/null @@ -1,383 +0,0 @@ -/* - * Cast6 Cipher 8-way parallel algorithm (AVX/x86_64) - * - * Copyright (C) 2012 Johannes Goetzfried - * - * - * Copyright © 2012 Jussi Kivilinna - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - * - */ - -.file "cast6-avx-x86_64-asm_64.S" - -.extern cast6_s1 -.extern cast6_s2 -.extern cast6_s3 -.extern cast6_s4 - -/* structure of crypto context */ -#define km 0 -#define kr (12*4*4) - -/* s-boxes */ -#define s1 cast6_s1 -#define s2 cast6_s2 -#define s3 cast6_s3 -#define s4 cast6_s4 - -/********************************************************************** - 8-way AVX cast6 - **********************************************************************/ -#define CTX %rdi - -#define RA1 %xmm0 -#define RB1 %xmm1 -#define RC1 %xmm2 -#define RD1 %xmm3 - -#define RA2 %xmm4 -#define RB2 %xmm5 -#define RC2 %xmm6 -#define RD2 %xmm7 - -#define RX %xmm8 - -#define RKM %xmm9 -#define RKR %xmm10 -#define RKRF %xmm11 -#define RKRR %xmm12 -#define R32 %xmm13 -#define R1ST %xmm14 - -#define RTMP %xmm15 - -#define RID1 %rbp -#define RID1d %ebp -#define RID2 %rsi -#define RID2d %esi - -#define RGI1 %rdx -#define RGI1bl %dl -#define RGI1bh %dh -#define RGI2 %rcx -#define RGI2bl %cl -#define RGI2bh %ch - -#define RGI3 %rax -#define RGI3bl %al -#define RGI3bh %ah -#define RGI4 %rbx -#define RGI4bl %bl -#define RGI4bh %bh - -#define RFS1 %r8 -#define RFS1d %r8d -#define RFS2 %r9 -#define RFS2d %r9d -#define RFS3 %r10 -#define RFS3d %r10d - - -#define lookup_32bit(src, dst, op1, op2, op3, interleave_op, il_reg) \ - movzbl src ## bh, RID1d; \ - movzbl src ## bl, RID2d; \ - shrq $16, src; \ - movl s1(, RID1, 4), dst ## d; \ - op1 s2(, RID2, 4), dst ## d; \ - movzbl src ## bh, RID1d; \ - movzbl src ## bl, RID2d; \ - interleave_op(il_reg); \ - op2 s3(, RID1, 4), dst ## d; \ - op3 s4(, RID2, 4), dst ## d; - -#define dummy(d) /* do nothing */ - -#define shr_next(reg) \ - shrq $16, reg; - -#define F_head(a, x, gi1, gi2, op0) \ - op0 a, RKM, x; \ - vpslld RKRF, x, RTMP; \ - vpsrld RKRR, x, x; \ - vpor RTMP, x, x; \ - \ - vmovq x, gi1; \ - vpextrq $1, x, gi2; - -#define F_tail(a, x, gi1, gi2, op1, op2, op3) \ - lookup_32bit(##gi1, RFS1, op1, op2, op3, shr_next, ##gi1); \ - lookup_32bit(##gi2, RFS3, op1, op2, op3, shr_next, ##gi2); \ - \ - lookup_32bit(##gi1, RFS2, op1, op2, op3, dummy, none); \ - shlq $32, RFS2; \ - orq RFS1, RFS2; \ - lookup_32bit(##gi2, RFS1, op1, op2, op3, dummy, none); \ - shlq $32, RFS1; \ - orq RFS1, RFS3; \ - \ - vmovq RFS2, x; \ - vpinsrq $1, RFS3, x, x; - -#define F_2(a1, b1, a2, b2, op0, op1, op2, op3) \ - F_head(b1, RX, RGI1, RGI2, op0); \ - F_head(b2, RX, RGI3, RGI4, op0); \ - \ - F_tail(b1, RX, RGI1, RGI2, op1, op2, op3); \ - F_tail(b2, RTMP, RGI3, RGI4, op1, op2, op3); \ - \ - vpxor a1, RX, a1; \ - vpxor a2, RTMP, a2; - -#define F1_2(a1, b1, a2, b2) \ - F_2(a1, b1, a2, b2, vpaddd, xorl, subl, addl) -#define F2_2(a1, b1, a2, b2) \ - F_2(a1, b1, a2, b2, vpxor, subl, addl, xorl) -#define F3_2(a1, b1, a2, b2) \ - F_2(a1, b1, a2, b2, vpsubd, addl, xorl, subl) - -#define qop(in, out, f) \ - F ## f ## _2(out ## 1, in ## 1, out ## 2, in ## 2); - -#define get_round_keys(nn) \ - vbroadcastss (km+(4*(nn)))(CTX), RKM; \ - vpand R1ST, RKR, RKRF; \ - vpsubq RKRF, R32, RKRR; \ - vpsrldq $1, RKR, RKR; - -#define Q(n) \ - get_round_keys(4*n+0); \ - qop(RD, RC, 1); \ - \ - get_round_keys(4*n+1); \ - qop(RC, RB, 2); \ - \ - get_round_keys(4*n+2); \ - qop(RB, RA, 3); \ - \ - get_round_keys(4*n+3); \ - qop(RA, RD, 1); - -#define QBAR(n) \ - get_round_keys(4*n+3); \ - qop(RA, RD, 1); \ - \ - get_round_keys(4*n+2); \ - qop(RB, RA, 3); \ - \ - get_round_keys(4*n+1); \ - qop(RC, RB, 2); \ - \ - get_round_keys(4*n+0); \ - qop(RD, RC, 1); - -#define shuffle(mask) \ - vpshufb mask, RKR, RKR; - -#define preload_rkr(n, do_mask, mask) \ - vbroadcastss .L16_mask, RKR; \ - /* add 16-bit rotation to key rotations (mod 32) */ \ - vpxor (kr+n*16)(CTX), RKR, RKR; \ - do_mask(mask); - -#define transpose_4x4(x0, x1, x2, x3, t0, t1, t2) \ - vpunpckldq x1, x0, t0; \ - vpunpckhdq x1, x0, t2; \ - vpunpckldq x3, x2, t1; \ - vpunpckhdq x3, x2, x3; \ - \ - vpunpcklqdq t1, t0, x0; \ - vpunpckhqdq t1, t0, x1; \ - vpunpcklqdq x3, t2, x2; \ - vpunpckhqdq x3, t2, x3; - -#define inpack_blocks(in, x0, x1, x2, x3, t0, t1, t2, rmask) \ - vmovdqu (0*4*4)(in), x0; \ - vmovdqu (1*4*4)(in), x1; \ - vmovdqu (2*4*4)(in), x2; \ - vmovdqu (3*4*4)(in), x3; \ - vpshufb rmask, x0, x0; \ - vpshufb rmask, x1, x1; \ - vpshufb rmask, x2, x2; \ - vpshufb rmask, x3, x3; \ - \ - transpose_4x4(x0, x1, x2, x3, t0, t1, t2) - -#define outunpack_blocks(out, x0, x1, x2, x3, t0, t1, t2, rmask) \ - transpose_4x4(x0, x1, x2, x3, t0, t1, t2) \ - \ - vpshufb rmask, x0, x0; \ - vpshufb rmask, x1, x1; \ - vpshufb rmask, x2, x2; \ - vpshufb rmask, x3, x3; \ - vmovdqu x0, (0*4*4)(out); \ - vmovdqu x1, (1*4*4)(out); \ - vmovdqu x2, (2*4*4)(out); \ - vmovdqu x3, (3*4*4)(out); - -#define outunpack_xor_blocks(out, x0, x1, x2, x3, t0, t1, t2, rmask) \ - transpose_4x4(x0, x1, x2, x3, t0, t1, t2) \ - \ - vpshufb rmask, x0, x0; \ - vpshufb rmask, x1, x1; \ - vpshufb rmask, x2, x2; \ - vpshufb rmask, x3, x3; \ - vpxor (0*4*4)(out), x0, x0; \ - vmovdqu x0, (0*4*4)(out); \ - vpxor (1*4*4)(out), x1, x1; \ - vmovdqu x1, (1*4*4)(out); \ - vpxor (2*4*4)(out), x2, x2; \ - vmovdqu x2, (2*4*4)(out); \ - vpxor (3*4*4)(out), x3, x3; \ - vmovdqu x3, (3*4*4)(out); - -.data - -.align 16 -.Lbswap_mask: - .byte 3, 2, 1, 0, 7, 6, 5, 4, 11, 10, 9, 8, 15, 14, 13, 12 -.Lrkr_enc_Q_Q_QBAR_QBAR: - .byte 0, 1, 2, 3, 4, 5, 6, 7, 11, 10, 9, 8, 15, 14, 13, 12 -.Lrkr_enc_QBAR_QBAR_QBAR_QBAR: - .byte 3, 2, 1, 0, 7, 6, 5, 4, 11, 10, 9, 8, 15, 14, 13, 12 -.Lrkr_dec_Q_Q_Q_Q: - .byte 12, 13, 14, 15, 8, 9, 10, 11, 4, 5, 6, 7, 0, 1, 2, 3 -.Lrkr_dec_Q_Q_QBAR_QBAR: - .byte 12, 13, 14, 15, 8, 9, 10, 11, 7, 6, 5, 4, 3, 2, 1, 0 -.Lrkr_dec_QBAR_QBAR_QBAR_QBAR: - .byte 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 -.L16_mask: - .byte 16, 16, 16, 16 -.L32_mask: - .byte 32, 0, 0, 0 -.Lfirst_mask: - .byte 0x1f, 0, 0, 0 - -.text - -.align 16 -.global __cast6_enc_blk_8way -.type __cast6_enc_blk_8way,@function; - -__cast6_enc_blk_8way: - /* input: - * %rdi: ctx, CTX - * %rsi: dst - * %rdx: src - * %rcx: bool, if true: xor output - */ - - pushq %rbp; - pushq %rbx; - pushq %rcx; - - vmovdqa .Lbswap_mask, RKM; - vmovd .Lfirst_mask, R1ST; - vmovd .L32_mask, R32; - - leaq (4*4*4)(%rdx), %rax; - inpack_blocks(%rdx, RA1, RB1, RC1, RD1, RTMP, RX, RKRF, RKM); - inpack_blocks(%rax, RA2, RB2, RC2, RD2, RTMP, RX, RKRF, RKM); - - movq %rsi, %r11; - - preload_rkr(0, dummy, none); - Q(0); - Q(1); - Q(2); - Q(3); - preload_rkr(1, shuffle, .Lrkr_enc_Q_Q_QBAR_QBAR); - Q(4); - Q(5); - QBAR(6); - QBAR(7); - preload_rkr(2, shuffle, .Lrkr_enc_QBAR_QBAR_QBAR_QBAR); - QBAR(8); - QBAR(9); - QBAR(10); - QBAR(11); - - popq %rcx; - popq %rbx; - popq %rbp; - - vmovdqa .Lbswap_mask, RKM; - leaq (4*4*4)(%r11), %rax; - - testb %cl, %cl; - jnz __enc_xor8; - - outunpack_blocks(%r11, RA1, RB1, RC1, RD1, RTMP, RX, RKRF, RKM); - outunpack_blocks(%rax, RA2, RB2, RC2, RD2, RTMP, RX, RKRF, RKM); - - ret; - -__enc_xor8: - outunpack_xor_blocks(%r11, RA1, RB1, RC1, RD1, RTMP, RX, RKRF, RKM); - outunpack_xor_blocks(%rax, RA2, RB2, RC2, RD2, RTMP, RX, RKRF, RKM); - - ret; - -.align 16 -.global cast6_dec_blk_8way -.type cast6_dec_blk_8way,@function; - -cast6_dec_blk_8way: - /* input: - * %rdi: ctx, CTX - * %rsi: dst - * %rdx: src - */ - - pushq %rbp; - pushq %rbx; - - vmovdqa .Lbswap_mask, RKM; - vmovd .Lfirst_mask, R1ST; - vmovd .L32_mask, R32; - - leaq (4*4*4)(%rdx), %rax; - inpack_blocks(%rdx, RA1, RB1, RC1, RD1, RTMP, RX, RKRF, RKM); - inpack_blocks(%rax, RA2, RB2, RC2, RD2, RTMP, RX, RKRF, RKM); - - movq %rsi, %r11; - - preload_rkr(2, shuffle, .Lrkr_dec_Q_Q_Q_Q); - Q(11); - Q(10); - Q(9); - Q(8); - preload_rkr(1, shuffle, .Lrkr_dec_Q_Q_QBAR_QBAR); - Q(7); - Q(6); - QBAR(5); - QBAR(4); - preload_rkr(0, shuffle, .Lrkr_dec_QBAR_QBAR_QBAR_QBAR); - QBAR(3); - QBAR(2); - QBAR(1); - QBAR(0); - - popq %rbx; - popq %rbp; - - vmovdqa .Lbswap_mask, RKM; - leaq (4*4*4)(%r11), %rax; - outunpack_blocks(%r11, RA1, RB1, RC1, RD1, RTMP, RX, RKRF, RKM); - outunpack_blocks(%rax, RA2, RB2, RC2, RD2, RTMP, RX, RKRF, RKM); - - ret; diff --git a/trunk/arch/x86/crypto/cast6_avx_glue.c b/trunk/arch/x86/crypto/cast6_avx_glue.c deleted file mode 100644 index 15e5f85a5011..000000000000 --- a/trunk/arch/x86/crypto/cast6_avx_glue.c +++ /dev/null @@ -1,648 +0,0 @@ -/* - * Glue Code for the AVX assembler implemention of the Cast6 Cipher - * - * Copyright (C) 2012 Johannes Goetzfried - * - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define CAST6_PARALLEL_BLOCKS 8 - -asmlinkage void __cast6_enc_blk_8way(struct cast6_ctx *ctx, u8 *dst, - const u8 *src, bool xor); -asmlinkage void cast6_dec_blk_8way(struct cast6_ctx *ctx, u8 *dst, - const u8 *src); - -static inline void cast6_enc_blk_xway(struct cast6_ctx *ctx, u8 *dst, - const u8 *src) -{ - __cast6_enc_blk_8way(ctx, dst, src, false); -} - -static inline void cast6_enc_blk_xway_xor(struct cast6_ctx *ctx, u8 *dst, - const u8 *src) -{ - __cast6_enc_blk_8way(ctx, dst, src, true); -} - -static inline void cast6_dec_blk_xway(struct cast6_ctx *ctx, u8 *dst, - const u8 *src) -{ - cast6_dec_blk_8way(ctx, dst, src); -} - - -static void cast6_decrypt_cbc_xway(void *ctx, u128 *dst, const u128 *src) -{ - u128 ivs[CAST6_PARALLEL_BLOCKS - 1]; - unsigned int j; - - for (j = 0; j < CAST6_PARALLEL_BLOCKS - 1; j++) - ivs[j] = src[j]; - - cast6_dec_blk_xway(ctx, (u8 *)dst, (u8 *)src); - - for (j = 0; j < CAST6_PARALLEL_BLOCKS - 1; j++) - u128_xor(dst + (j + 1), dst + (j + 1), ivs + j); -} - -static void cast6_crypt_ctr(void *ctx, u128 *dst, const u128 *src, u128 *iv) -{ - be128 ctrblk; - - u128_to_be128(&ctrblk, iv); - u128_inc(iv); - - __cast6_encrypt(ctx, (u8 *)&ctrblk, (u8 *)&ctrblk); - u128_xor(dst, src, (u128 *)&ctrblk); -} - -static void cast6_crypt_ctr_xway(void *ctx, u128 *dst, const u128 *src, - u128 *iv) -{ - be128 ctrblks[CAST6_PARALLEL_BLOCKS]; - unsigned int i; - - for (i = 0; i < CAST6_PARALLEL_BLOCKS; i++) { - if (dst != src) - dst[i] = src[i]; - - u128_to_be128(&ctrblks[i], iv); - u128_inc(iv); - } - - cast6_enc_blk_xway_xor(ctx, (u8 *)dst, (u8 *)ctrblks); -} - -static const struct common_glue_ctx cast6_enc = { - .num_funcs = 2, - .fpu_blocks_limit = CAST6_PARALLEL_BLOCKS, - - .funcs = { { - .num_blocks = CAST6_PARALLEL_BLOCKS, - .fn_u = { .ecb = GLUE_FUNC_CAST(cast6_enc_blk_xway) } - }, { - .num_blocks = 1, - .fn_u = { .ecb = GLUE_FUNC_CAST(__cast6_encrypt) } - } } -}; - -static const struct common_glue_ctx cast6_ctr = { - .num_funcs = 2, - .fpu_blocks_limit = CAST6_PARALLEL_BLOCKS, - - .funcs = { { - .num_blocks = CAST6_PARALLEL_BLOCKS, - .fn_u = { .ctr = GLUE_CTR_FUNC_CAST(cast6_crypt_ctr_xway) } - }, { - .num_blocks = 1, - .fn_u = { .ctr = GLUE_CTR_FUNC_CAST(cast6_crypt_ctr) } - } } -}; - -static const struct common_glue_ctx cast6_dec = { - .num_funcs = 2, - .fpu_blocks_limit = CAST6_PARALLEL_BLOCKS, - - .funcs = { { - .num_blocks = CAST6_PARALLEL_BLOCKS, - .fn_u = { .ecb = GLUE_FUNC_CAST(cast6_dec_blk_xway) } - }, { - .num_blocks = 1, - .fn_u = { .ecb = GLUE_FUNC_CAST(__cast6_decrypt) } - } } -}; - -static const struct common_glue_ctx cast6_dec_cbc = { - .num_funcs = 2, - .fpu_blocks_limit = CAST6_PARALLEL_BLOCKS, - - .funcs = { { - .num_blocks = CAST6_PARALLEL_BLOCKS, - .fn_u = { .cbc = GLUE_CBC_FUNC_CAST(cast6_decrypt_cbc_xway) } - }, { - .num_blocks = 1, - .fn_u = { .cbc = GLUE_CBC_FUNC_CAST(__cast6_decrypt) } - } } -}; - -static int ecb_encrypt(struct blkcipher_desc *desc, struct scatterlist *dst, - struct scatterlist *src, unsigned int nbytes) -{ - return glue_ecb_crypt_128bit(&cast6_enc, desc, dst, src, nbytes); -} - -static int ecb_decrypt(struct blkcipher_desc *desc, struct scatterlist *dst, - struct scatterlist *src, unsigned int nbytes) -{ - return glue_ecb_crypt_128bit(&cast6_dec, desc, dst, src, nbytes); -} - -static int cbc_encrypt(struct blkcipher_desc *desc, struct scatterlist *dst, - struct scatterlist *src, unsigned int nbytes) -{ - return glue_cbc_encrypt_128bit(GLUE_FUNC_CAST(__cast6_encrypt), desc, - dst, src, nbytes); -} - -static int cbc_decrypt(struct blkcipher_desc *desc, struct scatterlist *dst, - struct scatterlist *src, unsigned int nbytes) -{ - return glue_cbc_decrypt_128bit(&cast6_dec_cbc, desc, dst, src, - nbytes); -} - -static int ctr_crypt(struct blkcipher_desc *desc, struct scatterlist *dst, - struct scatterlist *src, unsigned int nbytes) -{ - return glue_ctr_crypt_128bit(&cast6_ctr, desc, dst, src, nbytes); -} - -static inline bool cast6_fpu_begin(bool fpu_enabled, unsigned int nbytes) -{ - return glue_fpu_begin(CAST6_BLOCK_SIZE, CAST6_PARALLEL_BLOCKS, - NULL, fpu_enabled, nbytes); -} - -static inline void cast6_fpu_end(bool fpu_enabled) -{ - glue_fpu_end(fpu_enabled); -} - -struct crypt_priv { - struct cast6_ctx *ctx; - bool fpu_enabled; -}; - -static void encrypt_callback(void *priv, u8 *srcdst, unsigned int nbytes) -{ - const unsigned int bsize = CAST6_BLOCK_SIZE; - struct crypt_priv *ctx = priv; - int i; - - ctx->fpu_enabled = cast6_fpu_begin(ctx->fpu_enabled, nbytes); - - if (nbytes == bsize * CAST6_PARALLEL_BLOCKS) { - cast6_enc_blk_xway(ctx->ctx, srcdst, srcdst); - return; - } - - for (i = 0; i < nbytes / bsize; i++, srcdst += bsize) - __cast6_encrypt(ctx->ctx, srcdst, srcdst); -} - -static void decrypt_callback(void *priv, u8 *srcdst, unsigned int nbytes) -{ - const unsigned int bsize = CAST6_BLOCK_SIZE; - struct crypt_priv *ctx = priv; - int i; - - ctx->fpu_enabled = cast6_fpu_begin(ctx->fpu_enabled, nbytes); - - if (nbytes == bsize * CAST6_PARALLEL_BLOCKS) { - cast6_dec_blk_xway(ctx->ctx, srcdst, srcdst); - return; - } - - for (i = 0; i < nbytes / bsize; i++, srcdst += bsize) - __cast6_decrypt(ctx->ctx, srcdst, srcdst); -} - -struct cast6_lrw_ctx { - struct lrw_table_ctx lrw_table; - struct cast6_ctx cast6_ctx; -}; - -static int lrw_cast6_setkey(struct crypto_tfm *tfm, const u8 *key, - unsigned int keylen) -{ - struct cast6_lrw_ctx *ctx = crypto_tfm_ctx(tfm); - int err; - - err = __cast6_setkey(&ctx->cast6_ctx, key, keylen - CAST6_BLOCK_SIZE, - &tfm->crt_flags); - if (err) - return err; - - return lrw_init_table(&ctx->lrw_table, key + keylen - CAST6_BLOCK_SIZE); -} - -static int lrw_encrypt(struct blkcipher_desc *desc, struct scatterlist *dst, - struct scatterlist *src, unsigned int nbytes) -{ - struct cast6_lrw_ctx *ctx = crypto_blkcipher_ctx(desc->tfm); - be128 buf[CAST6_PARALLEL_BLOCKS]; - struct crypt_priv crypt_ctx = { - .ctx = &ctx->cast6_ctx, - .fpu_enabled = false, - }; - struct lrw_crypt_req req = { - .tbuf = buf, - .tbuflen = sizeof(buf), - - .table_ctx = &ctx->lrw_table, - .crypt_ctx = &crypt_ctx, - .crypt_fn = encrypt_callback, - }; - int ret; - - desc->flags &= ~CRYPTO_TFM_REQ_MAY_SLEEP; - ret = lrw_crypt(desc, dst, src, nbytes, &req); - cast6_fpu_end(crypt_ctx.fpu_enabled); - - return ret; -} - -static int lrw_decrypt(struct blkcipher_desc *desc, struct scatterlist *dst, - struct scatterlist *src, unsigned int nbytes) -{ - struct cast6_lrw_ctx *ctx = crypto_blkcipher_ctx(desc->tfm); - be128 buf[CAST6_PARALLEL_BLOCKS]; - struct crypt_priv crypt_ctx = { - .ctx = &ctx->cast6_ctx, - .fpu_enabled = false, - }; - struct lrw_crypt_req req = { - .tbuf = buf, - .tbuflen = sizeof(buf), - - .table_ctx = &ctx->lrw_table, - .crypt_ctx = &crypt_ctx, - .crypt_fn = decrypt_callback, - }; - int ret; - - desc->flags &= ~CRYPTO_TFM_REQ_MAY_SLEEP; - ret = lrw_crypt(desc, dst, src, nbytes, &req); - cast6_fpu_end(crypt_ctx.fpu_enabled); - - return ret; -} - -static void lrw_exit_tfm(struct crypto_tfm *tfm) -{ - struct cast6_lrw_ctx *ctx = crypto_tfm_ctx(tfm); - - lrw_free_table(&ctx->lrw_table); -} - -struct cast6_xts_ctx { - struct cast6_ctx tweak_ctx; - struct cast6_ctx crypt_ctx; -}; - -static int xts_cast6_setkey(struct crypto_tfm *tfm, const u8 *key, - unsigned int keylen) -{ - struct cast6_xts_ctx *ctx = crypto_tfm_ctx(tfm); - u32 *flags = &tfm->crt_flags; - int err; - - /* key consists of keys of equal size concatenated, therefore - * the length must be even - */ - if (keylen % 2) { - *flags |= CRYPTO_TFM_RES_BAD_KEY_LEN; - return -EINVAL; - } - - /* first half of xts-key is for crypt */ - err = __cast6_setkey(&ctx->crypt_ctx, key, keylen / 2, flags); - if (err) - return err; - - /* second half of xts-key is for tweak */ - return __cast6_setkey(&ctx->tweak_ctx, key + keylen / 2, keylen / 2, - flags); -} - -static int xts_encrypt(struct blkcipher_desc *desc, struct scatterlist *dst, - struct scatterlist *src, unsigned int nbytes) -{ - struct cast6_xts_ctx *ctx = crypto_blkcipher_ctx(desc->tfm); - be128 buf[CAST6_PARALLEL_BLOCKS]; - struct crypt_priv crypt_ctx = { - .ctx = &ctx->crypt_ctx, - .fpu_enabled = false, - }; - struct xts_crypt_req req = { - .tbuf = buf, - .tbuflen = sizeof(buf), - - .tweak_ctx = &ctx->tweak_ctx, - .tweak_fn = XTS_TWEAK_CAST(__cast6_encrypt), - .crypt_ctx = &crypt_ctx, - .crypt_fn = encrypt_callback, - }; - int ret; - - desc->flags &= ~CRYPTO_TFM_REQ_MAY_SLEEP; - ret = xts_crypt(desc, dst, src, nbytes, &req); - cast6_fpu_end(crypt_ctx.fpu_enabled); - - return ret; -} - -static int xts_decrypt(struct blkcipher_desc *desc, struct scatterlist *dst, - struct scatterlist *src, unsigned int nbytes) -{ - struct cast6_xts_ctx *ctx = crypto_blkcipher_ctx(desc->tfm); - be128 buf[CAST6_PARALLEL_BLOCKS]; - struct crypt_priv crypt_ctx = { - .ctx = &ctx->crypt_ctx, - .fpu_enabled = false, - }; - struct xts_crypt_req req = { - .tbuf = buf, - .tbuflen = sizeof(buf), - - .tweak_ctx = &ctx->tweak_ctx, - .tweak_fn = XTS_TWEAK_CAST(__cast6_encrypt), - .crypt_ctx = &crypt_ctx, - .crypt_fn = decrypt_callback, - }; - int ret; - - desc->flags &= ~CRYPTO_TFM_REQ_MAY_SLEEP; - ret = xts_crypt(desc, dst, src, nbytes, &req); - cast6_fpu_end(crypt_ctx.fpu_enabled); - - return ret; -} - -static struct crypto_alg cast6_algs[10] = { { - .cra_name = "__ecb-cast6-avx", - .cra_driver_name = "__driver-ecb-cast6-avx", - .cra_priority = 0, - .cra_flags = CRYPTO_ALG_TYPE_BLKCIPHER, - .cra_blocksize = CAST6_BLOCK_SIZE, - .cra_ctxsize = sizeof(struct cast6_ctx), - .cra_alignmask = 0, - .cra_type = &crypto_blkcipher_type, - .cra_module = THIS_MODULE, - .cra_u = { - .blkcipher = { - .min_keysize = CAST6_MIN_KEY_SIZE, - .max_keysize = CAST6_MAX_KEY_SIZE, - .setkey = cast6_setkey, - .encrypt = ecb_encrypt, - .decrypt = ecb_decrypt, - }, - }, -}, { - .cra_name = "__cbc-cast6-avx", - .cra_driver_name = "__driver-cbc-cast6-avx", - .cra_priority = 0, - .cra_flags = CRYPTO_ALG_TYPE_BLKCIPHER, - .cra_blocksize = CAST6_BLOCK_SIZE, - .cra_ctxsize = sizeof(struct cast6_ctx), - .cra_alignmask = 0, - .cra_type = &crypto_blkcipher_type, - .cra_module = THIS_MODULE, - .cra_u = { - .blkcipher = { - .min_keysize = CAST6_MIN_KEY_SIZE, - .max_keysize = CAST6_MAX_KEY_SIZE, - .setkey = cast6_setkey, - .encrypt = cbc_encrypt, - .decrypt = cbc_decrypt, - }, - }, -}, { - .cra_name = "__ctr-cast6-avx", - .cra_driver_name = "__driver-ctr-cast6-avx", - .cra_priority = 0, - .cra_flags = CRYPTO_ALG_TYPE_BLKCIPHER, - .cra_blocksize = 1, - .cra_ctxsize = sizeof(struct cast6_ctx), - .cra_alignmask = 0, - .cra_type = &crypto_blkcipher_type, - .cra_module = THIS_MODULE, - .cra_u = { - .blkcipher = { - .min_keysize = CAST6_MIN_KEY_SIZE, - .max_keysize = CAST6_MAX_KEY_SIZE, - .ivsize = CAST6_BLOCK_SIZE, - .setkey = cast6_setkey, - .encrypt = ctr_crypt, - .decrypt = ctr_crypt, - }, - }, -}, { - .cra_name = "__lrw-cast6-avx", - .cra_driver_name = "__driver-lrw-cast6-avx", - .cra_priority = 0, - .cra_flags = CRYPTO_ALG_TYPE_BLKCIPHER, - .cra_blocksize = CAST6_BLOCK_SIZE, - .cra_ctxsize = sizeof(struct cast6_lrw_ctx), - .cra_alignmask = 0, - .cra_type = &crypto_blkcipher_type, - .cra_module = THIS_MODULE, - .cra_exit = lrw_exit_tfm, - .cra_u = { - .blkcipher = { - .min_keysize = CAST6_MIN_KEY_SIZE + - CAST6_BLOCK_SIZE, - .max_keysize = CAST6_MAX_KEY_SIZE + - CAST6_BLOCK_SIZE, - .ivsize = CAST6_BLOCK_SIZE, - .setkey = lrw_cast6_setkey, - .encrypt = lrw_encrypt, - .decrypt = lrw_decrypt, - }, - }, -}, { - .cra_name = "__xts-cast6-avx", - .cra_driver_name = "__driver-xts-cast6-avx", - .cra_priority = 0, - .cra_flags = CRYPTO_ALG_TYPE_BLKCIPHER, - .cra_blocksize = CAST6_BLOCK_SIZE, - .cra_ctxsize = sizeof(struct cast6_xts_ctx), - .cra_alignmask = 0, - .cra_type = &crypto_blkcipher_type, - .cra_module = THIS_MODULE, - .cra_u = { - .blkcipher = { - .min_keysize = CAST6_MIN_KEY_SIZE * 2, - .max_keysize = CAST6_MAX_KEY_SIZE * 2, - .ivsize = CAST6_BLOCK_SIZE, - .setkey = xts_cast6_setkey, - .encrypt = xts_encrypt, - .decrypt = xts_decrypt, - }, - }, -}, { - .cra_name = "ecb(cast6)", - .cra_driver_name = "ecb-cast6-avx", - .cra_priority = 200, - .cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_ASYNC, - .cra_blocksize = CAST6_BLOCK_SIZE, - .cra_ctxsize = sizeof(struct async_helper_ctx), - .cra_alignmask = 0, - .cra_type = &crypto_ablkcipher_type, - .cra_module = THIS_MODULE, - .cra_init = ablk_init, - .cra_exit = ablk_exit, - .cra_u = { - .ablkcipher = { - .min_keysize = CAST6_MIN_KEY_SIZE, - .max_keysize = CAST6_MAX_KEY_SIZE, - .setkey = ablk_set_key, - .encrypt = ablk_encrypt, - .decrypt = ablk_decrypt, - }, - }, -}, { - .cra_name = "cbc(cast6)", - .cra_driver_name = "cbc-cast6-avx", - .cra_priority = 200, - .cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_ASYNC, - .cra_blocksize = CAST6_BLOCK_SIZE, - .cra_ctxsize = sizeof(struct async_helper_ctx), - .cra_alignmask = 0, - .cra_type = &crypto_ablkcipher_type, - .cra_module = THIS_MODULE, - .cra_init = ablk_init, - .cra_exit = ablk_exit, - .cra_u = { - .ablkcipher = { - .min_keysize = CAST6_MIN_KEY_SIZE, - .max_keysize = CAST6_MAX_KEY_SIZE, - .ivsize = CAST6_BLOCK_SIZE, - .setkey = ablk_set_key, - .encrypt = __ablk_encrypt, - .decrypt = ablk_decrypt, - }, - }, -}, { - .cra_name = "ctr(cast6)", - .cra_driver_name = "ctr-cast6-avx", - .cra_priority = 200, - .cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_ASYNC, - .cra_blocksize = 1, - .cra_ctxsize = sizeof(struct async_helper_ctx), - .cra_alignmask = 0, - .cra_type = &crypto_ablkcipher_type, - .cra_module = THIS_MODULE, - .cra_init = ablk_init, - .cra_exit = ablk_exit, - .cra_u = { - .ablkcipher = { - .min_keysize = CAST6_MIN_KEY_SIZE, - .max_keysize = CAST6_MAX_KEY_SIZE, - .ivsize = CAST6_BLOCK_SIZE, - .setkey = ablk_set_key, - .encrypt = ablk_encrypt, - .decrypt = ablk_encrypt, - .geniv = "chainiv", - }, - }, -}, { - .cra_name = "lrw(cast6)", - .cra_driver_name = "lrw-cast6-avx", - .cra_priority = 200, - .cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_ASYNC, - .cra_blocksize = CAST6_BLOCK_SIZE, - .cra_ctxsize = sizeof(struct async_helper_ctx), - .cra_alignmask = 0, - .cra_type = &crypto_ablkcipher_type, - .cra_module = THIS_MODULE, - .cra_init = ablk_init, - .cra_exit = ablk_exit, - .cra_u = { - .ablkcipher = { - .min_keysize = CAST6_MIN_KEY_SIZE + - CAST6_BLOCK_SIZE, - .max_keysize = CAST6_MAX_KEY_SIZE + - CAST6_BLOCK_SIZE, - .ivsize = CAST6_BLOCK_SIZE, - .setkey = ablk_set_key, - .encrypt = ablk_encrypt, - .decrypt = ablk_decrypt, - }, - }, -}, { - .cra_name = "xts(cast6)", - .cra_driver_name = "xts-cast6-avx", - .cra_priority = 200, - .cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_ASYNC, - .cra_blocksize = CAST6_BLOCK_SIZE, - .cra_ctxsize = sizeof(struct async_helper_ctx), - .cra_alignmask = 0, - .cra_type = &crypto_ablkcipher_type, - .cra_module = THIS_MODULE, - .cra_init = ablk_init, - .cra_exit = ablk_exit, - .cra_u = { - .ablkcipher = { - .min_keysize = CAST6_MIN_KEY_SIZE * 2, - .max_keysize = CAST6_MAX_KEY_SIZE * 2, - .ivsize = CAST6_BLOCK_SIZE, - .setkey = ablk_set_key, - .encrypt = ablk_encrypt, - .decrypt = ablk_decrypt, - }, - }, -} }; - -static int __init cast6_init(void) -{ - u64 xcr0; - - if (!cpu_has_avx || !cpu_has_osxsave) { - pr_info("AVX instructions are not detected.\n"); - return -ENODEV; - } - - xcr0 = xgetbv(XCR_XFEATURE_ENABLED_MASK); - if ((xcr0 & (XSTATE_SSE | XSTATE_YMM)) != (XSTATE_SSE | XSTATE_YMM)) { - pr_info("AVX detected but unusable.\n"); - return -ENODEV; - } - - return crypto_register_algs(cast6_algs, ARRAY_SIZE(cast6_algs)); -} - -static void __exit cast6_exit(void) -{ - crypto_unregister_algs(cast6_algs, ARRAY_SIZE(cast6_algs)); -} - -module_init(cast6_init); -module_exit(cast6_exit); - -MODULE_DESCRIPTION("Cast6 Cipher Algorithm, AVX optimized"); -MODULE_LICENSE("GPL"); -MODULE_ALIAS("cast6"); diff --git a/trunk/arch/x86/crypto/ghash-clmulni-intel_glue.c b/trunk/arch/x86/crypto/ghash-clmulni-intel_glue.c index 6759dd1135be..b4bf0a63b520 100644 --- a/trunk/arch/x86/crypto/ghash-clmulni-intel_glue.c +++ b/trunk/arch/x86/crypto/ghash-clmulni-intel_glue.c @@ -150,6 +150,7 @@ static struct shash_alg ghash_alg = { .cra_blocksize = GHASH_BLOCK_SIZE, .cra_ctxsize = sizeof(struct ghash_ctx), .cra_module = THIS_MODULE, + .cra_list = LIST_HEAD_INIT(ghash_alg.base.cra_list), }, }; @@ -287,6 +288,7 @@ static struct ahash_alg ghash_async_alg = { .cra_blocksize = GHASH_BLOCK_SIZE, .cra_type = &crypto_ahash_type, .cra_module = THIS_MODULE, + .cra_list = LIST_HEAD_INIT(ghash_async_alg.halg.base.cra_list), .cra_init = ghash_async_init_tfm, .cra_exit = ghash_async_exit_tfm, }, diff --git a/trunk/arch/x86/crypto/glue_helper.c b/trunk/arch/x86/crypto/glue_helper.c index 30b3927bd733..4854f0f31e4f 100644 --- a/trunk/arch/x86/crypto/glue_helper.c +++ b/trunk/arch/x86/crypto/glue_helper.c @@ -110,7 +110,7 @@ static unsigned int __glue_cbc_encrypt_128bit(const common_glue_func_t fn, nbytes -= bsize; } while (nbytes >= bsize); - *(u128 *)walk->iv = *iv; + u128_xor((u128 *)walk->iv, (u128 *)walk->iv, iv); return nbytes; } diff --git a/trunk/arch/x86/crypto/salsa20_glue.c b/trunk/arch/x86/crypto/salsa20_glue.c index a3a3c0205c16..bccb76d80987 100644 --- a/trunk/arch/x86/crypto/salsa20_glue.c +++ b/trunk/arch/x86/crypto/salsa20_glue.c @@ -97,6 +97,7 @@ static struct crypto_alg alg = { .cra_ctxsize = sizeof(struct salsa20_ctx), .cra_alignmask = 3, .cra_module = THIS_MODULE, + .cra_list = LIST_HEAD_INIT(alg.cra_list), .cra_u = { .blkcipher = { .setkey = setkey, diff --git a/trunk/arch/x86/crypto/serpent_avx_glue.c b/trunk/arch/x86/crypto/serpent_avx_glue.c index 3f543a04cf1e..b36bdac237eb 100644 --- a/trunk/arch/x86/crypto/serpent_avx_glue.c +++ b/trunk/arch/x86/crypto/serpent_avx_glue.c @@ -390,6 +390,7 @@ static struct crypto_alg serpent_algs[10] = { { .cra_alignmask = 0, .cra_type = &crypto_blkcipher_type, .cra_module = THIS_MODULE, + .cra_list = LIST_HEAD_INIT(serpent_algs[0].cra_list), .cra_u = { .blkcipher = { .min_keysize = SERPENT_MIN_KEY_SIZE, @@ -409,6 +410,7 @@ static struct crypto_alg serpent_algs[10] = { { .cra_alignmask = 0, .cra_type = &crypto_blkcipher_type, .cra_module = THIS_MODULE, + .cra_list = LIST_HEAD_INIT(serpent_algs[1].cra_list), .cra_u = { .blkcipher = { .min_keysize = SERPENT_MIN_KEY_SIZE, @@ -428,6 +430,7 @@ static struct crypto_alg serpent_algs[10] = { { .cra_alignmask = 0, .cra_type = &crypto_blkcipher_type, .cra_module = THIS_MODULE, + .cra_list = LIST_HEAD_INIT(serpent_algs[2].cra_list), .cra_u = { .blkcipher = { .min_keysize = SERPENT_MIN_KEY_SIZE, @@ -448,6 +451,7 @@ static struct crypto_alg serpent_algs[10] = { { .cra_alignmask = 0, .cra_type = &crypto_blkcipher_type, .cra_module = THIS_MODULE, + .cra_list = LIST_HEAD_INIT(serpent_algs[3].cra_list), .cra_exit = lrw_exit_tfm, .cra_u = { .blkcipher = { @@ -471,6 +475,7 @@ static struct crypto_alg serpent_algs[10] = { { .cra_alignmask = 0, .cra_type = &crypto_blkcipher_type, .cra_module = THIS_MODULE, + .cra_list = LIST_HEAD_INIT(serpent_algs[4].cra_list), .cra_u = { .blkcipher = { .min_keysize = SERPENT_MIN_KEY_SIZE * 2, @@ -491,6 +496,7 @@ static struct crypto_alg serpent_algs[10] = { { .cra_alignmask = 0, .cra_type = &crypto_ablkcipher_type, .cra_module = THIS_MODULE, + .cra_list = LIST_HEAD_INIT(serpent_algs[5].cra_list), .cra_init = ablk_init, .cra_exit = ablk_exit, .cra_u = { @@ -512,6 +518,7 @@ static struct crypto_alg serpent_algs[10] = { { .cra_alignmask = 0, .cra_type = &crypto_ablkcipher_type, .cra_module = THIS_MODULE, + .cra_list = LIST_HEAD_INIT(serpent_algs[6].cra_list), .cra_init = ablk_init, .cra_exit = ablk_exit, .cra_u = { @@ -534,6 +541,7 @@ static struct crypto_alg serpent_algs[10] = { { .cra_alignmask = 0, .cra_type = &crypto_ablkcipher_type, .cra_module = THIS_MODULE, + .cra_list = LIST_HEAD_INIT(serpent_algs[7].cra_list), .cra_init = ablk_init, .cra_exit = ablk_exit, .cra_u = { @@ -557,6 +565,7 @@ static struct crypto_alg serpent_algs[10] = { { .cra_alignmask = 0, .cra_type = &crypto_ablkcipher_type, .cra_module = THIS_MODULE, + .cra_list = LIST_HEAD_INIT(serpent_algs[8].cra_list), .cra_init = ablk_init, .cra_exit = ablk_exit, .cra_u = { @@ -581,6 +590,7 @@ static struct crypto_alg serpent_algs[10] = { { .cra_alignmask = 0, .cra_type = &crypto_ablkcipher_type, .cra_module = THIS_MODULE, + .cra_list = LIST_HEAD_INIT(serpent_algs[9].cra_list), .cra_init = ablk_init, .cra_exit = ablk_exit, .cra_u = { diff --git a/trunk/arch/x86/crypto/serpent_sse2_glue.c b/trunk/arch/x86/crypto/serpent_sse2_glue.c index 9107a9908c41..d679c8675f4a 100644 --- a/trunk/arch/x86/crypto/serpent_sse2_glue.c +++ b/trunk/arch/x86/crypto/serpent_sse2_glue.c @@ -393,6 +393,7 @@ static struct crypto_alg serpent_algs[10] = { { .cra_alignmask = 0, .cra_type = &crypto_blkcipher_type, .cra_module = THIS_MODULE, + .cra_list = LIST_HEAD_INIT(serpent_algs[0].cra_list), .cra_u = { .blkcipher = { .min_keysize = SERPENT_MIN_KEY_SIZE, @@ -412,6 +413,7 @@ static struct crypto_alg serpent_algs[10] = { { .cra_alignmask = 0, .cra_type = &crypto_blkcipher_type, .cra_module = THIS_MODULE, + .cra_list = LIST_HEAD_INIT(serpent_algs[1].cra_list), .cra_u = { .blkcipher = { .min_keysize = SERPENT_MIN_KEY_SIZE, @@ -431,6 +433,7 @@ static struct crypto_alg serpent_algs[10] = { { .cra_alignmask = 0, .cra_type = &crypto_blkcipher_type, .cra_module = THIS_MODULE, + .cra_list = LIST_HEAD_INIT(serpent_algs[2].cra_list), .cra_u = { .blkcipher = { .min_keysize = SERPENT_MIN_KEY_SIZE, @@ -451,6 +454,7 @@ static struct crypto_alg serpent_algs[10] = { { .cra_alignmask = 0, .cra_type = &crypto_blkcipher_type, .cra_module = THIS_MODULE, + .cra_list = LIST_HEAD_INIT(serpent_algs[3].cra_list), .cra_exit = lrw_exit_tfm, .cra_u = { .blkcipher = { @@ -474,6 +478,7 @@ static struct crypto_alg serpent_algs[10] = { { .cra_alignmask = 0, .cra_type = &crypto_blkcipher_type, .cra_module = THIS_MODULE, + .cra_list = LIST_HEAD_INIT(serpent_algs[4].cra_list), .cra_u = { .blkcipher = { .min_keysize = SERPENT_MIN_KEY_SIZE * 2, @@ -494,6 +499,7 @@ static struct crypto_alg serpent_algs[10] = { { .cra_alignmask = 0, .cra_type = &crypto_ablkcipher_type, .cra_module = THIS_MODULE, + .cra_list = LIST_HEAD_INIT(serpent_algs[5].cra_list), .cra_init = ablk_init, .cra_exit = ablk_exit, .cra_u = { @@ -515,6 +521,7 @@ static struct crypto_alg serpent_algs[10] = { { .cra_alignmask = 0, .cra_type = &crypto_ablkcipher_type, .cra_module = THIS_MODULE, + .cra_list = LIST_HEAD_INIT(serpent_algs[6].cra_list), .cra_init = ablk_init, .cra_exit = ablk_exit, .cra_u = { @@ -537,6 +544,7 @@ static struct crypto_alg serpent_algs[10] = { { .cra_alignmask = 0, .cra_type = &crypto_ablkcipher_type, .cra_module = THIS_MODULE, + .cra_list = LIST_HEAD_INIT(serpent_algs[7].cra_list), .cra_init = ablk_init, .cra_exit = ablk_exit, .cra_u = { @@ -560,6 +568,7 @@ static struct crypto_alg serpent_algs[10] = { { .cra_alignmask = 0, .cra_type = &crypto_ablkcipher_type, .cra_module = THIS_MODULE, + .cra_list = LIST_HEAD_INIT(serpent_algs[8].cra_list), .cra_init = ablk_init, .cra_exit = ablk_exit, .cra_u = { @@ -584,6 +593,7 @@ static struct crypto_alg serpent_algs[10] = { { .cra_alignmask = 0, .cra_type = &crypto_ablkcipher_type, .cra_module = THIS_MODULE, + .cra_list = LIST_HEAD_INIT(serpent_algs[9].cra_list), .cra_init = ablk_init, .cra_exit = ablk_exit, .cra_u = { diff --git a/trunk/arch/x86/crypto/twofish-avx-x86_64-asm_64.S b/trunk/arch/x86/crypto/twofish-avx-x86_64-asm_64.S index 1585abb13dde..35f45574390d 100644 --- a/trunk/arch/x86/crypto/twofish-avx-x86_64-asm_64.S +++ b/trunk/arch/x86/crypto/twofish-avx-x86_64-asm_64.S @@ -4,8 +4,6 @@ * Copyright (C) 2012 Johannes Goetzfried * * - * Copyright © 2012 Jussi Kivilinna - * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or @@ -49,22 +47,16 @@ #define RC2 %xmm6 #define RD2 %xmm7 -#define RX0 %xmm8 -#define RY0 %xmm9 - -#define RX1 %xmm10 -#define RY1 %xmm11 +#define RX %xmm8 +#define RY %xmm9 -#define RK1 %xmm12 -#define RK2 %xmm13 +#define RK1 %xmm10 +#define RK2 %xmm11 -#define RT %xmm14 -#define RR %xmm15 - -#define RID1 %rbp -#define RID1d %ebp -#define RID2 %rsi -#define RID2d %esi +#define RID1 %rax +#define RID1b %al +#define RID2 %rbx +#define RID2b %bl #define RGI1 %rdx #define RGI1bl %dl @@ -73,13 +65,6 @@ #define RGI2bl %cl #define RGI2bh %ch -#define RGI3 %rax -#define RGI3bl %al -#define RGI3bh %ah -#define RGI4 %rbx -#define RGI4bl %bl -#define RGI4bh %bh - #define RGS1 %r8 #define RGS1d %r8d #define RGS2 %r9 @@ -88,123 +73,89 @@ #define RGS3d %r10d -#define lookup_32bit(t0, t1, t2, t3, src, dst, interleave_op, il_reg) \ - movzbl src ## bl, RID1d; \ - movzbl src ## bh, RID2d; \ - shrq $16, src; \ +#define lookup_32bit(t0, t1, t2, t3, src, dst) \ + movb src ## bl, RID1b; \ + movb src ## bh, RID2b; \ movl t0(CTX, RID1, 4), dst ## d; \ - movl t1(CTX, RID2, 4), RID2d; \ - movzbl src ## bl, RID1d; \ - xorl RID2d, dst ## d; \ - movzbl src ## bh, RID2d; \ - interleave_op(il_reg); \ + xorl t1(CTX, RID2, 4), dst ## d; \ + shrq $16, src; \ + movb src ## bl, RID1b; \ + movb src ## bh, RID2b; \ xorl t2(CTX, RID1, 4), dst ## d; \ xorl t3(CTX, RID2, 4), dst ## d; -#define dummy(d) /* do nothing */ - -#define shr_next(reg) \ - shrq $16, reg; - -#define G(gi1, gi2, x, t0, t1, t2, t3) \ - lookup_32bit(t0, t1, t2, t3, ##gi1, RGS1, shr_next, ##gi1); \ - lookup_32bit(t0, t1, t2, t3, ##gi2, RGS3, shr_next, ##gi2); \ - \ - lookup_32bit(t0, t1, t2, t3, ##gi1, RGS2, dummy, none); \ - shlq $32, RGS2; \ - orq RGS1, RGS2; \ - lookup_32bit(t0, t1, t2, t3, ##gi2, RGS1, dummy, none); \ - shlq $32, RGS1; \ - orq RGS1, RGS3; - -#define round_head_2(a, b, x1, y1, x2, y2) \ - vmovq b ## 1, RGI3; \ - vpextrq $1, b ## 1, RGI4; \ +#define G(a, x, t0, t1, t2, t3) \ + vmovq a, RGI1; \ + vpsrldq $8, a, x; \ + vmovq x, RGI2; \ \ - G(RGI1, RGI2, x1, s0, s1, s2, s3); \ - vmovq a ## 2, RGI1; \ - vpextrq $1, a ## 2, RGI2; \ - vmovq RGS2, x1; \ - vpinsrq $1, RGS3, x1, x1; \ + lookup_32bit(t0, t1, t2, t3, RGI1, RGS1); \ + shrq $16, RGI1; \ + lookup_32bit(t0, t1, t2, t3, RGI1, RGS2); \ + shlq $32, RGS2; \ + orq RGS1, RGS2; \ \ - G(RGI3, RGI4, y1, s1, s2, s3, s0); \ - vmovq b ## 2, RGI3; \ - vpextrq $1, b ## 2, RGI4; \ - vmovq RGS2, y1; \ - vpinsrq $1, RGS3, y1, y1; \ + lookup_32bit(t0, t1, t2, t3, RGI2, RGS1); \ + shrq $16, RGI2; \ + lookup_32bit(t0, t1, t2, t3, RGI2, RGS3); \ + shlq $32, RGS3; \ + orq RGS1, RGS3; \ \ - G(RGI1, RGI2, x2, s0, s1, s2, s3); \ - vmovq RGS2, x2; \ - vpinsrq $1, RGS3, x2, x2; \ - \ - G(RGI3, RGI4, y2, s1, s2, s3, s0); \ - vmovq RGS2, y2; \ - vpinsrq $1, RGS3, y2, y2; + vmovq RGS2, x; \ + vpinsrq $1, RGS3, x, x; -#define encround_tail(a, b, c, d, x, y, prerotate) \ +#define encround(a, b, c, d, x, y) \ + G(a, x, s0, s1, s2, s3); \ + G(b, y, s1, s2, s3, s0); \ vpaddd x, y, x; \ - vpaddd x, RK1, RT;\ - prerotate(b); \ - vpxor RT, c, c; \ vpaddd y, x, y; \ + vpaddd x, RK1, x; \ vpaddd y, RK2, y; \ - vpsrld $1, c, RT; \ + vpxor x, c, c; \ + vpsrld $1, c, x; \ vpslld $(32 - 1), c, c; \ - vpor c, RT, c; \ - vpxor d, y, d; \ - -#define decround_tail(a, b, c, d, x, y, prerotate) \ + vpor c, x, c; \ + vpslld $1, d, x; \ + vpsrld $(32 - 1), d, d; \ + vpor d, x, d; \ + vpxor d, y, d; + +#define decround(a, b, c, d, x, y) \ + G(a, x, s0, s1, s2, s3); \ + G(b, y, s1, s2, s3, s0); \ vpaddd x, y, x; \ - vpaddd x, RK1, RT;\ - prerotate(a); \ - vpxor RT, c, c; \ vpaddd y, x, y; \ vpaddd y, RK2, y; \ vpxor d, y, d; \ vpsrld $1, d, y; \ vpslld $(32 - 1), d, d; \ vpor d, y, d; \ - -#define rotate_1l(x) \ - vpslld $1, x, RR; \ - vpsrld $(32 - 1), x, x; \ - vpor x, RR, x; - -#define preload_rgi(c) \ - vmovq c, RGI1; \ - vpextrq $1, c, RGI2; - -#define encrypt_round(n, a, b, c, d, preload, prerotate) \ - vbroadcastss (k+4*(2*(n)))(CTX), RK1; \ - vbroadcastss (k+4*(2*(n)+1))(CTX), RK2; \ - round_head_2(a, b, RX0, RY0, RX1, RY1); \ - encround_tail(a ## 1, b ## 1, c ## 1, d ## 1, RX0, RY0, prerotate); \ - preload(c ## 1); \ - encround_tail(a ## 2, b ## 2, c ## 2, d ## 2, RX1, RY1, prerotate); - -#define decrypt_round(n, a, b, c, d, preload, prerotate) \ - vbroadcastss (k+4*(2*(n)))(CTX), RK1; \ - vbroadcastss (k+4*(2*(n)+1))(CTX), RK2; \ - round_head_2(a, b, RX0, RY0, RX1, RY1); \ - decround_tail(a ## 1, b ## 1, c ## 1, d ## 1, RX0, RY0, prerotate); \ - preload(c ## 1); \ - decround_tail(a ## 2, b ## 2, c ## 2, d ## 2, RX1, RY1, prerotate); + vpslld $1, c, y; \ + vpsrld $(32 - 1), c, c; \ + vpor c, y, c; \ + vpaddd x, RK1, x; \ + vpxor x, c, c; + +#define encrypt_round(n, a, b, c, d) \ + vbroadcastss (k+4*(2*(n)))(CTX), RK1; \ + vbroadcastss (k+4*(2*(n)+1))(CTX), RK2; \ + encround(a ## 1, b ## 1, c ## 1, d ## 1, RX, RY); \ + encround(a ## 2, b ## 2, c ## 2, d ## 2, RX, RY); + +#define decrypt_round(n, a, b, c, d) \ + vbroadcastss (k+4*(2*(n)))(CTX), RK1; \ + vbroadcastss (k+4*(2*(n)+1))(CTX), RK2; \ + decround(a ## 1, b ## 1, c ## 1, d ## 1, RX, RY); \ + decround(a ## 2, b ## 2, c ## 2, d ## 2, RX, RY); #define encrypt_cycle(n) \ - encrypt_round((2*n), RA, RB, RC, RD, preload_rgi, rotate_1l); \ - encrypt_round(((2*n) + 1), RC, RD, RA, RB, preload_rgi, rotate_1l); - -#define encrypt_cycle_last(n) \ - encrypt_round((2*n), RA, RB, RC, RD, preload_rgi, rotate_1l); \ - encrypt_round(((2*n) + 1), RC, RD, RA, RB, dummy, dummy); + encrypt_round((2*n), RA, RB, RC, RD); \ + encrypt_round(((2*n) + 1), RC, RD, RA, RB); #define decrypt_cycle(n) \ - decrypt_round(((2*n) + 1), RC, RD, RA, RB, preload_rgi, rotate_1l); \ - decrypt_round((2*n), RA, RB, RC, RD, preload_rgi, rotate_1l); + decrypt_round(((2*n) + 1), RC, RD, RA, RB); \ + decrypt_round((2*n), RA, RB, RC, RD); -#define decrypt_cycle_last(n) \ - decrypt_round(((2*n) + 1), RC, RD, RA, RB, preload_rgi, rotate_1l); \ - decrypt_round((2*n), RA, RB, RC, RD, dummy, dummy); #define transpose_4x4(x0, x1, x2, x3, t0, t1, t2) \ vpunpckldq x1, x0, t0; \ @@ -265,20 +216,17 @@ __twofish_enc_blk_8way: * %rcx: bool, if true: xor output */ - pushq %rbp; pushq %rbx; pushq %rcx; vmovdqu w(CTX), RK1; leaq (4*4*4)(%rdx), %rax; - inpack_blocks(%rdx, RA1, RB1, RC1, RD1, RK1, RX0, RY0, RK2); - preload_rgi(RA1); - rotate_1l(RD1); - inpack_blocks(%rax, RA2, RB2, RC2, RD2, RK1, RX0, RY0, RK2); - rotate_1l(RD2); + inpack_blocks(%rdx, RA1, RB1, RC1, RD1, RK1, RX, RY, RK2); + inpack_blocks(%rax, RA2, RB2, RC2, RD2, RK1, RX, RY, RK2); - movq %rsi, %r11; + xorq RID1, RID1; + xorq RID2, RID2; encrypt_cycle(0); encrypt_cycle(1); @@ -287,27 +235,26 @@ __twofish_enc_blk_8way: encrypt_cycle(4); encrypt_cycle(5); encrypt_cycle(6); - encrypt_cycle_last(7); + encrypt_cycle(7); vmovdqu (w+4*4)(CTX), RK1; popq %rcx; popq %rbx; - popq %rbp; - leaq (4*4*4)(%r11), %rax; + leaq (4*4*4)(%rsi), %rax; testb %cl, %cl; jnz __enc_xor8; - outunpack_blocks(%r11, RC1, RD1, RA1, RB1, RK1, RX0, RY0, RK2); - outunpack_blocks(%rax, RC2, RD2, RA2, RB2, RK1, RX0, RY0, RK2); + outunpack_blocks(%rsi, RC1, RD1, RA1, RB1, RK1, RX, RY, RK2); + outunpack_blocks(%rax, RC2, RD2, RA2, RB2, RK1, RX, RY, RK2); ret; __enc_xor8: - outunpack_xor_blocks(%r11, RC1, RD1, RA1, RB1, RK1, RX0, RY0, RK2); - outunpack_xor_blocks(%rax, RC2, RD2, RA2, RB2, RK1, RX0, RY0, RK2); + outunpack_xor_blocks(%rsi, RC1, RD1, RA1, RB1, RK1, RX, RY, RK2); + outunpack_xor_blocks(%rax, RC2, RD2, RA2, RB2, RK1, RX, RY, RK2); ret; @@ -322,19 +269,16 @@ twofish_dec_blk_8way: * %rdx: src */ - pushq %rbp; pushq %rbx; vmovdqu (w+4*4)(CTX), RK1; leaq (4*4*4)(%rdx), %rax; - inpack_blocks(%rdx, RC1, RD1, RA1, RB1, RK1, RX0, RY0, RK2); - preload_rgi(RC1); - rotate_1l(RA1); - inpack_blocks(%rax, RC2, RD2, RA2, RB2, RK1, RX0, RY0, RK2); - rotate_1l(RA2); + inpack_blocks(%rdx, RC1, RD1, RA1, RB1, RK1, RX, RY, RK2); + inpack_blocks(%rax, RC2, RD2, RA2, RB2, RK1, RX, RY, RK2); - movq %rsi, %r11; + xorq RID1, RID1; + xorq RID2, RID2; decrypt_cycle(7); decrypt_cycle(6); @@ -343,15 +287,14 @@ twofish_dec_blk_8way: decrypt_cycle(3); decrypt_cycle(2); decrypt_cycle(1); - decrypt_cycle_last(0); + decrypt_cycle(0); vmovdqu (w)(CTX), RK1; popq %rbx; - popq %rbp; - leaq (4*4*4)(%r11), %rax; - outunpack_blocks(%r11, RA1, RB1, RC1, RD1, RK1, RX0, RY0, RK2); - outunpack_blocks(%rax, RA2, RB2, RC2, RD2, RK1, RX0, RY0, RK2); + leaq (4*4*4)(%rsi), %rax; + outunpack_blocks(%rsi, RA1, RB1, RC1, RD1, RK1, RX, RY, RK2); + outunpack_blocks(%rax, RA2, RB2, RC2, RD2, RK1, RX, RY, RK2); ret; diff --git a/trunk/arch/x86/crypto/twofish_avx_glue.c b/trunk/arch/x86/crypto/twofish_avx_glue.c index e7708b5442e0..782b67ddaf6a 100644 --- a/trunk/arch/x86/crypto/twofish_avx_glue.c +++ b/trunk/arch/x86/crypto/twofish_avx_glue.c @@ -378,6 +378,7 @@ static struct crypto_alg twofish_algs[10] = { { .cra_alignmask = 0, .cra_type = &crypto_blkcipher_type, .cra_module = THIS_MODULE, + .cra_list = LIST_HEAD_INIT(twofish_algs[0].cra_list), .cra_u = { .blkcipher = { .min_keysize = TF_MIN_KEY_SIZE, @@ -397,6 +398,7 @@ static struct crypto_alg twofish_algs[10] = { { .cra_alignmask = 0, .cra_type = &crypto_blkcipher_type, .cra_module = THIS_MODULE, + .cra_list = LIST_HEAD_INIT(twofish_algs[1].cra_list), .cra_u = { .blkcipher = { .min_keysize = TF_MIN_KEY_SIZE, @@ -416,6 +418,7 @@ static struct crypto_alg twofish_algs[10] = { { .cra_alignmask = 0, .cra_type = &crypto_blkcipher_type, .cra_module = THIS_MODULE, + .cra_list = LIST_HEAD_INIT(twofish_algs[2].cra_list), .cra_u = { .blkcipher = { .min_keysize = TF_MIN_KEY_SIZE, @@ -436,6 +439,7 @@ static struct crypto_alg twofish_algs[10] = { { .cra_alignmask = 0, .cra_type = &crypto_blkcipher_type, .cra_module = THIS_MODULE, + .cra_list = LIST_HEAD_INIT(twofish_algs[3].cra_list), .cra_exit = lrw_twofish_exit_tfm, .cra_u = { .blkcipher = { @@ -459,6 +463,7 @@ static struct crypto_alg twofish_algs[10] = { { .cra_alignmask = 0, .cra_type = &crypto_blkcipher_type, .cra_module = THIS_MODULE, + .cra_list = LIST_HEAD_INIT(twofish_algs[4].cra_list), .cra_u = { .blkcipher = { .min_keysize = TF_MIN_KEY_SIZE * 2, @@ -479,6 +484,7 @@ static struct crypto_alg twofish_algs[10] = { { .cra_alignmask = 0, .cra_type = &crypto_ablkcipher_type, .cra_module = THIS_MODULE, + .cra_list = LIST_HEAD_INIT(twofish_algs[5].cra_list), .cra_init = ablk_init, .cra_exit = ablk_exit, .cra_u = { @@ -500,6 +506,7 @@ static struct crypto_alg twofish_algs[10] = { { .cra_alignmask = 0, .cra_type = &crypto_ablkcipher_type, .cra_module = THIS_MODULE, + .cra_list = LIST_HEAD_INIT(twofish_algs[6].cra_list), .cra_init = ablk_init, .cra_exit = ablk_exit, .cra_u = { @@ -522,6 +529,7 @@ static struct crypto_alg twofish_algs[10] = { { .cra_alignmask = 0, .cra_type = &crypto_ablkcipher_type, .cra_module = THIS_MODULE, + .cra_list = LIST_HEAD_INIT(twofish_algs[7].cra_list), .cra_init = ablk_init, .cra_exit = ablk_exit, .cra_u = { @@ -545,6 +553,7 @@ static struct crypto_alg twofish_algs[10] = { { .cra_alignmask = 0, .cra_type = &crypto_ablkcipher_type, .cra_module = THIS_MODULE, + .cra_list = LIST_HEAD_INIT(twofish_algs[8].cra_list), .cra_init = ablk_init, .cra_exit = ablk_exit, .cra_u = { @@ -569,6 +578,7 @@ static struct crypto_alg twofish_algs[10] = { { .cra_alignmask = 0, .cra_type = &crypto_ablkcipher_type, .cra_module = THIS_MODULE, + .cra_list = LIST_HEAD_INIT(twofish_algs[9].cra_list), .cra_init = ablk_init, .cra_exit = ablk_exit, .cra_u = { diff --git a/trunk/arch/x86/crypto/twofish_glue.c b/trunk/arch/x86/crypto/twofish_glue.c index 0a5202303501..359ae084275c 100644 --- a/trunk/arch/x86/crypto/twofish_glue.c +++ b/trunk/arch/x86/crypto/twofish_glue.c @@ -70,6 +70,7 @@ static struct crypto_alg alg = { .cra_ctxsize = sizeof(struct twofish_ctx), .cra_alignmask = 0, .cra_module = THIS_MODULE, + .cra_list = LIST_HEAD_INIT(alg.cra_list), .cra_u = { .cipher = { .cia_min_keysize = TF_MIN_KEY_SIZE, diff --git a/trunk/arch/x86/crypto/twofish_glue_3way.c b/trunk/arch/x86/crypto/twofish_glue_3way.c index aa3eb358b7e8..15f9347316c8 100644 --- a/trunk/arch/x86/crypto/twofish_glue_3way.c +++ b/trunk/arch/x86/crypto/twofish_glue_3way.c @@ -342,6 +342,7 @@ static struct crypto_alg tf_algs[5] = { { .cra_alignmask = 0, .cra_type = &crypto_blkcipher_type, .cra_module = THIS_MODULE, + .cra_list = LIST_HEAD_INIT(tf_algs[0].cra_list), .cra_u = { .blkcipher = { .min_keysize = TF_MIN_KEY_SIZE, @@ -361,6 +362,7 @@ static struct crypto_alg tf_algs[5] = { { .cra_alignmask = 0, .cra_type = &crypto_blkcipher_type, .cra_module = THIS_MODULE, + .cra_list = LIST_HEAD_INIT(tf_algs[1].cra_list), .cra_u = { .blkcipher = { .min_keysize = TF_MIN_KEY_SIZE, @@ -381,6 +383,7 @@ static struct crypto_alg tf_algs[5] = { { .cra_alignmask = 0, .cra_type = &crypto_blkcipher_type, .cra_module = THIS_MODULE, + .cra_list = LIST_HEAD_INIT(tf_algs[2].cra_list), .cra_u = { .blkcipher = { .min_keysize = TF_MIN_KEY_SIZE, @@ -401,6 +404,7 @@ static struct crypto_alg tf_algs[5] = { { .cra_alignmask = 0, .cra_type = &crypto_blkcipher_type, .cra_module = THIS_MODULE, + .cra_list = LIST_HEAD_INIT(tf_algs[3].cra_list), .cra_exit = lrw_twofish_exit_tfm, .cra_u = { .blkcipher = { @@ -422,6 +426,7 @@ static struct crypto_alg tf_algs[5] = { { .cra_alignmask = 0, .cra_type = &crypto_blkcipher_type, .cra_module = THIS_MODULE, + .cra_list = LIST_HEAD_INIT(tf_algs[4].cra_list), .cra_u = { .blkcipher = { .min_keysize = TF_MIN_KEY_SIZE * 2, diff --git a/trunk/arch/x86/include/asm/Kbuild b/trunk/arch/x86/include/asm/Kbuild index 1595d6813432..f9c0d3ba9e84 100644 --- a/trunk/arch/x86/include/asm/Kbuild +++ b/trunk/arch/x86/include/asm/Kbuild @@ -22,3 +22,7 @@ header-y += sigcontext32.h header-y += ucontext.h header-y += vm86.h header-y += vsyscall.h + +genhdr-y += unistd_32.h +genhdr-y += unistd_64.h +genhdr-y += unistd_x32.h diff --git a/trunk/arch/x86/include/asm/apic.h b/trunk/arch/x86/include/asm/apic.h index 338803422239..f34261296ffb 100644 --- a/trunk/arch/x86/include/asm/apic.h +++ b/trunk/arch/x86/include/asm/apic.h @@ -409,7 +409,7 @@ extern struct apic *apic; * to enforce the order with in them. */ #define apic_driver(sym) \ - static const struct apic *__apicdrivers_##sym __used \ + static struct apic *__apicdrivers_##sym __used \ __aligned(sizeof(struct apic *)) \ __section(.apicdrivers) = { &sym } diff --git a/trunk/arch/x86/include/asm/atomic.h b/trunk/arch/x86/include/asm/atomic.h index 250b8774c158..58cb6d4085f7 100644 --- a/trunk/arch/x86/include/asm/atomic.h +++ b/trunk/arch/x86/include/asm/atomic.h @@ -309,9 +309,9 @@ static inline void atomic_or_long(unsigned long *v1, unsigned long v2) #define smp_mb__after_atomic_inc() barrier() #ifdef CONFIG_X86_32 -# include +# include "atomic64_32.h" #else -# include +# include "atomic64_64.h" #endif #endif /* _ASM_X86_ATOMIC_H */ diff --git a/trunk/arch/x86/include/asm/calling.h b/trunk/arch/x86/include/asm/calling.h index 0fa675033912..7f8422a28a46 100644 --- a/trunk/arch/x86/include/asm/calling.h +++ b/trunk/arch/x86/include/asm/calling.h @@ -46,7 +46,7 @@ For 32-bit we have the following conventions - kernel is built with */ -#include +#include "dwarf2.h" /* * 64-bit system call stack frame layout defines and helpers, diff --git a/trunk/arch/x86/include/asm/checksum.h b/trunk/arch/x86/include/asm/checksum.h index 5f5bb0f97361..848850fd7d62 100644 --- a/trunk/arch/x86/include/asm/checksum.h +++ b/trunk/arch/x86/include/asm/checksum.h @@ -1,5 +1,5 @@ #ifdef CONFIG_X86_32 -# include +# include "checksum_32.h" #else -# include +# include "checksum_64.h" #endif diff --git a/trunk/arch/x86/include/asm/cmpxchg.h b/trunk/arch/x86/include/asm/cmpxchg.h index 8d871eaddb66..99480e55973d 100644 --- a/trunk/arch/x86/include/asm/cmpxchg.h +++ b/trunk/arch/x86/include/asm/cmpxchg.h @@ -138,9 +138,9 @@ extern void __add_wrong_size(void) __raw_cmpxchg((ptr), (old), (new), (size), "") #ifdef CONFIG_X86_32 -# include +# include "cmpxchg_32.h" #else -# include +# include "cmpxchg_64.h" #endif #ifdef __HAVE_ARCH_CMPXCHG diff --git a/trunk/arch/x86/include/asm/compat.h b/trunk/arch/x86/include/asm/compat.h index 59c6c401f79f..fedf32b73e65 100644 --- a/trunk/arch/x86/include/asm/compat.h +++ b/trunk/arch/x86/include/asm/compat.h @@ -41,7 +41,6 @@ typedef s64 __attribute__((aligned(4))) compat_s64; typedef u32 compat_uint_t; typedef u32 compat_ulong_t; typedef u64 __attribute__((aligned(4))) compat_u64; -typedef u32 compat_uptr_t; struct compat_timespec { compat_time_t tv_sec; @@ -125,78 +124,6 @@ typedef u32 compat_old_sigset_t; /* at least 32 bits */ typedef u32 compat_sigset_word; -typedef union compat_sigval { - compat_int_t sival_int; - compat_uptr_t sival_ptr; -} compat_sigval_t; - -typedef struct compat_siginfo { - int si_signo; - int si_errno; - int si_code; - - union { - int _pad[128/sizeof(int) - 3]; - - /* kill() */ - struct { - unsigned int _pid; /* sender's pid */ - unsigned int _uid; /* sender's uid */ - } _kill; - - /* POSIX.1b timers */ - struct { - compat_timer_t _tid; /* timer id */ - int _overrun; /* overrun count */ - compat_sigval_t _sigval; /* same as below */ - int _sys_private; /* not to be passed to user */ - int _overrun_incr; /* amount to add to overrun */ - } _timer; - - /* POSIX.1b signals */ - struct { - unsigned int _pid; /* sender's pid */ - unsigned int _uid; /* sender's uid */ - compat_sigval_t _sigval; - } _rt; - - /* SIGCHLD */ - struct { - unsigned int _pid; /* which child */ - unsigned int _uid; /* sender's uid */ - int _status; /* exit code */ - compat_clock_t _utime; - compat_clock_t _stime; - } _sigchld; - - /* SIGCHLD (x32 version) */ - struct { - unsigned int _pid; /* which child */ - unsigned int _uid; /* sender's uid */ - int _status; /* exit code */ - compat_s64 _utime; - compat_s64 _stime; - } _sigchld_x32; - - /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */ - struct { - unsigned int _addr; /* faulting insn/memory ref. */ - } _sigfault; - - /* SIGPOLL */ - struct { - int _band; /* POLL_IN, POLL_OUT, POLL_MSG */ - int _fd; - } _sigpoll; - - struct { - unsigned int _call_addr; /* calling insn */ - int _syscall; /* triggering system call number */ - unsigned int _arch; /* AUDIT_ARCH_* of syscall */ - } _sigsys; - } _sifields; -} compat_siginfo_t; - #define COMPAT_OFF_T_MAX 0x7fffffff #define COMPAT_LOFF_T_MAX 0x7fffffffffffffffL @@ -282,6 +209,7 @@ typedef struct user_regs_struct32 compat_elf_gregset_t; * as pointers because the syscall entry code will have * appropriately converted them already. */ +typedef u32 compat_uptr_t; static inline void __user *compat_ptr(compat_uptr_t uptr) { diff --git a/trunk/arch/x86/include/asm/cpufeature.h b/trunk/arch/x86/include/asm/cpufeature.h index 8c297aa53eef..16cae425d1f8 100644 --- a/trunk/arch/x86/include/asm/cpufeature.h +++ b/trunk/arch/x86/include/asm/cpufeature.h @@ -4,9 +4,7 @@ #ifndef _ASM_X86_CPUFEATURE_H #define _ASM_X86_CPUFEATURE_H -#ifndef _ASM_X86_REQUIRED_FEATURES_H #include -#endif #define NCAPINTS 10 /* N 32-bit words worth of info */ diff --git a/trunk/arch/x86/include/asm/ia32.h b/trunk/arch/x86/include/asm/ia32.h index e6232773ce49..b04cbdb138cd 100644 --- a/trunk/arch/x86/include/asm/ia32.h +++ b/trunk/arch/x86/include/asm/ia32.h @@ -86,6 +86,73 @@ struct stat64 { unsigned long long st_ino; } __attribute__((packed)); +typedef struct compat_siginfo { + int si_signo; + int si_errno; + int si_code; + + union { + int _pad[((128 / sizeof(int)) - 3)]; + + /* kill() */ + struct { + unsigned int _pid; /* sender's pid */ + unsigned int _uid; /* sender's uid */ + } _kill; + + /* POSIX.1b timers */ + struct { + compat_timer_t _tid; /* timer id */ + int _overrun; /* overrun count */ + compat_sigval_t _sigval; /* same as below */ + int _sys_private; /* not to be passed to user */ + int _overrun_incr; /* amount to add to overrun */ + } _timer; + + /* POSIX.1b signals */ + struct { + unsigned int _pid; /* sender's pid */ + unsigned int _uid; /* sender's uid */ + compat_sigval_t _sigval; + } _rt; + + /* SIGCHLD */ + struct { + unsigned int _pid; /* which child */ + unsigned int _uid; /* sender's uid */ + int _status; /* exit code */ + compat_clock_t _utime; + compat_clock_t _stime; + } _sigchld; + + /* SIGCHLD (x32 version) */ + struct { + unsigned int _pid; /* which child */ + unsigned int _uid; /* sender's uid */ + int _status; /* exit code */ + compat_s64 _utime; + compat_s64 _stime; + } _sigchld_x32; + + /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */ + struct { + unsigned int _addr; /* faulting insn/memory ref. */ + } _sigfault; + + /* SIGPOLL */ + struct { + int _band; /* POLL_IN, POLL_OUT, POLL_MSG */ + int _fd; + } _sigpoll; + + struct { + unsigned int _call_addr; /* calling insn */ + int _syscall; /* triggering system call number */ + unsigned int _arch; /* AUDIT_ARCH_* of syscall */ + } _sigsys; + } _sifields; +} compat_siginfo_t; + #define IA32_STACK_TOP IA32_PAGE_OFFSET #ifdef __KERNEL__ diff --git a/trunk/arch/x86/include/asm/kvm.h b/trunk/arch/x86/include/asm/kvm.h index a65ec29e6ffb..41e08cb6a092 100644 --- a/trunk/arch/x86/include/asm/kvm.h +++ b/trunk/arch/x86/include/asm/kvm.h @@ -41,7 +41,6 @@ #define __KVM_HAVE_DEBUGREGS #define __KVM_HAVE_XSAVE #define __KVM_HAVE_XCRS -#define __KVM_HAVE_READONLY_MEM /* Architectural interrupt line count. */ #define KVM_NR_INTERRUPTS 256 diff --git a/trunk/arch/x86/include/asm/kvm_emulate.h b/trunk/arch/x86/include/asm/kvm_emulate.h index 15f960c06ff7..c764f43b71c5 100644 --- a/trunk/arch/x86/include/asm/kvm_emulate.h +++ b/trunk/arch/x86/include/asm/kvm_emulate.h @@ -85,19 +85,6 @@ struct x86_instruction_info { #define X86EMUL_INTERCEPTED 6 /* Intercepted by nested VMCB/VMCS */ struct x86_emulate_ops { - /* - * read_gpr: read a general purpose register (rax - r15) - * - * @reg: gpr number. - */ - ulong (*read_gpr)(struct x86_emulate_ctxt *ctxt, unsigned reg); - /* - * write_gpr: write a general purpose register (rax - r15) - * - * @reg: gpr number. - * @val: value to write. - */ - void (*write_gpr)(struct x86_emulate_ctxt *ctxt, unsigned reg, ulong val); /* * read_std: Read bytes of standard (non-emulated/special) memory. * Used for descriptor reading. @@ -213,9 +200,8 @@ typedef u32 __attribute__((vector_size(16))) sse128_t; /* Type, address-of, and value of an instruction's operand. */ struct operand { - enum { OP_REG, OP_MEM, OP_MEM_STR, OP_IMM, OP_XMM, OP_MM, OP_NONE } type; + enum { OP_REG, OP_MEM, OP_IMM, OP_XMM, OP_MM, OP_NONE } type; unsigned int bytes; - unsigned int count; union { unsigned long orig_val; u64 orig_val64; @@ -235,7 +221,6 @@ struct operand { char valptr[sizeof(unsigned long) + 2]; sse128_t vec_val; u64 mm_val; - void *data; }; }; @@ -251,23 +236,14 @@ struct read_cache { unsigned long end; }; -/* Execution mode, passed to the emulator. */ -enum x86emul_mode { - X86EMUL_MODE_REAL, /* Real mode. */ - X86EMUL_MODE_VM86, /* Virtual 8086 mode. */ - X86EMUL_MODE_PROT16, /* 16-bit protected mode. */ - X86EMUL_MODE_PROT32, /* 32-bit protected mode. */ - X86EMUL_MODE_PROT64, /* 64-bit (long) mode. */ -}; - struct x86_emulate_ctxt { - const struct x86_emulate_ops *ops; + struct x86_emulate_ops *ops; /* Register state before/after emulation. */ unsigned long eflags; unsigned long eip; /* eip before instruction emulation */ /* Emulated execution mode, represented by an X86EMUL_MODE value. */ - enum x86emul_mode mode; + int mode; /* interruptibility state, as a result of execution of STI or MOV SS */ int interruptibility; @@ -305,10 +281,8 @@ struct x86_emulate_ctxt { bool rip_relative; unsigned long _eip; struct operand memop; - u32 regs_valid; /* bitmaps of registers in _regs[] that can be read */ - u32 regs_dirty; /* bitmaps of registers in _regs[] that have been written */ /* Fields above regs are cleared together. */ - unsigned long _regs[NR_VCPU_REGS]; + unsigned long regs[NR_VCPU_REGS]; struct operand *memopp; struct fetch_cache fetch; struct read_cache io_read; @@ -319,6 +293,17 @@ struct x86_emulate_ctxt { #define REPE_PREFIX 0xf3 #define REPNE_PREFIX 0xf2 +/* Execution mode, passed to the emulator. */ +#define X86EMUL_MODE_REAL 0 /* Real mode. */ +#define X86EMUL_MODE_VM86 1 /* Virtual 8086 mode. */ +#define X86EMUL_MODE_PROT16 2 /* 16-bit protected mode. */ +#define X86EMUL_MODE_PROT32 4 /* 32-bit protected mode. */ +#define X86EMUL_MODE_PROT64 8 /* 64-bit (long) mode. */ + +/* any protected mode */ +#define X86EMUL_MODE_PROT (X86EMUL_MODE_PROT16|X86EMUL_MODE_PROT32| \ + X86EMUL_MODE_PROT64) + /* CPUID vendors */ #define X86EMUL_CPUID_VENDOR_AuthenticAMD_ebx 0x68747541 #define X86EMUL_CPUID_VENDOR_AuthenticAMD_ecx 0x444d4163 @@ -409,7 +394,4 @@ int emulator_task_switch(struct x86_emulate_ctxt *ctxt, u16 tss_selector, int idt_index, int reason, bool has_error_code, u32 error_code); int emulate_int_real(struct x86_emulate_ctxt *ctxt, int irq); -void emulator_invalidate_register_cache(struct x86_emulate_ctxt *ctxt); -void emulator_writeback_register_cache(struct x86_emulate_ctxt *ctxt); - #endif /* _ASM_X86_KVM_X86_EMULATE_H */ diff --git a/trunk/arch/x86/include/asm/kvm_host.h b/trunk/arch/x86/include/asm/kvm_host.h index b2e11f452435..1eaa6b056670 100644 --- a/trunk/arch/x86/include/asm/kvm_host.h +++ b/trunk/arch/x86/include/asm/kvm_host.h @@ -271,24 +271,10 @@ struct kvm_mmu { union kvm_mmu_page_role base_role; bool direct_map; - /* - * Bitmap; bit set = permission fault - * Byte index: page fault error code [4:1] - * Bit index: pte permissions in ACC_* format - */ - u8 permissions[16]; - u64 *pae_root; u64 *lm_root; u64 rsvd_bits_mask[2][4]; - /* - * Bitmap: bit set = last pte in walk - * index[0:1]: level (zero-based) - * index[2]: pte.ps - */ - u8 last_pte_bitmap; - bool nx; u64 pdptrs[4]; /* pae */ @@ -412,15 +398,12 @@ struct kvm_vcpu_arch { struct x86_emulate_ctxt emulate_ctxt; bool emulate_regs_need_sync_to_vcpu; bool emulate_regs_need_sync_from_vcpu; - int (*complete_userspace_io)(struct kvm_vcpu *vcpu); gpa_t time; struct pvclock_vcpu_time_info hv_clock; unsigned int hw_tsc_khz; unsigned int time_offset; struct page *time_page; - /* set guest stopped flag in pvclock flags field */ - bool pvclock_set_guest_stopped_request; struct { u64 msr_val; @@ -455,7 +438,6 @@ struct kvm_vcpu_arch { unsigned long dr6; unsigned long dr7; unsigned long eff_db[KVM_NR_DB_REGS]; - unsigned long guest_debug_dr7; u64 mcg_cap; u64 mcg_status; @@ -502,24 +484,14 @@ struct kvm_vcpu_arch { }; struct kvm_lpage_info { + unsigned long rmap_pde; int write_count; }; struct kvm_arch_memory_slot { - unsigned long *rmap[KVM_NR_PAGE_SIZES]; struct kvm_lpage_info *lpage_info[KVM_NR_PAGE_SIZES - 1]; }; -struct kvm_apic_map { - struct rcu_head rcu; - u8 ldr_bits; - /* fields bellow are used to decode ldr values in different modes */ - u32 cid_shift, cid_mask, lid_mask; - struct kvm_lapic *phys_map[256]; - /* first index is cluster id second is cpu id in a cluster */ - struct kvm_lapic *logical_map[16][16]; -}; - struct kvm_arch { unsigned int n_used_mmu_pages; unsigned int n_requested_mmu_pages; @@ -537,8 +509,6 @@ struct kvm_arch { struct kvm_ioapic *vioapic; struct kvm_pit *vpit; int vapics_in_nmi_mode; - struct mutex apic_map_lock; - struct kvm_apic_map *apic_map; unsigned int tss_addr; struct page *apic_access_page; @@ -632,7 +602,8 @@ struct kvm_x86_ops { void (*vcpu_load)(struct kvm_vcpu *vcpu, int cpu); void (*vcpu_put)(struct kvm_vcpu *vcpu); - void (*update_db_bp_intercept)(struct kvm_vcpu *vcpu); + void (*set_guest_debug)(struct kvm_vcpu *vcpu, + struct kvm_guest_debug *dbg); int (*get_msr)(struct kvm_vcpu *vcpu, u32 msr_index, u64 *pdata); int (*set_msr)(struct kvm_vcpu *vcpu, u32 msr_index, u64 data); u64 (*get_segment_base)(struct kvm_vcpu *vcpu, int seg); @@ -970,7 +941,6 @@ extern bool kvm_rebooting; #define KVM_ARCH_WANT_MMU_NOTIFIER int kvm_unmap_hva(struct kvm *kvm, unsigned long hva); -int kvm_unmap_hva_range(struct kvm *kvm, unsigned long start, unsigned long end); int kvm_age_hva(struct kvm *kvm, unsigned long hva); int kvm_test_age_hva(struct kvm *kvm, unsigned long hva); void kvm_set_spte_hva(struct kvm *kvm, unsigned long hva, pte_t pte); diff --git a/trunk/arch/x86/include/asm/kvm_para.h b/trunk/arch/x86/include/asm/kvm_para.h index eb3e9d85e1f1..2f7712e08b1e 100644 --- a/trunk/arch/x86/include/asm/kvm_para.h +++ b/trunk/arch/x86/include/asm/kvm_para.h @@ -102,21 +102,21 @@ struct kvm_vcpu_pv_apf_data { extern void kvmclock_init(void); extern int kvm_register_clock(char *txt); -#ifdef CONFIG_KVM_GUEST +#ifdef CONFIG_KVM_CLOCK bool kvm_check_and_clear_guest_paused(void); #else static inline bool kvm_check_and_clear_guest_paused(void) { return false; } -#endif /* CONFIG_KVM_GUEST */ +#endif /* CONFIG_KVMCLOCK */ /* This instruction is vmcall. On non-VT architectures, it will generate a * trap that we will then rewrite to the appropriate instruction. */ #define KVM_HYPERCALL ".byte 0x0f,0x01,0xc1" -/* For KVM hypercalls, a three-byte sequence of either the vmcall or the vmmcall +/* For KVM hypercalls, a three-byte sequence of either the vmrun or the vmmrun * instruction. The hypervisor may replace it with something else but only the * instructions are guaranteed to be supported. * diff --git a/trunk/arch/x86/include/asm/mmzone.h b/trunk/arch/x86/include/asm/mmzone.h index d497bc425cae..64217ea16a36 100644 --- a/trunk/arch/x86/include/asm/mmzone.h +++ b/trunk/arch/x86/include/asm/mmzone.h @@ -1,5 +1,5 @@ #ifdef CONFIG_X86_32 -# include +# include "mmzone_32.h" #else -# include +# include "mmzone_64.h" #endif diff --git a/trunk/arch/x86/include/asm/msr-index.h b/trunk/arch/x86/include/asm/msr-index.h index fbee9714d9ab..957ec87385af 100644 --- a/trunk/arch/x86/include/asm/msr-index.h +++ b/trunk/arch/x86/include/asm/msr-index.h @@ -248,9 +248,6 @@ #define MSR_IA32_PERF_STATUS 0x00000198 #define MSR_IA32_PERF_CTL 0x00000199 -#define MSR_AMD_PSTATE_DEF_BASE 0xc0010064 -#define MSR_AMD_PERF_STATUS 0xc0010063 -#define MSR_AMD_PERF_CTL 0xc0010062 #define MSR_IA32_MPERF 0x000000e7 #define MSR_IA32_APERF 0x000000e8 diff --git a/trunk/arch/x86/include/asm/mutex.h b/trunk/arch/x86/include/asm/mutex.h index 7d3a48275394..a731b9c573a6 100644 --- a/trunk/arch/x86/include/asm/mutex.h +++ b/trunk/arch/x86/include/asm/mutex.h @@ -1,5 +1,5 @@ #ifdef CONFIG_X86_32 -# include +# include "mutex_32.h" #else -# include +# include "mutex_64.h" #endif diff --git a/trunk/arch/x86/include/asm/numa.h b/trunk/arch/x86/include/asm/numa.h index 49119fcea2dc..bfacd2ccf651 100644 --- a/trunk/arch/x86/include/asm/numa.h +++ b/trunk/arch/x86/include/asm/numa.h @@ -53,9 +53,9 @@ static inline int numa_cpu_node(int cpu) #endif /* CONFIG_NUMA */ #ifdef CONFIG_X86_32 -# include +# include "numa_32.h" #else -# include +# include "numa_64.h" #endif #ifdef CONFIG_NUMA diff --git a/trunk/arch/x86/include/asm/pci.h b/trunk/arch/x86/include/asm/pci.h index 6e41b9343928..df75d07571ce 100644 --- a/trunk/arch/x86/include/asm/pci.h +++ b/trunk/arch/x86/include/asm/pci.h @@ -141,7 +141,7 @@ void default_restore_msi_irqs(struct pci_dev *dev, int irq); #endif /* __KERNEL__ */ #ifdef CONFIG_X86_64 -#include +#include "pci_64.h" #endif /* implement the pci_ DMA API in terms of the generic device dma_ one */ diff --git a/trunk/arch/x86/include/asm/pgtable.h b/trunk/arch/x86/include/asm/pgtable.h index fc9948465293..49afb3f41eb6 100644 --- a/trunk/arch/x86/include/asm/pgtable.h +++ b/trunk/arch/x86/include/asm/pgtable.h @@ -384,9 +384,9 @@ pte_t *populate_extra_pte(unsigned long vaddr); #endif /* __ASSEMBLY__ */ #ifdef CONFIG_X86_32 -# include +# include "pgtable_32.h" #else -# include +# include "pgtable_64.h" #endif #ifndef __ASSEMBLY__ diff --git a/trunk/arch/x86/include/asm/pgtable_types.h b/trunk/arch/x86/include/asm/pgtable_types.h index ec8a1fc9505d..db8fec6d2953 100644 --- a/trunk/arch/x86/include/asm/pgtable_types.h +++ b/trunk/arch/x86/include/asm/pgtable_types.h @@ -174,9 +174,9 @@ #endif #ifdef CONFIG_X86_32 -# include +# include "pgtable_32_types.h" #else -# include +# include "pgtable_64_types.h" #endif #ifndef __ASSEMBLY__ diff --git a/trunk/arch/x86/include/asm/posix_types.h b/trunk/arch/x86/include/asm/posix_types.h index bad3665c25fc..7ef7c3020e5c 100644 --- a/trunk/arch/x86/include/asm/posix_types.h +++ b/trunk/arch/x86/include/asm/posix_types.h @@ -1,15 +1,15 @@ #ifdef __KERNEL__ # ifdef CONFIG_X86_32 -# include +# include "posix_types_32.h" # else -# include +# include "posix_types_64.h" # endif #else # ifdef __i386__ -# include +# include "posix_types_32.h" # elif defined(__ILP32__) -# include +# include "posix_types_x32.h" # else -# include +# include "posix_types_64.h" # endif #endif diff --git a/trunk/arch/x86/include/asm/seccomp.h b/trunk/arch/x86/include/asm/seccomp.h index 0f3d7f099224..c62e58a5a90d 100644 --- a/trunk/arch/x86/include/asm/seccomp.h +++ b/trunk/arch/x86/include/asm/seccomp.h @@ -1,5 +1,5 @@ #ifdef CONFIG_X86_32 -# include +# include "seccomp_32.h" #else -# include +# include "seccomp_64.h" #endif diff --git a/trunk/arch/x86/include/asm/string.h b/trunk/arch/x86/include/asm/string.h index 09224d7a5862..6dfd6d9373a0 100644 --- a/trunk/arch/x86/include/asm/string.h +++ b/trunk/arch/x86/include/asm/string.h @@ -1,5 +1,5 @@ #ifdef CONFIG_X86_32 -# include +# include "string_32.h" #else -# include +# include "string_64.h" #endif diff --git a/trunk/arch/x86/include/asm/suspend.h b/trunk/arch/x86/include/asm/suspend.h index 2fab6c2c3575..9bd521fe4570 100644 --- a/trunk/arch/x86/include/asm/suspend.h +++ b/trunk/arch/x86/include/asm/suspend.h @@ -1,5 +1,5 @@ #ifdef CONFIG_X86_32 -# include +# include "suspend_32.h" #else -# include +# include "suspend_64.h" #endif diff --git a/trunk/arch/x86/include/asm/uaccess.h b/trunk/arch/x86/include/asm/uaccess.h index 7ccf8d131535..a91acfbb1a98 100644 --- a/trunk/arch/x86/include/asm/uaccess.h +++ b/trunk/arch/x86/include/asm/uaccess.h @@ -589,9 +589,9 @@ extern struct movsl_mask { #define ARCH_HAS_NOCACHE_UACCESS 1 #ifdef CONFIG_X86_32 -# include +# include "uaccess_32.h" #else -# include +# include "uaccess_64.h" #endif #endif /* _ASM_X86_UACCESS_H */ diff --git a/trunk/arch/x86/include/asm/user.h b/trunk/arch/x86/include/asm/user.h index ccab4af1646d..24532c7da3d6 100644 --- a/trunk/arch/x86/include/asm/user.h +++ b/trunk/arch/x86/include/asm/user.h @@ -2,9 +2,9 @@ #define _ASM_X86_USER_H #ifdef CONFIG_X86_32 -# include +# include "user_32.h" #else -# include +# include "user_64.h" #endif #include diff --git a/trunk/arch/x86/include/asm/xen/interface.h b/trunk/arch/x86/include/asm/xen/interface.h index 1707cfa928fb..cbf0c9d50b92 100644 --- a/trunk/arch/x86/include/asm/xen/interface.h +++ b/trunk/arch/x86/include/asm/xen/interface.h @@ -47,10 +47,6 @@ #endif #ifndef __ASSEMBLY__ -/* Explicitly size integers that represent pfns in the public interface - * with Xen so that on ARM we can have one ABI that works for 32 and 64 - * bit guests. */ -typedef unsigned long xen_pfn_t; /* Guest handles for primitive C types. */ __DEFINE_GUEST_HANDLE(uchar, unsigned char); __DEFINE_GUEST_HANDLE(uint, unsigned int); @@ -61,7 +57,6 @@ DEFINE_GUEST_HANDLE(long); DEFINE_GUEST_HANDLE(void); DEFINE_GUEST_HANDLE(uint64_t); DEFINE_GUEST_HANDLE(uint32_t); -DEFINE_GUEST_HANDLE(xen_pfn_t); #endif #ifndef HYPERVISOR_VIRT_START @@ -121,13 +116,11 @@ struct arch_shared_info { #endif /* !__ASSEMBLY__ */ #ifdef CONFIG_X86_32 -#include +#include "interface_32.h" #else -#include +#include "interface_64.h" #endif -#include - #ifndef __ASSEMBLY__ /* * The following is all CPU context. Note that the fpu_ctxt block is filled diff --git a/trunk/arch/x86/include/asm/xen/swiotlb-xen.h b/trunk/arch/x86/include/asm/xen/swiotlb-xen.h index ee52fcac6f72..1be1ab7d6a41 100644 --- a/trunk/arch/x86/include/asm/xen/swiotlb-xen.h +++ b/trunk/arch/x86/include/asm/xen/swiotlb-xen.h @@ -5,12 +5,10 @@ extern int xen_swiotlb; extern int __init pci_xen_swiotlb_detect(void); extern void __init pci_xen_swiotlb_init(void); -extern int pci_xen_swiotlb_init_late(void); #else #define xen_swiotlb (0) static inline int __init pci_xen_swiotlb_detect(void) { return 0; } static inline void __init pci_xen_swiotlb_init(void) { } -static inline int pci_xen_swiotlb_init_late(void) { return -ENXIO; } #endif #endif /* _ASM_X86_SWIOTLB_XEN_H */ diff --git a/trunk/arch/x86/include/asm/xor.h b/trunk/arch/x86/include/asm/xor.h index f8fde90bc45e..7fcf6f3dbcc3 100644 --- a/trunk/arch/x86/include/asm/xor.h +++ b/trunk/arch/x86/include/asm/xor.h @@ -3,8 +3,8 @@ # include #else #ifdef CONFIG_X86_32 -# include +# include "xor_32.h" #else -# include +# include "xor_64.h" #endif #endif diff --git a/trunk/arch/x86/include/asm/xor_32.h b/trunk/arch/x86/include/asm/xor_32.h index f79cb7ec0e06..aabd5850bdb9 100644 --- a/trunk/arch/x86/include/asm/xor_32.h +++ b/trunk/arch/x86/include/asm/xor_32.h @@ -822,7 +822,7 @@ static struct xor_block_template xor_block_pIII_sse = { }; /* Also try the AVX routines */ -#include +#include "xor_avx.h" /* Also try the generic routines. */ #include diff --git a/trunk/arch/x86/include/asm/xor_64.h b/trunk/arch/x86/include/asm/xor_64.h index 87ac522c4af5..5fc06d0b7eb5 100644 --- a/trunk/arch/x86/include/asm/xor_64.h +++ b/trunk/arch/x86/include/asm/xor_64.h @@ -306,7 +306,7 @@ static struct xor_block_template xor_block_sse = { /* Also try the AVX routines */ -#include +#include "xor_avx.h" #undef XOR_TRY_TEMPLATES #define XOR_TRY_TEMPLATES \ diff --git a/trunk/arch/x86/include/uapi/asm/Kbuild b/trunk/arch/x86/include/uapi/asm/Kbuild deleted file mode 100644 index 83b6e9a0dce4..000000000000 --- a/trunk/arch/x86/include/uapi/asm/Kbuild +++ /dev/null @@ -1,6 +0,0 @@ -# UAPI Header export list -include include/uapi/asm-generic/Kbuild.asm - -genhdr-y += unistd_32.h -genhdr-y += unistd_64.h -genhdr-y += unistd_x32.h diff --git a/trunk/arch/x86/kernel/Makefile b/trunk/arch/x86/kernel/Makefile index a48ea05157d3..8d7a619718b5 100644 --- a/trunk/arch/x86/kernel/Makefile +++ b/trunk/arch/x86/kernel/Makefile @@ -81,7 +81,8 @@ obj-$(CONFIG_DEBUG_RODATA_TEST) += test_rodata.o obj-$(CONFIG_DEBUG_NX_TEST) += test_nx.o obj-$(CONFIG_DEBUG_NMI_SELFTEST) += nmi_selftest.o -obj-$(CONFIG_KVM_GUEST) += kvm.o kvmclock.o +obj-$(CONFIG_KVM_GUEST) += kvm.o +obj-$(CONFIG_KVM_CLOCK) += kvmclock.o obj-$(CONFIG_PARAVIRT) += paravirt.o paravirt_patch_$(BITS).o obj-$(CONFIG_PARAVIRT_SPINLOCKS)+= paravirt-spinlocks.o obj-$(CONFIG_PARAVIRT_CLOCK) += pvclock.o diff --git a/trunk/arch/x86/kernel/apic/apic_numachip.c b/trunk/arch/x86/kernel/apic/apic_numachip.c index a65829ac2b9a..bc552cff2578 100644 --- a/trunk/arch/x86/kernel/apic/apic_numachip.c +++ b/trunk/arch/x86/kernel/apic/apic_numachip.c @@ -30,7 +30,7 @@ static int numachip_system __read_mostly; -static const struct apic apic_numachip __read_mostly; +static struct apic apic_numachip __read_mostly; static unsigned int get_apic_id(unsigned long x) { @@ -199,7 +199,7 @@ static int numachip_acpi_madt_oem_check(char *oem_id, char *oem_table_id) return 0; } -static const struct apic apic_numachip __refconst = { +static struct apic apic_numachip __refconst = { .name = "NumaConnect system", .probe = numachip_probe, diff --git a/trunk/arch/x86/kernel/cpu/mkcapflags.pl b/trunk/arch/x86/kernel/cpu/mkcapflags.pl index 091972ef49de..c7b3fe2d72e0 100644 --- a/trunk/arch/x86/kernel/cpu/mkcapflags.pl +++ b/trunk/arch/x86/kernel/cpu/mkcapflags.pl @@ -8,10 +8,7 @@ open(IN, "< $in\0") or die "$0: cannot open: $in: $!\n"; open(OUT, "> $out\0") or die "$0: cannot create: $out: $!\n"; -print OUT "#ifndef _ASM_X86_CPUFEATURE_H\n"; -print OUT "#include \n"; -print OUT "#endif\n"; -print OUT "\n"; +print OUT "#include \n\n"; print OUT "const char * const x86_cap_flags[NCAPINTS*32] = {\n"; %features = (); diff --git a/trunk/arch/x86/kernel/kvm.c b/trunk/arch/x86/kernel/kvm.c index b3e5e51bc907..c1d61ee4b4f1 100644 --- a/trunk/arch/x86/kernel/kvm.c +++ b/trunk/arch/x86/kernel/kvm.c @@ -354,7 +354,6 @@ static void kvm_pv_guest_cpu_reboot(void *unused) if (kvm_para_has_feature(KVM_FEATURE_PV_EOI)) wrmsrl(MSR_KVM_PV_EOI_EN, 0); kvm_pv_disable_apf(); - kvm_disable_steal_time(); } static int kvm_pv_reboot_notify(struct notifier_block *nb, @@ -397,7 +396,9 @@ void kvm_disable_steal_time(void) #ifdef CONFIG_SMP static void __init kvm_smp_prepare_boot_cpu(void) { +#ifdef CONFIG_KVM_CLOCK WARN_ON(kvm_register_clock("primary cpu clock")); +#endif kvm_guest_cpu_init(); native_smp_prepare_boot_cpu(); } diff --git a/trunk/arch/x86/kernel/rtc.c b/trunk/arch/x86/kernel/rtc.c index 4929c1be0ac0..af6db6ec5b2a 100644 --- a/trunk/arch/x86/kernel/rtc.c +++ b/trunk/arch/x86/kernel/rtc.c @@ -225,7 +225,7 @@ static struct platform_device rtc_device = { static __init int add_rtc_cmos(void) { #ifdef CONFIG_PNP - static const char * const const ids[] __initconst = + static const char *ids[] __initconst = { "PNP0b00", "PNP0b01", "PNP0b02", }; struct pnp_dev *dev; struct pnp_id *id; diff --git a/trunk/arch/x86/kernel/setup.c b/trunk/arch/x86/kernel/setup.c index d609be046b57..4f165479c453 100644 --- a/trunk/arch/x86/kernel/setup.c +++ b/trunk/arch/x86/kernel/setup.c @@ -957,7 +957,7 @@ void __init setup_arch(char **cmdline_p) initmem_init(); memblock_find_dma_reserve(); -#ifdef CONFIG_KVM_GUEST +#ifdef CONFIG_KVM_CLOCK kvmclock_init(); #endif diff --git a/trunk/arch/x86/kvm/Kconfig b/trunk/arch/x86/kvm/Kconfig index 586f00059805..a28f338843ea 100644 --- a/trunk/arch/x86/kvm/Kconfig +++ b/trunk/arch/x86/kvm/Kconfig @@ -20,7 +20,6 @@ if VIRTUALIZATION config KVM tristate "Kernel-based Virtual Machine (KVM) support" depends on HAVE_KVM - depends on HIGH_RES_TIMERS # for device assignment: depends on PCI # for TASKSTATS/TASK_DELAY_ACCT: @@ -38,7 +37,6 @@ config KVM select TASK_DELAY_ACCT select PERF_EVENTS select HAVE_KVM_MSI - select HAVE_KVM_CPU_RELAX_INTERCEPT ---help--- Support hosting fully virtualized guest machines using hardware virtualization extensions. You will need a fairly recent diff --git a/trunk/arch/x86/kvm/Makefile b/trunk/arch/x86/kvm/Makefile index 04d30401c5cb..4f579e8dcacf 100644 --- a/trunk/arch/x86/kvm/Makefile +++ b/trunk/arch/x86/kvm/Makefile @@ -12,7 +12,7 @@ kvm-$(CONFIG_IOMMU_API) += $(addprefix ../../../virt/kvm/, iommu.o) kvm-$(CONFIG_KVM_ASYNC_PF) += $(addprefix ../../../virt/kvm/, async_pf.o) kvm-y += x86.o mmu.o emulate.o i8259.o irq.o lapic.o \ - i8254.o cpuid.o pmu.o + i8254.o timer.o cpuid.o pmu.o kvm-intel-y += vmx.o kvm-amd-y += svm.o diff --git a/trunk/arch/x86/kvm/cpuid.c b/trunk/arch/x86/kvm/cpuid.c index ec79e773342e..0595f1397b7c 100644 --- a/trunk/arch/x86/kvm/cpuid.c +++ b/trunk/arch/x86/kvm/cpuid.c @@ -316,7 +316,7 @@ static int do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function, } case 7: { entry->flags |= KVM_CPUID_FLAG_SIGNIFCANT_INDEX; - /* Mask ebx against host capability word 9 */ + /* Mask ebx against host capbability word 9 */ if (index == 0) { entry->ebx &= kvm_supported_word9_x86_features; cpuid_mask(&entry->ebx, 9); @@ -397,8 +397,8 @@ static int do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function, break; } case KVM_CPUID_SIGNATURE: { - static const char signature[12] = "KVMKVMKVM\0\0"; - const u32 *sigptr = (const u32 *)signature; + char signature[12] = "KVMKVMKVM\0\0"; + u32 *sigptr = (u32 *)signature; entry->eax = KVM_CPUID_FEATURES; entry->ebx = sigptr[0]; entry->ecx = sigptr[1]; @@ -484,10 +484,10 @@ struct kvm_cpuid_param { u32 func; u32 idx; bool has_leaf_count; - bool (*qualifier)(const struct kvm_cpuid_param *param); + bool (*qualifier)(struct kvm_cpuid_param *param); }; -static bool is_centaur_cpu(const struct kvm_cpuid_param *param) +static bool is_centaur_cpu(struct kvm_cpuid_param *param) { return boot_cpu_data.x86_vendor == X86_VENDOR_CENTAUR; } @@ -498,7 +498,7 @@ int kvm_dev_ioctl_get_supported_cpuid(struct kvm_cpuid2 *cpuid, struct kvm_cpuid_entry2 *cpuid_entries; int limit, nent = 0, r = -E2BIG, i; u32 func; - static const struct kvm_cpuid_param param[] = { + static struct kvm_cpuid_param param[] = { { .func = 0, .has_leaf_count = true }, { .func = 0x80000000, .has_leaf_count = true }, { .func = 0xC0000000, .qualifier = is_centaur_cpu, .has_leaf_count = true }, @@ -517,7 +517,7 @@ int kvm_dev_ioctl_get_supported_cpuid(struct kvm_cpuid2 *cpuid, r = 0; for (i = 0; i < ARRAY_SIZE(param); i++) { - const struct kvm_cpuid_param *ent = ¶m[i]; + struct kvm_cpuid_param *ent = ¶m[i]; if (ent->qualifier && !ent->qualifier(ent)) continue; diff --git a/trunk/arch/x86/kvm/emulate.c b/trunk/arch/x86/kvm/emulate.c index 39171cb307ea..a3b57a27be88 100644 --- a/trunk/arch/x86/kvm/emulate.c +++ b/trunk/arch/x86/kvm/emulate.c @@ -161,9 +161,9 @@ struct opcode { u64 intercept : 8; union { int (*execute)(struct x86_emulate_ctxt *ctxt); - const struct opcode *group; - const struct group_dual *gdual; - const struct gprefix *gprefix; + struct opcode *group; + struct group_dual *gdual; + struct gprefix *gprefix; } u; int (*check_perm)(struct x86_emulate_ctxt *ctxt); }; @@ -202,42 +202,6 @@ struct gprefix { #define EFLG_RESERVED_ZEROS_MASK 0xffc0802a #define EFLG_RESERVED_ONE_MASK 2 -static ulong reg_read(struct x86_emulate_ctxt *ctxt, unsigned nr) -{ - if (!(ctxt->regs_valid & (1 << nr))) { - ctxt->regs_valid |= 1 << nr; - ctxt->_regs[nr] = ctxt->ops->read_gpr(ctxt, nr); - } - return ctxt->_regs[nr]; -} - -static ulong *reg_write(struct x86_emulate_ctxt *ctxt, unsigned nr) -{ - ctxt->regs_valid |= 1 << nr; - ctxt->regs_dirty |= 1 << nr; - return &ctxt->_regs[nr]; -} - -static ulong *reg_rmw(struct x86_emulate_ctxt *ctxt, unsigned nr) -{ - reg_read(ctxt, nr); - return reg_write(ctxt, nr); -} - -static void writeback_registers(struct x86_emulate_ctxt *ctxt) -{ - unsigned reg; - - for_each_set_bit(reg, (ulong *)&ctxt->regs_dirty, 16) - ctxt->ops->write_gpr(ctxt, reg, ctxt->_regs[reg]); -} - -static void invalidate_registers(struct x86_emulate_ctxt *ctxt) -{ - ctxt->regs_dirty = 0; - ctxt->regs_valid = 0; -} - /* * Instruction emulation: * Most instructions are emulated directly via a fragment of inline assembly @@ -410,8 +374,8 @@ static void invalidate_registers(struct x86_emulate_ctxt *ctxt) #define __emulate_1op_rax_rdx(ctxt, _op, _suffix, _ex) \ do { \ unsigned long _tmp; \ - ulong *rax = reg_rmw((ctxt), VCPU_REGS_RAX); \ - ulong *rdx = reg_rmw((ctxt), VCPU_REGS_RDX); \ + ulong *rax = &(ctxt)->regs[VCPU_REGS_RAX]; \ + ulong *rdx = &(ctxt)->regs[VCPU_REGS_RDX]; \ \ __asm__ __volatile__ ( \ _PRE_EFLAGS("0", "5", "1") \ @@ -530,7 +494,7 @@ register_address_increment(struct x86_emulate_ctxt *ctxt, unsigned long *reg, in static void rsp_increment(struct x86_emulate_ctxt *ctxt, int inc) { - masked_increment(reg_rmw(ctxt, VCPU_REGS_RSP), stack_mask(ctxt), inc); + masked_increment(&ctxt->regs[VCPU_REGS_RSP], stack_mask(ctxt), inc); } static inline void jmp_rel(struct x86_emulate_ctxt *ctxt, int rel) @@ -668,6 +632,8 @@ static int __linearize(struct x86_emulate_ctxt *ctxt, la = seg_base(ctxt, addr.seg) + addr.ea; switch (ctxt->mode) { + case X86EMUL_MODE_REAL: + break; case X86EMUL_MODE_PROT64: if (((signed long)la << 16) >> 16 != la) return emulate_gp(ctxt, 0); @@ -689,7 +655,7 @@ static int __linearize(struct x86_emulate_ctxt *ctxt, if (addr.ea > lim || (u32)(addr.ea + size - 1) > lim) goto bad; } else { - /* expand-down segment */ + /* exapand-down segment */ if (addr.ea <= lim || (u32)(addr.ea + size - 1) <= lim) goto bad; lim = desc.d ? 0xffffffff : 0xffff; @@ -697,10 +663,7 @@ static int __linearize(struct x86_emulate_ctxt *ctxt, goto bad; } cpl = ctxt->ops->cpl(ctxt); - if (ctxt->mode == X86EMUL_MODE_REAL) - rpl = 0; - else - rpl = sel & 3; + rpl = sel & 3; cpl = max(cpl, rpl); if (!(desc.type & 8)) { /* data segment */ @@ -725,9 +688,9 @@ static int __linearize(struct x86_emulate_ctxt *ctxt, return X86EMUL_CONTINUE; bad: if (addr.seg == VCPU_SREG_SS) - return emulate_ss(ctxt, sel); + return emulate_ss(ctxt, addr.seg); else - return emulate_gp(ctxt, sel); + return emulate_gp(ctxt, addr.seg); } static int linearize(struct x86_emulate_ctxt *ctxt, @@ -823,15 +786,14 @@ static int do_insn_fetch(struct x86_emulate_ctxt *ctxt, * pointer into the block that addresses the relevant register. * @highbyte_regs specifies whether to decode AH,CH,DH,BH. */ -static void *decode_register(struct x86_emulate_ctxt *ctxt, u8 modrm_reg, +static void *decode_register(u8 modrm_reg, unsigned long *regs, int highbyte_regs) { void *p; + p = ®s[modrm_reg]; if (highbyte_regs && modrm_reg >= 4 && modrm_reg < 8) - p = (unsigned char *)reg_rmw(ctxt, modrm_reg & 3) + 1; - else - p = reg_rmw(ctxt, modrm_reg); + p = (unsigned char *)®s[modrm_reg & 3] + 1; return p; } @@ -909,23 +871,23 @@ static void read_sse_reg(struct x86_emulate_ctxt *ctxt, sse128_t *data, int reg) { ctxt->ops->get_fpu(ctxt); switch (reg) { - case 0: asm("movdqa %%xmm0, %0" : "=m"(*data)); break; - case 1: asm("movdqa %%xmm1, %0" : "=m"(*data)); break; - case 2: asm("movdqa %%xmm2, %0" : "=m"(*data)); break; - case 3: asm("movdqa %%xmm3, %0" : "=m"(*data)); break; - case 4: asm("movdqa %%xmm4, %0" : "=m"(*data)); break; - case 5: asm("movdqa %%xmm5, %0" : "=m"(*data)); break; - case 6: asm("movdqa %%xmm6, %0" : "=m"(*data)); break; - case 7: asm("movdqa %%xmm7, %0" : "=m"(*data)); break; + case 0: asm("movdqu %%xmm0, %0" : "=m"(*data)); break; + case 1: asm("movdqu %%xmm1, %0" : "=m"(*data)); break; + case 2: asm("movdqu %%xmm2, %0" : "=m"(*data)); break; + case 3: asm("movdqu %%xmm3, %0" : "=m"(*data)); break; + case 4: asm("movdqu %%xmm4, %0" : "=m"(*data)); break; + case 5: asm("movdqu %%xmm5, %0" : "=m"(*data)); break; + case 6: asm("movdqu %%xmm6, %0" : "=m"(*data)); break; + case 7: asm("movdqu %%xmm7, %0" : "=m"(*data)); break; #ifdef CONFIG_X86_64 - case 8: asm("movdqa %%xmm8, %0" : "=m"(*data)); break; - case 9: asm("movdqa %%xmm9, %0" : "=m"(*data)); break; - case 10: asm("movdqa %%xmm10, %0" : "=m"(*data)); break; - case 11: asm("movdqa %%xmm11, %0" : "=m"(*data)); break; - case 12: asm("movdqa %%xmm12, %0" : "=m"(*data)); break; - case 13: asm("movdqa %%xmm13, %0" : "=m"(*data)); break; - case 14: asm("movdqa %%xmm14, %0" : "=m"(*data)); break; - case 15: asm("movdqa %%xmm15, %0" : "=m"(*data)); break; + case 8: asm("movdqu %%xmm8, %0" : "=m"(*data)); break; + case 9: asm("movdqu %%xmm9, %0" : "=m"(*data)); break; + case 10: asm("movdqu %%xmm10, %0" : "=m"(*data)); break; + case 11: asm("movdqu %%xmm11, %0" : "=m"(*data)); break; + case 12: asm("movdqu %%xmm12, %0" : "=m"(*data)); break; + case 13: asm("movdqu %%xmm13, %0" : "=m"(*data)); break; + case 14: asm("movdqu %%xmm14, %0" : "=m"(*data)); break; + case 15: asm("movdqu %%xmm15, %0" : "=m"(*data)); break; #endif default: BUG(); } @@ -937,23 +899,23 @@ static void write_sse_reg(struct x86_emulate_ctxt *ctxt, sse128_t *data, { ctxt->ops->get_fpu(ctxt); switch (reg) { - case 0: asm("movdqa %0, %%xmm0" : : "m"(*data)); break; - case 1: asm("movdqa %0, %%xmm1" : : "m"(*data)); break; - case 2: asm("movdqa %0, %%xmm2" : : "m"(*data)); break; - case 3: asm("movdqa %0, %%xmm3" : : "m"(*data)); break; - case 4: asm("movdqa %0, %%xmm4" : : "m"(*data)); break; - case 5: asm("movdqa %0, %%xmm5" : : "m"(*data)); break; - case 6: asm("movdqa %0, %%xmm6" : : "m"(*data)); break; - case 7: asm("movdqa %0, %%xmm7" : : "m"(*data)); break; + case 0: asm("movdqu %0, %%xmm0" : : "m"(*data)); break; + case 1: asm("movdqu %0, %%xmm1" : : "m"(*data)); break; + case 2: asm("movdqu %0, %%xmm2" : : "m"(*data)); break; + case 3: asm("movdqu %0, %%xmm3" : : "m"(*data)); break; + case 4: asm("movdqu %0, %%xmm4" : : "m"(*data)); break; + case 5: asm("movdqu %0, %%xmm5" : : "m"(*data)); break; + case 6: asm("movdqu %0, %%xmm6" : : "m"(*data)); break; + case 7: asm("movdqu %0, %%xmm7" : : "m"(*data)); break; #ifdef CONFIG_X86_64 - case 8: asm("movdqa %0, %%xmm8" : : "m"(*data)); break; - case 9: asm("movdqa %0, %%xmm9" : : "m"(*data)); break; - case 10: asm("movdqa %0, %%xmm10" : : "m"(*data)); break; - case 11: asm("movdqa %0, %%xmm11" : : "m"(*data)); break; - case 12: asm("movdqa %0, %%xmm12" : : "m"(*data)); break; - case 13: asm("movdqa %0, %%xmm13" : : "m"(*data)); break; - case 14: asm("movdqa %0, %%xmm14" : : "m"(*data)); break; - case 15: asm("movdqa %0, %%xmm15" : : "m"(*data)); break; + case 8: asm("movdqu %0, %%xmm8" : : "m"(*data)); break; + case 9: asm("movdqu %0, %%xmm9" : : "m"(*data)); break; + case 10: asm("movdqu %0, %%xmm10" : : "m"(*data)); break; + case 11: asm("movdqu %0, %%xmm11" : : "m"(*data)); break; + case 12: asm("movdqu %0, %%xmm12" : : "m"(*data)); break; + case 13: asm("movdqu %0, %%xmm13" : : "m"(*data)); break; + case 14: asm("movdqu %0, %%xmm14" : : "m"(*data)); break; + case 15: asm("movdqu %0, %%xmm15" : : "m"(*data)); break; #endif default: BUG(); } @@ -1020,10 +982,10 @@ static void decode_register_operand(struct x86_emulate_ctxt *ctxt, op->type = OP_REG; if (ctxt->d & ByteOp) { - op->addr.reg = decode_register(ctxt, reg, highbyte_regs); + op->addr.reg = decode_register(reg, ctxt->regs, highbyte_regs); op->bytes = 1; } else { - op->addr.reg = decode_register(ctxt, reg, 0); + op->addr.reg = decode_register(reg, ctxt->regs, 0); op->bytes = ctxt->op_bytes; } fetch_register_operand(op); @@ -1058,7 +1020,8 @@ static int decode_modrm(struct x86_emulate_ctxt *ctxt, if (ctxt->modrm_mod == 3) { op->type = OP_REG; op->bytes = (ctxt->d & ByteOp) ? 1 : ctxt->op_bytes; - op->addr.reg = decode_register(ctxt, ctxt->modrm_rm, ctxt->d & ByteOp); + op->addr.reg = decode_register(ctxt->modrm_rm, + ctxt->regs, ctxt->d & ByteOp); if (ctxt->d & Sse) { op->type = OP_XMM; op->bytes = 16; @@ -1079,10 +1042,10 @@ static int decode_modrm(struct x86_emulate_ctxt *ctxt, op->type = OP_MEM; if (ctxt->ad_bytes == 2) { - unsigned bx = reg_read(ctxt, VCPU_REGS_RBX); - unsigned bp = reg_read(ctxt, VCPU_REGS_RBP); - unsigned si = reg_read(ctxt, VCPU_REGS_RSI); - unsigned di = reg_read(ctxt, VCPU_REGS_RDI); + unsigned bx = ctxt->regs[VCPU_REGS_RBX]; + unsigned bp = ctxt->regs[VCPU_REGS_RBP]; + unsigned si = ctxt->regs[VCPU_REGS_RSI]; + unsigned di = ctxt->regs[VCPU_REGS_RDI]; /* 16-bit ModR/M decode. */ switch (ctxt->modrm_mod) { @@ -1139,17 +1102,17 @@ static int decode_modrm(struct x86_emulate_ctxt *ctxt, if ((base_reg & 7) == 5 && ctxt->modrm_mod == 0) modrm_ea += insn_fetch(s32, ctxt); else { - modrm_ea += reg_read(ctxt, base_reg); + modrm_ea += ctxt->regs[base_reg]; adjust_modrm_seg(ctxt, base_reg); } if (index_reg != 4) - modrm_ea += reg_read(ctxt, index_reg) << scale; + modrm_ea += ctxt->regs[index_reg] << scale; } else if ((ctxt->modrm_rm & 7) == 5 && ctxt->modrm_mod == 0) { if (ctxt->mode == X86EMUL_MODE_PROT64) ctxt->rip_relative = 1; } else { base_reg = ctxt->modrm_rm; - modrm_ea += reg_read(ctxt, base_reg); + modrm_ea += ctxt->regs[base_reg]; adjust_modrm_seg(ctxt, base_reg); } switch (ctxt->modrm_mod) { @@ -1216,21 +1179,24 @@ static int read_emulated(struct x86_emulate_ctxt *ctxt, int rc; struct read_cache *mc = &ctxt->mem_read; - if (mc->pos < mc->end) - goto read_cached; - - WARN_ON((mc->end + size) >= sizeof(mc->data)); + while (size) { + int n = min(size, 8u); + size -= n; + if (mc->pos < mc->end) + goto read_cached; - rc = ctxt->ops->read_emulated(ctxt, addr, mc->data + mc->end, size, - &ctxt->exception); - if (rc != X86EMUL_CONTINUE) - return rc; - - mc->end += size; + rc = ctxt->ops->read_emulated(ctxt, addr, mc->data + mc->end, n, + &ctxt->exception); + if (rc != X86EMUL_CONTINUE) + return rc; + mc->end += n; -read_cached: - memcpy(dest, mc->data + mc->pos, size); - mc->pos += size; + read_cached: + memcpy(dest, mc->data + mc->pos, n); + mc->pos += n; + dest += n; + addr += n; + } return X86EMUL_CONTINUE; } @@ -1287,10 +1253,10 @@ static int pio_in_emulated(struct x86_emulate_ctxt *ctxt, if (rc->pos == rc->end) { /* refill pio read ahead */ unsigned int in_page, n; unsigned int count = ctxt->rep_prefix ? - address_mask(ctxt, reg_read(ctxt, VCPU_REGS_RCX)) : 1; + address_mask(ctxt, ctxt->regs[VCPU_REGS_RCX]) : 1; in_page = (ctxt->eflags & EFLG_DF) ? - offset_in_page(reg_read(ctxt, VCPU_REGS_RDI)) : - PAGE_SIZE - offset_in_page(reg_read(ctxt, VCPU_REGS_RDI)); + offset_in_page(ctxt->regs[VCPU_REGS_RDI]) : + PAGE_SIZE - offset_in_page(ctxt->regs[VCPU_REGS_RDI]); n = min(min(in_page, (unsigned int)sizeof(rc->data)) / size, count); if (n == 0) @@ -1301,15 +1267,8 @@ static int pio_in_emulated(struct x86_emulate_ctxt *ctxt, rc->end = n * size; } - if (ctxt->rep_prefix && !(ctxt->eflags & EFLG_DF)) { - ctxt->dst.data = rc->data + rc->pos; - ctxt->dst.type = OP_MEM_STR; - ctxt->dst.count = (rc->end - rc->pos) / size; - rc->pos = rc->end; - } else { - memcpy(dest, rc->data + rc->pos, size); - rc->pos += size; - } + memcpy(dest, rc->data + rc->pos, size); + rc->pos += size; return 1; } @@ -1332,7 +1291,7 @@ static int read_interrupt_descriptor(struct x86_emulate_ctxt *ctxt, static void get_descriptor_table_ptr(struct x86_emulate_ctxt *ctxt, u16 selector, struct desc_ptr *dt) { - const struct x86_emulate_ops *ops = ctxt->ops; + struct x86_emulate_ops *ops = ctxt->ops; if (selector & 1 << 2) { struct desc_struct desc; @@ -1396,15 +1355,19 @@ static int load_segment_descriptor(struct x86_emulate_ctxt *ctxt, bool null_selector = !(selector & ~0x3); /* 0000-0003 are null */ ulong desc_addr; int ret; - u16 dummy; memset(&seg_desc, 0, sizeof seg_desc); if ((seg <= VCPU_SREG_GS && ctxt->mode == X86EMUL_MODE_VM86) || ctxt->mode == X86EMUL_MODE_REAL) { /* set real mode segment descriptor */ - ctxt->ops->get_segment(ctxt, &dummy, &seg_desc, NULL, seg); set_desc_base(&seg_desc, selector << 4); + set_desc_limit(&seg_desc, 0xffff); + seg_desc.type = 3; + seg_desc.p = 1; + seg_desc.s = 1; + if (ctxt->mode == X86EMUL_MODE_VM86) + seg_desc.dpl = 3; goto load; } @@ -1433,7 +1396,7 @@ static int load_segment_descriptor(struct x86_emulate_ctxt *ctxt, err_code = selector & 0xfffc; err_vec = GP_VECTOR; - /* can't load system descriptor into segment selector */ + /* can't load system descriptor into segment selecor */ if (seg <= VCPU_SREG_GS && !seg_desc.s) goto exception; @@ -1553,14 +1516,6 @@ static int writeback(struct x86_emulate_ctxt *ctxt) if (rc != X86EMUL_CONTINUE) return rc; break; - case OP_MEM_STR: - rc = segmented_write(ctxt, - ctxt->dst.addr.mem, - ctxt->dst.data, - ctxt->dst.bytes * ctxt->dst.count); - if (rc != X86EMUL_CONTINUE) - return rc; - break; case OP_XMM: write_sse_reg(ctxt, &ctxt->dst.vec_val, ctxt->dst.addr.xmm); break; @@ -1581,7 +1536,7 @@ static int push(struct x86_emulate_ctxt *ctxt, void *data, int bytes) struct segmented_address addr; rsp_increment(ctxt, -bytes); - addr.ea = reg_read(ctxt, VCPU_REGS_RSP) & stack_mask(ctxt); + addr.ea = ctxt->regs[VCPU_REGS_RSP] & stack_mask(ctxt); addr.seg = VCPU_SREG_SS; return segmented_write(ctxt, addr, data, bytes); @@ -1600,7 +1555,7 @@ static int emulate_pop(struct x86_emulate_ctxt *ctxt, int rc; struct segmented_address addr; - addr.ea = reg_read(ctxt, VCPU_REGS_RSP) & stack_mask(ctxt); + addr.ea = ctxt->regs[VCPU_REGS_RSP] & stack_mask(ctxt); addr.seg = VCPU_SREG_SS; rc = segmented_read(ctxt, addr, dest, len); if (rc != X86EMUL_CONTINUE) @@ -1668,28 +1623,26 @@ static int em_enter(struct x86_emulate_ctxt *ctxt) int rc; unsigned frame_size = ctxt->src.val; unsigned nesting_level = ctxt->src2.val & 31; - ulong rbp; if (nesting_level) return X86EMUL_UNHANDLEABLE; - rbp = reg_read(ctxt, VCPU_REGS_RBP); - rc = push(ctxt, &rbp, stack_size(ctxt)); + rc = push(ctxt, &ctxt->regs[VCPU_REGS_RBP], stack_size(ctxt)); if (rc != X86EMUL_CONTINUE) return rc; - assign_masked(reg_rmw(ctxt, VCPU_REGS_RBP), reg_read(ctxt, VCPU_REGS_RSP), + assign_masked(&ctxt->regs[VCPU_REGS_RBP], ctxt->regs[VCPU_REGS_RSP], stack_mask(ctxt)); - assign_masked(reg_rmw(ctxt, VCPU_REGS_RSP), - reg_read(ctxt, VCPU_REGS_RSP) - frame_size, + assign_masked(&ctxt->regs[VCPU_REGS_RSP], + ctxt->regs[VCPU_REGS_RSP] - frame_size, stack_mask(ctxt)); return X86EMUL_CONTINUE; } static int em_leave(struct x86_emulate_ctxt *ctxt) { - assign_masked(reg_rmw(ctxt, VCPU_REGS_RSP), reg_read(ctxt, VCPU_REGS_RBP), + assign_masked(&ctxt->regs[VCPU_REGS_RSP], ctxt->regs[VCPU_REGS_RBP], stack_mask(ctxt)); - return emulate_pop(ctxt, reg_rmw(ctxt, VCPU_REGS_RBP), ctxt->op_bytes); + return emulate_pop(ctxt, &ctxt->regs[VCPU_REGS_RBP], ctxt->op_bytes); } static int em_push_sreg(struct x86_emulate_ctxt *ctxt) @@ -1717,13 +1670,13 @@ static int em_pop_sreg(struct x86_emulate_ctxt *ctxt) static int em_pusha(struct x86_emulate_ctxt *ctxt) { - unsigned long old_esp = reg_read(ctxt, VCPU_REGS_RSP); + unsigned long old_esp = ctxt->regs[VCPU_REGS_RSP]; int rc = X86EMUL_CONTINUE; int reg = VCPU_REGS_RAX; while (reg <= VCPU_REGS_RDI) { (reg == VCPU_REGS_RSP) ? - (ctxt->src.val = old_esp) : (ctxt->src.val = reg_read(ctxt, reg)); + (ctxt->src.val = old_esp) : (ctxt->src.val = ctxt->regs[reg]); rc = em_push(ctxt); if (rc != X86EMUL_CONTINUE) @@ -1752,7 +1705,7 @@ static int em_popa(struct x86_emulate_ctxt *ctxt) --reg; } - rc = emulate_pop(ctxt, reg_rmw(ctxt, reg), ctxt->op_bytes); + rc = emulate_pop(ctxt, &ctxt->regs[reg], ctxt->op_bytes); if (rc != X86EMUL_CONTINUE) break; --reg; @@ -1760,9 +1713,9 @@ static int em_popa(struct x86_emulate_ctxt *ctxt) return rc; } -static int __emulate_int_real(struct x86_emulate_ctxt *ctxt, int irq) +int emulate_int_real(struct x86_emulate_ctxt *ctxt, int irq) { - const struct x86_emulate_ops *ops = ctxt->ops; + struct x86_emulate_ops *ops = ctxt->ops; int rc; struct desc_ptr dt; gva_t cs_addr; @@ -1809,22 +1762,11 @@ static int __emulate_int_real(struct x86_emulate_ctxt *ctxt, int irq) return rc; } -int emulate_int_real(struct x86_emulate_ctxt *ctxt, int irq) -{ - int rc; - - invalidate_registers(ctxt); - rc = __emulate_int_real(ctxt, irq); - if (rc == X86EMUL_CONTINUE) - writeback_registers(ctxt); - return rc; -} - static int emulate_int(struct x86_emulate_ctxt *ctxt, int irq) { switch(ctxt->mode) { case X86EMUL_MODE_REAL: - return __emulate_int_real(ctxt, irq); + return emulate_int_real(ctxt, irq); case X86EMUL_MODE_VM86: case X86EMUL_MODE_PROT16: case X86EMUL_MODE_PROT32: @@ -2031,14 +1973,14 @@ static int em_cmpxchg8b(struct x86_emulate_ctxt *ctxt) { u64 old = ctxt->dst.orig_val64; - if (((u32) (old >> 0) != (u32) reg_read(ctxt, VCPU_REGS_RAX)) || - ((u32) (old >> 32) != (u32) reg_read(ctxt, VCPU_REGS_RDX))) { - *reg_write(ctxt, VCPU_REGS_RAX) = (u32) (old >> 0); - *reg_write(ctxt, VCPU_REGS_RDX) = (u32) (old >> 32); + if (((u32) (old >> 0) != (u32) ctxt->regs[VCPU_REGS_RAX]) || + ((u32) (old >> 32) != (u32) ctxt->regs[VCPU_REGS_RDX])) { + ctxt->regs[VCPU_REGS_RAX] = (u32) (old >> 0); + ctxt->regs[VCPU_REGS_RDX] = (u32) (old >> 32); ctxt->eflags &= ~EFLG_ZF; } else { - ctxt->dst.val64 = ((u64)reg_read(ctxt, VCPU_REGS_RCX) << 32) | - (u32) reg_read(ctxt, VCPU_REGS_RBX); + ctxt->dst.val64 = ((u64)ctxt->regs[VCPU_REGS_RCX] << 32) | + (u32) ctxt->regs[VCPU_REGS_RBX]; ctxt->eflags |= EFLG_ZF; } @@ -2074,7 +2016,7 @@ static int em_cmpxchg(struct x86_emulate_ctxt *ctxt) { /* Save real source value, then compare EAX against destination. */ ctxt->src.orig_val = ctxt->src.val; - ctxt->src.val = reg_read(ctxt, VCPU_REGS_RAX); + ctxt->src.val = ctxt->regs[VCPU_REGS_RAX]; emulate_2op_SrcV(ctxt, "cmp"); if (ctxt->eflags & EFLG_ZF) { @@ -2083,7 +2025,7 @@ static int em_cmpxchg(struct x86_emulate_ctxt *ctxt) } else { /* Failure: write the value we saw to EAX. */ ctxt->dst.type = OP_REG; - ctxt->dst.addr.reg = reg_rmw(ctxt, VCPU_REGS_RAX); + ctxt->dst.addr.reg = (unsigned long *)&ctxt->regs[VCPU_REGS_RAX]; } return X86EMUL_CONTINUE; } @@ -2108,6 +2050,12 @@ static void setup_syscalls_segments(struct x86_emulate_ctxt *ctxt, struct desc_struct *cs, struct desc_struct *ss) { + u16 selector; + + memset(cs, 0, sizeof(struct desc_struct)); + ctxt->ops->get_segment(ctxt, &selector, cs, NULL, VCPU_SREG_CS); + memset(ss, 0, sizeof(struct desc_struct)); + cs->l = 0; /* will be adjusted later */ set_desc_base(cs, 0); /* flat segment */ cs->g = 1; /* 4kb granularity */ @@ -2117,7 +2065,6 @@ setup_syscalls_segments(struct x86_emulate_ctxt *ctxt, cs->dpl = 0; /* will be adjusted later */ cs->p = 1; cs->d = 1; - cs->avl = 0; set_desc_base(ss, 0); /* flat segment */ set_desc_limit(ss, 0xfffff); /* 4GB limit */ @@ -2127,8 +2074,6 @@ setup_syscalls_segments(struct x86_emulate_ctxt *ctxt, ss->d = 1; /* 32bit stack segment */ ss->dpl = 0; ss->p = 1; - ss->l = 0; - ss->avl = 0; } static bool vendor_intel(struct x86_emulate_ctxt *ctxt) @@ -2144,7 +2089,7 @@ static bool vendor_intel(struct x86_emulate_ctxt *ctxt) static bool em_syscall_is_enabled(struct x86_emulate_ctxt *ctxt) { - const struct x86_emulate_ops *ops = ctxt->ops; + struct x86_emulate_ops *ops = ctxt->ops; u32 eax, ebx, ecx, edx; /* @@ -2188,7 +2133,7 @@ static bool em_syscall_is_enabled(struct x86_emulate_ctxt *ctxt) static int em_syscall(struct x86_emulate_ctxt *ctxt) { - const struct x86_emulate_ops *ops = ctxt->ops; + struct x86_emulate_ops *ops = ctxt->ops; struct desc_struct cs, ss; u64 msr_data; u16 cs_sel, ss_sel; @@ -2220,10 +2165,10 @@ static int em_syscall(struct x86_emulate_ctxt *ctxt) ops->set_segment(ctxt, cs_sel, &cs, 0, VCPU_SREG_CS); ops->set_segment(ctxt, ss_sel, &ss, 0, VCPU_SREG_SS); - *reg_write(ctxt, VCPU_REGS_RCX) = ctxt->_eip; + ctxt->regs[VCPU_REGS_RCX] = ctxt->_eip; if (efer & EFER_LMA) { #ifdef CONFIG_X86_64 - *reg_write(ctxt, VCPU_REGS_R11) = ctxt->eflags & ~EFLG_RF; + ctxt->regs[VCPU_REGS_R11] = ctxt->eflags & ~EFLG_RF; ops->get_msr(ctxt, ctxt->mode == X86EMUL_MODE_PROT64 ? @@ -2246,7 +2191,7 @@ static int em_syscall(struct x86_emulate_ctxt *ctxt) static int em_sysenter(struct x86_emulate_ctxt *ctxt) { - const struct x86_emulate_ops *ops = ctxt->ops; + struct x86_emulate_ops *ops = ctxt->ops; struct desc_struct cs, ss; u64 msr_data; u16 cs_sel, ss_sel; @@ -2283,8 +2228,6 @@ static int em_sysenter(struct x86_emulate_ctxt *ctxt) if (msr_data == 0x0) return emulate_gp(ctxt, 0); break; - default: - break; } ctxt->eflags &= ~(EFLG_VM | EFLG_IF | EFLG_RF); @@ -2304,14 +2247,14 @@ static int em_sysenter(struct x86_emulate_ctxt *ctxt) ctxt->_eip = msr_data; ops->get_msr(ctxt, MSR_IA32_SYSENTER_ESP, &msr_data); - *reg_write(ctxt, VCPU_REGS_RSP) = msr_data; + ctxt->regs[VCPU_REGS_RSP] = msr_data; return X86EMUL_CONTINUE; } static int em_sysexit(struct x86_emulate_ctxt *ctxt) { - const struct x86_emulate_ops *ops = ctxt->ops; + struct x86_emulate_ops *ops = ctxt->ops; struct desc_struct cs, ss; u64 msr_data; int usermode; @@ -2354,8 +2297,8 @@ static int em_sysexit(struct x86_emulate_ctxt *ctxt) ops->set_segment(ctxt, cs_sel, &cs, 0, VCPU_SREG_CS); ops->set_segment(ctxt, ss_sel, &ss, 0, VCPU_SREG_SS); - ctxt->_eip = reg_read(ctxt, VCPU_REGS_RDX); - *reg_write(ctxt, VCPU_REGS_RSP) = reg_read(ctxt, VCPU_REGS_RCX); + ctxt->_eip = ctxt->regs[VCPU_REGS_RDX]; + ctxt->regs[VCPU_REGS_RSP] = ctxt->regs[VCPU_REGS_RCX]; return X86EMUL_CONTINUE; } @@ -2374,7 +2317,7 @@ static bool emulator_bad_iopl(struct x86_emulate_ctxt *ctxt) static bool emulator_io_port_access_allowed(struct x86_emulate_ctxt *ctxt, u16 port, u16 len) { - const struct x86_emulate_ops *ops = ctxt->ops; + struct x86_emulate_ops *ops = ctxt->ops; struct desc_struct tr_seg; u32 base3; int r; @@ -2424,14 +2367,14 @@ static void save_state_to_tss16(struct x86_emulate_ctxt *ctxt, { tss->ip = ctxt->_eip; tss->flag = ctxt->eflags; - tss->ax = reg_read(ctxt, VCPU_REGS_RAX); - tss->cx = reg_read(ctxt, VCPU_REGS_RCX); - tss->dx = reg_read(ctxt, VCPU_REGS_RDX); - tss->bx = reg_read(ctxt, VCPU_REGS_RBX); - tss->sp = reg_read(ctxt, VCPU_REGS_RSP); - tss->bp = reg_read(ctxt, VCPU_REGS_RBP); - tss->si = reg_read(ctxt, VCPU_REGS_RSI); - tss->di = reg_read(ctxt, VCPU_REGS_RDI); + tss->ax = ctxt->regs[VCPU_REGS_RAX]; + tss->cx = ctxt->regs[VCPU_REGS_RCX]; + tss->dx = ctxt->regs[VCPU_REGS_RDX]; + tss->bx = ctxt->regs[VCPU_REGS_RBX]; + tss->sp = ctxt->regs[VCPU_REGS_RSP]; + tss->bp = ctxt->regs[VCPU_REGS_RBP]; + tss->si = ctxt->regs[VCPU_REGS_RSI]; + tss->di = ctxt->regs[VCPU_REGS_RDI]; tss->es = get_segment_selector(ctxt, VCPU_SREG_ES); tss->cs = get_segment_selector(ctxt, VCPU_SREG_CS); @@ -2447,14 +2390,14 @@ static int load_state_from_tss16(struct x86_emulate_ctxt *ctxt, ctxt->_eip = tss->ip; ctxt->eflags = tss->flag | 2; - *reg_write(ctxt, VCPU_REGS_RAX) = tss->ax; - *reg_write(ctxt, VCPU_REGS_RCX) = tss->cx; - *reg_write(ctxt, VCPU_REGS_RDX) = tss->dx; - *reg_write(ctxt, VCPU_REGS_RBX) = tss->bx; - *reg_write(ctxt, VCPU_REGS_RSP) = tss->sp; - *reg_write(ctxt, VCPU_REGS_RBP) = tss->bp; - *reg_write(ctxt, VCPU_REGS_RSI) = tss->si; - *reg_write(ctxt, VCPU_REGS_RDI) = tss->di; + ctxt->regs[VCPU_REGS_RAX] = tss->ax; + ctxt->regs[VCPU_REGS_RCX] = tss->cx; + ctxt->regs[VCPU_REGS_RDX] = tss->dx; + ctxt->regs[VCPU_REGS_RBX] = tss->bx; + ctxt->regs[VCPU_REGS_RSP] = tss->sp; + ctxt->regs[VCPU_REGS_RBP] = tss->bp; + ctxt->regs[VCPU_REGS_RSI] = tss->si; + ctxt->regs[VCPU_REGS_RDI] = tss->di; /* * SDM says that segment selectors are loaded before segment @@ -2467,7 +2410,7 @@ static int load_state_from_tss16(struct x86_emulate_ctxt *ctxt, set_segment_selector(ctxt, tss->ds, VCPU_SREG_DS); /* - * Now load segment descriptors. If fault happens at this stage + * Now load segment descriptors. If fault happenes at this stage * it is handled in a context of new task */ ret = load_segment_descriptor(ctxt, tss->ldt, VCPU_SREG_LDTR); @@ -2493,7 +2436,7 @@ static int task_switch_16(struct x86_emulate_ctxt *ctxt, u16 tss_selector, u16 old_tss_sel, ulong old_tss_base, struct desc_struct *new_desc) { - const struct x86_emulate_ops *ops = ctxt->ops; + struct x86_emulate_ops *ops = ctxt->ops; struct tss_segment_16 tss_seg; int ret; u32 new_tss_base = get_desc_base(new_desc); @@ -2539,14 +2482,14 @@ static void save_state_to_tss32(struct x86_emulate_ctxt *ctxt, tss->cr3 = ctxt->ops->get_cr(ctxt, 3); tss->eip = ctxt->_eip; tss->eflags = ctxt->eflags; - tss->eax = reg_read(ctxt, VCPU_REGS_RAX); - tss->ecx = reg_read(ctxt, VCPU_REGS_RCX); - tss->edx = reg_read(ctxt, VCPU_REGS_RDX); - tss->ebx = reg_read(ctxt, VCPU_REGS_RBX); - tss->esp = reg_read(ctxt, VCPU_REGS_RSP); - tss->ebp = reg_read(ctxt, VCPU_REGS_RBP); - tss->esi = reg_read(ctxt, VCPU_REGS_RSI); - tss->edi = reg_read(ctxt, VCPU_REGS_RDI); + tss->eax = ctxt->regs[VCPU_REGS_RAX]; + tss->ecx = ctxt->regs[VCPU_REGS_RCX]; + tss->edx = ctxt->regs[VCPU_REGS_RDX]; + tss->ebx = ctxt->regs[VCPU_REGS_RBX]; + tss->esp = ctxt->regs[VCPU_REGS_RSP]; + tss->ebp = ctxt->regs[VCPU_REGS_RBP]; + tss->esi = ctxt->regs[VCPU_REGS_RSI]; + tss->edi = ctxt->regs[VCPU_REGS_RDI]; tss->es = get_segment_selector(ctxt, VCPU_SREG_ES); tss->cs = get_segment_selector(ctxt, VCPU_SREG_CS); @@ -2568,14 +2511,14 @@ static int load_state_from_tss32(struct x86_emulate_ctxt *ctxt, ctxt->eflags = tss->eflags | 2; /* General purpose registers */ - *reg_write(ctxt, VCPU_REGS_RAX) = tss->eax; - *reg_write(ctxt, VCPU_REGS_RCX) = tss->ecx; - *reg_write(ctxt, VCPU_REGS_RDX) = tss->edx; - *reg_write(ctxt, VCPU_REGS_RBX) = tss->ebx; - *reg_write(ctxt, VCPU_REGS_RSP) = tss->esp; - *reg_write(ctxt, VCPU_REGS_RBP) = tss->ebp; - *reg_write(ctxt, VCPU_REGS_RSI) = tss->esi; - *reg_write(ctxt, VCPU_REGS_RDI) = tss->edi; + ctxt->regs[VCPU_REGS_RAX] = tss->eax; + ctxt->regs[VCPU_REGS_RCX] = tss->ecx; + ctxt->regs[VCPU_REGS_RDX] = tss->edx; + ctxt->regs[VCPU_REGS_RBX] = tss->ebx; + ctxt->regs[VCPU_REGS_RSP] = tss->esp; + ctxt->regs[VCPU_REGS_RBP] = tss->ebp; + ctxt->regs[VCPU_REGS_RSI] = tss->esi; + ctxt->regs[VCPU_REGS_RDI] = tss->edi; /* * SDM says that segment selectors are loaded before segment @@ -2640,7 +2583,7 @@ static int task_switch_32(struct x86_emulate_ctxt *ctxt, u16 tss_selector, u16 old_tss_sel, ulong old_tss_base, struct desc_struct *new_desc) { - const struct x86_emulate_ops *ops = ctxt->ops; + struct x86_emulate_ops *ops = ctxt->ops; struct tss_segment_32 tss_seg; int ret; u32 new_tss_base = get_desc_base(new_desc); @@ -2684,7 +2627,7 @@ static int emulator_do_task_switch(struct x86_emulate_ctxt *ctxt, u16 tss_selector, int idt_index, int reason, bool has_error_code, u32 error_code) { - const struct x86_emulate_ops *ops = ctxt->ops; + struct x86_emulate_ops *ops = ctxt->ops; struct desc_struct curr_tss_desc, next_tss_desc; int ret; u16 old_tss_sel = get_segment_selector(ctxt, VCPU_SREG_TR); @@ -2709,7 +2652,7 @@ static int emulator_do_task_switch(struct x86_emulate_ctxt *ctxt, * * 1. jmp/call/int to task gate: Check against DPL of the task gate * 2. Exception/IRQ/iret: No check is performed - * 3. jmp/call to TSS: Check against DPL of the TSS + * 3. jmp/call to TSS: Check agains DPL of the TSS */ if (reason == TASK_SWITCH_GATE) { if (idt_index != -1) { @@ -2750,7 +2693,7 @@ static int emulator_do_task_switch(struct x86_emulate_ctxt *ctxt, ctxt->eflags = ctxt->eflags & ~X86_EFLAGS_NT; /* set back link to prev task only if NT bit is set in eflags - note that old_tss_sel is not used after this point */ + note that old_tss_sel is not used afetr this point */ if (reason != TASK_SWITCH_CALL && reason != TASK_SWITCH_GATE) old_tss_sel = 0xffff; @@ -2790,28 +2733,26 @@ int emulator_task_switch(struct x86_emulate_ctxt *ctxt, { int rc; - invalidate_registers(ctxt); ctxt->_eip = ctxt->eip; ctxt->dst.type = OP_NONE; rc = emulator_do_task_switch(ctxt, tss_selector, idt_index, reason, has_error_code, error_code); - if (rc == X86EMUL_CONTINUE) { + if (rc == X86EMUL_CONTINUE) ctxt->eip = ctxt->_eip; - writeback_registers(ctxt); - } return (rc == X86EMUL_UNHANDLEABLE) ? EMULATION_FAILED : EMULATION_OK; } -static void string_addr_inc(struct x86_emulate_ctxt *ctxt, int reg, - struct operand *op) +static void string_addr_inc(struct x86_emulate_ctxt *ctxt, unsigned seg, + int reg, struct operand *op) { - int df = (ctxt->eflags & EFLG_DF) ? -op->count : op->count; + int df = (ctxt->eflags & EFLG_DF) ? -1 : 1; - register_address_increment(ctxt, reg_rmw(ctxt, reg), df * op->bytes); - op->addr.mem.ea = register_address(ctxt, reg_read(ctxt, reg)); + register_address_increment(ctxt, &ctxt->regs[reg], df * op->bytes); + op->addr.mem.ea = register_address(ctxt, ctxt->regs[reg]); + op->addr.mem.seg = seg; } static int em_das(struct x86_emulate_ctxt *ctxt) @@ -2986,7 +2927,7 @@ static int em_cwd(struct x86_emulate_ctxt *ctxt) { ctxt->dst.type = OP_REG; ctxt->dst.bytes = ctxt->src.bytes; - ctxt->dst.addr.reg = reg_rmw(ctxt, VCPU_REGS_RDX); + ctxt->dst.addr.reg = &ctxt->regs[VCPU_REGS_RDX]; ctxt->dst.val = ~((ctxt->src.val >> (ctxt->src.bytes * 8 - 1)) - 1); return X86EMUL_CONTINUE; @@ -2997,8 +2938,8 @@ static int em_rdtsc(struct x86_emulate_ctxt *ctxt) u64 tsc = 0; ctxt->ops->get_msr(ctxt, MSR_IA32_TSC, &tsc); - *reg_write(ctxt, VCPU_REGS_RAX) = (u32)tsc; - *reg_write(ctxt, VCPU_REGS_RDX) = tsc >> 32; + ctxt->regs[VCPU_REGS_RAX] = (u32)tsc; + ctxt->regs[VCPU_REGS_RDX] = tsc >> 32; return X86EMUL_CONTINUE; } @@ -3006,10 +2947,10 @@ static int em_rdpmc(struct x86_emulate_ctxt *ctxt) { u64 pmc; - if (ctxt->ops->read_pmc(ctxt, reg_read(ctxt, VCPU_REGS_RCX), &pmc)) + if (ctxt->ops->read_pmc(ctxt, ctxt->regs[VCPU_REGS_RCX], &pmc)) return emulate_gp(ctxt, 0); - *reg_write(ctxt, VCPU_REGS_RAX) = (u32)pmc; - *reg_write(ctxt, VCPU_REGS_RDX) = pmc >> 32; + ctxt->regs[VCPU_REGS_RAX] = (u32)pmc; + ctxt->regs[VCPU_REGS_RDX] = pmc >> 32; return X86EMUL_CONTINUE; } @@ -3051,9 +2992,9 @@ static int em_wrmsr(struct x86_emulate_ctxt *ctxt) { u64 msr_data; - msr_data = (u32)reg_read(ctxt, VCPU_REGS_RAX) - | ((u64)reg_read(ctxt, VCPU_REGS_RDX) << 32); - if (ctxt->ops->set_msr(ctxt, reg_read(ctxt, VCPU_REGS_RCX), msr_data)) + msr_data = (u32)ctxt->regs[VCPU_REGS_RAX] + | ((u64)ctxt->regs[VCPU_REGS_RDX] << 32); + if (ctxt->ops->set_msr(ctxt, ctxt->regs[VCPU_REGS_RCX], msr_data)) return emulate_gp(ctxt, 0); return X86EMUL_CONTINUE; @@ -3063,11 +3004,11 @@ static int em_rdmsr(struct x86_emulate_ctxt *ctxt) { u64 msr_data; - if (ctxt->ops->get_msr(ctxt, reg_read(ctxt, VCPU_REGS_RCX), &msr_data)) + if (ctxt->ops->get_msr(ctxt, ctxt->regs[VCPU_REGS_RCX], &msr_data)) return emulate_gp(ctxt, 0); - *reg_write(ctxt, VCPU_REGS_RAX) = (u32)msr_data; - *reg_write(ctxt, VCPU_REGS_RDX) = msr_data >> 32; + ctxt->regs[VCPU_REGS_RAX] = (u32)msr_data; + ctxt->regs[VCPU_REGS_RDX] = msr_data >> 32; return X86EMUL_CONTINUE; } @@ -3247,8 +3188,8 @@ static int em_lmsw(struct x86_emulate_ctxt *ctxt) static int em_loop(struct x86_emulate_ctxt *ctxt) { - register_address_increment(ctxt, reg_rmw(ctxt, VCPU_REGS_RCX), -1); - if ((address_mask(ctxt, reg_read(ctxt, VCPU_REGS_RCX)) != 0) && + register_address_increment(ctxt, &ctxt->regs[VCPU_REGS_RCX], -1); + if ((address_mask(ctxt, ctxt->regs[VCPU_REGS_RCX]) != 0) && (ctxt->b == 0xe2 || test_cc(ctxt->b ^ 0x5, ctxt->eflags))) jmp_rel(ctxt, ctxt->src.val); @@ -3257,7 +3198,7 @@ static int em_loop(struct x86_emulate_ctxt *ctxt) static int em_jcxz(struct x86_emulate_ctxt *ctxt) { - if (address_mask(ctxt, reg_read(ctxt, VCPU_REGS_RCX)) == 0) + if (address_mask(ctxt, ctxt->regs[VCPU_REGS_RCX]) == 0) jmp_rel(ctxt, ctxt->src.val); return X86EMUL_CONTINUE; @@ -3345,20 +3286,20 @@ static int em_cpuid(struct x86_emulate_ctxt *ctxt) { u32 eax, ebx, ecx, edx; - eax = reg_read(ctxt, VCPU_REGS_RAX); - ecx = reg_read(ctxt, VCPU_REGS_RCX); + eax = ctxt->regs[VCPU_REGS_RAX]; + ecx = ctxt->regs[VCPU_REGS_RCX]; ctxt->ops->get_cpuid(ctxt, &eax, &ebx, &ecx, &edx); - *reg_write(ctxt, VCPU_REGS_RAX) = eax; - *reg_write(ctxt, VCPU_REGS_RBX) = ebx; - *reg_write(ctxt, VCPU_REGS_RCX) = ecx; - *reg_write(ctxt, VCPU_REGS_RDX) = edx; + ctxt->regs[VCPU_REGS_RAX] = eax; + ctxt->regs[VCPU_REGS_RBX] = ebx; + ctxt->regs[VCPU_REGS_RCX] = ecx; + ctxt->regs[VCPU_REGS_RDX] = edx; return X86EMUL_CONTINUE; } static int em_lahf(struct x86_emulate_ctxt *ctxt) { - *reg_rmw(ctxt, VCPU_REGS_RAX) &= ~0xff00UL; - *reg_rmw(ctxt, VCPU_REGS_RAX) |= (ctxt->eflags & 0xff) << 8; + ctxt->regs[VCPU_REGS_RAX] &= ~0xff00UL; + ctxt->regs[VCPU_REGS_RAX] |= (ctxt->eflags & 0xff) << 8; return X86EMUL_CONTINUE; } @@ -3515,7 +3456,7 @@ static int check_svme(struct x86_emulate_ctxt *ctxt) static int check_svme_pa(struct x86_emulate_ctxt *ctxt) { - u64 rax = reg_read(ctxt, VCPU_REGS_RAX); + u64 rax = ctxt->regs[VCPU_REGS_RAX]; /* Valid physical address? */ if (rax & 0xffff000000000000ULL) @@ -3537,7 +3478,7 @@ static int check_rdtsc(struct x86_emulate_ctxt *ctxt) static int check_rdpmc(struct x86_emulate_ctxt *ctxt) { u64 cr4 = ctxt->ops->get_cr(ctxt, 4); - u64 rcx = reg_read(ctxt, VCPU_REGS_RCX); + u64 rcx = ctxt->regs[VCPU_REGS_RCX]; if ((!(cr4 & X86_CR4_PCE) && ctxt->ops->cpl(ctxt)) || (rcx > 3)) @@ -3590,13 +3531,13 @@ static int check_perm_out(struct x86_emulate_ctxt *ctxt) I2bv(((_f) | DstReg | SrcMem | ModRM) & ~Lock, _e), \ I2bv(((_f) & ~Lock) | DstAcc | SrcImm, _e) -static const struct opcode group7_rm1[] = { +static struct opcode group7_rm1[] = { DI(SrcNone | Priv, monitor), DI(SrcNone | Priv, mwait), N, N, N, N, N, N, }; -static const struct opcode group7_rm3[] = { +static struct opcode group7_rm3[] = { DIP(SrcNone | Prot | Priv, vmrun, check_svme_pa), II(SrcNone | Prot | VendorSpecific, em_vmmcall, vmmcall), DIP(SrcNone | Prot | Priv, vmload, check_svme_pa), @@ -3607,13 +3548,13 @@ static const struct opcode group7_rm3[] = { DIP(SrcNone | Prot | Priv, invlpga, check_svme), }; -static const struct opcode group7_rm7[] = { +static struct opcode group7_rm7[] = { N, DIP(SrcNone, rdtscp, check_rdtsc), N, N, N, N, N, N, }; -static const struct opcode group1[] = { +static struct opcode group1[] = { I(Lock, em_add), I(Lock | PageTable, em_or), I(Lock, em_adc), @@ -3624,11 +3565,11 @@ static const struct opcode group1[] = { I(0, em_cmp), }; -static const struct opcode group1A[] = { +static struct opcode group1A[] = { I(DstMem | SrcNone | Mov | Stack, em_pop), N, N, N, N, N, N, N, }; -static const struct opcode group3[] = { +static struct opcode group3[] = { I(DstMem | SrcImm, em_test), I(DstMem | SrcImm, em_test), I(DstMem | SrcNone | Lock, em_not), @@ -3639,13 +3580,13 @@ static const struct opcode group3[] = { I(SrcMem, em_idiv_ex), }; -static const struct opcode group4[] = { +static struct opcode group4[] = { I(ByteOp | DstMem | SrcNone | Lock, em_grp45), I(ByteOp | DstMem | SrcNone | Lock, em_grp45), N, N, N, N, N, N, }; -static const struct opcode group5[] = { +static struct opcode group5[] = { I(DstMem | SrcNone | Lock, em_grp45), I(DstMem | SrcNone | Lock, em_grp45), I(SrcMem | Stack, em_grp45), @@ -3655,7 +3596,7 @@ static const struct opcode group5[] = { I(SrcMem | Stack, em_grp45), N, }; -static const struct opcode group6[] = { +static struct opcode group6[] = { DI(Prot, sldt), DI(Prot, str), II(Prot | Priv | SrcMem16, em_lldt, lldt), @@ -3663,7 +3604,7 @@ static const struct opcode group6[] = { N, N, N, N, }; -static const struct group_dual group7 = { { +static struct group_dual group7 = { { II(Mov | DstMem | Priv, em_sgdt, sgdt), II(Mov | DstMem | Priv, em_sidt, sidt), II(SrcMem | Priv, em_lgdt, lgdt), @@ -3680,7 +3621,7 @@ static const struct group_dual group7 = { { EXT(0, group7_rm7), } }; -static const struct opcode group8[] = { +static struct opcode group8[] = { N, N, N, N, I(DstMem | SrcImmByte, em_bt), I(DstMem | SrcImmByte | Lock | PageTable, em_bts), @@ -3688,26 +3629,26 @@ static const struct opcode group8[] = { I(DstMem | SrcImmByte | Lock | PageTable, em_btc), }; -static const struct group_dual group9 = { { +static struct group_dual group9 = { { N, I(DstMem64 | Lock | PageTable, em_cmpxchg8b), N, N, N, N, N, N, }, { N, N, N, N, N, N, N, N, } }; -static const struct opcode group11[] = { +static struct opcode group11[] = { I(DstMem | SrcImm | Mov | PageTable, em_mov), X7(D(Undefined)), }; -static const struct gprefix pfx_0f_6f_0f_7f = { +static struct gprefix pfx_0f_6f_0f_7f = { I(Mmx, em_mov), I(Sse | Aligned, em_mov), N, I(Sse | Unaligned, em_mov), }; -static const struct gprefix pfx_vmovntpx = { +static struct gprefix pfx_vmovntpx = { I(0, em_mov), N, N, N, }; -static const struct opcode opcode_table[256] = { +static struct opcode opcode_table[256] = { /* 0x00 - 0x07 */ I6ALU(Lock, em_add), I(ImplicitOps | Stack | No64 | Src2ES, em_push_sreg), @@ -3748,7 +3689,7 @@ static const struct opcode opcode_table[256] = { I(DstReg | SrcMem | ModRM | Src2Imm, em_imul_3op), I(SrcImmByte | Mov | Stack, em_push), I(DstReg | SrcMem | ModRM | Src2ImmByte, em_imul_3op), - I2bvIP(DstDI | SrcDX | Mov | String | Unaligned, em_in, ins, check_perm_in), /* insb, insw/insd */ + I2bvIP(DstDI | SrcDX | Mov | String, em_in, ins, check_perm_in), /* insb, insw/insd */ I2bvIP(SrcSI | DstDX | String, em_out, outs, check_perm_out), /* outsb, outsw/outsd */ /* 0x70 - 0x7F */ X16(D(SrcImmByte)), @@ -3824,7 +3765,7 @@ static const struct opcode opcode_table[256] = { D(ImplicitOps), D(ImplicitOps), G(0, group4), G(0, group5), }; -static const struct opcode twobyte_table[256] = { +static struct opcode twobyte_table[256] = { /* 0x00 - 0x0F */ G(0, group6), GD(0, &group7), N, N, N, I(ImplicitOps | VendorSpecific, em_syscall), @@ -3995,7 +3936,7 @@ static int decode_operand(struct x86_emulate_ctxt *ctxt, struct operand *op, case OpAcc: op->type = OP_REG; op->bytes = (ctxt->d & ByteOp) ? 1 : ctxt->op_bytes; - op->addr.reg = reg_rmw(ctxt, VCPU_REGS_RAX); + op->addr.reg = &ctxt->regs[VCPU_REGS_RAX]; fetch_register_operand(op); op->orig_val = op->val; break; @@ -4003,20 +3944,19 @@ static int decode_operand(struct x86_emulate_ctxt *ctxt, struct operand *op, op->type = OP_MEM; op->bytes = (ctxt->d & ByteOp) ? 1 : ctxt->op_bytes; op->addr.mem.ea = - register_address(ctxt, reg_read(ctxt, VCPU_REGS_RDI)); + register_address(ctxt, ctxt->regs[VCPU_REGS_RDI]); op->addr.mem.seg = VCPU_SREG_ES; op->val = 0; - op->count = 1; break; case OpDX: op->type = OP_REG; op->bytes = 2; - op->addr.reg = reg_rmw(ctxt, VCPU_REGS_RDX); + op->addr.reg = &ctxt->regs[VCPU_REGS_RDX]; fetch_register_operand(op); break; case OpCL: op->bytes = 1; - op->val = reg_read(ctxt, VCPU_REGS_RCX) & 0xff; + op->val = ctxt->regs[VCPU_REGS_RCX] & 0xff; break; case OpImmByte: rc = decode_imm(ctxt, op, 1, true); @@ -4047,10 +3987,9 @@ static int decode_operand(struct x86_emulate_ctxt *ctxt, struct operand *op, op->type = OP_MEM; op->bytes = (ctxt->d & ByteOp) ? 1 : ctxt->op_bytes; op->addr.mem.ea = - register_address(ctxt, reg_read(ctxt, VCPU_REGS_RSI)); + register_address(ctxt, ctxt->regs[VCPU_REGS_RSI]); op->addr.mem.seg = seg_override(ctxt); op->val = 0; - op->count = 1; break; case OpImmFAddr: op->type = OP_IMM; @@ -4354,10 +4293,9 @@ static void fetch_possible_mmx_operand(struct x86_emulate_ctxt *ctxt, read_mmx_reg(ctxt, &op->mm_val, op->addr.mm); } - int x86_emulate_insn(struct x86_emulate_ctxt *ctxt) { - const struct x86_emulate_ops *ops = ctxt->ops; + struct x86_emulate_ops *ops = ctxt->ops; int rc = X86EMUL_CONTINUE; int saved_dst_type = ctxt->dst.type; @@ -4418,7 +4356,7 @@ int x86_emulate_insn(struct x86_emulate_ctxt *ctxt) } /* Instruction can only be executed in protected mode */ - if ((ctxt->d & Prot) && ctxt->mode < X86EMUL_MODE_PROT16) { + if ((ctxt->d & Prot) && !(ctxt->mode & X86EMUL_MODE_PROT)) { rc = emulate_ud(ctxt); goto done; } @@ -4439,7 +4377,7 @@ int x86_emulate_insn(struct x86_emulate_ctxt *ctxt) if (ctxt->rep_prefix && (ctxt->d & String)) { /* All REP prefixes have the same first termination condition */ - if (address_mask(ctxt, reg_read(ctxt, VCPU_REGS_RCX)) == 0) { + if (address_mask(ctxt, ctxt->regs[VCPU_REGS_RCX]) == 0) { ctxt->eip = ctxt->_eip; goto done; } @@ -4512,7 +4450,7 @@ int x86_emulate_insn(struct x86_emulate_ctxt *ctxt) ctxt->dst.val = ctxt->src.addr.mem.ea; break; case 0x90 ... 0x97: /* nop / xchg reg, rax */ - if (ctxt->dst.addr.reg == reg_rmw(ctxt, VCPU_REGS_RAX)) + if (ctxt->dst.addr.reg == &ctxt->regs[VCPU_REGS_RAX]) break; rc = em_xchg(ctxt); break; @@ -4540,7 +4478,7 @@ int x86_emulate_insn(struct x86_emulate_ctxt *ctxt) rc = em_grp2(ctxt); break; case 0xd2 ... 0xd3: /* Grp2 */ - ctxt->src.val = reg_read(ctxt, VCPU_REGS_RCX); + ctxt->src.val = ctxt->regs[VCPU_REGS_RCX]; rc = em_grp2(ctxt); break; case 0xe9: /* jmp rel */ @@ -4586,27 +4524,23 @@ int x86_emulate_insn(struct x86_emulate_ctxt *ctxt) ctxt->dst.type = saved_dst_type; if ((ctxt->d & SrcMask) == SrcSI) - string_addr_inc(ctxt, VCPU_REGS_RSI, &ctxt->src); + string_addr_inc(ctxt, seg_override(ctxt), + VCPU_REGS_RSI, &ctxt->src); if ((ctxt->d & DstMask) == DstDI) - string_addr_inc(ctxt, VCPU_REGS_RDI, &ctxt->dst); + string_addr_inc(ctxt, VCPU_SREG_ES, VCPU_REGS_RDI, + &ctxt->dst); if (ctxt->rep_prefix && (ctxt->d & String)) { - unsigned int count; struct read_cache *r = &ctxt->io_read; - if ((ctxt->d & SrcMask) == SrcSI) - count = ctxt->src.count; - else - count = ctxt->dst.count; - register_address_increment(ctxt, reg_rmw(ctxt, VCPU_REGS_RCX), - -count); + register_address_increment(ctxt, &ctxt->regs[VCPU_REGS_RCX], -1); if (!string_insn_completed(ctxt)) { /* * Re-enter guest when pio read ahead buffer is empty * or, if it is not used, after each 1024 iteration. */ - if ((r->end != 0 || reg_read(ctxt, VCPU_REGS_RCX) & 0x3ff) && + if ((r->end != 0 || ctxt->regs[VCPU_REGS_RCX] & 0x3ff) && (r->end == 0 || r->end != r->pos)) { /* * Reset read cache. Usually happens before @@ -4614,7 +4548,6 @@ int x86_emulate_insn(struct x86_emulate_ctxt *ctxt) * we have to do it here. */ ctxt->mem_read.end = 0; - writeback_registers(ctxt); return EMULATION_RESTART; } goto done; /* skip rip writeback */ @@ -4629,9 +4562,6 @@ int x86_emulate_insn(struct x86_emulate_ctxt *ctxt) if (rc == X86EMUL_INTERCEPTED) return EMULATION_INTERCEPTED; - if (rc == X86EMUL_CONTINUE) - writeback_registers(ctxt); - return (rc == X86EMUL_UNHANDLEABLE) ? EMULATION_FAILED : EMULATION_OK; twobyte_insn: @@ -4704,13 +4634,3 @@ int x86_emulate_insn(struct x86_emulate_ctxt *ctxt) cannot_emulate: return EMULATION_FAILED; } - -void emulator_invalidate_register_cache(struct x86_emulate_ctxt *ctxt) -{ - invalidate_registers(ctxt); -} - -void emulator_writeback_register_cache(struct x86_emulate_ctxt *ctxt) -{ - writeback_registers(ctxt); -} diff --git a/trunk/arch/x86/kvm/i8254.c b/trunk/arch/x86/kvm/i8254.c index 11300d2fa714..adba28f88d1a 100644 --- a/trunk/arch/x86/kvm/i8254.c +++ b/trunk/arch/x86/kvm/i8254.c @@ -108,7 +108,7 @@ static s64 __kpit_elapsed(struct kvm *kvm) ktime_t remaining; struct kvm_kpit_state *ps = &kvm->arch.vpit->pit_state; - if (!ps->period) + if (!ps->pit_timer.period) return 0; /* @@ -120,9 +120,9 @@ static s64 __kpit_elapsed(struct kvm *kvm) * itself with the initial count and continues counting * from there. */ - remaining = hrtimer_get_remaining(&ps->timer); - elapsed = ps->period - ktime_to_ns(remaining); - elapsed = mod_64(elapsed, ps->period); + remaining = hrtimer_get_remaining(&ps->pit_timer.timer); + elapsed = ps->pit_timer.period - ktime_to_ns(remaining); + elapsed = mod_64(elapsed, ps->pit_timer.period); return elapsed; } @@ -238,12 +238,12 @@ static void kvm_pit_ack_irq(struct kvm_irq_ack_notifier *kian) int value; spin_lock(&ps->inject_lock); - value = atomic_dec_return(&ps->pending); + value = atomic_dec_return(&ps->pit_timer.pending); if (value < 0) /* spurious acks can be generated if, for example, the * PIC is being reset. Handle it gracefully here */ - atomic_inc(&ps->pending); + atomic_inc(&ps->pit_timer.pending); else if (value > 0) /* in this case, we had multiple outstanding pit interrupts * that we needed to inject. Reinject @@ -261,17 +261,28 @@ void __kvm_migrate_pit_timer(struct kvm_vcpu *vcpu) if (!kvm_vcpu_is_bsp(vcpu) || !pit) return; - timer = &pit->pit_state.timer; + timer = &pit->pit_state.pit_timer.timer; if (hrtimer_cancel(timer)) hrtimer_start_expires(timer, HRTIMER_MODE_ABS); } static void destroy_pit_timer(struct kvm_pit *pit) { - hrtimer_cancel(&pit->pit_state.timer); + hrtimer_cancel(&pit->pit_state.pit_timer.timer); flush_kthread_work(&pit->expired); } +static bool kpit_is_periodic(struct kvm_timer *ktimer) +{ + struct kvm_kpit_state *ps = container_of(ktimer, struct kvm_kpit_state, + pit_timer); + return ps->is_periodic; +} + +static struct kvm_timer_ops kpit_ops = { + .is_periodic = kpit_is_periodic, +}; + static void pit_do_work(struct kthread_work *work) { struct kvm_pit *pit = container_of(work, struct kvm_pit, expired); @@ -311,16 +322,16 @@ static void pit_do_work(struct kthread_work *work) static enum hrtimer_restart pit_timer_fn(struct hrtimer *data) { - struct kvm_kpit_state *ps = container_of(data, struct kvm_kpit_state, timer); - struct kvm_pit *pt = ps->kvm->arch.vpit; + struct kvm_timer *ktimer = container_of(data, struct kvm_timer, timer); + struct kvm_pit *pt = ktimer->kvm->arch.vpit; - if (ps->reinject || !atomic_read(&ps->pending)) { - atomic_inc(&ps->pending); + if (ktimer->reinject || !atomic_read(&ktimer->pending)) { + atomic_inc(&ktimer->pending); queue_kthread_work(&pt->worker, &pt->expired); } - if (ps->is_periodic) { - hrtimer_add_expires_ns(&ps->timer, ps->period); + if (ktimer->t_ops->is_periodic(ktimer)) { + hrtimer_add_expires_ns(&ktimer->timer, ktimer->period); return HRTIMER_RESTART; } else return HRTIMER_NORESTART; @@ -329,6 +340,7 @@ static enum hrtimer_restart pit_timer_fn(struct hrtimer *data) static void create_pit_timer(struct kvm *kvm, u32 val, int is_period) { struct kvm_kpit_state *ps = &kvm->arch.vpit->pit_state; + struct kvm_timer *pt = &ps->pit_timer; s64 interval; if (!irqchip_in_kernel(kvm) || ps->flags & KVM_PIT_FLAGS_HPET_LEGACY) @@ -339,18 +351,19 @@ static void create_pit_timer(struct kvm *kvm, u32 val, int is_period) pr_debug("create pit timer, interval is %llu nsec\n", interval); /* TODO The new value only affected after the retriggered */ - hrtimer_cancel(&ps->timer); + hrtimer_cancel(&pt->timer); flush_kthread_work(&ps->pit->expired); - ps->period = interval; + pt->period = interval; ps->is_periodic = is_period; - ps->timer.function = pit_timer_fn; - ps->kvm = ps->pit->kvm; + pt->timer.function = pit_timer_fn; + pt->t_ops = &kpit_ops; + pt->kvm = ps->pit->kvm; - atomic_set(&ps->pending, 0); + atomic_set(&pt->pending, 0); ps->irq_ack = 1; - hrtimer_start(&ps->timer, ktime_add_ns(ktime_get(), interval), + hrtimer_start(&pt->timer, ktime_add_ns(ktime_get(), interval), HRTIMER_MODE_ABS); } @@ -626,7 +639,7 @@ void kvm_pit_reset(struct kvm_pit *pit) } mutex_unlock(&pit->pit_state.lock); - atomic_set(&pit->pit_state.pending, 0); + atomic_set(&pit->pit_state.pit_timer.pending, 0); pit->pit_state.irq_ack = 1; } @@ -635,7 +648,7 @@ static void pit_mask_notifer(struct kvm_irq_mask_notifier *kimn, bool mask) struct kvm_pit *pit = container_of(kimn, struct kvm_pit, mask_notifier); if (!mask) { - atomic_set(&pit->pit_state.pending, 0); + atomic_set(&pit->pit_state.pit_timer.pending, 0); pit->pit_state.irq_ack = 1; } } @@ -693,11 +706,12 @@ struct kvm_pit *kvm_create_pit(struct kvm *kvm, u32 flags) pit_state = &pit->pit_state; pit_state->pit = pit; - hrtimer_init(&pit_state->timer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS); + hrtimer_init(&pit_state->pit_timer.timer, + CLOCK_MONOTONIC, HRTIMER_MODE_ABS); pit_state->irq_ack_notifier.gsi = 0; pit_state->irq_ack_notifier.irq_acked = kvm_pit_ack_irq; kvm_register_irq_ack_notifier(kvm, &pit_state->irq_ack_notifier); - pit_state->reinject = true; + pit_state->pit_timer.reinject = true; mutex_unlock(&pit->pit_state.lock); kvm_pit_reset(pit); @@ -747,7 +761,7 @@ void kvm_free_pit(struct kvm *kvm) kvm_unregister_irq_ack_notifier(kvm, &kvm->arch.vpit->pit_state.irq_ack_notifier); mutex_lock(&kvm->arch.vpit->pit_state.lock); - timer = &kvm->arch.vpit->pit_state.timer; + timer = &kvm->arch.vpit->pit_state.pit_timer.timer; hrtimer_cancel(timer); flush_kthread_work(&kvm->arch.vpit->expired); kthread_stop(kvm->arch.vpit->worker_task); diff --git a/trunk/arch/x86/kvm/i8254.h b/trunk/arch/x86/kvm/i8254.h index dd1b16b611b0..fdf40425ea1d 100644 --- a/trunk/arch/x86/kvm/i8254.h +++ b/trunk/arch/x86/kvm/i8254.h @@ -24,12 +24,8 @@ struct kvm_kpit_channel_state { struct kvm_kpit_state { struct kvm_kpit_channel_state channels[3]; u32 flags; + struct kvm_timer pit_timer; bool is_periodic; - s64 period; /* unit: ns */ - struct hrtimer timer; - atomic_t pending; /* accumulated triggered timers */ - bool reinject; - struct kvm *kvm; u32 speaker_data_on; struct mutex lock; struct kvm_pit *pit; diff --git a/trunk/arch/x86/kvm/i8259.c b/trunk/arch/x86/kvm/i8259.c index 848206df0967..9fc9aa7ac703 100644 --- a/trunk/arch/x86/kvm/i8259.c +++ b/trunk/arch/x86/kvm/i8259.c @@ -190,17 +190,17 @@ void kvm_pic_update_irq(struct kvm_pic *s) int kvm_pic_set_irq(struct kvm_pic *s, int irq, int irq_source_id, int level) { - int ret, irq_level; - - BUG_ON(irq < 0 || irq >= PIC_NUM_PINS); + int ret = -1; pic_lock(s); - irq_level = __kvm_irq_line_state(&s->irq_states[irq], - irq_source_id, level); - ret = pic_set_irq1(&s->pics[irq >> 3], irq & 7, irq_level); - pic_update_irq(s); - trace_kvm_pic_set_irq(irq >> 3, irq & 7, s->pics[irq >> 3].elcr, - s->pics[irq >> 3].imr, ret == 0); + if (irq >= 0 && irq < PIC_NUM_PINS) { + int irq_level = __kvm_irq_line_state(&s->irq_states[irq], + irq_source_id, level); + ret = pic_set_irq1(&s->pics[irq >> 3], irq & 7, irq_level); + pic_update_irq(s); + trace_kvm_pic_set_irq(irq >> 3, irq & 7, s->pics[irq >> 3].elcr, + s->pics[irq >> 3].imr, ret == 0); + } pic_unlock(s); return ret; @@ -275,20 +275,23 @@ void kvm_pic_reset(struct kvm_kpic_state *s) { int irq, i; struct kvm_vcpu *vcpu; - u8 edge_irr = s->irr & ~s->elcr; + u8 irr = s->irr, isr = s->imr; bool found = false; s->last_irr = 0; - s->irr &= s->elcr; + s->irr = 0; s->imr = 0; + s->isr = 0; s->priority_add = 0; - s->special_mask = 0; + s->irq_base = 0; s->read_reg_select = 0; - if (!s->init4) { - s->special_fully_nested_mode = 0; - s->auto_eoi = 0; - } - s->init_state = 1; + s->poll = 0; + s->special_mask = 0; + s->init_state = 0; + s->auto_eoi = 0; + s->rotate_on_auto_eoi = 0; + s->special_fully_nested_mode = 0; + s->init4 = 0; kvm_for_each_vcpu(i, vcpu, s->pics_state->kvm) if (kvm_apic_accept_pic_intr(vcpu)) { @@ -301,7 +304,7 @@ void kvm_pic_reset(struct kvm_kpic_state *s) return; for (irq = 0; irq < PIC_NUM_PINS/2; irq++) - if (edge_irr & (1 << irq)) + if (irr & (1 << irq) || isr & (1 << irq)) pic_clear_isr(s, irq); } @@ -313,13 +316,40 @@ static void pic_ioport_write(void *opaque, u32 addr, u32 val) addr &= 1; if (addr == 0) { if (val & 0x10) { + u8 edge_irr = s->irr & ~s->elcr; + int i; + bool found = false; + struct kvm_vcpu *vcpu; + s->init4 = val & 1; + s->last_irr = 0; + s->irr &= s->elcr; + s->imr = 0; + s->priority_add = 0; + s->special_mask = 0; + s->read_reg_select = 0; + if (!s->init4) { + s->special_fully_nested_mode = 0; + s->auto_eoi = 0; + } + s->init_state = 1; if (val & 0x02) pr_pic_unimpl("single mode not supported"); if (val & 0x08) pr_pic_unimpl( - "level sensitive irq not supported"); - kvm_pic_reset(s); + "level sensitive irq not supported"); + + kvm_for_each_vcpu(i, vcpu, s->pics_state->kvm) + if (kvm_apic_accept_pic_intr(vcpu)) { + found = true; + break; + } + + + if (found) + for (irq = 0; irq < PIC_NUM_PINS/2; irq++) + if (edge_irr & (1 << irq)) + pic_clear_isr(s, irq); } else if (val & 0x08) { if (val & 0x04) s->poll = 1; diff --git a/trunk/arch/x86/kvm/irq.h b/trunk/arch/x86/kvm/irq.h index 2d03568e9498..2086f2bfba33 100644 --- a/trunk/arch/x86/kvm/irq.h +++ b/trunk/arch/x86/kvm/irq.h @@ -70,7 +70,7 @@ struct kvm_pic { struct kvm_io_device dev_slave; struct kvm_io_device dev_eclr; void (*ack_notifier)(void *opaque, int irq); - unsigned long irq_states[PIC_NUM_PINS]; + unsigned long irq_states[16]; }; struct kvm_pic *kvm_create_pic(struct kvm *kvm); diff --git a/trunk/arch/x86/kvm/kvm_timer.h b/trunk/arch/x86/kvm/kvm_timer.h new file mode 100644 index 000000000000..497dbaa366d4 --- /dev/null +++ b/trunk/arch/x86/kvm/kvm_timer.h @@ -0,0 +1,18 @@ + +struct kvm_timer { + struct hrtimer timer; + s64 period; /* unit: ns */ + u32 timer_mode_mask; + u64 tscdeadline; + atomic_t pending; /* accumulated triggered timers */ + bool reinject; + struct kvm_timer_ops *t_ops; + struct kvm *kvm; + struct kvm_vcpu *vcpu; +}; + +struct kvm_timer_ops { + bool (*is_periodic)(struct kvm_timer *); +}; + +enum hrtimer_restart kvm_timer_fn(struct hrtimer *data); diff --git a/trunk/arch/x86/kvm/lapic.c b/trunk/arch/x86/kvm/lapic.c index c6e6b721b6ee..ce878788a39f 100644 --- a/trunk/arch/x86/kvm/lapic.c +++ b/trunk/arch/x86/kvm/lapic.c @@ -34,7 +34,6 @@ #include #include #include -#include #include "kvm_cache_regs.h" #include "irq.h" #include "trace.h" @@ -66,7 +65,6 @@ #define APIC_DEST_NOSHORT 0x0 #define APIC_DEST_MASK 0x800 #define MAX_APIC_VECTOR 256 -#define APIC_VECTORS_PER_REG 32 #define VEC_POS(v) ((v) & (32 - 1)) #define REG_POS(v) (((v) >> 5) << 4) @@ -74,6 +72,11 @@ static unsigned int min_timer_period_us = 500; module_param(min_timer_period_us, uint, S_IRUGO | S_IWUSR); +static inline u32 apic_get_reg(struct kvm_lapic *apic, int reg_off) +{ + return *((u32 *) (apic->regs + reg_off)); +} + static inline void apic_set_reg(struct kvm_lapic *apic, int reg_off, u32 val) { *((u32 *) (apic->regs + reg_off)) = val; @@ -114,23 +117,19 @@ static inline int __apic_test_and_clear_vector(int vec, void *bitmap) return __test_and_clear_bit(VEC_POS(vec), (bitmap) + REG_POS(vec)); } -struct static_key_deferred apic_hw_disabled __read_mostly; -struct static_key_deferred apic_sw_disabled __read_mostly; +static inline int apic_hw_enabled(struct kvm_lapic *apic) +{ + return (apic)->vcpu->arch.apic_base & MSR_IA32_APICBASE_ENABLE; +} -static inline void apic_set_spiv(struct kvm_lapic *apic, u32 val) +static inline int apic_sw_enabled(struct kvm_lapic *apic) { - if ((kvm_apic_get_reg(apic, APIC_SPIV) ^ val) & APIC_SPIV_APIC_ENABLED) { - if (val & APIC_SPIV_APIC_ENABLED) - static_key_slow_dec_deferred(&apic_sw_disabled); - else - static_key_slow_inc(&apic_sw_disabled.key); - } - apic_set_reg(apic, APIC_SPIV, val); + return apic_get_reg(apic, APIC_SPIV) & APIC_SPIV_APIC_ENABLED; } static inline int apic_enabled(struct kvm_lapic *apic) { - return kvm_apic_sw_enabled(apic) && kvm_apic_hw_enabled(apic); + return apic_sw_enabled(apic) && apic_hw_enabled(apic); } #define LVT_MASK \ @@ -140,135 +139,36 @@ static inline int apic_enabled(struct kvm_lapic *apic) (LVT_MASK | APIC_MODE_MASK | APIC_INPUT_POLARITY | \ APIC_LVT_REMOTE_IRR | APIC_LVT_LEVEL_TRIGGER) -static inline int apic_x2apic_mode(struct kvm_lapic *apic) -{ - return apic->vcpu->arch.apic_base & X2APIC_ENABLE; -} - static inline int kvm_apic_id(struct kvm_lapic *apic) { - return (kvm_apic_get_reg(apic, APIC_ID) >> 24) & 0xff; -} - -static inline u16 apic_cluster_id(struct kvm_apic_map *map, u32 ldr) -{ - u16 cid; - ldr >>= 32 - map->ldr_bits; - cid = (ldr >> map->cid_shift) & map->cid_mask; - - BUG_ON(cid >= ARRAY_SIZE(map->logical_map)); - - return cid; -} - -static inline u16 apic_logical_id(struct kvm_apic_map *map, u32 ldr) -{ - ldr >>= (32 - map->ldr_bits); - return ldr & map->lid_mask; -} - -static void recalculate_apic_map(struct kvm *kvm) -{ - struct kvm_apic_map *new, *old = NULL; - struct kvm_vcpu *vcpu; - int i; - - new = kzalloc(sizeof(struct kvm_apic_map), GFP_KERNEL); - - mutex_lock(&kvm->arch.apic_map_lock); - - if (!new) - goto out; - - new->ldr_bits = 8; - /* flat mode is default */ - new->cid_shift = 8; - new->cid_mask = 0; - new->lid_mask = 0xff; - - kvm_for_each_vcpu(i, vcpu, kvm) { - struct kvm_lapic *apic = vcpu->arch.apic; - u16 cid, lid; - u32 ldr; - - if (!kvm_apic_present(vcpu)) - continue; - - /* - * All APICs have to be configured in the same mode by an OS. - * We take advatage of this while building logical id loockup - * table. After reset APICs are in xapic/flat mode, so if we - * find apic with different setting we assume this is the mode - * OS wants all apics to be in; build lookup table accordingly. - */ - if (apic_x2apic_mode(apic)) { - new->ldr_bits = 32; - new->cid_shift = 16; - new->cid_mask = new->lid_mask = 0xffff; - } else if (kvm_apic_sw_enabled(apic) && - !new->cid_mask /* flat mode */ && - kvm_apic_get_reg(apic, APIC_DFR) == APIC_DFR_CLUSTER) { - new->cid_shift = 4; - new->cid_mask = 0xf; - new->lid_mask = 0xf; - } - - new->phys_map[kvm_apic_id(apic)] = apic; - - ldr = kvm_apic_get_reg(apic, APIC_LDR); - cid = apic_cluster_id(new, ldr); - lid = apic_logical_id(new, ldr); - - if (lid) - new->logical_map[cid][ffs(lid) - 1] = apic; - } -out: - old = rcu_dereference_protected(kvm->arch.apic_map, - lockdep_is_held(&kvm->arch.apic_map_lock)); - rcu_assign_pointer(kvm->arch.apic_map, new); - mutex_unlock(&kvm->arch.apic_map_lock); - - if (old) - kfree_rcu(old, rcu); -} - -static inline void kvm_apic_set_id(struct kvm_lapic *apic, u8 id) -{ - apic_set_reg(apic, APIC_ID, id << 24); - recalculate_apic_map(apic->vcpu->kvm); -} - -static inline void kvm_apic_set_ldr(struct kvm_lapic *apic, u32 id) -{ - apic_set_reg(apic, APIC_LDR, id); - recalculate_apic_map(apic->vcpu->kvm); + return (apic_get_reg(apic, APIC_ID) >> 24) & 0xff; } static inline int apic_lvt_enabled(struct kvm_lapic *apic, int lvt_type) { - return !(kvm_apic_get_reg(apic, lvt_type) & APIC_LVT_MASKED); + return !(apic_get_reg(apic, lvt_type) & APIC_LVT_MASKED); } static inline int apic_lvt_vector(struct kvm_lapic *apic, int lvt_type) { - return kvm_apic_get_reg(apic, lvt_type) & APIC_VECTOR_MASK; + return apic_get_reg(apic, lvt_type) & APIC_VECTOR_MASK; } static inline int apic_lvtt_oneshot(struct kvm_lapic *apic) { - return ((kvm_apic_get_reg(apic, APIC_LVTT) & + return ((apic_get_reg(apic, APIC_LVTT) & apic->lapic_timer.timer_mode_mask) == APIC_LVT_TIMER_ONESHOT); } static inline int apic_lvtt_period(struct kvm_lapic *apic) { - return ((kvm_apic_get_reg(apic, APIC_LVTT) & + return ((apic_get_reg(apic, APIC_LVTT) & apic->lapic_timer.timer_mode_mask) == APIC_LVT_TIMER_PERIODIC); } static inline int apic_lvtt_tscdeadline(struct kvm_lapic *apic) { - return ((kvm_apic_get_reg(apic, APIC_LVTT) & + return ((apic_get_reg(apic, APIC_LVTT) & apic->lapic_timer.timer_mode_mask) == APIC_LVT_TIMER_TSCDEADLINE); } @@ -284,7 +184,7 @@ void kvm_apic_set_version(struct kvm_vcpu *vcpu) struct kvm_cpuid_entry2 *feat; u32 v = APIC_VERSION; - if (!kvm_vcpu_has_lapic(vcpu)) + if (!irqchip_in_kernel(vcpu->kvm)) return; feat = kvm_find_cpuid_entry(apic->vcpu, 0x1, 0); @@ -293,7 +193,12 @@ void kvm_apic_set_version(struct kvm_vcpu *vcpu) apic_set_reg(apic, APIC_LVR, v); } -static const unsigned int apic_lvt_mask[APIC_LVT_NUM] = { +static inline int apic_x2apic_mode(struct kvm_lapic *apic) +{ + return apic->vcpu->arch.apic_base & X2APIC_ENABLE; +} + +static unsigned int apic_lvt_mask[APIC_LVT_NUM] = { LVT_MASK , /* part LVTT mask, timer mode mask added at runtime */ LVT_MASK | APIC_MODE_MASK, /* LVTTHMR */ LVT_MASK | APIC_MODE_MASK, /* LVTPC */ @@ -303,30 +208,25 @@ static const unsigned int apic_lvt_mask[APIC_LVT_NUM] = { static int find_highest_vector(void *bitmap) { - int vec; - u32 *reg; + u32 *word = bitmap; + int word_offset = MAX_APIC_VECTOR >> 5; - for (vec = MAX_APIC_VECTOR - APIC_VECTORS_PER_REG; - vec >= 0; vec -= APIC_VECTORS_PER_REG) { - reg = bitmap + REG_POS(vec); - if (*reg) - return fls(*reg) - 1 + vec; - } + while ((word_offset != 0) && (word[(--word_offset) << 2] == 0)) + continue; - return -1; + if (likely(!word_offset && !word[0])) + return -1; + else + return fls(word[word_offset << 2]) - 1 + (word_offset << 5); } static u8 count_vectors(void *bitmap) { - int vec; - u32 *reg; + u32 *word = bitmap; + int word_offset; u8 count = 0; - - for (vec = 0; vec < MAX_APIC_VECTOR; vec += APIC_VECTORS_PER_REG) { - reg = bitmap + REG_POS(vec); - count += hweight32(*reg); - } - + for (word_offset = 0; word_offset < MAX_APIC_VECTOR >> 5; ++word_offset) + count += hweight32(word[word_offset << 2]); return count; } @@ -385,6 +285,7 @@ static inline void apic_clear_isr(int vec, struct kvm_lapic *apic) int kvm_lapic_find_highest_irr(struct kvm_vcpu *vcpu) { + struct kvm_lapic *apic = vcpu->arch.apic; int highest_irr; /* This may race with setting of irr in __apic_accept_irq() and @@ -392,9 +293,9 @@ int kvm_lapic_find_highest_irr(struct kvm_vcpu *vcpu) * will cause vmexit immediately and the value will be recalculated * on the next vmentry. */ - if (!kvm_vcpu_has_lapic(vcpu)) + if (!apic) return 0; - highest_irr = apic_find_highest_irr(vcpu->arch.apic); + highest_irr = apic_find_highest_irr(apic); return highest_irr; } @@ -477,8 +378,8 @@ static void apic_update_ppr(struct kvm_lapic *apic) u32 tpr, isrv, ppr, old_ppr; int isr; - old_ppr = kvm_apic_get_reg(apic, APIC_PROCPRI); - tpr = kvm_apic_get_reg(apic, APIC_TASKPRI); + old_ppr = apic_get_reg(apic, APIC_PROCPRI); + tpr = apic_get_reg(apic, APIC_TASKPRI); isr = apic_find_highest_isr(apic); isrv = (isr != -1) ? isr : 0; @@ -514,13 +415,13 @@ int kvm_apic_match_logical_addr(struct kvm_lapic *apic, u8 mda) u32 logical_id; if (apic_x2apic_mode(apic)) { - logical_id = kvm_apic_get_reg(apic, APIC_LDR); + logical_id = apic_get_reg(apic, APIC_LDR); return logical_id & mda; } - logical_id = GET_APIC_LOGICAL_ID(kvm_apic_get_reg(apic, APIC_LDR)); + logical_id = GET_APIC_LOGICAL_ID(apic_get_reg(apic, APIC_LDR)); - switch (kvm_apic_get_reg(apic, APIC_DFR)) { + switch (apic_get_reg(apic, APIC_DFR)) { case APIC_DFR_FLAT: if (logical_id & mda) result = 1; @@ -532,7 +433,7 @@ int kvm_apic_match_logical_addr(struct kvm_lapic *apic, u8 mda) break; default: apic_debug("Bad DFR vcpu %d: %08x\n", - apic->vcpu->vcpu_id, kvm_apic_get_reg(apic, APIC_DFR)); + apic->vcpu->vcpu_id, apic_get_reg(apic, APIC_DFR)); break; } @@ -577,72 +478,6 @@ int kvm_apic_match_dest(struct kvm_vcpu *vcpu, struct kvm_lapic *source, return result; } -bool kvm_irq_delivery_to_apic_fast(struct kvm *kvm, struct kvm_lapic *src, - struct kvm_lapic_irq *irq, int *r) -{ - struct kvm_apic_map *map; - unsigned long bitmap = 1; - struct kvm_lapic **dst; - int i; - bool ret = false; - - *r = -1; - - if (irq->shorthand == APIC_DEST_SELF) { - *r = kvm_apic_set_irq(src->vcpu, irq); - return true; - } - - if (irq->shorthand) - return false; - - rcu_read_lock(); - map = rcu_dereference(kvm->arch.apic_map); - - if (!map) - goto out; - - if (irq->dest_mode == 0) { /* physical mode */ - if (irq->delivery_mode == APIC_DM_LOWEST || - irq->dest_id == 0xff) - goto out; - dst = &map->phys_map[irq->dest_id & 0xff]; - } else { - u32 mda = irq->dest_id << (32 - map->ldr_bits); - - dst = map->logical_map[apic_cluster_id(map, mda)]; - - bitmap = apic_logical_id(map, mda); - - if (irq->delivery_mode == APIC_DM_LOWEST) { - int l = -1; - for_each_set_bit(i, &bitmap, 16) { - if (!dst[i]) - continue; - if (l < 0) - l = i; - else if (kvm_apic_compare_prio(dst[i]->vcpu, dst[l]->vcpu) < 0) - l = i; - } - - bitmap = (l >= 0) ? 1 << l : 0; - } - } - - for_each_set_bit(i, &bitmap, 16) { - if (!dst[i]) - continue; - if (*r < 0) - *r = 0; - *r += kvm_apic_set_irq(dst[i]->vcpu, irq); - } - - ret = true; -out: - rcu_read_unlock(); - return ret; -} - /* * Add a pending IRQ into lapic. * Return 1 if successfully added and 0 if discarded. @@ -756,7 +591,7 @@ static int apic_set_eoi(struct kvm_lapic *apic) apic_clear_isr(vector, apic); apic_update_ppr(apic); - if (!(kvm_apic_get_reg(apic, APIC_SPIV) & APIC_SPIV_DIRECTED_EOI) && + if (!(apic_get_reg(apic, APIC_SPIV) & APIC_SPIV_DIRECTED_EOI) && kvm_ioapic_handles_vector(apic->vcpu->kvm, vector)) { int trigger_mode; if (apic_test_vector(vector, apic->regs + APIC_TMR)) @@ -771,8 +606,8 @@ static int apic_set_eoi(struct kvm_lapic *apic) static void apic_send_ipi(struct kvm_lapic *apic) { - u32 icr_low = kvm_apic_get_reg(apic, APIC_ICR); - u32 icr_high = kvm_apic_get_reg(apic, APIC_ICR2); + u32 icr_low = apic_get_reg(apic, APIC_ICR); + u32 icr_high = apic_get_reg(apic, APIC_ICR2); struct kvm_lapic_irq irq; irq.vector = icr_low & APIC_VECTOR_MASK; @@ -807,7 +642,7 @@ static u32 apic_get_tmcct(struct kvm_lapic *apic) ASSERT(apic != NULL); /* if initial count is 0, current count should also be 0 */ - if (kvm_apic_get_reg(apic, APIC_TMICT) == 0) + if (apic_get_reg(apic, APIC_TMICT) == 0) return 0; remaining = hrtimer_get_remaining(&apic->lapic_timer.timer); @@ -861,15 +696,13 @@ static u32 __apic_read(struct kvm_lapic *apic, unsigned int offset) val = apic_get_tmcct(apic); break; - case APIC_PROCPRI: - apic_update_ppr(apic); - val = kvm_apic_get_reg(apic, offset); - break; + case APIC_TASKPRI: report_tpr_access(apic, false); /* fall thru */ default: - val = kvm_apic_get_reg(apic, offset); + apic_update_ppr(apic); + val = apic_get_reg(apic, offset); break; } @@ -886,7 +719,7 @@ static int apic_reg_read(struct kvm_lapic *apic, u32 offset, int len, { unsigned char alignment = offset & 0xf; u32 result; - /* this bitmask has a bit cleared for each reserved register */ + /* this bitmask has a bit cleared for each reserver register */ static const u64 rmask = 0x43ff01ffffffe70cULL; if ((alignment + len) > 4) { @@ -921,7 +754,7 @@ static int apic_reg_read(struct kvm_lapic *apic, u32 offset, int len, static int apic_mmio_in_range(struct kvm_lapic *apic, gpa_t addr) { - return kvm_apic_hw_enabled(apic) && + return apic_hw_enabled(apic) && addr >= apic->base_address && addr < apic->base_address + LAPIC_MMIO_LENGTH; } @@ -944,7 +777,7 @@ static void update_divide_count(struct kvm_lapic *apic) { u32 tmp1, tmp2, tdcr; - tdcr = kvm_apic_get_reg(apic, APIC_TDCR); + tdcr = apic_get_reg(apic, APIC_TDCR); tmp1 = tdcr & 0xf; tmp2 = ((tmp1 & 0x3) | ((tmp1 & 0x8) >> 1)) + 1; apic->divide_count = 0x1 << (tmp2 & 0x7); @@ -959,9 +792,9 @@ static void start_apic_timer(struct kvm_lapic *apic) atomic_set(&apic->lapic_timer.pending, 0); if (apic_lvtt_period(apic) || apic_lvtt_oneshot(apic)) { - /* lapic timer in oneshot or periodic mode */ + /* lapic timer in oneshot or peroidic mode */ now = apic->lapic_timer.timer.base->get_time(); - apic->lapic_timer.period = (u64)kvm_apic_get_reg(apic, APIC_TMICT) + apic->lapic_timer.period = (u64)apic_get_reg(apic, APIC_TMICT) * APIC_BUS_CYCLE_NS * apic->divide_count; if (!apic->lapic_timer.period) @@ -993,7 +826,7 @@ static void start_apic_timer(struct kvm_lapic *apic) "timer initial count 0x%x, period %lldns, " "expire @ 0x%016" PRIx64 ".\n", __func__, APIC_BUS_CYCLE_NS, ktime_to_ns(now), - kvm_apic_get_reg(apic, APIC_TMICT), + apic_get_reg(apic, APIC_TMICT), apic->lapic_timer.period, ktime_to_ns(ktime_add_ns(now, apic->lapic_timer.period))); @@ -1025,7 +858,7 @@ static void start_apic_timer(struct kvm_lapic *apic) static void apic_manage_nmi_watchdog(struct kvm_lapic *apic, u32 lvt0_val) { - int nmi_wd_enabled = apic_lvt_nmi_mode(kvm_apic_get_reg(apic, APIC_LVT0)); + int nmi_wd_enabled = apic_lvt_nmi_mode(apic_get_reg(apic, APIC_LVT0)); if (apic_lvt_nmi_mode(lvt0_val)) { if (!nmi_wd_enabled) { @@ -1046,7 +879,7 @@ static int apic_reg_write(struct kvm_lapic *apic, u32 reg, u32 val) switch (reg) { case APIC_ID: /* Local APIC ID */ if (!apic_x2apic_mode(apic)) - kvm_apic_set_id(apic, val >> 24); + apic_set_reg(apic, APIC_ID, val); else ret = 1; break; @@ -1062,30 +895,29 @@ static int apic_reg_write(struct kvm_lapic *apic, u32 reg, u32 val) case APIC_LDR: if (!apic_x2apic_mode(apic)) - kvm_apic_set_ldr(apic, val & APIC_LDR_MASK); + apic_set_reg(apic, APIC_LDR, val & APIC_LDR_MASK); else ret = 1; break; case APIC_DFR: - if (!apic_x2apic_mode(apic)) { + if (!apic_x2apic_mode(apic)) apic_set_reg(apic, APIC_DFR, val | 0x0FFFFFFF); - recalculate_apic_map(apic->vcpu->kvm); - } else + else ret = 1; break; case APIC_SPIV: { u32 mask = 0x3ff; - if (kvm_apic_get_reg(apic, APIC_LVR) & APIC_LVR_DIRECTED_EOI) + if (apic_get_reg(apic, APIC_LVR) & APIC_LVR_DIRECTED_EOI) mask |= APIC_SPIV_DIRECTED_EOI; - apic_set_spiv(apic, val & mask); + apic_set_reg(apic, APIC_SPIV, val & mask); if (!(val & APIC_SPIV_APIC_ENABLED)) { int i; u32 lvt_val; for (i = 0; i < APIC_LVT_NUM; i++) { - lvt_val = kvm_apic_get_reg(apic, + lvt_val = apic_get_reg(apic, APIC_LVTT + 0x10 * i); apic_set_reg(apic, APIC_LVTT + 0x10 * i, lvt_val | APIC_LVT_MASKED); @@ -1114,7 +946,7 @@ static int apic_reg_write(struct kvm_lapic *apic, u32 reg, u32 val) case APIC_LVT1: case APIC_LVTERR: /* TODO: Check vector */ - if (!kvm_apic_sw_enabled(apic)) + if (!apic_sw_enabled(apic)) val |= APIC_LVT_MASKED; val &= apic_lvt_mask[(reg - APIC_LVTT) >> 4]; @@ -1123,12 +955,12 @@ static int apic_reg_write(struct kvm_lapic *apic, u32 reg, u32 val) break; case APIC_LVTT: - if ((kvm_apic_get_reg(apic, APIC_LVTT) & + if ((apic_get_reg(apic, APIC_LVTT) & apic->lapic_timer.timer_mode_mask) != (val & apic->lapic_timer.timer_mode_mask)) hrtimer_cancel(&apic->lapic_timer.timer); - if (!kvm_apic_sw_enabled(apic)) + if (!apic_sw_enabled(apic)) val |= APIC_LVT_MASKED; val &= (apic_lvt_mask[0] | apic->lapic_timer.timer_mode_mask); apic_set_reg(apic, APIC_LVTT, val); @@ -1207,30 +1039,24 @@ static int apic_mmio_write(struct kvm_io_device *this, void kvm_lapic_set_eoi(struct kvm_vcpu *vcpu) { - if (kvm_vcpu_has_lapic(vcpu)) + struct kvm_lapic *apic = vcpu->arch.apic; + + if (apic) apic_reg_write(vcpu->arch.apic, APIC_EOI, 0); } EXPORT_SYMBOL_GPL(kvm_lapic_set_eoi); void kvm_free_lapic(struct kvm_vcpu *vcpu) { - struct kvm_lapic *apic = vcpu->arch.apic; - if (!vcpu->arch.apic) return; - hrtimer_cancel(&apic->lapic_timer.timer); - - if (!(vcpu->arch.apic_base & MSR_IA32_APICBASE_ENABLE)) - static_key_slow_dec_deferred(&apic_hw_disabled); - - if (!(kvm_apic_get_reg(apic, APIC_SPIV) & APIC_SPIV_APIC_ENABLED)) - static_key_slow_dec_deferred(&apic_sw_disabled); + hrtimer_cancel(&vcpu->arch.apic->lapic_timer.timer); - if (apic->regs) - free_page((unsigned long)apic->regs); + if (vcpu->arch.apic->regs) + free_page((unsigned long)vcpu->arch.apic->regs); - kfree(apic); + kfree(vcpu->arch.apic); } /* @@ -1242,9 +1068,10 @@ void kvm_free_lapic(struct kvm_vcpu *vcpu) u64 kvm_get_lapic_tscdeadline_msr(struct kvm_vcpu *vcpu) { struct kvm_lapic *apic = vcpu->arch.apic; + if (!apic) + return 0; - if (!kvm_vcpu_has_lapic(vcpu) || apic_lvtt_oneshot(apic) || - apic_lvtt_period(apic)) + if (apic_lvtt_oneshot(apic) || apic_lvtt_period(apic)) return 0; return apic->lapic_timer.tscdeadline; @@ -1253,9 +1080,10 @@ u64 kvm_get_lapic_tscdeadline_msr(struct kvm_vcpu *vcpu) void kvm_set_lapic_tscdeadline_msr(struct kvm_vcpu *vcpu, u64 data) { struct kvm_lapic *apic = vcpu->arch.apic; + if (!apic) + return; - if (!kvm_vcpu_has_lapic(vcpu) || apic_lvtt_oneshot(apic) || - apic_lvtt_period(apic)) + if (apic_lvtt_oneshot(apic) || apic_lvtt_period(apic)) return; hrtimer_cancel(&apic->lapic_timer.timer); @@ -1267,21 +1095,20 @@ void kvm_lapic_set_tpr(struct kvm_vcpu *vcpu, unsigned long cr8) { struct kvm_lapic *apic = vcpu->arch.apic; - if (!kvm_vcpu_has_lapic(vcpu)) + if (!apic) return; - apic_set_tpr(apic, ((cr8 & 0x0f) << 4) - | (kvm_apic_get_reg(apic, APIC_TASKPRI) & 4)); + | (apic_get_reg(apic, APIC_TASKPRI) & 4)); } u64 kvm_lapic_get_cr8(struct kvm_vcpu *vcpu) { + struct kvm_lapic *apic = vcpu->arch.apic; u64 tpr; - if (!kvm_vcpu_has_lapic(vcpu)) + if (!apic) return 0; - - tpr = (u64) kvm_apic_get_reg(vcpu->arch.apic, APIC_TASKPRI); + tpr = (u64) apic_get_reg(apic, APIC_TASKPRI); return (tpr & 0xf0) >> 4; } @@ -1296,15 +1123,6 @@ void kvm_lapic_set_base(struct kvm_vcpu *vcpu, u64 value) return; } - /* update jump label if enable bit changes */ - if ((vcpu->arch.apic_base ^ value) & MSR_IA32_APICBASE_ENABLE) { - if (value & MSR_IA32_APICBASE_ENABLE) - static_key_slow_dec_deferred(&apic_hw_disabled); - else - static_key_slow_inc(&apic_hw_disabled.key); - recalculate_apic_map(vcpu->kvm); - } - if (!kvm_vcpu_is_bsp(apic->vcpu)) value &= ~MSR_IA32_APICBASE_BSP; @@ -1312,7 +1130,7 @@ void kvm_lapic_set_base(struct kvm_vcpu *vcpu, u64 value) if (apic_x2apic_mode(apic)) { u32 id = kvm_apic_id(apic); u32 ldr = ((id & ~0xf) << 16) | (1 << (id & 0xf)); - kvm_apic_set_ldr(apic, ldr); + apic_set_reg(apic, APIC_LDR, ldr); } apic->base_address = apic->vcpu->arch.apic_base & MSR_IA32_APICBASE_BASE; @@ -1337,7 +1155,7 @@ void kvm_lapic_reset(struct kvm_vcpu *vcpu) /* Stop the timer in case it's a reset to an active apic */ hrtimer_cancel(&apic->lapic_timer.timer); - kvm_apic_set_id(apic, vcpu->vcpu_id); + apic_set_reg(apic, APIC_ID, vcpu->vcpu_id << 24); kvm_apic_set_version(apic->vcpu); for (i = 0; i < APIC_LVT_NUM; i++) @@ -1346,9 +1164,9 @@ void kvm_lapic_reset(struct kvm_vcpu *vcpu) SET_APIC_DELIVERY_MODE(0, APIC_MODE_EXTINT)); apic_set_reg(apic, APIC_DFR, 0xffffffffU); - apic_set_spiv(apic, 0xff); + apic_set_reg(apic, APIC_SPIV, 0xff); apic_set_reg(apic, APIC_TASKPRI, 0); - kvm_apic_set_ldr(apic, 0); + apic_set_reg(apic, APIC_LDR, 0); apic_set_reg(apic, APIC_ESR, 0); apic_set_reg(apic, APIC_ICR, 0); apic_set_reg(apic, APIC_ICR2, 0); @@ -1365,8 +1183,7 @@ void kvm_lapic_reset(struct kvm_vcpu *vcpu) update_divide_count(apic); atomic_set(&apic->lapic_timer.pending, 0); if (kvm_vcpu_is_bsp(vcpu)) - kvm_lapic_set_base(vcpu, - vcpu->arch.apic_base | MSR_IA32_APICBASE_BSP); + vcpu->arch.apic_base |= MSR_IA32_APICBASE_BSP; vcpu->arch.pv_eoi.msr_val = 0; apic_update_ppr(apic); @@ -1379,34 +1196,45 @@ void kvm_lapic_reset(struct kvm_vcpu *vcpu) vcpu->arch.apic_base, apic->base_address); } +bool kvm_apic_present(struct kvm_vcpu *vcpu) +{ + return vcpu->arch.apic && apic_hw_enabled(vcpu->arch.apic); +} + +int kvm_lapic_enabled(struct kvm_vcpu *vcpu) +{ + return kvm_apic_present(vcpu) && apic_sw_enabled(vcpu->arch.apic); +} + /* *---------------------------------------------------------------------- * timer interface *---------------------------------------------------------------------- */ -static bool lapic_is_periodic(struct kvm_lapic *apic) +static bool lapic_is_periodic(struct kvm_timer *ktimer) { + struct kvm_lapic *apic = container_of(ktimer, struct kvm_lapic, + lapic_timer); return apic_lvtt_period(apic); } int apic_has_pending_timer(struct kvm_vcpu *vcpu) { - struct kvm_lapic *apic = vcpu->arch.apic; + struct kvm_lapic *lapic = vcpu->arch.apic; - if (kvm_vcpu_has_lapic(vcpu) && apic_enabled(apic) && - apic_lvt_enabled(apic, APIC_LVTT)) - return atomic_read(&apic->lapic_timer.pending); + if (lapic && apic_enabled(lapic) && apic_lvt_enabled(lapic, APIC_LVTT)) + return atomic_read(&lapic->lapic_timer.pending); return 0; } int kvm_apic_local_deliver(struct kvm_lapic *apic, int lvt_type) { - u32 reg = kvm_apic_get_reg(apic, lvt_type); + u32 reg = apic_get_reg(apic, lvt_type); int vector, mode, trig_mode; - if (kvm_apic_hw_enabled(apic) && !(reg & APIC_LVT_MASKED)) { + if (apic_hw_enabled(apic) && !(reg & APIC_LVT_MASKED)) { vector = reg & APIC_VECTOR_MASK; mode = reg & APIC_MODE_MASK; trig_mode = reg & APIC_LVT_LEVEL_TRIGGER; @@ -1423,40 +1251,15 @@ void kvm_apic_nmi_wd_deliver(struct kvm_vcpu *vcpu) kvm_apic_local_deliver(apic, APIC_LVT0); } +static struct kvm_timer_ops lapic_timer_ops = { + .is_periodic = lapic_is_periodic, +}; + static const struct kvm_io_device_ops apic_mmio_ops = { .read = apic_mmio_read, .write = apic_mmio_write, }; -static enum hrtimer_restart apic_timer_fn(struct hrtimer *data) -{ - struct kvm_timer *ktimer = container_of(data, struct kvm_timer, timer); - struct kvm_lapic *apic = container_of(ktimer, struct kvm_lapic, lapic_timer); - struct kvm_vcpu *vcpu = apic->vcpu; - wait_queue_head_t *q = &vcpu->wq; - - /* - * There is a race window between reading and incrementing, but we do - * not care about potentially losing timer events in the !reinject - * case anyway. Note: KVM_REQ_PENDING_TIMER is implicitly checked - * in vcpu_enter_guest. - */ - if (!atomic_read(&ktimer->pending)) { - atomic_inc(&ktimer->pending); - /* FIXME: this code should not know anything about vcpus */ - kvm_make_request(KVM_REQ_PENDING_TIMER, vcpu); - } - - if (waitqueue_active(q)) - wake_up_interruptible(q); - - if (lapic_is_periodic(apic)) { - hrtimer_add_expires_ns(&ktimer->timer, ktimer->period); - return HRTIMER_RESTART; - } else - return HRTIMER_NORESTART; -} - int kvm_create_lapic(struct kvm_vcpu *vcpu) { struct kvm_lapic *apic; @@ -1480,17 +1283,14 @@ int kvm_create_lapic(struct kvm_vcpu *vcpu) hrtimer_init(&apic->lapic_timer.timer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS); - apic->lapic_timer.timer.function = apic_timer_fn; + apic->lapic_timer.timer.function = kvm_timer_fn; + apic->lapic_timer.t_ops = &lapic_timer_ops; + apic->lapic_timer.kvm = vcpu->kvm; + apic->lapic_timer.vcpu = vcpu; - /* - * APIC is created enabled. This will prevent kvm_lapic_set_base from - * thinking that APIC satet has changed. - */ - vcpu->arch.apic_base = MSR_IA32_APICBASE_ENABLE; - kvm_lapic_set_base(vcpu, - APIC_DEFAULT_PHYS_BASE | MSR_IA32_APICBASE_ENABLE); + apic->base_address = APIC_DEFAULT_PHYS_BASE; + vcpu->arch.apic_base = APIC_DEFAULT_PHYS_BASE; - static_key_slow_inc(&apic_sw_disabled.key); /* sw disabled at reset */ kvm_lapic_reset(vcpu); kvm_iodevice_init(&apic->dev, &apic_mmio_ops); @@ -1506,23 +1306,23 @@ int kvm_apic_has_interrupt(struct kvm_vcpu *vcpu) struct kvm_lapic *apic = vcpu->arch.apic; int highest_irr; - if (!kvm_vcpu_has_lapic(vcpu) || !apic_enabled(apic)) + if (!apic || !apic_enabled(apic)) return -1; apic_update_ppr(apic); highest_irr = apic_find_highest_irr(apic); if ((highest_irr == -1) || - ((highest_irr & 0xF0) <= kvm_apic_get_reg(apic, APIC_PROCPRI))) + ((highest_irr & 0xF0) <= apic_get_reg(apic, APIC_PROCPRI))) return -1; return highest_irr; } int kvm_apic_accept_pic_intr(struct kvm_vcpu *vcpu) { - u32 lvt0 = kvm_apic_get_reg(vcpu->arch.apic, APIC_LVT0); + u32 lvt0 = apic_get_reg(vcpu->arch.apic, APIC_LVT0); int r = 0; - if (!kvm_apic_hw_enabled(vcpu->arch.apic)) + if (!apic_hw_enabled(vcpu->arch.apic)) r = 1; if ((lvt0 & APIC_LVT_MASKED) == 0 && GET_APIC_DELIVERY_MODE(lvt0) == APIC_MODE_EXTINT) @@ -1534,10 +1334,7 @@ void kvm_inject_apic_timer_irqs(struct kvm_vcpu *vcpu) { struct kvm_lapic *apic = vcpu->arch.apic; - if (!kvm_vcpu_has_lapic(vcpu)) - return; - - if (atomic_read(&apic->lapic_timer.pending) > 0) { + if (apic && atomic_read(&apic->lapic_timer.pending) > 0) { if (kvm_apic_local_deliver(apic, APIC_LVTT)) atomic_dec(&apic->lapic_timer.pending); } @@ -1557,17 +1354,12 @@ int kvm_get_apic_interrupt(struct kvm_vcpu *vcpu) return vector; } -void kvm_apic_post_state_restore(struct kvm_vcpu *vcpu, - struct kvm_lapic_state *s) +void kvm_apic_post_state_restore(struct kvm_vcpu *vcpu) { struct kvm_lapic *apic = vcpu->arch.apic; - kvm_lapic_set_base(vcpu, vcpu->arch.apic_base); - /* set SPIV separately to get count of SW disabled APICs right */ - apic_set_spiv(apic, *((u32 *)(s->regs + APIC_SPIV))); - memcpy(vcpu->arch.apic->regs, s->regs, sizeof *s); - /* call kvm_apic_set_id() to put apic into apic_map */ - kvm_apic_set_id(apic, kvm_apic_id(apic)); + apic->base_address = vcpu->arch.apic_base & + MSR_IA32_APICBASE_BASE; kvm_apic_set_version(vcpu); apic_update_ppr(apic); @@ -1582,12 +1374,13 @@ void kvm_apic_post_state_restore(struct kvm_vcpu *vcpu, void __kvm_migrate_apic_timer(struct kvm_vcpu *vcpu) { + struct kvm_lapic *apic = vcpu->arch.apic; struct hrtimer *timer; - if (!kvm_vcpu_has_lapic(vcpu)) + if (!apic) return; - timer = &vcpu->arch.apic->lapic_timer.timer; + timer = &apic->lapic_timer.timer; if (hrtimer_cancel(timer)) hrtimer_start_expires(timer, HRTIMER_MODE_ABS); } @@ -1685,7 +1478,7 @@ void kvm_lapic_sync_to_vapic(struct kvm_vcpu *vcpu) if (!test_bit(KVM_APIC_CHECK_VAPIC, &vcpu->arch.apic_attention)) return; - tpr = kvm_apic_get_reg(apic, APIC_TASKPRI) & 0xff; + tpr = apic_get_reg(apic, APIC_TASKPRI) & 0xff; max_irr = apic_find_highest_irr(apic); if (max_irr < 0) max_irr = 0; @@ -1744,7 +1537,7 @@ int kvm_hv_vapic_msr_write(struct kvm_vcpu *vcpu, u32 reg, u64 data) { struct kvm_lapic *apic = vcpu->arch.apic; - if (!kvm_vcpu_has_lapic(vcpu)) + if (!irqchip_in_kernel(vcpu->kvm)) return 1; /* if this is ICR write vector before command */ @@ -1758,7 +1551,7 @@ int kvm_hv_vapic_msr_read(struct kvm_vcpu *vcpu, u32 reg, u64 *data) struct kvm_lapic *apic = vcpu->arch.apic; u32 low, high = 0; - if (!kvm_vcpu_has_lapic(vcpu)) + if (!irqchip_in_kernel(vcpu->kvm)) return 1; if (apic_reg_read(apic, reg, 4, &low)) @@ -1783,10 +1576,3 @@ int kvm_lapic_enable_pv_eoi(struct kvm_vcpu *vcpu, u64 data) return kvm_gfn_to_hva_cache_init(vcpu->kvm, &vcpu->arch.pv_eoi.data, addr); } - -void kvm_lapic_init(void) -{ - /* do not patch jump label more than once per second */ - jump_label_rate_limit(&apic_hw_disabled, HZ); - jump_label_rate_limit(&apic_sw_disabled, HZ); -} diff --git a/trunk/arch/x86/kvm/lapic.h b/trunk/arch/x86/kvm/lapic.h index e5ebf9f3571f..4af5405ae1e2 100644 --- a/trunk/arch/x86/kvm/lapic.h +++ b/trunk/arch/x86/kvm/lapic.h @@ -2,17 +2,10 @@ #define __KVM_X86_LAPIC_H #include "iodev.h" +#include "kvm_timer.h" #include -struct kvm_timer { - struct hrtimer timer; - s64 period; /* unit: ns */ - u32 timer_mode_mask; - u64 tscdeadline; - atomic_t pending; /* accumulated triggered timers */ -}; - struct kvm_lapic { unsigned long base_address; struct kvm_io_device dev; @@ -52,13 +45,11 @@ int kvm_apic_match_logical_addr(struct kvm_lapic *apic, u8 mda); int kvm_apic_set_irq(struct kvm_vcpu *vcpu, struct kvm_lapic_irq *irq); int kvm_apic_local_deliver(struct kvm_lapic *apic, int lvt_type); -bool kvm_irq_delivery_to_apic_fast(struct kvm *kvm, struct kvm_lapic *src, - struct kvm_lapic_irq *irq, int *r); - u64 kvm_get_apic_base(struct kvm_vcpu *vcpu); void kvm_set_apic_base(struct kvm_vcpu *vcpu, u64 data); -void kvm_apic_post_state_restore(struct kvm_vcpu *vcpu, - struct kvm_lapic_state *s); +void kvm_apic_post_state_restore(struct kvm_vcpu *vcpu); +int kvm_lapic_enabled(struct kvm_vcpu *vcpu); +bool kvm_apic_present(struct kvm_vcpu *vcpu); int kvm_lapic_find_highest_irr(struct kvm_vcpu *vcpu); u64 kvm_get_lapic_tscdeadline_msr(struct kvm_vcpu *vcpu); @@ -80,48 +71,4 @@ static inline bool kvm_hv_vapic_assist_page_enabled(struct kvm_vcpu *vcpu) } int kvm_lapic_enable_pv_eoi(struct kvm_vcpu *vcpu, u64 data); -void kvm_lapic_init(void); - -static inline u32 kvm_apic_get_reg(struct kvm_lapic *apic, int reg_off) -{ - return *((u32 *) (apic->regs + reg_off)); -} - -extern struct static_key kvm_no_apic_vcpu; - -static inline bool kvm_vcpu_has_lapic(struct kvm_vcpu *vcpu) -{ - if (static_key_false(&kvm_no_apic_vcpu)) - return vcpu->arch.apic; - return true; -} - -extern struct static_key_deferred apic_hw_disabled; - -static inline int kvm_apic_hw_enabled(struct kvm_lapic *apic) -{ - if (static_key_false(&apic_hw_disabled.key)) - return apic->vcpu->arch.apic_base & MSR_IA32_APICBASE_ENABLE; - return MSR_IA32_APICBASE_ENABLE; -} - -extern struct static_key_deferred apic_sw_disabled; - -static inline int kvm_apic_sw_enabled(struct kvm_lapic *apic) -{ - if (static_key_false(&apic_sw_disabled.key)) - return kvm_apic_get_reg(apic, APIC_SPIV) & APIC_SPIV_APIC_ENABLED; - return APIC_SPIV_APIC_ENABLED; -} - -static inline bool kvm_apic_present(struct kvm_vcpu *vcpu) -{ - return kvm_vcpu_has_lapic(vcpu) && kvm_apic_hw_enabled(vcpu->arch.apic); -} - -static inline int kvm_lapic_enabled(struct kvm_vcpu *vcpu) -{ - return kvm_apic_present(vcpu) && kvm_apic_sw_enabled(vcpu->arch.apic); -} - #endif diff --git a/trunk/arch/x86/kvm/mmu.c b/trunk/arch/x86/kvm/mmu.c index d289fee1ffb8..7fbd0d273ea8 100644 --- a/trunk/arch/x86/kvm/mmu.c +++ b/trunk/arch/x86/kvm/mmu.c @@ -556,14 +556,6 @@ static int mmu_spte_clear_track_bits(u64 *sptep) return 0; pfn = spte_to_pfn(old_spte); - - /* - * KVM does not hold the refcount of the page used by - * kvm mmu, before reclaiming the page, we should - * unmap it from mmu first. - */ - WARN_ON(!kvm_is_mmio_pfn(pfn) && !page_count(pfn_to_page(pfn))); - if (!shadow_accessed_mask || old_spte & shadow_accessed_mask) kvm_set_pfn_accessed(pfn); if (!shadow_dirty_mask || (old_spte & shadow_dirty_mask)) @@ -968,10 +960,13 @@ static void pte_list_walk(unsigned long *pte_list, pte_list_walk_fn fn) static unsigned long *__gfn_to_rmap(gfn_t gfn, int level, struct kvm_memory_slot *slot) { - unsigned long idx; + struct kvm_lpage_info *linfo; - idx = gfn_to_index(gfn, slot->base_gfn, level); - return &slot->arch.rmap[level - PT_PAGE_TABLE_LEVEL][idx]; + if (likely(level == PT_PAGE_TABLE_LEVEL)) + return &slot->rmap[gfn - slot->base_gfn]; + + linfo = lpage_info_slot(gfn, slot, level); + return &linfo->rmap_pde; } /* @@ -1178,8 +1173,7 @@ void kvm_mmu_write_protect_pt_masked(struct kvm *kvm, unsigned long *rmapp; while (mask) { - rmapp = __gfn_to_rmap(slot->base_gfn + gfn_offset + __ffs(mask), - PT_PAGE_TABLE_LEVEL, slot); + rmapp = &slot->rmap[gfn_offset + __ffs(mask)]; __rmap_write_protect(kvm, rmapp, PT_PAGE_TABLE_LEVEL, false); /* clear the first set bit */ @@ -1206,7 +1200,7 @@ static bool rmap_write_protect(struct kvm *kvm, u64 gfn) } static int kvm_unmap_rmapp(struct kvm *kvm, unsigned long *rmapp, - struct kvm_memory_slot *slot, unsigned long data) + unsigned long data) { u64 *sptep; struct rmap_iterator iter; @@ -1224,7 +1218,7 @@ static int kvm_unmap_rmapp(struct kvm *kvm, unsigned long *rmapp, } static int kvm_set_pte_rmapp(struct kvm *kvm, unsigned long *rmapp, - struct kvm_memory_slot *slot, unsigned long data) + unsigned long data) { u64 *sptep; struct rmap_iterator iter; @@ -1265,67 +1259,43 @@ static int kvm_set_pte_rmapp(struct kvm *kvm, unsigned long *rmapp, return 0; } -static int kvm_handle_hva_range(struct kvm *kvm, - unsigned long start, - unsigned long end, - unsigned long data, - int (*handler)(struct kvm *kvm, - unsigned long *rmapp, - struct kvm_memory_slot *slot, - unsigned long data)) +static int kvm_handle_hva(struct kvm *kvm, unsigned long hva, + unsigned long data, + int (*handler)(struct kvm *kvm, unsigned long *rmapp, + unsigned long data)) { int j; - int ret = 0; + int ret; + int retval = 0; struct kvm_memslots *slots; struct kvm_memory_slot *memslot; slots = kvm_memslots(kvm); kvm_for_each_memslot(memslot, slots) { - unsigned long hva_start, hva_end; - gfn_t gfn_start, gfn_end; + unsigned long start = memslot->userspace_addr; + unsigned long end; - hva_start = max(start, memslot->userspace_addr); - hva_end = min(end, memslot->userspace_addr + - (memslot->npages << PAGE_SHIFT)); - if (hva_start >= hva_end) - continue; - /* - * {gfn(page) | page intersects with [hva_start, hva_end)} = - * {gfn_start, gfn_start+1, ..., gfn_end-1}. - */ - gfn_start = hva_to_gfn_memslot(hva_start, memslot); - gfn_end = hva_to_gfn_memslot(hva_end + PAGE_SIZE - 1, memslot); + end = start + (memslot->npages << PAGE_SHIFT); + if (hva >= start && hva < end) { + gfn_t gfn_offset = (hva - start) >> PAGE_SHIFT; + gfn_t gfn = memslot->base_gfn + gfn_offset; - for (j = PT_PAGE_TABLE_LEVEL; - j < PT_PAGE_TABLE_LEVEL + KVM_NR_PAGE_SIZES; ++j) { - unsigned long idx, idx_end; - unsigned long *rmapp; + ret = handler(kvm, &memslot->rmap[gfn_offset], data); - /* - * {idx(page_j) | page_j intersects with - * [hva_start, hva_end)} = {idx, idx+1, ..., idx_end}. - */ - idx = gfn_to_index(gfn_start, memslot->base_gfn, j); - idx_end = gfn_to_index(gfn_end - 1, memslot->base_gfn, j); + for (j = 0; j < KVM_NR_PAGE_SIZES - 1; ++j) { + struct kvm_lpage_info *linfo; - rmapp = __gfn_to_rmap(gfn_start, j, memslot); - - for (; idx <= idx_end; ++idx) - ret |= handler(kvm, rmapp++, memslot, data); + linfo = lpage_info_slot(gfn, memslot, + PT_DIRECTORY_LEVEL + j); + ret |= handler(kvm, &linfo->rmap_pde, data); + } + trace_kvm_age_page(hva, memslot, ret); + retval |= ret; } } - return ret; -} - -static int kvm_handle_hva(struct kvm *kvm, unsigned long hva, - unsigned long data, - int (*handler)(struct kvm *kvm, unsigned long *rmapp, - struct kvm_memory_slot *slot, - unsigned long data)) -{ - return kvm_handle_hva_range(kvm, hva, hva + 1, data, handler); + return retval; } int kvm_unmap_hva(struct kvm *kvm, unsigned long hva) @@ -1333,18 +1303,13 @@ int kvm_unmap_hva(struct kvm *kvm, unsigned long hva) return kvm_handle_hva(kvm, hva, 0, kvm_unmap_rmapp); } -int kvm_unmap_hva_range(struct kvm *kvm, unsigned long start, unsigned long end) -{ - return kvm_handle_hva_range(kvm, start, end, 0, kvm_unmap_rmapp); -} - void kvm_set_spte_hva(struct kvm *kvm, unsigned long hva, pte_t pte) { kvm_handle_hva(kvm, hva, (unsigned long)&pte, kvm_set_pte_rmapp); } static int kvm_age_rmapp(struct kvm *kvm, unsigned long *rmapp, - struct kvm_memory_slot *slot, unsigned long data) + unsigned long data) { u64 *sptep; struct rmap_iterator uninitialized_var(iter); @@ -1358,10 +1323,8 @@ static int kvm_age_rmapp(struct kvm *kvm, unsigned long *rmapp, * This has some overhead, but not as much as the cost of swapping * out actively used pages or breaking up actively used hugepages. */ - if (!shadow_accessed_mask) { - young = kvm_unmap_rmapp(kvm, rmapp, slot, data); - goto out; - } + if (!shadow_accessed_mask) + return kvm_unmap_rmapp(kvm, rmapp, data); for (sptep = rmap_get_first(*rmapp, &iter); sptep; sptep = rmap_get_next(&iter)) { @@ -1373,14 +1336,12 @@ static int kvm_age_rmapp(struct kvm *kvm, unsigned long *rmapp, (unsigned long *)sptep); } } -out: - /* @data has hva passed to kvm_age_hva(). */ - trace_kvm_age_page(data, slot, young); + return young; } static int kvm_test_age_rmapp(struct kvm *kvm, unsigned long *rmapp, - struct kvm_memory_slot *slot, unsigned long data) + unsigned long data) { u64 *sptep; struct rmap_iterator iter; @@ -1418,13 +1379,13 @@ static void rmap_recycle(struct kvm_vcpu *vcpu, u64 *spte, gfn_t gfn) rmapp = gfn_to_rmap(vcpu->kvm, gfn, sp->role.level); - kvm_unmap_rmapp(vcpu->kvm, rmapp, NULL, 0); + kvm_unmap_rmapp(vcpu->kvm, rmapp, 0); kvm_flush_remote_tlbs(vcpu->kvm); } int kvm_age_hva(struct kvm *kvm, unsigned long hva) { - return kvm_handle_hva(kvm, hva, hva, kvm_age_rmapp); + return kvm_handle_hva(kvm, hva, 0, kvm_age_rmapp); } int kvm_test_age_hva(struct kvm *kvm, unsigned long hva) @@ -2496,9 +2457,7 @@ static void mmu_set_spte(struct kvm_vcpu *vcpu, u64 *sptep, rmap_recycle(vcpu, sptep, gfn); } } - - if (!is_error_pfn(pfn)) - kvm_release_pfn_clean(pfn); + kvm_release_pfn_clean(pfn); } static void nonpaging_new_cr3(struct kvm_vcpu *vcpu) @@ -2510,12 +2469,17 @@ static pfn_t pte_prefetch_gfn_to_pfn(struct kvm_vcpu *vcpu, gfn_t gfn, bool no_dirty_log) { struct kvm_memory_slot *slot; + unsigned long hva; slot = gfn_to_memslot_dirty_bitmap(vcpu, gfn, no_dirty_log); - if (!slot) - return KVM_PFN_ERR_FAULT; + if (!slot) { + get_page(fault_page); + return page_to_pfn(fault_page); + } - return gfn_to_pfn_memslot_atomic(slot, gfn); + hva = gfn_to_hva_memslot(slot, gfn); + + return hva_to_pfn_atomic(vcpu->kvm, hva); } static int direct_pte_prefetch_many(struct kvm_vcpu *vcpu, @@ -2616,6 +2580,11 @@ static int __direct_map(struct kvm_vcpu *vcpu, gpa_t v, int write, sp = kvm_mmu_get_page(vcpu, pseudo_gfn, iterator.addr, iterator.level - 1, 1, ACC_ALL, iterator.sptep); + if (!sp) { + pgprintk("nonpaging_map: ENOMEM\n"); + kvm_release_pfn_clean(pfn); + return -ENOMEM; + } mmu_spte_set(iterator.sptep, __pa(sp->spt) @@ -2642,16 +2611,8 @@ static void kvm_send_hwpoison_signal(unsigned long address, struct task_struct * static int kvm_handle_bad_page(struct kvm_vcpu *vcpu, gfn_t gfn, pfn_t pfn) { - /* - * Do not cache the mmio info caused by writing the readonly gfn - * into the spte otherwise read access on readonly gfn also can - * caused mmio page fault and treat it as mmio access. - * Return 1 to tell kvm to emulate it. - */ - if (pfn == KVM_PFN_ERR_RO_FAULT) - return 1; - - if (pfn == KVM_PFN_ERR_HWPOISON) { + kvm_release_pfn_clean(pfn); + if (is_hwpoison_pfn(pfn)) { kvm_send_hwpoison_signal(gfn_to_hva(vcpu->kvm, gfn), current); return 0; } @@ -3275,6 +3236,8 @@ static bool try_async_pf(struct kvm_vcpu *vcpu, bool prefault, gfn_t gfn, if (!async) return false; /* *pfn has correct page already */ + put_page(pfn_to_page(*pfn)); + if (!prefault && can_do_async_pf(vcpu)) { trace_kvm_try_async_get_page(gva, gfn); if (kvm_find_async_pf_gfn(vcpu, gfn)) { @@ -3408,18 +3371,6 @@ static bool is_rsvd_bits_set(struct kvm_mmu *mmu, u64 gpte, int level) return (gpte & mmu->rsvd_bits_mask[bit7][level-1]) != 0; } -static inline void protect_clean_gpte(unsigned *access, unsigned gpte) -{ - unsigned mask; - - BUILD_BUG_ON(PT_WRITABLE_MASK != ACC_WRITE_MASK); - - mask = (unsigned)~ACC_WRITE_MASK; - /* Allow write access to dirty gptes */ - mask |= (gpte >> (PT_DIRTY_SHIFT - PT_WRITABLE_SHIFT)) & PT_WRITABLE_MASK; - *access &= mask; -} - static bool sync_mmio_spte(u64 *sptep, gfn_t gfn, unsigned access, int *nr_present) { @@ -3437,25 +3388,6 @@ static bool sync_mmio_spte(u64 *sptep, gfn_t gfn, unsigned access, return false; } -static inline unsigned gpte_access(struct kvm_vcpu *vcpu, u64 gpte) -{ - unsigned access; - - access = (gpte & (PT_WRITABLE_MASK | PT_USER_MASK)) | ACC_EXEC_MASK; - access &= ~(gpte >> PT64_NX_SHIFT); - - return access; -} - -static inline bool is_last_gpte(struct kvm_mmu *mmu, unsigned level, unsigned gpte) -{ - unsigned index; - - index = level - 1; - index |= (gpte & PT_PAGE_SIZE_MASK) >> (PT_PAGE_SIZE_SHIFT - 2); - return mmu->last_pte_bitmap & (1 << index); -} - #define PTTYPE 64 #include "paging_tmpl.h" #undef PTTYPE @@ -3525,56 +3457,6 @@ static void reset_rsvds_bits_mask(struct kvm_vcpu *vcpu, } } -static void update_permission_bitmask(struct kvm_vcpu *vcpu, struct kvm_mmu *mmu) -{ - unsigned bit, byte, pfec; - u8 map; - bool fault, x, w, u, wf, uf, ff, smep; - - smep = kvm_read_cr4_bits(vcpu, X86_CR4_SMEP); - for (byte = 0; byte < ARRAY_SIZE(mmu->permissions); ++byte) { - pfec = byte << 1; - map = 0; - wf = pfec & PFERR_WRITE_MASK; - uf = pfec & PFERR_USER_MASK; - ff = pfec & PFERR_FETCH_MASK; - for (bit = 0; bit < 8; ++bit) { - x = bit & ACC_EXEC_MASK; - w = bit & ACC_WRITE_MASK; - u = bit & ACC_USER_MASK; - - /* Not really needed: !nx will cause pte.nx to fault */ - x |= !mmu->nx; - /* Allow supervisor writes if !cr0.wp */ - w |= !is_write_protection(vcpu) && !uf; - /* Disallow supervisor fetches of user code if cr4.smep */ - x &= !(smep && u && !uf); - - fault = (ff && !x) || (uf && !u) || (wf && !w); - map |= fault << bit; - } - mmu->permissions[byte] = map; - } -} - -static void update_last_pte_bitmap(struct kvm_vcpu *vcpu, struct kvm_mmu *mmu) -{ - u8 map; - unsigned level, root_level = mmu->root_level; - const unsigned ps_set_index = 1 << 2; /* bit 2 of index: ps */ - - if (root_level == PT32E_ROOT_LEVEL) - --root_level; - /* PT_PAGE_TABLE_LEVEL always terminates */ - map = 1 | (1 << ps_set_index); - for (level = PT_DIRECTORY_LEVEL; level <= root_level; ++level) { - if (level <= PT_PDPE_LEVEL - && (mmu->root_level >= PT32E_ROOT_LEVEL || is_pse(vcpu))) - map |= 1 << (ps_set_index | (level - 1)); - } - mmu->last_pte_bitmap = map; -} - static int paging64_init_context_common(struct kvm_vcpu *vcpu, struct kvm_mmu *context, int level) @@ -3583,8 +3465,6 @@ static int paging64_init_context_common(struct kvm_vcpu *vcpu, context->root_level = level; reset_rsvds_bits_mask(vcpu, context); - update_permission_bitmask(vcpu, context); - update_last_pte_bitmap(vcpu, context); ASSERT(is_pae(vcpu)); context->new_cr3 = paging_new_cr3; @@ -3613,8 +3493,6 @@ static int paging32_init_context(struct kvm_vcpu *vcpu, context->root_level = PT32_ROOT_LEVEL; reset_rsvds_bits_mask(vcpu, context); - update_permission_bitmask(vcpu, context); - update_last_pte_bitmap(vcpu, context); context->new_cr3 = paging_new_cr3; context->page_fault = paging32_page_fault; @@ -3675,9 +3553,6 @@ static int init_kvm_tdp_mmu(struct kvm_vcpu *vcpu) context->gva_to_gpa = paging32_gva_to_gpa; } - update_permission_bitmask(vcpu, context); - update_last_pte_bitmap(vcpu, context); - return 0; } @@ -3753,9 +3628,6 @@ static int init_kvm_nested_mmu(struct kvm_vcpu *vcpu) g_context->gva_to_gpa = paging32_gva_to_gpa_nested; } - update_permission_bitmask(vcpu, g_context); - update_last_pte_bitmap(vcpu, g_context); - return 0; } diff --git a/trunk/arch/x86/kvm/mmu.h b/trunk/arch/x86/kvm/mmu.h index 69871080e866..e374db9af021 100644 --- a/trunk/arch/x86/kvm/mmu.h +++ b/trunk/arch/x86/kvm/mmu.h @@ -18,10 +18,8 @@ #define PT_PCD_MASK (1ULL << 4) #define PT_ACCESSED_SHIFT 5 #define PT_ACCESSED_MASK (1ULL << PT_ACCESSED_SHIFT) -#define PT_DIRTY_SHIFT 6 -#define PT_DIRTY_MASK (1ULL << PT_DIRTY_SHIFT) -#define PT_PAGE_SIZE_SHIFT 7 -#define PT_PAGE_SIZE_MASK (1ULL << PT_PAGE_SIZE_SHIFT) +#define PT_DIRTY_MASK (1ULL << 6) +#define PT_PAGE_SIZE_MASK (1ULL << 7) #define PT_PAT_MASK (1ULL << 7) #define PT_GLOBAL_MASK (1ULL << 8) #define PT64_NX_SHIFT 63 @@ -90,14 +88,17 @@ static inline bool is_write_protection(struct kvm_vcpu *vcpu) return kvm_read_cr0_bits(vcpu, X86_CR0_WP); } -/* - * Will a fault with a given page-fault error code (pfec) cause a permission - * fault with the given access (in ACC_* format)? - */ -static inline bool permission_fault(struct kvm_mmu *mmu, unsigned pte_access, - unsigned pfec) +static inline bool check_write_user_access(struct kvm_vcpu *vcpu, + bool write_fault, bool user_fault, + unsigned long pte) { - return (mmu->permissions[pfec >> 1] >> pte_access) & 1; -} + if (unlikely(write_fault && !is_writable_pte(pte) + && (user_fault || is_write_protection(vcpu)))) + return false; + + if (unlikely(user_fault && !(pte & PT_USER_MASK))) + return false; + return true; +} #endif diff --git a/trunk/arch/x86/kvm/mmu_audit.c b/trunk/arch/x86/kvm/mmu_audit.c index daff69e21150..7d7d0b9e23eb 100644 --- a/trunk/arch/x86/kvm/mmu_audit.c +++ b/trunk/arch/x86/kvm/mmu_audit.c @@ -116,8 +116,10 @@ static void audit_mappings(struct kvm_vcpu *vcpu, u64 *sptep, int level) gfn = kvm_mmu_page_get_gfn(sp, sptep - sp->spt); pfn = gfn_to_pfn_atomic(vcpu->kvm, gfn); - if (is_error_pfn(pfn)) + if (is_error_pfn(pfn)) { + kvm_release_pfn_clean(pfn); return; + } hpa = pfn << PAGE_SHIFT; if ((*sptep & PT64_BASE_ADDR_MASK) != hpa) @@ -188,6 +190,7 @@ static void check_mappings_rmap(struct kvm *kvm, struct kvm_mmu_page *sp) static void audit_write_protection(struct kvm *kvm, struct kvm_mmu_page *sp) { + struct kvm_memory_slot *slot; unsigned long *rmapp; u64 *sptep; struct rmap_iterator iter; @@ -195,7 +198,8 @@ static void audit_write_protection(struct kvm *kvm, struct kvm_mmu_page *sp) if (sp->role.direct || sp->unsync || sp->role.invalid) return; - rmapp = gfn_to_rmap(kvm, sp->gfn, PT_PAGE_TABLE_LEVEL); + slot = gfn_to_memslot(kvm, sp->gfn); + rmapp = &slot->rmap[sp->gfn - slot->base_gfn]; for (sptep = rmap_get_first(*rmapp, &iter); sptep; sptep = rmap_get_next(&iter)) { diff --git a/trunk/arch/x86/kvm/paging_tmpl.h b/trunk/arch/x86/kvm/paging_tmpl.h index 714e2c01a6fe..bb7cf01cae76 100644 --- a/trunk/arch/x86/kvm/paging_tmpl.h +++ b/trunk/arch/x86/kvm/paging_tmpl.h @@ -63,12 +63,10 @@ */ struct guest_walker { int level; - unsigned max_level; gfn_t table_gfn[PT_MAX_FULL_LEVELS]; pt_element_t ptes[PT_MAX_FULL_LEVELS]; pt_element_t prefetch_ptes[PTE_PREFETCH_NUM]; gpa_t pte_gpa[PT_MAX_FULL_LEVELS]; - pt_element_t __user *ptep_user[PT_MAX_FULL_LEVELS]; unsigned pt_access; unsigned pte_access; gfn_t gfn; @@ -103,41 +101,38 @@ static int FNAME(cmpxchg_gpte)(struct kvm_vcpu *vcpu, struct kvm_mmu *mmu, return (ret != orig_pte); } -static int FNAME(update_accessed_dirty_bits)(struct kvm_vcpu *vcpu, - struct kvm_mmu *mmu, - struct guest_walker *walker, - int write_fault) +static unsigned FNAME(gpte_access)(struct kvm_vcpu *vcpu, pt_element_t gpte, + bool last) { - unsigned level, index; - pt_element_t pte, orig_pte; - pt_element_t __user *ptep_user; - gfn_t table_gfn; - int ret; - - for (level = walker->max_level; level >= walker->level; --level) { - pte = orig_pte = walker->ptes[level - 1]; - table_gfn = walker->table_gfn[level - 1]; - ptep_user = walker->ptep_user[level - 1]; - index = offset_in_page(ptep_user) / sizeof(pt_element_t); - if (!(pte & PT_ACCESSED_MASK)) { - trace_kvm_mmu_set_accessed_bit(table_gfn, index, sizeof(pte)); - pte |= PT_ACCESSED_MASK; - } - if (level == walker->level && write_fault && !is_dirty_gpte(pte)) { - trace_kvm_mmu_set_dirty_bit(table_gfn, index, sizeof(pte)); - pte |= PT_DIRTY_MASK; - } - if (pte == orig_pte) - continue; + unsigned access; - ret = FNAME(cmpxchg_gpte)(vcpu, mmu, ptep_user, index, orig_pte, pte); - if (ret) - return ret; + access = (gpte & (PT_WRITABLE_MASK | PT_USER_MASK)) | ACC_EXEC_MASK; + if (last && !is_dirty_gpte(gpte)) + access &= ~ACC_WRITE_MASK; - mark_page_dirty(vcpu->kvm, table_gfn); - walker->ptes[level] = pte; - } - return 0; +#if PTTYPE == 64 + if (vcpu->arch.mmu.nx) + access &= ~(gpte >> PT64_NX_SHIFT); +#endif + return access; +} + +static bool FNAME(is_last_gpte)(struct guest_walker *walker, + struct kvm_vcpu *vcpu, struct kvm_mmu *mmu, + pt_element_t gpte) +{ + if (walker->level == PT_PAGE_TABLE_LEVEL) + return true; + + if ((walker->level == PT_DIRECTORY_LEVEL) && is_large_pte(gpte) && + (PTTYPE == 64 || is_pse(vcpu))) + return true; + + if ((walker->level == PT_PDPE_LEVEL) && is_large_pte(gpte) && + (mmu->root_level == PT64_ROOT_LEVEL)) + return true; + + return false; } /* @@ -147,22 +142,21 @@ static int FNAME(walk_addr_generic)(struct guest_walker *walker, struct kvm_vcpu *vcpu, struct kvm_mmu *mmu, gva_t addr, u32 access) { - int ret; pt_element_t pte; pt_element_t __user *uninitialized_var(ptep_user); gfn_t table_gfn; - unsigned index, pt_access, pte_access, accessed_dirty, shift; + unsigned index, pt_access, uninitialized_var(pte_access); gpa_t pte_gpa; + bool eperm, last_gpte; int offset; const int write_fault = access & PFERR_WRITE_MASK; const int user_fault = access & PFERR_USER_MASK; const int fetch_fault = access & PFERR_FETCH_MASK; u16 errcode = 0; - gpa_t real_gpa; - gfn_t gfn; trace_kvm_mmu_pagetable_walk(addr, access); retry_walk: + eperm = false; walker->level = mmu->root_level; pte = mmu->get_cr3(vcpu); @@ -175,21 +169,15 @@ static int FNAME(walk_addr_generic)(struct guest_walker *walker, --walker->level; } #endif - walker->max_level = walker->level; ASSERT((!is_long_mode(vcpu) && is_pae(vcpu)) || (mmu->get_cr3(vcpu) & CR3_NONPAE_RESERVED_BITS) == 0); - accessed_dirty = PT_ACCESSED_MASK; - pt_access = pte_access = ACC_ALL; - ++walker->level; + pt_access = ACC_ALL; - do { + for (;;) { gfn_t real_gfn; unsigned long host_addr; - pt_access &= pte_access; - --walker->level; - index = PT_INDEX(addr, walker->level); table_gfn = gpte_to_gfn(pte); @@ -211,7 +199,6 @@ static int FNAME(walk_addr_generic)(struct guest_walker *walker, ptep_user = (pt_element_t __user *)((void *)host_addr + offset); if (unlikely(__copy_from_user(&pte, ptep_user, sizeof(pte)))) goto error; - walker->ptep_user[walker->level - 1] = ptep_user; trace_kvm_mmu_paging_element(pte, walker->level); @@ -224,48 +211,92 @@ static int FNAME(walk_addr_generic)(struct guest_walker *walker, goto error; } - accessed_dirty &= pte; - pte_access = pt_access & gpte_access(vcpu, pte); + if (!check_write_user_access(vcpu, write_fault, user_fault, + pte)) + eperm = true; + +#if PTTYPE == 64 + if (unlikely(fetch_fault && (pte & PT64_NX_MASK))) + eperm = true; +#endif + + last_gpte = FNAME(is_last_gpte)(walker, vcpu, mmu, pte); + if (last_gpte) { + pte_access = pt_access & + FNAME(gpte_access)(vcpu, pte, true); + /* check if the kernel is fetching from user page */ + if (unlikely(pte_access & PT_USER_MASK) && + kvm_read_cr4_bits(vcpu, X86_CR4_SMEP)) + if (fetch_fault && !user_fault) + eperm = true; + } + + if (!eperm && unlikely(!(pte & PT_ACCESSED_MASK))) { + int ret; + trace_kvm_mmu_set_accessed_bit(table_gfn, index, + sizeof(pte)); + ret = FNAME(cmpxchg_gpte)(vcpu, mmu, ptep_user, index, + pte, pte|PT_ACCESSED_MASK); + if (unlikely(ret < 0)) + goto error; + else if (ret) + goto retry_walk; + + mark_page_dirty(vcpu->kvm, table_gfn); + pte |= PT_ACCESSED_MASK; + } walker->ptes[walker->level - 1] = pte; - } while (!is_last_gpte(mmu, walker->level, pte)); - if (unlikely(permission_fault(mmu, pte_access, access))) { - errcode |= PFERR_PRESENT_MASK; - goto error; - } + if (last_gpte) { + int lvl = walker->level; + gpa_t real_gpa; + gfn_t gfn; + u32 ac; - gfn = gpte_to_gfn_lvl(pte, walker->level); - gfn += (addr & PT_LVL_OFFSET_MASK(walker->level)) >> PAGE_SHIFT; + gfn = gpte_to_gfn_lvl(pte, lvl); + gfn += (addr & PT_LVL_OFFSET_MASK(lvl)) >> PAGE_SHIFT; - if (PTTYPE == 32 && walker->level == PT_DIRECTORY_LEVEL && is_cpuid_PSE36()) - gfn += pse36_gfn_delta(pte); + if (PTTYPE == 32 && + walker->level == PT_DIRECTORY_LEVEL && + is_cpuid_PSE36()) + gfn += pse36_gfn_delta(pte); - real_gpa = mmu->translate_gpa(vcpu, gfn_to_gpa(gfn), access); - if (real_gpa == UNMAPPED_GVA) - return 0; + ac = write_fault | fetch_fault | user_fault; - walker->gfn = real_gpa >> PAGE_SHIFT; + real_gpa = mmu->translate_gpa(vcpu, gfn_to_gpa(gfn), + ac); + if (real_gpa == UNMAPPED_GVA) + return 0; - if (!write_fault) - protect_clean_gpte(&pte_access, pte); + walker->gfn = real_gpa >> PAGE_SHIFT; - /* - * On a write fault, fold the dirty bit into accessed_dirty by shifting it one - * place right. - * - * On a read fault, do nothing. - */ - shift = write_fault >> ilog2(PFERR_WRITE_MASK); - shift *= PT_DIRTY_SHIFT - PT_ACCESSED_SHIFT; - accessed_dirty &= pte >> shift; + break; + } + + pt_access &= FNAME(gpte_access)(vcpu, pte, false); + --walker->level; + } + + if (unlikely(eperm)) { + errcode |= PFERR_PRESENT_MASK; + goto error; + } - if (unlikely(!accessed_dirty)) { - ret = FNAME(update_accessed_dirty_bits)(vcpu, mmu, walker, write_fault); + if (write_fault && unlikely(!is_dirty_gpte(pte))) { + int ret; + + trace_kvm_mmu_set_dirty_bit(table_gfn, index, sizeof(pte)); + ret = FNAME(cmpxchg_gpte)(vcpu, mmu, ptep_user, index, + pte, pte|PT_DIRTY_MASK); if (unlikely(ret < 0)) goto error; else if (ret) goto retry_walk; + + mark_page_dirty(vcpu->kvm, table_gfn); + pte |= PT_DIRTY_MASK; + walker->ptes[walker->level - 1] = pte; } walker->pt_access = pt_access; @@ -337,11 +368,12 @@ static void FNAME(update_pte)(struct kvm_vcpu *vcpu, struct kvm_mmu_page *sp, return; pgprintk("%s: gpte %llx spte %p\n", __func__, (u64)gpte, spte); - pte_access = sp->role.access & gpte_access(vcpu, gpte); - protect_clean_gpte(&pte_access, gpte); + pte_access = sp->role.access & FNAME(gpte_access)(vcpu, gpte, true); pfn = gfn_to_pfn_atomic(vcpu->kvm, gpte_to_gfn(gpte)); - if (mmu_invalid_pfn(pfn)) + if (mmu_invalid_pfn(pfn)) { + kvm_release_pfn_clean(pfn); return; + } /* * we call mmu_set_spte() with host_writable = true because that @@ -411,13 +443,15 @@ static void FNAME(pte_prefetch)(struct kvm_vcpu *vcpu, struct guest_walker *gw, if (FNAME(prefetch_invalid_gpte)(vcpu, sp, spte, gpte)) continue; - pte_access = sp->role.access & gpte_access(vcpu, gpte); - protect_clean_gpte(&pte_access, gpte); + pte_access = sp->role.access & FNAME(gpte_access)(vcpu, gpte, + true); gfn = gpte_to_gfn(gpte); pfn = pte_prefetch_gfn_to_pfn(vcpu, gfn, pte_access & ACC_WRITE_MASK); - if (mmu_invalid_pfn(pfn)) + if (mmu_invalid_pfn(pfn)) { + kvm_release_pfn_clean(pfn); break; + } mmu_set_spte(vcpu, spte, sp->role.access, pte_access, 0, 0, NULL, PT_PAGE_TABLE_LEVEL, gfn, @@ -764,8 +798,7 @@ static int FNAME(sync_page)(struct kvm_vcpu *vcpu, struct kvm_mmu_page *sp) gfn = gpte_to_gfn(gpte); pte_access = sp->role.access; - pte_access &= gpte_access(vcpu, gpte); - protect_clean_gpte(&pte_access, gpte); + pte_access &= FNAME(gpte_access)(vcpu, gpte, true); if (sync_mmio_spte(&sp->spt[i], gfn, pte_access, &nr_present)) continue; diff --git a/trunk/arch/x86/kvm/pmu.c b/trunk/arch/x86/kvm/pmu.c index cfc258a6bf97..9b7ec1150ab0 100644 --- a/trunk/arch/x86/kvm/pmu.c +++ b/trunk/arch/x86/kvm/pmu.c @@ -1,5 +1,5 @@ /* - * Kernel-based Virtual Machine -- Performance Monitoring Unit support + * Kernel-based Virtual Machine -- Performane Monitoring Unit support * * Copyright 2011 Red Hat, Inc. and/or its affiliates. * diff --git a/trunk/arch/x86/kvm/svm.c b/trunk/arch/x86/kvm/svm.c index d017df3899ef..baead950d6c8 100644 --- a/trunk/arch/x86/kvm/svm.c +++ b/trunk/arch/x86/kvm/svm.c @@ -163,7 +163,7 @@ static DEFINE_PER_CPU(u64, current_tsc_ratio); #define MSR_INVALID 0xffffffffU -static const struct svm_direct_access_msrs { +static struct svm_direct_access_msrs { u32 index; /* Index of the MSR */ bool always; /* True if intercept is always on */ } direct_access_msrs[] = { @@ -400,7 +400,7 @@ struct svm_init_data { int r; }; -static const u32 msrpm_ranges[] = {0, 0xc0000000, 0xc0010000}; +static u32 msrpm_ranges[] = {0, 0xc0000000, 0xc0010000}; #define NUM_MSR_MAPS ARRAY_SIZE(msrpm_ranges) #define MSRS_RANGE_SIZE 2048 @@ -1146,6 +1146,7 @@ static void init_vmcb(struct vcpu_svm *svm) svm_set_efer(&svm->vcpu, 0); save->dr6 = 0xffff0ff0; + save->dr7 = 0x400; kvm_set_rflags(&svm->vcpu, 2); save->rip = 0x0000fff0; svm->vcpu.arch.regs[VCPU_REGS_RIP] = save->rip; @@ -1642,7 +1643,7 @@ static void svm_set_segment(struct kvm_vcpu *vcpu, mark_dirty(svm->vmcb, VMCB_SEG); } -static void update_db_bp_intercept(struct kvm_vcpu *vcpu) +static void update_db_intercept(struct kvm_vcpu *vcpu) { struct vcpu_svm *svm = to_svm(vcpu); @@ -1662,6 +1663,20 @@ static void update_db_bp_intercept(struct kvm_vcpu *vcpu) vcpu->guest_debug = 0; } +static void svm_guest_debug(struct kvm_vcpu *vcpu, struct kvm_guest_debug *dbg) +{ + struct vcpu_svm *svm = to_svm(vcpu); + + if (vcpu->guest_debug & KVM_GUESTDBG_USE_HW_BP) + svm->vmcb->save.dr7 = dbg->arch.debugreg[7]; + else + svm->vmcb->save.dr7 = vcpu->arch.dr7; + + mark_dirty(svm->vmcb, VMCB_DR); + + update_db_intercept(vcpu); +} + static void new_asid(struct vcpu_svm *svm, struct svm_cpu_data *sd) { if (sd->next_asid > sd->max_asid) { @@ -1733,7 +1748,7 @@ static int db_interception(struct vcpu_svm *svm) if (!(svm->vcpu.guest_debug & KVM_GUESTDBG_SINGLESTEP)) svm->vmcb->save.rflags &= ~(X86_EFLAGS_TF | X86_EFLAGS_RF); - update_db_bp_intercept(&svm->vcpu); + update_db_intercept(&svm->vcpu); } if (svm->vcpu.guest_debug & @@ -2048,7 +2063,7 @@ static inline bool nested_svm_intr(struct vcpu_svm *svm) if (svm->nested.intercept & 1ULL) { /* * The #vmexit can't be emulated here directly because this - * code path runs with irqs and preemption disabled. A + * code path runs with irqs and preemtion disabled. A * #vmexit emulation might sleep. Only signal request for * the #vmexit here. */ @@ -2090,6 +2105,7 @@ static void *nested_svm_map(struct vcpu_svm *svm, u64 gpa, struct page **_page) return kmap(page); error: + kvm_release_page_clean(page); kvm_inject_gp(&svm->vcpu, 0); return NULL; @@ -2393,7 +2409,7 @@ static bool nested_svm_vmrun_msrpm(struct vcpu_svm *svm) { /* * This function merges the msr permission bitmaps of kvm and the - * nested vmcb. It is optimized in that it only merges the parts where + * nested vmcb. It is omptimized in that it only merges the parts where * the kvm msr permission bitmap may contain zero bits */ int i; @@ -3252,7 +3268,7 @@ static int pause_interception(struct vcpu_svm *svm) return 1; } -static int (*const svm_exit_handlers[])(struct vcpu_svm *svm) = { +static int (*svm_exit_handlers[])(struct vcpu_svm *svm) = { [SVM_EXIT_READ_CR0] = cr_interception, [SVM_EXIT_READ_CR3] = cr_interception, [SVM_EXIT_READ_CR4] = cr_interception, @@ -3644,7 +3660,7 @@ static void enable_nmi_window(struct kvm_vcpu *vcpu) */ svm->nmi_singlestep = true; svm->vmcb->save.rflags |= (X86_EFLAGS_TF | X86_EFLAGS_RF); - update_db_bp_intercept(vcpu); + update_db_intercept(vcpu); } static int svm_set_tss_addr(struct kvm *kvm, unsigned int addr) @@ -3767,6 +3783,12 @@ static void svm_cancel_injection(struct kvm_vcpu *vcpu) svm_complete_interrupts(svm); } +#ifdef CONFIG_X86_64 +#define R "r" +#else +#define R "e" +#endif + static void svm_vcpu_run(struct kvm_vcpu *vcpu) { struct vcpu_svm *svm = to_svm(vcpu); @@ -3793,13 +3815,13 @@ static void svm_vcpu_run(struct kvm_vcpu *vcpu) local_irq_enable(); asm volatile ( - "push %%" _ASM_BP "; \n\t" - "mov %c[rbx](%[svm]), %%" _ASM_BX " \n\t" - "mov %c[rcx](%[svm]), %%" _ASM_CX " \n\t" - "mov %c[rdx](%[svm]), %%" _ASM_DX " \n\t" - "mov %c[rsi](%[svm]), %%" _ASM_SI " \n\t" - "mov %c[rdi](%[svm]), %%" _ASM_DI " \n\t" - "mov %c[rbp](%[svm]), %%" _ASM_BP " \n\t" + "push %%"R"bp; \n\t" + "mov %c[rbx](%[svm]), %%"R"bx \n\t" + "mov %c[rcx](%[svm]), %%"R"cx \n\t" + "mov %c[rdx](%[svm]), %%"R"dx \n\t" + "mov %c[rsi](%[svm]), %%"R"si \n\t" + "mov %c[rdi](%[svm]), %%"R"di \n\t" + "mov %c[rbp](%[svm]), %%"R"bp \n\t" #ifdef CONFIG_X86_64 "mov %c[r8](%[svm]), %%r8 \n\t" "mov %c[r9](%[svm]), %%r9 \n\t" @@ -3812,20 +3834,20 @@ static void svm_vcpu_run(struct kvm_vcpu *vcpu) #endif /* Enter guest mode */ - "push %%" _ASM_AX " \n\t" - "mov %c[vmcb](%[svm]), %%" _ASM_AX " \n\t" + "push %%"R"ax \n\t" + "mov %c[vmcb](%[svm]), %%"R"ax \n\t" __ex(SVM_VMLOAD) "\n\t" __ex(SVM_VMRUN) "\n\t" __ex(SVM_VMSAVE) "\n\t" - "pop %%" _ASM_AX " \n\t" + "pop %%"R"ax \n\t" /* Save guest registers, load host registers */ - "mov %%" _ASM_BX ", %c[rbx](%[svm]) \n\t" - "mov %%" _ASM_CX ", %c[rcx](%[svm]) \n\t" - "mov %%" _ASM_DX ", %c[rdx](%[svm]) \n\t" - "mov %%" _ASM_SI ", %c[rsi](%[svm]) \n\t" - "mov %%" _ASM_DI ", %c[rdi](%[svm]) \n\t" - "mov %%" _ASM_BP ", %c[rbp](%[svm]) \n\t" + "mov %%"R"bx, %c[rbx](%[svm]) \n\t" + "mov %%"R"cx, %c[rcx](%[svm]) \n\t" + "mov %%"R"dx, %c[rdx](%[svm]) \n\t" + "mov %%"R"si, %c[rsi](%[svm]) \n\t" + "mov %%"R"di, %c[rdi](%[svm]) \n\t" + "mov %%"R"bp, %c[rbp](%[svm]) \n\t" #ifdef CONFIG_X86_64 "mov %%r8, %c[r8](%[svm]) \n\t" "mov %%r9, %c[r9](%[svm]) \n\t" @@ -3836,7 +3858,7 @@ static void svm_vcpu_run(struct kvm_vcpu *vcpu) "mov %%r14, %c[r14](%[svm]) \n\t" "mov %%r15, %c[r15](%[svm]) \n\t" #endif - "pop %%" _ASM_BP + "pop %%"R"bp" : : [svm]"a"(svm), [vmcb]"i"(offsetof(struct vcpu_svm, vmcb_pa)), @@ -3857,11 +3879,9 @@ static void svm_vcpu_run(struct kvm_vcpu *vcpu) [r15]"i"(offsetof(struct vcpu_svm, vcpu.arch.regs[VCPU_REGS_R15])) #endif : "cc", "memory" + , R"bx", R"cx", R"dx", R"si", R"di" #ifdef CONFIG_X86_64 - , "rbx", "rcx", "rdx", "rsi", "rdi" , "r8", "r9", "r10", "r11" , "r12", "r13", "r14", "r15" -#else - , "ebx", "ecx", "edx", "esi", "edi" #endif ); @@ -3921,6 +3941,8 @@ static void svm_vcpu_run(struct kvm_vcpu *vcpu) mark_all_clean(svm->vmcb); } +#undef R + static void svm_set_cr3(struct kvm_vcpu *vcpu, unsigned long root) { struct vcpu_svm *svm = to_svm(vcpu); @@ -4047,7 +4069,7 @@ static void svm_fpu_deactivate(struct kvm_vcpu *vcpu) #define POST_MEM(exit) { .exit_code = (exit), \ .stage = X86_ICPT_POST_MEMACCESS, } -static const struct __x86_intercept { +static struct __x86_intercept { u32 exit_code; enum x86_intercept_stage stage; } x86_intercept_map[] = { @@ -4238,7 +4260,7 @@ static struct kvm_x86_ops svm_x86_ops = { .vcpu_load = svm_vcpu_load, .vcpu_put = svm_vcpu_put, - .update_db_bp_intercept = update_db_bp_intercept, + .set_guest_debug = svm_guest_debug, .get_msr = svm_get_msr, .set_msr = svm_set_msr, .get_segment_base = svm_get_segment_base, diff --git a/trunk/arch/x86/kvm/timer.c b/trunk/arch/x86/kvm/timer.c new file mode 100644 index 000000000000..6b85cc647f34 --- /dev/null +++ b/trunk/arch/x86/kvm/timer.c @@ -0,0 +1,47 @@ +/* + * Kernel-based Virtual Machine driver for Linux + * + * This module enables machines with Intel VT-x extensions to run virtual + * machines without emulation or binary translation. + * + * timer support + * + * Copyright 2010 Red Hat, Inc. and/or its affiliates. + * + * This work is licensed under the terms of the GNU GPL, version 2. See + * the COPYING file in the top-level directory. + */ + +#include +#include +#include +#include +#include "kvm_timer.h" + +enum hrtimer_restart kvm_timer_fn(struct hrtimer *data) +{ + struct kvm_timer *ktimer = container_of(data, struct kvm_timer, timer); + struct kvm_vcpu *vcpu = ktimer->vcpu; + wait_queue_head_t *q = &vcpu->wq; + + /* + * There is a race window between reading and incrementing, but we do + * not care about potentially losing timer events in the !reinject + * case anyway. Note: KVM_REQ_PENDING_TIMER is implicitly checked + * in vcpu_enter_guest. + */ + if (ktimer->reinject || !atomic_read(&ktimer->pending)) { + atomic_inc(&ktimer->pending); + /* FIXME: this code should not know anything about vcpus */ + kvm_make_request(KVM_REQ_PENDING_TIMER, vcpu); + } + + if (waitqueue_active(q)) + wake_up_interruptible(q); + + if (ktimer->t_ops->is_periodic(ktimer)) { + hrtimer_add_expires_ns(&ktimer->timer, ktimer->period); + return HRTIMER_RESTART; + } else + return HRTIMER_NORESTART; +} diff --git a/trunk/arch/x86/kvm/vmx.c b/trunk/arch/x86/kvm/vmx.c index ad6b1dd06f8b..851aa7c3b890 100644 --- a/trunk/arch/x86/kvm/vmx.c +++ b/trunk/arch/x86/kvm/vmx.c @@ -127,8 +127,6 @@ module_param(ple_gap, int, S_IRUGO); static int ple_window = KVM_VMX_DEFAULT_PLE_WINDOW; module_param(ple_window, int, S_IRUGO); -extern const ulong vmx_return; - #define NR_AUTOLOAD_MSRS 8 #define VMCS02_POOL_SIZE 1 @@ -407,16 +405,16 @@ struct vcpu_vmx { struct { int vm86_active; ulong save_rflags; - struct kvm_segment segs[8]; - } rmode; - struct { - u32 bitmask; /* 4 bits per segment (1 bit per field) */ struct kvm_save_segment { u16 selector; unsigned long base; u32 limit; u32 ar; - } seg[8]; + } tr, es, ds, fs, gs; + } rmode; + struct { + u32 bitmask; /* 4 bits per segment (1 bit per field) */ + struct kvm_save_segment seg[8]; } segment_cache; int vpid; bool emulation_required; @@ -452,7 +450,7 @@ static inline struct vcpu_vmx *to_vmx(struct kvm_vcpu *vcpu) #define FIELD64(number, name) [number] = VMCS12_OFFSET(name), \ [number##_HIGH] = VMCS12_OFFSET(name)+4 -static const unsigned short vmcs_field_to_offset_table[] = { +static unsigned short vmcs_field_to_offset_table[] = { FIELD(VIRTUAL_PROCESSOR_ID, virtual_processor_id), FIELD(GUEST_ES_SELECTOR, guest_es_selector), FIELD(GUEST_CS_SELECTOR, guest_cs_selector), @@ -598,9 +596,10 @@ static inline struct vmcs12 *get_vmcs12(struct kvm_vcpu *vcpu) static struct page *nested_get_page(struct kvm_vcpu *vcpu, gpa_t addr) { struct page *page = gfn_to_page(vcpu->kvm, addr >> PAGE_SHIFT); - if (is_error_page(page)) + if (is_error_page(page)) { + kvm_release_page_clean(page); return NULL; - + } return page; } @@ -668,7 +667,7 @@ static struct vmx_capability { .ar_bytes = GUEST_##seg##_AR_BYTES, \ } -static const struct kvm_vmx_segment_field { +static struct kvm_vmx_segment_field { unsigned selector; unsigned base; unsigned limit; @@ -1344,7 +1343,7 @@ static bool update_transition_efer(struct vcpu_vmx *vmx, int efer_offset) guest_efer = vmx->vcpu.arch.efer; /* - * NX is emulated; LMA and LME handled by hardware; SCE meaningless + * NX is emulated; LMA and LME handled by hardware; SCE meaninless * outside long mode */ ignore_bits = EFER_NX | EFER_SCE; @@ -1996,7 +1995,7 @@ static __init void nested_vmx_setup_ctls_msrs(void) #endif CPU_BASED_MOV_DR_EXITING | CPU_BASED_UNCOND_IO_EXITING | CPU_BASED_USE_IO_BITMAPS | CPU_BASED_MONITOR_EXITING | - CPU_BASED_RDPMC_EXITING | CPU_BASED_RDTSC_EXITING | + CPU_BASED_RDPMC_EXITING | CPU_BASED_ACTIVATE_SECONDARY_CONTROLS; /* * We can allow some features even when not supported by the @@ -2292,6 +2291,16 @@ static void vmx_cache_reg(struct kvm_vcpu *vcpu, enum kvm_reg reg) } } +static void set_guest_debug(struct kvm_vcpu *vcpu, struct kvm_guest_debug *dbg) +{ + if (vcpu->guest_debug & KVM_GUESTDBG_USE_HW_BP) + vmcs_writel(GUEST_DR7, dbg->arch.debugreg[7]); + else + vmcs_writel(GUEST_DR7, vcpu->arch.dr7); + + update_exception_bitmap(vcpu); +} + static __init int cpu_has_kvm_support(void) { return cpu_has_vmx(); @@ -2689,17 +2698,20 @@ static __exit void hardware_unsetup(void) free_kvm_area(); } -static void fix_pmode_dataseg(struct kvm_vcpu *vcpu, int seg, struct kvm_segment *save) +static void fix_pmode_dataseg(int seg, struct kvm_save_segment *save) { - const struct kvm_vmx_segment_field *sf = &kvm_vmx_segment_fields[seg]; - struct kvm_segment tmp = *save; + struct kvm_vmx_segment_field *sf = &kvm_vmx_segment_fields[seg]; - if (!(vmcs_readl(sf->base) == tmp.base && tmp.s)) { - tmp.base = vmcs_readl(sf->base); - tmp.selector = vmcs_read16(sf->selector); - tmp.s = 1; + if (vmcs_readl(sf->base) == save->base && (save->base & AR_S_MASK)) { + vmcs_write16(sf->selector, save->selector); + vmcs_writel(sf->base, save->base); + vmcs_write32(sf->limit, save->limit); + vmcs_write32(sf->ar_bytes, save->ar); + } else { + u32 dpl = (vmcs_read16(sf->selector) & SELECTOR_RPL_MASK) + << AR_DPL_SHIFT; + vmcs_write32(sf->ar_bytes, 0x93 | dpl); } - vmx_set_segment(vcpu, &tmp, seg); } static void enter_pmode(struct kvm_vcpu *vcpu) @@ -2712,7 +2724,10 @@ static void enter_pmode(struct kvm_vcpu *vcpu) vmx_segment_cache_clear(vmx); - vmx_set_segment(vcpu, &vmx->rmode.segs[VCPU_SREG_TR], VCPU_SREG_TR); + vmcs_write16(GUEST_TR_SELECTOR, vmx->rmode.tr.selector); + vmcs_writel(GUEST_TR_BASE, vmx->rmode.tr.base); + vmcs_write32(GUEST_TR_LIMIT, vmx->rmode.tr.limit); + vmcs_write32(GUEST_TR_AR_BYTES, vmx->rmode.tr.ar); flags = vmcs_readl(GUEST_RFLAGS); flags &= RMODE_GUEST_OWNED_EFLAGS_BITS; @@ -2727,10 +2742,10 @@ static void enter_pmode(struct kvm_vcpu *vcpu) if (emulate_invalid_guest_state) return; - fix_pmode_dataseg(vcpu, VCPU_SREG_ES, &vmx->rmode.segs[VCPU_SREG_ES]); - fix_pmode_dataseg(vcpu, VCPU_SREG_DS, &vmx->rmode.segs[VCPU_SREG_DS]); - fix_pmode_dataseg(vcpu, VCPU_SREG_FS, &vmx->rmode.segs[VCPU_SREG_FS]); - fix_pmode_dataseg(vcpu, VCPU_SREG_GS, &vmx->rmode.segs[VCPU_SREG_GS]); + fix_pmode_dataseg(VCPU_SREG_ES, &vmx->rmode.es); + fix_pmode_dataseg(VCPU_SREG_DS, &vmx->rmode.ds); + fix_pmode_dataseg(VCPU_SREG_GS, &vmx->rmode.gs); + fix_pmode_dataseg(VCPU_SREG_FS, &vmx->rmode.fs); vmx_segment_cache_clear(vmx); @@ -2758,10 +2773,14 @@ static gva_t rmode_tss_base(struct kvm *kvm) return kvm->arch.tss_addr; } -static void fix_rmode_seg(int seg, struct kvm_segment *save) +static void fix_rmode_seg(int seg, struct kvm_save_segment *save) { - const struct kvm_vmx_segment_field *sf = &kvm_vmx_segment_fields[seg]; + struct kvm_vmx_segment_field *sf = &kvm_vmx_segment_fields[seg]; + save->selector = vmcs_read16(sf->selector); + save->base = vmcs_readl(sf->base); + save->limit = vmcs_read32(sf->limit); + save->ar = vmcs_read32(sf->ar_bytes); vmcs_write16(sf->selector, save->base >> 4); vmcs_write32(sf->base, save->base & 0xffff0); vmcs_write32(sf->limit, 0xffff); @@ -2781,16 +2800,9 @@ static void enter_rmode(struct kvm_vcpu *vcpu) if (enable_unrestricted_guest) return; - vmx_get_segment(vcpu, &vmx->rmode.segs[VCPU_SREG_TR], VCPU_SREG_TR); - vmx_get_segment(vcpu, &vmx->rmode.segs[VCPU_SREG_ES], VCPU_SREG_ES); - vmx_get_segment(vcpu, &vmx->rmode.segs[VCPU_SREG_DS], VCPU_SREG_DS); - vmx_get_segment(vcpu, &vmx->rmode.segs[VCPU_SREG_FS], VCPU_SREG_FS); - vmx_get_segment(vcpu, &vmx->rmode.segs[VCPU_SREG_GS], VCPU_SREG_GS); - vmx->emulation_required = 1; vmx->rmode.vm86_active = 1; - /* * Very old userspace does not call KVM_SET_TSS_ADDR before entering * vcpu. Call it here with phys address pointing 16M below 4G. @@ -2805,8 +2817,14 @@ static void enter_rmode(struct kvm_vcpu *vcpu) vmx_segment_cache_clear(vmx); + vmx->rmode.tr.selector = vmcs_read16(GUEST_TR_SELECTOR); + vmx->rmode.tr.base = vmcs_readl(GUEST_TR_BASE); vmcs_writel(GUEST_TR_BASE, rmode_tss_base(vcpu->kvm)); + + vmx->rmode.tr.limit = vmcs_read32(GUEST_TR_LIMIT); vmcs_write32(GUEST_TR_LIMIT, RMODE_TSS_SIZE - 1); + + vmx->rmode.tr.ar = vmcs_read32(GUEST_TR_AR_BYTES); vmcs_write32(GUEST_TR_AR_BYTES, 0x008b); flags = vmcs_readl(GUEST_RFLAGS); @@ -3099,24 +3117,35 @@ static void vmx_get_segment(struct kvm_vcpu *vcpu, struct kvm_segment *var, int seg) { struct vcpu_vmx *vmx = to_vmx(vcpu); + struct kvm_save_segment *save; u32 ar; if (vmx->rmode.vm86_active && (seg == VCPU_SREG_TR || seg == VCPU_SREG_ES || seg == VCPU_SREG_DS || seg == VCPU_SREG_FS - || seg == VCPU_SREG_GS)) { - *var = vmx->rmode.segs[seg]; + || seg == VCPU_SREG_GS) + && !emulate_invalid_guest_state) { + switch (seg) { + case VCPU_SREG_TR: save = &vmx->rmode.tr; break; + case VCPU_SREG_ES: save = &vmx->rmode.es; break; + case VCPU_SREG_DS: save = &vmx->rmode.ds; break; + case VCPU_SREG_FS: save = &vmx->rmode.fs; break; + case VCPU_SREG_GS: save = &vmx->rmode.gs; break; + default: BUG(); + } + var->selector = save->selector; + var->base = save->base; + var->limit = save->limit; + ar = save->ar; if (seg == VCPU_SREG_TR || var->selector == vmx_read_guest_seg_selector(vmx, seg)) - return; - var->base = vmx_read_guest_seg_base(vmx, seg); - var->selector = vmx_read_guest_seg_selector(vmx, seg); - return; + goto use_saved_rmode_seg; } var->base = vmx_read_guest_seg_base(vmx, seg); var->limit = vmx_read_guest_seg_limit(vmx, seg); var->selector = vmx_read_guest_seg_selector(vmx, seg); ar = vmx_read_guest_seg_ar(vmx, seg); +use_saved_rmode_seg: if ((ar & AR_UNUSABLE_MASK) && !emulate_invalid_guest_state) ar = 0; var->type = ar & 15; @@ -3198,21 +3227,23 @@ static void vmx_set_segment(struct kvm_vcpu *vcpu, struct kvm_segment *var, int seg) { struct vcpu_vmx *vmx = to_vmx(vcpu); - const struct kvm_vmx_segment_field *sf = &kvm_vmx_segment_fields[seg]; + struct kvm_vmx_segment_field *sf = &kvm_vmx_segment_fields[seg]; u32 ar; vmx_segment_cache_clear(vmx); if (vmx->rmode.vm86_active && seg == VCPU_SREG_TR) { vmcs_write16(sf->selector, var->selector); - vmx->rmode.segs[VCPU_SREG_TR] = *var; + vmx->rmode.tr.selector = var->selector; + vmx->rmode.tr.base = var->base; + vmx->rmode.tr.limit = var->limit; + vmx->rmode.tr.ar = vmx_segment_access_rights(var); return; } vmcs_writel(sf->base, var->base); vmcs_write32(sf->limit, var->limit); vmcs_write16(sf->selector, var->selector); if (vmx->rmode.vm86_active && var->s) { - vmx->rmode.segs[seg] = *var; /* * Hack real-mode segments into vm86 compatibility. */ @@ -3227,7 +3258,7 @@ static void vmx_set_segment(struct kvm_vcpu *vcpu, * qemu binaries. * IA32 arch specifies that at the time of processor reset the * "Accessed" bit in the AR field of segment registers is 1. And qemu - * is setting it to 0 in the userland code. This causes invalid guest + * is setting it to 0 in the usedland code. This causes invalid guest * state vmexit when "unrestricted guest" mode is turned on. * Fix for this setup issue in cpu_reset is being pushed in the qemu * tree. Newer qemu binaries with that qemu fix would not need this @@ -3257,10 +3288,16 @@ static void vmx_set_segment(struct kvm_vcpu *vcpu, vmcs_readl(GUEST_CS_BASE) >> 4); break; case VCPU_SREG_ES: + fix_rmode_seg(VCPU_SREG_ES, &vmx->rmode.es); + break; case VCPU_SREG_DS: + fix_rmode_seg(VCPU_SREG_DS, &vmx->rmode.ds); + break; case VCPU_SREG_GS: + fix_rmode_seg(VCPU_SREG_GS, &vmx->rmode.gs); + break; case VCPU_SREG_FS: - fix_rmode_seg(seg, &vmx->rmode.segs[seg]); + fix_rmode_seg(VCPU_SREG_FS, &vmx->rmode.fs); break; case VCPU_SREG_SS: vmcs_write16(GUEST_SS_SELECTOR, @@ -3314,9 +3351,9 @@ static bool rmode_segment_valid(struct kvm_vcpu *vcpu, int seg) if (var.base != (var.selector << 4)) return false; - if (var.limit < 0xffff) + if (var.limit != 0xffff) return false; - if (((ar | (3 << AR_DPL_SHIFT)) & ~(AR_G_MASK | AR_DB_MASK)) != 0xf3) + if (ar != 0xf3) return false; return true; @@ -3568,7 +3605,7 @@ static int init_rmode_identity_map(struct kvm *kvm) static void seg_setup(int seg) { - const struct kvm_vmx_segment_field *sf = &kvm_vmx_segment_fields[seg]; + struct kvm_vmx_segment_field *sf = &kvm_vmx_segment_fields[seg]; unsigned int ar; vmcs_write16(sf->selector, 0); @@ -3733,7 +3770,8 @@ static void vmx_set_constant_host_state(void) native_store_idt(&dt); vmcs_writel(HOST_IDTR_BASE, dt.address); /* 22.2.4 */ - vmcs_writel(HOST_RIP, vmx_return); /* 22.2.5 */ + asm("mov $.Lkvm_vmx_return, %0" : "=r"(tmpl)); + vmcs_writel(HOST_RIP, tmpl); /* 22.2.5 */ rdmsr(MSR_IA32_SYSENTER_CS, low32, high32); vmcs_write32(HOST_IA32_SYSENTER_CS, low32); @@ -3967,6 +4005,8 @@ static int vmx_vcpu_reset(struct kvm_vcpu *vcpu) kvm_rip_write(vcpu, 0); kvm_register_write(vcpu, VCPU_REGS_RSP, 0); + vmcs_writel(GUEST_DR7, 0x400); + vmcs_writel(GUEST_GDTR_BASE, 0); vmcs_write32(GUEST_GDTR_LIMIT, 0xffff); @@ -4416,7 +4456,7 @@ vmx_patch_hypercall(struct kvm_vcpu *vcpu, unsigned char *hypercall) hypercall[2] = 0xc1; } -/* called to set cr0 as appropriate for a mov-to-cr0 exit. */ +/* called to set cr0 as approriate for a mov-to-cr0 exit. */ static int handle_set_cr0(struct kvm_vcpu *vcpu, unsigned long val) { if (to_vmx(vcpu)->nested.vmxon && @@ -5661,7 +5701,7 @@ static int handle_vmptrst(struct kvm_vcpu *vcpu) * may resume. Otherwise they set the kvm_run parameter to indicate what needs * to be done to userspace and return 0. */ -static int (*const kvm_vmx_exit_handlers[])(struct kvm_vcpu *vcpu) = { +static int (*kvm_vmx_exit_handlers[])(struct kvm_vcpu *vcpu) = { [EXIT_REASON_EXCEPTION_NMI] = handle_exception, [EXIT_REASON_EXTERNAL_INTERRUPT] = handle_external_interrupt, [EXIT_REASON_TRIPLE_FAULT] = handle_triple_fault, @@ -6189,10 +6229,17 @@ static void atomic_switch_perf_msrs(struct vcpu_vmx *vmx) msrs[i].host); } +#ifdef CONFIG_X86_64 +#define R "r" +#define Q "q" +#else +#define R "e" +#define Q "l" +#endif + static void __noclone vmx_vcpu_run(struct kvm_vcpu *vcpu) { struct vcpu_vmx *vmx = to_vmx(vcpu); - unsigned long debugctlmsr; if (is_guest_mode(vcpu) && !vmx->nested.nested_run_pending) { struct vmcs12 *vmcs12 = get_vmcs12(vcpu); @@ -6232,35 +6279,34 @@ static void __noclone vmx_vcpu_run(struct kvm_vcpu *vcpu) vmx_set_interrupt_shadow(vcpu, 0); atomic_switch_perf_msrs(vmx); - debugctlmsr = get_debugctlmsr(); vmx->__launched = vmx->loaded_vmcs->launched; asm( /* Store host registers */ - "push %%" _ASM_DX "; push %%" _ASM_BP ";" - "push %%" _ASM_CX " \n\t" /* placeholder for guest rcx */ - "push %%" _ASM_CX " \n\t" - "cmp %%" _ASM_SP ", %c[host_rsp](%0) \n\t" + "push %%"R"dx; push %%"R"bp;" + "push %%"R"cx \n\t" /* placeholder for guest rcx */ + "push %%"R"cx \n\t" + "cmp %%"R"sp, %c[host_rsp](%0) \n\t" "je 1f \n\t" - "mov %%" _ASM_SP ", %c[host_rsp](%0) \n\t" + "mov %%"R"sp, %c[host_rsp](%0) \n\t" __ex(ASM_VMX_VMWRITE_RSP_RDX) "\n\t" "1: \n\t" /* Reload cr2 if changed */ - "mov %c[cr2](%0), %%" _ASM_AX " \n\t" - "mov %%cr2, %%" _ASM_DX " \n\t" - "cmp %%" _ASM_AX ", %%" _ASM_DX " \n\t" + "mov %c[cr2](%0), %%"R"ax \n\t" + "mov %%cr2, %%"R"dx \n\t" + "cmp %%"R"ax, %%"R"dx \n\t" "je 2f \n\t" - "mov %%" _ASM_AX", %%cr2 \n\t" + "mov %%"R"ax, %%cr2 \n\t" "2: \n\t" /* Check if vmlaunch of vmresume is needed */ "cmpl $0, %c[launched](%0) \n\t" /* Load guest registers. Don't clobber flags. */ - "mov %c[rax](%0), %%" _ASM_AX " \n\t" - "mov %c[rbx](%0), %%" _ASM_BX " \n\t" - "mov %c[rdx](%0), %%" _ASM_DX " \n\t" - "mov %c[rsi](%0), %%" _ASM_SI " \n\t" - "mov %c[rdi](%0), %%" _ASM_DI " \n\t" - "mov %c[rbp](%0), %%" _ASM_BP " \n\t" + "mov %c[rax](%0), %%"R"ax \n\t" + "mov %c[rbx](%0), %%"R"bx \n\t" + "mov %c[rdx](%0), %%"R"dx \n\t" + "mov %c[rsi](%0), %%"R"si \n\t" + "mov %c[rdi](%0), %%"R"di \n\t" + "mov %c[rbp](%0), %%"R"bp \n\t" #ifdef CONFIG_X86_64 "mov %c[r8](%0), %%r8 \n\t" "mov %c[r9](%0), %%r9 \n\t" @@ -6271,24 +6317,24 @@ static void __noclone vmx_vcpu_run(struct kvm_vcpu *vcpu) "mov %c[r14](%0), %%r14 \n\t" "mov %c[r15](%0), %%r15 \n\t" #endif - "mov %c[rcx](%0), %%" _ASM_CX " \n\t" /* kills %0 (ecx) */ + "mov %c[rcx](%0), %%"R"cx \n\t" /* kills %0 (ecx) */ /* Enter guest mode */ - "jne 1f \n\t" + "jne .Llaunched \n\t" __ex(ASM_VMX_VMLAUNCH) "\n\t" - "jmp 2f \n\t" - "1: " __ex(ASM_VMX_VMRESUME) "\n\t" - "2: " + "jmp .Lkvm_vmx_return \n\t" + ".Llaunched: " __ex(ASM_VMX_VMRESUME) "\n\t" + ".Lkvm_vmx_return: " /* Save guest registers, load host registers, keep flags */ - "mov %0, %c[wordsize](%%" _ASM_SP ") \n\t" + "mov %0, %c[wordsize](%%"R"sp) \n\t" "pop %0 \n\t" - "mov %%" _ASM_AX ", %c[rax](%0) \n\t" - "mov %%" _ASM_BX ", %c[rbx](%0) \n\t" - __ASM_SIZE(pop) " %c[rcx](%0) \n\t" - "mov %%" _ASM_DX ", %c[rdx](%0) \n\t" - "mov %%" _ASM_SI ", %c[rsi](%0) \n\t" - "mov %%" _ASM_DI ", %c[rdi](%0) \n\t" - "mov %%" _ASM_BP ", %c[rbp](%0) \n\t" + "mov %%"R"ax, %c[rax](%0) \n\t" + "mov %%"R"bx, %c[rbx](%0) \n\t" + "pop"Q" %c[rcx](%0) \n\t" + "mov %%"R"dx, %c[rdx](%0) \n\t" + "mov %%"R"si, %c[rsi](%0) \n\t" + "mov %%"R"di, %c[rdi](%0) \n\t" + "mov %%"R"bp, %c[rbp](%0) \n\t" #ifdef CONFIG_X86_64 "mov %%r8, %c[r8](%0) \n\t" "mov %%r9, %c[r9](%0) \n\t" @@ -6299,15 +6345,11 @@ static void __noclone vmx_vcpu_run(struct kvm_vcpu *vcpu) "mov %%r14, %c[r14](%0) \n\t" "mov %%r15, %c[r15](%0) \n\t" #endif - "mov %%cr2, %%" _ASM_AX " \n\t" - "mov %%" _ASM_AX ", %c[cr2](%0) \n\t" + "mov %%cr2, %%"R"ax \n\t" + "mov %%"R"ax, %c[cr2](%0) \n\t" - "pop %%" _ASM_BP "; pop %%" _ASM_DX " \n\t" + "pop %%"R"bp; pop %%"R"dx \n\t" "setbe %c[fail](%0) \n\t" - ".pushsection .rodata \n\t" - ".global vmx_return \n\t" - "vmx_return: " _ASM_PTR " 2b \n\t" - ".popsection" : : "c"(vmx), "d"((unsigned long)HOST_RSP), [launched]"i"(offsetof(struct vcpu_vmx, __launched)), [fail]"i"(offsetof(struct vcpu_vmx, fail)), @@ -6332,18 +6374,12 @@ static void __noclone vmx_vcpu_run(struct kvm_vcpu *vcpu) [cr2]"i"(offsetof(struct vcpu_vmx, vcpu.arch.cr2)), [wordsize]"i"(sizeof(ulong)) : "cc", "memory" + , R"ax", R"bx", R"di", R"si" #ifdef CONFIG_X86_64 - , "rax", "rbx", "rdi", "rsi" , "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15" -#else - , "eax", "ebx", "edi", "esi" #endif ); - /* MSR_IA32_DEBUGCTLMSR is zeroed on vmexit. Restore it if needed */ - if (debugctlmsr) - update_debugctlmsr(debugctlmsr); - #ifndef CONFIG_X86_64 /* * The sysexit path does not restore ds/es, so we must set them to @@ -6388,6 +6424,9 @@ static void __noclone vmx_vcpu_run(struct kvm_vcpu *vcpu) vmx_complete_interrupts(vmx); } +#undef R +#undef Q + static void vmx_free_vcpu(struct kvm_vcpu *vcpu) { struct vcpu_vmx *vmx = to_vmx(vcpu); @@ -7242,7 +7281,7 @@ static struct kvm_x86_ops vmx_x86_ops = { .vcpu_load = vmx_vcpu_load, .vcpu_put = vmx_vcpu_put, - .update_db_bp_intercept = update_exception_bitmap, + .set_guest_debug = set_guest_debug, .get_msr = vmx_get_msr, .set_msr = vmx_set_msr, .get_segment_base = vmx_get_segment_base, diff --git a/trunk/arch/x86/kvm/x86.c b/trunk/arch/x86/kvm/x86.c index 1eefebe5d727..1f09552572fa 100644 --- a/trunk/arch/x86/kvm/x86.c +++ b/trunk/arch/x86/kvm/x86.c @@ -246,14 +246,20 @@ static void drop_user_return_notifiers(void *ignore) u64 kvm_get_apic_base(struct kvm_vcpu *vcpu) { - return vcpu->arch.apic_base; + if (irqchip_in_kernel(vcpu->kvm)) + return vcpu->arch.apic_base; + else + return vcpu->arch.apic_base; } EXPORT_SYMBOL_GPL(kvm_get_apic_base); void kvm_set_apic_base(struct kvm_vcpu *vcpu, u64 data) { /* TODO: reserve bits check */ - kvm_lapic_set_base(vcpu, data); + if (irqchip_in_kernel(vcpu->kvm)) + kvm_lapic_set_base(vcpu, data); + else + vcpu->arch.apic_base = data; } EXPORT_SYMBOL_GPL(kvm_set_apic_base); @@ -692,18 +698,6 @@ unsigned long kvm_get_cr8(struct kvm_vcpu *vcpu) } EXPORT_SYMBOL_GPL(kvm_get_cr8); -static void kvm_update_dr7(struct kvm_vcpu *vcpu) -{ - unsigned long dr7; - - if (vcpu->guest_debug & KVM_GUESTDBG_USE_HW_BP) - dr7 = vcpu->arch.guest_debug_dr7; - else - dr7 = vcpu->arch.dr7; - kvm_x86_ops->set_dr7(vcpu, dr7); - vcpu->arch.switch_db_regs = (dr7 & DR7_BP_EN_MASK); -} - static int __kvm_set_dr(struct kvm_vcpu *vcpu, int dr, unsigned long val) { switch (dr) { @@ -729,7 +723,10 @@ static int __kvm_set_dr(struct kvm_vcpu *vcpu, int dr, unsigned long val) if (val & 0xffffffff00000000ULL) return -1; /* #GP */ vcpu->arch.dr7 = (val & DR7_VOLATILE) | DR7_FIXED_1; - kvm_update_dr7(vcpu); + if (!(vcpu->guest_debug & KVM_GUESTDBG_USE_HW_BP)) { + kvm_x86_ops->set_dr7(vcpu, vcpu->arch.dr7); + vcpu->arch.switch_db_regs = (val & DR7_BP_EN_MASK); + } break; } @@ -826,7 +823,7 @@ static u32 msrs_to_save[] = { static unsigned num_msrs_to_save; -static const u32 emulated_msrs[] = { +static u32 emulated_msrs[] = { MSR_IA32_TSCDEADLINE, MSR_IA32_MISC_ENABLE, MSR_IA32_MCG_STATUS, @@ -1100,7 +1097,7 @@ void kvm_write_tsc(struct kvm_vcpu *vcpu, u64 data) * For each generation, we track the original measured * nanosecond time, offset, and write, so if TSCs are in * sync, we can match exact offset, and if not, we can match - * exact software computation in compute_guest_tsc() + * exact software computaion in compute_guest_tsc() * * These values are tracked in kvm->arch.cur_xxx variables. */ @@ -1143,7 +1140,6 @@ static int kvm_guest_time_update(struct kvm_vcpu *v) unsigned long this_tsc_khz; s64 kernel_ns, max_kernel_ns; u64 tsc_timestamp; - u8 pvclock_flags; /* Keep irq disabled to prevent changes to the clock */ local_irq_save(flags); @@ -1225,14 +1221,7 @@ static int kvm_guest_time_update(struct kvm_vcpu *v) vcpu->hv_clock.system_time = kernel_ns + v->kvm->arch.kvmclock_offset; vcpu->last_kernel_ns = kernel_ns; vcpu->last_guest_tsc = tsc_timestamp; - - pvclock_flags = 0; - if (vcpu->pvclock_set_guest_stopped_request) { - pvclock_flags |= PVCLOCK_GUEST_STOPPED; - vcpu->pvclock_set_guest_stopped_request = false; - } - - vcpu->hv_clock.flags = pvclock_flags; + vcpu->hv_clock.flags = 0; /* * The interface expects us to write an even number signaling that the @@ -1515,7 +1504,7 @@ static int kvm_pv_enable_async_pf(struct kvm_vcpu *vcpu, u64 data) { gpa_t gpa = data & ~0x3f; - /* Bits 2:5 are reserved, Should be zero */ + /* Bits 2:5 are resrved, Should be zero */ if (data & 0x3c) return 1; @@ -1650,9 +1639,10 @@ int kvm_set_msr_common(struct kvm_vcpu *vcpu, u32 msr, u64 data) vcpu->arch.time_page = gfn_to_page(vcpu->kvm, data >> PAGE_SHIFT); - if (is_error_page(vcpu->arch.time_page)) + if (is_error_page(vcpu->arch.time_page)) { + kvm_release_page_clean(vcpu->arch.time_page); vcpu->arch.time_page = NULL; - + } break; } case MSR_KVM_ASYNC_PF_EN: @@ -1737,7 +1727,7 @@ int kvm_set_msr_common(struct kvm_vcpu *vcpu, u32 msr, u64 data) * Ignore all writes to this no longer documented MSR. * Writes are only relevant for old K7 processors, * all pre-dating SVM, but a recommended workaround from - * AMD for these chips. It is possible to specify the + * AMD for these chips. It is possible to speicify the * affected processor models on the command line, hence * the need to ignore the workaround. */ @@ -2187,8 +2177,6 @@ int kvm_dev_ioctl_check_extension(long ext) case KVM_CAP_GET_TSC_KHZ: case KVM_CAP_PCI_2_3: case KVM_CAP_KVMCLOCK_CTRL: - case KVM_CAP_READONLY_MEM: - case KVM_CAP_IRQFD_RESAMPLE: r = 1; break; case KVM_CAP_COALESCED_MMIO: @@ -2370,7 +2358,8 @@ static int kvm_vcpu_ioctl_get_lapic(struct kvm_vcpu *vcpu, static int kvm_vcpu_ioctl_set_lapic(struct kvm_vcpu *vcpu, struct kvm_lapic_state *s) { - kvm_apic_post_state_restore(vcpu, s); + memcpy(vcpu->arch.apic->regs, s->regs, sizeof *s); + kvm_apic_post_state_restore(vcpu); update_cr8_intercept(vcpu); return 0; @@ -2379,7 +2368,7 @@ static int kvm_vcpu_ioctl_set_lapic(struct kvm_vcpu *vcpu, static int kvm_vcpu_ioctl_interrupt(struct kvm_vcpu *vcpu, struct kvm_interrupt *irq) { - if (irq->irq < 0 || irq->irq >= KVM_NR_INTERRUPTS) + if (irq->irq < 0 || irq->irq >= 256) return -EINVAL; if (irqchip_in_kernel(vcpu->kvm)) return -ENXIO; @@ -2646,9 +2635,11 @@ static int kvm_vcpu_ioctl_x86_set_xcrs(struct kvm_vcpu *vcpu, */ static int kvm_set_guest_paused(struct kvm_vcpu *vcpu) { + struct pvclock_vcpu_time_info *src = &vcpu->arch.hv_clock; if (!vcpu->arch.time_page) return -EINVAL; - vcpu->arch.pvclock_set_guest_stopped_request = true; + src->flags |= PVCLOCK_GUEST_STOPPED; + mark_page_dirty(vcpu->kvm, vcpu->arch.time >> PAGE_SHIFT); kvm_make_request(KVM_REQ_CLOCK_UPDATE, vcpu); return 0; } @@ -3099,7 +3090,7 @@ static int kvm_vm_ioctl_reinject(struct kvm *kvm, if (!kvm->arch.vpit) return -ENXIO; mutex_lock(&kvm->arch.vpit->pit_state.lock); - kvm->arch.vpit->pit_state.reinject = control->pit_reinject; + kvm->arch.vpit->pit_state.pit_timer.reinject = control->pit_reinject; mutex_unlock(&kvm->arch.vpit->pit_state.lock); return 0; } @@ -3182,16 +3173,6 @@ int kvm_vm_ioctl_get_dirty_log(struct kvm *kvm, struct kvm_dirty_log *log) return r; } -int kvm_vm_ioctl_irq_line(struct kvm *kvm, struct kvm_irq_level *irq_event) -{ - if (!irqchip_in_kernel(kvm)) - return -ENXIO; - - irq_event->status = kvm_set_irq(kvm, KVM_USERSPACE_IRQ_SOURCE_ID, - irq_event->irq, irq_event->level); - return 0; -} - long kvm_arch_vm_ioctl(struct file *filp, unsigned int ioctl, unsigned long arg) { @@ -3298,6 +3279,29 @@ long kvm_arch_vm_ioctl(struct file *filp, create_pit_unlock: mutex_unlock(&kvm->slots_lock); break; + case KVM_IRQ_LINE_STATUS: + case KVM_IRQ_LINE: { + struct kvm_irq_level irq_event; + + r = -EFAULT; + if (copy_from_user(&irq_event, argp, sizeof irq_event)) + goto out; + r = -ENXIO; + if (irqchip_in_kernel(kvm)) { + __s32 status; + status = kvm_set_irq(kvm, KVM_USERSPACE_IRQ_SOURCE_ID, + irq_event.irq, irq_event.level); + if (ioctl == KVM_IRQ_LINE_STATUS) { + r = -EFAULT; + irq_event.status = status; + if (copy_to_user(argp, &irq_event, + sizeof irq_event)) + goto out; + } + r = 0; + } + break; + } case KVM_GET_IRQCHIP: { /* 0: PIC master, 1: PIC slave, 2: IOAPIC */ struct kvm_irqchip *chip; @@ -3685,17 +3689,20 @@ static int vcpu_mmio_gva_to_gpa(struct kvm_vcpu *vcpu, unsigned long gva, gpa_t *gpa, struct x86_exception *exception, bool write) { - u32 access = ((kvm_x86_ops->get_cpl(vcpu) == 3) ? PFERR_USER_MASK : 0) - | (write ? PFERR_WRITE_MASK : 0); + u32 access = (kvm_x86_ops->get_cpl(vcpu) == 3) ? PFERR_USER_MASK : 0; - if (vcpu_match_mmio_gva(vcpu, gva) - && !permission_fault(vcpu->arch.walk_mmu, vcpu->arch.access, access)) { + if (vcpu_match_mmio_gva(vcpu, gva) && + check_write_user_access(vcpu, write, access, + vcpu->arch.access)) { *gpa = vcpu->arch.mmio_gfn << PAGE_SHIFT | (gva & (PAGE_SIZE - 1)); trace_vcpu_match_mmio(gva, *gpa, write, false); return 1; } + if (write) + access |= PFERR_WRITE_MASK; + *gpa = vcpu->arch.walk_mmu->gva_to_gpa(vcpu, gva, access, exception); if (*gpa == UNMAPPED_GVA) @@ -3783,14 +3790,14 @@ static int write_exit_mmio(struct kvm_vcpu *vcpu, gpa_t gpa, return X86EMUL_CONTINUE; } -static const struct read_write_emulator_ops read_emultor = { +static struct read_write_emulator_ops read_emultor = { .read_write_prepare = read_prepare, .read_write_emulate = read_emulate, .read_write_mmio = vcpu_mmio_read, .read_write_exit_mmio = read_exit_mmio, }; -static const struct read_write_emulator_ops write_emultor = { +static struct read_write_emulator_ops write_emultor = { .read_write_emulate = write_emulate, .read_write_mmio = write_mmio, .read_write_exit_mmio = write_exit_mmio, @@ -3801,7 +3808,7 @@ static int emulator_read_write_onepage(unsigned long addr, void *val, unsigned int bytes, struct x86_exception *exception, struct kvm_vcpu *vcpu, - const struct read_write_emulator_ops *ops) + struct read_write_emulator_ops *ops) { gpa_t gpa; int handled, ret; @@ -3850,7 +3857,7 @@ static int emulator_read_write_onepage(unsigned long addr, void *val, int emulator_read_write(struct x86_emulate_ctxt *ctxt, unsigned long addr, void *val, unsigned int bytes, struct x86_exception *exception, - const struct read_write_emulator_ops *ops) + struct read_write_emulator_ops *ops) { struct kvm_vcpu *vcpu = emul_to_vcpu(ctxt); gpa_t gpa; @@ -3955,8 +3962,10 @@ static int emulator_cmpxchg_emulated(struct x86_emulate_ctxt *ctxt, goto emul_write; page = gfn_to_page(vcpu->kvm, gpa >> PAGE_SHIFT); - if (is_error_page(page)) + if (is_error_page(page)) { + kvm_release_page_clean(page); goto emul_write; + } kaddr = kmap_atomic(page); kaddr += offset_in_page(gpa); @@ -4323,19 +4332,7 @@ static void emulator_get_cpuid(struct x86_emulate_ctxt *ctxt, kvm_cpuid(emul_to_vcpu(ctxt), eax, ebx, ecx, edx); } -static ulong emulator_read_gpr(struct x86_emulate_ctxt *ctxt, unsigned reg) -{ - return kvm_register_read(emul_to_vcpu(ctxt), reg); -} - -static void emulator_write_gpr(struct x86_emulate_ctxt *ctxt, unsigned reg, ulong val) -{ - kvm_register_write(emul_to_vcpu(ctxt), reg, val); -} - -static const struct x86_emulate_ops emulate_ops = { - .read_gpr = emulator_read_gpr, - .write_gpr = emulator_write_gpr, +static struct x86_emulate_ops emulate_ops = { .read_std = kvm_read_guest_virt_system, .write_std = kvm_write_guest_virt_system, .fetch = kvm_fetch_guest_virt, @@ -4370,6 +4367,14 @@ static const struct x86_emulate_ops emulate_ops = { .get_cpuid = emulator_get_cpuid, }; +static void cache_all_regs(struct kvm_vcpu *vcpu) +{ + kvm_register_read(vcpu, VCPU_REGS_RAX); + kvm_register_read(vcpu, VCPU_REGS_RSP); + kvm_register_read(vcpu, VCPU_REGS_RIP); + vcpu->arch.regs_dirty = ~0; +} + static void toggle_interruptibility(struct kvm_vcpu *vcpu, u32 mask) { u32 int_shadow = kvm_x86_ops->get_interrupt_shadow(vcpu, mask); @@ -4396,10 +4401,12 @@ static void inject_emulated_exception(struct kvm_vcpu *vcpu) kvm_queue_exception(vcpu, ctxt->exception.vector); } -static void init_decode_cache(struct x86_emulate_ctxt *ctxt) +static void init_decode_cache(struct x86_emulate_ctxt *ctxt, + const unsigned long *regs) { memset(&ctxt->twobyte, 0, - (void *)&ctxt->_regs - (void *)&ctxt->twobyte); + (void *)&ctxt->regs - (void *)&ctxt->twobyte); + memcpy(ctxt->regs, regs, sizeof(ctxt->regs)); ctxt->fetch.start = 0; ctxt->fetch.end = 0; @@ -4414,6 +4421,14 @@ static void init_emulate_ctxt(struct kvm_vcpu *vcpu) struct x86_emulate_ctxt *ctxt = &vcpu->arch.emulate_ctxt; int cs_db, cs_l; + /* + * TODO: fix emulate.c to use guest_read/write_register + * instead of direct ->regs accesses, can save hundred cycles + * on Intel for instructions that don't read/change RSP, for + * for example. + */ + cache_all_regs(vcpu); + kvm_x86_ops->get_cs_db_l_bits(vcpu, &cs_db, &cs_l); ctxt->eflags = kvm_get_rflags(vcpu); @@ -4425,7 +4440,7 @@ static void init_emulate_ctxt(struct kvm_vcpu *vcpu) X86EMUL_MODE_PROT16; ctxt->guest_mode = is_guest_mode(vcpu); - init_decode_cache(ctxt); + init_decode_cache(ctxt, vcpu->arch.regs); vcpu->arch.emulate_regs_need_sync_from_vcpu = false; } @@ -4445,6 +4460,7 @@ int kvm_inject_realmode_interrupt(struct kvm_vcpu *vcpu, int irq, int inc_eip) return EMULATE_FAIL; ctxt->eip = ctxt->_eip; + memcpy(vcpu->arch.regs, ctxt->regs, sizeof ctxt->regs); kvm_rip_write(vcpu, ctxt->eip); kvm_set_rflags(vcpu, ctxt->eflags); @@ -4477,14 +4493,13 @@ static int handle_emulation_failure(struct kvm_vcpu *vcpu) static bool reexecute_instruction(struct kvm_vcpu *vcpu, gva_t gva) { gpa_t gpa; - pfn_t pfn; if (tdp_enabled) return false; /* * if emulation was due to access to shadowed page table - * and it failed try to unshadow page and re-enter the + * and it failed try to unshadow page and re-entetr the * guest to let CPU execute the instruction. */ if (kvm_mmu_unprotect_page_virt(vcpu, gva)) @@ -4495,17 +4510,8 @@ static bool reexecute_instruction(struct kvm_vcpu *vcpu, gva_t gva) if (gpa == UNMAPPED_GVA) return true; /* let cpu generate fault */ - /* - * Do not retry the unhandleable instruction if it faults on the - * readonly host memory, otherwise it will goto a infinite loop: - * retry instruction -> write #PF -> emulation fail -> retry - * instruction -> ... - */ - pfn = gfn_to_pfn(vcpu->kvm, gpa_to_gfn(gpa)); - if (!is_error_pfn(pfn)) { - kvm_release_pfn_clean(pfn); + if (!kvm_is_error_hva(gfn_to_hva(vcpu->kvm, gpa >> PAGE_SHIFT))) return true; - } return false; } @@ -4554,9 +4560,6 @@ static bool retry_instruction(struct x86_emulate_ctxt *ctxt, return true; } -static int complete_emulated_mmio(struct kvm_vcpu *vcpu); -static int complete_emulated_pio(struct kvm_vcpu *vcpu); - int x86_emulate_instruction(struct kvm_vcpu *vcpu, unsigned long cr2, int emulation_type, @@ -4605,7 +4608,7 @@ int x86_emulate_instruction(struct kvm_vcpu *vcpu, changes registers values during IO operation */ if (vcpu->arch.emulate_regs_need_sync_from_vcpu) { vcpu->arch.emulate_regs_need_sync_from_vcpu = false; - emulator_invalidate_register_cache(ctxt); + memcpy(ctxt->regs, vcpu->arch.regs, sizeof ctxt->regs); } restart: @@ -4627,16 +4630,13 @@ int x86_emulate_instruction(struct kvm_vcpu *vcpu, } else if (vcpu->arch.pio.count) { if (!vcpu->arch.pio.in) vcpu->arch.pio.count = 0; - else { + else writeback = false; - vcpu->arch.complete_userspace_io = complete_emulated_pio; - } r = EMULATE_DO_MMIO; } else if (vcpu->mmio_needed) { if (!vcpu->mmio_is_write) writeback = false; r = EMULATE_DO_MMIO; - vcpu->arch.complete_userspace_io = complete_emulated_mmio; } else if (r == EMULATION_RESTART) goto restart; else @@ -4646,6 +4646,7 @@ int x86_emulate_instruction(struct kvm_vcpu *vcpu, toggle_interruptibility(vcpu, ctxt->interruptibility); kvm_set_rflags(vcpu, ctxt->eflags); kvm_make_request(KVM_REQ_EVENT, vcpu); + memcpy(vcpu->arch.regs, ctxt->regs, sizeof ctxt->regs); vcpu->arch.emulate_regs_need_sync_to_vcpu = false; kvm_rip_write(vcpu, ctxt->eip); } else @@ -4928,7 +4929,6 @@ int kvm_arch_init(void *opaque) if (cpu_has_xsave) host_xcr0 = xgetbv(XCR_XFEATURE_ENABLED_MASK); - kvm_lapic_init(); return 0; out: @@ -5499,24 +5499,6 @@ static int __vcpu_run(struct kvm_vcpu *vcpu) return r; } -static inline int complete_emulated_io(struct kvm_vcpu *vcpu) -{ - int r; - vcpu->srcu_idx = srcu_read_lock(&vcpu->kvm->srcu); - r = emulate_instruction(vcpu, EMULTYPE_NO_DECODE); - srcu_read_unlock(&vcpu->kvm->srcu, vcpu->srcu_idx); - if (r != EMULATE_DONE) - return 0; - return 1; -} - -static int complete_emulated_pio(struct kvm_vcpu *vcpu) -{ - BUG_ON(!vcpu->arch.pio.count); - - return complete_emulated_io(vcpu); -} - /* * Implements the following, as a state machine: * @@ -5533,36 +5515,46 @@ static int complete_emulated_pio(struct kvm_vcpu *vcpu) * copy data * exit */ -static int complete_emulated_mmio(struct kvm_vcpu *vcpu) +static int complete_mmio(struct kvm_vcpu *vcpu) { struct kvm_run *run = vcpu->run; struct kvm_mmio_fragment *frag; + int r; - BUG_ON(!vcpu->mmio_needed); + if (!(vcpu->arch.pio.count || vcpu->mmio_needed)) + return 1; - /* Complete previous fragment */ - frag = &vcpu->mmio_fragments[vcpu->mmio_cur_fragment++]; - if (!vcpu->mmio_is_write) - memcpy(frag->data, run->mmio.data, frag->len); - if (vcpu->mmio_cur_fragment == vcpu->mmio_nr_fragments) { - vcpu->mmio_needed = 0; + if (vcpu->mmio_needed) { + /* Complete previous fragment */ + frag = &vcpu->mmio_fragments[vcpu->mmio_cur_fragment++]; + if (!vcpu->mmio_is_write) + memcpy(frag->data, run->mmio.data, frag->len); + if (vcpu->mmio_cur_fragment == vcpu->mmio_nr_fragments) { + vcpu->mmio_needed = 0; + if (vcpu->mmio_is_write) + return 1; + vcpu->mmio_read_completed = 1; + goto done; + } + /* Initiate next fragment */ + ++frag; + run->exit_reason = KVM_EXIT_MMIO; + run->mmio.phys_addr = frag->gpa; if (vcpu->mmio_is_write) - return 1; - vcpu->mmio_read_completed = 1; - return complete_emulated_io(vcpu); - } - /* Initiate next fragment */ - ++frag; - run->exit_reason = KVM_EXIT_MMIO; - run->mmio.phys_addr = frag->gpa; - if (vcpu->mmio_is_write) - memcpy(run->mmio.data, frag->data, frag->len); - run->mmio.len = frag->len; - run->mmio.is_write = vcpu->mmio_is_write; - vcpu->arch.complete_userspace_io = complete_emulated_mmio; - return 0; -} + memcpy(run->mmio.data, frag->data, frag->len); + run->mmio.len = frag->len; + run->mmio.is_write = vcpu->mmio_is_write; + return 0; + } +done: + vcpu->srcu_idx = srcu_read_lock(&vcpu->kvm->srcu); + r = emulate_instruction(vcpu, EMULTYPE_NO_DECODE); + srcu_read_unlock(&vcpu->kvm->srcu, vcpu->srcu_idx); + if (r != EMULATE_DONE) + return 0; + return 1; +} int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) { @@ -5590,14 +5582,9 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) } } - if (unlikely(vcpu->arch.complete_userspace_io)) { - int (*cui)(struct kvm_vcpu *) = vcpu->arch.complete_userspace_io; - vcpu->arch.complete_userspace_io = NULL; - r = cui(vcpu); - if (r <= 0) - goto out; - } else - WARN_ON(vcpu->arch.pio.count || vcpu->mmio_needed); + r = complete_mmio(vcpu); + if (r <= 0) + goto out; r = __vcpu_run(vcpu); @@ -5615,11 +5602,12 @@ int kvm_arch_vcpu_ioctl_get_regs(struct kvm_vcpu *vcpu, struct kvm_regs *regs) /* * We are here if userspace calls get_regs() in the middle of * instruction emulation. Registers state needs to be copied - * back from emulation context to vcpu. Userspace shouldn't do + * back from emulation context to vcpu. Usrapace shouldn't do * that usually, but some bad designed PV devices (vmware * backdoor interface) need this to work */ - emulator_writeback_register_cache(&vcpu->arch.emulate_ctxt); + struct x86_emulate_ctxt *ctxt = &vcpu->arch.emulate_ctxt; + memcpy(vcpu->arch.regs, ctxt->regs, sizeof ctxt->regs); vcpu->arch.emulate_regs_need_sync_to_vcpu = false; } regs->rax = kvm_register_read(vcpu, VCPU_REGS_RAX); @@ -5759,6 +5747,7 @@ int kvm_task_switch(struct kvm_vcpu *vcpu, u16 tss_selector, int idt_index, if (ret) return EMULATE_FAIL; + memcpy(vcpu->arch.regs, ctxt->regs, sizeof ctxt->regs); kvm_rip_write(vcpu, ctxt->eip); kvm_set_rflags(vcpu, ctxt->eflags); kvm_make_request(KVM_REQ_EVENT, vcpu); @@ -5810,7 +5799,7 @@ int kvm_arch_vcpu_ioctl_set_sregs(struct kvm_vcpu *vcpu, if (mmu_reset_needed) kvm_mmu_reset_context(vcpu); - max_bits = KVM_NR_INTERRUPTS; + max_bits = (sizeof sregs->interrupt_bitmap) << 3; pending_vec = find_first_bit( (const unsigned long *)sregs->interrupt_bitmap, max_bits); if (pending_vec < max_bits) { @@ -5870,12 +5859,13 @@ int kvm_arch_vcpu_ioctl_set_guest_debug(struct kvm_vcpu *vcpu, if (vcpu->guest_debug & KVM_GUESTDBG_USE_HW_BP) { for (i = 0; i < KVM_NR_DB_REGS; ++i) vcpu->arch.eff_db[i] = dbg->arch.debugreg[i]; - vcpu->arch.guest_debug_dr7 = dbg->arch.debugreg[7]; + vcpu->arch.switch_db_regs = + (dbg->arch.debugreg[7] & DR7_BP_EN_MASK); } else { for (i = 0; i < KVM_NR_DB_REGS; i++) vcpu->arch.eff_db[i] = vcpu->arch.db[i]; + vcpu->arch.switch_db_regs = (vcpu->arch.dr7 & DR7_BP_EN_MASK); } - kvm_update_dr7(vcpu); if (vcpu->guest_debug & KVM_GUESTDBG_SINGLESTEP) vcpu->arch.singlestep_rip = kvm_rip_read(vcpu) + @@ -5887,7 +5877,7 @@ int kvm_arch_vcpu_ioctl_set_guest_debug(struct kvm_vcpu *vcpu, */ kvm_set_rflags(vcpu, rflags); - kvm_x86_ops->update_db_bp_intercept(vcpu); + kvm_x86_ops->set_guest_debug(vcpu, dbg); r = 0; @@ -6033,9 +6023,7 @@ int kvm_arch_vcpu_setup(struct kvm_vcpu *vcpu) int r; vcpu->arch.mtrr_state.have_fixed = 1; - r = vcpu_load(vcpu); - if (r) - return r; + vcpu_load(vcpu); r = kvm_arch_vcpu_reset(vcpu); if (r == 0) r = kvm_mmu_setup(vcpu); @@ -6046,11 +6034,9 @@ int kvm_arch_vcpu_setup(struct kvm_vcpu *vcpu) void kvm_arch_vcpu_destroy(struct kvm_vcpu *vcpu) { - int r; vcpu->arch.apf.msr_val = 0; - r = vcpu_load(vcpu); - BUG_ON(r); + vcpu_load(vcpu); kvm_mmu_unload(vcpu); vcpu_put(vcpu); @@ -6064,10 +6050,10 @@ int kvm_arch_vcpu_reset(struct kvm_vcpu *vcpu) vcpu->arch.nmi_pending = 0; vcpu->arch.nmi_injected = false; + vcpu->arch.switch_db_regs = 0; memset(vcpu->arch.db, 0, sizeof(vcpu->arch.db)); vcpu->arch.dr6 = DR6_FIXED_1; vcpu->arch.dr7 = DR7_FIXED_1; - kvm_update_dr7(vcpu); kvm_make_request(KVM_REQ_EVENT, vcpu); vcpu->arch.apf.msr_val = 0; @@ -6146,7 +6132,7 @@ int kvm_arch_hardware_enable(void *garbage) * as we reset last_host_tsc on all VCPUs to stop this from being * called multiple times (one for each physical CPU bringup). * - * Platforms with unreliable TSCs don't have to deal with this, they + * Platforms with unnreliable TSCs don't have to deal with this, they * will be compensated by the logic in vcpu_load, which sets the TSC to * catchup mode. This will catchup all VCPUs to real time, but cannot * guarantee that they stay in perfect synchronization. @@ -6199,8 +6185,6 @@ bool kvm_vcpu_compatible(struct kvm_vcpu *vcpu) return irqchip_in_kernel(vcpu->kvm) == (vcpu->arch.apic != NULL); } -struct static_key kvm_no_apic_vcpu __read_mostly; - int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu) { struct page *page; @@ -6233,8 +6217,7 @@ int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu) r = kvm_create_lapic(vcpu); if (r < 0) goto fail_mmu_destroy; - } else - static_key_slow_inc(&kvm_no_apic_vcpu); + } vcpu->arch.mce_banks = kzalloc(KVM_MAX_MCE_BANKS * sizeof(u64) * 4, GFP_KERNEL); @@ -6274,8 +6257,6 @@ void kvm_arch_vcpu_uninit(struct kvm_vcpu *vcpu) kvm_mmu_destroy(vcpu); srcu_read_unlock(&vcpu->kvm->srcu, idx); free_page((unsigned long)vcpu->arch.pio_data); - if (!irqchip_in_kernel(vcpu->kvm)) - static_key_slow_dec(&kvm_no_apic_vcpu); } int kvm_arch_init_vm(struct kvm *kvm, unsigned long type) @@ -6288,21 +6269,15 @@ int kvm_arch_init_vm(struct kvm *kvm, unsigned long type) /* Reserve bit 0 of irq_sources_bitmap for userspace irq source */ set_bit(KVM_USERSPACE_IRQ_SOURCE_ID, &kvm->arch.irq_sources_bitmap); - /* Reserve bit 1 of irq_sources_bitmap for irqfd-resampler */ - set_bit(KVM_IRQFD_RESAMPLE_IRQ_SOURCE_ID, - &kvm->arch.irq_sources_bitmap); raw_spin_lock_init(&kvm->arch.tsc_write_lock); - mutex_init(&kvm->arch.apic_map_lock); return 0; } static void kvm_unload_vcpu_mmu(struct kvm_vcpu *vcpu) { - int r; - r = vcpu_load(vcpu); - BUG_ON(r); + vcpu_load(vcpu); kvm_mmu_unload(vcpu); vcpu_put(vcpu); } @@ -6346,7 +6321,6 @@ void kvm_arch_destroy_vm(struct kvm *kvm) put_page(kvm->arch.apic_access_page); if (kvm->arch.ept_identity_pagetable) put_page(kvm->arch.ept_identity_pagetable); - kfree(rcu_dereference_check(kvm->arch.apic_map, 1)); } void kvm_arch_free_memslot(struct kvm_memory_slot *free, @@ -6354,18 +6328,10 @@ void kvm_arch_free_memslot(struct kvm_memory_slot *free, { int i; - for (i = 0; i < KVM_NR_PAGE_SIZES; ++i) { - if (!dont || free->arch.rmap[i] != dont->arch.rmap[i]) { - kvm_kvfree(free->arch.rmap[i]); - free->arch.rmap[i] = NULL; - } - if (i == 0) - continue; - - if (!dont || free->arch.lpage_info[i - 1] != - dont->arch.lpage_info[i - 1]) { - kvm_kvfree(free->arch.lpage_info[i - 1]); - free->arch.lpage_info[i - 1] = NULL; + for (i = 0; i < KVM_NR_PAGE_SIZES - 1; ++i) { + if (!dont || free->arch.lpage_info[i] != dont->arch.lpage_info[i]) { + kvm_kvfree(free->arch.lpage_info[i]); + free->arch.lpage_info[i] = NULL; } } } @@ -6374,30 +6340,23 @@ int kvm_arch_create_memslot(struct kvm_memory_slot *slot, unsigned long npages) { int i; - for (i = 0; i < KVM_NR_PAGE_SIZES; ++i) { + for (i = 0; i < KVM_NR_PAGE_SIZES - 1; ++i) { unsigned long ugfn; int lpages; - int level = i + 1; + int level = i + 2; lpages = gfn_to_index(slot->base_gfn + npages - 1, slot->base_gfn, level) + 1; - slot->arch.rmap[i] = - kvm_kvzalloc(lpages * sizeof(*slot->arch.rmap[i])); - if (!slot->arch.rmap[i]) - goto out_free; - if (i == 0) - continue; - - slot->arch.lpage_info[i - 1] = kvm_kvzalloc(lpages * - sizeof(*slot->arch.lpage_info[i - 1])); - if (!slot->arch.lpage_info[i - 1]) + slot->arch.lpage_info[i] = + kvm_kvzalloc(lpages * sizeof(*slot->arch.lpage_info[i])); + if (!slot->arch.lpage_info[i]) goto out_free; if (slot->base_gfn & (KVM_PAGES_PER_HPAGE(level) - 1)) - slot->arch.lpage_info[i - 1][0].write_count = 1; + slot->arch.lpage_info[i][0].write_count = 1; if ((slot->base_gfn + npages) & (KVM_PAGES_PER_HPAGE(level) - 1)) - slot->arch.lpage_info[i - 1][lpages - 1].write_count = 1; + slot->arch.lpage_info[i][lpages - 1].write_count = 1; ugfn = slot->userspace_addr >> PAGE_SHIFT; /* * If the gfn and userspace address are not aligned wrt each @@ -6409,21 +6368,16 @@ int kvm_arch_create_memslot(struct kvm_memory_slot *slot, unsigned long npages) unsigned long j; for (j = 0; j < lpages; ++j) - slot->arch.lpage_info[i - 1][j].write_count = 1; + slot->arch.lpage_info[i][j].write_count = 1; } } return 0; out_free: - for (i = 0; i < KVM_NR_PAGE_SIZES; ++i) { - kvm_kvfree(slot->arch.rmap[i]); - slot->arch.rmap[i] = NULL; - if (i == 0) - continue; - - kvm_kvfree(slot->arch.lpage_info[i - 1]); - slot->arch.lpage_info[i - 1] = NULL; + for (i = 0; i < KVM_NR_PAGE_SIZES - 1; ++i) { + kvm_kvfree(slot->arch.lpage_info[i]); + slot->arch.lpage_info[i] = NULL; } return -ENOMEM; } @@ -6442,10 +6396,10 @@ int kvm_arch_prepare_memory_region(struct kvm *kvm, map_flags = MAP_SHARED | MAP_ANONYMOUS; /*To keep backward compatibility with older userspace, - *x86 needs to handle !user_alloc case. + *x86 needs to hanlde !user_alloc case. */ if (!user_alloc) { - if (npages && !old.npages) { + if (npages && !old.rmap) { unsigned long userspace_addr; userspace_addr = vm_mmap(NULL, 0, @@ -6473,7 +6427,7 @@ void kvm_arch_commit_memory_region(struct kvm *kvm, int nr_mmu_pages = 0, npages = mem->memory_size >> PAGE_SHIFT; - if (!user_alloc && !old.user_alloc && old.npages && !npages) { + if (!user_alloc && !old.user_alloc && old.rmap && !npages) { int ret; ret = vm_munmap(old.userspace_addr, @@ -6492,28 +6446,14 @@ void kvm_arch_commit_memory_region(struct kvm *kvm, kvm_mmu_change_mmu_pages(kvm, nr_mmu_pages); kvm_mmu_slot_remove_write_access(kvm, mem->slot); spin_unlock(&kvm->mmu_lock); - /* - * If memory slot is created, or moved, we need to clear all - * mmio sptes. - */ - if (npages && old.base_gfn != mem->guest_phys_addr >> PAGE_SHIFT) { - kvm_mmu_zap_all(kvm); - kvm_reload_remote_mmus(kvm); - } } -void kvm_arch_flush_shadow_all(struct kvm *kvm) +void kvm_arch_flush_shadow(struct kvm *kvm) { kvm_mmu_zap_all(kvm); kvm_reload_remote_mmus(kvm); } -void kvm_arch_flush_shadow_memslot(struct kvm *kvm, - struct kvm_memory_slot *slot) -{ - kvm_arch_flush_shadow_all(kvm); -} - int kvm_arch_vcpu_runnable(struct kvm_vcpu *vcpu) { return (vcpu->arch.mp_state == KVM_MP_STATE_RUNNABLE && diff --git a/trunk/arch/x86/kvm/x86.h b/trunk/arch/x86/kvm/x86.h index 2b5219c12ac8..3d1134ddb885 100644 --- a/trunk/arch/x86/kvm/x86.h +++ b/trunk/arch/x86/kvm/x86.h @@ -124,5 +124,4 @@ int kvm_write_guest_virt_system(struct x86_emulate_ctxt *ctxt, extern u64 host_xcr0; -extern struct static_key kvm_no_apic_vcpu; #endif diff --git a/trunk/arch/x86/lib/insn.c b/trunk/arch/x86/lib/insn.c index 54fcffed28ed..b1e6c4b2e8eb 100644 --- a/trunk/arch/x86/lib/insn.c +++ b/trunk/arch/x86/lib/insn.c @@ -18,11 +18,7 @@ * Copyright (C) IBM Corporation, 2002, 2004, 2009 */ -#ifdef __KERNEL__ #include -#else -#include -#endif #include #include diff --git a/trunk/arch/x86/syscalls/Makefile b/trunk/arch/x86/syscalls/Makefile index f325af26107c..3236aebc828d 100644 --- a/trunk/arch/x86/syscalls/Makefile +++ b/trunk/arch/x86/syscalls/Makefile @@ -1,9 +1,7 @@ out := $(obj)/../include/generated/asm -uapi := $(obj)/../include/generated/uapi/asm # Create output directory if not already present -_dummy := $(shell [ -d '$(out)' ] || mkdir -p '$(out)') \ - $(shell [ -d '$(uapi)' ] || mkdir -p '$(uapi)') +_dummy := $(shell [ -d '$(out)' ] || mkdir -p '$(out)') syscall32 := $(srctree)/$(src)/syscall_32.tbl syscall64 := $(srctree)/$(src)/syscall_64.tbl @@ -20,7 +18,7 @@ quiet_cmd_systbl = SYSTBL $@ cmd_systbl = $(CONFIG_SHELL) '$(systbl)' $< $@ syshdr_abi_unistd_32 := i386 -$(uapi)/unistd_32.h: $(syscall32) $(syshdr) +$(out)/unistd_32.h: $(syscall32) $(syshdr) $(call if_changed,syshdr) syshdr_abi_unistd_32_ia32 := i386 @@ -30,11 +28,11 @@ $(out)/unistd_32_ia32.h: $(syscall32) $(syshdr) syshdr_abi_unistd_x32 := common,x32 syshdr_offset_unistd_x32 := __X32_SYSCALL_BIT -$(uapi)/unistd_x32.h: $(syscall64) $(syshdr) +$(out)/unistd_x32.h: $(syscall64) $(syshdr) $(call if_changed,syshdr) syshdr_abi_unistd_64 := common,64 -$(uapi)/unistd_64.h: $(syscall64) $(syshdr) +$(out)/unistd_64.h: $(syscall64) $(syshdr) $(call if_changed,syshdr) syshdr_abi_unistd_64_x32 := x32 @@ -47,12 +45,11 @@ $(out)/syscalls_32.h: $(syscall32) $(systbl) $(out)/syscalls_64.h: $(syscall64) $(systbl) $(call if_changed,systbl) -uapisyshdr-y += unistd_32.h unistd_64.h unistd_x32.h +syshdr-y += unistd_32.h unistd_64.h unistd_x32.h syshdr-y += syscalls_32.h syshdr-$(CONFIG_X86_64) += unistd_32_ia32.h unistd_64_x32.h syshdr-$(CONFIG_X86_64) += syscalls_64.h -targets += $(uapisyshdr-y) $(syshdr-y) +targets += $(syshdr-y) -all: $(addprefix $(uapi)/,$(uapisyshdr-y)) -all: $(addprefix $(out)/,$(syshdr-y)) +all: $(addprefix $(out)/,$(targets)) diff --git a/trunk/arch/x86/tools/Makefile b/trunk/arch/x86/tools/Makefile index bae601f900ef..733057b435b0 100644 --- a/trunk/arch/x86/tools/Makefile +++ b/trunk/arch/x86/tools/Makefile @@ -28,7 +28,7 @@ posttest: $(obj)/test_get_len vmlinux $(obj)/insn_sanity hostprogs-y += test_get_len insn_sanity # -I needed for generated C source and C source which in the kernel tree. -HOSTCFLAGS_test_get_len.o := -Wall -I$(objtree)/arch/x86/lib/ -I$(srctree)/arch/x86/include/uapi/ -I$(srctree)/arch/x86/include/ -I$(srctree)/arch/x86/lib/ -I$(srctree)/include/uapi/ +HOSTCFLAGS_test_get_len.o := -Wall -I$(objtree)/arch/x86/lib/ -I$(srctree)/arch/x86/include/ -I$(srctree)/arch/x86/lib/ -I$(srctree)/include/ HOSTCFLAGS_insn_sanity.o := -Wall -I$(objtree)/arch/x86/lib/ -I$(srctree)/arch/x86/include/ -I$(srctree)/arch/x86/lib/ -I$(srctree)/include/ diff --git a/trunk/arch/x86/xen/apic.c b/trunk/arch/x86/xen/apic.c index 7005ced5d1ad..ec57bd3818a4 100644 --- a/trunk/arch/x86/xen/apic.c +++ b/trunk/arch/x86/xen/apic.c @@ -6,9 +6,8 @@ #include #include -#include "xen-ops.h" -static unsigned int xen_io_apic_read(unsigned apic, unsigned reg) +unsigned int xen_io_apic_read(unsigned apic, unsigned reg) { struct physdev_apic apic_op; int ret; diff --git a/trunk/arch/x86/xen/enlighten.c b/trunk/arch/x86/xen/enlighten.c index 2d932c351f91..1fbe75a95f15 100644 --- a/trunk/arch/x86/xen/enlighten.c +++ b/trunk/arch/x86/xen/enlighten.c @@ -80,8 +80,6 @@ #include "smp.h" #include "multicalls.h" -#include - EXPORT_SYMBOL_GPL(hypercall_page); DEFINE_PER_CPU(struct vcpu_info *, xen_vcpu); @@ -1290,6 +1288,7 @@ asmlinkage void __init xen_start_kernel(void) { struct physdev_set_iopl set_iopl; int rc; + pgd_t *pgd; if (!xen_start_info) return; @@ -1381,6 +1380,8 @@ asmlinkage void __init xen_start_kernel(void) acpi_numa = -1; #endif + pgd = (pgd_t *)xen_start_info->pt_base; + /* Don't do the full vcpu_info placement stuff until we have a possible map and a non-dummy shared_info. */ per_cpu(xen_vcpu, 0) = &HYPERVISOR_shared_info->vcpu_info[0]; @@ -1389,7 +1390,7 @@ asmlinkage void __init xen_start_kernel(void) early_boot_irqs_disabled = true; xen_raw_console_write("mapping kernel into physical memory\n"); - xen_setup_kernel_pagetable((pgd_t *)xen_start_info->pt_base, xen_start_info->nr_pages); + pgd = xen_setup_kernel_pagetable(pgd, xen_start_info->nr_pages); /* Allocate and initialize top and mid mfn levels for p2m structure */ xen_build_mfn_list_list(); @@ -1440,19 +1441,11 @@ asmlinkage void __init xen_start_kernel(void) const struct dom0_vga_console_info *info = (void *)((char *)xen_start_info + xen_start_info->console.dom0.info_off); - struct xen_platform_op op = { - .cmd = XENPF_firmware_info, - .interface_version = XENPF_INTERFACE_VERSION, - .u.firmware_info.type = XEN_FW_KBD_SHIFT_FLAGS, - }; xen_init_vga(info, xen_start_info->console.dom0.info_size); xen_start_info->console.domU.mfn = 0; xen_start_info->console.domU.evtchn = 0; - if (HYPERVISOR_dom0_op(&op) == 0) - boot_params.kbd_status = op.u.firmware_info.u.kbd_shift_flags; - xen_init_apic(); /* Make sure ACS will be enabled */ diff --git a/trunk/arch/x86/xen/mmu.c b/trunk/arch/x86/xen/mmu.c index 5a16824cc2b3..7a769b7526cb 100644 --- a/trunk/arch/x86/xen/mmu.c +++ b/trunk/arch/x86/xen/mmu.c @@ -84,7 +84,6 @@ */ DEFINE_SPINLOCK(xen_reservation_lock); -#ifdef CONFIG_X86_32 /* * Identity map, in addition to plain kernel map. This needs to be * large enough to allocate page table pages to allocate the rest. @@ -92,7 +91,7 @@ DEFINE_SPINLOCK(xen_reservation_lock); */ #define LEVEL1_IDENT_ENTRIES (PTRS_PER_PTE * 4) static RESERVE_BRK_ARRAY(pte_t, level1_ident_pgt, LEVEL1_IDENT_ENTRIES); -#endif + #ifdef CONFIG_X86_64 /* l3 pud for userspace vsyscall mapping */ static pud_t level3_user_vsyscall[PTRS_PER_PUD] __page_aligned_bss; @@ -1177,6 +1176,13 @@ static void xen_exit_mmap(struct mm_struct *mm) static void xen_post_allocator_init(void); +static void __init xen_pagetable_init(void) +{ + paging_init(); + xen_setup_shared_info(); + xen_post_allocator_init(); +} + static __init void xen_mapping_pagetable_reserve(u64 start, u64 end) { /* reserve the range used */ @@ -1191,87 +1197,6 @@ static __init void xen_mapping_pagetable_reserve(u64 start, u64 end) } } -#ifdef CONFIG_X86_64 -static void __init xen_cleanhighmap(unsigned long vaddr, - unsigned long vaddr_end) -{ - unsigned long kernel_end = roundup((unsigned long)_brk_end, PMD_SIZE) - 1; - pmd_t *pmd = level2_kernel_pgt + pmd_index(vaddr); - - /* NOTE: The loop is more greedy than the cleanup_highmap variant. - * We include the PMD passed in on _both_ boundaries. */ - for (; vaddr <= vaddr_end && (pmd < (level2_kernel_pgt + PAGE_SIZE)); - pmd++, vaddr += PMD_SIZE) { - if (pmd_none(*pmd)) - continue; - if (vaddr < (unsigned long) _text || vaddr > kernel_end) - set_pmd(pmd, __pmd(0)); - } - /* In case we did something silly, we should crash in this function - * instead of somewhere later and be confusing. */ - xen_mc_flush(); -} -#endif -static void __init xen_pagetable_init(void) -{ -#ifdef CONFIG_X86_64 - unsigned long size; - unsigned long addr; -#endif - paging_init(); - xen_setup_shared_info(); -#ifdef CONFIG_X86_64 - if (!xen_feature(XENFEAT_auto_translated_physmap)) { - unsigned long new_mfn_list; - - size = PAGE_ALIGN(xen_start_info->nr_pages * sizeof(unsigned long)); - - /* On 32-bit, we get zero so this never gets executed. */ - new_mfn_list = xen_revector_p2m_tree(); - if (new_mfn_list && new_mfn_list != xen_start_info->mfn_list) { - /* using __ka address and sticking INVALID_P2M_ENTRY! */ - memset((void *)xen_start_info->mfn_list, 0xff, size); - - /* We should be in __ka space. */ - BUG_ON(xen_start_info->mfn_list < __START_KERNEL_map); - addr = xen_start_info->mfn_list; - /* We roundup to the PMD, which means that if anybody at this stage is - * using the __ka address of xen_start_info or xen_start_info->shared_info - * they are in going to crash. Fortunatly we have already revectored - * in xen_setup_kernel_pagetable and in xen_setup_shared_info. */ - size = roundup(size, PMD_SIZE); - xen_cleanhighmap(addr, addr + size); - - size = PAGE_ALIGN(xen_start_info->nr_pages * sizeof(unsigned long)); - memblock_free(__pa(xen_start_info->mfn_list), size); - /* And revector! Bye bye old array */ - xen_start_info->mfn_list = new_mfn_list; - } else - goto skip; - } - /* At this stage, cleanup_highmap has already cleaned __ka space - * from _brk_limit way up to the max_pfn_mapped (which is the end of - * the ramdisk). We continue on, erasing PMD entries that point to page - * tables - do note that they are accessible at this stage via __va. - * For good measure we also round up to the PMD - which means that if - * anybody is using __ka address to the initial boot-stack - and try - * to use it - they are going to crash. The xen_start_info has been - * taken care of already in xen_setup_kernel_pagetable. */ - addr = xen_start_info->pt_base; - size = roundup(xen_start_info->nr_pt_frames * PAGE_SIZE, PMD_SIZE); - - xen_cleanhighmap(addr, addr + size); - xen_start_info->pt_base = (unsigned long)__va(__pa(xen_start_info->pt_base)); -#ifdef DEBUG - /* This is superflous and is not neccessary, but you know what - * lets do it. The MODULES_VADDR -> MODULES_END should be clear of - * anything at this stage. */ - xen_cleanhighmap(MODULES_VADDR, roundup(MODULES_VADDR, PUD_SIZE) - 1); -#endif -skip: -#endif - xen_post_allocator_init(); -} static void xen_write_cr2(unsigned long cr2) { this_cpu_read(xen_vcpu)->arch.cr2 = cr2; @@ -1727,7 +1652,7 @@ static void set_page_prot(void *addr, pgprot_t prot) if (HYPERVISOR_update_va_mapping((unsigned long)addr, pte, 0)) BUG(); } -#ifdef CONFIG_X86_32 + static void __init xen_map_identity_early(pmd_t *pmd, unsigned long max_pfn) { unsigned pmdidx, pteidx; @@ -1778,7 +1703,7 @@ static void __init xen_map_identity_early(pmd_t *pmd, unsigned long max_pfn) set_page_prot(pmd, PAGE_KERNEL_RO); } -#endif + void __init xen_setup_machphys_mapping(void) { struct xen_machphys_mapping mapping; @@ -1806,20 +1731,7 @@ static void convert_pfn_mfn(void *v) for (i = 0; i < PTRS_PER_PTE; i++) pte[i] = xen_make_pte(pte[i].pte); } -static void __init check_pt_base(unsigned long *pt_base, unsigned long *pt_end, - unsigned long addr) -{ - if (*pt_base == PFN_DOWN(__pa(addr))) { - set_page_prot((void *)addr, PAGE_KERNEL); - clear_page((void *)addr); - (*pt_base)++; - } - if (*pt_end == PFN_DOWN(__pa(addr))) { - set_page_prot((void *)addr, PAGE_KERNEL); - clear_page((void *)addr); - (*pt_end)--; - } -} + /* * Set up the initial kernel pagetable. * @@ -1831,13 +1743,11 @@ static void __init check_pt_base(unsigned long *pt_base, unsigned long *pt_end, * of the physical mapping once some sort of allocator has been set * up. */ -void __init xen_setup_kernel_pagetable(pgd_t *pgd, unsigned long max_pfn) +pgd_t * __init xen_setup_kernel_pagetable(pgd_t *pgd, + unsigned long max_pfn) { pud_t *l3; pmd_t *l2; - unsigned long addr[3]; - unsigned long pt_base, pt_end; - unsigned i; /* max_pfn_mapped is the last pfn mapped in the initial memory * mappings. Considering that on Xen after the kernel mappings we @@ -1845,53 +1755,32 @@ void __init xen_setup_kernel_pagetable(pgd_t *pgd, unsigned long max_pfn) * set max_pfn_mapped to the last real pfn mapped. */ max_pfn_mapped = PFN_DOWN(__pa(xen_start_info->mfn_list)); - pt_base = PFN_DOWN(__pa(xen_start_info->pt_base)); - pt_end = pt_base + xen_start_info->nr_pt_frames; - /* Zap identity mapping */ init_level4_pgt[0] = __pgd(0); /* Pre-constructed entries are in pfn, so convert to mfn */ - /* L4[272] -> level3_ident_pgt - * L4[511] -> level3_kernel_pgt */ convert_pfn_mfn(init_level4_pgt); - - /* L3_i[0] -> level2_ident_pgt */ convert_pfn_mfn(level3_ident_pgt); - /* L3_k[510] -> level2_kernel_pgt - * L3_i[511] -> level2_fixmap_pgt */ convert_pfn_mfn(level3_kernel_pgt); - /* We get [511][511] and have Xen's version of level2_kernel_pgt */ l3 = m2v(pgd[pgd_index(__START_KERNEL_map)].pgd); l2 = m2v(l3[pud_index(__START_KERNEL_map)].pud); - addr[0] = (unsigned long)pgd; - addr[1] = (unsigned long)l3; - addr[2] = (unsigned long)l2; - /* Graft it onto L4[272][0]. Note that we creating an aliasing problem: - * Both L4[272][0] and L4[511][511] have entries that point to the same - * L2 (PMD) tables. Meaning that if you modify it in __va space - * it will be also modified in the __ka space! (But if you just - * modify the PMD table to point to other PTE's or none, then you - * are OK - which is what cleanup_highmap does) */ - copy_page(level2_ident_pgt, l2); - /* Graft it onto L4[511][511] */ - copy_page(level2_kernel_pgt, l2); - - /* Get [511][510] and graft that in level2_fixmap_pgt */ + memcpy(level2_ident_pgt, l2, sizeof(pmd_t) * PTRS_PER_PMD); + memcpy(level2_kernel_pgt, l2, sizeof(pmd_t) * PTRS_PER_PMD); + l3 = m2v(pgd[pgd_index(__START_KERNEL_map + PMD_SIZE)].pgd); l2 = m2v(l3[pud_index(__START_KERNEL_map + PMD_SIZE)].pud); - copy_page(level2_fixmap_pgt, l2); - /* Note that we don't do anything with level1_fixmap_pgt which - * we don't need. */ + memcpy(level2_fixmap_pgt, l2, sizeof(pmd_t) * PTRS_PER_PMD); + + /* Set up identity map */ + xen_map_identity_early(level2_ident_pgt, max_pfn); /* Make pagetable pieces RO */ set_page_prot(init_level4_pgt, PAGE_KERNEL_RO); set_page_prot(level3_ident_pgt, PAGE_KERNEL_RO); set_page_prot(level3_kernel_pgt, PAGE_KERNEL_RO); set_page_prot(level3_user_vsyscall, PAGE_KERNEL_RO); - set_page_prot(level2_ident_pgt, PAGE_KERNEL_RO); set_page_prot(level2_kernel_pgt, PAGE_KERNEL_RO); set_page_prot(level2_fixmap_pgt, PAGE_KERNEL_RO); @@ -1902,28 +1791,22 @@ void __init xen_setup_kernel_pagetable(pgd_t *pgd, unsigned long max_pfn) /* Unpin Xen-provided one */ pin_pagetable_pfn(MMUEXT_UNPIN_TABLE, PFN_DOWN(__pa(pgd))); + /* Switch over */ + pgd = init_level4_pgt; + /* * At this stage there can be no user pgd, and no page * structure to attach it to, so make sure we just set kernel * pgd. */ xen_mc_batch(); - __xen_write_cr3(true, __pa(init_level4_pgt)); + __xen_write_cr3(true, __pa(pgd)); xen_mc_issue(PARAVIRT_LAZY_CPU); - /* We can't that easily rip out L3 and L2, as the Xen pagetables are - * set out this way: [L4], [L1], [L2], [L3], [L1], [L1] ... for - * the initial domain. For guests using the toolstack, they are in: - * [L4], [L3], [L2], [L1], [L1], order .. So for dom0 we can only - * rip out the [L4] (pgd), but for guests we shave off three pages. - */ - for (i = 0; i < ARRAY_SIZE(addr); i++) - check_pt_base(&pt_base, &pt_end, addr[i]); + memblock_reserve(__pa(xen_start_info->pt_base), + xen_start_info->nr_pt_frames * PAGE_SIZE); - /* Our (by three pages) smaller Xen pagetable that we are using */ - memblock_reserve(PFN_PHYS(pt_base), (pt_end - pt_base) * PAGE_SIZE); - /* Revector the xen_start_info */ - xen_start_info = (struct start_info *)__va(__pa(xen_start_info)); + return pgd; } #else /* !CONFIG_X86_64 */ static RESERVE_BRK_ARRAY(pmd_t, initial_kernel_pmd, PTRS_PER_PMD); @@ -1948,7 +1831,8 @@ static void __init xen_write_cr3_init(unsigned long cr3) */ swapper_kernel_pmd = extend_brk(sizeof(pmd_t) * PTRS_PER_PMD, PAGE_SIZE); - copy_page(swapper_kernel_pmd, initial_kernel_pmd); + memcpy(swapper_kernel_pmd, initial_kernel_pmd, + sizeof(pmd_t) * PTRS_PER_PMD); swapper_pg_dir[KERNEL_PGD_BOUNDARY] = __pgd(__pa(swapper_kernel_pmd) | _PAGE_PRESENT); set_page_prot(swapper_kernel_pmd, PAGE_KERNEL_RO); @@ -1965,7 +1849,8 @@ static void __init xen_write_cr3_init(unsigned long cr3) pv_mmu_ops.write_cr3 = &xen_write_cr3; } -void __init xen_setup_kernel_pagetable(pgd_t *pgd, unsigned long max_pfn) +pgd_t * __init xen_setup_kernel_pagetable(pgd_t *pgd, + unsigned long max_pfn) { pmd_t *kernel_pmd; @@ -1977,11 +1862,11 @@ void __init xen_setup_kernel_pagetable(pgd_t *pgd, unsigned long max_pfn) 512*1024); kernel_pmd = m2v(pgd[KERNEL_PGD_BOUNDARY].pgd); - copy_page(initial_kernel_pmd, kernel_pmd); + memcpy(initial_kernel_pmd, kernel_pmd, sizeof(pmd_t) * PTRS_PER_PMD); xen_map_identity_early(initial_kernel_pmd, max_pfn); - copy_page(initial_page_table, pgd); + memcpy(initial_page_table, pgd, sizeof(pgd_t) * PTRS_PER_PGD); initial_page_table[KERNEL_PGD_BOUNDARY] = __pgd(__pa(initial_kernel_pmd) | _PAGE_PRESENT); @@ -1997,6 +1882,8 @@ void __init xen_setup_kernel_pagetable(pgd_t *pgd, unsigned long max_pfn) memblock_reserve(__pa(xen_start_info->pt_base), xen_start_info->nr_pt_frames * PAGE_SIZE); + + return initial_page_table; } #endif /* CONFIG_X86_64 */ @@ -2446,9 +2333,6 @@ int xen_remap_domain_mfn_range(struct vm_area_struct *vma, unsigned long range; int err = 0; - if (xen_feature(XENFEAT_auto_translated_physmap)) - return -EINVAL; - prot = __pgprot(pgprot_val(prot) | _PAGE_IOMAP); BUG_ON(!((vma->vm_flags & (VM_PFNMAP | VM_RESERVED | VM_IO)) == @@ -2467,8 +2351,8 @@ int xen_remap_domain_mfn_range(struct vm_area_struct *vma, if (err) goto out; - err = HYPERVISOR_mmu_update(mmu_update, batch, NULL, domid); - if (err < 0) + err = -EFAULT; + if (HYPERVISOR_mmu_update(mmu_update, batch, NULL, domid) < 0) goto out; nr -= batch; diff --git a/trunk/arch/x86/xen/p2m.c b/trunk/arch/x86/xen/p2m.c index 95fb2aa5927e..72213da605f5 100644 --- a/trunk/arch/x86/xen/p2m.c +++ b/trunk/arch/x86/xen/p2m.c @@ -22,7 +22,7 @@ * * P2M_PER_PAGE depends on the architecture, as a mfn is always * unsigned long (8 bytes on 64-bit, 4 bytes on 32), leading to - * 512 and 1024 entries respectively. + * 512 and 1024 entries respectively. * * In short, these structures contain the Machine Frame Number (MFN) of the PFN. * @@ -139,11 +139,11 @@ * / | ~0, ~0, .... | * | \---------------/ * | - * p2m_mid_missing p2m_missing - * /-----------------\ /------------\ - * | [p2m_missing] +---->| ~0, ~0, ~0 | - * | [p2m_missing] +---->| ..., ~0 | - * \-----------------/ \------------/ + * p2m_missing p2m_missing + * /------------------\ /------------\ + * | [p2m_mid_missing]+---->| ~0, ~0, ~0 | + * | [p2m_mid_missing]+---->| ..., ~0 | + * \------------------/ \------------/ * * where ~0 is INVALID_P2M_ENTRY. IDENTITY is (PFN | IDENTITY_BIT) */ @@ -396,85 +396,7 @@ void __init xen_build_dynamic_phys_to_machine(void) m2p_override_init(); } -#ifdef CONFIG_X86_64 -#include -unsigned long __init xen_revector_p2m_tree(void) -{ - unsigned long va_start; - unsigned long va_end; - unsigned long pfn; - unsigned long pfn_free = 0; - unsigned long *mfn_list = NULL; - unsigned long size; - - va_start = xen_start_info->mfn_list; - /*We copy in increments of P2M_PER_PAGE * sizeof(unsigned long), - * so make sure it is rounded up to that */ - size = PAGE_ALIGN(xen_start_info->nr_pages * sizeof(unsigned long)); - va_end = va_start + size; - - /* If we were revectored already, don't do it again. */ - if (va_start <= __START_KERNEL_map && va_start >= __PAGE_OFFSET) - return 0; - - mfn_list = alloc_bootmem_align(size, PAGE_SIZE); - if (!mfn_list) { - pr_warn("Could not allocate space for a new P2M tree!\n"); - return xen_start_info->mfn_list; - } - /* Fill it out with INVALID_P2M_ENTRY value */ - memset(mfn_list, 0xFF, size); - - for (pfn = 0; pfn < ALIGN(MAX_DOMAIN_PAGES, P2M_PER_PAGE); pfn += P2M_PER_PAGE) { - unsigned topidx = p2m_top_index(pfn); - unsigned mididx; - unsigned long *mid_p; - - if (!p2m_top[topidx]) - continue; - - if (p2m_top[topidx] == p2m_mid_missing) - continue; - - mididx = p2m_mid_index(pfn); - mid_p = p2m_top[topidx][mididx]; - if (!mid_p) - continue; - if ((mid_p == p2m_missing) || (mid_p == p2m_identity)) - continue; - - if ((unsigned long)mid_p == INVALID_P2M_ENTRY) - continue; - - /* The old va. Rebase it on mfn_list */ - if (mid_p >= (unsigned long *)va_start && mid_p <= (unsigned long *)va_end) { - unsigned long *new; - - if (pfn_free > (size / sizeof(unsigned long))) { - WARN(1, "Only allocated for %ld pages, but we want %ld!\n", - size / sizeof(unsigned long), pfn_free); - return 0; - } - new = &mfn_list[pfn_free]; - - copy_page(new, mid_p); - p2m_top[topidx][mididx] = &mfn_list[pfn_free]; - p2m_top_mfn_p[topidx][mididx] = virt_to_mfn(&mfn_list[pfn_free]); - - pfn_free += P2M_PER_PAGE; - } - /* This should be the leafs allocated for identity from _brk. */ - } - return (unsigned long)mfn_list; - -} -#else -unsigned long __init xen_revector_p2m_tree(void) -{ - return 0; -} -#endif unsigned long get_phys_to_machine(unsigned long pfn) { unsigned topidx, mididx, idx; @@ -508,7 +430,7 @@ static void free_p2m_page(void *p) free_page((unsigned long)p); } -/* +/* * Fully allocate the p2m structure for a given pfn. We need to check * that both the top and mid levels are allocated, and make sure the * parallel mfn tree is kept in sync. We may race with other cpus, so diff --git a/trunk/arch/x86/xen/pci-swiotlb-xen.c b/trunk/arch/x86/xen/pci-swiotlb-xen.c index 969570491c39..967633ad98c4 100644 --- a/trunk/arch/x86/xen/pci-swiotlb-xen.c +++ b/trunk/arch/x86/xen/pci-swiotlb-xen.c @@ -8,14 +8,6 @@ #include #include - -#include -#ifdef CONFIG_X86_64 -#include -#include -#endif -#include - int xen_swiotlb __read_mostly; static struct dma_map_ops xen_swiotlb_dma_ops = { @@ -42,64 +34,34 @@ static struct dma_map_ops xen_swiotlb_dma_ops = { int __init pci_xen_swiotlb_detect(void) { - if (!xen_pv_domain()) - return 0; - /* If running as PV guest, either iommu=soft, or swiotlb=force will * activate this IOMMU. If running as PV privileged, activate it * irregardless. */ - if ((xen_initial_domain() || swiotlb || swiotlb_force)) + if ((xen_initial_domain() || swiotlb || swiotlb_force) && + (xen_pv_domain())) xen_swiotlb = 1; /* If we are running under Xen, we MUST disable the native SWIOTLB. * Don't worry about swiotlb_force flag activating the native, as * the 'swiotlb' flag is the only one turning it on. */ - swiotlb = 0; + if (xen_pv_domain()) + swiotlb = 0; -#ifdef CONFIG_X86_64 - /* pci_swiotlb_detect_4gb turns on native SWIOTLB if no_iommu == 0 - * (so no iommu=X command line over-writes). - * Considering that PV guests do not want the *native SWIOTLB* but - * only Xen SWIOTLB it is not useful to us so set no_iommu=1 here. - */ - if (max_pfn > MAX_DMA32_PFN) - no_iommu = 1; -#endif return xen_swiotlb; } void __init pci_xen_swiotlb_init(void) { if (xen_swiotlb) { - xen_swiotlb_init(1, true /* early */); + xen_swiotlb_init(1); dma_ops = &xen_swiotlb_dma_ops; /* Make sure ACS will be enabled */ pci_request_acs(); } } - -int pci_xen_swiotlb_init_late(void) -{ - int rc; - - if (xen_swiotlb) - return 0; - - rc = xen_swiotlb_init(1, false /* late */); - if (rc) - return rc; - - dma_ops = &xen_swiotlb_dma_ops; - /* Make sure ACS will be enabled */ - pci_request_acs(); - - return 0; -} -EXPORT_SYMBOL_GPL(pci_xen_swiotlb_init_late); - IOMMU_INIT_FINISH(pci_xen_swiotlb_detect, - NULL, + 0, pci_xen_swiotlb_init, - NULL); + 0); diff --git a/trunk/arch/x86/xen/platform-pci-unplug.c b/trunk/arch/x86/xen/platform-pci-unplug.c index 0a7852483ffe..ffcf2615640b 100644 --- a/trunk/arch/x86/xen/platform-pci-unplug.c +++ b/trunk/arch/x86/xen/platform-pci-unplug.c @@ -24,7 +24,6 @@ #include #include -#include "xen-ops.h" #define XEN_PLATFORM_ERR_MAGIC -1 #define XEN_PLATFORM_ERR_PROTOCOL -2 diff --git a/trunk/arch/x86/xen/setup.c b/trunk/arch/x86/xen/setup.c index 8971a26d21ab..e2d62d697b5d 100644 --- a/trunk/arch/x86/xen/setup.c +++ b/trunk/arch/x86/xen/setup.c @@ -432,24 +432,6 @@ char * __init xen_memory_setup(void) * - mfn_list * - xen_start_info * See comment above "struct start_info" in - * We tried to make the the memblock_reserve more selective so - * that it would be clear what region is reserved. Sadly we ran - * in the problem wherein on a 64-bit hypervisor with a 32-bit - * initial domain, the pt_base has the cr3 value which is not - * neccessarily where the pagetable starts! As Jan put it: " - * Actually, the adjustment turns out to be correct: The page - * tables for a 32-on-64 dom0 get allocated in the order "first L1", - * "first L2", "first L3", so the offset to the page table base is - * indeed 2. When reading xen/include/public/xen.h's comment - * very strictly, this is not a violation (since there nothing is said - * that the first thing in the page table space is pointed to by - * pt_base; I admit that this seems to be implied though, namely - * do I think that it is implied that the page table space is the - * range [pt_base, pt_base + nt_pt_frames), whereas that - * range here indeed is [pt_base - 2, pt_base - 2 + nt_pt_frames), - * which - without a priori knowledge - the kernel would have - * difficulty to figure out)." - so lets just fall back to the - * easy way and reserve the whole region. */ memblock_reserve(__pa(xen_start_info->mfn_list), xen_start_info->pt_base - xen_start_info->mfn_list); diff --git a/trunk/arch/x86/xen/vga.c b/trunk/arch/x86/xen/vga.c index 6722e3733f02..1cd7f4d11e29 100644 --- a/trunk/arch/x86/xen/vga.c +++ b/trunk/arch/x86/xen/vga.c @@ -35,7 +35,6 @@ void __init xen_init_vga(const struct dom0_vga_console_info *info, size_t size) info->u.text_mode_3.font_height; break; - case XEN_VGATYPE_EFI_LFB: case XEN_VGATYPE_VESA_LFB: if (size < offsetof(struct dom0_vga_console_info, u.vesa_lfb.gbl_caps)) @@ -55,12 +54,6 @@ void __init xen_init_vga(const struct dom0_vga_console_info *info, size_t size) screen_info->blue_pos = info->u.vesa_lfb.blue_pos; screen_info->rsvd_size = info->u.vesa_lfb.rsvd_size; screen_info->rsvd_pos = info->u.vesa_lfb.rsvd_pos; - - if (info->video_type == XEN_VGATYPE_EFI_LFB) { - screen_info->orig_video_isVGA = VIDEO_TYPE_EFI; - break; - } - if (size >= offsetof(struct dom0_vga_console_info, u.vesa_lfb.gbl_caps) + sizeof(info->u.vesa_lfb.gbl_caps)) diff --git a/trunk/arch/x86/xen/xen-head.S b/trunk/arch/x86/xen/xen-head.S index 7faed5869e5b..aaa7291c9259 100644 --- a/trunk/arch/x86/xen/xen-head.S +++ b/trunk/arch/x86/xen/xen-head.S @@ -28,61 +28,9 @@ ENTRY(startup_xen) __FINIT .pushsection .text - .balign PAGE_SIZE + .align PAGE_SIZE ENTRY(hypercall_page) -#define NEXT_HYPERCALL(x) \ - ENTRY(xen_hypercall_##x) \ - .skip 32 - -NEXT_HYPERCALL(set_trap_table) -NEXT_HYPERCALL(mmu_update) -NEXT_HYPERCALL(set_gdt) -NEXT_HYPERCALL(stack_switch) -NEXT_HYPERCALL(set_callbacks) -NEXT_HYPERCALL(fpu_taskswitch) -NEXT_HYPERCALL(sched_op_compat) -NEXT_HYPERCALL(platform_op) -NEXT_HYPERCALL(set_debugreg) -NEXT_HYPERCALL(get_debugreg) -NEXT_HYPERCALL(update_descriptor) -NEXT_HYPERCALL(ni) -NEXT_HYPERCALL(memory_op) -NEXT_HYPERCALL(multicall) -NEXT_HYPERCALL(update_va_mapping) -NEXT_HYPERCALL(set_timer_op) -NEXT_HYPERCALL(event_channel_op_compat) -NEXT_HYPERCALL(xen_version) -NEXT_HYPERCALL(console_io) -NEXT_HYPERCALL(physdev_op_compat) -NEXT_HYPERCALL(grant_table_op) -NEXT_HYPERCALL(vm_assist) -NEXT_HYPERCALL(update_va_mapping_otherdomain) -NEXT_HYPERCALL(iret) -NEXT_HYPERCALL(vcpu_op) -NEXT_HYPERCALL(set_segment_base) -NEXT_HYPERCALL(mmuext_op) -NEXT_HYPERCALL(xsm_op) -NEXT_HYPERCALL(nmi_op) -NEXT_HYPERCALL(sched_op) -NEXT_HYPERCALL(callback_op) -NEXT_HYPERCALL(xenoprof_op) -NEXT_HYPERCALL(event_channel_op) -NEXT_HYPERCALL(physdev_op) -NEXT_HYPERCALL(hvm_op) -NEXT_HYPERCALL(sysctl) -NEXT_HYPERCALL(domctl) -NEXT_HYPERCALL(kexec_op) -NEXT_HYPERCALL(tmem_op) /* 38 */ -ENTRY(xen_hypercall_rsvr) - .skip 320 -NEXT_HYPERCALL(mca) /* 48 */ -NEXT_HYPERCALL(arch_1) -NEXT_HYPERCALL(arch_2) -NEXT_HYPERCALL(arch_3) -NEXT_HYPERCALL(arch_4) -NEXT_HYPERCALL(arch_5) -NEXT_HYPERCALL(arch_6) - .balign PAGE_SIZE + .skip PAGE_SIZE .popsection ELFNOTE(Xen, XEN_ELFNOTE_GUEST_OS, .asciz "linux") diff --git a/trunk/arch/x86/xen/xen-ops.h b/trunk/arch/x86/xen/xen-ops.h index bb5a8105ea86..202d4c150154 100644 --- a/trunk/arch/x86/xen/xen-ops.h +++ b/trunk/arch/x86/xen/xen-ops.h @@ -27,7 +27,7 @@ void xen_setup_mfn_list_list(void); void xen_setup_shared_info(void); void xen_build_mfn_list_list(void); void xen_setup_machphys_mapping(void); -void xen_setup_kernel_pagetable(pgd_t *pgd, unsigned long max_pfn); +pgd_t *xen_setup_kernel_pagetable(pgd_t *pgd, unsigned long max_pfn); void xen_reserve_top(void); extern unsigned long xen_max_p2m_pfn; @@ -45,7 +45,6 @@ void xen_hvm_init_shared_info(void); void xen_unplug_emulated_devices(void); void __init xen_build_dynamic_phys_to_machine(void); -unsigned long __init xen_revector_p2m_tree(void); void xen_init_irq_ops(void); void xen_setup_timer(int cpu); diff --git a/trunk/arch/xtensa/include/asm/elf.h b/trunk/arch/xtensa/include/asm/elf.h index 5293312bc6a4..6e65eadaae14 100644 --- a/trunk/arch/xtensa/include/asm/elf.h +++ b/trunk/arch/xtensa/include/asm/elf.h @@ -189,8 +189,7 @@ typedef struct { #endif } elf_xtregs_t; -#define SET_PERSONALITY(ex) \ - set_personality(PER_LINUX_32BIT | (current->personality & (~PER_MASK))) +#define SET_PERSONALITY(ex) set_personality(PER_LINUX_32BIT) struct task_struct; diff --git a/trunk/arch/xtensa/include/uapi/asm/Kbuild b/trunk/arch/xtensa/include/uapi/asm/Kbuild deleted file mode 100644 index baebb3da1d44..000000000000 --- a/trunk/arch/xtensa/include/uapi/asm/Kbuild +++ /dev/null @@ -1,3 +0,0 @@ -# UAPI Header export list -include include/uapi/asm-generic/Kbuild.asm - diff --git a/trunk/crypto/842.c b/trunk/crypto/842.c deleted file mode 100644 index 65c7a89cfa09..000000000000 --- a/trunk/crypto/842.c +++ /dev/null @@ -1,182 +0,0 @@ -/* - * Cryptographic API for the 842 compression algorithm. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * Copyright (C) IBM Corporation, 2011 - * - * Authors: Robert Jennings - * Seth Jennings - */ - -#include -#include -#include -#include -#include -#include -#include - -static int nx842_uselzo; - -struct nx842_ctx { - void *nx842_wmem; /* working memory for 842/lzo */ -}; - -enum nx842_crypto_type { - NX842_CRYPTO_TYPE_842, - NX842_CRYPTO_TYPE_LZO -}; - -#define NX842_SENTINEL 0xdeadbeef - -struct nx842_crypto_header { - unsigned int sentinel; /* debug */ - enum nx842_crypto_type type; -}; - -static int nx842_init(struct crypto_tfm *tfm) -{ - struct nx842_ctx *ctx = crypto_tfm_ctx(tfm); - int wmemsize; - - wmemsize = max_t(int, nx842_get_workmem_size(), LZO1X_MEM_COMPRESS); - ctx->nx842_wmem = kmalloc(wmemsize, GFP_NOFS); - if (!ctx->nx842_wmem) - return -ENOMEM; - - return 0; -} - -static void nx842_exit(struct crypto_tfm *tfm) -{ - struct nx842_ctx *ctx = crypto_tfm_ctx(tfm); - - kfree(ctx->nx842_wmem); -} - -static void nx842_reset_uselzo(unsigned long data) -{ - nx842_uselzo = 0; -} - -static DEFINE_TIMER(failover_timer, nx842_reset_uselzo, 0, 0); - -static int nx842_crypto_compress(struct crypto_tfm *tfm, const u8 *src, - unsigned int slen, u8 *dst, unsigned int *dlen) -{ - struct nx842_ctx *ctx = crypto_tfm_ctx(tfm); - struct nx842_crypto_header *hdr; - unsigned int tmp_len = *dlen; - size_t lzodlen; /* needed for lzo */ - int err; - - *dlen = 0; - hdr = (struct nx842_crypto_header *)dst; - hdr->sentinel = NX842_SENTINEL; /* debug */ - dst += sizeof(struct nx842_crypto_header); - tmp_len -= sizeof(struct nx842_crypto_header); - lzodlen = tmp_len; - - if (likely(!nx842_uselzo)) { - err = nx842_compress(src, slen, dst, &tmp_len, ctx->nx842_wmem); - - if (likely(!err)) { - hdr->type = NX842_CRYPTO_TYPE_842; - *dlen = tmp_len + sizeof(struct nx842_crypto_header); - return 0; - } - - /* hardware failed */ - nx842_uselzo = 1; - - /* set timer to check for hardware again in 1 second */ - mod_timer(&failover_timer, jiffies + msecs_to_jiffies(1000)); - } - - /* no hardware, use lzo */ - err = lzo1x_1_compress(src, slen, dst, &lzodlen, ctx->nx842_wmem); - if (err != LZO_E_OK) - return -EINVAL; - - hdr->type = NX842_CRYPTO_TYPE_LZO; - *dlen = lzodlen + sizeof(struct nx842_crypto_header); - return 0; -} - -static int nx842_crypto_decompress(struct crypto_tfm *tfm, const u8 *src, - unsigned int slen, u8 *dst, unsigned int *dlen) -{ - struct nx842_ctx *ctx = crypto_tfm_ctx(tfm); - struct nx842_crypto_header *hdr; - unsigned int tmp_len = *dlen; - size_t lzodlen; /* needed for lzo */ - int err; - - *dlen = 0; - hdr = (struct nx842_crypto_header *)src; - - if (unlikely(hdr->sentinel != NX842_SENTINEL)) - return -EINVAL; - - src += sizeof(struct nx842_crypto_header); - slen -= sizeof(struct nx842_crypto_header); - - if (likely(hdr->type == NX842_CRYPTO_TYPE_842)) { - err = nx842_decompress(src, slen, dst, &tmp_len, - ctx->nx842_wmem); - if (err) - return -EINVAL; - *dlen = tmp_len; - } else if (hdr->type == NX842_CRYPTO_TYPE_LZO) { - lzodlen = tmp_len; - err = lzo1x_decompress_safe(src, slen, dst, &lzodlen); - if (err != LZO_E_OK) - return -EINVAL; - *dlen = lzodlen; - } else - return -EINVAL; - - return 0; -} - -static struct crypto_alg alg = { - .cra_name = "842", - .cra_flags = CRYPTO_ALG_TYPE_COMPRESS, - .cra_ctxsize = sizeof(struct nx842_ctx), - .cra_module = THIS_MODULE, - .cra_init = nx842_init, - .cra_exit = nx842_exit, - .cra_u = { .compress = { - .coa_compress = nx842_crypto_compress, - .coa_decompress = nx842_crypto_decompress } } -}; - -static int __init nx842_mod_init(void) -{ - del_timer(&failover_timer); - return crypto_register_alg(&alg); -} - -static void __exit nx842_mod_exit(void) -{ - crypto_unregister_alg(&alg); -} - -module_init(nx842_mod_init); -module_exit(nx842_mod_exit); - -MODULE_LICENSE("GPL"); -MODULE_DESCRIPTION("842 Compression Algorithm"); diff --git a/trunk/crypto/Kconfig b/trunk/crypto/Kconfig index 50402dc0ea35..94f232f96d03 100644 --- a/trunk/crypto/Kconfig +++ b/trunk/crypto/Kconfig @@ -460,15 +460,6 @@ config CRYPTO_SHA1_SPARC64 SHA-1 secure hash standard (FIPS 180-1/DFIPS 180-2) implemented using sparc64 crypto instructions, when available. -config CRYPTO_SHA1_ARM - tristate "SHA1 digest algorithm (ARM-asm)" - depends on ARM - select CRYPTO_SHA1 - select CRYPTO_HASH - help - SHA-1 secure hash standard (FIPS 180-1/DFIPS 180-2) implemented - using optimized ARM assembler. - config CRYPTO_SHA256 tristate "SHA224 and SHA256 digest algorithm" select CRYPTO_HASH @@ -618,8 +609,6 @@ config CRYPTO_AES_NI_INTEL select CRYPTO_CRYPTD select CRYPTO_ABLK_HELPER_X86 select CRYPTO_ALGAPI - select CRYPTO_LRW - select CRYPTO_XTS help Use Intel AES-NI instructions for AES algorithm. @@ -672,30 +661,6 @@ config CRYPTO_AES_SPARC64 for some popular block cipher mode is supported too, including ECB and CBC. -config CRYPTO_AES_ARM - tristate "AES cipher algorithms (ARM-asm)" - depends on ARM - select CRYPTO_ALGAPI - select CRYPTO_AES - help - Use optimized AES assembler routines for ARM platforms. - - AES cipher algorithms (FIPS-197). AES uses the Rijndael - algorithm. - - Rijndael appears to be consistently a very good performer in - both hardware and software across a wide range of computing - environments regardless of its use in feedback or non-feedback - modes. Its key setup time is excellent, and its key agility is - good. Rijndael's very low memory requirements make it very well - suited for restricted-space environments, in which it also - demonstrates excellent performance. Rijndael's operations are - among the easiest to defend against power and timing attacks. - - The AES specifies three key sizes: 128, 192 and 256 bits - - See for more information. - config CRYPTO_ANUBIS tristate "Anubis cipher algorithm" select CRYPTO_ALGAPI @@ -816,20 +781,6 @@ config CRYPTO_CAST5 The CAST5 encryption algorithm (synonymous with CAST-128) is described in RFC2144. -config CRYPTO_CAST5_AVX_X86_64 - tristate "CAST5 (CAST-128) cipher algorithm (x86_64/AVX)" - depends on X86 && 64BIT - select CRYPTO_ALGAPI - select CRYPTO_CRYPTD - select CRYPTO_ABLK_HELPER_X86 - select CRYPTO_CAST5 - help - The CAST5 encryption algorithm (synonymous with CAST-128) is - described in RFC2144. - - This module provides the Cast5 cipher algorithm that processes - sixteen blocks parallel using the AVX instruction set. - config CRYPTO_CAST6 tristate "CAST6 (CAST-256) cipher algorithm" select CRYPTO_ALGAPI @@ -837,23 +788,6 @@ config CRYPTO_CAST6 The CAST6 encryption algorithm (synonymous with CAST-256) is described in RFC2612. -config CRYPTO_CAST6_AVX_X86_64 - tristate "CAST6 (CAST-256) cipher algorithm (x86_64/AVX)" - depends on X86 && 64BIT - select CRYPTO_ALGAPI - select CRYPTO_CRYPTD - select CRYPTO_ABLK_HELPER_X86 - select CRYPTO_GLUE_HELPER_X86 - select CRYPTO_CAST6 - select CRYPTO_LRW - select CRYPTO_XTS - help - The CAST6 encryption algorithm (synonymous with CAST-256) is - described in RFC2612. - - This module provides the Cast6 cipher algorithm that processes - eight blocks parallel using the AVX instruction set. - config CRYPTO_DES tristate "DES and Triple DES EDE cipher algorithms" select CRYPTO_ALGAPI @@ -862,7 +796,6 @@ config CRYPTO_DES config CRYPTO_DES_SPARC64 tristate "DES and Triple DES EDE cipher algorithms (SPARC64)" - depends on SPARC64 select CRYPTO_ALGAPI select CRYPTO_DES help @@ -1172,15 +1105,6 @@ config CRYPTO_LZO help This is the LZO algorithm. -config CRYPTO_842 - tristate "842 compression algorithm" - depends on CRYPTO_DEV_NX_COMPRESS - # 842 uses lzo if the hardware becomes unavailable - select LZO_COMPRESS - select LZO_DECOMPRESS - help - This is the 842 algorithm. - comment "Random Number Generation" config CRYPTO_ANSI_CPRNG diff --git a/trunk/crypto/Makefile b/trunk/crypto/Makefile index a301ad2b258c..30f33d675330 100644 --- a/trunk/crypto/Makefile +++ b/trunk/crypto/Makefile @@ -68,8 +68,8 @@ obj-$(CONFIG_CRYPTO_TWOFISH_COMMON) += twofish_common.o obj-$(CONFIG_CRYPTO_SERPENT) += serpent_generic.o obj-$(CONFIG_CRYPTO_AES) += aes_generic.o obj-$(CONFIG_CRYPTO_CAMELLIA) += camellia_generic.o -obj-$(CONFIG_CRYPTO_CAST5) += cast5_generic.o -obj-$(CONFIG_CRYPTO_CAST6) += cast6_generic.o +obj-$(CONFIG_CRYPTO_CAST5) += cast5.o +obj-$(CONFIG_CRYPTO_CAST6) += cast6.o obj-$(CONFIG_CRYPTO_ARC4) += arc4.o obj-$(CONFIG_CRYPTO_TEA) += tea.o obj-$(CONFIG_CRYPTO_KHAZAD) += khazad.o @@ -82,7 +82,6 @@ obj-$(CONFIG_CRYPTO_MICHAEL_MIC) += michael_mic.o obj-$(CONFIG_CRYPTO_CRC32C) += crc32c.o obj-$(CONFIG_CRYPTO_AUTHENC) += authenc.o authencesn.o obj-$(CONFIG_CRYPTO_LZO) += lzo.o -obj-$(CONFIG_CRYPTO_842) += 842.o obj-$(CONFIG_CRYPTO_RNG2) += rng.o obj-$(CONFIG_CRYPTO_RNG2) += krng.o obj-$(CONFIG_CRYPTO_ANSI_CPRNG) += ansi_cprng.o diff --git a/trunk/crypto/aes_generic.c b/trunk/crypto/aes_generic.c index 47f2e5c71759..a68c73dae15a 100644 --- a/trunk/crypto/aes_generic.c +++ b/trunk/crypto/aes_generic.c @@ -1448,6 +1448,7 @@ static struct crypto_alg aes_alg = { .cra_ctxsize = sizeof(struct crypto_aes_ctx), .cra_alignmask = 3, .cra_module = THIS_MODULE, + .cra_list = LIST_HEAD_INIT(aes_alg.cra_list), .cra_u = { .cipher = { .cia_min_keysize = AES_MIN_KEY_SIZE, diff --git a/trunk/crypto/ansi_cprng.c b/trunk/crypto/ansi_cprng.c index c0bb3778f1ae..6ddd99e6114b 100644 --- a/trunk/crypto/ansi_cprng.c +++ b/trunk/crypto/ansi_cprng.c @@ -382,6 +382,26 @@ static int cprng_reset(struct crypto_rng *tfm, u8 *seed, unsigned int slen) return 0; } +static struct crypto_alg rng_alg = { + .cra_name = "stdrng", + .cra_driver_name = "ansi_cprng", + .cra_priority = 100, + .cra_flags = CRYPTO_ALG_TYPE_RNG, + .cra_ctxsize = sizeof(struct prng_context), + .cra_type = &crypto_rng_type, + .cra_module = THIS_MODULE, + .cra_list = LIST_HEAD_INIT(rng_alg.cra_list), + .cra_init = cprng_init, + .cra_exit = cprng_exit, + .cra_u = { + .rng = { + .rng_make_random = cprng_get_random, + .rng_reset = cprng_reset, + .seedsize = DEFAULT_PRNG_KSZ + 2*DEFAULT_BLK_SZ, + } + } +}; + #ifdef CONFIG_CRYPTO_FIPS static int fips_cprng_get_random(struct crypto_rng *tfm, u8 *rdata, unsigned int dlen) @@ -418,27 +438,8 @@ static int fips_cprng_reset(struct crypto_rng *tfm, u8 *seed, unsigned int slen) out: return rc; } -#endif -static struct crypto_alg rng_algs[] = { { - .cra_name = "stdrng", - .cra_driver_name = "ansi_cprng", - .cra_priority = 100, - .cra_flags = CRYPTO_ALG_TYPE_RNG, - .cra_ctxsize = sizeof(struct prng_context), - .cra_type = &crypto_rng_type, - .cra_module = THIS_MODULE, - .cra_init = cprng_init, - .cra_exit = cprng_exit, - .cra_u = { - .rng = { - .rng_make_random = cprng_get_random, - .rng_reset = cprng_reset, - .seedsize = DEFAULT_PRNG_KSZ + 2*DEFAULT_BLK_SZ, - } - } -#ifdef CONFIG_CRYPTO_FIPS -}, { +static struct crypto_alg fips_rng_alg = { .cra_name = "fips(ansi_cprng)", .cra_driver_name = "fips_ansi_cprng", .cra_priority = 300, @@ -446,6 +447,7 @@ static struct crypto_alg rng_algs[] = { { .cra_ctxsize = sizeof(struct prng_context), .cra_type = &crypto_rng_type, .cra_module = THIS_MODULE, + .cra_list = LIST_HEAD_INIT(rng_alg.cra_list), .cra_init = cprng_init, .cra_exit = cprng_exit, .cra_u = { @@ -455,18 +457,33 @@ static struct crypto_alg rng_algs[] = { { .seedsize = DEFAULT_PRNG_KSZ + 2*DEFAULT_BLK_SZ, } } +}; #endif -} }; /* Module initalization */ static int __init prng_mod_init(void) { - return crypto_register_algs(rng_algs, ARRAY_SIZE(rng_algs)); + int rc = 0; + + rc = crypto_register_alg(&rng_alg); +#ifdef CONFIG_CRYPTO_FIPS + if (rc) + goto out; + + rc = crypto_register_alg(&fips_rng_alg); + +out: +#endif + return rc; } static void __exit prng_mod_fini(void) { - crypto_unregister_algs(rng_algs, ARRAY_SIZE(rng_algs)); + crypto_unregister_alg(&rng_alg); +#ifdef CONFIG_CRYPTO_FIPS + crypto_unregister_alg(&fips_rng_alg); +#endif + return; } MODULE_LICENSE("GPL"); diff --git a/trunk/crypto/anubis.c b/trunk/crypto/anubis.c index 008c8a4fb67c..77530d571c96 100644 --- a/trunk/crypto/anubis.c +++ b/trunk/crypto/anubis.c @@ -678,6 +678,7 @@ static struct crypto_alg anubis_alg = { .cra_ctxsize = sizeof (struct anubis_ctx), .cra_alignmask = 3, .cra_module = THIS_MODULE, + .cra_list = LIST_HEAD_INIT(anubis_alg.cra_list), .cra_u = { .cipher = { .cia_min_keysize = ANUBIS_MIN_KEY_SIZE, .cia_max_keysize = ANUBIS_MAX_KEY_SIZE, diff --git a/trunk/crypto/blowfish_generic.c b/trunk/crypto/blowfish_generic.c index 8baf5447d35b..6f269b5cfa3b 100644 --- a/trunk/crypto/blowfish_generic.c +++ b/trunk/crypto/blowfish_generic.c @@ -115,6 +115,7 @@ static struct crypto_alg alg = { .cra_ctxsize = sizeof(struct bf_ctx), .cra_alignmask = 3, .cra_module = THIS_MODULE, + .cra_list = LIST_HEAD_INIT(alg.cra_list), .cra_u = { .cipher = { .cia_min_keysize = BF_MIN_KEY_SIZE, .cia_max_keysize = BF_MAX_KEY_SIZE, diff --git a/trunk/crypto/camellia_generic.c b/trunk/crypto/camellia_generic.c index 75efa2052305..f7aaaaf86982 100644 --- a/trunk/crypto/camellia_generic.c +++ b/trunk/crypto/camellia_generic.c @@ -1072,6 +1072,7 @@ static struct crypto_alg camellia_alg = { .cra_ctxsize = sizeof(struct camellia_ctx), .cra_alignmask = 3, .cra_module = THIS_MODULE, + .cra_list = LIST_HEAD_INIT(camellia_alg.cra_list), .cra_u = { .cipher = { .cia_min_keysize = CAMELLIA_MIN_KEY_SIZE, diff --git a/trunk/crypto/cast5_generic.c b/trunk/crypto/cast5.c similarity index 95% rename from trunk/crypto/cast5_generic.c rename to trunk/crypto/cast5.c index bc525dbd8a4b..4a230ddec877 100644 --- a/trunk/crypto/cast5_generic.c +++ b/trunk/crypto/cast5.c @@ -4,8 +4,8 @@ * Derived from GnuPG implementation of cast5. * * Major Changes. -* Complete conformance to rfc2144. -* Supports key size from 40 to 128 bits. +* Complete conformance to rfc2144. +* Supports key size from 40 to 128 bits. * * Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc. * Copyright (C) 2003 Kartikey Mahendra Bhatt . @@ -28,10 +28,19 @@ #include #include #include -#include +#define CAST5_BLOCK_SIZE 8 +#define CAST5_MIN_KEY_SIZE 5 +#define CAST5_MAX_KEY_SIZE 16 -const u32 cast5_s1[256] = { +struct cast5_ctx { + u32 Km[16]; + u8 Kr[16]; + int rr; /* rr?number of rounds = 16:number of rounds = 12; (rfc 2144) */ +}; + + +static const u32 s1[256] = { 0x30fb40d4, 0x9fa0ff0b, 0x6beccd2f, 0x3f258c7a, 0x1e213f2f, 0x9c004dd3, 0x6003e540, 0xcf9fc949, 0xbfd4af27, 0x88bbbdb5, 0xe2034090, 0x98d09675, 0x6e63a0e0, @@ -97,8 +106,7 @@ const u32 cast5_s1[256] = { 0x1a69e783, 0x02cc4843, 0xa2f7c579, 0x429ef47d, 0x427b169c, 0x5ac9f049, 0xdd8f0f00, 0x5c8165bf }; -EXPORT_SYMBOL_GPL(cast5_s1); -const u32 cast5_s2[256] = { +static const u32 s2[256] = { 0x1f201094, 0xef0ba75b, 0x69e3cf7e, 0x393f4380, 0xfe61cf7a, 0xeec5207a, 0x55889c94, 0x72fc0651, 0xada7ef79, 0x4e1d7235, 0xd55a63ce, 0xde0436ba, 0x99c430ef, @@ -164,8 +172,7 @@ const u32 cast5_s2[256] = { 0x43d79572, 0x7e6dd07c, 0x06dfdf1e, 0x6c6cc4ef, 0x7160a539, 0x73bfbe70, 0x83877605, 0x4523ecf1 }; -EXPORT_SYMBOL_GPL(cast5_s2); -const u32 cast5_s3[256] = { +static const u32 s3[256] = { 0x8defc240, 0x25fa5d9f, 0xeb903dbf, 0xe810c907, 0x47607fff, 0x369fe44b, 0x8c1fc644, 0xaececa90, 0xbeb1f9bf, 0xeefbcaea, 0xe8cf1950, 0x51df07ae, 0x920e8806, @@ -231,8 +238,7 @@ const u32 cast5_s3[256] = { 0xf7baefd5, 0x4142ed9c, 0xa4315c11, 0x83323ec5, 0xdfef4636, 0xa133c501, 0xe9d3531c, 0xee353783 }; -EXPORT_SYMBOL_GPL(cast5_s3); -const u32 cast5_s4[256] = { +static const u32 s4[256] = { 0x9db30420, 0x1fb6e9de, 0xa7be7bef, 0xd273a298, 0x4a4f7bdb, 0x64ad8c57, 0x85510443, 0xfa020ed1, 0x7e287aff, 0xe60fb663, 0x095f35a1, 0x79ebf120, 0xfd059d43, @@ -298,7 +304,6 @@ const u32 cast5_s4[256] = { 0x7ae5290c, 0x3cb9536b, 0x851e20fe, 0x9833557e, 0x13ecf0b0, 0xd3ffb372, 0x3f85c5c1, 0x0aef7ed2 }; -EXPORT_SYMBOL_GPL(cast5_s4); static const u32 s5[256] = { 0x7ec90c04, 0x2c6e74b9, 0x9b0e66df, 0xa6337911, 0xb86a7fff, 0x1dd358f5, 0x44dd9d44, 0x1731167f, @@ -564,21 +569,17 @@ static const u32 sb8[256] = { 0xeaee6801, 0x8db2a283, 0xea8bf59e }; -#define s1 cast5_s1 -#define s2 cast5_s2 -#define s3 cast5_s3 -#define s4 cast5_s4 - #define F1(D, m, r) ((I = ((m) + (D))), (I = rol32(I, (r))), \ - (((s1[I >> 24] ^ s2[(I>>16)&0xff]) - s3[(I>>8)&0xff]) + s4[I&0xff])) + (((s1[I >> 24] ^ s2[(I>>16)&0xff]) - s3[(I>>8)&0xff]) + s4[I&0xff])) #define F2(D, m, r) ((I = ((m) ^ (D))), (I = rol32(I, (r))), \ - (((s1[I >> 24] - s2[(I>>16)&0xff]) + s3[(I>>8)&0xff]) ^ s4[I&0xff])) + (((s1[I >> 24] - s2[(I>>16)&0xff]) + s3[(I>>8)&0xff]) ^ s4[I&0xff])) #define F3(D, m, r) ((I = ((m) - (D))), (I = rol32(I, (r))), \ - (((s1[I >> 24] + s2[(I>>16)&0xff]) ^ s3[(I>>8)&0xff]) - s4[I&0xff])) + (((s1[I >> 24] + s2[(I>>16)&0xff]) ^ s3[(I>>8)&0xff]) - s4[I&0xff])) -void __cast5_encrypt(struct cast5_ctx *c, u8 *outbuf, const u8 *inbuf) +static void cast5_encrypt(struct crypto_tfm *tfm, u8 *outbuf, const u8 *inbuf) { + struct cast5_ctx *c = crypto_tfm_ctx(tfm); const __be32 *src = (const __be32 *)inbuf; __be32 *dst = (__be32 *)outbuf; u32 l, r, t; @@ -627,15 +628,10 @@ void __cast5_encrypt(struct cast5_ctx *c, u8 *outbuf, const u8 *inbuf) dst[0] = cpu_to_be32(r); dst[1] = cpu_to_be32(l); } -EXPORT_SYMBOL_GPL(__cast5_encrypt); -static void cast5_encrypt(struct crypto_tfm *tfm, u8 *outbuf, const u8 *inbuf) -{ - __cast5_encrypt(crypto_tfm_ctx(tfm), outbuf, inbuf); -} - -void __cast5_decrypt(struct cast5_ctx *c, u8 *outbuf, const u8 *inbuf) +static void cast5_decrypt(struct crypto_tfm *tfm, u8 *outbuf, const u8 *inbuf) { + struct cast5_ctx *c = crypto_tfm_ctx(tfm); const __be32 *src = (const __be32 *)inbuf; __be32 *dst = (__be32 *)outbuf; u32 l, r, t; @@ -671,12 +667,6 @@ void __cast5_decrypt(struct cast5_ctx *c, u8 *outbuf, const u8 *inbuf) dst[0] = cpu_to_be32(r); dst[1] = cpu_to_be32(l); } -EXPORT_SYMBOL_GPL(__cast5_decrypt); - -static void cast5_decrypt(struct crypto_tfm *tfm, u8 *outbuf, const u8 *inbuf) -{ - __cast5_decrypt(crypto_tfm_ctx(tfm), outbuf, inbuf); -} static void key_schedule(u32 *x, u32 *z, u32 *k) { @@ -753,7 +743,7 @@ static void key_schedule(u32 *x, u32 *z, u32 *k) } -int cast5_setkey(struct crypto_tfm *tfm, const u8 *key, unsigned int key_len) +static int cast5_setkey(struct crypto_tfm *tfm, const u8 *key, unsigned key_len) { struct cast5_ctx *c = crypto_tfm_ctx(tfm); int i; @@ -781,22 +771,20 @@ int cast5_setkey(struct crypto_tfm *tfm, const u8 *key, unsigned int key_len) c->Kr[i] = k[i] & 0x1f; return 0; } -EXPORT_SYMBOL_GPL(cast5_setkey); static struct crypto_alg alg = { - .cra_name = "cast5", - .cra_driver_name = "cast5-generic", - .cra_priority = 100, - .cra_flags = CRYPTO_ALG_TYPE_CIPHER, - .cra_blocksize = CAST5_BLOCK_SIZE, - .cra_ctxsize = sizeof(struct cast5_ctx), - .cra_alignmask = 3, - .cra_module = THIS_MODULE, - .cra_u = { + .cra_name = "cast5", + .cra_flags = CRYPTO_ALG_TYPE_CIPHER, + .cra_blocksize = CAST5_BLOCK_SIZE, + .cra_ctxsize = sizeof(struct cast5_ctx), + .cra_alignmask = 3, + .cra_module = THIS_MODULE, + .cra_list = LIST_HEAD_INIT(alg.cra_list), + .cra_u = { .cipher = { .cia_min_keysize = CAST5_MIN_KEY_SIZE, .cia_max_keysize = CAST5_MAX_KEY_SIZE, - .cia_setkey = cast5_setkey, + .cia_setkey = cast5_setkey, .cia_encrypt = cast5_encrypt, .cia_decrypt = cast5_decrypt } @@ -818,4 +806,4 @@ module_exit(cast5_mod_fini); MODULE_LICENSE("GPL"); MODULE_DESCRIPTION("Cast5 Cipher Algorithm"); -MODULE_ALIAS("cast5"); + diff --git a/trunk/crypto/cast6_generic.c b/trunk/crypto/cast6.c similarity index 93% rename from trunk/crypto/cast6_generic.c rename to trunk/crypto/cast6.c index 1acd2f1c48fc..e0c15a6c7c34 100644 --- a/trunk/crypto/cast6_generic.c +++ b/trunk/crypto/cast6.c @@ -25,21 +25,24 @@ #include #include #include -#include -#define s1 cast6_s1 -#define s2 cast6_s2 -#define s3 cast6_s3 -#define s4 cast6_s4 +#define CAST6_BLOCK_SIZE 16 +#define CAST6_MIN_KEY_SIZE 16 +#define CAST6_MAX_KEY_SIZE 32 + +struct cast6_ctx { + u32 Km[12][4]; + u8 Kr[12][4]; +}; #define F1(D, r, m) ((I = ((m) + (D))), (I = rol32(I, (r))), \ - (((s1[I >> 24] ^ s2[(I>>16)&0xff]) - s3[(I>>8)&0xff]) + s4[I&0xff])) + (((s1[I >> 24] ^ s2[(I>>16)&0xff]) - s3[(I>>8)&0xff]) + s4[I&0xff])) #define F2(D, r, m) ((I = ((m) ^ (D))), (I = rol32(I, (r))), \ - (((s1[I >> 24] - s2[(I>>16)&0xff]) + s3[(I>>8)&0xff]) ^ s4[I&0xff])) + (((s1[I >> 24] - s2[(I>>16)&0xff]) + s3[(I>>8)&0xff]) ^ s4[I&0xff])) #define F3(D, r, m) ((I = ((m) - (D))), (I = rol32(I, (r))), \ - (((s1[I >> 24] + s2[(I>>16)&0xff]) ^ s3[(I>>8)&0xff]) - s4[I&0xff])) + (((s1[I >> 24] + s2[(I>>16)&0xff]) ^ s3[(I>>8)&0xff]) - s4[I&0xff])) -const u32 cast6_s1[256] = { +static const u32 s1[256] = { 0x30fb40d4, 0x9fa0ff0b, 0x6beccd2f, 0x3f258c7a, 0x1e213f2f, 0x9c004dd3, 0x6003e540, 0xcf9fc949, 0xbfd4af27, 0x88bbbdb5, 0xe2034090, 0x98d09675, 0x6e63a0e0, @@ -105,9 +108,8 @@ const u32 cast6_s1[256] = { 0x1a69e783, 0x02cc4843, 0xa2f7c579, 0x429ef47d, 0x427b169c, 0x5ac9f049, 0xdd8f0f00, 0x5c8165bf }; -EXPORT_SYMBOL_GPL(cast6_s1); -const u32 cast6_s2[256] = { +static const u32 s2[256] = { 0x1f201094, 0xef0ba75b, 0x69e3cf7e, 0x393f4380, 0xfe61cf7a, 0xeec5207a, 0x55889c94, 0x72fc0651, 0xada7ef79, 0x4e1d7235, 0xd55a63ce, 0xde0436ba, 0x99c430ef, @@ -173,9 +175,8 @@ const u32 cast6_s2[256] = { 0x43d79572, 0x7e6dd07c, 0x06dfdf1e, 0x6c6cc4ef, 0x7160a539, 0x73bfbe70, 0x83877605, 0x4523ecf1 }; -EXPORT_SYMBOL_GPL(cast6_s2); -const u32 cast6_s3[256] = { +static const u32 s3[256] = { 0x8defc240, 0x25fa5d9f, 0xeb903dbf, 0xe810c907, 0x47607fff, 0x369fe44b, 0x8c1fc644, 0xaececa90, 0xbeb1f9bf, 0xeefbcaea, 0xe8cf1950, 0x51df07ae, 0x920e8806, @@ -241,9 +242,8 @@ const u32 cast6_s3[256] = { 0xf7baefd5, 0x4142ed9c, 0xa4315c11, 0x83323ec5, 0xdfef4636, 0xa133c501, 0xe9d3531c, 0xee353783 }; -EXPORT_SYMBOL_GPL(cast6_s3); -const u32 cast6_s4[256] = { +static const u32 s4[256] = { 0x9db30420, 0x1fb6e9de, 0xa7be7bef, 0xd273a298, 0x4a4f7bdb, 0x64ad8c57, 0x85510443, 0xfa020ed1, 0x7e287aff, 0xe60fb663, 0x095f35a1, 0x79ebf120, 0xfd059d43, @@ -309,7 +309,6 @@ const u32 cast6_s4[256] = { 0x7ae5290c, 0x3cb9536b, 0x851e20fe, 0x9833557e, 0x13ecf0b0, 0xd3ffb372, 0x3f85c5c1, 0x0aef7ed2 }; -EXPORT_SYMBOL_GPL(cast6_s4); static const u32 Tm[24][8] = { { 0x5a827999, 0xc95c653a, 0x383650db, 0xa7103c7c, 0x15ea281d, @@ -370,7 +369,7 @@ static const u8 Tr[4][8] = { }; /* forward octave */ -static inline void W(u32 *key, unsigned int i) +static void W(u32 *key, unsigned int i) { u32 I; key[6] ^= F1(key[7], Tr[i % 4][0], Tm[i][0]); @@ -383,12 +382,14 @@ static inline void W(u32 *key, unsigned int i) key[7] ^= F2(key[0], Tr[i % 4][7], Tm[i][7]); } -int __cast6_setkey(struct cast6_ctx *c, const u8 *in_key, - unsigned key_len, u32 *flags) +static int cast6_setkey(struct crypto_tfm *tfm, const u8 *in_key, + unsigned key_len) { int i; u32 key[8]; __be32 p_key[8]; /* padded key */ + struct cast6_ctx *c = crypto_tfm_ctx(tfm); + u32 *flags = &tfm->crt_flags; if (key_len % 4 != 0) { *flags |= CRYPTO_TFM_RES_BAD_KEY_LEN; @@ -424,17 +425,9 @@ int __cast6_setkey(struct cast6_ctx *c, const u8 *in_key, return 0; } -EXPORT_SYMBOL_GPL(__cast6_setkey); - -int cast6_setkey(struct crypto_tfm *tfm, const u8 *key, unsigned int keylen) -{ - return __cast6_setkey(crypto_tfm_ctx(tfm), key, keylen, - &tfm->crt_flags); -} -EXPORT_SYMBOL_GPL(cast6_setkey); /*forward quad round*/ -static inline void Q(u32 *block, u8 *Kr, u32 *Km) +static void Q(u32 *block, u8 *Kr, u32 *Km) { u32 I; block[2] ^= F1(block[3], Kr[0], Km[0]); @@ -444,7 +437,7 @@ static inline void Q(u32 *block, u8 *Kr, u32 *Km) } /*reverse quad round*/ -static inline void QBAR(u32 *block, u8 *Kr, u32 *Km) +static void QBAR(u32 *block, u8 *Kr, u32 *Km) { u32 I; block[3] ^= F1(block[0], Kr[3], Km[3]); @@ -453,8 +446,9 @@ static inline void QBAR(u32 *block, u8 *Kr, u32 *Km) block[2] ^= F1(block[3], Kr[0], Km[0]); } -void __cast6_encrypt(struct cast6_ctx *c, u8 *outbuf, const u8 *inbuf) +static void cast6_encrypt(struct crypto_tfm *tfm, u8 *outbuf, const u8 *inbuf) { + struct cast6_ctx *c = crypto_tfm_ctx(tfm); const __be32 *src = (const __be32 *)inbuf; __be32 *dst = (__be32 *)outbuf; u32 block[4]; @@ -484,15 +478,10 @@ void __cast6_encrypt(struct cast6_ctx *c, u8 *outbuf, const u8 *inbuf) dst[2] = cpu_to_be32(block[2]); dst[3] = cpu_to_be32(block[3]); } -EXPORT_SYMBOL_GPL(__cast6_encrypt); -static void cast6_encrypt(struct crypto_tfm *tfm, u8 *outbuf, const u8 *inbuf) -{ - __cast6_encrypt(crypto_tfm_ctx(tfm), outbuf, inbuf); -} - -void __cast6_decrypt(struct cast6_ctx *c, u8 *outbuf, const u8 *inbuf) +static void cast6_decrypt(struct crypto_tfm *tfm, u8 *outbuf, const u8 *inbuf) { + struct cast6_ctx *c = crypto_tfm_ctx(tfm); const __be32 *src = (const __be32 *)inbuf; __be32 *dst = (__be32 *)outbuf; u32 block[4]; @@ -522,22 +511,15 @@ void __cast6_decrypt(struct cast6_ctx *c, u8 *outbuf, const u8 *inbuf) dst[2] = cpu_to_be32(block[2]); dst[3] = cpu_to_be32(block[3]); } -EXPORT_SYMBOL_GPL(__cast6_decrypt); - -static void cast6_decrypt(struct crypto_tfm *tfm, u8 *outbuf, const u8 *inbuf) -{ - __cast6_decrypt(crypto_tfm_ctx(tfm), outbuf, inbuf); -} static struct crypto_alg alg = { .cra_name = "cast6", - .cra_driver_name = "cast6-generic", - .cra_priority = 100, .cra_flags = CRYPTO_ALG_TYPE_CIPHER, .cra_blocksize = CAST6_BLOCK_SIZE, .cra_ctxsize = sizeof(struct cast6_ctx), .cra_alignmask = 3, .cra_module = THIS_MODULE, + .cra_list = LIST_HEAD_INIT(alg.cra_list), .cra_u = { .cipher = { .cia_min_keysize = CAST6_MIN_KEY_SIZE, @@ -563,4 +545,3 @@ module_exit(cast6_mod_fini); MODULE_LICENSE("GPL"); MODULE_DESCRIPTION("Cast6 Cipher Algorithm"); -MODULE_ALIAS("cast6"); diff --git a/trunk/crypto/crypto_null.c b/trunk/crypto/crypto_null.c index fee7265cd35d..07a8a96d46fc 100644 --- a/trunk/crypto/crypto_null.c +++ b/trunk/crypto/crypto_null.c @@ -94,6 +94,18 @@ static int skcipher_null_crypt(struct blkcipher_desc *desc, return err; } +static struct crypto_alg compress_null = { + .cra_name = "compress_null", + .cra_flags = CRYPTO_ALG_TYPE_COMPRESS, + .cra_blocksize = NULL_BLOCK_SIZE, + .cra_ctxsize = 0, + .cra_module = THIS_MODULE, + .cra_list = LIST_HEAD_INIT(compress_null.cra_list), + .cra_u = { .compress = { + .coa_compress = null_compress, + .coa_decompress = null_compress } } +}; + static struct shash_alg digest_null = { .digestsize = NULL_DIGEST_SIZE, .setkey = null_hash_setkey, @@ -110,19 +122,22 @@ static struct shash_alg digest_null = { } }; -static struct crypto_alg null_algs[3] = { { +static struct crypto_alg cipher_null = { .cra_name = "cipher_null", .cra_flags = CRYPTO_ALG_TYPE_CIPHER, .cra_blocksize = NULL_BLOCK_SIZE, .cra_ctxsize = 0, .cra_module = THIS_MODULE, + .cra_list = LIST_HEAD_INIT(cipher_null.cra_list), .cra_u = { .cipher = { .cia_min_keysize = NULL_KEY_SIZE, .cia_max_keysize = NULL_KEY_SIZE, .cia_setkey = null_setkey, .cia_encrypt = null_crypt, .cia_decrypt = null_crypt } } -}, { +}; + +static struct crypto_alg skcipher_null = { .cra_name = "ecb(cipher_null)", .cra_driver_name = "ecb-cipher_null", .cra_priority = 100, @@ -131,6 +146,7 @@ static struct crypto_alg null_algs[3] = { { .cra_type = &crypto_blkcipher_type, .cra_ctxsize = 0, .cra_module = THIS_MODULE, + .cra_list = LIST_HEAD_INIT(skcipher_null.cra_list), .cra_u = { .blkcipher = { .min_keysize = NULL_KEY_SIZE, .max_keysize = NULL_KEY_SIZE, @@ -138,16 +154,7 @@ static struct crypto_alg null_algs[3] = { { .setkey = null_setkey, .encrypt = skcipher_null_crypt, .decrypt = skcipher_null_crypt } } -}, { - .cra_name = "compress_null", - .cra_flags = CRYPTO_ALG_TYPE_COMPRESS, - .cra_blocksize = NULL_BLOCK_SIZE, - .cra_ctxsize = 0, - .cra_module = THIS_MODULE, - .cra_u = { .compress = { - .coa_compress = null_compress, - .coa_decompress = null_compress } } -} }; +}; MODULE_ALIAS("compress_null"); MODULE_ALIAS("digest_null"); @@ -157,26 +164,40 @@ static int __init crypto_null_mod_init(void) { int ret = 0; - ret = crypto_register_algs(null_algs, ARRAY_SIZE(null_algs)); + ret = crypto_register_alg(&cipher_null); if (ret < 0) goto out; + ret = crypto_register_alg(&skcipher_null); + if (ret < 0) + goto out_unregister_cipher; + ret = crypto_register_shash(&digest_null); if (ret < 0) - goto out_unregister_algs; + goto out_unregister_skcipher; - return 0; + ret = crypto_register_alg(&compress_null); + if (ret < 0) + goto out_unregister_digest; -out_unregister_algs: - crypto_unregister_algs(null_algs, ARRAY_SIZE(null_algs)); out: return ret; + +out_unregister_digest: + crypto_unregister_shash(&digest_null); +out_unregister_skcipher: + crypto_unregister_alg(&skcipher_null); +out_unregister_cipher: + crypto_unregister_alg(&cipher_null); + goto out; } static void __exit crypto_null_mod_fini(void) { + crypto_unregister_alg(&compress_null); crypto_unregister_shash(&digest_null); - crypto_unregister_algs(null_algs, ARRAY_SIZE(null_algs)); + crypto_unregister_alg(&skcipher_null); + crypto_unregister_alg(&cipher_null); } module_init(crypto_null_mod_init); diff --git a/trunk/crypto/crypto_user.c b/trunk/crypto/crypto_user.c index 35d700a97d79..6bba414d0c61 100644 --- a/trunk/crypto/crypto_user.c +++ b/trunk/crypto/crypto_user.c @@ -30,7 +30,7 @@ #include "internal.h" -static DEFINE_MUTEX(crypto_cfg_mutex); +DEFINE_MUTEX(crypto_cfg_mutex); /* The crypto netlink socket */ static struct sock *crypto_nlsk; diff --git a/trunk/crypto/deflate.c b/trunk/crypto/deflate.c index b57d70eb156b..b0165ecad0c5 100644 --- a/trunk/crypto/deflate.c +++ b/trunk/crypto/deflate.c @@ -199,6 +199,7 @@ static struct crypto_alg alg = { .cra_flags = CRYPTO_ALG_TYPE_COMPRESS, .cra_ctxsize = sizeof(struct deflate_ctx), .cra_module = THIS_MODULE, + .cra_list = LIST_HEAD_INIT(alg.cra_list), .cra_init = deflate_init, .cra_exit = deflate_exit, .cra_u = { .compress = { diff --git a/trunk/crypto/des_generic.c b/trunk/crypto/des_generic.c index f6cf63f88468..873818d48e86 100644 --- a/trunk/crypto/des_generic.c +++ b/trunk/crypto/des_generic.c @@ -943,44 +943,59 @@ static void des3_ede_decrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src) d[1] = cpu_to_le32(L); } -static struct crypto_alg des_algs[2] = { { +static struct crypto_alg des_alg = { .cra_name = "des", .cra_flags = CRYPTO_ALG_TYPE_CIPHER, .cra_blocksize = DES_BLOCK_SIZE, .cra_ctxsize = sizeof(struct des_ctx), .cra_module = THIS_MODULE, .cra_alignmask = 3, + .cra_list = LIST_HEAD_INIT(des_alg.cra_list), .cra_u = { .cipher = { .cia_min_keysize = DES_KEY_SIZE, .cia_max_keysize = DES_KEY_SIZE, .cia_setkey = des_setkey, .cia_encrypt = des_encrypt, .cia_decrypt = des_decrypt } } -}, { +}; + +static struct crypto_alg des3_ede_alg = { .cra_name = "des3_ede", .cra_flags = CRYPTO_ALG_TYPE_CIPHER, .cra_blocksize = DES3_EDE_BLOCK_SIZE, .cra_ctxsize = sizeof(struct des3_ede_ctx), .cra_module = THIS_MODULE, .cra_alignmask = 3, + .cra_list = LIST_HEAD_INIT(des3_ede_alg.cra_list), .cra_u = { .cipher = { .cia_min_keysize = DES3_EDE_KEY_SIZE, .cia_max_keysize = DES3_EDE_KEY_SIZE, .cia_setkey = des3_ede_setkey, .cia_encrypt = des3_ede_encrypt, .cia_decrypt = des3_ede_decrypt } } -} }; +}; MODULE_ALIAS("des3_ede"); static int __init des_generic_mod_init(void) { - return crypto_register_algs(des_algs, ARRAY_SIZE(des_algs)); + int ret = 0; + + ret = crypto_register_alg(&des_alg); + if (ret < 0) + goto out; + + ret = crypto_register_alg(&des3_ede_alg); + if (ret < 0) + crypto_unregister_alg(&des_alg); +out: + return ret; } static void __exit des_generic_mod_fini(void) { - crypto_unregister_algs(des_algs, ARRAY_SIZE(des_algs)); + crypto_unregister_alg(&des3_ede_alg); + crypto_unregister_alg(&des_alg); } module_init(des_generic_mod_init); diff --git a/trunk/crypto/fcrypt.c b/trunk/crypto/fcrypt.c index 3b2cf569c684..c33107e340b6 100644 --- a/trunk/crypto/fcrypt.c +++ b/trunk/crypto/fcrypt.c @@ -396,6 +396,7 @@ static struct crypto_alg fcrypt_alg = { .cra_ctxsize = sizeof(struct fcrypt_ctx), .cra_module = THIS_MODULE, .cra_alignmask = 3, + .cra_list = LIST_HEAD_INIT(fcrypt_alg.cra_list), .cra_u = { .cipher = { .cia_min_keysize = 8, .cia_max_keysize = 8, diff --git a/trunk/crypto/ghash-generic.c b/trunk/crypto/ghash-generic.c index 9d3f0c69a86f..7835b8fc94db 100644 --- a/trunk/crypto/ghash-generic.c +++ b/trunk/crypto/ghash-generic.c @@ -153,6 +153,7 @@ static struct shash_alg ghash_alg = { .cra_blocksize = GHASH_BLOCK_SIZE, .cra_ctxsize = sizeof(struct ghash_ctx), .cra_module = THIS_MODULE, + .cra_list = LIST_HEAD_INIT(ghash_alg.base.cra_list), .cra_exit = ghash_exit_tfm, }, }; diff --git a/trunk/crypto/khazad.c b/trunk/crypto/khazad.c index 60e7cd66facc..527e4e395fc3 100644 --- a/trunk/crypto/khazad.c +++ b/trunk/crypto/khazad.c @@ -853,6 +853,7 @@ static struct crypto_alg khazad_alg = { .cra_ctxsize = sizeof (struct khazad_ctx), .cra_alignmask = 7, .cra_module = THIS_MODULE, + .cra_list = LIST_HEAD_INIT(khazad_alg.cra_list), .cra_u = { .cipher = { .cia_min_keysize = KHAZAD_KEY_SIZE, .cia_max_keysize = KHAZAD_KEY_SIZE, diff --git a/trunk/crypto/krng.c b/trunk/crypto/krng.c index a2d2b72fc135..4328bb3430ed 100644 --- a/trunk/crypto/krng.c +++ b/trunk/crypto/krng.c @@ -35,6 +35,7 @@ static struct crypto_alg krng_alg = { .cra_ctxsize = 0, .cra_type = &crypto_rng_type, .cra_module = THIS_MODULE, + .cra_list = LIST_HEAD_INIT(krng_alg.cra_list), .cra_u = { .rng = { .rng_make_random = krng_get_random, diff --git a/trunk/crypto/lzo.c b/trunk/crypto/lzo.c index 1c2aa69c54b8..b5e77077d751 100644 --- a/trunk/crypto/lzo.c +++ b/trunk/crypto/lzo.c @@ -81,6 +81,7 @@ static struct crypto_alg alg = { .cra_flags = CRYPTO_ALG_TYPE_COMPRESS, .cra_ctxsize = sizeof(struct lzo_ctx), .cra_module = THIS_MODULE, + .cra_list = LIST_HEAD_INIT(alg.cra_list), .cra_init = lzo_init, .cra_exit = lzo_exit, .cra_u = { .compress = { diff --git a/trunk/crypto/salsa20_generic.c b/trunk/crypto/salsa20_generic.c index 9a4770c02284..eac10c11685c 100644 --- a/trunk/crypto/salsa20_generic.c +++ b/trunk/crypto/salsa20_generic.c @@ -221,6 +221,7 @@ static struct crypto_alg alg = { .cra_ctxsize = sizeof(struct salsa20_ctx), .cra_alignmask = 3, .cra_module = THIS_MODULE, + .cra_list = LIST_HEAD_INIT(alg.cra_list), .cra_u = { .blkcipher = { .setkey = setkey, diff --git a/trunk/crypto/seed.c b/trunk/crypto/seed.c index 9c904d6d2151..d3e422f60556 100644 --- a/trunk/crypto/seed.c +++ b/trunk/crypto/seed.c @@ -449,6 +449,7 @@ static struct crypto_alg seed_alg = { .cra_ctxsize = sizeof(struct seed_ctx), .cra_alignmask = 3, .cra_module = THIS_MODULE, + .cra_list = LIST_HEAD_INIT(seed_alg.cra_list), .cra_u = { .cipher = { .cia_min_keysize = SEED_KEY_SIZE, diff --git a/trunk/crypto/serpent_generic.c b/trunk/crypto/serpent_generic.c index 7ddbd7e88859..8f32cf35e5ce 100644 --- a/trunk/crypto/serpent_generic.c +++ b/trunk/crypto/serpent_generic.c @@ -567,6 +567,24 @@ static void serpent_decrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src) __serpent_decrypt(ctx, dst, src); } +static struct crypto_alg serpent_alg = { + .cra_name = "serpent", + .cra_driver_name = "serpent-generic", + .cra_priority = 100, + .cra_flags = CRYPTO_ALG_TYPE_CIPHER, + .cra_blocksize = SERPENT_BLOCK_SIZE, + .cra_ctxsize = sizeof(struct serpent_ctx), + .cra_alignmask = 3, + .cra_module = THIS_MODULE, + .cra_list = LIST_HEAD_INIT(serpent_alg.cra_list), + .cra_u = { .cipher = { + .cia_min_keysize = SERPENT_MIN_KEY_SIZE, + .cia_max_keysize = SERPENT_MAX_KEY_SIZE, + .cia_setkey = serpent_setkey, + .cia_encrypt = serpent_encrypt, + .cia_decrypt = serpent_decrypt } } +}; + static int tnepres_setkey(struct crypto_tfm *tfm, const u8 *key, unsigned int keylen) { @@ -619,44 +637,41 @@ static void tnepres_decrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src) d[3] = swab32(rd[0]); } -static struct crypto_alg srp_algs[2] = { { - .cra_name = "serpent", - .cra_driver_name = "serpent-generic", - .cra_priority = 100, - .cra_flags = CRYPTO_ALG_TYPE_CIPHER, - .cra_blocksize = SERPENT_BLOCK_SIZE, - .cra_ctxsize = sizeof(struct serpent_ctx), - .cra_alignmask = 3, - .cra_module = THIS_MODULE, - .cra_u = { .cipher = { - .cia_min_keysize = SERPENT_MIN_KEY_SIZE, - .cia_max_keysize = SERPENT_MAX_KEY_SIZE, - .cia_setkey = serpent_setkey, - .cia_encrypt = serpent_encrypt, - .cia_decrypt = serpent_decrypt } } -}, { +static struct crypto_alg tnepres_alg = { .cra_name = "tnepres", .cra_flags = CRYPTO_ALG_TYPE_CIPHER, .cra_blocksize = SERPENT_BLOCK_SIZE, .cra_ctxsize = sizeof(struct serpent_ctx), .cra_alignmask = 3, .cra_module = THIS_MODULE, + .cra_list = LIST_HEAD_INIT(serpent_alg.cra_list), .cra_u = { .cipher = { .cia_min_keysize = SERPENT_MIN_KEY_SIZE, .cia_max_keysize = SERPENT_MAX_KEY_SIZE, .cia_setkey = tnepres_setkey, .cia_encrypt = tnepres_encrypt, .cia_decrypt = tnepres_decrypt } } -} }; +}; static int __init serpent_mod_init(void) { - return crypto_register_algs(srp_algs, ARRAY_SIZE(srp_algs)); + int ret = crypto_register_alg(&serpent_alg); + + if (ret) + return ret; + + ret = crypto_register_alg(&tnepres_alg); + + if (ret) + crypto_unregister_alg(&serpent_alg); + + return ret; } static void __exit serpent_mod_fini(void) { - crypto_unregister_algs(srp_algs, ARRAY_SIZE(srp_algs)); + crypto_unregister_alg(&tnepres_alg); + crypto_unregister_alg(&serpent_alg); } module_init(serpent_mod_init); diff --git a/trunk/crypto/sha256_generic.c b/trunk/crypto/sha256_generic.c index c3ed4ec924e1..c48459ebf05b 100644 --- a/trunk/crypto/sha256_generic.c +++ b/trunk/crypto/sha256_generic.c @@ -336,7 +336,7 @@ static int sha256_import(struct shash_desc *desc, const void *in) return 0; } -static struct shash_alg sha256_algs[2] = { { +static struct shash_alg sha256 = { .digestsize = SHA256_DIGEST_SIZE, .init = sha256_init, .update = sha256_update, @@ -352,7 +352,9 @@ static struct shash_alg sha256_algs[2] = { { .cra_blocksize = SHA256_BLOCK_SIZE, .cra_module = THIS_MODULE, } -}, { +}; + +static struct shash_alg sha224 = { .digestsize = SHA224_DIGEST_SIZE, .init = sha224_init, .update = sha256_update, @@ -365,16 +367,29 @@ static struct shash_alg sha256_algs[2] = { { .cra_blocksize = SHA224_BLOCK_SIZE, .cra_module = THIS_MODULE, } -} }; +}; static int __init sha256_generic_mod_init(void) { - return crypto_register_shashes(sha256_algs, ARRAY_SIZE(sha256_algs)); + int ret = 0; + + ret = crypto_register_shash(&sha224); + + if (ret < 0) + return ret; + + ret = crypto_register_shash(&sha256); + + if (ret < 0) + crypto_unregister_shash(&sha224); + + return ret; } static void __exit sha256_generic_mod_fini(void) { - crypto_unregister_shashes(sha256_algs, ARRAY_SIZE(sha256_algs)); + crypto_unregister_shash(&sha224); + crypto_unregister_shash(&sha256); } module_init(sha256_generic_mod_init); diff --git a/trunk/crypto/sha512_generic.c b/trunk/crypto/sha512_generic.c index 71fcf361102d..dd30f40af9f5 100644 --- a/trunk/crypto/sha512_generic.c +++ b/trunk/crypto/sha512_generic.c @@ -242,7 +242,7 @@ static int sha384_final(struct shash_desc *desc, u8 *hash) return 0; } -static struct shash_alg sha512_algs[2] = { { +static struct shash_alg sha512 = { .digestsize = SHA512_DIGEST_SIZE, .init = sha512_init, .update = sha512_update, @@ -254,7 +254,9 @@ static struct shash_alg sha512_algs[2] = { { .cra_blocksize = SHA512_BLOCK_SIZE, .cra_module = THIS_MODULE, } -}, { +}; + +static struct shash_alg sha384 = { .digestsize = SHA384_DIGEST_SIZE, .init = sha384_init, .update = sha512_update, @@ -266,16 +268,24 @@ static struct shash_alg sha512_algs[2] = { { .cra_blocksize = SHA384_BLOCK_SIZE, .cra_module = THIS_MODULE, } -} }; +}; static int __init sha512_generic_mod_init(void) { - return crypto_register_shashes(sha512_algs, ARRAY_SIZE(sha512_algs)); + int ret = 0; + + if ((ret = crypto_register_shash(&sha384)) < 0) + goto out; + if ((ret = crypto_register_shash(&sha512)) < 0) + crypto_unregister_shash(&sha384); +out: + return ret; } static void __exit sha512_generic_mod_fini(void) { - crypto_unregister_shashes(sha512_algs, ARRAY_SIZE(sha512_algs)); + crypto_unregister_shash(&sha384); + crypto_unregister_shash(&sha512); } module_init(sha512_generic_mod_init); diff --git a/trunk/crypto/shash.c b/trunk/crypto/shash.c index f426330f1017..32067f47e6c7 100644 --- a/trunk/crypto/shash.c +++ b/trunk/crypto/shash.c @@ -629,42 +629,6 @@ int crypto_unregister_shash(struct shash_alg *alg) } EXPORT_SYMBOL_GPL(crypto_unregister_shash); -int crypto_register_shashes(struct shash_alg *algs, int count) -{ - int i, ret; - - for (i = 0; i < count; i++) { - ret = crypto_register_shash(&algs[i]); - if (ret) - goto err; - } - - return 0; - -err: - for (--i; i >= 0; --i) - crypto_unregister_shash(&algs[i]); - - return ret; -} -EXPORT_SYMBOL_GPL(crypto_register_shashes); - -int crypto_unregister_shashes(struct shash_alg *algs, int count) -{ - int i, ret; - - for (i = count - 1; i >= 0; --i) { - ret = crypto_unregister_shash(&algs[i]); - if (ret) - pr_err("Failed to unregister %s %s: %d\n", - algs[i].base.cra_driver_name, - algs[i].base.cra_name, ret); - } - - return 0; -} -EXPORT_SYMBOL_GPL(crypto_unregister_shashes); - int shash_register_instance(struct crypto_template *tmpl, struct shash_instance *inst) { diff --git a/trunk/crypto/tcrypt.c b/trunk/crypto/tcrypt.c index e87fa60f5831..5cf2ccb1540c 100644 --- a/trunk/crypto/tcrypt.c +++ b/trunk/crypto/tcrypt.c @@ -97,6 +97,7 @@ static int test_cipher_cycles(struct blkcipher_desc *desc, int enc, int ret = 0; int i; + local_bh_disable(); local_irq_disable(); /* Warm-up run. */ @@ -129,6 +130,7 @@ static int test_cipher_cycles(struct blkcipher_desc *desc, int enc, out: local_irq_enable(); + local_bh_enable(); if (ret == 0) printk("1 operation in %lu cycles (%d bytes)\n", @@ -298,6 +300,7 @@ static int test_hash_cycles_digest(struct hash_desc *desc, int i; int ret; + local_bh_disable(); local_irq_disable(); /* Warm-up run. */ @@ -324,6 +327,7 @@ static int test_hash_cycles_digest(struct hash_desc *desc, out: local_irq_enable(); + local_bh_enable(); if (ret) return ret; @@ -344,6 +348,7 @@ static int test_hash_cycles(struct hash_desc *desc, struct scatterlist *sg, if (plen == blen) return test_hash_cycles_digest(desc, sg, blen, out); + local_bh_disable(); local_irq_disable(); /* Warm-up run. */ @@ -386,6 +391,7 @@ static int test_hash_cycles(struct hash_desc *desc, struct scatterlist *sg, out: local_irq_enable(); + local_bh_enable(); if (ret) return ret; @@ -1031,16 +1037,10 @@ static int do_test(int m) case 14: ret += tcrypt_test("ecb(cast5)"); - ret += tcrypt_test("cbc(cast5)"); - ret += tcrypt_test("ctr(cast5)"); break; case 15: ret += tcrypt_test("ecb(cast6)"); - ret += tcrypt_test("cbc(cast6)"); - ret += tcrypt_test("ctr(cast6)"); - ret += tcrypt_test("lrw(cast6)"); - ret += tcrypt_test("xts(cast6)"); break; case 16: @@ -1112,9 +1112,6 @@ static int do_test(int m) case 32: ret += tcrypt_test("ecb(camellia)"); ret += tcrypt_test("cbc(camellia)"); - ret += tcrypt_test("ctr(camellia)"); - ret += tcrypt_test("lrw(camellia)"); - ret += tcrypt_test("xts(camellia)"); break; case 33: ret += tcrypt_test("sha224"); @@ -1168,10 +1165,6 @@ static int do_test(int m) ret += tcrypt_test("rfc4309(ccm(aes))"); break; - case 46: - ret += tcrypt_test("ghash"); - break; - case 100: ret += tcrypt_test("hmac(md5)"); break; @@ -1366,44 +1359,6 @@ static int do_test(int m) speed_template_8); break; - case 209: - test_cipher_speed("ecb(cast5)", ENCRYPT, sec, NULL, 0, - speed_template_8_16); - test_cipher_speed("ecb(cast5)", DECRYPT, sec, NULL, 0, - speed_template_8_16); - test_cipher_speed("cbc(cast5)", ENCRYPT, sec, NULL, 0, - speed_template_8_16); - test_cipher_speed("cbc(cast5)", DECRYPT, sec, NULL, 0, - speed_template_8_16); - test_cipher_speed("ctr(cast5)", ENCRYPT, sec, NULL, 0, - speed_template_8_16); - test_cipher_speed("ctr(cast5)", DECRYPT, sec, NULL, 0, - speed_template_8_16); - break; - - case 210: - test_cipher_speed("ecb(cast6)", ENCRYPT, sec, NULL, 0, - speed_template_16_32); - test_cipher_speed("ecb(cast6)", DECRYPT, sec, NULL, 0, - speed_template_16_32); - test_cipher_speed("cbc(cast6)", ENCRYPT, sec, NULL, 0, - speed_template_16_32); - test_cipher_speed("cbc(cast6)", DECRYPT, sec, NULL, 0, - speed_template_16_32); - test_cipher_speed("ctr(cast6)", ENCRYPT, sec, NULL, 0, - speed_template_16_32); - test_cipher_speed("ctr(cast6)", DECRYPT, sec, NULL, 0, - speed_template_16_32); - test_cipher_speed("lrw(cast6)", ENCRYPT, sec, NULL, 0, - speed_template_32_48); - test_cipher_speed("lrw(cast6)", DECRYPT, sec, NULL, 0, - speed_template_32_48); - test_cipher_speed("xts(cast6)", ENCRYPT, sec, NULL, 0, - speed_template_32_64); - test_cipher_speed("xts(cast6)", DECRYPT, sec, NULL, 0, - speed_template_32_64); - break; - case 300: /* fall through */ @@ -1684,44 +1639,6 @@ static int do_test(int m) speed_template_8); break; - case 506: - test_acipher_speed("ecb(cast5)", ENCRYPT, sec, NULL, 0, - speed_template_8_16); - test_acipher_speed("ecb(cast5)", DECRYPT, sec, NULL, 0, - speed_template_8_16); - test_acipher_speed("cbc(cast5)", ENCRYPT, sec, NULL, 0, - speed_template_8_16); - test_acipher_speed("cbc(cast5)", DECRYPT, sec, NULL, 0, - speed_template_8_16); - test_acipher_speed("ctr(cast5)", ENCRYPT, sec, NULL, 0, - speed_template_8_16); - test_acipher_speed("ctr(cast5)", DECRYPT, sec, NULL, 0, - speed_template_8_16); - break; - - case 507: - test_acipher_speed("ecb(cast6)", ENCRYPT, sec, NULL, 0, - speed_template_16_32); - test_acipher_speed("ecb(cast6)", DECRYPT, sec, NULL, 0, - speed_template_16_32); - test_acipher_speed("cbc(cast6)", ENCRYPT, sec, NULL, 0, - speed_template_16_32); - test_acipher_speed("cbc(cast6)", DECRYPT, sec, NULL, 0, - speed_template_16_32); - test_acipher_speed("ctr(cast6)", ENCRYPT, sec, NULL, 0, - speed_template_16_32); - test_acipher_speed("ctr(cast6)", DECRYPT, sec, NULL, 0, - speed_template_16_32); - test_acipher_speed("lrw(cast6)", ENCRYPT, sec, NULL, 0, - speed_template_32_48); - test_acipher_speed("lrw(cast6)", DECRYPT, sec, NULL, 0, - speed_template_32_48); - test_acipher_speed("xts(cast6)", ENCRYPT, sec, NULL, 0, - speed_template_32_64); - test_acipher_speed("xts(cast6)", DECRYPT, sec, NULL, 0, - speed_template_32_64); - break; - case 1000: test_available(); break; diff --git a/trunk/crypto/tcrypt.h b/trunk/crypto/tcrypt.h index cd2068524f3f..5be1fc8c1ab3 100644 --- a/trunk/crypto/tcrypt.h +++ b/trunk/crypto/tcrypt.h @@ -47,7 +47,6 @@ static struct cipher_speed_template des3_speed_template[] = { */ static u8 speed_template_8[] = {8, 0}; static u8 speed_template_24[] = {24, 0}; -static u8 speed_template_8_16[] = {8, 16, 0}; static u8 speed_template_8_32[] = {8, 32, 0}; static u8 speed_template_16_32[] = {16, 32, 0}; static u8 speed_template_16_24_32[] = {16, 24, 32, 0}; diff --git a/trunk/crypto/tea.c b/trunk/crypto/tea.c index 0a572323ee4a..412bc74f8179 100644 --- a/trunk/crypto/tea.c +++ b/trunk/crypto/tea.c @@ -219,55 +219,84 @@ static void xeta_decrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src) out[1] = cpu_to_le32(z); } -static struct crypto_alg tea_algs[3] = { { +static struct crypto_alg tea_alg = { .cra_name = "tea", .cra_flags = CRYPTO_ALG_TYPE_CIPHER, .cra_blocksize = TEA_BLOCK_SIZE, .cra_ctxsize = sizeof (struct tea_ctx), .cra_alignmask = 3, .cra_module = THIS_MODULE, + .cra_list = LIST_HEAD_INIT(tea_alg.cra_list), .cra_u = { .cipher = { .cia_min_keysize = TEA_KEY_SIZE, .cia_max_keysize = TEA_KEY_SIZE, .cia_setkey = tea_setkey, .cia_encrypt = tea_encrypt, .cia_decrypt = tea_decrypt } } -}, { +}; + +static struct crypto_alg xtea_alg = { .cra_name = "xtea", .cra_flags = CRYPTO_ALG_TYPE_CIPHER, .cra_blocksize = XTEA_BLOCK_SIZE, .cra_ctxsize = sizeof (struct xtea_ctx), .cra_alignmask = 3, .cra_module = THIS_MODULE, + .cra_list = LIST_HEAD_INIT(xtea_alg.cra_list), .cra_u = { .cipher = { .cia_min_keysize = XTEA_KEY_SIZE, .cia_max_keysize = XTEA_KEY_SIZE, .cia_setkey = xtea_setkey, .cia_encrypt = xtea_encrypt, .cia_decrypt = xtea_decrypt } } -}, { +}; + +static struct crypto_alg xeta_alg = { .cra_name = "xeta", .cra_flags = CRYPTO_ALG_TYPE_CIPHER, .cra_blocksize = XTEA_BLOCK_SIZE, .cra_ctxsize = sizeof (struct xtea_ctx), .cra_alignmask = 3, .cra_module = THIS_MODULE, + .cra_list = LIST_HEAD_INIT(xtea_alg.cra_list), .cra_u = { .cipher = { .cia_min_keysize = XTEA_KEY_SIZE, .cia_max_keysize = XTEA_KEY_SIZE, .cia_setkey = xtea_setkey, .cia_encrypt = xeta_encrypt, .cia_decrypt = xeta_decrypt } } -} }; +}; static int __init tea_mod_init(void) { - return crypto_register_algs(tea_algs, ARRAY_SIZE(tea_algs)); + int ret = 0; + + ret = crypto_register_alg(&tea_alg); + if (ret < 0) + goto out; + + ret = crypto_register_alg(&xtea_alg); + if (ret < 0) { + crypto_unregister_alg(&tea_alg); + goto out; + } + + ret = crypto_register_alg(&xeta_alg); + if (ret < 0) { + crypto_unregister_alg(&tea_alg); + crypto_unregister_alg(&xtea_alg); + goto out; + } + +out: + return ret; } static void __exit tea_mod_fini(void) { - crypto_unregister_algs(tea_algs, ARRAY_SIZE(tea_algs)); + crypto_unregister_alg(&tea_alg); + crypto_unregister_alg(&xtea_alg); + crypto_unregister_alg(&xeta_alg); } MODULE_ALIAS("xtea"); diff --git a/trunk/crypto/testmgr.c b/trunk/crypto/testmgr.c index 941d75cd1f7c..a2ca7431760a 100644 --- a/trunk/crypto/testmgr.c +++ b/trunk/crypto/testmgr.c @@ -358,9 +358,8 @@ static int test_hash(struct crypto_ahash *tfm, struct hash_testvec *template, return ret; } -static int __test_aead(struct crypto_aead *tfm, int enc, - struct aead_testvec *template, unsigned int tcount, - const bool diff_dst) +static int test_aead(struct crypto_aead *tfm, int enc, + struct aead_testvec *template, unsigned int tcount) { const char *algo = crypto_tfm_alg_driver_name(crypto_aead_tfm(tfm)); unsigned int i, j, k, n, temp; @@ -368,18 +367,15 @@ static int __test_aead(struct crypto_aead *tfm, int enc, char *q; char *key; struct aead_request *req; - struct scatterlist *sg; - struct scatterlist *asg; - struct scatterlist *sgout; - const char *e, *d; + struct scatterlist sg[8]; + struct scatterlist asg[8]; + const char *e; struct tcrypt_result result; unsigned int authsize; void *input; - void *output; void *assoc; char iv[MAX_IVLEN]; char *xbuf[XBUFSIZE]; - char *xoutbuf[XBUFSIZE]; char *axbuf[XBUFSIZE]; if (testmgr_alloc_buf(xbuf)) @@ -387,21 +383,6 @@ static int __test_aead(struct crypto_aead *tfm, int enc, if (testmgr_alloc_buf(axbuf)) goto out_noaxbuf; - if (diff_dst && testmgr_alloc_buf(xoutbuf)) - goto out_nooutbuf; - - /* avoid "the frame size is larger than 1024 bytes" compiler warning */ - sg = kmalloc(sizeof(*sg) * 8 * (diff_dst ? 3 : 2), GFP_KERNEL); - if (!sg) - goto out_nosg; - asg = &sg[8]; - sgout = &asg[8]; - - if (diff_dst) - d = "-ddst"; - else - d = ""; - if (enc == ENCRYPT) e = "encryption"; else @@ -411,8 +392,8 @@ static int __test_aead(struct crypto_aead *tfm, int enc, req = aead_request_alloc(tfm, GFP_KERNEL); if (!req) { - pr_err("alg: aead%s: Failed to allocate request for %s\n", - d, algo); + printk(KERN_ERR "alg: aead: Failed to allocate request for " + "%s\n", algo); goto out; } @@ -451,8 +432,9 @@ static int __test_aead(struct crypto_aead *tfm, int enc, ret = crypto_aead_setkey(tfm, key, template[i].klen); if (!ret == template[i].fail) { - pr_err("alg: aead%s: setkey failed on test %d for %s: flags=%x\n", - d, j, algo, crypto_aead_get_flags(tfm)); + printk(KERN_ERR "alg: aead: setkey failed on " + "test %d for %s: flags=%x\n", j, algo, + crypto_aead_get_flags(tfm)); goto out; } else if (ret) continue; @@ -460,26 +442,18 @@ static int __test_aead(struct crypto_aead *tfm, int enc, authsize = abs(template[i].rlen - template[i].ilen); ret = crypto_aead_setauthsize(tfm, authsize); if (ret) { - pr_err("alg: aead%s: Failed to set authsize to %u on test %d for %s\n", - d, authsize, j, algo); + printk(KERN_ERR "alg: aead: Failed to set " + "authsize to %u on test %d for %s\n", + authsize, j, algo); goto out; } sg_init_one(&sg[0], input, template[i].ilen + (enc ? authsize : 0)); - if (diff_dst) { - output = xoutbuf[0]; - sg_init_one(&sgout[0], output, - template[i].ilen + - (enc ? authsize : 0)); - } else { - output = input; - } - sg_init_one(&asg[0], assoc, template[i].alen); - aead_request_set_crypt(req, sg, (diff_dst) ? sgout : sg, + aead_request_set_crypt(req, sg, sg, template[i].ilen, iv); aead_request_set_assoc(req, asg, template[i].alen); @@ -492,8 +466,10 @@ static int __test_aead(struct crypto_aead *tfm, int enc, case 0: if (template[i].novrfy) { /* verification was supposed to fail */ - pr_err("alg: aead%s: %s failed on test %d for %s: ret was 0, expected -EBADMSG\n", - d, e, j, algo); + printk(KERN_ERR "alg: aead: %s failed " + "on test %d for %s: ret was 0, " + "expected -EBADMSG\n", + e, j, algo); /* so really, we got a bad message */ ret = -EBADMSG; goto out; @@ -513,15 +489,15 @@ static int __test_aead(struct crypto_aead *tfm, int enc, continue; /* fall through */ default: - pr_err("alg: aead%s: %s failed on test %d for %s: ret=%d\n", - d, e, j, algo, -ret); + printk(KERN_ERR "alg: aead: %s failed on test " + "%d for %s: ret=%d\n", e, j, algo, -ret); goto out; } - q = output; + q = input; if (memcmp(q, template[i].result, template[i].rlen)) { - pr_err("alg: aead%s: Test %d failed on %s for %s\n", - d, j, e, algo); + printk(KERN_ERR "alg: aead: Test %d failed on " + "%s for %s\n", j, e, algo); hexdump(q, template[i].rlen); ret = -EINVAL; goto out; @@ -546,8 +522,9 @@ static int __test_aead(struct crypto_aead *tfm, int enc, ret = crypto_aead_setkey(tfm, key, template[i].klen); if (!ret == template[i].fail) { - pr_err("alg: aead%s: setkey failed on chunk test %d for %s: flags=%x\n", - d, j, algo, crypto_aead_get_flags(tfm)); + printk(KERN_ERR "alg: aead: setkey failed on " + "chunk test %d for %s: flags=%x\n", j, + algo, crypto_aead_get_flags(tfm)); goto out; } else if (ret) continue; @@ -556,8 +533,6 @@ static int __test_aead(struct crypto_aead *tfm, int enc, ret = -EINVAL; sg_init_table(sg, template[i].np); - if (diff_dst) - sg_init_table(sgout, template[i].np); for (k = 0, temp = 0; k < template[i].np; k++) { if (WARN_ON(offset_in_page(IDX[k]) + template[i].tap[k] > PAGE_SIZE)) @@ -576,26 +551,14 @@ static int __test_aead(struct crypto_aead *tfm, int enc, q[n] = 0; sg_set_buf(&sg[k], q, template[i].tap[k]); - - if (diff_dst) { - q = xoutbuf[IDX[k] >> PAGE_SHIFT] + - offset_in_page(IDX[k]); - - memset(q, 0, template[i].tap[k]); - if (offset_in_page(q) + n < PAGE_SIZE) - q[n] = 0; - - sg_set_buf(&sgout[k], q, - template[i].tap[k]); - } - temp += template[i].tap[k]; } ret = crypto_aead_setauthsize(tfm, authsize); if (ret) { - pr_err("alg: aead%s: Failed to set authsize to %u on chunk test %d for %s\n", - d, authsize, j, algo); + printk(KERN_ERR "alg: aead: Failed to set " + "authsize to %u on chunk test %d for " + "%s\n", authsize, j, algo); goto out; } @@ -608,9 +571,6 @@ static int __test_aead(struct crypto_aead *tfm, int enc, } sg[k - 1].length += authsize; - - if (diff_dst) - sgout[k - 1].length += authsize; } sg_init_table(asg, template[i].anp); @@ -628,7 +588,7 @@ static int __test_aead(struct crypto_aead *tfm, int enc, temp += template[i].atap[k]; } - aead_request_set_crypt(req, sg, (diff_dst) ? sgout : sg, + aead_request_set_crypt(req, sg, sg, template[i].ilen, iv); @@ -642,8 +602,10 @@ static int __test_aead(struct crypto_aead *tfm, int enc, case 0: if (template[i].novrfy) { /* verification was supposed to fail */ - pr_err("alg: aead%s: %s failed on chunk test %d for %s: ret was 0, expected -EBADMSG\n", - d, e, j, algo); + printk(KERN_ERR "alg: aead: %s failed " + "on chunk test %d for %s: ret " + "was 0, expected -EBADMSG\n", + e, j, algo); /* so really, we got a bad message */ ret = -EBADMSG; goto out; @@ -663,35 +625,32 @@ static int __test_aead(struct crypto_aead *tfm, int enc, continue; /* fall through */ default: - pr_err("alg: aead%s: %s failed on chunk test %d for %s: ret=%d\n", - d, e, j, algo, -ret); + printk(KERN_ERR "alg: aead: %s failed on " + "chunk test %d for %s: ret=%d\n", e, j, + algo, -ret); goto out; } ret = -EINVAL; for (k = 0, temp = 0; k < template[i].np; k++) { - if (diff_dst) - q = xoutbuf[IDX[k] >> PAGE_SHIFT] + - offset_in_page(IDX[k]); - else - q = xbuf[IDX[k] >> PAGE_SHIFT] + - offset_in_page(IDX[k]); + q = xbuf[IDX[k] >> PAGE_SHIFT] + + offset_in_page(IDX[k]); n = template[i].tap[k]; if (k == template[i].np - 1) n += enc ? authsize : -authsize; if (memcmp(q, template[i].result + temp, n)) { - pr_err("alg: aead%s: Chunk test %d failed on %s at page %u for %s\n", - d, j, e, k, algo); + printk(KERN_ERR "alg: aead: Chunk " + "test %d failed on %s at page " + "%u for %s\n", j, e, k, algo); hexdump(q, n); goto out; } q += n; if (k == template[i].np - 1 && !enc) { - if (!diff_dst && - memcmp(q, template[i].input + + if (memcmp(q, template[i].input + temp + n, authsize)) n = authsize; else @@ -702,8 +661,11 @@ static int __test_aead(struct crypto_aead *tfm, int enc, ; } if (n) { - pr_err("alg: aead%s: Result buffer corruption in chunk test %d on %s at page %u for %s: %u bytes:\n", - d, j, e, k, algo, n); + printk(KERN_ERR "alg: aead: Result " + "buffer corruption in chunk " + "test %d on %s at page %u for " + "%s: %u bytes:\n", j, e, k, + algo, n); hexdump(q, n); goto out; } @@ -717,11 +679,6 @@ static int __test_aead(struct crypto_aead *tfm, int enc, out: aead_request_free(req); - kfree(sg); -out_nosg: - if (diff_dst) - testmgr_free_buf(xoutbuf); -out_nooutbuf: testmgr_free_buf(axbuf); out_noaxbuf: testmgr_free_buf(xbuf); @@ -729,20 +686,6 @@ static int __test_aead(struct crypto_aead *tfm, int enc, return ret; } -static int test_aead(struct crypto_aead *tfm, int enc, - struct aead_testvec *template, unsigned int tcount) -{ - int ret; - - /* test 'dst == src' case */ - ret = __test_aead(tfm, enc, template, tcount, false); - if (ret) - return ret; - - /* test 'dst != src' case */ - return __test_aead(tfm, enc, template, tcount, true); -} - static int test_cipher(struct crypto_cipher *tfm, int enc, struct cipher_testvec *template, unsigned int tcount) { @@ -818,9 +761,8 @@ static int test_cipher(struct crypto_cipher *tfm, int enc, return ret; } -static int __test_skcipher(struct crypto_ablkcipher *tfm, int enc, - struct cipher_testvec *template, unsigned int tcount, - const bool diff_dst) +static int test_skcipher(struct crypto_ablkcipher *tfm, int enc, + struct cipher_testvec *template, unsigned int tcount) { const char *algo = crypto_tfm_alg_driver_name(crypto_ablkcipher_tfm(tfm)); @@ -828,26 +770,16 @@ static int __test_skcipher(struct crypto_ablkcipher *tfm, int enc, char *q; struct ablkcipher_request *req; struct scatterlist sg[8]; - struct scatterlist sgout[8]; - const char *e, *d; + const char *e; struct tcrypt_result result; void *data; char iv[MAX_IVLEN]; char *xbuf[XBUFSIZE]; - char *xoutbuf[XBUFSIZE]; int ret = -ENOMEM; if (testmgr_alloc_buf(xbuf)) goto out_nobuf; - if (diff_dst && testmgr_alloc_buf(xoutbuf)) - goto out_nooutbuf; - - if (diff_dst) - d = "-ddst"; - else - d = ""; - if (enc == ENCRYPT) e = "encryption"; else @@ -857,8 +789,8 @@ static int __test_skcipher(struct crypto_ablkcipher *tfm, int enc, req = ablkcipher_request_alloc(tfm, GFP_KERNEL); if (!req) { - pr_err("alg: skcipher%s: Failed to allocate request for %s\n", - d, algo); + printk(KERN_ERR "alg: skcipher: Failed to allocate request " + "for %s\n", algo); goto out; } @@ -872,7 +804,7 @@ static int __test_skcipher(struct crypto_ablkcipher *tfm, int enc, else memset(iv, 0, MAX_IVLEN); - if (!(template[i].np) || (template[i].also_non_np)) { + if (!(template[i].np)) { j++; ret = -EINVAL; @@ -890,21 +822,16 @@ static int __test_skcipher(struct crypto_ablkcipher *tfm, int enc, ret = crypto_ablkcipher_setkey(tfm, template[i].key, template[i].klen); if (!ret == template[i].fail) { - pr_err("alg: skcipher%s: setkey failed on test %d for %s: flags=%x\n", - d, j, algo, - crypto_ablkcipher_get_flags(tfm)); + printk(KERN_ERR "alg: skcipher: setkey failed " + "on test %d for %s: flags=%x\n", j, + algo, crypto_ablkcipher_get_flags(tfm)); goto out; } else if (ret) continue; sg_init_one(&sg[0], data, template[i].ilen); - if (diff_dst) { - data = xoutbuf[0]; - sg_init_one(&sgout[0], data, template[i].ilen); - } - ablkcipher_request_set_crypt(req, sg, - (diff_dst) ? sgout : sg, + ablkcipher_request_set_crypt(req, sg, sg, template[i].ilen, iv); ret = enc ? crypto_ablkcipher_encrypt(req) : @@ -923,15 +850,16 @@ static int __test_skcipher(struct crypto_ablkcipher *tfm, int enc, } /* fall through */ default: - pr_err("alg: skcipher%s: %s failed on test %d for %s: ret=%d\n", - d, e, j, algo, -ret); + printk(KERN_ERR "alg: skcipher: %s failed on " + "test %d for %s: ret=%d\n", e, j, algo, + -ret); goto out; } q = data; if (memcmp(q, template[i].result, template[i].rlen)) { - pr_err("alg: skcipher%s: Test %d failed on %s for %s\n", - d, j, e, algo); + printk(KERN_ERR "alg: skcipher: Test %d " + "failed on %s for %s\n", j, e, algo); hexdump(q, template[i].rlen); ret = -EINVAL; goto out; @@ -958,8 +886,9 @@ static int __test_skcipher(struct crypto_ablkcipher *tfm, int enc, ret = crypto_ablkcipher_setkey(tfm, template[i].key, template[i].klen); if (!ret == template[i].fail) { - pr_err("alg: skcipher%s: setkey failed on chunk test %d for %s: flags=%x\n", - d, j, algo, + printk(KERN_ERR "alg: skcipher: setkey failed " + "on chunk test %d for %s: flags=%x\n", + j, algo, crypto_ablkcipher_get_flags(tfm)); goto out; } else if (ret) @@ -968,8 +897,6 @@ static int __test_skcipher(struct crypto_ablkcipher *tfm, int enc, temp = 0; ret = -EINVAL; sg_init_table(sg, template[i].np); - if (diff_dst) - sg_init_table(sgout, template[i].np); for (k = 0; k < template[i].np; k++) { if (WARN_ON(offset_in_page(IDX[k]) + template[i].tap[k] > PAGE_SIZE)) @@ -986,24 +913,11 @@ static int __test_skcipher(struct crypto_ablkcipher *tfm, int enc, q[template[i].tap[k]] = 0; sg_set_buf(&sg[k], q, template[i].tap[k]); - if (diff_dst) { - q = xoutbuf[IDX[k] >> PAGE_SHIFT] + - offset_in_page(IDX[k]); - - sg_set_buf(&sgout[k], q, - template[i].tap[k]); - - memset(q, 0, template[i].tap[k]); - if (offset_in_page(q) + - template[i].tap[k] < PAGE_SIZE) - q[template[i].tap[k]] = 0; - } temp += template[i].tap[k]; } - ablkcipher_request_set_crypt(req, sg, - (diff_dst) ? sgout : sg, + ablkcipher_request_set_crypt(req, sg, sg, template[i].ilen, iv); ret = enc ? @@ -1023,25 +937,23 @@ static int __test_skcipher(struct crypto_ablkcipher *tfm, int enc, } /* fall through */ default: - pr_err("alg: skcipher%s: %s failed on chunk test %d for %s: ret=%d\n", - d, e, j, algo, -ret); + printk(KERN_ERR "alg: skcipher: %s failed on " + "chunk test %d for %s: ret=%d\n", e, j, + algo, -ret); goto out; } temp = 0; ret = -EINVAL; for (k = 0; k < template[i].np; k++) { - if (diff_dst) - q = xoutbuf[IDX[k] >> PAGE_SHIFT] + - offset_in_page(IDX[k]); - else - q = xbuf[IDX[k] >> PAGE_SHIFT] + - offset_in_page(IDX[k]); + q = xbuf[IDX[k] >> PAGE_SHIFT] + + offset_in_page(IDX[k]); if (memcmp(q, template[i].result + temp, template[i].tap[k])) { - pr_err("alg: skcipher%s: Chunk test %d failed on %s at page %u for %s\n", - d, j, e, k, algo); + printk(KERN_ERR "alg: skcipher: Chunk " + "test %d failed on %s at page " + "%u for %s\n", j, e, k, algo); hexdump(q, template[i].tap[k]); goto out; } @@ -1050,8 +962,11 @@ static int __test_skcipher(struct crypto_ablkcipher *tfm, int enc, for (n = 0; offset_in_page(q + n) && q[n]; n++) ; if (n) { - pr_err("alg: skcipher%s: Result buffer corruption in chunk test %d on %s at page %u for %s: %u bytes:\n", - d, j, e, k, algo, n); + printk(KERN_ERR "alg: skcipher: " + "Result buffer corruption in " + "chunk test %d on %s at page " + "%u for %s: %u bytes:\n", j, e, + k, algo, n); hexdump(q, n); goto out; } @@ -1064,28 +979,11 @@ static int __test_skcipher(struct crypto_ablkcipher *tfm, int enc, out: ablkcipher_request_free(req); - if (diff_dst) - testmgr_free_buf(xoutbuf); -out_nooutbuf: testmgr_free_buf(xbuf); out_nobuf: return ret; } -static int test_skcipher(struct crypto_ablkcipher *tfm, int enc, - struct cipher_testvec *template, unsigned int tcount) -{ - int ret; - - /* test 'dst == src' case */ - ret = __test_skcipher(tfm, enc, template, tcount, false); - if (ret) - return ret; - - /* test 'dst != src' case */ - return __test_skcipher(tfm, enc, template, tcount, true); -} - static int test_comp(struct crypto_comp *tfm, struct comp_testvec *ctemplate, struct comp_testvec *dtemplate, int ctcount, int dtcount) { @@ -1636,36 +1534,6 @@ static int alg_test_null(const struct alg_test_desc *desc, /* Please keep this list sorted by algorithm name. */ static const struct alg_test_desc alg_test_descs[] = { { - .alg = "__cbc-cast5-avx", - .test = alg_test_null, - .suite = { - .cipher = { - .enc = { - .vecs = NULL, - .count = 0 - }, - .dec = { - .vecs = NULL, - .count = 0 - } - } - } - }, { - .alg = "__cbc-cast6-avx", - .test = alg_test_null, - .suite = { - .cipher = { - .enc = { - .vecs = NULL, - .count = 0 - }, - .dec = { - .vecs = NULL, - .count = 0 - } - } - } - }, { .alg = "__cbc-serpent-avx", .test = alg_test_null, .suite = { @@ -1726,36 +1594,6 @@ static const struct alg_test_desc alg_test_descs[] = { } } } - }, { - .alg = "__driver-cbc-cast5-avx", - .test = alg_test_null, - .suite = { - .cipher = { - .enc = { - .vecs = NULL, - .count = 0 - }, - .dec = { - .vecs = NULL, - .count = 0 - } - } - } - }, { - .alg = "__driver-cbc-cast6-avx", - .test = alg_test_null, - .suite = { - .cipher = { - .enc = { - .vecs = NULL, - .count = 0 - }, - .dec = { - .vecs = NULL, - .count = 0 - } - } - } }, { .alg = "__driver-cbc-serpent-avx", .test = alg_test_null, @@ -1817,36 +1655,6 @@ static const struct alg_test_desc alg_test_descs[] = { } } } - }, { - .alg = "__driver-ecb-cast5-avx", - .test = alg_test_null, - .suite = { - .cipher = { - .enc = { - .vecs = NULL, - .count = 0 - }, - .dec = { - .vecs = NULL, - .count = 0 - } - } - } - }, { - .alg = "__driver-ecb-cast6-avx", - .test = alg_test_null, - .suite = { - .cipher = { - .enc = { - .vecs = NULL, - .count = 0 - }, - .dec = { - .vecs = NULL, - .count = 0 - } - } - } }, { .alg = "__driver-ecb-serpent-avx", .test = alg_test_null, @@ -2009,36 +1817,6 @@ static const struct alg_test_desc alg_test_descs[] = { } } } - }, { - .alg = "cbc(cast5)", - .test = alg_test_skcipher, - .suite = { - .cipher = { - .enc = { - .vecs = cast5_cbc_enc_tv_template, - .count = CAST5_CBC_ENC_TEST_VECTORS - }, - .dec = { - .vecs = cast5_cbc_dec_tv_template, - .count = CAST5_CBC_DEC_TEST_VECTORS - } - } - } - }, { - .alg = "cbc(cast6)", - .test = alg_test_skcipher, - .suite = { - .cipher = { - .enc = { - .vecs = cast6_cbc_enc_tv_template, - .count = CAST6_CBC_ENC_TEST_VECTORS - }, - .dec = { - .vecs = cast6_cbc_dec_tv_template, - .count = CAST6_CBC_DEC_TEST_VECTORS - } - } - } }, { .alg = "cbc(des)", .test = alg_test_skcipher, @@ -2158,36 +1936,6 @@ static const struct alg_test_desc alg_test_descs[] = { } } } - }, { - .alg = "cryptd(__driver-ecb-cast5-avx)", - .test = alg_test_null, - .suite = { - .cipher = { - .enc = { - .vecs = NULL, - .count = 0 - }, - .dec = { - .vecs = NULL, - .count = 0 - } - } - } - }, { - .alg = "cryptd(__driver-ecb-cast6-avx)", - .test = alg_test_null, - .suite = { - .cipher = { - .enc = { - .vecs = NULL, - .count = 0 - }, - .dec = { - .vecs = NULL, - .count = 0 - } - } - } }, { .alg = "cryptd(__driver-ecb-serpent-avx)", .test = alg_test_null, @@ -2305,36 +2053,6 @@ static const struct alg_test_desc alg_test_descs[] = { } } } - }, { - .alg = "ctr(cast5)", - .test = alg_test_skcipher, - .suite = { - .cipher = { - .enc = { - .vecs = cast5_ctr_enc_tv_template, - .count = CAST5_CTR_ENC_TEST_VECTORS - }, - .dec = { - .vecs = cast5_ctr_dec_tv_template, - .count = CAST5_CTR_DEC_TEST_VECTORS - } - } - } - }, { - .alg = "ctr(cast6)", - .test = alg_test_skcipher, - .suite = { - .cipher = { - .enc = { - .vecs = cast6_ctr_enc_tv_template, - .count = CAST6_CTR_ENC_TEST_VECTORS - }, - .dec = { - .vecs = cast6_ctr_dec_tv_template, - .count = CAST6_CTR_DEC_TEST_VECTORS - } - } - } }, { .alg = "ctr(serpent)", .test = alg_test_skcipher, @@ -2811,21 +2529,6 @@ static const struct alg_test_desc alg_test_descs[] = { } } } - }, { - .alg = "lrw(cast6)", - .test = alg_test_skcipher, - .suite = { - .cipher = { - .enc = { - .vecs = cast6_lrw_enc_tv_template, - .count = CAST6_LRW_ENC_TEST_VECTORS - }, - .dec = { - .vecs = cast6_lrw_dec_tv_template, - .count = CAST6_LRW_DEC_TEST_VECTORS - } - } - } }, { .alg = "lrw(serpent)", .test = alg_test_skcipher, @@ -3178,21 +2881,6 @@ static const struct alg_test_desc alg_test_descs[] = { } } } - }, { - .alg = "xts(cast6)", - .test = alg_test_skcipher, - .suite = { - .cipher = { - .enc = { - .vecs = cast6_xts_enc_tv_template, - .count = CAST6_XTS_ENC_TEST_VECTORS - }, - .dec = { - .vecs = cast6_xts_dec_tv_template, - .count = CAST6_XTS_DEC_TEST_VECTORS - } - } - } }, { .alg = "xts(serpent)", .test = alg_test_skcipher, diff --git a/trunk/crypto/testmgr.h b/trunk/crypto/testmgr.h index 76d7f6cc82f5..f8179e0344ed 100644 --- a/trunk/crypto/testmgr.h +++ b/trunk/crypto/testmgr.h @@ -53,7 +53,6 @@ struct cipher_testvec { char *result; unsigned short tap[MAX_TAP]; int np; - unsigned char also_non_np; unsigned char fail; unsigned char wk; /* weak key flag */ unsigned char klen; @@ -2469,9 +2468,6 @@ static struct cipher_testvec bf_enc_tv_template[] = { "\xC2\xF4\x6D\xFF\xF6\xCD\x6B\x40" "\xE1\xB3\xBF\xD4\x38\x2B\xC8\x3B", .rlen = 40, - .also_non_np = 1, - .np = 2, - .tap = { 40 - 8, 8 }, }, }; @@ -2545,9 +2541,6 @@ static struct cipher_testvec bf_dec_tv_template[] = { "\xAC\x20\xB7\x4E\xE5\x59\xF0\x87" "\x1E\x92\x29\xC0\x34\xCB\x62\xF9", .rlen = 40, - .also_non_np = 1, - .np = 2, - .tap = { 40 - 8, 8 }, }, }; @@ -2586,9 +2579,6 @@ static struct cipher_testvec bf_cbc_enc_tv_template[] = { "\x1B\xD9\x02\xB6\x48\xB0\x87\x25" "\x01\x9C\x93\x63\x51\x60\x82\xD2", .rlen = 40, - .also_non_np = 1, - .np = 2, - .tap = { 40 - 8, 8 }, }, }; @@ -2627,9 +2617,6 @@ static struct cipher_testvec bf_cbc_dec_tv_template[] = { "\xAC\x20\xB7\x4E\xE5\x59\xF0\x87" "\x1E\x92\x29\xC0\x34\xCB\x62\xF9", .rlen = 40, - .also_non_np = 1, - .np = 2, - .tap = { 40 - 8, 8 }, }, }; @@ -2674,144 +2661,6 @@ static struct cipher_testvec bf_ctr_enc_tv_template[] = { "\xE4\x1F\x5E\xA5\x89\xAC\x32\xBC" "\x3D\xA7\xE9", .rlen = 43, - .also_non_np = 1, - .np = 2, - .tap = { 43 - 8, 8 }, - }, { /* Generated with Crypto++ */ - .key = "\x85\x62\x3F\x1C\xF9\xD6\x1C\xF9" - "\xD6\xB3\x90\x6D\x4A\x90\x6D\x4A" - "\x27\x04\xE1\x27\x04\xE1\xBE\x9B" - "\x78\xBE\x9B\x78\x55\x32\x0F\x55", - .klen = 32, - .iv = "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFD", - .input = "\x56\xED\x84\x1B\x8F\x26\xBD\x31" - "\xC8\x5F\xF6\x6A\x01\x98\x0C\xA3" - "\x3A\xD1\x45\xDC\x73\x0A\x7E\x15" - "\xAC\x20\xB7\x4E\xE5\x59\xF0\x87" - "\x1E\x92\x29\xC0\x34\xCB\x62\xF9" - "\x6D\x04\x9B\x0F\xA6\x3D\xD4\x48" - "\xDF\x76\x0D\x81\x18\xAF\x23\xBA" - "\x51\xE8\x5C\xF3\x8A\x21\x95\x2C" - "\xC3\x37\xCE\x65\xFC\x70\x07\x9E" - "\x12\xA9\x40\xD7\x4B\xE2\x79\x10" - "\x84\x1B\xB2\x26\xBD\x54\xEB\x5F" - "\xF6\x8D\x01\x98\x2F\xC6\x3A\xD1" - "\x68\xFF\x73\x0A\xA1\x15\xAC\x43" - "\xDA\x4E\xE5\x7C\x13\x87\x1E\xB5" - "\x29\xC0\x57\xEE\x62\xF9\x90\x04" - "\x9B\x32\xC9\x3D\xD4\x6B\x02\x76" - "\x0D\xA4\x18\xAF\x46\xDD\x51\xE8" - "\x7F\x16\x8A\x21\xB8\x2C\xC3\x5A" - "\xF1\x65\xFC\x93\x07\x9E\x35\xCC" - "\x40\xD7\x6E\x05\x79\x10\xA7\x1B" - "\xB2\x49\xE0\x54\xEB\x82\x19\x8D" - "\x24\xBB\x2F\xC6\x5D\xF4\x68\xFF" - "\x96\x0A\xA1\x38\xCF\x43\xDA\x71" - "\x08\x7C\x13\xAA\x1E\xB5\x4C\xE3" - "\x57\xEE\x85\x1C\x90\x27\xBE\x32" - "\xC9\x60\xF7\x6B\x02\x99\x0D\xA4" - "\x3B\xD2\x46\xDD\x74\x0B\x7F\x16" - "\xAD\x21\xB8\x4F\xE6\x5A\xF1\x88" - "\x1F\x93\x2A\xC1\x35\xCC\x63\xFA" - "\x6E\x05\x9C\x10\xA7\x3E\xD5\x49" - "\xE0\x77\x0E\x82\x19\xB0\x24\xBB" - "\x52\xE9\x5D\xF4\x8B\x22\x96\x2D" - "\xC4\x38\xCF\x66\xFD\x71\x08\x9F" - "\x13\xAA\x41\xD8\x4C\xE3\x7A\x11" - "\x85\x1C\xB3\x27\xBE\x55\xEC\x60" - "\xF7\x8E\x02\x99\x30\xC7\x3B\xD2" - "\x69\x00\x74\x0B\xA2\x16\xAD\x44" - "\xDB\x4F\xE6\x7D\x14\x88\x1F\xB6" - "\x2A\xC1\x58\xEF\x63\xFA\x91\x05" - "\x9C\x33\xCA\x3E\xD5\x6C\x03\x77" - "\x0E\xA5\x19\xB0\x47\xDE\x52\xE9" - "\x80\x17\x8B\x22\xB9\x2D\xC4\x5B" - "\xF2\x66\xFD\x94\x08\x9F\x36\xCD" - "\x41\xD8\x6F\x06\x7A\x11\xA8\x1C" - "\xB3\x4A\xE1\x55\xEC\x83\x1A\x8E" - "\x25\xBC\x30\xC7\x5E\xF5\x69\x00" - "\x97\x0B\xA2\x39\xD0\x44\xDB\x72" - "\x09\x7D\x14\xAB\x1F\xB6\x4D\xE4" - "\x58\xEF\x86\x1D\x91\x28\xBF\x33" - "\xCA\x61\xF8\x6C\x03\x9A\x0E\xA5" - "\x3C\xD3\x47\xDE\x75\x0C\x80\x17" - "\xAE\x22\xB9\x50\xE7\x5B\xF2\x89" - "\x20\x94\x2B\xC2\x36\xCD\x64\xFB" - "\x6F\x06\x9D\x11\xA8\x3F\xD6\x4A" - "\xE1\x78\x0F\x83\x1A\xB1\x25\xBC" - "\x53\xEA\x5E\xF5\x8C\x00\x97\x2E" - "\xC5\x39\xD0\x67\xFE\x72\x09\xA0" - "\x14\xAB\x42\xD9\x4D\xE4\x7B\x12" - "\x86\x1D\xB4\x28\xBF\x56\xED\x61" - "\xF8\x8F\x03\x9A\x31\xC8\x3C\xD3" - "\x6A\x01\x75\x0C\xA3\x17\xAE\x45" - "\xDC\x50\xE7\x7E\x15\x89\x20\xB7" - "\x2B\xC2\x59\xF0\x64\xFB\x92\x06", - .ilen = 504, - .result = "\x5F\x58\x6E\x60\x51\x6E\xDC\x3D" - "\xD1\xBB\xF7\xB7\xFD\x04\x44\x82" - "\xDC\x9F\x4B\x02\xF1\xD2\x5A\x6F" - "\x25\xF9\x27\x21\xF2\xD2\x9A\x01" - "\xBD\xAD\x3D\x93\x87\xCA\x0D\xFE" - "\xB7\x2C\x17\x1F\x42\x8C\x13\xB2" - "\x62\x44\x72\xB9\x5D\xC0\xF8\x37" - "\xDF\xEA\x78\x81\x8F\xA6\x34\xB2" - "\x07\x09\x7C\xB9\x3A\xA0\x2B\x18" - "\x34\x6A\x9D\x3D\xA5\xEB\xF4\x60" - "\xF8\x98\xA2\x39\x81\x23\x6C\xA9" - "\x70\xCA\xCC\x45\xD8\x1F\xDF\x44" - "\x2A\x67\x7A\x88\x28\xDC\x36\x83" - "\x18\xD7\x48\x43\x17\x2B\x1B\xE6" - "\x0B\x82\x59\x14\x26\x67\x08\x09" - "\x5B\x5D\x38\xD0\x81\xCE\x54\x2A" - "\xCD\x22\x94\x42\xF5\xBA\x74\x7E" - "\xD9\x00\x40\xA9\x0D\x0B\xBD\x8E" - "\xC4\x8E\x5E\x17\x8F\x48\xE2\xB8" - "\xF4\xCC\x19\x76\xAB\x48\x29\xAA" - "\x81\xD5\xCE\xD5\x8A\x3B\xC9\x21" - "\xEF\x50\x4F\x04\x02\xBF\xE1\x1F" - "\x59\x28\x1A\xE4\x18\x16\xA0\x29" - "\xBF\x34\xA9\x2D\x28\x83\xC0\x5E" - "\xEA\x44\xC4\x6E\xAB\x24\x79\x9D" - "\x2D\xA1\xE8\x55\xCA\x74\xFC\xBD" - "\xFE\xDD\xDA\xA5\xFB\x34\x90\x31" - "\x0E\x62\x28\x9B\xDC\xD7\xA1\xBB" - "\xF0\x1A\xB3\xE2\xD0\xFA\xBD\xE8" - "\x5C\x5A\x10\x67\xF6\x6A\x17\x3F" - "\xC5\xE9\x09\x08\xDD\x22\x77\x42" - "\x26\x6A\x6A\x7A\x3F\x87\x80\x0C" - "\xF0\xFF\x15\x8E\x84\x86\xC0\x10" - "\x0F\x8D\x33\x06\xB8\x72\xA4\x47" - "\x6B\xED\x2E\x05\x94\x6C\x5C\x5B" - "\x13\xF6\x77\xEE\x3B\x16\xDF\xC2" - "\x63\x66\x07\x6D\x3F\x6C\x51\x7C" - "\x1C\xAC\x80\xB6\x58\x48\xB7\x9D" - "\xB4\x19\xD8\x19\x45\x66\x27\x02" - "\xA1\xA9\x99\xF3\x1F\xE5\xA7\x1D" - "\x31\xE7\x1B\x0D\xFF\xBB\xB5\xA1" - "\xF5\x9C\x45\x1E\x18\x19\xA1\xE7" - "\xC2\xF1\xBF\x68\xC3\xEC\xCF\x53" - "\x67\xA6\x2B\x7D\x3C\x6D\x24\xC3" - "\xE8\xE6\x07\x5A\x09\xE0\x32\xA8" - "\x52\xF6\xE9\xED\x0E\xC6\x0A\x6A" - "\xFC\x60\x2A\xE0\x93\xCE\xB8\x2E" - "\xA2\xA8\x0E\x79\x9E\x34\x5D\x37" - "\x6F\x12\xFE\x48\x7B\xE7\xB9\x22" - "\x29\xE8\xD7\xBE\x5D\xD1\x8B\xD9" - "\x91\x51\x4E\x71\xF2\x98\x85\x16" - "\x25\x7A\x76\x8A\x51\x0E\x65\x14" - "\x81\xB5\x3A\x37\xFD\xEC\xB5\x8A" - "\xE1\xCF\x41\x72\x14\x29\x4C\xF0" - "\x20\xD9\x9A\xC5\x66\xA4\x03\x76" - "\x5B\xA4\x15\x4F\x0E\x64\x39\x40" - "\x25\xF9\x20\x22\xF5\x88\xF5\xBA" - "\xE4\xDF\x45\x61\xBF\x8D\x7A\x24" - "\x4B\x92\x71\xD9\x2F\x77\xA7\x95" - "\xA8\x7F\x61\xD5\xA4\x57\xB0\xFB" - "\xB5\x77\xBA\x1C\xEE\x71\xFA\xB0" - "\x16\x4C\x18\x6B\xF2\x69\xA0\x07" - "\xEF\xBE\xEC\x69\xAC\xA8\x63\x9E", - .rlen = 504, }, }; @@ -2856,144 +2705,6 @@ static struct cipher_testvec bf_ctr_dec_tv_template[] = { "\x1E\x92\x29\xC0\x34\xCB\x62\xF9" "\x6D\x04\x9B", .rlen = 43, - .also_non_np = 1, - .np = 2, - .tap = { 43 - 8, 8 }, - }, { /* Generated with Crypto++ */ - .key = "\x85\x62\x3F\x1C\xF9\xD6\x1C\xF9" - "\xD6\xB3\x90\x6D\x4A\x90\x6D\x4A" - "\x27\x04\xE1\x27\x04\xE1\xBE\x9B" - "\x78\xBE\x9B\x78\x55\x32\x0F\x55", - .klen = 32, - .iv = "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFD", - .input = "\x5F\x58\x6E\x60\x51\x6E\xDC\x3D" - "\xD1\xBB\xF7\xB7\xFD\x04\x44\x82" - "\xDC\x9F\x4B\x02\xF1\xD2\x5A\x6F" - "\x25\xF9\x27\x21\xF2\xD2\x9A\x01" - "\xBD\xAD\x3D\x93\x87\xCA\x0D\xFE" - "\xB7\x2C\x17\x1F\x42\x8C\x13\xB2" - "\x62\x44\x72\xB9\x5D\xC0\xF8\x37" - "\xDF\xEA\x78\x81\x8F\xA6\x34\xB2" - "\x07\x09\x7C\xB9\x3A\xA0\x2B\x18" - "\x34\x6A\x9D\x3D\xA5\xEB\xF4\x60" - "\xF8\x98\xA2\x39\x81\x23\x6C\xA9" - "\x70\xCA\xCC\x45\xD8\x1F\xDF\x44" - "\x2A\x67\x7A\x88\x28\xDC\x36\x83" - "\x18\xD7\x48\x43\x17\x2B\x1B\xE6" - "\x0B\x82\x59\x14\x26\x67\x08\x09" - "\x5B\x5D\x38\xD0\x81\xCE\x54\x2A" - "\xCD\x22\x94\x42\xF5\xBA\x74\x7E" - "\xD9\x00\x40\xA9\x0D\x0B\xBD\x8E" - "\xC4\x8E\x5E\x17\x8F\x48\xE2\xB8" - "\xF4\xCC\x19\x76\xAB\x48\x29\xAA" - "\x81\xD5\xCE\xD5\x8A\x3B\xC9\x21" - "\xEF\x50\x4F\x04\x02\xBF\xE1\x1F" - "\x59\x28\x1A\xE4\x18\x16\xA0\x29" - "\xBF\x34\xA9\x2D\x28\x83\xC0\x5E" - "\xEA\x44\xC4\x6E\xAB\x24\x79\x9D" - "\x2D\xA1\xE8\x55\xCA\x74\xFC\xBD" - "\xFE\xDD\xDA\xA5\xFB\x34\x90\x31" - "\x0E\x62\x28\x9B\xDC\xD7\xA1\xBB" - "\xF0\x1A\xB3\xE2\xD0\xFA\xBD\xE8" - "\x5C\x5A\x10\x67\xF6\x6A\x17\x3F" - "\xC5\xE9\x09\x08\xDD\x22\x77\x42" - "\x26\x6A\x6A\x7A\x3F\x87\x80\x0C" - "\xF0\xFF\x15\x8E\x84\x86\xC0\x10" - "\x0F\x8D\x33\x06\xB8\x72\xA4\x47" - "\x6B\xED\x2E\x05\x94\x6C\x5C\x5B" - "\x13\xF6\x77\xEE\x3B\x16\xDF\xC2" - "\x63\x66\x07\x6D\x3F\x6C\x51\x7C" - "\x1C\xAC\x80\xB6\x58\x48\xB7\x9D" - "\xB4\x19\xD8\x19\x45\x66\x27\x02" - "\xA1\xA9\x99\xF3\x1F\xE5\xA7\x1D" - "\x31\xE7\x1B\x0D\xFF\xBB\xB5\xA1" - "\xF5\x9C\x45\x1E\x18\x19\xA1\xE7" - "\xC2\xF1\xBF\x68\xC3\xEC\xCF\x53" - "\x67\xA6\x2B\x7D\x3C\x6D\x24\xC3" - "\xE8\xE6\x07\x5A\x09\xE0\x32\xA8" - "\x52\xF6\xE9\xED\x0E\xC6\x0A\x6A" - "\xFC\x60\x2A\xE0\x93\xCE\xB8\x2E" - "\xA2\xA8\x0E\x79\x9E\x34\x5D\x37" - "\x6F\x12\xFE\x48\x7B\xE7\xB9\x22" - "\x29\xE8\xD7\xBE\x5D\xD1\x8B\xD9" - "\x91\x51\x4E\x71\xF2\x98\x85\x16" - "\x25\x7A\x76\x8A\x51\x0E\x65\x14" - "\x81\xB5\x3A\x37\xFD\xEC\xB5\x8A" - "\xE1\xCF\x41\x72\x14\x29\x4C\xF0" - "\x20\xD9\x9A\xC5\x66\xA4\x03\x76" - "\x5B\xA4\x15\x4F\x0E\x64\x39\x40" - "\x25\xF9\x20\x22\xF5\x88\xF5\xBA" - "\xE4\xDF\x45\x61\xBF\x8D\x7A\x24" - "\x4B\x92\x71\xD9\x2F\x77\xA7\x95" - "\xA8\x7F\x61\xD5\xA4\x57\xB0\xFB" - "\xB5\x77\xBA\x1C\xEE\x71\xFA\xB0" - "\x16\x4C\x18\x6B\xF2\x69\xA0\x07" - "\xEF\xBE\xEC\x69\xAC\xA8\x63\x9E", - .ilen = 504, - .result = "\x56\xED\x84\x1B\x8F\x26\xBD\x31" - "\xC8\x5F\xF6\x6A\x01\x98\x0C\xA3" - "\x3A\xD1\x45\xDC\x73\x0A\x7E\x15" - "\xAC\x20\xB7\x4E\xE5\x59\xF0\x87" - "\x1E\x92\x29\xC0\x34\xCB\x62\xF9" - "\x6D\x04\x9B\x0F\xA6\x3D\xD4\x48" - "\xDF\x76\x0D\x81\x18\xAF\x23\xBA" - "\x51\xE8\x5C\xF3\x8A\x21\x95\x2C" - "\xC3\x37\xCE\x65\xFC\x70\x07\x9E" - "\x12\xA9\x40\xD7\x4B\xE2\x79\x10" - "\x84\x1B\xB2\x26\xBD\x54\xEB\x5F" - "\xF6\x8D\x01\x98\x2F\xC6\x3A\xD1" - "\x68\xFF\x73\x0A\xA1\x15\xAC\x43" - "\xDA\x4E\xE5\x7C\x13\x87\x1E\xB5" - "\x29\xC0\x57\xEE\x62\xF9\x90\x04" - "\x9B\x32\xC9\x3D\xD4\x6B\x02\x76" - "\x0D\xA4\x18\xAF\x46\xDD\x51\xE8" - "\x7F\x16\x8A\x21\xB8\x2C\xC3\x5A" - "\xF1\x65\xFC\x93\x07\x9E\x35\xCC" - "\x40\xD7\x6E\x05\x79\x10\xA7\x1B" - "\xB2\x49\xE0\x54\xEB\x82\x19\x8D" - "\x24\xBB\x2F\xC6\x5D\xF4\x68\xFF" - "\x96\x0A\xA1\x38\xCF\x43\xDA\x71" - "\x08\x7C\x13\xAA\x1E\xB5\x4C\xE3" - "\x57\xEE\x85\x1C\x90\x27\xBE\x32" - "\xC9\x60\xF7\x6B\x02\x99\x0D\xA4" - "\x3B\xD2\x46\xDD\x74\x0B\x7F\x16" - "\xAD\x21\xB8\x4F\xE6\x5A\xF1\x88" - "\x1F\x93\x2A\xC1\x35\xCC\x63\xFA" - "\x6E\x05\x9C\x10\xA7\x3E\xD5\x49" - "\xE0\x77\x0E\x82\x19\xB0\x24\xBB" - "\x52\xE9\x5D\xF4\x8B\x22\x96\x2D" - "\xC4\x38\xCF\x66\xFD\x71\x08\x9F" - "\x13\xAA\x41\xD8\x4C\xE3\x7A\x11" - "\x85\x1C\xB3\x27\xBE\x55\xEC\x60" - "\xF7\x8E\x02\x99\x30\xC7\x3B\xD2" - "\x69\x00\x74\x0B\xA2\x16\xAD\x44" - "\xDB\x4F\xE6\x7D\x14\x88\x1F\xB6" - "\x2A\xC1\x58\xEF\x63\xFA\x91\x05" - "\x9C\x33\xCA\x3E\xD5\x6C\x03\x77" - "\x0E\xA5\x19\xB0\x47\xDE\x52\xE9" - "\x80\x17\x8B\x22\xB9\x2D\xC4\x5B" - "\xF2\x66\xFD\x94\x08\x9F\x36\xCD" - "\x41\xD8\x6F\x06\x7A\x11\xA8\x1C" - "\xB3\x4A\xE1\x55\xEC\x83\x1A\x8E" - "\x25\xBC\x30\xC7\x5E\xF5\x69\x00" - "\x97\x0B\xA2\x39\xD0\x44\xDB\x72" - "\x09\x7D\x14\xAB\x1F\xB6\x4D\xE4" - "\x58\xEF\x86\x1D\x91\x28\xBF\x33" - "\xCA\x61\xF8\x6C\x03\x9A\x0E\xA5" - "\x3C\xD3\x47\xDE\x75\x0C\x80\x17" - "\xAE\x22\xB9\x50\xE7\x5B\xF2\x89" - "\x20\x94\x2B\xC2\x36\xCD\x64\xFB" - "\x6F\x06\x9D\x11\xA8\x3F\xD6\x4A" - "\xE1\x78\x0F\x83\x1A\xB1\x25\xBC" - "\x53\xEA\x5E\xF5\x8C\x00\x97\x2E" - "\xC5\x39\xD0\x67\xFE\x72\x09\xA0" - "\x14\xAB\x42\xD9\x4D\xE4\x7B\x12" - "\x86\x1D\xB4\x28\xBF\x56\xED\x61" - "\xF8\x8F\x03\x9A\x31\xC8\x3C\xD3" - "\x6A\x01\x75\x0C\xA3\x17\xAE\x45" - "\xDC\x50\xE7\x7E\x15\x89\x20\xB7" - "\x2B\xC2\x59\xF0\x64\xFB\x92\x06", - .rlen = 504, }, }; @@ -3173,9 +2884,6 @@ static struct cipher_testvec tf_enc_tv_template[] = { "\x58\x33\x9B\x78\xC7\x58\x48\x6B" "\x2C\x75\x64\xC4\xCA\xC1\x7E\xD5", .rlen = 496, - .also_non_np = 1, - .np = 2, - .tap = { 496 - 16, 16 }, }, }; @@ -3341,9 +3049,6 @@ static struct cipher_testvec tf_dec_tv_template[] = { "\x6A\x01\x75\x0C\xA3\x17\xAE\x45" "\xDC\x50\xE7\x7E\x15\x89\x20\xB7", .rlen = 496, - .also_non_np = 1, - .np = 2, - .tap = { 496 - 16, 16 }, }, }; @@ -3524,9 +3229,6 @@ static struct cipher_testvec tf_cbc_enc_tv_template[] = { "\x30\x70\x56\xA4\x37\xDD\x7C\xC0" "\x0A\xA3\x30\x10\x26\x25\x41\x2C", .rlen = 496, - .also_non_np = 1, - .np = 2, - .tap = { 496 - 16, 16 }, }, }; @@ -3707,9 +3409,6 @@ static struct cipher_testvec tf_cbc_dec_tv_template[] = { "\x6A\x01\x75\x0C\xA3\x17\xAE\x45" "\xDC\x50\xE7\x7E\x15\x89\x20\xB7", .rlen = 496, - .also_non_np = 1, - .np = 2, - .tap = { 496 - 16, 16 }, }, }; @@ -3848,140 +3547,6 @@ static struct cipher_testvec tf_ctr_enc_tv_template[] = { "\xB9\x32\xE2\xC1\x82\xAC\xFE\xCC" "\xC5\xC9\x7F\x9E\xCF\x33\x7A\xDF", .rlen = 496, - }, { /* Generated with Crypto++ */ - .key = "\x85\x62\x3F\x1C\xF9\xD6\x1C\xF9" - "\xD6\xB3\x90\x6D\x4A\x90\x6D\x4A" - "\x27\x04\xE1\x27\x04\xE1\xBE\x9B" - "\x78\xBE\x9B\x78\x55\x32\x0F\x55", - .klen = 32, - .iv = "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF" - "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFD", - .input = "\x56\xED\x84\x1B\x8F\x26\xBD\x31" - "\xC8\x5F\xF6\x6A\x01\x98\x0C\xA3" - "\x3A\xD1\x45\xDC\x73\x0A\x7E\x15" - "\xAC\x20\xB7\x4E\xE5\x59\xF0\x87" - "\x1E\x92\x29\xC0\x34\xCB\x62\xF9" - "\x6D\x04\x9B\x0F\xA6\x3D\xD4\x48" - "\xDF\x76\x0D\x81\x18\xAF\x23\xBA" - "\x51\xE8\x5C\xF3\x8A\x21\x95\x2C" - "\xC3\x37\xCE\x65\xFC\x70\x07\x9E" - "\x12\xA9\x40\xD7\x4B\xE2\x79\x10" - "\x84\x1B\xB2\x26\xBD\x54\xEB\x5F" - "\xF6\x8D\x01\x98\x2F\xC6\x3A\xD1" - "\x68\xFF\x73\x0A\xA1\x15\xAC\x43" - "\xDA\x4E\xE5\x7C\x13\x87\x1E\xB5" - "\x29\xC0\x57\xEE\x62\xF9\x90\x04" - "\x9B\x32\xC9\x3D\xD4\x6B\x02\x76" - "\x0D\xA4\x18\xAF\x46\xDD\x51\xE8" - "\x7F\x16\x8A\x21\xB8\x2C\xC3\x5A" - "\xF1\x65\xFC\x93\x07\x9E\x35\xCC" - "\x40\xD7\x6E\x05\x79\x10\xA7\x1B" - "\xB2\x49\xE0\x54\xEB\x82\x19\x8D" - "\x24\xBB\x2F\xC6\x5D\xF4\x68\xFF" - "\x96\x0A\xA1\x38\xCF\x43\xDA\x71" - "\x08\x7C\x13\xAA\x1E\xB5\x4C\xE3" - "\x57\xEE\x85\x1C\x90\x27\xBE\x32" - "\xC9\x60\xF7\x6B\x02\x99\x0D\xA4" - "\x3B\xD2\x46\xDD\x74\x0B\x7F\x16" - "\xAD\x21\xB8\x4F\xE6\x5A\xF1\x88" - "\x1F\x93\x2A\xC1\x35\xCC\x63\xFA" - "\x6E\x05\x9C\x10\xA7\x3E\xD5\x49" - "\xE0\x77\x0E\x82\x19\xB0\x24\xBB" - "\x52\xE9\x5D\xF4\x8B\x22\x96\x2D" - "\xC4\x38\xCF\x66\xFD\x71\x08\x9F" - "\x13\xAA\x41\xD8\x4C\xE3\x7A\x11" - "\x85\x1C\xB3\x27\xBE\x55\xEC\x60" - "\xF7\x8E\x02\x99\x30\xC7\x3B\xD2" - "\x69\x00\x74\x0B\xA2\x16\xAD\x44" - "\xDB\x4F\xE6\x7D\x14\x88\x1F\xB6" - "\x2A\xC1\x58\xEF\x63\xFA\x91\x05" - "\x9C\x33\xCA\x3E\xD5\x6C\x03\x77" - "\x0E\xA5\x19\xB0\x47\xDE\x52\xE9" - "\x80\x17\x8B\x22\xB9\x2D\xC4\x5B" - "\xF2\x66\xFD\x94\x08\x9F\x36\xCD" - "\x41\xD8\x6F\x06\x7A\x11\xA8\x1C" - "\xB3\x4A\xE1\x55\xEC\x83\x1A\x8E" - "\x25\xBC\x30\xC7\x5E\xF5\x69\x00" - "\x97\x0B\xA2\x39\xD0\x44\xDB\x72" - "\x09\x7D\x14\xAB\x1F\xB6\x4D\xE4" - "\x58\xEF\x86\x1D\x91\x28\xBF\x33" - "\xCA\x61\xF8\x6C\x03\x9A\x0E\xA5" - "\x3C\xD3\x47\xDE\x75\x0C\x80\x17" - "\xAE\x22\xB9\x50\xE7\x5B\xF2\x89" - "\x20\x94\x2B\xC2\x36\xCD\x64\xFB" - "\x6F\x06\x9D\x11\xA8\x3F\xD6\x4A" - "\xE1\x78\x0F\x83\x1A\xB1\x25\xBC" - "\x53\xEA\x5E\xF5\x8C\x00\x97\x2E" - "\xC5\x39\xD0\x67\xFE\x72\x09\xA0" - "\x14\xAB\x42\xD9\x4D\xE4\x7B\x12" - "\x86\x1D\xB4\x28\xBF\x56\xED\x61" - "\xF8\x8F\x03\x9A\x31\xC8\x3C\xD3" - "\x6A\x01\x75\x0C\xA3\x17\xAE\x45" - "\xDC\x50\xE7\x7E\x15\x89\x20\xB7", - .ilen = 496, - .result = "\xEB\x44\xAF\x49\x27\xB8\xFB\x44" - "\x4C\xA6\xC3\x0C\x8B\xD0\x01\x0C" - "\x53\xC8\x16\x38\xDE\x40\x4F\x91" - "\x25\x6D\x4C\xA0\x9A\x87\x1E\xDA" - "\x88\x7E\x89\xE9\x67\x2B\x83\xA2" - "\x5F\x2E\x23\x3E\x45\xB9\x77\x7B" - "\xA6\x7E\x47\x36\x81\x9F\x9B\xF3" - "\xE0\xF0\xD7\x47\xA9\xC8\xEF\x33" - "\x0C\x43\xFE\x67\x50\x0A\x2C\x3E" - "\xA0\xE1\x25\x8E\x80\x07\x4A\xC0" - "\x64\x89\x9F\x6A\x27\x96\x07\xA6" - "\x9B\xC8\x1B\x21\x60\xAE\x5D\x01" - "\xE2\xCD\xC8\xAA\x6C\x9D\x1C\x34" - "\x39\x18\x09\xA4\x82\x59\x78\xE7" - "\xFC\x59\x65\xF2\x94\xFF\xFB\xE2" - "\x3C\xDA\xB1\x90\x95\xBF\x91\xE3" - "\xE6\x87\x31\x9E\x16\x85\xAD\xB1" - "\x4C\xAE\x43\x4D\x19\x58\xB5\x5E" - "\x2E\xF5\x09\xAA\x39\xF4\xC0\xB3" - "\xD4\x4D\xDB\x73\x7A\xD4\xF1\xBF" - "\x89\x16\x4D\x2D\xA2\x26\x33\x72" - "\x18\x33\x7E\xD6\xD2\x16\xA4\x54" - "\xF4\x8C\xB3\x52\xDF\x21\x9C\xEB" - "\xBF\x49\xD3\xF9\x05\x06\xCB\xD2" - "\xA9\xD2\x3B\x6E\x19\x8C\xBC\x19" - "\xAB\x89\xD6\xD8\xCD\x56\x89\x5E" - "\xAC\x00\xE3\x50\x63\x4A\x80\x9A" - "\x05\xBC\x50\x39\xD3\x32\xD9\x0D" - "\xE3\x20\x0D\x75\x54\xEC\xE6\x31" - "\x14\xB9\x3A\x59\x00\x43\x37\x8E" - "\x8C\x5A\x79\x62\x14\x76\x8A\xAE" - "\x8F\xCC\xA1\x6C\x38\x78\xDD\x2D" - "\x8B\x6D\xEA\xBD\x7B\x25\xFF\x60" - "\xC9\x87\xB1\x79\x1E\xA5\x86\x68" - "\x81\xB4\xE2\xC1\x05\x7D\x3A\x73" - "\xD0\xDA\x75\x77\x9E\x05\x27\xF1" - "\x08\xA9\x66\x64\x6C\xBC\x82\x17" - "\x2C\x23\x5F\x62\x4D\x02\x1A\x58" - "\xE7\xB7\x23\x6D\xE2\x20\xDA\xEF" - "\xB4\xB3\x3F\xB2\x2B\x69\x98\x83" - "\x95\x87\x13\x57\x60\xD7\xB5\xB1" - "\xEE\x0A\x2F\x95\x36\x4C\x76\x5D" - "\x5F\xD9\x19\xED\xB9\xA5\x48\xBF" - "\xC8\xAB\x0F\x71\xCC\x61\x8E\x0A" - "\xD0\x29\x44\xA8\xB9\xC1\xE8\xC8" - "\xC9\xA8\x28\x81\xFB\x50\xF2\xF0" - "\x26\xAE\x39\xB8\x91\xCD\xA8\xAC" - "\xDE\x55\x1B\x50\x14\x53\x44\x17" - "\x54\x46\xFC\xB1\xE4\x07\x6B\x9A" - "\x01\x14\xF0\x2E\x2E\xDB\x46\x1B" - "\x1A\x09\x97\xA9\xB6\x97\x79\x06" - "\xFB\xCB\x85\xCF\xDD\xA1\x41\xB1" - "\x00\xAA\xF7\xE0\x89\x73\xFB\xE5" - "\xBF\x84\xDB\xC9\xCD\xC4\xA2\x0D" - "\x3B\xAC\xF9\xDF\x96\xBF\x88\x23" - "\x41\x67\xA1\x24\x99\x7E\xCC\x9B" - "\x02\x8F\x6A\x49\xF6\x25\xBA\x7A" - "\xF4\x78\xFD\x79\x62\x63\x4F\x14" - "\xD6\x11\x11\x04\x05\x5F\x7E\xEA" - "\x4C\xB6\xF8\xF4\x5F\x48\x52\x54" - "\x94\x63\xA8\x4E\xCF\xD2\x1B\x1B" - "\x22\x18\x6A\xAF\x6E\x3E\xE1\x0D", - .rlen = 496, }, { /* Generated with Crypto++ */ .key = "\x85\x62\x3F\x1C\xF9\xD6\x1C\xF9" "\xD6\xB3\x90\x6D\x4A\x90\x6D\x4A" @@ -4118,9 +3683,6 @@ static struct cipher_testvec tf_ctr_enc_tv_template[] = { "\xC5\xC9\x7F\x9E\xCF\x33\x7A\xDF" "\x6C\x82\x9D", .rlen = 499, - .also_non_np = 1, - .np = 2, - .tap = { 499 - 16, 16 }, }, }; @@ -4259,140 +3821,6 @@ static struct cipher_testvec tf_ctr_dec_tv_template[] = { "\x6A\x01\x75\x0C\xA3\x17\xAE\x45" "\xDC\x50\xE7\x7E\x15\x89\x20\xB7", .rlen = 496, - }, { /* Generated with Crypto++ */ - .key = "\x85\x62\x3F\x1C\xF9\xD6\x1C\xF9" - "\xD6\xB3\x90\x6D\x4A\x90\x6D\x4A" - "\x27\x04\xE1\x27\x04\xE1\xBE\x9B" - "\x78\xBE\x9B\x78\x55\x32\x0F\x55", - .klen = 32, - .iv = "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF" - "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFD", - .input = "\xEB\x44\xAF\x49\x27\xB8\xFB\x44" - "\x4C\xA6\xC3\x0C\x8B\xD0\x01\x0C" - "\x53\xC8\x16\x38\xDE\x40\x4F\x91" - "\x25\x6D\x4C\xA0\x9A\x87\x1E\xDA" - "\x88\x7E\x89\xE9\x67\x2B\x83\xA2" - "\x5F\x2E\x23\x3E\x45\xB9\x77\x7B" - "\xA6\x7E\x47\x36\x81\x9F\x9B\xF3" - "\xE0\xF0\xD7\x47\xA9\xC8\xEF\x33" - "\x0C\x43\xFE\x67\x50\x0A\x2C\x3E" - "\xA0\xE1\x25\x8E\x80\x07\x4A\xC0" - "\x64\x89\x9F\x6A\x27\x96\x07\xA6" - "\x9B\xC8\x1B\x21\x60\xAE\x5D\x01" - "\xE2\xCD\xC8\xAA\x6C\x9D\x1C\x34" - "\x39\x18\x09\xA4\x82\x59\x78\xE7" - "\xFC\x59\x65\xF2\x94\xFF\xFB\xE2" - "\x3C\xDA\xB1\x90\x95\xBF\x91\xE3" - "\xE6\x87\x31\x9E\x16\x85\xAD\xB1" - "\x4C\xAE\x43\x4D\x19\x58\xB5\x5E" - "\x2E\xF5\x09\xAA\x39\xF4\xC0\xB3" - "\xD4\x4D\xDB\x73\x7A\xD4\xF1\xBF" - "\x89\x16\x4D\x2D\xA2\x26\x33\x72" - "\x18\x33\x7E\xD6\xD2\x16\xA4\x54" - "\xF4\x8C\xB3\x52\xDF\x21\x9C\xEB" - "\xBF\x49\xD3\xF9\x05\x06\xCB\xD2" - "\xA9\xD2\x3B\x6E\x19\x8C\xBC\x19" - "\xAB\x89\xD6\xD8\xCD\x56\x89\x5E" - "\xAC\x00\xE3\x50\x63\x4A\x80\x9A" - "\x05\xBC\x50\x39\xD3\x32\xD9\x0D" - "\xE3\x20\x0D\x75\x54\xEC\xE6\x31" - "\x14\xB9\x3A\x59\x00\x43\x37\x8E" - "\x8C\x5A\x79\x62\x14\x76\x8A\xAE" - "\x8F\xCC\xA1\x6C\x38\x78\xDD\x2D" - "\x8B\x6D\xEA\xBD\x7B\x25\xFF\x60" - "\xC9\x87\xB1\x79\x1E\xA5\x86\x68" - "\x81\xB4\xE2\xC1\x05\x7D\x3A\x73" - "\xD0\xDA\x75\x77\x9E\x05\x27\xF1" - "\x08\xA9\x66\x64\x6C\xBC\x82\x17" - "\x2C\x23\x5F\x62\x4D\x02\x1A\x58" - "\xE7\xB7\x23\x6D\xE2\x20\xDA\xEF" - "\xB4\xB3\x3F\xB2\x2B\x69\x98\x83" - "\x95\x87\x13\x57\x60\xD7\xB5\xB1" - "\xEE\x0A\x2F\x95\x36\x4C\x76\x5D" - "\x5F\xD9\x19\xED\xB9\xA5\x48\xBF" - "\xC8\xAB\x0F\x71\xCC\x61\x8E\x0A" - "\xD0\x29\x44\xA8\xB9\xC1\xE8\xC8" - "\xC9\xA8\x28\x81\xFB\x50\xF2\xF0" - "\x26\xAE\x39\xB8\x91\xCD\xA8\xAC" - "\xDE\x55\x1B\x50\x14\x53\x44\x17" - "\x54\x46\xFC\xB1\xE4\x07\x6B\x9A" - "\x01\x14\xF0\x2E\x2E\xDB\x46\x1B" - "\x1A\x09\x97\xA9\xB6\x97\x79\x06" - "\xFB\xCB\x85\xCF\xDD\xA1\x41\xB1" - "\x00\xAA\xF7\xE0\x89\x73\xFB\xE5" - "\xBF\x84\xDB\xC9\xCD\xC4\xA2\x0D" - "\x3B\xAC\xF9\xDF\x96\xBF\x88\x23" - "\x41\x67\xA1\x24\x99\x7E\xCC\x9B" - "\x02\x8F\x6A\x49\xF6\x25\xBA\x7A" - "\xF4\x78\xFD\x79\x62\x63\x4F\x14" - "\xD6\x11\x11\x04\x05\x5F\x7E\xEA" - "\x4C\xB6\xF8\xF4\x5F\x48\x52\x54" - "\x94\x63\xA8\x4E\xCF\xD2\x1B\x1B" - "\x22\x18\x6A\xAF\x6E\x3E\xE1\x0D", - .ilen = 496, - .result = "\x56\xED\x84\x1B\x8F\x26\xBD\x31" - "\xC8\x5F\xF6\x6A\x01\x98\x0C\xA3" - "\x3A\xD1\x45\xDC\x73\x0A\x7E\x15" - "\xAC\x20\xB7\x4E\xE5\x59\xF0\x87" - "\x1E\x92\x29\xC0\x34\xCB\x62\xF9" - "\x6D\x04\x9B\x0F\xA6\x3D\xD4\x48" - "\xDF\x76\x0D\x81\x18\xAF\x23\xBA" - "\x51\xE8\x5C\xF3\x8A\x21\x95\x2C" - "\xC3\x37\xCE\x65\xFC\x70\x07\x9E" - "\x12\xA9\x40\xD7\x4B\xE2\x79\x10" - "\x84\x1B\xB2\x26\xBD\x54\xEB\x5F" - "\xF6\x8D\x01\x98\x2F\xC6\x3A\xD1" - "\x68\xFF\x73\x0A\xA1\x15\xAC\x43" - "\xDA\x4E\xE5\x7C\x13\x87\x1E\xB5" - "\x29\xC0\x57\xEE\x62\xF9\x90\x04" - "\x9B\x32\xC9\x3D\xD4\x6B\x02\x76" - "\x0D\xA4\x18\xAF\x46\xDD\x51\xE8" - "\x7F\x16\x8A\x21\xB8\x2C\xC3\x5A" - "\xF1\x65\xFC\x93\x07\x9E\x35\xCC" - "\x40\xD7\x6E\x05\x79\x10\xA7\x1B" - "\xB2\x49\xE0\x54\xEB\x82\x19\x8D" - "\x24\xBB\x2F\xC6\x5D\xF4\x68\xFF" - "\x96\x0A\xA1\x38\xCF\x43\xDA\x71" - "\x08\x7C\x13\xAA\x1E\xB5\x4C\xE3" - "\x57\xEE\x85\x1C\x90\x27\xBE\x32" - "\xC9\x60\xF7\x6B\x02\x99\x0D\xA4" - "\x3B\xD2\x46\xDD\x74\x0B\x7F\x16" - "\xAD\x21\xB8\x4F\xE6\x5A\xF1\x88" - "\x1F\x93\x2A\xC1\x35\xCC\x63\xFA" - "\x6E\x05\x9C\x10\xA7\x3E\xD5\x49" - "\xE0\x77\x0E\x82\x19\xB0\x24\xBB" - "\x52\xE9\x5D\xF4\x8B\x22\x96\x2D" - "\xC4\x38\xCF\x66\xFD\x71\x08\x9F" - "\x13\xAA\x41\xD8\x4C\xE3\x7A\x11" - "\x85\x1C\xB3\x27\xBE\x55\xEC\x60" - "\xF7\x8E\x02\x99\x30\xC7\x3B\xD2" - "\x69\x00\x74\x0B\xA2\x16\xAD\x44" - "\xDB\x4F\xE6\x7D\x14\x88\x1F\xB6" - "\x2A\xC1\x58\xEF\x63\xFA\x91\x05" - "\x9C\x33\xCA\x3E\xD5\x6C\x03\x77" - "\x0E\xA5\x19\xB0\x47\xDE\x52\xE9" - "\x80\x17\x8B\x22\xB9\x2D\xC4\x5B" - "\xF2\x66\xFD\x94\x08\x9F\x36\xCD" - "\x41\xD8\x6F\x06\x7A\x11\xA8\x1C" - "\xB3\x4A\xE1\x55\xEC\x83\x1A\x8E" - "\x25\xBC\x30\xC7\x5E\xF5\x69\x00" - "\x97\x0B\xA2\x39\xD0\x44\xDB\x72" - "\x09\x7D\x14\xAB\x1F\xB6\x4D\xE4" - "\x58\xEF\x86\x1D\x91\x28\xBF\x33" - "\xCA\x61\xF8\x6C\x03\x9A\x0E\xA5" - "\x3C\xD3\x47\xDE\x75\x0C\x80\x17" - "\xAE\x22\xB9\x50\xE7\x5B\xF2\x89" - "\x20\x94\x2B\xC2\x36\xCD\x64\xFB" - "\x6F\x06\x9D\x11\xA8\x3F\xD6\x4A" - "\xE1\x78\x0F\x83\x1A\xB1\x25\xBC" - "\x53\xEA\x5E\xF5\x8C\x00\x97\x2E" - "\xC5\x39\xD0\x67\xFE\x72\x09\xA0" - "\x14\xAB\x42\xD9\x4D\xE4\x7B\x12" - "\x86\x1D\xB4\x28\xBF\x56\xED\x61" - "\xF8\x8F\x03\x9A\x31\xC8\x3C\xD3" - "\x6A\x01\x75\x0C\xA3\x17\xAE\x45" - "\xDC\x50\xE7\x7E\x15\x89\x20\xB7", - .rlen = 496, }, { /* Generated with Crypto++ */ .key = "\x85\x62\x3F\x1C\xF9\xD6\x1C\xF9" "\xD6\xB3\x90\x6D\x4A\x90\x6D\x4A" @@ -4529,9 +3957,6 @@ static struct cipher_testvec tf_ctr_dec_tv_template[] = { "\xDC\x50\xE7\x7E\x15\x89\x20\xB7" "\x2B\xC2\x59", .rlen = 499, - .also_non_np = 1, - .np = 2, - .tap = { 499 - 16, 16 }, }, }; @@ -4781,9 +4206,6 @@ static struct cipher_testvec tf_lrw_enc_tv_template[] = { "\x80\x18\xc4\x6c\x03\xd3\xb7\xba" "\x11\xd7\xb8\x6e\xea\xe1\x80\x30", .rlen = 512, - .also_non_np = 1, - .np = 2, - .tap = { 512 - 16, 16 }, }, }; @@ -5034,9 +4456,6 @@ static struct cipher_testvec tf_lrw_dec_tv_template[] = { "\xe9\x2e\xc4\x29\x0f\x84\xdb\xc4" "\x21\xc4\xc2\x75\x67\x89\x37\x0a", .rlen = 512, - .also_non_np = 1, - .np = 2, - .tap = { 512 - 16, 16 }, }, }; @@ -5376,9 +4795,6 @@ static struct cipher_testvec tf_xts_enc_tv_template[] = { "\xa4\x05\x0b\xb2\xb3\xa8\x30\x97" "\x37\x30\xe1\x91\x8d\xb3\x2a\xff", .rlen = 512, - .also_non_np = 1, - .np = 2, - .tap = { 512 - 16, 16 }, }, }; @@ -5719,9 +5135,6 @@ static struct cipher_testvec tf_xts_dec_tv_template[] = { "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7" "\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff", .rlen = 512, - .also_non_np = 1, - .np = 2, - .tap = { 512 - 16, 16 }, }, }; @@ -5829,9 +5242,6 @@ static struct cipher_testvec serpent_enc_tv_template[] = { "\x30\xD4\x2C\xF2\x8E\x06\x4B\x39" "\xB3\x12\x1D\xB3\x17\x46\xE6\xD6", .rlen = 144, - .also_non_np = 1, - .np = 2, - .tap = { 144 - 16, 16 }, }, }; @@ -5967,9 +5377,6 @@ static struct cipher_testvec serpent_dec_tv_template[] = { "\x0D\xA4\x18\xAF\x46\xDD\x51\xE8" "\x7F\x16\x8A\x21\xB8\x2C\xC3\x5A", .rlen = 144, - .also_non_np = 1, - .np = 2, - .tap = { 144 - 16, 16 }, }, }; @@ -6061,9 +5468,6 @@ static struct cipher_testvec serpent_cbc_enc_tv_template[] = { "\x27\xDF\x89\x1D\x86\x3E\xF7\x5A" "\xF6\xE3\x0F\xC7\x6B\x4C\x96\x7C", .rlen = 144, - .also_non_np = 1, - .np = 2, - .tap = { 144 - 16, 16 }, }, }; @@ -6114,9 +5518,6 @@ static struct cipher_testvec serpent_cbc_dec_tv_template[] = { "\x0D\xA4\x18\xAF\x46\xDD\x51\xE8" "\x7F\x16\x8A\x21\xB8\x2C\xC3\x5A", .rlen = 144, - .also_non_np = 1, - .np = 2, - .tap = { 144 - 16, 16 }, }, }; @@ -6215,143 +5616,6 @@ static struct cipher_testvec serpent_ctr_enc_tv_template[] = { "\x5D\xE1\x4F\xA1\xEA\xB3\xCA\xB9" "\xE6\xD0\x97", .rlen = 147, - .also_non_np = 1, - .np = 2, - .tap = { 147 - 16, 16 }, - }, { /* Generated with Crypto++ */ - .key = "\x85\x62\x3F\x1C\xF9\xD6\x1C\xF9" - "\xD6\xB3\x90\x6D\x4A\x90\x6D\x4A" - "\x27\x04\xE1\x27\x04\xE1\xBE\x9B" - "\x78\xBE\x9B\x78\x55\x32\x0F\x55", - .klen = 32, - .iv = "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF" - "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFD", - .input = "\x56\xED\x84\x1B\x8F\x26\xBD\x31" - "\xC8\x5F\xF6\x6A\x01\x98\x0C\xA3" - "\x3A\xD1\x45\xDC\x73\x0A\x7E\x15" - "\xAC\x20\xB7\x4E\xE5\x59\xF0\x87" - "\x1E\x92\x29\xC0\x34\xCB\x62\xF9" - "\x6D\x04\x9B\x0F\xA6\x3D\xD4\x48" - "\xDF\x76\x0D\x81\x18\xAF\x23\xBA" - "\x51\xE8\x5C\xF3\x8A\x21\x95\x2C" - "\xC3\x37\xCE\x65\xFC\x70\x07\x9E" - "\x12\xA9\x40\xD7\x4B\xE2\x79\x10" - "\x84\x1B\xB2\x26\xBD\x54\xEB\x5F" - "\xF6\x8D\x01\x98\x2F\xC6\x3A\xD1" - "\x68\xFF\x73\x0A\xA1\x15\xAC\x43" - "\xDA\x4E\xE5\x7C\x13\x87\x1E\xB5" - "\x29\xC0\x57\xEE\x62\xF9\x90\x04" - "\x9B\x32\xC9\x3D\xD4\x6B\x02\x76" - "\x0D\xA4\x18\xAF\x46\xDD\x51\xE8" - "\x7F\x16\x8A\x21\xB8\x2C\xC3\x5A" - "\xF1\x65\xFC\x93\x07\x9E\x35\xCC" - "\x40\xD7\x6E\x05\x79\x10\xA7\x1B" - "\xB2\x49\xE0\x54\xEB\x82\x19\x8D" - "\x24\xBB\x2F\xC6\x5D\xF4\x68\xFF" - "\x96\x0A\xA1\x38\xCF\x43\xDA\x71" - "\x08\x7C\x13\xAA\x1E\xB5\x4C\xE3" - "\x57\xEE\x85\x1C\x90\x27\xBE\x32" - "\xC9\x60\xF7\x6B\x02\x99\x0D\xA4" - "\x3B\xD2\x46\xDD\x74\x0B\x7F\x16" - "\xAD\x21\xB8\x4F\xE6\x5A\xF1\x88" - "\x1F\x93\x2A\xC1\x35\xCC\x63\xFA" - "\x6E\x05\x9C\x10\xA7\x3E\xD5\x49" - "\xE0\x77\x0E\x82\x19\xB0\x24\xBB" - "\x52\xE9\x5D\xF4\x8B\x22\x96\x2D" - "\xC4\x38\xCF\x66\xFD\x71\x08\x9F" - "\x13\xAA\x41\xD8\x4C\xE3\x7A\x11" - "\x85\x1C\xB3\x27\xBE\x55\xEC\x60" - "\xF7\x8E\x02\x99\x30\xC7\x3B\xD2" - "\x69\x00\x74\x0B\xA2\x16\xAD\x44" - "\xDB\x4F\xE6\x7D\x14\x88\x1F\xB6" - "\x2A\xC1\x58\xEF\x63\xFA\x91\x05" - "\x9C\x33\xCA\x3E\xD5\x6C\x03\x77" - "\x0E\xA5\x19\xB0\x47\xDE\x52\xE9" - "\x80\x17\x8B\x22\xB9\x2D\xC4\x5B" - "\xF2\x66\xFD\x94\x08\x9F\x36\xCD" - "\x41\xD8\x6F\x06\x7A\x11\xA8\x1C" - "\xB3\x4A\xE1\x55\xEC\x83\x1A\x8E" - "\x25\xBC\x30\xC7\x5E\xF5\x69\x00" - "\x97\x0B\xA2\x39\xD0\x44\xDB\x72" - "\x09\x7D\x14\xAB\x1F\xB6\x4D\xE4" - "\x58\xEF\x86\x1D\x91\x28\xBF\x33" - "\xCA\x61\xF8\x6C\x03\x9A\x0E\xA5" - "\x3C\xD3\x47\xDE\x75\x0C\x80\x17" - "\xAE\x22\xB9\x50\xE7\x5B\xF2\x89" - "\x20\x94\x2B\xC2\x36\xCD\x64\xFB" - "\x6F\x06\x9D\x11\xA8\x3F\xD6\x4A" - "\xE1\x78\x0F\x83\x1A\xB1\x25\xBC" - "\x53\xEA\x5E\xF5\x8C\x00\x97\x2E" - "\xC5\x39\xD0\x67\xFE\x72\x09\xA0" - "\x14\xAB\x42\xD9\x4D\xE4\x7B\x12" - "\x86\x1D\xB4\x28\xBF\x56\xED\x61" - "\xF8\x8F\x03\x9A\x31\xC8\x3C\xD3" - "\x6A\x01\x75\x0C\xA3\x17\xAE\x45" - "\xDC\x50\xE7\x7E\x15\x89\x20\xB7", - .ilen = 496, - .result = "\x06\x9A\xF8\xB4\x53\x88\x62\xFC" - "\x68\xB8\x2E\xDF\xC1\x05\x0F\x3D" - "\xAF\x4D\x95\xAE\xC4\xE9\x1C\xDC" - "\xF6\x2B\x8F\x90\x89\xF6\x7E\x1A" - "\xA6\xB9\xE4\xF4\xFA\xCA\xE5\x7E" - "\x71\x28\x06\x4F\xE8\x08\x39\xDA" - "\xA5\x0E\xC8\xC0\xB8\x16\xE5\x69" - "\xE5\xCA\xEC\x4F\x63\x2C\xC0\x9B" - "\x9F\x3E\x39\x79\xF0\xCD\x64\x35" - "\x4A\xD3\xC8\xA9\x31\xCD\x48\x5B" - "\x92\x3D\x8F\x3F\x96\xBD\xB3\x18" - "\x74\x2A\x5D\x29\x3F\x57\x8F\xE2" - "\x67\x9A\xE0\xE5\xD4\x4A\xE2\x47" - "\xBC\xF6\xEB\x14\xF3\x8C\x20\xC2" - "\x7D\xE2\x43\x81\x86\x72\x2E\xB1" - "\x39\xF6\x95\xE1\x1F\xCB\x76\x33" - "\x5B\x7D\x23\x0F\x3A\x67\x2A\x2F" - "\xB9\x37\x9D\xDD\x1F\x16\xA1\x3C" - "\x70\xFE\x52\xAA\x93\x3C\xC4\x46" - "\xB1\xE5\xFF\xDA\xAF\xE2\x84\xFE" - "\x25\x92\xB2\x63\xBD\x49\x77\xB4" - "\x22\xA4\x6A\xD5\x04\xE0\x45\x58" - "\x1C\x34\x96\x7C\x03\x0C\x13\xA2" - "\x05\x22\xE2\xCB\x5A\x35\x03\x09" - "\x40\xD2\x82\x05\xCA\x58\x73\xF2" - "\x29\x5E\x01\x47\x13\x32\x78\xBE" - "\x06\xB0\x51\xDB\x6C\x31\xA0\x1C" - "\x74\xBC\x8D\x25\xDF\xF8\x65\xD1" - "\x38\x35\x11\x26\x4A\xB4\x06\x32" - "\xFA\xD2\x07\x77\xB3\x74\x98\x80" - "\x61\x59\xA8\x9F\xF3\x6F\x2A\xBF" - "\xE6\xA5\x9A\xC4\x6B\xA6\x49\x6F" - "\xBC\x47\xD9\xFB\xC6\xEF\x25\x65" - "\x96\xAC\x9F\xE4\x81\x4B\xD8\xBA" - "\xD6\x9B\xC9\x6D\x58\x40\x81\x02" - "\x73\x44\x4E\x43\x6E\x37\xBB\x11" - "\xE3\xF9\xB8\x2F\xEC\x76\x34\xEA" - "\x90\xCD\xB7\x2E\x0E\x32\x71\xE8" - "\xBB\x4E\x0B\x98\xA4\x17\x17\x5B" - "\x07\xB5\x82\x3A\xC4\xE8\x42\x51" - "\x5A\x4C\x4E\x7D\xBF\xC4\xC0\x4F" - "\x68\xB8\xC6\x4A\x32\x6F\x0B\xD7" - "\x85\xED\x6B\xFB\x72\xD2\xA5\x8F" - "\xBF\xF9\xAC\x59\x50\xA8\x08\x70" - "\xEC\xBD\x0A\xBF\xE5\x87\xA1\xC2" - "\x92\x14\x78\xAF\xE8\xEA\x2E\xDD" - "\xC1\x03\x9A\xAA\x89\x8B\x32\x46" - "\x5B\x18\x27\xBA\x46\xAA\x64\xDE" - "\xE3\xD5\xA3\xFC\x7B\x5B\x61\xDB" - "\x7E\xDA\xEC\x30\x17\x19\xF8\x80" - "\xB5\x5E\x27\xB5\x37\x3A\x1F\x28" - "\x07\x73\xC3\x63\xCE\xFF\x8C\xFE" - "\x81\x4E\xF8\x24\xF3\xB8\xC7\xE8" - "\x16\x9A\xCC\x58\x2F\x88\x1C\x4B" - "\xBB\x33\xA2\x73\xF0\x1C\x89\x0E" - "\xDC\x34\x27\x89\x98\xCE\x1C\xA2" - "\xD8\xB8\x90\xBE\xEC\x72\x28\x13" - "\xAC\x7B\xF1\xD0\x7F\x7A\x28\x50" - "\xB7\x99\x65\x8A\xC9\xC6\x21\x34" - "\x7F\x67\x9D\xB7\x2C\xCC\xF5\x17" - "\x2B\x89\xAC\xB0\xD7\x1E\x47\xB0" - "\x61\xAF\xD4\x63\x6D\xB8\x2D\x20", - .rlen = 496, }, }; @@ -6450,143 +5714,6 @@ static struct cipher_testvec serpent_ctr_dec_tv_template[] = { "\x7F\x16\x8A\x21\xB8\x2C\xC3\x5A" "\xF1\x65\xFC", .rlen = 147, - .also_non_np = 1, - .np = 2, - .tap = { 147 - 16, 16 }, - }, { /* Generated with Crypto++ */ - .key = "\x85\x62\x3F\x1C\xF9\xD6\x1C\xF9" - "\xD6\xB3\x90\x6D\x4A\x90\x6D\x4A" - "\x27\x04\xE1\x27\x04\xE1\xBE\x9B" - "\x78\xBE\x9B\x78\x55\x32\x0F\x55", - .klen = 32, - .iv = "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF" - "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFD", - .input = "\x06\x9A\xF8\xB4\x53\x88\x62\xFC" - "\x68\xB8\x2E\xDF\xC1\x05\x0F\x3D" - "\xAF\x4D\x95\xAE\xC4\xE9\x1C\xDC" - "\xF6\x2B\x8F\x90\x89\xF6\x7E\x1A" - "\xA6\xB9\xE4\xF4\xFA\xCA\xE5\x7E" - "\x71\x28\x06\x4F\xE8\x08\x39\xDA" - "\xA5\x0E\xC8\xC0\xB8\x16\xE5\x69" - "\xE5\xCA\xEC\x4F\x63\x2C\xC0\x9B" - "\x9F\x3E\x39\x79\xF0\xCD\x64\x35" - "\x4A\xD3\xC8\xA9\x31\xCD\x48\x5B" - "\x92\x3D\x8F\x3F\x96\xBD\xB3\x18" - "\x74\x2A\x5D\x29\x3F\x57\x8F\xE2" - "\x67\x9A\xE0\xE5\xD4\x4A\xE2\x47" - "\xBC\xF6\xEB\x14\xF3\x8C\x20\xC2" - "\x7D\xE2\x43\x81\x86\x72\x2E\xB1" - "\x39\xF6\x95\xE1\x1F\xCB\x76\x33" - "\x5B\x7D\x23\x0F\x3A\x67\x2A\x2F" - "\xB9\x37\x9D\xDD\x1F\x16\xA1\x3C" - "\x70\xFE\x52\xAA\x93\x3C\xC4\x46" - "\xB1\xE5\xFF\xDA\xAF\xE2\x84\xFE" - "\x25\x92\xB2\x63\xBD\x49\x77\xB4" - "\x22\xA4\x6A\xD5\x04\xE0\x45\x58" - "\x1C\x34\x96\x7C\x03\x0C\x13\xA2" - "\x05\x22\xE2\xCB\x5A\x35\x03\x09" - "\x40\xD2\x82\x05\xCA\x58\x73\xF2" - "\x29\x5E\x01\x47\x13\x32\x78\xBE" - "\x06\xB0\x51\xDB\x6C\x31\xA0\x1C" - "\x74\xBC\x8D\x25\xDF\xF8\x65\xD1" - "\x38\x35\x11\x26\x4A\xB4\x06\x32" - "\xFA\xD2\x07\x77\xB3\x74\x98\x80" - "\x61\x59\xA8\x9F\xF3\x6F\x2A\xBF" - "\xE6\xA5\x9A\xC4\x6B\xA6\x49\x6F" - "\xBC\x47\xD9\xFB\xC6\xEF\x25\x65" - "\x96\xAC\x9F\xE4\x81\x4B\xD8\xBA" - "\xD6\x9B\xC9\x6D\x58\x40\x81\x02" - "\x73\x44\x4E\x43\x6E\x37\xBB\x11" - "\xE3\xF9\xB8\x2F\xEC\x76\x34\xEA" - "\x90\xCD\xB7\x2E\x0E\x32\x71\xE8" - "\xBB\x4E\x0B\x98\xA4\x17\x17\x5B" - "\x07\xB5\x82\x3A\xC4\xE8\x42\x51" - "\x5A\x4C\x4E\x7D\xBF\xC4\xC0\x4F" - "\x68\xB8\xC6\x4A\x32\x6F\x0B\xD7" - "\x85\xED\x6B\xFB\x72\xD2\xA5\x8F" - "\xBF\xF9\xAC\x59\x50\xA8\x08\x70" - "\xEC\xBD\x0A\xBF\xE5\x87\xA1\xC2" - "\x92\x14\x78\xAF\xE8\xEA\x2E\xDD" - "\xC1\x03\x9A\xAA\x89\x8B\x32\x46" - "\x5B\x18\x27\xBA\x46\xAA\x64\xDE" - "\xE3\xD5\xA3\xFC\x7B\x5B\x61\xDB" - "\x7E\xDA\xEC\x30\x17\x19\xF8\x80" - "\xB5\x5E\x27\xB5\x37\x3A\x1F\x28" - "\x07\x73\xC3\x63\xCE\xFF\x8C\xFE" - "\x81\x4E\xF8\x24\xF3\xB8\xC7\xE8" - "\x16\x9A\xCC\x58\x2F\x88\x1C\x4B" - "\xBB\x33\xA2\x73\xF0\x1C\x89\x0E" - "\xDC\x34\x27\x89\x98\xCE\x1C\xA2" - "\xD8\xB8\x90\xBE\xEC\x72\x28\x13" - "\xAC\x7B\xF1\xD0\x7F\x7A\x28\x50" - "\xB7\x99\x65\x8A\xC9\xC6\x21\x34" - "\x7F\x67\x9D\xB7\x2C\xCC\xF5\x17" - "\x2B\x89\xAC\xB0\xD7\x1E\x47\xB0" - "\x61\xAF\xD4\x63\x6D\xB8\x2D\x20", - .ilen = 496, - .result = "\x56\xED\x84\x1B\x8F\x26\xBD\x31" - "\xC8\x5F\xF6\x6A\x01\x98\x0C\xA3" - "\x3A\xD1\x45\xDC\x73\x0A\x7E\x15" - "\xAC\x20\xB7\x4E\xE5\x59\xF0\x87" - "\x1E\x92\x29\xC0\x34\xCB\x62\xF9" - "\x6D\x04\x9B\x0F\xA6\x3D\xD4\x48" - "\xDF\x76\x0D\x81\x18\xAF\x23\xBA" - "\x51\xE8\x5C\xF3\x8A\x21\x95\x2C" - "\xC3\x37\xCE\x65\xFC\x70\x07\x9E" - "\x12\xA9\x40\xD7\x4B\xE2\x79\x10" - "\x84\x1B\xB2\x26\xBD\x54\xEB\x5F" - "\xF6\x8D\x01\x98\x2F\xC6\x3A\xD1" - "\x68\xFF\x73\x0A\xA1\x15\xAC\x43" - "\xDA\x4E\xE5\x7C\x13\x87\x1E\xB5" - "\x29\xC0\x57\xEE\x62\xF9\x90\x04" - "\x9B\x32\xC9\x3D\xD4\x6B\x02\x76" - "\x0D\xA4\x18\xAF\x46\xDD\x51\xE8" - "\x7F\x16\x8A\x21\xB8\x2C\xC3\x5A" - "\xF1\x65\xFC\x93\x07\x9E\x35\xCC" - "\x40\xD7\x6E\x05\x79\x10\xA7\x1B" - "\xB2\x49\xE0\x54\xEB\x82\x19\x8D" - "\x24\xBB\x2F\xC6\x5D\xF4\x68\xFF" - "\x96\x0A\xA1\x38\xCF\x43\xDA\x71" - "\x08\x7C\x13\xAA\x1E\xB5\x4C\xE3" - "\x57\xEE\x85\x1C\x90\x27\xBE\x32" - "\xC9\x60\xF7\x6B\x02\x99\x0D\xA4" - "\x3B\xD2\x46\xDD\x74\x0B\x7F\x16" - "\xAD\x21\xB8\x4F\xE6\x5A\xF1\x88" - "\x1F\x93\x2A\xC1\x35\xCC\x63\xFA" - "\x6E\x05\x9C\x10\xA7\x3E\xD5\x49" - "\xE0\x77\x0E\x82\x19\xB0\x24\xBB" - "\x52\xE9\x5D\xF4\x8B\x22\x96\x2D" - "\xC4\x38\xCF\x66\xFD\x71\x08\x9F" - "\x13\xAA\x41\xD8\x4C\xE3\x7A\x11" - "\x85\x1C\xB3\x27\xBE\x55\xEC\x60" - "\xF7\x8E\x02\x99\x30\xC7\x3B\xD2" - "\x69\x00\x74\x0B\xA2\x16\xAD\x44" - "\xDB\x4F\xE6\x7D\x14\x88\x1F\xB6" - "\x2A\xC1\x58\xEF\x63\xFA\x91\x05" - "\x9C\x33\xCA\x3E\xD5\x6C\x03\x77" - "\x0E\xA5\x19\xB0\x47\xDE\x52\xE9" - "\x80\x17\x8B\x22\xB9\x2D\xC4\x5B" - "\xF2\x66\xFD\x94\x08\x9F\x36\xCD" - "\x41\xD8\x6F\x06\x7A\x11\xA8\x1C" - "\xB3\x4A\xE1\x55\xEC\x83\x1A\x8E" - "\x25\xBC\x30\xC7\x5E\xF5\x69\x00" - "\x97\x0B\xA2\x39\xD0\x44\xDB\x72" - "\x09\x7D\x14\xAB\x1F\xB6\x4D\xE4" - "\x58\xEF\x86\x1D\x91\x28\xBF\x33" - "\xCA\x61\xF8\x6C\x03\x9A\x0E\xA5" - "\x3C\xD3\x47\xDE\x75\x0C\x80\x17" - "\xAE\x22\xB9\x50\xE7\x5B\xF2\x89" - "\x20\x94\x2B\xC2\x36\xCD\x64\xFB" - "\x6F\x06\x9D\x11\xA8\x3F\xD6\x4A" - "\xE1\x78\x0F\x83\x1A\xB1\x25\xBC" - "\x53\xEA\x5E\xF5\x8C\x00\x97\x2E" - "\xC5\x39\xD0\x67\xFE\x72\x09\xA0" - "\x14\xAB\x42\xD9\x4D\xE4\x7B\x12" - "\x86\x1D\xB4\x28\xBF\x56\xED\x61" - "\xF8\x8F\x03\x9A\x31\xC8\x3C\xD3" - "\x6A\x01\x75\x0C\xA3\x17\xAE\x45" - "\xDC\x50\xE7\x7E\x15\x89\x20\xB7", - .rlen = 496, }, }; @@ -6836,9 +5963,6 @@ static struct cipher_testvec serpent_lrw_enc_tv_template[] = { "\x5c\xc6\x84\xfe\x7c\xcb\x26\xfd" "\xd9\x51\x0f\xd7\x94\x2f\xc5\xa7", .rlen = 512, - .also_non_np = 1, - .np = 2, - .tap = { 512 - 16, 16 }, }, }; @@ -7089,9 +6213,6 @@ static struct cipher_testvec serpent_lrw_dec_tv_template[] = { "\xe9\x2e\xc4\x29\x0f\x84\xdb\xc4" "\x21\xc4\xc2\x75\x67\x89\x37\x0a", .rlen = 512, - .also_non_np = 1, - .np = 2, - .tap = { 512 - 16, 16 }, }, }; @@ -7431,9 +6552,6 @@ static struct cipher_testvec serpent_xts_enc_tv_template[] = { "\xaf\x43\x0b\xc5\x20\x41\x92\x20" "\xd4\xa0\x91\x98\x11\x5f\x4d\xb1", .rlen = 512, - .also_non_np = 1, - .np = 2, - .tap = { 512 - 16, 16 }, }, }; @@ -7774,23 +6892,12 @@ static struct cipher_testvec serpent_xts_dec_tv_template[] = { "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7" "\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff", .rlen = 512, - .also_non_np = 1, - .np = 2, - .tap = { 512 - 16, 16 }, }, }; /* Cast6 test vectors from RFC 2612 */ -#define CAST6_ENC_TEST_VECTORS 4 -#define CAST6_DEC_TEST_VECTORS 4 -#define CAST6_CBC_ENC_TEST_VECTORS 1 -#define CAST6_CBC_DEC_TEST_VECTORS 1 -#define CAST6_CTR_ENC_TEST_VECTORS 2 -#define CAST6_CTR_DEC_TEST_VECTORS 2 -#define CAST6_LRW_ENC_TEST_VECTORS 1 -#define CAST6_LRW_DEC_TEST_VECTORS 1 -#define CAST6_XTS_ENC_TEST_VECTORS 1 -#define CAST6_XTS_DEC_TEST_VECTORS 1 +#define CAST6_ENC_TEST_VECTORS 3 +#define CAST6_DEC_TEST_VECTORS 3 static struct cipher_testvec cast6_enc_tv_template[] = { { @@ -7823,1749 +6930,287 @@ static struct cipher_testvec cast6_enc_tv_template[] = { .result = "\x4f\x6a\x20\x38\x28\x68\x97\xb9" "\xc9\x87\x01\x36\x55\x33\x17\xfa", .rlen = 16, - }, { /* Generated from TF test vectors */ - .key = "\x85\x62\x3F\x1C\xF9\xD6\x1C\xF9" - "\xD6\xB3\x90\x6D\x4A\x90\x6D\x4A" - "\x27\x04\xE1\x27\x04\xE1\xBE\x9B" - "\x78\xBE\x9B\x78\x55\x32\x0F\x55", + }, +}; + +static struct cipher_testvec cast6_dec_tv_template[] = { + { + .key = "\x23\x42\xbb\x9e\xfa\x38\x54\x2c" + "\x0a\xf7\x56\x47\xf2\x9f\x61\x5d", + .klen = 16, + .input = "\xc8\x42\xa0\x89\x72\xb4\x3d\x20" + "\x83\x6c\x91\xd1\xb7\x53\x0f\x6b", + .ilen = 16, + .result = zeroed_string, + .rlen = 16, + }, { + .key = "\x23\x42\xbb\x9e\xfa\x38\x54\x2c" + "\xbe\xd0\xac\x83\x94\x0a\xc2\x98" + "\xba\xc7\x7a\x77\x17\x94\x28\x63", + .klen = 24, + .input = "\x1b\x38\x6c\x02\x10\xdc\xad\xcb" + "\xdd\x0e\x41\xaa\x08\xa7\xa7\xe8", + .ilen = 16, + .result = zeroed_string, + .rlen = 16, + }, { + .key = "\x23\x42\xbb\x9e\xfa\x38\x54\x2c" + "\xbe\xd0\xac\x83\x94\x0a\xc2\x98" + "\x8d\x7c\x47\xce\x26\x49\x08\x46" + "\x1c\xc1\xb5\x13\x7a\xe6\xb6\x04", .klen = 32, - .iv = "\xE2\x24\x89\xEE\x53\xB8\x1D\x5F" - "\xC4\x29\x8E\xF3\x35\x9A\xFF\x64", - .input = "\x56\xED\x84\x1B\x8F\x26\xBD\x31" - "\xC8\x5F\xF6\x6A\x01\x98\x0C\xA3" - "\x3A\xD1\x45\xDC\x73\x0A\x7E\x15" - "\xAC\x20\xB7\x4E\xE5\x59\xF0\x87" - "\x1E\x92\x29\xC0\x34\xCB\x62\xF9" - "\x6D\x04\x9B\x0F\xA6\x3D\xD4\x48" - "\xDF\x76\x0D\x81\x18\xAF\x23\xBA" - "\x51\xE8\x5C\xF3\x8A\x21\x95\x2C" - "\xC3\x37\xCE\x65\xFC\x70\x07\x9E" - "\x12\xA9\x40\xD7\x4B\xE2\x79\x10" - "\x84\x1B\xB2\x26\xBD\x54\xEB\x5F" - "\xF6\x8D\x01\x98\x2F\xC6\x3A\xD1" - "\x68\xFF\x73\x0A\xA1\x15\xAC\x43" - "\xDA\x4E\xE5\x7C\x13\x87\x1E\xB5" - "\x29\xC0\x57\xEE\x62\xF9\x90\x04" - "\x9B\x32\xC9\x3D\xD4\x6B\x02\x76" - "\x0D\xA4\x18\xAF\x46\xDD\x51\xE8" - "\x7F\x16\x8A\x21\xB8\x2C\xC3\x5A" - "\xF1\x65\xFC\x93\x07\x9E\x35\xCC" - "\x40\xD7\x6E\x05\x79\x10\xA7\x1B" - "\xB2\x49\xE0\x54\xEB\x82\x19\x8D" - "\x24\xBB\x2F\xC6\x5D\xF4\x68\xFF" - "\x96\x0A\xA1\x38\xCF\x43\xDA\x71" - "\x08\x7C\x13\xAA\x1E\xB5\x4C\xE3" - "\x57\xEE\x85\x1C\x90\x27\xBE\x32" - "\xC9\x60\xF7\x6B\x02\x99\x0D\xA4" - "\x3B\xD2\x46\xDD\x74\x0B\x7F\x16" - "\xAD\x21\xB8\x4F\xE6\x5A\xF1\x88" - "\x1F\x93\x2A\xC1\x35\xCC\x63\xFA" - "\x6E\x05\x9C\x10\xA7\x3E\xD5\x49" - "\xE0\x77\x0E\x82\x19\xB0\x24\xBB" - "\x52\xE9\x5D\xF4\x8B\x22\x96\x2D" - "\xC4\x38\xCF\x66\xFD\x71\x08\x9F" - "\x13\xAA\x41\xD8\x4C\xE3\x7A\x11" - "\x85\x1C\xB3\x27\xBE\x55\xEC\x60" - "\xF7\x8E\x02\x99\x30\xC7\x3B\xD2" - "\x69\x00\x74\x0B\xA2\x16\xAD\x44" - "\xDB\x4F\xE6\x7D\x14\x88\x1F\xB6" - "\x2A\xC1\x58\xEF\x63\xFA\x91\x05" - "\x9C\x33\xCA\x3E\xD5\x6C\x03\x77" - "\x0E\xA5\x19\xB0\x47\xDE\x52\xE9" - "\x80\x17\x8B\x22\xB9\x2D\xC4\x5B" - "\xF2\x66\xFD\x94\x08\x9F\x36\xCD" - "\x41\xD8\x6F\x06\x7A\x11\xA8\x1C" - "\xB3\x4A\xE1\x55\xEC\x83\x1A\x8E" - "\x25\xBC\x30\xC7\x5E\xF5\x69\x00" - "\x97\x0B\xA2\x39\xD0\x44\xDB\x72" - "\x09\x7D\x14\xAB\x1F\xB6\x4D\xE4" - "\x58\xEF\x86\x1D\x91\x28\xBF\x33" - "\xCA\x61\xF8\x6C\x03\x9A\x0E\xA5" - "\x3C\xD3\x47\xDE\x75\x0C\x80\x17" - "\xAE\x22\xB9\x50\xE7\x5B\xF2\x89" - "\x20\x94\x2B\xC2\x36\xCD\x64\xFB" - "\x6F\x06\x9D\x11\xA8\x3F\xD6\x4A" - "\xE1\x78\x0F\x83\x1A\xB1\x25\xBC" - "\x53\xEA\x5E\xF5\x8C\x00\x97\x2E" - "\xC5\x39\xD0\x67\xFE\x72\x09\xA0" - "\x14\xAB\x42\xD9\x4D\xE4\x7B\x12" - "\x86\x1D\xB4\x28\xBF\x56\xED\x61" - "\xF8\x8F\x03\x9A\x31\xC8\x3C\xD3" - "\x6A\x01\x75\x0C\xA3\x17\xAE\x45" - "\xDC\x50\xE7\x7E\x15\x89\x20\xB7", - .ilen = 496, - .result = "\xC3\x70\x22\x32\xF5\x80\xCB\x54" - "\xFC\x30\xE0\xF6\xEB\x39\x57\xA6" - "\xB6\xB9\xC5\xA4\x91\x55\x14\x97" - "\xC1\x20\xFF\x6C\x5C\xF0\x67\xEA" - "\x2F\xED\xD8\xC9\xFB\x38\x3F\xFE" - "\x93\xBE\xDC\x00\xD3\x7F\xAD\x4C" - "\x5A\x08\x92\xD1\x47\x0C\xFA\x6C" - "\xD0\x6A\x99\x10\x72\xF8\x47\x62" - "\x81\x42\xF8\xD8\xF5\xBB\x94\x08" - "\xAA\x97\xA2\x8B\x69\xB3\xD2\x7E" - "\xBC\xB5\x00\x0C\xE5\x44\x4B\x58" - "\xE8\x63\xDC\xB3\xC4\xE5\x23\x12" - "\x5A\x72\x85\x47\x8B\xEC\x9F\x26" - "\x84\xB6\xED\x10\x33\x63\x9B\x5F" - "\x4D\x53\xEE\x94\x45\x8B\x60\x58" - "\x86\x20\xF9\x1E\x82\x08\x3E\x58" - "\x60\x1B\x34\x19\x02\xBE\x4E\x09" - "\xBB\x7C\x15\xCC\x60\x27\x55\x7A" - "\x12\xB8\xD8\x08\x89\x3C\xA6\xF3" - "\xF1\xDD\xA7\x07\xA3\x12\x85\x28" - "\xE9\x57\xAC\x80\x0C\x5C\x0F\x3A" - "\x5D\xC2\x91\xC7\x90\xE4\x8C\x43" - "\x92\xE4\x7C\x26\x69\x4D\x83\x68" - "\x14\x96\x42\x47\xBD\xA9\xE4\x8A" - "\x33\x19\xEB\x54\x8E\x0D\x4B\x6E" - "\x91\x51\xB5\x36\x08\xDE\x1C\x06" - "\x03\xBD\xDE\x81\x26\xF7\x99\xC2" - "\xBA\xF7\x6D\x87\x0D\xE4\xA6\xCF" - "\xC1\xF5\x27\x05\xB8\x02\x57\x72" - "\xE6\x42\x13\x0B\xC6\x47\x05\x74" - "\x24\x15\xF7\x0D\xC2\x23\x9D\xB9" - "\x3C\x77\x18\x93\xBA\xB4\xFC\x8C" - "\x98\x82\x67\x67\xB4\xD7\xD3\x43" - "\x23\x08\x02\xB7\x9B\x99\x05\xFB" - "\xD3\xB5\x00\x0A\xA9\x9D\x66\xD6" - "\x2E\x49\x58\xD0\xA8\x57\x29\x7F" - "\x0A\x0E\x7D\xFC\x92\x83\xCC\x67" - "\xA2\xB1\x70\x3A\x8F\x87\x4A\x8D" - "\x17\xE2\x58\x2B\x88\x0D\x68\x62" - "\xBF\x35\xD1\x6F\xC0\xF0\x18\x62" - "\xB2\xC7\x2D\x58\xC7\x16\xDE\x08" - "\xEB\x84\x1D\x25\xA7\x38\x94\x06" - "\x93\x9D\xF8\xFE\x88\x71\xE7\x84" - "\x2C\xA0\x38\xA3\x1D\x48\xCF\x29" - "\x0B\xBC\xD8\x50\x99\x1A\x26\xFB" - "\x8E\x75\x3D\x73\xEB\x6A\xED\x29" - "\xE0\x8E\xED\xFC\xFE\x6F\xF6\xBA" - "\x41\xE2\x10\x4C\x01\x8B\x69\x2B" - "\x25\x3F\x4D\x70\x7B\x92\xD6\x3B" - "\xAC\xF9\x77\x18\xD9\x6A\x30\xA6" - "\x2E\xFA\x30\xFF\xC8\xD5\x1D\x06" - "\x59\x28\x1D\x86\x43\x04\x5D\x3B" - "\x99\x4C\x04\x5A\x21\x17\x8B\x76" - "\x8F\x72\xCB\xA1\x9C\x29\x4C\xC3" - "\x65\xA2\x58\x2A\xC5\x66\x24\xBF" - "\xBA\xE6\x0C\xDD\x34\x24\x74\xC8" - "\x84\x0A\x66\x2C\xBE\x8F\x32\xA9" - "\xE7\xE4\xA1\xD7\xDA\xAB\x23\x1E" - "\xEB\xEE\x6C\x94\x6F\x9C\x2E\xD1" - "\x49\x2C\xF3\xD4\x90\xCC\x93\x4C" - "\x84\x52\x6D\x68\xDE\xC6\x64\xB2" - "\x11\x74\x93\x57\xB4\x7E\xC6\x00", - .rlen = 496, - .also_non_np = 1, - .np = 2, - .tap = { 496 - 16, 16 }, + .input = "\x4f\x6a\x20\x38\x28\x68\x97\xb9" + "\xc9\x87\x01\x36\x55\x33\x17\xfa", + .ilen = 16, + .result = zeroed_string, + .rlen = 16, }, }; -static struct cipher_testvec cast6_dec_tv_template[] = { - { - .key = "\x23\x42\xbb\x9e\xfa\x38\x54\x2c" - "\x0a\xf7\x56\x47\xf2\x9f\x61\x5d", + +/* + * AES test vectors. + */ +#define AES_ENC_TEST_VECTORS 3 +#define AES_DEC_TEST_VECTORS 3 +#define AES_CBC_ENC_TEST_VECTORS 4 +#define AES_CBC_DEC_TEST_VECTORS 4 +#define HMAC_SHA1_AES_CBC_ENC_TEST_VECTORS 7 +#define HMAC_SHA256_AES_CBC_ENC_TEST_VECTORS 7 +#define HMAC_SHA512_AES_CBC_ENC_TEST_VECTORS 7 +#define AES_LRW_ENC_TEST_VECTORS 8 +#define AES_LRW_DEC_TEST_VECTORS 8 +#define AES_XTS_ENC_TEST_VECTORS 5 +#define AES_XTS_DEC_TEST_VECTORS 5 +#define AES_CTR_ENC_TEST_VECTORS 3 +#define AES_CTR_DEC_TEST_VECTORS 3 +#define AES_OFB_ENC_TEST_VECTORS 1 +#define AES_OFB_DEC_TEST_VECTORS 1 +#define AES_CTR_3686_ENC_TEST_VECTORS 7 +#define AES_CTR_3686_DEC_TEST_VECTORS 6 +#define AES_GCM_ENC_TEST_VECTORS 9 +#define AES_GCM_DEC_TEST_VECTORS 8 +#define AES_GCM_4106_ENC_TEST_VECTORS 7 +#define AES_GCM_4106_DEC_TEST_VECTORS 7 +#define AES_CCM_ENC_TEST_VECTORS 7 +#define AES_CCM_DEC_TEST_VECTORS 7 +#define AES_CCM_4309_ENC_TEST_VECTORS 7 +#define AES_CCM_4309_DEC_TEST_VECTORS 10 + +static struct cipher_testvec aes_enc_tv_template[] = { + { /* From FIPS-197 */ + .key = "\x00\x01\x02\x03\x04\x05\x06\x07" + "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f", .klen = 16, - .input = "\xc8\x42\xa0\x89\x72\xb4\x3d\x20" - "\x83\x6c\x91\xd1\xb7\x53\x0f\x6b", + .input = "\x00\x11\x22\x33\x44\x55\x66\x77" + "\x88\x99\xaa\xbb\xcc\xdd\xee\xff", .ilen = 16, - .result = zeroed_string, + .result = "\x69\xc4\xe0\xd8\x6a\x7b\x04\x30" + "\xd8\xcd\xb7\x80\x70\xb4\xc5\x5a", .rlen = 16, }, { - .key = "\x23\x42\xbb\x9e\xfa\x38\x54\x2c" - "\xbe\xd0\xac\x83\x94\x0a\xc2\x98" - "\xba\xc7\x7a\x77\x17\x94\x28\x63", + .key = "\x00\x01\x02\x03\x04\x05\x06\x07" + "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f" + "\x10\x11\x12\x13\x14\x15\x16\x17", .klen = 24, - .input = "\x1b\x38\x6c\x02\x10\xdc\xad\xcb" - "\xdd\x0e\x41\xaa\x08\xa7\xa7\xe8", + .input = "\x00\x11\x22\x33\x44\x55\x66\x77" + "\x88\x99\xaa\xbb\xcc\xdd\xee\xff", .ilen = 16, - .result = zeroed_string, + .result = "\xdd\xa9\x7c\xa4\x86\x4c\xdf\xe0" + "\x6e\xaf\x70\xa0\xec\x0d\x71\x91", .rlen = 16, }, { - .key = "\x23\x42\xbb\x9e\xfa\x38\x54\x2c" - "\xbe\xd0\xac\x83\x94\x0a\xc2\x98" - "\x8d\x7c\x47\xce\x26\x49\x08\x46" - "\x1c\xc1\xb5\x13\x7a\xe6\xb6\x04", + .key = "\x00\x01\x02\x03\x04\x05\x06\x07" + "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f" + "\x10\x11\x12\x13\x14\x15\x16\x17" + "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f", .klen = 32, - .input = "\x4f\x6a\x20\x38\x28\x68\x97\xb9" - "\xc9\x87\x01\x36\x55\x33\x17\xfa", + .input = "\x00\x11\x22\x33\x44\x55\x66\x77" + "\x88\x99\xaa\xbb\xcc\xdd\xee\xff", .ilen = 16, - .result = zeroed_string, + .result = "\x8e\xa2\xb7\xca\x51\x67\x45\xbf" + "\xea\xfc\x49\x90\x4b\x49\x60\x89", .rlen = 16, - }, { /* Generated from TF test vectors */ - .key = "\x85\x62\x3F\x1C\xF9\xD6\x1C\xF9" - "\xD6\xB3\x90\x6D\x4A\x90\x6D\x4A" - "\x27\x04\xE1\x27\x04\xE1\xBE\x9B" - "\x78\xBE\x9B\x78\x55\x32\x0F\x55", - .klen = 32, - .iv = "\xE2\x24\x89\xEE\x53\xB8\x1D\x5F" - "\xC4\x29\x8E\xF3\x35\x9A\xFF\x64", - .input = "\xC3\x70\x22\x32\xF5\x80\xCB\x54" - "\xFC\x30\xE0\xF6\xEB\x39\x57\xA6" - "\xB6\xB9\xC5\xA4\x91\x55\x14\x97" - "\xC1\x20\xFF\x6C\x5C\xF0\x67\xEA" - "\x2F\xED\xD8\xC9\xFB\x38\x3F\xFE" - "\x93\xBE\xDC\x00\xD3\x7F\xAD\x4C" - "\x5A\x08\x92\xD1\x47\x0C\xFA\x6C" - "\xD0\x6A\x99\x10\x72\xF8\x47\x62" - "\x81\x42\xF8\xD8\xF5\xBB\x94\x08" - "\xAA\x97\xA2\x8B\x69\xB3\xD2\x7E" - "\xBC\xB5\x00\x0C\xE5\x44\x4B\x58" - "\xE8\x63\xDC\xB3\xC4\xE5\x23\x12" - "\x5A\x72\x85\x47\x8B\xEC\x9F\x26" - "\x84\xB6\xED\x10\x33\x63\x9B\x5F" - "\x4D\x53\xEE\x94\x45\x8B\x60\x58" - "\x86\x20\xF9\x1E\x82\x08\x3E\x58" - "\x60\x1B\x34\x19\x02\xBE\x4E\x09" - "\xBB\x7C\x15\xCC\x60\x27\x55\x7A" - "\x12\xB8\xD8\x08\x89\x3C\xA6\xF3" - "\xF1\xDD\xA7\x07\xA3\x12\x85\x28" - "\xE9\x57\xAC\x80\x0C\x5C\x0F\x3A" - "\x5D\xC2\x91\xC7\x90\xE4\x8C\x43" - "\x92\xE4\x7C\x26\x69\x4D\x83\x68" - "\x14\x96\x42\x47\xBD\xA9\xE4\x8A" - "\x33\x19\xEB\x54\x8E\x0D\x4B\x6E" - "\x91\x51\xB5\x36\x08\xDE\x1C\x06" - "\x03\xBD\xDE\x81\x26\xF7\x99\xC2" - "\xBA\xF7\x6D\x87\x0D\xE4\xA6\xCF" - "\xC1\xF5\x27\x05\xB8\x02\x57\x72" - "\xE6\x42\x13\x0B\xC6\x47\x05\x74" - "\x24\x15\xF7\x0D\xC2\x23\x9D\xB9" - "\x3C\x77\x18\x93\xBA\xB4\xFC\x8C" - "\x98\x82\x67\x67\xB4\xD7\xD3\x43" - "\x23\x08\x02\xB7\x9B\x99\x05\xFB" - "\xD3\xB5\x00\x0A\xA9\x9D\x66\xD6" - "\x2E\x49\x58\xD0\xA8\x57\x29\x7F" - "\x0A\x0E\x7D\xFC\x92\x83\xCC\x67" - "\xA2\xB1\x70\x3A\x8F\x87\x4A\x8D" - "\x17\xE2\x58\x2B\x88\x0D\x68\x62" - "\xBF\x35\xD1\x6F\xC0\xF0\x18\x62" - "\xB2\xC7\x2D\x58\xC7\x16\xDE\x08" - "\xEB\x84\x1D\x25\xA7\x38\x94\x06" - "\x93\x9D\xF8\xFE\x88\x71\xE7\x84" - "\x2C\xA0\x38\xA3\x1D\x48\xCF\x29" - "\x0B\xBC\xD8\x50\x99\x1A\x26\xFB" - "\x8E\x75\x3D\x73\xEB\x6A\xED\x29" - "\xE0\x8E\xED\xFC\xFE\x6F\xF6\xBA" - "\x41\xE2\x10\x4C\x01\x8B\x69\x2B" - "\x25\x3F\x4D\x70\x7B\x92\xD6\x3B" - "\xAC\xF9\x77\x18\xD9\x6A\x30\xA6" - "\x2E\xFA\x30\xFF\xC8\xD5\x1D\x06" - "\x59\x28\x1D\x86\x43\x04\x5D\x3B" - "\x99\x4C\x04\x5A\x21\x17\x8B\x76" - "\x8F\x72\xCB\xA1\x9C\x29\x4C\xC3" - "\x65\xA2\x58\x2A\xC5\x66\x24\xBF" - "\xBA\xE6\x0C\xDD\x34\x24\x74\xC8" - "\x84\x0A\x66\x2C\xBE\x8F\x32\xA9" - "\xE7\xE4\xA1\xD7\xDA\xAB\x23\x1E" - "\xEB\xEE\x6C\x94\x6F\x9C\x2E\xD1" - "\x49\x2C\xF3\xD4\x90\xCC\x93\x4C" - "\x84\x52\x6D\x68\xDE\xC6\x64\xB2" - "\x11\x74\x93\x57\xB4\x7E\xC6\x00", - .ilen = 496, - .result = "\x56\xED\x84\x1B\x8F\x26\xBD\x31" - "\xC8\x5F\xF6\x6A\x01\x98\x0C\xA3" - "\x3A\xD1\x45\xDC\x73\x0A\x7E\x15" - "\xAC\x20\xB7\x4E\xE5\x59\xF0\x87" - "\x1E\x92\x29\xC0\x34\xCB\x62\xF9" - "\x6D\x04\x9B\x0F\xA6\x3D\xD4\x48" - "\xDF\x76\x0D\x81\x18\xAF\x23\xBA" - "\x51\xE8\x5C\xF3\x8A\x21\x95\x2C" - "\xC3\x37\xCE\x65\xFC\x70\x07\x9E" - "\x12\xA9\x40\xD7\x4B\xE2\x79\x10" - "\x84\x1B\xB2\x26\xBD\x54\xEB\x5F" - "\xF6\x8D\x01\x98\x2F\xC6\x3A\xD1" - "\x68\xFF\x73\x0A\xA1\x15\xAC\x43" - "\xDA\x4E\xE5\x7C\x13\x87\x1E\xB5" - "\x29\xC0\x57\xEE\x62\xF9\x90\x04" - "\x9B\x32\xC9\x3D\xD4\x6B\x02\x76" - "\x0D\xA4\x18\xAF\x46\xDD\x51\xE8" - "\x7F\x16\x8A\x21\xB8\x2C\xC3\x5A" - "\xF1\x65\xFC\x93\x07\x9E\x35\xCC" - "\x40\xD7\x6E\x05\x79\x10\xA7\x1B" - "\xB2\x49\xE0\x54\xEB\x82\x19\x8D" - "\x24\xBB\x2F\xC6\x5D\xF4\x68\xFF" - "\x96\x0A\xA1\x38\xCF\x43\xDA\x71" - "\x08\x7C\x13\xAA\x1E\xB5\x4C\xE3" - "\x57\xEE\x85\x1C\x90\x27\xBE\x32" - "\xC9\x60\xF7\x6B\x02\x99\x0D\xA4" - "\x3B\xD2\x46\xDD\x74\x0B\x7F\x16" - "\xAD\x21\xB8\x4F\xE6\x5A\xF1\x88" - "\x1F\x93\x2A\xC1\x35\xCC\x63\xFA" - "\x6E\x05\x9C\x10\xA7\x3E\xD5\x49" - "\xE0\x77\x0E\x82\x19\xB0\x24\xBB" - "\x52\xE9\x5D\xF4\x8B\x22\x96\x2D" - "\xC4\x38\xCF\x66\xFD\x71\x08\x9F" - "\x13\xAA\x41\xD8\x4C\xE3\x7A\x11" - "\x85\x1C\xB3\x27\xBE\x55\xEC\x60" - "\xF7\x8E\x02\x99\x30\xC7\x3B\xD2" - "\x69\x00\x74\x0B\xA2\x16\xAD\x44" - "\xDB\x4F\xE6\x7D\x14\x88\x1F\xB6" - "\x2A\xC1\x58\xEF\x63\xFA\x91\x05" - "\x9C\x33\xCA\x3E\xD5\x6C\x03\x77" - "\x0E\xA5\x19\xB0\x47\xDE\x52\xE9" - "\x80\x17\x8B\x22\xB9\x2D\xC4\x5B" - "\xF2\x66\xFD\x94\x08\x9F\x36\xCD" - "\x41\xD8\x6F\x06\x7A\x11\xA8\x1C" - "\xB3\x4A\xE1\x55\xEC\x83\x1A\x8E" - "\x25\xBC\x30\xC7\x5E\xF5\x69\x00" - "\x97\x0B\xA2\x39\xD0\x44\xDB\x72" - "\x09\x7D\x14\xAB\x1F\xB6\x4D\xE4" - "\x58\xEF\x86\x1D\x91\x28\xBF\x33" - "\xCA\x61\xF8\x6C\x03\x9A\x0E\xA5" - "\x3C\xD3\x47\xDE\x75\x0C\x80\x17" - "\xAE\x22\xB9\x50\xE7\x5B\xF2\x89" - "\x20\x94\x2B\xC2\x36\xCD\x64\xFB" - "\x6F\x06\x9D\x11\xA8\x3F\xD6\x4A" - "\xE1\x78\x0F\x83\x1A\xB1\x25\xBC" - "\x53\xEA\x5E\xF5\x8C\x00\x97\x2E" - "\xC5\x39\xD0\x67\xFE\x72\x09\xA0" - "\x14\xAB\x42\xD9\x4D\xE4\x7B\x12" - "\x86\x1D\xB4\x28\xBF\x56\xED\x61" - "\xF8\x8F\x03\x9A\x31\xC8\x3C\xD3" - "\x6A\x01\x75\x0C\xA3\x17\xAE\x45" - "\xDC\x50\xE7\x7E\x15\x89\x20\xB7", - .rlen = 496, - .also_non_np = 1, - .np = 2, - .tap = { 496 - 16, 16 }, }, }; -static struct cipher_testvec cast6_cbc_enc_tv_template[] = { - { /* Generated from TF test vectors */ - .key = "\x85\x62\x3F\x1C\xF9\xD6\x1C\xF9" - "\xD6\xB3\x90\x6D\x4A\x90\x6D\x4A" - "\x27\x04\xE1\x27\x04\xE1\xBE\x9B" - "\x78\xBE\x9B\x78\x55\x32\x0F\x55", +static struct cipher_testvec aes_dec_tv_template[] = { + { /* From FIPS-197 */ + .key = "\x00\x01\x02\x03\x04\x05\x06\x07" + "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f", + .klen = 16, + .input = "\x69\xc4\xe0\xd8\x6a\x7b\x04\x30" + "\xd8\xcd\xb7\x80\x70\xb4\xc5\x5a", + .ilen = 16, + .result = "\x00\x11\x22\x33\x44\x55\x66\x77" + "\x88\x99\xaa\xbb\xcc\xdd\xee\xff", + .rlen = 16, + }, { + .key = "\x00\x01\x02\x03\x04\x05\x06\x07" + "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f" + "\x10\x11\x12\x13\x14\x15\x16\x17", + .klen = 24, + .input = "\xdd\xa9\x7c\xa4\x86\x4c\xdf\xe0" + "\x6e\xaf\x70\xa0\xec\x0d\x71\x91", + .ilen = 16, + .result = "\x00\x11\x22\x33\x44\x55\x66\x77" + "\x88\x99\xaa\xbb\xcc\xdd\xee\xff", + .rlen = 16, + }, { + .key = "\x00\x01\x02\x03\x04\x05\x06\x07" + "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f" + "\x10\x11\x12\x13\x14\x15\x16\x17" + "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f", .klen = 32, - .iv = "\xE2\x24\x89\xEE\x53\xB8\x1D\x5F" - "\xC4\x29\x8E\xF3\x35\x9A\xFF\x64", - .input = "\x56\xED\x84\x1B\x8F\x26\xBD\x31" - "\xC8\x5F\xF6\x6A\x01\x98\x0C\xA3" - "\x3A\xD1\x45\xDC\x73\x0A\x7E\x15" - "\xAC\x20\xB7\x4E\xE5\x59\xF0\x87" - "\x1E\x92\x29\xC0\x34\xCB\x62\xF9" - "\x6D\x04\x9B\x0F\xA6\x3D\xD4\x48" - "\xDF\x76\x0D\x81\x18\xAF\x23\xBA" - "\x51\xE8\x5C\xF3\x8A\x21\x95\x2C" - "\xC3\x37\xCE\x65\xFC\x70\x07\x9E" - "\x12\xA9\x40\xD7\x4B\xE2\x79\x10" - "\x84\x1B\xB2\x26\xBD\x54\xEB\x5F" - "\xF6\x8D\x01\x98\x2F\xC6\x3A\xD1" - "\x68\xFF\x73\x0A\xA1\x15\xAC\x43" - "\xDA\x4E\xE5\x7C\x13\x87\x1E\xB5" - "\x29\xC0\x57\xEE\x62\xF9\x90\x04" - "\x9B\x32\xC9\x3D\xD4\x6B\x02\x76" - "\x0D\xA4\x18\xAF\x46\xDD\x51\xE8" - "\x7F\x16\x8A\x21\xB8\x2C\xC3\x5A" - "\xF1\x65\xFC\x93\x07\x9E\x35\xCC" - "\x40\xD7\x6E\x05\x79\x10\xA7\x1B" - "\xB2\x49\xE0\x54\xEB\x82\x19\x8D" - "\x24\xBB\x2F\xC6\x5D\xF4\x68\xFF" - "\x96\x0A\xA1\x38\xCF\x43\xDA\x71" - "\x08\x7C\x13\xAA\x1E\xB5\x4C\xE3" - "\x57\xEE\x85\x1C\x90\x27\xBE\x32" - "\xC9\x60\xF7\x6B\x02\x99\x0D\xA4" - "\x3B\xD2\x46\xDD\x74\x0B\x7F\x16" - "\xAD\x21\xB8\x4F\xE6\x5A\xF1\x88" - "\x1F\x93\x2A\xC1\x35\xCC\x63\xFA" - "\x6E\x05\x9C\x10\xA7\x3E\xD5\x49" - "\xE0\x77\x0E\x82\x19\xB0\x24\xBB" - "\x52\xE9\x5D\xF4\x8B\x22\x96\x2D" - "\xC4\x38\xCF\x66\xFD\x71\x08\x9F" - "\x13\xAA\x41\xD8\x4C\xE3\x7A\x11" - "\x85\x1C\xB3\x27\xBE\x55\xEC\x60" - "\xF7\x8E\x02\x99\x30\xC7\x3B\xD2" - "\x69\x00\x74\x0B\xA2\x16\xAD\x44" - "\xDB\x4F\xE6\x7D\x14\x88\x1F\xB6" - "\x2A\xC1\x58\xEF\x63\xFA\x91\x05" - "\x9C\x33\xCA\x3E\xD5\x6C\x03\x77" - "\x0E\xA5\x19\xB0\x47\xDE\x52\xE9" - "\x80\x17\x8B\x22\xB9\x2D\xC4\x5B" - "\xF2\x66\xFD\x94\x08\x9F\x36\xCD" - "\x41\xD8\x6F\x06\x7A\x11\xA8\x1C" - "\xB3\x4A\xE1\x55\xEC\x83\x1A\x8E" - "\x25\xBC\x30\xC7\x5E\xF5\x69\x00" - "\x97\x0B\xA2\x39\xD0\x44\xDB\x72" - "\x09\x7D\x14\xAB\x1F\xB6\x4D\xE4" - "\x58\xEF\x86\x1D\x91\x28\xBF\x33" - "\xCA\x61\xF8\x6C\x03\x9A\x0E\xA5" - "\x3C\xD3\x47\xDE\x75\x0C\x80\x17" - "\xAE\x22\xB9\x50\xE7\x5B\xF2\x89" - "\x20\x94\x2B\xC2\x36\xCD\x64\xFB" - "\x6F\x06\x9D\x11\xA8\x3F\xD6\x4A" - "\xE1\x78\x0F\x83\x1A\xB1\x25\xBC" - "\x53\xEA\x5E\xF5\x8C\x00\x97\x2E" - "\xC5\x39\xD0\x67\xFE\x72\x09\xA0" - "\x14\xAB\x42\xD9\x4D\xE4\x7B\x12" - "\x86\x1D\xB4\x28\xBF\x56\xED\x61" - "\xF8\x8F\x03\x9A\x31\xC8\x3C\xD3" - "\x6A\x01\x75\x0C\xA3\x17\xAE\x45" - "\xDC\x50\xE7\x7E\x15\x89\x20\xB7", - .ilen = 496, - .result = "\xDF\x77\x68\x96\xC7\xBA\xF8\xE2" - "\x0E\x24\x99\x1A\xAA\xF3\xC6\x9F" - "\xA0\x73\xB3\x70\xC3\x68\x64\x70" - "\xAD\x33\x02\xFB\x88\x74\xAA\x78" - "\xC7\x47\x1A\x18\x61\x2D\xAC\x9F" - "\x7E\x6F\xDF\x05\x13\x76\xA6\x72" - "\xB7\x13\x09\x0F\x7D\x38\xDF\x25" - "\x4E\xFD\x50\x45\xFA\x35\x6A\xC0" - "\x57\x95\xE1\x21\x26\x10\x9A\x21" - "\xA1\x8A\x51\x05\xD1\xB1\x78\x35" - "\x98\xF5\xAE\xC0\xC1\x8B\x94\xFF" - "\xD0\x69\x3F\x42\xC2\x01\xA7\x9B" - "\x23\x16\x47\x72\x81\x13\x3A\x72" - "\xEC\xD9\x40\x88\x00\x9C\xB0\xA8" - "\x9C\xAC\xCE\x11\x73\x7B\x63\x3E" - "\xA3\x63\x98\x7D\x35\xE4\xD9\x83" - "\xE2\xD0\x52\x87\x0C\x1F\xB0\xB3" - "\x41\x1A\x93\x8D\x76\x31\x9F\xF2" - "\xFE\x09\xA3\x8F\x22\x6A\x3B\xB9" - "\x6C\x9E\xE4\xA1\xA0\xC4\xE7\xA1" - "\x21\x9C\x1A\xCA\x65\xDE\x44\x03" - "\x99\xF2\xD2\x39\xE3\x3F\x0F\x37" - "\x53\x50\x23\xA4\x81\x6E\xDA\xFB" - "\xF8\x7B\x01\xD7\xB2\x32\x9C\xB8" - "\xB1\x0E\x99\x17\xB5\x38\xF9\xD7" - "\x86\x2D\x6E\x94\x5C\x99\x9D\xB3" - "\xD3\x63\x4B\x2A\x7D\x44\x6A\xB2" - "\xC1\x03\xE6\x5A\x37\xD8\x64\x18" - "\xAA\x32\xCE\x29\xED\xC0\xA2\xCB" - "\x8D\xAF\xCD\xBE\x8F\xB6\xEC\xB4" - "\x89\x05\x81\x6E\x71\x4F\xC3\x28" - "\x10\xC1\x62\xC4\x41\xE9\xD2\x39" - "\xF3\x22\x39\x12\x2C\xC2\x95\x2D" - "\xBF\x93\x58\x4B\x04\xD1\x8D\x57" - "\xAE\xEB\x60\x03\x56\x35\xAD\x5A" - "\xE9\xC3\xFF\x4E\x31\xE1\x37\xF8" - "\x7D\xEE\x65\x8A\xB6\x88\x1A\x3E" - "\x07\x09\x82\xBA\xF0\x80\x8A\xD0" - "\xA0\x3F\x6A\xE9\x24\x87\x19\x65" - "\x73\x3F\x12\x91\x47\x54\xBA\x39" - "\x30\x5B\x1E\xE5\xC2\xF9\x3F\xEF" - "\xD6\x75\xF9\xB8\x7C\x8B\x05\x76" - "\xEE\xB7\x08\x25\x4B\xB6\x7B\x47" - "\x72\xC0\x4C\xD4\xDA\xE0\x75\xF1" - "\x7C\xE8\x94\x9E\x16\x6E\xB8\x12" - "\xA1\xC1\x6E\x3B\x1C\x59\x41\x2D" - "\x23\xFA\x7D\x77\xB8\x46\x75\xFE" - "\x4F\x10\xD3\x09\x60\xA1\x36\x96" - "\x5B\xC2\xDC\x6E\x84\x7D\x9B\x14" - "\x80\x21\x83\x58\x3C\x76\xFD\x28" - "\x1D\xF9\x93\x13\xD7\x0E\x62\x14" - "\x5A\xC5\x4E\x08\xA5\x56\xA4\x3C" - "\x68\x93\x44\x70\xDF\xCF\x4A\x51" - "\x0B\x81\x29\x41\xE5\x62\x4D\x36" - "\xB3\xEA\x94\xA6\xB9\xDD\x3F\x09" - "\x62\x34\xA0\x6A\x7E\x7D\xF5\xF6" - "\x01\x91\xB4\x27\xDA\x59\xD6\x17" - "\x56\x4D\x82\x62\x37\xA3\x48\x01" - "\x99\x91\x77\xB2\x08\x6B\x2C\x37" - "\xC5\x5C\xAD\xB6\x07\xB6\x84\xF3" - "\x4D\x59\x7D\xC5\x28\x69\xFA\x92" - "\x22\x46\x89\x2D\x0F\x2B\x08\x24", - .rlen = 496, - .also_non_np = 1, - .np = 2, - .tap = { 496 - 16, 16 }, + .input = "\x8e\xa2\xb7\xca\x51\x67\x45\xbf" + "\xea\xfc\x49\x90\x4b\x49\x60\x89", + .ilen = 16, + .result = "\x00\x11\x22\x33\x44\x55\x66\x77" + "\x88\x99\xaa\xbb\xcc\xdd\xee\xff", + .rlen = 16, }, }; -static struct cipher_testvec cast6_cbc_dec_tv_template[] = { - { /* Generated from TF test vectors */ - .key = "\x85\x62\x3F\x1C\xF9\xD6\x1C\xF9" - "\xD6\xB3\x90\x6D\x4A\x90\x6D\x4A" - "\x27\x04\xE1\x27\x04\xE1\xBE\x9B" - "\x78\xBE\x9B\x78\x55\x32\x0F\x55", +static struct cipher_testvec aes_cbc_enc_tv_template[] = { + { /* From RFC 3602 */ + .key = "\x06\xa9\x21\x40\x36\xb8\xa1\x5b" + "\x51\x2e\x03\xd5\x34\x12\x00\x06", + .klen = 16, + .iv = "\x3d\xaf\xba\x42\x9d\x9e\xb4\x30" + "\xb4\x22\xda\x80\x2c\x9f\xac\x41", + .input = "Single block msg", + .ilen = 16, + .result = "\xe3\x53\x77\x9c\x10\x79\xae\xb8" + "\x27\x08\x94\x2d\xbe\x77\x18\x1a", + .rlen = 16, + }, { + .key = "\xc2\x86\x69\x6d\x88\x7c\x9a\xa0" + "\x61\x1b\xbb\x3e\x20\x25\xa4\x5a", + .klen = 16, + .iv = "\x56\x2e\x17\x99\x6d\x09\x3d\x28" + "\xdd\xb3\xba\x69\x5a\x2e\x6f\x58", + .input = "\x00\x01\x02\x03\x04\x05\x06\x07" + "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f" + "\x10\x11\x12\x13\x14\x15\x16\x17" + "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f", + .ilen = 32, + .result = "\xd2\x96\xcd\x94\xc2\xcc\xcf\x8a" + "\x3a\x86\x30\x28\xb5\xe1\xdc\x0a" + "\x75\x86\x60\x2d\x25\x3c\xff\xf9" + "\x1b\x82\x66\xbe\xa6\xd6\x1a\xb1", + .rlen = 32, + }, { /* From NIST SP800-38A */ + .key = "\x8e\x73\xb0\xf7\xda\x0e\x64\x52" + "\xc8\x10\xf3\x2b\x80\x90\x79\xe5" + "\x62\xf8\xea\xd2\x52\x2c\x6b\x7b", + .klen = 24, + .iv = "\x00\x01\x02\x03\x04\x05\x06\x07" + "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f", + .input = "\x6b\xc1\xbe\xe2\x2e\x40\x9f\x96" + "\xe9\x3d\x7e\x11\x73\x93\x17\x2a" + "\xae\x2d\x8a\x57\x1e\x03\xac\x9c" + "\x9e\xb7\x6f\xac\x45\xaf\x8e\x51" + "\x30\xc8\x1c\x46\xa3\x5c\xe4\x11" + "\xe5\xfb\xc1\x19\x1a\x0a\x52\xef" + "\xf6\x9f\x24\x45\xdf\x4f\x9b\x17" + "\xad\x2b\x41\x7b\xe6\x6c\x37\x10", + .ilen = 64, + .result = "\x4f\x02\x1d\xb2\x43\xbc\x63\x3d" + "\x71\x78\x18\x3a\x9f\xa0\x71\xe8" + "\xb4\xd9\xad\xa9\xad\x7d\xed\xf4" + "\xe5\xe7\x38\x76\x3f\x69\x14\x5a" + "\x57\x1b\x24\x20\x12\xfb\x7a\xe0" + "\x7f\xa9\xba\xac\x3d\xf1\x02\xe0" + "\x08\xb0\xe2\x79\x88\x59\x88\x81" + "\xd9\x20\xa9\xe6\x4f\x56\x15\xcd", + .rlen = 64, + }, { + .key = "\x60\x3d\xeb\x10\x15\xca\x71\xbe" + "\x2b\x73\xae\xf0\x85\x7d\x77\x81" + "\x1f\x35\x2c\x07\x3b\x61\x08\xd7" + "\x2d\x98\x10\xa3\x09\x14\xdf\xf4", .klen = 32, - .iv = "\xE2\x24\x89\xEE\x53\xB8\x1D\x5F" - "\xC4\x29\x8E\xF3\x35\x9A\xFF\x64", - .input = "\xDF\x77\x68\x96\xC7\xBA\xF8\xE2" - "\x0E\x24\x99\x1A\xAA\xF3\xC6\x9F" - "\xA0\x73\xB3\x70\xC3\x68\x64\x70" - "\xAD\x33\x02\xFB\x88\x74\xAA\x78" - "\xC7\x47\x1A\x18\x61\x2D\xAC\x9F" - "\x7E\x6F\xDF\x05\x13\x76\xA6\x72" - "\xB7\x13\x09\x0F\x7D\x38\xDF\x25" - "\x4E\xFD\x50\x45\xFA\x35\x6A\xC0" - "\x57\x95\xE1\x21\x26\x10\x9A\x21" - "\xA1\x8A\x51\x05\xD1\xB1\x78\x35" - "\x98\xF5\xAE\xC0\xC1\x8B\x94\xFF" - "\xD0\x69\x3F\x42\xC2\x01\xA7\x9B" - "\x23\x16\x47\x72\x81\x13\x3A\x72" - "\xEC\xD9\x40\x88\x00\x9C\xB0\xA8" - "\x9C\xAC\xCE\x11\x73\x7B\x63\x3E" - "\xA3\x63\x98\x7D\x35\xE4\xD9\x83" - "\xE2\xD0\x52\x87\x0C\x1F\xB0\xB3" - "\x41\x1A\x93\x8D\x76\x31\x9F\xF2" - "\xFE\x09\xA3\x8F\x22\x6A\x3B\xB9" - "\x6C\x9E\xE4\xA1\xA0\xC4\xE7\xA1" - "\x21\x9C\x1A\xCA\x65\xDE\x44\x03" - "\x99\xF2\xD2\x39\xE3\x3F\x0F\x37" - "\x53\x50\x23\xA4\x81\x6E\xDA\xFB" - "\xF8\x7B\x01\xD7\xB2\x32\x9C\xB8" - "\xB1\x0E\x99\x17\xB5\x38\xF9\xD7" - "\x86\x2D\x6E\x94\x5C\x99\x9D\xB3" - "\xD3\x63\x4B\x2A\x7D\x44\x6A\xB2" - "\xC1\x03\xE6\x5A\x37\xD8\x64\x18" - "\xAA\x32\xCE\x29\xED\xC0\xA2\xCB" - "\x8D\xAF\xCD\xBE\x8F\xB6\xEC\xB4" - "\x89\x05\x81\x6E\x71\x4F\xC3\x28" - "\x10\xC1\x62\xC4\x41\xE9\xD2\x39" - "\xF3\x22\x39\x12\x2C\xC2\x95\x2D" - "\xBF\x93\x58\x4B\x04\xD1\x8D\x57" - "\xAE\xEB\x60\x03\x56\x35\xAD\x5A" - "\xE9\xC3\xFF\x4E\x31\xE1\x37\xF8" - "\x7D\xEE\x65\x8A\xB6\x88\x1A\x3E" - "\x07\x09\x82\xBA\xF0\x80\x8A\xD0" - "\xA0\x3F\x6A\xE9\x24\x87\x19\x65" - "\x73\x3F\x12\x91\x47\x54\xBA\x39" - "\x30\x5B\x1E\xE5\xC2\xF9\x3F\xEF" - "\xD6\x75\xF9\xB8\x7C\x8B\x05\x76" - "\xEE\xB7\x08\x25\x4B\xB6\x7B\x47" - "\x72\xC0\x4C\xD4\xDA\xE0\x75\xF1" - "\x7C\xE8\x94\x9E\x16\x6E\xB8\x12" - "\xA1\xC1\x6E\x3B\x1C\x59\x41\x2D" - "\x23\xFA\x7D\x77\xB8\x46\x75\xFE" - "\x4F\x10\xD3\x09\x60\xA1\x36\x96" - "\x5B\xC2\xDC\x6E\x84\x7D\x9B\x14" - "\x80\x21\x83\x58\x3C\x76\xFD\x28" - "\x1D\xF9\x93\x13\xD7\x0E\x62\x14" - "\x5A\xC5\x4E\x08\xA5\x56\xA4\x3C" - "\x68\x93\x44\x70\xDF\xCF\x4A\x51" - "\x0B\x81\x29\x41\xE5\x62\x4D\x36" - "\xB3\xEA\x94\xA6\xB9\xDD\x3F\x09" - "\x62\x34\xA0\x6A\x7E\x7D\xF5\xF6" - "\x01\x91\xB4\x27\xDA\x59\xD6\x17" - "\x56\x4D\x82\x62\x37\xA3\x48\x01" - "\x99\x91\x77\xB2\x08\x6B\x2C\x37" - "\xC5\x5C\xAD\xB6\x07\xB6\x84\xF3" - "\x4D\x59\x7D\xC5\x28\x69\xFA\x92" - "\x22\x46\x89\x2D\x0F\x2B\x08\x24", - .ilen = 496, - .result = "\x56\xED\x84\x1B\x8F\x26\xBD\x31" - "\xC8\x5F\xF6\x6A\x01\x98\x0C\xA3" - "\x3A\xD1\x45\xDC\x73\x0A\x7E\x15" - "\xAC\x20\xB7\x4E\xE5\x59\xF0\x87" - "\x1E\x92\x29\xC0\x34\xCB\x62\xF9" - "\x6D\x04\x9B\x0F\xA6\x3D\xD4\x48" - "\xDF\x76\x0D\x81\x18\xAF\x23\xBA" - "\x51\xE8\x5C\xF3\x8A\x21\x95\x2C" - "\xC3\x37\xCE\x65\xFC\x70\x07\x9E" - "\x12\xA9\x40\xD7\x4B\xE2\x79\x10" - "\x84\x1B\xB2\x26\xBD\x54\xEB\x5F" - "\xF6\x8D\x01\x98\x2F\xC6\x3A\xD1" - "\x68\xFF\x73\x0A\xA1\x15\xAC\x43" - "\xDA\x4E\xE5\x7C\x13\x87\x1E\xB5" - "\x29\xC0\x57\xEE\x62\xF9\x90\x04" - "\x9B\x32\xC9\x3D\xD4\x6B\x02\x76" - "\x0D\xA4\x18\xAF\x46\xDD\x51\xE8" - "\x7F\x16\x8A\x21\xB8\x2C\xC3\x5A" - "\xF1\x65\xFC\x93\x07\x9E\x35\xCC" - "\x40\xD7\x6E\x05\x79\x10\xA7\x1B" - "\xB2\x49\xE0\x54\xEB\x82\x19\x8D" - "\x24\xBB\x2F\xC6\x5D\xF4\x68\xFF" - "\x96\x0A\xA1\x38\xCF\x43\xDA\x71" - "\x08\x7C\x13\xAA\x1E\xB5\x4C\xE3" - "\x57\xEE\x85\x1C\x90\x27\xBE\x32" - "\xC9\x60\xF7\x6B\x02\x99\x0D\xA4" - "\x3B\xD2\x46\xDD\x74\x0B\x7F\x16" - "\xAD\x21\xB8\x4F\xE6\x5A\xF1\x88" - "\x1F\x93\x2A\xC1\x35\xCC\x63\xFA" - "\x6E\x05\x9C\x10\xA7\x3E\xD5\x49" - "\xE0\x77\x0E\x82\x19\xB0\x24\xBB" - "\x52\xE9\x5D\xF4\x8B\x22\x96\x2D" - "\xC4\x38\xCF\x66\xFD\x71\x08\x9F" - "\x13\xAA\x41\xD8\x4C\xE3\x7A\x11" - "\x85\x1C\xB3\x27\xBE\x55\xEC\x60" - "\xF7\x8E\x02\x99\x30\xC7\x3B\xD2" - "\x69\x00\x74\x0B\xA2\x16\xAD\x44" - "\xDB\x4F\xE6\x7D\x14\x88\x1F\xB6" - "\x2A\xC1\x58\xEF\x63\xFA\x91\x05" - "\x9C\x33\xCA\x3E\xD5\x6C\x03\x77" - "\x0E\xA5\x19\xB0\x47\xDE\x52\xE9" - "\x80\x17\x8B\x22\xB9\x2D\xC4\x5B" - "\xF2\x66\xFD\x94\x08\x9F\x36\xCD" - "\x41\xD8\x6F\x06\x7A\x11\xA8\x1C" - "\xB3\x4A\xE1\x55\xEC\x83\x1A\x8E" - "\x25\xBC\x30\xC7\x5E\xF5\x69\x00" - "\x97\x0B\xA2\x39\xD0\x44\xDB\x72" - "\x09\x7D\x14\xAB\x1F\xB6\x4D\xE4" - "\x58\xEF\x86\x1D\x91\x28\xBF\x33" - "\xCA\x61\xF8\x6C\x03\x9A\x0E\xA5" - "\x3C\xD3\x47\xDE\x75\x0C\x80\x17" - "\xAE\x22\xB9\x50\xE7\x5B\xF2\x89" - "\x20\x94\x2B\xC2\x36\xCD\x64\xFB" - "\x6F\x06\x9D\x11\xA8\x3F\xD6\x4A" - "\xE1\x78\x0F\x83\x1A\xB1\x25\xBC" - "\x53\xEA\x5E\xF5\x8C\x00\x97\x2E" - "\xC5\x39\xD0\x67\xFE\x72\x09\xA0" - "\x14\xAB\x42\xD9\x4D\xE4\x7B\x12" - "\x86\x1D\xB4\x28\xBF\x56\xED\x61" - "\xF8\x8F\x03\x9A\x31\xC8\x3C\xD3" - "\x6A\x01\x75\x0C\xA3\x17\xAE\x45" - "\xDC\x50\xE7\x7E\x15\x89\x20\xB7", - .rlen = 496, - .also_non_np = 1, - .np = 2, - .tap = { 496 - 16, 16 }, + .iv = "\x00\x01\x02\x03\x04\x05\x06\x07" + "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f", + .input = "\x6b\xc1\xbe\xe2\x2e\x40\x9f\x96" + "\xe9\x3d\x7e\x11\x73\x93\x17\x2a" + "\xae\x2d\x8a\x57\x1e\x03\xac\x9c" + "\x9e\xb7\x6f\xac\x45\xaf\x8e\x51" + "\x30\xc8\x1c\x46\xa3\x5c\xe4\x11" + "\xe5\xfb\xc1\x19\x1a\x0a\x52\xef" + "\xf6\x9f\x24\x45\xdf\x4f\x9b\x17" + "\xad\x2b\x41\x7b\xe6\x6c\x37\x10", + .ilen = 64, + .result = "\xf5\x8c\x4c\x04\xd6\xe5\xf1\xba" + "\x77\x9e\xab\xfb\x5f\x7b\xfb\xd6" + "\x9c\xfc\x4e\x96\x7e\xdb\x80\x8d" + "\x67\x9f\x77\x7b\xc6\x70\x2c\x7d" + "\x39\xf2\x33\x69\xa9\xd9\xba\xcf" + "\xa5\x30\xe2\x63\x04\x23\x14\x61" + "\xb2\xeb\x05\xe2\xc3\x9b\xe9\xfc" + "\xda\x6c\x19\x07\x8c\x6a\x9d\x1b", + .rlen = 64, }, }; -static struct cipher_testvec cast6_ctr_enc_tv_template[] = { - { /* Generated from TF test vectors */ - .key = "\x85\x62\x3F\x1C\xF9\xD6\x1C\xF9" - "\xD6\xB3\x90\x6D\x4A\x90\x6D\x4A" - "\x27\x04\xE1\x27\x04\xE1\xBE\x9B" - "\x78\xBE\x9B\x78\x55\x32\x0F\x55", - .klen = 32, - .iv = "\xE2\x24\x89\xEE\x53\xB8\x1D\x5F" - "\xC4\x29\x8E\xF3\x35\x9A\xFF\x64", - .input = "\x56\xED\x84\x1B\x8F\x26\xBD\x31" - "\xC8\x5F\xF6\x6A\x01\x98\x0C\xA3" - "\x3A", - .ilen = 17, - .result = "\x26\x0A\xF1\xE2\x3F\x8A\xEF\xA3" - "\x53\x9A\x5E\x1B\x2A\x1A\xC6\x0A" - "\x57", - .rlen = 17, - }, { /* Generated from TF test vectors */ - .key = "\x85\x62\x3F\x1C\xF9\xD6\x1C\xF9" - "\xD6\xB3\x90\x6D\x4A\x90\x6D\x4A" - "\x27\x04\xE1\x27\x04\xE1\xBE\x9B" - "\x78\xBE\x9B\x78\x55\x32\x0F\x55", - .klen = 32, - .iv = "\xE2\x24\x89\xEE\x53\xB8\x1D\x5F" - "\xC4\x29\x8E\xF3\x35\x9A\xFF\x64", - .input = "\x56\xED\x84\x1B\x8F\x26\xBD\x31" - "\xC8\x5F\xF6\x6A\x01\x98\x0C\xA3" - "\x3A\xD1\x45\xDC\x73\x0A\x7E\x15" - "\xAC\x20\xB7\x4E\xE5\x59\xF0\x87" - "\x1E\x92\x29\xC0\x34\xCB\x62\xF9" - "\x6D\x04\x9B\x0F\xA6\x3D\xD4\x48" - "\xDF\x76\x0D\x81\x18\xAF\x23\xBA" - "\x51\xE8\x5C\xF3\x8A\x21\x95\x2C" - "\xC3\x37\xCE\x65\xFC\x70\x07\x9E" - "\x12\xA9\x40\xD7\x4B\xE2\x79\x10" - "\x84\x1B\xB2\x26\xBD\x54\xEB\x5F" - "\xF6\x8D\x01\x98\x2F\xC6\x3A\xD1" - "\x68\xFF\x73\x0A\xA1\x15\xAC\x43" - "\xDA\x4E\xE5\x7C\x13\x87\x1E\xB5" - "\x29\xC0\x57\xEE\x62\xF9\x90\x04" - "\x9B\x32\xC9\x3D\xD4\x6B\x02\x76" - "\x0D\xA4\x18\xAF\x46\xDD\x51\xE8" - "\x7F\x16\x8A\x21\xB8\x2C\xC3\x5A" - "\xF1\x65\xFC\x93\x07\x9E\x35\xCC" - "\x40\xD7\x6E\x05\x79\x10\xA7\x1B" - "\xB2\x49\xE0\x54\xEB\x82\x19\x8D" - "\x24\xBB\x2F\xC6\x5D\xF4\x68\xFF" - "\x96\x0A\xA1\x38\xCF\x43\xDA\x71" - "\x08\x7C\x13\xAA\x1E\xB5\x4C\xE3" - "\x57\xEE\x85\x1C\x90\x27\xBE\x32" - "\xC9\x60\xF7\x6B\x02\x99\x0D\xA4" - "\x3B\xD2\x46\xDD\x74\x0B\x7F\x16" - "\xAD\x21\xB8\x4F\xE6\x5A\xF1\x88" - "\x1F\x93\x2A\xC1\x35\xCC\x63\xFA" - "\x6E\x05\x9C\x10\xA7\x3E\xD5\x49" - "\xE0\x77\x0E\x82\x19\xB0\x24\xBB" - "\x52\xE9\x5D\xF4\x8B\x22\x96\x2D" - "\xC4\x38\xCF\x66\xFD\x71\x08\x9F" - "\x13\xAA\x41\xD8\x4C\xE3\x7A\x11" - "\x85\x1C\xB3\x27\xBE\x55\xEC\x60" - "\xF7\x8E\x02\x99\x30\xC7\x3B\xD2" - "\x69\x00\x74\x0B\xA2\x16\xAD\x44" - "\xDB\x4F\xE6\x7D\x14\x88\x1F\xB6" - "\x2A\xC1\x58\xEF\x63\xFA\x91\x05" - "\x9C\x33\xCA\x3E\xD5\x6C\x03\x77" - "\x0E\xA5\x19\xB0\x47\xDE\x52\xE9" - "\x80\x17\x8B\x22\xB9\x2D\xC4\x5B" - "\xF2\x66\xFD\x94\x08\x9F\x36\xCD" - "\x41\xD8\x6F\x06\x7A\x11\xA8\x1C" - "\xB3\x4A\xE1\x55\xEC\x83\x1A\x8E" - "\x25\xBC\x30\xC7\x5E\xF5\x69\x00" - "\x97\x0B\xA2\x39\xD0\x44\xDB\x72" - "\x09\x7D\x14\xAB\x1F\xB6\x4D\xE4" - "\x58\xEF\x86\x1D\x91\x28\xBF\x33" - "\xCA\x61\xF8\x6C\x03\x9A\x0E\xA5" - "\x3C\xD3\x47\xDE\x75\x0C\x80\x17" - "\xAE\x22\xB9\x50\xE7\x5B\xF2\x89" - "\x20\x94\x2B\xC2\x36\xCD\x64\xFB" - "\x6F\x06\x9D\x11\xA8\x3F\xD6\x4A" - "\xE1\x78\x0F\x83\x1A\xB1\x25\xBC" - "\x53\xEA\x5E\xF5\x8C\x00\x97\x2E" - "\xC5\x39\xD0\x67\xFE\x72\x09\xA0" - "\x14\xAB\x42\xD9\x4D\xE4\x7B\x12" - "\x86\x1D\xB4\x28\xBF\x56\xED\x61" - "\xF8\x8F\x03\x9A\x31\xC8\x3C\xD3" - "\x6A\x01\x75\x0C\xA3\x17\xAE\x45" - "\xDC\x50\xE7\x7E\x15\x89\x20\xB7", - .ilen = 496, - .result = "\x26\x0A\xF1\xE2\x3F\x8A\xEF\xA3" - "\x53\x9A\x5E\x1B\x2A\x1A\xC6\x0A" - "\x57\xA3\xEF\x47\x2A\xE8\x88\xA7" - "\x3C\xD0\xEC\xB9\x94\x50\x7D\x56" - "\xBC\xE1\xC1\xF5\xE1\xEE\x12\xF8" - "\x4F\x03\x82\x3A\x93\x6B\x4C\xD3" - "\xE3\xF3\xFA\xC2\x23\x55\x98\x20" - "\x49\x76\x9B\x6B\xC1\x23\xBF\xE5" - "\xD4\xC4\x2F\x61\xE1\x67\x2A\x30" - "\x6F\x29\xCA\x54\xF8\x1B\xA6\x7D" - "\x66\x45\xEE\xC8\x19\xBE\x50\xF0" - "\x5F\x65\xF8\x1E\x4D\x07\x87\xD9" - "\xD3\xD9\x1B\x09\x89\xFD\x42\xC5" - "\xDB\xEB\x86\xF1\x67\x04\x0F\x5C" - "\x81\xDF\x82\x12\xC7\x4C\x1B\x07" - "\xDE\xE6\xFA\x29\x86\xD1\xB0\xBA" - "\x3D\x6A\x69\x76\xEC\x0F\xB4\xE6" - "\xCD\xA7\xF8\xA8\xB8\xE0\x33\xF5" - "\x49\x61\x22\x52\x64\x8C\x46\x41" - "\x1F\x48\x5F\x4F\xA2\x89\x36\x17" - "\x20\xF8\x2F\x8F\x4B\xFA\xF2\xC0" - "\x1E\x18\xA2\xF8\xB7\x6D\x98\xE3" - "\x00\x14\x15\x59\xC1\x30\x64\xAF" - "\xA8\x01\x38\xAB\xD4\x8B\xEC\x7C" - "\x44\x9A\xC6\x2C\x2E\x2B\x2B\xF4" - "\x02\x37\xC4\x69\xEF\x36\xC1\xF3" - "\xA0\xFB\xFE\x29\xAD\x39\xCF\xD0" - "\x51\x73\xA3\x22\x42\x41\xAB\xD2" - "\x0F\x50\x14\xB9\x54\xD3\xD4\xFA" - "\xBF\xC9\xBB\xCE\xC4\x1D\x2D\xAF" - "\xC9\x3F\x07\x87\x42\x4B\x3A\x54" - "\x34\x8E\x37\xA3\x03\x6F\x65\x66" - "\xDB\x44\xC3\xE8\xD7\xDD\x7D\xDD" - "\x61\xB4\x2B\x80\xA3\x98\x13\xF5" - "\x5A\xD3\x34\x58\xC3\x6E\xF6\xB8" - "\x0A\xC6\x50\x01\x8E\xD5\x6C\x7D" - "\xFE\x16\xB6\xCF\xFC\x51\x40\xAE" - "\xB3\x15\xAC\x90\x6F\x0B\x28\x3A" - "\x60\x40\x38\x90\x20\x46\xC7\xB3" - "\x0B\x12\x6D\x3B\x15\x14\xF9\xF4" - "\x11\x41\x76\x6B\xB3\x60\x82\x3C" - "\x84\xFB\x08\x2E\x92\x25\xCB\x79" - "\x6F\x58\xC5\x94\x00\x00\x47\xB6" - "\x9E\xDC\x0F\x29\x70\x46\x20\x76" - "\x65\x75\x66\x5C\x00\x96\xB3\xE1" - "\x0B\xA7\x11\x8B\x2E\x61\x4E\x45" - "\x73\xFC\x91\xAB\x79\x41\x23\x14" - "\x13\xB6\x72\x6C\x46\xB3\x03\x11" - "\xE4\xF1\xEE\xC9\x7A\xCF\x96\x32" - "\xB6\xF0\x8B\x97\xB4\xCF\x82\xB7" - "\x15\x48\x44\x99\x09\xF6\xE0\xD7" - "\xBC\xF1\x5B\x91\x4F\x30\x22\xA2" - "\x45\xC4\x68\x55\xC2\xBE\xA7\xD2" - "\x12\x53\x35\x9C\xF9\xE7\x35\x5D" - "\x81\xE4\x86\x42\xC3\x58\xFB\xF0" - "\x38\x9B\x8E\x5A\xEF\x83\x33\x0F" - "\x00\x4E\x3F\x9F\xF5\x84\x62\xC4" - "\x19\x35\x88\x22\x45\x59\x0E\x8F" - "\xEC\x27\xDD\x4A\xA4\x1F\xBC\x41" - "\x9B\x66\x8D\x32\xBA\x81\x34\x87" - "\x0E\x74\x33\x30\x62\xB9\x89\xDF" - "\xF9\xC5\xDD\x27\xB3\x39\xCB\xCB", - .rlen = 496, - .also_non_np = 1, - .np = 2, - .tap = { 496 - 16, 16 }, - }, -}; - -static struct cipher_testvec cast6_ctr_dec_tv_template[] = { - { /* Generated from TF test vectors */ - .key = "\x85\x62\x3F\x1C\xF9\xD6\x1C\xF9" - "\xD6\xB3\x90\x6D\x4A\x90\x6D\x4A" - "\x27\x04\xE1\x27\x04\xE1\xBE\x9B" - "\x78\xBE\x9B\x78\x55\x32\x0F\x55", - .klen = 32, - .iv = "\xE2\x24\x89\xEE\x53\xB8\x1D\x5F" - "\xC4\x29\x8E\xF3\x35\x9A\xFF\x64", - .input = "\x26\x0A\xF1\xE2\x3F\x8A\xEF\xA3" - "\x53\x9A\x5E\x1B\x2A\x1A\xC6\x0A" - "\x57", - .ilen = 17, - .result = "\x56\xED\x84\x1B\x8F\x26\xBD\x31" - "\xC8\x5F\xF6\x6A\x01\x98\x0C\xA3" - "\x3A", - .rlen = 17, - }, { /* Generated from TF test vectors */ - .key = "\x85\x62\x3F\x1C\xF9\xD6\x1C\xF9" - "\xD6\xB3\x90\x6D\x4A\x90\x6D\x4A" - "\x27\x04\xE1\x27\x04\xE1\xBE\x9B" - "\x78\xBE\x9B\x78\x55\x32\x0F\x55", - .klen = 32, - .iv = "\xE2\x24\x89\xEE\x53\xB8\x1D\x5F" - "\xC4\x29\x8E\xF3\x35\x9A\xFF\x64", - .input = "\x26\x0A\xF1\xE2\x3F\x8A\xEF\xA3" - "\x53\x9A\x5E\x1B\x2A\x1A\xC6\x0A" - "\x57\xA3\xEF\x47\x2A\xE8\x88\xA7" - "\x3C\xD0\xEC\xB9\x94\x50\x7D\x56" - "\xBC\xE1\xC1\xF5\xE1\xEE\x12\xF8" - "\x4F\x03\x82\x3A\x93\x6B\x4C\xD3" - "\xE3\xF3\xFA\xC2\x23\x55\x98\x20" - "\x49\x76\x9B\x6B\xC1\x23\xBF\xE5" - "\xD4\xC4\x2F\x61\xE1\x67\x2A\x30" - "\x6F\x29\xCA\x54\xF8\x1B\xA6\x7D" - "\x66\x45\xEE\xC8\x19\xBE\x50\xF0" - "\x5F\x65\xF8\x1E\x4D\x07\x87\xD9" - "\xD3\xD9\x1B\x09\x89\xFD\x42\xC5" - "\xDB\xEB\x86\xF1\x67\x04\x0F\x5C" - "\x81\xDF\x82\x12\xC7\x4C\x1B\x07" - "\xDE\xE6\xFA\x29\x86\xD1\xB0\xBA" - "\x3D\x6A\x69\x76\xEC\x0F\xB4\xE6" - "\xCD\xA7\xF8\xA8\xB8\xE0\x33\xF5" - "\x49\x61\x22\x52\x64\x8C\x46\x41" - "\x1F\x48\x5F\x4F\xA2\x89\x36\x17" - "\x20\xF8\x2F\x8F\x4B\xFA\xF2\xC0" - "\x1E\x18\xA2\xF8\xB7\x6D\x98\xE3" - "\x00\x14\x15\x59\xC1\x30\x64\xAF" - "\xA8\x01\x38\xAB\xD4\x8B\xEC\x7C" - "\x44\x9A\xC6\x2C\x2E\x2B\x2B\xF4" - "\x02\x37\xC4\x69\xEF\x36\xC1\xF3" - "\xA0\xFB\xFE\x29\xAD\x39\xCF\xD0" - "\x51\x73\xA3\x22\x42\x41\xAB\xD2" - "\x0F\x50\x14\xB9\x54\xD3\xD4\xFA" - "\xBF\xC9\xBB\xCE\xC4\x1D\x2D\xAF" - "\xC9\x3F\x07\x87\x42\x4B\x3A\x54" - "\x34\x8E\x37\xA3\x03\x6F\x65\x66" - "\xDB\x44\xC3\xE8\xD7\xDD\x7D\xDD" - "\x61\xB4\x2B\x80\xA3\x98\x13\xF5" - "\x5A\xD3\x34\x58\xC3\x6E\xF6\xB8" - "\x0A\xC6\x50\x01\x8E\xD5\x6C\x7D" - "\xFE\x16\xB6\xCF\xFC\x51\x40\xAE" - "\xB3\x15\xAC\x90\x6F\x0B\x28\x3A" - "\x60\x40\x38\x90\x20\x46\xC7\xB3" - "\x0B\x12\x6D\x3B\x15\x14\xF9\xF4" - "\x11\x41\x76\x6B\xB3\x60\x82\x3C" - "\x84\xFB\x08\x2E\x92\x25\xCB\x79" - "\x6F\x58\xC5\x94\x00\x00\x47\xB6" - "\x9E\xDC\x0F\x29\x70\x46\x20\x76" - "\x65\x75\x66\x5C\x00\x96\xB3\xE1" - "\x0B\xA7\x11\x8B\x2E\x61\x4E\x45" - "\x73\xFC\x91\xAB\x79\x41\x23\x14" - "\x13\xB6\x72\x6C\x46\xB3\x03\x11" - "\xE4\xF1\xEE\xC9\x7A\xCF\x96\x32" - "\xB6\xF0\x8B\x97\xB4\xCF\x82\xB7" - "\x15\x48\x44\x99\x09\xF6\xE0\xD7" - "\xBC\xF1\x5B\x91\x4F\x30\x22\xA2" - "\x45\xC4\x68\x55\xC2\xBE\xA7\xD2" - "\x12\x53\x35\x9C\xF9\xE7\x35\x5D" - "\x81\xE4\x86\x42\xC3\x58\xFB\xF0" - "\x38\x9B\x8E\x5A\xEF\x83\x33\x0F" - "\x00\x4E\x3F\x9F\xF5\x84\x62\xC4" - "\x19\x35\x88\x22\x45\x59\x0E\x8F" - "\xEC\x27\xDD\x4A\xA4\x1F\xBC\x41" - "\x9B\x66\x8D\x32\xBA\x81\x34\x87" - "\x0E\x74\x33\x30\x62\xB9\x89\xDF" - "\xF9\xC5\xDD\x27\xB3\x39\xCB\xCB", - .ilen = 496, - .result = "\x56\xED\x84\x1B\x8F\x26\xBD\x31" - "\xC8\x5F\xF6\x6A\x01\x98\x0C\xA3" - "\x3A\xD1\x45\xDC\x73\x0A\x7E\x15" - "\xAC\x20\xB7\x4E\xE5\x59\xF0\x87" - "\x1E\x92\x29\xC0\x34\xCB\x62\xF9" - "\x6D\x04\x9B\x0F\xA6\x3D\xD4\x48" - "\xDF\x76\x0D\x81\x18\xAF\x23\xBA" - "\x51\xE8\x5C\xF3\x8A\x21\x95\x2C" - "\xC3\x37\xCE\x65\xFC\x70\x07\x9E" - "\x12\xA9\x40\xD7\x4B\xE2\x79\x10" - "\x84\x1B\xB2\x26\xBD\x54\xEB\x5F" - "\xF6\x8D\x01\x98\x2F\xC6\x3A\xD1" - "\x68\xFF\x73\x0A\xA1\x15\xAC\x43" - "\xDA\x4E\xE5\x7C\x13\x87\x1E\xB5" - "\x29\xC0\x57\xEE\x62\xF9\x90\x04" - "\x9B\x32\xC9\x3D\xD4\x6B\x02\x76" - "\x0D\xA4\x18\xAF\x46\xDD\x51\xE8" - "\x7F\x16\x8A\x21\xB8\x2C\xC3\x5A" - "\xF1\x65\xFC\x93\x07\x9E\x35\xCC" - "\x40\xD7\x6E\x05\x79\x10\xA7\x1B" - "\xB2\x49\xE0\x54\xEB\x82\x19\x8D" - "\x24\xBB\x2F\xC6\x5D\xF4\x68\xFF" - "\x96\x0A\xA1\x38\xCF\x43\xDA\x71" - "\x08\x7C\x13\xAA\x1E\xB5\x4C\xE3" - "\x57\xEE\x85\x1C\x90\x27\xBE\x32" - "\xC9\x60\xF7\x6B\x02\x99\x0D\xA4" - "\x3B\xD2\x46\xDD\x74\x0B\x7F\x16" - "\xAD\x21\xB8\x4F\xE6\x5A\xF1\x88" - "\x1F\x93\x2A\xC1\x35\xCC\x63\xFA" - "\x6E\x05\x9C\x10\xA7\x3E\xD5\x49" - "\xE0\x77\x0E\x82\x19\xB0\x24\xBB" - "\x52\xE9\x5D\xF4\x8B\x22\x96\x2D" - "\xC4\x38\xCF\x66\xFD\x71\x08\x9F" - "\x13\xAA\x41\xD8\x4C\xE3\x7A\x11" - "\x85\x1C\xB3\x27\xBE\x55\xEC\x60" - "\xF7\x8E\x02\x99\x30\xC7\x3B\xD2" - "\x69\x00\x74\x0B\xA2\x16\xAD\x44" - "\xDB\x4F\xE6\x7D\x14\x88\x1F\xB6" - "\x2A\xC1\x58\xEF\x63\xFA\x91\x05" - "\x9C\x33\xCA\x3E\xD5\x6C\x03\x77" - "\x0E\xA5\x19\xB0\x47\xDE\x52\xE9" - "\x80\x17\x8B\x22\xB9\x2D\xC4\x5B" - "\xF2\x66\xFD\x94\x08\x9F\x36\xCD" - "\x41\xD8\x6F\x06\x7A\x11\xA8\x1C" - "\xB3\x4A\xE1\x55\xEC\x83\x1A\x8E" - "\x25\xBC\x30\xC7\x5E\xF5\x69\x00" - "\x97\x0B\xA2\x39\xD0\x44\xDB\x72" - "\x09\x7D\x14\xAB\x1F\xB6\x4D\xE4" - "\x58\xEF\x86\x1D\x91\x28\xBF\x33" - "\xCA\x61\xF8\x6C\x03\x9A\x0E\xA5" - "\x3C\xD3\x47\xDE\x75\x0C\x80\x17" - "\xAE\x22\xB9\x50\xE7\x5B\xF2\x89" - "\x20\x94\x2B\xC2\x36\xCD\x64\xFB" - "\x6F\x06\x9D\x11\xA8\x3F\xD6\x4A" - "\xE1\x78\x0F\x83\x1A\xB1\x25\xBC" - "\x53\xEA\x5E\xF5\x8C\x00\x97\x2E" - "\xC5\x39\xD0\x67\xFE\x72\x09\xA0" - "\x14\xAB\x42\xD9\x4D\xE4\x7B\x12" - "\x86\x1D\xB4\x28\xBF\x56\xED\x61" - "\xF8\x8F\x03\x9A\x31\xC8\x3C\xD3" - "\x6A\x01\x75\x0C\xA3\x17\xAE\x45" - "\xDC\x50\xE7\x7E\x15\x89\x20\xB7", - .rlen = 496, - .also_non_np = 1, - .np = 2, - .tap = { 496 - 16, 16 }, - }, -}; - -static struct cipher_testvec cast6_lrw_enc_tv_template[] = { - { /* Generated from TF test vectors */ - .key = "\xf8\xd4\x76\xff\xd6\x46\xee\x6c" - "\x23\x84\xcb\x1c\x77\xd6\x19\x5d" - "\xfe\xf1\xa9\xf3\x7b\xbc\x8d\x21" - "\xa7\x9c\x21\xf8\xcb\x90\x02\x89" - "\xa8\x45\x34\x8e\xc8\xc5\xb5\xf1" - "\x26\xf5\x0e\x76\xfe\xfd\x1b\x1e", - .klen = 48, - .iv = "\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x01", - .input = "\x05\x11\xb7\x18\xab\xc6\x2d\xac" - "\x70\x5d\xf6\x22\x94\xcd\xe5\x6c" - "\x17\x6b\xf6\x1c\xf0\xf3\x6e\xf8" - "\x50\x38\x1f\x71\x49\xb6\x57\xd6" - "\x8f\xcb\x8d\x6b\xe3\xa6\x29\x90" - "\xfe\x2a\x62\x82\xae\x6d\x8b\xf6" - "\xad\x1e\x9e\x20\x5f\x38\xbe\x04" - "\xda\x10\x8e\xed\xa2\xa4\x87\xab" - "\xda\x6b\xb4\x0c\x75\xba\xd3\x7c" - "\xc9\xac\x42\x31\x95\x7c\xc9\x04" - "\xeb\xd5\x6e\x32\x69\x8a\xdb\xa6" - "\x15\xd7\x3f\x4f\x2f\x66\x69\x03" - "\x9c\x1f\x54\x0f\xde\x1f\xf3\x65" - "\x4c\x96\x12\xed\x7c\x92\x03\x01" - "\x6f\xbc\x35\x93\xac\xf1\x27\xf1" - "\xb4\x96\x82\x5a\x5f\xb0\xa0\x50" - "\x89\xa4\x8e\x66\x44\x85\xcc\xfd" - "\x33\x14\x70\xe3\x96\xb2\xc3\xd3" - "\xbb\x54\x5a\x1a\xf9\x74\xa2\xc5" - "\x2d\x64\x75\xdd\xb4\x54\xe6\x74" - "\x8c\xd3\x9d\x9e\x86\xab\x51\x53" - "\xb7\x93\x3e\x6f\xd0\x4e\x2c\x40" - "\xf6\xa8\x2e\x3e\x9d\xf4\x66\xa5" - "\x76\x12\x73\x44\x1a\x56\xd7\x72" - "\x88\xcd\x21\x8c\x4c\x0f\xfe\xda" - "\x95\xe0\x3a\xa6\xa5\x84\x46\xcd" - "\xd5\x3e\x9d\x3a\xe2\x67\xe6\x60" - "\x1a\xe2\x70\x85\x58\xc2\x1b\x09" - "\xe1\xd7\x2c\xca\xad\xa8\x8f\xf9" - "\xac\xb3\x0e\xdb\xca\x2e\xe2\xb8" - "\x51\x71\xd9\x3c\x6c\xf1\x56\xf8" - "\xea\x9c\xf1\xfb\x0c\xe6\xb7\x10" - "\x1c\xf8\xa9\x7c\xe8\x53\x35\xc1" - "\x90\x3e\x76\x4a\x74\xa4\x21\x2c" - "\xf6\x2c\x4e\x0f\x94\x3a\x88\x2e" - "\x41\x09\x6a\x33\x7d\xf6\xdd\x3f" - "\x8d\x23\x31\x74\x84\xeb\x88\x6e" - "\xcc\xb9\xbc\x22\x83\x19\x07\x22" - "\xa5\x2d\xdf\xa5\xf3\x80\x85\x78" - "\x84\x39\x6a\x6d\x6a\x99\x4f\xa5" - "\x15\xfe\x46\xb0\xe4\x6c\xa5\x41" - "\x3c\xce\x8f\x42\x60\x71\xa7\x75" - "\x08\x40\x65\x8a\x82\xbf\xf5\x43" - "\x71\x96\xa9\x4d\x44\x8a\x20\xbe" - "\xfa\x4d\xbb\xc0\x7d\x31\x96\x65" - "\xe7\x75\xe5\x3e\xfd\x92\x3b\xc9" - "\x55\xbb\x16\x7e\xf7\xc2\x8c\xa4" - "\x40\x1d\xe5\xef\x0e\xdf\xe4\x9a" - "\x62\x73\x65\xfd\x46\x63\x25\x3d" - "\x2b\xaf\xe5\x64\xfe\xa5\x5c\xcf" - "\x24\xf3\xb4\xac\x64\xba\xdf\x4b" - "\xc6\x96\x7d\x81\x2d\x8d\x97\xf7" - "\xc5\x68\x77\x84\x32\x2b\xcc\x85" - "\x74\x96\xf0\x12\x77\x61\xb9\xeb" - "\x71\xaa\x82\xcb\x1c\xdb\x89\xc8" - "\xc6\xb5\xe3\x5c\x7d\x39\x07\x24" - "\xda\x39\x87\x45\xc0\x2b\xbb\x01" - "\xac\xbc\x2a\x5c\x7f\xfc\xe8\xce" - "\x6d\x9c\x6f\xed\xd3\xc1\xa1\xd6" - "\xc5\x55\xa9\x66\x2f\xe1\xc8\x32" - "\xa6\x5d\xa4\x3a\x98\x73\xe8\x45" - "\xa4\xc7\xa8\xb4\xf6\x13\x03\xf6" - "\xe9\x2e\xc4\x29\x0f\x84\xdb\xc4" - "\x21\xc4\xc2\x75\x67\x89\x37\x0a", - .ilen = 512, - .result = "\x55\x25\x09\x8B\xB5\xD5\xF8\xBF" - "\x37\x4A\xFE\x3C\x47\xD8\xE6\xEB" - "\xCA\xA4\x9B\xB0\xAB\x6D\x64\xCA" - "\x58\xB6\x73\xF0\xD7\x52\x34\xEF" - "\xFB\x3E\x96\x81\xB7\x71\x34\xA4" - "\x55\x20\xBE\x39\x5A\x2B\xF9\xD1" - "\x65\x0B\xDA\xD3\x7E\xB3\xA6\xF7" - "\x2E\x0B\x5A\x52\xDB\x39\x8C\x9B" - "\x61\x17\x5F\xAF\xB6\x5A\xC8\x08" - "\xA7\xB7\x2A\x11\x7C\x97\x38\x9D" - "\x59\x0E\x66\x59\x5E\xD8\x8B\xCE" - "\x70\xE0\xC3\x42\xB0\x8C\x0F\xBA" - "\xB2\x0D\x81\xB6\xBE\x61\x1C\x2D" - "\x7E\xEA\x91\x25\xAC\xEC\xF8\x28" - "\x80\x1D\xF0\x30\xBA\x62\x77\x7D" - "\xDB\x15\x69\xDF\xFA\x2A\x81\x64" - "\x95\x5B\xA4\x7F\x3E\x4F\xE3\x30" - "\xB0\x5C\xC2\x05\xF8\xF0\x29\xE7" - "\x0A\xA0\x66\xB2\x5D\x0F\x39\x2B" - "\xB4\xB3\x00\xA9\xD0\xAB\x63\x61" - "\x5E\xDB\xFC\x11\x74\x25\x96\x65" - "\xE8\xE2\x34\x57\x77\x15\x5E\x70" - "\xFF\x10\x90\xC3\x64\xF0\x11\x0A" - "\x63\x3A\xD3\x55\x92\x15\x4B\x0C" - "\xC7\x08\x89\x17\x3B\x99\xAD\x63" - "\xE7\x06\xDF\x52\xBC\x15\x64\x45" - "\x9D\x7A\xFB\x69\xBC\x2D\x6E\xA9" - "\x35\xD9\xD8\xF5\x0C\xC4\xA2\x23" - "\x9C\x18\x8B\xA8\x8C\xFE\xF8\x0E" - "\xBD\xAB\x60\x1A\x51\x17\x54\x27" - "\xB6\xE8\xBE\x0F\xA9\xA5\x82\x19" - "\x2F\x6F\x20\xA7\x47\xED\x74\x6C" - "\x4E\xC1\xF8\x8C\x14\xF3\xBB\x1F" - "\xED\x4D\x8F\x7C\x37\xEF\x19\xA1" - "\x07\x16\xDE\x76\xCC\x5E\x94\x02" - "\xFB\xBF\xE4\x81\x50\xCE\xFC\x0F" - "\x9E\xCF\x3D\xF6\x67\x00\xBF\xA7" - "\x6E\x21\x58\x36\x06\xDE\xB3\xD4" - "\xA2\xFA\xD8\x4E\xE0\xB9\x7F\x23" - "\x51\x21\x2B\x32\x68\xAA\xF8\xA8" - "\x93\x08\xB5\x6D\xE6\x43\x2C\xB7" - "\x31\xB2\x0F\xD0\xA2\x51\xC0\x25" - "\x30\xC7\x10\x3F\x97\x27\x01\x8E" - "\xFA\xD8\x4F\x78\xD8\x2E\x1D\xEB" - "\xA1\x37\x52\x0F\x7B\x5E\x87\xA8" - "\x22\xE2\xE6\x92\xA7\x5F\x11\x32" - "\xCC\x93\x34\xFC\xD1\x7E\xAE\x54" - "\xBC\x6A\x1B\x91\xD1\x2E\x21\xEC" - "\x5D\xF1\xC4\xF1\x55\x20\xBF\xE5" - "\x96\x3D\x69\x91\x20\x4E\xF2\x61" - "\xDA\x77\xFE\xEE\xC3\x74\x57\x2A" - "\x78\x39\xB0\xE0\xCF\x12\x56\xD6" - "\x05\xDC\xF9\x19\x66\x44\x1D\xF9" - "\x82\x37\xD4\xC2\x60\xB6\x31\xDF" - "\x0C\xAF\xBC\x8B\x55\x9A\xC8\x2D" - "\xAB\xA7\x88\x7B\x41\xE8\x29\xC9" - "\x9B\x8D\xA7\x00\x86\x25\xB6\x14" - "\xF5\x13\x73\xD7\x4B\x6B\x83\xF3" - "\xAF\x96\x00\xE4\xB7\x3C\x65\xA6" - "\x15\xB7\x94\x7D\x4E\x70\x4C\x75" - "\xF3\xB4\x02\xA9\x17\x1C\x7A\x0A" - "\xC0\xD5\x33\x11\x56\xDE\xDC\xF5" - "\x8D\xD9\xCD\x3B\x22\x67\x18\xC7" - "\xC4\xF5\x99\x61\xBC\xBB\x5B\x46", - .rlen = 512, - .also_non_np = 1, - .np = 2, - .tap = { 512 - 16, 16 }, - }, -}; - -static struct cipher_testvec cast6_lrw_dec_tv_template[] = { - { /* Generated from TF test vectors */ - .key = "\xf8\xd4\x76\xff\xd6\x46\xee\x6c" - "\x23\x84\xcb\x1c\x77\xd6\x19\x5d" - "\xfe\xf1\xa9\xf3\x7b\xbc\x8d\x21" - "\xa7\x9c\x21\xf8\xcb\x90\x02\x89" - "\xa8\x45\x34\x8e\xc8\xc5\xb5\xf1" - "\x26\xf5\x0e\x76\xfe\xfd\x1b\x1e", - .klen = 48, - .iv = "\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x01", - .input = "\x55\x25\x09\x8B\xB5\xD5\xF8\xBF" - "\x37\x4A\xFE\x3C\x47\xD8\xE6\xEB" - "\xCA\xA4\x9B\xB0\xAB\x6D\x64\xCA" - "\x58\xB6\x73\xF0\xD7\x52\x34\xEF" - "\xFB\x3E\x96\x81\xB7\x71\x34\xA4" - "\x55\x20\xBE\x39\x5A\x2B\xF9\xD1" - "\x65\x0B\xDA\xD3\x7E\xB3\xA6\xF7" - "\x2E\x0B\x5A\x52\xDB\x39\x8C\x9B" - "\x61\x17\x5F\xAF\xB6\x5A\xC8\x08" - "\xA7\xB7\x2A\x11\x7C\x97\x38\x9D" - "\x59\x0E\x66\x59\x5E\xD8\x8B\xCE" - "\x70\xE0\xC3\x42\xB0\x8C\x0F\xBA" - "\xB2\x0D\x81\xB6\xBE\x61\x1C\x2D" - "\x7E\xEA\x91\x25\xAC\xEC\xF8\x28" - "\x80\x1D\xF0\x30\xBA\x62\x77\x7D" - "\xDB\x15\x69\xDF\xFA\x2A\x81\x64" - "\x95\x5B\xA4\x7F\x3E\x4F\xE3\x30" - "\xB0\x5C\xC2\x05\xF8\xF0\x29\xE7" - "\x0A\xA0\x66\xB2\x5D\x0F\x39\x2B" - "\xB4\xB3\x00\xA9\xD0\xAB\x63\x61" - "\x5E\xDB\xFC\x11\x74\x25\x96\x65" - "\xE8\xE2\x34\x57\x77\x15\x5E\x70" - "\xFF\x10\x90\xC3\x64\xF0\x11\x0A" - "\x63\x3A\xD3\x55\x92\x15\x4B\x0C" - "\xC7\x08\x89\x17\x3B\x99\xAD\x63" - "\xE7\x06\xDF\x52\xBC\x15\x64\x45" - "\x9D\x7A\xFB\x69\xBC\x2D\x6E\xA9" - "\x35\xD9\xD8\xF5\x0C\xC4\xA2\x23" - "\x9C\x18\x8B\xA8\x8C\xFE\xF8\x0E" - "\xBD\xAB\x60\x1A\x51\x17\x54\x27" - "\xB6\xE8\xBE\x0F\xA9\xA5\x82\x19" - "\x2F\x6F\x20\xA7\x47\xED\x74\x6C" - "\x4E\xC1\xF8\x8C\x14\xF3\xBB\x1F" - "\xED\x4D\x8F\x7C\x37\xEF\x19\xA1" - "\x07\x16\xDE\x76\xCC\x5E\x94\x02" - "\xFB\xBF\xE4\x81\x50\xCE\xFC\x0F" - "\x9E\xCF\x3D\xF6\x67\x00\xBF\xA7" - "\x6E\x21\x58\x36\x06\xDE\xB3\xD4" - "\xA2\xFA\xD8\x4E\xE0\xB9\x7F\x23" - "\x51\x21\x2B\x32\x68\xAA\xF8\xA8" - "\x93\x08\xB5\x6D\xE6\x43\x2C\xB7" - "\x31\xB2\x0F\xD0\xA2\x51\xC0\x25" - "\x30\xC7\x10\x3F\x97\x27\x01\x8E" - "\xFA\xD8\x4F\x78\xD8\x2E\x1D\xEB" - "\xA1\x37\x52\x0F\x7B\x5E\x87\xA8" - "\x22\xE2\xE6\x92\xA7\x5F\x11\x32" - "\xCC\x93\x34\xFC\xD1\x7E\xAE\x54" - "\xBC\x6A\x1B\x91\xD1\x2E\x21\xEC" - "\x5D\xF1\xC4\xF1\x55\x20\xBF\xE5" - "\x96\x3D\x69\x91\x20\x4E\xF2\x61" - "\xDA\x77\xFE\xEE\xC3\x74\x57\x2A" - "\x78\x39\xB0\xE0\xCF\x12\x56\xD6" - "\x05\xDC\xF9\x19\x66\x44\x1D\xF9" - "\x82\x37\xD4\xC2\x60\xB6\x31\xDF" - "\x0C\xAF\xBC\x8B\x55\x9A\xC8\x2D" - "\xAB\xA7\x88\x7B\x41\xE8\x29\xC9" - "\x9B\x8D\xA7\x00\x86\x25\xB6\x14" - "\xF5\x13\x73\xD7\x4B\x6B\x83\xF3" - "\xAF\x96\x00\xE4\xB7\x3C\x65\xA6" - "\x15\xB7\x94\x7D\x4E\x70\x4C\x75" - "\xF3\xB4\x02\xA9\x17\x1C\x7A\x0A" - "\xC0\xD5\x33\x11\x56\xDE\xDC\xF5" - "\x8D\xD9\xCD\x3B\x22\x67\x18\xC7" - "\xC4\xF5\x99\x61\xBC\xBB\x5B\x46", - .ilen = 512, - .result = "\x05\x11\xb7\x18\xab\xc6\x2d\xac" - "\x70\x5d\xf6\x22\x94\xcd\xe5\x6c" - "\x17\x6b\xf6\x1c\xf0\xf3\x6e\xf8" - "\x50\x38\x1f\x71\x49\xb6\x57\xd6" - "\x8f\xcb\x8d\x6b\xe3\xa6\x29\x90" - "\xfe\x2a\x62\x82\xae\x6d\x8b\xf6" - "\xad\x1e\x9e\x20\x5f\x38\xbe\x04" - "\xda\x10\x8e\xed\xa2\xa4\x87\xab" - "\xda\x6b\xb4\x0c\x75\xba\xd3\x7c" - "\xc9\xac\x42\x31\x95\x7c\xc9\x04" - "\xeb\xd5\x6e\x32\x69\x8a\xdb\xa6" - "\x15\xd7\x3f\x4f\x2f\x66\x69\x03" - "\x9c\x1f\x54\x0f\xde\x1f\xf3\x65" - "\x4c\x96\x12\xed\x7c\x92\x03\x01" - "\x6f\xbc\x35\x93\xac\xf1\x27\xf1" - "\xb4\x96\x82\x5a\x5f\xb0\xa0\x50" - "\x89\xa4\x8e\x66\x44\x85\xcc\xfd" - "\x33\x14\x70\xe3\x96\xb2\xc3\xd3" - "\xbb\x54\x5a\x1a\xf9\x74\xa2\xc5" - "\x2d\x64\x75\xdd\xb4\x54\xe6\x74" - "\x8c\xd3\x9d\x9e\x86\xab\x51\x53" - "\xb7\x93\x3e\x6f\xd0\x4e\x2c\x40" - "\xf6\xa8\x2e\x3e\x9d\xf4\x66\xa5" - "\x76\x12\x73\x44\x1a\x56\xd7\x72" - "\x88\xcd\x21\x8c\x4c\x0f\xfe\xda" - "\x95\xe0\x3a\xa6\xa5\x84\x46\xcd" - "\xd5\x3e\x9d\x3a\xe2\x67\xe6\x60" - "\x1a\xe2\x70\x85\x58\xc2\x1b\x09" - "\xe1\xd7\x2c\xca\xad\xa8\x8f\xf9" - "\xac\xb3\x0e\xdb\xca\x2e\xe2\xb8" - "\x51\x71\xd9\x3c\x6c\xf1\x56\xf8" - "\xea\x9c\xf1\xfb\x0c\xe6\xb7\x10" - "\x1c\xf8\xa9\x7c\xe8\x53\x35\xc1" - "\x90\x3e\x76\x4a\x74\xa4\x21\x2c" - "\xf6\x2c\x4e\x0f\x94\x3a\x88\x2e" - "\x41\x09\x6a\x33\x7d\xf6\xdd\x3f" - "\x8d\x23\x31\x74\x84\xeb\x88\x6e" - "\xcc\xb9\xbc\x22\x83\x19\x07\x22" - "\xa5\x2d\xdf\xa5\xf3\x80\x85\x78" - "\x84\x39\x6a\x6d\x6a\x99\x4f\xa5" - "\x15\xfe\x46\xb0\xe4\x6c\xa5\x41" - "\x3c\xce\x8f\x42\x60\x71\xa7\x75" - "\x08\x40\x65\x8a\x82\xbf\xf5\x43" - "\x71\x96\xa9\x4d\x44\x8a\x20\xbe" - "\xfa\x4d\xbb\xc0\x7d\x31\x96\x65" - "\xe7\x75\xe5\x3e\xfd\x92\x3b\xc9" - "\x55\xbb\x16\x7e\xf7\xc2\x8c\xa4" - "\x40\x1d\xe5\xef\x0e\xdf\xe4\x9a" - "\x62\x73\x65\xfd\x46\x63\x25\x3d" - "\x2b\xaf\xe5\x64\xfe\xa5\x5c\xcf" - "\x24\xf3\xb4\xac\x64\xba\xdf\x4b" - "\xc6\x96\x7d\x81\x2d\x8d\x97\xf7" - "\xc5\x68\x77\x84\x32\x2b\xcc\x85" - "\x74\x96\xf0\x12\x77\x61\xb9\xeb" - "\x71\xaa\x82\xcb\x1c\xdb\x89\xc8" - "\xc6\xb5\xe3\x5c\x7d\x39\x07\x24" - "\xda\x39\x87\x45\xc0\x2b\xbb\x01" - "\xac\xbc\x2a\x5c\x7f\xfc\xe8\xce" - "\x6d\x9c\x6f\xed\xd3\xc1\xa1\xd6" - "\xc5\x55\xa9\x66\x2f\xe1\xc8\x32" - "\xa6\x5d\xa4\x3a\x98\x73\xe8\x45" - "\xa4\xc7\xa8\xb4\xf6\x13\x03\xf6" - "\xe9\x2e\xc4\x29\x0f\x84\xdb\xc4" - "\x21\xc4\xc2\x75\x67\x89\x37\x0a", - .rlen = 512, - .also_non_np = 1, - .np = 2, - .tap = { 512 - 16, 16 }, - }, -}; - -static struct cipher_testvec cast6_xts_enc_tv_template[] = { - { /* Generated from TF test vectors */ - .key = "\x27\x18\x28\x18\x28\x45\x90\x45" - "\x23\x53\x60\x28\x74\x71\x35\x26" - "\x62\x49\x77\x57\x24\x70\x93\x69" - "\x99\x59\x57\x49\x66\x96\x76\x27" - "\x31\x41\x59\x26\x53\x58\x97\x93" - "\x23\x84\x62\x64\x33\x83\x27\x95" - "\x02\x88\x41\x97\x16\x93\x99\x37" - "\x51\x05\x82\x09\x74\x94\x45\x92", - .klen = 64, - .iv = "\xff\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00", - .input = "\x00\x01\x02\x03\x04\x05\x06\x07" - "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f" - "\x10\x11\x12\x13\x14\x15\x16\x17" - "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f" - "\x20\x21\x22\x23\x24\x25\x26\x27" - "\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f" - "\x30\x31\x32\x33\x34\x35\x36\x37" - "\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f" - "\x40\x41\x42\x43\x44\x45\x46\x47" - "\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f" - "\x50\x51\x52\x53\x54\x55\x56\x57" - "\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f" - "\x60\x61\x62\x63\x64\x65\x66\x67" - "\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f" - "\x70\x71\x72\x73\x74\x75\x76\x77" - "\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f" - "\x80\x81\x82\x83\x84\x85\x86\x87" - "\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f" - "\x90\x91\x92\x93\x94\x95\x96\x97" - "\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f" - "\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7" - "\xa8\xa9\xaa\xab\xac\xad\xae\xaf" - "\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7" - "\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf" - "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7" - "\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf" - "\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7" - "\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf" - "\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7" - "\xe8\xe9\xea\xeb\xec\xed\xee\xef" - "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7" - "\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff" - "\x00\x01\x02\x03\x04\x05\x06\x07" - "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f" - "\x10\x11\x12\x13\x14\x15\x16\x17" - "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f" - "\x20\x21\x22\x23\x24\x25\x26\x27" - "\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f" - "\x30\x31\x32\x33\x34\x35\x36\x37" - "\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f" - "\x40\x41\x42\x43\x44\x45\x46\x47" - "\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f" - "\x50\x51\x52\x53\x54\x55\x56\x57" - "\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f" - "\x60\x61\x62\x63\x64\x65\x66\x67" - "\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f" - "\x70\x71\x72\x73\x74\x75\x76\x77" - "\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f" - "\x80\x81\x82\x83\x84\x85\x86\x87" - "\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f" - "\x90\x91\x92\x93\x94\x95\x96\x97" - "\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f" - "\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7" - "\xa8\xa9\xaa\xab\xac\xad\xae\xaf" - "\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7" - "\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf" - "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7" - "\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf" - "\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7" - "\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf" - "\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7" - "\xe8\xe9\xea\xeb\xec\xed\xee\xef" - "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7" - "\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff", - .ilen = 512, - .result = "\xDE\x6F\x22\xA5\xE8\x39\xE8\x78" - "\x88\x5A\x4F\x8D\x82\x76\x52\x6D" - "\xB2\x41\x16\xF4\x2B\xA6\xEB\xF6" - "\xE2\xC5\x62\x8D\x61\xA1\x01\xED" - "\xD9\x38\x01\xC1\x43\x63\x4E\x88" - "\xC9\x4B\x5A\x88\x80\xB7\x5C\x71" - "\x47\xEE\x11\xD8\xB7\x2D\x5D\x13" - "\x1A\xB1\x68\x5B\x61\xA7\xA9\x81" - "\x8B\x83\xA1\x6A\xAA\x36\xD6\xB6" - "\x60\x54\x09\x32\xFE\x6A\x76\x2E" - "\x28\xFF\xD5\xD6\xDD\x1D\x45\x7D" - "\xF0\x8B\xF3\x32\x4E\x6C\x12\xCB" - "\xB8\x25\x70\xF8\x40\xBC\x90\x1B" - "\x11\xC3\x59\xAF\xF0\x2F\x92\xDD" - "\xD3\x3B\xCF\x60\xA1\x78\x94\x57" - "\xAF\x76\xC1\x67\xA6\x3C\xCD\x98" - "\xB1\xF7\x27\xB9\xA3\xBD\x10\xEA" - "\xCD\x8B\xC2\xF2\x14\xF2\xB2\x67" - "\x05\xDD\x1D\x58\x6E\x2F\x95\x08" - "\x3A\xF8\x78\x76\x82\x56\xA7\xEC" - "\x51\x4B\x85\x77\xC2\x4C\x4A\x34" - "\x71\x38\x17\x91\x44\xE8\xFC\x65" - "\x99\x0D\x52\x91\xEE\xF8\xEF\x27" - "\x2A\x9E\x6E\x78\xC4\x26\x87\xF4" - "\x8A\xF0\x2D\x04\xE8\x14\x92\x5D" - "\x59\x22\x9B\x29\x5C\x18\xF0\xC3" - "\x47\xF3\x76\xD8\xE4\xF3\x1B\xD1" - "\x70\xA3\x0D\xB5\x70\x02\x1D\xA3" - "\x91\x3B\x49\x73\x18\xAB\xD4\xC9" - "\xC3\x1E\xEF\x1F\xFE\xD5\x59\x8A" - "\xD7\xF6\xC9\x71\x67\x79\xD7\x0E" - "\xBE\x1F\x8E\xEC\x55\x7E\x4F\x24" - "\xE6\x87\xEA\xFE\x96\x25\x67\x8E" - "\x93\x03\xFA\xFF\xCE\xAF\xB2\x3C" - "\x6F\xEB\x57\xFB\xD3\x28\x87\xA9" - "\xCE\xC2\xF5\x9C\xC6\x67\xB5\x97" - "\x49\xF7\x04\xCB\xEF\x84\x98\x33" - "\xAF\x38\xD3\x04\x1C\x24\x71\x38" - "\xC7\x71\xDD\x43\x0D\x12\x4A\x18" - "\xBA\xC4\xAF\xBA\xB2\x5B\xEB\x95" - "\x02\x43\x5D\xCE\x19\xCC\xCD\x66" - "\x91\x0B\x8C\x7F\x51\xC4\xBF\x3C" - "\x8B\xF1\xCC\xAA\x29\xD7\x87\xCB" - "\x3E\xC5\xF3\xC9\x75\xE8\xA3\x5B" - "\x30\x45\xA9\xB7\xAF\x80\x64\x6F" - "\x75\x4A\xA7\xC0\x6D\x19\x6B\xDE" - "\x17\xDE\x6D\xEA\x87\x9F\x95\xAE" - "\xF5\x3C\xEE\x54\xB8\x27\x84\xF8" - "\x97\xA3\xE1\x6F\x38\x24\x34\x88" - "\xCE\xBD\x32\x52\xE0\x00\x6C\x94" - "\xC9\xD7\x5D\x37\x81\x33\x2E\x7F" - "\x4F\x7E\x2E\x0D\x94\xBD\xEA\x59" - "\x34\x39\xA8\x35\x12\xB7\xBC\xAC" - "\xEA\x52\x9C\x78\x02\x6D\x92\x36" - "\xFB\x59\x2B\xA4\xEA\x7B\x1B\x83" - "\xE1\x4D\x5E\x2A\x7E\x92\xB1\x64" - "\xDE\xE0\x27\x4B\x0A\x6F\x4C\xE3" - "\xB0\xEB\x31\xE4\x69\x95\xAB\x35" - "\x8B\x2C\xF5\x6B\x7F\xF1\xA2\x82" - "\xF8\xD9\x47\x82\xA9\x82\x03\x91" - "\x69\x1F\xBE\x4C\xE7\xC7\x34\x2F" - "\x45\x72\x80\x17\x81\xBD\x9D\x62" - "\xA1\xAC\xE8\xCF\xC6\x74\xCF\xDC" - "\x22\x60\x4E\xE8\xA4\x5D\x85\xB9", - .rlen = 512, - .also_non_np = 1, - .np = 2, - .tap = { 512 - 16, 16 }, - }, -}; - -static struct cipher_testvec cast6_xts_dec_tv_template[] = { - { /* Generated from TF test vectors */ - .key = "\x27\x18\x28\x18\x28\x45\x90\x45" - "\x23\x53\x60\x28\x74\x71\x35\x26" - "\x62\x49\x77\x57\x24\x70\x93\x69" - "\x99\x59\x57\x49\x66\x96\x76\x27" - "\x31\x41\x59\x26\x53\x58\x97\x93" - "\x23\x84\x62\x64\x33\x83\x27\x95" - "\x02\x88\x41\x97\x16\x93\x99\x37" - "\x51\x05\x82\x09\x74\x94\x45\x92", - .klen = 64, - .iv = "\xff\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00", - .input = "\xDE\x6F\x22\xA5\xE8\x39\xE8\x78" - "\x88\x5A\x4F\x8D\x82\x76\x52\x6D" - "\xB2\x41\x16\xF4\x2B\xA6\xEB\xF6" - "\xE2\xC5\x62\x8D\x61\xA1\x01\xED" - "\xD9\x38\x01\xC1\x43\x63\x4E\x88" - "\xC9\x4B\x5A\x88\x80\xB7\x5C\x71" - "\x47\xEE\x11\xD8\xB7\x2D\x5D\x13" - "\x1A\xB1\x68\x5B\x61\xA7\xA9\x81" - "\x8B\x83\xA1\x6A\xAA\x36\xD6\xB6" - "\x60\x54\x09\x32\xFE\x6A\x76\x2E" - "\x28\xFF\xD5\xD6\xDD\x1D\x45\x7D" - "\xF0\x8B\xF3\x32\x4E\x6C\x12\xCB" - "\xB8\x25\x70\xF8\x40\xBC\x90\x1B" - "\x11\xC3\x59\xAF\xF0\x2F\x92\xDD" - "\xD3\x3B\xCF\x60\xA1\x78\x94\x57" - "\xAF\x76\xC1\x67\xA6\x3C\xCD\x98" - "\xB1\xF7\x27\xB9\xA3\xBD\x10\xEA" - "\xCD\x8B\xC2\xF2\x14\xF2\xB2\x67" - "\x05\xDD\x1D\x58\x6E\x2F\x95\x08" - "\x3A\xF8\x78\x76\x82\x56\xA7\xEC" - "\x51\x4B\x85\x77\xC2\x4C\x4A\x34" - "\x71\x38\x17\x91\x44\xE8\xFC\x65" - "\x99\x0D\x52\x91\xEE\xF8\xEF\x27" - "\x2A\x9E\x6E\x78\xC4\x26\x87\xF4" - "\x8A\xF0\x2D\x04\xE8\x14\x92\x5D" - "\x59\x22\x9B\x29\x5C\x18\xF0\xC3" - "\x47\xF3\x76\xD8\xE4\xF3\x1B\xD1" - "\x70\xA3\x0D\xB5\x70\x02\x1D\xA3" - "\x91\x3B\x49\x73\x18\xAB\xD4\xC9" - "\xC3\x1E\xEF\x1F\xFE\xD5\x59\x8A" - "\xD7\xF6\xC9\x71\x67\x79\xD7\x0E" - "\xBE\x1F\x8E\xEC\x55\x7E\x4F\x24" - "\xE6\x87\xEA\xFE\x96\x25\x67\x8E" - "\x93\x03\xFA\xFF\xCE\xAF\xB2\x3C" - "\x6F\xEB\x57\xFB\xD3\x28\x87\xA9" - "\xCE\xC2\xF5\x9C\xC6\x67\xB5\x97" - "\x49\xF7\x04\xCB\xEF\x84\x98\x33" - "\xAF\x38\xD3\x04\x1C\x24\x71\x38" - "\xC7\x71\xDD\x43\x0D\x12\x4A\x18" - "\xBA\xC4\xAF\xBA\xB2\x5B\xEB\x95" - "\x02\x43\x5D\xCE\x19\xCC\xCD\x66" - "\x91\x0B\x8C\x7F\x51\xC4\xBF\x3C" - "\x8B\xF1\xCC\xAA\x29\xD7\x87\xCB" - "\x3E\xC5\xF3\xC9\x75\xE8\xA3\x5B" - "\x30\x45\xA9\xB7\xAF\x80\x64\x6F" - "\x75\x4A\xA7\xC0\x6D\x19\x6B\xDE" - "\x17\xDE\x6D\xEA\x87\x9F\x95\xAE" - "\xF5\x3C\xEE\x54\xB8\x27\x84\xF8" - "\x97\xA3\xE1\x6F\x38\x24\x34\x88" - "\xCE\xBD\x32\x52\xE0\x00\x6C\x94" - "\xC9\xD7\x5D\x37\x81\x33\x2E\x7F" - "\x4F\x7E\x2E\x0D\x94\xBD\xEA\x59" - "\x34\x39\xA8\x35\x12\xB7\xBC\xAC" - "\xEA\x52\x9C\x78\x02\x6D\x92\x36" - "\xFB\x59\x2B\xA4\xEA\x7B\x1B\x83" - "\xE1\x4D\x5E\x2A\x7E\x92\xB1\x64" - "\xDE\xE0\x27\x4B\x0A\x6F\x4C\xE3" - "\xB0\xEB\x31\xE4\x69\x95\xAB\x35" - "\x8B\x2C\xF5\x6B\x7F\xF1\xA2\x82" - "\xF8\xD9\x47\x82\xA9\x82\x03\x91" - "\x69\x1F\xBE\x4C\xE7\xC7\x34\x2F" - "\x45\x72\x80\x17\x81\xBD\x9D\x62" - "\xA1\xAC\xE8\xCF\xC6\x74\xCF\xDC" - "\x22\x60\x4E\xE8\xA4\x5D\x85\xB9", - .ilen = 512, - .result = "\x00\x01\x02\x03\x04\x05\x06\x07" - "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f" - "\x10\x11\x12\x13\x14\x15\x16\x17" - "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f" - "\x20\x21\x22\x23\x24\x25\x26\x27" - "\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f" - "\x30\x31\x32\x33\x34\x35\x36\x37" - "\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f" - "\x40\x41\x42\x43\x44\x45\x46\x47" - "\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f" - "\x50\x51\x52\x53\x54\x55\x56\x57" - "\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f" - "\x60\x61\x62\x63\x64\x65\x66\x67" - "\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f" - "\x70\x71\x72\x73\x74\x75\x76\x77" - "\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f" - "\x80\x81\x82\x83\x84\x85\x86\x87" - "\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f" - "\x90\x91\x92\x93\x94\x95\x96\x97" - "\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f" - "\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7" - "\xa8\xa9\xaa\xab\xac\xad\xae\xaf" - "\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7" - "\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf" - "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7" - "\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf" - "\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7" - "\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf" - "\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7" - "\xe8\xe9\xea\xeb\xec\xed\xee\xef" - "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7" - "\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff" - "\x00\x01\x02\x03\x04\x05\x06\x07" - "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f" - "\x10\x11\x12\x13\x14\x15\x16\x17" - "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f" - "\x20\x21\x22\x23\x24\x25\x26\x27" - "\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f" - "\x30\x31\x32\x33\x34\x35\x36\x37" - "\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f" - "\x40\x41\x42\x43\x44\x45\x46\x47" - "\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f" - "\x50\x51\x52\x53\x54\x55\x56\x57" - "\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f" - "\x60\x61\x62\x63\x64\x65\x66\x67" - "\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f" - "\x70\x71\x72\x73\x74\x75\x76\x77" - "\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f" - "\x80\x81\x82\x83\x84\x85\x86\x87" - "\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f" - "\x90\x91\x92\x93\x94\x95\x96\x97" - "\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f" - "\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7" - "\xa8\xa9\xaa\xab\xac\xad\xae\xaf" - "\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7" - "\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf" - "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7" - "\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf" - "\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7" - "\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf" - "\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7" - "\xe8\xe9\xea\xeb\xec\xed\xee\xef" - "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7" - "\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff", - .rlen = 512, - .also_non_np = 1, - .np = 2, - .tap = { 512 - 16, 16 }, - }, -}; - - -/* - * AES test vectors. - */ -#define AES_ENC_TEST_VECTORS 3 -#define AES_DEC_TEST_VECTORS 3 -#define AES_CBC_ENC_TEST_VECTORS 4 -#define AES_CBC_DEC_TEST_VECTORS 4 -#define HMAC_SHA1_AES_CBC_ENC_TEST_VECTORS 7 -#define HMAC_SHA256_AES_CBC_ENC_TEST_VECTORS 7 -#define HMAC_SHA512_AES_CBC_ENC_TEST_VECTORS 7 -#define AES_LRW_ENC_TEST_VECTORS 8 -#define AES_LRW_DEC_TEST_VECTORS 8 -#define AES_XTS_ENC_TEST_VECTORS 5 -#define AES_XTS_DEC_TEST_VECTORS 5 -#define AES_CTR_ENC_TEST_VECTORS 3 -#define AES_CTR_DEC_TEST_VECTORS 3 -#define AES_OFB_ENC_TEST_VECTORS 1 -#define AES_OFB_DEC_TEST_VECTORS 1 -#define AES_CTR_3686_ENC_TEST_VECTORS 7 -#define AES_CTR_3686_DEC_TEST_VECTORS 6 -#define AES_GCM_ENC_TEST_VECTORS 9 -#define AES_GCM_DEC_TEST_VECTORS 8 -#define AES_GCM_4106_ENC_TEST_VECTORS 7 -#define AES_GCM_4106_DEC_TEST_VECTORS 7 -#define AES_CCM_ENC_TEST_VECTORS 7 -#define AES_CCM_DEC_TEST_VECTORS 7 -#define AES_CCM_4309_ENC_TEST_VECTORS 7 -#define AES_CCM_4309_DEC_TEST_VECTORS 10 - -static struct cipher_testvec aes_enc_tv_template[] = { - { /* From FIPS-197 */ - .key = "\x00\x01\x02\x03\x04\x05\x06\x07" - "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f", - .klen = 16, - .input = "\x00\x11\x22\x33\x44\x55\x66\x77" - "\x88\x99\xaa\xbb\xcc\xdd\xee\xff", - .ilen = 16, - .result = "\x69\xc4\xe0\xd8\x6a\x7b\x04\x30" - "\xd8\xcd\xb7\x80\x70\xb4\xc5\x5a", - .rlen = 16, - }, { - .key = "\x00\x01\x02\x03\x04\x05\x06\x07" - "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f" - "\x10\x11\x12\x13\x14\x15\x16\x17", - .klen = 24, - .input = "\x00\x11\x22\x33\x44\x55\x66\x77" - "\x88\x99\xaa\xbb\xcc\xdd\xee\xff", - .ilen = 16, - .result = "\xdd\xa9\x7c\xa4\x86\x4c\xdf\xe0" - "\x6e\xaf\x70\xa0\xec\x0d\x71\x91", - .rlen = 16, - }, { - .key = "\x00\x01\x02\x03\x04\x05\x06\x07" - "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f" - "\x10\x11\x12\x13\x14\x15\x16\x17" - "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f", - .klen = 32, - .input = "\x00\x11\x22\x33\x44\x55\x66\x77" - "\x88\x99\xaa\xbb\xcc\xdd\xee\xff", - .ilen = 16, - .result = "\x8e\xa2\xb7\xca\x51\x67\x45\xbf" - "\xea\xfc\x49\x90\x4b\x49\x60\x89", - .rlen = 16, - }, -}; - -static struct cipher_testvec aes_dec_tv_template[] = { - { /* From FIPS-197 */ - .key = "\x00\x01\x02\x03\x04\x05\x06\x07" - "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f", - .klen = 16, - .input = "\x69\xc4\xe0\xd8\x6a\x7b\x04\x30" - "\xd8\xcd\xb7\x80\x70\xb4\xc5\x5a", - .ilen = 16, - .result = "\x00\x11\x22\x33\x44\x55\x66\x77" - "\x88\x99\xaa\xbb\xcc\xdd\xee\xff", - .rlen = 16, - }, { - .key = "\x00\x01\x02\x03\x04\x05\x06\x07" - "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f" - "\x10\x11\x12\x13\x14\x15\x16\x17", - .klen = 24, - .input = "\xdd\xa9\x7c\xa4\x86\x4c\xdf\xe0" - "\x6e\xaf\x70\xa0\xec\x0d\x71\x91", - .ilen = 16, - .result = "\x00\x11\x22\x33\x44\x55\x66\x77" - "\x88\x99\xaa\xbb\xcc\xdd\xee\xff", - .rlen = 16, - }, { - .key = "\x00\x01\x02\x03\x04\x05\x06\x07" - "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f" - "\x10\x11\x12\x13\x14\x15\x16\x17" - "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f", - .klen = 32, - .input = "\x8e\xa2\xb7\xca\x51\x67\x45\xbf" - "\xea\xfc\x49\x90\x4b\x49\x60\x89", - .ilen = 16, - .result = "\x00\x11\x22\x33\x44\x55\x66\x77" - "\x88\x99\xaa\xbb\xcc\xdd\xee\xff", - .rlen = 16, - }, -}; - -static struct cipher_testvec aes_cbc_enc_tv_template[] = { - { /* From RFC 3602 */ - .key = "\x06\xa9\x21\x40\x36\xb8\xa1\x5b" - "\x51\x2e\x03\xd5\x34\x12\x00\x06", - .klen = 16, - .iv = "\x3d\xaf\xba\x42\x9d\x9e\xb4\x30" - "\xb4\x22\xda\x80\x2c\x9f\xac\x41", - .input = "Single block msg", - .ilen = 16, - .result = "\xe3\x53\x77\x9c\x10\x79\xae\xb8" - "\x27\x08\x94\x2d\xbe\x77\x18\x1a", - .rlen = 16, - }, { - .key = "\xc2\x86\x69\x6d\x88\x7c\x9a\xa0" - "\x61\x1b\xbb\x3e\x20\x25\xa4\x5a", - .klen = 16, - .iv = "\x56\x2e\x17\x99\x6d\x09\x3d\x28" - "\xdd\xb3\xba\x69\x5a\x2e\x6f\x58", - .input = "\x00\x01\x02\x03\x04\x05\x06\x07" - "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f" - "\x10\x11\x12\x13\x14\x15\x16\x17" - "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f", - .ilen = 32, - .result = "\xd2\x96\xcd\x94\xc2\xcc\xcf\x8a" - "\x3a\x86\x30\x28\xb5\xe1\xdc\x0a" - "\x75\x86\x60\x2d\x25\x3c\xff\xf9" - "\x1b\x82\x66\xbe\xa6\xd6\x1a\xb1", - .rlen = 32, - }, { /* From NIST SP800-38A */ - .key = "\x8e\x73\xb0\xf7\xda\x0e\x64\x52" - "\xc8\x10\xf3\x2b\x80\x90\x79\xe5" - "\x62\xf8\xea\xd2\x52\x2c\x6b\x7b", - .klen = 24, - .iv = "\x00\x01\x02\x03\x04\x05\x06\x07" - "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f", - .input = "\x6b\xc1\xbe\xe2\x2e\x40\x9f\x96" - "\xe9\x3d\x7e\x11\x73\x93\x17\x2a" - "\xae\x2d\x8a\x57\x1e\x03\xac\x9c" - "\x9e\xb7\x6f\xac\x45\xaf\x8e\x51" - "\x30\xc8\x1c\x46\xa3\x5c\xe4\x11" - "\xe5\xfb\xc1\x19\x1a\x0a\x52\xef" - "\xf6\x9f\x24\x45\xdf\x4f\x9b\x17" - "\xad\x2b\x41\x7b\xe6\x6c\x37\x10", - .ilen = 64, - .result = "\x4f\x02\x1d\xb2\x43\xbc\x63\x3d" - "\x71\x78\x18\x3a\x9f\xa0\x71\xe8" - "\xb4\xd9\xad\xa9\xad\x7d\xed\xf4" - "\xe5\xe7\x38\x76\x3f\x69\x14\x5a" - "\x57\x1b\x24\x20\x12\xfb\x7a\xe0" - "\x7f\xa9\xba\xac\x3d\xf1\x02\xe0" - "\x08\xb0\xe2\x79\x88\x59\x88\x81" - "\xd9\x20\xa9\xe6\x4f\x56\x15\xcd", - .rlen = 64, - }, { - .key = "\x60\x3d\xeb\x10\x15\xca\x71\xbe" - "\x2b\x73\xae\xf0\x85\x7d\x77\x81" - "\x1f\x35\x2c\x07\x3b\x61\x08\xd7" - "\x2d\x98\x10\xa3\x09\x14\xdf\xf4", - .klen = 32, - .iv = "\x00\x01\x02\x03\x04\x05\x06\x07" - "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f", - .input = "\x6b\xc1\xbe\xe2\x2e\x40\x9f\x96" - "\xe9\x3d\x7e\x11\x73\x93\x17\x2a" - "\xae\x2d\x8a\x57\x1e\x03\xac\x9c" - "\x9e\xb7\x6f\xac\x45\xaf\x8e\x51" - "\x30\xc8\x1c\x46\xa3\x5c\xe4\x11" - "\xe5\xfb\xc1\x19\x1a\x0a\x52\xef" - "\xf6\x9f\x24\x45\xdf\x4f\x9b\x17" - "\xad\x2b\x41\x7b\xe6\x6c\x37\x10", - .ilen = 64, - .result = "\xf5\x8c\x4c\x04\xd6\xe5\xf1\xba" - "\x77\x9e\xab\xfb\x5f\x7b\xfb\xd6" - "\x9c\xfc\x4e\x96\x7e\xdb\x80\x8d" - "\x67\x9f\x77\x7b\xc6\x70\x2c\x7d" - "\x39\xf2\x33\x69\xa9\xd9\xba\xcf" - "\xa5\x30\xe2\x63\x04\x23\x14\x61" - "\xb2\xeb\x05\xe2\xc3\x9b\xe9\xfc" - "\xda\x6c\x19\x07\x8c\x6a\x9d\x1b", - .rlen = 64, - }, -}; - -static struct cipher_testvec aes_cbc_dec_tv_template[] = { - { /* From RFC 3602 */ - .key = "\x06\xa9\x21\x40\x36\xb8\xa1\x5b" - "\x51\x2e\x03\xd5\x34\x12\x00\x06", - .klen = 16, - .iv = "\x3d\xaf\xba\x42\x9d\x9e\xb4\x30" - "\xb4\x22\xda\x80\x2c\x9f\xac\x41", - .input = "\xe3\x53\x77\x9c\x10\x79\xae\xb8" - "\x27\x08\x94\x2d\xbe\x77\x18\x1a", - .ilen = 16, - .result = "Single block msg", - .rlen = 16, - }, { - .key = "\xc2\x86\x69\x6d\x88\x7c\x9a\xa0" - "\x61\x1b\xbb\x3e\x20\x25\xa4\x5a", - .klen = 16, - .iv = "\x56\x2e\x17\x99\x6d\x09\x3d\x28" - "\xdd\xb3\xba\x69\x5a\x2e\x6f\x58", - .input = "\xd2\x96\xcd\x94\xc2\xcc\xcf\x8a" - "\x3a\x86\x30\x28\xb5\xe1\xdc\x0a" - "\x75\x86\x60\x2d\x25\x3c\xff\xf9" - "\x1b\x82\x66\xbe\xa6\xd6\x1a\xb1", - .ilen = 32, - .result = "\x00\x01\x02\x03\x04\x05\x06\x07" - "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f" - "\x10\x11\x12\x13\x14\x15\x16\x17" - "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f", - .rlen = 32, - }, { /* From NIST SP800-38A */ - .key = "\x8e\x73\xb0\xf7\xda\x0e\x64\x52" - "\xc8\x10\xf3\x2b\x80\x90\x79\xe5" - "\x62\xf8\xea\xd2\x52\x2c\x6b\x7b", - .klen = 24, - .iv = "\x00\x01\x02\x03\x04\x05\x06\x07" - "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f", - .input = "\x4f\x02\x1d\xb2\x43\xbc\x63\x3d" - "\x71\x78\x18\x3a\x9f\xa0\x71\xe8" - "\xb4\xd9\xad\xa9\xad\x7d\xed\xf4" - "\xe5\xe7\x38\x76\x3f\x69\x14\x5a" - "\x57\x1b\x24\x20\x12\xfb\x7a\xe0" - "\x7f\xa9\xba\xac\x3d\xf1\x02\xe0" - "\x08\xb0\xe2\x79\x88\x59\x88\x81" - "\xd9\x20\xa9\xe6\x4f\x56\x15\xcd", - .ilen = 64, - .result = "\x6b\xc1\xbe\xe2\x2e\x40\x9f\x96" - "\xe9\x3d\x7e\x11\x73\x93\x17\x2a" - "\xae\x2d\x8a\x57\x1e\x03\xac\x9c" - "\x9e\xb7\x6f\xac\x45\xaf\x8e\x51" - "\x30\xc8\x1c\x46\xa3\x5c\xe4\x11" - "\xe5\xfb\xc1\x19\x1a\x0a\x52\xef" - "\xf6\x9f\x24\x45\xdf\x4f\x9b\x17" - "\xad\x2b\x41\x7b\xe6\x6c\x37\x10", - .rlen = 64, - }, { - .key = "\x60\x3d\xeb\x10\x15\xca\x71\xbe" - "\x2b\x73\xae\xf0\x85\x7d\x77\x81" - "\x1f\x35\x2c\x07\x3b\x61\x08\xd7" - "\x2d\x98\x10\xa3\x09\x14\xdf\xf4", +static struct cipher_testvec aes_cbc_dec_tv_template[] = { + { /* From RFC 3602 */ + .key = "\x06\xa9\x21\x40\x36\xb8\xa1\x5b" + "\x51\x2e\x03\xd5\x34\x12\x00\x06", + .klen = 16, + .iv = "\x3d\xaf\xba\x42\x9d\x9e\xb4\x30" + "\xb4\x22\xda\x80\x2c\x9f\xac\x41", + .input = "\xe3\x53\x77\x9c\x10\x79\xae\xb8" + "\x27\x08\x94\x2d\xbe\x77\x18\x1a", + .ilen = 16, + .result = "Single block msg", + .rlen = 16, + }, { + .key = "\xc2\x86\x69\x6d\x88\x7c\x9a\xa0" + "\x61\x1b\xbb\x3e\x20\x25\xa4\x5a", + .klen = 16, + .iv = "\x56\x2e\x17\x99\x6d\x09\x3d\x28" + "\xdd\xb3\xba\x69\x5a\x2e\x6f\x58", + .input = "\xd2\x96\xcd\x94\xc2\xcc\xcf\x8a" + "\x3a\x86\x30\x28\xb5\xe1\xdc\x0a" + "\x75\x86\x60\x2d\x25\x3c\xff\xf9" + "\x1b\x82\x66\xbe\xa6\xd6\x1a\xb1", + .ilen = 32, + .result = "\x00\x01\x02\x03\x04\x05\x06\x07" + "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f" + "\x10\x11\x12\x13\x14\x15\x16\x17" + "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f", + .rlen = 32, + }, { /* From NIST SP800-38A */ + .key = "\x8e\x73\xb0\xf7\xda\x0e\x64\x52" + "\xc8\x10\xf3\x2b\x80\x90\x79\xe5" + "\x62\xf8\xea\xd2\x52\x2c\x6b\x7b", + .klen = 24, + .iv = "\x00\x01\x02\x03\x04\x05\x06\x07" + "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f", + .input = "\x4f\x02\x1d\xb2\x43\xbc\x63\x3d" + "\x71\x78\x18\x3a\x9f\xa0\x71\xe8" + "\xb4\xd9\xad\xa9\xad\x7d\xed\xf4" + "\xe5\xe7\x38\x76\x3f\x69\x14\x5a" + "\x57\x1b\x24\x20\x12\xfb\x7a\xe0" + "\x7f\xa9\xba\xac\x3d\xf1\x02\xe0" + "\x08\xb0\xe2\x79\x88\x59\x88\x81" + "\xd9\x20\xa9\xe6\x4f\x56\x15\xcd", + .ilen = 64, + .result = "\x6b\xc1\xbe\xe2\x2e\x40\x9f\x96" + "\xe9\x3d\x7e\x11\x73\x93\x17\x2a" + "\xae\x2d\x8a\x57\x1e\x03\xac\x9c" + "\x9e\xb7\x6f\xac\x45\xaf\x8e\x51" + "\x30\xc8\x1c\x46\xa3\x5c\xe4\x11" + "\xe5\xfb\xc1\x19\x1a\x0a\x52\xef" + "\xf6\x9f\x24\x45\xdf\x4f\x9b\x17" + "\xad\x2b\x41\x7b\xe6\x6c\x37\x10", + .rlen = 64, + }, { + .key = "\x60\x3d\xeb\x10\x15\xca\x71\xbe" + "\x2b\x73\xae\xf0\x85\x7d\x77\x81" + "\x1f\x35\x2c\x07\x3b\x61\x08\xd7" + "\x2d\x98\x10\xa3\x09\x14\xdf\xf4", .klen = 32, .iv = "\x00\x01\x02\x03\x04\x05\x06\x07" "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f", @@ -10668,9 +8313,6 @@ static struct cipher_testvec aes_lrw_enc_tv_template[] = { "\xcd\x7e\x2b\x5d\x43\xea\x42\xe7" "\x74\x3f\x7d\x58\x88\x75\xde\x3e", .rlen = 512, - .also_non_np = 1, - .np = 2, - .tap = { 512 - 16, 16 }, } }; @@ -10922,9 +8564,6 @@ static struct cipher_testvec aes_lrw_dec_tv_template[] = { "\xe9\x2e\xc4\x29\x0f\x84\xdb\xc4" "\x21\xc4\xc2\x75\x67\x89\x37\x0a", .rlen = 512, - .also_non_np = 1, - .np = 2, - .tap = { 512 - 16, 16 }, } }; @@ -11266,9 +8905,6 @@ static struct cipher_testvec aes_xts_enc_tv_template[] = { "\xc4\xf3\x6f\xfd\xa9\xfc\xea\x70" "\xb9\xc6\xe6\x93\xe1\x48\xc1\x51", .rlen = 512, - .also_non_np = 1, - .np = 2, - .tap = { 512 - 16, 16 }, } }; @@ -11610,9 +9246,7 @@ static struct cipher_testvec aes_xts_dec_tv_template[] = { "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7" "\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff", .rlen = 512, - .also_non_np = 1, - .np = 2, - .tap = { 512 - 16, 16 }, + } }; @@ -13790,1611 +11424,761 @@ static struct aead_testvec aes_ccm_enc_tv_template[] = { .key = "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7" "\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf", .klen = 16, - .iv = "\x01\x00\x00\x00\x07\x06\x05\x04" - "\xa0\xa1\xa2\xa3\xa4\xa5\x00\x00", - .assoc = "\x00\x01\x02\x03\x04\x05\x06\x07" - "\x08\x09\x0a\x0b", - .alen = 12, - .input = "\x0c\x0d\x0e\x0f\x10\x11\x12\x13" - "\x14\x15\x16\x17\x18\x19\x1a\x1b" - "\x1c\x1d\x1e\x1f", - .ilen = 20, - .result = "\xdc\xf1\xfb\x7b\x5d\x9e\x23\xfb" - "\x9d\x4e\x13\x12\x53\x65\x8a\xd8" - "\x6e\xbd\xca\x3e\x51\xe8\x3f\x07" - "\x7d\x9c\x2d\x93", - .rlen = 28, - }, { - .key = "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7" - "\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf", - .klen = 16, - .iv = "\x01\x00\x00\x00\x0b\x0a\x09\x08" - "\xa0\xa1\xa2\xa3\xa4\xa5\x00\x00", - .assoc = "\x00\x01\x02\x03\x04\x05\x06\x07", - .alen = 8, - .input = "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f" - "\x10\x11\x12\x13\x14\x15\x16\x17" - "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f" - "\x20", - .ilen = 25, - .result = "\x82\x53\x1a\x60\xcc\x24\x94\x5a" - "\x4b\x82\x79\x18\x1a\xb5\xc8\x4d" - "\xf2\x1c\xe7\xf9\xb7\x3f\x42\xe1" - "\x97\xea\x9c\x07\xe5\x6b\x5e\xb1" - "\x7e\x5f\x4e", - .rlen = 35, - }, { - .key = "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7" - "\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf", - .klen = 16, - .iv = "\x01\x00\x00\x00\x0c\x0b\x0a\x09" - "\xa0\xa1\xa2\xa3\xa4\xa5\x00\x00", - .assoc = "\x00\x01\x02\x03\x04\x05\x06\x07" - "\x08\x09\x0a\x0b", - .alen = 12, - .input = "\x0c\x0d\x0e\x0f\x10\x11\x12\x13" - "\x14\x15\x16\x17\x18\x19\x1a\x1b" - "\x1c\x1d\x1e", - .ilen = 19, - .result = "\x07\x34\x25\x94\x15\x77\x85\x15" - "\x2b\x07\x40\x98\x33\x0a\xbb\x14" - "\x1b\x94\x7b\x56\x6a\xa9\x40\x6b" - "\x4d\x99\x99\x88\xdd", - .rlen = 29, - }, { - .key = "\xd7\x82\x8d\x13\xb2\xb0\xbd\xc3" - "\x25\xa7\x62\x36\xdf\x93\xcc\x6b", - .klen = 16, - .iv = "\x01\x00\x33\x56\x8e\xf7\xb2\x63" - "\x3c\x96\x96\x76\x6c\xfa\x00\x00", - .assoc = "\x63\x01\x8f\x76\xdc\x8a\x1b\xcb", - .alen = 8, - .input = "\x90\x20\xea\x6f\x91\xbd\xd8\x5a" - "\xfa\x00\x39\xba\x4b\xaf\xf9\xbf" - "\xb7\x9c\x70\x28\x94\x9c\xd0\xec", - .ilen = 24, - .result = "\x4c\xcb\x1e\x7c\xa9\x81\xbe\xfa" - "\xa0\x72\x6c\x55\xd3\x78\x06\x12" - "\x98\xc8\x5c\x92\x81\x4a\xbc\x33" - "\xc5\x2e\xe8\x1d\x7d\x77\xc0\x8a", - .rlen = 32, - }, { - .key = "\xd7\x82\x8d\x13\xb2\xb0\xbd\xc3" - "\x25\xa7\x62\x36\xdf\x93\xcc\x6b", - .klen = 16, - .iv = "\x01\x00\xd5\x60\x91\x2d\x3f\x70" - "\x3c\x96\x96\x76\x6c\xfa\x00\x00", - .assoc = "\xcd\x90\x44\xd2\xb7\x1f\xdb\x81" - "\x20\xea\x60\xc0", - .alen = 12, - .input = "\x64\x35\xac\xba\xfb\x11\xa8\x2e" - "\x2f\x07\x1d\x7c\xa4\xa5\xeb\xd9" - "\x3a\x80\x3b\xa8\x7f", - .ilen = 21, - .result = "\x00\x97\x69\xec\xab\xdf\x48\x62" - "\x55\x94\xc5\x92\x51\xe6\x03\x57" - "\x22\x67\x5e\x04\xc8\x47\x09\x9e" - "\x5a\xe0\x70\x45\x51", - .rlen = 29, - }, { - .key = "\xd7\x82\x8d\x13\xb2\xb0\xbd\xc3" - "\x25\xa7\x62\x36\xdf\x93\xcc\x6b", - .klen = 16, - .iv = "\x01\x00\x42\xff\xf8\xf1\x95\x1c" - "\x3c\x96\x96\x76\x6c\xfa\x00\x00", - .assoc = "\xd8\x5b\xc7\xe6\x9f\x94\x4f\xb8", - .alen = 8, - .input = "\x8a\x19\xb9\x50\xbc\xf7\x1a\x01" - "\x8e\x5e\x67\x01\xc9\x17\x87\x65" - "\x98\x09\xd6\x7d\xbe\xdd\x18", - .ilen = 23, - .result = "\xbc\x21\x8d\xaa\x94\x74\x27\xb6" - "\xdb\x38\x6a\x99\xac\x1a\xef\x23" - "\xad\xe0\xb5\x29\x39\xcb\x6a\x63" - "\x7c\xf9\xbe\xc2\x40\x88\x97\xc6" - "\xba", - .rlen = 33, - }, -}; - -static struct aead_testvec aes_ccm_dec_tv_template[] = { - { /* From RFC 3610 */ - .key = "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7" - "\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf", - .klen = 16, - .iv = "\x01\x00\x00\x00\x03\x02\x01\x00" - "\xa0\xa1\xa2\xa3\xa4\xa5\x00\x00", - .assoc = "\x00\x01\x02\x03\x04\x05\x06\x07", - .alen = 8, - .input = "\x58\x8c\x97\x9a\x61\xc6\x63\xd2" - "\xf0\x66\xd0\xc2\xc0\xf9\x89\x80" - "\x6d\x5f\x6b\x61\xda\xc3\x84\x17" - "\xe8\xd1\x2c\xfd\xf9\x26\xe0", - .ilen = 31, - .result = "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f" - "\x10\x11\x12\x13\x14\x15\x16\x17" - "\x18\x19\x1a\x1b\x1c\x1d\x1e", - .rlen = 23, - }, { - .key = "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7" - "\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf", - .klen = 16, - .iv = "\x01\x00\x00\x00\x07\x06\x05\x04" - "\xa0\xa1\xa2\xa3\xa4\xa5\x00\x00", - .assoc = "\x00\x01\x02\x03\x04\x05\x06\x07" - "\x08\x09\x0a\x0b", - .alen = 12, - .input = "\xdc\xf1\xfb\x7b\x5d\x9e\x23\xfb" - "\x9d\x4e\x13\x12\x53\x65\x8a\xd8" - "\x6e\xbd\xca\x3e\x51\xe8\x3f\x07" - "\x7d\x9c\x2d\x93", - .ilen = 28, - .result = "\x0c\x0d\x0e\x0f\x10\x11\x12\x13" - "\x14\x15\x16\x17\x18\x19\x1a\x1b" - "\x1c\x1d\x1e\x1f", - .rlen = 20, - }, { - .key = "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7" - "\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf", - .klen = 16, - .iv = "\x01\x00\x00\x00\x0b\x0a\x09\x08" - "\xa0\xa1\xa2\xa3\xa4\xa5\x00\x00", - .assoc = "\x00\x01\x02\x03\x04\x05\x06\x07", - .alen = 8, - .input = "\x82\x53\x1a\x60\xcc\x24\x94\x5a" - "\x4b\x82\x79\x18\x1a\xb5\xc8\x4d" - "\xf2\x1c\xe7\xf9\xb7\x3f\x42\xe1" - "\x97\xea\x9c\x07\xe5\x6b\x5e\xb1" - "\x7e\x5f\x4e", - .ilen = 35, - .result = "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f" - "\x10\x11\x12\x13\x14\x15\x16\x17" - "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f" - "\x20", - .rlen = 25, - }, { - .key = "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7" - "\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf", - .klen = 16, - .iv = "\x01\x00\x00\x00\x0c\x0b\x0a\x09" - "\xa0\xa1\xa2\xa3\xa4\xa5\x00\x00", - .assoc = "\x00\x01\x02\x03\x04\x05\x06\x07" - "\x08\x09\x0a\x0b", - .alen = 12, - .input = "\x07\x34\x25\x94\x15\x77\x85\x15" - "\x2b\x07\x40\x98\x33\x0a\xbb\x14" - "\x1b\x94\x7b\x56\x6a\xa9\x40\x6b" - "\x4d\x99\x99\x88\xdd", - .ilen = 29, - .result = "\x0c\x0d\x0e\x0f\x10\x11\x12\x13" - "\x14\x15\x16\x17\x18\x19\x1a\x1b" - "\x1c\x1d\x1e", - .rlen = 19, - }, { - .key = "\xd7\x82\x8d\x13\xb2\xb0\xbd\xc3" - "\x25\xa7\x62\x36\xdf\x93\xcc\x6b", - .klen = 16, - .iv = "\x01\x00\x33\x56\x8e\xf7\xb2\x63" - "\x3c\x96\x96\x76\x6c\xfa\x00\x00", - .assoc = "\x63\x01\x8f\x76\xdc\x8a\x1b\xcb", - .alen = 8, - .input = "\x4c\xcb\x1e\x7c\xa9\x81\xbe\xfa" - "\xa0\x72\x6c\x55\xd3\x78\x06\x12" - "\x98\xc8\x5c\x92\x81\x4a\xbc\x33" - "\xc5\x2e\xe8\x1d\x7d\x77\xc0\x8a", - .ilen = 32, - .result = "\x90\x20\xea\x6f\x91\xbd\xd8\x5a" - "\xfa\x00\x39\xba\x4b\xaf\xf9\xbf" - "\xb7\x9c\x70\x28\x94\x9c\xd0\xec", - .rlen = 24, - }, { - .key = "\xd7\x82\x8d\x13\xb2\xb0\xbd\xc3" - "\x25\xa7\x62\x36\xdf\x93\xcc\x6b", - .klen = 16, - .iv = "\x01\x00\xd5\x60\x91\x2d\x3f\x70" - "\x3c\x96\x96\x76\x6c\xfa\x00\x00", - .assoc = "\xcd\x90\x44\xd2\xb7\x1f\xdb\x81" - "\x20\xea\x60\xc0", + .iv = "\x01\x00\x00\x00\x07\x06\x05\x04" + "\xa0\xa1\xa2\xa3\xa4\xa5\x00\x00", + .assoc = "\x00\x01\x02\x03\x04\x05\x06\x07" + "\x08\x09\x0a\x0b", .alen = 12, - .input = "\x00\x97\x69\xec\xab\xdf\x48\x62" - "\x55\x94\xc5\x92\x51\xe6\x03\x57" - "\x22\x67\x5e\x04\xc8\x47\x09\x9e" - "\x5a\xe0\x70\x45\x51", - .ilen = 29, - .result = "\x64\x35\xac\xba\xfb\x11\xa8\x2e" - "\x2f\x07\x1d\x7c\xa4\xa5\xeb\xd9" - "\x3a\x80\x3b\xa8\x7f", - .rlen = 21, + .input = "\x0c\x0d\x0e\x0f\x10\x11\x12\x13" + "\x14\x15\x16\x17\x18\x19\x1a\x1b" + "\x1c\x1d\x1e\x1f", + .ilen = 20, + .result = "\xdc\xf1\xfb\x7b\x5d\x9e\x23\xfb" + "\x9d\x4e\x13\x12\x53\x65\x8a\xd8" + "\x6e\xbd\xca\x3e\x51\xe8\x3f\x07" + "\x7d\x9c\x2d\x93", + .rlen = 28, }, { - .key = "\xd7\x82\x8d\x13\xb2\xb0\xbd\xc3" - "\x25\xa7\x62\x36\xdf\x93\xcc\x6b", + .key = "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7" + "\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf", .klen = 16, - .iv = "\x01\x00\x42\xff\xf8\xf1\x95\x1c" - "\x3c\x96\x96\x76\x6c\xfa\x00\x00", - .assoc = "\xd8\x5b\xc7\xe6\x9f\x94\x4f\xb8", + .iv = "\x01\x00\x00\x00\x0b\x0a\x09\x08" + "\xa0\xa1\xa2\xa3\xa4\xa5\x00\x00", + .assoc = "\x00\x01\x02\x03\x04\x05\x06\x07", .alen = 8, - .input = "\xbc\x21\x8d\xaa\x94\x74\x27\xb6" - "\xdb\x38\x6a\x99\xac\x1a\xef\x23" - "\xad\xe0\xb5\x29\x39\xcb\x6a\x63" - "\x7c\xf9\xbe\xc2\x40\x88\x97\xc6" - "\xba", - .ilen = 33, - .result = "\x8a\x19\xb9\x50\xbc\xf7\x1a\x01" - "\x8e\x5e\x67\x01\xc9\x17\x87\x65" - "\x98\x09\xd6\x7d\xbe\xdd\x18", - .rlen = 23, - }, -}; - -/* - * rfc4309 refers to section 8 of rfc3610 for test vectors, but they all - * use a 13-byte nonce, we only support an 11-byte nonce. Similarly, all of - * Special Publication 800-38C's test vectors also use nonce lengths our - * implementation doesn't support. The following are taken from fips cavs - * fax files on hand at Red Hat. - * - * nb: actual key lengths are (klen - 3), the last 3 bytes are actually - * part of the nonce which combine w/the iv, but need to be input this way. - */ -static struct aead_testvec aes_ccm_rfc4309_enc_tv_template[] = { - { - .key = "\x83\xac\x54\x66\xc2\xeb\xe5\x05" - "\x2e\x01\xd1\xfc\x5d\x82\x66\x2e" - "\x96\xac\x59", - .klen = 19, - .iv = "\x30\x07\xa1\xe2\xa2\xc7\x55\x24", - .alen = 0, - .input = "\x19\xc8\x81\xf6\xe9\x86\xff\x93" - "\x0b\x78\x67\xe5\xbb\xb7\xfc\x6e" - "\x83\x77\xb3\xa6\x0c\x8c\x9f\x9c" - "\x35\x2e\xad\xe0\x62\xf9\x91\xa1", - .ilen = 32, - .result = "\xab\x6f\xe1\x69\x1d\x19\x99\xa8" - "\x92\xa0\xc4\x6f\x7e\xe2\x8b\xb1" - "\x70\xbb\x8c\xa6\x4c\x6e\x97\x8a" - "\x57\x2b\xbe\x5d\x98\xa6\xb1\x32" - "\xda\x24\xea\xd9\xa1\x39\x98\xfd" - "\xa4\xbe\xd9\xf2\x1a\x6d\x22\xa8", - .rlen = 48, - }, { - .key = "\x1e\x2c\x7e\x01\x41\x9a\xef\xc0" - "\x0d\x58\x96\x6e\x5c\xa2\x4b\xd3" - "\x4f\xa3\x19", - .klen = 19, - .iv = "\xd3\x01\x5a\xd8\x30\x60\x15\x56", - .assoc = "\xda\xe6\x28\x9c\x45\x2d\xfd\x63" - "\x5e\xda\x4c\xb6\xe6\xfc\xf9\xb7" - "\x0c\x56\xcb\xe4\xe0\x05\x7a\xe1" - "\x0a\x63\x09\x78\xbc\x2c\x55\xde", - .alen = 32, - .input = "\x87\xa3\x36\xfd\x96\xb3\x93\x78" - "\xa9\x28\x63\xba\x12\xa3\x14\x85" - "\x57\x1e\x06\xc9\x7b\x21\xef\x76" - "\x7f\x38\x7e\x8e\x29\xa4\x3e\x7e", - .ilen = 32, - .result = "\x8a\x1e\x11\xf0\x02\x6b\xe2\x19" - "\xfc\x70\xc4\x6d\x8e\xb7\x99\xab" - "\xc5\x4b\xa2\xac\xd3\xf3\x48\xff" - "\x3b\xb5\xce\x53\xef\xde\xbb\x02" - "\xa9\x86\x15\x6c\x13\xfe\xda\x0a" - "\x22\xb8\x29\x3d\xd8\x39\x9a\x23", - .rlen = 48, - }, { - .key = "\xf4\x6b\xc2\x75\x62\xfe\xb4\xe1" - "\xa3\xf0\xff\xdd\x4e\x4b\x12\x75" - "\x53\x14\x73\x66\x8d\x88\xf6\x80" - "\xa0\x20\x35", - .klen = 27, - .iv = "\x26\xf2\x21\x8d\x50\x20\xda\xe2", - .assoc = "\x5b\x9e\x13\x67\x02\x5e\xef\xc1" - "\x6c\xf9\xd7\x1e\x52\x8f\x7a\x47" - "\xe9\xd4\xcf\x20\x14\x6e\xf0\x2d" - "\xd8\x9e\x2b\x56\x10\x23\x56\xe7", - .alen = 32, - .ilen = 0, - .result = "\x36\xea\x7a\x70\x08\xdc\x6a\xbc" - "\xad\x0c\x7a\x63\xf6\x61\xfd\x9b", - .rlen = 16, - }, { - .key = "\x56\xdf\x5c\x8f\x26\x3f\x0e\x42" - "\xef\x7a\xd3\xce\xfc\x84\x60\x62" - "\xca\xb4\x40\xaf\x5f\xc9\xc9\x01" - "\xd6\x3c\x8c", - .klen = 27, - .iv = "\x86\x84\xb6\xcd\xef\x09\x2e\x94", - .assoc = "\x02\x65\x78\x3c\xe9\x21\x30\x91" - "\xb1\xb9\xda\x76\x9a\x78\x6d\x95" - "\xf2\x88\x32\xa3\xf2\x50\xcb\x4c" - "\xe3\x00\x73\x69\x84\x69\x87\x79", - .alen = 32, - .input = "\x9f\xd2\x02\x4b\x52\x49\x31\x3c" - "\x43\x69\x3a\x2d\x8e\x70\xad\x7e" - "\xe0\xe5\x46\x09\x80\x89\x13\xb2" - "\x8c\x8b\xd9\x3f\x86\xfb\xb5\x6b", - .ilen = 32, - .result = "\x39\xdf\x7c\x3c\x5a\x29\xb9\x62" - "\x5d\x51\xc2\x16\xd8\xbd\x06\x9f" - "\x9b\x6a\x09\x70\xc1\x51\x83\xc2" - "\x66\x88\x1d\x4f\x9a\xda\xe0\x1e" - "\xc7\x79\x11\x58\xe5\x6b\x20\x40" - "\x7a\xea\x46\x42\x8b\xe4\x6f\xe1", - .rlen = 48, - }, { - .key = "\xe0\x8d\x99\x71\x60\xd7\x97\x1a" - "\xbd\x01\x99\xd5\x8a\xdf\x71\x3a" - "\xd3\xdf\x24\x4b\x5e\x3d\x4b\x4e" - "\x30\x7a\xb9\xd8\x53\x0a\x5e\x2b" - "\x1e\x29\x91", - .klen = 35, - .iv = "\xad\x8e\xc1\x53\x0a\xcf\x2d\xbe", - .assoc = "\x19\xb6\x1f\x57\xc4\xf3\xf0\x8b" - "\x78\x2b\x94\x02\x29\x0f\x42\x27" - "\x6b\x75\xcb\x98\x34\x08\x7e\x79" - "\xe4\x3e\x49\x0d\x84\x8b\x22\x87", - .alen = 32, - .input = "\xe1\xd9\xd8\x13\xeb\x3a\x75\x3f" - "\x9d\xbd\x5f\x66\xbe\xdc\xbb\x66" - "\xbf\x17\x99\x62\x4a\x39\x27\x1f" - "\x1d\xdc\x24\xae\x19\x2f\x98\x4c", - .ilen = 32, - .result = "\x19\xb8\x61\x33\x45\x2b\x43\x96" - "\x6f\x51\xd0\x20\x30\x7d\x9b\xc6" - "\x26\x3d\xf8\xc9\x65\x16\xa8\x9f" - "\xf0\x62\x17\x34\xf2\x1e\x8d\x75" - "\x4e\x13\xcc\xc0\xc3\x2a\x54\x2d", - .rlen = 40, - }, { - .key = "\x7c\xc8\x18\x3b\x8d\x99\xe0\x7c" - "\x45\x41\xb8\xbd\x5c\xa7\xc2\x32" - "\x8a\xb8\x02\x59\xa4\xfe\xa9\x2c" - "\x09\x75\x9a\x9b\x3c\x9b\x27\x39" - "\xf9\xd9\x4e", - .klen = 35, - .iv = "\x63\xb5\x3d\x9d\x43\xf6\x1e\x50", - .assoc = "\x57\xf5\x6b\x8b\x57\x5c\x3d\x3b" - "\x13\x02\x01\x0c\x83\x4c\x96\x35" - "\x8e\xd6\x39\xcf\x7d\x14\x9b\x94" - "\xb0\x39\x36\xe6\x8f\x57\xe0\x13", - .alen = 32, - .input = "\x3b\x6c\x29\x36\xb6\xef\x07\xa6" - "\x83\x72\x07\x4f\xcf\xfa\x66\x89" - "\x5f\xca\xb1\xba\xd5\x8f\x2c\x27" - "\x30\xdb\x75\x09\x93\xd4\x65\xe4", - .ilen = 32, - .result = "\xb0\x88\x5a\x33\xaa\xe5\xc7\x1d" - "\x85\x23\xc7\xc6\x2f\xf4\x1e\x3d" - "\xcc\x63\x44\x25\x07\x78\x4f\x9e" - "\x96\xb8\x88\xeb\xbc\x48\x1f\x06" - "\x39\xaf\x39\xac\xd8\x4a\x80\x39" - "\x7b\x72\x8a\xf7", - .rlen = 44, - }, { - .key = "\xab\xd0\xe9\x33\x07\x26\xe5\x83" - "\x8c\x76\x95\xd4\xb6\xdc\xf3\x46" - "\xf9\x8f\xad\xe3\x02\x13\x83\x77" - "\x3f\xb0\xf1\xa1\xa1\x22\x0f\x2b" - "\x24\xa7\x8b", - .klen = 35, - .iv = "\x07\xcb\xcc\x0e\xe6\x33\xbf\xf5", - .assoc = "\xd4\xdb\x30\x1d\x03\xfe\xfd\x5f" - "\x87\xd4\x8c\xb6\xb6\xf1\x7a\x5d" - "\xab\x90\x65\x8d\x8e\xca\x4d\x4f" - "\x16\x0c\x40\x90\x4b\xc7\x36\x73", - .alen = 32, - .input = "\xf5\xc6\x7d\x48\xc1\xb7\xe6\x92" - "\x97\x5a\xca\xc4\xa9\x6d\xf9\x3d" - "\x6c\xde\xbc\xf1\x90\xea\x6a\xb2" - "\x35\x86\x36\xaf\x5c\xfe\x4b\x3a", - .ilen = 32, - .result = "\x83\x6f\x40\x87\x72\xcf\xc1\x13" - "\xef\xbb\x80\x21\x04\x6c\x58\x09" - "\x07\x1b\xfc\xdf\xc0\x3f\x5b\xc7" - "\xe0\x79\xa8\x6e\x71\x7c\x3f\xcf" - "\x5c\xda\xb2\x33\xe5\x13\xe2\x0d" - "\x74\xd1\xef\xb5\x0f\x3a\xb5\xf8", - .rlen = 48, - }, -}; - -static struct aead_testvec aes_ccm_rfc4309_dec_tv_template[] = { - { - .key = "\xab\x2f\x8a\x74\xb7\x1c\xd2\xb1" - "\xff\x80\x2e\x48\x7d\x82\xf8\xb9" - "\xc6\xfb\x7d", - .klen = 19, - .iv = "\x80\x0d\x13\xab\xd8\xa6\xb2\xd8", - .alen = 0, - .input = "\xd5\xe8\x93\x9f\xc7\x89\x2e\x2b", - .ilen = 8, - .result = "\x00", - .rlen = 0, - .novrfy = 1, + .input = "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f" + "\x10\x11\x12\x13\x14\x15\x16\x17" + "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f" + "\x20", + .ilen = 25, + .result = "\x82\x53\x1a\x60\xcc\x24\x94\x5a" + "\x4b\x82\x79\x18\x1a\xb5\xc8\x4d" + "\xf2\x1c\xe7\xf9\xb7\x3f\x42\xe1" + "\x97\xea\x9c\x07\xe5\x6b\x5e\xb1" + "\x7e\x5f\x4e", + .rlen = 35, }, { - .key = "\xab\x2f\x8a\x74\xb7\x1c\xd2\xb1" - "\xff\x80\x2e\x48\x7d\x82\xf8\xb9" - "\xaf\x94\x87", - .klen = 19, - .iv = "\x78\x35\x82\x81\x7f\x88\x94\x68", - .alen = 0, - .input = "\x41\x3c\xb8\x87\x73\xcb\xf3\xf3", - .ilen = 8, - .result = "\x00", - .rlen = 0, + .key = "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7" + "\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf", + .klen = 16, + .iv = "\x01\x00\x00\x00\x0c\x0b\x0a\x09" + "\xa0\xa1\xa2\xa3\xa4\xa5\x00\x00", + .assoc = "\x00\x01\x02\x03\x04\x05\x06\x07" + "\x08\x09\x0a\x0b", + .alen = 12, + .input = "\x0c\x0d\x0e\x0f\x10\x11\x12\x13" + "\x14\x15\x16\x17\x18\x19\x1a\x1b" + "\x1c\x1d\x1e", + .ilen = 19, + .result = "\x07\x34\x25\x94\x15\x77\x85\x15" + "\x2b\x07\x40\x98\x33\x0a\xbb\x14" + "\x1b\x94\x7b\x56\x6a\xa9\x40\x6b" + "\x4d\x99\x99\x88\xdd", + .rlen = 29, }, { - .key = "\x61\x0e\x8c\xae\xe3\x23\xb6\x38" - "\x76\x1c\xf6\x3a\x67\xa3\x9c\xd8" - "\xc6\xfb\x7d", - .klen = 19, - .iv = "\x80\x0d\x13\xab\xd8\xa6\xb2\xd8", - .assoc = "\xf3\x94\x87\x78\x35\x82\x81\x7f" - "\x88\x94\x68\xb1\x78\x6b\x2b\xd6" - "\x04\x1f\x4e\xed\x78\xd5\x33\x66" - "\xd8\x94\x99\x91\x81\x54\x62\x57", - .alen = 32, - .input = "\xf0\x7c\x29\x02\xae\x1c\x2f\x55" - "\xd0\xd1\x3d\x1a\xa3\x6d\xe4\x0a" - "\x86\xb0\x87\x6b\x62\x33\x8c\x34" - "\xce\xab\x57\xcc\x79\x0b\xe0\x6f" - "\x5c\x3e\x48\x1f\x6c\x46\xf7\x51" - "\x8b\x84\x83\x2a\xc1\x05\xb8\xc5", - .ilen = 48, - .result = "\x50\x82\x3e\x07\xe2\x1e\xb6\xfb" - "\x33\xe4\x73\xce\xd2\xfb\x95\x79" - "\xe8\xb4\xb5\x77\x11\x10\x62\x6f" - "\x6a\x82\xd1\x13\xec\xf5\xd0\x48", + .key = "\xd7\x82\x8d\x13\xb2\xb0\xbd\xc3" + "\x25\xa7\x62\x36\xdf\x93\xcc\x6b", + .klen = 16, + .iv = "\x01\x00\x33\x56\x8e\xf7\xb2\x63" + "\x3c\x96\x96\x76\x6c\xfa\x00\x00", + .assoc = "\x63\x01\x8f\x76\xdc\x8a\x1b\xcb", + .alen = 8, + .input = "\x90\x20\xea\x6f\x91\xbd\xd8\x5a" + "\xfa\x00\x39\xba\x4b\xaf\xf9\xbf" + "\xb7\x9c\x70\x28\x94\x9c\xd0\xec", + .ilen = 24, + .result = "\x4c\xcb\x1e\x7c\xa9\x81\xbe\xfa" + "\xa0\x72\x6c\x55\xd3\x78\x06\x12" + "\x98\xc8\x5c\x92\x81\x4a\xbc\x33" + "\xc5\x2e\xe8\x1d\x7d\x77\xc0\x8a", .rlen = 32, - .novrfy = 1, }, { - .key = "\x61\x0e\x8c\xae\xe3\x23\xb6\x38" - "\x76\x1c\xf6\x3a\x67\xa3\x9c\xd8" - "\x05\xe0\xc9", - .klen = 19, - .iv = "\x0f\xed\x34\xea\x97\xd4\x3b\xdf", - .assoc = "\x49\x5c\x50\x1f\x1d\x94\xcc\x81" - "\xba\xb7\xb6\x03\xaf\xa5\xc1\xa1" - "\xd8\x5c\x42\x68\xe0\x6c\xda\x89" - "\x05\xac\x56\xac\x1b\x2a\xd3\x86", - .alen = 32, - .input = "\x39\xbe\x7d\x15\x62\x77\xf3\x3c" - "\xad\x83\x52\x6d\x71\x03\x25\x1c" - "\xed\x81\x3a\x9a\x16\x7d\x19\x80" - "\x72\x04\x72\xd0\xf6\xff\x05\x0f" - "\xb7\x14\x30\x00\x32\x9e\xa0\xa6" - "\x9e\x5a\x18\xa1\xb8\xfe\xdb\xd3", - .ilen = 48, - .result = "\x75\x05\xbe\xc2\xd9\x1e\xde\x60" - "\x47\x3d\x8c\x7d\xbd\xb5\xd9\xb7" - "\xf2\xae\x61\x05\x8f\x82\x24\x3f" - "\x9c\x67\x91\xe1\x38\x4f\xe4\x0c", - .rlen = 32, + .key = "\xd7\x82\x8d\x13\xb2\xb0\xbd\xc3" + "\x25\xa7\x62\x36\xdf\x93\xcc\x6b", + .klen = 16, + .iv = "\x01\x00\xd5\x60\x91\x2d\x3f\x70" + "\x3c\x96\x96\x76\x6c\xfa\x00\x00", + .assoc = "\xcd\x90\x44\xd2\xb7\x1f\xdb\x81" + "\x20\xea\x60\xc0", + .alen = 12, + .input = "\x64\x35\xac\xba\xfb\x11\xa8\x2e" + "\x2f\x07\x1d\x7c\xa4\xa5\xeb\xd9" + "\x3a\x80\x3b\xa8\x7f", + .ilen = 21, + .result = "\x00\x97\x69\xec\xab\xdf\x48\x62" + "\x55\x94\xc5\x92\x51\xe6\x03\x57" + "\x22\x67\x5e\x04\xc8\x47\x09\x9e" + "\x5a\xe0\x70\x45\x51", + .rlen = 29, }, { - .key = "\x39\xbb\xa7\xbe\x59\x97\x9e\x73" - "\xa2\xbc\x6b\x98\xd7\x75\x7f\xe3" - "\xa4\x48\x93\x39\x26\x71\x4a\xc6" - "\xee\x49\x83", - .klen = 27, - .iv = "\xe9\xa9\xff\xe9\x57\xba\xfd\x9e", - .assoc = "\x44\xa6\x2c\x05\xe9\xe1\x43\xb1" - "\x58\x7c\xf2\x5c\x6d\x39\x0a\x64" - "\xa4\xf0\x13\x05\xd1\x77\x99\x67" - "\x11\xc4\xc6\xdb\x00\x56\x36\x61", - .alen = 32, - .input = "\x71\x99\xfa\xf4\x44\x12\x68\x9b", - .ilen = 8, - .result = "\x00", - .rlen = 0, + .key = "\xd7\x82\x8d\x13\xb2\xb0\xbd\xc3" + "\x25\xa7\x62\x36\xdf\x93\xcc\x6b", + .klen = 16, + .iv = "\x01\x00\x42\xff\xf8\xf1\x95\x1c" + "\x3c\x96\x96\x76\x6c\xfa\x00\x00", + .assoc = "\xd8\x5b\xc7\xe6\x9f\x94\x4f\xb8", + .alen = 8, + .input = "\x8a\x19\xb9\x50\xbc\xf7\x1a\x01" + "\x8e\x5e\x67\x01\xc9\x17\x87\x65" + "\x98\x09\xd6\x7d\xbe\xdd\x18", + .ilen = 23, + .result = "\xbc\x21\x8d\xaa\x94\x74\x27\xb6" + "\xdb\x38\x6a\x99\xac\x1a\xef\x23" + "\xad\xe0\xb5\x29\x39\xcb\x6a\x63" + "\x7c\xf9\xbe\xc2\x40\x88\x97\xc6" + "\xba", + .rlen = 33, + }, +}; + +static struct aead_testvec aes_ccm_dec_tv_template[] = { + { /* From RFC 3610 */ + .key = "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7" + "\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf", + .klen = 16, + .iv = "\x01\x00\x00\x00\x03\x02\x01\x00" + "\xa0\xa1\xa2\xa3\xa4\xa5\x00\x00", + .assoc = "\x00\x01\x02\x03\x04\x05\x06\x07", + .alen = 8, + .input = "\x58\x8c\x97\x9a\x61\xc6\x63\xd2" + "\xf0\x66\xd0\xc2\xc0\xf9\x89\x80" + "\x6d\x5f\x6b\x61\xda\xc3\x84\x17" + "\xe8\xd1\x2c\xfd\xf9\x26\xe0", + .ilen = 31, + .result = "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f" + "\x10\x11\x12\x13\x14\x15\x16\x17" + "\x18\x19\x1a\x1b\x1c\x1d\x1e", + .rlen = 23, }, { - .key = "\x58\x5d\xa0\x96\x65\x1a\x04\xd7" - "\x96\xe5\xc5\x68\xaa\x95\x35\xe0" - "\x29\xa0\xba\x9e\x48\x78\xd1\xba" - "\xee\x49\x83", - .klen = 27, - .iv = "\xe9\xa9\xff\xe9\x57\xba\xfd\x9e", - .assoc = "\x44\xa6\x2c\x05\xe9\xe1\x43\xb1" - "\x58\x7c\xf2\x5c\x6d\x39\x0a\x64" - "\xa4\xf0\x13\x05\xd1\x77\x99\x67" - "\x11\xc4\xc6\xdb\x00\x56\x36\x61", - .alen = 32, - .input = "\xfb\xe5\x5d\x34\xbe\xe5\xe8\xe7" - "\x5a\xef\x2f\xbf\x1f\x7f\xd4\xb2" - "\x66\xca\x61\x1e\x96\x7a\x61\xb3" - "\x1c\x16\x45\x52\xba\x04\x9c\x9f" - "\xb1\xd2\x40\xbc\x52\x7c\x6f\xb1", - .ilen = 40, - .result = "\x85\x34\x66\x42\xc8\x92\x0f\x36" - "\x58\xe0\x6b\x91\x3c\x98\x5c\xbb" - "\x0a\x85\xcc\x02\xad\x7a\x96\xe9" - "\x65\x43\xa4\xc3\x0f\xdc\x55\x81", - .rlen = 32, + .key = "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7" + "\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf", + .klen = 16, + .iv = "\x01\x00\x00\x00\x07\x06\x05\x04" + "\xa0\xa1\xa2\xa3\xa4\xa5\x00\x00", + .assoc = "\x00\x01\x02\x03\x04\x05\x06\x07" + "\x08\x09\x0a\x0b", + .alen = 12, + .input = "\xdc\xf1\xfb\x7b\x5d\x9e\x23\xfb" + "\x9d\x4e\x13\x12\x53\x65\x8a\xd8" + "\x6e\xbd\xca\x3e\x51\xe8\x3f\x07" + "\x7d\x9c\x2d\x93", + .ilen = 28, + .result = "\x0c\x0d\x0e\x0f\x10\x11\x12\x13" + "\x14\x15\x16\x17\x18\x19\x1a\x1b" + "\x1c\x1d\x1e\x1f", + .rlen = 20, }, { - .key = "\x58\x5d\xa0\x96\x65\x1a\x04\xd7" - "\x96\xe5\xc5\x68\xaa\x95\x35\xe0" - "\x29\xa0\xba\x9e\x48\x78\xd1\xba" - "\xd1\xfc\x57", - .klen = 27, - .iv = "\x9c\xfe\xb8\x9c\xad\x71\xaa\x1f", - .assoc = "\x86\x67\xa5\xa9\x14\x5f\x0d\xc6" - "\xff\x14\xc7\x44\xbf\x6c\x3a\xc3" - "\xff\xb6\x81\xbd\xe2\xd5\x06\xc7" - "\x3c\xa1\x52\x13\x03\x8a\x23\x3a", - .alen = 32, - .input = "\x3f\x66\xb0\x9d\xe5\x4b\x38\x00" - "\xc6\x0e\x6e\xe5\xd6\x98\xa6\x37" - "\x8c\x26\x33\xc6\xb2\xa2\x17\xfa" - "\x64\x19\xc0\x30\xd7\xfc\x14\x6b" - "\xe3\x33\xc2\x04\xb0\x37\xbe\x3f" - "\xa9\xb4\x2d\x68\x03\xa3\x44\xef", - .ilen = 48, - .result = "\x02\x87\x4d\x28\x80\x6e\xb2\xed" - "\x99\x2a\xa8\xca\x04\x25\x45\x90" - "\x1d\xdd\x5a\xd9\xe4\xdb\x9c\x9c" - "\x49\xe9\x01\xfe\xa7\x80\x6d\x6b", - .rlen = 32, - .novrfy = 1, + .key = "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7" + "\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf", + .klen = 16, + .iv = "\x01\x00\x00\x00\x0b\x0a\x09\x08" + "\xa0\xa1\xa2\xa3\xa4\xa5\x00\x00", + .assoc = "\x00\x01\x02\x03\x04\x05\x06\x07", + .alen = 8, + .input = "\x82\x53\x1a\x60\xcc\x24\x94\x5a" + "\x4b\x82\x79\x18\x1a\xb5\xc8\x4d" + "\xf2\x1c\xe7\xf9\xb7\x3f\x42\xe1" + "\x97\xea\x9c\x07\xe5\x6b\x5e\xb1" + "\x7e\x5f\x4e", + .ilen = 35, + .result = "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f" + "\x10\x11\x12\x13\x14\x15\x16\x17" + "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f" + "\x20", + .rlen = 25, }, { - .key = "\xa4\x4b\x54\x29\x0a\xb8\x6d\x01" - "\x5b\x80\x2a\xcf\x25\xc4\xb7\x5c" - "\x20\x2c\xad\x30\xc2\x2b\x41\xfb" - "\x0e\x85\xbc\x33\xad\x0f\x2b\xff" - "\xee\x49\x83", - .klen = 35, - .iv = "\xe9\xa9\xff\xe9\x57\xba\xfd\x9e", - .alen = 0, - .input = "\x1f\xb8\x8f\xa3\xdd\x54\x00\xf2", - .ilen = 8, - .result = "\x00", - .rlen = 0, + .key = "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7" + "\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf", + .klen = 16, + .iv = "\x01\x00\x00\x00\x0c\x0b\x0a\x09" + "\xa0\xa1\xa2\xa3\xa4\xa5\x00\x00", + .assoc = "\x00\x01\x02\x03\x04\x05\x06\x07" + "\x08\x09\x0a\x0b", + .alen = 12, + .input = "\x07\x34\x25\x94\x15\x77\x85\x15" + "\x2b\x07\x40\x98\x33\x0a\xbb\x14" + "\x1b\x94\x7b\x56\x6a\xa9\x40\x6b" + "\x4d\x99\x99\x88\xdd", + .ilen = 29, + .result = "\x0c\x0d\x0e\x0f\x10\x11\x12\x13" + "\x14\x15\x16\x17\x18\x19\x1a\x1b" + "\x1c\x1d\x1e", + .rlen = 19, + }, { + .key = "\xd7\x82\x8d\x13\xb2\xb0\xbd\xc3" + "\x25\xa7\x62\x36\xdf\x93\xcc\x6b", + .klen = 16, + .iv = "\x01\x00\x33\x56\x8e\xf7\xb2\x63" + "\x3c\x96\x96\x76\x6c\xfa\x00\x00", + .assoc = "\x63\x01\x8f\x76\xdc\x8a\x1b\xcb", + .alen = 8, + .input = "\x4c\xcb\x1e\x7c\xa9\x81\xbe\xfa" + "\xa0\x72\x6c\x55\xd3\x78\x06\x12" + "\x98\xc8\x5c\x92\x81\x4a\xbc\x33" + "\xc5\x2e\xe8\x1d\x7d\x77\xc0\x8a", + .ilen = 32, + .result = "\x90\x20\xea\x6f\x91\xbd\xd8\x5a" + "\xfa\x00\x39\xba\x4b\xaf\xf9\xbf" + "\xb7\x9c\x70\x28\x94\x9c\xd0\xec", + .rlen = 24, }, { - .key = "\x39\xbb\xa7\xbe\x59\x97\x9e\x73" - "\xa2\xbc\x6b\x98\xd7\x75\x7f\xe3" - "\xa4\x48\x93\x39\x26\x71\x4a\xc6" - "\xae\x8f\x11\x4c\xc2\x9c\x4a\xbb" - "\x85\x34\x66", - .klen = 35, - .iv = "\x42\xc8\x92\x0f\x36\x58\xe0\x6b", - .alen = 0, - .input = "\x48\x01\x5e\x02\x24\x04\x66\x47" - "\xa1\xea\x6f\xaf\xe8\xfc\xfb\xdd" - "\xa5\xa9\x87\x8d\x84\xee\x2e\x77" - "\xbb\x86\xb9\xf5\x5c\x6c\xff\xf6" - "\x72\xc3\x8e\xf7\x70\xb1\xb2\x07" - "\xbc\xa8\xa3\xbd\x83\x7c\x1d\x2a", - .ilen = 48, - .result = "\xdc\x56\xf2\x71\xb0\xb1\xa0\x6c" - "\xf0\x97\x3a\xfb\x6d\xe7\x32\x99" - "\x3e\xaf\x70\x5e\xb2\x4d\xea\x39" - "\x89\xd4\x75\x7a\x63\xb1\xda\x93", - .rlen = 32, - .novrfy = 1, + .key = "\xd7\x82\x8d\x13\xb2\xb0\xbd\xc3" + "\x25\xa7\x62\x36\xdf\x93\xcc\x6b", + .klen = 16, + .iv = "\x01\x00\xd5\x60\x91\x2d\x3f\x70" + "\x3c\x96\x96\x76\x6c\xfa\x00\x00", + .assoc = "\xcd\x90\x44\xd2\xb7\x1f\xdb\x81" + "\x20\xea\x60\xc0", + .alen = 12, + .input = "\x00\x97\x69\xec\xab\xdf\x48\x62" + "\x55\x94\xc5\x92\x51\xe6\x03\x57" + "\x22\x67\x5e\x04\xc8\x47\x09\x9e" + "\x5a\xe0\x70\x45\x51", + .ilen = 29, + .result = "\x64\x35\xac\xba\xfb\x11\xa8\x2e" + "\x2f\x07\x1d\x7c\xa4\xa5\xeb\xd9" + "\x3a\x80\x3b\xa8\x7f", + .rlen = 21, }, { - .key = "\x58\x5d\xa0\x96\x65\x1a\x04\xd7" - "\x96\xe5\xc5\x68\xaa\x95\x35\xe0" - "\x29\xa0\xba\x9e\x48\x78\xd1\xba" - "\x0d\x1a\x53\x3b\xb5\xe3\xf8\x8b" - "\xcf\x76\x3f", - .klen = 35, - .iv = "\xd9\x95\x75\x8f\x44\x89\x40\x7b", - .assoc = "\x8f\x86\x6c\x4d\x1d\xc5\x39\x88" - "\xc8\xf3\x5c\x52\x10\x63\x6f\x2b" - "\x8a\x2a\xc5\x6f\x30\x23\x58\x7b" - "\xfb\x36\x03\x11\xb4\xd9\xf2\xfe", - .alen = 32, - .input = "\x48\x58\xd6\xf3\xad\x63\x58\xbf" - "\xae\xc7\x5e\xae\x83\x8f\x7b\xe4" - "\x78\x5c\x4c\x67\x71\x89\x94\xbf" - "\x47\xf1\x63\x7e\x1c\x59\xbd\xc5" - "\x7f\x44\x0a\x0c\x01\x18\x07\x92" - "\xe1\xd3\x51\xce\x32\x6d\x0c\x5b", - .ilen = 48, - .result = "\xc2\x54\xc8\xde\x78\x87\x77\x40" - "\x49\x71\xe4\xb7\xe7\xcb\x76\x61" - "\x0a\x41\xb9\xe9\xc0\x76\x54\xab" - "\x04\x49\x3b\x19\x93\x57\x25\x5d", - .rlen = 32, + .key = "\xd7\x82\x8d\x13\xb2\xb0\xbd\xc3" + "\x25\xa7\x62\x36\xdf\x93\xcc\x6b", + .klen = 16, + .iv = "\x01\x00\x42\xff\xf8\xf1\x95\x1c" + "\x3c\x96\x96\x76\x6c\xfa\x00\x00", + .assoc = "\xd8\x5b\xc7\xe6\x9f\x94\x4f\xb8", + .alen = 8, + .input = "\xbc\x21\x8d\xaa\x94\x74\x27\xb6" + "\xdb\x38\x6a\x99\xac\x1a\xef\x23" + "\xad\xe0\xb5\x29\x39\xcb\x6a\x63" + "\x7c\xf9\xbe\xc2\x40\x88\x97\xc6" + "\xba", + .ilen = 33, + .result = "\x8a\x19\xb9\x50\xbc\xf7\x1a\x01" + "\x8e\x5e\x67\x01\xc9\x17\x87\x65" + "\x98\x09\xd6\x7d\xbe\xdd\x18", + .rlen = 23, }, }; /* - * ANSI X9.31 Continuous Pseudo-Random Number Generator (AES mode) - * test vectors, taken from Appendix B.2.9 and B.2.10: - * http://csrc.nist.gov/groups/STM/cavp/documents/rng/RNGVS.pdf - * Only AES-128 is supported at this time. + * rfc4309 refers to section 8 of rfc3610 for test vectors, but they all + * use a 13-byte nonce, we only support an 11-byte nonce. Similarly, all of + * Special Publication 800-38C's test vectors also use nonce lengths our + * implementation doesn't support. The following are taken from fips cavs + * fax files on hand at Red Hat. + * + * nb: actual key lengths are (klen - 3), the last 3 bytes are actually + * part of the nonce which combine w/the iv, but need to be input this way. */ -#define ANSI_CPRNG_AES_TEST_VECTORS 6 - -static struct cprng_testvec ansi_cprng_aes_tv_template[] = { +static struct aead_testvec aes_ccm_rfc4309_enc_tv_template[] = { { - .key = "\xf3\xb1\x66\x6d\x13\x60\x72\x42" - "\xed\x06\x1c\xab\xb8\xd4\x62\x02", - .klen = 16, - .dt = "\xe6\xb3\xbe\x78\x2a\x23\xfa\x62" - "\xd7\x1d\x4a\xfb\xb0\xe9\x22\xf9", - .dtlen = 16, - .v = "\x80\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00", - .vlen = 16, - .result = "\x59\x53\x1e\xd1\x3b\xb0\xc0\x55" - "\x84\x79\x66\x85\xc1\x2f\x76\x41", - .rlen = 16, - .loops = 1, + .key = "\x83\xac\x54\x66\xc2\xeb\xe5\x05" + "\x2e\x01\xd1\xfc\x5d\x82\x66\x2e" + "\x96\xac\x59", + .klen = 19, + .iv = "\x30\x07\xa1\xe2\xa2\xc7\x55\x24", + .alen = 0, + .input = "\x19\xc8\x81\xf6\xe9\x86\xff\x93" + "\x0b\x78\x67\xe5\xbb\xb7\xfc\x6e" + "\x83\x77\xb3\xa6\x0c\x8c\x9f\x9c" + "\x35\x2e\xad\xe0\x62\xf9\x91\xa1", + .ilen = 32, + .result = "\xab\x6f\xe1\x69\x1d\x19\x99\xa8" + "\x92\xa0\xc4\x6f\x7e\xe2\x8b\xb1" + "\x70\xbb\x8c\xa6\x4c\x6e\x97\x8a" + "\x57\x2b\xbe\x5d\x98\xa6\xb1\x32" + "\xda\x24\xea\xd9\xa1\x39\x98\xfd" + "\xa4\xbe\xd9\xf2\x1a\x6d\x22\xa8", + .rlen = 48, }, { - .key = "\xf3\xb1\x66\x6d\x13\x60\x72\x42" - "\xed\x06\x1c\xab\xb8\xd4\x62\x02", - .klen = 16, - .dt = "\xe6\xb3\xbe\x78\x2a\x23\xfa\x62" - "\xd7\x1d\x4a\xfb\xb0\xe9\x22\xfa", - .dtlen = 16, - .v = "\xc0\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00", - .vlen = 16, - .result = "\x7c\x22\x2c\xf4\xca\x8f\xa2\x4c" - "\x1c\x9c\xb6\x41\xa9\xf3\x22\x0d", - .rlen = 16, - .loops = 1, + .key = "\x1e\x2c\x7e\x01\x41\x9a\xef\xc0" + "\x0d\x58\x96\x6e\x5c\xa2\x4b\xd3" + "\x4f\xa3\x19", + .klen = 19, + .iv = "\xd3\x01\x5a\xd8\x30\x60\x15\x56", + .assoc = "\xda\xe6\x28\x9c\x45\x2d\xfd\x63" + "\x5e\xda\x4c\xb6\xe6\xfc\xf9\xb7" + "\x0c\x56\xcb\xe4\xe0\x05\x7a\xe1" + "\x0a\x63\x09\x78\xbc\x2c\x55\xde", + .alen = 32, + .input = "\x87\xa3\x36\xfd\x96\xb3\x93\x78" + "\xa9\x28\x63\xba\x12\xa3\x14\x85" + "\x57\x1e\x06\xc9\x7b\x21\xef\x76" + "\x7f\x38\x7e\x8e\x29\xa4\x3e\x7e", + .ilen = 32, + .result = "\x8a\x1e\x11\xf0\x02\x6b\xe2\x19" + "\xfc\x70\xc4\x6d\x8e\xb7\x99\xab" + "\xc5\x4b\xa2\xac\xd3\xf3\x48\xff" + "\x3b\xb5\xce\x53\xef\xde\xbb\x02" + "\xa9\x86\x15\x6c\x13\xfe\xda\x0a" + "\x22\xb8\x29\x3d\xd8\x39\x9a\x23", + .rlen = 48, }, { - .key = "\xf3\xb1\x66\x6d\x13\x60\x72\x42" - "\xed\x06\x1c\xab\xb8\xd4\x62\x02", - .klen = 16, - .dt = "\xe6\xb3\xbe\x78\x2a\x23\xfa\x62" - "\xd7\x1d\x4a\xfb\xb0\xe9\x22\xfb", - .dtlen = 16, - .v = "\xe0\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00", - .vlen = 16, - .result = "\x8a\xaa\x00\x39\x66\x67\x5b\xe5" - "\x29\x14\x28\x81\xa9\x4d\x4e\xc7", + .key = "\xf4\x6b\xc2\x75\x62\xfe\xb4\xe1" + "\xa3\xf0\xff\xdd\x4e\x4b\x12\x75" + "\x53\x14\x73\x66\x8d\x88\xf6\x80" + "\xa0\x20\x35", + .klen = 27, + .iv = "\x26\xf2\x21\x8d\x50\x20\xda\xe2", + .assoc = "\x5b\x9e\x13\x67\x02\x5e\xef\xc1" + "\x6c\xf9\xd7\x1e\x52\x8f\x7a\x47" + "\xe9\xd4\xcf\x20\x14\x6e\xf0\x2d" + "\xd8\x9e\x2b\x56\x10\x23\x56\xe7", + .alen = 32, + .ilen = 0, + .result = "\x36\xea\x7a\x70\x08\xdc\x6a\xbc" + "\xad\x0c\x7a\x63\xf6\x61\xfd\x9b", .rlen = 16, - .loops = 1, }, { - .key = "\xf3\xb1\x66\x6d\x13\x60\x72\x42" - "\xed\x06\x1c\xab\xb8\xd4\x62\x02", - .klen = 16, - .dt = "\xe6\xb3\xbe\x78\x2a\x23\xfa\x62" - "\xd7\x1d\x4a\xfb\xb0\xe9\x22\xfc", - .dtlen = 16, - .v = "\xf0\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00", - .vlen = 16, - .result = "\x88\xdd\xa4\x56\x30\x24\x23\xe5" - "\xf6\x9d\xa5\x7e\x7b\x95\xc7\x3a", - .rlen = 16, - .loops = 1, + .key = "\x56\xdf\x5c\x8f\x26\x3f\x0e\x42" + "\xef\x7a\xd3\xce\xfc\x84\x60\x62" + "\xca\xb4\x40\xaf\x5f\xc9\xc9\x01" + "\xd6\x3c\x8c", + .klen = 27, + .iv = "\x86\x84\xb6\xcd\xef\x09\x2e\x94", + .assoc = "\x02\x65\x78\x3c\xe9\x21\x30\x91" + "\xb1\xb9\xda\x76\x9a\x78\x6d\x95" + "\xf2\x88\x32\xa3\xf2\x50\xcb\x4c" + "\xe3\x00\x73\x69\x84\x69\x87\x79", + .alen = 32, + .input = "\x9f\xd2\x02\x4b\x52\x49\x31\x3c" + "\x43\x69\x3a\x2d\x8e\x70\xad\x7e" + "\xe0\xe5\x46\x09\x80\x89\x13\xb2" + "\x8c\x8b\xd9\x3f\x86\xfb\xb5\x6b", + .ilen = 32, + .result = "\x39\xdf\x7c\x3c\x5a\x29\xb9\x62" + "\x5d\x51\xc2\x16\xd8\xbd\x06\x9f" + "\x9b\x6a\x09\x70\xc1\x51\x83\xc2" + "\x66\x88\x1d\x4f\x9a\xda\xe0\x1e" + "\xc7\x79\x11\x58\xe5\x6b\x20\x40" + "\x7a\xea\x46\x42\x8b\xe4\x6f\xe1", + .rlen = 48, + }, { + .key = "\xe0\x8d\x99\x71\x60\xd7\x97\x1a" + "\xbd\x01\x99\xd5\x8a\xdf\x71\x3a" + "\xd3\xdf\x24\x4b\x5e\x3d\x4b\x4e" + "\x30\x7a\xb9\xd8\x53\x0a\x5e\x2b" + "\x1e\x29\x91", + .klen = 35, + .iv = "\xad\x8e\xc1\x53\x0a\xcf\x2d\xbe", + .assoc = "\x19\xb6\x1f\x57\xc4\xf3\xf0\x8b" + "\x78\x2b\x94\x02\x29\x0f\x42\x27" + "\x6b\x75\xcb\x98\x34\x08\x7e\x79" + "\xe4\x3e\x49\x0d\x84\x8b\x22\x87", + .alen = 32, + .input = "\xe1\xd9\xd8\x13\xeb\x3a\x75\x3f" + "\x9d\xbd\x5f\x66\xbe\xdc\xbb\x66" + "\xbf\x17\x99\x62\x4a\x39\x27\x1f" + "\x1d\xdc\x24\xae\x19\x2f\x98\x4c", + .ilen = 32, + .result = "\x19\xb8\x61\x33\x45\x2b\x43\x96" + "\x6f\x51\xd0\x20\x30\x7d\x9b\xc6" + "\x26\x3d\xf8\xc9\x65\x16\xa8\x9f" + "\xf0\x62\x17\x34\xf2\x1e\x8d\x75" + "\x4e\x13\xcc\xc0\xc3\x2a\x54\x2d", + .rlen = 40, }, { - .key = "\xf3\xb1\x66\x6d\x13\x60\x72\x42" - "\xed\x06\x1c\xab\xb8\xd4\x62\x02", - .klen = 16, - .dt = "\xe6\xb3\xbe\x78\x2a\x23\xfa\x62" - "\xd7\x1d\x4a\xfb\xb0\xe9\x22\xfd", - .dtlen = 16, - .v = "\xf8\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00", - .vlen = 16, - .result = "\x05\x25\x92\x46\x61\x79\xd2\xcb" - "\x78\xc4\x0b\x14\x0a\x5a\x9a\xc8", - .rlen = 16, - .loops = 1, - }, { /* Monte Carlo Test */ - .key = "\x9f\x5b\x51\x20\x0b\xf3\x34\xb5" - "\xd8\x2b\xe8\xc3\x72\x55\xc8\x48", - .klen = 16, - .dt = "\x63\x76\xbb\xe5\x29\x02\xba\x3b" - "\x67\xc9\x25\xfa\x70\x1f\x11\xac", - .dtlen = 16, - .v = "\x57\x2c\x8e\x76\x87\x26\x47\x97" - "\x7e\x74\xfb\xdd\xc4\x95\x01\xd1", - .vlen = 16, - .result = "\x48\xe9\xbd\x0d\x06\xee\x18\xfb" - "\xe4\x57\x90\xd5\xc3\xfc\x9b\x73", - .rlen = 16, - .loops = 10000, + .key = "\x7c\xc8\x18\x3b\x8d\x99\xe0\x7c" + "\x45\x41\xb8\xbd\x5c\xa7\xc2\x32" + "\x8a\xb8\x02\x59\xa4\xfe\xa9\x2c" + "\x09\x75\x9a\x9b\x3c\x9b\x27\x39" + "\xf9\xd9\x4e", + .klen = 35, + .iv = "\x63\xb5\x3d\x9d\x43\xf6\x1e\x50", + .assoc = "\x57\xf5\x6b\x8b\x57\x5c\x3d\x3b" + "\x13\x02\x01\x0c\x83\x4c\x96\x35" + "\x8e\xd6\x39\xcf\x7d\x14\x9b\x94" + "\xb0\x39\x36\xe6\x8f\x57\xe0\x13", + .alen = 32, + .input = "\x3b\x6c\x29\x36\xb6\xef\x07\xa6" + "\x83\x72\x07\x4f\xcf\xfa\x66\x89" + "\x5f\xca\xb1\xba\xd5\x8f\x2c\x27" + "\x30\xdb\x75\x09\x93\xd4\x65\xe4", + .ilen = 32, + .result = "\xb0\x88\x5a\x33\xaa\xe5\xc7\x1d" + "\x85\x23\xc7\xc6\x2f\xf4\x1e\x3d" + "\xcc\x63\x44\x25\x07\x78\x4f\x9e" + "\x96\xb8\x88\xeb\xbc\x48\x1f\x06" + "\x39\xaf\x39\xac\xd8\x4a\x80\x39" + "\x7b\x72\x8a\xf7", + .rlen = 44, + }, { + .key = "\xab\xd0\xe9\x33\x07\x26\xe5\x83" + "\x8c\x76\x95\xd4\xb6\xdc\xf3\x46" + "\xf9\x8f\xad\xe3\x02\x13\x83\x77" + "\x3f\xb0\xf1\xa1\xa1\x22\x0f\x2b" + "\x24\xa7\x8b", + .klen = 35, + .iv = "\x07\xcb\xcc\x0e\xe6\x33\xbf\xf5", + .assoc = "\xd4\xdb\x30\x1d\x03\xfe\xfd\x5f" + "\x87\xd4\x8c\xb6\xb6\xf1\x7a\x5d" + "\xab\x90\x65\x8d\x8e\xca\x4d\x4f" + "\x16\x0c\x40\x90\x4b\xc7\x36\x73", + .alen = 32, + .input = "\xf5\xc6\x7d\x48\xc1\xb7\xe6\x92" + "\x97\x5a\xca\xc4\xa9\x6d\xf9\x3d" + "\x6c\xde\xbc\xf1\x90\xea\x6a\xb2" + "\x35\x86\x36\xaf\x5c\xfe\x4b\x3a", + .ilen = 32, + .result = "\x83\x6f\x40\x87\x72\xcf\xc1\x13" + "\xef\xbb\x80\x21\x04\x6c\x58\x09" + "\x07\x1b\xfc\xdf\xc0\x3f\x5b\xc7" + "\xe0\x79\xa8\x6e\x71\x7c\x3f\xcf" + "\x5c\xda\xb2\x33\xe5\x13\xe2\x0d" + "\x74\xd1\xef\xb5\x0f\x3a\xb5\xf8", + .rlen = 48, }, }; -/* Cast5 test vectors from RFC 2144 */ -#define CAST5_ENC_TEST_VECTORS 4 -#define CAST5_DEC_TEST_VECTORS 4 -#define CAST5_CBC_ENC_TEST_VECTORS 1 -#define CAST5_CBC_DEC_TEST_VECTORS 1 -#define CAST5_CTR_ENC_TEST_VECTORS 2 -#define CAST5_CTR_DEC_TEST_VECTORS 2 - -static struct cipher_testvec cast5_enc_tv_template[] = { +static struct aead_testvec aes_ccm_rfc4309_dec_tv_template[] = { { - .key = "\x01\x23\x45\x67\x12\x34\x56\x78" - "\x23\x45\x67\x89\x34\x56\x78\x9a", - .klen = 16, - .input = "\x01\x23\x45\x67\x89\xab\xcd\xef", + .key = "\xab\x2f\x8a\x74\xb7\x1c\xd2\xb1" + "\xff\x80\x2e\x48\x7d\x82\xf8\xb9" + "\xc6\xfb\x7d", + .klen = 19, + .iv = "\x80\x0d\x13\xab\xd8\xa6\xb2\xd8", + .alen = 0, + .input = "\xd5\xe8\x93\x9f\xc7\x89\x2e\x2b", .ilen = 8, - .result = "\x23\x8b\x4f\xe5\x84\x7e\x44\xb2", - .rlen = 8, + .result = "\x00", + .rlen = 0, + .novrfy = 1, }, { - .key = "\x01\x23\x45\x67\x12\x34\x56\x78" - "\x23\x45", - .klen = 10, - .input = "\x01\x23\x45\x67\x89\xab\xcd\xef", + .key = "\xab\x2f\x8a\x74\xb7\x1c\xd2\xb1" + "\xff\x80\x2e\x48\x7d\x82\xf8\xb9" + "\xaf\x94\x87", + .klen = 19, + .iv = "\x78\x35\x82\x81\x7f\x88\x94\x68", + .alen = 0, + .input = "\x41\x3c\xb8\x87\x73\xcb\xf3\xf3", .ilen = 8, - .result = "\xeb\x6a\x71\x1a\x2c\x02\x27\x1b", - .rlen = 8, + .result = "\x00", + .rlen = 0, }, { - .key = "\x01\x23\x45\x67\x12", - .klen = 5, - .input = "\x01\x23\x45\x67\x89\xab\xcd\xef", - .ilen = 8, - .result = "\x7a\xc8\x16\xd1\x6e\x9b\x30\x2e", - .rlen = 8, - }, { /* Generated from TF test vectors */ - .key = "\x85\x62\x3F\x1C\xF9\xD6\x1C\xF9" - "\xD6\xB3\x90\x6D\x4A\x90\x6D\x4A", - .klen = 16, - .iv = "\xE2\x24\x89\xEE\x53\xB8\x1D\x5F", - .input = "\x56\xED\x84\x1B\x8F\x26\xBD\x31" - "\xC8\x5F\xF6\x6A\x01\x98\x0C\xA3" - "\x3A\xD1\x45\xDC\x73\x0A\x7E\x15" - "\xAC\x20\xB7\x4E\xE5\x59\xF0\x87" - "\x1E\x92\x29\xC0\x34\xCB\x62\xF9" - "\x6D\x04\x9B\x0F\xA6\x3D\xD4\x48" - "\xDF\x76\x0D\x81\x18\xAF\x23\xBA" - "\x51\xE8\x5C\xF3\x8A\x21\x95\x2C" - "\xC3\x37\xCE\x65\xFC\x70\x07\x9E" - "\x12\xA9\x40\xD7\x4B\xE2\x79\x10" - "\x84\x1B\xB2\x26\xBD\x54\xEB\x5F" - "\xF6\x8D\x01\x98\x2F\xC6\x3A\xD1" - "\x68\xFF\x73\x0A\xA1\x15\xAC\x43" - "\xDA\x4E\xE5\x7C\x13\x87\x1E\xB5" - "\x29\xC0\x57\xEE\x62\xF9\x90\x04" - "\x9B\x32\xC9\x3D\xD4\x6B\x02\x76" - "\x0D\xA4\x18\xAF\x46\xDD\x51\xE8" - "\x7F\x16\x8A\x21\xB8\x2C\xC3\x5A" - "\xF1\x65\xFC\x93\x07\x9E\x35\xCC" - "\x40\xD7\x6E\x05\x79\x10\xA7\x1B" - "\xB2\x49\xE0\x54\xEB\x82\x19\x8D" - "\x24\xBB\x2F\xC6\x5D\xF4\x68\xFF" - "\x96\x0A\xA1\x38\xCF\x43\xDA\x71" - "\x08\x7C\x13\xAA\x1E\xB5\x4C\xE3" - "\x57\xEE\x85\x1C\x90\x27\xBE\x32" - "\xC9\x60\xF7\x6B\x02\x99\x0D\xA4" - "\x3B\xD2\x46\xDD\x74\x0B\x7F\x16" - "\xAD\x21\xB8\x4F\xE6\x5A\xF1\x88" - "\x1F\x93\x2A\xC1\x35\xCC\x63\xFA" - "\x6E\x05\x9C\x10\xA7\x3E\xD5\x49" - "\xE0\x77\x0E\x82\x19\xB0\x24\xBB" - "\x52\xE9\x5D\xF4\x8B\x22\x96\x2D" - "\xC4\x38\xCF\x66\xFD\x71\x08\x9F" - "\x13\xAA\x41\xD8\x4C\xE3\x7A\x11" - "\x85\x1C\xB3\x27\xBE\x55\xEC\x60" - "\xF7\x8E\x02\x99\x30\xC7\x3B\xD2" - "\x69\x00\x74\x0B\xA2\x16\xAD\x44" - "\xDB\x4F\xE6\x7D\x14\x88\x1F\xB6" - "\x2A\xC1\x58\xEF\x63\xFA\x91\x05" - "\x9C\x33\xCA\x3E\xD5\x6C\x03\x77" - "\x0E\xA5\x19\xB0\x47\xDE\x52\xE9" - "\x80\x17\x8B\x22\xB9\x2D\xC4\x5B" - "\xF2\x66\xFD\x94\x08\x9F\x36\xCD" - "\x41\xD8\x6F\x06\x7A\x11\xA8\x1C" - "\xB3\x4A\xE1\x55\xEC\x83\x1A\x8E" - "\x25\xBC\x30\xC7\x5E\xF5\x69\x00" - "\x97\x0B\xA2\x39\xD0\x44\xDB\x72" - "\x09\x7D\x14\xAB\x1F\xB6\x4D\xE4" - "\x58\xEF\x86\x1D\x91\x28\xBF\x33" - "\xCA\x61\xF8\x6C\x03\x9A\x0E\xA5" - "\x3C\xD3\x47\xDE\x75\x0C\x80\x17" - "\xAE\x22\xB9\x50\xE7\x5B\xF2\x89" - "\x20\x94\x2B\xC2\x36\xCD\x64\xFB" - "\x6F\x06\x9D\x11\xA8\x3F\xD6\x4A" - "\xE1\x78\x0F\x83\x1A\xB1\x25\xBC" - "\x53\xEA\x5E\xF5\x8C\x00\x97\x2E" - "\xC5\x39\xD0\x67\xFE\x72\x09\xA0" - "\x14\xAB\x42\xD9\x4D\xE4\x7B\x12" - "\x86\x1D\xB4\x28\xBF\x56\xED\x61" - "\xF8\x8F\x03\x9A\x31\xC8\x3C\xD3" - "\x6A\x01\x75\x0C\xA3\x17\xAE\x45" - "\xDC\x50\xE7\x7E\x15\x89\x20\xB7", - .ilen = 496, - .result = "\x8D\xFC\x81\x9C\xCB\xAA\x5A\x1C" - "\x7E\x95\xCF\x40\xAB\x4D\x6F\xEA" - "\xD3\xD9\xB0\x9A\xB7\xC7\xE0\x2E" - "\xD1\x39\x34\x92\x8F\xFA\x14\xF1" - "\xD5\xD2\x7B\x59\x1F\x35\x28\xC2" - "\x20\xD9\x42\x06\xC9\x0B\x10\x04" - "\xF8\x79\xCD\x32\x86\x75\x4C\xB6" - "\x7B\x1C\x52\xB1\x91\x64\x22\x4B" - "\x13\xC7\xAE\x98\x0E\xB5\xCF\x6F" - "\x3F\xF4\x43\x96\x73\x0D\xA2\x05" - "\xDB\xFD\x28\x90\x2C\x56\xB9\x37" - "\x5B\x69\x0C\xAD\x84\x67\xFF\x15" - "\x4A\xD4\xA7\xD3\xDD\x99\x47\x3A" - "\xED\x34\x35\x78\x6B\x91\xC9\x32" - "\xE1\xBF\xBC\xB4\x04\x85\x6A\x39" - "\xC0\xBA\x51\xD0\x0F\x4E\xD1\xE2" - "\x1C\xFD\x0E\x05\x07\xF4\x10\xED" - "\xA2\x17\xFF\xF5\x64\xC6\x1A\x22" - "\xAD\x78\xE7\xD7\x11\xE9\x99\xB9" - "\xAA\xEC\x6F\xF8\x3B\xBF\xCE\x77" - "\x93\xE8\xAD\x1D\x50\x6C\xAE\xBC" - "\xBA\x5C\x80\xD1\x91\x65\x51\x1B" - "\xE8\x0A\xCD\x99\x96\x71\x3D\xB6" - "\x78\x75\x37\x55\xC1\xF5\x90\x40" - "\x34\xF4\x7E\xC8\xCC\x3A\x5F\x6E" - "\x36\xA1\xA1\xC2\x3A\x72\x42\x8E" - "\x0E\x37\x88\xE8\xCE\x83\xCB\xAD" - "\xE0\x69\x77\x50\xC7\x0C\x99\xCA" - "\x19\x5B\x30\x25\x9A\xEF\x9B\x0C" - "\xEF\x8F\x74\x4C\xCF\x49\x4E\xB9" - "\xC5\xAE\x9E\x2E\x78\x9A\xB9\x48" - "\xD5\x81\xE4\x37\x1D\xBF\x27\xD9" - "\xC5\xD6\x65\x43\x45\x8C\xBB\xB6" - "\x55\xF4\x06\xBB\x49\x53\x8B\x1B" - "\x07\xA9\x96\x69\x5B\xCB\x0F\xBC" - "\x93\x85\x90\x0F\x0A\x68\x40\x2A" - "\x95\xED\x2D\x88\xBF\x71\xD0\xBB" - "\xEC\xB0\x77\x6C\x79\xFC\x3C\x05" - "\x49\x3F\xB8\x24\xEF\x8E\x09\xA2" - "\x1D\xEF\x92\x02\x96\xD4\x7F\xC8" - "\x03\xB2\xCA\xDB\x17\x5C\x52\xCF" - "\xDD\x70\x37\x63\xAA\xA5\x83\x20" - "\x52\x02\xF6\xB9\xE7\x6E\x0A\xB6" - "\x79\x03\xA0\xDA\xA3\x79\x21\xBD" - "\xE3\x37\x3A\xC0\xF7\x2C\x32\xBE" - "\x8B\xE8\xA6\x00\xC7\x32\xD5\x06" - "\xBB\xE3\xAB\x06\x21\x82\xB8\x32" - "\x31\x34\x2A\xA7\x1F\x64\x99\xBF" - "\xFA\xDA\x3D\x75\xF7\x48\xD5\x48" - "\x4B\x52\x7E\xF6\x7C\xAB\x67\x59" - "\xC5\xDC\xA8\xC6\x63\x85\x4A\xDF" - "\xF0\x40\x5F\xCF\xE3\x58\x52\x67" - "\x7A\x24\x32\xC5\xEC\x9E\xA9\x6F" - "\x58\x56\xDD\x94\x1F\x71\x8D\xF4" - "\x6E\xFF\x2C\xA7\xA5\xD8\xBA\xAF" - "\x1D\x8B\xA2\x46\xB5\xC4\x9F\x57" - "\x8D\xD8\xB3\x3C\x02\x0D\xBB\x84" - "\xC7\xBD\xB4\x9A\x6E\xBB\xB1\x37" - "\x95\x79\xC4\xA7\xEA\x1D\xDC\x33" - "\x5D\x0B\x3F\x03\x8F\x30\xF9\xAE" - "\x4F\xFE\x24\x9C\x9A\x02\xE5\x57" - "\xF5\xBC\x25\xD6\x02\x56\x57\x1C", - .rlen = 496, - .also_non_np = 1, - .np = 2, - .tap = { 496 - 16, 16 }, - }, -}; - -static struct cipher_testvec cast5_dec_tv_template[] = { - { - .key = "\x01\x23\x45\x67\x12\x34\x56\x78" - "\x23\x45\x67\x89\x34\x56\x78\x9a", - .klen = 16, - .input = "\x23\x8b\x4f\xe5\x84\x7e\x44\xb2", + .key = "\x61\x0e\x8c\xae\xe3\x23\xb6\x38" + "\x76\x1c\xf6\x3a\x67\xa3\x9c\xd8" + "\xc6\xfb\x7d", + .klen = 19, + .iv = "\x80\x0d\x13\xab\xd8\xa6\xb2\xd8", + .assoc = "\xf3\x94\x87\x78\x35\x82\x81\x7f" + "\x88\x94\x68\xb1\x78\x6b\x2b\xd6" + "\x04\x1f\x4e\xed\x78\xd5\x33\x66" + "\xd8\x94\x99\x91\x81\x54\x62\x57", + .alen = 32, + .input = "\xf0\x7c\x29\x02\xae\x1c\x2f\x55" + "\xd0\xd1\x3d\x1a\xa3\x6d\xe4\x0a" + "\x86\xb0\x87\x6b\x62\x33\x8c\x34" + "\xce\xab\x57\xcc\x79\x0b\xe0\x6f" + "\x5c\x3e\x48\x1f\x6c\x46\xf7\x51" + "\x8b\x84\x83\x2a\xc1\x05\xb8\xc5", + .ilen = 48, + .result = "\x50\x82\x3e\x07\xe2\x1e\xb6\xfb" + "\x33\xe4\x73\xce\xd2\xfb\x95\x79" + "\xe8\xb4\xb5\x77\x11\x10\x62\x6f" + "\x6a\x82\xd1\x13\xec\xf5\xd0\x48", + .rlen = 32, + .novrfy = 1, + }, { + .key = "\x61\x0e\x8c\xae\xe3\x23\xb6\x38" + "\x76\x1c\xf6\x3a\x67\xa3\x9c\xd8" + "\x05\xe0\xc9", + .klen = 19, + .iv = "\x0f\xed\x34\xea\x97\xd4\x3b\xdf", + .assoc = "\x49\x5c\x50\x1f\x1d\x94\xcc\x81" + "\xba\xb7\xb6\x03\xaf\xa5\xc1\xa1" + "\xd8\x5c\x42\x68\xe0\x6c\xda\x89" + "\x05\xac\x56\xac\x1b\x2a\xd3\x86", + .alen = 32, + .input = "\x39\xbe\x7d\x15\x62\x77\xf3\x3c" + "\xad\x83\x52\x6d\x71\x03\x25\x1c" + "\xed\x81\x3a\x9a\x16\x7d\x19\x80" + "\x72\x04\x72\xd0\xf6\xff\x05\x0f" + "\xb7\x14\x30\x00\x32\x9e\xa0\xa6" + "\x9e\x5a\x18\xa1\xb8\xfe\xdb\xd3", + .ilen = 48, + .result = "\x75\x05\xbe\xc2\xd9\x1e\xde\x60" + "\x47\x3d\x8c\x7d\xbd\xb5\xd9\xb7" + "\xf2\xae\x61\x05\x8f\x82\x24\x3f" + "\x9c\x67\x91\xe1\x38\x4f\xe4\x0c", + .rlen = 32, + }, { + .key = "\x39\xbb\xa7\xbe\x59\x97\x9e\x73" + "\xa2\xbc\x6b\x98\xd7\x75\x7f\xe3" + "\xa4\x48\x93\x39\x26\x71\x4a\xc6" + "\xee\x49\x83", + .klen = 27, + .iv = "\xe9\xa9\xff\xe9\x57\xba\xfd\x9e", + .assoc = "\x44\xa6\x2c\x05\xe9\xe1\x43\xb1" + "\x58\x7c\xf2\x5c\x6d\x39\x0a\x64" + "\xa4\xf0\x13\x05\xd1\x77\x99\x67" + "\x11\xc4\xc6\xdb\x00\x56\x36\x61", + .alen = 32, + .input = "\x71\x99\xfa\xf4\x44\x12\x68\x9b", .ilen = 8, - .result = "\x01\x23\x45\x67\x89\xab\xcd\xef", - .rlen = 8, + .result = "\x00", + .rlen = 0, }, { - .key = "\x01\x23\x45\x67\x12\x34\x56\x78" - "\x23\x45", - .klen = 10, - .input = "\xeb\x6a\x71\x1a\x2c\x02\x27\x1b", - .ilen = 8, - .result = "\x01\x23\x45\x67\x89\xab\xcd\xef", - .rlen = 8, + .key = "\x58\x5d\xa0\x96\x65\x1a\x04\xd7" + "\x96\xe5\xc5\x68\xaa\x95\x35\xe0" + "\x29\xa0\xba\x9e\x48\x78\xd1\xba" + "\xee\x49\x83", + .klen = 27, + .iv = "\xe9\xa9\xff\xe9\x57\xba\xfd\x9e", + .assoc = "\x44\xa6\x2c\x05\xe9\xe1\x43\xb1" + "\x58\x7c\xf2\x5c\x6d\x39\x0a\x64" + "\xa4\xf0\x13\x05\xd1\x77\x99\x67" + "\x11\xc4\xc6\xdb\x00\x56\x36\x61", + .alen = 32, + .input = "\xfb\xe5\x5d\x34\xbe\xe5\xe8\xe7" + "\x5a\xef\x2f\xbf\x1f\x7f\xd4\xb2" + "\x66\xca\x61\x1e\x96\x7a\x61\xb3" + "\x1c\x16\x45\x52\xba\x04\x9c\x9f" + "\xb1\xd2\x40\xbc\x52\x7c\x6f\xb1", + .ilen = 40, + .result = "\x85\x34\x66\x42\xc8\x92\x0f\x36" + "\x58\xe0\x6b\x91\x3c\x98\x5c\xbb" + "\x0a\x85\xcc\x02\xad\x7a\x96\xe9" + "\x65\x43\xa4\xc3\x0f\xdc\x55\x81", + .rlen = 32, }, { - .key = "\x01\x23\x45\x67\x12", - .klen = 5, - .input = "\x7a\xc8\x16\xd1\x6e\x9b\x30\x2e", + .key = "\x58\x5d\xa0\x96\x65\x1a\x04\xd7" + "\x96\xe5\xc5\x68\xaa\x95\x35\xe0" + "\x29\xa0\xba\x9e\x48\x78\xd1\xba" + "\xd1\xfc\x57", + .klen = 27, + .iv = "\x9c\xfe\xb8\x9c\xad\x71\xaa\x1f", + .assoc = "\x86\x67\xa5\xa9\x14\x5f\x0d\xc6" + "\xff\x14\xc7\x44\xbf\x6c\x3a\xc3" + "\xff\xb6\x81\xbd\xe2\xd5\x06\xc7" + "\x3c\xa1\x52\x13\x03\x8a\x23\x3a", + .alen = 32, + .input = "\x3f\x66\xb0\x9d\xe5\x4b\x38\x00" + "\xc6\x0e\x6e\xe5\xd6\x98\xa6\x37" + "\x8c\x26\x33\xc6\xb2\xa2\x17\xfa" + "\x64\x19\xc0\x30\xd7\xfc\x14\x6b" + "\xe3\x33\xc2\x04\xb0\x37\xbe\x3f" + "\xa9\xb4\x2d\x68\x03\xa3\x44\xef", + .ilen = 48, + .result = "\x02\x87\x4d\x28\x80\x6e\xb2\xed" + "\x99\x2a\xa8\xca\x04\x25\x45\x90" + "\x1d\xdd\x5a\xd9\xe4\xdb\x9c\x9c" + "\x49\xe9\x01\xfe\xa7\x80\x6d\x6b", + .rlen = 32, + .novrfy = 1, + }, { + .key = "\xa4\x4b\x54\x29\x0a\xb8\x6d\x01" + "\x5b\x80\x2a\xcf\x25\xc4\xb7\x5c" + "\x20\x2c\xad\x30\xc2\x2b\x41\xfb" + "\x0e\x85\xbc\x33\xad\x0f\x2b\xff" + "\xee\x49\x83", + .klen = 35, + .iv = "\xe9\xa9\xff\xe9\x57\xba\xfd\x9e", + .alen = 0, + .input = "\x1f\xb8\x8f\xa3\xdd\x54\x00\xf2", .ilen = 8, - .result = "\x01\x23\x45\x67\x89\xab\xcd\xef", - .rlen = 8, - }, { /* Generated from TF test vectors */ - .key = "\x85\x62\x3F\x1C\xF9\xD6\x1C\xF9" - "\xD6\xB3\x90\x6D\x4A\x90\x6D\x4A", - .klen = 16, - .iv = "\xE2\x24\x89\xEE\x53\xB8\x1D\x5F", - .input = "\x8D\xFC\x81\x9C\xCB\xAA\x5A\x1C" - "\x7E\x95\xCF\x40\xAB\x4D\x6F\xEA" - "\xD3\xD9\xB0\x9A\xB7\xC7\xE0\x2E" - "\xD1\x39\x34\x92\x8F\xFA\x14\xF1" - "\xD5\xD2\x7B\x59\x1F\x35\x28\xC2" - "\x20\xD9\x42\x06\xC9\x0B\x10\x04" - "\xF8\x79\xCD\x32\x86\x75\x4C\xB6" - "\x7B\x1C\x52\xB1\x91\x64\x22\x4B" - "\x13\xC7\xAE\x98\x0E\xB5\xCF\x6F" - "\x3F\xF4\x43\x96\x73\x0D\xA2\x05" - "\xDB\xFD\x28\x90\x2C\x56\xB9\x37" - "\x5B\x69\x0C\xAD\x84\x67\xFF\x15" - "\x4A\xD4\xA7\xD3\xDD\x99\x47\x3A" - "\xED\x34\x35\x78\x6B\x91\xC9\x32" - "\xE1\xBF\xBC\xB4\x04\x85\x6A\x39" - "\xC0\xBA\x51\xD0\x0F\x4E\xD1\xE2" - "\x1C\xFD\x0E\x05\x07\xF4\x10\xED" - "\xA2\x17\xFF\xF5\x64\xC6\x1A\x22" - "\xAD\x78\xE7\xD7\x11\xE9\x99\xB9" - "\xAA\xEC\x6F\xF8\x3B\xBF\xCE\x77" - "\x93\xE8\xAD\x1D\x50\x6C\xAE\xBC" - "\xBA\x5C\x80\xD1\x91\x65\x51\x1B" - "\xE8\x0A\xCD\x99\x96\x71\x3D\xB6" - "\x78\x75\x37\x55\xC1\xF5\x90\x40" - "\x34\xF4\x7E\xC8\xCC\x3A\x5F\x6E" - "\x36\xA1\xA1\xC2\x3A\x72\x42\x8E" - "\x0E\x37\x88\xE8\xCE\x83\xCB\xAD" - "\xE0\x69\x77\x50\xC7\x0C\x99\xCA" - "\x19\x5B\x30\x25\x9A\xEF\x9B\x0C" - "\xEF\x8F\x74\x4C\xCF\x49\x4E\xB9" - "\xC5\xAE\x9E\x2E\x78\x9A\xB9\x48" - "\xD5\x81\xE4\x37\x1D\xBF\x27\xD9" - "\xC5\xD6\x65\x43\x45\x8C\xBB\xB6" - "\x55\xF4\x06\xBB\x49\x53\x8B\x1B" - "\x07\xA9\x96\x69\x5B\xCB\x0F\xBC" - "\x93\x85\x90\x0F\x0A\x68\x40\x2A" - "\x95\xED\x2D\x88\xBF\x71\xD0\xBB" - "\xEC\xB0\x77\x6C\x79\xFC\x3C\x05" - "\x49\x3F\xB8\x24\xEF\x8E\x09\xA2" - "\x1D\xEF\x92\x02\x96\xD4\x7F\xC8" - "\x03\xB2\xCA\xDB\x17\x5C\x52\xCF" - "\xDD\x70\x37\x63\xAA\xA5\x83\x20" - "\x52\x02\xF6\xB9\xE7\x6E\x0A\xB6" - "\x79\x03\xA0\xDA\xA3\x79\x21\xBD" - "\xE3\x37\x3A\xC0\xF7\x2C\x32\xBE" - "\x8B\xE8\xA6\x00\xC7\x32\xD5\x06" - "\xBB\xE3\xAB\x06\x21\x82\xB8\x32" - "\x31\x34\x2A\xA7\x1F\x64\x99\xBF" - "\xFA\xDA\x3D\x75\xF7\x48\xD5\x48" - "\x4B\x52\x7E\xF6\x7C\xAB\x67\x59" - "\xC5\xDC\xA8\xC6\x63\x85\x4A\xDF" - "\xF0\x40\x5F\xCF\xE3\x58\x52\x67" - "\x7A\x24\x32\xC5\xEC\x9E\xA9\x6F" - "\x58\x56\xDD\x94\x1F\x71\x8D\xF4" - "\x6E\xFF\x2C\xA7\xA5\xD8\xBA\xAF" - "\x1D\x8B\xA2\x46\xB5\xC4\x9F\x57" - "\x8D\xD8\xB3\x3C\x02\x0D\xBB\x84" - "\xC7\xBD\xB4\x9A\x6E\xBB\xB1\x37" - "\x95\x79\xC4\xA7\xEA\x1D\xDC\x33" - "\x5D\x0B\x3F\x03\x8F\x30\xF9\xAE" - "\x4F\xFE\x24\x9C\x9A\x02\xE5\x57" - "\xF5\xBC\x25\xD6\x02\x56\x57\x1C", - .ilen = 496, - .result = "\x56\xED\x84\x1B\x8F\x26\xBD\x31" - "\xC8\x5F\xF6\x6A\x01\x98\x0C\xA3" - "\x3A\xD1\x45\xDC\x73\x0A\x7E\x15" - "\xAC\x20\xB7\x4E\xE5\x59\xF0\x87" - "\x1E\x92\x29\xC0\x34\xCB\x62\xF9" - "\x6D\x04\x9B\x0F\xA6\x3D\xD4\x48" - "\xDF\x76\x0D\x81\x18\xAF\x23\xBA" - "\x51\xE8\x5C\xF3\x8A\x21\x95\x2C" - "\xC3\x37\xCE\x65\xFC\x70\x07\x9E" - "\x12\xA9\x40\xD7\x4B\xE2\x79\x10" - "\x84\x1B\xB2\x26\xBD\x54\xEB\x5F" - "\xF6\x8D\x01\x98\x2F\xC6\x3A\xD1" - "\x68\xFF\x73\x0A\xA1\x15\xAC\x43" - "\xDA\x4E\xE5\x7C\x13\x87\x1E\xB5" - "\x29\xC0\x57\xEE\x62\xF9\x90\x04" - "\x9B\x32\xC9\x3D\xD4\x6B\x02\x76" - "\x0D\xA4\x18\xAF\x46\xDD\x51\xE8" - "\x7F\x16\x8A\x21\xB8\x2C\xC3\x5A" - "\xF1\x65\xFC\x93\x07\x9E\x35\xCC" - "\x40\xD7\x6E\x05\x79\x10\xA7\x1B" - "\xB2\x49\xE0\x54\xEB\x82\x19\x8D" - "\x24\xBB\x2F\xC6\x5D\xF4\x68\xFF" - "\x96\x0A\xA1\x38\xCF\x43\xDA\x71" - "\x08\x7C\x13\xAA\x1E\xB5\x4C\xE3" - "\x57\xEE\x85\x1C\x90\x27\xBE\x32" - "\xC9\x60\xF7\x6B\x02\x99\x0D\xA4" - "\x3B\xD2\x46\xDD\x74\x0B\x7F\x16" - "\xAD\x21\xB8\x4F\xE6\x5A\xF1\x88" - "\x1F\x93\x2A\xC1\x35\xCC\x63\xFA" - "\x6E\x05\x9C\x10\xA7\x3E\xD5\x49" - "\xE0\x77\x0E\x82\x19\xB0\x24\xBB" - "\x52\xE9\x5D\xF4\x8B\x22\x96\x2D" - "\xC4\x38\xCF\x66\xFD\x71\x08\x9F" - "\x13\xAA\x41\xD8\x4C\xE3\x7A\x11" - "\x85\x1C\xB3\x27\xBE\x55\xEC\x60" - "\xF7\x8E\x02\x99\x30\xC7\x3B\xD2" - "\x69\x00\x74\x0B\xA2\x16\xAD\x44" - "\xDB\x4F\xE6\x7D\x14\x88\x1F\xB6" - "\x2A\xC1\x58\xEF\x63\xFA\x91\x05" - "\x9C\x33\xCA\x3E\xD5\x6C\x03\x77" - "\x0E\xA5\x19\xB0\x47\xDE\x52\xE9" - "\x80\x17\x8B\x22\xB9\x2D\xC4\x5B" - "\xF2\x66\xFD\x94\x08\x9F\x36\xCD" - "\x41\xD8\x6F\x06\x7A\x11\xA8\x1C" - "\xB3\x4A\xE1\x55\xEC\x83\x1A\x8E" - "\x25\xBC\x30\xC7\x5E\xF5\x69\x00" - "\x97\x0B\xA2\x39\xD0\x44\xDB\x72" - "\x09\x7D\x14\xAB\x1F\xB6\x4D\xE4" - "\x58\xEF\x86\x1D\x91\x28\xBF\x33" - "\xCA\x61\xF8\x6C\x03\x9A\x0E\xA5" - "\x3C\xD3\x47\xDE\x75\x0C\x80\x17" - "\xAE\x22\xB9\x50\xE7\x5B\xF2\x89" - "\x20\x94\x2B\xC2\x36\xCD\x64\xFB" - "\x6F\x06\x9D\x11\xA8\x3F\xD6\x4A" - "\xE1\x78\x0F\x83\x1A\xB1\x25\xBC" - "\x53\xEA\x5E\xF5\x8C\x00\x97\x2E" - "\xC5\x39\xD0\x67\xFE\x72\x09\xA0" - "\x14\xAB\x42\xD9\x4D\xE4\x7B\x12" - "\x86\x1D\xB4\x28\xBF\x56\xED\x61" - "\xF8\x8F\x03\x9A\x31\xC8\x3C\xD3" - "\x6A\x01\x75\x0C\xA3\x17\xAE\x45" - "\xDC\x50\xE7\x7E\x15\x89\x20\xB7", - .rlen = 496, - .also_non_np = 1, - .np = 2, - .tap = { 496 - 16, 16 }, - }, -}; - -static struct cipher_testvec cast5_cbc_enc_tv_template[] = { - { /* Generated from TF test vectors */ - .key = "\x85\x62\x3F\x1C\xF9\xD6\x1C\xF9" - "\xD6\xB3\x90\x6D\x4A\x90\x6D\x4A", - .klen = 16, - .iv = "\xE2\x24\x89\xEE\x53\xB8\x1D\x5F", - .input = "\x56\xED\x84\x1B\x8F\x26\xBD\x31" - "\xC8\x5F\xF6\x6A\x01\x98\x0C\xA3" - "\x3A\xD1\x45\xDC\x73\x0A\x7E\x15" - "\xAC\x20\xB7\x4E\xE5\x59\xF0\x87" - "\x1E\x92\x29\xC0\x34\xCB\x62\xF9" - "\x6D\x04\x9B\x0F\xA6\x3D\xD4\x48" - "\xDF\x76\x0D\x81\x18\xAF\x23\xBA" - "\x51\xE8\x5C\xF3\x8A\x21\x95\x2C" - "\xC3\x37\xCE\x65\xFC\x70\x07\x9E" - "\x12\xA9\x40\xD7\x4B\xE2\x79\x10" - "\x84\x1B\xB2\x26\xBD\x54\xEB\x5F" - "\xF6\x8D\x01\x98\x2F\xC6\x3A\xD1" - "\x68\xFF\x73\x0A\xA1\x15\xAC\x43" - "\xDA\x4E\xE5\x7C\x13\x87\x1E\xB5" - "\x29\xC0\x57\xEE\x62\xF9\x90\x04" - "\x9B\x32\xC9\x3D\xD4\x6B\x02\x76" - "\x0D\xA4\x18\xAF\x46\xDD\x51\xE8" - "\x7F\x16\x8A\x21\xB8\x2C\xC3\x5A" - "\xF1\x65\xFC\x93\x07\x9E\x35\xCC" - "\x40\xD7\x6E\x05\x79\x10\xA7\x1B" - "\xB2\x49\xE0\x54\xEB\x82\x19\x8D" - "\x24\xBB\x2F\xC6\x5D\xF4\x68\xFF" - "\x96\x0A\xA1\x38\xCF\x43\xDA\x71" - "\x08\x7C\x13\xAA\x1E\xB5\x4C\xE3" - "\x57\xEE\x85\x1C\x90\x27\xBE\x32" - "\xC9\x60\xF7\x6B\x02\x99\x0D\xA4" - "\x3B\xD2\x46\xDD\x74\x0B\x7F\x16" - "\xAD\x21\xB8\x4F\xE6\x5A\xF1\x88" - "\x1F\x93\x2A\xC1\x35\xCC\x63\xFA" - "\x6E\x05\x9C\x10\xA7\x3E\xD5\x49" - "\xE0\x77\x0E\x82\x19\xB0\x24\xBB" - "\x52\xE9\x5D\xF4\x8B\x22\x96\x2D" - "\xC4\x38\xCF\x66\xFD\x71\x08\x9F" - "\x13\xAA\x41\xD8\x4C\xE3\x7A\x11" - "\x85\x1C\xB3\x27\xBE\x55\xEC\x60" - "\xF7\x8E\x02\x99\x30\xC7\x3B\xD2" - "\x69\x00\x74\x0B\xA2\x16\xAD\x44" - "\xDB\x4F\xE6\x7D\x14\x88\x1F\xB6" - "\x2A\xC1\x58\xEF\x63\xFA\x91\x05" - "\x9C\x33\xCA\x3E\xD5\x6C\x03\x77" - "\x0E\xA5\x19\xB0\x47\xDE\x52\xE9" - "\x80\x17\x8B\x22\xB9\x2D\xC4\x5B" - "\xF2\x66\xFD\x94\x08\x9F\x36\xCD" - "\x41\xD8\x6F\x06\x7A\x11\xA8\x1C" - "\xB3\x4A\xE1\x55\xEC\x83\x1A\x8E" - "\x25\xBC\x30\xC7\x5E\xF5\x69\x00" - "\x97\x0B\xA2\x39\xD0\x44\xDB\x72" - "\x09\x7D\x14\xAB\x1F\xB6\x4D\xE4" - "\x58\xEF\x86\x1D\x91\x28\xBF\x33" - "\xCA\x61\xF8\x6C\x03\x9A\x0E\xA5" - "\x3C\xD3\x47\xDE\x75\x0C\x80\x17" - "\xAE\x22\xB9\x50\xE7\x5B\xF2\x89" - "\x20\x94\x2B\xC2\x36\xCD\x64\xFB" - "\x6F\x06\x9D\x11\xA8\x3F\xD6\x4A" - "\xE1\x78\x0F\x83\x1A\xB1\x25\xBC" - "\x53\xEA\x5E\xF5\x8C\x00\x97\x2E" - "\xC5\x39\xD0\x67\xFE\x72\x09\xA0" - "\x14\xAB\x42\xD9\x4D\xE4\x7B\x12" - "\x86\x1D\xB4\x28\xBF\x56\xED\x61" - "\xF8\x8F\x03\x9A\x31\xC8\x3C\xD3" - "\x6A\x01\x75\x0C\xA3\x17\xAE\x45" - "\xDC\x50\xE7\x7E\x15\x89\x20\xB7", - .ilen = 496, - .result = "\x05\x28\xCE\x61\x90\x80\xE1\x78" - "\xB9\x2A\x97\x7C\xB0\x83\xD8\x1A" - "\xDE\x58\x7F\xD7\xFD\x72\xB8\xFB" - "\xDA\xF0\x6E\x77\x14\x47\x82\xBA" - "\x29\x0E\x25\x6E\xB4\x39\xD9\x7F" - "\x05\xA7\xA7\x3A\xC1\x5D\x9E\x39" - "\xA7\xFB\x0D\x05\x00\xF3\x58\x67" - "\x60\xEC\x73\x77\x46\x85\x9B\x6A" - "\x08\x3E\xBE\x59\xFB\xE4\x96\x34" - "\xB4\x05\x49\x1A\x97\x43\xAD\xA0" - "\xA9\x1E\x6E\x74\xF1\x94\xEC\xA8" - "\xB5\x8A\x20\xEA\x89\x6B\x19\xAA" - "\xA7\xF1\x33\x67\x90\x23\x0D\xEE" - "\x81\xD5\x78\x4F\xD3\x63\xEA\x46" - "\xB5\xB2\x6E\xBB\xCA\x76\x06\x10" - "\x96\x2A\x0A\xBA\xF9\x41\x5A\x1D" - "\x36\x7C\x56\x14\x54\x83\xFA\xA1" - "\x27\xDD\xBA\x8A\x90\x29\xD6\xA6" - "\xFA\x48\x3E\x1E\x23\x6E\x98\xA8" - "\xA7\xD9\x67\x92\x5C\x13\xB4\x71" - "\xA8\xAA\x89\x4A\xA4\xB3\x49\x7C" - "\x7D\x7F\xCE\x6F\x29\x2E\x7E\x37" - "\xC8\x52\x60\xD9\xE7\xCA\x60\x98" - "\xED\xCD\xE8\x60\x83\xAD\x34\x4D" - "\x96\x4A\x99\x2B\xB7\x14\x75\x66" - "\x6C\x2C\x1A\xBA\x4B\xBB\x49\x56" - "\xE1\x86\xA2\x0E\xD0\xF0\x07\xD3" - "\x18\x38\x09\x9C\x0E\x8B\x86\x07" - "\x90\x12\x37\x49\x27\x98\x69\x18" - "\xB0\xCC\xFB\xD3\xBD\x04\xA0\x85" - "\x4B\x22\x97\x07\xB6\x97\xE9\x95" - "\x0F\x88\x36\xA9\x44\x00\xC6\xE9" - "\x27\x53\x5C\x5B\x1F\xD3\xE2\xEE" - "\xD0\xCD\x63\x30\xA9\xC0\xDD\x49" - "\xFE\x16\xA4\x07\x0D\xE2\x5D\x97" - "\xDE\x89\xBA\x2E\xF3\xA9\x5E\xBE" - "\x03\x55\x0E\x02\x41\x4A\x45\x06" - "\xBE\xEA\x32\xF2\xDC\x91\x5C\x20" - "\x94\x02\x30\xD2\xFC\x29\xFA\x8E" - "\x34\xA0\x31\xB8\x34\xBA\xAE\x54" - "\xB5\x88\x1F\xDC\x43\xDC\x22\x9F" - "\xDC\xCE\xD3\xFA\xA4\xA8\xBC\x8A" - "\xC7\x5A\x43\x21\xA5\xB1\xDB\xC3" - "\x84\x3B\xB4\x9B\xB5\xA7\xF1\x0A" - "\xB6\x37\x21\x19\x55\xC2\xBD\x99" - "\x49\x24\xBB\x7C\xB3\x8E\xEF\xD2" - "\x3A\xCF\xA0\x31\x28\x0E\x25\xA2" - "\x11\xB4\x18\x17\x1A\x65\x92\x56" - "\xE8\xE0\x52\x9C\x61\x18\x2A\xB1" - "\x1A\x01\x22\x45\x17\x62\x52\x6C" - "\x91\x44\xCF\x98\xC7\xC0\x79\x26" - "\x32\x66\x6F\x23\x7F\x94\x36\x88" - "\x3C\xC9\xD0\xB7\x45\x30\x31\x86" - "\x3D\xC6\xA3\x98\x62\x84\x1A\x8B" - "\x16\x88\xC7\xA3\xE9\x4F\xE0\x86" - "\xA4\x93\xA8\x34\x5A\xCA\xDF\xCA" - "\x46\x38\xD2\xF4\xE0\x2D\x1E\xC9" - "\x7C\xEF\x53\xB7\x60\x72\x41\xBF" - "\x29\x00\x87\x02\xAF\x44\x4C\xB7" - "\x8C\xF5\x3F\x19\xF4\x80\x45\xA7" - "\x15\x5F\xDB\xE9\xB1\x83\xD2\xE6" - "\x1D\x18\x66\x44\x5B\x8F\x14\xEB", - .rlen = 496, - .also_non_np = 1, - .np = 2, - .tap = { 496 - 16, 16 }, + .result = "\x00", + .rlen = 0, + }, { + .key = "\x39\xbb\xa7\xbe\x59\x97\x9e\x73" + "\xa2\xbc\x6b\x98\xd7\x75\x7f\xe3" + "\xa4\x48\x93\x39\x26\x71\x4a\xc6" + "\xae\x8f\x11\x4c\xc2\x9c\x4a\xbb" + "\x85\x34\x66", + .klen = 35, + .iv = "\x42\xc8\x92\x0f\x36\x58\xe0\x6b", + .alen = 0, + .input = "\x48\x01\x5e\x02\x24\x04\x66\x47" + "\xa1\xea\x6f\xaf\xe8\xfc\xfb\xdd" + "\xa5\xa9\x87\x8d\x84\xee\x2e\x77" + "\xbb\x86\xb9\xf5\x5c\x6c\xff\xf6" + "\x72\xc3\x8e\xf7\x70\xb1\xb2\x07" + "\xbc\xa8\xa3\xbd\x83\x7c\x1d\x2a", + .ilen = 48, + .result = "\xdc\x56\xf2\x71\xb0\xb1\xa0\x6c" + "\xf0\x97\x3a\xfb\x6d\xe7\x32\x99" + "\x3e\xaf\x70\x5e\xb2\x4d\xea\x39" + "\x89\xd4\x75\x7a\x63\xb1\xda\x93", + .rlen = 32, + .novrfy = 1, + }, { + .key = "\x58\x5d\xa0\x96\x65\x1a\x04\xd7" + "\x96\xe5\xc5\x68\xaa\x95\x35\xe0" + "\x29\xa0\xba\x9e\x48\x78\xd1\xba" + "\x0d\x1a\x53\x3b\xb5\xe3\xf8\x8b" + "\xcf\x76\x3f", + .klen = 35, + .iv = "\xd9\x95\x75\x8f\x44\x89\x40\x7b", + .assoc = "\x8f\x86\x6c\x4d\x1d\xc5\x39\x88" + "\xc8\xf3\x5c\x52\x10\x63\x6f\x2b" + "\x8a\x2a\xc5\x6f\x30\x23\x58\x7b" + "\xfb\x36\x03\x11\xb4\xd9\xf2\xfe", + .alen = 32, + .input = "\x48\x58\xd6\xf3\xad\x63\x58\xbf" + "\xae\xc7\x5e\xae\x83\x8f\x7b\xe4" + "\x78\x5c\x4c\x67\x71\x89\x94\xbf" + "\x47\xf1\x63\x7e\x1c\x59\xbd\xc5" + "\x7f\x44\x0a\x0c\x01\x18\x07\x92" + "\xe1\xd3\x51\xce\x32\x6d\x0c\x5b", + .ilen = 48, + .result = "\xc2\x54\xc8\xde\x78\x87\x77\x40" + "\x49\x71\xe4\xb7\xe7\xcb\x76\x61" + "\x0a\x41\xb9\xe9\xc0\x76\x54\xab" + "\x04\x49\x3b\x19\x93\x57\x25\x5d", + .rlen = 32, }, }; -static struct cipher_testvec cast5_cbc_dec_tv_template[] = { - { /* Generated from TF test vectors */ - .key = "\x85\x62\x3F\x1C\xF9\xD6\x1C\xF9" - "\xD6\xB3\x90\x6D\x4A\x90\x6D\x4A", +/* + * ANSI X9.31 Continuous Pseudo-Random Number Generator (AES mode) + * test vectors, taken from Appendix B.2.9 and B.2.10: + * http://csrc.nist.gov/groups/STM/cavp/documents/rng/RNGVS.pdf + * Only AES-128 is supported at this time. + */ +#define ANSI_CPRNG_AES_TEST_VECTORS 6 + +static struct cprng_testvec ansi_cprng_aes_tv_template[] = { + { + .key = "\xf3\xb1\x66\x6d\x13\x60\x72\x42" + "\xed\x06\x1c\xab\xb8\xd4\x62\x02", .klen = 16, - .iv = "\xE2\x24\x89\xEE\x53\xB8\x1D\x5F", - .input = "\x05\x28\xCE\x61\x90\x80\xE1\x78" - "\xB9\x2A\x97\x7C\xB0\x83\xD8\x1A" - "\xDE\x58\x7F\xD7\xFD\x72\xB8\xFB" - "\xDA\xF0\x6E\x77\x14\x47\x82\xBA" - "\x29\x0E\x25\x6E\xB4\x39\xD9\x7F" - "\x05\xA7\xA7\x3A\xC1\x5D\x9E\x39" - "\xA7\xFB\x0D\x05\x00\xF3\x58\x67" - "\x60\xEC\x73\x77\x46\x85\x9B\x6A" - "\x08\x3E\xBE\x59\xFB\xE4\x96\x34" - "\xB4\x05\x49\x1A\x97\x43\xAD\xA0" - "\xA9\x1E\x6E\x74\xF1\x94\xEC\xA8" - "\xB5\x8A\x20\xEA\x89\x6B\x19\xAA" - "\xA7\xF1\x33\x67\x90\x23\x0D\xEE" - "\x81\xD5\x78\x4F\xD3\x63\xEA\x46" - "\xB5\xB2\x6E\xBB\xCA\x76\x06\x10" - "\x96\x2A\x0A\xBA\xF9\x41\x5A\x1D" - "\x36\x7C\x56\x14\x54\x83\xFA\xA1" - "\x27\xDD\xBA\x8A\x90\x29\xD6\xA6" - "\xFA\x48\x3E\x1E\x23\x6E\x98\xA8" - "\xA7\xD9\x67\x92\x5C\x13\xB4\x71" - "\xA8\xAA\x89\x4A\xA4\xB3\x49\x7C" - "\x7D\x7F\xCE\x6F\x29\x2E\x7E\x37" - "\xC8\x52\x60\xD9\xE7\xCA\x60\x98" - "\xED\xCD\xE8\x60\x83\xAD\x34\x4D" - "\x96\x4A\x99\x2B\xB7\x14\x75\x66" - "\x6C\x2C\x1A\xBA\x4B\xBB\x49\x56" - "\xE1\x86\xA2\x0E\xD0\xF0\x07\xD3" - "\x18\x38\x09\x9C\x0E\x8B\x86\x07" - "\x90\x12\x37\x49\x27\x98\x69\x18" - "\xB0\xCC\xFB\xD3\xBD\x04\xA0\x85" - "\x4B\x22\x97\x07\xB6\x97\xE9\x95" - "\x0F\x88\x36\xA9\x44\x00\xC6\xE9" - "\x27\x53\x5C\x5B\x1F\xD3\xE2\xEE" - "\xD0\xCD\x63\x30\xA9\xC0\xDD\x49" - "\xFE\x16\xA4\x07\x0D\xE2\x5D\x97" - "\xDE\x89\xBA\x2E\xF3\xA9\x5E\xBE" - "\x03\x55\x0E\x02\x41\x4A\x45\x06" - "\xBE\xEA\x32\xF2\xDC\x91\x5C\x20" - "\x94\x02\x30\xD2\xFC\x29\xFA\x8E" - "\x34\xA0\x31\xB8\x34\xBA\xAE\x54" - "\xB5\x88\x1F\xDC\x43\xDC\x22\x9F" - "\xDC\xCE\xD3\xFA\xA4\xA8\xBC\x8A" - "\xC7\x5A\x43\x21\xA5\xB1\xDB\xC3" - "\x84\x3B\xB4\x9B\xB5\xA7\xF1\x0A" - "\xB6\x37\x21\x19\x55\xC2\xBD\x99" - "\x49\x24\xBB\x7C\xB3\x8E\xEF\xD2" - "\x3A\xCF\xA0\x31\x28\x0E\x25\xA2" - "\x11\xB4\x18\x17\x1A\x65\x92\x56" - "\xE8\xE0\x52\x9C\x61\x18\x2A\xB1" - "\x1A\x01\x22\x45\x17\x62\x52\x6C" - "\x91\x44\xCF\x98\xC7\xC0\x79\x26" - "\x32\x66\x6F\x23\x7F\x94\x36\x88" - "\x3C\xC9\xD0\xB7\x45\x30\x31\x86" - "\x3D\xC6\xA3\x98\x62\x84\x1A\x8B" - "\x16\x88\xC7\xA3\xE9\x4F\xE0\x86" - "\xA4\x93\xA8\x34\x5A\xCA\xDF\xCA" - "\x46\x38\xD2\xF4\xE0\x2D\x1E\xC9" - "\x7C\xEF\x53\xB7\x60\x72\x41\xBF" - "\x29\x00\x87\x02\xAF\x44\x4C\xB7" - "\x8C\xF5\x3F\x19\xF4\x80\x45\xA7" - "\x15\x5F\xDB\xE9\xB1\x83\xD2\xE6" - "\x1D\x18\x66\x44\x5B\x8F\x14\xEB", - .ilen = 496, - .result = "\x56\xED\x84\x1B\x8F\x26\xBD\x31" - "\xC8\x5F\xF6\x6A\x01\x98\x0C\xA3" - "\x3A\xD1\x45\xDC\x73\x0A\x7E\x15" - "\xAC\x20\xB7\x4E\xE5\x59\xF0\x87" - "\x1E\x92\x29\xC0\x34\xCB\x62\xF9" - "\x6D\x04\x9B\x0F\xA6\x3D\xD4\x48" - "\xDF\x76\x0D\x81\x18\xAF\x23\xBA" - "\x51\xE8\x5C\xF3\x8A\x21\x95\x2C" - "\xC3\x37\xCE\x65\xFC\x70\x07\x9E" - "\x12\xA9\x40\xD7\x4B\xE2\x79\x10" - "\x84\x1B\xB2\x26\xBD\x54\xEB\x5F" - "\xF6\x8D\x01\x98\x2F\xC6\x3A\xD1" - "\x68\xFF\x73\x0A\xA1\x15\xAC\x43" - "\xDA\x4E\xE5\x7C\x13\x87\x1E\xB5" - "\x29\xC0\x57\xEE\x62\xF9\x90\x04" - "\x9B\x32\xC9\x3D\xD4\x6B\x02\x76" - "\x0D\xA4\x18\xAF\x46\xDD\x51\xE8" - "\x7F\x16\x8A\x21\xB8\x2C\xC3\x5A" - "\xF1\x65\xFC\x93\x07\x9E\x35\xCC" - "\x40\xD7\x6E\x05\x79\x10\xA7\x1B" - "\xB2\x49\xE0\x54\xEB\x82\x19\x8D" - "\x24\xBB\x2F\xC6\x5D\xF4\x68\xFF" - "\x96\x0A\xA1\x38\xCF\x43\xDA\x71" - "\x08\x7C\x13\xAA\x1E\xB5\x4C\xE3" - "\x57\xEE\x85\x1C\x90\x27\xBE\x32" - "\xC9\x60\xF7\x6B\x02\x99\x0D\xA4" - "\x3B\xD2\x46\xDD\x74\x0B\x7F\x16" - "\xAD\x21\xB8\x4F\xE6\x5A\xF1\x88" - "\x1F\x93\x2A\xC1\x35\xCC\x63\xFA" - "\x6E\x05\x9C\x10\xA7\x3E\xD5\x49" - "\xE0\x77\x0E\x82\x19\xB0\x24\xBB" - "\x52\xE9\x5D\xF4\x8B\x22\x96\x2D" - "\xC4\x38\xCF\x66\xFD\x71\x08\x9F" - "\x13\xAA\x41\xD8\x4C\xE3\x7A\x11" - "\x85\x1C\xB3\x27\xBE\x55\xEC\x60" - "\xF7\x8E\x02\x99\x30\xC7\x3B\xD2" - "\x69\x00\x74\x0B\xA2\x16\xAD\x44" - "\xDB\x4F\xE6\x7D\x14\x88\x1F\xB6" - "\x2A\xC1\x58\xEF\x63\xFA\x91\x05" - "\x9C\x33\xCA\x3E\xD5\x6C\x03\x77" - "\x0E\xA5\x19\xB0\x47\xDE\x52\xE9" - "\x80\x17\x8B\x22\xB9\x2D\xC4\x5B" - "\xF2\x66\xFD\x94\x08\x9F\x36\xCD" - "\x41\xD8\x6F\x06\x7A\x11\xA8\x1C" - "\xB3\x4A\xE1\x55\xEC\x83\x1A\x8E" - "\x25\xBC\x30\xC7\x5E\xF5\x69\x00" - "\x97\x0B\xA2\x39\xD0\x44\xDB\x72" - "\x09\x7D\x14\xAB\x1F\xB6\x4D\xE4" - "\x58\xEF\x86\x1D\x91\x28\xBF\x33" - "\xCA\x61\xF8\x6C\x03\x9A\x0E\xA5" - "\x3C\xD3\x47\xDE\x75\x0C\x80\x17" - "\xAE\x22\xB9\x50\xE7\x5B\xF2\x89" - "\x20\x94\x2B\xC2\x36\xCD\x64\xFB" - "\x6F\x06\x9D\x11\xA8\x3F\xD6\x4A" - "\xE1\x78\x0F\x83\x1A\xB1\x25\xBC" - "\x53\xEA\x5E\xF5\x8C\x00\x97\x2E" - "\xC5\x39\xD0\x67\xFE\x72\x09\xA0" - "\x14\xAB\x42\xD9\x4D\xE4\x7B\x12" - "\x86\x1D\xB4\x28\xBF\x56\xED\x61" - "\xF8\x8F\x03\x9A\x31\xC8\x3C\xD3" - "\x6A\x01\x75\x0C\xA3\x17\xAE\x45" - "\xDC\x50\xE7\x7E\x15\x89\x20\xB7", - .rlen = 496, - .also_non_np = 1, - .np = 2, - .tap = { 496 - 16, 16 }, + .dt = "\xe6\xb3\xbe\x78\x2a\x23\xfa\x62" + "\xd7\x1d\x4a\xfb\xb0\xe9\x22\xf9", + .dtlen = 16, + .v = "\x80\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00", + .vlen = 16, + .result = "\x59\x53\x1e\xd1\x3b\xb0\xc0\x55" + "\x84\x79\x66\x85\xc1\x2f\x76\x41", + .rlen = 16, + .loops = 1, + }, { + .key = "\xf3\xb1\x66\x6d\x13\x60\x72\x42" + "\xed\x06\x1c\xab\xb8\xd4\x62\x02", + .klen = 16, + .dt = "\xe6\xb3\xbe\x78\x2a\x23\xfa\x62" + "\xd7\x1d\x4a\xfb\xb0\xe9\x22\xfa", + .dtlen = 16, + .v = "\xc0\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00", + .vlen = 16, + .result = "\x7c\x22\x2c\xf4\xca\x8f\xa2\x4c" + "\x1c\x9c\xb6\x41\xa9\xf3\x22\x0d", + .rlen = 16, + .loops = 1, + }, { + .key = "\xf3\xb1\x66\x6d\x13\x60\x72\x42" + "\xed\x06\x1c\xab\xb8\xd4\x62\x02", + .klen = 16, + .dt = "\xe6\xb3\xbe\x78\x2a\x23\xfa\x62" + "\xd7\x1d\x4a\xfb\xb0\xe9\x22\xfb", + .dtlen = 16, + .v = "\xe0\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00", + .vlen = 16, + .result = "\x8a\xaa\x00\x39\x66\x67\x5b\xe5" + "\x29\x14\x28\x81\xa9\x4d\x4e\xc7", + .rlen = 16, + .loops = 1, + }, { + .key = "\xf3\xb1\x66\x6d\x13\x60\x72\x42" + "\xed\x06\x1c\xab\xb8\xd4\x62\x02", + .klen = 16, + .dt = "\xe6\xb3\xbe\x78\x2a\x23\xfa\x62" + "\xd7\x1d\x4a\xfb\xb0\xe9\x22\xfc", + .dtlen = 16, + .v = "\xf0\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00", + .vlen = 16, + .result = "\x88\xdd\xa4\x56\x30\x24\x23\xe5" + "\xf6\x9d\xa5\x7e\x7b\x95\xc7\x3a", + .rlen = 16, + .loops = 1, + }, { + .key = "\xf3\xb1\x66\x6d\x13\x60\x72\x42" + "\xed\x06\x1c\xab\xb8\xd4\x62\x02", + .klen = 16, + .dt = "\xe6\xb3\xbe\x78\x2a\x23\xfa\x62" + "\xd7\x1d\x4a\xfb\xb0\xe9\x22\xfd", + .dtlen = 16, + .v = "\xf8\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00", + .vlen = 16, + .result = "\x05\x25\x92\x46\x61\x79\xd2\xcb" + "\x78\xc4\x0b\x14\x0a\x5a\x9a\xc8", + .rlen = 16, + .loops = 1, + }, { /* Monte Carlo Test */ + .key = "\x9f\x5b\x51\x20\x0b\xf3\x34\xb5" + "\xd8\x2b\xe8\xc3\x72\x55\xc8\x48", + .klen = 16, + .dt = "\x63\x76\xbb\xe5\x29\x02\xba\x3b" + "\x67\xc9\x25\xfa\x70\x1f\x11\xac", + .dtlen = 16, + .v = "\x57\x2c\x8e\x76\x87\x26\x47\x97" + "\x7e\x74\xfb\xdd\xc4\x95\x01\xd1", + .vlen = 16, + .result = "\x48\xe9\xbd\x0d\x06\xee\x18\xfb" + "\xe4\x57\x90\xd5\xc3\xfc\x9b\x73", + .rlen = 16, + .loops = 10000, }, }; -static struct cipher_testvec cast5_ctr_enc_tv_template[] = { - { /* Generated from TF test vectors */ - .key = "\x85\x62\x3F\x1C\xF9\xD6\x1C\xF9" - "\xD6\xB3\x90\x6D\x4A\x90\x6D\x4A", - .klen = 16, - .iv = "\xE2\x24\x89\xEE\x53\xB8\x1D\x5F", - .input = "\x56\xED\x84\x1B\x8F\x26\xBD\x31" - "\xC8\x5F\xF6\x6A\x01\x98\x0C\xA3" - "\x3A", - .ilen = 17, - .result = "\xFF\xC4\x2E\x82\x3D\xF8\xA8\x39" - "\x7C\x52\xC4\xD3\xBB\x62\xC6\xA8" - "\x0C", - .rlen = 17, - }, { /* Generated from TF test vectors */ - .key = "\x85\x62\x3F\x1C\xF9\xD6\x1C\xF9" - "\xD6\xB3\x90\x6D\x4A\x90\x6D\x4A", +/* Cast5 test vectors from RFC 2144 */ +#define CAST5_ENC_TEST_VECTORS 3 +#define CAST5_DEC_TEST_VECTORS 3 + +static struct cipher_testvec cast5_enc_tv_template[] = { + { + .key = "\x01\x23\x45\x67\x12\x34\x56\x78" + "\x23\x45\x67\x89\x34\x56\x78\x9a", .klen = 16, - .iv = "\xE2\x24\x89\xEE\x53\xB8\x1D\x5F", - .input = "\x56\xED\x84\x1B\x8F\x26\xBD\x31" - "\xC8\x5F\xF6\x6A\x01\x98\x0C\xA3" - "\x3A\xD1\x45\xDC\x73\x0A\x7E\x15" - "\xAC\x20\xB7\x4E\xE5\x59\xF0\x87" - "\x1E\x92\x29\xC0\x34\xCB\x62\xF9" - "\x6D\x04\x9B\x0F\xA6\x3D\xD4\x48" - "\xDF\x76\x0D\x81\x18\xAF\x23\xBA" - "\x51\xE8\x5C\xF3\x8A\x21\x95\x2C" - "\xC3\x37\xCE\x65\xFC\x70\x07\x9E" - "\x12\xA9\x40\xD7\x4B\xE2\x79\x10" - "\x84\x1B\xB2\x26\xBD\x54\xEB\x5F" - "\xF6\x8D\x01\x98\x2F\xC6\x3A\xD1" - "\x68\xFF\x73\x0A\xA1\x15\xAC\x43" - "\xDA\x4E\xE5\x7C\x13\x87\x1E\xB5" - "\x29\xC0\x57\xEE\x62\xF9\x90\x04" - "\x9B\x32\xC9\x3D\xD4\x6B\x02\x76" - "\x0D\xA4\x18\xAF\x46\xDD\x51\xE8" - "\x7F\x16\x8A\x21\xB8\x2C\xC3\x5A" - "\xF1\x65\xFC\x93\x07\x9E\x35\xCC" - "\x40\xD7\x6E\x05\x79\x10\xA7\x1B" - "\xB2\x49\xE0\x54\xEB\x82\x19\x8D" - "\x24\xBB\x2F\xC6\x5D\xF4\x68\xFF" - "\x96\x0A\xA1\x38\xCF\x43\xDA\x71" - "\x08\x7C\x13\xAA\x1E\xB5\x4C\xE3" - "\x57\xEE\x85\x1C\x90\x27\xBE\x32" - "\xC9\x60\xF7\x6B\x02\x99\x0D\xA4" - "\x3B\xD2\x46\xDD\x74\x0B\x7F\x16" - "\xAD\x21\xB8\x4F\xE6\x5A\xF1\x88" - "\x1F\x93\x2A\xC1\x35\xCC\x63\xFA" - "\x6E\x05\x9C\x10\xA7\x3E\xD5\x49" - "\xE0\x77\x0E\x82\x19\xB0\x24\xBB" - "\x52\xE9\x5D\xF4\x8B\x22\x96\x2D" - "\xC4\x38\xCF\x66\xFD\x71\x08\x9F" - "\x13\xAA\x41\xD8\x4C\xE3\x7A\x11" - "\x85\x1C\xB3\x27\xBE\x55\xEC\x60" - "\xF7\x8E\x02\x99\x30\xC7\x3B\xD2" - "\x69\x00\x74\x0B\xA2\x16\xAD\x44" - "\xDB\x4F\xE6\x7D\x14\x88\x1F\xB6" - "\x2A\xC1\x58\xEF\x63\xFA\x91\x05" - "\x9C\x33\xCA\x3E\xD5\x6C\x03\x77" - "\x0E\xA5\x19\xB0\x47\xDE\x52\xE9" - "\x80\x17\x8B\x22\xB9\x2D\xC4\x5B" - "\xF2\x66\xFD\x94\x08\x9F\x36\xCD" - "\x41\xD8\x6F\x06\x7A\x11\xA8\x1C" - "\xB3\x4A\xE1\x55\xEC\x83\x1A\x8E" - "\x25\xBC\x30\xC7\x5E\xF5\x69\x00" - "\x97\x0B\xA2\x39\xD0\x44\xDB\x72" - "\x09\x7D\x14\xAB\x1F\xB6\x4D\xE4" - "\x58\xEF\x86\x1D\x91\x28\xBF\x33" - "\xCA\x61\xF8\x6C\x03\x9A\x0E\xA5" - "\x3C\xD3\x47\xDE\x75\x0C\x80\x17" - "\xAE\x22\xB9\x50\xE7\x5B\xF2\x89" - "\x20\x94\x2B\xC2\x36\xCD\x64\xFB" - "\x6F\x06\x9D\x11\xA8\x3F\xD6\x4A" - "\xE1\x78\x0F\x83\x1A\xB1\x25\xBC" - "\x53\xEA\x5E\xF5\x8C\x00\x97\x2E" - "\xC5\x39\xD0\x67\xFE\x72\x09\xA0" - "\x14\xAB\x42\xD9\x4D\xE4\x7B\x12" - "\x86\x1D\xB4\x28\xBF\x56\xED\x61" - "\xF8\x8F\x03\x9A\x31\xC8\x3C\xD3" - "\x6A\x01\x75\x0C\xA3\x17\xAE\x45" - "\xDC\x50\xE7\x7E\x15\x89\x20\xB7", - .ilen = 496, - .result = "\xFF\xC4\x2E\x82\x3D\xF8\xA8\x39" - "\x7C\x52\xC4\xD3\xBB\x62\xC6\xA8" - "\x0C\x63\xA5\x55\xE3\xF8\x1C\x7F" - "\xDC\x59\xF9\xA0\x52\xAD\x83\xDF" - "\xD5\x3B\x53\x4A\xAA\x1F\x49\x44" - "\xE8\x20\xCC\xF8\x97\xE6\xE0\x3C" - "\x5A\xD2\x83\xEC\xEE\x25\x3F\xCF" - "\x0D\xC2\x79\x80\x99\x6E\xFF\x7B" - "\x64\xB0\x7B\x86\x29\x1D\x9F\x17" - "\x10\xA5\xA5\xEB\x16\x55\x9E\xE3" - "\x88\x18\x52\x56\x48\x58\xD1\x6B" - "\xE8\x74\x6E\x48\xB0\x2E\x69\x63" - "\x32\xAA\xAC\x26\x55\x45\x94\xDE" - "\x30\x26\x26\xE6\x08\x82\x2F\x5F" - "\xA7\x15\x94\x07\x75\x2D\xC6\x3A" - "\x1B\xA0\x39\xFB\xBA\xB9\x06\x56" - "\xF6\x9F\xF1\x2F\x9B\xF3\x89\x8B" - "\x08\xC8\x9D\x5E\x6B\x95\x09\xC7" - "\x98\xB7\x62\xA4\x1D\x25\xFA\xC5" - "\x62\xC8\x5D\x6B\xB4\x85\x88\x7F" - "\x3B\x29\xF9\xB4\x32\x62\x69\xBF" - "\x32\xB8\xEB\xFD\x0E\x26\xAA\xA3" - "\x44\x67\x90\x20\xAC\x41\xDF\x43" - "\xC6\xC7\x19\x9F\x2C\x28\x74\xEB" - "\x3E\x7F\x7A\x80\x5B\xE4\x08\x60" - "\xC7\xC9\x71\x34\x44\xCE\x05\xFD" - "\xA8\x91\xA8\x44\x5E\xD3\x89\x2C" - "\xAE\x59\x0F\x07\x88\x79\x53\x26" - "\xAF\xAC\xCB\x1D\x6F\x08\x25\x62" - "\xD0\x82\x65\x66\xE4\x2A\x29\x1C" - "\x9C\x64\x5F\x49\x9D\xF8\x62\xF9" - "\xED\xC4\x13\x52\x75\xDC\xE4\xF9" - "\x68\x0F\x8A\xCD\xA6\x8D\x75\xAA" - "\x49\xA1\x86\x86\x37\x5C\x6B\x3D" - "\x56\xE5\x6F\xBE\x27\xC0\x10\xF8" - "\x3C\x4D\x17\x35\x14\xDC\x1C\xA0" - "\x6E\xAE\xD1\x10\xDD\x83\x06\xC2" - "\x23\xD3\xC7\x27\x15\x04\x2C\x27" - "\xDD\x1F\x2E\x97\x09\x9C\x33\x7D" - "\xAC\x50\x1B\x2E\xC9\x52\x0C\x14" - "\x4B\x78\xC4\xDE\x07\x6A\x12\x02" - "\x6E\xD7\x4B\x91\xB9\x88\x4D\x02" - "\xC3\xB5\x04\xBC\xE0\x67\xCA\x18" - "\x22\xA1\xAE\x9A\x21\xEF\xB2\x06" - "\x35\xCD\xEC\x37\x70\x2D\xFC\x1E" - "\xA8\x31\xE7\xFC\xE5\x8E\x88\x66" - "\x16\xB5\xC8\x45\x21\x37\xBD\x24" - "\xA9\xD5\x36\x12\x9F\x6E\x67\x80" - "\x87\x54\xD5\xAF\x97\xE1\x15\xA7" - "\x11\xF0\x63\x7B\xE1\x44\x14\x1C" - "\x06\x32\x05\x8C\x6C\xDB\x9B\x36" - "\x6A\x6B\xAD\x3A\x27\x55\x20\x4C" - "\x76\x36\x43\xE8\x16\x60\xB5\xF3" - "\xDF\x5A\xC6\xA5\x69\x78\x59\x51" - "\x54\x68\x65\x06\x84\xDE\x3D\xAE" - "\x38\x91\xBD\xCC\xA2\x8A\xEC\xE6" - "\x9E\x83\xAE\x1E\x8E\x34\x5D\xDE" - "\x91\xCE\x8F\xED\x40\xF7\xC8\x8B" - "\x9A\x13\x4C\xAD\x89\x97\x9E\xD1" - "\x91\x01\xD7\x21\x23\x28\x1E\xCC" - "\x8C\x98\xDB\xDE\xFC\x72\x94\xAA" - "\xC0\x0D\x96\xAA\x23\xF8\xFE\x13", - .rlen = 496, - .also_non_np = 1, - .np = 2, - .tap = { 496 - 16, 16 }, + .input = "\x01\x23\x45\x67\x89\xab\xcd\xef", + .ilen = 8, + .result = "\x23\x8b\x4f\xe5\x84\x7e\x44\xb2", + .rlen = 8, + }, { + .key = "\x01\x23\x45\x67\x12\x34\x56\x78" + "\x23\x45", + .klen = 10, + .input = "\x01\x23\x45\x67\x89\xab\xcd\xef", + .ilen = 8, + .result = "\xeb\x6a\x71\x1a\x2c\x02\x27\x1b", + .rlen = 8, + }, { + .key = "\x01\x23\x45\x67\x12", + .klen = 5, + .input = "\x01\x23\x45\x67\x89\xab\xcd\xef", + .ilen = 8, + .result = "\x7a\xc8\x16\xd1\x6e\x9b\x30\x2e", + .rlen = 8, }, }; -static struct cipher_testvec cast5_ctr_dec_tv_template[] = { - { /* Generated from TF test vectors */ - .key = "\x85\x62\x3F\x1C\xF9\xD6\x1C\xF9" - "\xD6\xB3\x90\x6D\x4A\x90\x6D\x4A", - .klen = 16, - .iv = "\xE2\x24\x89\xEE\x53\xB8\x1D\x5F", - .input = "\xFF\xC4\x2E\x82\x3D\xF8\xA8\x39" - "\x7C\x52\xC4\xD3\xBB\x62\xC6\xA8" - "\x0C", - .ilen = 17, - .result = "\x56\xED\x84\x1B\x8F\x26\xBD\x31" - "\xC8\x5F\xF6\x6A\x01\x98\x0C\xA3" - "\x3A", - .rlen = 17, - }, { /* Generated from TF test vectors */ - .key = "\x85\x62\x3F\x1C\xF9\xD6\x1C\xF9" - "\xD6\xB3\x90\x6D\x4A\x90\x6D\x4A", +static struct cipher_testvec cast5_dec_tv_template[] = { + { + .key = "\x01\x23\x45\x67\x12\x34\x56\x78" + "\x23\x45\x67\x89\x34\x56\x78\x9a", .klen = 16, - .iv = "\xE2\x24\x89\xEE\x53\xB8\x1D\x5F", - .input = "\xFF\xC4\x2E\x82\x3D\xF8\xA8\x39" - "\x7C\x52\xC4\xD3\xBB\x62\xC6\xA8" - "\x0C\x63\xA5\x55\xE3\xF8\x1C\x7F" - "\xDC\x59\xF9\xA0\x52\xAD\x83\xDF" - "\xD5\x3B\x53\x4A\xAA\x1F\x49\x44" - "\xE8\x20\xCC\xF8\x97\xE6\xE0\x3C" - "\x5A\xD2\x83\xEC\xEE\x25\x3F\xCF" - "\x0D\xC2\x79\x80\x99\x6E\xFF\x7B" - "\x64\xB0\x7B\x86\x29\x1D\x9F\x17" - "\x10\xA5\xA5\xEB\x16\x55\x9E\xE3" - "\x88\x18\x52\x56\x48\x58\xD1\x6B" - "\xE8\x74\x6E\x48\xB0\x2E\x69\x63" - "\x32\xAA\xAC\x26\x55\x45\x94\xDE" - "\x30\x26\x26\xE6\x08\x82\x2F\x5F" - "\xA7\x15\x94\x07\x75\x2D\xC6\x3A" - "\x1B\xA0\x39\xFB\xBA\xB9\x06\x56" - "\xF6\x9F\xF1\x2F\x9B\xF3\x89\x8B" - "\x08\xC8\x9D\x5E\x6B\x95\x09\xC7" - "\x98\xB7\x62\xA4\x1D\x25\xFA\xC5" - "\x62\xC8\x5D\x6B\xB4\x85\x88\x7F" - "\x3B\x29\xF9\xB4\x32\x62\x69\xBF" - "\x32\xB8\xEB\xFD\x0E\x26\xAA\xA3" - "\x44\x67\x90\x20\xAC\x41\xDF\x43" - "\xC6\xC7\x19\x9F\x2C\x28\x74\xEB" - "\x3E\x7F\x7A\x80\x5B\xE4\x08\x60" - "\xC7\xC9\x71\x34\x44\xCE\x05\xFD" - "\xA8\x91\xA8\x44\x5E\xD3\x89\x2C" - "\xAE\x59\x0F\x07\x88\x79\x53\x26" - "\xAF\xAC\xCB\x1D\x6F\x08\x25\x62" - "\xD0\x82\x65\x66\xE4\x2A\x29\x1C" - "\x9C\x64\x5F\x49\x9D\xF8\x62\xF9" - "\xED\xC4\x13\x52\x75\xDC\xE4\xF9" - "\x68\x0F\x8A\xCD\xA6\x8D\x75\xAA" - "\x49\xA1\x86\x86\x37\x5C\x6B\x3D" - "\x56\xE5\x6F\xBE\x27\xC0\x10\xF8" - "\x3C\x4D\x17\x35\x14\xDC\x1C\xA0" - "\x6E\xAE\xD1\x10\xDD\x83\x06\xC2" - "\x23\xD3\xC7\x27\x15\x04\x2C\x27" - "\xDD\x1F\x2E\x97\x09\x9C\x33\x7D" - "\xAC\x50\x1B\x2E\xC9\x52\x0C\x14" - "\x4B\x78\xC4\xDE\x07\x6A\x12\x02" - "\x6E\xD7\x4B\x91\xB9\x88\x4D\x02" - "\xC3\xB5\x04\xBC\xE0\x67\xCA\x18" - "\x22\xA1\xAE\x9A\x21\xEF\xB2\x06" - "\x35\xCD\xEC\x37\x70\x2D\xFC\x1E" - "\xA8\x31\xE7\xFC\xE5\x8E\x88\x66" - "\x16\xB5\xC8\x45\x21\x37\xBD\x24" - "\xA9\xD5\x36\x12\x9F\x6E\x67\x80" - "\x87\x54\xD5\xAF\x97\xE1\x15\xA7" - "\x11\xF0\x63\x7B\xE1\x44\x14\x1C" - "\x06\x32\x05\x8C\x6C\xDB\x9B\x36" - "\x6A\x6B\xAD\x3A\x27\x55\x20\x4C" - "\x76\x36\x43\xE8\x16\x60\xB5\xF3" - "\xDF\x5A\xC6\xA5\x69\x78\x59\x51" - "\x54\x68\x65\x06\x84\xDE\x3D\xAE" - "\x38\x91\xBD\xCC\xA2\x8A\xEC\xE6" - "\x9E\x83\xAE\x1E\x8E\x34\x5D\xDE" - "\x91\xCE\x8F\xED\x40\xF7\xC8\x8B" - "\x9A\x13\x4C\xAD\x89\x97\x9E\xD1" - "\x91\x01\xD7\x21\x23\x28\x1E\xCC" - "\x8C\x98\xDB\xDE\xFC\x72\x94\xAA" - "\xC0\x0D\x96\xAA\x23\xF8\xFE\x13", - .ilen = 496, - .result = "\x56\xED\x84\x1B\x8F\x26\xBD\x31" - "\xC8\x5F\xF6\x6A\x01\x98\x0C\xA3" - "\x3A\xD1\x45\xDC\x73\x0A\x7E\x15" - "\xAC\x20\xB7\x4E\xE5\x59\xF0\x87" - "\x1E\x92\x29\xC0\x34\xCB\x62\xF9" - "\x6D\x04\x9B\x0F\xA6\x3D\xD4\x48" - "\xDF\x76\x0D\x81\x18\xAF\x23\xBA" - "\x51\xE8\x5C\xF3\x8A\x21\x95\x2C" - "\xC3\x37\xCE\x65\xFC\x70\x07\x9E" - "\x12\xA9\x40\xD7\x4B\xE2\x79\x10" - "\x84\x1B\xB2\x26\xBD\x54\xEB\x5F" - "\xF6\x8D\x01\x98\x2F\xC6\x3A\xD1" - "\x68\xFF\x73\x0A\xA1\x15\xAC\x43" - "\xDA\x4E\xE5\x7C\x13\x87\x1E\xB5" - "\x29\xC0\x57\xEE\x62\xF9\x90\x04" - "\x9B\x32\xC9\x3D\xD4\x6B\x02\x76" - "\x0D\xA4\x18\xAF\x46\xDD\x51\xE8" - "\x7F\x16\x8A\x21\xB8\x2C\xC3\x5A" - "\xF1\x65\xFC\x93\x07\x9E\x35\xCC" - "\x40\xD7\x6E\x05\x79\x10\xA7\x1B" - "\xB2\x49\xE0\x54\xEB\x82\x19\x8D" - "\x24\xBB\x2F\xC6\x5D\xF4\x68\xFF" - "\x96\x0A\xA1\x38\xCF\x43\xDA\x71" - "\x08\x7C\x13\xAA\x1E\xB5\x4C\xE3" - "\x57\xEE\x85\x1C\x90\x27\xBE\x32" - "\xC9\x60\xF7\x6B\x02\x99\x0D\xA4" - "\x3B\xD2\x46\xDD\x74\x0B\x7F\x16" - "\xAD\x21\xB8\x4F\xE6\x5A\xF1\x88" - "\x1F\x93\x2A\xC1\x35\xCC\x63\xFA" - "\x6E\x05\x9C\x10\xA7\x3E\xD5\x49" - "\xE0\x77\x0E\x82\x19\xB0\x24\xBB" - "\x52\xE9\x5D\xF4\x8B\x22\x96\x2D" - "\xC4\x38\xCF\x66\xFD\x71\x08\x9F" - "\x13\xAA\x41\xD8\x4C\xE3\x7A\x11" - "\x85\x1C\xB3\x27\xBE\x55\xEC\x60" - "\xF7\x8E\x02\x99\x30\xC7\x3B\xD2" - "\x69\x00\x74\x0B\xA2\x16\xAD\x44" - "\xDB\x4F\xE6\x7D\x14\x88\x1F\xB6" - "\x2A\xC1\x58\xEF\x63\xFA\x91\x05" - "\x9C\x33\xCA\x3E\xD5\x6C\x03\x77" - "\x0E\xA5\x19\xB0\x47\xDE\x52\xE9" - "\x80\x17\x8B\x22\xB9\x2D\xC4\x5B" - "\xF2\x66\xFD\x94\x08\x9F\x36\xCD" - "\x41\xD8\x6F\x06\x7A\x11\xA8\x1C" - "\xB3\x4A\xE1\x55\xEC\x83\x1A\x8E" - "\x25\xBC\x30\xC7\x5E\xF5\x69\x00" - "\x97\x0B\xA2\x39\xD0\x44\xDB\x72" - "\x09\x7D\x14\xAB\x1F\xB6\x4D\xE4" - "\x58\xEF\x86\x1D\x91\x28\xBF\x33" - "\xCA\x61\xF8\x6C\x03\x9A\x0E\xA5" - "\x3C\xD3\x47\xDE\x75\x0C\x80\x17" - "\xAE\x22\xB9\x50\xE7\x5B\xF2\x89" - "\x20\x94\x2B\xC2\x36\xCD\x64\xFB" - "\x6F\x06\x9D\x11\xA8\x3F\xD6\x4A" - "\xE1\x78\x0F\x83\x1A\xB1\x25\xBC" - "\x53\xEA\x5E\xF5\x8C\x00\x97\x2E" - "\xC5\x39\xD0\x67\xFE\x72\x09\xA0" - "\x14\xAB\x42\xD9\x4D\xE4\x7B\x12" - "\x86\x1D\xB4\x28\xBF\x56\xED\x61" - "\xF8\x8F\x03\x9A\x31\xC8\x3C\xD3" - "\x6A\x01\x75\x0C\xA3\x17\xAE\x45" - "\xDC\x50\xE7\x7E\x15\x89\x20\xB7", - .rlen = 496, - .also_non_np = 1, - .np = 2, - .tap = { 496 - 16, 16 }, + .input = "\x23\x8b\x4f\xe5\x84\x7e\x44\xb2", + .ilen = 8, + .result = "\x01\x23\x45\x67\x89\xab\xcd\xef", + .rlen = 8, + }, { + .key = "\x01\x23\x45\x67\x12\x34\x56\x78" + "\x23\x45", + .klen = 10, + .input = "\xeb\x6a\x71\x1a\x2c\x02\x27\x1b", + .ilen = 8, + .result = "\x01\x23\x45\x67\x89\xab\xcd\xef", + .rlen = 8, + }, { + .key = "\x01\x23\x45\x67\x12", + .klen = 5, + .input = "\x7a\xc8\x16\xd1\x6e\x9b\x30\x2e", + .ilen = 8, + .result = "\x01\x23\x45\x67\x89\xab\xcd\xef", + .rlen = 8, }, }; @@ -16312,9 +13096,6 @@ static struct cipher_testvec camellia_enc_tv_template[] = { "\x0D\xD0\xFD\xC4\x65\xA5\x69\xB9" "\xF1\xF6\xB1\xA5\xB2\x75\x4F\x8A", .rlen = 48, - .also_non_np = 1, - .np = 2, - .tap = { 48 - 16, 16 }, }, }; @@ -16373,9 +13154,6 @@ static struct cipher_testvec camellia_dec_tv_template[] = { "\x1E\x92\x29\xC0\x34\xCB\x62\xF9" "\x6D\x04\x9B\x0F\xA6\x3D\xD4\x48", .rlen = 48, - .also_non_np = 1, - .np = 2, - .tap = { 48 - 16, 16 }, }, }; @@ -16430,9 +13208,6 @@ static struct cipher_testvec camellia_cbc_enc_tv_template[] = { "\xB9\xF9\xC2\x27\x6A\xB6\x31\x27" "\xA6\xAD\xEF\xE5\x5D\xE4\x02\x01", .rlen = 48, - .also_non_np = 1, - .np = 2, - .tap = { 48 - 16, 16 }, }, }; @@ -16487,9 +13262,6 @@ static struct cipher_testvec camellia_cbc_dec_tv_template[] = { "\x1E\x92\x29\xC0\x34\xCB\x62\xF9" "\x6D\x04\x9B\x0F\xA6\x3D\xD4\x48", .rlen = 48, - .also_non_np = 1, - .np = 2, - .tap = { 48 - 16, 16 }, }, }; @@ -16541,143 +13313,6 @@ static struct cipher_testvec camellia_ctr_enc_tv_template[] = { "\x60\xFC\xE8\x94\xE8\xB5\x09\x2C" "\x1E\x43\xEF", .rlen = 51, - .also_non_np = 1, - .np = 2, - .tap = { 51 - 16, 16 }, - }, { /* Generated with Crypto++ */ - .key = "\x85\x62\x3F\x1C\xF9\xD6\x1C\xF9" - "\xD6\xB3\x90\x6D\x4A\x90\x6D\x4A" - "\x27\x04\xE1\x27\x04\xE1\xBE\x9B" - "\x78\xBE\x9B\x78\x55\x32\x0F\x55", - .klen = 32, - .iv = "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF" - "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFD", - .input = "\x56\xED\x84\x1B\x8F\x26\xBD\x31" - "\xC8\x5F\xF6\x6A\x01\x98\x0C\xA3" - "\x3A\xD1\x45\xDC\x73\x0A\x7E\x15" - "\xAC\x20\xB7\x4E\xE5\x59\xF0\x87" - "\x1E\x92\x29\xC0\x34\xCB\x62\xF9" - "\x6D\x04\x9B\x0F\xA6\x3D\xD4\x48" - "\xDF\x76\x0D\x81\x18\xAF\x23\xBA" - "\x51\xE8\x5C\xF3\x8A\x21\x95\x2C" - "\xC3\x37\xCE\x65\xFC\x70\x07\x9E" - "\x12\xA9\x40\xD7\x4B\xE2\x79\x10" - "\x84\x1B\xB2\x26\xBD\x54\xEB\x5F" - "\xF6\x8D\x01\x98\x2F\xC6\x3A\xD1" - "\x68\xFF\x73\x0A\xA1\x15\xAC\x43" - "\xDA\x4E\xE5\x7C\x13\x87\x1E\xB5" - "\x29\xC0\x57\xEE\x62\xF9\x90\x04" - "\x9B\x32\xC9\x3D\xD4\x6B\x02\x76" - "\x0D\xA4\x18\xAF\x46\xDD\x51\xE8" - "\x7F\x16\x8A\x21\xB8\x2C\xC3\x5A" - "\xF1\x65\xFC\x93\x07\x9E\x35\xCC" - "\x40\xD7\x6E\x05\x79\x10\xA7\x1B" - "\xB2\x49\xE0\x54\xEB\x82\x19\x8D" - "\x24\xBB\x2F\xC6\x5D\xF4\x68\xFF" - "\x96\x0A\xA1\x38\xCF\x43\xDA\x71" - "\x08\x7C\x13\xAA\x1E\xB5\x4C\xE3" - "\x57\xEE\x85\x1C\x90\x27\xBE\x32" - "\xC9\x60\xF7\x6B\x02\x99\x0D\xA4" - "\x3B\xD2\x46\xDD\x74\x0B\x7F\x16" - "\xAD\x21\xB8\x4F\xE6\x5A\xF1\x88" - "\x1F\x93\x2A\xC1\x35\xCC\x63\xFA" - "\x6E\x05\x9C\x10\xA7\x3E\xD5\x49" - "\xE0\x77\x0E\x82\x19\xB0\x24\xBB" - "\x52\xE9\x5D\xF4\x8B\x22\x96\x2D" - "\xC4\x38\xCF\x66\xFD\x71\x08\x9F" - "\x13\xAA\x41\xD8\x4C\xE3\x7A\x11" - "\x85\x1C\xB3\x27\xBE\x55\xEC\x60" - "\xF7\x8E\x02\x99\x30\xC7\x3B\xD2" - "\x69\x00\x74\x0B\xA2\x16\xAD\x44" - "\xDB\x4F\xE6\x7D\x14\x88\x1F\xB6" - "\x2A\xC1\x58\xEF\x63\xFA\x91\x05" - "\x9C\x33\xCA\x3E\xD5\x6C\x03\x77" - "\x0E\xA5\x19\xB0\x47\xDE\x52\xE9" - "\x80\x17\x8B\x22\xB9\x2D\xC4\x5B" - "\xF2\x66\xFD\x94\x08\x9F\x36\xCD" - "\x41\xD8\x6F\x06\x7A\x11\xA8\x1C" - "\xB3\x4A\xE1\x55\xEC\x83\x1A\x8E" - "\x25\xBC\x30\xC7\x5E\xF5\x69\x00" - "\x97\x0B\xA2\x39\xD0\x44\xDB\x72" - "\x09\x7D\x14\xAB\x1F\xB6\x4D\xE4" - "\x58\xEF\x86\x1D\x91\x28\xBF\x33" - "\xCA\x61\xF8\x6C\x03\x9A\x0E\xA5" - "\x3C\xD3\x47\xDE\x75\x0C\x80\x17" - "\xAE\x22\xB9\x50\xE7\x5B\xF2\x89" - "\x20\x94\x2B\xC2\x36\xCD\x64\xFB" - "\x6F\x06\x9D\x11\xA8\x3F\xD6\x4A" - "\xE1\x78\x0F\x83\x1A\xB1\x25\xBC" - "\x53\xEA\x5E\xF5\x8C\x00\x97\x2E" - "\xC5\x39\xD0\x67\xFE\x72\x09\xA0" - "\x14\xAB\x42\xD9\x4D\xE4\x7B\x12" - "\x86\x1D\xB4\x28\xBF\x56\xED\x61" - "\xF8\x8F\x03\x9A\x31\xC8\x3C\xD3" - "\x6A\x01\x75\x0C\xA3\x17\xAE\x45" - "\xDC\x50\xE7\x7E\x15\x89\x20\xB7", - .ilen = 496, - .result = "\x85\x79\x6C\x8B\x2B\x6D\x14\xF9" - "\xA6\x83\xB6\x80\x5B\x3A\xF3\x7E" - "\x30\x29\xEB\x1F\xDC\x19\x5F\xEB" - "\xF7\xC4\x27\x04\x51\x87\xD7\x6F" - "\xB8\x4E\x07\xFB\xAC\x3B\x08\xB4" - "\x4D\xCB\xE8\xE1\x71\x7D\x4F\x48" - "\xCD\x81\x64\xA5\xC4\x07\x1A\x9A" - "\x4B\x62\x90\x0E\xC8\xB3\x2B\x6B" - "\x8F\x9C\x6E\x72\x4B\xBA\xEF\x07" - "\x2C\x56\x07\x5E\x37\x30\x60\xA9" - "\xE3\xEF\xD6\x69\xE1\xA1\x77\x64" - "\x93\x75\x7A\xB7\x7A\x3B\xE9\x43" - "\x23\x35\x95\x91\x80\x8A\xC7\xCF" - "\xC3\xD5\xBF\xE7\xFE\x4C\x06\x6B" - "\x05\x19\x48\xE2\x62\xBA\x4F\xF2" - "\xFB\xEE\xE4\xCB\x79\x9D\xA3\x10" - "\x1D\x29\x8C\x1D\x7A\x88\x5A\xDD" - "\x4E\xB6\x18\xAA\xCD\xE6\x33\x96" - "\xD9\x0F\x90\x5A\x78\x76\x4D\x77" - "\x3C\x20\x89\x3B\xA3\xF9\x07\xFD" - "\xE4\xE8\x20\x2D\x15\x0A\x63\x49" - "\xF5\x4F\x89\xD8\xDE\xA1\x28\x78" - "\x28\x07\x09\x1B\x03\x94\x1D\x4B" - "\x82\x28\x1E\x1D\x95\xBA\xAC\x85" - "\x71\x6E\x3C\x18\x4B\x77\x74\x79" - "\xBF\x67\x0A\x53\x3C\x94\xD9\x60" - "\xE9\x6D\x40\x34\xA0\x2A\x53\x5D" - "\x27\xD5\x47\xF9\xC3\x4B\x27\x29" - "\xE4\x76\x9C\x3F\xA7\x1C\x87\xFC" - "\x6E\x0F\xCF\x9B\x60\xF0\xF0\x8B" - "\x70\x1C\x84\x81\x72\x4D\xB4\x98" - "\x23\x62\xE7\x6A\x2B\xFC\xA5\xB2" - "\xFF\xF5\x71\x07\xCD\x90\x23\x13" - "\x19\xD7\x79\x36\x6C\x9D\x55\x8B" - "\x93\x78\x86\x05\x69\x46\xD0\xC5" - "\x39\x09\xEB\x79\xEF\xFA\x9F\xAE" - "\xF3\xD5\x44\xC3\xFD\x86\xD2\x7C" - "\x83\x4B\xD8\x75\x9C\x18\x04\x7B" - "\x73\xAD\x72\xA4\xF6\xAB\xCF\x4B" - "\xCC\x01\x45\x90\xA6\x43\x05\x0C" - "\x6C\x4F\x62\x77\x57\x97\x9F\xEE" - "\x75\xA7\x3C\x38\xD1\x0F\x3D\x0E" - "\x2C\x43\x98\xFB\x13\x65\x73\xE4" - "\x3C\x1E\xD6\x90\x08\xF7\xE0\x99" - "\x3B\xF1\x9D\x6C\x48\xA9\x0E\x32" - "\x17\xC2\xCC\x20\xA1\x19\x26\xAA" - "\xE0\x75\x2F\xFB\x54\x66\x0A\xDF" - "\xB5\xF2\x1F\xC1\x34\x3C\x30\x56" - "\xE8\xDC\xF7\x92\x6B\xBF\x17\x24" - "\xEC\x94\xB5\x3B\xD6\xCE\xA2\x54" - "\x10\x7F\x50\xDE\x69\x77\xD5\x37" - "\xFE\x9C\x10\x83\xC5\xEB\xC9\x53" - "\xB7\xF3\xC4\x20\xAF\x0A\x7E\x57" - "\x3A\xE6\x75\xFE\x89\x00\x6E\x48" - "\xFB\x99\x17\x2C\xF6\x64\x40\x95" - "\x5E\xDC\x7A\xA6\x70\xC7\xF4\xDD" - "\x52\x05\x24\x34\xF9\x0E\xC8\x64" - "\x6D\xE2\xD8\x80\x53\x31\x4C\xFE" - "\xB4\x3A\x5F\x19\xCF\x42\x1B\x22" - "\x0B\x2D\x7B\xF1\xC5\x43\xF7\x5E" - "\x12\xA8\x01\x64\x16\x0B\x26\x5A" - "\x0C\x95\x0F\x40\xC5\x5A\x06\x7C", - .rlen = 496, }, }; @@ -16729,144 +13364,8 @@ static struct cipher_testvec camellia_ctr_dec_tv_template[] = { "\x6D\x04\x9B\x0F\xA6\x3D\xD4\x48" "\xDF\x76\x0D", .rlen = 51, - .also_non_np = 1, - .np = 2, - .tap = { 51 - 16, 16 }, - }, { /* Generated with Crypto++ */ - .key = "\x85\x62\x3F\x1C\xF9\xD6\x1C\xF9" - "\xD6\xB3\x90\x6D\x4A\x90\x6D\x4A" - "\x27\x04\xE1\x27\x04\xE1\xBE\x9B" - "\x78\xBE\x9B\x78\x55\x32\x0F\x55", - .klen = 32, - .iv = "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF" - "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFD", - .input = "\x85\x79\x6C\x8B\x2B\x6D\x14\xF9" - "\xA6\x83\xB6\x80\x5B\x3A\xF3\x7E" - "\x30\x29\xEB\x1F\xDC\x19\x5F\xEB" - "\xF7\xC4\x27\x04\x51\x87\xD7\x6F" - "\xB8\x4E\x07\xFB\xAC\x3B\x08\xB4" - "\x4D\xCB\xE8\xE1\x71\x7D\x4F\x48" - "\xCD\x81\x64\xA5\xC4\x07\x1A\x9A" - "\x4B\x62\x90\x0E\xC8\xB3\x2B\x6B" - "\x8F\x9C\x6E\x72\x4B\xBA\xEF\x07" - "\x2C\x56\x07\x5E\x37\x30\x60\xA9" - "\xE3\xEF\xD6\x69\xE1\xA1\x77\x64" - "\x93\x75\x7A\xB7\x7A\x3B\xE9\x43" - "\x23\x35\x95\x91\x80\x8A\xC7\xCF" - "\xC3\xD5\xBF\xE7\xFE\x4C\x06\x6B" - "\x05\x19\x48\xE2\x62\xBA\x4F\xF2" - "\xFB\xEE\xE4\xCB\x79\x9D\xA3\x10" - "\x1D\x29\x8C\x1D\x7A\x88\x5A\xDD" - "\x4E\xB6\x18\xAA\xCD\xE6\x33\x96" - "\xD9\x0F\x90\x5A\x78\x76\x4D\x77" - "\x3C\x20\x89\x3B\xA3\xF9\x07\xFD" - "\xE4\xE8\x20\x2D\x15\x0A\x63\x49" - "\xF5\x4F\x89\xD8\xDE\xA1\x28\x78" - "\x28\x07\x09\x1B\x03\x94\x1D\x4B" - "\x82\x28\x1E\x1D\x95\xBA\xAC\x85" - "\x71\x6E\x3C\x18\x4B\x77\x74\x79" - "\xBF\x67\x0A\x53\x3C\x94\xD9\x60" - "\xE9\x6D\x40\x34\xA0\x2A\x53\x5D" - "\x27\xD5\x47\xF9\xC3\x4B\x27\x29" - "\xE4\x76\x9C\x3F\xA7\x1C\x87\xFC" - "\x6E\x0F\xCF\x9B\x60\xF0\xF0\x8B" - "\x70\x1C\x84\x81\x72\x4D\xB4\x98" - "\x23\x62\xE7\x6A\x2B\xFC\xA5\xB2" - "\xFF\xF5\x71\x07\xCD\x90\x23\x13" - "\x19\xD7\x79\x36\x6C\x9D\x55\x8B" - "\x93\x78\x86\x05\x69\x46\xD0\xC5" - "\x39\x09\xEB\x79\xEF\xFA\x9F\xAE" - "\xF3\xD5\x44\xC3\xFD\x86\xD2\x7C" - "\x83\x4B\xD8\x75\x9C\x18\x04\x7B" - "\x73\xAD\x72\xA4\xF6\xAB\xCF\x4B" - "\xCC\x01\x45\x90\xA6\x43\x05\x0C" - "\x6C\x4F\x62\x77\x57\x97\x9F\xEE" - "\x75\xA7\x3C\x38\xD1\x0F\x3D\x0E" - "\x2C\x43\x98\xFB\x13\x65\x73\xE4" - "\x3C\x1E\xD6\x90\x08\xF7\xE0\x99" - "\x3B\xF1\x9D\x6C\x48\xA9\x0E\x32" - "\x17\xC2\xCC\x20\xA1\x19\x26\xAA" - "\xE0\x75\x2F\xFB\x54\x66\x0A\xDF" - "\xB5\xF2\x1F\xC1\x34\x3C\x30\x56" - "\xE8\xDC\xF7\x92\x6B\xBF\x17\x24" - "\xEC\x94\xB5\x3B\xD6\xCE\xA2\x54" - "\x10\x7F\x50\xDE\x69\x77\xD5\x37" - "\xFE\x9C\x10\x83\xC5\xEB\xC9\x53" - "\xB7\xF3\xC4\x20\xAF\x0A\x7E\x57" - "\x3A\xE6\x75\xFE\x89\x00\x6E\x48" - "\xFB\x99\x17\x2C\xF6\x64\x40\x95" - "\x5E\xDC\x7A\xA6\x70\xC7\xF4\xDD" - "\x52\x05\x24\x34\xF9\x0E\xC8\x64" - "\x6D\xE2\xD8\x80\x53\x31\x4C\xFE" - "\xB4\x3A\x5F\x19\xCF\x42\x1B\x22" - "\x0B\x2D\x7B\xF1\xC5\x43\xF7\x5E" - "\x12\xA8\x01\x64\x16\x0B\x26\x5A" - "\x0C\x95\x0F\x40\xC5\x5A\x06\x7C", - .ilen = 496, - .result = "\x56\xED\x84\x1B\x8F\x26\xBD\x31" - "\xC8\x5F\xF6\x6A\x01\x98\x0C\xA3" - "\x3A\xD1\x45\xDC\x73\x0A\x7E\x15" - "\xAC\x20\xB7\x4E\xE5\x59\xF0\x87" - "\x1E\x92\x29\xC0\x34\xCB\x62\xF9" - "\x6D\x04\x9B\x0F\xA6\x3D\xD4\x48" - "\xDF\x76\x0D\x81\x18\xAF\x23\xBA" - "\x51\xE8\x5C\xF3\x8A\x21\x95\x2C" - "\xC3\x37\xCE\x65\xFC\x70\x07\x9E" - "\x12\xA9\x40\xD7\x4B\xE2\x79\x10" - "\x84\x1B\xB2\x26\xBD\x54\xEB\x5F" - "\xF6\x8D\x01\x98\x2F\xC6\x3A\xD1" - "\x68\xFF\x73\x0A\xA1\x15\xAC\x43" - "\xDA\x4E\xE5\x7C\x13\x87\x1E\xB5" - "\x29\xC0\x57\xEE\x62\xF9\x90\x04" - "\x9B\x32\xC9\x3D\xD4\x6B\x02\x76" - "\x0D\xA4\x18\xAF\x46\xDD\x51\xE8" - "\x7F\x16\x8A\x21\xB8\x2C\xC3\x5A" - "\xF1\x65\xFC\x93\x07\x9E\x35\xCC" - "\x40\xD7\x6E\x05\x79\x10\xA7\x1B" - "\xB2\x49\xE0\x54\xEB\x82\x19\x8D" - "\x24\xBB\x2F\xC6\x5D\xF4\x68\xFF" - "\x96\x0A\xA1\x38\xCF\x43\xDA\x71" - "\x08\x7C\x13\xAA\x1E\xB5\x4C\xE3" - "\x57\xEE\x85\x1C\x90\x27\xBE\x32" - "\xC9\x60\xF7\x6B\x02\x99\x0D\xA4" - "\x3B\xD2\x46\xDD\x74\x0B\x7F\x16" - "\xAD\x21\xB8\x4F\xE6\x5A\xF1\x88" - "\x1F\x93\x2A\xC1\x35\xCC\x63\xFA" - "\x6E\x05\x9C\x10\xA7\x3E\xD5\x49" - "\xE0\x77\x0E\x82\x19\xB0\x24\xBB" - "\x52\xE9\x5D\xF4\x8B\x22\x96\x2D" - "\xC4\x38\xCF\x66\xFD\x71\x08\x9F" - "\x13\xAA\x41\xD8\x4C\xE3\x7A\x11" - "\x85\x1C\xB3\x27\xBE\x55\xEC\x60" - "\xF7\x8E\x02\x99\x30\xC7\x3B\xD2" - "\x69\x00\x74\x0B\xA2\x16\xAD\x44" - "\xDB\x4F\xE6\x7D\x14\x88\x1F\xB6" - "\x2A\xC1\x58\xEF\x63\xFA\x91\x05" - "\x9C\x33\xCA\x3E\xD5\x6C\x03\x77" - "\x0E\xA5\x19\xB0\x47\xDE\x52\xE9" - "\x80\x17\x8B\x22\xB9\x2D\xC4\x5B" - "\xF2\x66\xFD\x94\x08\x9F\x36\xCD" - "\x41\xD8\x6F\x06\x7A\x11\xA8\x1C" - "\xB3\x4A\xE1\x55\xEC\x83\x1A\x8E" - "\x25\xBC\x30\xC7\x5E\xF5\x69\x00" - "\x97\x0B\xA2\x39\xD0\x44\xDB\x72" - "\x09\x7D\x14\xAB\x1F\xB6\x4D\xE4" - "\x58\xEF\x86\x1D\x91\x28\xBF\x33" - "\xCA\x61\xF8\x6C\x03\x9A\x0E\xA5" - "\x3C\xD3\x47\xDE\x75\x0C\x80\x17" - "\xAE\x22\xB9\x50\xE7\x5B\xF2\x89" - "\x20\x94\x2B\xC2\x36\xCD\x64\xFB" - "\x6F\x06\x9D\x11\xA8\x3F\xD6\x4A" - "\xE1\x78\x0F\x83\x1A\xB1\x25\xBC" - "\x53\xEA\x5E\xF5\x8C\x00\x97\x2E" - "\xC5\x39\xD0\x67\xFE\x72\x09\xA0" - "\x14\xAB\x42\xD9\x4D\xE4\x7B\x12" - "\x86\x1D\xB4\x28\xBF\x56\xED\x61" - "\xF8\x8F\x03\x9A\x31\xC8\x3C\xD3" - "\x6A\x01\x75\x0C\xA3\x17\xAE\x45" - "\xDC\x50\xE7\x7E\x15\x89\x20\xB7", - .rlen = 496, }, + }; static struct cipher_testvec camellia_lrw_enc_tv_template[] = { @@ -17115,9 +13614,6 @@ static struct cipher_testvec camellia_lrw_enc_tv_template[] = { "\xb2\x1a\xd8\x4c\xbd\x1d\x10\xe9" "\x5a\xa8\x92\x7f\xba\xe6\x0c\x95", .rlen = 512, - .also_non_np = 1, - .np = 2, - .tap = { 512 - 16, 16 }, }, }; @@ -17368,9 +13864,6 @@ static struct cipher_testvec camellia_lrw_dec_tv_template[] = { "\xe9\x2e\xc4\x29\x0f\x84\xdb\xc4" "\x21\xc4\xc2\x75\x67\x89\x37\x0a", .rlen = 512, - .also_non_np = 1, - .np = 2, - .tap = { 512 - 16, 16 }, }, }; @@ -17710,9 +14203,6 @@ static struct cipher_testvec camellia_xts_enc_tv_template[] = { "\xb7\x16\xd8\x12\x5c\xcd\x7d\x4e" "\xd5\xc6\x99\xcc\x4e\x6c\x94\x95", .rlen = 512, - .also_non_np = 1, - .np = 2, - .tap = { 512 - 16, 16 }, }, }; @@ -18053,9 +14543,6 @@ static struct cipher_testvec camellia_xts_dec_tv_template[] = { "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7" "\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff", .rlen = 512, - .also_non_np = 1, - .np = 2, - .tap = { 512 - 16, 16 }, }, }; diff --git a/trunk/crypto/tgr192.c b/trunk/crypto/tgr192.c index 87403556fd0b..cbca4f208c9f 100644 --- a/trunk/crypto/tgr192.c +++ b/trunk/crypto/tgr192.c @@ -628,7 +628,7 @@ static int tgr128_final(struct shash_desc *desc, u8 * out) return 0; } -static struct shash_alg tgr_algs[3] = { { +static struct shash_alg tgr192 = { .digestsize = TGR192_DIGEST_SIZE, .init = tgr192_init, .update = tgr192_update, @@ -640,7 +640,9 @@ static struct shash_alg tgr_algs[3] = { { .cra_blocksize = TGR192_BLOCK_SIZE, .cra_module = THIS_MODULE, } -}, { +}; + +static struct shash_alg tgr160 = { .digestsize = TGR160_DIGEST_SIZE, .init = tgr192_init, .update = tgr192_update, @@ -652,7 +654,9 @@ static struct shash_alg tgr_algs[3] = { { .cra_blocksize = TGR192_BLOCK_SIZE, .cra_module = THIS_MODULE, } -}, { +}; + +static struct shash_alg tgr128 = { .digestsize = TGR128_DIGEST_SIZE, .init = tgr192_init, .update = tgr192_update, @@ -664,16 +668,38 @@ static struct shash_alg tgr_algs[3] = { { .cra_blocksize = TGR192_BLOCK_SIZE, .cra_module = THIS_MODULE, } -} }; +}; static int __init tgr192_mod_init(void) { - return crypto_register_shashes(tgr_algs, ARRAY_SIZE(tgr_algs)); + int ret = 0; + + ret = crypto_register_shash(&tgr192); + + if (ret < 0) { + goto out; + } + + ret = crypto_register_shash(&tgr160); + if (ret < 0) { + crypto_unregister_shash(&tgr192); + goto out; + } + + ret = crypto_register_shash(&tgr128); + if (ret < 0) { + crypto_unregister_shash(&tgr192); + crypto_unregister_shash(&tgr160); + } + out: + return ret; } static void __exit tgr192_mod_fini(void) { - crypto_unregister_shashes(tgr_algs, ARRAY_SIZE(tgr_algs)); + crypto_unregister_shash(&tgr192); + crypto_unregister_shash(&tgr160); + crypto_unregister_shash(&tgr128); } MODULE_ALIAS("tgr160"); diff --git a/trunk/crypto/twofish_generic.c b/trunk/crypto/twofish_generic.c index 2d5000552d0f..1f07b843e07c 100644 --- a/trunk/crypto/twofish_generic.c +++ b/trunk/crypto/twofish_generic.c @@ -188,6 +188,7 @@ static struct crypto_alg alg = { .cra_ctxsize = sizeof(struct twofish_ctx), .cra_alignmask = 3, .cra_module = THIS_MODULE, + .cra_list = LIST_HEAD_INIT(alg.cra_list), .cra_u = { .cipher = { .cia_min_keysize = TF_MIN_KEY_SIZE, .cia_max_keysize = TF_MAX_KEY_SIZE, diff --git a/trunk/crypto/vmac.c b/trunk/crypto/vmac.c index f2338ca98368..4243905ba135 100644 --- a/trunk/crypto/vmac.c +++ b/trunk/crypto/vmac.c @@ -38,11 +38,11 @@ * Constants and masks */ #define UINT64_C(x) x##ULL -static const u64 p64 = UINT64_C(0xfffffffffffffeff); /* 2^64 - 257 prime */ -static const u64 m62 = UINT64_C(0x3fffffffffffffff); /* 62-bit mask */ -static const u64 m63 = UINT64_C(0x7fffffffffffffff); /* 63-bit mask */ -static const u64 m64 = UINT64_C(0xffffffffffffffff); /* 64-bit mask */ -static const u64 mpoly = UINT64_C(0x1fffffff1fffffff); /* Poly key mask */ +const u64 p64 = UINT64_C(0xfffffffffffffeff); /* 2^64 - 257 prime */ +const u64 m62 = UINT64_C(0x3fffffffffffffff); /* 62-bit mask */ +const u64 m63 = UINT64_C(0x7fffffffffffffff); /* 63-bit mask */ +const u64 m64 = UINT64_C(0xffffffffffffffff); /* 64-bit mask */ +const u64 mpoly = UINT64_C(0x1fffffff1fffffff); /* Poly key mask */ #define pe64_to_cpup le64_to_cpup /* Prefer little endian */ diff --git a/trunk/crypto/wp512.c b/trunk/crypto/wp512.c index 180f1d6e03f4..71719a2be25a 100644 --- a/trunk/crypto/wp512.c +++ b/trunk/crypto/wp512.c @@ -1119,7 +1119,7 @@ static int wp256_final(struct shash_desc *desc, u8 *out) return 0; } -static struct shash_alg wp_algs[3] = { { +static struct shash_alg wp512 = { .digestsize = WP512_DIGEST_SIZE, .init = wp512_init, .update = wp512_update, @@ -1131,7 +1131,9 @@ static struct shash_alg wp_algs[3] = { { .cra_blocksize = WP512_BLOCK_SIZE, .cra_module = THIS_MODULE, } -}, { +}; + +static struct shash_alg wp384 = { .digestsize = WP384_DIGEST_SIZE, .init = wp512_init, .update = wp512_update, @@ -1143,7 +1145,9 @@ static struct shash_alg wp_algs[3] = { { .cra_blocksize = WP512_BLOCK_SIZE, .cra_module = THIS_MODULE, } -}, { +}; + +static struct shash_alg wp256 = { .digestsize = WP256_DIGEST_SIZE, .init = wp512_init, .update = wp512_update, @@ -1155,16 +1159,39 @@ static struct shash_alg wp_algs[3] = { { .cra_blocksize = WP512_BLOCK_SIZE, .cra_module = THIS_MODULE, } -} }; +}; static int __init wp512_mod_init(void) { - return crypto_register_shashes(wp_algs, ARRAY_SIZE(wp_algs)); + int ret = 0; + + ret = crypto_register_shash(&wp512); + + if (ret < 0) + goto out; + + ret = crypto_register_shash(&wp384); + if (ret < 0) + { + crypto_unregister_shash(&wp512); + goto out; + } + + ret = crypto_register_shash(&wp256); + if (ret < 0) + { + crypto_unregister_shash(&wp512); + crypto_unregister_shash(&wp384); + } +out: + return ret; } static void __exit wp512_mod_fini(void) { - crypto_unregister_shashes(wp_algs, ARRAY_SIZE(wp_algs)); + crypto_unregister_shash(&wp512); + crypto_unregister_shash(&wp384); + crypto_unregister_shash(&wp256); } MODULE_ALIAS("wp384"); diff --git a/trunk/drivers/acpi/processor_driver.c b/trunk/drivers/acpi/processor_driver.c index e78c2a52ea46..bfc31cb0dd3e 100644 --- a/trunk/drivers/acpi/processor_driver.c +++ b/trunk/drivers/acpi/processor_driver.c @@ -475,7 +475,7 @@ static __ref int acpi_processor_start(struct acpi_processor *pr) acpi_processor_get_limit_info(pr); if (!cpuidle_get_driver() || cpuidle_get_driver() == &acpi_idle_driver) - acpi_processor_power_init(pr); + acpi_processor_power_init(pr, device); pr->cdev = thermal_cooling_device_register("Processor", device, &processor_cooling_ops); @@ -509,7 +509,7 @@ static __ref int acpi_processor_start(struct acpi_processor *pr) err_thermal_unregister: thermal_cooling_device_unregister(pr->cdev); err_power_exit: - acpi_processor_power_exit(pr); + acpi_processor_power_exit(pr, device); return result; } @@ -620,7 +620,7 @@ static int acpi_processor_remove(struct acpi_device *device, int type) return -EINVAL; } - acpi_processor_power_exit(pr); + acpi_processor_power_exit(pr, device); sysfs_remove_link(&device->dev.kobj, "sysdev"); @@ -905,6 +905,8 @@ static int __init acpi_processor_init(void) if (acpi_disabled) return 0; + memset(&errata, 0, sizeof(errata)); + result = acpi_bus_register_driver(&acpi_processor_driver); if (result < 0) return result; diff --git a/trunk/drivers/acpi/processor_idle.c b/trunk/drivers/acpi/processor_idle.c index 3655ab923812..ad3730b4038b 100644 --- a/trunk/drivers/acpi/processor_idle.c +++ b/trunk/drivers/acpi/processor_idle.c @@ -79,8 +79,6 @@ module_param(bm_check_disable, uint, 0000); static unsigned int latency_factor __read_mostly = 2; module_param(latency_factor, uint, 0644); -static DEFINE_PER_CPU(struct cpuidle_device *, acpi_cpuidle_device); - static int disabled_by_idle_boot_param(void) { return boot_option_idle_override == IDLE_POLL || @@ -485,6 +483,8 @@ static int acpi_processor_get_power_info_cst(struct acpi_processor *pr) if (obj->type != ACPI_TYPE_INTEGER) continue; + cx.power = obj->integer.value; + current_count++; memcpy(&(pr->power.states[current_count]), &cx, sizeof(cx)); @@ -1000,7 +1000,7 @@ static int acpi_processor_setup_cpuidle_cx(struct acpi_processor *pr) int i, count = CPUIDLE_DRIVER_STATE_START; struct acpi_processor_cx *cx; struct cpuidle_state_usage *state_usage; - struct cpuidle_device *dev = per_cpu(acpi_cpuidle_device, pr->id); + struct cpuidle_device *dev = &pr->power.dev; if (!pr->flags.power_setup_done) return -EINVAL; @@ -1132,7 +1132,6 @@ static int acpi_processor_setup_cpuidle_states(struct acpi_processor *pr) int acpi_processor_hotplug(struct acpi_processor *pr) { int ret = 0; - struct cpuidle_device *dev = per_cpu(acpi_cpuidle_device, pr->id); if (disabled_by_idle_boot_param()) return 0; @@ -1148,11 +1147,11 @@ int acpi_processor_hotplug(struct acpi_processor *pr) return -ENODEV; cpuidle_pause_and_lock(); - cpuidle_disable_device(dev); + cpuidle_disable_device(&pr->power.dev); acpi_processor_get_power_info(pr); if (pr->flags.power) { acpi_processor_setup_cpuidle_cx(pr); - ret = cpuidle_enable_device(dev); + ret = cpuidle_enable_device(&pr->power.dev); } cpuidle_resume_and_unlock(); @@ -1163,7 +1162,6 @@ int acpi_processor_cst_has_changed(struct acpi_processor *pr) { int cpu; struct acpi_processor *_pr; - struct cpuidle_device *dev; if (disabled_by_idle_boot_param()) return 0; @@ -1194,8 +1192,7 @@ int acpi_processor_cst_has_changed(struct acpi_processor *pr) _pr = per_cpu(processors, cpu); if (!_pr || !_pr->flags.power_setup_done) continue; - dev = per_cpu(acpi_cpuidle_device, cpu); - cpuidle_disable_device(dev); + cpuidle_disable_device(&_pr->power.dev); } /* Populate Updated C-state information */ @@ -1209,8 +1206,7 @@ int acpi_processor_cst_has_changed(struct acpi_processor *pr) acpi_processor_get_power_info(_pr); if (_pr->flags.power) { acpi_processor_setup_cpuidle_cx(_pr); - dev = per_cpu(acpi_cpuidle_device, cpu); - cpuidle_enable_device(dev); + cpuidle_enable_device(&_pr->power.dev); } } put_online_cpus(); @@ -1222,11 +1218,11 @@ int acpi_processor_cst_has_changed(struct acpi_processor *pr) static int acpi_processor_registered; -int __cpuinit acpi_processor_power_init(struct acpi_processor *pr) +int __cpuinit acpi_processor_power_init(struct acpi_processor *pr, + struct acpi_device *device) { acpi_status status = 0; int retval; - struct cpuidle_device *dev; static int first_run; if (disabled_by_idle_boot_param()) @@ -1272,18 +1268,11 @@ int __cpuinit acpi_processor_power_init(struct acpi_processor *pr) printk(KERN_DEBUG "ACPI: %s registered with cpuidle\n", acpi_idle_driver.name); } - - dev = kzalloc(sizeof(*dev), GFP_KERNEL); - if (!dev) - return -ENOMEM; - per_cpu(acpi_cpuidle_device, pr->id) = dev; - - acpi_processor_setup_cpuidle_cx(pr); - /* Register per-cpu cpuidle_device. Cpuidle driver * must already be registered before registering device */ - retval = cpuidle_register_device(dev); + acpi_processor_setup_cpuidle_cx(pr); + retval = cpuidle_register_device(&pr->power.dev); if (retval) { if (acpi_processor_registered == 0) cpuidle_unregister_driver(&acpi_idle_driver); @@ -1294,15 +1283,14 @@ int __cpuinit acpi_processor_power_init(struct acpi_processor *pr) return 0; } -int acpi_processor_power_exit(struct acpi_processor *pr) +int acpi_processor_power_exit(struct acpi_processor *pr, + struct acpi_device *device) { - struct cpuidle_device *dev = per_cpu(acpi_cpuidle_device, pr->id); - if (disabled_by_idle_boot_param()) return 0; if (pr->flags.power) { - cpuidle_unregister_device(dev); + cpuidle_unregister_device(&pr->power.dev); acpi_processor_registered--; if (acpi_processor_registered == 0) cpuidle_unregister_driver(&acpi_idle_driver); diff --git a/trunk/drivers/acpi/processor_perflib.c b/trunk/drivers/acpi/processor_perflib.c index 836bfe069042..a093dc163a42 100644 --- a/trunk/drivers/acpi/processor_perflib.c +++ b/trunk/drivers/acpi/processor_perflib.c @@ -324,34 +324,6 @@ static int acpi_processor_get_performance_control(struct acpi_processor *pr) return result; } -#ifdef CONFIG_X86 -/* - * Some AMDs have 50MHz frequency multiples, but only provide 100MHz rounding - * in their ACPI data. Calculate the real values and fix up the _PSS data. - */ -static void amd_fixup_frequency(struct acpi_processor_px *px, int i) -{ - u32 hi, lo, fid, did; - int index = px->control & 0x00000007; - - if (boot_cpu_data.x86_vendor != X86_VENDOR_AMD) - return; - - if ((boot_cpu_data.x86 == 0x10 && boot_cpu_data.x86_model < 10) - || boot_cpu_data.x86 == 0x11) { - rdmsr(MSR_AMD_PSTATE_DEF_BASE + index, lo, hi); - fid = lo & 0x3f; - did = (lo >> 6) & 7; - if (boot_cpu_data.x86 == 0x10) - px->core_frequency = (100 * (fid + 0x10)) >> did; - else - px->core_frequency = (100 * (fid + 8)) >> did; - } -} -#else -static void amd_fixup_frequency(struct acpi_processor_px *px, int i) {}; -#endif - static int acpi_processor_get_performance_states(struct acpi_processor *pr) { int result = 0; @@ -407,8 +379,6 @@ static int acpi_processor_get_performance_states(struct acpi_processor *pr) goto end; } - amd_fixup_frequency(px, i); - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "State [%d]: core_frequency[%d] power[%d] transition_latency[%d] bus_master_latency[%d] control[0x%x] status[0x%x]\n", i, diff --git a/trunk/drivers/acpi/video.c b/trunk/drivers/acpi/video.c index f94d4c818fc7..1e0a9e17c31d 100644 --- a/trunk/drivers/acpi/video.c +++ b/trunk/drivers/acpi/video.c @@ -1448,7 +1448,8 @@ static void acpi_video_bus_notify(struct acpi_device *device, u32 event) case ACPI_VIDEO_NOTIFY_SWITCH: /* User requested a switch, * most likely via hotkey. */ acpi_bus_generate_proc_event(device, event, 0); - keycode = KEY_SWITCHVIDEOMODE; + if (!acpi_notifier_call_chain(device, event, 0)) + keycode = KEY_SWITCHVIDEOMODE; break; case ACPI_VIDEO_NOTIFY_PROBE: /* User plugged in or removed a video @@ -1478,9 +1479,8 @@ static void acpi_video_bus_notify(struct acpi_device *device, u32 event) break; } - if (acpi_notifier_call_chain(device, event, 0)) - /* Something vetoed the keypress. */ - keycode = 0; + if (event != ACPI_VIDEO_NOTIFY_SWITCH) + acpi_notifier_call_chain(device, event, 0); if (keycode) { input_report_key(input, keycode, 1); diff --git a/trunk/drivers/ata/Kconfig b/trunk/drivers/ata/Kconfig index e08d322d01d7..27cecd313e75 100644 --- a/trunk/drivers/ata/Kconfig +++ b/trunk/drivers/ata/Kconfig @@ -214,14 +214,6 @@ config SATA_DWC_VDEBUG help This option enables the taskfile dumping and NCQ debugging. -config SATA_HIGHBANK - tristate "Calxeda Highbank SATA support" - help - This option enables support for the Calxeda Highbank SoC's - onboard SATA. - - If unsure, say N. - config SATA_MV tristate "Marvell SATA support" help diff --git a/trunk/drivers/ata/Makefile b/trunk/drivers/ata/Makefile index 9329dafba91b..a454a139b1d2 100644 --- a/trunk/drivers/ata/Makefile +++ b/trunk/drivers/ata/Makefile @@ -9,7 +9,6 @@ obj-$(CONFIG_SATA_FSL) += sata_fsl.o obj-$(CONFIG_SATA_INIC162X) += sata_inic162x.o obj-$(CONFIG_SATA_SIL24) += sata_sil24.o obj-$(CONFIG_SATA_DWC) += sata_dwc_460ex.o -obj-$(CONFIG_SATA_HIGHBANK) += sata_highbank.o libahci.o # SFF w/ custom DMA obj-$(CONFIG_PDC_ADMA) += pdc_adma.o diff --git a/trunk/drivers/ata/ahci.h b/trunk/drivers/ata/ahci.h index 9be471200a07..57eb1c212a4c 100644 --- a/trunk/drivers/ata/ahci.h +++ b/trunk/drivers/ata/ahci.h @@ -35,7 +35,6 @@ #ifndef _AHCI_H #define _AHCI_H -#include #include /* Enclosure Management Control */ @@ -116,9 +115,6 @@ enum { HOST_CAP2_BOH = (1 << 0), /* BIOS/OS handoff supported */ HOST_CAP2_NVMHCI = (1 << 1), /* NVMHCI supported */ HOST_CAP2_APST = (1 << 2), /* Automatic partial to slumber */ - HOST_CAP2_SDS = (1 << 3), /* Support device sleep */ - HOST_CAP2_SADM = (1 << 4), /* Support aggressive DevSlp */ - HOST_CAP2_DESO = (1 << 5), /* DevSlp from slumber only */ /* registers for each SATA port */ PORT_LST_ADDR = 0x00, /* command list DMA addr */ @@ -137,7 +133,6 @@ enum { PORT_SCR_ACT = 0x34, /* SATA phy register: SActive */ PORT_SCR_NTF = 0x3c, /* SATA phy register: SNotification */ PORT_FBS = 0x40, /* FIS-based Switching */ - PORT_DEVSLP = 0x44, /* device sleep */ /* PORT_IRQ_{STAT,MASK} bits */ PORT_IRQ_COLD_PRES = (1 << 31), /* cold presence detect */ @@ -191,7 +186,6 @@ enum { PORT_CMD_ICC_PARTIAL = (0x2 << 28), /* Put i/f in partial state */ PORT_CMD_ICC_SLUMBER = (0x6 << 28), /* Put i/f in slumber state */ - /* PORT_FBS bits */ PORT_FBS_DWE_OFFSET = 16, /* FBS device with error offset */ PORT_FBS_ADO_OFFSET = 12, /* FBS active dev optimization offset */ PORT_FBS_DEV_OFFSET = 8, /* FBS device to issue offset */ @@ -200,15 +194,6 @@ enum { PORT_FBS_DEC = (1 << 1), /* FBS device error clear */ PORT_FBS_EN = (1 << 0), /* Enable FBS */ - /* PORT_DEVSLP bits */ - PORT_DEVSLP_DM_OFFSET = 25, /* DITO multiplier offset */ - PORT_DEVSLP_DM_MASK = (0xf << 25), /* DITO multiplier mask */ - PORT_DEVSLP_DITO_OFFSET = 15, /* DITO offset */ - PORT_DEVSLP_MDAT_OFFSET = 10, /* Minimum assertion time */ - PORT_DEVSLP_DETO_OFFSET = 2, /* DevSlp exit timeout */ - PORT_DEVSLP_DSP = (1 << 1), /* DevSlp present */ - PORT_DEVSLP_ADSE = (1 << 0), /* Aggressive DevSlp enable */ - /* hpriv->flags bits */ #define AHCI_HFLAGS(flags) .private_data = (void *)(flags) @@ -317,7 +302,6 @@ struct ahci_host_priv { u32 em_loc; /* enclosure management location */ u32 em_buf_sz; /* EM buffer size in byte */ u32 em_msg_type; /* EM message type */ - struct clk *clk; /* Only for platforms supporting clk */ }; extern int ahci_ignore_sss; diff --git a/trunk/drivers/ata/ahci_platform.c b/trunk/drivers/ata/ahci_platform.c index b1ae48054dc5..09728e09cb31 100644 --- a/trunk/drivers/ata/ahci_platform.c +++ b/trunk/drivers/ata/ahci_platform.c @@ -12,7 +12,6 @@ * any later version. */ -#include #include #include #include @@ -119,17 +118,6 @@ static int __init ahci_probe(struct platform_device *pdev) return -ENOMEM; } - hpriv->clk = clk_get(dev, NULL); - if (IS_ERR(hpriv->clk)) { - dev_err(dev, "can't get clock\n"); - } else { - rc = clk_prepare_enable(hpriv->clk); - if (rc) { - dev_err(dev, "clock prepare enable failed"); - goto free_clk; - } - } - /* * Some platforms might need to prepare for mmio region access, * which could be done in the following init call. So, the mmio @@ -139,7 +127,7 @@ static int __init ahci_probe(struct platform_device *pdev) if (pdata && pdata->init) { rc = pdata->init(dev, hpriv->mmio); if (rc) - goto disable_unprepare_clk; + return rc; } ahci_save_initial_config(dev, hpriv, @@ -165,7 +153,7 @@ static int __init ahci_probe(struct platform_device *pdev) host = ata_host_alloc_pinfo(dev, ppi, n_ports); if (!host) { rc = -ENOMEM; - goto pdata_exit; + goto err0; } host->private_data = hpriv; @@ -195,7 +183,7 @@ static int __init ahci_probe(struct platform_device *pdev) rc = ahci_reset_controller(host); if (rc) - goto pdata_exit; + goto err0; ahci_init_controller(host); ahci_print_info(host, "platform"); @@ -203,18 +191,12 @@ static int __init ahci_probe(struct platform_device *pdev) rc = ata_host_activate(host, irq, ahci_interrupt, IRQF_SHARED, &ahci_platform_sht); if (rc) - goto pdata_exit; + goto err0; return 0; -pdata_exit: +err0: if (pdata && pdata->exit) pdata->exit(dev); -disable_unprepare_clk: - if (!IS_ERR(hpriv->clk)) - clk_disable_unprepare(hpriv->clk); -free_clk: - if (!IS_ERR(hpriv->clk)) - clk_put(hpriv->clk); return rc; } @@ -223,18 +205,12 @@ static int __devexit ahci_remove(struct platform_device *pdev) struct device *dev = &pdev->dev; struct ahci_platform_data *pdata = dev_get_platdata(dev); struct ata_host *host = dev_get_drvdata(dev); - struct ahci_host_priv *hpriv = host->private_data; ata_host_detach(host); if (pdata && pdata->exit) pdata->exit(dev); - if (!IS_ERR(hpriv->clk)) { - clk_disable_unprepare(hpriv->clk); - clk_put(hpriv->clk); - } - return 0; } @@ -269,10 +245,6 @@ static int ahci_suspend(struct device *dev) if (pdata && pdata->suspend) return pdata->suspend(dev); - - if (!IS_ERR(hpriv->clk)) - clk_disable_unprepare(hpriv->clk); - return 0; } @@ -280,27 +252,18 @@ static int ahci_resume(struct device *dev) { struct ahci_platform_data *pdata = dev_get_platdata(dev); struct ata_host *host = dev_get_drvdata(dev); - struct ahci_host_priv *hpriv = host->private_data; int rc; - if (!IS_ERR(hpriv->clk)) { - rc = clk_prepare_enable(hpriv->clk); - if (rc) { - dev_err(dev, "clock prepare enable failed"); - return rc; - } - } - if (pdata && pdata->resume) { rc = pdata->resume(dev); if (rc) - goto disable_unprepare_clk; + return rc; } if (dev->power.power_state.event == PM_EVENT_SUSPEND) { rc = ahci_reset_controller(host); if (rc) - goto disable_unprepare_clk; + return rc; ahci_init_controller(host); } @@ -308,18 +271,13 @@ static int ahci_resume(struct device *dev) ata_host_resume(host); return 0; - -disable_unprepare_clk: - if (!IS_ERR(hpriv->clk)) - clk_disable_unprepare(hpriv->clk); - - return rc; } #endif SIMPLE_DEV_PM_OPS(ahci_pm_ops, ahci_suspend, ahci_resume); static const struct of_device_id ahci_of_match[] = { + { .compatible = "calxeda,hb-ahci", }, { .compatible = "snps,spear-ahci", }, {}, }; diff --git a/trunk/drivers/ata/libahci.c b/trunk/drivers/ata/libahci.c index 4201e535a8c8..555c07afa05b 100644 --- a/trunk/drivers/ata/libahci.c +++ b/trunk/drivers/ata/libahci.c @@ -45,7 +45,6 @@ #include #include #include "ahci.h" -#include "libata.h" static int ahci_skip_host_reset; int ahci_ignore_sss; @@ -77,7 +76,6 @@ static void ahci_qc_prep(struct ata_queued_cmd *qc); static int ahci_pmp_qc_defer(struct ata_queued_cmd *qc); static void ahci_freeze(struct ata_port *ap); static void ahci_thaw(struct ata_port *ap); -static void ahci_set_aggressive_devslp(struct ata_port *ap, bool sleep); static void ahci_enable_fbs(struct ata_port *ap); static void ahci_disable_fbs(struct ata_port *ap); static void ahci_pmp_attach(struct ata_port *ap); @@ -195,10 +193,6 @@ module_param(ahci_em_messages, int, 0444); MODULE_PARM_DESC(ahci_em_messages, "AHCI Enclosure Management Message control (0 = off, 1 = on)"); -int devslp_idle_timeout = 1000; /* device sleep idle timeout in ms */ -module_param(devslp_idle_timeout, int, 0644); -MODULE_PARM_DESC(devslp_idle_timeout, "device sleep idle timeout"); - static void ahci_enable_ahci(void __iomem *mmio) { int i; @@ -708,16 +702,6 @@ static int ahci_set_lpm(struct ata_link *link, enum ata_lpm_policy policy, } } - /* set aggressive device sleep */ - if ((hpriv->cap2 & HOST_CAP2_SDS) && - (hpriv->cap2 & HOST_CAP2_SADM) && - (link->device->flags & ATA_DFLAG_DEVSLP)) { - if (policy == ATA_LPM_MIN_POWER) - ahci_set_aggressive_devslp(ap, true); - else - ahci_set_aggressive_devslp(ap, false); - } - if (policy == ATA_LPM_MAX_POWER) { sata_link_scr_lpm(link, policy, false); @@ -1906,81 +1890,6 @@ static void ahci_post_internal_cmd(struct ata_queued_cmd *qc) ahci_kick_engine(ap); } -static void ahci_set_aggressive_devslp(struct ata_port *ap, bool sleep) -{ - void __iomem *port_mmio = ahci_port_base(ap); - struct ata_device *dev = ap->link.device; - u32 devslp, dm, dito, mdat, deto; - int rc; - unsigned int err_mask; - - devslp = readl(port_mmio + PORT_DEVSLP); - if (!(devslp & PORT_DEVSLP_DSP)) { - dev_err(ap->host->dev, "port does not support device sleep\n"); - return; - } - - /* disable device sleep */ - if (!sleep) { - if (devslp & PORT_DEVSLP_ADSE) { - writel(devslp & ~PORT_DEVSLP_ADSE, - port_mmio + PORT_DEVSLP); - err_mask = ata_dev_set_feature(dev, - SETFEATURES_SATA_DISABLE, - SATA_DEVSLP); - if (err_mask && err_mask != AC_ERR_DEV) - ata_dev_warn(dev, "failed to disable DEVSLP\n"); - } - return; - } - - /* device sleep was already enabled */ - if (devslp & PORT_DEVSLP_ADSE) - return; - - /* set DITO, MDAT, DETO and enable DevSlp, need to stop engine first */ - rc = ahci_stop_engine(ap); - if (rc) - return; - - dm = (devslp & PORT_DEVSLP_DM_MASK) >> PORT_DEVSLP_DM_OFFSET; - dito = devslp_idle_timeout / (dm + 1); - if (dito > 0x3ff) - dito = 0x3ff; - - /* Use the nominal value 10 ms if the read MDAT is zero, - * the nominal value of DETO is 20 ms. - */ - if (dev->sata_settings[ATA_LOG_DEVSLP_VALID] & - ATA_LOG_DEVSLP_VALID_MASK) { - mdat = dev->sata_settings[ATA_LOG_DEVSLP_MDAT] & - ATA_LOG_DEVSLP_MDAT_MASK; - if (!mdat) - mdat = 10; - deto = dev->sata_settings[ATA_LOG_DEVSLP_DETO]; - if (!deto) - deto = 20; - } else { - mdat = 10; - deto = 20; - } - - devslp |= ((dito << PORT_DEVSLP_DITO_OFFSET) | - (mdat << PORT_DEVSLP_MDAT_OFFSET) | - (deto << PORT_DEVSLP_DETO_OFFSET) | - PORT_DEVSLP_ADSE); - writel(devslp, port_mmio + PORT_DEVSLP); - - ahci_start_engine(ap); - - /* enable device sleep feature for the drive */ - err_mask = ata_dev_set_feature(dev, - SETFEATURES_SATA_ENABLE, - SATA_DEVSLP); - if (err_mask && err_mask != AC_ERR_DEV) - ata_dev_warn(dev, "failed to enable DEVSLP\n"); -} - static void ahci_enable_fbs(struct ata_port *ap) { struct ahci_port_priv *pp = ap->private_data; @@ -2255,8 +2164,7 @@ void ahci_print_info(struct ata_host *host, const char *scc_s) "flags: " "%s%s%s%s%s%s%s" "%s%s%s%s%s%s%s" - "%s%s%s%s%s%s%s" - "%s%s\n" + "%s%s%s%s%s%s\n" , cap & HOST_CAP_64 ? "64bit " : "", @@ -2276,9 +2184,6 @@ void ahci_print_info(struct ata_host *host, const char *scc_s) cap & HOST_CAP_CCC ? "ccc " : "", cap & HOST_CAP_EMS ? "ems " : "", cap & HOST_CAP_SXS ? "sxs " : "", - cap2 & HOST_CAP2_DESO ? "deso " : "", - cap2 & HOST_CAP2_SADM ? "sadm " : "", - cap2 & HOST_CAP2_SDS ? "sds " : "", cap2 & HOST_CAP2_APST ? "apst " : "", cap2 & HOST_CAP2_NVMHCI ? "nvmp " : "", cap2 & HOST_CAP2_BOH ? "boh " : "" diff --git a/trunk/drivers/ata/libata-core.c b/trunk/drivers/ata/libata-core.c index 3cc7096cfda7..8e1039c8e159 100644 --- a/trunk/drivers/ata/libata-core.c +++ b/trunk/drivers/ata/libata-core.c @@ -774,7 +774,7 @@ int ata_build_rw_tf(struct ata_taskfile *tf, struct ata_device *dev, tf->lbam = (block >> 8) & 0xff; tf->lbal = block & 0xff; - tf->device = ATA_LBA; + tf->device = 1 << 6; if (tf->flags & ATA_TFLAG_FUA) tf->device |= 1 << 7; } else if (dev->flags & ATA_DFLAG_LBA) { @@ -2155,7 +2155,6 @@ int ata_dev_configure(struct ata_device *dev) int print_info = ehc->i.flags & ATA_EHI_PRINTINFO; const u16 *id = dev->id; unsigned long xfer_mask; - unsigned int err_mask; char revbuf[7]; /* XYZ-99\0 */ char fwrevbuf[ATA_ID_FW_REV_LEN+1]; char modelbuf[ATA_ID_PROD_LEN+1]; @@ -2324,26 +2323,6 @@ int ata_dev_configure(struct ata_device *dev) } } - /* check and mark DevSlp capability */ - if (ata_id_has_devslp(dev->id)) - dev->flags |= ATA_DFLAG_DEVSLP; - - /* Obtain SATA Settings page from Identify Device Data Log, - * which contains DevSlp timing variables etc. - * Exclude old devices with ata_id_has_ncq() - */ - if (ata_id_has_ncq(dev->id)) { - err_mask = ata_read_log_page(dev, - ATA_LOG_SATA_ID_DEV_DATA, - ATA_LOG_SATA_SETTINGS, - dev->sata_settings, - 1); - if (err_mask) - ata_dev_dbg(dev, - "failed to get Identify Device Data, Emask 0x%x\n", - err_mask); - } - dev->cdb_len = 16; } @@ -2372,6 +2351,8 @@ int ata_dev_configure(struct ata_device *dev) (ap->flags & ATA_FLAG_AN) && ata_id_has_atapi_AN(id) && (!sata_pmp_attached(ap) || sata_scr_read(&ap->link, SCR_NOTIFICATION, &sntf) == 0)) { + unsigned int err_mask; + /* issue SET feature command to turn this on */ err_mask = ata_dev_set_feature(dev, SETFEATURES_SATA_ENABLE, SATA_AN); @@ -3617,7 +3598,7 @@ int sata_link_scr_lpm(struct ata_link *link, enum ata_lpm_policy policy, switch (policy) { case ATA_LPM_MAX_POWER: /* disable all LPM transitions */ - scontrol |= (0x7 << 8); + scontrol |= (0x3 << 8); /* initiate transition to active state */ if (spm_wakeup) { scontrol |= (0x4 << 12); @@ -3627,12 +3608,12 @@ int sata_link_scr_lpm(struct ata_link *link, enum ata_lpm_policy policy, case ATA_LPM_MED_POWER: /* allow LPM to PARTIAL */ scontrol &= ~(0x1 << 8); - scontrol |= (0x6 << 8); + scontrol |= (0x2 << 8); break; case ATA_LPM_MIN_POWER: if (ata_link_nr_enabled(link) > 0) /* no restrictions on LPM transitions */ - scontrol &= ~(0x7 << 8); + scontrol &= ~(0x3 << 8); else { /* empty port, power off */ scontrol &= ~0xf; @@ -4491,7 +4472,6 @@ unsigned int ata_dev_set_feature(struct ata_device *dev, u8 enable, u8 feature) DPRINTK("EXIT, err_mask=%x\n", err_mask); return err_mask; } -EXPORT_SYMBOL_GPL(ata_dev_set_feature); /** * ata_dev_init_params - Issue INIT DEV PARAMS command @@ -5273,20 +5253,16 @@ bool ata_link_offline(struct ata_link *link) #ifdef CONFIG_PM static int ata_port_request_pm(struct ata_port *ap, pm_message_t mesg, unsigned int action, unsigned int ehi_flags, - int *async) + int wait) { struct ata_link *link; unsigned long flags; - int rc = 0; + int rc; /* Previous resume operation might still be in * progress. Wait for PM_PENDING to clear. */ if (ap->pflags & ATA_PFLAG_PM_PENDING) { - if (async) { - *async = -EAGAIN; - return 0; - } ata_port_wait_eh(ap); WARN_ON(ap->pflags & ATA_PFLAG_PM_PENDING); } @@ -5295,10 +5271,10 @@ static int ata_port_request_pm(struct ata_port *ap, pm_message_t mesg, spin_lock_irqsave(ap->lock, flags); ap->pm_mesg = mesg; - if (async) - ap->pm_result = async; - else + if (wait) { + rc = 0; ap->pm_result = &rc; + } ap->pflags |= ATA_PFLAG_PM_PENDING; ata_for_each_link(link, ap, HOST_FIRST) { @@ -5311,7 +5287,7 @@ static int ata_port_request_pm(struct ata_port *ap, pm_message_t mesg, spin_unlock_irqrestore(ap->lock, flags); /* wait and check result */ - if (!async) { + if (wait) { ata_port_wait_eh(ap); WARN_ON(ap->pflags & ATA_PFLAG_PM_PENDING); } @@ -5319,8 +5295,9 @@ static int ata_port_request_pm(struct ata_port *ap, pm_message_t mesg, return rc; } -static int __ata_port_suspend_common(struct ata_port *ap, pm_message_t mesg, int *async) +static int ata_port_suspend_common(struct device *dev, pm_message_t mesg) { + struct ata_port *ap = to_ata_port(dev); unsigned int ehi_flags = ATA_EHI_QUIET; int rc; @@ -5335,17 +5312,10 @@ static int __ata_port_suspend_common(struct ata_port *ap, pm_message_t mesg, int if (mesg.event == PM_EVENT_SUSPEND) ehi_flags |= ATA_EHI_NO_AUTOPSY | ATA_EHI_NO_RECOVERY; - rc = ata_port_request_pm(ap, mesg, 0, ehi_flags, async); + rc = ata_port_request_pm(ap, mesg, 0, ehi_flags, 1); return rc; } -static int ata_port_suspend_common(struct device *dev, pm_message_t mesg) -{ - struct ata_port *ap = to_ata_port(dev); - - return __ata_port_suspend_common(ap, mesg, NULL); -} - static int ata_port_suspend(struct device *dev) { if (pm_runtime_suspended(dev)) @@ -5370,22 +5340,16 @@ static int ata_port_poweroff(struct device *dev) return ata_port_suspend_common(dev, PMSG_HIBERNATE); } -static int __ata_port_resume_common(struct ata_port *ap, int *async) +static int ata_port_resume_common(struct device *dev) { + struct ata_port *ap = to_ata_port(dev); int rc; rc = ata_port_request_pm(ap, PMSG_ON, ATA_EH_RESET, - ATA_EHI_NO_AUTOPSY | ATA_EHI_QUIET, async); + ATA_EHI_NO_AUTOPSY | ATA_EHI_QUIET, 1); return rc; } -static int ata_port_resume_common(struct device *dev) -{ - struct ata_port *ap = to_ata_port(dev); - - return __ata_port_resume_common(ap, NULL); -} - static int ata_port_resume(struct device *dev) { int rc; @@ -5418,24 +5382,6 @@ static const struct dev_pm_ops ata_port_pm_ops = { .runtime_idle = ata_port_runtime_idle, }; -/* sas ports don't participate in pm runtime management of ata_ports, - * and need to resume ata devices at the domain level, not the per-port - * level. sas suspend/resume is async to allow parallel port recovery - * since sas has multiple ata_port instances per Scsi_Host. - */ -int ata_sas_port_async_suspend(struct ata_port *ap, int *async) -{ - return __ata_port_suspend_common(ap, PMSG_SUSPEND, async); -} -EXPORT_SYMBOL_GPL(ata_sas_port_async_suspend); - -int ata_sas_port_async_resume(struct ata_port *ap, int *async) -{ - return __ata_port_resume_common(ap, async); -} -EXPORT_SYMBOL_GPL(ata_sas_port_async_resume); - - /** * ata_host_suspend - suspend host * @host: host to suspend @@ -5981,18 +5927,24 @@ int ata_host_start(struct ata_host *host) } /** - * ata_sas_host_init - Initialize a host struct for sas (ipr, libsas) + * ata_sas_host_init - Initialize a host struct * @host: host to initialize * @dev: device host is attached to + * @flags: host flags * @ops: port_ops * + * LOCKING: + * PCI/etc. bus probe sem. + * */ +/* KILLME - the only user left is ipr */ void ata_host_init(struct ata_host *host, struct device *dev, - struct ata_port_operations *ops) + unsigned long flags, struct ata_port_operations *ops) { spin_lock_init(&host->lock); mutex_init(&host->eh_mutex); host->dev = dev; + host->flags = flags; host->ops = ops; } @@ -6436,7 +6388,6 @@ static int __init ata_parse_force_one(char **cur, { "nohrst", .lflags = ATA_LFLAG_NO_HRST }, { "nosrst", .lflags = ATA_LFLAG_NO_SRST }, { "norst", .lflags = ATA_LFLAG_NO_HRST | ATA_LFLAG_NO_SRST }, - { "rstonce", .lflags = ATA_LFLAG_RST_ONCE }, }; char *start = *cur, *p = *cur; char *id, *val, *endp; diff --git a/trunk/drivers/ata/libata-eh.c b/trunk/drivers/ata/libata-eh.c index e60437cd0d19..7d4535e989bf 100644 --- a/trunk/drivers/ata/libata-eh.c +++ b/trunk/drivers/ata/libata-eh.c @@ -1487,7 +1487,6 @@ static const char *ata_err_string(unsigned int err_mask) /** * ata_read_log_page - read a specific log page * @dev: target device - * @log: log to read * @page: page to read * @buf: buffer to store read page * @sectors: number of sectors to read @@ -1500,18 +1499,17 @@ static const char *ata_err_string(unsigned int err_mask) * RETURNS: * 0 on success, AC_ERR_* mask otherwise. */ -unsigned int ata_read_log_page(struct ata_device *dev, u8 log, - u8 page, void *buf, unsigned int sectors) +static unsigned int ata_read_log_page(struct ata_device *dev, + u8 page, void *buf, unsigned int sectors) { struct ata_taskfile tf; unsigned int err_mask; - DPRINTK("read log page - log 0x%x, page 0x%x\n", log, page); + DPRINTK("read log page - page %d\n", page); ata_tf_init(dev, &tf); tf.command = ATA_CMD_READ_LOG_EXT; - tf.lbal = log; - tf.lbam = page; + tf.lbal = page; tf.nsect = sectors; tf.hob_nsect = sectors >> 8; tf.flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_LBA48 | ATA_TFLAG_DEVICE; @@ -1547,7 +1545,7 @@ static int ata_eh_read_log_10h(struct ata_device *dev, u8 csum; int i; - err_mask = ata_read_log_page(dev, ATA_LOG_SATA_NCQ, 0, buf, 1); + err_mask = ata_read_log_page(dev, ATA_LOG_SATA_NCQ, buf, 1); if (err_mask) return -EIO; @@ -2625,8 +2623,6 @@ int ata_eh_reset(struct ata_link *link, int classify, */ while (ata_eh_reset_timeouts[max_tries] != ULONG_MAX) max_tries++; - if (link->flags & ATA_LFLAG_RST_ONCE) - max_tries = 1; if (link->flags & ATA_LFLAG_NO_HRST) hardreset = NULL; if (link->flags & ATA_LFLAG_NO_SRST) diff --git a/trunk/drivers/ata/libata-scsi.c b/trunk/drivers/ata/libata-scsi.c index e3bda074fa12..8ec81ca8f659 100644 --- a/trunk/drivers/ata/libata-scsi.c +++ b/trunk/drivers/ata/libata-scsi.c @@ -1655,7 +1655,7 @@ static unsigned int ata_scsi_rw_xlat(struct ata_queued_cmd *qc) if (unlikely(scmd->cmd_len < 10)) goto invalid_fld; scsi_10_lba_len(cdb, &block, &n_block); - if (cdb[1] & (1 << 3)) + if (unlikely(cdb[1] & (1 << 3))) tf_flags |= ATA_TFLAG_FUA; break; case READ_6: @@ -1675,7 +1675,7 @@ static unsigned int ata_scsi_rw_xlat(struct ata_queued_cmd *qc) if (unlikely(scmd->cmd_len < 16)) goto invalid_fld; scsi_16_lba_len(cdb, &block, &n_block); - if (cdb[1] & (1 << 3)) + if (unlikely(cdb[1] & (1 << 3))) tf_flags |= ATA_TFLAG_FUA; break; default: @@ -2204,34 +2204,10 @@ static unsigned int ata_scsiop_noop(struct ata_scsi_args *args, u8 *rbuf) return 0; } -/** - * modecpy - Prepare response for MODE SENSE - * @dest: output buffer - * @src: data being copied - * @n: length of mode page - * @changeable: whether changeable parameters are requested - * - * Generate a generic MODE SENSE page for either current or changeable - * parameters. - * - * LOCKING: - * None. - */ -static void modecpy(u8 *dest, const u8 *src, int n, bool changeable) -{ - if (changeable) { - memcpy(dest, src, 2); - memset(dest + 2, 0, n - 2); - } else { - memcpy(dest, src, n); - } -} - /** * ata_msense_caching - Simulate MODE SENSE caching info page * @id: device IDENTIFY data * @buf: output buffer - * @changeable: whether changeable parameters are requested * * Generate a caching info page, which conditionally indicates * write caching to the SCSI layer, depending on device @@ -2240,12 +2216,12 @@ static void modecpy(u8 *dest, const u8 *src, int n, bool changeable) * LOCKING: * None. */ -static unsigned int ata_msense_caching(u16 *id, u8 *buf, bool changeable) +static unsigned int ata_msense_caching(u16 *id, u8 *buf) { - modecpy(buf, def_cache_mpage, sizeof(def_cache_mpage), changeable); - if (changeable || ata_id_wcache_enabled(id)) + memcpy(buf, def_cache_mpage, sizeof(def_cache_mpage)); + if (ata_id_wcache_enabled(id)) buf[2] |= (1 << 2); /* write cache enable */ - if (!changeable && !ata_id_rahead_enabled(id)) + if (!ata_id_rahead_enabled(id)) buf[12] |= (1 << 5); /* disable read ahead */ return sizeof(def_cache_mpage); } @@ -2253,33 +2229,30 @@ static unsigned int ata_msense_caching(u16 *id, u8 *buf, bool changeable) /** * ata_msense_ctl_mode - Simulate MODE SENSE control mode page * @buf: output buffer - * @changeable: whether changeable parameters are requested * * Generate a generic MODE SENSE control mode page. * * LOCKING: * None. */ -static unsigned int ata_msense_ctl_mode(u8 *buf, bool changeable) +static unsigned int ata_msense_ctl_mode(u8 *buf) { - modecpy(buf, def_control_mpage, sizeof(def_control_mpage), changeable); + memcpy(buf, def_control_mpage, sizeof(def_control_mpage)); return sizeof(def_control_mpage); } /** * ata_msense_rw_recovery - Simulate MODE SENSE r/w error recovery page * @buf: output buffer - * @changeable: whether changeable parameters are requested * * Generate a generic MODE SENSE r/w error recovery page. * * LOCKING: * None. */ -static unsigned int ata_msense_rw_recovery(u8 *buf, bool changeable) +static unsigned int ata_msense_rw_recovery(u8 *buf) { - modecpy(buf, def_rw_recovery_mpage, sizeof(def_rw_recovery_mpage), - changeable); + memcpy(buf, def_rw_recovery_mpage, sizeof(def_rw_recovery_mpage)); return sizeof(def_rw_recovery_mpage); } @@ -2343,11 +2316,11 @@ static unsigned int ata_scsiop_mode_sense(struct ata_scsi_args *args, u8 *rbuf) page_control = scsicmd[2] >> 6; switch (page_control) { case 0: /* current */ - case 1: /* changeable */ - case 2: /* defaults */ break; /* supported */ case 3: /* saved */ goto saving_not_supp; + case 1: /* changeable */ + case 2: /* defaults */ default: goto invalid_fld; } @@ -2368,21 +2341,21 @@ static unsigned int ata_scsiop_mode_sense(struct ata_scsi_args *args, u8 *rbuf) switch(pg) { case RW_RECOVERY_MPAGE: - p += ata_msense_rw_recovery(p, page_control == 1); + p += ata_msense_rw_recovery(p); break; case CACHE_MPAGE: - p += ata_msense_caching(args->id, p, page_control == 1); + p += ata_msense_caching(args->id, p); break; case CONTROL_MPAGE: - p += ata_msense_ctl_mode(p, page_control == 1); + p += ata_msense_ctl_mode(p); break; case ALL_MPAGES: - p += ata_msense_rw_recovery(p, page_control == 1); - p += ata_msense_caching(args->id, p, page_control == 1); - p += ata_msense_ctl_mode(p, page_control == 1); + p += ata_msense_rw_recovery(p); + p += ata_msense_caching(args->id, p); + p += ata_msense_ctl_mode(p); break; default: /* invalid page code */ @@ -3106,188 +3079,6 @@ static unsigned int ata_scsi_write_same_xlat(struct ata_queued_cmd *qc) return 1; } -/** - * ata_mselect_caching - Simulate MODE SELECT for caching info page - * @qc: Storage for translated ATA taskfile - * @buf: input buffer - * @len: number of valid bytes in the input buffer - * - * Prepare a taskfile to modify caching information for the device. - * - * LOCKING: - * None. - */ -static int ata_mselect_caching(struct ata_queued_cmd *qc, - const u8 *buf, int len) -{ - struct ata_taskfile *tf = &qc->tf; - struct ata_device *dev = qc->dev; - char mpage[CACHE_MPAGE_LEN]; - u8 wce; - - /* - * The first two bytes of def_cache_mpage are a header, so offsets - * in mpage are off by 2 compared to buf. Same for len. - */ - - if (len != CACHE_MPAGE_LEN - 2) - return -EINVAL; - - wce = buf[0] & (1 << 2); - - /* - * Check that read-only bits are not modified. - */ - ata_msense_caching(dev->id, mpage, false); - mpage[2] &= ~(1 << 2); - mpage[2] |= wce; - if (memcmp(mpage + 2, buf, CACHE_MPAGE_LEN - 2) != 0) - return -EINVAL; - - tf->flags |= ATA_TFLAG_DEVICE | ATA_TFLAG_ISADDR; - tf->protocol = ATA_PROT_NODATA; - tf->nsect = 0; - tf->command = ATA_CMD_SET_FEATURES; - tf->feature = wce ? SETFEATURES_WC_ON : SETFEATURES_WC_OFF; - return 0; -} - -/** - * ata_scsiop_mode_select - Simulate MODE SELECT 6, 10 commands - * @qc: Storage for translated ATA taskfile - * - * Converts a MODE SELECT command to an ATA SET FEATURES taskfile. - * Assume this is invoked for direct access devices (e.g. disks) only. - * There should be no block descriptor for other device types. - * - * LOCKING: - * spin_lock_irqsave(host lock) - */ -static unsigned int ata_scsi_mode_select_xlat(struct ata_queued_cmd *qc) -{ - struct scsi_cmnd *scmd = qc->scsicmd; - const u8 *cdb = scmd->cmnd; - const u8 *p; - u8 pg, spg; - unsigned six_byte, pg_len, hdr_len, bd_len; - int len; - - VPRINTK("ENTER\n"); - - six_byte = (cdb[0] == MODE_SELECT); - if (six_byte) { - if (scmd->cmd_len < 5) - goto invalid_fld; - - len = cdb[4]; - hdr_len = 4; - } else { - if (scmd->cmd_len < 9) - goto invalid_fld; - - len = (cdb[7] << 8) + cdb[8]; - hdr_len = 8; - } - - /* We only support PF=1, SP=0. */ - if ((cdb[1] & 0x11) != 0x10) - goto invalid_fld; - - /* Test early for possible overrun. */ - if (!scsi_sg_count(scmd) || scsi_sglist(scmd)->length < len) - goto invalid_param_len; - - p = page_address(sg_page(scsi_sglist(scmd))); - - /* Move past header and block descriptors. */ - if (len < hdr_len) - goto invalid_param_len; - - if (six_byte) - bd_len = p[3]; - else - bd_len = (p[6] << 8) + p[7]; - - len -= hdr_len; - p += hdr_len; - if (len < bd_len) - goto invalid_param_len; - if (bd_len != 0 && bd_len != 8) - goto invalid_param; - - len -= bd_len; - p += bd_len; - if (len == 0) - goto skip; - - /* Parse both possible formats for the mode page headers. */ - pg = p[0] & 0x3f; - if (p[0] & 0x40) { - if (len < 4) - goto invalid_param_len; - - spg = p[1]; - pg_len = (p[2] << 8) | p[3]; - p += 4; - len -= 4; - } else { - if (len < 2) - goto invalid_param_len; - - spg = 0; - pg_len = p[1]; - p += 2; - len -= 2; - } - - /* - * No mode subpages supported (yet) but asking for _all_ - * subpages may be valid - */ - if (spg && (spg != ALL_SUB_MPAGES)) - goto invalid_param; - if (pg_len > len) - goto invalid_param_len; - - switch (pg) { - case CACHE_MPAGE: - if (ata_mselect_caching(qc, p, pg_len) < 0) - goto invalid_param; - break; - - default: /* invalid page code */ - goto invalid_param; - } - - /* - * Only one page has changeable data, so we only support setting one - * page at a time. - */ - if (len > pg_len) - goto invalid_param; - - return 0; - - invalid_fld: - /* "Invalid field in CDB" */ - ata_scsi_set_sense(scmd, ILLEGAL_REQUEST, 0x24, 0x0); - return 1; - - invalid_param: - /* "Invalid field in parameter list" */ - ata_scsi_set_sense(scmd, ILLEGAL_REQUEST, 0x26, 0x0); - return 1; - - invalid_param_len: - /* "Parameter list length error" */ - ata_scsi_set_sense(scmd, ILLEGAL_REQUEST, 0x1a, 0x0); - return 1; - - skip: - scmd->result = SAM_STAT_GOOD; - return 1; -} - /** * ata_get_xlat_func - check if SCSI to ATA translation is possible * @dev: ATA device @@ -3328,11 +3119,6 @@ static inline ata_xlat_func_t ata_get_xlat_func(struct ata_device *dev, u8 cmd) case ATA_16: return ata_scsi_pass_thru; - case MODE_SELECT: - case MODE_SELECT_10: - return ata_scsi_mode_select_xlat; - break; - case START_STOP: return ata_scsi_start_stop_xlat; } @@ -3525,6 +3311,11 @@ void ata_scsi_simulate(struct ata_device *dev, struct scsi_cmnd *cmd) ata_scsi_rbuf_fill(&args, ata_scsiop_mode_sense); break; + case MODE_SELECT: /* unconditionally return */ + case MODE_SELECT_10: /* bad-field-in-cdb */ + ata_scsi_invalid_field(cmd); + break; + case READ_CAPACITY: ata_scsi_rbuf_fill(&args, ata_scsiop_read_cap); break; diff --git a/trunk/drivers/ata/libata.h b/trunk/drivers/ata/libata.h index 7148a58020b9..50e4dff0604e 100644 --- a/trunk/drivers/ata/libata.h +++ b/trunk/drivers/ata/libata.h @@ -165,8 +165,6 @@ extern void ata_eh_about_to_do(struct ata_link *link, struct ata_device *dev, unsigned int action); extern void ata_eh_done(struct ata_link *link, struct ata_device *dev, unsigned int action); -extern unsigned int ata_read_log_page(struct ata_device *dev, u8 log, - u8 page, void *buf, unsigned int sectors); extern void ata_eh_autopsy(struct ata_port *ap); const char *ata_get_cmd_descript(u8 command); extern void ata_eh_report(struct ata_port *ap); diff --git a/trunk/drivers/ata/pata_arasan_cf.c b/trunk/drivers/ata/pata_arasan_cf.c index 26201ebef3ca..bfaa5cb1629a 100644 --- a/trunk/drivers/ata/pata_arasan_cf.c +++ b/trunk/drivers/ata/pata_arasan_cf.c @@ -31,7 +31,6 @@ #include #include #include -#include #include #include #include @@ -311,7 +310,7 @@ static int cf_init(struct arasan_cf_dev *acdev) unsigned long flags; int ret = 0; - ret = clk_prepare_enable(acdev->clk); + ret = clk_enable(acdev->clk); if (ret) { dev_dbg(acdev->host->dev, "clock enable failed"); return ret; @@ -341,7 +340,7 @@ static void cf_exit(struct arasan_cf_dev *acdev) writel(readl(acdev->vbase + OP_MODE) & ~CFHOST_ENB, acdev->vbase + OP_MODE); spin_unlock_irqrestore(&acdev->host->lock, flags); - clk_disable_unprepare(acdev->clk); + clk_disable(acdev->clk); } static void dma_callback(void *dev) @@ -936,14 +935,6 @@ static int arasan_cf_resume(struct device *dev) static SIMPLE_DEV_PM_OPS(arasan_cf_pm_ops, arasan_cf_suspend, arasan_cf_resume); -#ifdef CONFIG_OF -static const struct of_device_id arasan_cf_id_table[] = { - { .compatible = "arasan,cf-spear1340" }, - {} -}; -MODULE_DEVICE_TABLE(of, arasan_cf_id_table); -#endif - static struct platform_driver arasan_cf_driver = { .probe = arasan_cf_probe, .remove = __devexit_p(arasan_cf_remove), @@ -951,7 +942,6 @@ static struct platform_driver arasan_cf_driver = { .name = DRIVER_NAME, .owner = THIS_MODULE, .pm = &arasan_cf_pm_ops, - .of_match_table = of_match_ptr(arasan_cf_id_table), }, }; diff --git a/trunk/drivers/ata/sata_fsl.c b/trunk/drivers/ata/sata_fsl.c index 124b2c1d9c0b..d6577b93bee3 100644 --- a/trunk/drivers/ata/sata_fsl.c +++ b/trunk/drivers/ata/sata_fsl.c @@ -123,7 +123,6 @@ enum { ONLINE = (1 << 31), GOING_OFFLINE = (1 << 30), BIST_ERR = (1 << 29), - CLEAR_ERROR = (1 << 27), FATAL_ERR_HC_MASTER_ERR = (1 << 18), FATAL_ERR_PARITY_ERR_TX = (1 << 17), @@ -144,7 +143,6 @@ enum { FATAL_ERR_CRC_ERR_RX | FATAL_ERR_FIFO_OVRFL_TX | FATAL_ERR_FIFO_OVRFL_RX, - INT_ON_DATA_LENGTH_MISMATCH = (1 << 12), INT_ON_FATAL_ERR = (1 << 5), INT_ON_PHYRDY_CHG = (1 << 4), @@ -1183,54 +1181,25 @@ static void sata_fsl_host_intr(struct ata_port *ap) u32 hstatus, done_mask = 0; struct ata_queued_cmd *qc; u32 SError; - u32 tag; - u32 status_mask = INT_ON_ERROR; hstatus = ioread32(hcr_base + HSTATUS); sata_fsl_scr_read(&ap->link, SCR_ERROR, &SError); - /* Read command completed register */ - done_mask = ioread32(hcr_base + CC); - - /* Workaround for data length mismatch errata */ - if (unlikely(hstatus & INT_ON_DATA_LENGTH_MISMATCH)) { - for (tag = 0; tag < ATA_MAX_QUEUE; tag++) { - qc = ata_qc_from_tag(ap, tag); - if (qc && ata_is_atapi(qc->tf.protocol)) { - u32 hcontrol; - /* Set HControl[27] to clear error registers */ - hcontrol = ioread32(hcr_base + HCONTROL); - iowrite32(hcontrol | CLEAR_ERROR, - hcr_base + HCONTROL); - - /* Clear HControl[27] */ - iowrite32(hcontrol & ~CLEAR_ERROR, - hcr_base + HCONTROL); - - /* Clear SError[E] bit */ - sata_fsl_scr_write(&ap->link, SCR_ERROR, - SError); - - /* Ignore fatal error and device error */ - status_mask &= ~(INT_ON_SINGL_DEVICE_ERR - | INT_ON_FATAL_ERR); - break; - } - } - } - if (unlikely(SError & 0xFFFF0000)) { DPRINTK("serror @host_intr : 0x%x\n", SError); sata_fsl_error_intr(ap); } - if (unlikely(hstatus & status_mask)) { + if (unlikely(hstatus & INT_ON_ERROR)) { DPRINTK("error interrupt!!\n"); sata_fsl_error_intr(ap); return; } + /* Read command completed register */ + done_mask = ioread32(hcr_base + CC); + VPRINTK("Status of all queues :\n"); VPRINTK("done_mask/CC = 0x%x, CA = 0x%x, CE=0x%x,CQ=0x%x,apqa=0x%x\n", done_mask, diff --git a/trunk/drivers/ata/sata_highbank.c b/trunk/drivers/ata/sata_highbank.c deleted file mode 100644 index 0d7c4c2cd26f..000000000000 --- a/trunk/drivers/ata/sata_highbank.c +++ /dev/null @@ -1,450 +0,0 @@ -/* - * Calxeda Highbank AHCI SATA platform driver - * Copyright 2012 Calxeda, Inc. - * - * based on the AHCI SATA platform driver by Jeff Garzik and Anton Vorontsov - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along with - * this program. If not, see . - */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "ahci.h" - -#define CPHY_MAP(dev, addr) ((((dev) & 0x1f) << 7) | (((addr) >> 9) & 0x7f)) -#define CPHY_ADDR(addr) (((addr) & 0x1ff) << 2) -#define SERDES_CR_CTL 0x80a0 -#define SERDES_CR_ADDR 0x80a1 -#define SERDES_CR_DATA 0x80a2 -#define CR_BUSY 0x0001 -#define CR_START 0x0001 -#define CR_WR_RDN 0x0002 -#define CPHY_RX_INPUT_STS 0x2002 -#define CPHY_SATA_OVERRIDE 0x4000 -#define CPHY_OVERRIDE 0x2005 -#define SPHY_LANE 0x100 -#define SPHY_HALF_RATE 0x0001 -#define CPHY_SATA_DPLL_MODE 0x0700 -#define CPHY_SATA_DPLL_SHIFT 8 -#define CPHY_SATA_DPLL_RESET (1 << 11) -#define CPHY_PHY_COUNT 6 -#define CPHY_LANE_COUNT 4 -#define CPHY_PORT_COUNT (CPHY_PHY_COUNT * CPHY_LANE_COUNT) - -static DEFINE_SPINLOCK(cphy_lock); -/* Each of the 6 phys can have up to 4 sata ports attached to i. Map 0-based - * sata ports to their phys and then to their lanes within the phys - */ -struct phy_lane_info { - void __iomem *phy_base; - u8 lane_mapping; - u8 phy_devs; -}; -static struct phy_lane_info port_data[CPHY_PORT_COUNT]; - -static u32 __combo_phy_reg_read(u8 sata_port, u32 addr) -{ - u32 data; - u8 dev = port_data[sata_port].phy_devs; - spin_lock(&cphy_lock); - writel(CPHY_MAP(dev, addr), port_data[sata_port].phy_base + 0x800); - data = readl(port_data[sata_port].phy_base + CPHY_ADDR(addr)); - spin_unlock(&cphy_lock); - return data; -} - -static void __combo_phy_reg_write(u8 sata_port, u32 addr, u32 data) -{ - u8 dev = port_data[sata_port].phy_devs; - spin_lock(&cphy_lock); - writel(CPHY_MAP(dev, addr), port_data[sata_port].phy_base + 0x800); - writel(data, port_data[sata_port].phy_base + CPHY_ADDR(addr)); - spin_unlock(&cphy_lock); -} - -static void combo_phy_wait_for_ready(u8 sata_port) -{ - while (__combo_phy_reg_read(sata_port, SERDES_CR_CTL) & CR_BUSY) - udelay(5); -} - -static u32 combo_phy_read(u8 sata_port, u32 addr) -{ - combo_phy_wait_for_ready(sata_port); - __combo_phy_reg_write(sata_port, SERDES_CR_ADDR, addr); - __combo_phy_reg_write(sata_port, SERDES_CR_CTL, CR_START); - combo_phy_wait_for_ready(sata_port); - return __combo_phy_reg_read(sata_port, SERDES_CR_DATA); -} - -static void combo_phy_write(u8 sata_port, u32 addr, u32 data) -{ - combo_phy_wait_for_ready(sata_port); - __combo_phy_reg_write(sata_port, SERDES_CR_ADDR, addr); - __combo_phy_reg_write(sata_port, SERDES_CR_DATA, data); - __combo_phy_reg_write(sata_port, SERDES_CR_CTL, CR_WR_RDN | CR_START); -} - -static void highbank_cphy_disable_overrides(u8 sata_port) -{ - u8 lane = port_data[sata_port].lane_mapping; - u32 tmp; - if (unlikely(port_data[sata_port].phy_base == NULL)) - return; - tmp = combo_phy_read(sata_port, CPHY_RX_INPUT_STS + lane * SPHY_LANE); - tmp &= ~CPHY_SATA_OVERRIDE; - combo_phy_write(sata_port, CPHY_OVERRIDE + lane * SPHY_LANE, tmp); -} - -static void cphy_override_rx_mode(u8 sata_port, u32 val) -{ - u8 lane = port_data[sata_port].lane_mapping; - u32 tmp; - tmp = combo_phy_read(sata_port, CPHY_RX_INPUT_STS + lane * SPHY_LANE); - tmp &= ~CPHY_SATA_OVERRIDE; - combo_phy_write(sata_port, CPHY_OVERRIDE + lane * SPHY_LANE, tmp); - - tmp |= CPHY_SATA_OVERRIDE; - combo_phy_write(sata_port, CPHY_OVERRIDE + lane * SPHY_LANE, tmp); - - tmp &= ~CPHY_SATA_DPLL_MODE; - tmp |= val << CPHY_SATA_DPLL_SHIFT; - combo_phy_write(sata_port, CPHY_OVERRIDE + lane * SPHY_LANE, tmp); - - tmp |= CPHY_SATA_DPLL_RESET; - combo_phy_write(sata_port, CPHY_OVERRIDE + lane * SPHY_LANE, tmp); - - tmp &= ~CPHY_SATA_DPLL_RESET; - combo_phy_write(sata_port, CPHY_OVERRIDE + lane * SPHY_LANE, tmp); - - msleep(15); -} - -static void highbank_cphy_override_lane(u8 sata_port) -{ - u8 lane = port_data[sata_port].lane_mapping; - u32 tmp, k = 0; - - if (unlikely(port_data[sata_port].phy_base == NULL)) - return; - do { - tmp = combo_phy_read(sata_port, CPHY_RX_INPUT_STS + - lane * SPHY_LANE); - } while ((tmp & SPHY_HALF_RATE) && (k++ < 1000)); - cphy_override_rx_mode(sata_port, 3); -} - -static int highbank_initialize_phys(struct device *dev, void __iomem *addr) -{ - struct device_node *sata_node = dev->of_node; - int phy_count = 0, phy, port = 0; - void __iomem *cphy_base[CPHY_PHY_COUNT]; - struct device_node *phy_nodes[CPHY_PHY_COUNT]; - memset(port_data, 0, sizeof(struct phy_lane_info) * CPHY_PORT_COUNT); - memset(phy_nodes, 0, sizeof(struct device_node*) * CPHY_PHY_COUNT); - - do { - u32 tmp; - struct of_phandle_args phy_data; - if (of_parse_phandle_with_args(sata_node, - "calxeda,port-phys", "#phy-cells", - port, &phy_data)) - break; - for (phy = 0; phy < phy_count; phy++) { - if (phy_nodes[phy] == phy_data.np) - break; - } - if (phy_nodes[phy] == NULL) { - phy_nodes[phy] = phy_data.np; - cphy_base[phy] = of_iomap(phy_nodes[phy], 0); - if (cphy_base[phy] == NULL) { - return 0; - } - phy_count += 1; - } - port_data[port].lane_mapping = phy_data.args[0]; - of_property_read_u32(phy_nodes[phy], "phydev", &tmp); - port_data[port].phy_devs = tmp; - port_data[port].phy_base = cphy_base[phy]; - of_node_put(phy_data.np); - port += 1; - } while (port < CPHY_PORT_COUNT); - return 0; -} - -static int ahci_highbank_hardreset(struct ata_link *link, unsigned int *class, - unsigned long deadline) -{ - const unsigned long *timing = sata_ehc_deb_timing(&link->eh_context); - struct ata_port *ap = link->ap; - struct ahci_port_priv *pp = ap->private_data; - u8 *d2h_fis = pp->rx_fis + RX_FIS_D2H_REG; - struct ata_taskfile tf; - bool online; - u32 sstatus; - int rc; - int retry = 10; - - ahci_stop_engine(ap); - - /* clear D2H reception area to properly wait for D2H FIS */ - ata_tf_init(link->device, &tf); - tf.command = 0x80; - ata_tf_to_fis(&tf, 0, 0, d2h_fis); - - do { - highbank_cphy_disable_overrides(link->ap->port_no); - rc = sata_link_hardreset(link, timing, deadline, &online, NULL); - highbank_cphy_override_lane(link->ap->port_no); - - /* If the status is 1, we are connected, but the link did not - * come up. So retry resetting the link again. - */ - if (sata_scr_read(link, SCR_STATUS, &sstatus)) - break; - if (!(sstatus & 0x3)) - break; - } while (!online && retry--); - - ahci_start_engine(ap); - - if (online) - *class = ahci_dev_classify(ap); - - return rc; -} - -static struct ata_port_operations ahci_highbank_ops = { - .inherits = &ahci_ops, - .hardreset = ahci_highbank_hardreset, -}; - -static const struct ata_port_info ahci_highbank_port_info = { - .flags = AHCI_FLAG_COMMON, - .pio_mask = ATA_PIO4, - .udma_mask = ATA_UDMA6, - .port_ops = &ahci_highbank_ops, -}; - -static struct scsi_host_template ahci_highbank_platform_sht = { - AHCI_SHT("highbank-ahci"), -}; - -static const struct of_device_id ahci_of_match[] = { - { .compatible = "calxeda,hb-ahci" }, - {}, -}; -MODULE_DEVICE_TABLE(of, ahci_of_match); - -static int __init ahci_highbank_probe(struct platform_device *pdev) -{ - struct device *dev = &pdev->dev; - struct ahci_host_priv *hpriv; - struct ata_host *host; - struct resource *mem; - int irq; - int n_ports; - int i; - int rc; - struct ata_port_info pi = ahci_highbank_port_info; - const struct ata_port_info *ppi[] = { &pi, NULL }; - - mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!mem) { - dev_err(dev, "no mmio space\n"); - return -EINVAL; - } - - irq = platform_get_irq(pdev, 0); - if (irq <= 0) { - dev_err(dev, "no irq\n"); - return -EINVAL; - } - - hpriv = devm_kzalloc(dev, sizeof(*hpriv), GFP_KERNEL); - if (!hpriv) { - dev_err(dev, "can't alloc ahci_host_priv\n"); - return -ENOMEM; - } - - hpriv->flags |= (unsigned long)pi.private_data; - - hpriv->mmio = devm_ioremap(dev, mem->start, resource_size(mem)); - if (!hpriv->mmio) { - dev_err(dev, "can't map %pR\n", mem); - return -ENOMEM; - } - - rc = highbank_initialize_phys(dev, hpriv->mmio); - if (rc) - return rc; - - - ahci_save_initial_config(dev, hpriv, 0, 0); - - /* prepare host */ - if (hpriv->cap & HOST_CAP_NCQ) - pi.flags |= ATA_FLAG_NCQ; - - if (hpriv->cap & HOST_CAP_PMP) - pi.flags |= ATA_FLAG_PMP; - - ahci_set_em_messages(hpriv, &pi); - - /* CAP.NP sometimes indicate the index of the last enabled - * port, at other times, that of the last possible port, so - * determining the maximum port number requires looking at - * both CAP.NP and port_map. - */ - n_ports = max(ahci_nr_ports(hpriv->cap), fls(hpriv->port_map)); - - host = ata_host_alloc_pinfo(dev, ppi, n_ports); - if (!host) { - rc = -ENOMEM; - goto err0; - } - - host->private_data = hpriv; - - if (!(hpriv->cap & HOST_CAP_SSS) || ahci_ignore_sss) - host->flags |= ATA_HOST_PARALLEL_SCAN; - - if (pi.flags & ATA_FLAG_EM) - ahci_reset_em(host); - - for (i = 0; i < host->n_ports; i++) { - struct ata_port *ap = host->ports[i]; - - ata_port_desc(ap, "mmio %pR", mem); - ata_port_desc(ap, "port 0x%x", 0x100 + ap->port_no * 0x80); - - /* set enclosure management message type */ - if (ap->flags & ATA_FLAG_EM) - ap->em_message_type = hpriv->em_msg_type; - - /* disabled/not-implemented port */ - if (!(hpriv->port_map & (1 << i))) - ap->ops = &ata_dummy_port_ops; - } - - rc = ahci_reset_controller(host); - if (rc) - goto err0; - - ahci_init_controller(host); - ahci_print_info(host, "platform"); - - rc = ata_host_activate(host, irq, ahci_interrupt, 0, - &ahci_highbank_platform_sht); - if (rc) - goto err0; - - return 0; -err0: - return rc; -} - -static int __devexit ahci_highbank_remove(struct platform_device *pdev) -{ - struct device *dev = &pdev->dev; - struct ata_host *host = dev_get_drvdata(dev); - - ata_host_detach(host); - - return 0; -} - -#ifdef CONFIG_PM -static int ahci_highbank_suspend(struct device *dev) -{ - struct ata_host *host = dev_get_drvdata(dev); - struct ahci_host_priv *hpriv = host->private_data; - void __iomem *mmio = hpriv->mmio; - u32 ctl; - int rc; - - if (hpriv->flags & AHCI_HFLAG_NO_SUSPEND) { - dev_err(dev, "firmware update required for suspend/resume\n"); - return -EIO; - } - - /* - * AHCI spec rev1.1 section 8.3.3: - * Software must disable interrupts prior to requesting a - * transition of the HBA to D3 state. - */ - ctl = readl(mmio + HOST_CTL); - ctl &= ~HOST_IRQ_EN; - writel(ctl, mmio + HOST_CTL); - readl(mmio + HOST_CTL); /* flush */ - - rc = ata_host_suspend(host, PMSG_SUSPEND); - if (rc) - return rc; - - return 0; -} - -static int ahci_highbank_resume(struct device *dev) -{ - struct ata_host *host = dev_get_drvdata(dev); - int rc; - - if (dev->power.power_state.event == PM_EVENT_SUSPEND) { - rc = ahci_reset_controller(host); - if (rc) - return rc; - - ahci_init_controller(host); - } - - ata_host_resume(host); - - return 0; -} -#endif - -SIMPLE_DEV_PM_OPS(ahci_highbank_pm_ops, - ahci_highbank_suspend, ahci_highbank_resume); - -static struct platform_driver ahci_highbank_driver = { - .remove = __devexit_p(ahci_highbank_remove), - .driver = { - .name = "highbank-ahci", - .owner = THIS_MODULE, - .of_match_table = ahci_of_match, - .pm = &ahci_highbank_pm_ops, - }, - .probe = ahci_highbank_probe, -}; - -module_platform_driver(ahci_highbank_driver); - -MODULE_DESCRIPTION("Calxeda Highbank AHCI SATA platform driver"); -MODULE_AUTHOR("Mark Langsdorf "); -MODULE_LICENSE("GPL"); -MODULE_ALIAS("sata:highbank"); diff --git a/trunk/drivers/ata/sata_mv.c b/trunk/drivers/ata/sata_mv.c index 68f4fb54d627..311be18d3f03 100644 --- a/trunk/drivers/ata/sata_mv.c +++ b/trunk/drivers/ata/sata_mv.c @@ -79,8 +79,8 @@ * module options */ -#ifdef CONFIG_PCI static int msi; +#ifdef CONFIG_PCI module_param(msi, int, S_IRUGO); MODULE_PARM_DESC(msi, "Enable use of PCI MSI (0=off, 1=on)"); #endif @@ -652,13 +652,12 @@ static u8 mv_sff_check_status(struct ata_port *ap); * because we have to allow room for worst case splitting of * PRDs for 64K boundaries in mv_fill_sg(). */ -#ifdef CONFIG_PCI static struct scsi_host_template mv5_sht = { ATA_BASE_SHT(DRV_NAME), .sg_tablesize = MV_MAX_SG_CT / 2, .dma_boundary = MV_DMA_BOUNDARY, }; -#endif + static struct scsi_host_template mv6_sht = { ATA_NCQ_SHT(DRV_NAME), .can_queue = MV_MAX_Q_DEPTH - 1, @@ -1253,7 +1252,7 @@ static void mv_dump_mem(void __iomem *start, unsigned bytes) } } #endif -#if defined(ATA_DEBUG) || defined(CONFIG_PCI) + static void mv_dump_pci_cfg(struct pci_dev *pdev, unsigned bytes) { #ifdef ATA_DEBUG @@ -1270,7 +1269,6 @@ static void mv_dump_pci_cfg(struct pci_dev *pdev, unsigned bytes) } #endif } -#endif static void mv_dump_all_regs(void __iomem *mmio_base, int port, struct pci_dev *pdev) { diff --git a/trunk/drivers/atm/eni.c b/trunk/drivers/atm/eni.c index 81e44f7b0ab6..2059ee460b0c 100644 --- a/trunk/drivers/atm/eni.c +++ b/trunk/drivers/atm/eni.c @@ -1567,7 +1567,7 @@ tx_complete++; /*--------------------------------- entries ---------------------------------*/ -static char * const media_name[] __devinitconst = { +static const char *media_name[] __devinitdata = { "MMF", "SMF", "MMF", "03?", /* 0- 3 */ "UTP", "05?", "06?", "07?", /* 4- 7 */ "TAXI","09?", "10?", "11?", /* 8-11 */ diff --git a/trunk/drivers/base/dma-buf.c b/trunk/drivers/base/dma-buf.c index 460e22dee36d..c30f3e1d0efc 100644 --- a/trunk/drivers/base/dma-buf.c +++ b/trunk/drivers/base/dma-buf.c @@ -460,7 +460,8 @@ int dma_buf_mmap(struct dma_buf *dmabuf, struct vm_area_struct *vma, if (vma->vm_file) fput(vma->vm_file); - vma->vm_file = get_file(dmabuf->file); + vma->vm_file = dmabuf->file; + get_file(vma->vm_file); vma->vm_pgoff = pgoff; diff --git a/trunk/drivers/base/dma-contiguous.c b/trunk/drivers/base/dma-contiguous.c index 9a1469474f55..34d94c762a1e 100644 --- a/trunk/drivers/base/dma-contiguous.c +++ b/trunk/drivers/base/dma-contiguous.c @@ -315,7 +315,6 @@ struct page *dma_alloc_from_contiguous(struct device *dev, int count, { unsigned long mask, pfn, pageno, start = 0; struct cma *cma = dev_get_cma_area(dev); - struct page *page = NULL; int ret; if (!cma || !cma->count) @@ -337,17 +336,18 @@ struct page *dma_alloc_from_contiguous(struct device *dev, int count, for (;;) { pageno = bitmap_find_next_zero_area(cma->bitmap, cma->count, start, count, mask); - if (pageno >= cma->count) - break; + if (pageno >= cma->count) { + ret = -ENOMEM; + goto error; + } pfn = cma->base_pfn + pageno; ret = alloc_contig_range(pfn, pfn + count, MIGRATE_CMA); if (ret == 0) { bitmap_set(cma->bitmap, pageno, count); - page = pfn_to_page(pfn); break; } else if (ret != -EBUSY) { - break; + goto error; } pr_debug("%s(): memory range at %p is busy, retrying\n", __func__, pfn_to_page(pfn)); @@ -356,8 +356,12 @@ struct page *dma_alloc_from_contiguous(struct device *dev, int count, } mutex_unlock(&cma_mutex); - pr_debug("%s(): returned %p\n", __func__, page); - return page; + + pr_debug("%s(): returned %p\n", __func__, pfn_to_page(pfn)); + return pfn_to_page(pfn); +error: + mutex_unlock(&cma_mutex); + return NULL; } /** diff --git a/trunk/drivers/base/firmware_class.c b/trunk/drivers/base/firmware_class.c index 81541452887b..6e210802c37b 100644 --- a/trunk/drivers/base/firmware_class.c +++ b/trunk/drivers/base/firmware_class.c @@ -21,83 +21,18 @@ #include #include #include -#include #include #include #include #include #include -#include - #include "base.h" MODULE_AUTHOR("Manuel Estrada Sainz"); MODULE_DESCRIPTION("Multi purpose firmware loading support"); MODULE_LICENSE("GPL"); -static const char *fw_path[] = { - "/lib/firmware/updates/" UTS_RELEASE, - "/lib/firmware/updates", - "/lib/firmware/" UTS_RELEASE, - "/lib/firmware" -}; - -/* Don't inline this: 'struct kstat' is biggish */ -static noinline long fw_file_size(struct file *file) -{ - struct kstat st; - if (vfs_getattr(file->f_path.mnt, file->f_path.dentry, &st)) - return -1; - if (!S_ISREG(st.mode)) - return -1; - if (st.size != (long)st.size) - return -1; - return st.size; -} - -static bool fw_read_file_contents(struct file *file, struct firmware *fw) -{ - long size; - char *buf; - - size = fw_file_size(file); - if (size < 0) - return false; - buf = vmalloc(size); - if (!buf) - return false; - if (kernel_read(file, 0, buf, size) != size) { - vfree(buf); - return false; - } - fw->data = buf; - fw->size = size; - return true; -} - -static bool fw_get_filesystem_firmware(struct firmware *fw, const char *name) -{ - int i; - bool success = false; - char *path = __getname(); - - for (i = 0; i < ARRAY_SIZE(fw_path); i++) { - struct file *file; - snprintf(path, PATH_MAX, "%s/%s", fw_path[i], name); - - file = filp_open(path, O_RDONLY, 0); - if (IS_ERR(file)) - continue; - success = fw_read_file_contents(file, fw); - fput(file); - if (success) - break; - } - __putname(path); - return success; -} - /* Builtin firmware support */ #ifdef CONFIG_FW_LOADER @@ -411,11 +346,7 @@ static ssize_t firmware_loading_show(struct device *dev, /* firmware holds the ownership of pages */ static void firmware_free_data(const struct firmware *fw) { - /* Loaded directly? */ - if (!fw->priv) { - vfree(fw->data); - return; - } + WARN_ON(!fw->priv); fw_free_buf(fw->priv); } @@ -778,11 +709,6 @@ _request_firmware_prepare(const struct firmware **firmware_p, const char *name, return NULL; } - if (fw_get_filesystem_firmware(firmware, name)) { - dev_dbg(device, "firmware: direct-loading firmware %s\n", name); - return NULL; - } - ret = fw_lookup_and_allocate_buf(name, &fw_cache, &buf); if (!ret) fw_priv = fw_create_instance(firmware, name, device, diff --git a/trunk/drivers/base/platform.c b/trunk/drivers/base/platform.c index 8727e9c5eea4..ddeca142293c 100644 --- a/trunk/drivers/base/platform.c +++ b/trunk/drivers/base/platform.c @@ -23,7 +23,6 @@ #include #include "base.h" -#include "power/power.h" /* For automatically allocated device IDs */ static DEFINE_IDA(platform_devid_ida); @@ -984,7 +983,6 @@ void __init early_platform_add_devices(struct platform_device **devs, int num) dev = &devs[i]->dev; if (!dev->devres_head.next) { - pm_runtime_early_init(dev); INIT_LIST_HEAD(&dev->devres_head); list_add_tail(&dev->devres_head, &early_platform_device_list); diff --git a/trunk/drivers/base/power/domain.c b/trunk/drivers/base/power/domain.c index c22b869245d9..ba3487c9835b 100644 --- a/trunk/drivers/base/power/domain.c +++ b/trunk/drivers/base/power/domain.c @@ -53,24 +53,6 @@ static LIST_HEAD(gpd_list); static DEFINE_MUTEX(gpd_list_lock); -static struct generic_pm_domain *pm_genpd_lookup_name(const char *domain_name) -{ - struct generic_pm_domain *genpd = NULL, *gpd; - - if (IS_ERR_OR_NULL(domain_name)) - return NULL; - - mutex_lock(&gpd_list_lock); - list_for_each_entry(gpd, &gpd_list, gpd_list_node) { - if (!strcmp(gpd->name, domain_name)) { - genpd = gpd; - break; - } - } - mutex_unlock(&gpd_list_lock); - return genpd; -} - #ifdef CONFIG_PM struct generic_pm_domain *dev_to_genpd(struct device *dev) @@ -274,28 +256,10 @@ int pm_genpd_poweron(struct generic_pm_domain *genpd) return ret; } -/** - * pm_genpd_name_poweron - Restore power to a given PM domain and its masters. - * @domain_name: Name of the PM domain to power up. - */ -int pm_genpd_name_poweron(const char *domain_name) -{ - struct generic_pm_domain *genpd; - - genpd = pm_genpd_lookup_name(domain_name); - return genpd ? pm_genpd_poweron(genpd) : -EINVAL; -} - #endif /* CONFIG_PM */ #ifdef CONFIG_PM_RUNTIME -static int genpd_start_dev_no_timing(struct generic_pm_domain *genpd, - struct device *dev) -{ - return GENPD_DEV_CALLBACK(genpd, int, start, dev); -} - static int genpd_save_dev(struct generic_pm_domain *genpd, struct device *dev) { return GENPD_DEV_TIMED_CALLBACK(genpd, int, save_state, dev, @@ -472,7 +436,7 @@ static int pm_genpd_poweroff(struct generic_pm_domain *genpd) not_suspended = 0; list_for_each_entry(pdd, &genpd->dev_list, list_node) if (pdd->dev->driver && (!pm_runtime_suspended(pdd->dev) - || pdd->dev->power.irq_safe)) + || pdd->dev->power.irq_safe || to_gpd_data(pdd)->always_on)) not_suspended++; if (not_suspended > genpd->in_progress) @@ -614,6 +578,9 @@ static int pm_genpd_runtime_suspend(struct device *dev) might_sleep_if(!genpd->dev_irq_safe); + if (dev_gpd_data(dev)->always_on) + return -EBUSY; + stop_ok = genpd->gov ? genpd->gov->stop_ok : NULL; if (stop_ok && !stop_ok(dev)) return -EBUSY; @@ -662,7 +629,7 @@ static int pm_genpd_runtime_resume(struct device *dev) /* If power.irq_safe, the PM domain is never powered off. */ if (dev->power.irq_safe) - return genpd_start_dev_no_timing(genpd, dev); + return genpd_start_dev(genpd, dev); mutex_lock(&genpd->lock); ret = __pm_genpd_poweron(genpd); @@ -730,24 +697,6 @@ static inline void genpd_power_off_work_fn(struct work_struct *work) {} #ifdef CONFIG_PM_SLEEP -/** - * pm_genpd_present - Check if the given PM domain has been initialized. - * @genpd: PM domain to check. - */ -static bool pm_genpd_present(struct generic_pm_domain *genpd) -{ - struct generic_pm_domain *gpd; - - if (IS_ERR_OR_NULL(genpd)) - return false; - - list_for_each_entry(gpd, &gpd_list, gpd_list_node) - if (gpd == genpd) - return true; - - return false; -} - static bool genpd_dev_active_wakeup(struct generic_pm_domain *genpd, struct device *dev) { @@ -801,10 +750,9 @@ static int genpd_thaw_dev(struct generic_pm_domain *genpd, struct device *dev) * Check if the given PM domain can be powered off (during system suspend or * hibernation) and do that if so. Also, in that case propagate to its masters. * - * This function is only called in "noirq" and "syscore" stages of system power - * transitions, so it need not acquire locks (all of the "noirq" callbacks are - * executed sequentially, so it is guaranteed that it will never run twice in - * parallel). + * This function is only called in "noirq" stages of system power transitions, + * so it need not acquire locks (all of the "noirq" callbacks are executed + * sequentially, so it is guaranteed that it will never run twice in parallel). */ static void pm_genpd_sync_poweroff(struct generic_pm_domain *genpd) { @@ -828,33 +776,6 @@ static void pm_genpd_sync_poweroff(struct generic_pm_domain *genpd) } } -/** - * pm_genpd_sync_poweron - Synchronously power on a PM domain and its masters. - * @genpd: PM domain to power on. - * - * This function is only called in "noirq" and "syscore" stages of system power - * transitions, so it need not acquire locks (all of the "noirq" callbacks are - * executed sequentially, so it is guaranteed that it will never run twice in - * parallel). - */ -static void pm_genpd_sync_poweron(struct generic_pm_domain *genpd) -{ - struct gpd_link *link; - - if (genpd->status != GPD_STATE_POWER_OFF) - return; - - list_for_each_entry(link, &genpd->slave_links, slave_node) { - pm_genpd_sync_poweron(link->master); - genpd_sd_counter_inc(link->master); - } - - if (genpd->power_on) - genpd->power_on(genpd); - - genpd->status = GPD_STATE_ACTIVE; -} - /** * resume_needed - Check whether to resume a device before system suspend. * @dev: Device to check. @@ -1016,7 +937,7 @@ static int pm_genpd_suspend_noirq(struct device *dev) if (IS_ERR(genpd)) return -EINVAL; - if (genpd->suspend_power_off + if (genpd->suspend_power_off || dev_gpd_data(dev)->always_on || (dev->power.wakeup_path && genpd_dev_active_wakeup(genpd, dev))) return 0; @@ -1049,7 +970,7 @@ static int pm_genpd_resume_noirq(struct device *dev) if (IS_ERR(genpd)) return -EINVAL; - if (genpd->suspend_power_off + if (genpd->suspend_power_off || dev_gpd_data(dev)->always_on || (dev->power.wakeup_path && genpd_dev_active_wakeup(genpd, dev))) return 0; @@ -1058,7 +979,7 @@ static int pm_genpd_resume_noirq(struct device *dev) * guaranteed that this function will never run twice in parallel for * the same PM domain, so it is not necessary to use locking here. */ - pm_genpd_sync_poweron(genpd); + pm_genpd_poweron(genpd); genpd->suspended_count--; return genpd_start_dev(genpd, dev); @@ -1169,7 +1090,8 @@ static int pm_genpd_freeze_noirq(struct device *dev) if (IS_ERR(genpd)) return -EINVAL; - return genpd->suspend_power_off ? 0 : genpd_stop_dev(genpd, dev); + return genpd->suspend_power_off || dev_gpd_data(dev)->always_on ? + 0 : genpd_stop_dev(genpd, dev); } /** @@ -1189,7 +1111,8 @@ static int pm_genpd_thaw_noirq(struct device *dev) if (IS_ERR(genpd)) return -EINVAL; - return genpd->suspend_power_off ? 0 : genpd_start_dev(genpd, dev); + return genpd->suspend_power_off || dev_gpd_data(dev)->always_on ? + 0 : genpd_start_dev(genpd, dev); } /** @@ -1263,8 +1186,8 @@ static int pm_genpd_restore_noirq(struct device *dev) if (genpd->suspended_count++ == 0) { /* * The boot kernel might put the domain into arbitrary state, - * so make it appear as powered off to pm_genpd_sync_poweron(), - * so that it tries to power it on in case it was really off. + * so make it appear as powered off to pm_genpd_poweron(), so + * that it tries to power it on in case it was really off. */ genpd->status = GPD_STATE_POWER_OFF; if (genpd->suspend_power_off) { @@ -1282,9 +1205,9 @@ static int pm_genpd_restore_noirq(struct device *dev) if (genpd->suspend_power_off) return 0; - pm_genpd_sync_poweron(genpd); + pm_genpd_poweron(genpd); - return genpd_start_dev(genpd, dev); + return dev_gpd_data(dev)->always_on ? 0 : genpd_start_dev(genpd, dev); } /** @@ -1323,31 +1246,6 @@ static void pm_genpd_complete(struct device *dev) } } -/** - * pm_genpd_syscore_switch - Switch power during system core suspend or resume. - * @dev: Device that normally is marked as "always on" to switch power for. - * - * This routine may only be called during the system core (syscore) suspend or - * resume phase for devices whose "always on" flags are set. - */ -void pm_genpd_syscore_switch(struct device *dev, bool suspend) -{ - struct generic_pm_domain *genpd; - - genpd = dev_to_genpd(dev); - if (!pm_genpd_present(genpd)) - return; - - if (suspend) { - genpd->suspended_count++; - pm_genpd_sync_poweroff(genpd); - } else { - pm_genpd_sync_poweron(genpd); - genpd->suspended_count--; - } -} -EXPORT_SYMBOL_GPL(pm_genpd_syscore_switch); - #else #define pm_genpd_prepare NULL @@ -1495,19 +1393,6 @@ int __pm_genpd_of_add_device(struct device_node *genpd_node, struct device *dev, return __pm_genpd_add_device(genpd, dev, td); } - -/** - * __pm_genpd_name_add_device - Find I/O PM domain and add a device to it. - * @domain_name: Name of the PM domain to add the device to. - * @dev: Device to be added. - * @td: Set of PM QoS timing parameters to attach to the device. - */ -int __pm_genpd_name_add_device(const char *domain_name, struct device *dev, - struct gpd_timing_data *td) -{ - return __pm_genpd_add_device(pm_genpd_lookup_name(domain_name), dev, td); -} - /** * pm_genpd_remove_device - Remove a device from an I/O PM domain. * @genpd: PM domain to remove the device from. @@ -1569,6 +1454,26 @@ int pm_genpd_remove_device(struct generic_pm_domain *genpd, return ret; } +/** + * pm_genpd_dev_always_on - Set/unset the "always on" flag for a given device. + * @dev: Device to set/unset the flag for. + * @val: The new value of the device's "always on" flag. + */ +void pm_genpd_dev_always_on(struct device *dev, bool val) +{ + struct pm_subsys_data *psd; + unsigned long flags; + + spin_lock_irqsave(&dev->power.lock, flags); + + psd = dev_to_psd(dev); + if (psd && psd->domain_data) + to_gpd_data(psd->domain_data)->always_on = val; + + spin_unlock_irqrestore(&dev->power.lock, flags); +} +EXPORT_SYMBOL_GPL(pm_genpd_dev_always_on); + /** * pm_genpd_dev_need_restore - Set/unset the device's "need restore" flag. * @dev: Device to set/unset the flag for. @@ -1600,8 +1505,7 @@ int pm_genpd_add_subdomain(struct generic_pm_domain *genpd, struct gpd_link *link; int ret = 0; - if (IS_ERR_OR_NULL(genpd) || IS_ERR_OR_NULL(subdomain) - || genpd == subdomain) + if (IS_ERR_OR_NULL(genpd) || IS_ERR_OR_NULL(subdomain)) return -EINVAL; start: @@ -1647,35 +1551,6 @@ int pm_genpd_add_subdomain(struct generic_pm_domain *genpd, return ret; } -/** - * pm_genpd_add_subdomain_names - Add a subdomain to an I/O PM domain. - * @master_name: Name of the master PM domain to add the subdomain to. - * @subdomain_name: Name of the subdomain to be added. - */ -int pm_genpd_add_subdomain_names(const char *master_name, - const char *subdomain_name) -{ - struct generic_pm_domain *master = NULL, *subdomain = NULL, *gpd; - - if (IS_ERR_OR_NULL(master_name) || IS_ERR_OR_NULL(subdomain_name)) - return -EINVAL; - - mutex_lock(&gpd_list_lock); - list_for_each_entry(gpd, &gpd_list, gpd_list_node) { - if (!master && !strcmp(gpd->name, master_name)) - master = gpd; - - if (!subdomain && !strcmp(gpd->name, subdomain_name)) - subdomain = gpd; - - if (master && subdomain) - break; - } - mutex_unlock(&gpd_list_lock); - - return pm_genpd_add_subdomain(master, subdomain); -} - /** * pm_genpd_remove_subdomain - Remove a subdomain from an I/O PM domain. * @genpd: Master PM domain to remove the subdomain from. @@ -1829,16 +1704,7 @@ int __pm_genpd_remove_callbacks(struct device *dev, bool clear_td) } EXPORT_SYMBOL_GPL(__pm_genpd_remove_callbacks); -/** - * pm_genpd_attach_cpuidle - Connect the given PM domain with cpuidle. - * @genpd: PM domain to be connected with cpuidle. - * @state: cpuidle state this domain can disable/enable. - * - * Make a PM domain behave as though it contained a CPU core, that is, instead - * of calling its power down routine it will enable the given cpuidle state so - * that the cpuidle subsystem can power it down (if possible and desirable). - */ -int pm_genpd_attach_cpuidle(struct generic_pm_domain *genpd, int state) +int genpd_attach_cpuidle(struct generic_pm_domain *genpd, int state) { struct cpuidle_driver *cpuidle_drv; struct gpd_cpu_data *cpu_data; @@ -1887,24 +1753,7 @@ int pm_genpd_attach_cpuidle(struct generic_pm_domain *genpd, int state) goto out; } -/** - * pm_genpd_name_attach_cpuidle - Find PM domain and connect cpuidle to it. - * @name: Name of the domain to connect to cpuidle. - * @state: cpuidle state this domain can manipulate. - */ -int pm_genpd_name_attach_cpuidle(const char *name, int state) -{ - return pm_genpd_attach_cpuidle(pm_genpd_lookup_name(name), state); -} - -/** - * pm_genpd_detach_cpuidle - Remove the cpuidle connection from a PM domain. - * @genpd: PM domain to remove the cpuidle connection from. - * - * Remove the cpuidle connection set up by pm_genpd_attach_cpuidle() from the - * given PM domain. - */ -int pm_genpd_detach_cpuidle(struct generic_pm_domain *genpd) +int genpd_detach_cpuidle(struct generic_pm_domain *genpd) { struct gpd_cpu_data *cpu_data; struct cpuidle_state *idle_state; @@ -1935,15 +1784,6 @@ int pm_genpd_detach_cpuidle(struct generic_pm_domain *genpd) return ret; } -/** - * pm_genpd_name_detach_cpuidle - Find PM domain and disconnect cpuidle from it. - * @name: Name of the domain to disconnect cpuidle from. - */ -int pm_genpd_name_detach_cpuidle(const char *name) -{ - return pm_genpd_detach_cpuidle(pm_genpd_lookup_name(name)); -} - /* Default device callbacks for generic PM domains. */ /** diff --git a/trunk/drivers/base/power/main.c b/trunk/drivers/base/power/main.c index a3c1404c7933..b0b072a88f5f 100644 --- a/trunk/drivers/base/power/main.c +++ b/trunk/drivers/base/power/main.c @@ -57,17 +57,20 @@ static pm_message_t pm_transition; static int async_error; /** - * device_pm_sleep_init - Initialize system suspend-related device fields. + * device_pm_init - Initialize the PM-related part of a device object. * @dev: Device object being initialized. */ -void device_pm_sleep_init(struct device *dev) +void device_pm_init(struct device *dev) { dev->power.is_prepared = false; dev->power.is_suspended = false; init_completion(&dev->power.completion); complete_all(&dev->power.completion); dev->power.wakeup = NULL; + spin_lock_init(&dev->power.lock); + pm_runtime_init(dev); INIT_LIST_HEAD(&dev->power.entry); + dev->power.power_state = PMSG_INVALID; } /** @@ -405,9 +408,6 @@ static int device_resume_noirq(struct device *dev, pm_message_t state) TRACE_DEVICE(dev); TRACE_RESUME(0); - if (dev->power.syscore) - goto Out; - if (dev->pm_domain) { info = "noirq power domain "; callback = pm_noirq_op(&dev->pm_domain->ops, state); @@ -429,7 +429,6 @@ static int device_resume_noirq(struct device *dev, pm_message_t state) error = dpm_run_callback(callback, dev, state, info); - Out: TRACE_RESUME(error); return error; } @@ -487,9 +486,6 @@ static int device_resume_early(struct device *dev, pm_message_t state) TRACE_DEVICE(dev); TRACE_RESUME(0); - if (dev->power.syscore) - goto Out; - if (dev->pm_domain) { info = "early power domain "; callback = pm_late_early_op(&dev->pm_domain->ops, state); @@ -511,7 +507,6 @@ static int device_resume_early(struct device *dev, pm_message_t state) error = dpm_run_callback(callback, dev, state, info); - Out: TRACE_RESUME(error); return error; } @@ -570,13 +565,11 @@ static int device_resume(struct device *dev, pm_message_t state, bool async) pm_callback_t callback = NULL; char *info = NULL; int error = 0; + bool put = false; TRACE_DEVICE(dev); TRACE_RESUME(0); - if (dev->power.syscore) - goto Complete; - dpm_wait(dev->parent, async); device_lock(dev); @@ -590,6 +583,7 @@ static int device_resume(struct device *dev, pm_message_t state, bool async) goto Unlock; pm_runtime_enable(dev); + put = true; if (dev->pm_domain) { info = "power domain "; @@ -638,12 +632,13 @@ static int device_resume(struct device *dev, pm_message_t state, bool async) Unlock: device_unlock(dev); - - Complete: complete_all(&dev->power.completion); TRACE_RESUME(error); + if (put) + pm_runtime_put_sync(dev); + return error; } @@ -727,9 +722,6 @@ static void device_complete(struct device *dev, pm_message_t state) void (*callback)(struct device *) = NULL; char *info = NULL; - if (dev->power.syscore) - return; - device_lock(dev); if (dev->pm_domain) { @@ -757,8 +749,6 @@ static void device_complete(struct device *dev, pm_message_t state) } device_unlock(dev); - - pm_runtime_put_sync(dev); } /** @@ -844,9 +834,6 @@ static int device_suspend_noirq(struct device *dev, pm_message_t state) pm_callback_t callback = NULL; char *info = NULL; - if (dev->power.syscore) - return 0; - if (dev->pm_domain) { info = "noirq power domain "; callback = pm_noirq_op(&dev->pm_domain->ops, state); @@ -930,9 +917,6 @@ static int device_suspend_late(struct device *dev, pm_message_t state) pm_callback_t callback = NULL; char *info = NULL; - if (dev->power.syscore) - return 0; - if (dev->pm_domain) { info = "late power domain "; callback = pm_late_early_op(&dev->pm_domain->ops, state); @@ -1012,7 +996,7 @@ int dpm_suspend_end(pm_message_t state) error = dpm_suspend_noirq(state); if (error) { - dpm_resume_early(resume_event(state)); + dpm_resume_early(state); return error; } @@ -1059,23 +1043,16 @@ static int __device_suspend(struct device *dev, pm_message_t state, bool async) if (async_error) goto Complete; - /* - * If a device configured to wake up the system from sleep states - * has been suspended at run time and there's a resume request pending - * for it, this is equivalent to the device signaling wakeup, so the - * system suspend operation should be aborted. - */ + pm_runtime_get_noresume(dev); if (pm_runtime_barrier(dev) && device_may_wakeup(dev)) pm_wakeup_event(dev, 0); if (pm_wakeup_pending()) { + pm_runtime_put_sync(dev); async_error = -EBUSY; goto Complete; } - if (dev->power.syscore) - goto Complete; - device_lock(dev); if (dev->pm_domain) { @@ -1134,10 +1111,12 @@ static int __device_suspend(struct device *dev, pm_message_t state, bool async) Complete: complete_all(&dev->power.completion); - if (error) + if (error) { + pm_runtime_put_sync(dev); async_error = error; - else if (dev->power.is_suspended) + } else if (dev->power.is_suspended) { __pm_runtime_disable(dev, false); + } return error; } @@ -1230,17 +1209,6 @@ static int device_prepare(struct device *dev, pm_message_t state) char *info = NULL; int error = 0; - if (dev->power.syscore) - return 0; - - /* - * If a device's parent goes into runtime suspend at the wrong time, - * it won't be possible to resume the device. To prevent this we - * block runtime suspend here, during the prepare phase, and allow - * it again during the complete phase. - */ - pm_runtime_get_noresume(dev); - device_lock(dev); dev->power.wakeup_path = device_may_wakeup(dev); diff --git a/trunk/drivers/base/power/opp.c b/trunk/drivers/base/power/opp.c index d9468642fc41..ac993eafec82 100644 --- a/trunk/drivers/base/power/opp.c +++ b/trunk/drivers/base/power/opp.c @@ -22,7 +22,6 @@ #include #include #include -#include /* * Internal data structure organization with the OPP layer library is as @@ -675,49 +674,3 @@ struct srcu_notifier_head *opp_get_notifier(struct device *dev) return &dev_opp->head; } - -#ifdef CONFIG_OF -/** - * of_init_opp_table() - Initialize opp table from device tree - * @dev: device pointer used to lookup device OPPs. - * - * Register the initial OPP table with the OPP library for given device. - */ -int of_init_opp_table(struct device *dev) -{ - const struct property *prop; - const __be32 *val; - int nr; - - prop = of_find_property(dev->of_node, "operating-points", NULL); - if (!prop) - return -ENODEV; - if (!prop->value) - return -ENODATA; - - /* - * Each OPP is a set of tuples consisting of frequency and - * voltage like . - */ - nr = prop->length / sizeof(u32); - if (nr % 2) { - dev_err(dev, "%s: Invalid OPP list\n", __func__); - return -EINVAL; - } - - val = prop->value; - while (nr) { - unsigned long freq = be32_to_cpup(val++) * 1000; - unsigned long volt = be32_to_cpup(val++); - - if (opp_add(dev, freq, volt)) { - dev_warn(dev, "%s: Failed to add OPP %ld\n", - __func__, freq); - continue; - } - nr -= 2; - } - - return 0; -} -#endif diff --git a/trunk/drivers/base/power/power.h b/trunk/drivers/base/power/power.h index 0dbfdf4419af..eeb4bff9505c 100644 --- a/trunk/drivers/base/power/power.h +++ b/trunk/drivers/base/power/power.h @@ -1,32 +1,12 @@ #include -static inline void device_pm_init_common(struct device *dev) -{ - if (!dev->power.early_init) { - spin_lock_init(&dev->power.lock); - dev->power.power_state = PMSG_INVALID; - dev->power.early_init = true; - } -} - #ifdef CONFIG_PM_RUNTIME -static inline void pm_runtime_early_init(struct device *dev) -{ - dev->power.disable_depth = 1; - device_pm_init_common(dev); -} - extern void pm_runtime_init(struct device *dev); extern void pm_runtime_remove(struct device *dev); #else /* !CONFIG_PM_RUNTIME */ -static inline void pm_runtime_early_init(struct device *dev) -{ - device_pm_init_common(dev); -} - static inline void pm_runtime_init(struct device *dev) {} static inline void pm_runtime_remove(struct device *dev) {} @@ -45,7 +25,7 @@ static inline struct device *to_device(struct list_head *entry) return container_of(entry, struct device, power.entry); } -extern void device_pm_sleep_init(struct device *dev); +extern void device_pm_init(struct device *dev); extern void device_pm_add(struct device *); extern void device_pm_remove(struct device *); extern void device_pm_move_before(struct device *, struct device *); @@ -54,7 +34,12 @@ extern void device_pm_move_last(struct device *); #else /* !CONFIG_PM_SLEEP */ -static inline void device_pm_sleep_init(struct device *dev) {} +static inline void device_pm_init(struct device *dev) +{ + spin_lock_init(&dev->power.lock); + dev->power.power_state = PMSG_INVALID; + pm_runtime_init(dev); +} static inline void device_pm_add(struct device *dev) { @@ -75,13 +60,6 @@ static inline void device_pm_move_last(struct device *dev) {} #endif /* !CONFIG_PM_SLEEP */ -static inline void device_pm_init(struct device *dev) -{ - device_pm_init_common(dev); - device_pm_sleep_init(dev); - pm_runtime_init(dev); -} - #ifdef CONFIG_PM /* diff --git a/trunk/drivers/base/power/runtime.c b/trunk/drivers/base/power/runtime.c index 3148b10dc2e5..7d9c1cb1c39a 100644 --- a/trunk/drivers/base/power/runtime.c +++ b/trunk/drivers/base/power/runtime.c @@ -509,9 +509,6 @@ static int rpm_resume(struct device *dev, int rpmflags) repeat: if (dev->power.runtime_error) retval = -EINVAL; - else if (dev->power.disable_depth == 1 && dev->power.is_suspended - && dev->power.runtime_status == RPM_ACTIVE) - retval = 1; else if (dev->power.disable_depth > 0) retval = -EACCES; if (retval) diff --git a/trunk/drivers/base/power/wakeup.c b/trunk/drivers/base/power/wakeup.c index e6ee5e80e546..cbb463b3a750 100644 --- a/trunk/drivers/base/power/wakeup.c +++ b/trunk/drivers/base/power/wakeup.c @@ -127,8 +127,6 @@ EXPORT_SYMBOL_GPL(wakeup_source_destroy); */ void wakeup_source_add(struct wakeup_source *ws) { - unsigned long flags; - if (WARN_ON(!ws)) return; @@ -137,9 +135,9 @@ void wakeup_source_add(struct wakeup_source *ws) ws->active = false; ws->last_time = ktime_get(); - spin_lock_irqsave(&events_lock, flags); + spin_lock_irq(&events_lock); list_add_rcu(&ws->entry, &wakeup_sources); - spin_unlock_irqrestore(&events_lock, flags); + spin_unlock_irq(&events_lock); } EXPORT_SYMBOL_GPL(wakeup_source_add); @@ -149,14 +147,12 @@ EXPORT_SYMBOL_GPL(wakeup_source_add); */ void wakeup_source_remove(struct wakeup_source *ws) { - unsigned long flags; - if (WARN_ON(!ws)) return; - spin_lock_irqsave(&events_lock, flags); + spin_lock_irq(&events_lock); list_del_rcu(&ws->entry); - spin_unlock_irqrestore(&events_lock, flags); + spin_unlock_irq(&events_lock); synchronize_rcu(); } EXPORT_SYMBOL_GPL(wakeup_source_remove); @@ -653,31 +649,6 @@ void pm_wakeup_event(struct device *dev, unsigned int msec) } EXPORT_SYMBOL_GPL(pm_wakeup_event); -static void print_active_wakeup_sources(void) -{ - struct wakeup_source *ws; - int active = 0; - struct wakeup_source *last_activity_ws = NULL; - - rcu_read_lock(); - list_for_each_entry_rcu(ws, &wakeup_sources, entry) { - if (ws->active) { - pr_info("active wakeup source: %s\n", ws->name); - active = 1; - } else if (!active && - (!last_activity_ws || - ktime_to_ns(ws->last_time) > - ktime_to_ns(last_activity_ws->last_time))) { - last_activity_ws = ws; - } - } - - if (!active && last_activity_ws) - pr_info("last active wakeup source: %s\n", - last_activity_ws->name); - rcu_read_unlock(); -} - /** * pm_wakeup_pending - Check if power transition in progress should be aborted. * @@ -700,10 +671,6 @@ bool pm_wakeup_pending(void) events_check_enabled = !ret; } spin_unlock_irqrestore(&events_lock, flags); - - if (ret) - print_active_wakeup_sources(); - return ret; } @@ -756,16 +723,15 @@ bool pm_get_wakeup_count(unsigned int *count, bool block) bool pm_save_wakeup_count(unsigned int count) { unsigned int cnt, inpr; - unsigned long flags; events_check_enabled = false; - spin_lock_irqsave(&events_lock, flags); + spin_lock_irq(&events_lock); split_counters(&cnt, &inpr); if (cnt == count && inpr == 0) { saved_count = count; events_check_enabled = true; } - spin_unlock_irqrestore(&events_lock, flags); + spin_unlock_irq(&events_lock); return events_check_enabled; } diff --git a/trunk/drivers/block/aoe/aoe.h b/trunk/drivers/block/aoe/aoe.h index d2ed7f18d1ac..db195abad698 100644 --- a/trunk/drivers/block/aoe/aoe.h +++ b/trunk/drivers/block/aoe/aoe.h @@ -1,5 +1,5 @@ -/* Copyright (c) 2012 Coraid, Inc. See COPYING for GPL terms. */ -#define VERSION "50" +/* Copyright (c) 2007 Coraid, Inc. See COPYING for GPL terms. */ +#define VERSION "47" #define AOE_MAJOR 152 #define DEVICE_NAME "aoe" @@ -10,6 +10,9 @@ #define AOE_PARTITIONS (16) #endif +#define SYSMINOR(aoemajor, aoeminor) ((aoemajor) * NPERSHELF + (aoeminor)) +#define AOEMAJOR(sysminor) ((sysminor) / NPERSHELF) +#define AOEMINOR(sysminor) ((sysminor) % NPERSHELF) #define WHITESPACE " \t\v\f\n" enum { @@ -72,67 +75,72 @@ enum { DEVFL_UP = 1, /* device is installed in system and ready for AoE->ATA commands */ DEVFL_TKILL = (1<<1), /* flag for timer to know when to kill self */ DEVFL_EXT = (1<<2), /* device accepts lba48 commands */ - DEVFL_GDALLOC = (1<<3), /* need to alloc gendisk */ - DEVFL_KICKME = (1<<4), /* slow polling network card catch */ - DEVFL_NEWSIZE = (1<<5), /* need to update dev size in block layer */ + DEVFL_CLOSEWAIT = (1<<3), /* device is waiting for all closes to revalidate */ + DEVFL_GDALLOC = (1<<4), /* need to alloc gendisk */ + DEVFL_KICKME = (1<<5), /* slow polling network card catch */ + DEVFL_NEWSIZE = (1<<6), /* need to update dev size in block layer */ + + BUFFL_FAIL = 1, }; enum { DEFAULTBCNT = 2 * 512, /* 2 sectors */ + NPERSHELF = 16, /* number of slots per shelf address */ + FREETAG = -1, MIN_BUFS = 16, NTARGETS = 8, NAOEIFS = 8, - NSKBPOOLMAX = 256, - NFACTIVE = 61, + NSKBPOOLMAX = 128, TIMERTICK = HZ / 10, MINTIMER = HZ >> 2, MAXTIMER = HZ << 1, + HELPWAIT = 20, }; struct buf { + struct list_head bufs; + ulong stime; /* for disk stats */ + ulong flags; ulong nframesout; ulong resid; ulong bv_resid; + ulong bv_off; sector_t sector; struct bio *bio; struct bio_vec *bv; - struct request *rq; }; struct frame { - struct list_head head; - u32 tag; + int tag; ulong waited; - struct aoetgt *t; /* parent target I belong to */ - sector_t lba; - struct sk_buff *skb; /* command skb freed on module exit */ - struct sk_buff *r_skb; /* response skb for async processing */ struct buf *buf; - struct bio_vec *bv; + char *bufaddr; ulong bcnt; - ulong bv_off; + sector_t lba; + struct sk_buff *skb; }; struct aoeif { struct net_device *nd; - ulong lost; - int bcnt; + unsigned char lost; + unsigned char lostjumbo; + ushort maxbcnt; }; struct aoetgt { unsigned char addr[6]; ushort nframes; - struct aoedev *d; /* parent device I belong to */ - struct list_head ffree; /* list of free frames */ + struct frame *frames; struct aoeif ifs[NAOEIFS]; struct aoeif *ifp; /* current aoeif in use */ ushort nout; ushort maxout; - ulong falloc; + u16 lasttag; /* last tag sent */ + u16 useme; ulong lastwadj; /* last window adjustment */ - int minbcnt; int wpkts, rpkts; + int dataref; }; struct aoedev { @@ -145,9 +153,6 @@ struct aoedev { u16 rttavg; /* round trip average of requests/responses */ u16 mintimer; u16 fw_ver; /* version of blade's firmware */ - u16 lasttag; /* last tag sent */ - u16 useme; - ulong ref; struct work_struct work;/* disk create work struct */ struct gendisk *gd; struct request_queue *blkq; @@ -155,31 +160,16 @@ struct aoedev { sector_t ssize; struct timer_list timer; spinlock_t lock; + struct sk_buff_head sendq; struct sk_buff_head skbpool; mempool_t *bufpool; /* for deadlock-free Buf allocation */ - struct { /* pointers to work in progress */ - struct buf *buf; - struct bio *nxbio; - struct request *rq; - } ip; - ulong maxbcnt; - struct list_head factive[NFACTIVE]; /* hash of active frames */ + struct list_head bufq; /* queue of bios to work on */ + struct buf *inprocess; /* the one we're currently working on */ struct aoetgt *targets[NTARGETS]; struct aoetgt **tgt; /* target in use when working */ - struct aoetgt *htgt; /* target needing rexmit assistance */ - ulong ntargets; - ulong kicked; + struct aoetgt **htgt; /* target needing rexmit assistance */ }; -/* kthread tracking */ -struct ktstate { - struct completion rendez; - struct task_struct *task; - wait_queue_head_t *waitq; - int (*fn) (void); - char *name; - spinlock_t *lock; -}; int aoeblk_init(void); void aoeblk_exit(void); @@ -192,29 +182,22 @@ void aoechr_error(char *); void aoecmd_work(struct aoedev *d); void aoecmd_cfg(ushort aoemajor, unsigned char aoeminor); -struct sk_buff *aoecmd_ata_rsp(struct sk_buff *); +void aoecmd_ata_rsp(struct sk_buff *); void aoecmd_cfg_rsp(struct sk_buff *); void aoecmd_sleepwork(struct work_struct *); void aoecmd_cleanslate(struct aoedev *); -void aoecmd_exit(void); -int aoecmd_init(void); struct sk_buff *aoecmd_ata_id(struct aoedev *); -void aoe_freetframe(struct frame *); -void aoe_flush_iocq(void); -void aoe_end_request(struct aoedev *, struct request *, int); -int aoe_ktstart(struct ktstate *k); -void aoe_ktstop(struct ktstate *k); int aoedev_init(void); void aoedev_exit(void); -struct aoedev *aoedev_by_aoeaddr(ulong maj, int min, int do_alloc); +struct aoedev *aoedev_by_aoeaddr(int maj, int min); +struct aoedev *aoedev_by_sysminor_m(ulong sysminor); void aoedev_downdev(struct aoedev *d); int aoedev_flush(const char __user *str, size_t size); -void aoe_failbuf(struct aoedev *, struct buf *); -void aoedev_put(struct aoedev *); int aoenet_init(void); void aoenet_exit(void); void aoenet_xmit(struct sk_buff_head *); int is_aoe_netif(struct net_device *ifp); int set_aoe_iflist(const char __user *str, size_t size); + diff --git a/trunk/drivers/block/aoe/aoeblk.c b/trunk/drivers/block/aoe/aoeblk.c index 00dfc5008ad4..321de7b6c442 100644 --- a/trunk/drivers/block/aoe/aoeblk.c +++ b/trunk/drivers/block/aoe/aoeblk.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2012 Coraid, Inc. See COPYING for GPL terms. */ +/* Copyright (c) 2007 Coraid, Inc. See COPYING for GPL terms. */ /* * aoeblk.c * block device routines @@ -161,22 +161,68 @@ aoeblk_release(struct gendisk *disk, fmode_t mode) } static void -aoeblk_request(struct request_queue *q) +aoeblk_make_request(struct request_queue *q, struct bio *bio) { + struct sk_buff_head queue; struct aoedev *d; - struct request *rq; + struct buf *buf; + ulong flags; + + blk_queue_bounce(q, &bio); + + if (bio == NULL) { + printk(KERN_ERR "aoe: bio is NULL\n"); + BUG(); + return; + } + d = bio->bi_bdev->bd_disk->private_data; + if (d == NULL) { + printk(KERN_ERR "aoe: bd_disk->private_data is NULL\n"); + BUG(); + bio_endio(bio, -ENXIO); + return; + } else if (bio->bi_io_vec == NULL) { + printk(KERN_ERR "aoe: bi_io_vec is NULL\n"); + BUG(); + bio_endio(bio, -ENXIO); + return; + } + buf = mempool_alloc(d->bufpool, GFP_NOIO); + if (buf == NULL) { + printk(KERN_INFO "aoe: buf allocation failure\n"); + bio_endio(bio, -ENOMEM); + return; + } + memset(buf, 0, sizeof(*buf)); + INIT_LIST_HEAD(&buf->bufs); + buf->stime = jiffies; + buf->bio = bio; + buf->resid = bio->bi_size; + buf->sector = bio->bi_sector; + buf->bv = &bio->bi_io_vec[bio->bi_idx]; + buf->bv_resid = buf->bv->bv_len; + WARN_ON(buf->bv_resid == 0); + buf->bv_off = buf->bv->bv_offset; + + spin_lock_irqsave(&d->lock, flags); - d = q->queuedata; if ((d->flags & DEVFL_UP) == 0) { pr_info_ratelimited("aoe: device %ld.%d is not up\n", d->aoemajor, d->aoeminor); - while ((rq = blk_peek_request(q))) { - blk_start_request(rq); - aoe_end_request(d, rq, 1); - } + spin_unlock_irqrestore(&d->lock, flags); + mempool_free(buf, d->bufpool); + bio_endio(bio, -ENXIO); return; } + + list_add_tail(&buf->bufs, &d->bufq); + aoecmd_work(d); + __skb_queue_head_init(&queue); + skb_queue_splice_init(&d->sendq, &queue); + + spin_unlock_irqrestore(&d->lock, flags); + aoenet_xmit(&queue); } static int @@ -208,54 +254,41 @@ aoeblk_gdalloc(void *vp) { struct aoedev *d = vp; struct gendisk *gd; - mempool_t *mp; - struct request_queue *q; - enum { KB = 1024, MB = KB * KB, READ_AHEAD = 2 * MB, }; ulong flags; gd = alloc_disk(AOE_PARTITIONS); if (gd == NULL) { - pr_err("aoe: cannot allocate disk structure for %ld.%d\n", + printk(KERN_ERR + "aoe: cannot allocate disk structure for %ld.%d\n", d->aoemajor, d->aoeminor); goto err; } - mp = mempool_create(MIN_BUFS, mempool_alloc_slab, mempool_free_slab, - buf_pool_cache); - if (mp == NULL) { + d->bufpool = mempool_create_slab_pool(MIN_BUFS, buf_pool_cache); + if (d->bufpool == NULL) { printk(KERN_ERR "aoe: cannot allocate bufpool for %ld.%d\n", d->aoemajor, d->aoeminor); goto err_disk; } - q = blk_init_queue(aoeblk_request, &d->lock); - if (q == NULL) { - pr_err("aoe: cannot allocate block queue for %ld.%d\n", - d->aoemajor, d->aoeminor); - mempool_destroy(mp); - goto err_disk; - } d->blkq = blk_alloc_queue(GFP_KERNEL); if (!d->blkq) goto err_mempool; + blk_queue_make_request(d->blkq, aoeblk_make_request); d->blkq->backing_dev_info.name = "aoe"; if (bdi_init(&d->blkq->backing_dev_info)) goto err_blkq; spin_lock_irqsave(&d->lock, flags); - blk_queue_max_hw_sectors(d->blkq, BLK_DEF_MAX_SECTORS); - q->backing_dev_info.ra_pages = READ_AHEAD / PAGE_CACHE_SIZE; - d->bufpool = mp; - d->blkq = gd->queue = q; - q->queuedata = d; - d->gd = gd; gd->major = AOE_MAJOR; - gd->first_minor = d->sysminor; + gd->first_minor = d->sysminor * AOE_PARTITIONS; gd->fops = &aoe_bdops; gd->private_data = d; set_capacity(gd, d->ssize); snprintf(gd->disk_name, sizeof gd->disk_name, "etherd/e%ld.%d", d->aoemajor, d->aoeminor); + gd->queue = d->blkq; + d->gd = gd; d->flags &= ~DEVFL_GDALLOC; d->flags |= DEVFL_UP; diff --git a/trunk/drivers/block/aoe/aoechr.c b/trunk/drivers/block/aoe/aoechr.c index ed57a890c643..e86d2062a164 100644 --- a/trunk/drivers/block/aoe/aoechr.c +++ b/trunk/drivers/block/aoe/aoechr.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2012 Coraid, Inc. See COPYING for GPL terms. */ +/* Copyright (c) 2007 Coraid, Inc. See COPYING for GPL terms. */ /* * aoechr.c * AoE character device driver @@ -86,34 +86,34 @@ revalidate(const char __user *str, size_t size) if (copy_from_user(buf, str, size)) return -EFAULT; + /* should be e%d.%d format */ n = sscanf(buf, "e%d.%d", &major, &minor); if (n != 2) { - pr_err("aoe: invalid device specification %s\n", buf); + printk(KERN_ERR "aoe: invalid device specification\n"); return -EINVAL; } - d = aoedev_by_aoeaddr(major, minor, 0); + d = aoedev_by_aoeaddr(major, minor); if (!d) return -EINVAL; spin_lock_irqsave(&d->lock, flags); aoecmd_cleanslate(d); - aoecmd_cfg(major, minor); loop: skb = aoecmd_ata_id(d); spin_unlock_irqrestore(&d->lock, flags); /* try again if we are able to sleep a bit, * otherwise give up this revalidation */ - if (!skb && !msleep_interruptible(250)) { + if (!skb && !msleep_interruptible(200)) { spin_lock_irqsave(&d->lock, flags); goto loop; } - aoedev_put(d); if (skb) { struct sk_buff_head queue; __skb_queue_head_init(&queue); __skb_queue_tail(&queue, skb); aoenet_xmit(&queue); } + aoecmd_cfg(major, minor); return 0; } @@ -174,7 +174,6 @@ aoechr_write(struct file *filp, const char __user *buf, size_t cnt, loff_t *offp break; case MINOR_FLUSH: ret = aoedev_flush(buf, cnt); - break; } if (ret == 0) ret = cnt; diff --git a/trunk/drivers/block/aoe/aoecmd.c b/trunk/drivers/block/aoe/aoecmd.c index 3804a0af3ef1..887f68f6d79a 100644 --- a/trunk/drivers/block/aoe/aoecmd.c +++ b/trunk/drivers/block/aoe/aoecmd.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2012 Coraid, Inc. See COPYING for GPL terms. */ +/* Copyright (c) 2007 Coraid, Inc. See COPYING for GPL terms. */ /* * aoecmd.c * Filesystem request handling methods @@ -12,19 +12,10 @@ #include #include #include -#include -#include #include #include -#include #include "aoe.h" -#define MAXIOC (8192) /* default meant to avoid most soft lockups */ - -static void ktcomplete(struct frame *, struct sk_buff *); - -static struct buf *nextbuf(struct aoedev *); - static int aoe_deadsecs = 60 * 3; module_param(aoe_deadsecs, int, 0644); MODULE_PARM_DESC(aoe_deadsecs, "After aoe_deadsecs seconds, give up and fail dev."); @@ -34,15 +25,6 @@ module_param(aoe_maxout, int, 0644); MODULE_PARM_DESC(aoe_maxout, "Only aoe_maxout outstanding packets for every MAC on eX.Y."); -static wait_queue_head_t ktiowq; -static struct ktstate kts; - -/* io completion queue */ -static struct { - struct list_head head; - spinlock_t lock; -} iocq; - static struct sk_buff * new_skb(ulong len) { @@ -59,21 +41,15 @@ new_skb(ulong len) } static struct frame * -getframe(struct aoedev *d, u32 tag) +getframe(struct aoetgt *t, int tag) { - struct frame *f; - struct list_head *head, *pos, *nx; - u32 n; + struct frame *f, *e; - n = tag % NFACTIVE; - head = &d->factive[n]; - list_for_each_safe(pos, nx, head) { - f = list_entry(pos, struct frame, head); - if (f->tag == tag) { - list_del(pos); + f = t->frames; + e = f + t->nframes; + for (; ftag == tag) return f; - } - } return NULL; } @@ -83,18 +59,18 @@ getframe(struct aoedev *d, u32 tag) * This driver reserves tag -1 to mean "unused frame." */ static int -newtag(struct aoedev *d) +newtag(struct aoetgt *t) { register ulong n; n = jiffies & 0xffff; - return n |= (++d->lasttag & 0x7fff) << 16; + return n |= (++t->lasttag & 0x7fff) << 16; } -static u32 +static int aoehdr_atainit(struct aoedev *d, struct aoetgt *t, struct aoe_hdr *h) { - u32 host_tag = newtag(d); + u32 host_tag = newtag(t); memcpy(h->src, t->ifp->nd->dev_addr, sizeof h->src); memcpy(h->dst, t->addr, sizeof h->dst); @@ -119,18 +95,16 @@ put_lba(struct aoe_atahdr *ah, sector_t lba) ah->lba5 = lba >>= 8; } -static struct aoeif * +static void ifrotate(struct aoetgt *t) { - struct aoeif *ifp; - - ifp = t->ifp; - ifp++; - if (ifp >= &t->ifs[NAOEIFS] || ifp->nd == NULL) - ifp = t->ifs; - if (ifp->nd == NULL) - return NULL; - return t->ifp = ifp; + t->ifp++; + if (t->ifp >= &t->ifs[NAOEIFS] || t->ifp->nd == NULL) + t->ifp = t->ifs; + if (t->ifp->nd == NULL) { + printk(KERN_INFO "aoe: no interface to rotate to\n"); + BUG(); + } } static void @@ -155,128 +129,78 @@ skb_pool_get(struct aoedev *d) return NULL; } -void -aoe_freetframe(struct frame *f) -{ - struct aoetgt *t; - - t = f->t; - f->buf = NULL; - f->bv = NULL; - f->r_skb = NULL; - list_add(&f->head, &t->ffree); -} - +/* freeframe is where we do our load balancing so it's a little hairy. */ static struct frame * -newtframe(struct aoedev *d, struct aoetgt *t) +freeframe(struct aoedev *d) { - struct frame *f; + struct frame *f, *e, *rf; + struct aoetgt **t; struct sk_buff *skb; - struct list_head *pos; - - if (list_empty(&t->ffree)) { - if (t->falloc >= NSKBPOOLMAX*2) - return NULL; - f = kcalloc(1, sizeof(*f), GFP_ATOMIC); - if (f == NULL) - return NULL; - t->falloc++; - f->t = t; - } else { - pos = t->ffree.next; - list_del(pos); - f = list_entry(pos, struct frame, head); - } - - skb = f->skb; - if (skb == NULL) { - f->skb = skb = new_skb(ETH_ZLEN); - if (!skb) { -bail: aoe_freetframe(f); - return NULL; - } - } - - if (atomic_read(&skb_shinfo(skb)->dataref) != 1) { - skb = skb_pool_get(d); - if (skb == NULL) - goto bail; - skb_pool_put(d, f->skb); - f->skb = skb; - } - - skb->truesize -= skb->data_len; - skb_shinfo(skb)->nr_frags = skb->data_len = 0; - skb_trim(skb, 0); - return f; -} - -static struct frame * -newframe(struct aoedev *d) -{ - struct frame *f; - struct aoetgt *t, **tt; - int totout = 0; if (d->targets[0] == NULL) { /* shouldn't happen, but I'm paranoid */ printk(KERN_ERR "aoe: NULL TARGETS!\n"); return NULL; } - tt = d->tgt; /* last used target */ + t = d->tgt; + t++; + if (t >= &d->targets[NTARGETS] || !*t) + t = d->targets; for (;;) { - tt++; - if (tt >= &d->targets[NTARGETS] || !*tt) - tt = d->targets; - t = *tt; - totout += t->nout; - if (t->nout < t->maxout + if ((*t)->nout < (*t)->maxout && t != d->htgt - && t->ifp->nd) { - f = newtframe(d, t); - if (f) { - ifrotate(t); - d->tgt = tt; + && (*t)->ifp->nd) { + rf = NULL; + f = (*t)->frames; + e = f + (*t)->nframes; + for (; f < e; f++) { + if (f->tag != FREETAG) + continue; + skb = f->skb; + if (!skb + && !(f->skb = skb = new_skb(ETH_ZLEN))) + continue; + if (atomic_read(&skb_shinfo(skb)->dataref) + != 1) { + if (!rf) + rf = f; + continue; + } +gotone: skb_shinfo(skb)->nr_frags = skb->data_len = 0; + skb_trim(skb, 0); + d->tgt = t; + ifrotate(*t); return f; } + /* Work can be done, but the network layer is + holding our precious packets. Try to grab + one from the pool. */ + f = rf; + if (f == NULL) { /* more paranoia */ + printk(KERN_ERR + "aoe: freeframe: %s.\n", + "unexpected null rf"); + d->flags |= DEVFL_KICKME; + return NULL; + } + skb = skb_pool_get(d); + if (skb) { + skb_pool_put(d, f->skb); + f->skb = skb; + goto gotone; + } + (*t)->dataref++; + if ((*t)->nout == 0) + d->flags |= DEVFL_KICKME; } - if (tt == d->tgt) /* we've looped and found nada */ + if (t == d->tgt) /* we've looped and found nada */ break; - } - if (totout == 0) { - d->kicked++; - d->flags |= DEVFL_KICKME; + t++; + if (t >= &d->targets[NTARGETS] || !*t) + t = d->targets; } return NULL; } -static void -skb_fillup(struct sk_buff *skb, struct bio_vec *bv, ulong off, ulong cnt) -{ - int frag = 0; - ulong fcnt; -loop: - fcnt = bv->bv_len - (off - bv->bv_offset); - if (fcnt > cnt) - fcnt = cnt; - skb_fill_page_desc(skb, frag++, bv->bv_page, off, fcnt); - cnt -= fcnt; - if (cnt <= 0) - return; - bv++; - off = bv->bv_offset; - goto loop; -} - -static void -fhash(struct frame *f) -{ - struct aoedev *d = f->t->d; - u32 n; - - n = f->tag % NFACTIVE; - list_add_tail(&f->head, &d->factive[n]); -} - static int aoecmd_ata_rw(struct aoedev *d) { @@ -284,47 +208,26 @@ aoecmd_ata_rw(struct aoedev *d) struct aoe_hdr *h; struct aoe_atahdr *ah; struct buf *buf; + struct bio_vec *bv; struct aoetgt *t; struct sk_buff *skb; - struct sk_buff_head queue; - ulong bcnt, fbcnt; + ulong bcnt; char writebit, extbit; writebit = 0x10; extbit = 0x4; - buf = nextbuf(d); - if (buf == NULL) - return 0; - f = newframe(d); + f = freeframe(d); if (f == NULL) return 0; t = *d->tgt; - bcnt = d->maxbcnt; + buf = d->inprocess; + bv = buf->bv; + bcnt = t->ifp->maxbcnt; if (bcnt == 0) bcnt = DEFAULTBCNT; - if (bcnt > buf->resid) - bcnt = buf->resid; - fbcnt = bcnt; - f->bv = buf->bv; - f->bv_off = f->bv->bv_offset + (f->bv->bv_len - buf->bv_resid); - do { - if (fbcnt < buf->bv_resid) { - buf->bv_resid -= fbcnt; - buf->resid -= fbcnt; - break; - } - fbcnt -= buf->bv_resid; - buf->resid -= buf->bv_resid; - if (buf->resid == 0) { - d->ip.buf = NULL; - break; - } - buf->bv++; - buf->bv_resid = buf->bv->bv_len; - WARN_ON(buf->bv_resid == 0); - } while (fbcnt); - + if (bcnt > buf->bv_resid) + bcnt = buf->bv_resid; /* initialize the headers & frame */ skb = f->skb; h = (struct aoe_hdr *) skb_mac_header(skb); @@ -332,10 +235,10 @@ aoecmd_ata_rw(struct aoedev *d) skb_put(skb, sizeof *h + sizeof *ah); memset(h, 0, skb->len); f->tag = aoehdr_atainit(d, t, h); - fhash(f); t->nout++; f->waited = 0; f->buf = buf; + f->bufaddr = page_address(bv->bv_page) + buf->bv_off; f->bcnt = bcnt; f->lba = buf->sector; @@ -350,11 +253,10 @@ aoecmd_ata_rw(struct aoedev *d) ah->lba3 |= 0xe0; /* LBA bit + obsolete 0xa0 */ } if (bio_data_dir(buf->bio) == WRITE) { - skb_fillup(skb, f->bv, f->bv_off, bcnt); + skb_fill_page_desc(skb, 0, bv->bv_page, buf->bv_off, bcnt); ah->aflags |= AOEAFL_WRITE; skb->len += bcnt; skb->data_len = bcnt; - skb->truesize += bcnt; t->wpkts++; } else { t->rpkts++; @@ -365,15 +267,23 @@ aoecmd_ata_rw(struct aoedev *d) /* mark all tracking fields and load out */ buf->nframesout += 1; + buf->bv_off += bcnt; + buf->bv_resid -= bcnt; + buf->resid -= bcnt; buf->sector += bcnt >> 9; + if (buf->resid == 0) { + d->inprocess = NULL; + } else if (buf->bv_resid == 0) { + buf->bv = ++bv; + buf->bv_resid = bv->bv_len; + WARN_ON(buf->bv_resid == 0); + buf->bv_off = bv->bv_offset; + } skb->dev = t->ifp->nd; skb = skb_clone(skb, GFP_ATOMIC); - if (skb) { - __skb_queue_head_init(&queue); - __skb_queue_tail(&queue, skb); - aoenet_xmit(&queue); - } + if (skb) + __skb_queue_tail(&d->sendq, skb); return 1; } @@ -420,25 +330,17 @@ aoecmd_cfg_pkts(ushort aoemajor, unsigned char aoeminor, struct sk_buff_head *qu } static void -resend(struct aoedev *d, struct frame *f) +resend(struct aoedev *d, struct aoetgt *t, struct frame *f) { struct sk_buff *skb; - struct sk_buff_head queue; struct aoe_hdr *h; struct aoe_atahdr *ah; - struct aoetgt *t; char buf[128]; u32 n; - t = f->t; - n = newtag(d); + ifrotate(t); + n = newtag(t); skb = f->skb; - if (ifrotate(t) == NULL) { - /* probably can't happen, but set it up to fail anyway */ - pr_info("aoe: resend: no interfaces to rotate to.\n"); - ktcomplete(f, NULL); - return; - } h = (struct aoe_hdr *) skb_mac_header(skb); ah = (struct aoe_atahdr *) (h+1); @@ -449,22 +351,39 @@ resend(struct aoedev *d, struct frame *f) aoechr_error(buf); f->tag = n; - fhash(f); h->tag = cpu_to_be32(n); memcpy(h->dst, t->addr, sizeof h->dst); memcpy(h->src, t->ifp->nd->dev_addr, sizeof h->src); + switch (ah->cmdstat) { + default: + break; + case ATA_CMD_PIO_READ: + case ATA_CMD_PIO_READ_EXT: + case ATA_CMD_PIO_WRITE: + case ATA_CMD_PIO_WRITE_EXT: + put_lba(ah, f->lba); + + n = f->bcnt; + if (n > DEFAULTBCNT) + n = DEFAULTBCNT; + ah->scnt = n >> 9; + if (ah->aflags & AOEAFL_WRITE) { + skb_fill_page_desc(skb, 0, virt_to_page(f->bufaddr), + offset_in_page(f->bufaddr), n); + skb->len = sizeof *h + sizeof *ah + n; + skb->data_len = n; + } + } skb->dev = t->ifp->nd; skb = skb_clone(skb, GFP_ATOMIC); if (skb == NULL) return; - __skb_queue_head_init(&queue); - __skb_queue_tail(&queue, skb); - aoenet_xmit(&queue); + __skb_queue_tail(&d->sendq, skb); } static int -tsince(u32 tag) +tsince(int tag) { int n; @@ -488,65 +407,58 @@ getif(struct aoetgt *t, struct net_device *nd) return NULL; } +static struct aoeif * +addif(struct aoetgt *t, struct net_device *nd) +{ + struct aoeif *p; + + p = getif(t, NULL); + if (!p) + return NULL; + p->nd = nd; + p->maxbcnt = DEFAULTBCNT; + p->lost = 0; + p->lostjumbo = 0; + return p; +} + static void ejectif(struct aoetgt *t, struct aoeif *ifp) { struct aoeif *e; - struct net_device *nd; ulong n; - nd = ifp->nd; e = t->ifs + NAOEIFS - 1; n = (e - ifp) * sizeof *ifp; memmove(ifp, ifp+1, n); e->nd = NULL; - dev_put(nd); } static int sthtith(struct aoedev *d) { - struct frame *f, *nf; - struct list_head *nx, *pos, *head; + struct frame *f, *e, *nf; struct sk_buff *skb; - struct aoetgt *ht = d->htgt; - int i; - - for (i = 0; i < NFACTIVE; i++) { - head = &d->factive[i]; - list_for_each_safe(pos, nx, head) { - f = list_entry(pos, struct frame, head); - if (f->t != ht) - continue; - - nf = newframe(d); - if (!nf) - return 0; - - /* remove frame from active list */ - list_del(pos); - - /* reassign all pertinent bits to new outbound frame */ - skb = nf->skb; - nf->skb = f->skb; - nf->buf = f->buf; - nf->bcnt = f->bcnt; - nf->lba = f->lba; - nf->bv = f->bv; - nf->bv_off = f->bv_off; - nf->waited = 0; - f->skb = skb; - aoe_freetframe(f); - ht->nout--; - nf->t->nout++; - resend(d, nf); - } + struct aoetgt *ht = *d->htgt; + + f = ht->frames; + e = f + ht->nframes; + for (; f < e; f++) { + if (f->tag == FREETAG) + continue; + nf = freeframe(d); + if (!nf) + return 0; + skb = nf->skb; + *nf = *f; + f->skb = skb; + f->tag = FREETAG; + nf->waited = 0; + ht->nout--; + (*d->tgt)->nout++; + resend(d, *d->tgt, nf); } - /* We've cleaned up the outstanding so take away his - * interfaces so he won't be used. We should remove him from - * the target array here, but cleaning up a target is - * involved. PUNT! - */ + /* he's clean, he's useless. take away his interfaces */ memset(ht->ifs, 0, sizeof ht->ifs); d->htgt = NULL; return 1; @@ -565,15 +477,13 @@ ata_scnt(unsigned char *packet) { static void rexmit_timer(ulong vp) { + struct sk_buff_head queue; struct aoedev *d; struct aoetgt *t, **tt, **te; struct aoeif *ifp; - struct frame *f; - struct list_head *head, *pos, *nx; - LIST_HEAD(flist); + struct frame *f, *e; register long timeout; ulong flags, n; - int i; d = (struct aoedev *) vp; @@ -587,22 +497,58 @@ rexmit_timer(ulong vp) spin_unlock_irqrestore(&d->lock, flags); return; } + tt = d->targets; + te = tt + NTARGETS; + for (; tt < te && *tt; tt++) { + t = *tt; + f = t->frames; + e = f + t->nframes; + for (; f < e; f++) { + if (f->tag == FREETAG + || tsince(f->tag) < timeout) + continue; + n = f->waited += timeout; + n /= HZ; + if (n > aoe_deadsecs) { + /* waited too long. device failure. */ + aoedev_downdev(d); + break; + } + + if (n > HELPWAIT /* see if another target can help */ + && (tt != d->targets || d->targets[1])) + d->htgt = tt; + + if (t->nout == t->maxout) { + if (t->maxout > 1) + t->maxout--; + t->lastwadj = jiffies; + } + + ifp = getif(t, f->skb->dev); + if (ifp && ++ifp->lost > (t->nframes << 1) + && (ifp != t->ifs || t->ifs[1].nd)) { + ejectif(t, ifp); + ifp = NULL; + } - /* collect all frames to rexmit into flist */ - for (i = 0; i < NFACTIVE; i++) { - head = &d->factive[i]; - list_for_each_safe(pos, nx, head) { - f = list_entry(pos, struct frame, head); - if (tsince(f->tag) < timeout) - break; /* end of expired frames */ - /* move to flist for later processing */ - list_move_tail(pos, &flist); + if (ata_scnt(skb_mac_header(f->skb)) > DEFAULTBCNT / 512 + && ifp && ++ifp->lostjumbo > (t->nframes << 1) + && ifp->maxbcnt != DEFAULTBCNT) { + printk(KERN_INFO + "aoe: e%ld.%d: " + "too many lost jumbo on " + "%s:%pm - " + "falling back to %d frames.\n", + d->aoemajor, d->aoeminor, + ifp->nd->name, t->addr, + DEFAULTBCNT); + ifp->maxbcnt = 0; + } + resend(d, t, f); } - } - /* window check */ - tt = d->targets; - te = tt + d->ntargets; - for (; tt < te && (t = *tt); tt++) { + + /* window check */ if (t->nout == t->maxout && t->maxout < t->nframes && (jiffies - t->lastwadj)/HZ > 10) { @@ -611,173 +557,45 @@ rexmit_timer(ulong vp) } } - if (!list_empty(&flist)) { /* retransmissions necessary */ + if (!skb_queue_empty(&d->sendq)) { n = d->rttavg <<= 1; if (n > MAXTIMER) d->rttavg = MAXTIMER; } - /* process expired frames */ - while (!list_empty(&flist)) { - pos = flist.next; - f = list_entry(pos, struct frame, head); - n = f->waited += timeout; - n /= HZ; - if (n > aoe_deadsecs) { - /* Waited too long. Device failure. - * Hang all frames on first hash bucket for downdev - * to clean up. - */ - list_splice(&flist, &d->factive[0]); - aoedev_downdev(d); - break; - } - list_del(pos); - - t = f->t; - if (n > aoe_deadsecs/2) - d->htgt = t; /* see if another target can help */ - - if (t->nout == t->maxout) { - if (t->maxout > 1) - t->maxout--; - t->lastwadj = jiffies; - } - - ifp = getif(t, f->skb->dev); - if (ifp && ++ifp->lost > (t->nframes << 1) - && (ifp != t->ifs || t->ifs[1].nd)) { - ejectif(t, ifp); - ifp = NULL; - } - resend(d, f); - } - - if ((d->flags & DEVFL_KICKME || d->htgt) && d->blkq) { + if (d->flags & DEVFL_KICKME || d->htgt) { d->flags &= ~DEVFL_KICKME; - d->blkq->request_fn(d->blkq); + aoecmd_work(d); } + __skb_queue_head_init(&queue); + skb_queue_splice_init(&d->sendq, &queue); + d->timer.expires = jiffies + TIMERTICK; add_timer(&d->timer); spin_unlock_irqrestore(&d->lock, flags); -} - -static unsigned long -rqbiocnt(struct request *r) -{ - struct bio *bio; - unsigned long n = 0; - - __rq_for_each_bio(bio, r) - n++; - return n; -} - -/* This can be removed if we are certain that no users of the block - * layer will ever use zero-count pages in bios. Otherwise we have to - * protect against the put_page sometimes done by the network layer. - * - * See http://oss.sgi.com/archives/xfs/2007-01/msg00594.html for - * discussion. - * - * We cannot use get_page in the workaround, because it insists on a - * positive page count as a precondition. So we use _count directly. - */ -static void -bio_pageinc(struct bio *bio) -{ - struct bio_vec *bv; - struct page *page; - int i; - - bio_for_each_segment(bv, bio, i) { - page = bv->bv_page; - /* Non-zero page count for non-head members of - * compound pages is no longer allowed by the kernel, - * but this has never been seen here. - */ - if (unlikely(PageCompound(page))) - if (compound_trans_head(page) != page) { - pr_crit("page tail used for block I/O\n"); - BUG(); - } - atomic_inc(&page->_count); - } -} - -static void -bio_pagedec(struct bio *bio) -{ - struct bio_vec *bv; - int i; - - bio_for_each_segment(bv, bio, i) - atomic_dec(&bv->bv_page->_count); -} -static void -bufinit(struct buf *buf, struct request *rq, struct bio *bio) -{ - struct bio_vec *bv; - - memset(buf, 0, sizeof(*buf)); - buf->rq = rq; - buf->bio = bio; - buf->resid = bio->bi_size; - buf->sector = bio->bi_sector; - bio_pageinc(bio); - buf->bv = bv = &bio->bi_io_vec[bio->bi_idx]; - buf->bv_resid = bv->bv_len; - WARN_ON(buf->bv_resid == 0); -} - -static struct buf * -nextbuf(struct aoedev *d) -{ - struct request *rq; - struct request_queue *q; - struct buf *buf; - struct bio *bio; - - q = d->blkq; - if (q == NULL) - return NULL; /* initializing */ - if (d->ip.buf) - return d->ip.buf; - rq = d->ip.rq; - if (rq == NULL) { - rq = blk_peek_request(q); - if (rq == NULL) - return NULL; - blk_start_request(rq); - d->ip.rq = rq; - d->ip.nxbio = rq->bio; - rq->special = (void *) rqbiocnt(rq); - } - buf = mempool_alloc(d->bufpool, GFP_ATOMIC); - if (buf == NULL) { - pr_err("aoe: nextbuf: unable to mempool_alloc!\n"); - return NULL; - } - bio = d->ip.nxbio; - bufinit(buf, rq, bio); - bio = bio->bi_next; - d->ip.nxbio = bio; - if (bio == NULL) - d->ip.rq = NULL; - return d->ip.buf = buf; + aoenet_xmit(&queue); } /* enters with d->lock held */ void aoecmd_work(struct aoedev *d) { + struct buf *buf; +loop: if (d->htgt && !sthtith(d)) return; - while (aoecmd_ata_rw(d)) - ; + if (d->inprocess == NULL) { + if (list_empty(&d->bufq)) + return; + buf = container_of(d->bufq.next, struct buf, bufs); + list_del(d->bufq.next); + d->inprocess = buf; + } + if (aoecmd_ata_rw(d)) + goto loop; } /* this function performs work that has been deferred until sleeping is OK @@ -786,25 +604,28 @@ void aoecmd_sleepwork(struct work_struct *work) { struct aoedev *d = container_of(work, struct aoedev, work); - struct block_device *bd; - u64 ssize; if (d->flags & DEVFL_GDALLOC) aoeblk_gdalloc(d); if (d->flags & DEVFL_NEWSIZE) { + struct block_device *bd; + unsigned long flags; + u64 ssize; + ssize = get_capacity(d->gd); bd = bdget_disk(d->gd, 0); + if (bd) { mutex_lock(&bd->bd_inode->i_mutex); i_size_write(bd->bd_inode, (loff_t)ssize<<9); mutex_unlock(&bd->bd_inode->i_mutex); bdput(bd); } - spin_lock_irq(&d->lock); + spin_lock_irqsave(&d->lock, flags); d->flags |= DEVFL_UP; d->flags &= ~DEVFL_NEWSIZE; - spin_unlock_irq(&d->lock); + spin_unlock_irqrestore(&d->lock, flags); } } @@ -897,299 +718,163 @@ gettgt(struct aoedev *d, char *addr) return NULL; } -static void -bvcpy(struct bio_vec *bv, ulong off, struct sk_buff *skb, long cnt) -{ - ulong fcnt; - char *p; - int soff = 0; -loop: - fcnt = bv->bv_len - (off - bv->bv_offset); - if (fcnt > cnt) - fcnt = cnt; - p = page_address(bv->bv_page) + off; - skb_copy_bits(skb, soff, p, fcnt); - soff += fcnt; - cnt -= fcnt; - if (cnt <= 0) - return; - bv++; - off = bv->bv_offset; - goto loop; -} - -void -aoe_end_request(struct aoedev *d, struct request *rq, int fastfail) -{ - struct bio *bio; - int bok; - struct request_queue *q; - - q = d->blkq; - if (rq == d->ip.rq) - d->ip.rq = NULL; - do { - bio = rq->bio; - bok = !fastfail && test_bit(BIO_UPTODATE, &bio->bi_flags); - } while (__blk_end_request(rq, bok ? 0 : -EIO, bio->bi_size)); - - /* cf. http://lkml.org/lkml/2006/10/31/28 */ - if (!fastfail) - q->request_fn(q); -} - -static void -aoe_end_buf(struct aoedev *d, struct buf *buf) -{ - struct request *rq; - unsigned long n; - - if (buf == d->ip.buf) - d->ip.buf = NULL; - rq = buf->rq; - bio_pagedec(buf->bio); - mempool_free(buf, d->bufpool); - n = (unsigned long) rq->special; - rq->special = (void *) --n; - if (n == 0) - aoe_end_request(d, rq, 0); -} - -static void -ktiocomplete(struct frame *f) +static inline void +diskstats(struct gendisk *disk, struct bio *bio, ulong duration, sector_t sector) { - struct aoe_hdr *hin, *hout; - struct aoe_atahdr *ahin, *ahout; - struct buf *buf; - struct sk_buff *skb; - struct aoetgt *t; - struct aoeif *ifp; - struct aoedev *d; - long n; - - if (f == NULL) - return; - - t = f->t; - d = t->d; - - hout = (struct aoe_hdr *) skb_mac_header(f->skb); - ahout = (struct aoe_atahdr *) (hout+1); - buf = f->buf; - skb = f->r_skb; - if (skb == NULL) - goto noskb; /* just fail the buf. */ - - hin = (struct aoe_hdr *) skb->data; - skb_pull(skb, sizeof(*hin)); - ahin = (struct aoe_atahdr *) skb->data; - skb_pull(skb, sizeof(*ahin)); - if (ahin->cmdstat & 0xa9) { /* these bits cleared on success */ - pr_err("aoe: ata error cmd=%2.2Xh stat=%2.2Xh from e%ld.%d\n", - ahout->cmdstat, ahin->cmdstat, - d->aoemajor, d->aoeminor); -noskb: if (buf) - clear_bit(BIO_UPTODATE, &buf->bio->bi_flags); - goto badrsp; - } + unsigned long n_sect = bio->bi_size >> 9; + const int rw = bio_data_dir(bio); + struct hd_struct *part; + int cpu; - n = ahout->scnt << 9; - switch (ahout->cmdstat) { - case ATA_CMD_PIO_READ: - case ATA_CMD_PIO_READ_EXT: - if (skb->len < n) { - pr_err("aoe: runt data size in read. skb->len=%d need=%ld\n", - skb->len, n); - clear_bit(BIO_UPTODATE, &buf->bio->bi_flags); - break; - } - bvcpy(f->bv, f->bv_off, skb, n); - case ATA_CMD_PIO_WRITE: - case ATA_CMD_PIO_WRITE_EXT: - spin_lock_irq(&d->lock); - ifp = getif(t, skb->dev); - if (ifp) - ifp->lost = 0; - if (d->htgt == t) /* I'll help myself, thank you. */ - d->htgt = NULL; - spin_unlock_irq(&d->lock); - break; - case ATA_CMD_ID_ATA: - if (skb->len < 512) { - pr_info("aoe: runt data size in ataid. skb->len=%d\n", - skb->len); - break; - } - if (skb_linearize(skb)) - break; - spin_lock_irq(&d->lock); - ataid_complete(d, t, skb->data); - spin_unlock_irq(&d->lock); - break; - default: - pr_info("aoe: unrecognized ata command %2.2Xh for %d.%d\n", - ahout->cmdstat, - be16_to_cpu(get_unaligned(&hin->major)), - hin->minor); - } -badrsp: - spin_lock_irq(&d->lock); - - aoe_freetframe(f); - - if (buf && --buf->nframesout == 0 && buf->resid == 0) - aoe_end_buf(d, buf); - - aoecmd_work(d); - - spin_unlock_irq(&d->lock); - aoedev_put(d); - dev_kfree_skb(skb); -} - -/* Enters with iocq.lock held. - * Returns true iff responses needing processing remain. - */ -static int -ktio(void) -{ - struct frame *f; - struct list_head *pos; - int i; + cpu = part_stat_lock(); + part = disk_map_sector_rcu(disk, sector); - for (i = 0; ; ++i) { - if (i == MAXIOC) - return 1; - if (list_empty(&iocq.head)) - return 0; - pos = iocq.head.next; - list_del(pos); - spin_unlock_irq(&iocq.lock); - f = list_entry(pos, struct frame, head); - ktiocomplete(f); - spin_lock_irq(&iocq.lock); - } -} + part_stat_inc(cpu, part, ios[rw]); + part_stat_add(cpu, part, ticks[rw], duration); + part_stat_add(cpu, part, sectors[rw], n_sect); + part_stat_add(cpu, part, io_ticks, duration); -static int -kthread(void *vp) -{ - struct ktstate *k; - DECLARE_WAITQUEUE(wait, current); - int more; - - k = vp; - current->flags |= PF_NOFREEZE; - set_user_nice(current, -10); - complete(&k->rendez); /* tell spawner we're running */ - do { - spin_lock_irq(k->lock); - more = k->fn(); - if (!more) { - add_wait_queue(k->waitq, &wait); - __set_current_state(TASK_INTERRUPTIBLE); - } - spin_unlock_irq(k->lock); - if (!more) { - schedule(); - remove_wait_queue(k->waitq, &wait); - } else - cond_resched(); - } while (!kthread_should_stop()); - complete(&k->rendez); /* tell spawner we're stopping */ - return 0; + part_stat_unlock(); } void -aoe_ktstop(struct ktstate *k) -{ - kthread_stop(k->task); - wait_for_completion(&k->rendez); -} - -int -aoe_ktstart(struct ktstate *k) -{ - struct task_struct *task; - - init_completion(&k->rendez); - task = kthread_run(kthread, k, k->name); - if (task == NULL || IS_ERR(task)) - return -ENOMEM; - k->task = task; - wait_for_completion(&k->rendez); /* allow kthread to start */ - init_completion(&k->rendez); /* for waiting for exit later */ - return 0; -} - -/* pass it off to kthreads for processing */ -static void -ktcomplete(struct frame *f, struct sk_buff *skb) -{ - ulong flags; - - f->r_skb = skb; - spin_lock_irqsave(&iocq.lock, flags); - list_add_tail(&f->head, &iocq.head); - spin_unlock_irqrestore(&iocq.lock, flags); - wake_up(&ktiowq); -} - -struct sk_buff * aoecmd_ata_rsp(struct sk_buff *skb) { + struct sk_buff_head queue; struct aoedev *d; - struct aoe_hdr *h; + struct aoe_hdr *hin, *hout; + struct aoe_atahdr *ahin, *ahout; struct frame *f; + struct buf *buf; struct aoetgt *t; - u32 n; + struct aoeif *ifp; + register long n; ulong flags; char ebuf[128]; u16 aoemajor; - h = (struct aoe_hdr *) skb->data; - aoemajor = be16_to_cpu(get_unaligned(&h->major)); - d = aoedev_by_aoeaddr(aoemajor, h->minor, 0); + hin = (struct aoe_hdr *) skb_mac_header(skb); + aoemajor = get_unaligned_be16(&hin->major); + d = aoedev_by_aoeaddr(aoemajor, hin->minor); if (d == NULL) { snprintf(ebuf, sizeof ebuf, "aoecmd_ata_rsp: ata response " "for unknown device %d.%d\n", - aoemajor, h->minor); + aoemajor, hin->minor); aoechr_error(ebuf); - return skb; + return; } spin_lock_irqsave(&d->lock, flags); - n = be32_to_cpu(get_unaligned(&h->tag)); - f = getframe(d, n); + n = get_unaligned_be32(&hin->tag); + t = gettgt(d, hin->src); + if (t == NULL) { + printk(KERN_INFO "aoe: can't find target e%ld.%d:%pm\n", + d->aoemajor, d->aoeminor, hin->src); + spin_unlock_irqrestore(&d->lock, flags); + return; + } + f = getframe(t, n); if (f == NULL) { calc_rttavg(d, -tsince(n)); spin_unlock_irqrestore(&d->lock, flags); - aoedev_put(d); snprintf(ebuf, sizeof ebuf, "%15s e%d.%d tag=%08x@%08lx\n", "unexpected rsp", - get_unaligned_be16(&h->major), - h->minor, - get_unaligned_be32(&h->tag), + get_unaligned_be16(&hin->major), + hin->minor, + get_unaligned_be32(&hin->tag), jiffies); aoechr_error(ebuf); - return skb; + return; } - t = f->t; + calc_rttavg(d, tsince(f->tag)); + + ahin = (struct aoe_atahdr *) (hin+1); + hout = (struct aoe_hdr *) skb_mac_header(f->skb); + ahout = (struct aoe_atahdr *) (hout+1); + buf = f->buf; + + if (ahin->cmdstat & 0xa9) { /* these bits cleared on success */ + printk(KERN_ERR + "aoe: ata error cmd=%2.2Xh stat=%2.2Xh from e%ld.%d\n", + ahout->cmdstat, ahin->cmdstat, + d->aoemajor, d->aoeminor); + if (buf) + buf->flags |= BUFFL_FAIL; + } else { + if (d->htgt && t == *d->htgt) /* I'll help myself, thank you. */ + d->htgt = NULL; + n = ahout->scnt << 9; + switch (ahout->cmdstat) { + case ATA_CMD_PIO_READ: + case ATA_CMD_PIO_READ_EXT: + if (skb->len - sizeof *hin - sizeof *ahin < n) { + printk(KERN_ERR + "aoe: %s. skb->len=%d need=%ld\n", + "runt data size in read", skb->len, n); + /* fail frame f? just returning will rexmit. */ + spin_unlock_irqrestore(&d->lock, flags); + return; + } + memcpy(f->bufaddr, ahin+1, n); + case ATA_CMD_PIO_WRITE: + case ATA_CMD_PIO_WRITE_EXT: + ifp = getif(t, skb->dev); + if (ifp) { + ifp->lost = 0; + if (n > DEFAULTBCNT) + ifp->lostjumbo = 0; + } + if (f->bcnt -= n) { + f->lba += n >> 9; + f->bufaddr += n; + resend(d, t, f); + goto xmit; + } + break; + case ATA_CMD_ID_ATA: + if (skb->len - sizeof *hin - sizeof *ahin < 512) { + printk(KERN_INFO + "aoe: runt data size in ataid. skb->len=%d\n", + skb->len); + spin_unlock_irqrestore(&d->lock, flags); + return; + } + ataid_complete(d, t, (char *) (ahin+1)); + break; + default: + printk(KERN_INFO + "aoe: unrecognized ata command %2.2Xh for %d.%d\n", + ahout->cmdstat, + get_unaligned_be16(&hin->major), + hin->minor); + } + } + + if (buf && --buf->nframesout == 0 && buf->resid == 0) { + diskstats(d->gd, buf->bio, jiffies - buf->stime, buf->sector); + if (buf->flags & BUFFL_FAIL) + bio_endio(buf->bio, -EIO); + else { + bio_flush_dcache_pages(buf->bio); + bio_endio(buf->bio, 0); + } + mempool_free(buf, d->bufpool); + } + + f->buf = NULL; + f->tag = FREETAG; t->nout--; + aoecmd_work(d); +xmit: + __skb_queue_head_init(&queue); + skb_queue_splice_init(&d->sendq, &queue); spin_unlock_irqrestore(&d->lock, flags); - - ktcomplete(f, skb); - - /* - * Note here that we do not perform an aoedev_put, as we are - * leaving this reference for the ktio to release. - */ - return NULL; + aoenet_xmit(&queue); } void @@ -1211,7 +896,7 @@ aoecmd_ata_id(struct aoedev *d) struct sk_buff *skb; struct aoetgt *t; - f = newframe(d); + f = freeframe(d); if (f == NULL) return NULL; @@ -1224,7 +909,6 @@ aoecmd_ata_id(struct aoedev *d) skb_put(skb, sizeof *h + sizeof *ah); memset(h, 0, skb->len); f->tag = aoehdr_atainit(d, t, h); - fhash(f); t->nout++; f->waited = 0; @@ -1245,6 +929,7 @@ static struct aoetgt * addtgt(struct aoedev *d, char *addr, ulong nframes) { struct aoetgt *t, **tt, **te; + struct frame *f, *e; tt = d->targets; te = tt + NTARGETS; @@ -1256,73 +941,26 @@ addtgt(struct aoedev *d, char *addr, ulong nframes) "aoe: device addtgt failure; too many targets\n"); return NULL; } - t = kzalloc(sizeof(*t), GFP_ATOMIC); - if (!t) { + t = kcalloc(1, sizeof *t, GFP_ATOMIC); + f = kcalloc(nframes, sizeof *f, GFP_ATOMIC); + if (!t || !f) { + kfree(f); + kfree(t); printk(KERN_INFO "aoe: cannot allocate memory to add target\n"); return NULL; } - d->ntargets++; t->nframes = nframes; - t->d = d; + t->frames = f; + e = f + nframes; + for (; f < e; f++) + f->tag = FREETAG; memcpy(t->addr, addr, sizeof t->addr); t->ifp = t->ifs; t->maxout = t->nframes; - INIT_LIST_HEAD(&t->ffree); return *tt = t; } -static void -setdbcnt(struct aoedev *d) -{ - struct aoetgt **t, **e; - int bcnt = 0; - - t = d->targets; - e = t + NTARGETS; - for (; t < e && *t; t++) - if (bcnt == 0 || bcnt > (*t)->minbcnt) - bcnt = (*t)->minbcnt; - if (bcnt != d->maxbcnt) { - d->maxbcnt = bcnt; - pr_info("aoe: e%ld.%d: setting %d byte data frames\n", - d->aoemajor, d->aoeminor, bcnt); - } -} - -static void -setifbcnt(struct aoetgt *t, struct net_device *nd, int bcnt) -{ - struct aoedev *d; - struct aoeif *p, *e; - int minbcnt; - - d = t->d; - minbcnt = bcnt; - p = t->ifs; - e = p + NAOEIFS; - for (; p < e; p++) { - if (p->nd == NULL) - break; /* end of the valid interfaces */ - if (p->nd == nd) { - p->bcnt = bcnt; /* we're updating */ - nd = NULL; - } else if (minbcnt > p->bcnt) - minbcnt = p->bcnt; /* find the min interface */ - } - if (nd) { - if (p == e) { - pr_err("aoe: device setifbcnt failure; too many interfaces.\n"); - return; - } - dev_hold(nd); - p->nd = nd; - p->bcnt = bcnt; - } - t->minbcnt = minbcnt; - setdbcnt(d); -} - void aoecmd_cfg_rsp(struct sk_buff *skb) { @@ -1330,12 +968,11 @@ aoecmd_cfg_rsp(struct sk_buff *skb) struct aoe_hdr *h; struct aoe_cfghdr *ch; struct aoetgt *t; - ulong flags, aoemajor; + struct aoeif *ifp; + ulong flags, sysminor, aoemajor; struct sk_buff *sl; - struct sk_buff_head queue; u16 n; - sl = NULL; h = (struct aoe_hdr *) skb_mac_header(skb); ch = (struct aoe_cfghdr *) (h+1); @@ -1349,13 +986,10 @@ aoecmd_cfg_rsp(struct sk_buff *skb) "Check shelf dip switches.\n"); return; } - if (aoemajor == 0xffff) { - pr_info("aoe: e%ld.%d: broadcast shelf number invalid\n", - aoemajor, (int) h->minor); - return; - } - if (h->minor == 0xff) { - pr_info("aoe: e%ld.%d: broadcast slot number invalid\n", + + sysminor = SYSMINOR(aoemajor, h->minor); + if (sysminor * AOE_PARTITIONS + AOE_PARTITIONS > MINORMASK) { + printk(KERN_INFO "aoe: e%ld.%d: minor number too large\n", aoemajor, (int) h->minor); return; } @@ -1364,9 +998,9 @@ aoecmd_cfg_rsp(struct sk_buff *skb) if (n > aoe_maxout) /* keep it reasonable */ n = aoe_maxout; - d = aoedev_by_aoeaddr(aoemajor, h->minor, 1); + d = aoedev_by_sysminor_m(sysminor); if (d == NULL) { - pr_info("aoe: device allocation failure\n"); + printk(KERN_INFO "aoe: device sysminor_m failure\n"); return; } @@ -1375,26 +1009,52 @@ aoecmd_cfg_rsp(struct sk_buff *skb) t = gettgt(d, h->src); if (!t) { t = addtgt(d, h->src, n); - if (!t) - goto bail; + if (!t) { + spin_unlock_irqrestore(&d->lock, flags); + return; + } + } + ifp = getif(t, skb->dev); + if (!ifp) { + ifp = addif(t, skb->dev); + if (!ifp) { + printk(KERN_INFO + "aoe: device addif failure; " + "too many interfaces?\n"); + spin_unlock_irqrestore(&d->lock, flags); + return; + } + } + if (ifp->maxbcnt) { + n = ifp->nd->mtu; + n -= sizeof (struct aoe_hdr) + sizeof (struct aoe_atahdr); + n /= 512; + if (n > ch->scnt) + n = ch->scnt; + n = n ? n * 512 : DEFAULTBCNT; + if (n != ifp->maxbcnt) { + printk(KERN_INFO + "aoe: e%ld.%d: setting %d%s%s:%pm\n", + d->aoemajor, d->aoeminor, n, + " byte data frames on ", ifp->nd->name, + t->addr); + ifp->maxbcnt = n; + } } - n = skb->dev->mtu; - n -= sizeof(struct aoe_hdr) + sizeof(struct aoe_atahdr); - n /= 512; - if (n > ch->scnt) - n = ch->scnt; - n = n ? n * 512 : DEFAULTBCNT; - setifbcnt(t, skb->dev, n); /* don't change users' perspective */ - if (d->nopen == 0) { - d->fw_ver = be16_to_cpu(ch->fwver); - sl = aoecmd_ata_id(d); + if (d->nopen) { + spin_unlock_irqrestore(&d->lock, flags); + return; } -bail: + d->fw_ver = be16_to_cpu(ch->fwver); + + sl = aoecmd_ata_id(d); + spin_unlock_irqrestore(&d->lock, flags); - aoedev_put(d); + if (sl) { + struct sk_buff_head queue; __skb_queue_head_init(&queue); __skb_queue_tail(&queue, sl); aoenet_xmit(&queue); @@ -1405,74 +1065,20 @@ void aoecmd_cleanslate(struct aoedev *d) { struct aoetgt **t, **te; + struct aoeif *p, *e; d->mintimer = MINTIMER; - d->maxbcnt = 0; t = d->targets; te = t + NTARGETS; - for (; t < te && *t; t++) + for (; t < te && *t; t++) { (*t)->maxout = (*t)->nframes; -} - -void -aoe_failbuf(struct aoedev *d, struct buf *buf) -{ - if (buf == NULL) - return; - buf->resid = 0; - clear_bit(BIO_UPTODATE, &buf->bio->bi_flags); - if (buf->nframesout == 0) - aoe_end_buf(d, buf); -} - -void -aoe_flush_iocq(void) -{ - struct frame *f; - struct aoedev *d; - LIST_HEAD(flist); - struct list_head *pos; - struct sk_buff *skb; - ulong flags; - - spin_lock_irqsave(&iocq.lock, flags); - list_splice_init(&iocq.head, &flist); - spin_unlock_irqrestore(&iocq.lock, flags); - while (!list_empty(&flist)) { - pos = flist.next; - list_del(pos); - f = list_entry(pos, struct frame, head); - d = f->t->d; - skb = f->r_skb; - spin_lock_irqsave(&d->lock, flags); - if (f->buf) { - f->buf->nframesout--; - aoe_failbuf(d, f->buf); + p = (*t)->ifs; + e = p + NAOEIFS; + for (; p < e; p++) { + p->lostjumbo = 0; + p->lost = 0; + p->maxbcnt = DEFAULTBCNT; } - aoe_freetframe(f); - spin_unlock_irqrestore(&d->lock, flags); - dev_kfree_skb(skb); - aoedev_put(d); } } - -int __init -aoecmd_init(void) -{ - INIT_LIST_HEAD(&iocq.head); - spin_lock_init(&iocq.lock); - init_waitqueue_head(&ktiowq); - kts.name = "aoe_ktio"; - kts.fn = ktio; - kts.waitq = &ktiowq; - kts.lock = &iocq.lock; - return aoe_ktstart(&kts); -} - -void -aoecmd_exit(void) -{ - aoe_ktstop(&kts); - aoe_flush_iocq(); -} diff --git a/trunk/drivers/block/aoe/aoedev.c b/trunk/drivers/block/aoe/aoedev.c index 90e5b537f94b..6b5110a47458 100644 --- a/trunk/drivers/block/aoe/aoedev.c +++ b/trunk/drivers/block/aoe/aoedev.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2012 Coraid, Inc. See COPYING for GPL terms. */ +/* Copyright (c) 2007 Coraid, Inc. See COPYING for GPL terms. */ /* * aoedev.c * AoE device utility functions; maintains device list. @@ -9,9 +9,6 @@ #include #include #include -#include -#include -#include #include "aoe.h" static void dummy_timer(ulong); @@ -19,121 +16,23 @@ static void aoedev_freedev(struct aoedev *); static void freetgt(struct aoedev *d, struct aoetgt *t); static void skbpoolfree(struct aoedev *d); -static int aoe_dyndevs = 1; -module_param(aoe_dyndevs, int, 0644); -MODULE_PARM_DESC(aoe_dyndevs, "Use dynamic minor numbers for devices."); - static struct aoedev *devlist; static DEFINE_SPINLOCK(devlist_lock); -/* Because some systems will have one, many, or no - * - partitions, - * - slots per shelf, - * - or shelves, - * we need some flexibility in the way the minor numbers - * are allocated. So they are dynamic. - */ -#define N_DEVS ((1U<= NPERSHELF || n >= N_DEVS) { - pr_err("aoe: %s with e%ld.%d\n", - "cannot use static minor device numbers", - aoemaj, aoemin); - error = -1; - } else { - spin_lock_irqsave(&used_minors_lock, flags); - if (test_bit(n, used_minors)) { - pr_err("aoe: %s %lu\n", - "existing device already has static minor number", - n); - error = -1; - } else - set_bit(n, used_minors); - spin_unlock_irqrestore(&used_minors_lock, flags); - } - - *sysminor = n; - return error; -} - -static int -minor_get(ulong *sysminor, ulong aoemaj, int aoemin) -{ - if (aoe_dyndevs) - return minor_get_dyn(sysminor); - else - return minor_get_static(sysminor, aoemaj, aoemin); -} - -static void -minor_free(ulong minor) +struct aoedev * +aoedev_by_aoeaddr(int maj, int min) { + struct aoedev *d; ulong flags; - minor /= AOE_PARTITIONS; - BUG_ON(minor >= N_DEVS); - - spin_lock_irqsave(&used_minors_lock, flags); - BUG_ON(!test_bit(minor, used_minors)); - clear_bit(minor, used_minors); - spin_unlock_irqrestore(&used_minors_lock, flags); -} - -/* - * Users who grab a pointer to the device with aoedev_by_aoeaddr - * automatically get a reference count and must be responsible - * for performing a aoedev_put. With the addition of async - * kthread processing I'm no longer confident that we can - * guarantee consistency in the face of device flushes. - * - * For the time being, we only bother to add extra references for - * frames sitting on the iocq. When the kthreads finish processing - * these frames, they will aoedev_put the device. - */ + spin_lock_irqsave(&devlist_lock, flags); -void -aoedev_put(struct aoedev *d) -{ - ulong flags; + for (d=devlist; d; d=d->next) + if (d->aoemajor == maj && d->aoeminor == min) + break; - spin_lock_irqsave(&devlist_lock, flags); - d->ref--; spin_unlock_irqrestore(&devlist_lock, flags); + return d; } static void @@ -148,74 +47,54 @@ dummy_timer(ulong vp) add_timer(&d->timer); } -static void -aoe_failip(struct aoedev *d) -{ - struct request *rq; - struct bio *bio; - unsigned long n; - - aoe_failbuf(d, d->ip.buf); - - rq = d->ip.rq; - if (rq == NULL) - return; - while ((bio = d->ip.nxbio)) { - clear_bit(BIO_UPTODATE, &bio->bi_flags); - d->ip.nxbio = bio->bi_next; - n = (unsigned long) rq->special; - rq->special = (void *) --n; - } - if ((unsigned long) rq->special == 0) - aoe_end_request(d, rq, 0); -} - void aoedev_downdev(struct aoedev *d) { - struct aoetgt *t, **tt, **te; - struct frame *f; - struct list_head *head, *pos, *nx; - struct request *rq; - int i; - - d->flags &= ~DEVFL_UP; + struct aoetgt **t, **te; + struct frame *f, *e; + struct buf *buf; + struct bio *bio; - /* clean out active buffers */ - for (i = 0; i < NFACTIVE; i++) { - head = &d->factive[i]; - list_for_each_safe(pos, nx, head) { - f = list_entry(pos, struct frame, head); - list_del(pos); - if (f->buf) { - f->buf->nframesout--; - aoe_failbuf(d, f->buf); + t = d->targets; + te = t + NTARGETS; + for (; t < te && *t; t++) { + f = (*t)->frames; + e = f + (*t)->nframes; + for (; f < e; f->tag = FREETAG, f->buf = NULL, f++) { + if (f->tag == FREETAG || f->buf == NULL) + continue; + buf = f->buf; + bio = buf->bio; + if (--buf->nframesout == 0 + && buf != d->inprocess) { + mempool_free(buf, d->bufpool); + bio_endio(bio, -EIO); } - aoe_freetframe(f); } + (*t)->maxout = (*t)->nframes; + (*t)->nout = 0; } - /* reset window dressings */ - tt = d->targets; - te = tt + NTARGETS; - for (; tt < te && (t = *tt); tt++) { - t->maxout = t->nframes; - t->nout = 0; + buf = d->inprocess; + if (buf) { + bio = buf->bio; + mempool_free(buf, d->bufpool); + bio_endio(bio, -EIO); } - - /* clean out the in-process request (if any) */ - aoe_failip(d); + d->inprocess = NULL; d->htgt = NULL; - /* fast fail all pending I/O */ - if (d->blkq) { - while ((rq = blk_peek_request(d->blkq))) { - blk_start_request(rq); - aoe_end_request(d, rq, 1); - } + while (!list_empty(&d->bufq)) { + buf = container_of(d->bufq.next, struct buf, bufs); + list_del(d->bufq.next); + bio = buf->bio; + mempool_free(buf, d->bufpool); + bio_endio(bio, -EIO); } if (d->gd) set_capacity(d->gd, 0); + + d->flags &= ~DEVFL_UP; } static void @@ -228,7 +107,6 @@ aoedev_freedev(struct aoedev *d) aoedisk_rm_sysfs(d); del_gendisk(d->gd); put_disk(d->gd); - blk_cleanup_queue(d->blkq); } t = d->targets; e = t + NTARGETS; @@ -237,7 +115,7 @@ aoedev_freedev(struct aoedev *d) if (d->bufpool) mempool_destroy(d->bufpool); skbpoolfree(d); - minor_free(d->sysminor); + blk_cleanup_queue(d->blkq); kfree(d); } @@ -264,8 +142,7 @@ aoedev_flush(const char __user *str, size_t cnt) spin_lock(&d->lock); if ((!all && (d->flags & DEVFL_UP)) || (d->flags & (DEVFL_GDALLOC|DEVFL_NEWSIZE)) - || d->nopen - || d->ref) { + || d->nopen) { spin_unlock(&d->lock); dd = &d->next; continue; @@ -286,15 +163,12 @@ aoedev_flush(const char __user *str, size_t cnt) return 0; } -/* This has been confirmed to occur once with Tms=3*1000 due to the - * driver changing link and not processing its transmit ring. The - * problem is hard enough to solve by returning an error that I'm - * still punting on "solving" this. - */ +/* I'm not really sure that this is a realistic problem, but if the +network driver goes gonzo let's just leak memory after complaining. */ static void skbfree(struct sk_buff *skb) { - enum { Sms = 250, Tms = 30 * 1000}; + enum { Sms = 100, Tms = 3*1000}; int i = Tms / Sms; if (skb == NULL) @@ -308,7 +182,6 @@ skbfree(struct sk_buff *skb) "cannot free skb -- memory leaked."); return; } - skb->truesize -= skb->data_len; skb_shinfo(skb)->nr_frags = skb->data_len = 0; skb_trim(skb, 0); dev_kfree_skb(skb); @@ -325,29 +198,26 @@ skbpoolfree(struct aoedev *d) __skb_queue_head_init(&d->skbpool); } -/* find it or allocate it */ +/* find it or malloc it */ struct aoedev * -aoedev_by_aoeaddr(ulong maj, int min, int do_alloc) +aoedev_by_sysminor_m(ulong sysminor) { struct aoedev *d; - int i; ulong flags; - ulong sysminor; spin_lock_irqsave(&devlist_lock, flags); for (d=devlist; d; d=d->next) - if (d->aoemajor == maj && d->aoeminor == min) { - d->ref++; + if (d->sysminor == sysminor) break; - } - if (d || !do_alloc || minor_get(&sysminor, maj, min) < 0) + if (d) goto out; d = kcalloc(1, sizeof *d, GFP_ATOMIC); if (!d) goto out; INIT_WORK(&d->work, aoecmd_sleepwork); spin_lock_init(&d->lock); + skb_queue_head_init(&d->sendq); skb_queue_head_init(&d->skbpool); init_timer(&d->timer); d->timer.data = (ulong) d; @@ -356,12 +226,10 @@ aoedev_by_aoeaddr(ulong maj, int min, int do_alloc) add_timer(&d->timer); d->bufpool = NULL; /* defer to aoeblk_gdalloc */ d->tgt = d->targets; - d->ref = 1; - for (i = 0; i < NFACTIVE; i++) - INIT_LIST_HEAD(&d->factive[i]); + INIT_LIST_HEAD(&d->bufq); d->sysminor = sysminor; - d->aoemajor = maj; - d->aoeminor = min; + d->aoemajor = AOEMAJOR(sysminor); + d->aoeminor = AOEMINOR(sysminor); d->mintimer = MINTIMER; d->next = devlist; devlist = d; @@ -373,23 +241,13 @@ aoedev_by_aoeaddr(ulong maj, int min, int do_alloc) static void freetgt(struct aoedev *d, struct aoetgt *t) { - struct frame *f; - struct list_head *pos, *nx, *head; - struct aoeif *ifp; + struct frame *f, *e; - for (ifp = t->ifs; ifp < &t->ifs[NAOEIFS]; ++ifp) { - if (!ifp->nd) - break; - dev_put(ifp->nd); - } - - head = &t->ffree; - list_for_each_safe(pos, nx, head) { - list_del(pos); - f = list_entry(pos, struct frame, head); + f = t->frames; + e = f + t->nframes; + for (; f < e; f++) skbfree(f->skb); - kfree(f); - } + kfree(t->frames); kfree(t); } @@ -399,7 +257,6 @@ aoedev_exit(void) struct aoedev *d; ulong flags; - aoe_flush_iocq(); while ((d = devlist)) { devlist = d->next; diff --git a/trunk/drivers/block/aoe/aoemain.c b/trunk/drivers/block/aoe/aoemain.c index 04793c2c701b..7f83ad90e76f 100644 --- a/trunk/drivers/block/aoe/aoemain.c +++ b/trunk/drivers/block/aoe/aoemain.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2012 Coraid, Inc. See COPYING for GPL terms. */ +/* Copyright (c) 2007 Coraid, Inc. See COPYING for GPL terms. */ /* * aoemain.c * Module initialization routines, discover timer @@ -61,7 +61,6 @@ aoe_exit(void) aoenet_exit(); unregister_blkdev(AOE_MAJOR, DEVICE_NAME); - aoecmd_exit(); aoechr_exit(); aoedev_exit(); aoeblk_exit(); /* free cache after de-allocating bufs */ @@ -84,20 +83,17 @@ aoe_init(void) ret = aoenet_init(); if (ret) goto net_fail; - ret = aoecmd_init(); - if (ret) - goto cmd_fail; ret = register_blkdev(AOE_MAJOR, DEVICE_NAME); if (ret < 0) { printk(KERN_ERR "aoe: can't register major\n"); goto blkreg_fail; } + printk(KERN_INFO "aoe: AoE v%s initialised.\n", VERSION); discover_timer(TINIT); return 0; + blkreg_fail: - aoecmd_exit(); - cmd_fail: aoenet_exit(); net_fail: aoeblk_exit(); diff --git a/trunk/drivers/block/aoe/aoenet.c b/trunk/drivers/block/aoe/aoenet.c index 162c6471275c..4d3bc0d49df5 100644 --- a/trunk/drivers/block/aoe/aoenet.c +++ b/trunk/drivers/block/aoe/aoenet.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2012 Coraid, Inc. See COPYING for GPL terms. */ +/* Copyright (c) 2007 Coraid, Inc. See COPYING for GPL terms. */ /* * aoenet.c * Ethernet portion of AoE driver @@ -33,9 +33,6 @@ static char aoe_iflist[IFLISTSZ]; module_param_string(aoe_iflist, aoe_iflist, IFLISTSZ, 0600); MODULE_PARM_DESC(aoe_iflist, "aoe_iflist=\"dev1 [dev2 ...]\""); -static wait_queue_head_t txwq; -static struct ktstate kts; - #ifndef MODULE static int __init aoe_iflist_setup(char *str) { @@ -47,23 +44,6 @@ static int __init aoe_iflist_setup(char *str) __setup("aoe_iflist=", aoe_iflist_setup); #endif -static spinlock_t txlock; -static struct sk_buff_head skbtxq; - -/* enters with txlock held */ -static int -tx(void) -{ - struct sk_buff *skb; - - while ((skb = skb_dequeue(&skbtxq))) { - spin_unlock_irq(&txlock); - dev_queue_xmit(skb); - spin_lock_irq(&txlock); - } - return 0; -} - int is_aoe_netif(struct net_device *ifp) { @@ -108,14 +88,10 @@ void aoenet_xmit(struct sk_buff_head *queue) { struct sk_buff *skb, *tmp; - ulong flags; skb_queue_walk_safe(queue, skb, tmp) { __skb_unlink(skb, queue); - spin_lock_irqsave(&txlock, flags); - skb_queue_tail(&skbtxq, skb); - spin_unlock_irqrestore(&txlock, flags); - wake_up(&txwq); + dev_queue_xmit(skb); } } @@ -126,9 +102,7 @@ static int aoenet_rcv(struct sk_buff *skb, struct net_device *ifp, struct packet_type *pt, struct net_device *orig_dev) { struct aoe_hdr *h; - struct aoe_atahdr *ah; u32 n; - int sn; if (dev_net(ifp) != &init_net) goto exit; @@ -136,16 +110,13 @@ aoenet_rcv(struct sk_buff *skb, struct net_device *ifp, struct packet_type *pt, skb = skb_share_check(skb, GFP_ATOMIC); if (skb == NULL) return 0; + if (skb_linearize(skb)) + goto exit; if (!is_aoe_netif(ifp)) goto exit; skb_push(skb, ETH_HLEN); /* (1) */ - sn = sizeof(*h) + sizeof(*ah); - if (skb->len >= sn) { - sn -= skb_headlen(skb); - if (sn > 0 && !__pskb_pull_tail(skb, sn)) - goto exit; - } - h = (struct aoe_hdr *) skb->data; + + h = (struct aoe_hdr *) skb_mac_header(skb); n = get_unaligned_be32(&h->tag); if ((h->verfl & AOEFL_RSP) == 0 || (n & 1<<31)) goto exit; @@ -166,8 +137,7 @@ aoenet_rcv(struct sk_buff *skb, struct net_device *ifp, struct packet_type *pt, switch (h->cmd) { case AOECMD_ATA: - /* ata_rsp may keep skb for later processing or give it back */ - skb = aoecmd_ata_rsp(skb); + aoecmd_ata_rsp(skb); break; case AOECMD_CFG: aoecmd_cfg_rsp(skb); @@ -175,12 +145,8 @@ aoenet_rcv(struct sk_buff *skb, struct net_device *ifp, struct packet_type *pt, default: if (h->cmd >= AOECMD_VEND_MIN) break; /* don't complain about vendor commands */ - pr_info("aoe: unknown AoE command type 0x%02x\n", h->cmd); - break; + printk(KERN_INFO "aoe: unknown cmd %d\n", h->cmd); } - - if (!skb) - return 0; exit: dev_kfree_skb(skb); return 0; @@ -194,15 +160,6 @@ static struct packet_type aoe_pt __read_mostly = { int __init aoenet_init(void) { - skb_queue_head_init(&skbtxq); - init_waitqueue_head(&txwq); - spin_lock_init(&txlock); - kts.lock = &txlock; - kts.fn = tx; - kts.waitq = &txwq; - kts.name = "aoe_tx"; - if (aoe_ktstart(&kts)) - return -EAGAIN; dev_add_pack(&aoe_pt); return 0; } @@ -210,8 +167,6 @@ aoenet_init(void) void aoenet_exit(void) { - aoe_ktstop(&kts); - skb_queue_purge(&skbtxq); dev_remove_pack(&aoe_pt); } diff --git a/trunk/drivers/block/nbd.c b/trunk/drivers/block/nbd.c index 043ddcca4abf..0c03411c59eb 100644 --- a/trunk/drivers/block/nbd.c +++ b/trunk/drivers/block/nbd.c @@ -78,8 +78,6 @@ static const char *ioctl_cmd_to_ascii(int cmd) case NBD_SET_SOCK: return "set-sock"; case NBD_SET_BLKSIZE: return "set-blksize"; case NBD_SET_SIZE: return "set-size"; - case NBD_SET_TIMEOUT: return "set-timeout"; - case NBD_SET_FLAGS: return "set-flags"; case NBD_DO_IT: return "do-it"; case NBD_CLEAR_SOCK: return "clear-sock"; case NBD_CLEAR_QUE: return "clear-que"; @@ -98,7 +96,6 @@ static const char *nbdcmd_to_ascii(int cmd) case NBD_CMD_READ: return "read"; case NBD_CMD_WRITE: return "write"; case NBD_CMD_DISC: return "disconnect"; - case NBD_CMD_TRIM: return "trim/discard"; } return "invalid"; } @@ -470,12 +467,8 @@ static void nbd_handle_req(struct nbd_device *nbd, struct request *req) nbd_cmd(req) = NBD_CMD_READ; if (rq_data_dir(req) == WRITE) { - if ((req->cmd_flags & REQ_DISCARD)) { - WARN_ON(!(nbd->flags & NBD_FLAG_SEND_TRIM)); - nbd_cmd(req) = NBD_CMD_TRIM; - } else - nbd_cmd(req) = NBD_CMD_WRITE; - if (nbd->flags & NBD_FLAG_READ_ONLY) { + nbd_cmd(req) = NBD_CMD_WRITE; + if (nbd->flags & NBD_READ_ONLY) { dev_err(disk_to_dev(nbd->disk), "Write on read-only\n"); goto error_out; @@ -658,10 +651,6 @@ static int __nbd_ioctl(struct block_device *bdev, struct nbd_device *nbd, nbd->xmit_timeout = arg * HZ; return 0; - case NBD_SET_FLAGS: - nbd->flags = arg; - return 0; - case NBD_SET_SIZE_BLOCKS: nbd->bytesize = ((u64) arg) * nbd->blksize; bdev->bd_inode->i_size = nbd->bytesize; @@ -681,10 +670,6 @@ static int __nbd_ioctl(struct block_device *bdev, struct nbd_device *nbd, mutex_unlock(&nbd->tx_lock); - if (nbd->flags & NBD_FLAG_SEND_TRIM) - queue_flag_set_unlocked(QUEUE_FLAG_DISCARD, - nbd->disk->queue); - thread = kthread_create(nbd_thread, nbd, nbd->disk->disk_name); if (IS_ERR(thread)) { mutex_lock(&nbd->tx_lock); @@ -702,7 +687,6 @@ static int __nbd_ioctl(struct block_device *bdev, struct nbd_device *nbd, nbd->file = NULL; nbd_clear_que(nbd); dev_warn(disk_to_dev(nbd->disk), "queue cleared\n"); - queue_flag_clear_unlocked(QUEUE_FLAG_DISCARD, nbd->disk->queue); if (file) fput(file); nbd->bytesize = 0; @@ -821,9 +805,6 @@ static int __init nbd_init(void) * Tell the block layer that we are not a rotational device */ queue_flag_set_unlocked(QUEUE_FLAG_NONROT, disk->queue); - disk->queue->limits.discard_granularity = 512; - disk->queue->limits.max_discard_sectors = UINT_MAX; - disk->queue->limits.discard_zeroes_data = 0; } if (register_blkdev(NBD_MAJOR, "nbd")) { diff --git a/trunk/drivers/char/agp/intel-gtt.c b/trunk/drivers/char/agp/intel-gtt.c index e01f5eaaec82..58e32f7c3229 100644 --- a/trunk/drivers/char/agp/intel-gtt.c +++ b/trunk/drivers/char/agp/intel-gtt.c @@ -84,33 +84,40 @@ static struct _intel_private { #define IS_IRONLAKE intel_private.driver->is_ironlake #define HAS_PGTBL_EN intel_private.driver->has_pgtbl_enable -static int intel_gtt_map_memory(struct page **pages, - unsigned int num_entries, - struct sg_table *st) +int intel_gtt_map_memory(struct page **pages, unsigned int num_entries, + struct scatterlist **sg_list, int *num_sg) { + struct sg_table st; struct scatterlist *sg; int i; + if (*sg_list) + return 0; /* already mapped (for e.g. resume */ + DBG("try mapping %lu pages\n", (unsigned long)num_entries); - if (sg_alloc_table(st, num_entries, GFP_KERNEL)) + if (sg_alloc_table(&st, num_entries, GFP_KERNEL)) goto err; - for_each_sg(st->sgl, sg, num_entries, i) + *sg_list = sg = st.sgl; + + for (i = 0 ; i < num_entries; i++, sg = sg_next(sg)) sg_set_page(sg, pages[i], PAGE_SIZE, 0); - if (!pci_map_sg(intel_private.pcidev, - st->sgl, st->nents, PCI_DMA_BIDIRECTIONAL)) + *num_sg = pci_map_sg(intel_private.pcidev, *sg_list, + num_entries, PCI_DMA_BIDIRECTIONAL); + if (unlikely(!*num_sg)) goto err; return 0; err: - sg_free_table(st); + sg_free_table(&st); return -ENOMEM; } +EXPORT_SYMBOL(intel_gtt_map_memory); -static void intel_gtt_unmap_memory(struct scatterlist *sg_list, int num_sg) +void intel_gtt_unmap_memory(struct scatterlist *sg_list, int num_sg) { struct sg_table st; DBG("try unmapping %lu pages\n", (unsigned long)mem->page_count); @@ -123,6 +130,7 @@ static void intel_gtt_unmap_memory(struct scatterlist *sg_list, int num_sg) sg_free_table(&st); } +EXPORT_SYMBOL(intel_gtt_unmap_memory); static void intel_fake_agp_enable(struct agp_bridge_data *bridge, u32 mode) { @@ -666,14 +674,9 @@ static int intel_gtt_init(void) gtt_map_size = intel_private.base.gtt_total_entries * 4; - intel_private.gtt = NULL; - if (INTEL_GTT_GEN < 6) - intel_private.gtt = ioremap_wc(intel_private.gtt_bus_addr, - gtt_map_size); - if (intel_private.gtt == NULL) - intel_private.gtt = ioremap(intel_private.gtt_bus_addr, - gtt_map_size); - if (intel_private.gtt == NULL) { + intel_private.gtt = ioremap(intel_private.gtt_bus_addr, + gtt_map_size); + if (!intel_private.gtt) { intel_private.driver->cleanup(); iounmap(intel_private.registers); return -ENOMEM; @@ -876,7 +879,8 @@ static bool i830_check_flags(unsigned int flags) return false; } -void intel_gtt_insert_sg_entries(struct sg_table *st, +void intel_gtt_insert_sg_entries(struct scatterlist *sg_list, + unsigned int sg_len, unsigned int pg_start, unsigned int flags) { @@ -888,11 +892,12 @@ void intel_gtt_insert_sg_entries(struct sg_table *st, /* sg may merge pages, but we have to separate * per-page addr for GTT */ - for_each_sg(st->sgl, sg, st->nents, i) { + for_each_sg(sg_list, sg, sg_len, i) { len = sg_dma_len(sg) >> PAGE_SHIFT; for (m = 0; m < len; m++) { dma_addr_t addr = sg_dma_address(sg) + (m << PAGE_SHIFT); - intel_private.driver->write_entry(addr, j, flags); + intel_private.driver->write_entry(addr, + j, flags); j++; } } @@ -900,10 +905,8 @@ void intel_gtt_insert_sg_entries(struct sg_table *st, } EXPORT_SYMBOL(intel_gtt_insert_sg_entries); -static void intel_gtt_insert_pages(unsigned int first_entry, - unsigned int num_entries, - struct page **pages, - unsigned int flags) +void intel_gtt_insert_pages(unsigned int first_entry, unsigned int num_entries, + struct page **pages, unsigned int flags) { int i, j; @@ -914,6 +917,7 @@ static void intel_gtt_insert_pages(unsigned int first_entry, } readl(intel_private.gtt+j-1); } +EXPORT_SYMBOL(intel_gtt_insert_pages); static int intel_fake_agp_insert_entries(struct agp_memory *mem, off_t pg_start, int type) @@ -949,15 +953,13 @@ static int intel_fake_agp_insert_entries(struct agp_memory *mem, global_cache_flush(); if (intel_private.base.needs_dmar) { - struct sg_table st; - - ret = intel_gtt_map_memory(mem->pages, mem->page_count, &st); + ret = intel_gtt_map_memory(mem->pages, mem->page_count, + &mem->sg_list, &mem->num_sg); if (ret != 0) return ret; - intel_gtt_insert_sg_entries(&st, pg_start, type); - mem->sg_list = st.sgl; - mem->num_sg = st.nents; + intel_gtt_insert_sg_entries(mem->sg_list, mem->num_sg, + pg_start, type); } else intel_gtt_insert_pages(pg_start, mem->page_count, mem->pages, type); diff --git a/trunk/drivers/char/hw_random/Kconfig b/trunk/drivers/char/hw_random/Kconfig index fbd9b2b850ef..7c0d391996b5 100644 --- a/trunk/drivers/char/hw_random/Kconfig +++ b/trunk/drivers/char/hw_random/Kconfig @@ -289,16 +289,3 @@ config HW_RANDOM_EXYNOS module will be called exynos-rng. If unsure, say Y. - -config HW_RANDOM_TPM - tristate "TPM HW Random Number Generator support" - depends on HW_RANDOM && TCG_TPM - default HW_RANDOM - ---help--- - This driver provides kernel-side support for the Random Number - Generator in the Trusted Platform Module - - To compile this driver as a module, choose M here: the - module will be called tpm-rng. - - If unsure, say Y. diff --git a/trunk/drivers/char/hw_random/Makefile b/trunk/drivers/char/hw_random/Makefile index 1fd7eec9fbf6..39a757ca15b6 100644 --- a/trunk/drivers/char/hw_random/Makefile +++ b/trunk/drivers/char/hw_random/Makefile @@ -25,4 +25,3 @@ obj-$(CONFIG_HW_RANDOM_PICOXCELL) += picoxcell-rng.o obj-$(CONFIG_HW_RANDOM_PPC4XX) += ppc4xx-rng.o obj-$(CONFIG_HW_RANDOM_PSERIES) += pseries-rng.o obj-$(CONFIG_HW_RANDOM_EXYNOS) += exynos-rng.o -obj-$(CONFIG_HW_RANDOM_TPM) += tpm-rng.o diff --git a/trunk/drivers/char/hw_random/mxc-rnga.c b/trunk/drivers/char/hw_random/mxc-rnga.c index f05d85713fd3..85074de5042e 100644 --- a/trunk/drivers/char/hw_random/mxc-rnga.c +++ b/trunk/drivers/char/hw_random/mxc-rnga.c @@ -59,21 +59,16 @@ #define RNGA_STATUS_LAST_READ_STATUS 0x00000002 #define RNGA_STATUS_SECURITY_VIOLATION 0x00000001 -struct mxc_rng { - struct device *dev; - struct hwrng rng; - void __iomem *mem; - struct clk *clk; -}; +static struct platform_device *rng_dev; static int mxc_rnga_data_present(struct hwrng *rng, int wait) { + void __iomem *rng_base = (void __iomem *)rng->priv; int i; - struct mxc_rng *mxc_rng = container_of(rng, struct mxc_rng, rng); for (i = 0; i < 20; i++) { /* how many random numbers are in FIFO? [0-16] */ - int level = (__raw_readl(mxc_rng->mem + RNGA_STATUS) & + int level = (__raw_readl(rng_base + RNGA_STATUS) & RNGA_STATUS_LEVEL_MASK) >> 8; if (level || !wait) return !!level; @@ -86,20 +81,20 @@ static int mxc_rnga_data_read(struct hwrng *rng, u32 * data) { int err; u32 ctrl; - struct mxc_rng *mxc_rng = container_of(rng, struct mxc_rng, rng); + void __iomem *rng_base = (void __iomem *)rng->priv; /* retrieve a random number from FIFO */ - *data = __raw_readl(mxc_rng->mem + RNGA_OUTPUT_FIFO); + *data = __raw_readl(rng_base + RNGA_OUTPUT_FIFO); /* some error while reading this random number? */ - err = __raw_readl(mxc_rng->mem + RNGA_STATUS) & RNGA_STATUS_ERROR_INT; + err = __raw_readl(rng_base + RNGA_STATUS) & RNGA_STATUS_ERROR_INT; /* if error: clear error interrupt, but doesn't return random number */ if (err) { - dev_dbg(mxc_rng->dev, "Error while reading random number!\n"); - ctrl = __raw_readl(mxc_rng->mem + RNGA_CONTROL); + dev_dbg(&rng_dev->dev, "Error while reading random number!\n"); + ctrl = __raw_readl(rng_base + RNGA_CONTROL); __raw_writel(ctrl | RNGA_CONTROL_CLEAR_INT, - mxc_rng->mem + RNGA_CONTROL); + rng_base + RNGA_CONTROL); return 0; } else return 4; @@ -108,22 +103,22 @@ static int mxc_rnga_data_read(struct hwrng *rng, u32 * data) static int mxc_rnga_init(struct hwrng *rng) { u32 ctrl, osc; - struct mxc_rng *mxc_rng = container_of(rng, struct mxc_rng, rng); + void __iomem *rng_base = (void __iomem *)rng->priv; /* wake up */ - ctrl = __raw_readl(mxc_rng->mem + RNGA_CONTROL); - __raw_writel(ctrl & ~RNGA_CONTROL_SLEEP, mxc_rng->mem + RNGA_CONTROL); + ctrl = __raw_readl(rng_base + RNGA_CONTROL); + __raw_writel(ctrl & ~RNGA_CONTROL_SLEEP, rng_base + RNGA_CONTROL); /* verify if oscillator is working */ - osc = __raw_readl(mxc_rng->mem + RNGA_STATUS); + osc = __raw_readl(rng_base + RNGA_STATUS); if (osc & RNGA_STATUS_OSC_DEAD) { - dev_err(mxc_rng->dev, "RNGA Oscillator is dead!\n"); + dev_err(&rng_dev->dev, "RNGA Oscillator is dead!\n"); return -ENODEV; } /* go running */ - ctrl = __raw_readl(mxc_rng->mem + RNGA_CONTROL); - __raw_writel(ctrl | RNGA_CONTROL_GO, mxc_rng->mem + RNGA_CONTROL); + ctrl = __raw_readl(rng_base + RNGA_CONTROL); + __raw_writel(ctrl | RNGA_CONTROL_GO, rng_base + RNGA_CONTROL); return 0; } @@ -131,40 +126,40 @@ static int mxc_rnga_init(struct hwrng *rng) static void mxc_rnga_cleanup(struct hwrng *rng) { u32 ctrl; - struct mxc_rng *mxc_rng = container_of(rng, struct mxc_rng, rng); + void __iomem *rng_base = (void __iomem *)rng->priv; - ctrl = __raw_readl(mxc_rng->mem + RNGA_CONTROL); + ctrl = __raw_readl(rng_base + RNGA_CONTROL); /* stop rnga */ - __raw_writel(ctrl & ~RNGA_CONTROL_GO, mxc_rng->mem + RNGA_CONTROL); + __raw_writel(ctrl & ~RNGA_CONTROL_GO, rng_base + RNGA_CONTROL); } +static struct hwrng mxc_rnga = { + .name = "mxc-rnga", + .init = mxc_rnga_init, + .cleanup = mxc_rnga_cleanup, + .data_present = mxc_rnga_data_present, + .data_read = mxc_rnga_data_read +}; + static int __init mxc_rnga_probe(struct platform_device *pdev) { int err = -ENODEV; + struct clk *clk; struct resource *res, *mem; - struct mxc_rng *mxc_rng; - - mxc_rng = devm_kzalloc(&pdev->dev, sizeof(struct mxc_rng), - GFP_KERNEL); - if (!mxc_rng) - return -ENOMEM; - - mxc_rng->dev = &pdev->dev; - mxc_rng->rng.name = "mxc-rnga"; - mxc_rng->rng.init = mxc_rnga_init; - mxc_rng->rng.cleanup = mxc_rnga_cleanup, - mxc_rng->rng.data_present = mxc_rnga_data_present, - mxc_rng->rng.data_read = mxc_rnga_data_read, - - mxc_rng->clk = devm_clk_get(&pdev->dev, NULL); - if (IS_ERR(mxc_rng->clk)) { + void __iomem *rng_base = NULL; + + if (rng_dev) + return -EBUSY; + + clk = clk_get(&pdev->dev, "rng"); + if (IS_ERR(clk)) { dev_err(&pdev->dev, "Could not get rng_clk!\n"); - err = PTR_ERR(mxc_rng->clk); + err = PTR_ERR(clk); goto out; } - clk_prepare_enable(mxc_rng->clk); + clk_enable(clk); res = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (!res) { @@ -178,27 +173,36 @@ static int __init mxc_rnga_probe(struct platform_device *pdev) goto err_region; } - mxc_rng->mem = ioremap(res->start, resource_size(res)); - if (!mxc_rng->mem) { + rng_base = ioremap(res->start, resource_size(res)); + if (!rng_base) { err = -ENOMEM; goto err_ioremap; } - err = hwrng_register(&mxc_rng->rng); + mxc_rnga.priv = (unsigned long)rng_base; + + err = hwrng_register(&mxc_rnga); if (err) { dev_err(&pdev->dev, "MXC RNGA registering failed (%d)\n", err); - goto err_ioremap; + goto err_register; } + rng_dev = pdev; + dev_info(&pdev->dev, "MXC RNGA Registered.\n"); return 0; +err_register: + iounmap(rng_base); + rng_base = NULL; + err_ioremap: release_mem_region(res->start, resource_size(res)); err_region: - clk_disable_unprepare(mxc_rng->clk); + clk_disable(clk); + clk_put(clk); out: return err; @@ -207,15 +211,17 @@ static int __init mxc_rnga_probe(struct platform_device *pdev) static int __exit mxc_rnga_remove(struct platform_device *pdev) { struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - struct mxc_rng *mxc_rng = platform_get_drvdata(pdev); + void __iomem *rng_base = (void __iomem *)mxc_rnga.priv; + struct clk *clk = clk_get(&pdev->dev, "rng"); - hwrng_unregister(&mxc_rng->rng); + hwrng_unregister(&mxc_rnga); - iounmap(mxc_rng->mem); + iounmap(rng_base); release_mem_region(res->start, resource_size(res)); - clk_disable_unprepare(mxc_rng->clk); + clk_disable(clk); + clk_put(clk); return 0; } diff --git a/trunk/drivers/char/hw_random/octeon-rng.c b/trunk/drivers/char/hw_random/octeon-rng.c index 5c34c092af71..0943edc782a1 100644 --- a/trunk/drivers/char/hw_random/octeon-rng.c +++ b/trunk/drivers/char/hw_random/octeon-rng.c @@ -75,35 +75,42 @@ static int __devinit octeon_rng_probe(struct platform_device *pdev) res_ports = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (!res_ports) - return -ENOENT; + goto err_ports; res_result = platform_get_resource(pdev, IORESOURCE_MEM, 1); if (!res_result) - return -ENOENT; + goto err_ports; rng->control_status = devm_ioremap_nocache(&pdev->dev, res_ports->start, sizeof(u64)); if (!rng->control_status) - return -ENOENT; + goto err_ports; rng->result = devm_ioremap_nocache(&pdev->dev, res_result->start, sizeof(u64)); if (!rng->result) - return -ENOENT; + goto err_r; rng->ops = ops; dev_set_drvdata(&pdev->dev, &rng->ops); ret = hwrng_register(&rng->ops); if (ret) - return -ENOENT; + goto err; dev_info(&pdev->dev, "Octeon Random Number Generator\n"); return 0; +err: + devm_iounmap(&pdev->dev, rng->control_status); +err_r: + devm_iounmap(&pdev->dev, rng->result); +err_ports: + devm_kfree(&pdev->dev, rng); + return -ENOENT; } static int __exit octeon_rng_remove(struct platform_device *pdev) diff --git a/trunk/drivers/char/hw_random/tpm-rng.c b/trunk/drivers/char/hw_random/tpm-rng.c deleted file mode 100644 index d6d448266f07..000000000000 --- a/trunk/drivers/char/hw_random/tpm-rng.c +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (C) 2012 Kent Yoder IBM Corporation - * - * HWRNG interfaces to pull RNG data from a TPM - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include -#include -#include - -#define MODULE_NAME "tpm-rng" - -static int tpm_rng_read(struct hwrng *rng, void *data, size_t max, bool wait) -{ - return tpm_get_random(TPM_ANY_NUM, data, max); -} - -static struct hwrng tpm_rng = { - .name = MODULE_NAME, - .read = tpm_rng_read, -}; - -static int __init rng_init(void) -{ - return hwrng_register(&tpm_rng); -} -module_init(rng_init); - -static void __exit rng_exit(void) -{ - hwrng_unregister(&tpm_rng); -} -module_exit(rng_exit); - -MODULE_LICENSE("GPL v2"); -MODULE_AUTHOR("Kent Yoder "); -MODULE_DESCRIPTION("RNG driver for TPM devices"); diff --git a/trunk/drivers/char/mbcs.c b/trunk/drivers/char/mbcs.c index 0c7d340b9ab9..47ff7e470d87 100644 --- a/trunk/drivers/char/mbcs.c +++ b/trunk/drivers/char/mbcs.c @@ -799,7 +799,7 @@ static int mbcs_remove(struct cx_dev *dev) return 0; } -static const struct cx_device_id __devinitconst mbcs_id_table[] = { +static const struct cx_device_id __devinitdata mbcs_id_table[] = { { .part_num = MBCS_PART_NUM, .mfg_num = MBCS_MFG_NUM, diff --git a/trunk/drivers/char/tpm/Kconfig b/trunk/drivers/char/tpm/Kconfig index 915875e431d2..a048199ce866 100644 --- a/trunk/drivers/char/tpm/Kconfig +++ b/trunk/drivers/char/tpm/Kconfig @@ -33,17 +33,6 @@ config TCG_TIS from within Linux. To compile this driver as a module, choose M here; the module will be called tpm_tis. -config TCG_TIS_I2C_INFINEON - tristate "TPM Interface Specification 1.2 Interface (I2C - Infineon)" - depends on I2C - ---help--- - If you have a TPM security chip that is compliant with the - TCG TIS 1.2 TPM specification and Infineon's I2C Protocol Stack - Specification 0.20 say Yes and it will be accessible from within - Linux. - To compile this driver as a module, choose M here; the module - will be called tpm_tis_i2c_infineon. - config TCG_NSC tristate "National Semiconductor TPM Interface" depends on X86 @@ -73,12 +62,4 @@ config TCG_INFINEON Further information on this driver and the supported hardware can be found at http://www.trust.rub.de/projects/linux-device-driver-infineon-tpm/ -config TCG_IBMVTPM - tristate "IBM VTPM Interface" - depends on PPC64 - ---help--- - If you have IBM virtual TPM (VTPM) support say Yes and it - will be accessible from within Linux. To compile this driver - as a module, choose M here; the module will be called tpm_ibmvtpm. - endif # TCG_TPM diff --git a/trunk/drivers/char/tpm/Makefile b/trunk/drivers/char/tpm/Makefile index 5b3fc8bc6c13..ea3a1e02a824 100644 --- a/trunk/drivers/char/tpm/Makefile +++ b/trunk/drivers/char/tpm/Makefile @@ -4,16 +4,8 @@ obj-$(CONFIG_TCG_TPM) += tpm.o ifdef CONFIG_ACPI obj-$(CONFIG_TCG_TPM) += tpm_bios.o - tpm_bios-objs += tpm_eventlog.o tpm_acpi.o tpm_ppi.o -else -ifdef CONFIG_TCG_IBMVTPM - obj-$(CONFIG_TCG_TPM) += tpm_bios.o - tpm_bios-objs += tpm_eventlog.o tpm_of.o -endif endif obj-$(CONFIG_TCG_TIS) += tpm_tis.o -obj-$(CONFIG_TCG_TIS_I2C_INFINEON) += tpm_i2c_infineon.o obj-$(CONFIG_TCG_NSC) += tpm_nsc.o obj-$(CONFIG_TCG_ATMEL) += tpm_atmel.o obj-$(CONFIG_TCG_INFINEON) += tpm_infineon.o -obj-$(CONFIG_TCG_IBMVTPM) += tpm_ibmvtpm.o diff --git a/trunk/drivers/char/tpm/tpm.c b/trunk/drivers/char/tpm/tpm.c index f26afdb1a702..3af9f4d1a23f 100644 --- a/trunk/drivers/char/tpm/tpm.c +++ b/trunk/drivers/char/tpm/tpm.c @@ -30,7 +30,12 @@ #include #include "tpm.h" -#include "tpm_eventlog.h" + +enum tpm_const { + TPM_MINOR = 224, /* officially assigned */ + TPM_BUFSIZE = 4096, + TPM_NUM_DEVICES = 256, +}; enum tpm_duration { TPM_SHORT = 0, @@ -477,7 +482,6 @@ static ssize_t transmit_cmd(struct tpm_chip *chip, struct tpm_cmd_t *cmd, #define TPM_INTERNAL_RESULT_SIZE 200 #define TPM_TAG_RQU_COMMAND cpu_to_be16(193) #define TPM_ORD_GET_CAP cpu_to_be32(101) -#define TPM_ORD_GET_RANDOM cpu_to_be32(70) static const struct tpm_input_header tpm_getcap_header = { .tag = TPM_TAG_RQU_COMMAND, @@ -915,7 +919,7 @@ EXPORT_SYMBOL_GPL(tpm_show_pcrs); #define READ_PUBEK_RESULT_SIZE 314 #define TPM_ORD_READPUBEK cpu_to_be32(124) -static struct tpm_input_header tpm_readpubek_header = { +struct tpm_input_header tpm_readpubek_header = { .tag = TPM_TAG_RQU_COMMAND, .length = cpu_to_be32(30), .ordinal = TPM_ORD_READPUBEK @@ -1171,7 +1175,7 @@ int tpm_release(struct inode *inode, struct file *file) flush_work(&chip->work); file->private_data = NULL; atomic_set(&chip->data_pending, 0); - kzfree(chip->data_buffer); + kfree(chip->data_buffer); clear_bit(0, &chip->is_open); put_device(chip->dev); return 0; @@ -1223,6 +1227,7 @@ ssize_t tpm_read(struct file *file, char __user *buf, del_singleshot_timer_sync(&chip->user_read_timer); flush_work(&chip->work); ret_size = atomic_read(&chip->data_pending); + atomic_set(&chip->data_pending, 0); if (ret_size > 0) { /* relay data */ ssize_t orig_ret_size = ret_size; if (size < ret_size) @@ -1237,8 +1242,6 @@ ssize_t tpm_read(struct file *file, char __user *buf, mutex_unlock(&chip->buffer_mutex); } - atomic_set(&chip->data_pending, 0); - return ret_size; } EXPORT_SYMBOL_GPL(tpm_read); @@ -1323,58 +1326,6 @@ int tpm_pm_resume(struct device *dev) } EXPORT_SYMBOL_GPL(tpm_pm_resume); -#define TPM_GETRANDOM_RESULT_SIZE 18 -static struct tpm_input_header tpm_getrandom_header = { - .tag = TPM_TAG_RQU_COMMAND, - .length = cpu_to_be32(14), - .ordinal = TPM_ORD_GET_RANDOM -}; - -/** - * tpm_get_random() - Get random bytes from the tpm's RNG - * @chip_num: A specific chip number for the request or TPM_ANY_NUM - * @out: destination buffer for the random bytes - * @max: the max number of bytes to write to @out - * - * Returns < 0 on error and the number of bytes read on success - */ -int tpm_get_random(u32 chip_num, u8 *out, size_t max) -{ - struct tpm_chip *chip; - struct tpm_cmd_t tpm_cmd; - u32 recd, num_bytes = min_t(u32, max, TPM_MAX_RNG_DATA); - int err, total = 0, retries = 5; - u8 *dest = out; - - chip = tpm_chip_find_get(chip_num); - if (chip == NULL) - return -ENODEV; - - if (!out || !num_bytes || max > TPM_MAX_RNG_DATA) - return -EINVAL; - - do { - tpm_cmd.header.in = tpm_getrandom_header; - tpm_cmd.params.getrandom_in.num_bytes = cpu_to_be32(num_bytes); - - err = transmit_cmd(chip, &tpm_cmd, - TPM_GETRANDOM_RESULT_SIZE + num_bytes, - "attempting get random"); - if (err) - break; - - recd = be32_to_cpu(tpm_cmd.params.getrandom_out.rng_data_len); - memcpy(dest, tpm_cmd.params.getrandom_out.rng_data, recd); - - dest += recd; - total += recd; - num_bytes -= recd; - } while (retries-- && total < max); - - return total ? total : -EIO; -} -EXPORT_SYMBOL_GPL(tpm_get_random); - /* In case vendor provided release function, call it too.*/ void tpm_dev_vendor_release(struct tpm_chip *chip) @@ -1395,7 +1346,7 @@ EXPORT_SYMBOL_GPL(tpm_dev_vendor_release); * Once all references to platform device are down to 0, * release all allocated structures. */ -static void tpm_dev_release(struct device *dev) +void tpm_dev_release(struct device *dev) { struct tpm_chip *chip = dev_get_drvdata(dev); @@ -1476,11 +1427,6 @@ struct tpm_chip *tpm_register_hardware(struct device *dev, goto put_device; } - if (sys_add_ppi(&dev->kobj)) { - misc_deregister(&chip->vendor.miscdev); - goto put_device; - } - chip->bios_dir = tpm_bios_log_setup(devname); /* Make chip available */ diff --git a/trunk/drivers/char/tpm/tpm.h b/trunk/drivers/char/tpm/tpm.h index 02c266aa2bf7..917f727e6740 100644 --- a/trunk/drivers/char/tpm/tpm.h +++ b/trunk/drivers/char/tpm/tpm.h @@ -28,12 +28,6 @@ #include #include -enum tpm_const { - TPM_MINOR = 224, /* officially assigned */ - TPM_BUFSIZE = 4096, - TPM_NUM_DEVICES = 256, -}; - enum tpm_timeout { TPM_TIMEOUT = 5, /* msecs */ }; @@ -100,7 +94,6 @@ struct tpm_vendor_specific { bool timeout_adjusted; unsigned long duration[3]; /* jiffies */ bool duration_adjusted; - void *data; wait_queue_head_t read_queue; wait_queue_head_t int_queue; @@ -276,21 +269,6 @@ struct tpm_pcrextend_in { u8 hash[TPM_DIGEST_SIZE]; }__attribute__((packed)); -/* 128 bytes is an arbitrary cap. This could be as large as TPM_BUFSIZE - 18 - * bytes, but 128 is still a relatively large number of random bytes and - * anything much bigger causes users of struct tpm_cmd_t to start getting - * compiler warnings about stack frame size. */ -#define TPM_MAX_RNG_DATA 128 - -struct tpm_getrandom_out { - __be32 rng_data_len; - u8 rng_data[TPM_MAX_RNG_DATA]; -}__attribute__((packed)); - -struct tpm_getrandom_in { - __be32 num_bytes; -}__attribute__((packed)); - typedef union { struct tpm_getcap_params_out getcap_out; struct tpm_readpubek_params_out readpubek_out; @@ -299,8 +277,6 @@ typedef union { struct tpm_pcrread_in pcrread_in; struct tpm_pcrread_out pcrread_out; struct tpm_pcrextend_in pcrextend_in; - struct tpm_getrandom_in getrandom_in; - struct tpm_getrandom_out getrandom_out; } tpm_cmd_params; struct tpm_cmd_t { @@ -327,12 +303,15 @@ extern int tpm_pm_suspend(struct device *); extern int tpm_pm_resume(struct device *); extern int wait_for_tpm_stat(struct tpm_chip *, u8, unsigned long, wait_queue_head_t *); - #ifdef CONFIG_ACPI -extern ssize_t sys_add_ppi(struct kobject *parent); +extern struct dentry ** tpm_bios_log_setup(char *); +extern void tpm_bios_log_teardown(struct dentry **); #else -static inline ssize_t sys_add_ppi(struct kobject *parent) +static inline struct dentry ** tpm_bios_log_setup(char *name) +{ + return NULL; +} +static inline void tpm_bios_log_teardown(struct dentry **dir) { - return 0; } #endif diff --git a/trunk/drivers/char/tpm/tpm_acpi.c b/trunk/drivers/char/tpm/tpm_acpi.c deleted file mode 100644 index 56051d0c97a2..000000000000 --- a/trunk/drivers/char/tpm/tpm_acpi.c +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Copyright (C) 2005 IBM Corporation - * - * Authors: - * Seiji Munetoh - * Stefan Berger - * Reiner Sailer - * Kylene Hall - * - * Maintained by: - * - * Access to the eventlog extended by the TCG BIOS of PC platform - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version - * 2 of the License, or (at your option) any later version. - * - */ - -#include -#include -#include -#include -#include -#include - -#include "tpm.h" -#include "tpm_eventlog.h" - -struct acpi_tcpa { - struct acpi_table_header hdr; - u16 platform_class; - union { - struct client_hdr { - u32 log_max_len __attribute__ ((packed)); - u64 log_start_addr __attribute__ ((packed)); - } client; - struct server_hdr { - u16 reserved; - u64 log_max_len __attribute__ ((packed)); - u64 log_start_addr __attribute__ ((packed)); - } server; - }; -}; - -/* read binary bios log */ -int read_log(struct tpm_bios_log *log) -{ - struct acpi_tcpa *buff; - acpi_status status; - void __iomem *virt; - u64 len, start; - - if (log->bios_event_log != NULL) { - printk(KERN_ERR - "%s: ERROR - Eventlog already initialized\n", - __func__); - return -EFAULT; - } - - /* Find TCPA entry in RSDT (ACPI_LOGICAL_ADDRESSING) */ - status = acpi_get_table(ACPI_SIG_TCPA, 1, - (struct acpi_table_header **)&buff); - - if (ACPI_FAILURE(status)) { - printk(KERN_ERR "%s: ERROR - Could not get TCPA table\n", - __func__); - return -EIO; - } - - switch(buff->platform_class) { - case BIOS_SERVER: - len = buff->server.log_max_len; - start = buff->server.log_start_addr; - break; - case BIOS_CLIENT: - default: - len = buff->client.log_max_len; - start = buff->client.log_start_addr; - break; - } - if (!len) { - printk(KERN_ERR "%s: ERROR - TCPA log area empty\n", __func__); - return -EIO; - } - - /* malloc EventLog space */ - log->bios_event_log = kmalloc(len, GFP_KERNEL); - if (!log->bios_event_log) { - printk("%s: ERROR - Not enough Memory for BIOS measurements\n", - __func__); - return -ENOMEM; - } - - log->bios_event_log_end = log->bios_event_log + len; - - virt = acpi_os_map_memory(start, len); - if (!virt) { - kfree(log->bios_event_log); - printk("%s: ERROR - Unable to map memory\n", __func__); - return -EIO; - } - - memcpy_fromio(log->bios_event_log, virt, len); - - acpi_os_unmap_memory(virt, len); - return 0; -} diff --git a/trunk/drivers/char/tpm/tpm_eventlog.c b/trunk/drivers/char/tpm/tpm_bios.c similarity index 75% rename from trunk/drivers/char/tpm/tpm_eventlog.c rename to trunk/drivers/char/tpm/tpm_bios.c index 84ddc557b8f8..0636520fa9bf 100644 --- a/trunk/drivers/char/tpm/tpm_eventlog.c +++ b/trunk/drivers/char/tpm/tpm_bios.c @@ -1,8 +1,7 @@ /* - * Copyright (C) 2005, 2012 IBM Corporation + * Copyright (C) 2005 IBM Corporation * * Authors: - * Kent Yoder * Seiji Munetoh * Stefan Berger * Reiner Sailer @@ -10,7 +9,7 @@ * * Maintained by: * - * Access to the eventlog created by a system's firmware / BIOS + * Access to the eventlog extended by the TCG BIOS of PC platform * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -24,10 +23,67 @@ #include #include #include - +#include #include "tpm.h" -#include "tpm_eventlog.h" +#define TCG_EVENT_NAME_LEN_MAX 255 +#define MAX_TEXT_EVENT 1000 /* Max event string length */ +#define ACPI_TCPA_SIG "TCPA" /* 0x41504354 /'TCPA' */ + +enum bios_platform_class { + BIOS_CLIENT = 0x00, + BIOS_SERVER = 0x01, +}; + +struct tpm_bios_log { + void *bios_event_log; + void *bios_event_log_end; +}; + +struct acpi_tcpa { + struct acpi_table_header hdr; + u16 platform_class; + union { + struct client_hdr { + u32 log_max_len __attribute__ ((packed)); + u64 log_start_addr __attribute__ ((packed)); + } client; + struct server_hdr { + u16 reserved; + u64 log_max_len __attribute__ ((packed)); + u64 log_start_addr __attribute__ ((packed)); + } server; + }; +}; + +struct tcpa_event { + u32 pcr_index; + u32 event_type; + u8 pcr_value[20]; /* SHA1 */ + u32 event_size; + u8 event_data[0]; +}; + +enum tcpa_event_types { + PREBOOT = 0, + POST_CODE, + UNUSED, + NO_ACTION, + SEPARATOR, + ACTION, + EVENT_TAG, + SCRTM_CONTENTS, + SCRTM_VERSION, + CPU_MICROCODE, + PLATFORM_CONFIG_FLAGS, + TABLE_OF_DEVICES, + COMPACT_HASH, + IPL, + IPL_PARTITION_DATA, + NONHOST_CODE, + NONHOST_CONFIG, + NONHOST_INFO, +}; static const char* tcpa_event_type_strings[] = { "PREBOOT", @@ -50,6 +106,28 @@ static const char* tcpa_event_type_strings[] = { "Non-Host Info" }; +struct tcpa_pc_event { + u32 event_id; + u32 event_size; + u8 event_data[0]; +}; + +enum tcpa_pc_event_ids { + SMBIOS = 1, + BIS_CERT, + POST_BIOS_ROM, + ESCD, + CMOS, + NVRAM, + OPTION_ROM_EXEC, + OPTION_ROM_CONFIG, + OPTION_ROM_MICROCODE = 10, + S_CRTM_VERSION, + S_CRTM_CONTENTS, + POST_CONTENTS, + HOST_TABLE_OF_DEVICES, +}; + static const char* tcpa_pc_event_id_strings[] = { "", "SMBIOS", @@ -280,6 +358,65 @@ static const struct seq_operations tpm_binary_b_measurments_seqops = { .show = tpm_binary_bios_measurements_show, }; +/* read binary bios log */ +static int read_log(struct tpm_bios_log *log) +{ + struct acpi_tcpa *buff; + acpi_status status; + struct acpi_table_header *virt; + u64 len, start; + + if (log->bios_event_log != NULL) { + printk(KERN_ERR + "%s: ERROR - Eventlog already initialized\n", + __func__); + return -EFAULT; + } + + /* Find TCPA entry in RSDT (ACPI_LOGICAL_ADDRESSING) */ + status = acpi_get_table(ACPI_SIG_TCPA, 1, + (struct acpi_table_header **)&buff); + + if (ACPI_FAILURE(status)) { + printk(KERN_ERR "%s: ERROR - Could not get TCPA table\n", + __func__); + return -EIO; + } + + switch(buff->platform_class) { + case BIOS_SERVER: + len = buff->server.log_max_len; + start = buff->server.log_start_addr; + break; + case BIOS_CLIENT: + default: + len = buff->client.log_max_len; + start = buff->client.log_start_addr; + break; + } + if (!len) { + printk(KERN_ERR "%s: ERROR - TCPA log area empty\n", __func__); + return -EIO; + } + + /* malloc EventLog space */ + log->bios_event_log = kmalloc(len, GFP_KERNEL); + if (!log->bios_event_log) { + printk("%s: ERROR - Not enough Memory for BIOS measurements\n", + __func__); + return -ENOMEM; + } + + log->bios_event_log_end = log->bios_event_log + len; + + virt = acpi_os_map_memory(start, len); + + memcpy(log->bios_event_log, virt, len); + + acpi_os_unmap_memory(virt, len); + return 0; +} + static int tpm_ascii_bios_measurements_open(struct inode *inode, struct file *file) { diff --git a/trunk/drivers/char/tpm/tpm_eventlog.h b/trunk/drivers/char/tpm/tpm_eventlog.h deleted file mode 100644 index e7da086d6928..000000000000 --- a/trunk/drivers/char/tpm/tpm_eventlog.h +++ /dev/null @@ -1,86 +0,0 @@ - -#ifndef __TPM_EVENTLOG_H__ -#define __TPM_EVENTLOG_H__ - -#define TCG_EVENT_NAME_LEN_MAX 255 -#define MAX_TEXT_EVENT 1000 /* Max event string length */ -#define ACPI_TCPA_SIG "TCPA" /* 0x41504354 /'TCPA' */ - -enum bios_platform_class { - BIOS_CLIENT = 0x00, - BIOS_SERVER = 0x01, -}; - -struct tpm_bios_log { - void *bios_event_log; - void *bios_event_log_end; -}; - -struct tcpa_event { - u32 pcr_index; - u32 event_type; - u8 pcr_value[20]; /* SHA1 */ - u32 event_size; - u8 event_data[0]; -}; - -enum tcpa_event_types { - PREBOOT = 0, - POST_CODE, - UNUSED, - NO_ACTION, - SEPARATOR, - ACTION, - EVENT_TAG, - SCRTM_CONTENTS, - SCRTM_VERSION, - CPU_MICROCODE, - PLATFORM_CONFIG_FLAGS, - TABLE_OF_DEVICES, - COMPACT_HASH, - IPL, - IPL_PARTITION_DATA, - NONHOST_CODE, - NONHOST_CONFIG, - NONHOST_INFO, -}; - -struct tcpa_pc_event { - u32 event_id; - u32 event_size; - u8 event_data[0]; -}; - -enum tcpa_pc_event_ids { - SMBIOS = 1, - BIS_CERT, - POST_BIOS_ROM, - ESCD, - CMOS, - NVRAM, - OPTION_ROM_EXEC, - OPTION_ROM_CONFIG, - OPTION_ROM_MICROCODE = 10, - S_CRTM_VERSION, - S_CRTM_CONTENTS, - POST_CONTENTS, - HOST_TABLE_OF_DEVICES, -}; - -int read_log(struct tpm_bios_log *log); - -#if defined(CONFIG_TCG_IBMVTPM) || defined(CONFIG_TCG_IBMVTPM_MODULE) || \ - defined(CONFIG_ACPI) -extern struct dentry **tpm_bios_log_setup(char *); -extern void tpm_bios_log_teardown(struct dentry **); -#else -static inline struct dentry **tpm_bios_log_setup(char *name) -{ - return NULL; -} -static inline void tpm_bios_log_teardown(struct dentry **dir) -{ -} -#endif - -#endif diff --git a/trunk/drivers/char/tpm/tpm_i2c_infineon.c b/trunk/drivers/char/tpm/tpm_i2c_infineon.c deleted file mode 100644 index 5a831aec9d4b..000000000000 --- a/trunk/drivers/char/tpm/tpm_i2c_infineon.c +++ /dev/null @@ -1,695 +0,0 @@ -/* - * Copyright (C) 2012 Infineon Technologies - * - * Authors: - * Peter Huewe - * - * Device driver for TCG/TCPA TPM (trusted platform module). - * Specifications at www.trustedcomputinggroup.org - * - * This device driver implements the TPM interface as defined in - * the TCG TPM Interface Spec version 1.2, revision 1.0 and the - * Infineon I2C Protocol Stack Specification v0.20. - * - * It is based on the original tpm_tis device driver from Leendert van - * Dorn and Kyleen Hall. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation, version 2 of the - * License. - * - * - */ -#include -#include -#include -#include -#include -#include "tpm.h" - -/* max. buffer size supported by our TPM */ -#define TPM_BUFSIZE 1260 - -/* max. number of iterations after I2C NAK */ -#define MAX_COUNT 3 - -#define SLEEP_DURATION_LOW 55 -#define SLEEP_DURATION_HI 65 - -/* max. number of iterations after I2C NAK for 'long' commands - * we need this especially for sending TPM_READY, since the cleanup after the - * transtion to the ready state may take some time, but it is unpredictable - * how long it will take. - */ -#define MAX_COUNT_LONG 50 - -#define SLEEP_DURATION_LONG_LOW 200 -#define SLEEP_DURATION_LONG_HI 220 - -/* After sending TPM_READY to 'reset' the TPM we have to sleep even longer */ -#define SLEEP_DURATION_RESET_LOW 2400 -#define SLEEP_DURATION_RESET_HI 2600 - -/* we want to use usleep_range instead of msleep for the 5ms TPM_TIMEOUT */ -#define TPM_TIMEOUT_US_LOW (TPM_TIMEOUT * 1000) -#define TPM_TIMEOUT_US_HI (TPM_TIMEOUT_US_LOW + 2000) - -/* expected value for DIDVID register */ -#define TPM_TIS_I2C_DID_VID 0x000b15d1L - -/* Structure to store I2C TPM specific stuff */ -struct tpm_inf_dev { - struct i2c_client *client; - u8 buf[TPM_BUFSIZE + sizeof(u8)]; /* max. buffer size + addr */ - struct tpm_chip *chip; -}; - -static struct tpm_inf_dev tpm_dev; -static struct i2c_driver tpm_tis_i2c_driver; - -/* - * iic_tpm_read() - read from TPM register - * @addr: register address to read from - * @buffer: provided by caller - * @len: number of bytes to read - * - * Read len bytes from TPM register and put them into - * buffer (little-endian format, i.e. first byte is put into buffer[0]). - * - * NOTE: TPM is big-endian for multi-byte values. Multi-byte - * values have to be swapped. - * - * NOTE: We can't unfortunately use the combined read/write functions - * provided by the i2c core as the TPM currently does not support the - * repeated start condition and due to it's special requirements. - * The i2c_smbus* functions do not work for this chip. - * - * Return -EIO on error, 0 on success. - */ -static int iic_tpm_read(u8 addr, u8 *buffer, size_t len) -{ - - struct i2c_msg msg1 = { tpm_dev.client->addr, 0, 1, &addr }; - struct i2c_msg msg2 = { tpm_dev.client->addr, I2C_M_RD, len, buffer }; - - int rc; - int count; - - /* Lock the adapter for the duration of the whole sequence. */ - if (!tpm_dev.client->adapter->algo->master_xfer) - return -EOPNOTSUPP; - i2c_lock_adapter(tpm_dev.client->adapter); - - for (count = 0; count < MAX_COUNT; count++) { - rc = __i2c_transfer(tpm_dev.client->adapter, &msg1, 1); - if (rc > 0) - break; /* break here to skip sleep */ - - usleep_range(SLEEP_DURATION_LOW, SLEEP_DURATION_HI); - } - - if (rc <= 0) - goto out; - - /* After the TPM has successfully received the register address it needs - * some time, thus we're sleeping here again, before retrieving the data - */ - for (count = 0; count < MAX_COUNT; count++) { - usleep_range(SLEEP_DURATION_LOW, SLEEP_DURATION_HI); - rc = __i2c_transfer(tpm_dev.client->adapter, &msg2, 1); - if (rc > 0) - break; - - } - -out: - i2c_unlock_adapter(tpm_dev.client->adapter); - if (rc <= 0) - return -EIO; - - return 0; -} - -static int iic_tpm_write_generic(u8 addr, u8 *buffer, size_t len, - unsigned int sleep_low, - unsigned int sleep_hi, u8 max_count) -{ - int rc = -EIO; - int count; - - struct i2c_msg msg1 = { tpm_dev.client->addr, 0, len + 1, tpm_dev.buf }; - - if (len > TPM_BUFSIZE) - return -EINVAL; - - if (!tpm_dev.client->adapter->algo->master_xfer) - return -EOPNOTSUPP; - i2c_lock_adapter(tpm_dev.client->adapter); - - /* prepend the 'register address' to the buffer */ - tpm_dev.buf[0] = addr; - memcpy(&(tpm_dev.buf[1]), buffer, len); - - /* - * NOTE: We have to use these special mechanisms here and unfortunately - * cannot rely on the standard behavior of i2c_transfer. - */ - for (count = 0; count < max_count; count++) { - rc = __i2c_transfer(tpm_dev.client->adapter, &msg1, 1); - if (rc > 0) - break; - - usleep_range(sleep_low, sleep_hi); - } - - i2c_unlock_adapter(tpm_dev.client->adapter); - if (rc <= 0) - return -EIO; - - return 0; -} - -/* - * iic_tpm_write() - write to TPM register - * @addr: register address to write to - * @buffer: containing data to be written - * @len: number of bytes to write - * - * Write len bytes from provided buffer to TPM register (little - * endian format, i.e. buffer[0] is written as first byte). - * - * NOTE: TPM is big-endian for multi-byte values. Multi-byte - * values have to be swapped. - * - * NOTE: use this function instead of the iic_tpm_write_generic function. - * - * Return -EIO on error, 0 on success - */ -static int iic_tpm_write(u8 addr, u8 *buffer, size_t len) -{ - return iic_tpm_write_generic(addr, buffer, len, SLEEP_DURATION_LOW, - SLEEP_DURATION_HI, MAX_COUNT); -} - -/* - * This function is needed especially for the cleanup situation after - * sending TPM_READY - * */ -static int iic_tpm_write_long(u8 addr, u8 *buffer, size_t len) -{ - return iic_tpm_write_generic(addr, buffer, len, SLEEP_DURATION_LONG_LOW, - SLEEP_DURATION_LONG_HI, MAX_COUNT_LONG); -} - -enum tis_access { - TPM_ACCESS_VALID = 0x80, - TPM_ACCESS_ACTIVE_LOCALITY = 0x20, - TPM_ACCESS_REQUEST_PENDING = 0x04, - TPM_ACCESS_REQUEST_USE = 0x02, -}; - -enum tis_status { - TPM_STS_VALID = 0x80, - TPM_STS_COMMAND_READY = 0x40, - TPM_STS_GO = 0x20, - TPM_STS_DATA_AVAIL = 0x10, - TPM_STS_DATA_EXPECT = 0x08, -}; - -enum tis_defaults { - TIS_SHORT_TIMEOUT = 750, /* ms */ - TIS_LONG_TIMEOUT = 2000, /* 2 sec */ -}; - -#define TPM_ACCESS(l) (0x0000 | ((l) << 4)) -#define TPM_STS(l) (0x0001 | ((l) << 4)) -#define TPM_DATA_FIFO(l) (0x0005 | ((l) << 4)) -#define TPM_DID_VID(l) (0x0006 | ((l) << 4)) - -static int check_locality(struct tpm_chip *chip, int loc) -{ - u8 buf; - int rc; - - rc = iic_tpm_read(TPM_ACCESS(loc), &buf, 1); - if (rc < 0) - return rc; - - if ((buf & (TPM_ACCESS_ACTIVE_LOCALITY | TPM_ACCESS_VALID)) == - (TPM_ACCESS_ACTIVE_LOCALITY | TPM_ACCESS_VALID)) { - chip->vendor.locality = loc; - return loc; - } - - return -EIO; -} - -/* implementation similar to tpm_tis */ -static void release_locality(struct tpm_chip *chip, int loc, int force) -{ - u8 buf; - if (iic_tpm_read(TPM_ACCESS(loc), &buf, 1) < 0) - return; - - if (force || (buf & (TPM_ACCESS_REQUEST_PENDING | TPM_ACCESS_VALID)) == - (TPM_ACCESS_REQUEST_PENDING | TPM_ACCESS_VALID)) { - buf = TPM_ACCESS_ACTIVE_LOCALITY; - iic_tpm_write(TPM_ACCESS(loc), &buf, 1); - } -} - -static int request_locality(struct tpm_chip *chip, int loc) -{ - unsigned long stop; - u8 buf = TPM_ACCESS_REQUEST_USE; - - if (check_locality(chip, loc) >= 0) - return loc; - - iic_tpm_write(TPM_ACCESS(loc), &buf, 1); - - /* wait for burstcount */ - stop = jiffies + chip->vendor.timeout_a; - do { - if (check_locality(chip, loc) >= 0) - return loc; - usleep_range(TPM_TIMEOUT_US_LOW, TPM_TIMEOUT_US_HI); - } while (time_before(jiffies, stop)); - - return -ETIME; -} - -static u8 tpm_tis_i2c_status(struct tpm_chip *chip) -{ - /* NOTE: since I2C read may fail, return 0 in this case --> time-out */ - u8 buf; - if (iic_tpm_read(TPM_STS(chip->vendor.locality), &buf, 1) < 0) - return 0; - else - return buf; -} - -static void tpm_tis_i2c_ready(struct tpm_chip *chip) -{ - /* this causes the current command to be aborted */ - u8 buf = TPM_STS_COMMAND_READY; - iic_tpm_write_long(TPM_STS(chip->vendor.locality), &buf, 1); -} - -static ssize_t get_burstcount(struct tpm_chip *chip) -{ - unsigned long stop; - ssize_t burstcnt; - u8 buf[3]; - - /* wait for burstcount */ - /* which timeout value, spec has 2 answers (c & d) */ - stop = jiffies + chip->vendor.timeout_d; - do { - /* Note: STS is little endian */ - if (iic_tpm_read(TPM_STS(chip->vendor.locality)+1, buf, 3) < 0) - burstcnt = 0; - else - burstcnt = (buf[2] << 16) + (buf[1] << 8) + buf[0]; - - if (burstcnt) - return burstcnt; - - usleep_range(TPM_TIMEOUT_US_LOW, TPM_TIMEOUT_US_HI); - } while (time_before(jiffies, stop)); - return -EBUSY; -} - -static int wait_for_stat(struct tpm_chip *chip, u8 mask, unsigned long timeout, - int *status) -{ - unsigned long stop; - - /* check current status */ - *status = tpm_tis_i2c_status(chip); - if ((*status & mask) == mask) - return 0; - - stop = jiffies + timeout; - do { - /* since we just checked the status, give the TPM some time */ - usleep_range(TPM_TIMEOUT_US_LOW, TPM_TIMEOUT_US_HI); - *status = tpm_tis_i2c_status(chip); - if ((*status & mask) == mask) - return 0; - - } while (time_before(jiffies, stop)); - - return -ETIME; -} - -static int recv_data(struct tpm_chip *chip, u8 *buf, size_t count) -{ - size_t size = 0; - ssize_t burstcnt; - u8 retries = 0; - int rc; - - while (size < count) { - burstcnt = get_burstcount(chip); - - /* burstcnt < 0 = TPM is busy */ - if (burstcnt < 0) - return burstcnt; - - /* limit received data to max. left */ - if (burstcnt > (count - size)) - burstcnt = count - size; - - rc = iic_tpm_read(TPM_DATA_FIFO(chip->vendor.locality), - &(buf[size]), burstcnt); - if (rc == 0) - size += burstcnt; - else if (rc < 0) - retries++; - - /* avoid endless loop in case of broken HW */ - if (retries > MAX_COUNT_LONG) - return -EIO; - - } - return size; -} - -static int tpm_tis_i2c_recv(struct tpm_chip *chip, u8 *buf, size_t count) -{ - int size = 0; - int expected, status; - - if (count < TPM_HEADER_SIZE) { - size = -EIO; - goto out; - } - - /* read first 10 bytes, including tag, paramsize, and result */ - size = recv_data(chip, buf, TPM_HEADER_SIZE); - if (size < TPM_HEADER_SIZE) { - dev_err(chip->dev, "Unable to read header\n"); - goto out; - } - - expected = be32_to_cpu(*(__be32 *)(buf + 2)); - if ((size_t) expected > count) { - size = -EIO; - goto out; - } - - size += recv_data(chip, &buf[TPM_HEADER_SIZE], - expected - TPM_HEADER_SIZE); - if (size < expected) { - dev_err(chip->dev, "Unable to read remainder of result\n"); - size = -ETIME; - goto out; - } - - wait_for_stat(chip, TPM_STS_VALID, chip->vendor.timeout_c, &status); - if (status & TPM_STS_DATA_AVAIL) { /* retry? */ - dev_err(chip->dev, "Error left over data\n"); - size = -EIO; - goto out; - } - -out: - tpm_tis_i2c_ready(chip); - /* The TPM needs some time to clean up here, - * so we sleep rather than keeping the bus busy - */ - usleep_range(SLEEP_DURATION_RESET_LOW, SLEEP_DURATION_RESET_HI); - release_locality(chip, chip->vendor.locality, 0); - return size; -} - -static int tpm_tis_i2c_send(struct tpm_chip *chip, u8 *buf, size_t len) -{ - int rc, status; - ssize_t burstcnt; - size_t count = 0; - u8 retries = 0; - u8 sts = TPM_STS_GO; - - if (len > TPM_BUFSIZE) - return -E2BIG; /* command is too long for our tpm, sorry */ - - if (request_locality(chip, 0) < 0) - return -EBUSY; - - status = tpm_tis_i2c_status(chip); - if ((status & TPM_STS_COMMAND_READY) == 0) { - tpm_tis_i2c_ready(chip); - if (wait_for_stat - (chip, TPM_STS_COMMAND_READY, - chip->vendor.timeout_b, &status) < 0) { - rc = -ETIME; - goto out_err; - } - } - - while (count < len - 1) { - burstcnt = get_burstcount(chip); - - /* burstcnt < 0 = TPM is busy */ - if (burstcnt < 0) - return burstcnt; - - if (burstcnt > (len - 1 - count)) - burstcnt = len - 1 - count; - - rc = iic_tpm_write(TPM_DATA_FIFO(chip->vendor.locality), - &(buf[count]), burstcnt); - if (rc == 0) - count += burstcnt; - else if (rc < 0) - retries++; - - /* avoid endless loop in case of broken HW */ - if (retries > MAX_COUNT_LONG) { - rc = -EIO; - goto out_err; - } - - wait_for_stat(chip, TPM_STS_VALID, - chip->vendor.timeout_c, &status); - - if ((status & TPM_STS_DATA_EXPECT) == 0) { - rc = -EIO; - goto out_err; - } - - } - - /* write last byte */ - iic_tpm_write(TPM_DATA_FIFO(chip->vendor.locality), &(buf[count]), 1); - wait_for_stat(chip, TPM_STS_VALID, chip->vendor.timeout_c, &status); - if ((status & TPM_STS_DATA_EXPECT) != 0) { - rc = -EIO; - goto out_err; - } - - /* go and do it */ - iic_tpm_write(TPM_STS(chip->vendor.locality), &sts, 1); - - return len; -out_err: - tpm_tis_i2c_ready(chip); - /* The TPM needs some time to clean up here, - * so we sleep rather than keeping the bus busy - */ - usleep_range(SLEEP_DURATION_RESET_LOW, SLEEP_DURATION_RESET_HI); - release_locality(chip, chip->vendor.locality, 0); - return rc; -} - -static const struct file_operations tis_ops = { - .owner = THIS_MODULE, - .llseek = no_llseek, - .open = tpm_open, - .read = tpm_read, - .write = tpm_write, - .release = tpm_release, -}; - -static DEVICE_ATTR(pubek, S_IRUGO, tpm_show_pubek, NULL); -static DEVICE_ATTR(pcrs, S_IRUGO, tpm_show_pcrs, NULL); -static DEVICE_ATTR(enabled, S_IRUGO, tpm_show_enabled, NULL); -static DEVICE_ATTR(active, S_IRUGO, tpm_show_active, NULL); -static DEVICE_ATTR(owned, S_IRUGO, tpm_show_owned, NULL); -static DEVICE_ATTR(temp_deactivated, S_IRUGO, tpm_show_temp_deactivated, NULL); -static DEVICE_ATTR(caps, S_IRUGO, tpm_show_caps_1_2, NULL); -static DEVICE_ATTR(cancel, S_IWUSR | S_IWGRP, NULL, tpm_store_cancel); -static DEVICE_ATTR(durations, S_IRUGO, tpm_show_durations, NULL); -static DEVICE_ATTR(timeouts, S_IRUGO, tpm_show_timeouts, NULL); - -static struct attribute *tis_attrs[] = { - &dev_attr_pubek.attr, - &dev_attr_pcrs.attr, - &dev_attr_enabled.attr, - &dev_attr_active.attr, - &dev_attr_owned.attr, - &dev_attr_temp_deactivated.attr, - &dev_attr_caps.attr, - &dev_attr_cancel.attr, - &dev_attr_durations.attr, - &dev_attr_timeouts.attr, - NULL, -}; - -static struct attribute_group tis_attr_grp = { - .attrs = tis_attrs -}; - -static struct tpm_vendor_specific tpm_tis_i2c = { - .status = tpm_tis_i2c_status, - .recv = tpm_tis_i2c_recv, - .send = tpm_tis_i2c_send, - .cancel = tpm_tis_i2c_ready, - .req_complete_mask = TPM_STS_DATA_AVAIL | TPM_STS_VALID, - .req_complete_val = TPM_STS_DATA_AVAIL | TPM_STS_VALID, - .req_canceled = TPM_STS_COMMAND_READY, - .attr_group = &tis_attr_grp, - .miscdev.fops = &tis_ops, -}; - -static int __devinit tpm_tis_i2c_init(struct device *dev) -{ - u32 vendor; - int rc = 0; - struct tpm_chip *chip; - - chip = tpm_register_hardware(dev, &tpm_tis_i2c); - if (!chip) { - rc = -ENODEV; - goto out_err; - } - - /* Disable interrupts */ - chip->vendor.irq = 0; - - /* Default timeouts */ - chip->vendor.timeout_a = msecs_to_jiffies(TIS_SHORT_TIMEOUT); - chip->vendor.timeout_b = msecs_to_jiffies(TIS_LONG_TIMEOUT); - chip->vendor.timeout_c = msecs_to_jiffies(TIS_SHORT_TIMEOUT); - chip->vendor.timeout_d = msecs_to_jiffies(TIS_SHORT_TIMEOUT); - - if (request_locality(chip, 0) != 0) { - rc = -ENODEV; - goto out_vendor; - } - - /* read four bytes from DID_VID register */ - if (iic_tpm_read(TPM_DID_VID(0), (u8 *)&vendor, 4) < 0) { - rc = -EIO; - goto out_release; - } - - /* create DID_VID register value, after swapping to little-endian */ - vendor = be32_to_cpu((__be32) vendor); - - if (vendor != TPM_TIS_I2C_DID_VID) { - rc = -ENODEV; - goto out_release; - } - - dev_info(dev, "1.2 TPM (device-id 0x%X)\n", vendor >> 16); - - INIT_LIST_HEAD(&chip->vendor.list); - tpm_dev.chip = chip; - - tpm_get_timeouts(chip); - tpm_do_selftest(chip); - - return 0; - -out_release: - release_locality(chip, chip->vendor.locality, 1); - -out_vendor: - /* close file handles */ - tpm_dev_vendor_release(chip); - - /* remove hardware */ - tpm_remove_hardware(chip->dev); - - /* reset these pointers, otherwise we oops */ - chip->dev->release = NULL; - chip->release = NULL; - tpm_dev.client = NULL; - dev_set_drvdata(chip->dev, chip); -out_err: - return rc; -} - -static const struct i2c_device_id tpm_tis_i2c_table[] = { - {"tpm_i2c_infineon", 0}, - {}, -}; - -MODULE_DEVICE_TABLE(i2c, tpm_tis_i2c_table); -static SIMPLE_DEV_PM_OPS(tpm_tis_i2c_ops, tpm_pm_suspend, tpm_pm_resume); - -static int __devinit tpm_tis_i2c_probe(struct i2c_client *client, - const struct i2c_device_id *id) -{ - int rc; - if (tpm_dev.client != NULL) - return -EBUSY; /* We only support one client */ - - if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) { - dev_err(&client->dev, - "no algorithms associated to the i2c bus\n"); - return -ENODEV; - } - - client->driver = &tpm_tis_i2c_driver; - tpm_dev.client = client; - rc = tpm_tis_i2c_init(&client->dev); - if (rc != 0) { - client->driver = NULL; - tpm_dev.client = NULL; - rc = -ENODEV; - } - return rc; -} - -static int __devexit tpm_tis_i2c_remove(struct i2c_client *client) -{ - struct tpm_chip *chip = tpm_dev.chip; - release_locality(chip, chip->vendor.locality, 1); - - /* close file handles */ - tpm_dev_vendor_release(chip); - - /* remove hardware */ - tpm_remove_hardware(chip->dev); - - /* reset these pointers, otherwise we oops */ - chip->dev->release = NULL; - chip->release = NULL; - tpm_dev.client = NULL; - dev_set_drvdata(chip->dev, chip); - - return 0; -} - -static struct i2c_driver tpm_tis_i2c_driver = { - - .id_table = tpm_tis_i2c_table, - .probe = tpm_tis_i2c_probe, - .remove = tpm_tis_i2c_remove, - .driver = { - .name = "tpm_i2c_infineon", - .owner = THIS_MODULE, - .pm = &tpm_tis_i2c_ops, - }, -}; - -module_i2c_driver(tpm_tis_i2c_driver); -MODULE_AUTHOR("Peter Huewe "); -MODULE_DESCRIPTION("TPM TIS I2C Infineon Driver"); -MODULE_VERSION("2.1.5"); -MODULE_LICENSE("GPL"); diff --git a/trunk/drivers/char/tpm/tpm_ibmvtpm.c b/trunk/drivers/char/tpm/tpm_ibmvtpm.c deleted file mode 100644 index efc4ab36a9d6..000000000000 --- a/trunk/drivers/char/tpm/tpm_ibmvtpm.c +++ /dev/null @@ -1,749 +0,0 @@ -/* - * Copyright (C) 2012 IBM Corporation - * - * Author: Ashley Lai - * - * Maintained by: - * - * Device driver for TCG/TCPA TPM (trusted platform module). - * Specifications at www.trustedcomputinggroup.org - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation, version 2 of the - * License. - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "tpm.h" -#include "tpm_ibmvtpm.h" - -static const char tpm_ibmvtpm_driver_name[] = "tpm_ibmvtpm"; - -static struct vio_device_id tpm_ibmvtpm_device_table[] __devinitdata = { - { "IBM,vtpm", "IBM,vtpm"}, - { "", "" } -}; -MODULE_DEVICE_TABLE(vio, tpm_ibmvtpm_device_table); - -DECLARE_WAIT_QUEUE_HEAD(wq); - -/** - * ibmvtpm_send_crq - Send a CRQ request - * @vdev: vio device struct - * @w1: first word - * @w2: second word - * - * Return value: - * 0 -Sucess - * Non-zero - Failure - */ -static int ibmvtpm_send_crq(struct vio_dev *vdev, u64 w1, u64 w2) -{ - return plpar_hcall_norets(H_SEND_CRQ, vdev->unit_address, w1, w2); -} - -/** - * ibmvtpm_get_data - Retrieve ibm vtpm data - * @dev: device struct - * - * Return value: - * vtpm device struct - */ -static struct ibmvtpm_dev *ibmvtpm_get_data(const struct device *dev) -{ - struct tpm_chip *chip = dev_get_drvdata(dev); - if (chip) - return (struct ibmvtpm_dev *)chip->vendor.data; - return NULL; -} - -/** - * tpm_ibmvtpm_recv - Receive data after send - * @chip: tpm chip struct - * @buf: buffer to read - * count: size of buffer - * - * Return value: - * Number of bytes read - */ -static int tpm_ibmvtpm_recv(struct tpm_chip *chip, u8 *buf, size_t count) -{ - struct ibmvtpm_dev *ibmvtpm; - u16 len; - - ibmvtpm = (struct ibmvtpm_dev *)chip->vendor.data; - - if (!ibmvtpm->rtce_buf) { - dev_err(ibmvtpm->dev, "ibmvtpm device is not ready\n"); - return 0; - } - - wait_event_interruptible(wq, ibmvtpm->crq_res.len != 0); - - if (count < ibmvtpm->crq_res.len) { - dev_err(ibmvtpm->dev, - "Invalid size in recv: count=%ld, crq_size=%d\n", - count, ibmvtpm->crq_res.len); - return -EIO; - } - - spin_lock(&ibmvtpm->rtce_lock); - memcpy((void *)buf, (void *)ibmvtpm->rtce_buf, ibmvtpm->crq_res.len); - memset(ibmvtpm->rtce_buf, 0, ibmvtpm->crq_res.len); - ibmvtpm->crq_res.valid = 0; - ibmvtpm->crq_res.msg = 0; - len = ibmvtpm->crq_res.len; - ibmvtpm->crq_res.len = 0; - spin_unlock(&ibmvtpm->rtce_lock); - return len; -} - -/** - * tpm_ibmvtpm_send - Send tpm request - * @chip: tpm chip struct - * @buf: buffer contains data to send - * count: size of buffer - * - * Return value: - * Number of bytes sent - */ -static int tpm_ibmvtpm_send(struct tpm_chip *chip, u8 *buf, size_t count) -{ - struct ibmvtpm_dev *ibmvtpm; - struct ibmvtpm_crq crq; - u64 *word = (u64 *) &crq; - int rc; - - ibmvtpm = (struct ibmvtpm_dev *)chip->vendor.data; - - if (!ibmvtpm->rtce_buf) { - dev_err(ibmvtpm->dev, "ibmvtpm device is not ready\n"); - return 0; - } - - if (count > ibmvtpm->rtce_size) { - dev_err(ibmvtpm->dev, - "Invalid size in send: count=%ld, rtce_size=%d\n", - count, ibmvtpm->rtce_size); - return -EIO; - } - - spin_lock(&ibmvtpm->rtce_lock); - memcpy((void *)ibmvtpm->rtce_buf, (void *)buf, count); - crq.valid = (u8)IBMVTPM_VALID_CMD; - crq.msg = (u8)VTPM_TPM_COMMAND; - crq.len = (u16)count; - crq.data = ibmvtpm->rtce_dma_handle; - - rc = ibmvtpm_send_crq(ibmvtpm->vdev, word[0], word[1]); - if (rc != H_SUCCESS) { - dev_err(ibmvtpm->dev, "tpm_ibmvtpm_send failed rc=%d\n", rc); - rc = 0; - } else - rc = count; - - spin_unlock(&ibmvtpm->rtce_lock); - return rc; -} - -static void tpm_ibmvtpm_cancel(struct tpm_chip *chip) -{ - return; -} - -static u8 tpm_ibmvtpm_status(struct tpm_chip *chip) -{ - return 0; -} - -/** - * ibmvtpm_crq_get_rtce_size - Send a CRQ request to get rtce size - * @ibmvtpm: vtpm device struct - * - * Return value: - * 0 - Success - * Non-zero - Failure - */ -static int ibmvtpm_crq_get_rtce_size(struct ibmvtpm_dev *ibmvtpm) -{ - struct ibmvtpm_crq crq; - u64 *buf = (u64 *) &crq; - int rc; - - crq.valid = (u8)IBMVTPM_VALID_CMD; - crq.msg = (u8)VTPM_GET_RTCE_BUFFER_SIZE; - - rc = ibmvtpm_send_crq(ibmvtpm->vdev, buf[0], buf[1]); - if (rc != H_SUCCESS) - dev_err(ibmvtpm->dev, - "ibmvtpm_crq_get_rtce_size failed rc=%d\n", rc); - - return rc; -} - -/** - * ibmvtpm_crq_get_version - Send a CRQ request to get vtpm version - * - Note that this is vtpm version and not tpm version - * @ibmvtpm: vtpm device struct - * - * Return value: - * 0 - Success - * Non-zero - Failure - */ -static int ibmvtpm_crq_get_version(struct ibmvtpm_dev *ibmvtpm) -{ - struct ibmvtpm_crq crq; - u64 *buf = (u64 *) &crq; - int rc; - - crq.valid = (u8)IBMVTPM_VALID_CMD; - crq.msg = (u8)VTPM_GET_VERSION; - - rc = ibmvtpm_send_crq(ibmvtpm->vdev, buf[0], buf[1]); - if (rc != H_SUCCESS) - dev_err(ibmvtpm->dev, - "ibmvtpm_crq_get_version failed rc=%d\n", rc); - - return rc; -} - -/** - * ibmvtpm_crq_send_init_complete - Send a CRQ initialize complete message - * @ibmvtpm: vtpm device struct - * - * Return value: - * 0 - Success - * Non-zero - Failure - */ -static int ibmvtpm_crq_send_init_complete(struct ibmvtpm_dev *ibmvtpm) -{ - int rc; - - rc = ibmvtpm_send_crq(ibmvtpm->vdev, INIT_CRQ_COMP_CMD, 0); - if (rc != H_SUCCESS) - dev_err(ibmvtpm->dev, - "ibmvtpm_crq_send_init_complete failed rc=%d\n", rc); - - return rc; -} - -/** - * ibmvtpm_crq_send_init - Send a CRQ initialize message - * @ibmvtpm: vtpm device struct - * - * Return value: - * 0 - Success - * Non-zero - Failure - */ -static int ibmvtpm_crq_send_init(struct ibmvtpm_dev *ibmvtpm) -{ - int rc; - - rc = ibmvtpm_send_crq(ibmvtpm->vdev, INIT_CRQ_CMD, 0); - if (rc != H_SUCCESS) - dev_err(ibmvtpm->dev, - "ibmvtpm_crq_send_init failed rc=%d\n", rc); - - return rc; -} - -/** - * tpm_ibmvtpm_remove - ibm vtpm remove entry point - * @vdev: vio device struct - * - * Return value: - * 0 - */ -static int __devexit tpm_ibmvtpm_remove(struct vio_dev *vdev) -{ - struct ibmvtpm_dev *ibmvtpm = ibmvtpm_get_data(&vdev->dev); - int rc = 0; - - free_irq(vdev->irq, ibmvtpm); - tasklet_kill(&ibmvtpm->tasklet); - - do { - if (rc) - msleep(100); - rc = plpar_hcall_norets(H_FREE_CRQ, vdev->unit_address); - } while (rc == H_BUSY || H_IS_LONG_BUSY(rc)); - - dma_unmap_single(ibmvtpm->dev, ibmvtpm->crq_dma_handle, - CRQ_RES_BUF_SIZE, DMA_BIDIRECTIONAL); - free_page((unsigned long)ibmvtpm->crq_queue.crq_addr); - - if (ibmvtpm->rtce_buf) { - dma_unmap_single(ibmvtpm->dev, ibmvtpm->rtce_dma_handle, - ibmvtpm->rtce_size, DMA_BIDIRECTIONAL); - kfree(ibmvtpm->rtce_buf); - } - - tpm_remove_hardware(ibmvtpm->dev); - - kfree(ibmvtpm); - - return 0; -} - -/** - * tpm_ibmvtpm_get_desired_dma - Get DMA size needed by this driver - * @vdev: vio device struct - * - * Return value: - * Number of bytes the driver needs to DMA map - */ -static unsigned long tpm_ibmvtpm_get_desired_dma(struct vio_dev *vdev) -{ - struct ibmvtpm_dev *ibmvtpm = ibmvtpm_get_data(&vdev->dev); - return CRQ_RES_BUF_SIZE + ibmvtpm->rtce_size; -} - -/** - * tpm_ibmvtpm_suspend - Suspend - * @dev: device struct - * - * Return value: - * 0 - */ -static int tpm_ibmvtpm_suspend(struct device *dev) -{ - struct ibmvtpm_dev *ibmvtpm = ibmvtpm_get_data(dev); - struct ibmvtpm_crq crq; - u64 *buf = (u64 *) &crq; - int rc = 0; - - crq.valid = (u8)IBMVTPM_VALID_CMD; - crq.msg = (u8)VTPM_PREPARE_TO_SUSPEND; - - rc = ibmvtpm_send_crq(ibmvtpm->vdev, buf[0], buf[1]); - if (rc != H_SUCCESS) - dev_err(ibmvtpm->dev, - "tpm_ibmvtpm_suspend failed rc=%d\n", rc); - - return rc; -} - -/** - * ibmvtpm_reset_crq - Reset CRQ - * @ibmvtpm: ibm vtpm struct - * - * Return value: - * 0 - Success - * Non-zero - Failure - */ -static int ibmvtpm_reset_crq(struct ibmvtpm_dev *ibmvtpm) -{ - int rc = 0; - - do { - if (rc) - msleep(100); - rc = plpar_hcall_norets(H_FREE_CRQ, - ibmvtpm->vdev->unit_address); - } while (rc == H_BUSY || H_IS_LONG_BUSY(rc)); - - memset(ibmvtpm->crq_queue.crq_addr, 0, CRQ_RES_BUF_SIZE); - ibmvtpm->crq_queue.index = 0; - - return plpar_hcall_norets(H_REG_CRQ, ibmvtpm->vdev->unit_address, - ibmvtpm->crq_dma_handle, CRQ_RES_BUF_SIZE); -} - -/** - * tpm_ibmvtpm_resume - Resume from suspend - * @dev: device struct - * - * Return value: - * 0 - */ -static int tpm_ibmvtpm_resume(struct device *dev) -{ - struct ibmvtpm_dev *ibmvtpm = ibmvtpm_get_data(dev); - unsigned long flags; - int rc = 0; - - do { - if (rc) - msleep(100); - rc = plpar_hcall_norets(H_ENABLE_CRQ, - ibmvtpm->vdev->unit_address); - } while (rc == H_IN_PROGRESS || rc == H_BUSY || H_IS_LONG_BUSY(rc)); - - if (rc) { - dev_err(dev, "Error enabling ibmvtpm rc=%d\n", rc); - return rc; - } - - spin_lock_irqsave(&ibmvtpm->lock, flags); - vio_disable_interrupts(ibmvtpm->vdev); - tasklet_schedule(&ibmvtpm->tasklet); - spin_unlock_irqrestore(&ibmvtpm->lock, flags); - - rc = ibmvtpm_crq_send_init(ibmvtpm); - if (rc) - dev_err(dev, "Error send_init rc=%d\n", rc); - - return rc; -} - -static const struct file_operations ibmvtpm_ops = { - .owner = THIS_MODULE, - .llseek = no_llseek, - .open = tpm_open, - .read = tpm_read, - .write = tpm_write, - .release = tpm_release, -}; - -static DEVICE_ATTR(pubek, S_IRUGO, tpm_show_pubek, NULL); -static DEVICE_ATTR(pcrs, S_IRUGO, tpm_show_pcrs, NULL); -static DEVICE_ATTR(enabled, S_IRUGO, tpm_show_enabled, NULL); -static DEVICE_ATTR(active, S_IRUGO, tpm_show_active, NULL); -static DEVICE_ATTR(owned, S_IRUGO, tpm_show_owned, NULL); -static DEVICE_ATTR(temp_deactivated, S_IRUGO, tpm_show_temp_deactivated, - NULL); -static DEVICE_ATTR(caps, S_IRUGO, tpm_show_caps_1_2, NULL); -static DEVICE_ATTR(cancel, S_IWUSR | S_IWGRP, NULL, tpm_store_cancel); -static DEVICE_ATTR(durations, S_IRUGO, tpm_show_durations, NULL); -static DEVICE_ATTR(timeouts, S_IRUGO, tpm_show_timeouts, NULL); - -static struct attribute *ibmvtpm_attrs[] = { - &dev_attr_pubek.attr, - &dev_attr_pcrs.attr, - &dev_attr_enabled.attr, - &dev_attr_active.attr, - &dev_attr_owned.attr, - &dev_attr_temp_deactivated.attr, - &dev_attr_caps.attr, - &dev_attr_cancel.attr, - &dev_attr_durations.attr, - &dev_attr_timeouts.attr, NULL, -}; - -static struct attribute_group ibmvtpm_attr_grp = { .attrs = ibmvtpm_attrs }; - -static const struct tpm_vendor_specific tpm_ibmvtpm = { - .recv = tpm_ibmvtpm_recv, - .send = tpm_ibmvtpm_send, - .cancel = tpm_ibmvtpm_cancel, - .status = tpm_ibmvtpm_status, - .req_complete_mask = 0, - .req_complete_val = 0, - .req_canceled = 0, - .attr_group = &ibmvtpm_attr_grp, - .miscdev = { .fops = &ibmvtpm_ops, }, -}; - -static const struct dev_pm_ops tpm_ibmvtpm_pm_ops = { - .suspend = tpm_ibmvtpm_suspend, - .resume = tpm_ibmvtpm_resume, -}; - -/** - * ibmvtpm_crq_get_next - Get next responded crq - * @ibmvtpm vtpm device struct - * - * Return value: - * vtpm crq pointer - */ -static struct ibmvtpm_crq *ibmvtpm_crq_get_next(struct ibmvtpm_dev *ibmvtpm) -{ - struct ibmvtpm_crq_queue *crq_q = &ibmvtpm->crq_queue; - struct ibmvtpm_crq *crq = &crq_q->crq_addr[crq_q->index]; - - if (crq->valid & VTPM_MSG_RES) { - if (++crq_q->index == crq_q->num_entry) - crq_q->index = 0; - rmb(); - } else - crq = NULL; - return crq; -} - -/** - * ibmvtpm_crq_process - Process responded crq - * @crq crq to be processed - * @ibmvtpm vtpm device struct - * - * Return value: - * Nothing - */ -static void ibmvtpm_crq_process(struct ibmvtpm_crq *crq, - struct ibmvtpm_dev *ibmvtpm) -{ - int rc = 0; - - switch (crq->valid) { - case VALID_INIT_CRQ: - switch (crq->msg) { - case INIT_CRQ_RES: - dev_info(ibmvtpm->dev, "CRQ initialized\n"); - rc = ibmvtpm_crq_send_init_complete(ibmvtpm); - if (rc) - dev_err(ibmvtpm->dev, "Unable to send CRQ init complete rc=%d\n", rc); - return; - case INIT_CRQ_COMP_RES: - dev_info(ibmvtpm->dev, - "CRQ initialization completed\n"); - return; - default: - dev_err(ibmvtpm->dev, "Unknown crq message type: %d\n", crq->msg); - return; - } - return; - case IBMVTPM_VALID_CMD: - switch (crq->msg) { - case VTPM_GET_RTCE_BUFFER_SIZE_RES: - if (crq->len <= 0) { - dev_err(ibmvtpm->dev, "Invalid rtce size\n"); - return; - } - ibmvtpm->rtce_size = crq->len; - ibmvtpm->rtce_buf = kmalloc(ibmvtpm->rtce_size, - GFP_KERNEL); - if (!ibmvtpm->rtce_buf) { - dev_err(ibmvtpm->dev, "Failed to allocate memory for rtce buffer\n"); - return; - } - - ibmvtpm->rtce_dma_handle = dma_map_single(ibmvtpm->dev, - ibmvtpm->rtce_buf, ibmvtpm->rtce_size, - DMA_BIDIRECTIONAL); - - if (dma_mapping_error(ibmvtpm->dev, - ibmvtpm->rtce_dma_handle)) { - kfree(ibmvtpm->rtce_buf); - ibmvtpm->rtce_buf = NULL; - dev_err(ibmvtpm->dev, "Failed to dma map rtce buffer\n"); - } - - return; - case VTPM_GET_VERSION_RES: - ibmvtpm->vtpm_version = crq->data; - return; - case VTPM_TPM_COMMAND_RES: - ibmvtpm->crq_res.valid = crq->valid; - ibmvtpm->crq_res.msg = crq->msg; - ibmvtpm->crq_res.len = crq->len; - ibmvtpm->crq_res.data = crq->data; - wake_up_interruptible(&wq); - return; - default: - return; - } - } - return; -} - -/** - * ibmvtpm_interrupt - Interrupt handler - * @irq: irq number to handle - * @vtpm_instance: vtpm that received interrupt - * - * Returns: - * IRQ_HANDLED - **/ -static irqreturn_t ibmvtpm_interrupt(int irq, void *vtpm_instance) -{ - struct ibmvtpm_dev *ibmvtpm = (struct ibmvtpm_dev *) vtpm_instance; - unsigned long flags; - - spin_lock_irqsave(&ibmvtpm->lock, flags); - vio_disable_interrupts(ibmvtpm->vdev); - tasklet_schedule(&ibmvtpm->tasklet); - spin_unlock_irqrestore(&ibmvtpm->lock, flags); - - return IRQ_HANDLED; -} - -/** - * ibmvtpm_tasklet - Interrupt handler tasklet - * @data: ibm vtpm device struct - * - * Returns: - * Nothing - **/ -static void ibmvtpm_tasklet(void *data) -{ - struct ibmvtpm_dev *ibmvtpm = data; - struct ibmvtpm_crq *crq; - unsigned long flags; - - spin_lock_irqsave(&ibmvtpm->lock, flags); - while ((crq = ibmvtpm_crq_get_next(ibmvtpm)) != NULL) { - ibmvtpm_crq_process(crq, ibmvtpm); - crq->valid = 0; - wmb(); - } - - vio_enable_interrupts(ibmvtpm->vdev); - spin_unlock_irqrestore(&ibmvtpm->lock, flags); -} - -/** - * tpm_ibmvtpm_probe - ibm vtpm initialize entry point - * @vio_dev: vio device struct - * @id: vio device id struct - * - * Return value: - * 0 - Success - * Non-zero - Failure - */ -static int __devinit tpm_ibmvtpm_probe(struct vio_dev *vio_dev, - const struct vio_device_id *id) -{ - struct ibmvtpm_dev *ibmvtpm; - struct device *dev = &vio_dev->dev; - struct ibmvtpm_crq_queue *crq_q; - struct tpm_chip *chip; - int rc = -ENOMEM, rc1; - - chip = tpm_register_hardware(dev, &tpm_ibmvtpm); - if (!chip) { - dev_err(dev, "tpm_register_hardware failed\n"); - return -ENODEV; - } - - ibmvtpm = kzalloc(sizeof(struct ibmvtpm_dev), GFP_KERNEL); - if (!ibmvtpm) { - dev_err(dev, "kzalloc for ibmvtpm failed\n"); - goto cleanup; - } - - crq_q = &ibmvtpm->crq_queue; - crq_q->crq_addr = (struct ibmvtpm_crq *)get_zeroed_page(GFP_KERNEL); - if (!crq_q->crq_addr) { - dev_err(dev, "Unable to allocate memory for crq_addr\n"); - goto cleanup; - } - - crq_q->num_entry = CRQ_RES_BUF_SIZE / sizeof(*crq_q->crq_addr); - ibmvtpm->crq_dma_handle = dma_map_single(dev, crq_q->crq_addr, - CRQ_RES_BUF_SIZE, - DMA_BIDIRECTIONAL); - - if (dma_mapping_error(dev, ibmvtpm->crq_dma_handle)) { - dev_err(dev, "dma mapping failed\n"); - goto cleanup; - } - - rc = plpar_hcall_norets(H_REG_CRQ, vio_dev->unit_address, - ibmvtpm->crq_dma_handle, CRQ_RES_BUF_SIZE); - if (rc == H_RESOURCE) - rc = ibmvtpm_reset_crq(ibmvtpm); - - if (rc) { - dev_err(dev, "Unable to register CRQ rc=%d\n", rc); - goto reg_crq_cleanup; - } - - tasklet_init(&ibmvtpm->tasklet, (void *)ibmvtpm_tasklet, - (unsigned long)ibmvtpm); - - rc = request_irq(vio_dev->irq, ibmvtpm_interrupt, 0, - tpm_ibmvtpm_driver_name, ibmvtpm); - if (rc) { - dev_err(dev, "Error %d register irq 0x%x\n", rc, vio_dev->irq); - goto init_irq_cleanup; - } - - rc = vio_enable_interrupts(vio_dev); - if (rc) { - dev_err(dev, "Error %d enabling interrupts\n", rc); - goto init_irq_cleanup; - } - - crq_q->index = 0; - - ibmvtpm->dev = dev; - ibmvtpm->vdev = vio_dev; - chip->vendor.data = (void *)ibmvtpm; - - spin_lock_init(&ibmvtpm->lock); - spin_lock_init(&ibmvtpm->rtce_lock); - - rc = ibmvtpm_crq_send_init(ibmvtpm); - if (rc) - goto init_irq_cleanup; - - rc = ibmvtpm_crq_get_version(ibmvtpm); - if (rc) - goto init_irq_cleanup; - - rc = ibmvtpm_crq_get_rtce_size(ibmvtpm); - if (rc) - goto init_irq_cleanup; - - return rc; -init_irq_cleanup: - tasklet_kill(&ibmvtpm->tasklet); - do { - rc1 = plpar_hcall_norets(H_FREE_CRQ, vio_dev->unit_address); - } while (rc1 == H_BUSY || H_IS_LONG_BUSY(rc1)); -reg_crq_cleanup: - dma_unmap_single(dev, ibmvtpm->crq_dma_handle, CRQ_RES_BUF_SIZE, - DMA_BIDIRECTIONAL); -cleanup: - if (ibmvtpm) { - if (crq_q->crq_addr) - free_page((unsigned long)crq_q->crq_addr); - kfree(ibmvtpm); - } - - tpm_remove_hardware(dev); - - return rc; -} - -static struct vio_driver ibmvtpm_driver = { - .id_table = tpm_ibmvtpm_device_table, - .probe = tpm_ibmvtpm_probe, - .remove = tpm_ibmvtpm_remove, - .get_desired_dma = tpm_ibmvtpm_get_desired_dma, - .name = tpm_ibmvtpm_driver_name, - .pm = &tpm_ibmvtpm_pm_ops, -}; - -/** - * ibmvtpm_module_init - Initialize ibm vtpm module - * - * Return value: - * 0 -Success - * Non-zero - Failure - */ -static int __init ibmvtpm_module_init(void) -{ - return vio_register_driver(&ibmvtpm_driver); -} - -/** - * ibmvtpm_module_exit - Teardown ibm vtpm module - * - * Return value: - * Nothing - */ -static void __exit ibmvtpm_module_exit(void) -{ - vio_unregister_driver(&ibmvtpm_driver); -} - -module_init(ibmvtpm_module_init); -module_exit(ibmvtpm_module_exit); - -MODULE_AUTHOR("adlai@us.ibm.com"); -MODULE_DESCRIPTION("IBM vTPM Driver"); -MODULE_VERSION("1.0"); -MODULE_LICENSE("GPL"); diff --git a/trunk/drivers/char/tpm/tpm_ibmvtpm.h b/trunk/drivers/char/tpm/tpm_ibmvtpm.h deleted file mode 100644 index 4296eb4b4d82..000000000000 --- a/trunk/drivers/char/tpm/tpm_ibmvtpm.h +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (C) 2012 IBM Corporation - * - * Author: Ashley Lai - * - * Maintained by: - * - * Device driver for TCG/TCPA TPM (trusted platform module). - * Specifications at www.trustedcomputinggroup.org - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation, version 2 of the - * License. - * - */ - -#ifndef __TPM_IBMVTPM_H__ -#define __TPM_IBMVTPM_H__ - -/* vTPM Message Format 1 */ -struct ibmvtpm_crq { - u8 valid; - u8 msg; - u16 len; - u32 data; - u64 reserved; -} __attribute__((packed, aligned(8))); - -struct ibmvtpm_crq_queue { - struct ibmvtpm_crq *crq_addr; - u32 index; - u32 num_entry; -}; - -struct ibmvtpm_dev { - struct device *dev; - struct vio_dev *vdev; - struct ibmvtpm_crq_queue crq_queue; - dma_addr_t crq_dma_handle; - spinlock_t lock; - struct tasklet_struct tasklet; - u32 rtce_size; - void __iomem *rtce_buf; - dma_addr_t rtce_dma_handle; - spinlock_t rtce_lock; - struct ibmvtpm_crq crq_res; - u32 vtpm_version; -}; - -#define CRQ_RES_BUF_SIZE PAGE_SIZE - -/* Initialize CRQ */ -#define INIT_CRQ_CMD 0xC001000000000000LL /* Init cmd */ -#define INIT_CRQ_COMP_CMD 0xC002000000000000LL /* Init complete cmd */ -#define INIT_CRQ_RES 0x01 /* Init respond */ -#define INIT_CRQ_COMP_RES 0x02 /* Init complete respond */ -#define VALID_INIT_CRQ 0xC0 /* Valid command for init crq */ - -/* vTPM CRQ response is the message type | 0x80 */ -#define VTPM_MSG_RES 0x80 -#define IBMVTPM_VALID_CMD 0x80 - -/* vTPM CRQ message types */ -#define VTPM_GET_VERSION 0x01 -#define VTPM_GET_VERSION_RES (0x01 | VTPM_MSG_RES) - -#define VTPM_TPM_COMMAND 0x02 -#define VTPM_TPM_COMMAND_RES (0x02 | VTPM_MSG_RES) - -#define VTPM_GET_RTCE_BUFFER_SIZE 0x03 -#define VTPM_GET_RTCE_BUFFER_SIZE_RES (0x03 | VTPM_MSG_RES) - -#define VTPM_PREPARE_TO_SUSPEND 0x04 -#define VTPM_PREPARE_TO_SUSPEND_RES (0x04 | VTPM_MSG_RES) - -#endif diff --git a/trunk/drivers/char/tpm/tpm_of.c b/trunk/drivers/char/tpm/tpm_of.c deleted file mode 100644 index 98ba2bd1a355..000000000000 --- a/trunk/drivers/char/tpm/tpm_of.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright 2012 IBM Corporation - * - * Author: Ashley Lai - * - * Maintained by: - * - * Read the event log created by the firmware on PPC64 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version - * 2 of the License, or (at your option) any later version. - * - */ - -#include -#include - -#include "tpm.h" -#include "tpm_eventlog.h" - -int read_log(struct tpm_bios_log *log) -{ - struct device_node *np; - const u32 *sizep; - const __be64 *basep; - - if (log->bios_event_log != NULL) { - pr_err("%s: ERROR - Eventlog already initialized\n", __func__); - return -EFAULT; - } - - np = of_find_node_by_name(NULL, "ibm,vtpm"); - if (!np) { - pr_err("%s: ERROR - IBMVTPM not supported\n", __func__); - return -ENODEV; - } - - sizep = of_get_property(np, "linux,sml-size", NULL); - if (sizep == NULL) { - pr_err("%s: ERROR - SML size not found\n", __func__); - goto cleanup_eio; - } - if (*sizep == 0) { - pr_err("%s: ERROR - event log area empty\n", __func__); - goto cleanup_eio; - } - - basep = of_get_property(np, "linux,sml-base", NULL); - if (basep == NULL) { - pr_err(KERN_ERR "%s: ERROR - SML not found\n", __func__); - goto cleanup_eio; - } - - of_node_put(np); - log->bios_event_log = kmalloc(*sizep, GFP_KERNEL); - if (!log->bios_event_log) { - pr_err("%s: ERROR - Not enough memory for BIOS measurements\n", - __func__); - return -ENOMEM; - } - - log->bios_event_log_end = log->bios_event_log + *sizep; - - memcpy(log->bios_event_log, __va(be64_to_cpup(basep)), *sizep); - - return 0; - -cleanup_eio: - of_node_put(np); - return -EIO; -} diff --git a/trunk/drivers/char/tpm/tpm_ppi.c b/trunk/drivers/char/tpm/tpm_ppi.c deleted file mode 100644 index f27b58cfae98..000000000000 --- a/trunk/drivers/char/tpm/tpm_ppi.c +++ /dev/null @@ -1,461 +0,0 @@ -#include -#include -#include "tpm.h" - -static const u8 tpm_ppi_uuid[] = { - 0xA6, 0xFA, 0xDD, 0x3D, - 0x1B, 0x36, - 0xB4, 0x4E, - 0xA4, 0x24, - 0x8D, 0x10, 0x08, 0x9D, 0x16, 0x53 -}; -static char *tpm_device_name = "TPM"; - -#define TPM_PPI_REVISION_ID 1 -#define TPM_PPI_FN_VERSION 1 -#define TPM_PPI_FN_SUBREQ 2 -#define TPM_PPI_FN_GETREQ 3 -#define TPM_PPI_FN_GETACT 4 -#define TPM_PPI_FN_GETRSP 5 -#define TPM_PPI_FN_SUBREQ2 7 -#define TPM_PPI_FN_GETOPR 8 -#define PPI_TPM_REQ_MAX 22 -#define PPI_VS_REQ_START 128 -#define PPI_VS_REQ_END 255 -#define PPI_VERSION_LEN 3 - -static acpi_status ppi_callback(acpi_handle handle, u32 level, void *context, - void **return_value) -{ - acpi_status status; - struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; - status = acpi_get_name(handle, ACPI_FULL_PATHNAME, &buffer); - if (strstr(buffer.pointer, context) != NULL) { - *return_value = handle; - kfree(buffer.pointer); - return AE_CTRL_TERMINATE; - } - return AE_OK; -} - -static inline void ppi_assign_params(union acpi_object params[4], - u64 function_num) -{ - params[0].type = ACPI_TYPE_BUFFER; - params[0].buffer.length = sizeof(tpm_ppi_uuid); - params[0].buffer.pointer = (char *)tpm_ppi_uuid; - params[1].type = ACPI_TYPE_INTEGER; - params[1].integer.value = TPM_PPI_REVISION_ID; - params[2].type = ACPI_TYPE_INTEGER; - params[2].integer.value = function_num; - params[3].type = ACPI_TYPE_PACKAGE; - params[3].package.count = 0; - params[3].package.elements = NULL; -} - -static ssize_t tpm_show_ppi_version(struct device *dev, - struct device_attribute *attr, char *buf) -{ - acpi_handle handle; - acpi_status status; - struct acpi_object_list input; - struct acpi_buffer output = { ACPI_ALLOCATE_BUFFER, NULL }; - union acpi_object params[4]; - union acpi_object *obj; - - input.count = 4; - ppi_assign_params(params, TPM_PPI_FN_VERSION); - input.pointer = params; - status = acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, - ACPI_UINT32_MAX, ppi_callback, NULL, - tpm_device_name, &handle); - if (ACPI_FAILURE(status)) - return -ENXIO; - - status = acpi_evaluate_object_typed(handle, "_DSM", &input, &output, - ACPI_TYPE_STRING); - if (ACPI_FAILURE(status)) - return -ENOMEM; - obj = (union acpi_object *)output.pointer; - status = scnprintf(buf, PAGE_SIZE, "%s\n", obj->string.pointer); - kfree(output.pointer); - return status; -} - -static ssize_t tpm_show_ppi_request(struct device *dev, - struct device_attribute *attr, char *buf) -{ - acpi_handle handle; - acpi_status status; - struct acpi_object_list input; - struct acpi_buffer output = { ACPI_ALLOCATE_BUFFER, NULL }; - union acpi_object params[4]; - union acpi_object *ret_obj; - - input.count = 4; - ppi_assign_params(params, TPM_PPI_FN_GETREQ); - input.pointer = params; - status = acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, - ACPI_UINT32_MAX, ppi_callback, NULL, - tpm_device_name, &handle); - if (ACPI_FAILURE(status)) - return -ENXIO; - - status = acpi_evaluate_object_typed(handle, "_DSM", &input, &output, - ACPI_TYPE_PACKAGE); - if (ACPI_FAILURE(status)) - return -ENOMEM; - /* - * output.pointer should be of package type, including two integers. - * The first is function return code, 0 means success and 1 means - * error. The second is pending TPM operation requested by the OS, 0 - * means none and >0 means operation value. - */ - ret_obj = ((union acpi_object *)output.pointer)->package.elements; - if (ret_obj->type == ACPI_TYPE_INTEGER) { - if (ret_obj->integer.value) { - status = -EFAULT; - goto cleanup; - } - ret_obj++; - if (ret_obj->type == ACPI_TYPE_INTEGER) - status = scnprintf(buf, PAGE_SIZE, "%llu\n", - ret_obj->integer.value); - else - status = -EINVAL; - } else { - status = -EINVAL; - } -cleanup: - kfree(output.pointer); - return status; -} - -static ssize_t tpm_store_ppi_request(struct device *dev, - struct device_attribute *attr, - const char *buf, size_t count) -{ - char version[PPI_VERSION_LEN + 1]; - acpi_handle handle; - acpi_status status; - struct acpi_object_list input; - struct acpi_buffer output = { ACPI_ALLOCATE_BUFFER, NULL }; - union acpi_object params[4]; - union acpi_object obj; - u32 req; - u64 ret; - - input.count = 4; - ppi_assign_params(params, TPM_PPI_FN_VERSION); - input.pointer = params; - status = acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, - ACPI_UINT32_MAX, ppi_callback, NULL, - tpm_device_name, &handle); - if (ACPI_FAILURE(status)) - return -ENXIO; - - status = acpi_evaluate_object_typed(handle, "_DSM", &input, &output, - ACPI_TYPE_STRING); - if (ACPI_FAILURE(status)) - return -ENOMEM; - strncpy(version, - ((union acpi_object *)output.pointer)->string.pointer, - PPI_VERSION_LEN); - kfree(output.pointer); - output.length = ACPI_ALLOCATE_BUFFER; - output.pointer = NULL; - /* - * the function to submit TPM operation request to pre-os environment - * is updated with function index from SUBREQ to SUBREQ2 since PPI - * version 1.1 - */ - if (strcmp(version, "1.1") == -1) - params[2].integer.value = TPM_PPI_FN_SUBREQ; - else - params[2].integer.value = TPM_PPI_FN_SUBREQ2; - /* - * PPI spec defines params[3].type as ACPI_TYPE_PACKAGE. Some BIOS - * accept buffer/string/integer type, but some BIOS accept buffer/ - * string/package type. For PPI version 1.0 and 1.1, use buffer type - * for compatibility, and use package type since 1.2 according to spec. - */ - if (strcmp(version, "1.2") == -1) { - params[3].type = ACPI_TYPE_BUFFER; - params[3].buffer.length = sizeof(req); - sscanf(buf, "%d", &req); - params[3].buffer.pointer = (char *)&req; - } else { - params[3].package.count = 1; - obj.type = ACPI_TYPE_INTEGER; - sscanf(buf, "%llu", &obj.integer.value); - params[3].package.elements = &obj; - } - - status = acpi_evaluate_object_typed(handle, "_DSM", &input, &output, - ACPI_TYPE_INTEGER); - if (ACPI_FAILURE(status)) - return -ENOMEM; - ret = ((union acpi_object *)output.pointer)->integer.value; - if (ret == 0) - status = (acpi_status)count; - else if (ret == 1) - status = -EPERM; - else - status = -EFAULT; - kfree(output.pointer); - return status; -} - -static ssize_t tpm_show_ppi_transition_action(struct device *dev, - struct device_attribute *attr, - char *buf) -{ - char version[PPI_VERSION_LEN + 1]; - acpi_handle handle; - acpi_status status; - struct acpi_object_list input; - struct acpi_buffer output = { ACPI_ALLOCATE_BUFFER, NULL }; - union acpi_object params[4]; - u32 ret; - char *info[] = { - "None", - "Shutdown", - "Reboot", - "OS Vendor-specific", - "Error", - }; - input.count = 4; - ppi_assign_params(params, TPM_PPI_FN_VERSION); - input.pointer = params; - status = acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, - ACPI_UINT32_MAX, ppi_callback, NULL, - tpm_device_name, &handle); - if (ACPI_FAILURE(status)) - return -ENXIO; - - status = acpi_evaluate_object_typed(handle, "_DSM", &input, &output, - ACPI_TYPE_STRING); - if (ACPI_FAILURE(status)) - return -ENOMEM; - strncpy(version, - ((union acpi_object *)output.pointer)->string.pointer, - PPI_VERSION_LEN); - /* - * PPI spec defines params[3].type as empty package, but some platforms - * (e.g. Capella with PPI 1.0) need integer/string/buffer type, so for - * compatibility, define params[3].type as buffer, if PPI version < 1.2 - */ - if (strcmp(version, "1.2") == -1) { - params[3].type = ACPI_TYPE_BUFFER; - params[3].buffer.length = 0; - params[3].buffer.pointer = NULL; - } - params[2].integer.value = TPM_PPI_FN_GETACT; - kfree(output.pointer); - output.length = ACPI_ALLOCATE_BUFFER; - output.pointer = NULL; - status = acpi_evaluate_object_typed(handle, "_DSM", &input, &output, - ACPI_TYPE_INTEGER); - if (ACPI_FAILURE(status)) - return -ENOMEM; - ret = ((union acpi_object *)output.pointer)->integer.value; - if (ret < ARRAY_SIZE(info) - 1) - status = scnprintf(buf, PAGE_SIZE, "%d: %s\n", ret, info[ret]); - else - status = scnprintf(buf, PAGE_SIZE, "%d: %s\n", ret, - info[ARRAY_SIZE(info)-1]); - kfree(output.pointer); - return status; -} - -static ssize_t tpm_show_ppi_response(struct device *dev, - struct device_attribute *attr, - char *buf) -{ - acpi_handle handle; - acpi_status status; - struct acpi_object_list input; - struct acpi_buffer output = { ACPI_ALLOCATE_BUFFER, NULL }; - union acpi_object params[4]; - union acpi_object *ret_obj; - u64 req; - - input.count = 4; - ppi_assign_params(params, TPM_PPI_FN_GETRSP); - input.pointer = params; - status = acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, - ACPI_UINT32_MAX, ppi_callback, NULL, - tpm_device_name, &handle); - if (ACPI_FAILURE(status)) - return -ENXIO; - - status = acpi_evaluate_object_typed(handle, "_DSM", &input, &output, - ACPI_TYPE_PACKAGE); - if (ACPI_FAILURE(status)) - return -ENOMEM; - /* - * parameter output.pointer should be of package type, including - * 3 integers. The first means function return code, the second means - * most recent TPM operation request, and the last means response to - * the most recent TPM operation request. Only if the first is 0, and - * the second integer is not 0, the response makes sense. - */ - ret_obj = ((union acpi_object *)output.pointer)->package.elements; - if (ret_obj->type != ACPI_TYPE_INTEGER) { - status = -EINVAL; - goto cleanup; - } - if (ret_obj->integer.value) { - status = -EFAULT; - goto cleanup; - } - ret_obj++; - if (ret_obj->type != ACPI_TYPE_INTEGER) { - status = -EINVAL; - goto cleanup; - } - if (ret_obj->integer.value) { - req = ret_obj->integer.value; - ret_obj++; - if (ret_obj->type != ACPI_TYPE_INTEGER) { - status = -EINVAL; - goto cleanup; - } - if (ret_obj->integer.value == 0) - status = scnprintf(buf, PAGE_SIZE, "%llu %s\n", req, - "0: Success"); - else if (ret_obj->integer.value == 0xFFFFFFF0) - status = scnprintf(buf, PAGE_SIZE, "%llu %s\n", req, - "0xFFFFFFF0: User Abort"); - else if (ret_obj->integer.value == 0xFFFFFFF1) - status = scnprintf(buf, PAGE_SIZE, "%llu %s\n", req, - "0xFFFFFFF1: BIOS Failure"); - else if (ret_obj->integer.value >= 1 && - ret_obj->integer.value <= 0x00000FFF) - status = scnprintf(buf, PAGE_SIZE, "%llu %llu: %s\n", - req, ret_obj->integer.value, - "Corresponding TPM error"); - else - status = scnprintf(buf, PAGE_SIZE, "%llu %llu: %s\n", - req, ret_obj->integer.value, - "Error"); - } else { - status = scnprintf(buf, PAGE_SIZE, "%llu: %s\n", - ret_obj->integer.value, "No Recent Request"); - } -cleanup: - kfree(output.pointer); - return status; -} - -static ssize_t show_ppi_operations(char *buf, u32 start, u32 end) -{ - char *str = buf; - char version[PPI_VERSION_LEN]; - acpi_handle handle; - acpi_status status; - struct acpi_object_list input; - struct acpi_buffer output = { ACPI_ALLOCATE_BUFFER, NULL }; - union acpi_object params[4]; - union acpi_object obj; - int i; - u32 ret; - char *info[] = { - "Not implemented", - "BIOS only", - "Blocked for OS by BIOS", - "User required", - "User not required", - }; - input.count = 4; - ppi_assign_params(params, TPM_PPI_FN_VERSION); - input.pointer = params; - status = acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, - ACPI_UINT32_MAX, ppi_callback, NULL, - tpm_device_name, &handle); - if (ACPI_FAILURE(status)) - return -ENXIO; - - status = acpi_evaluate_object_typed(handle, "_DSM", &input, &output, - ACPI_TYPE_STRING); - if (ACPI_FAILURE(status)) - return -ENOMEM; - - strncpy(version, - ((union acpi_object *)output.pointer)->string.pointer, - PPI_VERSION_LEN); - kfree(output.pointer); - output.length = ACPI_ALLOCATE_BUFFER; - output.pointer = NULL; - if (strcmp(version, "1.2") == -1) - return -EPERM; - - params[2].integer.value = TPM_PPI_FN_GETOPR; - params[3].package.count = 1; - obj.type = ACPI_TYPE_INTEGER; - params[3].package.elements = &obj; - for (i = start; i <= end; i++) { - obj.integer.value = i; - status = acpi_evaluate_object_typed(handle, "_DSM", - &input, &output, ACPI_TYPE_INTEGER); - if (ACPI_FAILURE(status)) - return -ENOMEM; - - ret = ((union acpi_object *)output.pointer)->integer.value; - if (ret > 0 && ret < ARRAY_SIZE(info)) - str += scnprintf(str, PAGE_SIZE, "%d %d: %s\n", - i, ret, info[ret]); - kfree(output.pointer); - output.length = ACPI_ALLOCATE_BUFFER; - output.pointer = NULL; - } - return str - buf; -} - -static ssize_t tpm_show_ppi_tcg_operations(struct device *dev, - struct device_attribute *attr, - char *buf) -{ - return show_ppi_operations(buf, 0, PPI_TPM_REQ_MAX); -} - -static ssize_t tpm_show_ppi_vs_operations(struct device *dev, - struct device_attribute *attr, - char *buf) -{ - return show_ppi_operations(buf, PPI_VS_REQ_START, PPI_VS_REQ_END); -} - -static DEVICE_ATTR(version, S_IRUGO, tpm_show_ppi_version, NULL); -static DEVICE_ATTR(request, S_IRUGO | S_IWUSR | S_IWGRP, - tpm_show_ppi_request, tpm_store_ppi_request); -static DEVICE_ATTR(transition_action, S_IRUGO, - tpm_show_ppi_transition_action, NULL); -static DEVICE_ATTR(response, S_IRUGO, tpm_show_ppi_response, NULL); -static DEVICE_ATTR(tcg_operations, S_IRUGO, tpm_show_ppi_tcg_operations, NULL); -static DEVICE_ATTR(vs_operations, S_IRUGO, tpm_show_ppi_vs_operations, NULL); - -static struct attribute *ppi_attrs[] = { - &dev_attr_version.attr, - &dev_attr_request.attr, - &dev_attr_transition_action.attr, - &dev_attr_response.attr, - &dev_attr_tcg_operations.attr, - &dev_attr_vs_operations.attr, NULL, -}; -static struct attribute_group ppi_attr_grp = { - .attrs = ppi_attrs -}; - -ssize_t sys_add_ppi(struct kobject *parent) -{ - struct kobject *ppi; - ppi = kobject_create_and_add("ppi", parent); - if (sysfs_create_group(ppi, &ppi_attr_grp)) - return -EFAULT; - else - return 0; -} -EXPORT_SYMBOL_GPL(sys_add_ppi); - -MODULE_LICENSE("GPL"); diff --git a/trunk/drivers/char/tpm/tpm_tis.c b/trunk/drivers/char/tpm/tpm_tis.c index 6bdf2671254f..c4be3519a587 100644 --- a/trunk/drivers/char/tpm/tpm_tis.c +++ b/trunk/drivers/char/tpm/tpm_tis.c @@ -705,7 +705,6 @@ static int tpm_tis_init(struct device *dev, resource_size_t start, return rc; } -#if defined(CONFIG_PNP) || defined(CONFIG_PM_SLEEP) static void tpm_tis_reenable_interrupts(struct tpm_chip *chip) { u32 intmask; @@ -726,7 +725,7 @@ static void tpm_tis_reenable_interrupts(struct tpm_chip *chip) iowrite32(intmask, chip->vendor.iobase + TPM_INT_ENABLE(chip->vendor.locality)); } -#endif + #ifdef CONFIG_PNP static int __devinit tpm_tis_pnp_init(struct pnp_dev *pnp_dev, diff --git a/trunk/drivers/clocksource/sh_cmt.c b/trunk/drivers/clocksource/sh_cmt.c index a5f7829f2799..98b06baafcc6 100644 --- a/trunk/drivers/clocksource/sh_cmt.c +++ b/trunk/drivers/clocksource/sh_cmt.c @@ -33,7 +33,6 @@ #include #include #include -#include struct sh_cmt_priv { void __iomem *mapbase; @@ -53,7 +52,6 @@ struct sh_cmt_priv { struct clock_event_device ced; struct clocksource cs; unsigned long total_cycles; - bool cs_enabled; }; static DEFINE_RAW_SPINLOCK(sh_cmt_lock); @@ -157,9 +155,6 @@ static int sh_cmt_enable(struct sh_cmt_priv *p, unsigned long *rate) { int k, ret; - pm_runtime_get_sync(&p->pdev->dev); - dev_pm_syscore_device(&p->pdev->dev, true); - /* enable clock */ ret = clk_enable(p->clk); if (ret) { @@ -226,9 +221,6 @@ static void sh_cmt_disable(struct sh_cmt_priv *p) /* stop clock */ clk_disable(p->clk); - - dev_pm_syscore_device(&p->pdev->dev, false); - pm_runtime_put(&p->pdev->dev); } /* private flags */ @@ -459,42 +451,22 @@ static int sh_cmt_clocksource_enable(struct clocksource *cs) int ret; struct sh_cmt_priv *p = cs_to_sh_cmt(cs); - WARN_ON(p->cs_enabled); - p->total_cycles = 0; ret = sh_cmt_start(p, FLAG_CLOCKSOURCE); - if (!ret) { + if (!ret) __clocksource_updatefreq_hz(cs, p->rate); - p->cs_enabled = true; - } return ret; } static void sh_cmt_clocksource_disable(struct clocksource *cs) { - struct sh_cmt_priv *p = cs_to_sh_cmt(cs); - - WARN_ON(!p->cs_enabled); - - sh_cmt_stop(p, FLAG_CLOCKSOURCE); - p->cs_enabled = false; -} - -static void sh_cmt_clocksource_suspend(struct clocksource *cs) -{ - struct sh_cmt_priv *p = cs_to_sh_cmt(cs); - - sh_cmt_stop(p, FLAG_CLOCKSOURCE); - pm_genpd_syscore_poweroff(&p->pdev->dev); + sh_cmt_stop(cs_to_sh_cmt(cs), FLAG_CLOCKSOURCE); } static void sh_cmt_clocksource_resume(struct clocksource *cs) { - struct sh_cmt_priv *p = cs_to_sh_cmt(cs); - - pm_genpd_syscore_poweron(&p->pdev->dev); - sh_cmt_start(p, FLAG_CLOCKSOURCE); + sh_cmt_start(cs_to_sh_cmt(cs), FLAG_CLOCKSOURCE); } static int sh_cmt_register_clocksource(struct sh_cmt_priv *p, @@ -507,7 +479,7 @@ static int sh_cmt_register_clocksource(struct sh_cmt_priv *p, cs->read = sh_cmt_clocksource_read; cs->enable = sh_cmt_clocksource_enable; cs->disable = sh_cmt_clocksource_disable; - cs->suspend = sh_cmt_clocksource_suspend; + cs->suspend = sh_cmt_clocksource_disable; cs->resume = sh_cmt_clocksource_resume; cs->mask = CLOCKSOURCE_MASK(sizeof(unsigned long) * 8); cs->flags = CLOCK_SOURCE_IS_CONTINUOUS; @@ -590,16 +562,6 @@ static int sh_cmt_clock_event_next(unsigned long delta, return 0; } -static void sh_cmt_clock_event_suspend(struct clock_event_device *ced) -{ - pm_genpd_syscore_poweroff(&ced_to_sh_cmt(ced)->pdev->dev); -} - -static void sh_cmt_clock_event_resume(struct clock_event_device *ced) -{ - pm_genpd_syscore_poweron(&ced_to_sh_cmt(ced)->pdev->dev); -} - static void sh_cmt_register_clockevent(struct sh_cmt_priv *p, char *name, unsigned long rating) { @@ -614,8 +576,6 @@ static void sh_cmt_register_clockevent(struct sh_cmt_priv *p, ced->cpumask = cpumask_of(0); ced->set_next_event = sh_cmt_clock_event_next; ced->set_mode = sh_cmt_clock_event_mode; - ced->suspend = sh_cmt_clock_event_suspend; - ced->resume = sh_cmt_clock_event_resume; dev_info(&p->pdev->dev, "used for clock events\n"); clockevents_register_device(ced); @@ -710,7 +670,6 @@ static int sh_cmt_setup(struct sh_cmt_priv *p, struct platform_device *pdev) dev_err(&p->pdev->dev, "registration failed\n"); goto err1; } - p->cs_enabled = false; ret = setup_irq(irq, &p->irqaction); if (ret) { @@ -729,17 +688,14 @@ static int sh_cmt_setup(struct sh_cmt_priv *p, struct platform_device *pdev) static int __devinit sh_cmt_probe(struct platform_device *pdev) { struct sh_cmt_priv *p = platform_get_drvdata(pdev); - struct sh_timer_config *cfg = pdev->dev.platform_data; int ret; - if (!is_early_platform_device(pdev)) { - pm_runtime_set_active(&pdev->dev); - pm_runtime_enable(&pdev->dev); - } + if (!is_early_platform_device(pdev)) + pm_genpd_dev_always_on(&pdev->dev, true); if (p) { dev_info(&pdev->dev, "kept as earlytimer\n"); - goto out; + return 0; } p = kmalloc(sizeof(*p), GFP_KERNEL); @@ -752,19 +708,8 @@ static int __devinit sh_cmt_probe(struct platform_device *pdev) if (ret) { kfree(p); platform_set_drvdata(pdev, NULL); - pm_runtime_idle(&pdev->dev); - return ret; } - if (is_early_platform_device(pdev)) - return 0; - - out: - if (cfg->clockevent_rating || cfg->clocksource_rating) - pm_runtime_irq_safe(&pdev->dev); - else - pm_runtime_idle(&pdev->dev); - - return 0; + return ret; } static int __devexit sh_cmt_remove(struct platform_device *pdev) diff --git a/trunk/drivers/clocksource/sh_mtu2.c b/trunk/drivers/clocksource/sh_mtu2.c index c5eea858054a..d9b76ca64a61 100644 --- a/trunk/drivers/clocksource/sh_mtu2.c +++ b/trunk/drivers/clocksource/sh_mtu2.c @@ -32,7 +32,6 @@ #include #include #include -#include struct sh_mtu2_priv { void __iomem *mapbase; @@ -124,9 +123,6 @@ static int sh_mtu2_enable(struct sh_mtu2_priv *p) { int ret; - pm_runtime_get_sync(&p->pdev->dev); - dev_pm_syscore_device(&p->pdev->dev, true); - /* enable clock */ ret = clk_enable(p->clk); if (ret) { @@ -161,9 +157,6 @@ static void sh_mtu2_disable(struct sh_mtu2_priv *p) /* stop clock */ clk_disable(p->clk); - - dev_pm_syscore_device(&p->pdev->dev, false); - pm_runtime_put(&p->pdev->dev); } static irqreturn_t sh_mtu2_interrupt(int irq, void *dev_id) @@ -215,16 +208,6 @@ static void sh_mtu2_clock_event_mode(enum clock_event_mode mode, } } -static void sh_mtu2_clock_event_suspend(struct clock_event_device *ced) -{ - pm_genpd_syscore_poweroff(&ced_to_sh_mtu2(ced)->pdev->dev); -} - -static void sh_mtu2_clock_event_resume(struct clock_event_device *ced) -{ - pm_genpd_syscore_poweron(&ced_to_sh_mtu2(ced)->pdev->dev); -} - static void sh_mtu2_register_clockevent(struct sh_mtu2_priv *p, char *name, unsigned long rating) { @@ -238,8 +221,6 @@ static void sh_mtu2_register_clockevent(struct sh_mtu2_priv *p, ced->rating = rating; ced->cpumask = cpumask_of(0); ced->set_mode = sh_mtu2_clock_event_mode; - ced->suspend = sh_mtu2_clock_event_suspend; - ced->resume = sh_mtu2_clock_event_resume; dev_info(&p->pdev->dev, "used for clock events\n"); clockevents_register_device(ced); @@ -324,17 +305,14 @@ static int sh_mtu2_setup(struct sh_mtu2_priv *p, struct platform_device *pdev) static int __devinit sh_mtu2_probe(struct platform_device *pdev) { struct sh_mtu2_priv *p = platform_get_drvdata(pdev); - struct sh_timer_config *cfg = pdev->dev.platform_data; int ret; - if (!is_early_platform_device(pdev)) { - pm_runtime_set_active(&pdev->dev); - pm_runtime_enable(&pdev->dev); - } + if (!is_early_platform_device(pdev)) + pm_genpd_dev_always_on(&pdev->dev, true); if (p) { dev_info(&pdev->dev, "kept as earlytimer\n"); - goto out; + return 0; } p = kmalloc(sizeof(*p), GFP_KERNEL); @@ -347,19 +325,8 @@ static int __devinit sh_mtu2_probe(struct platform_device *pdev) if (ret) { kfree(p); platform_set_drvdata(pdev, NULL); - pm_runtime_idle(&pdev->dev); - return ret; } - if (is_early_platform_device(pdev)) - return 0; - - out: - if (cfg->clockevent_rating) - pm_runtime_irq_safe(&pdev->dev); - else - pm_runtime_idle(&pdev->dev); - - return 0; + return ret; } static int __devexit sh_mtu2_remove(struct platform_device *pdev) diff --git a/trunk/drivers/clocksource/sh_tmu.c b/trunk/drivers/clocksource/sh_tmu.c index 0cc4add88279..c1b51d49d106 100644 --- a/trunk/drivers/clocksource/sh_tmu.c +++ b/trunk/drivers/clocksource/sh_tmu.c @@ -33,7 +33,6 @@ #include #include #include -#include struct sh_tmu_priv { void __iomem *mapbase; @@ -44,8 +43,6 @@ struct sh_tmu_priv { unsigned long periodic; struct clock_event_device ced; struct clocksource cs; - bool cs_enabled; - unsigned int enable_count; }; static DEFINE_RAW_SPINLOCK(sh_tmu_lock); @@ -110,7 +107,7 @@ static void sh_tmu_start_stop_ch(struct sh_tmu_priv *p, int start) raw_spin_unlock_irqrestore(&sh_tmu_lock, flags); } -static int __sh_tmu_enable(struct sh_tmu_priv *p) +static int sh_tmu_enable(struct sh_tmu_priv *p) { int ret; @@ -138,18 +135,7 @@ static int __sh_tmu_enable(struct sh_tmu_priv *p) return 0; } -static int sh_tmu_enable(struct sh_tmu_priv *p) -{ - if (p->enable_count++ > 0) - return 0; - - pm_runtime_get_sync(&p->pdev->dev); - dev_pm_syscore_device(&p->pdev->dev, true); - - return __sh_tmu_enable(p); -} - -static void __sh_tmu_disable(struct sh_tmu_priv *p) +static void sh_tmu_disable(struct sh_tmu_priv *p) { /* disable channel */ sh_tmu_start_stop_ch(p, 0); @@ -161,20 +147,6 @@ static void __sh_tmu_disable(struct sh_tmu_priv *p) clk_disable(p->clk); } -static void sh_tmu_disable(struct sh_tmu_priv *p) -{ - if (WARN_ON(p->enable_count == 0)) - return; - - if (--p->enable_count > 0) - return; - - __sh_tmu_disable(p); - - dev_pm_syscore_device(&p->pdev->dev, false); - pm_runtime_put(&p->pdev->dev); -} - static void sh_tmu_set_next(struct sh_tmu_priv *p, unsigned long delta, int periodic) { @@ -231,53 +203,15 @@ static int sh_tmu_clocksource_enable(struct clocksource *cs) struct sh_tmu_priv *p = cs_to_sh_tmu(cs); int ret; - if (WARN_ON(p->cs_enabled)) - return 0; - ret = sh_tmu_enable(p); - if (!ret) { + if (!ret) __clocksource_updatefreq_hz(cs, p->rate); - p->cs_enabled = true; - } - return ret; } static void sh_tmu_clocksource_disable(struct clocksource *cs) { - struct sh_tmu_priv *p = cs_to_sh_tmu(cs); - - if (WARN_ON(!p->cs_enabled)) - return; - - sh_tmu_disable(p); - p->cs_enabled = false; -} - -static void sh_tmu_clocksource_suspend(struct clocksource *cs) -{ - struct sh_tmu_priv *p = cs_to_sh_tmu(cs); - - if (!p->cs_enabled) - return; - - if (--p->enable_count == 0) { - __sh_tmu_disable(p); - pm_genpd_syscore_poweroff(&p->pdev->dev); - } -} - -static void sh_tmu_clocksource_resume(struct clocksource *cs) -{ - struct sh_tmu_priv *p = cs_to_sh_tmu(cs); - - if (!p->cs_enabled) - return; - - if (p->enable_count++ == 0) { - pm_genpd_syscore_poweron(&p->pdev->dev); - __sh_tmu_enable(p); - } + sh_tmu_disable(cs_to_sh_tmu(cs)); } static int sh_tmu_register_clocksource(struct sh_tmu_priv *p, @@ -290,8 +224,6 @@ static int sh_tmu_register_clocksource(struct sh_tmu_priv *p, cs->read = sh_tmu_clocksource_read; cs->enable = sh_tmu_clocksource_enable; cs->disable = sh_tmu_clocksource_disable; - cs->suspend = sh_tmu_clocksource_suspend; - cs->resume = sh_tmu_clocksource_resume; cs->mask = CLOCKSOURCE_MASK(32); cs->flags = CLOCK_SOURCE_IS_CONTINUOUS; @@ -369,16 +301,6 @@ static int sh_tmu_clock_event_next(unsigned long delta, return 0; } -static void sh_tmu_clock_event_suspend(struct clock_event_device *ced) -{ - pm_genpd_syscore_poweroff(&ced_to_sh_tmu(ced)->pdev->dev); -} - -static void sh_tmu_clock_event_resume(struct clock_event_device *ced) -{ - pm_genpd_syscore_poweron(&ced_to_sh_tmu(ced)->pdev->dev); -} - static void sh_tmu_register_clockevent(struct sh_tmu_priv *p, char *name, unsigned long rating) { @@ -394,8 +316,6 @@ static void sh_tmu_register_clockevent(struct sh_tmu_priv *p, ced->cpumask = cpumask_of(0); ced->set_next_event = sh_tmu_clock_event_next; ced->set_mode = sh_tmu_clock_event_mode; - ced->suspend = sh_tmu_clock_event_suspend; - ced->resume = sh_tmu_clock_event_resume; dev_info(&p->pdev->dev, "used for clock events\n"); @@ -472,8 +392,6 @@ static int sh_tmu_setup(struct sh_tmu_priv *p, struct platform_device *pdev) ret = PTR_ERR(p->clk); goto err1; } - p->cs_enabled = false; - p->enable_count = 0; return sh_tmu_register(p, (char *)dev_name(&p->pdev->dev), cfg->clockevent_rating, @@ -487,17 +405,14 @@ static int sh_tmu_setup(struct sh_tmu_priv *p, struct platform_device *pdev) static int __devinit sh_tmu_probe(struct platform_device *pdev) { struct sh_tmu_priv *p = platform_get_drvdata(pdev); - struct sh_timer_config *cfg = pdev->dev.platform_data; int ret; - if (!is_early_platform_device(pdev)) { - pm_runtime_set_active(&pdev->dev); - pm_runtime_enable(&pdev->dev); - } + if (!is_early_platform_device(pdev)) + pm_genpd_dev_always_on(&pdev->dev, true); if (p) { dev_info(&pdev->dev, "kept as earlytimer\n"); - goto out; + return 0; } p = kmalloc(sizeof(*p), GFP_KERNEL); @@ -510,19 +425,8 @@ static int __devinit sh_tmu_probe(struct platform_device *pdev) if (ret) { kfree(p); platform_set_drvdata(pdev, NULL); - pm_runtime_idle(&pdev->dev); - return ret; } - if (is_early_platform_device(pdev)) - return 0; - - out: - if (cfg->clockevent_rating || cfg->clocksource_rating) - pm_runtime_irq_safe(&pdev->dev); - else - pm_runtime_idle(&pdev->dev); - - return 0; + return ret; } static int __devexit sh_tmu_remove(struct platform_device *pdev) diff --git a/trunk/drivers/cpufreq/Kconfig b/trunk/drivers/cpufreq/Kconfig index ea512f47b789..e24a2a1b6666 100644 --- a/trunk/drivers/cpufreq/Kconfig +++ b/trunk/drivers/cpufreq/Kconfig @@ -179,17 +179,6 @@ config CPU_FREQ_GOV_CONSERVATIVE If in doubt, say N. -config GENERIC_CPUFREQ_CPU0 - bool "Generic CPU0 cpufreq driver" - depends on HAVE_CLK && REGULATOR && PM_OPP && OF - select CPU_FREQ_TABLE - help - This adds a generic cpufreq driver for CPU0 frequency management. - It supports both uniprocessor (UP) and symmetric multiprocessor (SMP) - systems which share clock and voltage across all CPUs. - - If in doubt, say N. - menu "x86 CPU frequency scaling drivers" depends on X86 source "drivers/cpufreq/Kconfig.x86" diff --git a/trunk/drivers/cpufreq/Kconfig.x86 b/trunk/drivers/cpufreq/Kconfig.x86 index 934854ae5eb4..78ff7ee48951 100644 --- a/trunk/drivers/cpufreq/Kconfig.x86 +++ b/trunk/drivers/cpufreq/Kconfig.x86 @@ -23,8 +23,7 @@ config X86_ACPI_CPUFREQ help This driver adds a CPUFreq driver which utilizes the ACPI Processor Performance States. - This driver also supports Intel Enhanced Speedstep and newer - AMD CPUs. + This driver also supports Intel Enhanced Speedstep. To compile this driver as a module, choose M here: the module will be called acpi-cpufreq. @@ -33,18 +32,6 @@ config X86_ACPI_CPUFREQ If in doubt, say N. -config X86_ACPI_CPUFREQ_CPB - default y - bool "Legacy cpb sysfs knob support for AMD CPUs" - depends on X86_ACPI_CPUFREQ && CPU_SUP_AMD - help - The powernow-k8 driver used to provide a sysfs knob called "cpb" - to disable the Core Performance Boosting feature of AMD CPUs. This - file has now been superseeded by the more generic "boost" entry. - - By enabling this option the acpi_cpufreq driver provides the old - entry in addition to the new boost ones, for compatibility reasons. - config ELAN_CPUFREQ tristate "AMD Elan SC400 and SC410" select CPU_FREQ_TABLE @@ -108,8 +95,7 @@ config X86_POWERNOW_K8 select CPU_FREQ_TABLE depends on ACPI && ACPI_PROCESSOR help - This adds the CPUFreq driver for K8/early Opteron/Athlon64 processors. - Support for K10 and newer processors is now in acpi-cpufreq. + This adds the CPUFreq driver for K8/K10 Opteron/Athlon64 processors. To compile this driver as a module, choose M here: the module will be called powernow-k8. diff --git a/trunk/drivers/cpufreq/Makefile b/trunk/drivers/cpufreq/Makefile index 1bc90e1306d8..9531fc2eda22 100644 --- a/trunk/drivers/cpufreq/Makefile +++ b/trunk/drivers/cpufreq/Makefile @@ -13,15 +13,13 @@ obj-$(CONFIG_CPU_FREQ_GOV_CONSERVATIVE) += cpufreq_conservative.o # CPUfreq cross-arch helpers obj-$(CONFIG_CPU_FREQ_TABLE) += freq_table.o -obj-$(CONFIG_GENERIC_CPUFREQ_CPU0) += cpufreq-cpu0.o - ################################################################################## # x86 drivers. # Link order matters. K8 is preferred to ACPI because of firmware bugs in early # K8 systems. ACPI is preferred to all other hardware-specific drivers. # speedstep-* is preferred over p4-clockmod. -obj-$(CONFIG_X86_POWERNOW_K8) += powernow-k8.o +obj-$(CONFIG_X86_POWERNOW_K8) += powernow-k8.o mperf.o obj-$(CONFIG_X86_ACPI_CPUFREQ) += acpi-cpufreq.o mperf.o obj-$(CONFIG_X86_PCC_CPUFREQ) += pcc-cpufreq.o obj-$(CONFIG_X86_POWERNOW_K6) += powernow-k6.o diff --git a/trunk/drivers/cpufreq/acpi-cpufreq.c b/trunk/drivers/cpufreq/acpi-cpufreq.c index 0d048f6a2b23..56c6c6b4eb4d 100644 --- a/trunk/drivers/cpufreq/acpi-cpufreq.c +++ b/trunk/drivers/cpufreq/acpi-cpufreq.c @@ -51,19 +51,13 @@ MODULE_AUTHOR("Paul Diefenbaugh, Dominik Brodowski"); MODULE_DESCRIPTION("ACPI Processor P-States Driver"); MODULE_LICENSE("GPL"); -#define PFX "acpi-cpufreq: " - enum { UNDEFINED_CAPABLE = 0, SYSTEM_INTEL_MSR_CAPABLE, - SYSTEM_AMD_MSR_CAPABLE, SYSTEM_IO_CAPABLE, }; #define INTEL_MSR_RANGE (0xffff) -#define AMD_MSR_RANGE (0x7) - -#define MSR_K7_HWCR_CPB_DIS (1ULL << 25) struct acpi_cpufreq_data { struct acpi_processor_performance *acpi_data; @@ -80,116 +74,6 @@ static struct acpi_processor_performance __percpu *acpi_perf_data; static struct cpufreq_driver acpi_cpufreq_driver; static unsigned int acpi_pstate_strict; -static bool boost_enabled, boost_supported; -static struct msr __percpu *msrs; - -static bool boost_state(unsigned int cpu) -{ - u32 lo, hi; - u64 msr; - - switch (boot_cpu_data.x86_vendor) { - case X86_VENDOR_INTEL: - rdmsr_on_cpu(cpu, MSR_IA32_MISC_ENABLE, &lo, &hi); - msr = lo | ((u64)hi << 32); - return !(msr & MSR_IA32_MISC_ENABLE_TURBO_DISABLE); - case X86_VENDOR_AMD: - rdmsr_on_cpu(cpu, MSR_K7_HWCR, &lo, &hi); - msr = lo | ((u64)hi << 32); - return !(msr & MSR_K7_HWCR_CPB_DIS); - } - return false; -} - -static void boost_set_msrs(bool enable, const struct cpumask *cpumask) -{ - u32 cpu; - u32 msr_addr; - u64 msr_mask; - - switch (boot_cpu_data.x86_vendor) { - case X86_VENDOR_INTEL: - msr_addr = MSR_IA32_MISC_ENABLE; - msr_mask = MSR_IA32_MISC_ENABLE_TURBO_DISABLE; - break; - case X86_VENDOR_AMD: - msr_addr = MSR_K7_HWCR; - msr_mask = MSR_K7_HWCR_CPB_DIS; - break; - default: - return; - } - - rdmsr_on_cpus(cpumask, msr_addr, msrs); - - for_each_cpu(cpu, cpumask) { - struct msr *reg = per_cpu_ptr(msrs, cpu); - if (enable) - reg->q &= ~msr_mask; - else - reg->q |= msr_mask; - } - - wrmsr_on_cpus(cpumask, msr_addr, msrs); -} - -static ssize_t _store_boost(const char *buf, size_t count) -{ - int ret; - unsigned long val = 0; - - if (!boost_supported) - return -EINVAL; - - ret = kstrtoul(buf, 10, &val); - if (ret || (val > 1)) - return -EINVAL; - - if ((val && boost_enabled) || (!val && !boost_enabled)) - return count; - - get_online_cpus(); - - boost_set_msrs(val, cpu_online_mask); - - put_online_cpus(); - - boost_enabled = val; - pr_debug("Core Boosting %sabled.\n", val ? "en" : "dis"); - - return count; -} - -static ssize_t store_global_boost(struct kobject *kobj, struct attribute *attr, - const char *buf, size_t count) -{ - return _store_boost(buf, count); -} - -static ssize_t show_global_boost(struct kobject *kobj, - struct attribute *attr, char *buf) -{ - return sprintf(buf, "%u\n", boost_enabled); -} - -static struct global_attr global_boost = __ATTR(boost, 0644, - show_global_boost, - store_global_boost); - -#ifdef CONFIG_X86_ACPI_CPUFREQ_CPB -static ssize_t store_cpb(struct cpufreq_policy *policy, const char *buf, - size_t count) -{ - return _store_boost(buf, count); -} - -static ssize_t show_cpb(struct cpufreq_policy *policy, char *buf) -{ - return sprintf(buf, "%u\n", boost_enabled); -} - -static struct freq_attr cpb = __ATTR(cpb, 0644, show_cpb, store_cpb); -#endif static int check_est_cpu(unsigned int cpuid) { @@ -198,13 +82,6 @@ static int check_est_cpu(unsigned int cpuid) return cpu_has(cpu, X86_FEATURE_EST); } -static int check_amd_hwpstate_cpu(unsigned int cpuid) -{ - struct cpuinfo_x86 *cpu = &cpu_data(cpuid); - - return cpu_has(cpu, X86_FEATURE_HW_PSTATE); -} - static unsigned extract_io(u32 value, struct acpi_cpufreq_data *data) { struct acpi_processor_performance *perf; @@ -224,11 +101,7 @@ static unsigned extract_msr(u32 msr, struct acpi_cpufreq_data *data) int i; struct acpi_processor_performance *perf; - if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD) - msr &= AMD_MSR_RANGE; - else - msr &= INTEL_MSR_RANGE; - + msr &= INTEL_MSR_RANGE; perf = data->acpi_data; for (i = 0; data->freq_table[i].frequency != CPUFREQ_TABLE_END; i++) { @@ -242,7 +115,6 @@ static unsigned extract_freq(u32 val, struct acpi_cpufreq_data *data) { switch (data->cpu_feature) { case SYSTEM_INTEL_MSR_CAPABLE: - case SYSTEM_AMD_MSR_CAPABLE: return extract_msr(val, data); case SYSTEM_IO_CAPABLE: return extract_io(val, data); @@ -278,7 +150,6 @@ static void do_drv_read(void *_cmd) switch (cmd->type) { case SYSTEM_INTEL_MSR_CAPABLE: - case SYSTEM_AMD_MSR_CAPABLE: rdmsr(cmd->addr.msr.reg, cmd->val, h); break; case SYSTEM_IO_CAPABLE: @@ -303,9 +174,6 @@ static void do_drv_write(void *_cmd) lo = (lo & ~INTEL_MSR_RANGE) | (cmd->val & INTEL_MSR_RANGE); wrmsr(cmd->addr.msr.reg, lo, hi); break; - case SYSTEM_AMD_MSR_CAPABLE: - wrmsr(cmd->addr.msr.reg, cmd->val, 0); - break; case SYSTEM_IO_CAPABLE: acpi_os_write_port((acpi_io_address)cmd->addr.io.port, cmd->val, @@ -349,10 +217,6 @@ static u32 get_cur_val(const struct cpumask *mask) cmd.type = SYSTEM_INTEL_MSR_CAPABLE; cmd.addr.msr.reg = MSR_IA32_PERF_STATUS; break; - case SYSTEM_AMD_MSR_CAPABLE: - cmd.type = SYSTEM_AMD_MSR_CAPABLE; - cmd.addr.msr.reg = MSR_AMD_PERF_STATUS; - break; case SYSTEM_IO_CAPABLE: cmd.type = SYSTEM_IO_CAPABLE; perf = per_cpu(acfreq_data, cpumask_first(mask))->acpi_data; @@ -462,11 +326,6 @@ static int acpi_cpufreq_target(struct cpufreq_policy *policy, cmd.addr.msr.reg = MSR_IA32_PERF_CTL; cmd.val = (u32) perf->states[next_perf_state].control; break; - case SYSTEM_AMD_MSR_CAPABLE: - cmd.type = SYSTEM_AMD_MSR_CAPABLE; - cmd.addr.msr.reg = MSR_AMD_PERF_CTL; - cmd.val = (u32) perf->states[next_perf_state].control; - break; case SYSTEM_IO_CAPABLE: cmd.type = SYSTEM_IO_CAPABLE; cmd.addr.io.port = perf->control_register.address; @@ -560,44 +419,6 @@ static void free_acpi_perf_data(void) free_percpu(acpi_perf_data); } -static int boost_notify(struct notifier_block *nb, unsigned long action, - void *hcpu) -{ - unsigned cpu = (long)hcpu; - const struct cpumask *cpumask; - - cpumask = get_cpu_mask(cpu); - - /* - * Clear the boost-disable bit on the CPU_DOWN path so that - * this cpu cannot block the remaining ones from boosting. On - * the CPU_UP path we simply keep the boost-disable flag in - * sync with the current global state. - */ - - switch (action) { - case CPU_UP_PREPARE: - case CPU_UP_PREPARE_FROZEN: - boost_set_msrs(boost_enabled, cpumask); - break; - - case CPU_DOWN_PREPARE: - case CPU_DOWN_PREPARE_FROZEN: - boost_set_msrs(1, cpumask); - break; - - default: - break; - } - - return NOTIFY_OK; -} - - -static struct notifier_block boost_nb = { - .notifier_call = boost_notify, -}; - /* * acpi_cpufreq_early_init - initialize ACPI P-States library * @@ -738,14 +559,6 @@ static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy) policy->shared_type = CPUFREQ_SHARED_TYPE_ALL; cpumask_copy(policy->cpus, cpu_core_mask(cpu)); } - - if (check_amd_hwpstate_cpu(cpu) && !acpi_pstate_strict) { - cpumask_clear(policy->cpus); - cpumask_set_cpu(cpu, policy->cpus); - cpumask_copy(policy->related_cpus, cpu_sibling_mask(cpu)); - policy->shared_type = CPUFREQ_SHARED_TYPE_HW; - pr_info_once(PFX "overriding BIOS provided _PSD data\n"); - } #endif /* capability check */ @@ -767,16 +580,12 @@ static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy) break; case ACPI_ADR_SPACE_FIXED_HARDWARE: pr_debug("HARDWARE addr space\n"); - if (check_est_cpu(cpu)) { - data->cpu_feature = SYSTEM_INTEL_MSR_CAPABLE; - break; - } - if (check_amd_hwpstate_cpu(cpu)) { - data->cpu_feature = SYSTEM_AMD_MSR_CAPABLE; - break; + if (!check_est_cpu(cpu)) { + result = -ENODEV; + goto err_unreg; } - result = -ENODEV; - goto err_unreg; + data->cpu_feature = SYSTEM_INTEL_MSR_CAPABLE; + break; default: pr_debug("Unknown addr space %d\n", (u32) (perf->control_register.space_id)); @@ -909,7 +718,6 @@ static int acpi_cpufreq_resume(struct cpufreq_policy *policy) static struct freq_attr *acpi_cpufreq_attr[] = { &cpufreq_freq_attr_scaling_available_freqs, - NULL, /* this is a placeholder for cpb, do not remove */ NULL, }; @@ -925,49 +733,6 @@ static struct cpufreq_driver acpi_cpufreq_driver = { .attr = acpi_cpufreq_attr, }; -static void __init acpi_cpufreq_boost_init(void) -{ - if (boot_cpu_has(X86_FEATURE_CPB) || boot_cpu_has(X86_FEATURE_IDA)) { - msrs = msrs_alloc(); - - if (!msrs) - return; - - boost_supported = true; - boost_enabled = boost_state(0); - - get_online_cpus(); - - /* Force all MSRs to the same value */ - boost_set_msrs(boost_enabled, cpu_online_mask); - - register_cpu_notifier(&boost_nb); - - put_online_cpus(); - } else - global_boost.attr.mode = 0444; - - /* We create the boost file in any case, though for systems without - * hardware support it will be read-only and hardwired to return 0. - */ - if (sysfs_create_file(cpufreq_global_kobject, &(global_boost.attr))) - pr_warn(PFX "could not register global boost sysfs file\n"); - else - pr_debug("registered global boost sysfs file\n"); -} - -static void __exit acpi_cpufreq_boost_exit(void) -{ - sysfs_remove_file(cpufreq_global_kobject, &(global_boost.attr)); - - if (msrs) { - unregister_cpu_notifier(&boost_nb); - - msrs_free(msrs); - msrs = NULL; - } -} - static int __init acpi_cpufreq_init(void) { int ret; @@ -981,32 +746,9 @@ static int __init acpi_cpufreq_init(void) if (ret) return ret; -#ifdef CONFIG_X86_ACPI_CPUFREQ_CPB - /* this is a sysfs file with a strange name and an even stranger - * semantic - per CPU instantiation, but system global effect. - * Lets enable it only on AMD CPUs for compatibility reasons and - * only if configured. This is considered legacy code, which - * will probably be removed at some point in the future. - */ - if (check_amd_hwpstate_cpu(0)) { - struct freq_attr **iter; - - pr_debug("adding sysfs entry for cpb\n"); - - for (iter = acpi_cpufreq_attr; *iter != NULL; iter++) - ; - - /* make sure there is a terminator behind it */ - if (iter[1] == NULL) - *iter = &cpb; - } -#endif - ret = cpufreq_register_driver(&acpi_cpufreq_driver); if (ret) free_acpi_perf_data(); - else - acpi_cpufreq_boost_init(); return ret; } @@ -1015,8 +757,6 @@ static void __exit acpi_cpufreq_exit(void) { pr_debug("acpi_cpufreq_exit\n"); - acpi_cpufreq_boost_exit(); - cpufreq_unregister_driver(&acpi_cpufreq_driver); free_acpi_perf_data(); diff --git a/trunk/drivers/cpufreq/cpufreq-cpu0.c b/trunk/drivers/cpufreq/cpufreq-cpu0.c deleted file mode 100644 index e9158278c71d..000000000000 --- a/trunk/drivers/cpufreq/cpufreq-cpu0.c +++ /dev/null @@ -1,269 +0,0 @@ -/* - * Copyright (C) 2012 Freescale Semiconductor, Inc. - * - * The OPP code in function cpu0_set_target() is reused from - * drivers/cpufreq/omap-cpufreq.c - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ - -#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -static unsigned int transition_latency; -static unsigned int voltage_tolerance; /* in percentage */ - -static struct device *cpu_dev; -static struct clk *cpu_clk; -static struct regulator *cpu_reg; -static struct cpufreq_frequency_table *freq_table; - -static int cpu0_verify_speed(struct cpufreq_policy *policy) -{ - return cpufreq_frequency_table_verify(policy, freq_table); -} - -static unsigned int cpu0_get_speed(unsigned int cpu) -{ - return clk_get_rate(cpu_clk) / 1000; -} - -static int cpu0_set_target(struct cpufreq_policy *policy, - unsigned int target_freq, unsigned int relation) -{ - struct cpufreq_freqs freqs; - struct opp *opp; - unsigned long freq_Hz, volt = 0, volt_old = 0, tol = 0; - unsigned int index, cpu; - int ret; - - ret = cpufreq_frequency_table_target(policy, freq_table, target_freq, - relation, &index); - if (ret) { - pr_err("failed to match target freqency %d: %d\n", - target_freq, ret); - return ret; - } - - freq_Hz = clk_round_rate(cpu_clk, freq_table[index].frequency * 1000); - if (freq_Hz < 0) - freq_Hz = freq_table[index].frequency * 1000; - freqs.new = freq_Hz / 1000; - freqs.old = clk_get_rate(cpu_clk) / 1000; - - if (freqs.old == freqs.new) - return 0; - - for_each_online_cpu(cpu) { - freqs.cpu = cpu; - cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); - } - - if (cpu_reg) { - opp = opp_find_freq_ceil(cpu_dev, &freq_Hz); - if (IS_ERR(opp)) { - pr_err("failed to find OPP for %ld\n", freq_Hz); - return PTR_ERR(opp); - } - volt = opp_get_voltage(opp); - tol = volt * voltage_tolerance / 100; - volt_old = regulator_get_voltage(cpu_reg); - } - - pr_debug("%u MHz, %ld mV --> %u MHz, %ld mV\n", - freqs.old / 1000, volt_old ? volt_old / 1000 : -1, - freqs.new / 1000, volt ? volt / 1000 : -1); - - /* scaling up? scale voltage before frequency */ - if (cpu_reg && freqs.new > freqs.old) { - ret = regulator_set_voltage_tol(cpu_reg, volt, tol); - if (ret) { - pr_err("failed to scale voltage up: %d\n", ret); - freqs.new = freqs.old; - return ret; - } - } - - ret = clk_set_rate(cpu_clk, freqs.new * 1000); - if (ret) { - pr_err("failed to set clock rate: %d\n", ret); - if (cpu_reg) - regulator_set_voltage_tol(cpu_reg, volt_old, tol); - return ret; - } - - /* scaling down? scale voltage after frequency */ - if (cpu_reg && freqs.new < freqs.old) { - ret = regulator_set_voltage_tol(cpu_reg, volt, tol); - if (ret) { - pr_err("failed to scale voltage down: %d\n", ret); - clk_set_rate(cpu_clk, freqs.old * 1000); - freqs.new = freqs.old; - return ret; - } - } - - for_each_online_cpu(cpu) { - freqs.cpu = cpu; - cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); - } - - return 0; -} - -static int cpu0_cpufreq_init(struct cpufreq_policy *policy) -{ - int ret; - - if (policy->cpu != 0) - return -EINVAL; - - ret = cpufreq_frequency_table_cpuinfo(policy, freq_table); - if (ret) { - pr_err("invalid frequency table: %d\n", ret); - return ret; - } - - policy->cpuinfo.transition_latency = transition_latency; - policy->cur = clk_get_rate(cpu_clk) / 1000; - - /* - * The driver only supports the SMP configuartion where all processors - * share the clock and voltage and clock. Use cpufreq affected_cpus - * interface to have all CPUs scaled together. - */ - policy->shared_type = CPUFREQ_SHARED_TYPE_ANY; - cpumask_setall(policy->cpus); - - cpufreq_frequency_table_get_attr(freq_table, policy->cpu); - - return 0; -} - -static int cpu0_cpufreq_exit(struct cpufreq_policy *policy) -{ - cpufreq_frequency_table_put_attr(policy->cpu); - - return 0; -} - -static struct freq_attr *cpu0_cpufreq_attr[] = { - &cpufreq_freq_attr_scaling_available_freqs, - NULL, -}; - -static struct cpufreq_driver cpu0_cpufreq_driver = { - .flags = CPUFREQ_STICKY, - .verify = cpu0_verify_speed, - .target = cpu0_set_target, - .get = cpu0_get_speed, - .init = cpu0_cpufreq_init, - .exit = cpu0_cpufreq_exit, - .name = "generic_cpu0", - .attr = cpu0_cpufreq_attr, -}; - -static int __devinit cpu0_cpufreq_driver_init(void) -{ - struct device_node *np; - int ret; - - np = of_find_node_by_path("/cpus/cpu@0"); - if (!np) { - pr_err("failed to find cpu0 node\n"); - return -ENOENT; - } - - cpu_dev = get_cpu_device(0); - if (!cpu_dev) { - pr_err("failed to get cpu0 device\n"); - ret = -ENODEV; - goto out_put_node; - } - - cpu_dev->of_node = np; - - cpu_clk = clk_get(cpu_dev, NULL); - if (IS_ERR(cpu_clk)) { - ret = PTR_ERR(cpu_clk); - pr_err("failed to get cpu0 clock: %d\n", ret); - goto out_put_node; - } - - cpu_reg = regulator_get(cpu_dev, "cpu0"); - if (IS_ERR(cpu_reg)) { - pr_warn("failed to get cpu0 regulator\n"); - cpu_reg = NULL; - } - - ret = of_init_opp_table(cpu_dev); - if (ret) { - pr_err("failed to init OPP table: %d\n", ret); - goto out_put_node; - } - - ret = opp_init_cpufreq_table(cpu_dev, &freq_table); - if (ret) { - pr_err("failed to init cpufreq table: %d\n", ret); - goto out_put_node; - } - - of_property_read_u32(np, "voltage-tolerance", &voltage_tolerance); - - if (of_property_read_u32(np, "clock-latency", &transition_latency)) - transition_latency = CPUFREQ_ETERNAL; - - if (cpu_reg) { - struct opp *opp; - unsigned long min_uV, max_uV; - int i; - - /* - * OPP is maintained in order of increasing frequency, and - * freq_table initialised from OPP is therefore sorted in the - * same order. - */ - for (i = 0; freq_table[i].frequency != CPUFREQ_TABLE_END; i++) - ; - opp = opp_find_freq_exact(cpu_dev, - freq_table[0].frequency * 1000, true); - min_uV = opp_get_voltage(opp); - opp = opp_find_freq_exact(cpu_dev, - freq_table[i-1].frequency * 1000, true); - max_uV = opp_get_voltage(opp); - ret = regulator_set_voltage_time(cpu_reg, min_uV, max_uV); - if (ret > 0) - transition_latency += ret * 1000; - } - - ret = cpufreq_register_driver(&cpu0_cpufreq_driver); - if (ret) { - pr_err("failed register driver: %d\n", ret); - goto out_free_table; - } - - of_node_put(np); - return 0; - -out_free_table: - opp_free_cpufreq_table(cpu_dev, &freq_table); -out_put_node: - of_node_put(np); - return ret; -} -late_initcall(cpu0_cpufreq_driver_init); - -MODULE_AUTHOR("Shawn Guo "); -MODULE_DESCRIPTION("Generic CPU0 cpufreq driver"); -MODULE_LICENSE("GPL"); diff --git a/trunk/drivers/cpufreq/cpufreq_conservative.c b/trunk/drivers/cpufreq/cpufreq_conservative.c index a152af7e1991..55f0354864e2 100644 --- a/trunk/drivers/cpufreq/cpufreq_conservative.c +++ b/trunk/drivers/cpufreq/cpufreq_conservative.c @@ -504,7 +504,6 @@ static int cpufreq_governor_dbs(struct cpufreq_policy *policy, j_dbs_info->prev_cpu_nice = kcpustat_cpu(j).cpustat[CPUTIME_NICE]; } - this_dbs_info->cpu = cpu; this_dbs_info->down_skip = 0; this_dbs_info->requested_freq = policy->cur; @@ -584,7 +583,6 @@ static int cpufreq_governor_dbs(struct cpufreq_policy *policy, __cpufreq_driver_target( this_dbs_info->cur_policy, policy->min, CPUFREQ_RELATION_L); - dbs_check_cpu(this_dbs_info); mutex_unlock(&this_dbs_info->timer_mutex); break; diff --git a/trunk/drivers/cpufreq/cpufreq_ondemand.c b/trunk/drivers/cpufreq/cpufreq_ondemand.c index 396322f2a83f..14c1af5a264f 100644 --- a/trunk/drivers/cpufreq/cpufreq_ondemand.c +++ b/trunk/drivers/cpufreq/cpufreq_ondemand.c @@ -761,7 +761,6 @@ static int cpufreq_governor_dbs(struct cpufreq_policy *policy, else if (policy->min > this_dbs_info->cur_policy->cur) __cpufreq_driver_target(this_dbs_info->cur_policy, policy->min, CPUFREQ_RELATION_L); - dbs_check_cpu(this_dbs_info); mutex_unlock(&this_dbs_info->timer_mutex); break; } diff --git a/trunk/drivers/cpufreq/longhaul.h b/trunk/drivers/cpufreq/longhaul.h index e2dc436099d1..cbf48fbca881 100644 --- a/trunk/drivers/cpufreq/longhaul.h +++ b/trunk/drivers/cpufreq/longhaul.h @@ -56,7 +56,7 @@ union msr_longhaul { /* * VIA C3 Samuel 1 & Samuel 2 (stepping 0) */ -static const int __cpuinitconst samuel1_mults[16] = { +static const int __cpuinitdata samuel1_mults[16] = { -1, /* 0000 -> RESERVED */ 30, /* 0001 -> 3.0x */ 40, /* 0010 -> 4.0x */ @@ -75,7 +75,7 @@ static const int __cpuinitconst samuel1_mults[16] = { -1, /* 1111 -> RESERVED */ }; -static const int __cpuinitconst samuel1_eblcr[16] = { +static const int __cpuinitdata samuel1_eblcr[16] = { 50, /* 0000 -> RESERVED */ 30, /* 0001 -> 3.0x */ 40, /* 0010 -> 4.0x */ @@ -97,7 +97,7 @@ static const int __cpuinitconst samuel1_eblcr[16] = { /* * VIA C3 Samuel2 Stepping 1->15 */ -static const int __cpuinitconst samuel2_eblcr[16] = { +static const int __cpuinitdata samuel2_eblcr[16] = { 50, /* 0000 -> 5.0x */ 30, /* 0001 -> 3.0x */ 40, /* 0010 -> 4.0x */ @@ -119,7 +119,7 @@ static const int __cpuinitconst samuel2_eblcr[16] = { /* * VIA C3 Ezra */ -static const int __cpuinitconst ezra_mults[16] = { +static const int __cpuinitdata ezra_mults[16] = { 100, /* 0000 -> 10.0x */ 30, /* 0001 -> 3.0x */ 40, /* 0010 -> 4.0x */ @@ -138,7 +138,7 @@ static const int __cpuinitconst ezra_mults[16] = { 120, /* 1111 -> 12.0x */ }; -static const int __cpuinitconst ezra_eblcr[16] = { +static const int __cpuinitdata ezra_eblcr[16] = { 50, /* 0000 -> 5.0x */ 30, /* 0001 -> 3.0x */ 40, /* 0010 -> 4.0x */ @@ -160,7 +160,7 @@ static const int __cpuinitconst ezra_eblcr[16] = { /* * VIA C3 (Ezra-T) [C5M]. */ -static const int __cpuinitconst ezrat_mults[32] = { +static const int __cpuinitdata ezrat_mults[32] = { 100, /* 0000 -> 10.0x */ 30, /* 0001 -> 3.0x */ 40, /* 0010 -> 4.0x */ @@ -196,7 +196,7 @@ static const int __cpuinitconst ezrat_mults[32] = { -1, /* 1111 -> RESERVED (12.0x) */ }; -static const int __cpuinitconst ezrat_eblcr[32] = { +static const int __cpuinitdata ezrat_eblcr[32] = { 50, /* 0000 -> 5.0x */ 30, /* 0001 -> 3.0x */ 40, /* 0010 -> 4.0x */ @@ -235,7 +235,7 @@ static const int __cpuinitconst ezrat_eblcr[32] = { /* * VIA C3 Nehemiah */ -static const int __cpuinitconst nehemiah_mults[32] = { +static const int __cpuinitdata nehemiah_mults[32] = { 100, /* 0000 -> 10.0x */ -1, /* 0001 -> 16.0x */ 40, /* 0010 -> 4.0x */ @@ -270,7 +270,7 @@ static const int __cpuinitconst nehemiah_mults[32] = { -1, /* 1111 -> 12.0x */ }; -static const int __cpuinitconst nehemiah_eblcr[32] = { +static const int __cpuinitdata nehemiah_eblcr[32] = { 50, /* 0000 -> 5.0x */ 160, /* 0001 -> 16.0x */ 40, /* 0010 -> 4.0x */ @@ -315,7 +315,7 @@ struct mV_pos { unsigned short pos; }; -static const struct mV_pos __cpuinitconst vrm85_mV[32] = { +static const struct mV_pos __cpuinitdata vrm85_mV[32] = { {1250, 8}, {1200, 6}, {1150, 4}, {1100, 2}, {1050, 0}, {1800, 30}, {1750, 28}, {1700, 26}, {1650, 24}, {1600, 22}, {1550, 20}, {1500, 18}, @@ -326,14 +326,14 @@ static const struct mV_pos __cpuinitconst vrm85_mV[32] = { {1475, 17}, {1425, 15}, {1375, 13}, {1325, 11} }; -static const unsigned char __cpuinitconst mV_vrm85[32] = { +static const unsigned char __cpuinitdata mV_vrm85[32] = { 0x04, 0x14, 0x03, 0x13, 0x02, 0x12, 0x01, 0x11, 0x00, 0x10, 0x0f, 0x1f, 0x0e, 0x1e, 0x0d, 0x1d, 0x0c, 0x1c, 0x0b, 0x1b, 0x0a, 0x1a, 0x09, 0x19, 0x08, 0x18, 0x07, 0x17, 0x06, 0x16, 0x05, 0x15 }; -static const struct mV_pos __cpuinitconst mobilevrm_mV[32] = { +static const struct mV_pos __cpuinitdata mobilevrm_mV[32] = { {1750, 31}, {1700, 30}, {1650, 29}, {1600, 28}, {1550, 27}, {1500, 26}, {1450, 25}, {1400, 24}, {1350, 23}, {1300, 22}, {1250, 21}, {1200, 20}, @@ -344,7 +344,7 @@ static const struct mV_pos __cpuinitconst mobilevrm_mV[32] = { {675, 3}, {650, 2}, {625, 1}, {600, 0} }; -static const unsigned char __cpuinitconst mV_mobilevrm[32] = { +static const unsigned char __cpuinitdata mV_mobilevrm[32] = { 0x1f, 0x1e, 0x1d, 0x1c, 0x1b, 0x1a, 0x19, 0x18, 0x17, 0x16, 0x15, 0x14, 0x13, 0x12, 0x11, 0x10, 0x0f, 0x0e, 0x0d, 0x0c, 0x0b, 0x0a, 0x09, 0x08, diff --git a/trunk/drivers/cpufreq/omap-cpufreq.c b/trunk/drivers/cpufreq/omap-cpufreq.c index 65f8e9a54975..b47034e650a5 100644 --- a/trunk/drivers/cpufreq/omap-cpufreq.c +++ b/trunk/drivers/cpufreq/omap-cpufreq.c @@ -40,6 +40,16 @@ /* OPP tolerance in percentage */ #define OPP_TOLERANCE 4 +#ifdef CONFIG_SMP +struct lpj_info { + unsigned long ref; + unsigned int freq; +}; + +static DEFINE_PER_CPU(struct lpj_info, lpj_ref); +static struct lpj_info global_lpj_ref; +#endif + static struct cpufreq_frequency_table *freq_table; static atomic_t freq_table_users = ATOMIC_INIT(0); static struct clk *mpu_clk; @@ -151,6 +161,31 @@ static int omap_target(struct cpufreq_policy *policy, } freqs.new = omap_getspeed(policy->cpu); +#ifdef CONFIG_SMP + /* + * Note that loops_per_jiffy is not updated on SMP systems in + * cpufreq driver. So, update the per-CPU loops_per_jiffy value + * on frequency transition. We need to update all dependent CPUs. + */ + for_each_cpu(i, policy->cpus) { + struct lpj_info *lpj = &per_cpu(lpj_ref, i); + if (!lpj->freq) { + lpj->ref = per_cpu(cpu_data, i).loops_per_jiffy; + lpj->freq = freqs.old; + } + + per_cpu(cpu_data, i).loops_per_jiffy = + cpufreq_scale(lpj->ref, lpj->freq, freqs.new); + } + + /* And don't forget to adjust the global one */ + if (!global_lpj_ref.freq) { + global_lpj_ref.ref = loops_per_jiffy; + global_lpj_ref.freq = freqs.old; + } + loops_per_jiffy = cpufreq_scale(global_lpj_ref.ref, global_lpj_ref.freq, + freqs.new); +#endif done: /* notifiers */ @@ -266,9 +301,9 @@ static int __init omap_cpufreq_init(void) } mpu_dev = omap_device_get_by_hwmod_name("mpu"); - if (IS_ERR(mpu_dev)) { + if (!mpu_dev) { pr_warning("%s: unable to get the mpu device\n", __func__); - return PTR_ERR(mpu_dev); + return -EINVAL; } mpu_reg = regulator_get(mpu_dev, "vcc"); diff --git a/trunk/drivers/cpufreq/powernow-k8.c b/trunk/drivers/cpufreq/powernow-k8.c index 129e80bfff22..1a40935c85fd 100644 --- a/trunk/drivers/cpufreq/powernow-k8.c +++ b/trunk/drivers/cpufreq/powernow-k8.c @@ -48,12 +48,22 @@ #define PFX "powernow-k8: " #define VERSION "version 2.20.00" #include "powernow-k8.h" +#include "mperf.h" /* serialize freq changes */ static DEFINE_MUTEX(fidvid_mutex); static DEFINE_PER_CPU(struct powernow_k8_data *, powernow_data); +static int cpu_family = CPU_OPTERON; + +/* array to map SW pstate number to acpi state */ +static u32 ps_to_as[8]; + +/* core performance boost */ +static bool cpb_capable, cpb_enabled; +static struct msr __percpu *msrs; + static struct cpufreq_driver cpufreq_amd64_driver; #ifndef CONFIG_SMP @@ -75,6 +85,12 @@ static u32 find_khz_freq_from_fid(u32 fid) return 1000 * find_freq_from_fid(fid); } +static u32 find_khz_freq_from_pstate(struct cpufreq_frequency_table *data, + u32 pstate) +{ + return data[ps_to_as[pstate]].frequency; +} + /* Return the vco fid for an input fid * * Each "low" fid has corresponding "high" fid, and you can get to "low" fids @@ -97,6 +113,9 @@ static int pending_bit_stuck(void) { u32 lo, hi; + if (cpu_family == CPU_HW_PSTATE) + return 0; + rdmsr(MSR_FIDVID_STATUS, lo, hi); return lo & MSR_S_LO_CHANGE_PENDING ? 1 : 0; } @@ -110,6 +129,20 @@ static int query_current_values_with_pending_wait(struct powernow_k8_data *data) u32 lo, hi; u32 i = 0; + if (cpu_family == CPU_HW_PSTATE) { + rdmsr(MSR_PSTATE_STATUS, lo, hi); + i = lo & HW_PSTATE_MASK; + data->currpstate = i; + + /* + * a workaround for family 11h erratum 311 might cause + * an "out-of-range Pstate if the core is in Pstate-0 + */ + if ((boot_cpu_data.x86 == 0x11) && (i >= data->numps)) + data->currpstate = HW_PSTATE_0; + + return 0; + } do { if (i++ > 10000) { pr_debug("detected change pending stuck\n"); @@ -266,6 +299,14 @@ static int decrease_vid_code_by_step(struct powernow_k8_data *data, return 0; } +/* Change hardware pstate by single MSR write */ +static int transition_pstate(struct powernow_k8_data *data, u32 pstate) +{ + wrmsr(MSR_PSTATE_CTRL, pstate, 0); + data->currpstate = pstate; + return 0; +} + /* Change Opteron/Athlon64 fid and vid, by the 3 phases. */ static int transition_fid_vid(struct powernow_k8_data *data, u32 reqfid, u32 reqvid) @@ -482,6 +523,8 @@ static int core_voltage_post_transition(struct powernow_k8_data *data, static const struct x86_cpu_id powernow_k8_ids[] = { /* IO based frequency switching */ { X86_VENDOR_AMD, 0xf }, + /* MSR based frequency switching supported */ + X86_FEATURE_MATCH(X86_FEATURE_HW_PSTATE), {} }; MODULE_DEVICE_TABLE(x86cpu, powernow_k8_ids); @@ -517,8 +560,15 @@ static void check_supported_cpu(void *_rc) "Power state transitions not supported\n"); return; } - *rc = 0; + } else { /* must be a HW Pstate capable processor */ + cpuid(CPUID_FREQ_VOLT_CAPABILITIES, &eax, &ebx, &ecx, &edx); + if ((edx & USE_HW_PSTATE) == USE_HW_PSTATE) + cpu_family = CPU_HW_PSTATE; + else + return; } + + *rc = 0; } static int check_pst_table(struct powernow_k8_data *data, struct pst_s *pst, @@ -582,11 +632,18 @@ static void print_basics(struct powernow_k8_data *data) for (j = 0; j < data->numps; j++) { if (data->powernow_table[j].frequency != CPUFREQ_ENTRY_INVALID) { + if (cpu_family == CPU_HW_PSTATE) { + printk(KERN_INFO PFX + " %d : pstate %d (%d MHz)\n", j, + data->powernow_table[j].index, + data->powernow_table[j].frequency/1000); + } else { printk(KERN_INFO PFX "fid 0x%x (%d MHz), vid 0x%x\n", data->powernow_table[j].index & 0xff, data->powernow_table[j].frequency/1000, data->powernow_table[j].index >> 8); + } } } if (data->batps) @@ -594,6 +651,20 @@ static void print_basics(struct powernow_k8_data *data) data->batps); } +static u32 freq_from_fid_did(u32 fid, u32 did) +{ + u32 mhz = 0; + + if (boot_cpu_data.x86 == 0x10) + mhz = (100 * (fid + 0x10)) >> did; + else if (boot_cpu_data.x86 == 0x11) + mhz = (100 * (fid + 8)) >> did; + else + BUG(); + + return mhz * 1000; +} + static int fill_powernow_table(struct powernow_k8_data *data, struct pst_s *pst, u8 maxvid) { @@ -753,7 +824,7 @@ static void powernow_k8_acpi_pst_values(struct powernow_k8_data *data, { u64 control; - if (!data->acpi_data.state_count) + if (!data->acpi_data.state_count || (cpu_family == CPU_HW_PSTATE)) return; control = data->acpi_data.states[index].control; @@ -804,7 +875,10 @@ static int powernow_k8_cpu_init_acpi(struct powernow_k8_data *data) data->numps = data->acpi_data.state_count; powernow_k8_acpi_pst_values(data, 0); - ret_val = fill_powernow_table_fidvid(data, powernow_table); + if (cpu_family == CPU_HW_PSTATE) + ret_val = fill_powernow_table_pstate(data, powernow_table); + else + ret_val = fill_powernow_table_fidvid(data, powernow_table); if (ret_val) goto err_out_mem; @@ -841,6 +915,51 @@ static int powernow_k8_cpu_init_acpi(struct powernow_k8_data *data) return ret_val; } +static int fill_powernow_table_pstate(struct powernow_k8_data *data, + struct cpufreq_frequency_table *powernow_table) +{ + int i; + u32 hi = 0, lo = 0; + rdmsr(MSR_PSTATE_CUR_LIMIT, lo, hi); + data->max_hw_pstate = (lo & HW_PSTATE_MAX_MASK) >> HW_PSTATE_MAX_SHIFT; + + for (i = 0; i < data->acpi_data.state_count; i++) { + u32 index; + + index = data->acpi_data.states[i].control & HW_PSTATE_MASK; + if (index > data->max_hw_pstate) { + printk(KERN_ERR PFX "invalid pstate %d - " + "bad value %d.\n", i, index); + printk(KERN_ERR PFX "Please report to BIOS " + "manufacturer\n"); + invalidate_entry(powernow_table, i); + continue; + } + + ps_to_as[index] = i; + + /* Frequency may be rounded for these */ + if ((boot_cpu_data.x86 == 0x10 && boot_cpu_data.x86_model < 10) + || boot_cpu_data.x86 == 0x11) { + + rdmsr(MSR_PSTATE_DEF_BASE + index, lo, hi); + if (!(hi & HW_PSTATE_VALID_MASK)) { + pr_debug("invalid pstate %d, ignoring\n", index); + invalidate_entry(powernow_table, i); + continue; + } + + powernow_table[i].frequency = + freq_from_fid_did(lo & 0x3f, (lo >> 6) & 7); + } else + powernow_table[i].frequency = + data->acpi_data.states[i].core_frequency * 1000; + + powernow_table[i].index = index; + } + return 0; +} + static int fill_powernow_table_fidvid(struct powernow_k8_data *data, struct cpufreq_frequency_table *powernow_table) { @@ -917,7 +1036,15 @@ static int get_transition_latency(struct powernow_k8_data *data) max_latency = cur_latency; } if (max_latency == 0) { - pr_err(FW_WARN PFX "Invalid zero transition latency\n"); + /* + * Fam 11h and later may return 0 as transition latency. This + * is intended and means "very fast". While cpufreq core and + * governors currently can handle that gracefully, better set it + * to 1 to avoid problems in the future. + */ + if (boot_cpu_data.x86 < 0x11) + printk(KERN_ERR FW_WARN PFX "Invalid zero transition " + "latency\n"); max_latency = 1; } /* value in usecs, needs to be in nanoseconds */ @@ -977,6 +1104,40 @@ static int transition_frequency_fidvid(struct powernow_k8_data *data, return res; } +/* Take a frequency, and issue the hardware pstate transition command */ +static int transition_frequency_pstate(struct powernow_k8_data *data, + unsigned int index) +{ + u32 pstate = 0; + int res, i; + struct cpufreq_freqs freqs; + + pr_debug("cpu %d transition to index %u\n", smp_processor_id(), index); + + /* get MSR index for hardware pstate transition */ + pstate = index & HW_PSTATE_MASK; + if (pstate > data->max_hw_pstate) + return -EINVAL; + + freqs.old = find_khz_freq_from_pstate(data->powernow_table, + data->currpstate); + freqs.new = find_khz_freq_from_pstate(data->powernow_table, pstate); + + for_each_cpu(i, data->available_cores) { + freqs.cpu = i; + cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); + } + + res = transition_pstate(data, pstate); + freqs.new = find_khz_freq_from_pstate(data->powernow_table, pstate); + + for_each_cpu(i, data->available_cores) { + freqs.cpu = i; + cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); + } + return res; +} + struct powernowk8_target_arg { struct cpufreq_policy *pol; unsigned targfreq; @@ -1012,15 +1173,18 @@ static long powernowk8_target_fn(void *arg) if (query_current_values_with_pending_wait(data)) return -EIO; - pr_debug("targ: curr fid 0x%x, vid 0x%x\n", - data->currfid, data->currvid); + if (cpu_family != CPU_HW_PSTATE) { + pr_debug("targ: curr fid 0x%x, vid 0x%x\n", + data->currfid, data->currvid); - if ((checkvid != data->currvid) || - (checkfid != data->currfid)) { - pr_info(PFX - "error - out of sync, fix 0x%x 0x%x, vid 0x%x 0x%x\n", - checkfid, data->currfid, - checkvid, data->currvid); + if ((checkvid != data->currvid) || + (checkfid != data->currfid)) { + printk(KERN_INFO PFX + "error - out of sync, fix 0x%x 0x%x, " + "vid 0x%x 0x%x\n", + checkfid, data->currfid, + checkvid, data->currvid); + } } if (cpufreq_frequency_table_target(pol, data->powernow_table, @@ -1031,8 +1195,11 @@ static long powernowk8_target_fn(void *arg) powernow_k8_acpi_pst_values(data, newstate); - ret = transition_frequency_fidvid(data, newstate); - + if (cpu_family == CPU_HW_PSTATE) + ret = transition_frequency_pstate(data, + data->powernow_table[newstate].index); + else + ret = transition_frequency_fidvid(data, newstate); if (ret) { printk(KERN_ERR PFX "transition frequency failed\n"); mutex_unlock(&fidvid_mutex); @@ -1040,7 +1207,11 @@ static long powernowk8_target_fn(void *arg) } mutex_unlock(&fidvid_mutex); - pol->cur = find_khz_freq_from_fid(data->currfid); + if (cpu_family == CPU_HW_PSTATE) + pol->cur = find_khz_freq_from_pstate(data->powernow_table, + data->powernow_table[newstate].index); + else + pol->cur = find_khz_freq_from_fid(data->currfid); return 0; } @@ -1093,23 +1264,22 @@ static void __cpuinit powernowk8_cpu_init_on_cpu(void *_init_on_cpu) return; } - fidvid_msr_init(); + if (cpu_family == CPU_OPTERON) + fidvid_msr_init(); init_on_cpu->rc = 0; } -static const char missing_pss_msg[] = - KERN_ERR - FW_BUG PFX "No compatible ACPI _PSS objects found.\n" - FW_BUG PFX "First, make sure Cool'N'Quiet is enabled in the BIOS.\n" - FW_BUG PFX "If that doesn't help, try upgrading your BIOS.\n"; - /* per CPU init entry point to the driver */ static int __cpuinit powernowk8_cpu_init(struct cpufreq_policy *pol) { + static const char ACPI_PSS_BIOS_BUG_MSG[] = + KERN_ERR FW_BUG PFX "No compatible ACPI _PSS objects found.\n" + FW_BUG PFX "Try again with latest BIOS.\n"; struct powernow_k8_data *data; struct init_on_cpu init_on_cpu; int rc; + struct cpuinfo_x86 *c = &cpu_data(pol->cpu); if (!cpu_online(pol->cpu)) return -ENODEV; @@ -1125,6 +1295,7 @@ static int __cpuinit powernowk8_cpu_init(struct cpufreq_policy *pol) } data->cpu = pol->cpu; + data->currpstate = HW_PSTATE_INVALID; if (powernow_k8_cpu_init_acpi(data)) { /* @@ -1132,7 +1303,7 @@ static int __cpuinit powernowk8_cpu_init(struct cpufreq_policy *pol) * an UP version, and is deprecated by AMD. */ if (num_online_cpus() != 1) { - printk_once(missing_pss_msg); + printk_once(ACPI_PSS_BIOS_BUG_MSG); goto err_out; } if (pol->cpu != 0) { @@ -1161,10 +1332,17 @@ static int __cpuinit powernowk8_cpu_init(struct cpufreq_policy *pol) if (rc != 0) goto err_out_exit_acpi; - cpumask_copy(pol->cpus, cpu_core_mask(pol->cpu)); + if (cpu_family == CPU_HW_PSTATE) + cpumask_copy(pol->cpus, cpumask_of(pol->cpu)); + else + cpumask_copy(pol->cpus, cpu_core_mask(pol->cpu)); data->available_cores = pol->cpus; - pol->cur = find_khz_freq_from_fid(data->currfid); + if (cpu_family == CPU_HW_PSTATE) + pol->cur = find_khz_freq_from_pstate(data->powernow_table, + data->currpstate); + else + pol->cur = find_khz_freq_from_fid(data->currfid); pr_debug("policy current frequency %d kHz\n", pol->cur); /* min/max the cpu is capable of */ @@ -1176,10 +1354,18 @@ static int __cpuinit powernowk8_cpu_init(struct cpufreq_policy *pol) return -EINVAL; } + /* Check for APERF/MPERF support in hardware */ + if (cpu_has(c, X86_FEATURE_APERFMPERF)) + cpufreq_amd64_driver.getavg = cpufreq_get_measured_perf; + cpufreq_frequency_table_get_attr(data->powernow_table, pol->cpu); - pr_debug("cpu_init done, current fid 0x%x, vid 0x%x\n", - data->currfid, data->currvid); + if (cpu_family == CPU_HW_PSTATE) + pr_debug("cpu_init done, current pstate 0x%x\n", + data->currpstate); + else + pr_debug("cpu_init done, current fid 0x%x, vid 0x%x\n", + data->currfid, data->currvid); per_cpu(powernow_data, pol->cpu) = data; @@ -1232,15 +1418,88 @@ static unsigned int powernowk8_get(unsigned int cpu) if (err) goto out; - khz = find_khz_freq_from_fid(data->currfid); + if (cpu_family == CPU_HW_PSTATE) + khz = find_khz_freq_from_pstate(data->powernow_table, + data->currpstate); + else + khz = find_khz_freq_from_fid(data->currfid); out: return khz; } +static void _cpb_toggle_msrs(bool t) +{ + int cpu; + + get_online_cpus(); + + rdmsr_on_cpus(cpu_online_mask, MSR_K7_HWCR, msrs); + + for_each_cpu(cpu, cpu_online_mask) { + struct msr *reg = per_cpu_ptr(msrs, cpu); + if (t) + reg->l &= ~BIT(25); + else + reg->l |= BIT(25); + } + wrmsr_on_cpus(cpu_online_mask, MSR_K7_HWCR, msrs); + + put_online_cpus(); +} + +/* + * Switch on/off core performance boosting. + * + * 0=disable + * 1=enable. + */ +static void cpb_toggle(bool t) +{ + if (!cpb_capable) + return; + + if (t && !cpb_enabled) { + cpb_enabled = true; + _cpb_toggle_msrs(t); + printk(KERN_INFO PFX "Core Boosting enabled.\n"); + } else if (!t && cpb_enabled) { + cpb_enabled = false; + _cpb_toggle_msrs(t); + printk(KERN_INFO PFX "Core Boosting disabled.\n"); + } +} + +static ssize_t store_cpb(struct cpufreq_policy *policy, const char *buf, + size_t count) +{ + int ret = -EINVAL; + unsigned long val = 0; + + ret = strict_strtoul(buf, 10, &val); + if (!ret && (val == 0 || val == 1) && cpb_capable) + cpb_toggle(val); + else + return -EINVAL; + + return count; +} + +static ssize_t show_cpb(struct cpufreq_policy *policy, char *buf) +{ + return sprintf(buf, "%u\n", cpb_enabled); +} + +#define define_one_rw(_name) \ +static struct freq_attr _name = \ +__ATTR(_name, 0644, show_##_name, store_##_name) + +define_one_rw(cpb); + static struct freq_attr *powernow_k8_attr[] = { &cpufreq_freq_attr_scaling_available_freqs, + &cpb, NULL, }; @@ -1256,18 +1515,53 @@ static struct cpufreq_driver cpufreq_amd64_driver = { .attr = powernow_k8_attr, }; +/* + * Clear the boost-disable flag on the CPU_DOWN path so that this cpu + * cannot block the remaining ones from boosting. On the CPU_UP path we + * simply keep the boost-disable flag in sync with the current global + * state. + */ +static int cpb_notify(struct notifier_block *nb, unsigned long action, + void *hcpu) +{ + unsigned cpu = (long)hcpu; + u32 lo, hi; + + switch (action) { + case CPU_UP_PREPARE: + case CPU_UP_PREPARE_FROZEN: + + if (!cpb_enabled) { + rdmsr_on_cpu(cpu, MSR_K7_HWCR, &lo, &hi); + lo |= BIT(25); + wrmsr_on_cpu(cpu, MSR_K7_HWCR, lo, hi); + } + break; + + case CPU_DOWN_PREPARE: + case CPU_DOWN_PREPARE_FROZEN: + rdmsr_on_cpu(cpu, MSR_K7_HWCR, &lo, &hi); + lo &= ~BIT(25); + wrmsr_on_cpu(cpu, MSR_K7_HWCR, lo, hi); + break; + + default: + break; + } + + return NOTIFY_OK; +} + +static struct notifier_block cpb_nb = { + .notifier_call = cpb_notify, +}; + /* driver entry point for init */ static int __cpuinit powernowk8_init(void) { - unsigned int i, supported_cpus = 0; + unsigned int i, supported_cpus = 0, cpu; int rv; - if (static_cpu_has(X86_FEATURE_HW_PSTATE)) { - pr_warn(PFX "this CPU is not supported anymore, using acpi-cpufreq instead.\n"); - request_module("acpi-cpufreq"); - return -ENODEV; - } - if (!x86_match_cpu(powernow_k8_ids)) return -ENODEV; @@ -1281,13 +1575,38 @@ static int __cpuinit powernowk8_init(void) if (supported_cpus != num_online_cpus()) return -ENODEV; - rv = cpufreq_register_driver(&cpufreq_amd64_driver); + printk(KERN_INFO PFX "Found %d %s (%d cpu cores) (" VERSION ")\n", + num_online_nodes(), boot_cpu_data.x86_model_id, supported_cpus); + + if (boot_cpu_has(X86_FEATURE_CPB)) { + + cpb_capable = true; + + msrs = msrs_alloc(); + if (!msrs) { + printk(KERN_ERR "%s: Error allocating msrs!\n", __func__); + return -ENOMEM; + } + + register_cpu_notifier(&cpb_nb); - if (!rv) - pr_info(PFX "Found %d %s (%d cpu cores) (" VERSION ")\n", - num_online_nodes(), boot_cpu_data.x86_model_id, - supported_cpus); + rdmsr_on_cpus(cpu_online_mask, MSR_K7_HWCR, msrs); + for_each_cpu(cpu, cpu_online_mask) { + struct msr *reg = per_cpu_ptr(msrs, cpu); + cpb_enabled |= !(!!(reg->l & BIT(25))); + } + + printk(KERN_INFO PFX "Core Performance Boosting: %s.\n", + (cpb_enabled ? "on" : "off")); + } + + rv = cpufreq_register_driver(&cpufreq_amd64_driver); + if (rv < 0 && boot_cpu_has(X86_FEATURE_CPB)) { + unregister_cpu_notifier(&cpb_nb); + msrs_free(msrs); + msrs = NULL; + } return rv; } @@ -1296,6 +1615,13 @@ static void __exit powernowk8_exit(void) { pr_debug("exit\n"); + if (boot_cpu_has(X86_FEATURE_CPB)) { + msrs_free(msrs); + msrs = NULL; + + unregister_cpu_notifier(&cpb_nb); + } + cpufreq_unregister_driver(&cpufreq_amd64_driver); } diff --git a/trunk/drivers/cpufreq/powernow-k8.h b/trunk/drivers/cpufreq/powernow-k8.h index 79329d4d5abe..3744d26cdc2b 100644 --- a/trunk/drivers/cpufreq/powernow-k8.h +++ b/trunk/drivers/cpufreq/powernow-k8.h @@ -5,11 +5,24 @@ * http://www.gnu.org/licenses/gpl.html */ +enum pstate { + HW_PSTATE_INVALID = 0xff, + HW_PSTATE_0 = 0, + HW_PSTATE_1 = 1, + HW_PSTATE_2 = 2, + HW_PSTATE_3 = 3, + HW_PSTATE_4 = 4, + HW_PSTATE_5 = 5, + HW_PSTATE_6 = 6, + HW_PSTATE_7 = 7, +}; + struct powernow_k8_data { unsigned int cpu; u32 numps; /* number of p-states */ u32 batps; /* number of p-states supported on battery */ + u32 max_hw_pstate; /* maximum legal hardware pstate */ /* these values are constant when the PSB is used to determine * vid/fid pairings, but are modified during the ->target() call @@ -24,6 +37,7 @@ struct powernow_k8_data { /* keep track of the current fid / vid or pstate */ u32 currvid; u32 currfid; + enum pstate currpstate; /* the powernow_table includes all frequency and vid/fid pairings: * fid are the lower 8 bits of the index, vid are the upper 8 bits. @@ -83,6 +97,23 @@ struct powernow_k8_data { #define MSR_S_HI_CURRENT_VID 0x0000003f #define MSR_C_HI_STP_GNT_BENIGN 0x00000001 + +/* Hardware Pstate _PSS and MSR definitions */ +#define USE_HW_PSTATE 0x00000080 +#define HW_PSTATE_MASK 0x00000007 +#define HW_PSTATE_VALID_MASK 0x80000000 +#define HW_PSTATE_MAX_MASK 0x000000f0 +#define HW_PSTATE_MAX_SHIFT 4 +#define MSR_PSTATE_DEF_BASE 0xc0010064 /* base of Pstate MSRs */ +#define MSR_PSTATE_STATUS 0xc0010063 /* Pstate Status MSR */ +#define MSR_PSTATE_CTRL 0xc0010062 /* Pstate control MSR */ +#define MSR_PSTATE_CUR_LIMIT 0xc0010061 /* pstate current limit MSR */ + +/* define the two driver architectures */ +#define CPU_OPTERON 0 +#define CPU_HW_PSTATE 1 + + /* * There are restrictions frequencies have to follow: * - only 1 entry in the low fid table ( <=1.4GHz ) @@ -187,4 +218,5 @@ static int core_frequency_transition(struct powernow_k8_data *data, u32 reqfid); static void powernow_k8_acpi_pst_values(struct powernow_k8_data *data, unsigned int index); +static int fill_powernow_table_pstate(struct powernow_k8_data *data, struct cpufreq_frequency_table *powernow_table); static int fill_powernow_table_fidvid(struct powernow_k8_data *data, struct cpufreq_frequency_table *powernow_table); diff --git a/trunk/drivers/cpuidle/driver.c b/trunk/drivers/cpuidle/driver.c index 87db3877fead..58bf3b1ac9c4 100644 --- a/trunk/drivers/cpuidle/driver.c +++ b/trunk/drivers/cpuidle/driver.c @@ -18,10 +18,9 @@ static struct cpuidle_driver *cpuidle_curr_driver; DEFINE_SPINLOCK(cpuidle_driver_lock); int cpuidle_driver_refcount; -static void set_power_states(struct cpuidle_driver *drv) +static void __cpuidle_register_driver(struct cpuidle_driver *drv) { int i; - /* * cpuidle driver should set the drv->power_specified bit * before registering if the driver provides @@ -36,10 +35,13 @@ static void set_power_states(struct cpuidle_driver *drv) * an power value of -1. So we use -2, -3, etc, for other * c-states. */ - for (i = CPUIDLE_DRIVER_STATE_START; i < drv->state_count; i++) - drv->states[i].power_usage = -1 - i; + if (!drv->power_specified) { + for (i = CPUIDLE_DRIVER_STATE_START; i < drv->state_count; i++) + drv->states[i].power_usage = -1 - i; + } } + /** * cpuidle_register_driver - registers a driver * @drv: the driver @@ -57,16 +59,13 @@ int cpuidle_register_driver(struct cpuidle_driver *drv) spin_unlock(&cpuidle_driver_lock); return -EBUSY; } - - if (!drv->power_specified) - set_power_states(drv); - + __cpuidle_register_driver(drv); cpuidle_curr_driver = drv; - spin_unlock(&cpuidle_driver_lock); return 0; } + EXPORT_SYMBOL_GPL(cpuidle_register_driver); /** @@ -97,6 +96,7 @@ void cpuidle_unregister_driver(struct cpuidle_driver *drv) spin_unlock(&cpuidle_driver_lock); } + EXPORT_SYMBOL_GPL(cpuidle_unregister_driver); struct cpuidle_driver *cpuidle_driver_ref(void) diff --git a/trunk/drivers/cpuidle/governors/ladder.c b/trunk/drivers/cpuidle/governors/ladder.c index 9b784051ec12..b6a09ea859b1 100644 --- a/trunk/drivers/cpuidle/governors/ladder.c +++ b/trunk/drivers/cpuidle/governors/ladder.c @@ -88,8 +88,6 @@ static int ladder_select_state(struct cpuidle_driver *drv, /* consider promotion */ if (last_idx < drv->state_count - 1 && - !drv->states[last_idx + 1].disabled && - !dev->states_usage[last_idx + 1].disable && last_residency > last_state->threshold.promotion_time && drv->states[last_idx + 1].exit_latency <= latency_req) { last_state->stats.promotion_count++; @@ -102,9 +100,7 @@ static int ladder_select_state(struct cpuidle_driver *drv, /* consider demotion */ if (last_idx > CPUIDLE_DRIVER_STATE_START && - (drv->states[last_idx].disabled || - dev->states_usage[last_idx].disable || - drv->states[last_idx].exit_latency > latency_req)) { + drv->states[last_idx].exit_latency > latency_req) { int i; for (i = last_idx - 1; i > CPUIDLE_DRIVER_STATE_START; i--) { diff --git a/trunk/drivers/crypto/Kconfig b/trunk/drivers/crypto/Kconfig index 308c7fb92a60..7d74d092aa8f 100644 --- a/trunk/drivers/crypto/Kconfig +++ b/trunk/drivers/crypto/Kconfig @@ -298,15 +298,21 @@ config CRYPTO_DEV_TEGRA_AES will be called tegra-aes. config CRYPTO_DEV_NX - bool "Support for IBM Power7+ in-Nest cryptographic acceleration" + tristate "Support for Power7+ in-Nest cryptographic acceleration" depends on PPC64 && IBMVIO - default n + select CRYPTO_AES + select CRYPTO_CBC + select CRYPTO_ECB + select CRYPTO_CCM + select CRYPTO_GCM + select CRYPTO_AUTHENC + select CRYPTO_XCBC + select CRYPTO_SHA256 + select CRYPTO_SHA512 help - Support for Power7+ in-Nest cryptographic acceleration. - -if CRYPTO_DEV_NX - source "drivers/crypto/nx/Kconfig" -endif + Support for Power7+ in-Nest cryptographic acceleration. This + module supports acceleration for AES and SHA2 algorithms. If you + choose 'M' here, this module will be called nx_crypto. config CRYPTO_DEV_UX500 tristate "Driver for ST-Ericsson UX500 crypto hardware acceleration" @@ -334,7 +340,7 @@ config CRYPTO_DEV_ATMEL_AES select CRYPTO_AES select CRYPTO_ALGAPI select CRYPTO_BLKCIPHER - select AT_HDMAC + select CONFIG_AT_HDMAC help Some Atmel processors have AES hw accelerator. Select this if you want to use the Atmel module for diff --git a/trunk/drivers/crypto/amcc/crypto4xx_core.c b/trunk/drivers/crypto/amcc/crypto4xx_core.c index f88e3d8f6b64..802e85102c32 100644 --- a/trunk/drivers/crypto/amcc/crypto4xx_core.c +++ b/trunk/drivers/crypto/amcc/crypto4xx_core.c @@ -1226,7 +1226,6 @@ static int __init crypto4xx_probe(struct platform_device *ofdev) core_dev->dev->ce_base = of_iomap(ofdev->dev.of_node, 0); if (!core_dev->dev->ce_base) { dev_err(dev, "failed to of_iomap\n"); - rc = -ENOMEM; goto err_iomap; } diff --git a/trunk/drivers/crypto/atmel-aes.c b/trunk/drivers/crypto/atmel-aes.c index 8061336e07e7..6bb20fffbf49 100644 --- a/trunk/drivers/crypto/atmel-aes.c +++ b/trunk/drivers/crypto/atmel-aes.c @@ -24,10 +24,15 @@ #include #include +#include #include #include #include +#include +#include #include +#include +#include #include #include #include @@ -1012,6 +1017,7 @@ static int atmel_aes_register_algs(struct atmel_aes_dev *dd) int err, i, j; for (i = 0; i < ARRAY_SIZE(aes_algs); i++) { + INIT_LIST_HEAD(&aes_algs[i].cra_list); err = crypto_register_alg(&aes_algs[i]); if (err) goto err_aes_algs; @@ -1020,6 +1026,7 @@ static int atmel_aes_register_algs(struct atmel_aes_dev *dd) atmel_aes_hw_version_init(dd); if (dd->hw_version >= 0x130) { + INIT_LIST_HEAD(&aes_cfb64_alg[0].cra_list); err = crypto_register_alg(&aes_cfb64_alg[0]); if (err) goto err_aes_cfb64_alg; diff --git a/trunk/drivers/crypto/atmel-sha.c b/trunk/drivers/crypto/atmel-sha.c index bcdf55fdc623..f938b9d79b66 100644 --- a/trunk/drivers/crypto/atmel-sha.c +++ b/trunk/drivers/crypto/atmel-sha.c @@ -24,10 +24,15 @@ #include #include +#include #include #include #include +#include +#include #include +#include +#include #include #include #include diff --git a/trunk/drivers/crypto/atmel-tdes.c b/trunk/drivers/crypto/atmel-tdes.c index 7495f98c7221..eb2b61e57e2d 100644 --- a/trunk/drivers/crypto/atmel-tdes.c +++ b/trunk/drivers/crypto/atmel-tdes.c @@ -24,10 +24,15 @@ #include #include +#include #include #include #include +#include +#include #include +#include +#include #include #include #include @@ -1039,6 +1044,7 @@ static int atmel_tdes_register_algs(struct atmel_tdes_dev *dd) int err, i, j; for (i = 0; i < ARRAY_SIZE(tdes_algs); i++) { + INIT_LIST_HEAD(&tdes_algs[i].cra_list); err = crypto_register_alg(&tdes_algs[i]); if (err) goto err_tdes_algs; diff --git a/trunk/drivers/crypto/caam/caamalg.c b/trunk/drivers/crypto/caam/caamalg.c index b2a0a0726a54..0c1ea8492eff 100644 --- a/trunk/drivers/crypto/caam/caamalg.c +++ b/trunk/drivers/crypto/caam/caamalg.c @@ -205,7 +205,7 @@ static void init_sh_desc_key_aead(u32 *desc, struct caam_ctx *ctx, { u32 *key_jump_cmd; - init_sh_desc(desc, HDR_SHARE_SERIAL); + init_sh_desc(desc, HDR_SHARE_WAIT); /* Skip if already shared */ key_jump_cmd = append_jump(desc, JUMP_JSL | JUMP_TEST_ALL | @@ -224,7 +224,7 @@ static int aead_set_sh_desc(struct crypto_aead *aead) struct aead_tfm *tfm = &aead->base.crt_aead; struct caam_ctx *ctx = crypto_aead_ctx(aead); struct device *jrdev = ctx->jrdev; - bool keys_fit_inline = false; + bool keys_fit_inline = 0; u32 *key_jump_cmd, *jump_cmd; u32 geniv, moveiv; u32 *desc; @@ -239,7 +239,7 @@ static int aead_set_sh_desc(struct crypto_aead *aead) if (DESC_AEAD_ENC_LEN + DESC_JOB_IO_LEN + ctx->split_key_pad_len + ctx->enckeylen <= CAAM_DESC_BYTES_MAX) - keys_fit_inline = true; + keys_fit_inline = 1; /* aead_encrypt shared descriptor */ desc = ctx->sh_desc_enc; @@ -297,12 +297,12 @@ static int aead_set_sh_desc(struct crypto_aead *aead) if (DESC_AEAD_DEC_LEN + DESC_JOB_IO_LEN + ctx->split_key_pad_len + ctx->enckeylen <= CAAM_DESC_BYTES_MAX) - keys_fit_inline = true; + keys_fit_inline = 1; desc = ctx->sh_desc_dec; /* aead_decrypt shared descriptor */ - init_sh_desc(desc, HDR_SHARE_SERIAL); + init_sh_desc(desc, HDR_SHARE_WAIT); /* Skip if already shared */ key_jump_cmd = append_jump(desc, JUMP_JSL | JUMP_TEST_ALL | @@ -365,7 +365,7 @@ static int aead_set_sh_desc(struct crypto_aead *aead) if (DESC_AEAD_GIVENC_LEN + DESC_JOB_IO_LEN + ctx->split_key_pad_len + ctx->enckeylen <= CAAM_DESC_BYTES_MAX) - keys_fit_inline = true; + keys_fit_inline = 1; /* aead_givencrypt shared descriptor */ desc = ctx->sh_desc_givenc; @@ -564,7 +564,7 @@ static int ablkcipher_setkey(struct crypto_ablkcipher *ablkcipher, /* ablkcipher_encrypt shared descriptor */ desc = ctx->sh_desc_enc; - init_sh_desc(desc, HDR_SHARE_SERIAL); + init_sh_desc(desc, HDR_SHARE_WAIT); /* Skip if already shared */ key_jump_cmd = append_jump(desc, JUMP_JSL | JUMP_TEST_ALL | JUMP_COND_SHRD); @@ -605,7 +605,7 @@ static int ablkcipher_setkey(struct crypto_ablkcipher *ablkcipher, /* ablkcipher_decrypt shared descriptor */ desc = ctx->sh_desc_dec; - init_sh_desc(desc, HDR_SHARE_SERIAL); + init_sh_desc(desc, HDR_SHARE_WAIT); /* Skip if already shared */ key_jump_cmd = append_jump(desc, JUMP_JSL | JUMP_TEST_ALL | JUMP_COND_SHRD); @@ -1354,10 +1354,10 @@ static struct aead_edesc *aead_giv_edesc_alloc(struct aead_givcrypt_request contig &= ~GIV_SRC_CONTIG; if (dst_nents || iv_dma + ivsize != sg_dma_address(req->dst)) contig &= ~GIV_DST_CONTIG; - if (unlikely(req->src != req->dst)) { - dst_nents = dst_nents ? : 1; - sec4_sg_len += 1; - } + if (unlikely(req->src != req->dst)) { + dst_nents = dst_nents ? : 1; + sec4_sg_len += 1; + } if (!(contig & GIV_SRC_CONTIG)) { assoc_nents = assoc_nents ? : 1; src_nents = src_nents ? : 1; @@ -1650,11 +1650,7 @@ struct caam_alg_template { }; static struct caam_alg_template driver_algs[] = { - /* - * single-pass ipsec_esp descriptor - * authencesn(*,*) is also registered, although not present - * explicitly here. - */ + /* single-pass ipsec_esp descriptor */ { .name = "authenc(hmac(md5),cbc(aes))", .driver_name = "authenc-hmac-md5-cbc-aes-caam", @@ -2217,9 +2213,7 @@ static int __init caam_algapi_init(void) for (i = 0; i < ARRAY_SIZE(driver_algs); i++) { /* TODO: check if h/w supports alg */ struct caam_crypto_alg *t_alg; - bool done = false; -authencesn: t_alg = caam_alg_alloc(ctrldev, &driver_algs[i]); if (IS_ERR(t_alg)) { err = PTR_ERR(t_alg); @@ -2233,25 +2227,8 @@ static int __init caam_algapi_init(void) dev_warn(ctrldev, "%s alg registration failed\n", t_alg->crypto_alg.cra_driver_name); kfree(t_alg); - } else { + } else list_add_tail(&t_alg->entry, &priv->alg_list); - if (driver_algs[i].type == CRYPTO_ALG_TYPE_AEAD && - !memcmp(driver_algs[i].name, "authenc", 7) && - !done) { - char *name; - - name = driver_algs[i].name; - memmove(name + 10, name + 7, strlen(name) - 7); - memcpy(name + 7, "esn", 3); - - name = driver_algs[i].driver_name; - memmove(name + 10, name + 7, strlen(name) - 7); - memcpy(name + 7, "esn", 3); - - done = true; - goto authencesn; - } - } } if (!list_empty(&priv->alg_list)) dev_info(ctrldev, "%s algorithms registered in /proc/crypto\n", diff --git a/trunk/drivers/crypto/caam/caamhash.c b/trunk/drivers/crypto/caam/caamhash.c index 32aba7a61503..895aaf2bca92 100644 --- a/trunk/drivers/crypto/caam/caamhash.c +++ b/trunk/drivers/crypto/caam/caamhash.c @@ -225,7 +225,7 @@ static inline void init_sh_desc_key_ahash(u32 *desc, struct caam_hash_ctx *ctx) { u32 *key_jump_cmd; - init_sh_desc(desc, HDR_SHARE_SERIAL); + init_sh_desc(desc, HDR_SHARE_WAIT); if (ctx->split_key_len) { /* Skip if already shared */ @@ -311,7 +311,7 @@ static int ahash_set_sh_desc(struct crypto_ahash *ahash) /* ahash_update shared descriptor */ desc = ctx->sh_desc_update; - init_sh_desc(desc, HDR_SHARE_SERIAL); + init_sh_desc(desc, HDR_SHARE_WAIT); /* Import context from software */ append_cmd(desc, CMD_SEQ_LOAD | LDST_SRCDST_BYTE_CONTEXT | @@ -430,10 +430,6 @@ static u32 hash_digest_key(struct caam_hash_ctx *ctx, const u8 *key_in, int ret = 0; desc = kmalloc(CAAM_CMD_SZ * 6 + CAAM_PTR_SZ * 2, GFP_KERNEL | GFP_DMA); - if (!desc) { - dev_err(jrdev, "unable to allocate key input memory\n"); - return -ENOMEM; - } init_job_desc(desc, 0); @@ -1740,11 +1736,8 @@ static void __exit caam_algapi_hash_exit(void) struct caam_hash_alg *t_alg, *n; dev_node = of_find_compatible_node(NULL, NULL, "fsl,sec-v4.0"); - if (!dev_node) { - dev_node = of_find_compatible_node(NULL, NULL, "fsl,sec4.0"); - if (!dev_node) - return; - } + if (!dev_node) + return; pdev = of_find_device_by_node(dev_node); if (!pdev) @@ -1819,11 +1812,8 @@ static int __init caam_algapi_hash_init(void) int i = 0, err = 0; dev_node = of_find_compatible_node(NULL, NULL, "fsl,sec-v4.0"); - if (!dev_node) { - dev_node = of_find_compatible_node(NULL, NULL, "fsl,sec4.0"); - if (!dev_node) - return -ENODEV; - } + if (!dev_node) + return -ENODEV; pdev = of_find_device_by_node(dev_node); if (!pdev) diff --git a/trunk/drivers/crypto/caam/caamrng.c b/trunk/drivers/crypto/caam/caamrng.c index d1939a9539c0..e2bfe161dece 100644 --- a/trunk/drivers/crypto/caam/caamrng.c +++ b/trunk/drivers/crypto/caam/caamrng.c @@ -193,7 +193,7 @@ static inline void rng_create_sh_desc(struct caam_rng_ctx *ctx) struct device *jrdev = ctx->jrdev; u32 *desc = ctx->sh_desc; - init_sh_desc(desc, HDR_SHARE_SERIAL); + init_sh_desc(desc, HDR_SHARE_WAIT); /* Propagate errors from shared to job descriptor */ append_cmd(desc, SET_OK_NO_PROP_ERRORS | CMD_LOAD); @@ -284,11 +284,8 @@ static int __init caam_rng_init(void) struct caam_drv_private *priv; dev_node = of_find_compatible_node(NULL, NULL, "fsl,sec-v4.0"); - if (!dev_node) { - dev_node = of_find_compatible_node(NULL, NULL, "fsl,sec4.0"); - if (!dev_node) - return -ENODEV; - } + if (!dev_node) + return -ENODEV; pdev = of_find_device_by_node(dev_node); if (!pdev) diff --git a/trunk/drivers/crypto/caam/compat.h b/trunk/drivers/crypto/caam/compat.h index cf15e7813801..762aeff626ac 100644 --- a/trunk/drivers/crypto/caam/compat.h +++ b/trunk/drivers/crypto/caam/compat.h @@ -23,7 +23,6 @@ #include #include #include -#include #include #include diff --git a/trunk/drivers/crypto/caam/ctrl.c b/trunk/drivers/crypto/caam/ctrl.c index bf20dd891705..414ba20c05a1 100644 --- a/trunk/drivers/crypto/caam/ctrl.c +++ b/trunk/drivers/crypto/caam/ctrl.c @@ -129,7 +129,7 @@ static int instantiate_rng(struct device *jrdev) /* * By default, the TRNG runs for 200 clocks per sample; - * 1600 clocks per sample generates better entropy. + * 800 clocks per sample generates better entropy. */ static void kick_trng(struct platform_device *pdev) { @@ -144,9 +144,9 @@ static void kick_trng(struct platform_device *pdev) /* put RNG4 into program mode */ setbits32(&r4tst->rtmctl, RTMCTL_PRGM); - /* 1600 clocks per sample */ + /* 800 clocks per sample */ val = rd_reg32(&r4tst->rtsdctl); - val = (val & ~RTSDCTL_ENT_DLY_MASK) | (1600 << RTSDCTL_ENT_DLY_SHIFT); + val = (val & ~RTSDCTL_ENT_DLY_MASK) | (800 << RTSDCTL_ENT_DLY_SHIFT); wr_reg32(&r4tst->rtsdctl, val); /* min. freq. count */ wr_reg32(&r4tst->rtfrqmin, 400); diff --git a/trunk/drivers/crypto/caam/error.c b/trunk/drivers/crypto/caam/error.c index 30b8f74833d4..9955ed9643e6 100644 --- a/trunk/drivers/crypto/caam/error.c +++ b/trunk/drivers/crypto/caam/error.c @@ -77,8 +77,10 @@ static void report_ccb_status(u32 status, char *outstr) "Not instantiated", "Test instantiate", "Prediction resistance", + "", "Prediction resistance and test request", "Uninstantiate", + "", "Secure key generation", }; u8 cha_id = (status & JRSTA_CCBERR_CHAID_MASK) >> diff --git a/trunk/drivers/crypto/caam/key_gen.c b/trunk/drivers/crypto/caam/key_gen.c index f6dba10246c3..d216cd3cc569 100644 --- a/trunk/drivers/crypto/caam/key_gen.c +++ b/trunk/drivers/crypto/caam/key_gen.c @@ -54,10 +54,6 @@ u32 gen_split_key(struct device *jrdev, u8 *key_out, int split_key_len, int ret = 0; desc = kmalloc(CAAM_CMD_SZ * 6 + CAAM_PTR_SZ * 2, GFP_KERNEL | GFP_DMA); - if (!desc) { - dev_err(jrdev, "unable to allocate key input memory\n"); - return -ENOMEM; - } init_job_desc(desc, 0); diff --git a/trunk/drivers/crypto/geode-aes.c b/trunk/drivers/crypto/geode-aes.c index 51f196d77f21..f3e36c86b6c3 100644 --- a/trunk/drivers/crypto/geode-aes.c +++ b/trunk/drivers/crypto/geode-aes.c @@ -289,6 +289,7 @@ static struct crypto_alg geode_alg = { .cra_blocksize = AES_MIN_BLOCK_SIZE, .cra_ctxsize = sizeof(struct geode_aes_op), .cra_module = THIS_MODULE, + .cra_list = LIST_HEAD_INIT(geode_alg.cra_list), .cra_u = { .cipher = { .cia_min_keysize = AES_MIN_KEY_SIZE, @@ -401,6 +402,7 @@ static struct crypto_alg geode_cbc_alg = { .cra_alignmask = 15, .cra_type = &crypto_blkcipher_type, .cra_module = THIS_MODULE, + .cra_list = LIST_HEAD_INIT(geode_cbc_alg.cra_list), .cra_u = { .blkcipher = { .min_keysize = AES_MIN_KEY_SIZE, @@ -487,6 +489,7 @@ static struct crypto_alg geode_ecb_alg = { .cra_alignmask = 15, .cra_type = &crypto_blkcipher_type, .cra_module = THIS_MODULE, + .cra_list = LIST_HEAD_INIT(geode_ecb_alg.cra_list), .cra_u = { .blkcipher = { .min_keysize = AES_MIN_KEY_SIZE, @@ -585,8 +588,21 @@ static struct pci_driver geode_aes_driver = { .remove = __devexit_p(geode_aes_remove) }; -module_pci_driver(geode_aes_driver); +static int __init +geode_aes_init(void) +{ + return pci_register_driver(&geode_aes_driver); +} + +static void __exit +geode_aes_exit(void) +{ + pci_unregister_driver(&geode_aes_driver); +} MODULE_AUTHOR("Advanced Micro Devices, Inc."); MODULE_DESCRIPTION("Geode LX Hardware AES driver"); MODULE_LICENSE("GPL"); + +module_init(geode_aes_init); +module_exit(geode_aes_exit); diff --git a/trunk/drivers/crypto/hifn_795x.c b/trunk/drivers/crypto/hifn_795x.c index fda32968a66b..df14358d7fa1 100644 --- a/trunk/drivers/crypto/hifn_795x.c +++ b/trunk/drivers/crypto/hifn_795x.c @@ -2611,17 +2611,14 @@ static int __devinit hifn_probe(struct pci_dev *pdev, const struct pci_device_id size = pci_resource_len(pdev, i); dev->bar[i] = ioremap_nocache(addr, size); - if (!dev->bar[i]) { - err = -ENOMEM; + if (!dev->bar[i]) goto err_out_unmap_bars; - } } dev->desc_virt = pci_alloc_consistent(pdev, sizeof(struct hifn_dma), &dev->desc_dma); if (!dev->desc_virt) { dprintk("Failed to allocate descriptor rings.\n"); - err = -ENOMEM; goto err_out_unmap_bars; } memset(dev->desc_virt, 0, sizeof(struct hifn_dma)); diff --git a/trunk/drivers/crypto/nx/Kconfig b/trunk/drivers/crypto/nx/Kconfig deleted file mode 100644 index f82616621ae1..000000000000 --- a/trunk/drivers/crypto/nx/Kconfig +++ /dev/null @@ -1,26 +0,0 @@ -config CRYPTO_DEV_NX_ENCRYPT - tristate "Encryption acceleration support" - depends on PPC64 && IBMVIO - default y - select CRYPTO_AES - select CRYPTO_CBC - select CRYPTO_ECB - select CRYPTO_CCM - select CRYPTO_GCM - select CRYPTO_AUTHENC - select CRYPTO_XCBC - select CRYPTO_SHA256 - select CRYPTO_SHA512 - help - Support for Power7+ in-Nest encryption acceleration. This - module supports acceleration for AES and SHA2 algorithms. If you - choose 'M' here, this module will be called nx_crypto. - -config CRYPTO_DEV_NX_COMPRESS - tristate "Compression acceleration support" - depends on PPC64 && IBMVIO - default y - help - Support for Power7+ in-Nest compression acceleration. This - module supports acceleration for AES and SHA2 algorithms. If you - choose 'M' here, this module will be called nx_compress. diff --git a/trunk/drivers/crypto/nx/Makefile b/trunk/drivers/crypto/nx/Makefile index bb770ea45ce9..411ce59c80d1 100644 --- a/trunk/drivers/crypto/nx/Makefile +++ b/trunk/drivers/crypto/nx/Makefile @@ -1,4 +1,4 @@ -obj-$(CONFIG_CRYPTO_DEV_NX_ENCRYPT) += nx-crypto.o +obj-$(CONFIG_CRYPTO_DEV_NX) += nx-crypto.o nx-crypto-objs := nx.o \ nx_debugfs.o \ nx-aes-cbc.o \ @@ -9,6 +9,3 @@ nx-crypto-objs := nx.o \ nx-aes-xcbc.o \ nx-sha256.o \ nx-sha512.o - -obj-$(CONFIG_CRYPTO_DEV_NX_COMPRESS) += nx-compress.o -nx-compress-objs := nx-842.o diff --git a/trunk/drivers/crypto/nx/nx-842.c b/trunk/drivers/crypto/nx/nx-842.c deleted file mode 100644 index 0ce625738677..000000000000 --- a/trunk/drivers/crypto/nx/nx-842.c +++ /dev/null @@ -1,1617 +0,0 @@ -/* - * Driver for IBM Power 842 compression accelerator - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * Copyright (C) IBM Corporation, 2012 - * - * Authors: Robert Jennings - * Seth Jennings - */ - -#include -#include -#include -#include -#include - -#include -#include -#include - -#include "nx_csbcpb.h" /* struct nx_csbcpb */ - -#define MODULE_NAME "nx-compress" -MODULE_LICENSE("GPL"); -MODULE_AUTHOR("Robert Jennings "); -MODULE_DESCRIPTION("842 H/W Compression driver for IBM Power processors"); - -#define SHIFT_4K 12 -#define SHIFT_64K 16 -#define SIZE_4K (1UL << SHIFT_4K) -#define SIZE_64K (1UL << SHIFT_64K) - -/* IO buffer must be 128 byte aligned */ -#define IO_BUFFER_ALIGN 128 - -struct nx842_header { - int blocks_nr; /* number of compressed blocks */ - int offset; /* offset of the first block (from beginning of header) */ - int sizes[0]; /* size of compressed blocks */ -}; - -static inline int nx842_header_size(const struct nx842_header *hdr) -{ - return sizeof(struct nx842_header) + - hdr->blocks_nr * sizeof(hdr->sizes[0]); -} - -/* Macros for fields within nx_csbcpb */ -/* Check the valid bit within the csbcpb valid field */ -#define NX842_CSBCBP_VALID_CHK(x) (x & BIT_MASK(7)) - -/* CE macros operate on the completion_extension field bits in the csbcpb. - * CE0 0=full completion, 1=partial completion - * CE1 0=CE0 indicates completion, 1=termination (output may be modified) - * CE2 0=processed_bytes is source bytes, 1=processed_bytes is target bytes */ -#define NX842_CSBCPB_CE0(x) (x & BIT_MASK(7)) -#define NX842_CSBCPB_CE1(x) (x & BIT_MASK(6)) -#define NX842_CSBCPB_CE2(x) (x & BIT_MASK(5)) - -/* The NX unit accepts data only on 4K page boundaries */ -#define NX842_HW_PAGE_SHIFT SHIFT_4K -#define NX842_HW_PAGE_SIZE (ASM_CONST(1) << NX842_HW_PAGE_SHIFT) -#define NX842_HW_PAGE_MASK (~(NX842_HW_PAGE_SIZE-1)) - -enum nx842_status { - UNAVAILABLE, - AVAILABLE -}; - -struct ibm_nx842_counters { - atomic64_t comp_complete; - atomic64_t comp_failed; - atomic64_t decomp_complete; - atomic64_t decomp_failed; - atomic64_t swdecomp; - atomic64_t comp_times[32]; - atomic64_t decomp_times[32]; -}; - -static struct nx842_devdata { - struct vio_dev *vdev; - struct device *dev; - struct ibm_nx842_counters *counters; - unsigned int max_sg_len; - unsigned int max_sync_size; - unsigned int max_sync_sg; - enum nx842_status status; -} __rcu *devdata; -static DEFINE_SPINLOCK(devdata_mutex); - -#define NX842_COUNTER_INC(_x) \ -static inline void nx842_inc_##_x( \ - const struct nx842_devdata *dev) { \ - if (dev) \ - atomic64_inc(&dev->counters->_x); \ -} -NX842_COUNTER_INC(comp_complete); -NX842_COUNTER_INC(comp_failed); -NX842_COUNTER_INC(decomp_complete); -NX842_COUNTER_INC(decomp_failed); -NX842_COUNTER_INC(swdecomp); - -#define NX842_HIST_SLOTS 16 - -static void ibm_nx842_incr_hist(atomic64_t *times, unsigned int time) -{ - int bucket = fls(time); - - if (bucket) - bucket = min((NX842_HIST_SLOTS - 1), bucket - 1); - - atomic64_inc(×[bucket]); -} - -/* NX unit operation flags */ -#define NX842_OP_COMPRESS 0x0 -#define NX842_OP_CRC 0x1 -#define NX842_OP_DECOMPRESS 0x2 -#define NX842_OP_COMPRESS_CRC (NX842_OP_COMPRESS | NX842_OP_CRC) -#define NX842_OP_DECOMPRESS_CRC (NX842_OP_DECOMPRESS | NX842_OP_CRC) -#define NX842_OP_ASYNC (1<<23) -#define NX842_OP_NOTIFY (1<<22) -#define NX842_OP_NOTIFY_INT(x) ((x & 0xff)<<8) - -static unsigned long nx842_get_desired_dma(struct vio_dev *viodev) -{ - /* No use of DMA mappings within the driver. */ - return 0; -} - -struct nx842_slentry { - unsigned long ptr; /* Real address (use __pa()) */ - unsigned long len; -}; - -/* pHyp scatterlist entry */ -struct nx842_scatterlist { - int entry_nr; /* number of slentries */ - struct nx842_slentry *entries; /* ptr to array of slentries */ -}; - -/* Does not include sizeof(entry_nr) in the size */ -static inline unsigned long nx842_get_scatterlist_size( - struct nx842_scatterlist *sl) -{ - return sl->entry_nr * sizeof(struct nx842_slentry); -} - -static int nx842_build_scatterlist(unsigned long buf, int len, - struct nx842_scatterlist *sl) -{ - unsigned long nextpage; - struct nx842_slentry *entry; - - sl->entry_nr = 0; - - entry = sl->entries; - while (len) { - entry->ptr = __pa(buf); - nextpage = ALIGN(buf + 1, NX842_HW_PAGE_SIZE); - if (nextpage < buf + len) { - /* we aren't at the end yet */ - if (IS_ALIGNED(buf, NX842_HW_PAGE_SIZE)) - /* we are in the middle (or beginning) */ - entry->len = NX842_HW_PAGE_SIZE; - else - /* we are at the beginning */ - entry->len = nextpage - buf; - } else { - /* at the end */ - entry->len = len; - } - - len -= entry->len; - buf += entry->len; - sl->entry_nr++; - entry++; - } - - return 0; -} - -/* - * Working memory for software decompression - */ -struct sw842_fifo { - union { - char f8[256][8]; - char f4[512][4]; - }; - char f2[256][2]; - unsigned char f84_full; - unsigned char f2_full; - unsigned char f8_count; - unsigned char f2_count; - unsigned int f4_count; -}; - -/* - * Working memory for crypto API - */ -struct nx842_workmem { - char bounce[PAGE_SIZE]; /* bounce buffer for decompression input */ - union { - /* hardware working memory */ - struct { - /* scatterlist */ - char slin[SIZE_4K]; - char slout[SIZE_4K]; - /* coprocessor status/parameter block */ - struct nx_csbcpb csbcpb; - }; - /* software working memory */ - struct sw842_fifo swfifo; /* software decompression fifo */ - }; -}; - -int nx842_get_workmem_size(void) -{ - return sizeof(struct nx842_workmem) + NX842_HW_PAGE_SIZE; -} -EXPORT_SYMBOL_GPL(nx842_get_workmem_size); - -int nx842_get_workmem_size_aligned(void) -{ - return sizeof(struct nx842_workmem); -} -EXPORT_SYMBOL_GPL(nx842_get_workmem_size_aligned); - -static int nx842_validate_result(struct device *dev, - struct cop_status_block *csb) -{ - /* The csb must be valid after returning from vio_h_cop_sync */ - if (!NX842_CSBCBP_VALID_CHK(csb->valid)) { - dev_err(dev, "%s: cspcbp not valid upon completion.\n", - __func__); - dev_dbg(dev, "valid:0x%02x cs:0x%02x cc:0x%02x ce:0x%02x\n", - csb->valid, - csb->crb_seq_number, - csb->completion_code, - csb->completion_extension); - dev_dbg(dev, "processed_bytes:%d address:0x%016lx\n", - csb->processed_byte_count, - (unsigned long)csb->address); - return -EIO; - } - - /* Check return values from the hardware in the CSB */ - switch (csb->completion_code) { - case 0: /* Completed without error */ - break; - case 64: /* Target bytes > Source bytes during compression */ - case 13: /* Output buffer too small */ - dev_dbg(dev, "%s: Compression output larger than input\n", - __func__); - return -ENOSPC; - case 66: /* Input data contains an illegal template field */ - case 67: /* Template indicates data past the end of the input stream */ - dev_dbg(dev, "%s: Bad data for decompression (code:%d)\n", - __func__, csb->completion_code); - return -EINVAL; - default: - dev_dbg(dev, "%s: Unspecified error (code:%d)\n", - __func__, csb->completion_code); - return -EIO; - } - - /* Hardware sanity check */ - if (!NX842_CSBCPB_CE2(csb->completion_extension)) { - dev_err(dev, "%s: No error returned by hardware, but " - "data returned is unusable, contact support.\n" - "(Additional info: csbcbp->processed bytes " - "does not specify processed bytes for the " - "target buffer.)\n", __func__); - return -EIO; - } - - return 0; -} - -/** - * nx842_compress - Compress data using the 842 algorithm - * - * Compression provide by the NX842 coprocessor on IBM Power systems. - * The input buffer is compressed and the result is stored in the - * provided output buffer. - * - * Upon return from this function @outlen contains the length of the - * compressed data. If there is an error then @outlen will be 0 and an - * error will be specified by the return code from this function. - * - * @in: Pointer to input buffer, must be page aligned - * @inlen: Length of input buffer, must be PAGE_SIZE - * @out: Pointer to output buffer - * @outlen: Length of output buffer - * @wrkmem: ptr to buffer for working memory, size determined by - * nx842_get_workmem_size() - * - * Returns: - * 0 Success, output of length @outlen stored in the buffer at @out - * -ENOMEM Unable to allocate internal buffers - * -ENOSPC Output buffer is to small - * -EMSGSIZE XXX Difficult to describe this limitation - * -EIO Internal error - * -ENODEV Hardware unavailable - */ -int nx842_compress(const unsigned char *in, unsigned int inlen, - unsigned char *out, unsigned int *outlen, void *wmem) -{ - struct nx842_header *hdr; - struct nx842_devdata *local_devdata; - struct device *dev = NULL; - struct nx842_workmem *workmem; - struct nx842_scatterlist slin, slout; - struct nx_csbcpb *csbcpb; - int ret = 0, max_sync_size, i, bytesleft, size, hdrsize; - unsigned long inbuf, outbuf, padding; - struct vio_pfo_op op = { - .done = NULL, - .handle = 0, - .timeout = 0, - }; - unsigned long start_time = get_tb(); - - /* - * Make sure input buffer is 64k page aligned. This is assumed since - * this driver is designed for page compression only (for now). This - * is very nice since we can now use direct DDE(s) for the input and - * the alignment is guaranteed. - */ - inbuf = (unsigned long)in; - if (!IS_ALIGNED(inbuf, PAGE_SIZE) || inlen != PAGE_SIZE) - return -EINVAL; - - rcu_read_lock(); - local_devdata = rcu_dereference(devdata); - if (!local_devdata || !local_devdata->dev) { - rcu_read_unlock(); - return -ENODEV; - } - max_sync_size = local_devdata->max_sync_size; - dev = local_devdata->dev; - - /* Create the header */ - hdr = (struct nx842_header *)out; - hdr->blocks_nr = PAGE_SIZE / max_sync_size; - hdrsize = nx842_header_size(hdr); - outbuf = (unsigned long)out + hdrsize; - bytesleft = *outlen - hdrsize; - - /* Init scatterlist */ - workmem = (struct nx842_workmem *)ALIGN((unsigned long)wmem, - NX842_HW_PAGE_SIZE); - slin.entries = (struct nx842_slentry *)workmem->slin; - slout.entries = (struct nx842_slentry *)workmem->slout; - - /* Init operation */ - op.flags = NX842_OP_COMPRESS; - csbcpb = &workmem->csbcpb; - memset(csbcpb, 0, sizeof(*csbcpb)); - op.csbcpb = __pa(csbcpb); - op.out = __pa(slout.entries); - - for (i = 0; i < hdr->blocks_nr; i++) { - /* - * Aligning the output blocks to 128 bytes does waste space, - * but it prevents the need for bounce buffers and memory - * copies. It also simplifies the code a lot. In the worst - * case (64k page, 4k max_sync_size), you lose up to - * (128*16)/64k = ~3% the compression factor. For 64k - * max_sync_size, the loss would be at most 128/64k = ~0.2%. - */ - padding = ALIGN(outbuf, IO_BUFFER_ALIGN) - outbuf; - outbuf += padding; - bytesleft -= padding; - if (i == 0) - /* save offset into first block in header */ - hdr->offset = padding + hdrsize; - - if (bytesleft <= 0) { - ret = -ENOSPC; - goto unlock; - } - - /* - * NOTE: If the default max_sync_size is changed from 4k - * to 64k, remove the "likely" case below, since a - * scatterlist will always be needed. - */ - if (likely(max_sync_size == NX842_HW_PAGE_SIZE)) { - /* Create direct DDE */ - op.in = __pa(inbuf); - op.inlen = max_sync_size; - - } else { - /* Create indirect DDE (scatterlist) */ - nx842_build_scatterlist(inbuf, max_sync_size, &slin); - op.in = __pa(slin.entries); - op.inlen = -nx842_get_scatterlist_size(&slin); - } - - /* - * If max_sync_size != NX842_HW_PAGE_SIZE, an indirect - * DDE is required for the outbuf. - * If max_sync_size == NX842_HW_PAGE_SIZE, outbuf must - * also be page aligned (1 in 128/4k=32 chance) in order - * to use a direct DDE. - * This is unlikely, just use an indirect DDE always. - */ - nx842_build_scatterlist(outbuf, - min(bytesleft, max_sync_size), &slout); - /* op.out set before loop */ - op.outlen = -nx842_get_scatterlist_size(&slout); - - /* Send request to pHyp */ - ret = vio_h_cop_sync(local_devdata->vdev, &op); - - /* Check for pHyp error */ - if (ret) { - dev_dbg(dev, "%s: vio_h_cop_sync error (ret=%d, hret=%ld)\n", - __func__, ret, op.hcall_err); - ret = -EIO; - goto unlock; - } - - /* Check for hardware error */ - ret = nx842_validate_result(dev, &csbcpb->csb); - if (ret && ret != -ENOSPC) - goto unlock; - - /* Handle incompressible data */ - if (unlikely(ret == -ENOSPC)) { - if (bytesleft < max_sync_size) { - /* - * Not enough space left in the output buffer - * to store uncompressed block - */ - goto unlock; - } else { - /* Store incompressible block */ - memcpy((void *)outbuf, (void *)inbuf, - max_sync_size); - hdr->sizes[i] = -max_sync_size; - outbuf += max_sync_size; - bytesleft -= max_sync_size; - /* Reset ret, incompressible data handled */ - ret = 0; - } - } else { - /* Normal case, compression was successful */ - size = csbcpb->csb.processed_byte_count; - dev_dbg(dev, "%s: processed_bytes=%d\n", - __func__, size); - hdr->sizes[i] = size; - outbuf += size; - bytesleft -= size; - } - - inbuf += max_sync_size; - } - - *outlen = (unsigned int)(outbuf - (unsigned long)out); - -unlock: - if (ret) - nx842_inc_comp_failed(local_devdata); - else { - nx842_inc_comp_complete(local_devdata); - ibm_nx842_incr_hist(local_devdata->counters->comp_times, - (get_tb() - start_time) / tb_ticks_per_usec); - } - rcu_read_unlock(); - return ret; -} -EXPORT_SYMBOL_GPL(nx842_compress); - -static int sw842_decompress(const unsigned char *, int, unsigned char *, int *, - const void *); - -/** - * nx842_decompress - Decompress data using the 842 algorithm - * - * Decompression provide by the NX842 coprocessor on IBM Power systems. - * The input buffer is decompressed and the result is stored in the - * provided output buffer. The size allocated to the output buffer is - * provided by the caller of this function in @outlen. Upon return from - * this function @outlen contains the length of the decompressed data. - * If there is an error then @outlen will be 0 and an error will be - * specified by the return code from this function. - * - * @in: Pointer to input buffer, will use bounce buffer if not 128 byte - * aligned - * @inlen: Length of input buffer - * @out: Pointer to output buffer, must be page aligned - * @outlen: Length of output buffer, must be PAGE_SIZE - * @wrkmem: ptr to buffer for working memory, size determined by - * nx842_get_workmem_size() - * - * Returns: - * 0 Success, output of length @outlen stored in the buffer at @out - * -ENODEV Hardware decompression device is unavailable - * -ENOMEM Unable to allocate internal buffers - * -ENOSPC Output buffer is to small - * -EINVAL Bad input data encountered when attempting decompress - * -EIO Internal error - */ -int nx842_decompress(const unsigned char *in, unsigned int inlen, - unsigned char *out, unsigned int *outlen, void *wmem) -{ - struct nx842_header *hdr; - struct nx842_devdata *local_devdata; - struct device *dev = NULL; - struct nx842_workmem *workmem; - struct nx842_scatterlist slin, slout; - struct nx_csbcpb *csbcpb; - int ret = 0, i, size, max_sync_size; - unsigned long inbuf, outbuf; - struct vio_pfo_op op = { - .done = NULL, - .handle = 0, - .timeout = 0, - }; - unsigned long start_time = get_tb(); - - /* Ensure page alignment and size */ - outbuf = (unsigned long)out; - if (!IS_ALIGNED(outbuf, PAGE_SIZE) || *outlen != PAGE_SIZE) - return -EINVAL; - - rcu_read_lock(); - local_devdata = rcu_dereference(devdata); - if (local_devdata) - dev = local_devdata->dev; - - /* Get header */ - hdr = (struct nx842_header *)in; - - workmem = (struct nx842_workmem *)ALIGN((unsigned long)wmem, - NX842_HW_PAGE_SIZE); - - inbuf = (unsigned long)in + hdr->offset; - if (likely(!IS_ALIGNED(inbuf, IO_BUFFER_ALIGN))) { - /* Copy block(s) into bounce buffer for alignment */ - memcpy(workmem->bounce, in + hdr->offset, inlen - hdr->offset); - inbuf = (unsigned long)workmem->bounce; - } - - /* Init scatterlist */ - slin.entries = (struct nx842_slentry *)workmem->slin; - slout.entries = (struct nx842_slentry *)workmem->slout; - - /* Init operation */ - op.flags = NX842_OP_DECOMPRESS; - csbcpb = &workmem->csbcpb; - memset(csbcpb, 0, sizeof(*csbcpb)); - op.csbcpb = __pa(csbcpb); - - /* - * max_sync_size may have changed since compression, - * so we can't read it from the device info. We need - * to derive it from hdr->blocks_nr. - */ - max_sync_size = PAGE_SIZE / hdr->blocks_nr; - - for (i = 0; i < hdr->blocks_nr; i++) { - /* Skip padding */ - inbuf = ALIGN(inbuf, IO_BUFFER_ALIGN); - - if (hdr->sizes[i] < 0) { - /* Negative sizes indicate uncompressed data blocks */ - size = abs(hdr->sizes[i]); - memcpy((void *)outbuf, (void *)inbuf, size); - outbuf += size; - inbuf += size; - continue; - } - - if (!dev) - goto sw; - - /* - * The better the compression, the more likely the "likely" - * case becomes. - */ - if (likely((inbuf & NX842_HW_PAGE_MASK) == - ((inbuf + hdr->sizes[i] - 1) & NX842_HW_PAGE_MASK))) { - /* Create direct DDE */ - op.in = __pa(inbuf); - op.inlen = hdr->sizes[i]; - } else { - /* Create indirect DDE (scatterlist) */ - nx842_build_scatterlist(inbuf, hdr->sizes[i] , &slin); - op.in = __pa(slin.entries); - op.inlen = -nx842_get_scatterlist_size(&slin); - } - - /* - * NOTE: If the default max_sync_size is changed from 4k - * to 64k, remove the "likely" case below, since a - * scatterlist will always be needed. - */ - if (likely(max_sync_size == NX842_HW_PAGE_SIZE)) { - /* Create direct DDE */ - op.out = __pa(outbuf); - op.outlen = max_sync_size; - } else { - /* Create indirect DDE (scatterlist) */ - nx842_build_scatterlist(outbuf, max_sync_size, &slout); - op.out = __pa(slout.entries); - op.outlen = -nx842_get_scatterlist_size(&slout); - } - - /* Send request to pHyp */ - ret = vio_h_cop_sync(local_devdata->vdev, &op); - - /* Check for pHyp error */ - if (ret) { - dev_dbg(dev, "%s: vio_h_cop_sync error (ret=%d, hret=%ld)\n", - __func__, ret, op.hcall_err); - dev = NULL; - goto sw; - } - - /* Check for hardware error */ - ret = nx842_validate_result(dev, &csbcpb->csb); - if (ret) { - dev = NULL; - goto sw; - } - - /* HW decompression success */ - inbuf += hdr->sizes[i]; - outbuf += csbcpb->csb.processed_byte_count; - continue; - -sw: - /* software decompression */ - size = max_sync_size; - ret = sw842_decompress( - (unsigned char *)inbuf, hdr->sizes[i], - (unsigned char *)outbuf, &size, wmem); - if (ret) - pr_debug("%s: sw842_decompress failed with %d\n", - __func__, ret); - - if (ret) { - if (ret != -ENOSPC && ret != -EINVAL && - ret != -EMSGSIZE) - ret = -EIO; - goto unlock; - } - - /* SW decompression success */ - inbuf += hdr->sizes[i]; - outbuf += size; - } - - *outlen = (unsigned int)(outbuf - (unsigned long)out); - -unlock: - if (ret) - /* decompress fail */ - nx842_inc_decomp_failed(local_devdata); - else { - if (!dev) - /* software decompress */ - nx842_inc_swdecomp(local_devdata); - nx842_inc_decomp_complete(local_devdata); - ibm_nx842_incr_hist(local_devdata->counters->decomp_times, - (get_tb() - start_time) / tb_ticks_per_usec); - } - - rcu_read_unlock(); - return ret; -} -EXPORT_SYMBOL_GPL(nx842_decompress); - -/** - * nx842_OF_set_defaults -- Set default (disabled) values for devdata - * - * @devdata - struct nx842_devdata to update - * - * Returns: - * 0 on success - * -ENOENT if @devdata ptr is NULL - */ -static int nx842_OF_set_defaults(struct nx842_devdata *devdata) -{ - if (devdata) { - devdata->max_sync_size = 0; - devdata->max_sync_sg = 0; - devdata->max_sg_len = 0; - devdata->status = UNAVAILABLE; - return 0; - } else - return -ENOENT; -} - -/** - * nx842_OF_upd_status -- Update the device info from OF status prop - * - * The status property indicates if the accelerator is enabled. If the - * device is in the OF tree it indicates that the hardware is present. - * The status field indicates if the device is enabled when the status - * is 'okay'. Otherwise the device driver will be disabled. - * - * @devdata - struct nx842_devdata to update - * @prop - struct property point containing the maxsyncop for the update - * - * Returns: - * 0 - Device is available - * -EINVAL - Device is not available - */ -static int nx842_OF_upd_status(struct nx842_devdata *devdata, - struct property *prop) { - int ret = 0; - const char *status = (const char *)prop->value; - - if (!strncmp(status, "okay", (size_t)prop->length)) { - devdata->status = AVAILABLE; - } else { - dev_info(devdata->dev, "%s: status '%s' is not 'okay'\n", - __func__, status); - devdata->status = UNAVAILABLE; - } - - return ret; -} - -/** - * nx842_OF_upd_maxsglen -- Update the device info from OF maxsglen prop - * - * Definition of the 'ibm,max-sg-len' OF property: - * This field indicates the maximum byte length of a scatter list - * for the platform facility. It is a single cell encoded as with encode-int. - * - * Example: - * # od -x ibm,max-sg-len - * 0000000 0000 0ff0 - * - * In this example, the maximum byte length of a scatter list is - * 0x0ff0 (4,080). - * - * @devdata - struct nx842_devdata to update - * @prop - struct property point containing the maxsyncop for the update - * - * Returns: - * 0 on success - * -EINVAL on failure - */ -static int nx842_OF_upd_maxsglen(struct nx842_devdata *devdata, - struct property *prop) { - int ret = 0; - const int *maxsglen = prop->value; - - if (prop->length != sizeof(*maxsglen)) { - dev_err(devdata->dev, "%s: unexpected format for ibm,max-sg-len property\n", __func__); - dev_dbg(devdata->dev, "%s: ibm,max-sg-len is %d bytes long, expected %lu bytes\n", __func__, - prop->length, sizeof(*maxsglen)); - ret = -EINVAL; - } else { - devdata->max_sg_len = (unsigned int)min(*maxsglen, - (int)NX842_HW_PAGE_SIZE); - } - - return ret; -} - -/** - * nx842_OF_upd_maxsyncop -- Update the device info from OF maxsyncop prop - * - * Definition of the 'ibm,max-sync-cop' OF property: - * Two series of cells. The first series of cells represents the maximums - * that can be synchronously compressed. The second series of cells - * represents the maximums that can be synchronously decompressed. - * 1. The first cell in each series contains the count of the number of - * data length, scatter list elements pairs that follow – each being - * of the form - * a. One cell data byte length - * b. One cell total number of scatter list elements - * - * Example: - * # od -x ibm,max-sync-cop - * 0000000 0000 0001 0000 1000 0000 01fe 0000 0001 - * 0000020 0000 1000 0000 01fe - * - * In this example, compression supports 0x1000 (4,096) data byte length - * and 0x1fe (510) total scatter list elements. Decompression supports - * 0x1000 (4,096) data byte length and 0x1f3 (510) total scatter list - * elements. - * - * @devdata - struct nx842_devdata to update - * @prop - struct property point containing the maxsyncop for the update - * - * Returns: - * 0 on success - * -EINVAL on failure - */ -static int nx842_OF_upd_maxsyncop(struct nx842_devdata *devdata, - struct property *prop) { - int ret = 0; - const struct maxsynccop_t { - int comp_elements; - int comp_data_limit; - int comp_sg_limit; - int decomp_elements; - int decomp_data_limit; - int decomp_sg_limit; - } *maxsynccop; - - if (prop->length != sizeof(*maxsynccop)) { - dev_err(devdata->dev, "%s: unexpected format for ibm,max-sync-cop property\n", __func__); - dev_dbg(devdata->dev, "%s: ibm,max-sync-cop is %d bytes long, expected %lu bytes\n", __func__, prop->length, - sizeof(*maxsynccop)); - ret = -EINVAL; - goto out; - } - - maxsynccop = (const struct maxsynccop_t *)prop->value; - - /* Use one limit rather than separate limits for compression and - * decompression. Set a maximum for this so as not to exceed the - * size that the header can support and round the value down to - * the hardware page size (4K) */ - devdata->max_sync_size = - (unsigned int)min(maxsynccop->comp_data_limit, - maxsynccop->decomp_data_limit); - - devdata->max_sync_size = min_t(unsigned int, devdata->max_sync_size, - SIZE_64K); - - if (devdata->max_sync_size < SIZE_4K) { - dev_err(devdata->dev, "%s: hardware max data size (%u) is " - "less than the driver minimum, unable to use " - "the hardware device\n", - __func__, devdata->max_sync_size); - ret = -EINVAL; - goto out; - } - - devdata->max_sync_sg = (unsigned int)min(maxsynccop->comp_sg_limit, - maxsynccop->decomp_sg_limit); - if (devdata->max_sync_sg < 1) { - dev_err(devdata->dev, "%s: hardware max sg size (%u) is " - "less than the driver minimum, unable to use " - "the hardware device\n", - __func__, devdata->max_sync_sg); - ret = -EINVAL; - goto out; - } - -out: - return ret; -} - -/** - * - * nx842_OF_upd -- Handle OF properties updates for the device. - * - * Set all properties from the OF tree. Optionally, a new property - * can be provided by the @new_prop pointer to overwrite an existing value. - * The device will remain disabled until all values are valid, this function - * will return an error for updates unless all values are valid. - * - * @new_prop: If not NULL, this property is being updated. If NULL, update - * all properties from the current values in the OF tree. - * - * Returns: - * 0 - Success - * -ENOMEM - Could not allocate memory for new devdata structure - * -EINVAL - property value not found, new_prop is not a recognized - * property for the device or property value is not valid. - * -ENODEV - Device is not available - */ -static int nx842_OF_upd(struct property *new_prop) -{ - struct nx842_devdata *old_devdata = NULL; - struct nx842_devdata *new_devdata = NULL; - struct device_node *of_node = NULL; - struct property *status = NULL; - struct property *maxsglen = NULL; - struct property *maxsyncop = NULL; - int ret = 0; - unsigned long flags; - - spin_lock_irqsave(&devdata_mutex, flags); - old_devdata = rcu_dereference_check(devdata, - lockdep_is_held(&devdata_mutex)); - if (old_devdata) - of_node = old_devdata->dev->of_node; - - if (!old_devdata || !of_node) { - pr_err("%s: device is not available\n", __func__); - spin_unlock_irqrestore(&devdata_mutex, flags); - return -ENODEV; - } - - new_devdata = kzalloc(sizeof(*new_devdata), GFP_NOFS); - if (!new_devdata) { - dev_err(old_devdata->dev, "%s: Could not allocate memory for device data\n", __func__); - ret = -ENOMEM; - goto error_out; - } - - memcpy(new_devdata, old_devdata, sizeof(*old_devdata)); - new_devdata->counters = old_devdata->counters; - - /* Set ptrs for existing properties */ - status = of_find_property(of_node, "status", NULL); - maxsglen = of_find_property(of_node, "ibm,max-sg-len", NULL); - maxsyncop = of_find_property(of_node, "ibm,max-sync-cop", NULL); - if (!status || !maxsglen || !maxsyncop) { - dev_err(old_devdata->dev, "%s: Could not locate device properties\n", __func__); - ret = -EINVAL; - goto error_out; - } - - /* Set ptr to new property if provided */ - if (new_prop) { - /* Single property */ - if (!strncmp(new_prop->name, "status", new_prop->length)) { - status = new_prop; - - } else if (!strncmp(new_prop->name, "ibm,max-sg-len", - new_prop->length)) { - maxsglen = new_prop; - - } else if (!strncmp(new_prop->name, "ibm,max-sync-cop", - new_prop->length)) { - maxsyncop = new_prop; - - } else { - /* - * Skip the update, the property being updated - * has no impact. - */ - goto out; - } - } - - /* Perform property updates */ - ret = nx842_OF_upd_status(new_devdata, status); - if (ret) - goto error_out; - - ret = nx842_OF_upd_maxsglen(new_devdata, maxsglen); - if (ret) - goto error_out; - - ret = nx842_OF_upd_maxsyncop(new_devdata, maxsyncop); - if (ret) - goto error_out; - -out: - dev_info(old_devdata->dev, "%s: max_sync_size new:%u old:%u\n", - __func__, new_devdata->max_sync_size, - old_devdata->max_sync_size); - dev_info(old_devdata->dev, "%s: max_sync_sg new:%u old:%u\n", - __func__, new_devdata->max_sync_sg, - old_devdata->max_sync_sg); - dev_info(old_devdata->dev, "%s: max_sg_len new:%u old:%u\n", - __func__, new_devdata->max_sg_len, - old_devdata->max_sg_len); - - rcu_assign_pointer(devdata, new_devdata); - spin_unlock_irqrestore(&devdata_mutex, flags); - synchronize_rcu(); - dev_set_drvdata(new_devdata->dev, new_devdata); - kfree(old_devdata); - return 0; - -error_out: - if (new_devdata) { - dev_info(old_devdata->dev, "%s: device disabled\n", __func__); - nx842_OF_set_defaults(new_devdata); - rcu_assign_pointer(devdata, new_devdata); - spin_unlock_irqrestore(&devdata_mutex, flags); - synchronize_rcu(); - dev_set_drvdata(new_devdata->dev, new_devdata); - kfree(old_devdata); - } else { - dev_err(old_devdata->dev, "%s: could not update driver from hardware\n", __func__); - spin_unlock_irqrestore(&devdata_mutex, flags); - } - - if (!ret) - ret = -EINVAL; - return ret; -} - -/** - * nx842_OF_notifier - Process updates to OF properties for the device - * - * @np: notifier block - * @action: notifier action - * @update: struct pSeries_reconfig_prop_update pointer if action is - * PSERIES_UPDATE_PROPERTY - * - * Returns: - * NOTIFY_OK on success - * NOTIFY_BAD encoded with error number on failure, use - * notifier_to_errno() to decode this value - */ -static int nx842_OF_notifier(struct notifier_block *np, - unsigned long action, - void *update) -{ - struct pSeries_reconfig_prop_update *upd; - struct nx842_devdata *local_devdata; - struct device_node *node = NULL; - - upd = (struct pSeries_reconfig_prop_update *)update; - - rcu_read_lock(); - local_devdata = rcu_dereference(devdata); - if (local_devdata) - node = local_devdata->dev->of_node; - - if (local_devdata && - action == PSERIES_UPDATE_PROPERTY && - !strcmp(upd->node->name, node->name)) { - rcu_read_unlock(); - nx842_OF_upd(upd->property); - } else - rcu_read_unlock(); - - return NOTIFY_OK; -} - -static struct notifier_block nx842_of_nb = { - .notifier_call = nx842_OF_notifier, -}; - -#define nx842_counter_read(_name) \ -static ssize_t nx842_##_name##_show(struct device *dev, \ - struct device_attribute *attr, \ - char *buf) { \ - struct nx842_devdata *local_devdata; \ - int p = 0; \ - rcu_read_lock(); \ - local_devdata = rcu_dereference(devdata); \ - if (local_devdata) \ - p = snprintf(buf, PAGE_SIZE, "%ld\n", \ - atomic64_read(&local_devdata->counters->_name)); \ - rcu_read_unlock(); \ - return p; \ -} - -#define NX842DEV_COUNTER_ATTR_RO(_name) \ - nx842_counter_read(_name); \ - static struct device_attribute dev_attr_##_name = __ATTR(_name, \ - 0444, \ - nx842_##_name##_show,\ - NULL); - -NX842DEV_COUNTER_ATTR_RO(comp_complete); -NX842DEV_COUNTER_ATTR_RO(comp_failed); -NX842DEV_COUNTER_ATTR_RO(decomp_complete); -NX842DEV_COUNTER_ATTR_RO(decomp_failed); -NX842DEV_COUNTER_ATTR_RO(swdecomp); - -static ssize_t nx842_timehist_show(struct device *, - struct device_attribute *, char *); - -static struct device_attribute dev_attr_comp_times = __ATTR(comp_times, 0444, - nx842_timehist_show, NULL); -static struct device_attribute dev_attr_decomp_times = __ATTR(decomp_times, - 0444, nx842_timehist_show, NULL); - -static ssize_t nx842_timehist_show(struct device *dev, - struct device_attribute *attr, char *buf) { - char *p = buf; - struct nx842_devdata *local_devdata; - atomic64_t *times; - int bytes_remain = PAGE_SIZE; - int bytes; - int i; - - rcu_read_lock(); - local_devdata = rcu_dereference(devdata); - if (!local_devdata) { - rcu_read_unlock(); - return 0; - } - - if (attr == &dev_attr_comp_times) - times = local_devdata->counters->comp_times; - else if (attr == &dev_attr_decomp_times) - times = local_devdata->counters->decomp_times; - else { - rcu_read_unlock(); - return 0; - } - - for (i = 0; i < (NX842_HIST_SLOTS - 2); i++) { - bytes = snprintf(p, bytes_remain, "%u-%uus:\t%ld\n", - i ? (2<<(i-1)) : 0, (2<vdev != NULL) { - dev_err(&viodev->dev, "%s: Attempt to register more than one instance of the hardware\n", __func__); - ret = -1; - goto error_unlock; - } - - dev_set_drvdata(&viodev->dev, NULL); - - new_devdata = kzalloc(sizeof(*new_devdata), GFP_NOFS); - if (!new_devdata) { - dev_err(&viodev->dev, "%s: Could not allocate memory for device data\n", __func__); - ret = -ENOMEM; - goto error_unlock; - } - - new_devdata->counters = kzalloc(sizeof(*new_devdata->counters), - GFP_NOFS); - if (!new_devdata->counters) { - dev_err(&viodev->dev, "%s: Could not allocate memory for performance counters\n", __func__); - ret = -ENOMEM; - goto error_unlock; - } - - new_devdata->vdev = viodev; - new_devdata->dev = &viodev->dev; - nx842_OF_set_defaults(new_devdata); - - rcu_assign_pointer(devdata, new_devdata); - spin_unlock_irqrestore(&devdata_mutex, flags); - synchronize_rcu(); - kfree(old_devdata); - - pSeries_reconfig_notifier_register(&nx842_of_nb); - - ret = nx842_OF_upd(NULL); - if (ret && ret != -ENODEV) { - dev_err(&viodev->dev, "could not parse device tree. %d\n", ret); - ret = -1; - goto error; - } - - rcu_read_lock(); - if (dev_set_drvdata(&viodev->dev, rcu_dereference(devdata))) { - rcu_read_unlock(); - dev_err(&viodev->dev, "failed to set driver data for device\n"); - ret = -1; - goto error; - } - rcu_read_unlock(); - - if (sysfs_create_group(&viodev->dev.kobj, &nx842_attribute_group)) { - dev_err(&viodev->dev, "could not create sysfs device attributes\n"); - ret = -1; - goto error; - } - - return 0; - -error_unlock: - spin_unlock_irqrestore(&devdata_mutex, flags); - if (new_devdata) - kfree(new_devdata->counters); - kfree(new_devdata); -error: - return ret; -} - -static int __exit nx842_remove(struct vio_dev *viodev) -{ - struct nx842_devdata *old_devdata; - unsigned long flags; - - pr_info("Removing IBM Power 842 compression device\n"); - sysfs_remove_group(&viodev->dev.kobj, &nx842_attribute_group); - - spin_lock_irqsave(&devdata_mutex, flags); - old_devdata = rcu_dereference_check(devdata, - lockdep_is_held(&devdata_mutex)); - pSeries_reconfig_notifier_unregister(&nx842_of_nb); - rcu_assign_pointer(devdata, NULL); - spin_unlock_irqrestore(&devdata_mutex, flags); - synchronize_rcu(); - dev_set_drvdata(&viodev->dev, NULL); - if (old_devdata) - kfree(old_devdata->counters); - kfree(old_devdata); - return 0; -} - -static struct vio_device_id nx842_driver_ids[] = { - {"ibm,compression-v1", "ibm,compression"}, - {"", ""}, -}; - -static struct vio_driver nx842_driver = { - .name = MODULE_NAME, - .probe = nx842_probe, - .remove = nx842_remove, - .get_desired_dma = nx842_get_desired_dma, - .id_table = nx842_driver_ids, -}; - -static int __init nx842_init(void) -{ - struct nx842_devdata *new_devdata; - pr_info("Registering IBM Power 842 compression driver\n"); - - RCU_INIT_POINTER(devdata, NULL); - new_devdata = kzalloc(sizeof(*new_devdata), GFP_KERNEL); - if (!new_devdata) { - pr_err("Could not allocate memory for device data\n"); - return -ENOMEM; - } - new_devdata->status = UNAVAILABLE; - RCU_INIT_POINTER(devdata, new_devdata); - - return vio_register_driver(&nx842_driver); -} - -module_init(nx842_init); - -static void __exit nx842_exit(void) -{ - struct nx842_devdata *old_devdata; - unsigned long flags; - - pr_info("Exiting IBM Power 842 compression driver\n"); - spin_lock_irqsave(&devdata_mutex, flags); - old_devdata = rcu_dereference_check(devdata, - lockdep_is_held(&devdata_mutex)); - rcu_assign_pointer(devdata, NULL); - spin_unlock_irqrestore(&devdata_mutex, flags); - synchronize_rcu(); - if (old_devdata) - dev_set_drvdata(old_devdata->dev, NULL); - kfree(old_devdata); - vio_unregister_driver(&nx842_driver); -} - -module_exit(nx842_exit); - -/********************************* - * 842 software decompressor -*********************************/ -typedef int (*sw842_template_op)(const char **, int *, unsigned char **, - struct sw842_fifo *); - -static int sw842_data8(const char **, int *, unsigned char **, - struct sw842_fifo *); -static int sw842_data4(const char **, int *, unsigned char **, - struct sw842_fifo *); -static int sw842_data2(const char **, int *, unsigned char **, - struct sw842_fifo *); -static int sw842_ptr8(const char **, int *, unsigned char **, - struct sw842_fifo *); -static int sw842_ptr4(const char **, int *, unsigned char **, - struct sw842_fifo *); -static int sw842_ptr2(const char **, int *, unsigned char **, - struct sw842_fifo *); - -/* special templates */ -#define SW842_TMPL_REPEAT 0x1B -#define SW842_TMPL_ZEROS 0x1C -#define SW842_TMPL_EOF 0x1E - -static sw842_template_op sw842_tmpl_ops[26][4] = { - { sw842_data8, NULL}, /* 0 (00000) */ - { sw842_data4, sw842_data2, sw842_ptr2, NULL}, - { sw842_data4, sw842_ptr2, sw842_data2, NULL}, - { sw842_data4, sw842_ptr2, sw842_ptr2, NULL}, - { sw842_data4, sw842_ptr4, NULL}, - { sw842_data2, sw842_ptr2, sw842_data4, NULL}, - { sw842_data2, sw842_ptr2, sw842_data2, sw842_ptr2}, - { sw842_data2, sw842_ptr2, sw842_ptr2, sw842_data2}, - { sw842_data2, sw842_ptr2, sw842_ptr2, sw842_ptr2,}, - { sw842_data2, sw842_ptr2, sw842_ptr4, NULL}, - { sw842_ptr2, sw842_data2, sw842_data4, NULL}, /* 10 (01010) */ - { sw842_ptr2, sw842_data4, sw842_ptr2, NULL}, - { sw842_ptr2, sw842_data2, sw842_ptr2, sw842_data2}, - { sw842_ptr2, sw842_data2, sw842_ptr2, sw842_ptr2}, - { sw842_ptr2, sw842_data2, sw842_ptr4, NULL}, - { sw842_ptr2, sw842_ptr2, sw842_data4, NULL}, - { sw842_ptr2, sw842_ptr2, sw842_data2, sw842_ptr2}, - { sw842_ptr2, sw842_ptr2, sw842_ptr2, sw842_data2}, - { sw842_ptr2, sw842_ptr2, sw842_ptr2, sw842_ptr2}, - { sw842_ptr2, sw842_ptr2, sw842_ptr4, NULL}, - { sw842_ptr4, sw842_data4, NULL}, /* 20 (10100) */ - { sw842_ptr4, sw842_data2, sw842_ptr2, NULL}, - { sw842_ptr4, sw842_ptr2, sw842_data2, NULL}, - { sw842_ptr4, sw842_ptr2, sw842_ptr2, NULL}, - { sw842_ptr4, sw842_ptr4, NULL}, - { sw842_ptr8, NULL} -}; - -/* Software decompress helpers */ - -static uint8_t sw842_get_byte(const char *buf, int bit) -{ - uint8_t tmpl; - uint16_t tmp; - tmp = htons(*(uint16_t *)(buf)); - tmp = (uint16_t)(tmp << bit); - tmp = ntohs(tmp); - memcpy(&tmpl, &tmp, 1); - return tmpl; -} - -static uint8_t sw842_get_template(const char **buf, int *bit) -{ - uint8_t byte; - byte = sw842_get_byte(*buf, *bit); - byte = byte >> 3; - byte &= 0x1F; - *buf += (*bit + 5) / 8; - *bit = (*bit + 5) % 8; - return byte; -} - -/* repeat_count happens to be 5-bit too (like the template) */ -static uint8_t sw842_get_repeat_count(const char **buf, int *bit) -{ - uint8_t byte; - byte = sw842_get_byte(*buf, *bit); - byte = byte >> 2; - byte &= 0x3F; - *buf += (*bit + 6) / 8; - *bit = (*bit + 6) % 8; - return byte; -} - -static uint8_t sw842_get_ptr2(const char **buf, int *bit) -{ - uint8_t ptr; - ptr = sw842_get_byte(*buf, *bit); - (*buf)++; - return ptr; -} - -static uint16_t sw842_get_ptr4(const char **buf, int *bit, - struct sw842_fifo *fifo) -{ - uint16_t ptr; - ptr = htons(*(uint16_t *)(*buf)); - ptr = (uint16_t)(ptr << *bit); - ptr = ptr >> 7; - ptr &= 0x01FF; - *buf += (*bit + 9) / 8; - *bit = (*bit + 9) % 8; - return ptr; -} - -static uint8_t sw842_get_ptr8(const char **buf, int *bit, - struct sw842_fifo *fifo) -{ - return sw842_get_ptr2(buf, bit); -} - -/* Software decompress template ops */ - -static int sw842_data8(const char **inbuf, int *inbit, - unsigned char **outbuf, struct sw842_fifo *fifo) -{ - int ret; - - ret = sw842_data4(inbuf, inbit, outbuf, fifo); - if (ret) - return ret; - ret = sw842_data4(inbuf, inbit, outbuf, fifo); - return ret; -} - -static int sw842_data4(const char **inbuf, int *inbit, - unsigned char **outbuf, struct sw842_fifo *fifo) -{ - int ret; - - ret = sw842_data2(inbuf, inbit, outbuf, fifo); - if (ret) - return ret; - ret = sw842_data2(inbuf, inbit, outbuf, fifo); - return ret; -} - -static int sw842_data2(const char **inbuf, int *inbit, - unsigned char **outbuf, struct sw842_fifo *fifo) -{ - **outbuf = sw842_get_byte(*inbuf, *inbit); - (*inbuf)++; - (*outbuf)++; - **outbuf = sw842_get_byte(*inbuf, *inbit); - (*inbuf)++; - (*outbuf)++; - return 0; -} - -static int sw842_ptr8(const char **inbuf, int *inbit, - unsigned char **outbuf, struct sw842_fifo *fifo) -{ - uint8_t ptr; - ptr = sw842_get_ptr8(inbuf, inbit, fifo); - if (!fifo->f84_full && (ptr >= fifo->f8_count)) - return 1; - memcpy(*outbuf, fifo->f8[ptr], 8); - *outbuf += 8; - return 0; -} - -static int sw842_ptr4(const char **inbuf, int *inbit, - unsigned char **outbuf, struct sw842_fifo *fifo) -{ - uint16_t ptr; - ptr = sw842_get_ptr4(inbuf, inbit, fifo); - if (!fifo->f84_full && (ptr >= fifo->f4_count)) - return 1; - memcpy(*outbuf, fifo->f4[ptr], 4); - *outbuf += 4; - return 0; -} - -static int sw842_ptr2(const char **inbuf, int *inbit, - unsigned char **outbuf, struct sw842_fifo *fifo) -{ - uint8_t ptr; - ptr = sw842_get_ptr2(inbuf, inbit); - if (!fifo->f2_full && (ptr >= fifo->f2_count)) - return 1; - memcpy(*outbuf, fifo->f2[ptr], 2); - *outbuf += 2; - return 0; -} - -static void sw842_copy_to_fifo(const char *buf, struct sw842_fifo *fifo) -{ - unsigned char initial_f2count = fifo->f2_count; - - memcpy(fifo->f8[fifo->f8_count], buf, 8); - fifo->f4_count += 2; - fifo->f8_count += 1; - - if (!fifo->f84_full && fifo->f4_count >= 512) { - fifo->f84_full = 1; - fifo->f4_count /= 512; - } - - memcpy(fifo->f2[fifo->f2_count++], buf, 2); - memcpy(fifo->f2[fifo->f2_count++], buf + 2, 2); - memcpy(fifo->f2[fifo->f2_count++], buf + 4, 2); - memcpy(fifo->f2[fifo->f2_count++], buf + 6, 2); - if (fifo->f2_count < initial_f2count) - fifo->f2_full = 1; -} - -static int sw842_decompress(const unsigned char *src, int srclen, - unsigned char *dst, int *destlen, - const void *wrkmem) -{ - uint8_t tmpl; - const char *inbuf; - int inbit = 0; - unsigned char *outbuf, *outbuf_end, *origbuf, *prevbuf; - const char *inbuf_end; - sw842_template_op op; - int opindex; - int i, repeat_count; - struct sw842_fifo *fifo; - int ret = 0; - - fifo = &((struct nx842_workmem *)(wrkmem))->swfifo; - memset(fifo, 0, sizeof(*fifo)); - - origbuf = NULL; - inbuf = src; - inbuf_end = src + srclen; - outbuf = dst; - outbuf_end = dst + *destlen; - - while ((tmpl = sw842_get_template(&inbuf, &inbit)) != SW842_TMPL_EOF) { - if (inbuf >= inbuf_end) { - ret = -EINVAL; - goto out; - } - - opindex = 0; - prevbuf = origbuf; - origbuf = outbuf; - switch (tmpl) { - case SW842_TMPL_REPEAT: - if (prevbuf == NULL) { - ret = -EINVAL; - goto out; - } - - repeat_count = sw842_get_repeat_count(&inbuf, - &inbit) + 1; - - /* Did the repeat count advance past the end of input */ - if (inbuf > inbuf_end) { - ret = -EINVAL; - goto out; - } - - for (i = 0; i < repeat_count; i++) { - /* Would this overflow the output buffer */ - if ((outbuf + 8) > outbuf_end) { - ret = -ENOSPC; - goto out; - } - - memcpy(outbuf, prevbuf, 8); - sw842_copy_to_fifo(outbuf, fifo); - outbuf += 8; - } - break; - - case SW842_TMPL_ZEROS: - /* Would this overflow the output buffer */ - if ((outbuf + 8) > outbuf_end) { - ret = -ENOSPC; - goto out; - } - - memset(outbuf, 0, 8); - sw842_copy_to_fifo(outbuf, fifo); - outbuf += 8; - break; - - default: - if (tmpl > 25) { - ret = -EINVAL; - goto out; - } - - /* Does this go past the end of the input buffer */ - if ((inbuf + 2) > inbuf_end) { - ret = -EINVAL; - goto out; - } - - /* Would this overflow the output buffer */ - if ((outbuf + 8) > outbuf_end) { - ret = -ENOSPC; - goto out; - } - - while (opindex < 4 && - (op = sw842_tmpl_ops[tmpl][opindex++]) - != NULL) { - ret = (*op)(&inbuf, &inbit, &outbuf, fifo); - if (ret) { - ret = -EINVAL; - goto out; - } - sw842_copy_to_fifo(origbuf, fifo); - } - } - } - -out: - if (!ret) - *destlen = (unsigned int)(outbuf - dst); - else - *destlen = 0; - - return ret; -} diff --git a/trunk/drivers/crypto/nx/nx-aes-cbc.c b/trunk/drivers/crypto/nx/nx-aes-cbc.c index a76d4c4f29f5..69ed796ee327 100644 --- a/trunk/drivers/crypto/nx/nx-aes-cbc.c +++ b/trunk/drivers/crypto/nx/nx-aes-cbc.c @@ -127,6 +127,7 @@ struct crypto_alg nx_cbc_aes_alg = { .cra_ctxsize = sizeof(struct nx_crypto_ctx), .cra_type = &crypto_blkcipher_type, .cra_module = THIS_MODULE, + .cra_list = LIST_HEAD_INIT(nx_cbc_aes_alg.cra_list), .cra_init = nx_crypto_ctx_aes_cbc_init, .cra_exit = nx_crypto_ctx_exit, .cra_blkcipher = { diff --git a/trunk/drivers/crypto/nx/nx-aes-ccm.c b/trunk/drivers/crypto/nx/nx-aes-ccm.c index ef5eae6d1400..7aeac678b9c0 100644 --- a/trunk/drivers/crypto/nx/nx-aes-ccm.c +++ b/trunk/drivers/crypto/nx/nx-aes-ccm.c @@ -430,6 +430,7 @@ struct crypto_alg nx_ccm_aes_alg = { .cra_ctxsize = sizeof(struct nx_crypto_ctx), .cra_type = &crypto_aead_type, .cra_module = THIS_MODULE, + .cra_list = LIST_HEAD_INIT(nx_ccm_aes_alg.cra_list), .cra_init = nx_crypto_ctx_aes_ccm_init, .cra_exit = nx_crypto_ctx_exit, .cra_aead = { @@ -452,6 +453,7 @@ struct crypto_alg nx_ccm4309_aes_alg = { .cra_ctxsize = sizeof(struct nx_crypto_ctx), .cra_type = &crypto_nivaead_type, .cra_module = THIS_MODULE, + .cra_list = LIST_HEAD_INIT(nx_ccm4309_aes_alg.cra_list), .cra_init = nx_crypto_ctx_aes_ccm_init, .cra_exit = nx_crypto_ctx_exit, .cra_aead = { diff --git a/trunk/drivers/crypto/nx/nx-aes-ctr.c b/trunk/drivers/crypto/nx/nx-aes-ctr.c index b6286f14680b..52d4eb05e8f7 100644 --- a/trunk/drivers/crypto/nx/nx-aes-ctr.c +++ b/trunk/drivers/crypto/nx/nx-aes-ctr.c @@ -141,6 +141,7 @@ struct crypto_alg nx_ctr_aes_alg = { .cra_ctxsize = sizeof(struct nx_crypto_ctx), .cra_type = &crypto_blkcipher_type, .cra_module = THIS_MODULE, + .cra_list = LIST_HEAD_INIT(nx_ctr_aes_alg.cra_list), .cra_init = nx_crypto_ctx_aes_ctr_init, .cra_exit = nx_crypto_ctx_exit, .cra_blkcipher = { @@ -162,6 +163,7 @@ struct crypto_alg nx_ctr3686_aes_alg = { .cra_ctxsize = sizeof(struct nx_crypto_ctx), .cra_type = &crypto_blkcipher_type, .cra_module = THIS_MODULE, + .cra_list = LIST_HEAD_INIT(nx_ctr3686_aes_alg.cra_list), .cra_init = nx_crypto_ctx_aes_ctr_init, .cra_exit = nx_crypto_ctx_exit, .cra_blkcipher = { diff --git a/trunk/drivers/crypto/nx/nx-aes-ecb.c b/trunk/drivers/crypto/nx/nx-aes-ecb.c index ba5f1611336f..7b77bc2d1df4 100644 --- a/trunk/drivers/crypto/nx/nx-aes-ecb.c +++ b/trunk/drivers/crypto/nx/nx-aes-ecb.c @@ -126,6 +126,7 @@ struct crypto_alg nx_ecb_aes_alg = { .cra_ctxsize = sizeof(struct nx_crypto_ctx), .cra_type = &crypto_blkcipher_type, .cra_module = THIS_MODULE, + .cra_list = LIST_HEAD_INIT(nx_ecb_aes_alg.cra_list), .cra_init = nx_crypto_ctx_aes_ecb_init, .cra_exit = nx_crypto_ctx_exit, .cra_blkcipher = { diff --git a/trunk/drivers/crypto/nx/nx-aes-gcm.c b/trunk/drivers/crypto/nx/nx-aes-gcm.c index c8109edc5cfb..9ab1c7341dac 100644 --- a/trunk/drivers/crypto/nx/nx-aes-gcm.c +++ b/trunk/drivers/crypto/nx/nx-aes-gcm.c @@ -316,6 +316,7 @@ struct crypto_alg nx_gcm_aes_alg = { .cra_ctxsize = sizeof(struct nx_crypto_ctx), .cra_type = &crypto_aead_type, .cra_module = THIS_MODULE, + .cra_list = LIST_HEAD_INIT(nx_gcm_aes_alg.cra_list), .cra_init = nx_crypto_ctx_aes_gcm_init, .cra_exit = nx_crypto_ctx_exit, .cra_aead = { @@ -337,6 +338,7 @@ struct crypto_alg nx_gcm4106_aes_alg = { .cra_ctxsize = sizeof(struct nx_crypto_ctx), .cra_type = &crypto_nivaead_type, .cra_module = THIS_MODULE, + .cra_list = LIST_HEAD_INIT(nx_gcm4106_aes_alg.cra_list), .cra_init = nx_crypto_ctx_aes_gcm_init, .cra_exit = nx_crypto_ctx_exit, .cra_aead = { diff --git a/trunk/drivers/crypto/omap-aes.c b/trunk/drivers/crypto/omap-aes.c index 093a8af59cbe..63e57b57a12c 100644 --- a/trunk/drivers/crypto/omap-aes.c +++ b/trunk/drivers/crypto/omap-aes.c @@ -876,6 +876,7 @@ static int omap_aes_probe(struct platform_device *pdev) for (i = 0; i < ARRAY_SIZE(algs); i++) { pr_debug("i: %d\n", i); + INIT_LIST_HEAD(&algs[i].cra_list); err = crypto_register_alg(&algs[i]); if (err) goto err_algs; diff --git a/trunk/drivers/crypto/padlock-aes.c b/trunk/drivers/crypto/padlock-aes.c index 633ba945e153..37b2e9406af6 100644 --- a/trunk/drivers/crypto/padlock-aes.c +++ b/trunk/drivers/crypto/padlock-aes.c @@ -328,6 +328,7 @@ static struct crypto_alg aes_alg = { .cra_ctxsize = sizeof(struct aes_ctx), .cra_alignmask = PADLOCK_ALIGNMENT - 1, .cra_module = THIS_MODULE, + .cra_list = LIST_HEAD_INIT(aes_alg.cra_list), .cra_u = { .cipher = { .cia_min_keysize = AES_MIN_KEY_SIZE, @@ -407,6 +408,7 @@ static struct crypto_alg ecb_aes_alg = { .cra_alignmask = PADLOCK_ALIGNMENT - 1, .cra_type = &crypto_blkcipher_type, .cra_module = THIS_MODULE, + .cra_list = LIST_HEAD_INIT(ecb_aes_alg.cra_list), .cra_u = { .blkcipher = { .min_keysize = AES_MIN_KEY_SIZE, @@ -489,6 +491,7 @@ static struct crypto_alg cbc_aes_alg = { .cra_alignmask = PADLOCK_ALIGNMENT - 1, .cra_type = &crypto_blkcipher_type, .cra_module = THIS_MODULE, + .cra_list = LIST_HEAD_INIT(cbc_aes_alg.cra_list), .cra_u = { .blkcipher = { .min_keysize = AES_MIN_KEY_SIZE, diff --git a/trunk/drivers/crypto/s5p-sss.c b/trunk/drivers/crypto/s5p-sss.c index a22714412cda..bc986f806086 100644 --- a/trunk/drivers/crypto/s5p-sss.c +++ b/trunk/drivers/crypto/s5p-sss.c @@ -626,6 +626,7 @@ static int s5p_aes_probe(struct platform_device *pdev) crypto_init_queue(&pdata->queue, CRYPTO_QUEUE_LEN); for (i = 0; i < ARRAY_SIZE(algs); i++) { + INIT_LIST_HEAD(&algs[i].cra_list); err = crypto_register_alg(&algs[i]); if (err) goto err_algs; diff --git a/trunk/drivers/crypto/talitos.c b/trunk/drivers/crypto/talitos.c index da1112765a44..efff788d2f1d 100644 --- a/trunk/drivers/crypto/talitos.c +++ b/trunk/drivers/crypto/talitos.c @@ -38,7 +38,6 @@ #include #include #include -#include #include #include @@ -715,13 +714,8 @@ static int aead_setkey(struct crypto_aead *authenc, /* * talitos_edesc - s/w-extended descriptor - * @assoc_nents: number of segments in associated data scatterlist * @src_nents: number of segments in input scatterlist * @dst_nents: number of segments in output scatterlist - * @assoc_chained: whether assoc is chained or not - * @src_chained: whether src is chained or not - * @dst_chained: whether dst is chained or not - * @iv_dma: dma address of iv for checking continuity and link table * @dma_len: length of dma mapped link_tbl space * @dma_link_tbl: bus physical address of link_tbl * @desc: h/w descriptor @@ -732,13 +726,10 @@ static int aead_setkey(struct crypto_aead *authenc, * of link_tbl data */ struct talitos_edesc { - int assoc_nents; int src_nents; int dst_nents; - bool assoc_chained; - bool src_chained; - bool dst_chained; - dma_addr_t iv_dma; + int src_is_chained; + int dst_is_chained; int dma_len; dma_addr_t dma_link_tbl; struct talitos_desc desc; @@ -747,7 +738,7 @@ struct talitos_edesc { static int talitos_map_sg(struct device *dev, struct scatterlist *sg, unsigned int nents, enum dma_data_direction dir, - bool chained) + int chained) { if (unlikely(chained)) while (sg) { @@ -777,13 +768,13 @@ static void talitos_sg_unmap(struct device *dev, unsigned int dst_nents = edesc->dst_nents ? : 1; if (src != dst) { - if (edesc->src_chained) + if (edesc->src_is_chained) talitos_unmap_sg_chain(dev, src, DMA_TO_DEVICE); else dma_unmap_sg(dev, src, src_nents, DMA_TO_DEVICE); if (dst) { - if (edesc->dst_chained) + if (edesc->dst_is_chained) talitos_unmap_sg_chain(dev, dst, DMA_FROM_DEVICE); else @@ -791,7 +782,7 @@ static void talitos_sg_unmap(struct device *dev, DMA_FROM_DEVICE); } } else - if (edesc->src_chained) + if (edesc->src_is_chained) talitos_unmap_sg_chain(dev, src, DMA_BIDIRECTIONAL); else dma_unmap_sg(dev, src, src_nents, DMA_BIDIRECTIONAL); @@ -806,13 +797,7 @@ static void ipsec_esp_unmap(struct device *dev, unmap_single_talitos_ptr(dev, &edesc->desc.ptr[2], DMA_TO_DEVICE); unmap_single_talitos_ptr(dev, &edesc->desc.ptr[0], DMA_TO_DEVICE); - if (edesc->assoc_chained) - talitos_unmap_sg_chain(dev, areq->assoc, DMA_TO_DEVICE); - else - /* assoc_nents counts also for IV in non-contiguous cases */ - dma_unmap_sg(dev, areq->assoc, - edesc->assoc_nents ? edesc->assoc_nents - 1 : 1, - DMA_TO_DEVICE); + dma_unmap_sg(dev, areq->assoc, 1, DMA_TO_DEVICE); talitos_sg_unmap(dev, edesc, areq->src, areq->dst); @@ -840,10 +825,9 @@ static void ipsec_esp_encrypt_done(struct device *dev, ipsec_esp_unmap(dev, edesc, areq); /* copy the generated ICV to dst */ - if (edesc->dst_nents) { + if (edesc->dma_len) { icvdata = &edesc->link_tbl[edesc->src_nents + - edesc->dst_nents + 2 + - edesc->assoc_nents]; + edesc->dst_nents + 2]; sg = sg_last(areq->dst, edesc->dst_nents); memcpy((char *)sg_virt(sg) + sg->length - ctx->authsize, icvdata, ctx->authsize); @@ -873,8 +857,7 @@ static void ipsec_esp_decrypt_swauth_done(struct device *dev, /* auth check */ if (edesc->dma_len) icvdata = &edesc->link_tbl[edesc->src_nents + - edesc->dst_nents + 2 + - edesc->assoc_nents]; + edesc->dst_nents + 2]; else icvdata = &edesc->link_tbl[0]; @@ -949,9 +932,10 @@ static int sg_to_link_tbl(struct scatterlist *sg, int sg_count, * fill in and submit ipsec_esp descriptor */ static int ipsec_esp(struct talitos_edesc *edesc, struct aead_request *areq, - u64 seq, void (*callback) (struct device *dev, - struct talitos_desc *desc, - void *context, int error)) + u8 *giv, u64 seq, + void (*callback) (struct device *dev, + struct talitos_desc *desc, + void *context, int error)) { struct crypto_aead *aead = crypto_aead_reqtfm(areq); struct talitos_ctx *ctx = crypto_aead_ctx(aead); @@ -966,42 +950,12 @@ static int ipsec_esp(struct talitos_edesc *edesc, struct aead_request *areq, /* hmac key */ map_single_talitos_ptr(dev, &desc->ptr[0], ctx->authkeylen, &ctx->key, 0, DMA_TO_DEVICE); - /* hmac data */ - desc->ptr[1].len = cpu_to_be16(areq->assoclen + ivsize); - if (edesc->assoc_nents) { - int tbl_off = edesc->src_nents + edesc->dst_nents + 2; - struct talitos_ptr *tbl_ptr = &edesc->link_tbl[tbl_off]; - - to_talitos_ptr(&desc->ptr[1], edesc->dma_link_tbl + tbl_off * - sizeof(struct talitos_ptr)); - desc->ptr[1].j_extent = DESC_PTR_LNKTBL_JUMP; - - /* assoc_nents - 1 entries for assoc, 1 for IV */ - sg_count = sg_to_link_tbl(areq->assoc, edesc->assoc_nents - 1, - areq->assoclen, tbl_ptr); - - /* add IV to link table */ - tbl_ptr += sg_count - 1; - tbl_ptr->j_extent = 0; - tbl_ptr++; - to_talitos_ptr(tbl_ptr, edesc->iv_dma); - tbl_ptr->len = cpu_to_be16(ivsize); - tbl_ptr->j_extent = DESC_PTR_LNKTBL_RETURN; - - dma_sync_single_for_device(dev, edesc->dma_link_tbl, - edesc->dma_len, DMA_BIDIRECTIONAL); - } else { - to_talitos_ptr(&desc->ptr[1], sg_dma_address(areq->assoc)); - desc->ptr[1].j_extent = 0; - } - + map_single_talitos_ptr(dev, &desc->ptr[1], areq->assoclen + ivsize, + sg_virt(areq->assoc), 0, DMA_TO_DEVICE); /* cipher iv */ - to_talitos_ptr(&desc->ptr[2], edesc->iv_dma); - desc->ptr[2].len = cpu_to_be16(ivsize); - desc->ptr[2].j_extent = 0; - /* Sync needed for the aead_givencrypt case */ - dma_sync_single_for_device(dev, edesc->iv_dma, ivsize, DMA_TO_DEVICE); + map_single_talitos_ptr(dev, &desc->ptr[2], ivsize, giv ?: areq->iv, 0, + DMA_TO_DEVICE); /* cipher key */ map_single_talitos_ptr(dev, &desc->ptr[3], ctx->enckeylen, @@ -1020,7 +974,7 @@ static int ipsec_esp(struct talitos_edesc *edesc, struct aead_request *areq, sg_count = talitos_map_sg(dev, areq->src, edesc->src_nents ? : 1, (areq->src == areq->dst) ? DMA_BIDIRECTIONAL : DMA_TO_DEVICE, - edesc->src_chained); + edesc->src_is_chained); if (sg_count == 1) { to_talitos_ptr(&desc->ptr[4], sg_dma_address(areq->src)); @@ -1052,30 +1006,32 @@ static int ipsec_esp(struct talitos_edesc *edesc, struct aead_request *areq, if (areq->src != areq->dst) sg_count = talitos_map_sg(dev, areq->dst, edesc->dst_nents ? : 1, - DMA_FROM_DEVICE, edesc->dst_chained); + DMA_FROM_DEVICE, + edesc->dst_is_chained); if (sg_count == 1) { to_talitos_ptr(&desc->ptr[5], sg_dma_address(areq->dst)); } else { - int tbl_off = edesc->src_nents + 1; - struct talitos_ptr *tbl_ptr = &edesc->link_tbl[tbl_off]; + struct talitos_ptr *link_tbl_ptr = + &edesc->link_tbl[edesc->src_nents + 1]; to_talitos_ptr(&desc->ptr[5], edesc->dma_link_tbl + - tbl_off * sizeof(struct talitos_ptr)); + (edesc->src_nents + 1) * + sizeof(struct talitos_ptr)); sg_count = sg_to_link_tbl(areq->dst, sg_count, cryptlen, - tbl_ptr); + link_tbl_ptr); /* Add an entry to the link table for ICV data */ - tbl_ptr += sg_count - 1; - tbl_ptr->j_extent = 0; - tbl_ptr++; - tbl_ptr->j_extent = DESC_PTR_LNKTBL_RETURN; - tbl_ptr->len = cpu_to_be16(authsize); + link_tbl_ptr += sg_count - 1; + link_tbl_ptr->j_extent = 0; + sg_count++; + link_tbl_ptr++; + link_tbl_ptr->j_extent = DESC_PTR_LNKTBL_RETURN; + link_tbl_ptr->len = cpu_to_be16(authsize); /* icv data follows link tables */ - to_talitos_ptr(tbl_ptr, edesc->dma_link_tbl + - (tbl_off + edesc->dst_nents + 1 + - edesc->assoc_nents) * + to_talitos_ptr(link_tbl_ptr, edesc->dma_link_tbl + + (edesc->src_nents + edesc->dst_nents + 2) * sizeof(struct talitos_ptr)); desc->ptr[5].j_extent |= DESC_PTR_LNKTBL_JUMP; dma_sync_single_for_device(ctx->dev, edesc->dma_link_tbl, @@ -1097,17 +1053,17 @@ static int ipsec_esp(struct talitos_edesc *edesc, struct aead_request *areq, /* * derive number of elements in scatterlist */ -static int sg_count(struct scatterlist *sg_list, int nbytes, bool *chained) +static int sg_count(struct scatterlist *sg_list, int nbytes, int *chained) { struct scatterlist *sg = sg_list; int sg_nents = 0; - *chained = false; + *chained = 0; while (nbytes > 0) { sg_nents++; nbytes -= sg->length; if (!sg_is_last(sg) && (sg + 1)->length == 0) - *chained = true; + *chained = 1; sg = scatterwalk_sg_next(sg); } @@ -1176,21 +1132,17 @@ static size_t sg_copy_end_to_buffer(struct scatterlist *sgl, unsigned int nents, * allocate and map the extended descriptor */ static struct talitos_edesc *talitos_edesc_alloc(struct device *dev, - struct scatterlist *assoc, struct scatterlist *src, struct scatterlist *dst, - u8 *iv, - unsigned int assoclen, + int hash_result, unsigned int cryptlen, unsigned int authsize, - unsigned int ivsize, int icv_stashing, u32 cryptoflags) { struct talitos_edesc *edesc; - int assoc_nents = 0, src_nents, dst_nents, alloc_len, dma_len; - bool assoc_chained = false, src_chained = false, dst_chained = false; - dma_addr_t iv_dma = 0; + int src_nents, dst_nents, alloc_len, dma_len; + int src_chained, dst_chained = 0; gfp_t flags = cryptoflags & CRYPTO_TFM_REQ_MAY_SLEEP ? GFP_KERNEL : GFP_ATOMIC; @@ -1199,29 +1151,10 @@ static struct talitos_edesc *talitos_edesc_alloc(struct device *dev, return ERR_PTR(-EINVAL); } - if (iv) - iv_dma = dma_map_single(dev, iv, ivsize, DMA_TO_DEVICE); - - if (assoc) { - /* - * Currently it is assumed that iv is provided whenever assoc - * is. - */ - BUG_ON(!iv); - - assoc_nents = sg_count(assoc, assoclen, &assoc_chained); - talitos_map_sg(dev, assoc, assoc_nents, DMA_TO_DEVICE, - assoc_chained); - assoc_nents = (assoc_nents == 1) ? 0 : assoc_nents; - - if (assoc_nents || sg_dma_address(assoc) + assoclen != iv_dma) - assoc_nents = assoc_nents ? assoc_nents + 1 : 2; - } - src_nents = sg_count(src, cryptlen + authsize, &src_chained); src_nents = (src_nents == 1) ? 0 : src_nents; - if (!dst) { + if (hash_result) { dst_nents = 0; } else { if (dst == src) { @@ -1239,9 +1172,9 @@ static struct talitos_edesc *talitos_edesc_alloc(struct device *dev, * and the ICV data itself */ alloc_len = sizeof(struct talitos_edesc); - if (assoc_nents || src_nents || dst_nents) { - dma_len = (src_nents + dst_nents + 2 + assoc_nents) * - sizeof(struct talitos_ptr) + authsize; + if (src_nents || dst_nents) { + dma_len = (src_nents + dst_nents + 2) * + sizeof(struct talitos_ptr) + authsize; alloc_len += dma_len; } else { dma_len = 0; @@ -1250,20 +1183,14 @@ static struct talitos_edesc *talitos_edesc_alloc(struct device *dev, edesc = kmalloc(alloc_len, GFP_DMA | flags); if (!edesc) { - talitos_unmap_sg_chain(dev, assoc, DMA_TO_DEVICE); - if (iv_dma) - dma_unmap_single(dev, iv_dma, ivsize, DMA_TO_DEVICE); dev_err(dev, "could not allocate edescriptor\n"); return ERR_PTR(-ENOMEM); } - edesc->assoc_nents = assoc_nents; edesc->src_nents = src_nents; edesc->dst_nents = dst_nents; - edesc->assoc_chained = assoc_chained; - edesc->src_chained = src_chained; - edesc->dst_chained = dst_chained; - edesc->iv_dma = iv_dma; + edesc->src_is_chained = src_chained; + edesc->dst_is_chained = dst_chained; edesc->dma_len = dma_len; if (dma_len) edesc->dma_link_tbl = dma_map_single(dev, &edesc->link_tbl[0], @@ -1273,16 +1200,14 @@ static struct talitos_edesc *talitos_edesc_alloc(struct device *dev, return edesc; } -static struct talitos_edesc *aead_edesc_alloc(struct aead_request *areq, u8 *iv, +static struct talitos_edesc *aead_edesc_alloc(struct aead_request *areq, int icv_stashing) { struct crypto_aead *authenc = crypto_aead_reqtfm(areq); struct talitos_ctx *ctx = crypto_aead_ctx(authenc); - unsigned int ivsize = crypto_aead_ivsize(authenc); - return talitos_edesc_alloc(ctx->dev, areq->assoc, areq->src, areq->dst, - iv, areq->assoclen, areq->cryptlen, - ctx->authsize, ivsize, icv_stashing, + return talitos_edesc_alloc(ctx->dev, areq->src, areq->dst, 0, + areq->cryptlen, ctx->authsize, icv_stashing, areq->base.flags); } @@ -1293,14 +1218,14 @@ static int aead_encrypt(struct aead_request *req) struct talitos_edesc *edesc; /* allocate extended descriptor */ - edesc = aead_edesc_alloc(req, req->iv, 0); + edesc = aead_edesc_alloc(req, 0); if (IS_ERR(edesc)) return PTR_ERR(edesc); /* set encrypt */ edesc->desc.hdr = ctx->desc_hdr_template | DESC_HDR_MODE0_ENCRYPT; - return ipsec_esp(edesc, req, 0, ipsec_esp_encrypt_done); + return ipsec_esp(edesc, req, NULL, 0, ipsec_esp_encrypt_done); } static int aead_decrypt(struct aead_request *req) @@ -1316,7 +1241,7 @@ static int aead_decrypt(struct aead_request *req) req->cryptlen -= authsize; /* allocate extended descriptor */ - edesc = aead_edesc_alloc(req, req->iv, 1); + edesc = aead_edesc_alloc(req, 1); if (IS_ERR(edesc)) return PTR_ERR(edesc); @@ -1332,7 +1257,9 @@ static int aead_decrypt(struct aead_request *req) /* reset integrity check result bits */ edesc->desc.hdr_lo = 0; - return ipsec_esp(edesc, req, 0, ipsec_esp_decrypt_hwauth_done); + return ipsec_esp(edesc, req, NULL, 0, + ipsec_esp_decrypt_hwauth_done); + } /* Have to check the ICV with software */ @@ -1341,8 +1268,7 @@ static int aead_decrypt(struct aead_request *req) /* stash incoming ICV for later cmp with ICV generated by the h/w */ if (edesc->dma_len) icvdata = &edesc->link_tbl[edesc->src_nents + - edesc->dst_nents + 2 + - edesc->assoc_nents]; + edesc->dst_nents + 2]; else icvdata = &edesc->link_tbl[0]; @@ -1351,7 +1277,7 @@ static int aead_decrypt(struct aead_request *req) memcpy(icvdata, (char *)sg_virt(sg) + sg->length - ctx->authsize, ctx->authsize); - return ipsec_esp(edesc, req, 0, ipsec_esp_decrypt_swauth_done); + return ipsec_esp(edesc, req, NULL, 0, ipsec_esp_decrypt_swauth_done); } static int aead_givencrypt(struct aead_givcrypt_request *req) @@ -1362,7 +1288,7 @@ static int aead_givencrypt(struct aead_givcrypt_request *req) struct talitos_edesc *edesc; /* allocate extended descriptor */ - edesc = aead_edesc_alloc(areq, req->giv, 0); + edesc = aead_edesc_alloc(areq, 0); if (IS_ERR(edesc)) return PTR_ERR(edesc); @@ -1373,7 +1299,8 @@ static int aead_givencrypt(struct aead_givcrypt_request *req) /* avoid consecutive packets going out with same IV */ *(__be64 *)req->giv ^= cpu_to_be64(req->seq); - return ipsec_esp(edesc, areq, req->seq, ipsec_esp_encrypt_done); + return ipsec_esp(edesc, areq, req->giv, req->seq, + ipsec_esp_encrypt_done); } static int ablkcipher_setkey(struct crypto_ablkcipher *cipher, @@ -1429,7 +1356,7 @@ static int common_nonsnoop(struct talitos_edesc *edesc, struct device *dev = ctx->dev; struct talitos_desc *desc = &edesc->desc; unsigned int cryptlen = areq->nbytes; - unsigned int ivsize = crypto_ablkcipher_ivsize(cipher); + unsigned int ivsize; int sg_count, ret; /* first DWORD empty */ @@ -1438,9 +1365,9 @@ static int common_nonsnoop(struct talitos_edesc *edesc, desc->ptr[0].j_extent = 0; /* cipher iv */ - to_talitos_ptr(&desc->ptr[1], edesc->iv_dma); - desc->ptr[1].len = cpu_to_be16(ivsize); - desc->ptr[1].j_extent = 0; + ivsize = crypto_ablkcipher_ivsize(cipher); + map_single_talitos_ptr(dev, &desc->ptr[1], ivsize, areq->info, 0, + DMA_TO_DEVICE); /* cipher key */ map_single_talitos_ptr(dev, &desc->ptr[2], ctx->keylen, @@ -1455,7 +1382,7 @@ static int common_nonsnoop(struct talitos_edesc *edesc, sg_count = talitos_map_sg(dev, areq->src, edesc->src_nents ? : 1, (areq->src == areq->dst) ? DMA_BIDIRECTIONAL : DMA_TO_DEVICE, - edesc->src_chained); + edesc->src_is_chained); if (sg_count == 1) { to_talitos_ptr(&desc->ptr[3], sg_dma_address(areq->src)); @@ -1482,7 +1409,8 @@ static int common_nonsnoop(struct talitos_edesc *edesc, if (areq->src != areq->dst) sg_count = talitos_map_sg(dev, areq->dst, edesc->dst_nents ? : 1, - DMA_FROM_DEVICE, edesc->dst_chained); + DMA_FROM_DEVICE, + edesc->dst_is_chained); if (sg_count == 1) { to_talitos_ptr(&desc->ptr[4], sg_dma_address(areq->dst)); @@ -1522,11 +1450,9 @@ static struct talitos_edesc *ablkcipher_edesc_alloc(struct ablkcipher_request * { struct crypto_ablkcipher *cipher = crypto_ablkcipher_reqtfm(areq); struct talitos_ctx *ctx = crypto_ablkcipher_ctx(cipher); - unsigned int ivsize = crypto_ablkcipher_ivsize(cipher); - return talitos_edesc_alloc(ctx->dev, NULL, areq->src, areq->dst, - areq->info, 0, areq->nbytes, 0, ivsize, 0, - areq->base.flags); + return talitos_edesc_alloc(ctx->dev, areq->src, areq->dst, 0, + areq->nbytes, 0, 0, areq->base.flags); } static int ablkcipher_encrypt(struct ablkcipher_request *areq) @@ -1652,7 +1578,8 @@ static int common_nonsnoop_hash(struct talitos_edesc *edesc, sg_count = talitos_map_sg(dev, req_ctx->psrc, edesc->src_nents ? : 1, - DMA_TO_DEVICE, edesc->src_chained); + DMA_TO_DEVICE, + edesc->src_is_chained); if (sg_count == 1) { to_talitos_ptr(&desc->ptr[3], sg_dma_address(req_ctx->psrc)); @@ -1704,8 +1631,8 @@ static struct talitos_edesc *ahash_edesc_alloc(struct ahash_request *areq, struct talitos_ctx *ctx = crypto_ahash_ctx(tfm); struct talitos_ahash_req_ctx *req_ctx = ahash_request_ctx(areq); - return talitos_edesc_alloc(ctx->dev, NULL, req_ctx->psrc, NULL, NULL, 0, - nbytes, 0, 0, 0, areq->base.flags); + return talitos_edesc_alloc(ctx->dev, req_ctx->psrc, NULL, 1, + nbytes, 0, 0, areq->base.flags); } static int ahash_init(struct ahash_request *areq) @@ -1763,7 +1690,7 @@ static int ahash_process_req(struct ahash_request *areq, unsigned int nbytes) unsigned int nbytes_to_hash; unsigned int to_hash_later; unsigned int nsg; - bool chained; + int chained; if (!req_ctx->last && (nbytes + req_ctx->nbuf <= blocksize)) { /* Buffer up to one whole block */ @@ -1975,18 +1902,21 @@ struct talitos_alg_template { }; static struct talitos_alg_template driver_algs[] = { - /* - * AEAD algorithms. These use a single-pass ipsec_esp descriptor. - * authencesn(*,*) is also registered, although not present - * explicitly here. - */ + /* AEAD algorithms. These use a single-pass ipsec_esp descriptor */ { .type = CRYPTO_ALG_TYPE_AEAD, .alg.crypto = { .cra_name = "authenc(hmac(sha1),cbc(aes))", .cra_driver_name = "authenc-hmac-sha1-cbc-aes-talitos", .cra_blocksize = AES_BLOCK_SIZE, .cra_flags = CRYPTO_ALG_TYPE_AEAD | CRYPTO_ALG_ASYNC, + .cra_type = &crypto_aead_type, .cra_aead = { + .setkey = aead_setkey, + .setauthsize = aead_setauthsize, + .encrypt = aead_encrypt, + .decrypt = aead_decrypt, + .givencrypt = aead_givencrypt, + .geniv = "", .ivsize = AES_BLOCK_SIZE, .maxauthsize = SHA1_DIGEST_SIZE, } @@ -2005,7 +1935,14 @@ static struct talitos_alg_template driver_algs[] = { .cra_driver_name = "authenc-hmac-sha1-cbc-3des-talitos", .cra_blocksize = DES3_EDE_BLOCK_SIZE, .cra_flags = CRYPTO_ALG_TYPE_AEAD | CRYPTO_ALG_ASYNC, + .cra_type = &crypto_aead_type, .cra_aead = { + .setkey = aead_setkey, + .setauthsize = aead_setauthsize, + .encrypt = aead_encrypt, + .decrypt = aead_decrypt, + .givencrypt = aead_givencrypt, + .geniv = "", .ivsize = DES3_EDE_BLOCK_SIZE, .maxauthsize = SHA1_DIGEST_SIZE, } @@ -2025,7 +1962,14 @@ static struct talitos_alg_template driver_algs[] = { .cra_driver_name = "authenc-hmac-sha224-cbc-aes-talitos", .cra_blocksize = AES_BLOCK_SIZE, .cra_flags = CRYPTO_ALG_TYPE_AEAD | CRYPTO_ALG_ASYNC, + .cra_type = &crypto_aead_type, .cra_aead = { + .setkey = aead_setkey, + .setauthsize = aead_setauthsize, + .encrypt = aead_encrypt, + .decrypt = aead_decrypt, + .givencrypt = aead_givencrypt, + .geniv = "", .ivsize = AES_BLOCK_SIZE, .maxauthsize = SHA224_DIGEST_SIZE, } @@ -2044,7 +1988,14 @@ static struct talitos_alg_template driver_algs[] = { .cra_driver_name = "authenc-hmac-sha224-cbc-3des-talitos", .cra_blocksize = DES3_EDE_BLOCK_SIZE, .cra_flags = CRYPTO_ALG_TYPE_AEAD | CRYPTO_ALG_ASYNC, + .cra_type = &crypto_aead_type, .cra_aead = { + .setkey = aead_setkey, + .setauthsize = aead_setauthsize, + .encrypt = aead_encrypt, + .decrypt = aead_decrypt, + .givencrypt = aead_givencrypt, + .geniv = "", .ivsize = DES3_EDE_BLOCK_SIZE, .maxauthsize = SHA224_DIGEST_SIZE, } @@ -2064,7 +2015,14 @@ static struct talitos_alg_template driver_algs[] = { .cra_driver_name = "authenc-hmac-sha256-cbc-aes-talitos", .cra_blocksize = AES_BLOCK_SIZE, .cra_flags = CRYPTO_ALG_TYPE_AEAD | CRYPTO_ALG_ASYNC, + .cra_type = &crypto_aead_type, .cra_aead = { + .setkey = aead_setkey, + .setauthsize = aead_setauthsize, + .encrypt = aead_encrypt, + .decrypt = aead_decrypt, + .givencrypt = aead_givencrypt, + .geniv = "", .ivsize = AES_BLOCK_SIZE, .maxauthsize = SHA256_DIGEST_SIZE, } @@ -2083,7 +2041,14 @@ static struct talitos_alg_template driver_algs[] = { .cra_driver_name = "authenc-hmac-sha256-cbc-3des-talitos", .cra_blocksize = DES3_EDE_BLOCK_SIZE, .cra_flags = CRYPTO_ALG_TYPE_AEAD | CRYPTO_ALG_ASYNC, + .cra_type = &crypto_aead_type, .cra_aead = { + .setkey = aead_setkey, + .setauthsize = aead_setauthsize, + .encrypt = aead_encrypt, + .decrypt = aead_decrypt, + .givencrypt = aead_givencrypt, + .geniv = "", .ivsize = DES3_EDE_BLOCK_SIZE, .maxauthsize = SHA256_DIGEST_SIZE, } @@ -2103,7 +2068,14 @@ static struct talitos_alg_template driver_algs[] = { .cra_driver_name = "authenc-hmac-sha384-cbc-aes-talitos", .cra_blocksize = AES_BLOCK_SIZE, .cra_flags = CRYPTO_ALG_TYPE_AEAD | CRYPTO_ALG_ASYNC, + .cra_type = &crypto_aead_type, .cra_aead = { + .setkey = aead_setkey, + .setauthsize = aead_setauthsize, + .encrypt = aead_encrypt, + .decrypt = aead_decrypt, + .givencrypt = aead_givencrypt, + .geniv = "", .ivsize = AES_BLOCK_SIZE, .maxauthsize = SHA384_DIGEST_SIZE, } @@ -2122,7 +2094,14 @@ static struct talitos_alg_template driver_algs[] = { .cra_driver_name = "authenc-hmac-sha384-cbc-3des-talitos", .cra_blocksize = DES3_EDE_BLOCK_SIZE, .cra_flags = CRYPTO_ALG_TYPE_AEAD | CRYPTO_ALG_ASYNC, + .cra_type = &crypto_aead_type, .cra_aead = { + .setkey = aead_setkey, + .setauthsize = aead_setauthsize, + .encrypt = aead_encrypt, + .decrypt = aead_decrypt, + .givencrypt = aead_givencrypt, + .geniv = "", .ivsize = DES3_EDE_BLOCK_SIZE, .maxauthsize = SHA384_DIGEST_SIZE, } @@ -2142,7 +2121,14 @@ static struct talitos_alg_template driver_algs[] = { .cra_driver_name = "authenc-hmac-sha512-cbc-aes-talitos", .cra_blocksize = AES_BLOCK_SIZE, .cra_flags = CRYPTO_ALG_TYPE_AEAD | CRYPTO_ALG_ASYNC, + .cra_type = &crypto_aead_type, .cra_aead = { + .setkey = aead_setkey, + .setauthsize = aead_setauthsize, + .encrypt = aead_encrypt, + .decrypt = aead_decrypt, + .givencrypt = aead_givencrypt, + .geniv = "", .ivsize = AES_BLOCK_SIZE, .maxauthsize = SHA512_DIGEST_SIZE, } @@ -2161,7 +2147,14 @@ static struct talitos_alg_template driver_algs[] = { .cra_driver_name = "authenc-hmac-sha512-cbc-3des-talitos", .cra_blocksize = DES3_EDE_BLOCK_SIZE, .cra_flags = CRYPTO_ALG_TYPE_AEAD | CRYPTO_ALG_ASYNC, + .cra_type = &crypto_aead_type, .cra_aead = { + .setkey = aead_setkey, + .setauthsize = aead_setauthsize, + .encrypt = aead_encrypt, + .decrypt = aead_decrypt, + .givencrypt = aead_givencrypt, + .geniv = "", .ivsize = DES3_EDE_BLOCK_SIZE, .maxauthsize = SHA512_DIGEST_SIZE, } @@ -2181,7 +2174,14 @@ static struct talitos_alg_template driver_algs[] = { .cra_driver_name = "authenc-hmac-md5-cbc-aes-talitos", .cra_blocksize = AES_BLOCK_SIZE, .cra_flags = CRYPTO_ALG_TYPE_AEAD | CRYPTO_ALG_ASYNC, + .cra_type = &crypto_aead_type, .cra_aead = { + .setkey = aead_setkey, + .setauthsize = aead_setauthsize, + .encrypt = aead_encrypt, + .decrypt = aead_decrypt, + .givencrypt = aead_givencrypt, + .geniv = "", .ivsize = AES_BLOCK_SIZE, .maxauthsize = MD5_DIGEST_SIZE, } @@ -2200,7 +2200,14 @@ static struct talitos_alg_template driver_algs[] = { .cra_driver_name = "authenc-hmac-md5-cbc-3des-talitos", .cra_blocksize = DES3_EDE_BLOCK_SIZE, .cra_flags = CRYPTO_ALG_TYPE_AEAD | CRYPTO_ALG_ASYNC, + .cra_type = &crypto_aead_type, .cra_aead = { + .setkey = aead_setkey, + .setauthsize = aead_setauthsize, + .encrypt = aead_encrypt, + .decrypt = aead_decrypt, + .givencrypt = aead_givencrypt, + .geniv = "", .ivsize = DES3_EDE_BLOCK_SIZE, .maxauthsize = MD5_DIGEST_SIZE, } @@ -2222,7 +2229,12 @@ static struct talitos_alg_template driver_algs[] = { .cra_blocksize = AES_BLOCK_SIZE, .cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_ASYNC, + .cra_type = &crypto_ablkcipher_type, .cra_ablkcipher = { + .setkey = ablkcipher_setkey, + .encrypt = ablkcipher_encrypt, + .decrypt = ablkcipher_decrypt, + .geniv = "eseqiv", .min_keysize = AES_MIN_KEY_SIZE, .max_keysize = AES_MAX_KEY_SIZE, .ivsize = AES_BLOCK_SIZE, @@ -2239,7 +2251,12 @@ static struct talitos_alg_template driver_algs[] = { .cra_blocksize = DES3_EDE_BLOCK_SIZE, .cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_ASYNC, + .cra_type = &crypto_ablkcipher_type, .cra_ablkcipher = { + .setkey = ablkcipher_setkey, + .encrypt = ablkcipher_encrypt, + .decrypt = ablkcipher_decrypt, + .geniv = "eseqiv", .min_keysize = DES3_EDE_KEY_SIZE, .max_keysize = DES3_EDE_KEY_SIZE, .ivsize = DES3_EDE_BLOCK_SIZE, @@ -2253,6 +2270,11 @@ static struct talitos_alg_template driver_algs[] = { /* AHASH algorithms. */ { .type = CRYPTO_ALG_TYPE_AHASH, .alg.hash = { + .init = ahash_init, + .update = ahash_update, + .final = ahash_final, + .finup = ahash_finup, + .digest = ahash_digest, .halg.digestsize = MD5_DIGEST_SIZE, .halg.base = { .cra_name = "md5", @@ -2260,6 +2282,7 @@ static struct talitos_alg_template driver_algs[] = { .cra_blocksize = MD5_BLOCK_SIZE, .cra_flags = CRYPTO_ALG_TYPE_AHASH | CRYPTO_ALG_ASYNC, + .cra_type = &crypto_ahash_type } }, .desc_hdr_template = DESC_HDR_TYPE_COMMON_NONSNOOP_NO_AFEU | @@ -2268,6 +2291,11 @@ static struct talitos_alg_template driver_algs[] = { }, { .type = CRYPTO_ALG_TYPE_AHASH, .alg.hash = { + .init = ahash_init, + .update = ahash_update, + .final = ahash_final, + .finup = ahash_finup, + .digest = ahash_digest, .halg.digestsize = SHA1_DIGEST_SIZE, .halg.base = { .cra_name = "sha1", @@ -2275,6 +2303,7 @@ static struct talitos_alg_template driver_algs[] = { .cra_blocksize = SHA1_BLOCK_SIZE, .cra_flags = CRYPTO_ALG_TYPE_AHASH | CRYPTO_ALG_ASYNC, + .cra_type = &crypto_ahash_type } }, .desc_hdr_template = DESC_HDR_TYPE_COMMON_NONSNOOP_NO_AFEU | @@ -2283,6 +2312,11 @@ static struct talitos_alg_template driver_algs[] = { }, { .type = CRYPTO_ALG_TYPE_AHASH, .alg.hash = { + .init = ahash_init, + .update = ahash_update, + .final = ahash_final, + .finup = ahash_finup, + .digest = ahash_digest, .halg.digestsize = SHA224_DIGEST_SIZE, .halg.base = { .cra_name = "sha224", @@ -2290,6 +2324,7 @@ static struct talitos_alg_template driver_algs[] = { .cra_blocksize = SHA224_BLOCK_SIZE, .cra_flags = CRYPTO_ALG_TYPE_AHASH | CRYPTO_ALG_ASYNC, + .cra_type = &crypto_ahash_type } }, .desc_hdr_template = DESC_HDR_TYPE_COMMON_NONSNOOP_NO_AFEU | @@ -2298,6 +2333,11 @@ static struct talitos_alg_template driver_algs[] = { }, { .type = CRYPTO_ALG_TYPE_AHASH, .alg.hash = { + .init = ahash_init, + .update = ahash_update, + .final = ahash_final, + .finup = ahash_finup, + .digest = ahash_digest, .halg.digestsize = SHA256_DIGEST_SIZE, .halg.base = { .cra_name = "sha256", @@ -2305,6 +2345,7 @@ static struct talitos_alg_template driver_algs[] = { .cra_blocksize = SHA256_BLOCK_SIZE, .cra_flags = CRYPTO_ALG_TYPE_AHASH | CRYPTO_ALG_ASYNC, + .cra_type = &crypto_ahash_type } }, .desc_hdr_template = DESC_HDR_TYPE_COMMON_NONSNOOP_NO_AFEU | @@ -2313,6 +2354,11 @@ static struct talitos_alg_template driver_algs[] = { }, { .type = CRYPTO_ALG_TYPE_AHASH, .alg.hash = { + .init = ahash_init, + .update = ahash_update, + .final = ahash_final, + .finup = ahash_finup, + .digest = ahash_digest, .halg.digestsize = SHA384_DIGEST_SIZE, .halg.base = { .cra_name = "sha384", @@ -2320,6 +2366,7 @@ static struct talitos_alg_template driver_algs[] = { .cra_blocksize = SHA384_BLOCK_SIZE, .cra_flags = CRYPTO_ALG_TYPE_AHASH | CRYPTO_ALG_ASYNC, + .cra_type = &crypto_ahash_type } }, .desc_hdr_template = DESC_HDR_TYPE_COMMON_NONSNOOP_NO_AFEU | @@ -2328,6 +2375,11 @@ static struct talitos_alg_template driver_algs[] = { }, { .type = CRYPTO_ALG_TYPE_AHASH, .alg.hash = { + .init = ahash_init, + .update = ahash_update, + .final = ahash_final, + .finup = ahash_finup, + .digest = ahash_digest, .halg.digestsize = SHA512_DIGEST_SIZE, .halg.base = { .cra_name = "sha512", @@ -2335,6 +2387,7 @@ static struct talitos_alg_template driver_algs[] = { .cra_blocksize = SHA512_BLOCK_SIZE, .cra_flags = CRYPTO_ALG_TYPE_AHASH | CRYPTO_ALG_ASYNC, + .cra_type = &crypto_ahash_type } }, .desc_hdr_template = DESC_HDR_TYPE_COMMON_NONSNOOP_NO_AFEU | @@ -2343,6 +2396,12 @@ static struct talitos_alg_template driver_algs[] = { }, { .type = CRYPTO_ALG_TYPE_AHASH, .alg.hash = { + .init = ahash_init, + .update = ahash_update, + .final = ahash_final, + .finup = ahash_finup, + .digest = ahash_digest, + .setkey = ahash_setkey, .halg.digestsize = MD5_DIGEST_SIZE, .halg.base = { .cra_name = "hmac(md5)", @@ -2350,6 +2409,7 @@ static struct talitos_alg_template driver_algs[] = { .cra_blocksize = MD5_BLOCK_SIZE, .cra_flags = CRYPTO_ALG_TYPE_AHASH | CRYPTO_ALG_ASYNC, + .cra_type = &crypto_ahash_type } }, .desc_hdr_template = DESC_HDR_TYPE_COMMON_NONSNOOP_NO_AFEU | @@ -2358,6 +2418,12 @@ static struct talitos_alg_template driver_algs[] = { }, { .type = CRYPTO_ALG_TYPE_AHASH, .alg.hash = { + .init = ahash_init, + .update = ahash_update, + .final = ahash_final, + .finup = ahash_finup, + .digest = ahash_digest, + .setkey = ahash_setkey, .halg.digestsize = SHA1_DIGEST_SIZE, .halg.base = { .cra_name = "hmac(sha1)", @@ -2365,6 +2431,7 @@ static struct talitos_alg_template driver_algs[] = { .cra_blocksize = SHA1_BLOCK_SIZE, .cra_flags = CRYPTO_ALG_TYPE_AHASH | CRYPTO_ALG_ASYNC, + .cra_type = &crypto_ahash_type } }, .desc_hdr_template = DESC_HDR_TYPE_COMMON_NONSNOOP_NO_AFEU | @@ -2373,6 +2440,12 @@ static struct talitos_alg_template driver_algs[] = { }, { .type = CRYPTO_ALG_TYPE_AHASH, .alg.hash = { + .init = ahash_init, + .update = ahash_update, + .final = ahash_final, + .finup = ahash_finup, + .digest = ahash_digest, + .setkey = ahash_setkey, .halg.digestsize = SHA224_DIGEST_SIZE, .halg.base = { .cra_name = "hmac(sha224)", @@ -2380,6 +2453,7 @@ static struct talitos_alg_template driver_algs[] = { .cra_blocksize = SHA224_BLOCK_SIZE, .cra_flags = CRYPTO_ALG_TYPE_AHASH | CRYPTO_ALG_ASYNC, + .cra_type = &crypto_ahash_type } }, .desc_hdr_template = DESC_HDR_TYPE_COMMON_NONSNOOP_NO_AFEU | @@ -2388,6 +2462,12 @@ static struct talitos_alg_template driver_algs[] = { }, { .type = CRYPTO_ALG_TYPE_AHASH, .alg.hash = { + .init = ahash_init, + .update = ahash_update, + .final = ahash_final, + .finup = ahash_finup, + .digest = ahash_digest, + .setkey = ahash_setkey, .halg.digestsize = SHA256_DIGEST_SIZE, .halg.base = { .cra_name = "hmac(sha256)", @@ -2395,6 +2475,7 @@ static struct talitos_alg_template driver_algs[] = { .cra_blocksize = SHA256_BLOCK_SIZE, .cra_flags = CRYPTO_ALG_TYPE_AHASH | CRYPTO_ALG_ASYNC, + .cra_type = &crypto_ahash_type } }, .desc_hdr_template = DESC_HDR_TYPE_COMMON_NONSNOOP_NO_AFEU | @@ -2403,6 +2484,12 @@ static struct talitos_alg_template driver_algs[] = { }, { .type = CRYPTO_ALG_TYPE_AHASH, .alg.hash = { + .init = ahash_init, + .update = ahash_update, + .final = ahash_final, + .finup = ahash_finup, + .digest = ahash_digest, + .setkey = ahash_setkey, .halg.digestsize = SHA384_DIGEST_SIZE, .halg.base = { .cra_name = "hmac(sha384)", @@ -2410,6 +2497,7 @@ static struct talitos_alg_template driver_algs[] = { .cra_blocksize = SHA384_BLOCK_SIZE, .cra_flags = CRYPTO_ALG_TYPE_AHASH | CRYPTO_ALG_ASYNC, + .cra_type = &crypto_ahash_type } }, .desc_hdr_template = DESC_HDR_TYPE_COMMON_NONSNOOP_NO_AFEU | @@ -2418,6 +2506,12 @@ static struct talitos_alg_template driver_algs[] = { }, { .type = CRYPTO_ALG_TYPE_AHASH, .alg.hash = { + .init = ahash_init, + .update = ahash_update, + .final = ahash_final, + .finup = ahash_finup, + .digest = ahash_digest, + .setkey = ahash_setkey, .halg.digestsize = SHA512_DIGEST_SIZE, .halg.base = { .cra_name = "hmac(sha512)", @@ -2425,6 +2519,7 @@ static struct talitos_alg_template driver_algs[] = { .cra_blocksize = SHA512_BLOCK_SIZE, .cra_flags = CRYPTO_ALG_TYPE_AHASH | CRYPTO_ALG_ASYNC, + .cra_type = &crypto_ahash_type } }, .desc_hdr_template = DESC_HDR_TYPE_COMMON_NONSNOOP_NO_AFEU | @@ -2582,34 +2677,14 @@ static struct talitos_crypto_alg *talitos_alg_alloc(struct device *dev, case CRYPTO_ALG_TYPE_ABLKCIPHER: alg = &t_alg->algt.alg.crypto; alg->cra_init = talitos_cra_init; - alg->cra_type = &crypto_ablkcipher_type; - alg->cra_ablkcipher.setkey = ablkcipher_setkey; - alg->cra_ablkcipher.encrypt = ablkcipher_encrypt; - alg->cra_ablkcipher.decrypt = ablkcipher_decrypt; - alg->cra_ablkcipher.geniv = "eseqiv"; break; case CRYPTO_ALG_TYPE_AEAD: alg = &t_alg->algt.alg.crypto; alg->cra_init = talitos_cra_init_aead; - alg->cra_type = &crypto_aead_type; - alg->cra_aead.setkey = aead_setkey; - alg->cra_aead.setauthsize = aead_setauthsize; - alg->cra_aead.encrypt = aead_encrypt; - alg->cra_aead.decrypt = aead_decrypt; - alg->cra_aead.givencrypt = aead_givencrypt; - alg->cra_aead.geniv = ""; break; case CRYPTO_ALG_TYPE_AHASH: alg = &t_alg->algt.alg.hash.halg.base; alg->cra_init = talitos_cra_init_ahash; - alg->cra_type = &crypto_ahash_type; - t_alg->algt.alg.hash.init = ahash_init; - t_alg->algt.alg.hash.update = ahash_update; - t_alg->algt.alg.hash.final = ahash_final; - t_alg->algt.alg.hash.finup = ahash_finup; - t_alg->algt.alg.hash.digest = ahash_digest; - t_alg->algt.alg.hash.setkey = ahash_setkey; - if (!(priv->features & TALITOS_FTR_HMAC_OK) && !strncmp(alg->cra_name, "hmac", 4)) { kfree(t_alg); @@ -2821,9 +2896,7 @@ static int talitos_probe(struct platform_device *ofdev) if (hw_supports(dev, driver_algs[i].desc_hdr_template)) { struct talitos_crypto_alg *t_alg; char *name = NULL; - bool authenc = false; -authencesn: t_alg = talitos_alg_alloc(dev, &driver_algs[i]); if (IS_ERR(t_alg)) { err = PTR_ERR(t_alg); @@ -2838,8 +2911,6 @@ static int talitos_probe(struct platform_device *ofdev) err = crypto_register_alg( &t_alg->algt.alg.crypto); name = t_alg->algt.alg.crypto.cra_driver_name; - authenc = authenc ? !authenc : - !(bool)memcmp(name, "authenc", 7); break; case CRYPTO_ALG_TYPE_AHASH: err = crypto_register_ahash( @@ -2852,25 +2923,8 @@ static int talitos_probe(struct platform_device *ofdev) dev_err(dev, "%s alg registration failed\n", name); kfree(t_alg); - } else { + } else list_add_tail(&t_alg->entry, &priv->alg_list); - if (authenc) { - struct crypto_alg *alg = - &driver_algs[i].alg.crypto; - - name = alg->cra_name; - memmove(name + 10, name + 7, - strlen(name) - 7); - memcpy(name + 7, "esn", 3); - - name = alg->cra_driver_name; - memmove(name + 10, name + 7, - strlen(name) - 7); - memcpy(name + 7, "esn", 3); - - goto authencesn; - } - } } } if (!list_empty(&priv->alg_list)) diff --git a/trunk/drivers/crypto/tegra-aes.c b/trunk/drivers/crypto/tegra-aes.c index 37185e6630cd..ac236f6724f4 100644 --- a/trunk/drivers/crypto/tegra-aes.c +++ b/trunk/drivers/crypto/tegra-aes.c @@ -969,7 +969,6 @@ static int tegra_aes_probe(struct platform_device *pdev) aes_wq = alloc_workqueue("tegra_aes_wq", WQ_HIGHPRI | WQ_UNBOUND, 1); if (!aes_wq) { dev_err(dev, "alloc_workqueue failed\n"); - err = -ENOMEM; goto out; } @@ -1005,6 +1004,8 @@ static int tegra_aes_probe(struct platform_device *pdev) aes_dev = dd; for (i = 0; i < ARRAY_SIZE(algs); i++) { + INIT_LIST_HEAD(&algs[i].cra_list); + algs[i].cra_priority = 300; algs[i].cra_ctxsize = sizeof(struct tegra_aes_ctx); algs[i].cra_module = THIS_MODULE; diff --git a/trunk/drivers/crypto/ux500/cryp/cryp_core.c b/trunk/drivers/crypto/ux500/cryp/cryp_core.c index bc615cc56266..ef17e3871c71 100644 --- a/trunk/drivers/crypto/ux500/cryp/cryp_core.c +++ b/trunk/drivers/crypto/ux500/cryp/cryp_core.c @@ -1486,7 +1486,6 @@ static int ux500_cryp_probe(struct platform_device *pdev) if (!res_irq) { dev_err(dev, "[%s]: IORESOURCE_IRQ unavailable", __func__); - ret = -ENODEV; goto out_power; } diff --git a/trunk/drivers/crypto/ux500/hash/hash_core.c b/trunk/drivers/crypto/ux500/hash/hash_core.c index 632c3339895f..08765072a2b3 100644 --- a/trunk/drivers/crypto/ux500/hash/hash_core.c +++ b/trunk/drivers/crypto/ux500/hash/hash_core.c @@ -1991,6 +1991,7 @@ static int __init ux500_hash_mod_init(void) static void __exit ux500_hash_mod_fini(void) { platform_driver_unregister(&hash_driver); + return; } module_init(ux500_hash_mod_init); diff --git a/trunk/drivers/dma/dmaengine.c b/trunk/drivers/dma/dmaengine.c index a815d44c70a4..3491654cdf7b 100644 --- a/trunk/drivers/dma/dmaengine.c +++ b/trunk/drivers/dma/dmaengine.c @@ -582,7 +582,7 @@ void dmaengine_get(void) list_del_rcu(&device->global_node); break; } else if (err) - pr_debug("%s: failed to get %s: (%d)\n", + pr_err("%s: failed to get %s: (%d)\n", __func__, dma_chan_name(chan), err); } } diff --git a/trunk/drivers/firewire/core-device.c b/trunk/drivers/firewire/core-device.c index 3873d535b28d..7a05fd24d68b 100644 --- a/trunk/drivers/firewire/core-device.c +++ b/trunk/drivers/firewire/core-device.c @@ -32,7 +32,6 @@ #include #include #include -#include #include #include #include @@ -1067,8 +1066,6 @@ static void fw_device_init(struct work_struct *work) device->config_rom_retries = 0; set_broadcast_channel(device, device->generation); - - add_device_randomness(&device->config_rom[3], 8); } /* diff --git a/trunk/drivers/firewire/core-transaction.c b/trunk/drivers/firewire/core-transaction.c index 28a94c7ec6e5..87d6f2d2f02d 100644 --- a/trunk/drivers/firewire/core-transaction.c +++ b/trunk/drivers/firewire/core-transaction.c @@ -31,7 +31,6 @@ #include #include #include -#include #include #include #include @@ -490,7 +489,7 @@ static struct fw_address_handler *lookup_overlapping_address_handler( { struct fw_address_handler *handler; - list_for_each_entry_rcu(handler, list, link) { + list_for_each_entry(handler, list, link) { if (handler->offset < offset + length && offset < handler->offset + handler->length) return handler; @@ -511,7 +510,7 @@ static struct fw_address_handler *lookup_enclosing_address_handler( { struct fw_address_handler *handler; - list_for_each_entry_rcu(handler, list, link) { + list_for_each_entry(handler, list, link) { if (is_enclosing_handler(handler, offset, length)) return handler; } @@ -519,7 +518,7 @@ static struct fw_address_handler *lookup_enclosing_address_handler( return NULL; } -static DEFINE_SPINLOCK(address_handler_list_lock); +static DEFINE_SPINLOCK(address_handler_lock); static LIST_HEAD(address_handler_list); const struct fw_address_region fw_high_memory_region = @@ -556,7 +555,6 @@ static bool is_in_fcp_region(u64 offset, size_t length) * the specified callback is invoked. The parameters passed to the callback * give the details of the particular request. * - * To be called in process context. * Return value: 0 on success, non-zero otherwise. * * The start offset of the handler's address region is determined by @@ -577,7 +575,7 @@ int fw_core_add_address_handler(struct fw_address_handler *handler, handler->length == 0) return -EINVAL; - spin_lock(&address_handler_list_lock); + spin_lock_bh(&address_handler_lock); handler->offset = region->start; while (handler->offset + handler->length <= region->end) { @@ -590,13 +588,13 @@ int fw_core_add_address_handler(struct fw_address_handler *handler, if (other != NULL) { handler->offset += other->length; } else { - list_add_tail_rcu(&handler->link, &address_handler_list); + list_add_tail(&handler->link, &address_handler_list); ret = 0; break; } } - spin_unlock(&address_handler_list_lock); + spin_unlock_bh(&address_handler_lock); return ret; } @@ -605,17 +603,14 @@ EXPORT_SYMBOL(fw_core_add_address_handler); /** * fw_core_remove_address_handler() - unregister an address handler * - * To be called in process context. - * * When fw_core_remove_address_handler() returns, @handler->callback() is * guaranteed to not run on any CPU anymore. */ void fw_core_remove_address_handler(struct fw_address_handler *handler) { - spin_lock(&address_handler_list_lock); - list_del_rcu(&handler->link); - spin_unlock(&address_handler_list_lock); - synchronize_rcu(); + spin_lock_bh(&address_handler_lock); + list_del(&handler->link); + spin_unlock_bh(&address_handler_lock); } EXPORT_SYMBOL(fw_core_remove_address_handler); @@ -849,7 +844,7 @@ static void handle_exclusive_region_request(struct fw_card *card, if (tcode == TCODE_LOCK_REQUEST) tcode = 0x10 + HEADER_GET_EXTENDED_TCODE(p->header[3]); - rcu_read_lock(); + spin_lock_bh(&address_handler_lock); handler = lookup_enclosing_address_handler(&address_handler_list, offset, request->length); if (handler) @@ -858,7 +853,7 @@ static void handle_exclusive_region_request(struct fw_card *card, p->generation, offset, request->data, request->length, handler->callback_data); - rcu_read_unlock(); + spin_unlock_bh(&address_handler_lock); if (!handler) fw_send_response(card, request, RCODE_ADDRESS_ERROR); @@ -891,8 +886,8 @@ static void handle_fcp_region_request(struct fw_card *card, return; } - rcu_read_lock(); - list_for_each_entry_rcu(handler, &address_handler_list, link) { + spin_lock_bh(&address_handler_lock); + list_for_each_entry(handler, &address_handler_list, link) { if (is_enclosing_handler(handler, offset, request->length)) handler->address_callback(card, NULL, tcode, destination, source, @@ -901,7 +896,7 @@ static void handle_fcp_region_request(struct fw_card *card, request->length, handler->callback_data); } - rcu_read_unlock(); + spin_unlock_bh(&address_handler_lock); fw_send_response(card, request, RCODE_COMPLETE); } diff --git a/trunk/drivers/firewire/ohci.c b/trunk/drivers/firewire/ohci.c index 834e71d2324d..c788dbdaf3bc 100644 --- a/trunk/drivers/firewire/ohci.c +++ b/trunk/drivers/firewire/ohci.c @@ -1777,35 +1777,11 @@ static int get_self_id_pos(struct fw_ohci *ohci, u32 self_id, return i; } -static int initiated_reset(struct fw_ohci *ohci) -{ - int reg; - int ret = 0; - - mutex_lock(&ohci->phy_reg_mutex); - reg = write_phy_reg(ohci, 7, 0xe0); /* Select page 7 */ - if (reg >= 0) { - reg = read_phy_reg(ohci, 8); - reg |= 0x40; - reg = write_phy_reg(ohci, 8, reg); /* set PMODE bit */ - if (reg >= 0) { - reg = read_phy_reg(ohci, 12); /* read register 12 */ - if (reg >= 0) { - if ((reg & 0x08) == 0x08) { - /* bit 3 indicates "initiated reset" */ - ret = 0x2; - } - } - } - } - mutex_unlock(&ohci->phy_reg_mutex); - return ret; -} - /* * TI TSB82AA2B and TSB12LV26 do not receive the selfID of a locally * attached TSB41BA3D phy; see http://www.ti.com/litv/pdf/sllz059. * Construct the selfID from phy register contents. + * FIXME: How to determine the selfID.i flag? */ static int find_and_insert_self_id(struct fw_ohci *ohci, int self_id_count) { @@ -1838,8 +1814,6 @@ static int find_and_insert_self_id(struct fw_ohci *ohci, int self_id_count) self_id |= ((status & 0x3) << (6 - (i * 2))); } - self_id |= initiated_reset(ohci); - pos = get_self_id_pos(ohci, self_id, self_id_count); if (pos >= 0) { memmove(&(ohci->self_id_buffer[pos+1]), diff --git a/trunk/drivers/gpio/Kconfig b/trunk/drivers/gpio/Kconfig index aa73ef3233b8..8382dc832929 100644 --- a/trunk/drivers/gpio/Kconfig +++ b/trunk/drivers/gpio/Kconfig @@ -409,13 +409,6 @@ config GPIO_TWL4030 Say yes here to access the GPIO signals of various multi-function power management chips from Texas Instruments. -config GPIO_TWL6040 - tristate "TWL6040 GPO" - depends on TWL6040_CORE - help - Say yes here to access the GPO signals of twl6040 - audio chip from Texas Instruments. - config GPIO_WM831X tristate "WM831x GPIOs" depends on MFD_WM831X diff --git a/trunk/drivers/gpio/Makefile b/trunk/drivers/gpio/Makefile index b2c109d1303d..0ffaa8423e87 100644 --- a/trunk/drivers/gpio/Makefile +++ b/trunk/drivers/gpio/Makefile @@ -68,7 +68,6 @@ obj-$(CONFIG_GPIO_TPS6586X) += gpio-tps6586x.o obj-$(CONFIG_GPIO_TPS65910) += gpio-tps65910.o obj-$(CONFIG_GPIO_TPS65912) += gpio-tps65912.o obj-$(CONFIG_GPIO_TWL4030) += gpio-twl4030.o -obj-$(CONFIG_GPIO_TWL6040) += gpio-twl6040.o obj-$(CONFIG_GPIO_UCB1400) += gpio-ucb1400.o obj-$(CONFIG_GPIO_VR41XX) += gpio-vr41xx.o obj-$(CONFIG_GPIO_VT8500) += gpio-vt8500.o diff --git a/trunk/drivers/gpio/gpio-ich.c b/trunk/drivers/gpio/gpio-ich.c index d4d617966696..b7c06517403d 100644 --- a/trunk/drivers/gpio/gpio-ich.c +++ b/trunk/drivers/gpio/gpio-ich.c @@ -49,10 +49,6 @@ static const u8 ichx_regs[3][3] = { {0x0c, 0x38, 0x48}, /* LVL[1-3] offsets */ }; -static const u8 ichx_reglen[3] = { - 0x30, 0x10, 0x10, -}; - #define ICHX_WRITE(val, reg, base_res) outl(val, (reg) + (base_res)->start) #define ICHX_READ(reg, base_res) inl((reg) + (base_res)->start) @@ -79,7 +75,6 @@ static struct { struct resource *pm_base; /* Power Mangagment IO base */ struct ichx_desc *desc; /* Pointer to chipset-specific description */ u32 orig_gpio_ctrl; /* Orig CTRL value, used to restore on exit */ - u8 use_gpio; /* Which GPIO groups are usable */ } ichx_priv; static int modparam_gpiobase = -1; /* dynamic */ @@ -128,16 +123,8 @@ static int ichx_read_bit(int reg, unsigned nr) return data & (1 << bit) ? 1 : 0; } -static int ichx_gpio_check_available(struct gpio_chip *gpio, unsigned nr) -{ - return (ichx_priv.use_gpio & (1 << (nr / 32))) ? 0 : -ENXIO; -} - static int ichx_gpio_direction_input(struct gpio_chip *gpio, unsigned nr) { - if (!ichx_gpio_check_available(gpio, nr)) - return -ENXIO; - /* * Try setting pin as an input and verify it worked since many pins * are output-only. @@ -151,9 +138,6 @@ static int ichx_gpio_direction_input(struct gpio_chip *gpio, unsigned nr) static int ichx_gpio_direction_output(struct gpio_chip *gpio, unsigned nr, int val) { - if (!ichx_gpio_check_available(gpio, nr)) - return -ENXIO; - /* Set GPIO output value. */ ichx_write_bit(GPIO_LVL, nr, val, 0); @@ -169,9 +153,6 @@ static int ichx_gpio_direction_output(struct gpio_chip *gpio, unsigned nr, static int ichx_gpio_get(struct gpio_chip *chip, unsigned nr) { - if (!ichx_gpio_check_available(chip, nr)) - return -ENXIO; - return ichx_read_bit(GPIO_LVL, nr); } @@ -180,9 +161,6 @@ static int ich6_gpio_get(struct gpio_chip *chip, unsigned nr) unsigned long flags; u32 data; - if (!ichx_gpio_check_available(chip, nr)) - return -ENXIO; - /* * GPI 0 - 15 need to be read from the power management registers on * a ICH6/3100 bridge. @@ -313,46 +291,6 @@ static struct ichx_desc intel5_desc = { .ngpio = 76, }; -static int __devinit ichx_gpio_request_regions(struct resource *res_base, - const char *name, u8 use_gpio) -{ - int i; - - if (!res_base || !res_base->start || !res_base->end) - return -ENODEV; - - for (i = 0; i < ARRAY_SIZE(ichx_regs[0]); i++) { - if (!(use_gpio & (1 << i))) - continue; - if (!request_region(res_base->start + ichx_regs[0][i], - ichx_reglen[i], name)) - goto request_err; - } - return 0; - -request_err: - /* Clean up: release already requested regions, if any */ - for (i--; i >= 0; i--) { - if (!(use_gpio & (1 << i))) - continue; - release_region(res_base->start + ichx_regs[0][i], - ichx_reglen[i]); - } - return -EBUSY; -} - -static void ichx_gpio_release_regions(struct resource *res_base, u8 use_gpio) -{ - int i; - - for (i = 0; i < ARRAY_SIZE(ichx_regs[0]); i++) { - if (!(use_gpio & (1 << i))) - continue; - release_region(res_base->start + ichx_regs[0][i], - ichx_reglen[i]); - } -} - static int __devinit ichx_gpio_probe(struct platform_device *pdev) { struct resource *res_base, *res_pm; @@ -391,11 +329,12 @@ static int __devinit ichx_gpio_probe(struct platform_device *pdev) } res_base = platform_get_resource(pdev, IORESOURCE_IO, ICH_RES_GPIO); - ichx_priv.use_gpio = ich_info->use_gpio; - err = ichx_gpio_request_regions(res_base, pdev->name, - ichx_priv.use_gpio); - if (err) - return err; + if (!res_base || !res_base->start || !res_base->end) + return -ENODEV; + + if (!request_region(res_base->start, resource_size(res_base), + pdev->name)) + return -EBUSY; ichx_priv.gpio_base = res_base; @@ -435,7 +374,8 @@ static int __devinit ichx_gpio_probe(struct platform_device *pdev) return 0; add_err: - ichx_gpio_release_regions(ichx_priv.gpio_base, ichx_priv.use_gpio); + release_region(ichx_priv.gpio_base->start, + resource_size(ichx_priv.gpio_base)); if (ichx_priv.pm_base) release_region(ichx_priv.pm_base->start, resource_size(ichx_priv.pm_base)); @@ -453,7 +393,8 @@ static int __devexit ichx_gpio_remove(struct platform_device *pdev) return err; } - ichx_gpio_release_regions(ichx_priv.gpio_base, ichx_priv.use_gpio); + release_region(ichx_priv.gpio_base->start, + resource_size(ichx_priv.gpio_base)); if (ichx_priv.pm_base) release_region(ichx_priv.pm_base->start, resource_size(ichx_priv.pm_base)); diff --git a/trunk/drivers/gpio/gpio-twl6040.c b/trunk/drivers/gpio/gpio-twl6040.c deleted file mode 100644 index dd58e8b25043..000000000000 --- a/trunk/drivers/gpio/gpio-twl6040.c +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Access to GPOs on TWL6040 chip - * - * Copyright (C) 2012 Texas Instruments, Inc. - * - * Authors: - * Sergio Aguirre - * Peter Ujfalusi - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include -#include -#include -#include -#include -#include -#include - -#include - -static struct gpio_chip twl6040gpo_chip; - -static int twl6040gpo_get(struct gpio_chip *chip, unsigned offset) -{ - struct twl6040 *twl6040 = dev_get_drvdata(chip->dev->parent); - int ret = 0; - - ret = twl6040_reg_read(twl6040, TWL6040_REG_GPOCTL); - if (ret < 0) - return ret; - - return (ret >> offset) & 1; -} - -static int twl6040gpo_direction_out(struct gpio_chip *chip, unsigned offset, - int value) -{ - /* This only drives GPOs, and can't change direction */ - return 0; -} - -static void twl6040gpo_set(struct gpio_chip *chip, unsigned offset, int value) -{ - struct twl6040 *twl6040 = dev_get_drvdata(chip->dev->parent); - int ret; - u8 gpoctl; - - ret = twl6040_reg_read(twl6040, TWL6040_REG_GPOCTL); - if (ret < 0) - return; - - if (value) - gpoctl = ret | (1 << offset); - else - gpoctl = ret & ~(1 << offset); - - twl6040_reg_write(twl6040, TWL6040_REG_GPOCTL, gpoctl); -} - -static struct gpio_chip twl6040gpo_chip = { - .label = "twl6040", - .owner = THIS_MODULE, - .get = twl6040gpo_get, - .direction_output = twl6040gpo_direction_out, - .set = twl6040gpo_set, - .can_sleep = 1, -}; - -/*----------------------------------------------------------------------*/ - -static int __devinit gpo_twl6040_probe(struct platform_device *pdev) -{ - struct twl6040_gpo_data *pdata = pdev->dev.platform_data; - struct device *twl6040_core_dev = pdev->dev.parent; - struct twl6040 *twl6040 = dev_get_drvdata(twl6040_core_dev); - int ret; - - if (pdata) - twl6040gpo_chip.base = pdata->gpio_base; - else - twl6040gpo_chip.base = -1; - - if (twl6040_get_revid(twl6040) < TWL6041_REV_ES2_0) - twl6040gpo_chip.ngpio = 3; /* twl6040 have 3 GPO */ - else - twl6040gpo_chip.ngpio = 1; /* twl6041 have 1 GPO */ - - twl6040gpo_chip.dev = &pdev->dev; -#ifdef CONFIG_OF_GPIO - twl6040gpo_chip.of_node = twl6040_core_dev->of_node; -#endif - - ret = gpiochip_add(&twl6040gpo_chip); - if (ret < 0) { - dev_err(&pdev->dev, "could not register gpiochip, %d\n", ret); - twl6040gpo_chip.ngpio = 0; - } - - return ret; -} - -static int __devexit gpo_twl6040_remove(struct platform_device *pdev) -{ - return gpiochip_remove(&twl6040gpo_chip); -} - -/* Note: this hardware lives inside an I2C-based multi-function device. */ -MODULE_ALIAS("platform:twl6040-gpo"); - -static struct platform_driver gpo_twl6040_driver = { - .driver = { - .name = "twl6040-gpo", - .owner = THIS_MODULE, - }, - .probe = gpo_twl6040_probe, - .remove = gpo_twl6040_remove, -}; - -module_platform_driver(gpo_twl6040_driver); - -MODULE_AUTHOR("Texas Instruments, Inc."); -MODULE_DESCRIPTION("GPO interface for TWL6040"); -MODULE_LICENSE("GPL"); diff --git a/trunk/drivers/gpu/drm/Kconfig b/trunk/drivers/gpu/drm/Kconfig index 18321b68b880..90e28081712d 100644 --- a/trunk/drivers/gpu/drm/Kconfig +++ b/trunk/drivers/gpu/drm/Kconfig @@ -22,7 +22,7 @@ menuconfig DRM config DRM_USB tristate depends on DRM - depends on USB_SUPPORT && USB_ARCH_HAS_HCD + depends on USB_ARCH_HAS_HCD select USB config DRM_KMS_HELPER @@ -54,21 +54,6 @@ config DRM_TTM GPU memory types. Will be enabled automatically if a device driver uses it. -config DRM_GEM_CMA_HELPER - bool - depends on DRM - help - Choose this if you need the GEM CMA helper functions - -config DRM_KMS_CMA_HELPER - bool - select DRM_GEM_CMA_HELPER - select FB_SYS_FILLRECT - select FB_SYS_COPYAREA - select FB_SYS_IMAGEBLIT - help - Choose this if you need the KMS CMA helper functions - config DRM_TDFX tristate "3dfx Banshee/Voodoo3+" depends on DRM && PCI @@ -208,5 +193,3 @@ source "drivers/gpu/drm/ast/Kconfig" source "drivers/gpu/drm/mgag200/Kconfig" source "drivers/gpu/drm/cirrus/Kconfig" - -source "drivers/gpu/drm/shmobile/Kconfig" diff --git a/trunk/drivers/gpu/drm/Makefile b/trunk/drivers/gpu/drm/Makefile index 2ff5cefe9ead..f65f65ed0ddf 100644 --- a/trunk/drivers/gpu/drm/Makefile +++ b/trunk/drivers/gpu/drm/Makefile @@ -15,13 +15,11 @@ drm-y := drm_auth.o drm_buffer.o drm_bufs.o drm_cache.o \ drm_trace_points.o drm_global.o drm_prime.o drm-$(CONFIG_COMPAT) += drm_ioc32.o -drm-$(CONFIG_DRM_GEM_CMA_HELPER) += drm_gem_cma_helper.o drm-usb-y := drm_usb.o drm_kms_helper-y := drm_fb_helper.o drm_crtc_helper.o drm_dp_i2c_helper.o drm_kms_helper-$(CONFIG_DRM_LOAD_EDID_FIRMWARE) += drm_edid_load.o -drm_kms_helper-$(CONFIG_DRM_KMS_CMA_HELPER) += drm_fb_cma_helper.o obj-$(CONFIG_DRM_KMS_HELPER) += drm_kms_helper.o @@ -47,5 +45,4 @@ obj-$(CONFIG_DRM_EXYNOS) +=exynos/ obj-$(CONFIG_DRM_GMA500) += gma500/ obj-$(CONFIG_DRM_UDL) += udl/ obj-$(CONFIG_DRM_AST) += ast/ -obj-$(CONFIG_DRM_SHMOBILE) +=shmobile/ obj-y += i2c/ diff --git a/trunk/drivers/gpu/drm/ast/ast_drv.c b/trunk/drivers/gpu/drm/ast/ast_drv.c index 31123b6a0be5..36164806b9d4 100644 --- a/trunk/drivers/gpu/drm/ast/ast_drv.c +++ b/trunk/drivers/gpu/drm/ast/ast_drv.c @@ -28,8 +28,9 @@ #include #include -#include -#include +#include "drmP.h" +#include "drm.h" +#include "drm_crtc_helper.h" #include "ast_drv.h" diff --git a/trunk/drivers/gpu/drm/ast/ast_drv.h b/trunk/drivers/gpu/drm/ast/ast_drv.h index 5ccf984f063a..d4af9edcbb97 100644 --- a/trunk/drivers/gpu/drm/ast/ast_drv.h +++ b/trunk/drivers/gpu/drm/ast/ast_drv.h @@ -28,13 +28,13 @@ #ifndef __AST_DRV_H__ #define __AST_DRV_H__ -#include +#include "drm_fb_helper.h" -#include -#include -#include -#include -#include +#include "ttm/ttm_bo_api.h" +#include "ttm/ttm_bo_driver.h" +#include "ttm/ttm_placement.h" +#include "ttm/ttm_memory.h" +#include "ttm/ttm_module.h" #include #include @@ -94,6 +94,7 @@ struct ast_private { struct drm_global_reference mem_global_ref; struct ttm_bo_global_ref bo_global_ref; struct ttm_bo_device bdev; + atomic_t validate_sequence; } ttm; struct drm_gem_object *cursor_cache; diff --git a/trunk/drivers/gpu/drm/ast/ast_fb.c b/trunk/drivers/gpu/drm/ast/ast_fb.c index d9ec77959dff..2fc8e9e860b1 100644 --- a/trunk/drivers/gpu/drm/ast/ast_fb.c +++ b/trunk/drivers/gpu/drm/ast/ast_fb.c @@ -37,9 +37,10 @@ #include -#include -#include -#include +#include "drmP.h" +#include "drm.h" +#include "drm_crtc.h" +#include "drm_fb_helper.h" #include "ast_drv.h" static void ast_dirty_update(struct ast_fbdev *afbdev, diff --git a/trunk/drivers/gpu/drm/ast/ast_main.c b/trunk/drivers/gpu/drm/ast/ast_main.c index f668e6cc0f7a..95ae55b8214b 100644 --- a/trunk/drivers/gpu/drm/ast/ast_main.c +++ b/trunk/drivers/gpu/drm/ast/ast_main.c @@ -25,12 +25,12 @@ /* * Authors: Dave Airlie */ -#include +#include "drmP.h" #include "ast_drv.h" -#include -#include +#include "drm_fb_helper.h" +#include "drm_crtc_helper.h" #include "ast_dram_tables.h" diff --git a/trunk/drivers/gpu/drm/ast/ast_mode.c b/trunk/drivers/gpu/drm/ast/ast_mode.c index 7fc9f7272b56..a712cafcfa1d 100644 --- a/trunk/drivers/gpu/drm/ast/ast_mode.c +++ b/trunk/drivers/gpu/drm/ast/ast_mode.c @@ -28,9 +28,9 @@ * Authors: Dave Airlie */ #include -#include -#include -#include +#include "drmP.h" +#include "drm_crtc.h" +#include "drm_crtc_helper.h" #include "ast_drv.h" #include "ast_tables.h" @@ -582,6 +582,7 @@ static const struct drm_crtc_helper_funcs ast_crtc_helper_funcs = { .mode_set_base = ast_crtc_mode_set_base, .disable = ast_crtc_disable, .load_lut = ast_crtc_load_lut, + .disable = ast_crtc_disable, .prepare = ast_crtc_prepare, .commit = ast_crtc_commit, @@ -736,7 +737,6 @@ static int ast_get_modes(struct drm_connector *connector) if (edid) { drm_mode_connector_update_edid_property(&ast_connector->base, edid); ret = drm_add_edid_modes(connector, edid); - kfree(edid); return ret; } else drm_mode_connector_update_edid_property(&ast_connector->base, NULL); diff --git a/trunk/drivers/gpu/drm/ast/ast_post.c b/trunk/drivers/gpu/drm/ast/ast_post.c index 977cfb35837a..6edbee63b0cb 100644 --- a/trunk/drivers/gpu/drm/ast/ast_post.c +++ b/trunk/drivers/gpu/drm/ast/ast_post.c @@ -26,7 +26,7 @@ * Authors: Dave Airlie */ -#include +#include "drmP.h" #include "ast_drv.h" #include "ast_dram_tables.h" diff --git a/trunk/drivers/gpu/drm/ast/ast_ttm.c b/trunk/drivers/gpu/drm/ast/ast_ttm.c index 1a026ac2dfb4..6cf2adea66bc 100644 --- a/trunk/drivers/gpu/drm/ast/ast_ttm.c +++ b/trunk/drivers/gpu/drm/ast/ast_ttm.c @@ -25,7 +25,7 @@ /* * Authors: Dave Airlie */ -#include +#include "drmP.h" #include "ast_drv.h" #include diff --git a/trunk/drivers/gpu/drm/ati_pcigart.c b/trunk/drivers/gpu/drm/ati_pcigart.c index c399dea27a3b..9afe495c12c7 100644 --- a/trunk/drivers/gpu/drm/ati_pcigart.c +++ b/trunk/drivers/gpu/drm/ati_pcigart.c @@ -32,7 +32,7 @@ */ #include -#include +#include "drmP.h" # define ATI_PCIGART_PAGE_SIZE 4096 /**< PCI GART page size */ diff --git a/trunk/drivers/gpu/drm/cirrus/cirrus_drv.c b/trunk/drivers/gpu/drm/cirrus/cirrus_drv.c index 101e423c8991..b83a2d7ddd1a 100644 --- a/trunk/drivers/gpu/drm/cirrus/cirrus_drv.c +++ b/trunk/drivers/gpu/drm/cirrus/cirrus_drv.c @@ -10,7 +10,8 @@ */ #include #include -#include +#include "drmP.h" +#include "drm.h" #include "cirrus_drv.h" diff --git a/trunk/drivers/gpu/drm/cirrus/cirrus_drv.h b/trunk/drivers/gpu/drm/cirrus/cirrus_drv.h index 6e0cc724e5a2..64ea597cb6d3 100644 --- a/trunk/drivers/gpu/drm/cirrus/cirrus_drv.h +++ b/trunk/drivers/gpu/drm/cirrus/cirrus_drv.h @@ -15,11 +15,11 @@ #include -#include -#include -#include -#include -#include +#include "ttm/ttm_bo_api.h" +#include "ttm/ttm_bo_driver.h" +#include "ttm/ttm_placement.h" +#include "ttm/ttm_memory.h" +#include "ttm/ttm_module.h" #define DRIVER_AUTHOR "Matthew Garrett" @@ -143,6 +143,7 @@ struct cirrus_device { struct drm_global_reference mem_global_ref; struct ttm_bo_global_ref bo_global_ref; struct ttm_bo_device bdev; + atomic_t validate_sequence; } ttm; bool mm_inited; }; diff --git a/trunk/drivers/gpu/drm/cirrus/cirrus_fbdev.c b/trunk/drivers/gpu/drm/cirrus/cirrus_fbdev.c index 6c6b4c87d309..9a276a536992 100644 --- a/trunk/drivers/gpu/drm/cirrus/cirrus_fbdev.c +++ b/trunk/drivers/gpu/drm/cirrus/cirrus_fbdev.c @@ -9,8 +9,9 @@ * Dave Airlie */ #include -#include -#include +#include "drmP.h" +#include "drm.h" +#include "drm_fb_helper.h" #include diff --git a/trunk/drivers/gpu/drm/cirrus/cirrus_main.c b/trunk/drivers/gpu/drm/cirrus/cirrus_main.c index 6a9b12e88d46..e3c122578417 100644 --- a/trunk/drivers/gpu/drm/cirrus/cirrus_main.c +++ b/trunk/drivers/gpu/drm/cirrus/cirrus_main.c @@ -8,8 +8,9 @@ * Authors: Matthew Garrett * Dave Airlie */ -#include -#include +#include "drmP.h" +#include "drm.h" +#include "drm_crtc_helper.h" #include "cirrus_drv.h" diff --git a/trunk/drivers/gpu/drm/cirrus/cirrus_mode.c b/trunk/drivers/gpu/drm/cirrus/cirrus_mode.c index 60685b21cc36..a44d31aa4e3c 100644 --- a/trunk/drivers/gpu/drm/cirrus/cirrus_mode.c +++ b/trunk/drivers/gpu/drm/cirrus/cirrus_mode.c @@ -14,8 +14,9 @@ * * Copyright 1999-2001 Jeff Garzik */ -#include -#include +#include "drmP.h" +#include "drm.h" +#include "drm_crtc_helper.h" #include