Merge branch 'for-linus' of git://git.kernel.dk/linux-block
authorLinus Torvalds <torvalds@linux-foundation.org>
Wed, 13 Sep 2017 17:20:41 +0000 (10:20 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 13 Sep 2017 17:20:41 +0000 (10:20 -0700)
Pull block fixes from Jens Axboe:
 "Small collection of fixes that would be nice to have in -rc1. This
  contains:

   - NVMe pull request form Christoph, mostly with fixes for nvme-pci,
     host memory buffer in particular.

   - Error handling fixup for cgwb_create(), in case allocation of 'wb'
     fails. From Christophe Jaillet.

   - Ensure that trace_block_getrq() gets the 'dev' in an appropriate
     fashion, to avoid a potential NULL deref. From Greg Thelen.

   - Regression fix for dm-mq with blk-mq, fixing a problem with
     stacking IO schedulers. From me.

   - string.h fixup, fixing an issue with memcpy_and_pad(). This
     original change came in through an NVMe dependency, which is why
     I'm including it here. From Martin Wilck.

   - Fix potential int overflow in __blkdev_sectors_to_bio_pages(), from
     Mikulas.

   - MBR enable fix for sed-opal, from Scott"

* 'for-linus' of git://git.kernel.dk/linux-block:
  block: directly insert blk-mq request from blk_insert_cloned_request()
  mm/backing-dev.c: fix an error handling path in 'cgwb_create()'
  string.h: un-fortify memcpy_and_pad
  nvme-pci: implement the HMB entry number and size limitations
  nvme-pci: propagate (some) errors from host memory buffer setup
  nvme-pci: use appropriate initial chunk size for HMB allocation
  nvme-pci: fix host memory buffer allocation fallback
  nvme: fix lightnvm check
  block: fix integer overflow in __blkdev_sectors_to_bio_pages()
  block: sed-opal: Set MBRDone on S3 resume path if TPER is MBREnabled
  block: tolerate tracing of NULL bio

361 files changed:
CREDITS
Documentation/ABI/testing/sysfs-fs-f2fs
Documentation/DMA-API.txt
Documentation/admin-guide/LSM/tomoyo.rst
Documentation/conf.py
Documentation/devicetree/bindings/pwm/pwm-bcm2835.txt
Documentation/devicetree/bindings/pwm/pwm-mediatek.txt
Documentation/devicetree/bindings/pwm/pwm-rockchip.txt
Documentation/devicetree/bindings/pwm/pwm-tiecap.txt
Documentation/devicetree/bindings/pwm/pwm-zx.txt [new file with mode: 0644]
Documentation/devicetree/bindings/pwm/renesas,tpu-pwm.txt
Documentation/devicetree/bindings/thermal/mediatek-thermal.txt
Documentation/devicetree/bindings/thermal/rockchip-thermal.txt
Documentation/devicetree/bindings/thermal/uniphier-thermal.txt [new file with mode: 0644]
Documentation/filesystems/Locking
Documentation/filesystems/f2fs.txt
Documentation/filesystems/vfs.txt
Documentation/translations/ko_KR/memory-barriers.txt
MAINTAINERS
arch/alpha/include/uapi/asm/siginfo.h
arch/alpha/kernel/traps.c
arch/arm/Kconfig
arch/arm/include/asm/smp_scu.h
arch/arm/include/asm/suspend.h
arch/arm/include/debug/omap2plus.S
arch/arm/kernel/entry-armv.S
arch/arm/kernel/entry-common.S
arch/arm/kernel/head.S
arch/arm/kernel/hyp-stub.S
arch/arm/kernel/iwmmxt.S
arch/arm/kernel/sleep.S
arch/arm/kernel/stacktrace.c
arch/arm/mach-exynos/sleep.S
arch/arm/mach-imx/mach-imx27_visstrim_m10.c
arch/arm/mach-imx/mach-mx31moboard.c
arch/arm/mach-omap2/sleep34xx.S
arch/arm/mach-omap2/sleep44xx.S
arch/arm/mach-pxa/mioa701_bootresume.S
arch/arm/mach-rockchip/sleep.S
arch/arm/mm/cache-v4wb.S
arch/arm/mm/fault.c
arch/arm/mm/proc-v7-3level.S
arch/arm/mm/proc-xscale.S
arch/arm64/kernel/signal32.c
arch/blackfin/include/uapi/asm/siginfo.h
arch/frv/include/uapi/asm/siginfo.h
arch/ia64/include/uapi/asm/siginfo.h
arch/ia64/kernel/signal.c
arch/ia64/kernel/traps.c
arch/metag/include/asm/dma-mapping.h
arch/mips/include/uapi/asm/siginfo.h
arch/mips/kernel/signal32.c
arch/mips/kernel/traps.c
arch/nios2/include/asm/dma-mapping.h
arch/parisc/kernel/signal32.c
arch/powerpc/kernel/signal_32.c
arch/s390/include/asm/ap.h [new file with mode: 0644]
arch/s390/include/asm/mmu.h
arch/s390/include/asm/mmu_context.h
arch/s390/include/asm/tlbflush.h
arch/s390/kernel/compat_signal.c
arch/s390/mm/gmap.c
arch/s390/mm/pgalloc.c
arch/sh/drivers/pci/fixups-dreamcast.c
arch/sparc/include/uapi/asm/siginfo.h
arch/sparc/kernel/signal32.c
arch/sparc/kernel/traps_32.c
arch/sparc/kernel/traps_64.c
arch/tile/include/asm/dma-mapping.h
arch/tile/include/uapi/asm/siginfo.h
arch/tile/kernel/compat_signal.c
arch/tile/kernel/traps.c
arch/x86/Kconfig
arch/x86/include/asm/cacheflush.h
arch/x86/include/asm/mem_encrypt.h
arch/x86/include/asm/mpspec.h
arch/x86/kernel/apic/apic.c
arch/x86/kernel/signal_compat.c
arch/x86/mm/mem_encrypt.c
drivers/acpi/nfit/Kconfig
drivers/acpi/nfit/core.c
drivers/base/dma-coherent.c
drivers/base/dma-mapping.c
drivers/block/rbd.c
drivers/char/virtio_console.c
drivers/dax/super.c
drivers/firmware/efi/cper.c
drivers/media/platform/soc_camera/sh_mobile_ceu_camera.c
drivers/net/ethernet/amd/au1000_eth.c
drivers/net/ethernet/i825xx/lasi_82596.c
drivers/net/ethernet/i825xx/lib82596.c
drivers/net/ethernet/i825xx/sni_82596.c
drivers/net/ethernet/seeq/sgiseeq.c
drivers/nvdimm/btt.c
drivers/nvdimm/btt.h
drivers/nvdimm/btt_devs.c
drivers/nvdimm/bus.c
drivers/nvdimm/claim.c
drivers/nvdimm/core.c
drivers/nvdimm/label.c
drivers/nvdimm/namespace_devs.c
drivers/nvdimm/nd.h
drivers/nvdimm/pfn_devs.c
drivers/nvdimm/pmem.h
drivers/nvdimm/region_devs.c
drivers/of/device.c
drivers/pwm/Kconfig
drivers/pwm/Makefile
drivers/pwm/pwm-bcm2835.c
drivers/pwm/pwm-hibvt.c
drivers/pwm/pwm-mediatek.c
drivers/pwm/pwm-meson.c
drivers/pwm/pwm-pca9685.c
drivers/pwm/pwm-renesas-tpu.c
drivers/pwm/pwm-rockchip.c
drivers/pwm/pwm-samsung.c
drivers/pwm/pwm-tegra.c
drivers/pwm/pwm-tiecap.c
drivers/pwm/pwm-tiehrpwm.c
drivers/pwm/pwm-vt8500.c
drivers/pwm/pwm-zx.c [new file with mode: 0644]
drivers/s390/block/dasd.c
drivers/s390/block/dasd_devmap.c
drivers/s390/block/dasd_int.h
drivers/s390/crypto/ap_asm.h
drivers/s390/crypto/ap_bus.c
drivers/s390/crypto/ap_bus.h
drivers/s390/crypto/ap_queue.c
drivers/scsi/NCR_Q720.c
drivers/thermal/Kconfig
drivers/thermal/Makefile
drivers/thermal/broadcom/bcm2835_thermal.c
drivers/thermal/hisi_thermal.c
drivers/thermal/int340x_thermal/acpi_thermal_rel.c
drivers/thermal/int340x_thermal/acpi_thermal_rel.h
drivers/thermal/int340x_thermal/int3400_thermal.c
drivers/thermal/int340x_thermal/int3406_thermal.c
drivers/thermal/int340x_thermal/processor_thermal_device.c
drivers/thermal/intel_pch_thermal.c
drivers/thermal/mtk_thermal.c
drivers/thermal/qoriq_thermal.c
drivers/thermal/rcar_gen3_thermal.c
drivers/thermal/rockchip_thermal.c
drivers/thermal/samsung/exynos_tmu.c
drivers/thermal/thermal_core.c
drivers/thermal/thermal_core.h
drivers/thermal/thermal_sysfs.c
drivers/thermal/uniphier_thermal.c [new file with mode: 0644]
drivers/thermal/zx2967_thermal.c
drivers/usb/host/ohci-sm501.c
drivers/usb/host/ohci-tmio.c
fs/ceph/addr.c
fs/ceph/cache.c
fs/ceph/caps.c
fs/ceph/debugfs.c
fs/ceph/dir.c
fs/ceph/file.c
fs/ceph/inode.c
fs/ceph/mds_client.c
fs/ceph/mdsmap.c
fs/ceph/snap.c
fs/ceph/super.c
fs/ceph/super.h
fs/ceph/xattr.c
fs/ext2/ext2.h
fs/ext2/inode.c
fs/ext2/super.c
fs/ext4/ext4.h
fs/ext4/inode.c
fs/ext4/super.c
fs/f2fs/acl.c
fs/f2fs/checkpoint.c
fs/f2fs/data.c
fs/f2fs/dir.c
fs/f2fs/f2fs.h
fs/f2fs/file.c
fs/f2fs/gc.c
fs/f2fs/gc.h
fs/f2fs/inline.c
fs/f2fs/inode.c
fs/f2fs/namei.c
fs/f2fs/node.c
fs/f2fs/recovery.c
fs/f2fs/segment.c
fs/f2fs/segment.h
fs/f2fs/super.c
fs/f2fs/sysfs.c
fs/f2fs/xattr.c
fs/fcntl.c
fs/fuse/cuse.c
fs/fuse/dev.c
fs/fuse/dir.c
fs/fuse/file.c
fs/fuse/fuse_i.h
fs/inode.c
fs/internal.h
fs/lockd/clntlock.c
fs/namespace.c
fs/nfs/callback_proc.c
fs/nfs/delegation.c
fs/nfs/dir.c
fs/nfs/direct.c
fs/nfs/file.c
fs/nfs/inode.c
fs/nfs/internal.h
fs/nfs/nfs4_fs.h
fs/nfs/nfs4proc.c
fs/nfs/pagelist.c
fs/nfs/pnfs.c
fs/nfs/pnfs.h
fs/nfs/pnfs_nfs.c
fs/nfs/read.c
fs/nfs/super.c
fs/nfs/write.c
fs/open.c
fs/overlayfs/dir.c
fs/overlayfs/inode.c
fs/overlayfs/overlayfs.h
fs/overlayfs/readdir.c
fs/overlayfs/super.c
fs/overlayfs/util.c
fs/signalfd.c
fs/xattr.c
fs/xfs/xfs_aops.c
fs/xfs/xfs_aops.h
fs/xfs/xfs_buf.c
fs/xfs/xfs_buf.h
fs/xfs/xfs_iomap.c
fs/xfs/xfs_linux.h
fs/xfs/xfs_super.c
include/linux/capability.h
include/linux/ceph/ceph_fs.h
include/linux/ceph/libceph.h
include/linux/ceph/mon_client.h
include/linux/ceph/rados.h
include/linux/cper.h
include/linux/cpuset.h
include/linux/dax.h
include/linux/dcache.h
include/linux/dma-mapping.h
include/linux/efi.h
include/linux/f2fs_fs.h
include/linux/fs.h
include/linux/libnvdimm.h
include/linux/lsm_audit.h
include/linux/lsm_hooks.h
include/linux/mem_encrypt.h
include/linux/nfs_fs.h
include/linux/nfs_page.h
include/linux/nfs_xdr.h
include/linux/security.h
include/linux/signal.h
include/linux/sunrpc/sched.h
include/linux/sunrpc/xdr.h
include/linux/sunrpc/xprt.h
include/linux/thermal.h
include/linux/user_namespace.h
include/trace/events/f2fs.h
include/uapi/asm-generic/siginfo.h
include/uapi/linux/capability.h
kernel/cgroup/cpuset.c
kernel/exit.c
kernel/fork.c
kernel/irq/irqdesc.c
kernel/irq/msi.c
kernel/pid_namespace.c
kernel/power/process.c
kernel/ptrace.c
kernel/sched/core.c
kernel/sched/fair.c
kernel/signal.c
kernel/sys.c
kernel/user_namespace.c
lib/Kconfig
net/bluetooth/l2cap_core.c
net/ceph/mon_client.c
net/ceph/osd_client.c
net/sunrpc/backchannel_rqst.c
net/sunrpc/clnt.c
net/sunrpc/svcsock.c
net/sunrpc/xprt.c
net/sunrpc/xprtrdma/backchannel.c
net/sunrpc/xprtrdma/fmr_ops.c
net/sunrpc/xprtrdma/frwr_ops.c
net/sunrpc/xprtrdma/rpc_rdma.c
net/sunrpc/xprtrdma/svc_rdma_backchannel.c
net/sunrpc/xprtrdma/transport.c
net/sunrpc/xprtrdma/verbs.c
net/sunrpc/xprtrdma/xprt_rdma.h
net/sunrpc/xprtsock.c
scripts/selinux/genheaders/genheaders.c
scripts/sphinx-pre-install
security/commoncap.c
security/lsm_audit.c
security/security.c
security/selinux/avc.c
security/selinux/hooks.c
security/selinux/include/avc.h
security/selinux/include/avc_ss.h
security/selinux/include/classmap.h
security/selinux/include/objsec.h
security/selinux/include/security.h
security/selinux/ss/avtab.c
security/selinux/ss/avtab.h
security/selinux/ss/constraint.h
security/selinux/ss/context.h
security/selinux/ss/ebitmap.c
security/selinux/ss/ebitmap.h
security/selinux/ss/hashtab.c
security/selinux/ss/hashtab.h
security/selinux/ss/mls.c
security/selinux/ss/mls.h
security/selinux/ss/mls_types.h
security/selinux/ss/policydb.c
security/selinux/ss/policydb.h
security/selinux/ss/services.c
security/selinux/ss/services.h
security/selinux/ss/sidtab.c
security/selinux/ss/sidtab.h
security/selinux/ss/symtab.c
security/selinux/ss/symtab.h
tools/include/uapi/linux/perf_event.h
tools/perf/Documentation/intel-pt.txt
tools/perf/Documentation/perf-mem.txt
tools/perf/Documentation/perf-record.txt
tools/perf/Documentation/perf-report.txt
tools/perf/Documentation/perf-script.txt
tools/perf/Documentation/perf-trace.txt
tools/perf/builtin-mem.c
tools/perf/builtin-record.c
tools/perf/builtin-script.c
tools/perf/builtin-stat.c
tools/perf/builtin-trace.c
tools/perf/perf.h
tools/perf/pmu-events/arch/powerpc/power9/frontend.json
tools/perf/pmu-events/arch/powerpc/power9/other.json
tools/perf/pmu-events/arch/powerpc/power9/pipeline.json
tools/perf/pmu-events/arch/powerpc/power9/pmc.json
tools/perf/tests/code-reading.c
tools/perf/tests/sample-parsing.c
tools/perf/ui/browsers/annotate.c
tools/perf/ui/browsers/hists.c
tools/perf/ui/stdio/hist.c
tools/perf/util/callchain.c
tools/perf/util/callchain.h
tools/perf/util/event.h
tools/perf/util/evsel.c
tools/perf/util/evsel.h
tools/perf/util/hist.c
tools/perf/util/hist.h
tools/perf/util/machine.c
tools/perf/util/parse-events.c
tools/perf/util/session.c
tools/perf/util/sort.c
tools/perf/util/sort.h
tools/perf/util/symbol.h
tools/perf/util/syscalltbl.c
tools/perf/util/syscalltbl.h
tools/testing/nvdimm/test/nfit.c
tools/testing/selftests/x86/mpx-mini-test.c
tools/testing/selftests/x86/protection_keys.c

diff --git a/CREDITS b/CREDITS
index 0d2d60de5a2539cc48c21eee25a226b08b8a2040..9fbd2c77b5462d71dd9d24b5966c03d528094ce6 100644 (file)
--- a/CREDITS
+++ b/CREDITS
@@ -2606,11 +2606,9 @@ E: tmolina@cablespeed.com
 D: bug fixes, documentation, minor hackery
 
 N: Paul Moore
-E: paul.moore@hp.com
-D: NetLabel author
-S: Hewlett-Packard
-S: 110 Spit Brook Road
-S: Nashua, NH 03062
+E: paul@paul-moore.com
+W: http://www.paul-moore.com
+D: NetLabel, SELinux, audit
 
 N: James Morris
 E: jmorris@namei.org
index 84c606fb3ca4dff45bbd59af27de49d6d86884ca..11b7f4ebea7c4b6a04d2ce3894ff1a8d9907e60a 100644 (file)
@@ -57,6 +57,15 @@ Contact:     "Jaegeuk Kim" <jaegeuk.kim@samsung.com>
 Description:
                 Controls the issue rate of small discard commands.
 
+What:          /sys/fs/f2fs/<disk>/discard_granularity
+Date:          July 2017
+Contact:       "Chao Yu" <yuchao0@huawei.com>
+Description:
+               Controls discard granularity of inner discard thread, inner thread
+               will not issue discards with size that is smaller than granularity.
+               The unit size is one block, now only support configuring in range
+               of [1, 512].
+
 What:          /sys/fs/f2fs/<disk>/max_victim_search
 Date:          January 2014
 Contact:       "Jaegeuk Kim" <jaegeuk.kim@samsung.com>
@@ -130,3 +139,15 @@ Date:              June 2017
 Contact:       "Chao Yu" <yuchao0@huawei.com>
 Description:
                 Controls current reserved blocks in system.
+
+What:          /sys/fs/f2fs/<disk>/gc_urgent
+Date:          August 2017
+Contact:       "Jaegeuk Kim" <jaegeuk@kernel.org>
+Description:
+                Do background GC agressively
+
+What:          /sys/fs/f2fs/<disk>/gc_urgent_sleep_time
+Date:          August 2017
+Contact:       "Jaegeuk Kim" <jaegeuk@kernel.org>
+Description:
+                Controls sleep time of GC urgent mode
index 45b29326d719b25395accc371177348a52ca1ace..ac66ae2509a91c50174f4e21091d025529cfe7fd 100644 (file)
@@ -515,14 +515,15 @@ API at all.
 ::
 
        void *
-       dma_alloc_noncoherent(struct device *dev, size_t size,
-                             dma_addr_t *dma_handle, gfp_t flag)
+       dma_alloc_attrs(struct device *dev, size_t size, dma_addr_t *dma_handle,
+                       gfp_t flag, unsigned long attrs)
 
-Identical to dma_alloc_coherent() except that the platform will
-choose to return either consistent or non-consistent memory as it sees
-fit.  By using this API, you are guaranteeing to the platform that you
-have all the correct and necessary sync points for this memory in the
-driver should it choose to return non-consistent memory.
+Identical to dma_alloc_coherent() except that when the
+DMA_ATTR_NON_CONSISTENT flags is passed in the attrs argument, the
+platform will choose to return either consistent or non-consistent memory
+as it sees fit.  By using this API, you are guaranteeing to the platform
+that you have all the correct and necessary sync points for this memory
+in the driver should it choose to return non-consistent memory.
 
 Note: where the platform can return consistent memory, it will
 guarantee that the sync points become nops.
@@ -535,12 +536,13 @@ that simply cannot make consistent memory.
 ::
 
        void
-       dma_free_noncoherent(struct device *dev, size_t size, void *cpu_addr,
-                            dma_addr_t dma_handle)
+       dma_free_attrs(struct device *dev, size_t size, void *cpu_addr,
+                      dma_addr_t dma_handle, unsigned long attrs)
 
-Free memory allocated by the nonconsistent API.  All parameters must
-be identical to those passed in (and returned by
-dma_alloc_noncoherent()).
+Free memory allocated by the dma_alloc_attrs().  All parameters common
+parameters must identical to those otherwise passed to dma_fre_coherent,
+and the attrs argument must be identical to the attrs passed to
+dma_alloc_attrs().
 
 ::
 
@@ -564,8 +566,8 @@ memory or doing partial flushes.
        dma_cache_sync(struct device *dev, void *vaddr, size_t size,
                       enum dma_data_direction direction)
 
-Do a partial sync of memory that was allocated by
-dma_alloc_noncoherent(), starting at virtual address vaddr and
+Do a partial sync of memory that was allocated by dma_alloc_attrs() with
+the DMA_ATTR_NON_CONSISTENT flag starting at virtual address vaddr and
 continuing on for size.  Again, you *must* observe the cache line
 boundaries when doing this.
 
@@ -590,34 +592,11 @@ size is the size of the area (must be multiples of PAGE_SIZE).
 
 flags can be ORed together and are:
 
-- DMA_MEMORY_MAP - request that the memory returned from
-  dma_alloc_coherent() be directly writable.
-
-- DMA_MEMORY_IO - request that the memory returned from
-  dma_alloc_coherent() be addressable using read()/write()/memcpy_toio() etc.
-
-One or both of these flags must be present.
-
-- DMA_MEMORY_INCLUDES_CHILDREN - make the declared memory be allocated by
-  dma_alloc_coherent of any child devices of this one (for memory residing
-  on a bridge).
-
 - DMA_MEMORY_EXCLUSIVE - only allocate memory from the declared regions.
   Do not allow dma_alloc_coherent() to fall back to system memory when
   it's out of memory in the declared region.
 
-The return value will be either DMA_MEMORY_MAP or DMA_MEMORY_IO and
-must correspond to a passed in flag (i.e. no returning DMA_MEMORY_IO
-if only DMA_MEMORY_MAP were passed in) for success or zero for
-failure.
-
-Note, for DMA_MEMORY_IO returns, all subsequent memory returned by
-dma_alloc_coherent() may no longer be accessed directly, but instead
-must be accessed using the correct bus functions.  If your driver
-isn't prepared to handle this contingency, it should not specify
-DMA_MEMORY_IO in the input flags.
-
-As a simplification for the platforms, only **one** such region of
+As a simplification for the platforms, only *one* such region of
 memory may be declared per device.
 
 For reasons of efficiency, most platforms choose to track the declared
index a5947218fa647f4f4e2cb2b032dfec85d34ce709..e2d6b6e150825e4f0d0b643850420dae867fbe5e 100644 (file)
@@ -9,8 +9,8 @@ TOMOYO is a name-based MAC extension (LSM module) for the Linux kernel.
 
 LiveCD-based tutorials are available at
 
-http://tomoyo.sourceforge.jp/1.7/1st-step/ubuntu10.04-live/
-http://tomoyo.sourceforge.jp/1.7/1st-step/centos5-live/
+http://tomoyo.sourceforge.jp/1.8/ubuntu12.04-live.html
+http://tomoyo.sourceforge.jp/1.8/centos6-live.html
 
 Though these tutorials use non-LSM version of TOMOYO, they are useful for you
 to know what TOMOYO is.
@@ -21,35 +21,35 @@ How to enable TOMOYO?
 Build the kernel with ``CONFIG_SECURITY_TOMOYO=y`` and pass ``security=tomoyo`` on
 kernel's command line.
 
-Please see http://tomoyo.sourceforge.jp/2.3/ for details.
+Please see http://tomoyo.osdn.jp/2.5/ for details.
 
 Where is documentation?
 =======================
 
 User <-> Kernel interface documentation is available at
-http://tomoyo.sourceforge.jp/2.3/policy-reference.html .
+http://tomoyo.osdn.jp/2.5/policy-specification/index.html .
 
 Materials we prepared for seminars and symposiums are available at
-http://sourceforge.jp/projects/tomoyo/docs/?category_id=532&language_id=1 .
+http://osdn.jp/projects/tomoyo/docs/?category_id=532&language_id=1 .
 Below lists are chosen from three aspects.
 
 What is TOMOYO?
   TOMOYO Linux Overview
-    http://sourceforge.jp/projects/tomoyo/docs/lca2009-takeda.pdf
+    http://osdn.jp/projects/tomoyo/docs/lca2009-takeda.pdf
   TOMOYO Linux: pragmatic and manageable security for Linux
-    http://sourceforge.jp/projects/tomoyo/docs/freedomhectaipei-tomoyo.pdf
+    http://osdn.jp/projects/tomoyo/docs/freedomhectaipei-tomoyo.pdf
   TOMOYO Linux: A Practical Method to Understand and Protect Your Own Linux Box
-    http://sourceforge.jp/projects/tomoyo/docs/PacSec2007-en-no-demo.pdf
+    http://osdn.jp/projects/tomoyo/docs/PacSec2007-en-no-demo.pdf
 
 What can TOMOYO do?
   Deep inside TOMOYO Linux
-    http://sourceforge.jp/projects/tomoyo/docs/lca2009-kumaneko.pdf
+    http://osdn.jp/projects/tomoyo/docs/lca2009-kumaneko.pdf
   The role of "pathname based access control" in security.
-    http://sourceforge.jp/projects/tomoyo/docs/lfj2008-bof.pdf
+    http://osdn.jp/projects/tomoyo/docs/lfj2008-bof.pdf
 
 History of TOMOYO?
   Realities of Mainlining
-    http://sourceforge.jp/projects/tomoyo/docs/lfj2008.pdf
+    http://osdn.jp/projects/tomoyo/docs/lfj2008.pdf
 
 What is future plan?
 ====================
@@ -60,6 +60,6 @@ multiple LSM modules at the same time. We feel sorry that you have to give up
 SELinux/SMACK/AppArmor etc. when you want to use TOMOYO.
 
 We hope that LSM becomes stackable in future. Meanwhile, you can use non-LSM
-version of TOMOYO, available at http://tomoyo.sourceforge.jp/1.7/ .
+version of TOMOYO, available at http://tomoyo.osdn.jp/1.8/ .
 LSM version of TOMOYO is a subset of non-LSM version of TOMOYO. We are planning
 to port non-LSM version's functionalities to LSM versions.
index f9054ab60cb1117b12f0f15c07a8199bb3a0ab37..63857d33778ce253b0b90dea8198ddab52a2bbe7 100644 (file)
@@ -271,10 +271,29 @@ latex_elements = {
 
 # Additional stuff for the LaTeX preamble.
     'preamble': '''
-        \\usepackage{ifthen}
+       % Use some font with UTF-8 support with XeLaTeX
+        \\usepackage{fontspec}
+        \\setsansfont{DejaVu Serif}
+        \\setromanfont{DejaVu Sans}
+        \\setmonofont{DejaVu Sans Mono}
+
+     '''
+}
+
+# Fix reference escape troubles with Sphinx 1.4.x
+if major == 1 and minor > 3:
+    latex_elements['preamble']  += '\\renewcommand*{\\DUrole}[2]{ #2 }\n'
+
+if major == 1 and minor <= 4:
+    latex_elements['preamble']  += '\\usepackage[margin=0.5in, top=1in, bottom=1in]{geometry}'
+elif major == 1 and (minor > 5 or (minor == 5 and patch >= 3)):
+    latex_elements['sphinxsetup'] = 'hmargin=0.5in, vmargin=1in'
+    latex_elements['preamble']  += '\\fvset{fontsize=auto}\n'
 
-        % Allow generate some pages in landscape
-        \\usepackage{lscape}
+# Customize notice background colors on Sphinx < 1.6:
+if major == 1 and minor < 6:
+   latex_elements['preamble']  += '''
+        \\usepackage{ifthen}
 
         % Put notes in color and let them be inside a table
        \\definecolor{NoteColor}{RGB}{204,255,255}
@@ -325,27 +344,26 @@ latex_elements = {
         }
        \\makeatother
 
-       % Use some font with UTF-8 support with XeLaTeX
-        \\usepackage{fontspec}
-        \\setsansfont{DejaVu Serif}
-        \\setromanfont{DejaVu Sans}
-        \\setmonofont{DejaVu Sans Mono}
-
-       % To allow adjusting table sizes
-       \\usepackage{adjustbox}
-
      '''
-}
-
-# Fix reference escape troubles with Sphinx 1.4.x
-if major == 1 and minor > 3:
-    latex_elements['preamble']  += '\\renewcommand*{\\DUrole}[2]{ #2 }\n'
 
-if major == 1 and minor <= 4:
-    latex_elements['preamble']  += '\\usepackage[margin=0.5in, top=1in, bottom=1in]{geometry}'
-elif major == 1 and (minor > 5 or (minor == 5 and patch >= 3)):
-    latex_elements['sphinxsetup'] = 'hmargin=0.5in, vmargin=1in'
-    latex_elements['preamble']  += '\\fvset{fontsize=auto}\n'
+# With Sphinx 1.6, it is possible to change the Bg color directly
+# by using:
+#      \definecolor{sphinxnoteBgColor}{RGB}{204,255,255}
+#      \definecolor{sphinxwarningBgColor}{RGB}{255,204,204}
+#      \definecolor{sphinxattentionBgColor}{RGB}{255,255,204}
+#      \definecolor{sphinximportantBgColor}{RGB}{192,255,204}
+#
+# However, it require to use sphinx heavy box with:
+#
+#      \renewenvironment{sphinxlightbox} {%
+#              \\begin{sphinxheavybox}
+#      }
+#              \\end{sphinxheavybox}
+#      }
+#
+# Unfortunately, the implementation is buggy: if a note is inside a
+# table, it isn't displayed well. So, for now, let's use boring
+# black and white notes.
 
 # Grouping the document tree into LaTeX files. List of tuples
 # (source start file, target name, title,
index cf573e85b11d602877119319060b61fb926aa9bc..8cf87d1bfca53c7d896a3ca610c09e068f78f7eb 100644 (file)
@@ -6,7 +6,7 @@ Required properties:
 - clocks: This clock defines the base clock frequency of the PWM hardware
   system, the period and the duty_cycle of the PWM signal is a multiple of
   the base period.
-- #pwm-cells: Should be 2. See pwm.txt in this directory for a description of
+- #pwm-cells: Should be 3. See pwm.txt in this directory for a description of
   the cells format.
 
 Examples:
@@ -15,7 +15,7 @@ pwm@2020c000 {
        compatible = "brcm,bcm2835-pwm";
        reg = <0x2020c000 0x28>;
        clocks = <&clk_pwm>;
-       #pwm-cells = <2>;
+       #pwm-cells = <3>;
 };
 
 clocks {
index 54c59b0560ad701f9542da665f845c3bb1add186..ef8bd3cb67abb6ee8e94e43541d5638fc894ad15 100644 (file)
@@ -2,6 +2,8 @@ MediaTek PWM controller
 
 Required properties:
  - compatible: should be "mediatek,<name>-pwm":
+   - "mediatek,mt2712-pwm": found on mt2712 SoC.
+   - "mediatek,mt7622-pwm": found on mt7622 SoC.
    - "mediatek,mt7623-pwm": found on mt7623 SoC.
  - reg: physical base address and length of the controller's registers.
  - #pwm-cells: must be 2. See pwm.txt in this directory for a description of
@@ -10,7 +12,9 @@ Required properties:
  - clock-names: must contain the following:
    - "top": the top clock generator
    - "main": clock used by the PWM core
-   - "pwm1-5": the five per PWM clocks
+   - "pwm1-8": the eight per PWM clocks for mt2712
+   - "pwm1-6": the six per PWM clocks for mt7622
+   - "pwm1-5": the five per PWM clocks for mt7623
  - pinctrl-names: Must contain a "default" entry.
  - pinctrl-0: One property must exist for each entry in pinctrl-names.
    See pinctrl/pinctrl-bindings.txt for details of the property values.
index b8be3d09ee26b7522fa373eefd1903aef8ce3d41..2c5e52a5bede2da427a91b5dbf8996462f393551 100644 (file)
@@ -3,10 +3,17 @@ Rockchip PWM controller
 Required properties:
  - compatible: should be "rockchip,<name>-pwm"
    "rockchip,rk2928-pwm": found on RK29XX,RK3066 and RK3188 SoCs
-   "rockchip,rk3288-pwm": found on RK3288 SoC
+   "rockchip,rk3288-pwm": found on RK3288 SOC
+   "rockchip,rv1108-pwm", "rockchip,rk3288-pwm": found on RV1108 SoC
    "rockchip,vop-pwm": found integrated in VOP on RK3288 SoC
  - reg: physical base address and length of the controller's registers
- - clocks: phandle and clock specifier of the PWM reference clock
+ - clocks: See ../clock/clock-bindings.txt
+   - For older hardware (rk2928, rk3066, rk3188, rk3228, rk3288, rk3399):
+     - There is one clock that's used both to derive the functional clock
+       for the device and as the bus clock.
+   - For newer hardware (rk3328 and future socs): specified by name
+     - "pwm": This is used to derive the functional clock.
+     - "pclk": This is the APB bus clock.
  - #pwm-cells: must be 2 (rk2928) or 3 (rk3288). See pwm.txt in this directory
    for a description of the cell format.
 
index 8007e839a716d414e5e98b2bc70c62e501a5fdc7..06a363d9ccef9069124ae813bfb449d8cab182c7 100644 (file)
@@ -6,6 +6,7 @@ Required properties:
   for am4372 - compatible = "ti,am4372-ecap", "ti,am3352-ecap", "ti,am33xx-ecap";
   for da850  - compatible = "ti,da850-ecap", "ti,am3352-ecap", "ti,am33xx-ecap";
   for dra746 - compatible = "ti,dra746-ecap", "ti,am3352-ecap";
+  for 66ak2g - compatible = "ti,k2g-ecap", "ti,am3352-ecap";
 - #pwm-cells: should be 3. See pwm.txt in this directory for a description of
   the cells format. The PWM channel index ranges from 0 to 4. The only third
   cell flag supported by this binding is PWM_POLARITY_INVERTED.
diff --git a/Documentation/devicetree/bindings/pwm/pwm-zx.txt b/Documentation/devicetree/bindings/pwm/pwm-zx.txt
new file mode 100644 (file)
index 0000000..a6bcc75
--- /dev/null
@@ -0,0 +1,22 @@
+ZTE ZX PWM controller
+
+Required properties:
+ - compatible: Should be "zte,zx296718-pwm".
+ - reg: Physical base address and length of the controller's registers.
+ - clocks : The phandle and specifier referencing the controller's clocks.
+ - clock-names: "pclk" for PCLK, "wclk" for WCLK to the PWM controller.  The
+   PCLK is for register access, while WCLK is the reference clock for
+   calculating period and duty cycles.
+ - #pwm-cells: Should be 3. See pwm.txt in this directory for a description of
+   the cells format.
+
+Example:
+
+       pwm: pwm@1439000 {
+               compatible = "zte,zx296718-pwm";
+               reg = <0x1439000 0x1000>;
+               clocks = <&lsp1crm LSP1_PWM_PCLK>,
+                        <&lsp1crm LSP1_PWM_WCLK>;
+               clock-names = "pclk", "wclk";
+               #pwm-cells = <3>;
+       };
index b067e84a94b5e92d0ecd9c0857bd2af793d51ebf..1aadc804dae4e30b2bbf40650c1edd0ac1600d1b 100644 (file)
@@ -6,7 +6,6 @@ Required Properties:
     - "renesas,tpu-r8a73a4": for R8A77A4 (R-Mobile APE6) compatible PWM controller.
     - "renesas,tpu-r8a7740": for R8A7740 (R-Mobile A1) compatible PWM controller.
     - "renesas,tpu-r8a7790": for R8A7790 (R-Car H2) compatible PWM controller.
-    - "renesas,tpu-sh7372": for SH7372 (SH-Mobile AP4) compatible PWM controller.
     - "renesas,tpu": for generic R-Car TPU PWM controller.
 
   - reg: Base address and length of each memory resource used by the PWM
index e2f494d74d8a3fba16c328a3237fd4621ba3caf0..0d73ea5e9c0c41da00f34d98fcb86ea5d27e200b 100644 (file)
@@ -11,6 +11,7 @@ Required properties:
 - compatible:
   - "mediatek,mt8173-thermal" : For MT8173 family of SoCs
   - "mediatek,mt2701-thermal" : For MT2701 family of SoCs
+  - "mediatek,mt2712-thermal" : For MT2712 family of SoCs
 - reg: Address range of the thermal controller
 - interrupts: IRQ for the thermal controller
 - clocks, clock-names: Clocks needed for the thermal controller. required
index 43003aec94bd15ccadc2faf3d57e3be6088c9fba..e3a6234fb1acdbf3efdbf61c233c5151a98adc4f 100644 (file)
@@ -4,6 +4,7 @@ Required properties:
 - compatible : should be "rockchip,<name>-tsadc"
    "rockchip,rk3228-tsadc": found on RK3228 SoCs
    "rockchip,rk3288-tsadc": found on RK3288 SoCs
+   "rockchip,rk3328-tsadc": found on RK3328 SoCs
    "rockchip,rk3368-tsadc": found on RK3368 SoCs
    "rockchip,rk3399-tsadc": found on RK3399 SoCs
 - reg : physical base address of the controller and length of memory mapped
diff --git a/Documentation/devicetree/bindings/thermal/uniphier-thermal.txt b/Documentation/devicetree/bindings/thermal/uniphier-thermal.txt
new file mode 100644 (file)
index 0000000..686c0b4
--- /dev/null
@@ -0,0 +1,64 @@
+* UniPhier Thermal bindings
+
+This describes the devicetree bindings for thermal monitor supported by
+PVT(Process, Voltage and Temperature) monitoring unit implemented on Socionext
+UniPhier SoCs.
+
+Required properties:
+- compatible :
+  - "socionext,uniphier-pxs2-thermal" : For UniPhier PXs2 SoC
+  - "socionext,uniphier-ld20-thermal" : For UniPhier LD20 SoC
+- interrupts : IRQ for the temperature alarm
+- #thermal-sensor-cells : Should be 0. See ./thermal.txt for details.
+
+Optional properties:
+- socionext,tmod-calibration: A pair of calibrated values referred from PVT,
+                              in case that the values aren't set on SoC,
+                              like a reference board.
+
+Example:
+
+       sysctrl@61840000 {
+               compatible = "socionext,uniphier-ld20-sysctrl",
+                            "simple-mfd", "syscon";
+               reg = <0x61840000 0x10000>;
+               ...
+               pvtctl: pvtctl {
+                       compatible = "socionext,uniphier-ld20-thermal";
+                       interrupts = <0 3 1>;
+                       #thermal-sensor-cells = <0>;
+               };
+               ...
+       };
+
+       thermal-zones {
+               cpu_thermal {
+                       polling-delay-passive = <250>;  /* 250ms */
+                       polling-delay = <1000>;         /* 1000ms */
+                       thermal-sensors = <&pvtctl>;
+
+                       trips {
+                               cpu_crit: cpu_crit {
+                                       temperature = <110000>; /* 110C */
+                                       hysteresis = <2000>;
+                                       type = "critical";
+                               };
+                               cpu_alert: cpu_alert {
+                                       temperature = <100000>; /* 100C */
+                                       hysteresis = <2000>;
+                                       type = "passive";
+                               };
+                       };
+
+                       cooling-maps {
+                               map0 {
+                                       trip = <&cpu_alert>;
+                                       cooling-device = <&cpu0 (-1) (-1)>;
+                               };
+                               map1 {
+                                       trip = <&cpu_alert>;
+                                       cooling-device = <&cpu2 (-1) (-1)>;
+                               };
+                       };
+               };
+       };
index fe25787ff6d49748c3e1ecc494f17e401a60916a..75d2d57e2c4421122434aa855444e8a344c38f21 100644 (file)
@@ -22,7 +22,7 @@ prototypes:
        struct vfsmount *(*d_automount)(struct path *path);
        int (*d_manage)(const struct path *, bool);
        struct dentry *(*d_real)(struct dentry *, const struct inode *,
-                                unsigned int);
+                                unsigned int, unsigned int);
 
 locking rules:
                rename_lock     ->d_lock        may block       rcu-walk
index 273ccb26885e9c6ff6d1da17c655d6316cbefef8..13c2ff0343485f7595b66da41aa96475a4602bfd 100644 (file)
@@ -164,6 +164,16 @@ io_bits=%u             Set the bit size of write IO requests. It should be set
                        with "mode=lfs".
 usrquota               Enable plain user disk quota accounting.
 grpquota               Enable plain group disk quota accounting.
+prjquota               Enable plain project quota accounting.
+usrjquota=<file>       Appoint specified file and type during mount, so that quota
+grpjquota=<file>       information can be properly updated during recovery flow,
+prjjquota=<file>       <quota file>: must be in root directory;
+jqfmt=<quota type>     <quota type>: [vfsold,vfsv0,vfsv1].
+offusrjquota           Turn off user journelled quota.
+offgrpjquota           Turn off group journelled quota.
+offprjjquota           Turn off project journelled quota.
+quota                  Enable plain user disk quota accounting.
+noquota                Disable all plain disk quota option.
 
 ================================================================================
 DEBUGFS ENTRIES
@@ -209,6 +219,15 @@ Files in /sys/fs/f2fs/<devname>
                               gc_idle = 1 will select the Cost Benefit approach
                               & setting gc_idle = 2 will select the greedy approach.
 
+ gc_urgent                    This parameter controls triggering background GCs
+                              urgently or not. Setting gc_urgent = 0 [default]
+                              makes back to default behavior, while if it is set
+                              to 1, background thread starts to do GC by given
+                              gc_urgent_sleep_time interval.
+
+ gc_urgent_sleep_time         This parameter controls sleep time for gc_urgent.
+                              500 ms is set by default. See above gc_urgent.
+
  reclaim_segments             This parameter controls the number of prefree
                               segments to be reclaimed. If the number of prefree
                              segments is larger than the number of segments
index 405a3df759b33938dc9b6cc4e819673538f973a1..5fd325df59e2233df60cbf6da6c92230aa0c26ef 100644 (file)
@@ -988,7 +988,7 @@ struct dentry_operations {
        struct vfsmount *(*d_automount)(struct path *);
        int (*d_manage)(const struct path *, bool);
        struct dentry *(*d_real)(struct dentry *, const struct inode *,
-                                unsigned int);
+                                unsigned int, unsigned int);
 };
 
   d_revalidate: called when the VFS needs to revalidate a dentry. This
index bc80fc0e210f0634891b8252c48fcfc0350a712a..a7a813258013e7812ad6197c5da62af6cd03dad7 100644 (file)
@@ -523,11 +523,11 @@ CPU 에게 기대할 수 있는 최소한의 보장사항 몇가지가 있습니
      즉, ACQUIRE 는 최소한의 "취득" 동작처럼, 그리고 RELEASE 는 최소한의 "공개"
      처럼 동작한다는 의미입니다.
 
-core-api/atomic_ops.rst 에서 설명되는 어토믹 오퍼레이션들 중에는 완전히
-순서잡힌 것들과 (배리어를 사용하지 않는) 완화된 순서의 것들 외에 ACQUIRE 와
-RELEASE 부류의 것들도 존재합니다.  로드와 스토어를 모두 수행하는 조합된 어토믹
-오퍼레이션에서, ACQUIRE 는 해당 오퍼레이션의 로드 부분에만 적용되고 RELEASE 는
-해당 오퍼레이션의 스토어 부분에만 적용됩니다.
+atomic_t.txt 에 설명된 어토믹 오퍼레이션들 중 일부는 완전히 순서잡힌 것들과
+(배리어를 사용하지 않는) 완화된 순서의 것들 외에 ACQUIRE 와 RELEASE 부류의
+것들도 존재합니다.  로드와 스토어를 모두 수행하는 조합된 어토믹 오퍼레이션에서,
+ACQUIRE 는 해당 오퍼레이션의 로드 부분에만 적용되고 RELEASE 는 해당
+오퍼레이션의 스토어 부분에만 적용됩니다.
 
 메모리 배리어들은 두 CPU 간, 또는 CPU 와 디바이스 간에 상호작용의 가능성이 있을
 때에만 필요합니다.  만약 어떤 코드에 그런 상호작용이 없을 것이 보장된다면, 해당
@@ -617,7 +617,22 @@ RELEASE 부류의 것들도 존재합니다.  로드와 스토어를 모두 수
 이 변경은 앞의 처음 두가지 결과 중 하나만이 발생할 수 있고, 세번째의 결과는
 발생할 수 없도록 합니다.
 
-데이터 의존성 배리어는 의존적 쓰기에 대해서도 순서를 잡아줍니다:
+
+[!] 이 상당히 반직관적인 상황은 분리된 캐시를 가지는 기계들에서 가장 잘
+발생하는데, 예를 들면 한 캐시 뱅크는 짝수 번호의 캐시 라인들을 처리하고, 다른
+뱅크는 홀수 번호의 캐시 라인들을 처리하는 경우임을 알아두시기 바랍니다.  포인터
+P 는 짝수 번호 캐시 라인에 저장되어 있고, 변수 B 는 홀수 번호 캐시 라인에
+저장되어 있을 수 있습니다.  여기서 값을 읽어오는 CPU 의 캐시의 홀수 번호 처리
+뱅크는 열심히 일감을 처리중인 반면 홀수 번호 처리 뱅크는 할 일 없이 한가한
+중이라면 포인터 P (&B) 의 새로운 값과 변수 B 의 기존 값 (2) 를 볼 수 있습니다.
+
+
+의존적 쓰기들의 순서를 맞추는데에는 데이터 의존성 배리어가 필요치 않은데, 이는
+리눅스 커널이 지원하는 CPU 들은 (1) 쓰기가 정말로 일어날지, (2) 쓰기가 어디에
+이루어질지, 그리고 (3) 쓰여질 값을 확실히 알기 전까지는 쓰기를 수행하지 않기
+때문입니다.  하지만 "컨트롤 의존성" 섹션과
+Documentation/RCU/rcu_dereference.txt 파일을 주의 깊게 읽어 주시기 바랍니다:
+컴파일러는 매우 창의적인 많은 방법으로 종속성을 깰 수 있습니다.
 
        CPU 1                 CPU 2
        ===============       ===============
@@ -626,28 +641,19 @@ RELEASE 부류의 것들도 존재합니다.  로드와 스토어를 모두 수
        <쓰기 배리어>
        WRITE_ONCE(P, &B);
                              Q = READ_ONCE(P);
-                             <데이터 의존성 배리어>
-                             *Q = 5;
+                             WRITE_ONCE(*Q, 5);
 
-이 데이터 의존성 배리어는 Q 로의 읽기가 *Q 로의 스토어와 순서를 맞추게
-해줍니다.  이는 다음과 같은 결과를 막습니다:
+따라서, Q 로의 읽기와 *Q 로의 쓰기 사이에는 데이터 종속성 배리어가 필요치
+않습니다.  달리 말하면, 데이터 종속성 배리어가 없더라도 다음 결과는 생기지
+않습니다:
 
        (Q == &B) && (B == 4)
 
 이런 패턴은 드물게 사용되어야 함을 알아 두시기 바랍니다.  무엇보다도, 의존성
 순서 규칙의 의도는 쓰기 작업을 -예방- 해서 그로 인해 발생하는 비싼 캐시 미스도
 없애려는 것입니다.  이 패턴은 드물게 발생하는 에러 조건 같은것들을 기록하는데
-사용될 수 있고, 이렇게 배리어를 사용해 순서를 지키게 함으로써 그런 기록이
-사라지는 것을 막습니다.
-
-
-[!] 상당히 비직관적인 이 상황은 분리된 캐시를 가진 기계, 예를 들어 한 캐시
-뱅크가 짝수번 캐시 라인을 처리하고 다른 뱅크는 홀수번 캐시 라인을 처리하는 기계
-등에서 가장 잘 발생합니다.  포인터 P 는 홀수 번호의 캐시 라인에 있고, 변수 B 는
-짝수 번호 캐시 라인에 있다고 생각해 봅시다.  그런 상태에서 읽기 작업을 하는 CPU
-의 짝수번 뱅크는 할 일이 쌓여 매우 바쁘지만 홀수번 뱅크는 할 일이 없어 아무
-일도 하지 않고  있었다면, 포인터 P 는 새 값 (&B) 을, 그리고 변수 B 는 옛날 값
-(2) 을 가지고 있는 상태가 보여질 수도 있습니다.
+사용될 수 있으며, CPU의 자연적인 순서 보장이 그런 기록들을 사라지지 않게
+해줍니다.
 
 
 데이터 의존성 배리어는 매우 중요한데, 예를 들어 RCU 시스템에서 그렇습니다.
@@ -1848,8 +1854,7 @@ Mandatory 배리어들은 SMP 시스템에서도 UP 시스템에서도 SMP 효
      이 코드는 객체의 업데이트된 death 마크가 레퍼런스 카운터 감소 동작
      *전에* 보일 것을 보장합니다.
 
-     더 많은 정보를 위해선 Documentation/core-api/atomic_ops.rst 문서를 참고하세요.
-     어디서 이것들을 사용해야 할지 궁금하다면 "어토믹 오퍼레이션" 서브섹션을
+     더 많은 정보를 위해선 Documentation/atomic_{t,bitops}.txt 문서를
      참고하세요.
 
 
@@ -2468,86 +2473,7 @@ _않습니다_.
 전체 메모리 배리어를 내포하고 또 일부는 내포하지 않지만, 커널에서 상당히
 의존적으로 사용하는 기능 중 하나입니다.
 
-메모리의 어떤 상태를 수정하고 해당 상태에 대한 (예전의 또는 최신의) 정보를
-리턴하는 어토믹 오퍼레이션은 모두 SMP-조건적 범용 메모리 배리어(smp_mb())를
-실제 오퍼레이션의 앞과 뒤에 내포합니다.  이런 오퍼레이션은 다음의 것들을
-포함합니다:
-
-       xchg();
-       atomic_xchg();                  atomic_long_xchg();
-       atomic_inc_return();            atomic_long_inc_return();
-       atomic_dec_return();            atomic_long_dec_return();
-       atomic_add_return();            atomic_long_add_return();
-       atomic_sub_return();            atomic_long_sub_return();
-       atomic_inc_and_test();          atomic_long_inc_and_test();
-       atomic_dec_and_test();          atomic_long_dec_and_test();
-       atomic_sub_and_test();          atomic_long_sub_and_test();
-       atomic_add_negative();          atomic_long_add_negative();
-       test_and_set_bit();
-       test_and_clear_bit();
-       test_and_change_bit();
-
-       /* exchange 조건이 성공할 때 */
-       cmpxchg();
-       atomic_cmpxchg();               atomic_long_cmpxchg();
-       atomic_add_unless();            atomic_long_add_unless();
-
-이것들은 메모리 배리어 효과가 필요한 ACQUIRE 부류와 RELEASE 부류 오퍼레이션들을
-구현할 때, 그리고 객체 해제를 위해 레퍼런스 카운터를 조정할 때, 암묵적 메모리
-배리어 효과가 필요한 곳 등에 사용됩니다.
-
-
-다음의 오퍼레이션들은 메모리 배리어를 내포하지 _않기_ 때문에 문제가 될 수
-있지만, RELEASE 부류의 오퍼레이션들과 같은 것들을 구현할 때 사용될 수도
-있습니다:
-
-       atomic_set();
-       set_bit();
-       clear_bit();
-       change_bit();
-
-이것들을 사용할 때에는 필요하다면 적절한 (예를 들면 smp_mb__before_atomic()
-같은) 메모리 배리어가 명시적으로 함께 사용되어야 합니다.
-
-
-아래의 것들도 메모리 배리어를 내포하지 _않기_ 때문에, 일부 환경에서는 (예를
-들면 smp_mb__before_atomic() 과 같은) 명시적인 메모리 배리어 사용이 필요합니다.
-
-       atomic_add();
-       atomic_sub();
-       atomic_inc();
-       atomic_dec();
-
-이것들이 통계 생성을 위해 사용된다면, 그리고 통계 데이터 사이에 관계가 존재하지
-않는다면 메모리 배리어는 필요치 않을 겁니다.
-
-객체의 수명을 관리하기 위해 레퍼런스 카운팅 목적으로 사용된다면, 레퍼런스
-카운터는 락으로 보호되는 섹션에서만 조정되거나 호출하는 쪽이 이미 충분한
-레퍼런스를 잡고 있을 것이기 때문에 메모리 배리어는 아마 필요 없을 겁니다.
-
-만약 어떤 락을 구성하기 위해 사용된다면, 락 관련 동작은 일반적으로 작업을 특정
-순서대로 진행해야 하므로 메모리 배리어가 필요할 수 있습니다.
-
-기본적으로, 각 사용처에서는 메모리 배리어가 필요한지 아닌지 충분히 고려해야
-합니다.
-
-아래의 오퍼레이션들은 특별한 락 관련 동작들입니다:
-
-       test_and_set_bit_lock();
-       clear_bit_unlock();
-       __clear_bit_unlock();
-
-이것들은 ACQUIRE 류와 RELEASE 류의 오퍼레이션들을 구현합니다.  락 관련 도구를
-구현할 때에는 이것들을 좀 더 선호하는 편이 나은데, 이것들의 구현은 많은
-아키텍쳐에서 최적화 될 수 있기 때문입니다.
-
-[!] 이런 상황에 사용할 수 있는 특수한 메모리 배리어 도구들이 있습니다만, 일부
-CPU 에서는 사용되는 어토믹 인스트럭션 자체에 메모리 배리어가 내포되어 있어서
-어토믹 오퍼레이션과 메모리 배리어를 함께 사용하는 게 불필요한 일이 될 수
-있는데, 그런 경우에 이 특수 메모리 배리어 도구들은 no-op 이 되어 실질적으로
-아무일도 하지 않습니다.
-
-더 많은 내용을 위해선 Documentation/core-api/atomic_ops.rst 를 참고하세요.
+더 많은 내용을 위해선 Documentation/atomic_t.txt 를 참고하세요.
 
 
 디바이스 액세스
index fbb269415f0672c408558289ec5c4a5d5cdafcc5..f46a3225e3985bf38dc30c77cc8b34a1e2b6a1a2 100644 (file)
@@ -4219,7 +4219,7 @@ DMA MAPPING HELPERS
 M:     Christoph Hellwig <hch@lst.de>
 M:     Marek Szyprowski <m.szyprowski@samsung.com>
 R:     Robin Murphy <robin.murphy@arm.com>
-L:     linux-kernel@vger.kernel.org
+L:     iommu@lists.linux-foundation.org
 T:     git git://git.infradead.org/users/hch/dma-mapping.git
 W:     http://git.infradead.org/users/hch/dma-mapping.git
 S:     Supported
@@ -9298,15 +9298,6 @@ F:       net/*/netfilter/
 F:     net/netfilter/
 F:     net/bridge/br_netfilter*.c
 
-NETLABEL
-M:     Paul Moore <paul@paul-moore.com>
-W:     http://netlabel.sf.net
-L:     netdev@vger.kernel.org
-S:     Maintained
-F:     Documentation/netlabel/
-F:     include/net/netlabel.h
-F:     net/netlabel/
-
 NETROM NETWORK LAYER
 M:     Ralf Baechle <ralf@linux-mips.org>
 L:     linux-hams@vger.kernel.org
@@ -9434,10 +9425,23 @@ F:      net/ipv6/
 F:     include/net/ip*
 F:     arch/x86/net/*
 
-NETWORKING [LABELED] (NetLabel, CIPSO, Labeled IPsec, SECMARK)
+NETWORKING [LABELED] (NetLabel, Labeled IPsec, SECMARK)
 M:     Paul Moore <paul@paul-moore.com>
+W:     https://github.com/netlabel
 L:     netdev@vger.kernel.org
+L:     linux-security-module@vger.kernel.org
 S:     Maintained
+F:     Documentation/netlabel/
+F:     include/net/calipso.h
+F:     include/net/cipso_ipv4.h
+F:     include/net/netlabel.h
+F:     include/uapi/linux/netfilter/xt_SECMARK.h
+F:     include/uapi/linux/netfilter/xt_CONNSECMARK.h
+F:     net/netlabel/
+F:     net/ipv4/cipso_ipv4.c
+F:     net/ipv6/calipso.c
+F:     net/netfilter/xt_CONNSECMARK.c
+F:     net/netfilter/xt_SECMARK.c
 
 NETWORKING [TLS]
 M:     Ilya Lesokhin <ilyal@mellanox.com>
@@ -12023,8 +12027,9 @@ M:      Paul Moore <paul@paul-moore.com>
 M:     Stephen Smalley <sds@tycho.nsa.gov>
 M:     Eric Paris <eparis@parisplace.org>
 L:     selinux@tycho.nsa.gov (moderated for non-subscribers)
-W:     http://selinuxproject.org
-T:     git git://git.infradead.org/users/pcmoore/selinux
+W:     https://selinuxproject.org
+W:     https://github.com/SELinuxProject
+T:     git git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/selinux.git
 S:     Supported
 F:     include/linux/selinux*
 F:     security/selinux/
index 9822362a842461a178dcb51fbaf7f922165442f8..70494d1d8f297e17f59f319570067c08a15b9271 100644 (file)
@@ -6,4 +6,18 @@
 
 #include <asm-generic/siginfo.h>
 
+/*
+ * SIGFPE si_codes
+ */
+#ifdef __KERNEL__
+#define FPE_FIXME      0       /* Broken dup of SI_USER */
+#endif /* __KERNEL__ */
+
+/*
+ * SIGTRAP si_codes
+ */
+#ifdef __KERNEL__
+#define TRAP_FIXME     0       /* Broken dup of SI_USER */
+#endif /* __KERNEL__ */
+
 #endif
index ddb89a18cf26f76cafc174172adc068bbe9e919e..49d3b1e63ce5e2cd0423dff25728ed54c2592de1 100644 (file)
@@ -280,7 +280,7 @@ do_entIF(unsigned long type, struct pt_regs *regs)
              case 1: /* bugcheck */
                info.si_signo = SIGTRAP;
                info.si_errno = 0;
-               info.si_code = __SI_FAULT;
+               info.si_code = TRAP_FIXME;
                info.si_addr = (void __user *) regs->pc;
                info.si_trapno = 0;
                send_sig_info(SIGTRAP, &info, current);
@@ -320,7 +320,7 @@ do_entIF(unsigned long type, struct pt_regs *regs)
                        break;
                case GEN_ROPRAND:
                        signo = SIGFPE;
-                       code = __SI_FAULT;
+                       code = FPE_FIXME;
                        break;
 
                case GEN_DECOVF:
@@ -342,7 +342,7 @@ do_entIF(unsigned long type, struct pt_regs *regs)
                case GEN_SUBRNG7:
                default:
                        signo = SIGTRAP;
-                       code = __SI_FAULT;
+                       code = TRAP_FIXME;
                        break;
                }
 
index f1b3f1d575d47b0b6a19daeaab685daf143f2f44..7888c9803eb00b3ad1d166923182d5d1f4294bda 100644 (file)
@@ -1531,7 +1531,6 @@ config THUMB2_KERNEL
        bool "Compile the kernel in Thumb-2 mode" if !CPU_THUMBONLY
        depends on (CPU_V7 || CPU_V7M) && !CPU_V6 && !CPU_V6K
        default y if CPU_THUMBONLY
-       select AEABI
        select ARM_ASM_UNIFIED
        select ARM_UNWIND
        help
@@ -1594,7 +1593,8 @@ config ARM_PATCH_IDIV
          code to do integer division.
 
 config AEABI
-       bool "Use the ARM EABI to compile the kernel"
+       bool "Use the ARM EABI to compile the kernel" if !CPU_V7 && !CPU_V7M && !CPU_V6 && !CPU_V6K
+       default CPU_V7 || CPU_V7M || CPU_V6 || CPU_V6K
        help
          This option allows for the kernel to be compiled using the latest
          ARM ABI (aka EABI).  This is only useful if you are using a user
index bfe163c40024de7d6ccc81097451cfc409cc42c8..5983f6bc62d57784b007f3ccad4e80cad47e5828 100644 (file)
@@ -7,6 +7,7 @@
 
 #ifndef __ASSEMBLER__
 
+#include <linux/errno.h>
 #include <asm/cputype.h>
 
 static inline bool scu_a9_has_base(void)
index 6c7182f32cefeb247068e80af9944b4ff01e3727..a61905c86732973665f101be08cffac5a7d4c946 100644 (file)
@@ -1,6 +1,8 @@
 #ifndef __ASM_ARM_SUSPEND_H
 #define __ASM_ARM_SUSPEND_H
 
+#include <linux/types.h>
+
 struct sleep_save_sp {
        u32 *save_ptr_stash;
        u32 save_ptr_stash_phys;
index 8be08d907a16990a3516d32d085188fcc962822b..192a7583999ce7c5ebc26f012342e831d7d657fb 100644 (file)
@@ -22,6 +22,7 @@
 #define UART_OFFSET(addr)      ((addr) & 0x00ffffff)
 
                .pushsection .data
+               .align  2
 omap_uart_phys:        .word   0
 omap_uart_virt:        .word   0
 omap_uart_lsr: .word   0
index c731f0d2b2af1549dea68dcce2035ce398b81604..fbc707626b3e9e6794400e41ba1b08916cdf8d4a 100644 (file)
@@ -721,6 +721,7 @@ do_fpe:
  */
 
        .pushsection .data
+       .align  2
 ENTRY(fp_enter)
        .word   no_fp
        .popsection
@@ -1224,6 +1225,7 @@ vector_addrexcptn:
        W(b)    vector_fiq
 
        .data
+       .align  2
 
        .globl  cr_alignment
 cr_alignment:
index e33c32d561934c36b84d294d85ff27fa05aa0ec2..ca3614dc6938e1595f71a095f53456eb26701bec 100644 (file)
 
 #include "entry-header.S"
 
+saved_psr      .req    r8
+#if defined(CONFIG_TRACE_IRQFLAGS) || defined(CONFIG_CONTEXT_TRACKING)
+saved_pc       .req    r9
+#define TRACE(x...) x
+#else
+saved_pc       .req    lr
+#define TRACE(x...)
+#endif
 
        .align  5
 #if !(IS_ENABLED(CONFIG_TRACE_IRQFLAGS) || IS_ENABLED(CONFIG_CONTEXT_TRACKING))
@@ -146,16 +154,17 @@ ENTRY(vector_swi)
  ARM(  stmdb   r8, {sp, lr}^           )       @ Calling sp, lr
  THUMB(        mov     r8, sp                  )
  THUMB(        store_user_sp_lr r8, r10, S_SP  )       @ calling sp, lr
-       mrs     r8, spsr                        @ called from non-FIQ mode, so ok.
-       str     lr, [sp, #S_PC]                 @ Save calling PC
-       str     r8, [sp, #S_PSR]                @ Save CPSR
+       mrs     saved_psr, spsr                 @ called from non-FIQ mode, so ok.
+ TRACE(        mov     saved_pc, lr            )
+       str     saved_pc, [sp, #S_PC]           @ Save calling PC
+       str     saved_psr, [sp, #S_PSR]         @ Save CPSR
        str     r0, [sp, #S_OLD_R0]             @ Save OLD_R0
 #endif
        zero_fp
        alignment_trap r10, ip, __cr_alignment
-       enable_irq
-       ct_user_exit
-       get_thread_info tsk
+       asm_trace_hardirqs_on save=0
+       enable_irq_notrace
+       ct_user_exit save=0
 
        /*
         * Get the system call number.
@@ -168,11 +177,11 @@ ENTRY(vector_swi)
         * value to determine if it is an EABI or an old ABI call.
         */
 #ifdef CONFIG_ARM_THUMB
-       tst     r8, #PSR_T_BIT
+       tst     saved_psr, #PSR_T_BIT
        movne   r10, #0                         @ no thumb OABI emulation
- USER( ldreq   r10, [lr, #-4]          )       @ get SWI instruction
+ USER( ldreq   r10, [saved_pc, #-4]    )       @ get SWI instruction
 #else
- USER( ldr     r10, [lr, #-4]          )       @ get SWI instruction
+ USER( ldr     r10, [saved_pc, #-4]    )       @ get SWI instruction
 #endif
  ARM_BE8(rev   r10, r10)                       @ little endian instruction
 
@@ -183,15 +192,17 @@ ENTRY(vector_swi)
         */
 #elif defined(CONFIG_ARM_THUMB)
        /* Legacy ABI only, possibly thumb mode. */
-       tst     r8, #PSR_T_BIT                  @ this is SPSR from save_user_regs
+       tst     saved_psr, #PSR_T_BIT           @ this is SPSR from save_user_regs
        addne   scno, r7, #__NR_SYSCALL_BASE    @ put OS number in
- USER( ldreq   scno, [lr, #-4]         )
+ USER( ldreq   scno, [saved_pc, #-4]   )
 
 #else
        /* Legacy ABI only. */
- USER( ldr     scno, [lr, #-4]         )       @ get SWI instruction
+ USER( ldr     scno, [saved_pc, #-4]   )       @ get SWI instruction
 #endif
 
+       /* saved_psr and saved_pc are now dead */
+
        uaccess_disable tbl
 
        adr     tbl, sys_call_table             @ load syscall table pointer
@@ -210,6 +221,12 @@ ENTRY(vector_swi)
        bic     scno, scno, #0xff000000         @ mask off SWI op-code
        eor     scno, scno, #__NR_SYSCALL_BASE  @ check OS number
 #endif
+       get_thread_info tsk
+       /*
+        * Reload the registers that may have been corrupted on entry to
+        * the syscall assembly (by tracing or context tracking.)
+        */
+ TRACE(        ldmia   sp, {r0 - r3}           )
 
 local_restart:
        ldr     r10, [tsk, #TI_FLAGS]           @ check for syscall tracing
@@ -239,8 +256,9 @@ local_restart:
         * current task.
         */
 9001:
-       sub     lr, lr, #4
+       sub     lr, saved_pc, #4
        str     lr, [sp, #S_PC]
+       get_thread_info tsk
        b       ret_fast_syscall
 #endif
 ENDPROC(vector_swi)
index 04286fd9e09ce7a27259c4d375a05a965e3be0ea..6b1148cafffdbe09070f996343287a4db9bb1baa 100644 (file)
@@ -556,6 +556,7 @@ ENDPROC(__fixup_smp)
        .word   __smpalt_end
 
        .pushsection .data
+       .align  2
        .globl  smp_on_up
 smp_on_up:
        ALT_SMP(.long   1)
@@ -716,6 +717,7 @@ ENTRY(fixup_pv_table)
 ENDPROC(fixup_pv_table)
 
        .data
+       .align  2
        .globl  __pv_phys_pfn_offset
        .type   __pv_phys_pfn_offset, %object
 __pv_phys_pfn_offset:
index ec7e7377d423ddd5fa9d0bd3be0b2eb45a26209f..60146e32619a5912bf12b5277397f2e19213b2a8 100644 (file)
@@ -31,6 +31,7 @@
  * zeroing of .bss would clobber it.
  */
 .data
+       .align  2
 ENTRY(__boot_cpu_mode)
        .long   0
 .text
index 49fadbda8c63ab336d205d6fd538a13dc269fb79..81cd4d43b3ec8eded3415dce5e6c5c5d591d9d36 100644 (file)
@@ -367,6 +367,7 @@ ENTRY(iwmmxt_task_release)
 ENDPROC(iwmmxt_task_release)
 
        .data
+       .align  2
 concan_owner:
        .word   0
 
index 0f6c1000582c359881b6985c57d010037cb4ac17..9f08d214d05a91c216abe7542a9bf6340dc0f812 100644 (file)
@@ -171,6 +171,7 @@ mpidr_hash_ptr:
        .long   mpidr_hash - .                  @ mpidr_hash struct offset
 
        .data
+       .align  2
        .type   sleep_save_sp, #object
 ENTRY(sleep_save_sp)
        .space  SLEEP_SAVE_SP_SZ                @ struct sleep_save_sp
index 3a2fa203637a99d8da93962da8e151f07d1bf0fc..65228bf4c6dfee221e4e3a38112c0d59ecda65f9 100644 (file)
@@ -171,6 +171,7 @@ void save_stack_trace_tsk(struct task_struct *tsk, struct stack_trace *trace)
 {
        __save_stack_trace(tsk, trace, 1);
 }
+EXPORT_SYMBOL(save_stack_trace_tsk);
 
 void save_stack_trace(struct stack_trace *trace)
 {
index cf950790fbdceb470643b5e8c152394deb2d46e5..4292cae43f3c3ce564dcd1d4a6a8a74cd8239a6e 100644 (file)
@@ -124,6 +124,7 @@ _cp15_save_diag:
 #endif /* CONFIG_CACHE_L2X0 */
 
        .data
+       .align  2
        .globl cp15_save_diag
 cp15_save_diag:
        .long   0       @ cp15 diagnostic
index dd75a4756761f347a60fc6107cb9a198db9174e2..5169dfba97185b5037743d2d277d8bb74e063dfa 100644 (file)
@@ -245,7 +245,6 @@ static phys_addr_t mx2_camera_base __initdata;
 static void __init visstrim_analog_camera_init(void)
 {
        struct platform_device *pdev;
-       int dma;
 
        gpio_set_value(TVP5150_PWDN, 1);
        ndelay(1);
@@ -258,12 +257,9 @@ static void __init visstrim_analog_camera_init(void)
        if (IS_ERR(pdev))
                return;
 
-       dma = dma_declare_coherent_memory(&pdev->dev,
-                               mx2_camera_base, mx2_camera_base,
-                               MX2_CAMERA_BUF_SIZE,
-                               DMA_MEMORY_MAP | DMA_MEMORY_EXCLUSIVE);
-       if (!(dma & DMA_MEMORY_MAP))
-               return;
+       dma_declare_coherent_memory(&pdev->dev, mx2_camera_base,
+                                   mx2_camera_base, MX2_CAMERA_BUF_SIZE,
+                                   DMA_MEMORY_EXCLUSIVE);
 }
 
 static void __init visstrim_reserve(void)
@@ -444,16 +440,13 @@ static const struct imx_ssi_platform_data visstrim_m10_ssi_pdata __initconst = {
 static void __init visstrim_coda_init(void)
 {
        struct platform_device *pdev;
-       int dma;
 
        pdev = imx27_add_coda();
-       dma = dma_declare_coherent_memory(&pdev->dev,
-                                         mx2_camera_base + MX2_CAMERA_BUF_SIZE,
-                                         mx2_camera_base + MX2_CAMERA_BUF_SIZE,
-                                         MX2_CAMERA_BUF_SIZE,
-                                         DMA_MEMORY_MAP | DMA_MEMORY_EXCLUSIVE);
-       if (!(dma & DMA_MEMORY_MAP))
-               return;
+       dma_declare_coherent_memory(&pdev->dev,
+                                   mx2_camera_base + MX2_CAMERA_BUF_SIZE,
+                                   mx2_camera_base + MX2_CAMERA_BUF_SIZE,
+                                   MX2_CAMERA_BUF_SIZE,
+                                   DMA_MEMORY_EXCLUSIVE);
 }
 
 /* DMA deinterlace */
@@ -466,24 +459,21 @@ static void __init visstrim_deinterlace_init(void)
 {
        int ret = -ENOMEM;
        struct platform_device *pdev = &visstrim_deinterlace;
-       int dma;
 
        ret = platform_device_register(pdev);
 
-       dma = dma_declare_coherent_memory(&pdev->dev,
-                                         mx2_camera_base + 2 * MX2_CAMERA_BUF_SIZE,
-                                         mx2_camera_base + 2 * MX2_CAMERA_BUF_SIZE,
-                                         MX2_CAMERA_BUF_SIZE,
-                                         DMA_MEMORY_MAP | DMA_MEMORY_EXCLUSIVE);
-       if (!(dma & DMA_MEMORY_MAP))
-               return;
+       dma_declare_coherent_memory(&pdev->dev,
+                                   mx2_camera_base + 2 * MX2_CAMERA_BUF_SIZE,
+                                   mx2_camera_base + 2 * MX2_CAMERA_BUF_SIZE,
+                                   MX2_CAMERA_BUF_SIZE,
+                                   DMA_MEMORY_EXCLUSIVE);
 }
 
 /* Emma-PrP for format conversion */
 static void __init visstrim_emmaprp_init(void)
 {
        struct platform_device *pdev;
-       int dma;
+       int ret;
 
        pdev = imx27_add_mx2_emmaprp();
        if (IS_ERR(pdev))
@@ -493,11 +483,11 @@ static void __init visstrim_emmaprp_init(void)
         * Use the same memory area as the analog camera since both
         * devices are, by nature, exclusive.
         */
-       dma = dma_declare_coherent_memory(&pdev->dev,
+       ret = dma_declare_coherent_memory(&pdev->dev,
                                mx2_camera_base, mx2_camera_base,
                                MX2_CAMERA_BUF_SIZE,
-                               DMA_MEMORY_MAP | DMA_MEMORY_EXCLUSIVE);
-       if (!(dma & DMA_MEMORY_MAP))
+                               DMA_MEMORY_EXCLUSIVE);
+       if (ret)
                pr_err("Failed to declare memory for emmaprp\n");
 }
 
index bde9a9af67142ad2c3867b998aaee5d0426fda4e..7716f83aecdda1d5f6a35677d40d9446b5d8a0cf 100644 (file)
@@ -475,7 +475,7 @@ static phys_addr_t mx3_camera_base __initdata;
 
 static int __init mx31moboard_init_cam(void)
 {
-       int dma, ret = -ENOMEM;
+       int ret;
        struct platform_device *pdev;
 
        imx31_add_ipu_core();
@@ -484,11 +484,11 @@ static int __init mx31moboard_init_cam(void)
        if (IS_ERR(pdev))
                return PTR_ERR(pdev);
 
-       dma = dma_declare_coherent_memory(&pdev->dev,
-                                       mx3_camera_base, mx3_camera_base,
-                                       MX3_CAMERA_BUF_SIZE,
-                                       DMA_MEMORY_MAP | DMA_MEMORY_EXCLUSIVE);
-       if (!(dma & DMA_MEMORY_MAP))
+       ret = dma_declare_coherent_memory(&pdev->dev,
+                                         mx3_camera_base, mx3_camera_base,
+                                         MX3_CAMERA_BUF_SIZE,
+                                         DMA_MEMORY_EXCLUSIVE);
+       if (ret)
                goto err;
 
        ret = platform_device_add(pdev);
index 1b9f0520dea9154afa31f9668241e03f211fdc6a..fa5fd24f524c5cb233dfb72d73c23929084d7caa 100644 (file)
@@ -530,10 +530,12 @@ l2dis_3630_offset:
        .long   l2dis_3630 - .
 
        .data
+       .align  2
 l2dis_3630:
        .word   0
 
        .data
+       .align  2
 l2_inv_api_params:
        .word   0x1, 0x00
 
index c7a3b4aab4b5441249ddd9a7fdc362ef9370d737..56dfa2d5d0a8fc2b1f6c251f762aec2385464423 100644 (file)
@@ -385,6 +385,7 @@ ppa_zero_params_offset:
 ENDPROC(omap_do_wfi)
 
        .data
+       .align  2
 ppa_zero_params:
        .word           0
 
index 81591491ab947b09f7128fc12e66e14d3d17d77b..42d93f40a59fa9c78a58d365d87fd2d56700174e 100644 (file)
@@ -16,6 +16,7 @@
  *       insist on it to be truly read-only.
  */
        .data
+       .align  2
 ENTRY(mioa701_bootstrap)
 0:
        b       1f
@@ -34,4 +35,5 @@ ENTRY(mioa701_jumpaddr)
 
 ENTRY(mioa701_bootstrap_lg)
        .data
+       .align  2
        .word   2b-0b
index 2eec9a341f05b0a82c73a7d0ec7c16d8f744d39f..9927f06f52fef64263bd1b34c35e5fd856646fda 100644 (file)
@@ -23,7 +23,7 @@
  * ddr to sram for system resumeing.
  * so it is ".data section".
  */
-.align
+       .align  2
 
 ENTRY(rockchip_slp_cpu_resume)
        setmode PSR_I_BIT | PSR_F_BIT | SVC_MODE, r1  @ set svc, irqs off
index 2522f8c8fbb17278195ee0802a821d7aea7e3995..a5084ec70c6e67d75ccad63f8dd255ba0f275e68 100644 (file)
@@ -47,6 +47,7 @@
 #define CACHE_DLIMIT   (CACHE_DSIZE * 4)
 
        .data
+       .align  2
 flush_base:
        .long   FLUSH_BASE
        .text
index ff8b0aa2dfde887f7c48065f84c581c06fe1c4b8..42f585379e19c97fcb6abe1004d9b469f90215ce 100644 (file)
@@ -315,8 +315,11 @@ retry:
         * signal first. We do not need to release the mmap_sem because
         * it would already be released in __lock_page_or_retry in
         * mm/filemap.c. */
-       if ((fault & VM_FAULT_RETRY) && fatal_signal_pending(current))
+       if ((fault & VM_FAULT_RETRY) && fatal_signal_pending(current)) {
+               if (!user_mode(regs))
+                       goto no_context;
                return 0;
+       }
 
        /*
         * Major/minor page fault accounting is only done on the
index 5e5720e8bc5f219ebaa138eae369c32cba5b1615..7d16bbc4102bd22569062a50444901a879af2203 100644 (file)
@@ -129,8 +129,7 @@ ENDPROC(cpu_v7_set_pte_ext)
        .macro  v7_ttb_setup, zero, ttbr0l, ttbr0h, ttbr1, tmp
        ldr     \tmp, =swapper_pg_dir           @ swapper_pg_dir virtual address
        cmp     \ttbr1, \tmp, lsr #12           @ PHYS_OFFSET > PAGE_OFFSET?
-       mrc     p15, 0, \tmp, c2, c0, 2         @ TTB control egister
-       orr     \tmp, \tmp, #TTB_EAE
+       mov     \tmp, #TTB_EAE                  @ for TTB control egister
        ALT_SMP(orr     \tmp, \tmp, #TTB_FLAGS_SMP)
        ALT_UP(orr      \tmp, \tmp, #TTB_FLAGS_UP)
        ALT_SMP(orr     \tmp, \tmp, #TTB_FLAGS_SMP << 16)
index b6bbfdb6dfdc3d1681a562ef4eb96f95d33d6b03..3d75b7972fd13500baee28f30c48817428f286e9 100644 (file)
        .endm
 
        .data
+       .align  2
 clean_addr:    .word   CLEAN_ADDR
 
        .text
index 4e5a664be04b20bdaeb2e638ed3eb85b8ca48732..e09bf5d1560606405e25175d69d8b67929f02657 100644 (file)
@@ -142,25 +142,25 @@ int copy_siginfo_to_user32(compat_siginfo_t __user *to, const siginfo_t *from)
         */
        err = __put_user(from->si_signo, &to->si_signo);
        err |= __put_user(from->si_errno, &to->si_errno);
-       err |= __put_user((short)from->si_code, &to->si_code);
+       err |= __put_user(from->si_code, &to->si_code);
        if (from->si_code < 0)
                err |= __copy_to_user(&to->_sifields._pad, &from->_sifields._pad,
                                      SI_PAD_SIZE);
-       else switch (from->si_code & __SI_MASK) {
-       case __SI_KILL:
+       else switch (siginfo_layout(from->si_signo, from->si_code)) {
+       case SIL_KILL:
                err |= __put_user(from->si_pid, &to->si_pid);
                err |= __put_user(from->si_uid, &to->si_uid);
                break;
-       case __SI_TIMER:
+       case SIL_TIMER:
                 err |= __put_user(from->si_tid, &to->si_tid);
                 err |= __put_user(from->si_overrun, &to->si_overrun);
                 err |= __put_user(from->si_int, &to->si_int);
                break;
-       case __SI_POLL:
+       case SIL_POLL:
                err |= __put_user(from->si_band, &to->si_band);
                err |= __put_user(from->si_fd, &to->si_fd);
                break;
-       case __SI_FAULT:
+       case SIL_FAULT:
                err |= __put_user((compat_uptr_t)(unsigned long)from->si_addr,
                                  &to->si_addr);
 #ifdef BUS_MCEERR_AO
@@ -173,29 +173,24 @@ int copy_siginfo_to_user32(compat_siginfo_t __user *to, const siginfo_t *from)
                        err |= __put_user(from->si_addr_lsb, &to->si_addr_lsb);
 #endif
                break;
-       case __SI_CHLD:
+       case SIL_CHLD:
                err |= __put_user(from->si_pid, &to->si_pid);
                err |= __put_user(from->si_uid, &to->si_uid);
                err |= __put_user(from->si_status, &to->si_status);
                err |= __put_user(from->si_utime, &to->si_utime);
                err |= __put_user(from->si_stime, &to->si_stime);
                break;
-       case __SI_RT: /* This is not generated by the kernel as of now. */
-       case __SI_MESGQ: /* But this is */
+       case SIL_RT:
                err |= __put_user(from->si_pid, &to->si_pid);
                err |= __put_user(from->si_uid, &to->si_uid);
                err |= __put_user(from->si_int, &to->si_int);
                break;
-       case __SI_SYS:
+       case SIL_SYS:
                err |= __put_user((compat_uptr_t)(unsigned long)
                                from->si_call_addr, &to->si_call_addr);
                err |= __put_user(from->si_syscall, &to->si_syscall);
                err |= __put_user(from->si_arch, &to->si_arch);
                break;
-       default: /* this is just in case for now ... */
-               err |= __put_user(from->si_pid, &to->si_pid);
-               err |= __put_user(from->si_uid, &to->si_uid);
-               break;
        }
        return err;
 }
index c72f4e6e386fa34b2b120e14baa3ee932caadee9..79dfe3979123872c99925b9d08cf2c2bf4e5453b 100644 (file)
 
 #define si_uid16       _sifields._kill._uid
 
-#define ILL_ILLPARAOP  (__SI_FAULT|2)  /* illegal opcode combine ********** */
-#define ILL_ILLEXCPT   (__SI_FAULT|4)  /* unrecoverable exception ********** */
-#define ILL_CPLB_VI    (__SI_FAULT|9)  /* D/I CPLB protect violation ******** */
-#define ILL_CPLB_MISS  (__SI_FAULT|10) /* D/I CPLB miss ******** */
-#define ILL_CPLB_MULHIT        (__SI_FAULT|11) /* D/I CPLB multiple hit ******** */
+#define ILL_ILLPARAOP  2       /* illegal opcode combine ********** */
+#define ILL_ILLEXCPT   4       /* unrecoverable exception ********** */
+#define ILL_CPLB_VI    9       /* D/I CPLB protect violation ******** */
+#define ILL_CPLB_MISS  10      /* D/I CPLB miss ******** */
+#define ILL_CPLB_MULHIT        11      /* D/I CPLB multiple hit ******** */
+#undef NSIGILL
+#define NSIGILL         11
 
 /*
  * SIGBUS si_codes
  */
-#define BUS_OPFETCH    (__SI_FAULT|4)  /* error from instruction fetch ******** */
+#define BUS_OPFETCH    4       /* error from instruction fetch ******** */
+#undef NSIGBUS
+#define NSIGBUS                4
 
 /*
  * SIGTRAP si_codes
  */
-#define TRAP_STEP      (__SI_FAULT|1)  /* single-step breakpoint************* */
-#define TRAP_TRACEFLOW (__SI_FAULT|2)  /* trace buffer overflow ************* */
-#define TRAP_WATCHPT   (__SI_FAULT|3)  /* watchpoint match      ************* */
-#define TRAP_ILLTRAP   (__SI_FAULT|4)  /* illegal trap          ************* */
+#define TRAP_STEP      1       /* single-step breakpoint************* */
+#define TRAP_TRACEFLOW 2       /* trace buffer overflow ************* */
+#define TRAP_WATCHPT   3       /* watchpoint match      ************* */
+#define TRAP_ILLTRAP   4       /* illegal trap          ************* */
+#undef NSIGTRAP
+#define NSIGTRAP       4
 
 /*
  * SIGSEGV si_codes
  */
-#define SEGV_STACKFLOW (__SI_FAULT|3)  /* stack overflow */
+#define SEGV_STACKFLOW 3       /* stack overflow */
+#undef NSIGSEGV
+#define NSIGSEGV       3
 
 #endif /* _UAPI_BFIN_SIGINFO_H */
index d3fd1ca456536b3586efe9c05fc349beaf1ba03a..f55d9e0e906805dcc5590292d23368e270f2f7b4 100644 (file)
@@ -4,7 +4,7 @@
 #include <linux/types.h>
 #include <asm-generic/siginfo.h>
 
-#define FPE_MDAOVF     (__SI_FAULT|9)  /* media overflow */
+#define FPE_MDAOVF     9       /* media overflow */
 #undef NSIGFPE
 #define NSIGFPE                9
 
index 4694c64252d6daffa827ca6d187f6f676ac7a3a2..33389fc36f239144be69df0c4c11acc49c22a823 100644 (file)
@@ -98,27 +98,30 @@ typedef struct siginfo {
 /*
  * SIGILL si_codes
  */
-#define ILL_BADIADDR   (__SI_FAULT|9)  /* unimplemented instruction address */
-#define __ILL_BREAK    (__SI_FAULT|10) /* illegal break */
-#define __ILL_BNDMOD   (__SI_FAULT|11) /* bundle-update (modification) in progress */
+#define ILL_BADIADDR   9       /* unimplemented instruction address */
+#define __ILL_BREAK    10      /* illegal break */
+#define __ILL_BNDMOD   11      /* bundle-update (modification) in progress */
 #undef NSIGILL
 #define NSIGILL                11
 
 /*
  * SIGFPE si_codes
  */
-#define __FPE_DECOVF   (__SI_FAULT|9)  /* decimal overflow */
-#define __FPE_DECDIV   (__SI_FAULT|10) /* decimal division by zero */
-#define __FPE_DECERR   (__SI_FAULT|11) /* packed decimal error */
-#define __FPE_INVASC   (__SI_FAULT|12) /* invalid ASCII digit */
-#define __FPE_INVDEC   (__SI_FAULT|13) /* invalid decimal digit */
+#ifdef __KERNEL__
+#define FPE_FIXME      0       /* Broken dup of SI_USER */
+#endif /* __KERNEL__ */
+#define __FPE_DECOVF   9       /* decimal overflow */
+#define __FPE_DECDIV   10      /* decimal division by zero */
+#define __FPE_DECERR   11      /* packed decimal error */
+#define __FPE_INVASC   12      /* invalid ASCII digit */
+#define __FPE_INVDEC   13      /* invalid decimal digit */
 #undef NSIGFPE
 #define NSIGFPE                13
 
 /*
  * SIGSEGV si_codes
  */
-#define __SEGV_PSTKOVF (__SI_FAULT|4)  /* paragraph stack overflow */
+#define __SEGV_PSTKOVF 4       /* paragraph stack overflow */
 #undef NSIGSEGV
 #define NSIGSEGV       4
 
index 5db52c6813c418e5c6820d32ca1283e215c5a1e0..6146d53b6ad7df76c5c8a3d7e17b97a01fce58eb 100644 (file)
@@ -124,31 +124,30 @@ copy_siginfo_to_user (siginfo_t __user *to, const siginfo_t *from)
                 */
                err = __put_user(from->si_signo, &to->si_signo);
                err |= __put_user(from->si_errno, &to->si_errno);
-               err |= __put_user((short)from->si_code, &to->si_code);
-               switch (from->si_code >> 16) {
-                     case __SI_FAULT >> 16:
+               err |= __put_user(from->si_code, &to->si_code);
+               switch (siginfo_layout(from->si_signo, from->si_code)) {
+                     case SIL_FAULT:
                        err |= __put_user(from->si_flags, &to->si_flags);
                        err |= __put_user(from->si_isr, &to->si_isr);
-                     case __SI_POLL >> 16:
+                     case SIL_POLL:
                        err |= __put_user(from->si_addr, &to->si_addr);
                        err |= __put_user(from->si_imm, &to->si_imm);
                        break;
-                     case __SI_TIMER >> 16:
+                     case SIL_TIMER:
                        err |= __put_user(from->si_tid, &to->si_tid);
                        err |= __put_user(from->si_overrun, &to->si_overrun);
                        err |= __put_user(from->si_ptr, &to->si_ptr);
                        break;
-                     case __SI_RT >> 16:       /* Not generated by the kernel as of now.  */
-                     case __SI_MESGQ >> 16:
+                     case SIL_RT:
                        err |= __put_user(from->si_uid, &to->si_uid);
                        err |= __put_user(from->si_pid, &to->si_pid);
                        err |= __put_user(from->si_ptr, &to->si_ptr);
                        break;
-                     case __SI_CHLD >> 16:
+                     case SIL_CHLD:
                        err |= __put_user(from->si_utime, &to->si_utime);
                        err |= __put_user(from->si_stime, &to->si_stime);
                        err |= __put_user(from->si_status, &to->si_status);
-                     default:
+                     case SIL_KILL:
                        err |= __put_user(from->si_uid, &to->si_uid);
                        err |= __put_user(from->si_pid, &to->si_pid);
                        break;
index 7b1fe9462158e1cfbed5bf5367e813dbfe485577..3cb17cf9b3620d386bae6e08415cbd9f14646bb9 100644 (file)
@@ -349,7 +349,7 @@ handle_fpu_swa (int fp_fault, struct pt_regs *regs, unsigned long isr)
                        }
                        siginfo.si_signo = SIGFPE;
                        siginfo.si_errno = 0;
-                       siginfo.si_code = __SI_FAULT;   /* default code */
+                       siginfo.si_code = FPE_FIXME;    /* default code */
                        siginfo.si_addr = (void __user *) (regs->cr_iip + ia64_psr(regs)->ri);
                        if (isr & 0x11) {
                                siginfo.si_code = FPE_FLTINV;
@@ -373,7 +373,7 @@ handle_fpu_swa (int fp_fault, struct pt_regs *regs, unsigned long isr)
                        /* raise exception */
                        siginfo.si_signo = SIGFPE;
                        siginfo.si_errno = 0;
-                       siginfo.si_code = __SI_FAULT;   /* default code */
+                       siginfo.si_code = FPE_FIXME;    /* default code */
                        siginfo.si_addr = (void __user *) (regs->cr_iip + ia64_psr(regs)->ri);
                        if (isr & 0x880) {
                                siginfo.si_code = FPE_FLTOVF;
index fad3dc3cb21008c59d612827c40282fae34d1827..ea573be2b6d0550e46a170c8a72178953022f4f3 100644 (file)
@@ -9,7 +9,7 @@ static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
 }
 
 /*
- * dma_alloc_noncoherent() returns non-cacheable memory, so there's no need to
+ * dma_alloc_attrs() always returns non-cacheable memory, so there's no need to
  * do any flushing here.
  */
 static inline void
index 8069cf766603ea3e2e5f090bab3e6547a7ac46b6..cf6113bbcb98cfb4edeeb4e052a6452580d9f018 100644 (file)
@@ -120,7 +120,7 @@ typedef struct siginfo {
 #undef SI_TIMER
 #undef SI_MESGQ
 #define SI_ASYNCIO     -2      /* sent by AIO completion */
-#define SI_TIMER __SI_CODE(__SI_TIMER, -3) /* sent by timer expiration */
-#define SI_MESGQ __SI_CODE(__SI_MESGQ, -4) /* sent by real time mesq state change */
+#define SI_TIMER       -3      /* sent by timer expiration */
+#define SI_MESGQ       -4      /* sent by real time mesq state change */
 
 #endif /* _UAPI_ASM_SIGINFO_H */
index 84165f2b31ff60c6c6842d3d96b38f445b621839..cf5c7c05e5a38798ecb237fac321983809b8476b 100644 (file)
@@ -93,38 +93,37 @@ int copy_siginfo_to_user32(compat_siginfo_t __user *to, const siginfo_t *from)
           at the same time.  */
        err = __put_user(from->si_signo, &to->si_signo);
        err |= __put_user(from->si_errno, &to->si_errno);
-       err |= __put_user((short)from->si_code, &to->si_code);
+       err |= __put_user(from->si_code, &to->si_code);
        if (from->si_code < 0)
                err |= __copy_to_user(&to->_sifields._pad, &from->_sifields._pad, SI_PAD_SIZE);
        else {
-               switch (from->si_code >> 16) {
-               case __SI_TIMER >> 16:
+               switch (siginfo_layout(from->si_signo, from->si_code)) {
+               case SIL_TIMER:
                        err |= __put_user(from->si_tid, &to->si_tid);
                        err |= __put_user(from->si_overrun, &to->si_overrun);
                        err |= __put_user(from->si_int, &to->si_int);
                        break;
-               case __SI_CHLD >> 16:
+               case SIL_CHLD:
                        err |= __put_user(from->si_utime, &to->si_utime);
                        err |= __put_user(from->si_stime, &to->si_stime);
                        err |= __put_user(from->si_status, &to->si_status);
-               default:
+               case SIL_KILL:
                        err |= __put_user(from->si_pid, &to->si_pid);
                        err |= __put_user(from->si_uid, &to->si_uid);
                        break;
-               case __SI_FAULT >> 16:
+               case SIL_FAULT:
                        err |= __put_user((unsigned long)from->si_addr, &to->si_addr);
                        break;
-               case __SI_POLL >> 16:
+               case SIL_POLL:
                        err |= __put_user(from->si_band, &to->si_band);
                        err |= __put_user(from->si_fd, &to->si_fd);
                        break;
-               case __SI_RT >> 16: /* This is not generated by the kernel as of now.  */
-               case __SI_MESGQ >> 16:
+               case SIL_RT:
                        err |= __put_user(from->si_pid, &to->si_pid);
                        err |= __put_user(from->si_uid, &to->si_uid);
                        err |= __put_user(from->si_int, &to->si_int);
                        break;
-               case __SI_SYS >> 16:
+               case SIL_SYS:
                        err |= __copy_to_user(&to->si_call_addr, &from->si_call_addr,
                                              sizeof(compat_uptr_t));
                        err |= __put_user(from->si_syscall, &to->si_syscall);
index b68b4d0726d3e02fd7888fd5d757e14c2c8fc4b9..2bf41499334777e7a8682453222427dd084765ee 100644 (file)
@@ -735,7 +735,7 @@ void force_fcr31_sig(unsigned long fcr31, void __user *fault_addr,
        else if (fcr31 & FPU_CSR_INE_X)
                si.si_code = FPE_FLTRES;
        else
-               si.si_code = __SI_FAULT;
+               return; /* Broken hardware? */
        force_sig_info(SIGFPE, &si, tsk);
 }
 
index 7b3c6f280293aeb5cdd13b1de341f0e74f36bf2d..f8dc622227414abf8852c5c0718c2f832512eb50 100644 (file)
@@ -18,7 +18,7 @@ static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
 }
 
 /*
- * dma_alloc_noncoherent() returns non-cacheable memory, so there's no need to
+ * dma_alloc_attrs() always returns non-cacheable memory, so there's no need to
  * do any flushing here.
  */
 static inline void dma_cache_sync(struct device *dev, void *vaddr, size_t size,
index 70aaabb8b3cb33cd869c865bb653c434861f8b6b..9e0cb6a577d67976dff26e4532fee777d50eb59a 100644 (file)
@@ -290,25 +290,25 @@ copy_siginfo_from_user32 (siginfo_t *to, compat_siginfo_t __user *from)
        if (to->si_code < 0)
                err |= __copy_from_user(&to->_sifields._pad, &from->_sifields._pad, SI_PAD_SIZE);
        else {
-               switch (to->si_code >> 16) {
-                     case __SI_CHLD >> 16:
+               switch (siginfo_layout(to->si_signo, to->si_code)) {
+                     case SIL_CHLD:
                        err |= __get_user(to->si_utime, &from->si_utime);
                        err |= __get_user(to->si_stime, &from->si_stime);
                        err |= __get_user(to->si_status, &from->si_status);
                      default:
+                     case SIL_KILL:
                        err |= __get_user(to->si_pid, &from->si_pid);
                        err |= __get_user(to->si_uid, &from->si_uid);
                        break;
-                     case __SI_FAULT >> 16:
+                     case SIL_FAULT:
                        err |= __get_user(addr, &from->si_addr);
                        to->si_addr = compat_ptr(addr);
                        break;
-                     case __SI_POLL >> 16:
+                     case SIL_POLL:
                        err |= __get_user(to->si_band, &from->si_band);
                        err |= __get_user(to->si_fd, &from->si_fd);
                        break;
-                     case __SI_RT >> 16: /* This is not generated by the kernel as of now.  */
-                     case __SI_MESGQ >> 16:
+                     case SIL_RT:
                        err |= __get_user(to->si_pid, &from->si_pid);
                        err |= __get_user(to->si_uid, &from->si_uid);
                        err |= __get_user(to->si_int, &from->si_int);
@@ -337,41 +337,40 @@ copy_siginfo_to_user32 (compat_siginfo_t __user *to, const siginfo_t *from)
           at the same time.  */
        err = __put_user(from->si_signo, &to->si_signo);
        err |= __put_user(from->si_errno, &to->si_errno);
-       err |= __put_user((short)from->si_code, &to->si_code);
+       err |= __put_user(from->si_code, &to->si_code);
        if (from->si_code < 0)
                err |= __copy_to_user(&to->_sifields._pad, &from->_sifields._pad, SI_PAD_SIZE);
        else {
-               switch (from->si_code >> 16) {
-               case __SI_CHLD >> 16:
+               switch (siginfo_layout(from->si_signo, from->si_code)) {
+               case SIL_CHLD:
                        err |= __put_user(from->si_utime, &to->si_utime);
                        err |= __put_user(from->si_stime, &to->si_stime);
                        err |= __put_user(from->si_status, &to->si_status);
-               default:
+               case SIL_KILL:
                        err |= __put_user(from->si_pid, &to->si_pid);
                        err |= __put_user(from->si_uid, &to->si_uid);
                        break;
-               case __SI_FAULT >> 16:
+               case SIL_FAULT:
                        addr = ptr_to_compat(from->si_addr);
                        err |= __put_user(addr, &to->si_addr);
                        break;
-               case __SI_POLL >> 16:
+               case SIL_POLL:
                        err |= __put_user(from->si_band, &to->si_band);
                        err |= __put_user(from->si_fd, &to->si_fd);
                        break;
-               case __SI_TIMER >> 16:
+               case SIL_TIMER:
                        err |= __put_user(from->si_tid, &to->si_tid);
                        err |= __put_user(from->si_overrun, &to->si_overrun);
                        val = (compat_int_t)from->si_int;
                        err |= __put_user(val, &to->si_int);
                        break;
-               case __SI_RT >> 16:     /* Not generated by the kernel as of now.  */
-               case __SI_MESGQ >> 16:
+               case SIL_RT:
                        err |= __put_user(from->si_uid, &to->si_uid);
                        err |= __put_user(from->si_pid, &to->si_pid);
                        val = (compat_int_t)from->si_int;
                        err |= __put_user(val, &to->si_int);
                        break;
-               case __SI_SYS >> 16:
+               case SIL_SYS:
                        err |= __put_user(ptr_to_compat(from->si_call_addr), &to->si_call_addr);
                        err |= __put_user(from->si_syscall, &to->si_syscall);
                        err |= __put_user(from->si_arch, &to->si_arch);
index 97bb1385e77152d95215d83278771a0fbe972982..92fb1c8dbbd83772af643dce2c9bef527e676f40 100644 (file)
@@ -913,42 +913,40 @@ int copy_siginfo_to_user32(struct compat_siginfo __user *d, const siginfo_t *s)
         */
        err = __put_user(s->si_signo, &d->si_signo);
        err |= __put_user(s->si_errno, &d->si_errno);
-       err |= __put_user((short)s->si_code, &d->si_code);
+       err |= __put_user(s->si_code, &d->si_code);
        if (s->si_code < 0)
                err |= __copy_to_user(&d->_sifields._pad, &s->_sifields._pad,
                                      SI_PAD_SIZE32);
-       else switch(s->si_code >> 16) {
-       case __SI_CHLD >> 16:
+       else switch(siginfo_layout(s->si_signo, s->si_code)) {
+       case SIL_CHLD:
                err |= __put_user(s->si_pid, &d->si_pid);
                err |= __put_user(s->si_uid, &d->si_uid);
                err |= __put_user(s->si_utime, &d->si_utime);
                err |= __put_user(s->si_stime, &d->si_stime);
                err |= __put_user(s->si_status, &d->si_status);
                break;
-       case __SI_FAULT >> 16:
+       case SIL_FAULT:
                err |= __put_user((unsigned int)(unsigned long)s->si_addr,
                                  &d->si_addr);
                break;
-       case __SI_POLL >> 16:
+       case SIL_POLL:
                err |= __put_user(s->si_band, &d->si_band);
                err |= __put_user(s->si_fd, &d->si_fd);
                break;
-       case __SI_TIMER >> 16:
+       case SIL_TIMER:
                err |= __put_user(s->si_tid, &d->si_tid);
                err |= __put_user(s->si_overrun, &d->si_overrun);
                err |= __put_user(s->si_int, &d->si_int);
                break;
-       case __SI_SYS >> 16:
+       case SIL_SYS:
                err |= __put_user(ptr_to_compat(s->si_call_addr), &d->si_call_addr);
                err |= __put_user(s->si_syscall, &d->si_syscall);
                err |= __put_user(s->si_arch, &d->si_arch);
                break;
-       case __SI_RT >> 16: /* This is not generated by the kernel as of now.  */
-       case __SI_MESGQ >> 16:
+       case SIL_RT:
                err |= __put_user(s->si_int, &d->si_int);
                /* fallthrough */
-       case __SI_KILL >> 16:
-       default:
+       case SIL_KILL:
                err |= __put_user(s->si_pid, &d->si_pid);
                err |= __put_user(s->si_uid, &d->si_uid);
                break;
diff --git a/arch/s390/include/asm/ap.h b/arch/s390/include/asm/ap.h
new file mode 100644 (file)
index 0000000..c02f4ab
--- /dev/null
@@ -0,0 +1,126 @@
+/*
+ * Adjunct processor (AP) interfaces
+ *
+ * Copyright IBM Corp. 2017
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License (version 2 only)
+ * as published by the Free Software Foundation.
+ *
+ * Author(s): Tony Krowiak <akrowia@linux.vnet.ibm.com>
+ *           Martin Schwidefsky <schwidefsky@de.ibm.com>
+ *           Harald Freudenberger <freude@de.ibm.com>
+ */
+
+#ifndef _ASM_S390_AP_H_
+#define _ASM_S390_AP_H_
+
+/**
+ * The ap_qid_t identifier of an ap queue.
+ * If the AP facilities test (APFT) facility is available,
+ * card and queue index are 8 bit values, otherwise
+ * card index is 6 bit and queue index a 4 bit value.
+ */
+typedef unsigned int ap_qid_t;
+
+#define AP_MKQID(_card, _queue) (((_card) & 63) << 8 | ((_queue) & 255))
+#define AP_QID_CARD(_qid) (((_qid) >> 8) & 63)
+#define AP_QID_QUEUE(_qid) ((_qid) & 255)
+
+/**
+ * struct ap_queue_status - Holds the AP queue status.
+ * @queue_empty: Shows if queue is empty
+ * @replies_waiting: Waiting replies
+ * @queue_full: Is 1 if the queue is full
+ * @irq_enabled: Shows if interrupts are enabled for the AP
+ * @response_code: Holds the 8 bit response code
+ *
+ * The ap queue status word is returned by all three AP functions
+ * (PQAP, NQAP and DQAP).  There's a set of flags in the first
+ * byte, followed by a 1 byte response code.
+ */
+struct ap_queue_status {
+       unsigned int queue_empty        : 1;
+       unsigned int replies_waiting    : 1;
+       unsigned int queue_full         : 1;
+       unsigned int _pad1              : 4;
+       unsigned int irq_enabled        : 1;
+       unsigned int response_code      : 8;
+       unsigned int _pad2              : 16;
+};
+
+/**
+ * ap_test_queue(): Test adjunct processor queue.
+ * @qid: The AP queue number
+ * @tbit: Test facilities bit
+ * @info: Pointer to queue descriptor
+ *
+ * Returns AP queue status structure.
+ */
+struct ap_queue_status ap_test_queue(ap_qid_t qid,
+                                    int tbit,
+                                    unsigned long *info);
+
+struct ap_config_info {
+       unsigned int apsc        : 1;   /* S bit */
+       unsigned int apxa        : 1;   /* N bit */
+       unsigned int qact        : 1;   /* C bit */
+       unsigned int rc8a        : 1;   /* R bit */
+       unsigned char _reserved1 : 4;
+       unsigned char _reserved2[3];
+       unsigned char Na;               /* max # of APs - 1 */
+       unsigned char Nd;               /* max # of Domains - 1 */
+       unsigned char _reserved3[10];
+       unsigned int apm[8];            /* AP ID mask */
+       unsigned int aqm[8];            /* AP queue mask */
+       unsigned int adm[8];            /* AP domain mask */
+       unsigned char _reserved4[16];
+} __aligned(8);
+
+/*
+ * ap_query_configuration(): Fetch cryptographic config info
+ *
+ * Returns the ap configuration info fetched via PQAP(QCI).
+ * On success 0 is returned, on failure a negative errno
+ * is returned, e.g. if the PQAP(QCI) instruction is not
+ * available, the return value will be -EOPNOTSUPP.
+ */
+int ap_query_configuration(struct ap_config_info *info);
+
+/*
+ * struct ap_qirq_ctrl - convenient struct for easy invocation
+ * of the ap_queue_irq_ctrl() function. This struct is passed
+ * as GR1 parameter to the PQAP(AQIC) instruction. For details
+ * please see the AR documentation.
+ */
+struct ap_qirq_ctrl {
+       unsigned int _res1 : 8;
+       unsigned int zone  : 8;  /* zone info */
+       unsigned int ir    : 1;  /* ir flag: enable (1) or disable (0) irq */
+       unsigned int _res2 : 4;
+       unsigned int gisc  : 3;  /* guest isc field */
+       unsigned int _res3 : 6;
+       unsigned int gf    : 2;  /* gisa format */
+       unsigned int _res4 : 1;
+       unsigned int gisa  : 27; /* gisa origin */
+       unsigned int _res5 : 1;
+       unsigned int isc   : 3;  /* irq sub class */
+};
+
+/**
+ * ap_queue_irq_ctrl(): Control interruption on a AP queue.
+ * @qid: The AP queue number
+ * @qirqctrl: struct ap_qirq_ctrl, see above
+ * @ind: The notification indicator byte
+ *
+ * Returns AP queue status.
+ *
+ * Control interruption on the given AP queue.
+ * Just a simple wrapper function for the low level PQAP(AQIC)
+ * instruction available for other kernel modules.
+ */
+struct ap_queue_status ap_queue_irq_ctrl(ap_qid_t qid,
+                                        struct ap_qirq_ctrl qirqctrl,
+                                        void *ind);
+
+#endif /* _ASM_S390_AP_H_ */
index bd6f303045185b7dbb2a4bc4a14d4c7729a84e4a..3f46a6577b8d70d891ee032777bbaaabb6ec8229 100644 (file)
@@ -5,12 +5,11 @@
 #include <linux/errno.h>
 
 typedef struct {
+       spinlock_t lock;
        cpumask_t cpu_attach_mask;
        atomic_t flush_count;
        unsigned int flush_mm;
-       spinlock_t pgtable_lock;
        struct list_head pgtable_list;
-       spinlock_t gmap_lock;
        struct list_head gmap_list;
        unsigned long gmap_asce;
        unsigned long asce;
@@ -27,10 +26,8 @@ typedef struct {
 } mm_context_t;
 
 #define INIT_MM_CONTEXT(name)                                             \
-       .context.pgtable_lock =                                            \
-                       __SPIN_LOCK_UNLOCKED(name.context.pgtable_lock),   \
+       .context.lock = __SPIN_LOCK_UNLOCKED(name.context.lock),           \
        .context.pgtable_list = LIST_HEAD_INIT(name.context.pgtable_list), \
-       .context.gmap_lock = __SPIN_LOCK_UNLOCKED(name.context.gmap_lock), \
        .context.gmap_list = LIST_HEAD_INIT(name.context.gmap_list),
 
 static inline int tprot(unsigned long addr)
index 72e9ca83a6687873787ac7eb656c73aaf8dbc42e..3c9abedc323cbb488f46a7ae1d1bc40e4c7de9e1 100644 (file)
@@ -17,9 +17,8 @@
 static inline int init_new_context(struct task_struct *tsk,
                                   struct mm_struct *mm)
 {
-       spin_lock_init(&mm->context.pgtable_lock);
+       spin_lock_init(&mm->context.lock);
        INIT_LIST_HEAD(&mm->context.pgtable_list);
-       spin_lock_init(&mm->context.gmap_lock);
        INIT_LIST_HEAD(&mm->context.gmap_list);
        cpumask_clear(&mm->context.cpu_attach_mask);
        atomic_set(&mm->context.flush_count, 0);
@@ -103,7 +102,6 @@ static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
        if (prev == next)
                return;
        cpumask_set_cpu(cpu, &next->context.cpu_attach_mask);
-       cpumask_set_cpu(cpu, mm_cpumask(next));
        /* Clear old ASCE by loading the kernel ASCE. */
        __ctl_load(S390_lowcore.kernel_asce, 1, 1);
        __ctl_load(S390_lowcore.kernel_asce, 7, 7);
@@ -121,9 +119,8 @@ static inline void finish_arch_post_lock_switch(void)
                preempt_disable();
                while (atomic_read(&mm->context.flush_count))
                        cpu_relax();
-
-               if (mm->context.flush_mm)
-                       __tlb_flush_mm(mm);
+               cpumask_set_cpu(smp_processor_id(), mm_cpumask(mm));
+               __tlb_flush_mm_lazy(mm);
                preempt_enable();
        }
        set_fs(current->thread.mm_segment);
@@ -136,6 +133,7 @@ static inline void activate_mm(struct mm_struct *prev,
                                struct mm_struct *next)
 {
        switch_mm(prev, next, current);
+       cpumask_set_cpu(smp_processor_id(), mm_cpumask(next));
        set_user_asce(next);
 }
 
index 4d759f8f4bc737861849475e36d277adc653b2f0..b08d5bc2666e65f42e2444158133b712ec8dc1ff 100644 (file)
@@ -48,23 +48,6 @@ static inline void __tlb_flush_global(void)
  * Flush TLB entries for a specific mm on all CPUs (in case gmap is used
  * this implicates multiple ASCEs!).
  */
-static inline void __tlb_flush_full(struct mm_struct *mm)
-{
-       preempt_disable();
-       atomic_inc(&mm->context.flush_count);
-       if (cpumask_equal(mm_cpumask(mm), cpumask_of(smp_processor_id()))) {
-               /* Local TLB flush */
-               __tlb_flush_local();
-       } else {
-               /* Global TLB flush */
-               __tlb_flush_global();
-               /* Reset TLB flush mask */
-               cpumask_copy(mm_cpumask(mm), &mm->context.cpu_attach_mask);
-       }
-       atomic_dec(&mm->context.flush_count);
-       preempt_enable();
-}
-
 static inline void __tlb_flush_mm(struct mm_struct *mm)
 {
        unsigned long gmap_asce;
@@ -76,16 +59,18 @@ static inline void __tlb_flush_mm(struct mm_struct *mm)
         */
        preempt_disable();
        atomic_inc(&mm->context.flush_count);
+       /* Reset TLB flush mask */
+       cpumask_copy(mm_cpumask(mm), &mm->context.cpu_attach_mask);
+       barrier();
        gmap_asce = READ_ONCE(mm->context.gmap_asce);
        if (MACHINE_HAS_IDTE && gmap_asce != -1UL) {
                if (gmap_asce)
                        __tlb_flush_idte(gmap_asce);
                __tlb_flush_idte(mm->context.asce);
        } else {
-               __tlb_flush_full(mm);
+               /* Global TLB flush */
+               __tlb_flush_global();
        }
-       /* Reset TLB flush mask */
-       cpumask_copy(mm_cpumask(mm), &mm->context.cpu_attach_mask);
        atomic_dec(&mm->context.flush_count);
        preempt_enable();
 }
@@ -99,7 +84,6 @@ static inline void __tlb_flush_kernel(void)
 }
 #else
 #define __tlb_flush_global()   __tlb_flush_local()
-#define __tlb_flush_full(mm)   __tlb_flush_local()
 
 /*
  * Flush TLB entries for a specific ASCE on all CPUs.
@@ -117,10 +101,12 @@ static inline void __tlb_flush_kernel(void)
 
 static inline void __tlb_flush_mm_lazy(struct mm_struct * mm)
 {
+       spin_lock(&mm->context.lock);
        if (mm->context.flush_mm) {
-               __tlb_flush_mm(mm);
                mm->context.flush_mm = 0;
+               __tlb_flush_mm(mm);
        }
+       spin_unlock(&mm->context.lock);
 }
 
 /*
index c620049c61f2dfcd0e8824e28f3c329c077f8644..f549c4657376a4cec8009ada0a5d6b366d1d02f2 100644 (file)
@@ -75,35 +75,34 @@ int copy_siginfo_to_user32(compat_siginfo_t __user *to, const siginfo_t *from)
           at the same time.  */
        err = __put_user(from->si_signo, &to->si_signo);
        err |= __put_user(from->si_errno, &to->si_errno);
-       err |= __put_user((short)from->si_code, &to->si_code);
+       err |= __put_user(from->si_code, &to->si_code);
        if (from->si_code < 0)
                err |= __copy_to_user(&to->_sifields._pad, &from->_sifields._pad, SI_PAD_SIZE);
        else {
-               switch (from->si_code >> 16) {
-               case __SI_RT >> 16: /* This is not generated by the kernel as of now.  */
-               case __SI_MESGQ >> 16:
+               switch (siginfo_layout(from->si_signo, from->si_code)) {
+               case SIL_RT:
                        err |= __put_user(from->si_int, &to->si_int);
                        /* fallthrough */
-               case __SI_KILL >> 16:
+               case SIL_KILL:
                        err |= __put_user(from->si_pid, &to->si_pid);
                        err |= __put_user(from->si_uid, &to->si_uid);
                        break;
-               case __SI_CHLD >> 16:
+               case SIL_CHLD:
                        err |= __put_user(from->si_pid, &to->si_pid);
                        err |= __put_user(from->si_uid, &to->si_uid);
                        err |= __put_user(from->si_utime, &to->si_utime);
                        err |= __put_user(from->si_stime, &to->si_stime);
                        err |= __put_user(from->si_status, &to->si_status);
                        break;
-               case __SI_FAULT >> 16:
+               case SIL_FAULT:
                        err |= __put_user((unsigned long) from->si_addr,
                                          &to->si_addr);
                        break;
-               case __SI_POLL >> 16:
+               case SIL_POLL:
                        err |= __put_user(from->si_band, &to->si_band);
                        err |= __put_user(from->si_fd, &to->si_fd);
                        break;
-               case __SI_TIMER >> 16:
+               case SIL_TIMER:
                        err |= __put_user(from->si_tid, &to->si_tid);
                        err |= __put_user(from->si_overrun, &to->si_overrun);
                        err |= __put_user(from->si_int, &to->si_int);
@@ -127,32 +126,31 @@ int copy_siginfo_from_user32(siginfo_t *to, compat_siginfo_t __user *from)
        if (to->si_code < 0)
                err |= __copy_from_user(&to->_sifields._pad, &from->_sifields._pad, SI_PAD_SIZE);
        else {
-               switch (to->si_code >> 16) {
-               case __SI_RT >> 16: /* This is not generated by the kernel as of now.  */
-               case __SI_MESGQ >> 16:
+               switch (siginfo_layout(to->si_signo, to->si_code)) {
+               case SIL_RT:
                        err |= __get_user(to->si_int, &from->si_int);
                        /* fallthrough */
-               case __SI_KILL >> 16:
+               case SIL_KILL:
                        err |= __get_user(to->si_pid, &from->si_pid);
                        err |= __get_user(to->si_uid, &from->si_uid);
                        break;
-               case __SI_CHLD >> 16:
+               case SIL_CHLD:
                        err |= __get_user(to->si_pid, &from->si_pid);
                        err |= __get_user(to->si_uid, &from->si_uid);
                        err |= __get_user(to->si_utime, &from->si_utime);
                        err |= __get_user(to->si_stime, &from->si_stime);
                        err |= __get_user(to->si_status, &from->si_status);
                        break;
-               case __SI_FAULT >> 16:
+               case SIL_FAULT:
                        err |= __get_user(tmp, &from->si_addr);
                        to->si_addr = (void __force __user *)
                                (u64) (tmp & PSW32_ADDR_INSN);
                        break;
-               case __SI_POLL >> 16:
+               case SIL_POLL:
                        err |= __get_user(to->si_band, &from->si_band);
                        err |= __get_user(to->si_fd, &from->si_fd);
                        break;
-               case __SI_TIMER >> 16:
+               case SIL_TIMER:
                        err |= __get_user(to->si_tid, &from->si_tid);
                        err |= __get_user(to->si_overrun, &from->si_overrun);
                        err |= __get_user(to->si_int, &from->si_int);
index 9e1494e3d84903332eafd9e698dc625dd51d8352..2f66290c9b9273b2bf0295742bb5e56c0d51f1d6 100644 (file)
@@ -100,14 +100,14 @@ struct gmap *gmap_create(struct mm_struct *mm, unsigned long limit)
        if (!gmap)
                return NULL;
        gmap->mm = mm;
-       spin_lock(&mm->context.gmap_lock);
+       spin_lock(&mm->context.lock);
        list_add_rcu(&gmap->list, &mm->context.gmap_list);
        if (list_is_singular(&mm->context.gmap_list))
                gmap_asce = gmap->asce;
        else
                gmap_asce = -1UL;
        WRITE_ONCE(mm->context.gmap_asce, gmap_asce);
-       spin_unlock(&mm->context.gmap_lock);
+       spin_unlock(&mm->context.lock);
        return gmap;
 }
 EXPORT_SYMBOL_GPL(gmap_create);
@@ -248,7 +248,7 @@ void gmap_remove(struct gmap *gmap)
                spin_unlock(&gmap->shadow_lock);
        }
        /* Remove gmap from the pre-mm list */
-       spin_lock(&gmap->mm->context.gmap_lock);
+       spin_lock(&gmap->mm->context.lock);
        list_del_rcu(&gmap->list);
        if (list_empty(&gmap->mm->context.gmap_list))
                gmap_asce = 0;
@@ -258,7 +258,7 @@ void gmap_remove(struct gmap *gmap)
        else
                gmap_asce = -1UL;
        WRITE_ONCE(gmap->mm->context.gmap_asce, gmap_asce);
-       spin_unlock(&gmap->mm->context.gmap_lock);
+       spin_unlock(&gmap->mm->context.lock);
        synchronize_rcu();
        /* Put reference */
        gmap_put(gmap);
index c5b74dd61197998be7ee1e80a0a4de6d35a2fca7..05f1f27e6708f31642b9297013109702127c73b2 100644 (file)
@@ -83,7 +83,7 @@ int crst_table_upgrade(struct mm_struct *mm, unsigned long end)
        int rc, notify;
 
        /* upgrade should only happen from 3 to 4, 3 to 5, or 4 to 5 levels */
-       BUG_ON(mm->context.asce_limit < _REGION2_SIZE);
+       VM_BUG_ON(mm->context.asce_limit < _REGION2_SIZE);
        if (end >= TASK_SIZE_MAX)
                return -ENOMEM;
        rc = 0;
@@ -124,7 +124,7 @@ void crst_table_downgrade(struct mm_struct *mm)
        pgd_t *pgd;
 
        /* downgrade should only happen from 3 to 2 levels (compat only) */
-       BUG_ON(mm->context.asce_limit != _REGION2_SIZE);
+       VM_BUG_ON(mm->context.asce_limit != _REGION2_SIZE);
 
        if (current->active_mm == mm) {
                clear_user_asce();
@@ -188,7 +188,7 @@ unsigned long *page_table_alloc(struct mm_struct *mm)
        /* Try to get a fragment of a 4K page as a 2K page table */
        if (!mm_alloc_pgste(mm)) {
                table = NULL;
-               spin_lock_bh(&mm->context.pgtable_lock);
+               spin_lock_bh(&mm->context.lock);
                if (!list_empty(&mm->context.pgtable_list)) {
                        page = list_first_entry(&mm->context.pgtable_list,
                                                struct page, lru);
@@ -203,7 +203,7 @@ unsigned long *page_table_alloc(struct mm_struct *mm)
                                list_del(&page->lru);
                        }
                }
-               spin_unlock_bh(&mm->context.pgtable_lock);
+               spin_unlock_bh(&mm->context.lock);
                if (table)
                        return table;
        }
@@ -227,9 +227,9 @@ unsigned long *page_table_alloc(struct mm_struct *mm)
                /* Return the first 2K fragment of the page */
                atomic_set(&page->_mapcount, 1);
                clear_table(table, _PAGE_INVALID, PAGE_SIZE);
-               spin_lock_bh(&mm->context.pgtable_lock);
+               spin_lock_bh(&mm->context.lock);
                list_add(&page->lru, &mm->context.pgtable_list);
-               spin_unlock_bh(&mm->context.pgtable_lock);
+               spin_unlock_bh(&mm->context.lock);
        }
        return table;
 }
@@ -243,13 +243,13 @@ void page_table_free(struct mm_struct *mm, unsigned long *table)
        if (!mm_alloc_pgste(mm)) {
                /* Free 2K page table fragment of a 4K page */
                bit = (__pa(table) & ~PAGE_MASK)/(PTRS_PER_PTE*sizeof(pte_t));
-               spin_lock_bh(&mm->context.pgtable_lock);
+               spin_lock_bh(&mm->context.lock);
                mask = atomic_xor_bits(&page->_mapcount, 1U << bit);
                if (mask & 3)
                        list_add(&page->lru, &mm->context.pgtable_list);
                else
                        list_del(&page->lru);
-               spin_unlock_bh(&mm->context.pgtable_lock);
+               spin_unlock_bh(&mm->context.lock);
                if (mask != 0)
                        return;
        }
@@ -275,13 +275,13 @@ void page_table_free_rcu(struct mmu_gather *tlb, unsigned long *table,
                return;
        }
        bit = (__pa(table) & ~PAGE_MASK) / (PTRS_PER_PTE*sizeof(pte_t));
-       spin_lock_bh(&mm->context.pgtable_lock);
+       spin_lock_bh(&mm->context.lock);
        mask = atomic_xor_bits(&page->_mapcount, 0x11U << bit);
        if (mask & 3)
                list_add_tail(&page->lru, &mm->context.pgtable_list);
        else
                list_del(&page->lru);
-       spin_unlock_bh(&mm->context.pgtable_lock);
+       spin_unlock_bh(&mm->context.lock);
        table = (unsigned long *) (__pa(table) | (1U << bit));
        tlb_remove_table(tlb, table);
 }
index 9d597f7ab8ddd09f345826e603c2383fb9bdd44a..48aaefd8f5d6ccc5a3a2a67f0b484743d896a632 100644 (file)
@@ -63,11 +63,10 @@ static void gapspci_fixup_resources(struct pci_dev *dev)
                res.end = GAPSPCI_DMA_BASE + GAPSPCI_DMA_SIZE - 1;
                res.flags = IORESOURCE_MEM;
                pcibios_resource_to_bus(dev->bus, &region, &res);
-               BUG_ON(!dma_declare_coherent_memory(&dev->dev,
+               BUG_ON(dma_declare_coherent_memory(&dev->dev,
                                                res.start,
                                                region.start,
                                                resource_size(&res),
-                                               DMA_MEMORY_MAP |
                                                DMA_MEMORY_EXCLUSIVE));
                break;
        default:
index 2d9b79ccaa50263be9582f6c317b7ab7bb96a948..157f46fe374f5cb1fc54d0ea3ca75958440e995e 100644 (file)
 
 #define SI_NOINFO      32767           /* no information in siginfo_t */
 
+/*
+ * SIGFPE si_codes
+ */
+#ifdef __KERNEL__
+#define FPE_FIXME      0       /* Broken dup of SI_USER */
+#endif /* __KERNEL__ */
+
 /*
  * SIGEMT si_codes
  */
-#define EMT_TAGOVF     (__SI_FAULT|1)  /* tag overflow */
+#define EMT_TAGOVF     1       /* tag overflow */
 #define NSIGEMT                1
 
 #endif /* _UAPI__SPARC_SIGINFO_H */
index b4096bb665b2dd736fd1da18d0b756d081d4100c..0e4c08c45a37b0d704fce734a3109c089cc6ae2f 100644 (file)
@@ -85,34 +85,34 @@ int copy_siginfo_to_user32(compat_siginfo_t __user *to, const siginfo_t *from)
           at the same time.  */
        err = __put_user(from->si_signo, &to->si_signo);
        err |= __put_user(from->si_errno, &to->si_errno);
-       err |= __put_user((short)from->si_code, &to->si_code);
+       err |= __put_user(from->si_code, &to->si_code);
        if (from->si_code < 0)
                err |= __copy_to_user(&to->_sifields._pad, &from->_sifields._pad, SI_PAD_SIZE);
        else {
-               switch (from->si_code >> 16) {
-               case __SI_TIMER >> 16:
+               switch (siginfo_layout(from->si_signo, from->si_code)) {
+               case SIL_TIMER:
                        err |= __put_user(from->si_tid, &to->si_tid);
                        err |= __put_user(from->si_overrun, &to->si_overrun);
                        err |= __put_user(from->si_int, &to->si_int);
                        break;
-               case __SI_CHLD >> 16:
+               case SIL_CHLD:
                        err |= __put_user(from->si_utime, &to->si_utime);
                        err |= __put_user(from->si_stime, &to->si_stime);
                        err |= __put_user(from->si_status, &to->si_status);
                default:
+               case SIL_KILL:
                        err |= __put_user(from->si_pid, &to->si_pid);
                        err |= __put_user(from->si_uid, &to->si_uid);
                        break;
-               case __SI_FAULT >> 16:
+               case SIL_FAULT:
                        err |= __put_user(from->si_trapno, &to->si_trapno);
                        err |= __put_user((unsigned long)from->si_addr, &to->si_addr);
                        break;
-               case __SI_POLL >> 16:
+               case SIL_POLL:
                        err |= __put_user(from->si_band, &to->si_band);
                        err |= __put_user(from->si_fd, &to->si_fd);
                        break;
-               case __SI_RT >> 16: /* This is not generated by the kernel as of now.  */
-               case __SI_MESGQ >> 16:
+               case SIL_RT:
                        err |= __put_user(from->si_pid, &to->si_pid);
                        err |= __put_user(from->si_uid, &to->si_uid);
                        err |= __put_user(from->si_int, &to->si_int);
index 466d4aed06c771a9d3c523f6777dac8f7fc80f5f..581cf35ee7e3a7c18c9c0578ca495b8c877f3adf 100644 (file)
@@ -306,7 +306,7 @@ void do_fpe_trap(struct pt_regs *regs, unsigned long pc, unsigned long npc,
        info.si_errno = 0;
        info.si_addr = (void __user *)pc;
        info.si_trapno = 0;
-       info.si_code = __SI_FAULT;
+       info.si_code = FPE_FIXME;
        if ((fsr & 0x1c000) == (1 << 14)) {
                if (fsr & 0x10)
                        info.si_code = FPE_FLTINV;
index c74f2dffcc13f5cc77109c6476807fb332a871c6..0a56dc257cb9a687292817962f9a94eaebd4bd3c 100644 (file)
@@ -2303,7 +2303,7 @@ static void do_fpe_common(struct pt_regs *regs)
                info.si_errno = 0;
                info.si_addr = (void __user *)regs->tpc;
                info.si_trapno = 0;
-               info.si_code = __SI_FAULT;
+               info.si_code = FPE_FIXME;
                if ((fsr & 0x1c000) == (1 << 14)) {
                        if (fsr & 0x10)
                                info.si_code = FPE_FLTINV;
index bbc71a29b2c6a860abf9d7a9d81a6ad75a57f7a1..7061dc8af43af0681208f0fef5b769a99348f346 100644 (file)
@@ -68,8 +68,8 @@ static inline bool dma_capable(struct device *dev, dma_addr_t addr, size_t size)
 int dma_set_mask(struct device *dev, u64 mask);
 
 /*
- * dma_alloc_noncoherent() is #defined to return coherent memory,
- * so there's no need to do any flushing here.
+ * dma_alloc_attrs() always returns non-cacheable memory, so there's no need to
+ * do any flushing here.
  */
 static inline void dma_cache_sync(struct device *dev, void *vaddr, size_t size,
                                  enum dma_data_direction direction)
index 56d661bb010bc77d36a4e18cdc60799ff9c52744..e83f931aa1f0a1d21f6db9a422bea2ff0c88c524 100644 (file)
@@ -26,8 +26,8 @@
 /*
  * Additional Tile-specific SIGILL si_codes
  */
-#define ILL_DBLFLT     (__SI_FAULT|9)  /* double fault */
-#define ILL_HARDWALL   (__SI_FAULT|10) /* user networks hardwall violation */
+#define ILL_DBLFLT     9       /* double fault */
+#define ILL_HARDWALL   10      /* user networks hardwall violation */
 #undef NSIGILL
 #define NSIGILL                10
 
index 0e863f1ee08c040f84c4aa24a770877a2049fe98..971d87a1d8cf8a9241c026e7d83f33bb8581c9eb 100644 (file)
@@ -64,7 +64,7 @@ int copy_siginfo_to_user32(struct compat_siginfo __user *to, const siginfo_t *fr
           3 ints plus the relevant union member.  */
        err = __put_user(from->si_signo, &to->si_signo);
        err |= __put_user(from->si_errno, &to->si_errno);
-       err |= __put_user((short)from->si_code, &to->si_code);
+       err |= __put_user(from->si_code, &to->si_code);
 
        if (from->si_code < 0) {
                err |= __put_user(from->si_pid, &to->si_pid);
@@ -77,28 +77,26 @@ int copy_siginfo_to_user32(struct compat_siginfo __user *to, const siginfo_t *fr
                 */
                err |= __put_user(from->_sifields._pad[0],
                                  &to->_sifields._pad[0]);
-               switch (from->si_code >> 16) {
-               case __SI_FAULT >> 16:
+               switch (siginfo_layout(from->si_signo, from->si_code)) {
+               case SIL_FAULT:
                        break;
-               case __SI_CHLD >> 16:
+               case SIL_CHLD:
                        err |= __put_user(from->si_utime, &to->si_utime);
                        err |= __put_user(from->si_stime, &to->si_stime);
                        err |= __put_user(from->si_status, &to->si_status);
                        /* FALL THROUGH */
                default:
-               case __SI_KILL >> 16:
+               case SIL_KILL:
                        err |= __put_user(from->si_uid, &to->si_uid);
                        break;
-               case __SI_POLL >> 16:
+               case SIL_POLL:
                        err |= __put_user(from->si_fd, &to->si_fd);
                        break;
-               case __SI_TIMER >> 16:
+               case SIL_TIMER:
                        err |= __put_user(from->si_overrun, &to->si_overrun);
                        err |= __put_user(from->si_int, &to->si_int);
                        break;
-                        /* This is not generated by the kernel as of now.  */
-               case __SI_RT >> 16:
-               case __SI_MESGQ >> 16:
+               case SIL_RT:
                        err |= __put_user(from->si_uid, &to->si_uid);
                        err |= __put_user(from->si_int, &to->si_int);
                        break;
index 54804866f238a5f4c41162bef9e163281cbac818..9b08c6055f15eb7e057eda016d5dcad30643af26 100644 (file)
@@ -188,7 +188,7 @@ static int special_ill(tile_bundle_bits bundle, int *sigp, int *codep)
 
        /* Make it the requested signal. */
        *sigp = sig;
-       *codep = code | __SI_FAULT;
+       *codep = code;
        return 1;
 }
 
index a3e6e6136a47ad9ad01917c8f244dd2dd9d0b0ed..971feac135060d371e130680b54034f9dd39556a 100644 (file)
@@ -53,7 +53,6 @@ config X86
        select ARCH_HAS_FORTIFY_SOURCE
        select ARCH_HAS_GCOV_PROFILE_ALL
        select ARCH_HAS_KCOV                    if X86_64
-       select ARCH_HAS_MMIO_FLUSH
        select ARCH_HAS_PMEM_API                if X86_64
        # Causing hangs/crashes, see the commit that added this change for details.
        select ARCH_HAS_REFCOUNT                if BROKEN
index 8b4140f6724f4cfe4cf89135b9e0547baa527d94..cb9a1af109b4796152d8017ca8a9d11f959183f7 100644 (file)
@@ -7,6 +7,4 @@
 
 void clflush_cache_range(void *addr, unsigned int size);
 
-#define mmio_flush_range(addr, size) clflush_cache_range(addr, size)
-
 #endif /* _ASM_X86_CACHEFLUSH_H */
index 8e618fcf1f7c9f842873988ab4cb91e3fb5078fd..6a77c63540f7585477229f27fc1797bc1bdd5719 100644 (file)
@@ -21,7 +21,7 @@
 
 #ifdef CONFIG_AMD_MEM_ENCRYPT
 
-extern unsigned long sme_me_mask;
+extern u64 sme_me_mask;
 
 void sme_encrypt_execute(unsigned long encrypted_kernel_vaddr,
                         unsigned long decrypted_kernel_vaddr,
@@ -49,7 +49,7 @@ void swiotlb_set_mem_attributes(void *vaddr, unsigned long size);
 
 #else  /* !CONFIG_AMD_MEM_ENCRYPT */
 
-#define sme_me_mask    0UL
+#define sme_me_mask    0ULL
 
 static inline void __init sme_early_encrypt(resource_size_t paddr,
                                            unsigned long size) { }
index 831eb78955352bcded4422a8584d7becaf6ba15c..c471ca1f9412bdb021b0c27c00fb9fbfd8bebc90 100644 (file)
@@ -86,7 +86,6 @@ static inline void e820__memblock_alloc_reserved_mpc_new(void) { }
 #endif
 
 int generic_processor_info(int apicid, int version);
-int __generic_processor_info(int apicid, int version, bool enabled);
 
 #define PHYSID_ARRAY_SIZE      BITS_TO_LONGS(MAX_LOCAL_APIC)
 
index 8315e2f517a7ef609e8d43b924a2734f7320e9bb..d705c769f77d52ce55e4f7d5d32b9853ceb40394 100644 (file)
@@ -2130,7 +2130,7 @@ int generic_processor_info(int apicid, int version)
         * Since fixing handling of boot_cpu_physical_apicid requires
         * another discussion and tests on each platform, we leave it
         * for now and here we use read_apic_id() directly in this
-        * function, __generic_processor_info().
+        * function, generic_processor_info().
         */
        if (disabled_cpu_apicid != BAD_APICID &&
            disabled_cpu_apicid != read_apic_id() &&
index 71beb28600d4531d93a9966401a1ca082a9f0c2e..ab9feb5887b149ee8cc284045ca96d97c8eb4e78 100644 (file)
@@ -129,7 +129,7 @@ int __copy_siginfo_to_user32(compat_siginfo_t __user *to, const siginfo_t *from,
                   3 ints plus the relevant union member.  */
                put_user_ex(from->si_signo, &to->si_signo);
                put_user_ex(from->si_errno, &to->si_errno);
-               put_user_ex((short)from->si_code, &to->si_code);
+               put_user_ex(from->si_code, &to->si_code);
 
                if (from->si_code < 0) {
                        put_user_ex(from->si_pid, &to->si_pid);
@@ -142,8 +142,8 @@ int __copy_siginfo_to_user32(compat_siginfo_t __user *to, const siginfo_t *from,
                         */
                        put_user_ex(from->_sifields._pad[0],
                                          &to->_sifields._pad[0]);
-                       switch (from->si_code >> 16) {
-                       case __SI_FAULT >> 16:
+                       switch (siginfo_layout(from->si_signo, from->si_code)) {
+                       case SIL_FAULT:
                                if (from->si_signo == SIGBUS &&
                                    (from->si_code == BUS_MCEERR_AR ||
                                     from->si_code == BUS_MCEERR_AO))
@@ -160,11 +160,11 @@ int __copy_siginfo_to_user32(compat_siginfo_t __user *to, const siginfo_t *from,
                                                put_user_ex(from->si_pkey, &to->si_pkey);
                                }
                                break;
-                       case __SI_SYS >> 16:
+                       case SIL_SYS:
                                put_user_ex(from->si_syscall, &to->si_syscall);
                                put_user_ex(from->si_arch, &to->si_arch);
                                break;
-                       case __SI_CHLD >> 16:
+                       case SIL_CHLD:
                                if (!x32_ABI) {
                                        put_user_ex(from->si_utime, &to->si_utime);
                                        put_user_ex(from->si_stime, &to->si_stime);
@@ -174,21 +174,18 @@ int __copy_siginfo_to_user32(compat_siginfo_t __user *to, const siginfo_t *from,
                                }
                                put_user_ex(from->si_status, &to->si_status);
                                /* FALL THROUGH */
-                       default:
-                       case __SI_KILL >> 16:
+                       case SIL_KILL:
                                put_user_ex(from->si_uid, &to->si_uid);
                                break;
-                       case __SI_POLL >> 16:
+                       case SIL_POLL:
                                put_user_ex(from->si_fd, &to->si_fd);
                                break;
-                       case __SI_TIMER >> 16:
+                       case SIL_TIMER:
                                put_user_ex(from->si_overrun, &to->si_overrun);
                                put_user_ex(ptr_to_compat(from->si_ptr),
                                            &to->si_ptr);
                                break;
-                                /* This is not generated by the kernel as of now.  */
-                       case __SI_RT >> 16:
-                       case __SI_MESGQ >> 16:
+                       case SIL_RT:
                                put_user_ex(from->si_uid, &to->si_uid);
                                put_user_ex(from->si_int, &to->si_int);
                                break;
index 0fbd092697570c6e38d074fd01b3b99110dfb473..3fcc8e01683bef96b219d65dbdd0315db1f60605 100644 (file)
@@ -37,7 +37,7 @@ static char sme_cmdline_off[] __initdata = "off";
  * reside in the .data section so as not to be zeroed out when the .bss
  * section is later cleared.
  */
-unsigned long sme_me_mask __section(.data) = 0;
+u64 sme_me_mask __section(.data) = 0;
 EXPORT_SYMBOL_GPL(sme_me_mask);
 
 /* Buffer used for early in-place encryption by BSP, no locking needed */
index 6d3351452ea2e7c126ee0219aeddfec422832ec6..929ba4da0b3097d6d9c2ae583f4950be20227124 100644 (file)
@@ -2,7 +2,7 @@ config ACPI_NFIT
        tristate "ACPI NVDIMM Firmware Interface Table (NFIT)"
        depends on PHYS_ADDR_T_64BIT
        depends on BLK_DEV
-       depends on ARCH_HAS_MMIO_FLUSH
+       depends on ARCH_HAS_PMEM_API
        select LIBNVDIMM
        help
          Infrastructure to probe ACPI 6 compliant platforms for
index 1893e416e7c0d95a88854670ddef631590bdb8bc..9c2c49b6a240d55164ee8c39ce64e1d595072c62 100644 (file)
@@ -228,6 +228,10 @@ int acpi_nfit_ctl(struct nvdimm_bus_descriptor *nd_desc, struct nvdimm *nvdimm,
        if (cmd == ND_CMD_CALL) {
                call_pkg = buf;
                func = call_pkg->nd_command;
+
+               for (i = 0; i < ARRAY_SIZE(call_pkg->nd_reserved2); i++)
+                       if (call_pkg->nd_reserved2[i])
+                               return -EINVAL;
        }
 
        if (nvdimm) {
@@ -1674,8 +1678,19 @@ static ssize_t range_index_show(struct device *dev,
 }
 static DEVICE_ATTR_RO(range_index);
 
+static ssize_t ecc_unit_size_show(struct device *dev,
+               struct device_attribute *attr, char *buf)
+{
+       struct nd_region *nd_region = to_nd_region(dev);
+       struct nfit_spa *nfit_spa = nd_region_provider_data(nd_region);
+
+       return sprintf(buf, "%d\n", nfit_spa->clear_err_unit);
+}
+static DEVICE_ATTR_RO(ecc_unit_size);
+
 static struct attribute *acpi_nfit_region_attributes[] = {
        &dev_attr_range_index.attr,
+       &dev_attr_ecc_unit_size.attr,
        NULL,
 };
 
@@ -1804,6 +1819,7 @@ static int acpi_nfit_init_interleave_set(struct acpi_nfit_desc *acpi_desc,
                struct nfit_mem *nfit_mem = nvdimm_provider_data(nvdimm);
                struct acpi_nfit_memory_map *memdev = memdev_from_spa(acpi_desc,
                                spa->range_index, i);
+               struct acpi_nfit_control_region *dcr = nfit_mem->dcr;
 
                if (!memdev || !nfit_mem->dcr) {
                        dev_err(dev, "%s: failed to find DCR\n", __func__);
@@ -1811,13 +1827,13 @@ static int acpi_nfit_init_interleave_set(struct acpi_nfit_desc *acpi_desc,
                }
 
                map->region_offset = memdev->region_offset;
-               map->serial_number = nfit_mem->dcr->serial_number;
+               map->serial_number = dcr->serial_number;
 
                map2->region_offset = memdev->region_offset;
-               map2->serial_number = nfit_mem->dcr->serial_number;
-               map2->vendor_id = nfit_mem->dcr->vendor_id;
-               map2->manufacturing_date = nfit_mem->dcr->manufacturing_date;
-               map2->manufacturing_location = nfit_mem->dcr->manufacturing_location;
+               map2->serial_number = dcr->serial_number;
+               map2->vendor_id = dcr->vendor_id;
+               map2->manufacturing_date = dcr->manufacturing_date;
+               map2->manufacturing_location = dcr->manufacturing_location;
        }
 
        /* v1.1 namespaces */
@@ -1835,6 +1851,28 @@ static int acpi_nfit_init_interleave_set(struct acpi_nfit_desc *acpi_desc,
                        cmp_map_compat, NULL);
        nd_set->altcookie = nd_fletcher64(info, sizeof_nfit_set_info(nr), 0);
 
+       /* record the result of the sort for the mapping position */
+       for (i = 0; i < nr; i++) {
+               struct nfit_set_info_map2 *map2 = &info2->mapping[i];
+               int j;
+
+               for (j = 0; j < nr; j++) {
+                       struct nd_mapping_desc *mapping = &ndr_desc->mapping[j];
+                       struct nvdimm *nvdimm = mapping->nvdimm;
+                       struct nfit_mem *nfit_mem = nvdimm_provider_data(nvdimm);
+                       struct acpi_nfit_control_region *dcr = nfit_mem->dcr;
+
+                       if (map2->serial_number == dcr->serial_number &&
+                           map2->vendor_id == dcr->vendor_id &&
+                           map2->manufacturing_date == dcr->manufacturing_date &&
+                           map2->manufacturing_location
+                                   == dcr->manufacturing_location) {
+                               mapping->position = i;
+                               break;
+                       }
+               }
+       }
+
        ndr_desc->nd_set = nd_set;
        devm_kfree(dev, info);
        devm_kfree(dev, info2);
@@ -1930,7 +1968,7 @@ static int acpi_nfit_blk_single_io(struct nfit_blk *nfit_blk,
                        memcpy_flushcache(mmio->addr.aperture + offset, iobuf + copied, c);
                else {
                        if (nfit_blk->dimm_flags & NFIT_BLK_READ_FLUSH)
-                               mmio_flush_range((void __force *)
+                               arch_invalidate_pmem((void __force *)
                                        mmio->addr.aperture + offset, c);
 
                        memcpy(iobuf + copied, mmio->addr.aperture + offset, c);
index 1c152aed6b8265409a0ab2a677ce4bd0a99d62a9..a39b2166b145616d2a6261da8da7252aa7e28b4d 100644 (file)
@@ -37,7 +37,7 @@ static inline dma_addr_t dma_get_device_base(struct device *dev,
                return mem->device_base;
 }
 
-static bool dma_init_coherent_memory(
+static int dma_init_coherent_memory(
        phys_addr_t phys_addr, dma_addr_t device_addr, size_t size, int flags,
        struct dma_coherent_mem **mem)
 {
@@ -45,25 +45,28 @@ static bool dma_init_coherent_memory(
        void __iomem *mem_base = NULL;
        int pages = size >> PAGE_SHIFT;
        int bitmap_size = BITS_TO_LONGS(pages) * sizeof(long);
+       int ret;
 
-       if ((flags & (DMA_MEMORY_MAP | DMA_MEMORY_IO)) == 0)
-               goto out;
-       if (!size)
+       if (!size) {
+               ret = -EINVAL;
                goto out;
+       }
 
-       if (flags & DMA_MEMORY_MAP)
-               mem_base = memremap(phys_addr, size, MEMREMAP_WC);
-       else
-               mem_base = ioremap(phys_addr, size);
-       if (!mem_base)
+       mem_base = memremap(phys_addr, size, MEMREMAP_WC);
+       if (!mem_base) {
+               ret = -EINVAL;
                goto out;
-
+       }
        dma_mem = kzalloc(sizeof(struct dma_coherent_mem), GFP_KERNEL);
-       if (!dma_mem)
+       if (!dma_mem) {
+               ret = -ENOMEM;
                goto out;
+       }
        dma_mem->bitmap = kzalloc(bitmap_size, GFP_KERNEL);
-       if (!dma_mem->bitmap)
+       if (!dma_mem->bitmap) {
+               ret = -ENOMEM;
                goto out;
+       }
 
        dma_mem->virt_base = mem_base;
        dma_mem->device_base = device_addr;
@@ -73,17 +76,13 @@ static bool dma_init_coherent_memory(
        spin_lock_init(&dma_mem->spinlock);
 
        *mem = dma_mem;
-       return true;
+       return 0;
 
 out:
        kfree(dma_mem);
-       if (mem_base) {
-               if (flags & DMA_MEMORY_MAP)
-                       memunmap(mem_base);
-               else
-                       iounmap(mem_base);
-       }
-       return false;
+       if (mem_base)
+               memunmap(mem_base);
+       return ret;
 }
 
 static void dma_release_coherent_memory(struct dma_coherent_mem *mem)
@@ -91,10 +90,7 @@ static void dma_release_coherent_memory(struct dma_coherent_mem *mem)
        if (!mem)
                return;
 
-       if (mem->flags & DMA_MEMORY_MAP)
-               memunmap(mem->virt_base);
-       else
-               iounmap(mem->virt_base);
+       memunmap(mem->virt_base);
        kfree(mem->bitmap);
        kfree(mem);
 }
@@ -109,8 +105,6 @@ static int dma_assign_coherent_memory(struct device *dev,
                return -EBUSY;
 
        dev->dma_mem = mem;
-       /* FIXME: this routine just ignores DMA_MEMORY_INCLUDES_CHILDREN */
-
        return 0;
 }
 
@@ -118,16 +112,16 @@ int dma_declare_coherent_memory(struct device *dev, phys_addr_t phys_addr,
                                dma_addr_t device_addr, size_t size, int flags)
 {
        struct dma_coherent_mem *mem;
+       int ret;
 
-       if (!dma_init_coherent_memory(phys_addr, device_addr, size, flags,
-                                     &mem))
-               return 0;
-
-       if (dma_assign_coherent_memory(dev, mem) == 0)
-               return flags & DMA_MEMORY_MAP ? DMA_MEMORY_MAP : DMA_MEMORY_IO;
+       ret = dma_init_coherent_memory(phys_addr, device_addr, size, flags, &mem);
+       if (ret)
+               return ret;
 
-       dma_release_coherent_memory(mem);
-       return 0;
+       ret = dma_assign_coherent_memory(dev, mem);
+       if (ret)
+               dma_release_coherent_memory(mem);
+       return ret;
 }
 EXPORT_SYMBOL(dma_declare_coherent_memory);
 
@@ -171,7 +165,6 @@ static void *__dma_alloc_from_coherent(struct dma_coherent_mem *mem,
        int order = get_order(size);
        unsigned long flags;
        int pageno;
-       int dma_memory_map;
        void *ret;
 
        spin_lock_irqsave(&mem->spinlock, flags);
@@ -188,15 +181,9 @@ static void *__dma_alloc_from_coherent(struct dma_coherent_mem *mem,
         */
        *dma_handle = mem->device_base + (pageno << PAGE_SHIFT);
        ret = mem->virt_base + (pageno << PAGE_SHIFT);
-       dma_memory_map = (mem->flags & DMA_MEMORY_MAP);
        spin_unlock_irqrestore(&mem->spinlock, flags);
-       if (dma_memory_map)
-               memset(ret, 0, size);
-       else
-               memset_io(ret, 0, size);
-
+       memset(ret, 0, size);
        return ret;
-
 err:
        spin_unlock_irqrestore(&mem->spinlock, flags);
        return NULL;
@@ -359,14 +346,18 @@ static struct reserved_mem *dma_reserved_default_memory __initdata;
 static int rmem_dma_device_init(struct reserved_mem *rmem, struct device *dev)
 {
        struct dma_coherent_mem *mem = rmem->priv;
+       int ret;
 
-       if (!mem &&
-           !dma_init_coherent_memory(rmem->base, rmem->base, rmem->size,
-                                     DMA_MEMORY_MAP | DMA_MEMORY_EXCLUSIVE,
-                                     &mem)) {
+       if (!mem)
+               return -ENODEV;
+
+       ret = dma_init_coherent_memory(rmem->base, rmem->base, rmem->size,
+                                      DMA_MEMORY_EXCLUSIVE, &mem);
+
+       if (ret) {
                pr_err("Reserved memory: failed to init DMA memory pool at %pa, size %ld MiB\n",
                        &rmem->base, (unsigned long)rmem->size / SZ_1M);
-               return -ENODEV;
+               return ret;
        }
        mem->use_dev_dma_pfn_offset = true;
        rmem->priv = mem;
index b555ff9dd8fceb176af2f567157165726e9ab314..e584eddef0a72814e1ebe0ff40866619525d21ef 100644 (file)
@@ -176,13 +176,10 @@ int dmam_declare_coherent_memory(struct device *dev, phys_addr_t phys_addr,
 
        rc = dma_declare_coherent_memory(dev, phys_addr, device_addr, size,
                                         flags);
-       if (rc) {
+       if (!rc)
                devres_add(dev, res);
-               rc = 0;
-       } else {
+       else
                devres_free(res);
-               rc = -ENOMEM;
-       }
 
        return rc;
 }
index b008b6a980980ab56a82bc8b35f388b971b294aa..b640ad8a6d206714b1c0f3042916b15340e01ecc 100644 (file)
@@ -3435,7 +3435,7 @@ static void rbd_acquire_lock(struct work_struct *work)
        struct rbd_device *rbd_dev = container_of(to_delayed_work(work),
                                            struct rbd_device, lock_dwork);
        enum rbd_lock_state lock_state;
-       int ret;
+       int ret = 0;
 
        dout("%s rbd_dev %p\n", __func__, rbd_dev);
 again:
index 23f33f95d4a62d6fc74ec2f27cad04b623c50399..d1aed2513bd93a0dd749e84911f9830a867b1b3d 100644 (file)
@@ -451,9 +451,6 @@ static struct port_buffer *alloc_buf(struct virtqueue *vq, size_t buf_size,
                 * device is created by remoteproc, the DMA memory is
                 * associated with the grandparent device:
                 * vdev => rproc => platform-dev.
-                * The code here would have been less quirky if
-                * DMA_MEMORY_INCLUDES_CHILDREN had been supported
-                * in dma-coherent.c
                 */
                if (!vq->vdev->dev.parent || !vq->vdev->dev.parent->parent)
                        goto free_buf;
index 938eb4868f7f78c7264cae58b15a0dcc0565d5c4..3600ff7866462254d07a87741269231688b9262b 100644 (file)
@@ -46,6 +46,8 @@ void dax_read_unlock(int id)
 EXPORT_SYMBOL_GPL(dax_read_unlock);
 
 #ifdef CONFIG_BLOCK
+#include <linux/blkdev.h>
+
 int bdev_dax_pgoff(struct block_device *bdev, sector_t sector, size_t size,
                pgoff_t *pgoff)
 {
@@ -59,6 +61,16 @@ int bdev_dax_pgoff(struct block_device *bdev, sector_t sector, size_t size,
 }
 EXPORT_SYMBOL(bdev_dax_pgoff);
 
+#if IS_ENABLED(CONFIG_FS_DAX)
+struct dax_device *fs_dax_get_by_bdev(struct block_device *bdev)
+{
+       if (!blk_queue_dax(bdev->bd_queue))
+               return NULL;
+       return fs_dax_get_by_host(bdev->bd_disk->disk_name);
+}
+EXPORT_SYMBOL_GPL(fs_dax_get_by_bdev);
+#endif
+
 /**
  * __bdev_dax_supported() - Check if the device supports dax for filesystem
  * @sb: The superblock of the device
index bf3672a81e4948e87e494e4199cf6a16c1692793..d2fcafcea07e54d4b5cde6fe8ce433e2b3a4bbf8 100644 (file)
@@ -534,7 +534,7 @@ static void
 cper_estatus_print_section(const char *pfx, struct acpi_hest_generic_data *gdata,
                           int sec_no)
 {
-       uuid_le *sec_type = (uuid_le *)gdata->section_type;
+       guid_t *sec_type = (guid_t *)gdata->section_type;
        __u16 severity;
        char newpfx[64];
 
@@ -545,12 +545,12 @@ cper_estatus_print_section(const char *pfx, struct acpi_hest_generic_data *gdata
        printk("%s""Error %d, type: %s\n", pfx, sec_no,
               cper_severity_str(severity));
        if (gdata->validation_bits & CPER_SEC_VALID_FRU_ID)
-               printk("%s""fru_id: %pUl\n", pfx, (uuid_le *)gdata->fru_id);
+               printk("%s""fru_id: %pUl\n", pfx, gdata->fru_id);
        if (gdata->validation_bits & CPER_SEC_VALID_FRU_TEXT)
                printk("%s""fru_text: %.20s\n", pfx, gdata->fru_text);
 
        snprintf(newpfx, sizeof(newpfx), "%s%s", pfx, INDENT_SP);
-       if (!uuid_le_cmp(*sec_type, CPER_SEC_PROC_GENERIC)) {
+       if (guid_equal(sec_type, &CPER_SEC_PROC_GENERIC)) {
                struct cper_sec_proc_generic *proc_err = acpi_hest_get_payload(gdata);
 
                printk("%s""section_type: general processor error\n", newpfx);
@@ -558,7 +558,7 @@ cper_estatus_print_section(const char *pfx, struct acpi_hest_generic_data *gdata
                        cper_print_proc_generic(newpfx, proc_err);
                else
                        goto err_section_too_small;
-       } else if (!uuid_le_cmp(*sec_type, CPER_SEC_PLATFORM_MEM)) {
+       } else if (guid_equal(sec_type, &CPER_SEC_PLATFORM_MEM)) {
                struct cper_sec_mem_err *mem_err = acpi_hest_get_payload(gdata);
 
                printk("%s""section_type: memory error\n", newpfx);
@@ -568,7 +568,7 @@ cper_estatus_print_section(const char *pfx, struct acpi_hest_generic_data *gdata
                                       gdata->error_data_length);
                else
                        goto err_section_too_small;
-       } else if (!uuid_le_cmp(*sec_type, CPER_SEC_PCIE)) {
+       } else if (guid_equal(sec_type, &CPER_SEC_PCIE)) {
                struct cper_sec_pcie *pcie = acpi_hest_get_payload(gdata);
 
                printk("%s""section_type: PCIe error\n", newpfx);
index 96dc01750bc0192e0e9c597ce9b352518a31cea1..36762ec954e7e3f3f00d1f9bacd807294edecd84 100644 (file)
@@ -1708,11 +1708,10 @@ static int sh_mobile_ceu_probe(struct platform_device *pdev)
                err = dma_declare_coherent_memory(&pdev->dev, res->start,
                                                  res->start,
                                                  resource_size(res),
-                                                 DMA_MEMORY_MAP |
                                                  DMA_MEMORY_EXCLUSIVE);
-               if (!err) {
+               if (err) {
                        dev_err(&pdev->dev, "Unable to declare CEU memory.\n");
-                       return -ENXIO;
+                       return err;
                }
 
                pcdev->video_limit = resource_size(res);
index a3c90fe5de00c6b8151893c788b5ad7f36fe6344..73ca8879ada7f944a21b31b232562928cde38fdc 100644 (file)
@@ -1180,9 +1180,10 @@ static int au1000_probe(struct platform_device *pdev)
        /* Allocate the data buffers
         * Snooping works fine with eth on all au1xxx
         */
-       aup->vaddr = (u32)dma_alloc_noncoherent(NULL, MAX_BUF_SIZE *
-                                               (NUM_TX_BUFFS + NUM_RX_BUFFS),
-                                               &aup->dma_addr, 0);
+       aup->vaddr = (u32)dma_alloc_attrs(NULL, MAX_BUF_SIZE *
+                                         (NUM_TX_BUFFS + NUM_RX_BUFFS),
+                                         &aup->dma_addr, 0,
+                                         DMA_ATTR_NON_CONSISTENT);
        if (!aup->vaddr) {
                dev_err(&pdev->dev, "failed to allocate data buffers\n");
                err = -ENOMEM;
@@ -1361,8 +1362,9 @@ err_remap3:
 err_remap2:
        iounmap(aup->mac);
 err_remap1:
-       dma_free_noncoherent(NULL, MAX_BUF_SIZE * (NUM_TX_BUFFS + NUM_RX_BUFFS),
-                            (void *)aup->vaddr, aup->dma_addr);
+       dma_free_attrs(NULL, MAX_BUF_SIZE * (NUM_TX_BUFFS + NUM_RX_BUFFS),
+                       (void *)aup->vaddr, aup->dma_addr,
+                       DMA_ATTR_NON_CONSISTENT);
 err_vaddr:
        free_netdev(dev);
 err_alloc:
@@ -1394,9 +1396,9 @@ static int au1000_remove(struct platform_device *pdev)
                if (aup->tx_db_inuse[i])
                        au1000_ReleaseDB(aup, aup->tx_db_inuse[i]);
 
-       dma_free_noncoherent(NULL, MAX_BUF_SIZE *
-                       (NUM_TX_BUFFS + NUM_RX_BUFFS),
-                       (void *)aup->vaddr, aup->dma_addr);
+       dma_free_attrs(NULL, MAX_BUF_SIZE * (NUM_TX_BUFFS + NUM_RX_BUFFS),
+                       (void *)aup->vaddr, aup->dma_addr,
+                       DMA_ATTR_NON_CONSISTENT);
 
        iounmap(aup->macdma);
        iounmap(aup->mac);
index aa22e108f09b686eba33175ab82195c961bd531b..b69c622ba8b2d027fff91468a15c88349edae3d7 100644 (file)
@@ -96,8 +96,6 @@
 
 #define OPT_SWAP_PORT  0x0001  /* Need to wordswp on the MPU port */
 
-#define DMA_ALLOC                        dma_alloc_noncoherent
-#define DMA_FREE                         dma_free_noncoherent
 #define DMA_WBACK(ndev, addr, len) \
        do { dma_cache_sync((ndev)->dev.parent, (void *)addr, len, DMA_TO_DEVICE); } while (0)
 
@@ -200,8 +198,8 @@ static int __exit lan_remove_chip(struct parisc_device *pdev)
        struct i596_private *lp = netdev_priv(dev);
 
        unregister_netdev (dev);
-       DMA_FREE(&pdev->dev, sizeof(struct i596_private),
-                (void *)lp->dma, lp->dma_addr);
+       dma_free_attrs(&pdev->dev, sizeof(struct i596_private), lp->dma,
+                      lp->dma_addr, DMA_ATTR_NON_CONSISTENT);
        free_netdev (dev);
        return 0;
 }
index 8449c58f01fd6571c101f6d76a360c77237565fe..f00a1dc2128cbcfcf590cb22bf88aa3796b6ab45 100644 (file)
@@ -1063,8 +1063,9 @@ static int i82596_probe(struct net_device *dev)
        if (!dev->base_addr || !dev->irq)
                return -ENODEV;
 
-       dma = (struct i596_dma *) DMA_ALLOC(dev->dev.parent,
-               sizeof(struct i596_dma), &lp->dma_addr, GFP_KERNEL);
+       dma = dma_alloc_attrs(dev->dev.parent, sizeof(struct i596_dma),
+                             &lp->dma_addr, GFP_KERNEL,
+                             DMA_ATTR_NON_CONSISTENT);
        if (!dma) {
                printk(KERN_ERR "%s: Couldn't get shared memory\n", __FILE__);
                return -ENOMEM;
@@ -1085,8 +1086,8 @@ static int i82596_probe(struct net_device *dev)
 
        i = register_netdev(dev);
        if (i) {
-               DMA_FREE(dev->dev.parent, sizeof(struct i596_dma),
-                                   (void *)dma, lp->dma_addr);
+               dma_free_attrs(dev->dev.parent, sizeof(struct i596_dma),
+                              dma, lp->dma_addr, DMA_ATTR_NON_CONSISTENT);
                return i;
        }
 
index 2af7f77345fbdfad8cac859bad6e9584a7716dd4..b2c04a789744fc770b798d79b96604910077dfd3 100644 (file)
@@ -23,8 +23,6 @@
 
 static const char sni_82596_string[] = "snirm_82596";
 
-#define DMA_ALLOC                      dma_alloc_coherent
-#define DMA_FREE                       dma_free_coherent
 #define DMA_WBACK(priv, addr, len)     do { } while (0)
 #define DMA_INV(priv, addr, len)       do { } while (0)
 #define DMA_WBACK_INV(priv, addr, len) do { } while (0)
@@ -152,8 +150,8 @@ static int sni_82596_driver_remove(struct platform_device *pdev)
        struct i596_private *lp = netdev_priv(dev);
 
        unregister_netdev(dev);
-       DMA_FREE(dev->dev.parent, sizeof(struct i596_private),
-                lp->dma, lp->dma_addr);
+       dma_free_attrs(dev->dev.parent, sizeof(struct i596_private), lp->dma,
+                      lp->dma_addr, DMA_ATTR_NON_CONSISTENT);
        iounmap(lp->ca);
        iounmap(lp->mpu_port);
        free_netdev (dev);
index 70347720fdf98a7d54204f8bcda60f4024332f64..573691bc3b71fb31390dc33c071599a2e83c0ad9 100644 (file)
@@ -737,8 +737,8 @@ static int sgiseeq_probe(struct platform_device *pdev)
        sp = netdev_priv(dev);
 
        /* Make private data page aligned */
-       sr = dma_alloc_noncoherent(&pdev->dev, sizeof(*sp->srings),
-                               &sp->srings_dma, GFP_KERNEL);
+       sr = dma_alloc_attrs(&pdev->dev, sizeof(*sp->srings), &sp->srings_dma,
+                            GFP_KERNEL, DMA_ATTR_NON_CONSISTENT);
        if (!sr) {
                printk(KERN_ERR "Sgiseeq: Page alloc failed, aborting.\n");
                err = -ENOMEM;
@@ -813,8 +813,8 @@ static int sgiseeq_remove(struct platform_device *pdev)
        struct sgiseeq_private *sp = netdev_priv(dev);
 
        unregister_netdev(dev);
-       dma_free_noncoherent(&pdev->dev, sizeof(*sp->srings), sp->srings,
-                            sp->srings_dma);
+       dma_free_attrs(&pdev->dev, sizeof(*sp->srings), sp->srings,
+                      sp->srings_dma, DMA_ATTR_NON_CONSISTENT);
        free_netdev(dev);
 
        return 0;
index 60491641a8d67c8e05d7484f929ac897ac511a58..d5612bd1cc81cc4306f383ed7d1448cd3b487293 100644 (file)
@@ -31,6 +31,16 @@ enum log_ent_request {
        LOG_OLD_ENT
 };
 
+static struct device *to_dev(struct arena_info *arena)
+{
+       return &arena->nd_btt->dev;
+}
+
+static u64 adjust_initial_offset(struct nd_btt *nd_btt, u64 offset)
+{
+       return offset + nd_btt->initial_offset;
+}
+
 static int arena_read_bytes(struct arena_info *arena, resource_size_t offset,
                void *buf, size_t n, unsigned long flags)
 {
@@ -38,7 +48,7 @@ static int arena_read_bytes(struct arena_info *arena, resource_size_t offset,
        struct nd_namespace_common *ndns = nd_btt->ndns;
 
        /* arena offsets may be shifted from the base of the device */
-       offset += arena->nd_btt->initial_offset;
+       offset = adjust_initial_offset(nd_btt, offset);
        return nvdimm_read_bytes(ndns, offset, buf, n, flags);
 }
 
@@ -49,7 +59,7 @@ static int arena_write_bytes(struct arena_info *arena, resource_size_t offset,
        struct nd_namespace_common *ndns = nd_btt->ndns;
 
        /* arena offsets may be shifted from the base of the device */
-       offset += arena->nd_btt->initial_offset;
+       offset = adjust_initial_offset(nd_btt, offset);
        return nvdimm_write_bytes(ndns, offset, buf, n, flags);
 }
 
@@ -62,8 +72,10 @@ static int btt_info_write(struct arena_info *arena, struct btt_sb *super)
         * We rely on that to make sure rw_bytes does error clearing
         * correctly, so make sure that is the case.
         */
-       WARN_ON_ONCE(!IS_ALIGNED(arena->infooff, 512));
-       WARN_ON_ONCE(!IS_ALIGNED(arena->info2off, 512));
+       dev_WARN_ONCE(to_dev(arena), !IS_ALIGNED(arena->infooff, 512),
+               "arena->infooff: %#llx is unaligned\n", arena->infooff);
+       dev_WARN_ONCE(to_dev(arena), !IS_ALIGNED(arena->info2off, 512),
+               "arena->info2off: %#llx is unaligned\n", arena->info2off);
 
        ret = arena_write_bytes(arena, arena->info2off, super,
                        sizeof(struct btt_sb), 0);
@@ -76,7 +88,6 @@ static int btt_info_write(struct arena_info *arena, struct btt_sb *super)
 
 static int btt_info_read(struct arena_info *arena, struct btt_sb *super)
 {
-       WARN_ON(!super);
        return arena_read_bytes(arena, arena->infooff, super,
                        sizeof(struct btt_sb), 0);
 }
@@ -92,7 +103,10 @@ static int __btt_map_write(struct arena_info *arena, u32 lba, __le32 mapping,
 {
        u64 ns_off = arena->mapoff + (lba * MAP_ENT_SIZE);
 
-       WARN_ON(lba >= arena->external_nlba);
+       if (unlikely(lba >= arena->external_nlba))
+               dev_err_ratelimited(to_dev(arena),
+                       "%s: lba %#x out of range (max: %#x)\n",
+                       __func__, lba, arena->external_nlba);
        return arena_write_bytes(arena, ns_off, &mapping, MAP_ENT_SIZE, flags);
 }
 
@@ -106,7 +120,7 @@ static int btt_map_write(struct arena_info *arena, u32 lba, u32 mapping,
         * This 'mapping' is supposed to be just the LBA mapping, without
         * any flags set, so strip the flag bits.
         */
-       mapping &= MAP_LBA_MASK;
+       mapping = ent_lba(mapping);
 
        ze = (z_flag << 1) + e_flag;
        switch (ze) {
@@ -131,7 +145,8 @@ static int btt_map_write(struct arena_info *arena, u32 lba, u32 mapping,
                 * construed as a valid 'normal' case, but we decide not to,
                 * to avoid confusion
                 */
-               WARN_ONCE(1, "Invalid use of Z and E flags\n");
+               dev_err_ratelimited(to_dev(arena),
+                       "Invalid use of Z and E flags\n");
                return -EIO;
        }
 
@@ -147,7 +162,10 @@ static int btt_map_read(struct arena_info *arena, u32 lba, u32 *mapping,
        u32 raw_mapping, postmap, ze, z_flag, e_flag;
        u64 ns_off = arena->mapoff + (lba * MAP_ENT_SIZE);
 
-       WARN_ON(lba >= arena->external_nlba);
+       if (unlikely(lba >= arena->external_nlba))
+               dev_err_ratelimited(to_dev(arena),
+                       "%s: lba %#x out of range (max: %#x)\n",
+                       __func__, lba, arena->external_nlba);
 
        ret = arena_read_bytes(arena, ns_off, &in, MAP_ENT_SIZE, rwb_flags);
        if (ret)
@@ -155,10 +173,10 @@ static int btt_map_read(struct arena_info *arena, u32 lba, u32 *mapping,
 
        raw_mapping = le32_to_cpu(in);
 
-       z_flag = (raw_mapping & MAP_TRIM_MASK) >> MAP_TRIM_SHIFT;
-       e_flag = (raw_mapping & MAP_ERR_MASK) >> MAP_ERR_SHIFT;
+       z_flag = ent_z_flag(raw_mapping);
+       e_flag = ent_e_flag(raw_mapping);
        ze = (z_flag << 1) + e_flag;
-       postmap = raw_mapping & MAP_LBA_MASK;
+       postmap = ent_lba(raw_mapping);
 
        /* Reuse the {z,e}_flag variables for *trim and *error */
        z_flag = 0;
@@ -195,7 +213,6 @@ static int btt_map_read(struct arena_info *arena, u32 lba, u32 *mapping,
 static int btt_log_read_pair(struct arena_info *arena, u32 lane,
                        struct log_entry *ent)
 {
-       WARN_ON(!ent);
        return arena_read_bytes(arena,
                        arena->logoff + (2 * lane * LOG_ENT_SIZE), ent,
                        2 * LOG_ENT_SIZE, 0);
@@ -299,11 +316,6 @@ static int btt_log_get_old(struct log_entry *ent)
        return old;
 }
 
-static struct device *to_dev(struct arena_info *arena)
-{
-       return &arena->nd_btt->dev;
-}
-
 /*
  * This function copies the desired (old/new) log entry into ent if
  * it is not NULL. It returns the sub-slot number (0 or 1)
@@ -381,7 +393,9 @@ static int btt_flog_write(struct arena_info *arena, u32 lane, u32 sub,
        arena->freelist[lane].sub = 1 - arena->freelist[lane].sub;
        if (++(arena->freelist[lane].seq) == 4)
                arena->freelist[lane].seq = 1;
-       arena->freelist[lane].block = le32_to_cpu(ent->old_map);
+       if (ent_e_flag(ent->old_map))
+               arena->freelist[lane].has_err = 1;
+       arena->freelist[lane].block = le32_to_cpu(ent_lba(ent->old_map));
 
        return ret;
 }
@@ -407,12 +421,14 @@ static int btt_map_init(struct arena_info *arena)
         * make sure rw_bytes does error clearing correctly, so make sure that
         * is the case.
         */
-       WARN_ON_ONCE(!IS_ALIGNED(arena->mapoff, 512));
+       dev_WARN_ONCE(to_dev(arena), !IS_ALIGNED(arena->mapoff, 512),
+               "arena->mapoff: %#llx is unaligned\n", arena->mapoff);
 
        while (mapsize) {
                size_t size = min(mapsize, chunk_size);
 
-               WARN_ON_ONCE(size < 512);
+               dev_WARN_ONCE(to_dev(arena), size < 512,
+                       "chunk size: %#zx is unaligned\n", size);
                ret = arena_write_bytes(arena, arena->mapoff + offset, zerobuf,
                                size, 0);
                if (ret)
@@ -449,12 +465,14 @@ static int btt_log_init(struct arena_info *arena)
         * make sure rw_bytes does error clearing correctly, so make sure that
         * is the case.
         */
-       WARN_ON_ONCE(!IS_ALIGNED(arena->logoff, 512));
+       dev_WARN_ONCE(to_dev(arena), !IS_ALIGNED(arena->logoff, 512),
+               "arena->logoff: %#llx is unaligned\n", arena->logoff);
 
        while (logsize) {
                size_t size = min(logsize, chunk_size);
 
-               WARN_ON_ONCE(size < 512);
+               dev_WARN_ONCE(to_dev(arena), size < 512,
+                       "chunk size: %#zx is unaligned\n", size);
                ret = arena_write_bytes(arena, arena->logoff + offset, zerobuf,
                                size, 0);
                if (ret)
@@ -480,6 +498,40 @@ static int btt_log_init(struct arena_info *arena)
        return ret;
 }
 
+static u64 to_namespace_offset(struct arena_info *arena, u64 lba)
+{
+       return arena->dataoff + ((u64)lba * arena->internal_lbasize);
+}
+
+static int arena_clear_freelist_error(struct arena_info *arena, u32 lane)
+{
+       int ret = 0;
+
+       if (arena->freelist[lane].has_err) {
+               void *zero_page = page_address(ZERO_PAGE(0));
+               u32 lba = arena->freelist[lane].block;
+               u64 nsoff = to_namespace_offset(arena, lba);
+               unsigned long len = arena->sector_size;
+
+               mutex_lock(&arena->err_lock);
+
+               while (len) {
+                       unsigned long chunk = min(len, PAGE_SIZE);
+
+                       ret = arena_write_bytes(arena, nsoff, zero_page,
+                               chunk, 0);
+                       if (ret)
+                               break;
+                       len -= chunk;
+                       nsoff += chunk;
+                       if (len == 0)
+                               arena->freelist[lane].has_err = 0;
+               }
+               mutex_unlock(&arena->err_lock);
+       }
+       return ret;
+}
+
 static int btt_freelist_init(struct arena_info *arena)
 {
        int old, new, ret;
@@ -505,6 +557,17 @@ static int btt_freelist_init(struct arena_info *arena)
                arena->freelist[i].seq = nd_inc_seq(le32_to_cpu(log_new.seq));
                arena->freelist[i].block = le32_to_cpu(log_new.old_map);
 
+               /*
+                * FIXME: if error clearing fails during init, we want to make
+                * the BTT read-only
+                */
+               if (ent_e_flag(log_new.old_map)) {
+                       ret = arena_clear_freelist_error(arena, i);
+                       if (ret)
+                               dev_err_ratelimited(to_dev(arena),
+                                       "Unable to clear known errors\n");
+               }
+
                /* This implies a newly created or untouched flog entry */
                if (log_new.old_map == log_new.new_map)
                        continue;
@@ -525,7 +588,6 @@ static int btt_freelist_init(struct arena_info *arena)
                        if (ret)
                                return ret;
                }
-
        }
 
        return 0;
@@ -566,6 +628,7 @@ static struct arena_info *alloc_arena(struct btt *btt, size_t size,
        if (!arena)
                return NULL;
        arena->nd_btt = btt->nd_btt;
+       arena->sector_size = btt->sector_size;
 
        if (!size)
                return arena;
@@ -694,6 +757,7 @@ static int discover_arenas(struct btt *btt)
                arena->external_lba_start = cur_nlba;
                parse_arena_meta(arena, super, cur_off);
 
+               mutex_init(&arena->err_lock);
                ret = btt_freelist_init(arena);
                if (ret)
                        goto out;
@@ -904,11 +968,6 @@ static void unlock_map(struct arena_info *arena, u32 premap)
        spin_unlock(&arena->map_locks[idx].lock);
 }
 
-static u64 to_namespace_offset(struct arena_info *arena, u64 lba)
-{
-       return arena->dataoff + ((u64)lba * arena->internal_lbasize);
-}
-
 static int btt_data_read(struct arena_info *arena, struct page *page,
                        unsigned int off, u32 lba, u32 len)
 {
@@ -1032,6 +1091,7 @@ static int btt_read_pg(struct btt *btt, struct bio_integrity_payload *bip,
                 */
                while (1) {
                        u32 new_map;
+                       int new_t, new_e;
 
                        if (t_flag) {
                                zero_fill_data(page, off, cur_len);
@@ -1050,20 +1110,29 @@ static int btt_read_pg(struct btt *btt, struct bio_integrity_payload *bip,
                         */
                        barrier();
 
-                       ret = btt_map_read(arena, premap, &new_map, &t_flag,
-                                               &e_flag, NVDIMM_IO_ATOMIC);
+                       ret = btt_map_read(arena, premap, &new_map, &new_t,
+                                               &new_e, NVDIMM_IO_ATOMIC);
                        if (ret)
                                goto out_rtt;
 
-                       if (postmap == new_map)
+                       if ((postmap == new_map) && (t_flag == new_t) &&
+                                       (e_flag == new_e))
                                break;
 
                        postmap = new_map;
+                       t_flag = new_t;
+                       e_flag = new_e;
                }
 
                ret = btt_data_read(arena, page, off, postmap, cur_len);
-               if (ret)
+               if (ret) {
+                       int rc;
+
+                       /* Media error - set the e_flag */
+                       rc = btt_map_write(arena, premap, postmap, 0, 1,
+                               NVDIMM_IO_ATOMIC);
                        goto out_rtt;
+               }
 
                if (bip) {
                        ret = btt_rw_integrity(btt, bip, arena, postmap, READ);
@@ -1088,6 +1157,21 @@ static int btt_read_pg(struct btt *btt, struct bio_integrity_payload *bip,
        return ret;
 }
 
+/*
+ * Normally, arena_{read,write}_bytes will take care of the initial offset
+ * adjustment, but in the case of btt_is_badblock, where we query is_bad_pmem,
+ * we need the final, raw namespace offset here
+ */
+static bool btt_is_badblock(struct btt *btt, struct arena_info *arena,
+               u32 postmap)
+{
+       u64 nsoff = adjust_initial_offset(arena->nd_btt,
+                       to_namespace_offset(arena, postmap));
+       sector_t phys_sector = nsoff >> 9;
+
+       return is_bad_pmem(btt->phys_bb, phys_sector, arena->internal_lbasize);
+}
+
 static int btt_write_pg(struct btt *btt, struct bio_integrity_payload *bip,
                        sector_t sector, struct page *page, unsigned int off,
                        unsigned int len)
@@ -1100,7 +1184,9 @@ static int btt_write_pg(struct btt *btt, struct bio_integrity_payload *bip,
 
        while (len) {
                u32 cur_len;
+               int e_flag;
 
+ retry:
                lane = nd_region_acquire_lane(btt->nd_region);
 
                ret = lba_to_arena(btt, sector, &premap, &arena);
@@ -1113,6 +1199,21 @@ static int btt_write_pg(struct btt *btt, struct bio_integrity_payload *bip,
                        goto out_lane;
                }
 
+               if (btt_is_badblock(btt, arena, arena->freelist[lane].block))
+                       arena->freelist[lane].has_err = 1;
+
+               if (mutex_is_locked(&arena->err_lock)
+                               || arena->freelist[lane].has_err) {
+                       nd_region_release_lane(btt->nd_region, lane);
+
+                       ret = arena_clear_freelist_error(arena, lane);
+                       if (ret)
+                               return ret;
+
+                       /* OK to acquire a different lane/free block */
+                       goto retry;
+               }
+
                new_postmap = arena->freelist[lane].block;
 
                /* Wait if the new block is being read from */
@@ -1138,7 +1239,7 @@ static int btt_write_pg(struct btt *btt, struct bio_integrity_payload *bip,
                }
 
                lock_map(arena, premap);
-               ret = btt_map_read(arena, premap, &old_postmap, NULL, NULL,
+               ret = btt_map_read(arena, premap, &old_postmap, NULL, &e_flag,
                                NVDIMM_IO_ATOMIC);
                if (ret)
                        goto out_map;
@@ -1146,6 +1247,8 @@ static int btt_write_pg(struct btt *btt, struct bio_integrity_payload *bip,
                        ret = -EIO;
                        goto out_map;
                }
+               if (e_flag)
+                       set_e_flag(old_postmap);
 
                log.lba = cpu_to_le32(premap);
                log.old_map = cpu_to_le32(old_postmap);
@@ -1156,13 +1259,20 @@ static int btt_write_pg(struct btt *btt, struct bio_integrity_payload *bip,
                if (ret)
                        goto out_map;
 
-               ret = btt_map_write(arena, premap, new_postmap, 0, 0, 0);
+               ret = btt_map_write(arena, premap, new_postmap, 0, 0,
+                       NVDIMM_IO_ATOMIC);
                if (ret)
                        goto out_map;
 
                unlock_map(arena, premap);
                nd_region_release_lane(btt->nd_region, lane);
 
+               if (e_flag) {
+                       ret = arena_clear_freelist_error(arena, lane);
+                       if (ret)
+                               return ret;
+               }
+
                len -= cur_len;
                off += cur_len;
                sector += btt->sector_size >> SECTOR_SHIFT;
@@ -1211,11 +1321,13 @@ static blk_qc_t btt_make_request(struct request_queue *q, struct bio *bio)
        bio_for_each_segment(bvec, bio, iter) {
                unsigned int len = bvec.bv_len;
 
-               BUG_ON(len > PAGE_SIZE);
-               /* Make sure len is in multiples of sector size. */
-               /* XXX is this right? */
-               BUG_ON(len < btt->sector_size);
-               BUG_ON(len % btt->sector_size);
+               if (len > PAGE_SIZE || len < btt->sector_size ||
+                               len % btt->sector_size) {
+                       dev_err_ratelimited(&btt->nd_btt->dev,
+                               "unaligned bio segment (len: %d)\n", len);
+                       bio->bi_status = BLK_STS_IOERR;
+                       break;
+               }
 
                err = btt_do_bvec(btt, bip, bvec.bv_page, len, bvec.bv_offset,
                                  op_is_write(bio_op(bio)), iter.bi_sector);
@@ -1345,6 +1457,7 @@ static struct btt *btt_init(struct nd_btt *nd_btt, unsigned long long rawsize,
 {
        int ret;
        struct btt *btt;
+       struct nd_namespace_io *nsio;
        struct device *dev = &nd_btt->dev;
 
        btt = devm_kzalloc(dev, sizeof(struct btt), GFP_KERNEL);
@@ -1358,6 +1471,8 @@ static struct btt *btt_init(struct nd_btt *nd_btt, unsigned long long rawsize,
        INIT_LIST_HEAD(&btt->arena_list);
        mutex_init(&btt->init_lock);
        btt->nd_region = nd_region;
+       nsio = to_nd_namespace_io(&nd_btt->ndns->dev);
+       btt->phys_bb = &nsio->bb;
 
        ret = discover_arenas(btt);
        if (ret) {
@@ -1431,6 +1546,8 @@ int nvdimm_namespace_attach_btt(struct nd_namespace_common *ndns)
        }
 
        btt_sb = devm_kzalloc(&nd_btt->dev, sizeof(*btt_sb), GFP_KERNEL);
+       if (!btt_sb)
+               return -ENOMEM;
 
        /*
         * If this returns < 0, that is ok as it just means there wasn't
index 888e862907a0cab358a66abc6818cf33d9b9c559..578c2057524d396fbf7c2eee88804b58c1f17cfe 100644 (file)
@@ -15,6 +15,7 @@
 #ifndef _LINUX_BTT_H
 #define _LINUX_BTT_H
 
+#include <linux/badblocks.h>
 #include <linux/types.h>
 
 #define BTT_SIG_LEN 16
 #define IB_FLAG_ERROR 0x00000001
 #define IB_FLAG_ERROR_MASK 0x00000001
 
+#define ent_lba(ent) (ent & MAP_LBA_MASK)
+#define ent_e_flag(ent) (!!(ent & MAP_ERR_MASK))
+#define ent_z_flag(ent) (!!(ent & MAP_TRIM_MASK))
+#define set_e_flag(ent) (ent |= MAP_ERR_MASK)
+
 enum btt_init_state {
        INIT_UNCHECKED = 0,
        INIT_NOTFOUND,
@@ -78,6 +84,7 @@ struct free_entry {
        u32 block;
        u8 sub;
        u8 seq;
+       u8 has_err;
 };
 
 struct aligned_lock {
@@ -104,6 +111,7 @@ struct aligned_lock {
  *                     handle incoming writes.
  * @version_major:     Metadata layout version major.
  * @version_minor:     Metadata layout version minor.
+ * @sector_size:       The Linux sector size - 512 or 4096
  * @nextoff:           Offset in bytes to the start of the next arena.
  * @infooff:           Offset in bytes to the info block of this arena.
  * @dataoff:           Offset in bytes to the data area of this arena.
@@ -131,6 +139,7 @@ struct arena_info {
        u32 nfree;
        u16 version_major;
        u16 version_minor;
+       u32 sector_size;
        /* Byte offsets to the different on-media structures */
        u64 nextoff;
        u64 infooff;
@@ -147,6 +156,7 @@ struct arena_info {
        struct dentry *debugfs_dir;
        /* Arena flags */
        u32 flags;
+       struct mutex err_lock;
 };
 
 /**
@@ -181,6 +191,7 @@ struct btt {
        struct mutex init_lock;
        int init_state;
        int num_arenas;
+       struct badblocks *phys_bb;
 };
 
 bool nd_btt_arena_is_valid(struct nd_btt *nd_btt, struct btt_sb *super);
index 3e359d282f8ea57cfad70ed64e4c27c2c15cc6f2..d58925295aa797a60098b3076056c08714e11bc3 100644 (file)
@@ -61,7 +61,7 @@ static ssize_t sector_size_show(struct device *dev,
 {
        struct nd_btt *nd_btt = to_nd_btt(dev);
 
-       return nd_sector_size_show(nd_btt->lbasize, btt_lbasize_supported, buf);
+       return nd_size_select_show(nd_btt->lbasize, btt_lbasize_supported, buf);
 }
 
 static ssize_t sector_size_store(struct device *dev,
@@ -72,7 +72,7 @@ static ssize_t sector_size_store(struct device *dev,
 
        device_lock(dev);
        nvdimm_bus_lock(dev);
-       rc = nd_sector_size_store(dev, buf, &nd_btt->lbasize,
+       rc = nd_size_select_store(dev, buf, &nd_btt->lbasize,
                        btt_lbasize_supported);
        dev_dbg(dev, "%s: result: %zd wrote: %s%s", __func__,
                        rc, buf, buf[len - 1] == '\n' ? "" : "\n");
index 937fafa1886a8056f08ae809a129eb43f90daffd..baf283986a7ec38ea4f2562a43b36e31e1743f95 100644 (file)
@@ -11,6 +11,7 @@
  * General Public License for more details.
  */
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+#include <linux/sched/mm.h>
 #include <linux/vmalloc.h>
 #include <linux/uaccess.h>
 #include <linux/module.h>
@@ -234,6 +235,7 @@ long nvdimm_clear_poison(struct device *dev, phys_addr_t phys,
        struct nd_cmd_clear_error clear_err;
        struct nd_cmd_ars_cap ars_cap;
        u32 clear_err_unit, mask;
+       unsigned int noio_flag;
        int cmd_rc, rc;
 
        if (!nvdimm_bus)
@@ -250,8 +252,10 @@ long nvdimm_clear_poison(struct device *dev, phys_addr_t phys,
        memset(&ars_cap, 0, sizeof(ars_cap));
        ars_cap.address = phys;
        ars_cap.length = len;
+       noio_flag = memalloc_noio_save();
        rc = nd_desc->ndctl(nd_desc, NULL, ND_CMD_ARS_CAP, &ars_cap,
                        sizeof(ars_cap), &cmd_rc);
+       memalloc_noio_restore(noio_flag);
        if (rc < 0)
                return rc;
        if (cmd_rc < 0)
@@ -266,8 +270,10 @@ long nvdimm_clear_poison(struct device *dev, phys_addr_t phys,
        memset(&clear_err, 0, sizeof(clear_err));
        clear_err.address = phys;
        clear_err.length = len;
+       noio_flag = memalloc_noio_save();
        rc = nd_desc->ndctl(nd_desc, NULL, ND_CMD_CLEAR_ERROR, &clear_err,
                        sizeof(clear_err), &cmd_rc);
+       memalloc_noio_restore(noio_flag);
        if (rc < 0)
                return rc;
        if (cmd_rc < 0)
@@ -905,19 +911,20 @@ static int __nd_ioctl(struct nvdimm_bus *nvdimm_bus, struct nvdimm *nvdimm,
                int read_only, unsigned int ioctl_cmd, unsigned long arg)
 {
        struct nvdimm_bus_descriptor *nd_desc = nvdimm_bus->nd_desc;
-       size_t buf_len = 0, in_len = 0, out_len = 0;
        static char out_env[ND_CMD_MAX_ENVELOPE];
        static char in_env[ND_CMD_MAX_ENVELOPE];
        const struct nd_cmd_desc *desc = NULL;
        unsigned int cmd = _IOC_NR(ioctl_cmd);
-       unsigned int func = cmd;
-       void __user *p = (void __user *) arg;
        struct device *dev = &nvdimm_bus->dev;
-       struct nd_cmd_pkg pkg;
+       void __user *p = (void __user *) arg;
        const char *cmd_name, *dimm_name;
+       u32 in_len = 0, out_len = 0;
+       unsigned int func = cmd;
        unsigned long cmd_mask;
-       void *buf;
+       struct nd_cmd_pkg pkg;
        int rc, i, cmd_rc;
+       u64 buf_len = 0;
+       void *buf;
 
        if (nvdimm) {
                desc = nd_cmd_dimm_desc(cmd);
@@ -977,13 +984,9 @@ static int __nd_ioctl(struct nvdimm_bus *nvdimm_bus, struct nvdimm *nvdimm,
 
        if (cmd == ND_CMD_CALL) {
                func = pkg.nd_command;
-               dev_dbg(dev, "%s:%s, idx: %llu, in: %zu, out: %zu, len %zu\n",
+               dev_dbg(dev, "%s:%s, idx: %llu, in: %u, out: %u, len %llu\n",
                                __func__, dimm_name, pkg.nd_command,
                                in_len, out_len, buf_len);
-
-               for (i = 0; i < ARRAY_SIZE(pkg.nd_reserved2); i++)
-                       if (pkg.nd_reserved2[i])
-                               return -EINVAL;
        }
 
        /* process an output envelope */
@@ -1007,9 +1010,9 @@ static int __nd_ioctl(struct nvdimm_bus *nvdimm_bus, struct nvdimm *nvdimm,
                out_len += out_size;
        }
 
-       buf_len = out_len + in_len;
+       buf_len = (u64) out_len + (u64) in_len;
        if (buf_len > ND_IOCTL_MAX_BUFLEN) {
-               dev_dbg(dev, "%s:%s cmd: %s buf_len: %zu > %d\n", __func__,
+               dev_dbg(dev, "%s:%s cmd: %s buf_len: %llu > %d\n", __func__,
                                dimm_name, cmd_name, buf_len,
                                ND_IOCTL_MAX_BUFLEN);
                return -EINVAL;
index 47770460f3d324745b5ea6f1f251ae21df0a8c1d..b2fc29b8279b1e96682cbb9f29a81a84107bba74 100644 (file)
@@ -280,18 +280,11 @@ static int nsio_rw_bytes(struct nd_namespace_common *ndns,
        }
 
        if (unlikely(is_bad_pmem(&nsio->bb, sector, sz_align))) {
-               /*
-                * FIXME: nsio_rw_bytes() may be called from atomic
-                * context in the btt case and the ACPI DSM path for
-                * clearing the error takes sleeping locks and allocates
-                * memory. An explicit error clearing path, and support
-                * for tracking badblocks in BTT metadata is needed to
-                * work around this collision.
-                */
                if (IS_ALIGNED(offset, 512) && IS_ALIGNED(size, 512)
                                && !(flags & NVDIMM_IO_ATOMIC)) {
                        long cleared;
 
+                       might_sleep();
                        cleared = nvdimm_clear_poison(&ndns->dev,
                                        nsio->res.start + offset, size);
                        if (cleared < size)
index 75bc08c6838ccebe1c01e3cec8e9fe0db0fba33d..bb71f0cf8f5da3b1e31cff6521f2e6af298a595a 100644 (file)
@@ -277,14 +277,14 @@ int nd_uuid_store(struct device *dev, u8 **uuid_out, const char *buf,
        return 0;
 }
 
-ssize_t nd_sector_size_show(unsigned long current_lbasize,
+ssize_t nd_size_select_show(unsigned long current_size,
                const unsigned long *supported, char *buf)
 {
        ssize_t len = 0;
        int i;
 
        for (i = 0; supported[i]; i++)
-               if (current_lbasize == supported[i])
+               if (current_size == supported[i])
                        len += sprintf(buf + len, "[%ld] ", supported[i]);
                else
                        len += sprintf(buf + len, "%ld ", supported[i]);
@@ -292,8 +292,8 @@ ssize_t nd_sector_size_show(unsigned long current_lbasize,
        return len;
 }
 
-ssize_t nd_sector_size_store(struct device *dev, const char *buf,
-               unsigned long *current_lbasize, const unsigned long *supported)
+ssize_t nd_size_select_store(struct device *dev, const char *buf,
+               unsigned long *current_size, const unsigned long *supported)
 {
        unsigned long lbasize;
        int rc, i;
@@ -310,7 +310,7 @@ ssize_t nd_sector_size_store(struct device *dev, const char *buf,
                        break;
 
        if (supported[i]) {
-               *current_lbasize = lbasize;
+               *current_size = lbasize;
                return 0;
        } else {
                return -EINVAL;
index 87796f840777067e8594a2fb52ec6a4241ed83b7..9c5f108910e337be347aefcddbca3e8b7a53542f 100644 (file)
@@ -45,12 +45,14 @@ unsigned sizeof_namespace_label(struct nvdimm_drvdata *ndd)
        return ndd->nslabel_size;
 }
 
-size_t sizeof_namespace_index(struct nvdimm_drvdata *ndd)
+int nvdimm_num_label_slots(struct nvdimm_drvdata *ndd)
 {
-       u32 index_span;
+       return ndd->nsarea.config_size / (sizeof_namespace_label(ndd) + 1);
+}
 
-       if (ndd->nsindex_size)
-               return ndd->nsindex_size;
+size_t sizeof_namespace_index(struct nvdimm_drvdata *ndd)
+{
+       u32 nslot, space, size;
 
        /*
         * The minimum index space is 512 bytes, with that amount of
@@ -60,16 +62,16 @@ size_t sizeof_namespace_index(struct nvdimm_drvdata *ndd)
         * starts to waste space at larger config_sizes, but it's
         * unlikely we'll ever see anything but 128K.
         */
-       index_span = ndd->nsarea.config_size / (sizeof_namespace_label(ndd) + 1);
-       index_span /= NSINDEX_ALIGN * 2;
-       ndd->nsindex_size = index_span * NSINDEX_ALIGN;
-
-       return ndd->nsindex_size;
-}
-
-int nvdimm_num_label_slots(struct nvdimm_drvdata *ndd)
-{
-       return ndd->nsarea.config_size / (sizeof_namespace_label(ndd) + 1);
+       nslot = nvdimm_num_label_slots(ndd);
+       space = ndd->nsarea.config_size - nslot * sizeof_namespace_label(ndd);
+       size = ALIGN(sizeof(struct nd_namespace_index) + DIV_ROUND_UP(nslot, 8),
+                       NSINDEX_ALIGN) * 2;
+       if (size <= space)
+               return size / 2;
+
+       dev_err(ndd->dev, "label area (%d) too small to host (%d byte) labels\n",
+                       ndd->nsarea.config_size, sizeof_namespace_label(ndd));
+       return 0;
 }
 
 static int __nd_label_validate(struct nvdimm_drvdata *ndd)
index 5f1c6756e57ca6acffd9ba58e7e8ec746e6e8e48..1427a386a033e72f1f8ec7b4fe02471e9d5d92fb 100644 (file)
@@ -1313,14 +1313,14 @@ static ssize_t sector_size_show(struct device *dev,
        if (is_namespace_blk(dev)) {
                struct nd_namespace_blk *nsblk = to_nd_namespace_blk(dev);
 
-               return nd_sector_size_show(nsblk->lbasize,
+               return nd_size_select_show(nsblk->lbasize,
                                blk_lbasize_supported, buf);
        }
 
        if (is_namespace_pmem(dev)) {
                struct nd_namespace_pmem *nspm = to_nd_namespace_pmem(dev);
 
-               return nd_sector_size_show(nspm->lbasize,
+               return nd_size_select_show(nspm->lbasize,
                                pmem_lbasize_supported, buf);
        }
        return -ENXIO;
@@ -1352,7 +1352,7 @@ static ssize_t sector_size_store(struct device *dev,
        if (to_ndns(dev)->claim)
                rc = -EBUSY;
        if (rc >= 0)
-               rc = nd_sector_size_store(dev, buf, lbasize, supported);
+               rc = nd_size_select_store(dev, buf, lbasize, supported);
        if (rc >= 0)
                rc = nd_namespace_label_update(nd_region, dev);
        dev_dbg(dev, "%s: result: %zd %s: %s%s", __func__,
index a87f793f2945ec4b46a283fa482f746b94996c15..9c758a91372bbf6c72f9ca9a9af99615ec965426 100644 (file)
@@ -42,7 +42,7 @@ struct nd_poison {
 
 struct nvdimm_drvdata {
        struct device *dev;
-       int nsindex_size, nslabel_size;
+       int nslabel_size;
        struct nd_cmd_get_config_size nsarea;
        void *data;
        int ns_current, ns_next;
@@ -134,6 +134,7 @@ struct nd_mapping {
        struct nvdimm *nvdimm;
        u64 start;
        u64 size;
+       int position;
        struct list_head labels;
        struct mutex lock;
        /*
@@ -233,10 +234,10 @@ void nd_device_unregister(struct device *dev, enum nd_async_mode mode);
 void nd_device_notify(struct device *dev, enum nvdimm_event event);
 int nd_uuid_store(struct device *dev, u8 **uuid_out, const char *buf,
                size_t len);
-ssize_t nd_sector_size_show(unsigned long current_lbasize,
+ssize_t nd_size_select_show(unsigned long current_size,
                const unsigned long *supported, char *buf);
-ssize_t nd_sector_size_store(struct device *dev, const char *buf,
-               unsigned long *current_lbasize, const unsigned long *supported);
+ssize_t nd_size_select_store(struct device *dev, const char *buf,
+               unsigned long *current_size, const unsigned long *supported);
 int __init nvdimm_init(void);
 int __init nd_region_init(void);
 int __init nd_label_init(void);
@@ -285,6 +286,13 @@ static inline struct device *nd_btt_create(struct nd_region *nd_region)
 
 struct nd_pfn *to_nd_pfn(struct device *dev);
 #if IS_ENABLED(CONFIG_NVDIMM_PFN)
+
+#ifdef CONFIG_TRANSPARENT_HUGEPAGE
+#define PFN_DEFAULT_ALIGNMENT HPAGE_PMD_SIZE
+#else
+#define PFN_DEFAULT_ALIGNMENT PAGE_SIZE
+#endif
+
 int nd_pfn_probe(struct device *dev, struct nd_namespace_common *ndns);
 bool is_nd_pfn(struct device *dev);
 struct device *nd_pfn_create(struct nd_region *nd_region);
index 5fcb6f5b22a25f4d998d5c48309d8b1ef037e794..9576c444f0ab58f8385ea63cface071cba86d972 100644 (file)
@@ -111,24 +111,27 @@ static ssize_t align_show(struct device *dev,
        return sprintf(buf, "%ld\n", nd_pfn->align);
 }
 
-static ssize_t __align_store(struct nd_pfn *nd_pfn, const char *buf)
+static const unsigned long *nd_pfn_supported_alignments(void)
 {
-       unsigned long val;
-       int rc;
-
-       rc = kstrtoul(buf, 0, &val);
-       if (rc)
-               return rc;
-
-       if (!is_power_of_2(val) || val < PAGE_SIZE || val > SZ_1G)
-               return -EINVAL;
+       /*
+        * This needs to be a non-static variable because the *_SIZE
+        * macros aren't always constants.
+        */
+       const unsigned long supported_alignments[] = {
+               PAGE_SIZE,
+#ifdef CONFIG_TRANSPARENT_HUGEPAGE
+               HPAGE_PMD_SIZE,
+#ifdef CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD
+               HPAGE_PUD_SIZE,
+#endif
+#endif
+               0,
+       };
+       static unsigned long data[ARRAY_SIZE(supported_alignments)];
 
-       if (nd_pfn->dev.driver)
-               return -EBUSY;
-       else
-               nd_pfn->align = val;
+       memcpy(data, supported_alignments, sizeof(data));
 
-       return 0;
+       return data;
 }
 
 static ssize_t align_store(struct device *dev,
@@ -139,7 +142,8 @@ static ssize_t align_store(struct device *dev,
 
        device_lock(dev);
        nvdimm_bus_lock(dev);
-       rc = __align_store(nd_pfn, buf);
+       rc = nd_size_select_store(dev, buf, &nd_pfn->align,
+                       nd_pfn_supported_alignments());
        dev_dbg(dev, "%s: result: %zd wrote: %s%s", __func__,
                        rc, buf, buf[len - 1] == '\n' ? "" : "\n");
        nvdimm_bus_unlock(dev);
@@ -260,6 +264,13 @@ static ssize_t size_show(struct device *dev,
 }
 static DEVICE_ATTR_RO(size);
 
+static ssize_t supported_alignments_show(struct device *dev,
+               struct device_attribute *attr, char *buf)
+{
+       return nd_size_select_show(0, nd_pfn_supported_alignments(), buf);
+}
+static DEVICE_ATTR_RO(supported_alignments);
+
 static struct attribute *nd_pfn_attributes[] = {
        &dev_attr_mode.attr,
        &dev_attr_namespace.attr,
@@ -267,6 +278,7 @@ static struct attribute *nd_pfn_attributes[] = {
        &dev_attr_align.attr,
        &dev_attr_resource.attr,
        &dev_attr_size.attr,
+       &dev_attr_supported_alignments.attr,
        NULL,
 };
 
@@ -290,7 +302,7 @@ struct device *nd_pfn_devinit(struct nd_pfn *nd_pfn,
                return NULL;
 
        nd_pfn->mode = PFN_MODE_NONE;
-       nd_pfn->align = HPAGE_SIZE;
+       nd_pfn->align = PFN_DEFAULT_ALIGNMENT;
        dev = &nd_pfn->dev;
        device_initialize(&nd_pfn->dev);
        if (ndns && !__nd_attach_ndns(&nd_pfn->dev, ndns, &nd_pfn->ndns)) {
@@ -638,11 +650,12 @@ static int nd_pfn_init(struct nd_pfn *nd_pfn)
                        / PAGE_SIZE);
        if (nd_pfn->mode == PFN_MODE_PMEM) {
                /*
-                * vmemmap_populate_hugepages() allocates the memmap array in
-                * HPAGE_SIZE chunks.
+                * The altmap should be padded out to the block size used
+                * when populating the vmemmap. This *should* be equal to
+                * PMD_SIZE for most architectures.
                 */
                offset = ALIGN(start + SZ_8K + 64 * npfns + dax_label_reserve,
-                               max(nd_pfn->align, HPAGE_SIZE)) - start;
+                               max(nd_pfn->align, PMD_SIZE)) - start;
        } else if (nd_pfn->mode == PFN_MODE_RAM)
                offset = ALIGN(start + SZ_8K + dax_label_reserve,
                                nd_pfn->align) - start;
index 5434321cad67f11d4f044a0a7152a8e5035aa97d..c5917f040fa7ba56a8229a45c4134ae9a79535ea 100644 (file)
@@ -5,20 +5,6 @@
 #include <linux/pfn_t.h>
 #include <linux/fs.h>
 
-#ifdef CONFIG_ARCH_HAS_PMEM_API
-#define ARCH_MEMREMAP_PMEM MEMREMAP_WB
-void arch_wb_cache_pmem(void *addr, size_t size);
-void arch_invalidate_pmem(void *addr, size_t size);
-#else
-#define ARCH_MEMREMAP_PMEM MEMREMAP_WT
-static inline void arch_wb_cache_pmem(void *addr, size_t size)
-{
-}
-static inline void arch_invalidate_pmem(void *addr, size_t size)
-{
-}
-#endif
-
 /* this definition is in it's own header for tools/testing/nvdimm to consume */
 struct pmem_device {
        /* One contiguous memory region per device */
index 5954cfbea3fce58d14fac6ea7f5900791eaaa38d..829d760f651c7f86e86ed4b8a3f212d3b6ee0a05 100644 (file)
@@ -723,8 +723,9 @@ static ssize_t mappingN(struct device *dev, char *buf, int n)
        nd_mapping = &nd_region->mapping[n];
        nvdimm = nd_mapping->nvdimm;
 
-       return sprintf(buf, "%s,%llu,%llu\n", dev_name(&nvdimm->dev),
-                       nd_mapping->start, nd_mapping->size);
+       return sprintf(buf, "%s,%llu,%llu,%d\n", dev_name(&nvdimm->dev),
+                       nd_mapping->start, nd_mapping->size,
+                       nd_mapping->position);
 }
 
 #define REGION_MAPPING(idx) \
@@ -965,6 +966,7 @@ static struct nd_region *nd_region_create(struct nvdimm_bus *nvdimm_bus,
                nd_region->mapping[i].nvdimm = nvdimm;
                nd_region->mapping[i].start = mapping->start;
                nd_region->mapping[i].size = mapping->size;
+               nd_region->mapping[i].position = mapping->position;
                INIT_LIST_HEAD(&nd_region->mapping[i].labels);
                mutex_init(&nd_region->mapping[i].lock);
 
index 17b66e9715d2d6fed228205702d552197ad98296..64b710265d3907a404dcc92bd720b145f48b67da 100644 (file)
@@ -9,6 +9,9 @@
 #include <linux/module.h>
 #include <linux/mod_devicetable.h>
 #include <linux/slab.h>
+#include <linux/pci.h>
+#include <linux/platform_device.h>
+#include <linux/amba/bus.h>
 
 #include <asm/errno.h>
 #include "of_private.h"
@@ -84,31 +87,28 @@ int of_device_add(struct platform_device *ofdev)
  */
 int of_dma_configure(struct device *dev, struct device_node *np)
 {
-       u64 dma_addr, paddr, size;
+       u64 dma_addr, paddr, size = 0;
        int ret;
        bool coherent;
        unsigned long offset;
        const struct iommu_ops *iommu;
        u64 mask;
 
-       /*
-        * Set default coherent_dma_mask to 32 bit.  Drivers are expected to
-        * setup the correct supported mask.
-        */
-       if (!dev->coherent_dma_mask)
-               dev->coherent_dma_mask = DMA_BIT_MASK(32);
-
-       /*
-        * Set it to coherent_dma_mask by default if the architecture
-        * code has not set it.
-        */
-       if (!dev->dma_mask)
-               dev->dma_mask = &dev->coherent_dma_mask;
-
        ret = of_dma_get_range(np, &dma_addr, &paddr, &size);
        if (ret < 0) {
+               /*
+                * For legacy reasons, we have to assume some devices need
+                * DMA configuration regardless of whether "dma-ranges" is
+                * correctly specified or not.
+                */
+               if (!dev_is_pci(dev) &&
+#ifdef CONFIG_ARM_AMBA
+                   dev->bus != &amba_bustype &&
+#endif
+                   dev->bus != &platform_bus_type)
+                       return ret == -ENODEV ? 0 : ret;
+
                dma_addr = offset = 0;
-               size = max(dev->coherent_dma_mask, dev->coherent_dma_mask + 1);
        } else {
                offset = PFN_DOWN(paddr - dma_addr);
 
@@ -129,6 +129,22 @@ int of_dma_configure(struct device *dev, struct device_node *np)
                dev_dbg(dev, "dma_pfn_offset(%#08lx)\n", offset);
        }
 
+       /*
+        * Set default coherent_dma_mask to 32 bit.  Drivers are expected to
+        * setup the correct supported mask.
+        */
+       if (!dev->coherent_dma_mask)
+               dev->coherent_dma_mask = DMA_BIT_MASK(32);
+       /*
+        * Set it to coherent_dma_mask by default if the architecture
+        * code has not set it.
+        */
+       if (!dev->dma_mask)
+               dev->dma_mask = &dev->coherent_dma_mask;
+
+       if (!size)
+               size = max(dev->coherent_dma_mask, dev->coherent_dma_mask + 1);
+
        dev->dma_pfn_offset = offset;
 
        /*
index 7cb982b54c8c02035030c724d3c40197a50e290c..763ee50ea57d561d1ab137f6ad8b723eb04fc12c 100644 (file)
@@ -300,7 +300,7 @@ config PWM_MEDIATEK
          Generic PWM framework driver for Mediatek ARM SoC.
 
          To compile this driver as a module, choose M here: the module
-         will be called pwm-mxs.
+         will be called pwm-mediatek.
 
 config PWM_MXS
        tristate "Freescale MXS PWM support"
@@ -456,7 +456,7 @@ config PWM_TEGRA
 
 config  PWM_TIECAP
        tristate "ECAP PWM support"
-       depends on ARCH_OMAP2PLUS || ARCH_DAVINCI_DA8XX
+       depends on ARCH_OMAP2PLUS || ARCH_DAVINCI_DA8XX || ARCH_KEYSTONE
        help
          PWM driver support for the ECAP APWM controller found on AM33XX
          TI SOC
@@ -510,4 +510,13 @@ config PWM_VT8500
          To compile this driver as a module, choose M here: the module
          will be called pwm-vt8500.
 
+config PWM_ZX
+       tristate "ZTE ZX PWM support"
+       depends on ARCH_ZX
+       help
+         Generic PWM framework driver for ZTE ZX family SoCs.
+
+         To compile this driver as a module, choose M here: the module
+         will be called pwm-zx.
+
 endif
index a3a4beef6daa276fcda3e2fd3b4f879565682df5..ebefba5f528b11912420fa25bbf8a71c2dd155a6 100644 (file)
@@ -50,3 +50,4 @@ obj-$(CONFIG_PWM_TIPWMSS)     += pwm-tipwmss.o
 obj-$(CONFIG_PWM_TWL)          += pwm-twl.o
 obj-$(CONFIG_PWM_TWL_LED)      += pwm-twl-led.o
 obj-$(CONFIG_PWM_VT8500)       += pwm-vt8500.o
+obj-$(CONFIG_PWM_ZX)           += pwm-zx.o
index c5dbf16d810ba663ba4ef5637c380317be0e7180..db001cba937fd8617fc81720e21c30601f2bfec5 100644 (file)
@@ -167,6 +167,8 @@ static int bcm2835_pwm_probe(struct platform_device *pdev)
        pc->chip.dev = &pdev->dev;
        pc->chip.ops = &bcm2835_pwm_ops;
        pc->chip.npwm = 2;
+       pc->chip.of_xlate = of_pwm_xlate_with_flags;
+       pc->chip.of_pwm_n_cells = 3;
 
        platform_set_drvdata(pdev, pc);
 
index 8dadc58d6cdfef2239e682aa94d3f1d3b6020236..27c107e78d59adb37151c148435ad2c97fe68bde 100644 (file)
@@ -208,7 +208,7 @@ static int hibvt_pwm_probe(struct platform_device *pdev)
        if (ret < 0)
                return ret;
 
-       pwm_chip->rstc = devm_reset_control_get(&pdev->dev, NULL);
+       pwm_chip->rstc = devm_reset_control_get_exclusive(&pdev->dev, NULL);
        if (IS_ERR(pwm_chip->rstc)) {
                clk_disable_unprepare(pwm_chip->clk);
                return PTR_ERR(pwm_chip->rstc);
index 5c11bc708a3cafe148d5311320d3b6bb46a41667..b52f3afb2ba1f0f19f1241697ee7dcab92cc0057 100644 (file)
@@ -2,6 +2,7 @@
  * Mediatek Pulse Width Modulator driver
  *
  * Copyright (C) 2015 John Crispin <blogic@openwrt.org>
+ * Copyright (C) 2017 Zhi Mao <zhi.mao@mediatek.com>
  *
  * This file is licensed under the terms of the GNU General Public
  * License version 2. This program is licensed "as is" without any
@@ -29,6 +30,8 @@
 #define PWMDWIDTH              0x2c
 #define PWMTHRES               0x30
 
+#define PWM_CLK_DIV_MAX                7
+
 enum {
        MTK_CLK_MAIN = 0,
        MTK_CLK_TOP,
@@ -61,6 +64,42 @@ static inline struct mtk_pwm_chip *to_mtk_pwm_chip(struct pwm_chip *chip)
        return container_of(chip, struct mtk_pwm_chip, chip);
 }
 
+static int mtk_pwm_clk_enable(struct pwm_chip *chip, struct pwm_device *pwm)
+{
+       struct mtk_pwm_chip *pc = to_mtk_pwm_chip(chip);
+       int ret;
+
+       ret = clk_prepare_enable(pc->clks[MTK_CLK_TOP]);
+       if (ret < 0)
+               return ret;
+
+       ret = clk_prepare_enable(pc->clks[MTK_CLK_MAIN]);
+       if (ret < 0)
+               goto disable_clk_top;
+
+       ret = clk_prepare_enable(pc->clks[MTK_CLK_PWM1 + pwm->hwpwm]);
+       if (ret < 0)
+               goto disable_clk_main;
+
+       return 0;
+
+disable_clk_main:
+       clk_disable_unprepare(pc->clks[MTK_CLK_MAIN]);
+disable_clk_top:
+       clk_disable_unprepare(pc->clks[MTK_CLK_TOP]);
+
+       return ret;
+}
+
+static void mtk_pwm_clk_disable(struct pwm_chip *chip, struct pwm_device *pwm)
+{
+       struct mtk_pwm_chip *pc = to_mtk_pwm_chip(chip);
+
+       clk_disable_unprepare(pc->clks[MTK_CLK_PWM1 + pwm->hwpwm]);
+       clk_disable_unprepare(pc->clks[MTK_CLK_MAIN]);
+       clk_disable_unprepare(pc->clks[MTK_CLK_TOP]);
+}
+
 static inline u32 mtk_pwm_readl(struct mtk_pwm_chip *chip, unsigned int num,
                                unsigned int offset)
 {
@@ -80,6 +119,11 @@ static int mtk_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm,
        struct mtk_pwm_chip *pc = to_mtk_pwm_chip(chip);
        struct clk *clk = pc->clks[MTK_CLK_PWM1 + pwm->hwpwm];
        u32 resolution, clkdiv = 0;
+       int ret;
+
+       ret = mtk_pwm_clk_enable(chip, pwm);
+       if (ret < 0)
+               return ret;
 
        resolution = NSEC_PER_SEC / clk_get_rate(clk);
 
@@ -88,13 +132,18 @@ static int mtk_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm,
                clkdiv++;
        }
 
-       if (clkdiv > 7)
+       if (clkdiv > PWM_CLK_DIV_MAX) {
+               mtk_pwm_clk_disable(chip, pwm);
+               dev_err(chip->dev, "period %d not supported\n", period_ns);
                return -EINVAL;
+       }
 
-       mtk_pwm_writel(pc, pwm->hwpwm, PWMCON, BIT(15) | BIT(3) | clkdiv);
+       mtk_pwm_writel(pc, pwm->hwpwm, PWMCON, BIT(15) | clkdiv);
        mtk_pwm_writel(pc, pwm->hwpwm, PWMDWIDTH, period_ns / resolution);
        mtk_pwm_writel(pc, pwm->hwpwm, PWMTHRES, duty_ns / resolution);
 
+       mtk_pwm_clk_disable(chip, pwm);
+
        return 0;
 }
 
@@ -104,7 +153,7 @@ static int mtk_pwm_enable(struct pwm_chip *chip, struct pwm_device *pwm)
        u32 value;
        int ret;
 
-       ret = clk_prepare(pc->clks[MTK_CLK_PWM1 + pwm->hwpwm]);
+       ret = mtk_pwm_clk_enable(chip, pwm);
        if (ret < 0)
                return ret;
 
@@ -124,7 +173,7 @@ static void mtk_pwm_disable(struct pwm_chip *chip, struct pwm_device *pwm)
        value &= ~BIT(pwm->hwpwm);
        writel(value, pc->regs);
 
-       clk_unprepare(pc->clks[MTK_CLK_PWM1 + pwm->hwpwm]);
+       mtk_pwm_clk_disable(chip, pwm);
 }
 
 static const struct pwm_ops mtk_pwm_ops = {
@@ -156,14 +205,6 @@ static int mtk_pwm_probe(struct platform_device *pdev)
                        return PTR_ERR(pc->clks[i]);
        }
 
-       ret = clk_prepare(pc->clks[MTK_CLK_TOP]);
-       if (ret < 0)
-               return ret;
-
-       ret = clk_prepare(pc->clks[MTK_CLK_MAIN]);
-       if (ret < 0)
-               goto disable_clk_top;
-
        platform_set_drvdata(pdev, pc);
 
        pc->chip.dev = &pdev->dev;
@@ -174,26 +215,15 @@ static int mtk_pwm_probe(struct platform_device *pdev)
        ret = pwmchip_add(&pc->chip);
        if (ret < 0) {
                dev_err(&pdev->dev, "pwmchip_add() failed: %d\n", ret);
-               goto disable_clk_main;
+               return ret;
        }
 
        return 0;
-
-disable_clk_main:
-       clk_unprepare(pc->clks[MTK_CLK_MAIN]);
-disable_clk_top:
-       clk_unprepare(pc->clks[MTK_CLK_TOP]);
-
-       return ret;
 }
 
 static int mtk_pwm_remove(struct platform_device *pdev)
 {
        struct mtk_pwm_chip *pc = platform_get_drvdata(pdev);
-       unsigned int i;
-
-       for (i = 0; i < pc->chip.npwm; i++)
-               pwm_disable(&pc->chip.pwms[i]);
 
        return pwmchip_remove(&pc->chip);
 }
index cb845edfe2b42e69e8fd827f17c450311724c452..d589331d1884b29f938c47f9fb3308ffcb212026 100644 (file)
@@