1. 17 Apr, 2018 6 commits
    • Finn Thain's avatar
      block/swim: Check drive type · 8a500df6
      Finn Thain authored
      The SWIM chip is compatible with GCR-mode Sony 400K/800K drives but
      this driver only supports MFM mode. Therefore only Sony FDHD drives
      are supported. Skip incompatible drives.
      
      Cc: Laurent Vivier <lvivier@redhat.com>
      Cc: Jens Axboe <axboe@kernel.dk>
      Cc: stable@vger.kernel.org # v4.14+
      Tested-by: default avatarStan Johnson <userm57@yahoo.com>
      Signed-off-by: default avatarFinn Thain <fthain@telegraphics.com.au>
      Acked-by: default avatarLaurent Vivier <lvivier@redhat.com>
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      8a500df6
    • Finn Thain's avatar
      block/swim: Rename macros to avoid inconsistent inverted logic · 56a1c5ee
      Finn Thain authored
      The Sony drive status bits use active-low logic. The swim_readbit()
      function converts that to 'C' logic for readability. Hence, the
      sense of the names of the status bit macros should not be inverted.
      
      Mostly they are correct. However, the TWOMEG_DRIVE, MFM_MODE and
      TWOMEG_MEDIA macros have inverted sense (like MkLinux). Fix this
      inconsistency and make the following patches less confusing.
      
      The same problem affects swim3.c so fix that too.
      
      No functional change.
      
      The FDHD drive status bits are documented in sonydriv.cpp from MAME
      and in swimiii.h from MkLinux.
      
      Cc: Laurent Vivier <lvivier@redhat.com>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: linuxppc-dev@lists.ozlabs.org
      Cc: Jens Axboe <axboe@kernel.dk>
      Cc: stable@vger.kernel.org # v4.14+
      Tested-by: default avatarStan Johnson <userm57@yahoo.com>
      Signed-off-by: default avatarFinn Thain <fthain@telegraphics.com.au>
      Acked-by: default avatarLaurent Vivier <lvivier@redhat.com>
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      56a1c5ee
    • Finn Thain's avatar
      block/swim: Don't log an error message for an invalid ioctl · 8e2ab5a4
      Finn Thain authored
      The 'eject' shell command may send various different ioctl commands.
      This leads to error messages on the console even though the FDEJECT
      ioctl succeeds.
      
      ~# eject floppy
      SWIM floppy_ioctl: unknown cmd 21257
      SWIM floppy_ioctl: unknown cmd 1
      
      Don't log an error message for an invalid ioctl, just do as the
      swim3 driver does and return -ENOTTY.
      
      Cc: Laurent Vivier <lvivier@redhat.com>
      Cc: Jens Axboe <axboe@kernel.dk>
      Cc: stable@vger.kernel.org # v4.14+
      Tested-by: default avatarStan Johnson <userm57@yahoo.com>
      Signed-off-by: default avatarFinn Thain <fthain@telegraphics.com.au>
      Acked-by: default avatarLaurent Vivier <lvivier@redhat.com>
      Reviewed-by: default avatarGeert Uytterhoeven <geert@linux-m68k.org>
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      8e2ab5a4
    • Finn Thain's avatar
      block/swim: Remove extra put_disk() call from error path · c1d6207c
      Finn Thain authored
      Cc: Laurent Vivier <lvivier@redhat.com>
      Cc: Jens Axboe <axboe@kernel.dk>
      Cc: stable@vger.kernel.org # v4.14+
      Fixes: 103db8b2 ("[PATCH] swim: stop sharing request queue across multiple gendisks")
      Tested-by: default avatarStan Johnson <userm57@yahoo.com>
      Signed-off-by: default avatarFinn Thain <fthain@telegraphics.com.au>
      Acked-by: default avatarLaurent Vivier <lvivier@redhat.com>
      Reviewed-by: default avatarGeert Uytterhoeven <geert@linux-m68k.org>
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      c1d6207c
    • Finn Thain's avatar
      block/swim: Fix array bounds check · 7ae6a2b6
      Finn Thain authored
      In the floppy_find() function in swim.c is a call to
      get_disk(swd->unit[drive].disk). The actual parameter to this call
      can be a NULL pointer when drive == swd->floppy_count. This causes
      an oops in get_disk().
      
      Data read fault at 0x00000198 in Super Data (pc=0x1be5b6)
      BAD KERNEL BUSERR
      Oops: 00000000
      Modules linked in: swim_mod ipv6 mac8390
      PC: [<001be5b6>] get_disk+0xc/0x76
      SR: 2004  SP: 9a078bc1  a2: 0213ed90
      d0: 00000000    d1: 00000000    d2: 00000000    d3: 000000ff
      d4: 00000002    d5: 02983590    a0: 02332e00    a1: 022dfd64
      Process dd (pid: 285, task=020ab25b)
      Frame format=B ssw=074d isc=4a88 isb=6732 daddr=00000198 dobuf=00000000
      baddr=001be5bc dibuf=bfffffff ver=f
      Stack from 022dfca4:
              00000000 0203fc00 0213ed90 022dfcc0 02982936 00000000 00200000 022dfd08
              0020f85a 00200000 022dfd64 02332e00 004040fc 00000014 001be77e 022dfd64
              00334e4a 001be3f8 0800001d 022dfd64 01c04b60 01c04b70 022aba80 029828f8
              02332e00 022dfd2c 001be7ac 0203fc00 00200000 022dfd64 02103a00 01c04b60
              01c04b60 0200e400 022dfd68 000e191a 00200000 022dfd64 02103a00 0800001d
              00000000 00000003 000b89de 00500000 02103a00 01c04b60 02103a08 01c04c2e
      Call Trace: [<02982936>] floppy_find+0x3e/0x4a [swim_mod]
       [<00200000>] uart_remove_one_port+0x1a2/0x260
       [<0020f85a>] kobj_lookup+0xde/0x132
       [<00200000>] uart_remove_one_port+0x1a2/0x260
       [<001be77e>] get_gendisk+0x0/0x130
       [<00334e4a>] mutex_lock+0x0/0x2e
       [<001be3f8>] disk_block_events+0x0/0x6c
       [<029828f8>] floppy_find+0x0/0x4a [swim_mod]
       [<001be7ac>] get_gendisk+0x2e/0x130
       [<00200000>] uart_remove_one_port+0x1a2/0x260
       [<000e191a>] __blkdev_get+0x32/0x45a
       [<00200000>] uart_remove_one_port+0x1a2/0x260
       [<000b89de>] complete_walk+0x0/0x8a
       [<000e1e22>] blkdev_get+0xe0/0x29a
       [<000e1fdc>] blkdev_open+0x0/0xb0
       [<000b89de>] complete_walk+0x0/0x8a
       [<000e1fdc>] blkdev_open+0x0/0xb0
       [<000e01cc>] bd_acquire+0x74/0x8a
       [<000e205c>] blkdev_open+0x80/0xb0
       [<000e1fdc>] blkdev_open+0x0/0xb0
       [<000abf24>] do_dentry_open+0x1a4/0x322
       [<00020000>] __do_proc_douintvec+0x22/0x27e
       [<000b89de>] complete_walk+0x0/0x8a
       [<000baa62>] link_path_walk+0x0/0x48e
       [<000ba3f8>] inode_permission+0x20/0x54
       [<000ac0e4>] vfs_open+0x42/0x78
       [<000bc372>] path_openat+0x2b2/0xeaa
       [<000bc0c0>] path_openat+0x0/0xeaa
       [<0004463e>] __irq_wake_thread+0x0/0x4e
       [<0003a45a>] task_tick_fair+0x18/0xc8
       [<000bd00a>] do_filp_open+0xa0/0xea
       [<000abae0>] do_sys_open+0x11a/0x1ee
       [<00020000>] __do_proc_douintvec+0x22/0x27e
       [<000abbf4>] SyS_open+0x1e/0x22
       [<00020000>] __do_proc_douintvec+0x22/0x27e
       [<00002b40>] syscall+0x8/0xc
       [<00020000>] __do_proc_douintvec+0x22/0x27e
       [<0000c00b>] dyadic+0x1/0x28
      Code: 4e5e 4e75 4e56 fffc 2f0b 2f02 266e 0008 <206b> 0198 4a88 6732 2428 002c 661e 486b 0058 4eb9 0032 0b96 588f 4a88 672c 2008
      Disabling lock debugging due to kernel taint
      
      Fix the array index bounds check to avoid this.
      
      Cc: Laurent Vivier <lvivier@redhat.com>
      Cc: Jens Axboe <axboe@kernel.dk>
      Cc: stable@vger.kernel.org # v4.14+
      Fixes: 8852ecd9 ("[PATCH] m68k: mac - Add SWIM floppy support")
      Tested-by: default avatarStan Johnson <userm57@yahoo.com>
      Signed-off-by: default avatarFinn Thain <fthain@telegraphics.com.au>
      Acked-by: default avatarLaurent Vivier <lvivier@redhat.com>
      Reviewed-by: default avatarGeert Uytterhoeven <geert@linux-m68k.org>
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      7ae6a2b6
    • Finn Thain's avatar
      m68k/mac: Don't remap SWIM MMIO region · b64576cb
      Finn Thain authored
      For reasons I don't understand, calling ioremap() then iounmap() on
      the SWIM MMIO region causes a hang on 68030 (but not on 68040).
      
      ~# modprobe swim_mod
      SWIM floppy driver Version 0.2 (2008-10-30)
      SWIM device not found !
      watchdog: BUG: soft lockup - CPU#0 stuck for 23s! [modprobe:285]
      Modules linked in: swim_mod(+)
      Format 00  Vector: 0064  PC: 000075aa  Status: 2000    Not tainted
      ORIG_D0: ffffffff  D0: d00c0000  A2: 007c2370  A1: 003f810c
      A0: 00040000  D5: d0096800  D4: d0097e00
      D3: 00000001  D2: 00000003  D1: 00000000
      Non-Maskable Interrupt
      Modules linked in: swim_mod(+)
      PC: [<000075ba>] __iounmap+0x24/0x10e
      SR: 2000  SP: 007abc48  a2: 007c2370
      d0: d00c0000    d1: 000001a0    d2: 00000019    d3: 00000001
      d4: d0097e00    d5: d0096800    a0: 00040000    a1: 003f810c
      Process modprobe (pid: 285, task=007c2370)
      Frame format=0
      Stack from 007abc7c:
              ffffffed 00000000 006a4060 004712e0 007abca0 000076ea d0080000 00080000
              010bb4b8 007abcd8 010ba542 d0096000 00000000 00000000 00000001 010bb59c
              00000000 007abf30 010bb4b8 0047760a 0047763c 00477612 00616540 007abcec
              0020a91a 00477600 0047760a 010bb4cc 007abd18 002092f2 0047760a 00333b06
              007abd5c 00000000 0047760a 010bb4cc 00404f90 004776b8 00000001 007abd38
              00209446 010bb4cc 0047760a 010bb4cc 0020938e 0031f8be 00616540 007abd64
      Call Trace: [<000076ea>] iounmap+0x46/0x5a
       [<00080000>] shrink_page_list+0x7f6/0xe06
       [<010ba542>] swim_probe+0xe4/0x496 [swim_mod]
       [<0020a91a>] platform_drv_probe+0x20/0x5e
       [<002092f2>] driver_probe_device+0x21c/0x2b8
       [<00333b06>] mutex_lock+0x0/0x2e
       [<00209446>] __driver_attach+0xb8/0xce
       [<0020938e>] __driver_attach+0x0/0xce
       [<0031f8be>] klist_next+0x0/0xa0
       [<00207562>] bus_for_each_dev+0x74/0xba
       [<000344c0>] blocking_notifier_call_chain+0x0/0x20
       [<00333b06>] mutex_lock+0x0/0x2e
       [<00208e44>] driver_attach+0x1a/0x1e
       [<0020938e>] __driver_attach+0x0/0xce
       [<00207e26>] bus_add_driver+0x188/0x234
       [<000344c0>] blocking_notifier_call_chain+0x0/0x20
       [<00209894>] driver_register+0x58/0x104
       [<000344c0>] blocking_notifier_call_chain+0x0/0x20
       [<010bd000>] swim_init+0x0/0x2c [swim_mod]
       [<0020a7be>] __platform_driver_register+0x38/0x3c
       [<010bd028>] swim_init+0x28/0x2c [swim_mod]
       [<000020dc>] do_one_initcall+0x38/0x196
       [<000344c0>] blocking_notifier_call_chain+0x0/0x20
       [<003331cc>] mutex_unlock+0x0/0x3e
       [<00333b06>] mutex_lock+0x0/0x2e
       [<003331cc>] mutex_unlock+0x0/0x3e
       [<00333b06>] mutex_lock+0x0/0x2e
       [<003331cc>] mutex_unlock+0x0/0x3e
       [<00333b06>] mutex_lock+0x0/0x2e
       [<003331cc>] mutex_unlock+0x0/0x3e
       [<00333b06>] mutex_lock+0x0/0x2e
       [<00075008>] __free_pages+0x0/0x38
       [<000045c0>] mangle_kernel_stack+0x30/0xda
       [<000344c0>] blocking_notifier_call_chain+0x0/0x20
       [<003331cc>] mutex_unlock+0x0/0x3e
       [<00333b06>] mutex_lock+0x0/0x2e
       [<0005ced4>] do_init_module+0x42/0x266
       [<010bd000>] swim_init+0x0/0x2c [swim_mod]
       [<000344c0>] blocking_notifier_call_chain+0x0/0x20
       [<0005eda0>] load_module+0x1a30/0x1e70
       [<0000465d>] mangle_kernel_stack+0xcd/0xda
       [<00331c64>] __generic_copy_from_user+0x0/0x46
       [<0033256e>] _cond_resched+0x0/0x32
       [<00331b9c>] memset+0x0/0x98
       [<0033256e>] _cond_resched+0x0/0x32
       [<0005f25c>] SyS_init_module+0x7c/0x112
       [<00002000>] _start+0x0/0x8
       [<00002000>] _start+0x0/0x8
       [<00331c82>] __generic_copy_from_user+0x1e/0x46
       [<0005f2b2>] SyS_init_module+0xd2/0x112
       [<0000465d>] mangle_kernel_stack+0xcd/0xda
       [<00002b40>] syscall+0x8/0xc
       [<0000465d>] mangle_kernel_stack+0xcd/0xda
       [<0008c00c>] pcpu_balance_workfn+0xb2/0x40e
      Code: 2200 7419 e4a9 e589 2841 d9fc 0000 1000 <2414> 7203 c282 7602 b681 6600 0096 0242 fe00 0482 0000 0000 e9c0 11c3 ed89 2642
      
      There's no need to call ioremap() for the SWIM address range, as it lies
      within the usual IO device region at 0x5000 0000, which has already been
      mapped by head.S.
      
      Remove the redundant ioremap() and iounmap() calls to fix the hang.
      
      Cc: Laurent Vivier <lvivier@redhat.com>
      Cc: stable@vger.kernel.org # v4.14+
      Tested-by: default avatarStan Johnson <userm57@yahoo.com>
      Signed-off-by: default avatarFinn Thain <fthain@telegraphics.com.au>
      Acked-by: default avatarLaurent Vivier <lvivier@redhat.com>
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      b64576cb
  2. 15 Apr, 2018 2 commits
    • Jens Axboe's avatar
      loop: handle short DIO reads · f9de14bc
      Jens Axboe authored
      We ran into an issue with loop and btrfs, where btrfs would complain about
      checksum errors. It turns out that is because we don't handle short reads
      at all, we just zero fill the remainder. Worse than that, we don't handle
      the filling properly, which results in loop trying to advance a single
      bio by much more than its size, since it doesn't take chaining into
      account.
      
      Handle short reads appropriately, by simply retrying at the new correct
      offset. End the remainder of the request with EIO, if we get a 0 read.
      
      Fixes: bc07c10a ("block: loop: support DIO & AIO")
      Reviewed-by: default avatarMing Lei <ming.lei@redhat.com>
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      f9de14bc
    • Jens Axboe's avatar
      loop: remove cmd->rq member · 1894e916
      Jens Axboe authored
      We can always get at the request from the payload, no need to store
      a pointer to it.
      Reviewed-by: default avatarMing Lei <ming.lei@redhat.com>
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      1894e916
  3. 14 Apr, 2018 1 commit
    • Alan Jenkins's avatar
      block: do not use interruptible wait anywhere · 1dc3039b
      Alan Jenkins authored
      When blk_queue_enter() waits for a queue to unfreeze, or unset the
      PREEMPT_ONLY flag, do not allow it to be interrupted by a signal.
      
      The PREEMPT_ONLY flag was introduced later in commit 3a0a5299
      ("block, scsi: Make SCSI quiesce and resume work reliably").  Note the SCSI
      device is resumed asynchronously, i.e. after un-freezing userspace tasks.
      
      So that commit exposed the bug as a regression in v4.15.  A mysterious
      SIGBUS (or -EIO) sometimes happened during the time the device was being
      resumed.  Most frequently, there was no kernel log message, and we saw Xorg
      or Xwayland killed by SIGBUS.[1]
      
      [1] E.g. https://bugzilla.redhat.com/show_bug.cgi?id=1553979
      
      Without this fix, I get an IO error in this test:
      
      # dd if=/dev/sda of=/dev/null iflag=direct & \
        while killall -SIGUSR1 dd; do sleep 0.1; done & \
        echo mem > /sys/power/state ; \
        sleep 5; killall dd  # stop after 5 seconds
      
      The interruptible wait was added to blk_queue_enter in
      commit 3ef28e83 ("block: generic request_queue reference counting").
      Before then, the interruptible wait was only in blk-mq, but I don't think
      it could ever have been correct.
      Reviewed-by: default avatarBart Van Assche <bart.vanassche@wdc.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarAlan Jenkins <alan.christopher.jenkins@gmail.com>
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      1dc3039b
  4. 13 Apr, 2018 22 commits
    • Linus Torvalds's avatar
      Merge branch 'overlayfs-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/vfs · 48023102
      Linus Torvalds authored
      Pull overlayfs updates from Miklos Szeredi:
       "In addition to bug fixes and cleanups there are two new features from
        Amir:
      
         - Consistent inode number support for the case when layers are not
           all on the same filesystem (feature is dubbed "xino").
      
         - Optimize overlayfs file handle decoding. This one touches the
           exportfs interface to allow detecting the disconnected directory
           case"
      
      * 'overlayfs-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/vfs:
        ovl: update documentation w.r.t "xino" feature
        ovl: add support for "xino" mount and config options
        ovl: consistent d_ino for non-samefs with xino
        ovl: consistent i_ino for non-samefs with xino
        ovl: constant st_ino for non-samefs with xino
        ovl: allocate anon bdev per unique lower fs
        ovl: factor out ovl_map_dev_ino() helper
        ovl: cleanup ovl_update_time()
        ovl: add WARN_ON() for non-dir redirect cases
        ovl: cleanup setting OVL_INDEX
        ovl: set d->is_dir and d->opaque for last path element
        ovl: Do not check for redirect if this is last layer
        ovl: lookup in inode cache first when decoding lower file handle
        ovl: do not try to reconnect a disconnected origin dentry
        ovl: disambiguate ovl_encode_fh()
        ovl: set lower layer st_dev only if setting lower st_ino
        ovl: fix lookup with middle layer opaque dir and absolute path redirects
        ovl: Set d->last properly during lookup
        ovl: set i_ino to the value of st_ino for NFS export
      48023102
    • Linus Torvalds's avatar
      Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux · ba2b137d
      Linus Torvalds authored
      Pull thermal management update from Zhang Rui:
      
       - Fix race condition in imx_thermal_probe() (Mikhail Lappo)
      
       - Add cooling device's statistics in sysfs (Viresh Kumar)
      
      * 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux:
        thermal: Add cooling device's statistics in sysfs
        thermal: imx: Fix race condition in imx_thermal_probe()
      ba2b137d
    • Linus Torvalds's avatar
      Merge branch 'dmi-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging · 71893f11
      Linus Torvalds authored
      Pull dmi updates from Jean Delvare.
      
      * 'dmi-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging:
        firmware: dmi_scan: Use lowercase letters for UUID
        firmware: dmi_scan: Add DMI_OEM_STRING support to dmi_matches
        firmware: dmi_scan: Fix UUID length safety check
      71893f11
    • Linus Torvalds's avatar
      Merge tag 'chrome-platform-for-linus-4.17' of... · f6811370
      Linus Torvalds authored
      Merge tag 'chrome-platform-for-linus-4.17' of git://git.kernel.org/pub/scm/linux/kernel/git/bleung/chrome-platform
      
      Pull chrome platform updates from Benson Leung:
      
       - a series from Dmitry to remove platform data from chromeos_laptop.c,
         which was the only user of platform data for the atmel_mxt_ts driver.
      
       - a series to clean up sysfs and debugfs for cros_ec
      
       - other misc cleanups
      
      * tag 'chrome-platform-for-linus-4.17' of git://git.kernel.org/pub/scm/linux/kernel/git/bleung/chrome-platform: (22 commits)
        platform/chrome: mfd/cros_ec_dev: Add sysfs entry to set keyboard wake lid angle
        platform/chrome: cros_ec_debugfs: Add PD port info to debugfs
        platform/chrome: cros_ec_debugfs: Use octal permissions '0444'
        platform/chrome: cros_ec_sysfs: use permission-specific DEVICE_ATTR variants
        platform/chrome: cros_ec_sysfs: introduce to_cros_ec_dev define.
        platform/chrome: cros_ec_sysfs: Modify error handling
        platform/chrome: cros_ec_lpc: Add support for Google devices using custom coreboot firmware
        platform/chrome: cros_ec_lpc: wake up from s2idle on Chrome EC
        Input: atmel_mxt_ts - remove platform data support
        platform/chrome: chromeos_laptop - discard data for unneeded boards
        platform/chrome: chromeos_laptop - use device properties for Pixel
        platform/chrome: chromeos_laptop - rely on I2C to set up interrupt trigger
        platform/chrome: chromeos_laptop - use I2C notifier to create devices
        platform/chrome: chromeos_laptop - parse DMI IRQ data once
        platform/chrome: chromeos_laptop - rework i2c peripherals initialization
        platform/chrome: chromeos_laptop - factor out getting IRQ from DMI
        platform/chrome: chromeos_laptop - introduce pr_fmt()
        platform/chrome: chromeos_laptop - stop setting suspend mode for Atmel devices
        platform/chrome: chromeos_laptop - add SPDX identifier
        Input: atmel_mxt_ts - switch ChromeOS ACPI devices to generic props
        ...
      f6811370
    • Linus Torvalds's avatar
      Merge tag 'clk-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/clk/linux · ca4e7c51
      Linus Torvalds authored
      Pull clk updates from Stephen Boyd:
       "The large diff this time around is from the addition of a new clk
        driver for the TI Davinci family of SoCs. So far those clks have been
        supported with a custom implementation of the clk API in the arch port
        instead of in the CCF. With this driver merged we're one step closer
        to having a single clk API implementation.
      
        The other large diff is from the Amlogic clk driver that underwent
        some major surgery to use regmap. Beyond that, the biggest hitter is
        Samsung which needed some reworks to properly handle clk provider
        power domains and a bunch of PLL rate updates.
      
        The core framework was fairly quiet this round, just getting some
        cleanups and small fixes for some of the more esoteric features. And
        the usual set of driver non-critical fixes, cleanups, and minor
        additions are here as well.
      
        Core:
         - Rejig clk_ops::init() to be a little earlier for phase/accuracy ops
         - debugfs ops macroized to shave some lines of boilerplate code
         - Always calculate the phase instead of caching it in clk_get_phase()
         - More __must_check on bulk clk APIs
      
        New Drivers:
         - TI's Davinci family of SoCs
         - Intel's Stratix10 SoC
         - stm32mp157 SoC
         - Allwinner H6 CCU
         - Silicon Labs SI544 clock generator chip
         - Renesas R-Car M3-N and V3H SoCs
         - i.MX6SLL SoCs
      
        Removed Drivers:
         - ST-Ericsson AB8540/9540
      
        Updates:
         - Mediatek MT2701 and MT7622 audsys support and MT2712 updates
         - STM32F469 DSI and STM32F769 sdmmc2 support
         - GPIO clks can sleep now
         - Spreadtrum SC9860 RTC clks
         - Nvidia Tegra MBIST workarounds and various minor fixes
         - Rockchip phase handling fixes and a memory leak plugged
         - Renesas drivers switch to readl/writel from clk_readl/clk_writel
         - Renesas gained CPU (Z/Z2) and watchdog support
         - Rockchip rk3328 display clks and rk3399 1.6GHz PLL support
         - Qualcomm PM8921 PMIC XO buffers
         - Amlogic migrates to regmap APIs
         - TI Keystone clk latching support
         - Allwinner H3 and H5 video clk fixes
         - Broadcom BCM2835 PLLs needed another bit to enable
         - i.MX6SX CKO mux fix and i.MX7D Video PLL divider fix
         - i.MX6UL/ULL epdc_podf support
         - Hi3798CV200 COMBPHY0 and USB2_OTG_UTMI and phase support for eMMC"
      
      * tag 'clk-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/clk/linux: (233 commits)
        clk: davinci: add a reset lookup table for psc0
        clk: imx: add clock driver for imx6sll
        dt-bindings: imx: update clock doc for imx6sll
        clk: imx: add new gate/gate2 wrapper funtion
        clk: imx: Add CLK_IS_CRITICAL flag for busy divider and busy mux
        clk: cs2000: set pm_ops in hibernate-compatible way
        clk: bcm2835: De-assert/assert PLL reset signal when appropriate
        clk: imx7d: Move clks_init_on before any clock operations
        clk: imx7d: Correct ahb clk parent select
        clk: imx7d: Correct dram pll type
        clk: imx7d: Add USB clock information
        clk: socfpga: stratix10: add clock driver for Stratix10 platform
        dt-bindings: documentation: add clock bindings information for Stratix10
        clk: ti: fix flag space conflict with clkctrl clocks
        clk: uniphier: add additional ethernet clock lines for Pro4
        clk: uniphier: add SATA clock control support
        clk: uniphier: add PCIe clock control support
        clk: Add driver for the si544 clock generator chip
        clk: davinci: Remove redundant dev_err calls
        clk: uniphier: add ethernet clock control support for PXs3
        ...
      ca4e7c51
    • Linus Torvalds's avatar
      Merge tag 'pwm/for-4.17-rc1' of... · daf3ef6e
      Linus Torvalds authored
      Merge tag 'pwm/for-4.17-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/thierry.reding/linux-pwm
      
      Pull pwm updates from Thierry Reding:
       "This set of changes adds support for more generations of the RCar
        controller as well as runtime PM support. The JZ4740 driver gains
        support for device tree and can now be used on all Ingenic SoCs.
      
        Rounding things off is a random assortment of fixes and cleanups all
        across the board"
      
      * tag 'pwm/for-4.17-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/thierry.reding/linux-pwm: (29 commits)
        pwm: rcar: Add suspend/resume support
        pwm: rcar: Use PM Runtime to control module clock
        dt-bindings: pwm: rcar: Add bindings for R-Car M3N support
        pwm: rcar: Fix a condition to prevent mismatch value setting to duty
        pwm: sysfs: Use put_device() instead of kfree()
        dt-bindings: pwm: sunxi: Add new compatible strings
        pwm: sun4i: Simplify controller mapping
        pwm: sun4i: Drop unused .has_rdy member
        pwm: sun4i: Properly check current state
        pwm: Remove depends on AVR32
        pwm: stm32: LPTimer: Use 3 cells ->of_xlate()
        dt-bindings: pwm-stm32-lp: Add #pwm-cells
        pwm: stm32: Protect common prescaler for all channels
        pwm: stm32: Remove unused struct device
        pwm: mediatek: Improve precision in rate calculation
        pwm: mediatek: Remove redundant MODULE_ALIAS entries
        pwm: mediatek: Fix up PWM4 and PWM5 malfunction on MT7623
        pwm: jz4740: Enable for all Ingenic SoCs
        pwm: jz4740: Add support for devicetree
        pwm: jz4740: Implement ->set_polarity()
        ...
      daf3ef6e
    • Linus Torvalds's avatar
      Merge tag 'linux-watchdog-4.17-rc1' of git://www.linux-watchdog.org/linux-watchdog · 41531f58
      Linus Torvalds authored
      Pull watchdog updates from Wim Van Sebroeck:
      
       - Add Nuvoton NPCM watchdog driver
      
       - renesas_wdt: Add R-Car Gen2 support
      
       - renesas_wdt: add suspend/resume and restart handler support
      
       - hpwdt: convert to watchdog core and improve NMI
      
       - improve timeout setting/handling in various drivers
      
       - coh901327: make license text and module licence match
      
       - fix error handling in asm9260_wdt, sprd_wdt and davinci_wdt
      
       - aspeed imrovements
      
       - dw improvements (for control register & suspend/resume)
      
       - add SPDX identifiers for watchdog subsystem
      
      * tag 'linux-watchdog-4.17-rc1' of git://www.linux-watchdog.org/linux-watchdog: (35 commits)
        watchdog: davinci_wdt: fix error handling in davinci_wdt_probe()
        watchdog: add SPDX identifiers for watchdog subsystem
        watchdog: aspeed: Allow configuring for alternate boot
        watchdog: Add Nuvoton NPCM watchdog driver
        dt-bindings: watchdog: Add Nuvoton NPCM description
        watchdog: dw: save/restore control and timeout across suspend/resume
        watchdog: dw: RMW the control register
        watchdog: sprd_wdt: Fix error handling in sprd_wdt_enable()
        watchdog: aspeed: Fix translation of reset mode to ctrl register
        watchdog: renesas_wdt: Add restart handler
        watchdog: renesas_wdt: Add R-Car Gen2 support
        watchdog: renesas_wdt: Add suspend/resume support
        watchdog: f71808e_wdt: Fix WD_EN register read
        watchdog: hpwdt: Update driver version.
        watchdog: hpwdt: Add dynamic debug
        watchdog: hpwdt: Programable Pretimeout NMI
        watchdog: hpwdt: remove allow_kdump module parameter.
        watchdog: hpwdt: condition early return of NMI handler on iLO5
        watchdog: hpwdt: Modify to use watchdog core.
        watchdog: hpwdt: Update nmi_panic message.
        ...
      41531f58
    • Linus Torvalds's avatar
      Merge tag 'apparmor-pr-2018-04-10' of... · 80a17a5f
      Linus Torvalds authored
      Merge tag 'apparmor-pr-2018-04-10' of git://git.kernel.org/pub/scm/linux/kernel/git/jj/linux-apparmor
      
      Pull apparmor updates from John Johansen:
       "Features:
        - add base infrastructure for socket mediation. ABI bump and
          additional checks to ensure only v8 compliant policy uses socket af
          mediation.
        - improve and cleanup dfa verification
        - improve profile attachment logic
           - improve overlapping expression handling
           - add the xattr matching to the attachment logic
        - improve signal mediation handling with stacked labels
        - improve handling of no_new_privs in a label stack
      
        Cleanups and changes:
        - use dfa to parse string split
        - bounded version of label_parse
        - proper line wrap nulldfa.in
        - split context out into task and cred naming to better match usage
        - simplify code in aafs
      
        Bug fixes:
        - fix display of .ns_name for containers
        - fix resource audit messages when auditing peer
        - fix logging of the existence test for signals
        - fix resource audit messages when auditing peer
        - fix display of .ns_name for containers
        - fix an error code in verify_table_headers()
        - fix memory leak on buffer on error exit path
        - fix error returns checks by making size a ssize_t"
      
      * tag 'apparmor-pr-2018-04-10' of git://git.kernel.org/pub/scm/linux/kernel/git/jj/linux-apparmor: (36 commits)
        apparmor: fix memory leak on buffer on error exit path
        apparmor: fix dangling symlinks to policy rawdata after replacement
        apparmor: Fix an error code in verify_table_headers()
        apparmor: fix error returns checks by making size a ssize_t
        apparmor: update MAINTAINERS file git and wiki locations
        apparmor: remove POLICY_MEDIATES_SAFE
        apparmor: add base infastructure for socket mediation
        apparmor: improve overlapping domain attachment resolution
        apparmor: convert attaching profiles via xattrs to use dfa matching
        apparmor: Add support for attaching profiles via xattr, presence and value
        apparmor: cleanup: simplify code to get ns symlink name
        apparmor: cleanup create_aafs() error path
        apparmor: dfa split verification of table headers
        apparmor: dfa add support for state differential encoding
        apparmor: dfa move character match into a macro
        apparmor: update domain transitions that are subsets of confinement at nnp
        apparmor: move context.h to cred.h
        apparmor: move task related defines and fns to task.X files
        apparmor: cleanup, drop unused fn __aa_task_is_confined()
        apparmor: cleanup fixup description of aa_replace_profiles
        ...
      80a17a5f
    • Linus Torvalds's avatar
      Merge tag 'for-linus-20180413' of git://git.kernel.dk/linux-block · edda4153
      Linus Torvalds authored
      Pull block fixes from Jens Axboe:
       "Followup fixes for this merge window. This contains:
      
         - Series from Ming, fixing corner cases in our CPU <-> queue mapping.
      
           This triggered repeated warnings on especially s390, but I also hit
           it in cpu hot plug/unplug testing while doing IO on NVMe on x86-64.
      
         - Another fix from Ming, ensuring that we always order budget and
           driver tag identically, avoiding a deadlock on QD=1 devices.
      
         - Loop locking regression fix from this merge window, from Omar.
      
         - Another loop locking fix, this time missing an unlock, from Tetsuo
           Handa.
      
         - Fix for racing IO submission with device removal from Bart.
      
         - sr reference fix from me, fixing a case where disk change or
           getevents can race with device removal.
      
         - Set of nvme fixes by way of Keith, from various contributors"
      
      * tag 'for-linus-20180413' of git://git.kernel.dk/linux-block: (28 commits)
        nvme: expand nvmf_check_if_ready checks
        nvme: Use admin command effects for admin commands
        nvmet: fix space padding in serial number
        nvme: check return value of init_srcu_struct function
        nvmet: Fix nvmet_execute_write_zeroes sector count
        nvme-pci: Separate IO and admin queue IRQ vectors
        nvme-pci: Remove unused queue parameter
        nvme-pci: Skip queue deletion if there are no queues
        nvme: target: fix buffer overflow
        nvme: don't send keep-alives to the discovery controller
        nvme: unexport nvme_start_keep_alive
        nvme-loop: fix kernel oops in case of unhandled command
        nvme: enforce 64bit offset for nvme_get_log_ext fn
        sr: get/drop reference to device in revalidate and check_events
        blk-mq: Revert "blk-mq: reimplement blk_mq_hw_queue_mapped"
        blk-mq: Avoid that submitting a bio concurrently with device removal triggers a crash
        backing: silence compiler warning using __printf
        blk-mq: remove code for dealing with remapping queue
        blk-mq: reimplement blk_mq_hw_queue_mapped
        blk-mq: don't check queue mapped in __blk_mq_delay_run_hw_queue()
        ...
      edda4153
    • Linus Torvalds's avatar
      Merge branch 'i2c/for-current' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux · 3e565a35
      Linus Torvalds authored
      Pull more i2c updates from Wolfram Sang:
      
       - hot bugfix for i801 to make laptops with strange BIOS reboot again
         when using SMBUS Host notify
      
       - change to MAINTAINERS creating a specific fallback entry for I2C host
         drivers and settings its status to "Odd fixes"
      
       - a long overdue param checking for the I2C core
      
      * 'i2c/for-current' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux:
        i2c: add param sanity check to i2c_transfer()
        MAINTAINERS: add maintainer for Renesas I2C related drivers
        MAINTAINERS: remove me as maintainer for I2C host drivers
        i2c: i801: Restore configuration at shutdown
        i2c: i801: Save register SMBSLVCMD value only once
      3e565a35
    • Linus Torvalds's avatar
      Merge tag 'sh-for-4.17' of git://git.libc.org/linux-sh · 1bad9ce1
      Linus Torvalds authored
      Pull arch/sh updates from Rich Felker:
       "Fixes for bugs in futex, device tree, and userspace breakpoint traps,
        and for PCI issues on SH7786"
      
      * tag 'sh-for-4.17' of git://git.libc.org/linux-sh:
        arch/sh: pcie-sh7786: handle non-zero DMA offset
        arch/sh: pcie-sh7786: adjust the memory mapping
        arch/sh: pcie-sh7786: adjust PCI MEM and IO regions
        arch/sh: pcie-sh7786: exclude unusable PCI MEM areas
        arch/sh: pcie-sh7786: mark unavailable PCI resource as disabled
        arch/sh: pci: don't use disabled resources
        arch/sh: make the DMA mapping operations observe dev->dma_pfn_offset
        arch/sh: add sh7786_mm_sel() function
        sh: fix debug trap failure to process signals before return to user
        sh: fix memory corruption of unflattened device tree
        sh: fix futex FUTEX_OP_SET op on userspace addresses
      1bad9ce1
    • Linus Torvalds's avatar
      Merge tag 'arm64-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux · e4e57f20
      Linus Torvalds authored
      Pull more arm64 updates from Will Deacon:
       "A few late updates to address some issues arising from conflicts with
        other trees:
      
         - Removal of Qualcomm-specific Spectre-v2 mitigation in favour of the
           generic SMCCC-based firmware call
      
         - Fix EL2 hardening capability checking, which was bodged to reduce
           conflicts with the KVM tree
      
         - Add some currently unused assembler macros for managing SIMD
           registers which will be used by some crypto code in the next merge
           window"
      
      * tag 'arm64-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux:
        arm64: assembler: add macros to conditionally yield the NEON under PREEMPT
        arm64: assembler: add utility macros to push/pop stack frames
        arm64: Move the content of bpi.S to hyp-entry.S
        arm64: Get rid of __smccc_workaround_1_hvc_*
        arm64: capabilities: Rework EL2 vector hardening entry
        arm64: KVM: Use SMCCC_ARCH_WORKAROUND_1 for Falkor BP hardening
      e4e57f20
    • Linus Torvalds's avatar
      Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux · 6c21e433
      Linus Torvalds authored
      Pull  more s390 updates from Martin Schwidefsky:
       "Three notable larger changes next to the usual bug fixing:
      
         - update the email addresses in MAINTAINERS for the s390 folks to use
           the simpler linux.ibm.com domain instead of the old
           linux.vnet.ibm.com
      
         - an update for the zcrypt device driver that removes some old and
           obsolete interfaces and add support for up to 256 crypto adapters
      
         - a rework of the IPL aka boot code"
      
      * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux: (23 commits)
        s390: correct nospec auto detection init order
        s390/zcrypt: Support up to 256 crypto adapters.
        s390/zcrypt: Remove deprecated zcrypt proc interface.
        s390/zcrypt: Remove deprecated ioctls.
        s390/zcrypt: Make ap init functions static.
        MAINTAINERS: update s390 maintainers email addresses
        s390/ipl: remove reipl_method and dump_method
        s390/ipl: correct kdump reipl block checksum calculation
        s390/ipl: remove non-existing functions declaration
        s390: assume diag308 set always works
        s390/ipl: avoid adding scpdata to cmdline during ftp/dvd boot
        s390/ipl: correct ipl parmblock valid checks
        s390/ipl: rely on diag308 store to get ipl info
        s390/ipl: move ipl_flags to ipl.c
        s390/ipl: get rid of ipl_ssid and ipl_devno
        s390/ipl: unite diag308 and scsi boot ipl blocks
        s390/ipl: ensure loadparm valid flag is set
        s390/qdio: lock device while installing IRQ handler
        s390/qdio: clear intparm during shutdown
        s390/ccwgroup: require at least one ccw device
        ...
      6c21e433
    • Jean Delvare's avatar
      firmware: dmi_scan: Use lowercase letters for UUID · 712ff254
      Jean Delvare authored
      RFC 4122 asks for letters a-f in UUID to be lowercase. Follow this
      recommendation.
      
      Suggested by Paul Dagnelie at:
      https://savannah.nongnu.org/bugs/index.php?53569Signed-off-by: default avatarJean Delvare <jdelvare@suse.de>
      712ff254
    • Alex Hung's avatar
      firmware: dmi_scan: Add DMI_OEM_STRING support to dmi_matches · de40614d
      Alex Hung authored
      OEM strings are defined by each OEM and they contain customized and
      useful OEM information. Supporting it provides more flexible uses of
      the dmi_matches function.
      Signed-off-by: default avatarAlex Hung <alex.hung@canonical.com>
      Signed-off-by: default avatarJean Delvare <jdelvare@suse.de>
      de40614d
    • Jean Delvare's avatar
      firmware: dmi_scan: Fix UUID length safety check · 90fe6f8f
      Jean Delvare authored
      The test which ensures that the DMI type 1 structure is long enough
      to hold the UUID is off by one. It would fail if the structure is
      exactly 24 bytes long, while that's sufficient to hold the UUID.
      
      I don't expect this bug to cause problem in practice because all
      implementations I have seen had length 8, 25 or 27 bytes, in line
      with the SMBIOS specifications. But let's fix it still.
      Signed-off-by: default avatarJean Delvare <jdelvare@suse.de>
      Fixes: a814c359 ("firmware: dmi_scan: Check DMI structure length")
      Reviewed-by: default avatarMika Westerberg <mika.westerberg@linux.intel.com>
      90fe6f8f
    • Zhang Rui's avatar
      b907b408
    • Linus Torvalds's avatar
      Merge tag 'drm-fixes-for-v4.17-rc1' of git://people.freedesktop.org/~airlied/linux · 16e205cf
      Linus Torvalds authored
      Pull drm fixes from Dave Airlie:
       "One omap, and one alsa pm fix (we merged the breaking patch via drm
        tree).
      
        Otherwise it's two bunches of amdgpu fixes, removing an unneeded file,
        some DC fixes, HDMI audio regression fix, and some vega12 fixes"
      
      * tag 'drm-fixes-for-v4.17-rc1' of git://people.freedesktop.org/~airlied/linux: (27 commits)
        Revert "drm/amd/display: disable CRTCs with NULL FB on their primary plane (V2)"
        Revert "drm/amd/display: fix dereferencing possible ERR_PTR()"
        drm/amd/display: Fix regamma not affecting full-intensity color values
        drm/amd/display: Fix FBC text console corruption
        drm/amd/display: Only register backlight device if embedded panel connected
        drm/amd/display: fix brightness level after resume from suspend
        drm/amd/display: HDMI has no sound after Panel power off/on
        drm/amdgpu: add MP1 and THM hw ip base reg offset
        drm/amdgpu: fix null pointer panic with direct fw loading on gpu reset
        drm/radeon: add PX quirk for Asus K73TK
        drm/omap: fix crash if there's no video PLL
        drm/amdgpu: Fix memory leaks at amdgpu_init() error path
        drm/amdgpu: Fix PCIe lane width calculation
        drm/radeon: Fix PCIe lane width calculation
        drm/amdgpu/si: implement get/set pcie_lanes asic callback
        drm/amdgpu: Add support for SRBM selection v3
        Revert "drm/amdgpu: Don't change preferred domian when fallback GTT v5"
        drm/amd/powerply: fix power reading on Fiji
        drm/amd/powerplay: Enable ACG SS feature
        drm/amdgpu/sdma: fix mask in emit_pipeline_sync
        ...
      16e205cf
    • Linus Torvalds's avatar
      Merge tag 'trace-v4.17-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace · affb0280
      Linus Torvalds authored
      Pull tracing fixes from Steven Rostedt:
       "A few clean ups and bug fixes:
      
         - replace open coded "ARRAY_SIZE()" with macro
      
         - updates to uprobes
      
         - bug fix for perf event filter on error path"
      
      * tag 'trace-v4.17-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace:
        tracing: Enforce passing in filter=NULL to create_filter()
        trace_uprobe: Simplify probes_seq_show()
        trace_uprobe: Use %lx to display offset
        tracing/uprobe: Add support for overlayfs
        tracing: Use ARRAY_SIZE() macro instead of open coding it
      affb0280
    • Alexey Dobriyan's avatar
      proc: fixup copyright sign · ee9294d6
      Alexey Dobriyan authored
      Add copyright in two files before they get autorubberstamped.
      Signed-off-by: default avatarAlexey Dobriyan <adobriyan@gmail.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      ee9294d6
    • Linus Torvalds's avatar
      Merge tag 'pci-v4.17-changes-2' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci · 0c314a95
      Linus Torvalds authored
      Pull PCI fixes from Bjorn Helgaas:
      
       - mark Extended Tags as broken on Broadcom HT1100 and HT2000 Root Ports
         to fix drm/Xorg hangs and unresponsive keyboards (Sinan Kaya)
      
       - remove useless messages during resource reassignment (Desnes A. Nunes
         do Rosario)
      
      * tag 'pci-v4.17-changes-2' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci:
        PCI: Remove messages about reassigning resources
        PCI: Mark Broadcom HT1100 and HT2000 Root Port Extended Tags as broken
      0c314a95
    • Linus Torvalds's avatar
      Merge branch 'parisc-4.17-2' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux · 681857ef
      Linus Torvalds authored
      Pull parisc updates from Helge Deller:
      
       - fix panic when halting system via "shutdown -h now"
      
       - drop own coding in favour of generic CONFIG_COMPAT_BINFMT_ELF
         implementation
      
       - add FPE_CONDTRAP constant: last outstanding parisc-specific cleanup
         for Eric Biedermans siginfo patches
      
       - move some functions to .init and some to .text.hot linker sections
      
      * 'parisc-4.17-2' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux:
        parisc: Prevent panic at system halt
        parisc: Switch to generic COMPAT_BINFMT_ELF
        parisc: Move cache flush functions into .text.hot section
        parisc/signal: Add FPE_CONDTRAP for conditional trap handling
      681857ef
  5. 12 Apr, 2018 9 commits
    • Thomas Petazzoni's avatar
      arch/sh: pcie-sh7786: handle non-zero DMA offset · bf9c7e3d
      Thomas Petazzoni authored
      On SuperH, the base of the physical memory might be different from
      zero. In this case, PCI address zero will map to a non-zero physical
      address. In order to make sure that the DMA mapping API takes care of
      this DMA offset, we must fill in the dev->dma_pfn_offset field for PCI
      devices. This gets done in the pcibios_bus_add_device() hook, called
      for each new PCI device detected.
      
      The dma_pfn_offset global variable is re-calculated for every PCI
      controller available on the platform, but that's not an issue because
      its value will each time be exactly the same, as it only depends on
      the memory start address and memory size.
      Signed-off-by: default avatarThomas Petazzoni <thomas.petazzoni@free-electrons.com>
      Signed-off-by: default avatarRich Felker <dalias@libc.org>
      bf9c7e3d
    • Thomas Petazzoni's avatar
      arch/sh: pcie-sh7786: adjust the memory mapping · 79e1c5e7
      Thomas Petazzoni authored
      The code setting up the PCI -> SuperHighway mapping doesn't take into
      account the fact that the address stored in PCIELARx must be aligned
      with the size stored in PCIELAMRx.
      
      For example, when your physical memory starts at 0x0800_0000 (128 MB),
      a size of 64 MB or 128 MB is fine. However, if you have 256 MB of
      memory, it doesn't work because the base address is not aligned on the
      size.
      
      In such situation, we have to round down the base address to make sure
      it is aligned on the size of the area. For for a 0x0800_0000 base
      address with 256 MB of memory, we will round down to 0x0, and extend
      the size of the mapping to 512 MB.
      
      This allows the mapping to work on platforms that have 256 MB of
      RAM. The current setup would only work with 128 MB of RAM or less.
      Signed-off-by: default avatarThomas Petazzoni <thomas.petazzoni@free-electrons.com>
      Signed-off-by: default avatarRich Felker <dalias@libc.org>
      79e1c5e7
    • Thomas Petazzoni's avatar
      arch/sh: pcie-sh7786: adjust PCI MEM and IO regions · 5da1bb96
      Thomas Petazzoni authored
      The current definition of the PCIe IO and MEM resources for SH7786
      doesn't match what the datasheet says. For example, for PCIe0
      0xfe100000 is advertised by the datasheet as a PCI IO region, while
      0xfd000000 is advertised as a PCI MEM region. The code currently
      inverts the two.
      
      The SH4A_PCIEPARL and SH4A_PCIEPTCTLR registers allow to define the
      base address and role of the different regions (including whether it's
      a MEM or IO region). However, practical experience on a SH7786 shows
      that if 0xfe100000 is used for LEL and 0xfd000000 for IO, a PCIe
      device using two MEM BARs cannot be accessed at all. Simply using
      0xfe100000 for IO and 0xfd000000 for MEM makes the PCIe device
      accessible.
      
      It is very likely that this was never seen because there are two other
      PCI MEM region listed in the resources. However, for different
      reasons, none of the two other MEM regions are usable on the specific
      SH7786 platform the problem was encountered. Therefore, the last MEM
      region at 0xfe100000 was used to place the BARs, making the device
      non-functional.
      
      This commit therefore adjusts those PCI MEM and IO resources
      definitions so that they match what the datasheet says. They have only
      been tested with PCIe 0.
      Signed-off-by: default avatarThomas Petazzoni <thomas.petazzoni@free-electrons.com>
      Signed-off-by: default avatarRich Felker <dalias@libc.org>
      5da1bb96
    • Thomas Petazzoni's avatar
      arch/sh: pcie-sh7786: exclude unusable PCI MEM areas · d62e9bf5
      Thomas Petazzoni authored
      Depending on the physical memory layout, some PCI MEM areas are not
      usable. According to the SH7786 datasheet, the PCI MEM area from
      1000_0000 to 13FF_FFFF is only usable if the physical memory layout
      (in MMSELR) is 1, 2, 5 or 6. In all other configurations, this PCI MEM
      area is not usable (because it overlaps with DRAM).
      
      Therefore, this commit adjusts the PCI SH7786 initialization to mark
      the relevant PCI resource as IORESOURCE_DISABLED if we can't use it.
      Signed-off-by: default avatarThomas Petazzoni <thomas.petazzoni@free-electrons.com>
      Signed-off-by: default avatarRich Felker <dalias@libc.org>
      d62e9bf5
    • Thomas Petazzoni's avatar
      arch/sh: pcie-sh7786: mark unavailable PCI resource as disabled · 7dd7f698
      Thomas Petazzoni authored
      Some PCI MEM resources are marked as IORESOURCE_MEM_32BIT, which means
      they are only usable when the SH core runs in 32-bit mode. In 29-bit
      mode, such memory regions are not usable.
      
      The existing code for SH7786 properly skips such regions when
      configuring the PCIe controller registers. However, because such
      regions are still described in the resource array, the
      pcibios_scanbus() function in the SuperH pci.c will register them to
      the PCI core. Due to this, the PCI core will allocate MEM areas from
      this resource, and assign BARs pointing to this area, even though it's
      unusable.
      
      In order to prevent this from happening, we mark such regions as
      IORESOURCE_DISABLED, which tells the SuperH pci.c pcibios_scanbus()
      function to skip them.
      
      Note that we separate marking the region as disabled from skipping it,
      because other regions will be marked as disabled in follow-up patches.
      Signed-off-by: default avatarThomas Petazzoni <thomas.petazzoni@free-electrons.com>
      Signed-off-by: default avatarRich Felker <dalias@libc.org>
      7dd7f698
    • Thomas Petazzoni's avatar
      arch/sh: pci: don't use disabled resources · 3aeb93a0
      Thomas Petazzoni authored
      In pcibios_scanbus(), we provide to the PCI core the usable MEM and IO
      regions using pci_add_resource_offset(). We travel through all
      resources available in the "struct pci_channel".
      
      Also, in register_pci_controller(), we travel through all resources to
      request them, making sure they don't conflict with already requested
      resources.
      
      However, some resources may be disabled, in which case they should not
      be requested nor provided to the PCI core.
      
      In the current situation, none of the resources are disabled. However,
      follow-up patches in this series will make some resources disabled,
      making this preliminary change necessary.
      Signed-off-by: default avatarThomas Petazzoni <thomas.petazzoni@free-electrons.com>
      Signed-off-by: default avatarRich Felker <dalias@libc.org>
      3aeb93a0
    • Thomas Petazzoni's avatar
      arch/sh: make the DMA mapping operations observe dev->dma_pfn_offset · ce883130
      Thomas Petazzoni authored
      Some devices may have a non-zero DMA offset, i.e an offset between the
      DMA address and the physical address. Such an offset can be encoded
      into the dma_pfn_offset field of "struct device", but the SuperH
      implementation of the DMA mapping API does not observe this
      information.
      
      This commit fixes that by ensuring the DMA address is properly
      calculated depending on this DMA offset.
      Signed-off-by: default avatarThomas Petazzoni <thomas.petazzoni@free-electrons.com>
      Signed-off-by: default avatarRich Felker <dalias@libc.org>
      ce883130
    • Thomas Petazzoni's avatar
      arch/sh: add sh7786_mm_sel() function · bc05aa6e
      Thomas Petazzoni authored
      The SH7786 has different physical memory layout configurations,
      configurable through the MMSELR register. The configuration is
      typically defined by the bootloader, so Linux generally doesn't care.
      
      Except that depending on the configuration, some PCI MEM areas may or
      may not be available. This commit adds a helper function that allows
      to retrieve the current physical memory layout configuration. It will
      be used in a following patch to exclude unusable PCI MEM areas during
      the PCI initialization.
      Signed-off-by: default avatarThomas Petazzoni <thomas.petazzoni@free-electrons.com>
      Signed-off-by: default avatarRich Felker <dalias@libc.org>
      bc05aa6e
    • Rich Felker's avatar
      sh: fix debug trap failure to process signals before return to user · 96a59899
      Rich Felker authored
      When responding to a debug trap (breakpoint) in userspace, the
      kernel's trap handler raised SIGTRAP but returned from the trap via a
      code path that ignored pending signals, resulting in an infinite loop
      re-executing the trapping instruction.
      Signed-off-by: default avatarRich Felker <dalias@libc.org>
      96a59899