1. 21 Nov, 2019 2 commits
    • Nicolas Saenz Julienne's avatar
      dma-mapping: treat dev->bus_dma_mask as a DMA limit · a7ba70f1
      Nicolas Saenz Julienne authored
      Using a mask to represent bus DMA constraints has a set of limitations.
      The biggest one being it can only hold a power of two (minus one). The
      DMA mapping code is already aware of this and treats dev->bus_dma_mask
      as a limit. This quirk is already used by some architectures although
      still rare.
      
      With the introduction of the Raspberry Pi 4 we've found a new contender
      for the use of bus DMA limits, as its PCIe bus can only address the
      lower 3GB of memory (of a total of 4GB). This is impossible to represent
      with a mask. To make things worse the device-tree code rounds non power
      of two bus DMA limits to the next power of two, which is unacceptable in
      this case.
      
      In the light of this, rename dev->bus_dma_mask to dev->bus_dma_limit all
      over the tree and treat it as such. Note that dev->bus_dma_limit should
      contain the higher accessible DMA address.
      Signed-off-by: default avatarNicolas Saenz Julienne <nsaenzjulienne@suse.de>
      Reviewed-by: default avatarRobin Murphy <robin.murphy@arm.com>
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      a7ba70f1
    • Christoph Hellwig's avatar
      Merge branch 'for-next/zone-dma' of... · d7293f79
      Christoph Hellwig authored
      Merge branch 'for-next/zone-dma' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux into dma-mapping-for-next
      
      Pull in a stable branch from the arm64 tree that adds the zone_dma_bits
      variable to avoid creating hard to resolve conflicts with that addition.
      d7293f79
  2. 20 Nov, 2019 7 commits
  3. 11 Nov, 2019 7 commits
    • Nicolas Saenz Julienne's avatar
      x86/PCI: sta2x11: use default DMA address translation · e380a039
      Nicolas Saenz Julienne authored
      The devices found behind this PCIe chip have unusual DMA mapping
      constraints as there is an AMBA interconnect placed in between them and
      the different PCI endpoints. The offset between physical memory
      addresses and AMBA's view is provided by reading a PCI config register,
      which is saved and used whenever DMA mapping is needed.
      
      It turns out that this DMA setup can be represented by properly setting
      'dma_pfn_offset', 'dma_bus_mask' and 'dma_mask' during the PCI device
      enable fixup. And ultimately allows us to get rid of this device's
      custom DMA functions.
      
      Aside from the code deletion and DMA setup, sta2x11_pdev_to_mapping() is
      moved to avoid warnings whenever CONFIG_PM is not enabled.
      Signed-off-by: default avatarNicolas Saenz Julienne <nsaenzjulienne@suse.de>
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      e380a039
    • Nicolas Saenz Julienne's avatar
      dma-direct: check for overflows on 32 bit DMA addresses · b12d6627
      Nicolas Saenz Julienne authored
      As seen on the new Raspberry Pi 4 and sta2x11's DMA implementation it is
      possible for a device configured with 32 bit DMA addresses and a partial
      DMA mapping located at the end of the address space to overflow. It
      happens when a higher physical address, not DMAable, is translated to
      it's DMA counterpart.
      
      For example the Raspberry Pi 4, configurable up to 4 GB of memory, has
      an interconnect capable of addressing the lower 1 GB of physical memory
      with a DMA offset of 0xc0000000. It transpires that, any attempt to
      translate physical addresses higher than the first GB will result in an
      overflow which dma_capable() can't detect as it only checks for
      addresses bigger then the maximum allowed DMA address.
      
      Fix this by verifying in dma_capable() if the DMA address range provided
      is at any point lower than the minimum possible DMA address on the bus.
      Signed-off-by: default avatarNicolas Saenz Julienne <nsaenzjulienne@suse.de>
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      b12d6627
    • Eric Dumazet's avatar
      dma-debug: increase HASH_SIZE · 5e76f564
      Eric Dumazet authored
      With modern NIC, it is not unusual having about ~256,000 active dma
      mappings and a hash size of 1024 buckets is too small.
      
      Forcing full cache line per bucket does not seem useful, especially now
      that we have contention on free_entries_lock for allocations and freeing
      of entries.  Better use the space to fit more buckets.
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      5e76f564
    • Eric Dumazet's avatar
      dma-debug: reorder struct dma_debug_entry fields · d3694f30
      Eric Dumazet authored
      Move all fields used during exact match lookups to the first cache line.
      This makes debug_dma_mapping_error() and friends about 50% faster.
      
      Since it removes two 32bit holes, force a cacheline alignment on struct
      dma_debug_entry.
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      d3694f30
    • Christoph Hellwig's avatar
      xtensa: use the generic uncached segment support · 0f665b9e
      Christoph Hellwig authored
      Switch xtensa over to use the generic uncached support, and thus the
      generic implementations of dma_alloc_* and dma_alloc_*, which also
      gains support for mmaping DMA memory.  The non-working nommu DMA
      support has been disabled, but could be re-enabled easily if platforms
      that actually have an uncached segment show up.
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      Reviewed-by: default avatarMax Filippov <jcmvbkbc@gmail.com>
      Tested-by: default avatarMax Filippov <jcmvbkbc@gmail.com>
      0f665b9e
    • Christoph Hellwig's avatar
      dma-mapping: merge the generic remapping helpers into dma-direct · 3acac065
      Christoph Hellwig authored
      Integrate the generic dma remapping implementation into the main flow.
      This prepares for architectures like xtensa that use an uncached
      segment for pages in the kernel mapping, but can also remap highmem
      from CMA.  To simplify that implementation we now always deduct the
      page from the physical address via the DMA address instead of the
      virtual address.
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      Reviewed-by: default avatarMax Filippov <jcmvbkbc@gmail.com>
      3acac065
    • Christoph Hellwig's avatar
      dma-direct: provide mmap and get_sgtable method overrides · 34dc0ea6
      Christoph Hellwig authored
      For dma-direct we know that the DMA address is an encoding of the
      physical address that we can trivially decode.  Use that fact to
      provide implementations that do not need the arch_dma_coherent_to_pfn
      architecture hook.  Note that we still can only support mmap of
      non-coherent memory only if the architecture provides a way to set an
      uncached bit in the page tables.  This must be true for architectures
      that use the generic remap helpers, but other architectures can also
      manually select it.
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      Reviewed-by: default avatarMax Filippov <jcmvbkbc@gmail.com>
      34dc0ea6
  4. 07 Nov, 2019 3 commits
  5. 01 Nov, 2019 1 commit
  6. 31 Oct, 2019 1 commit
  7. 30 Oct, 2019 10 commits
  8. 29 Oct, 2019 1 commit
    • Linus Torvalds's avatar
      Merge tag 'fuse-fixes-5.4-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/fuse · 23fdb198
      Linus Torvalds authored
      Pull fuse fixes from Miklos Szeredi:
       "Mostly virtiofs fixes, but also fixes a regression and couple of
        longstanding data/metadata writeback ordering issues"
      
      * tag 'fuse-fixes-5.4-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/fuse:
        fuse: redundant get_fuse_inode() calls in fuse_writepages_fill()
        fuse: Add changelog entries for protocols 7.1 - 7.8
        fuse: truncate pending writes on O_TRUNC
        fuse: flush dirty data/metadata before non-truncate setattr
        virtiofs: Remove set but not used variable 'fc'
        virtiofs: Retry request submission from worker context
        virtiofs: Count pending forgets as in_flight forgets
        virtiofs: Set FR_SENT flag only after request has been sent
        virtiofs: No need to check fpq->connected state
        virtiofs: Do not end request in submission context
        fuse: don't advise readdirplus for negative lookup
        fuse: don't dereference req->args on finished request
        virtio-fs: don't show mount options
        virtio-fs: Change module name to virtiofs.ko
      23fdb198
  9. 28 Oct, 2019 7 commits
    • Linus Torvalds's avatar
      Merge tag 'arc-5.4-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/vgupta/arc · 8005803a
      Linus Torvalds authored
      Pull ARC fixes from Vineet Gupta:
       "Small fixes for ARC:
      
         - perf fix for Big Endian build [Alexey]
      
         - hadk platform enable soem peripherals [Eugeniy]"
      
      * tag 'arc-5.4-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/vgupta/arc:
        ARC: perf: Accommodate big-endian CPU
        ARC: [plat-hsdk]: Enable on-boardi SPI ADC IC
        ARC: [plat-hsdk]: Enable on-board SPI NOR flash IC
      8005803a
    • Catalin Marinas's avatar
      arm64: Make arm64_dma32_phys_limit static · 4686da51
      Catalin Marinas authored
      This variable is only used in the arch/arm64/mm/init.c file for
      ZONE_DMA32 initialisation, no need to expose it.
      Reported-by: default avatarWill Deacon <will@kernel.org>
      Signed-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      4686da51
    • Linus Torvalds's avatar
      Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid · 0365fb6b
      Linus Torvalds authored
      Pull HID fixes from Jiri Kosina:
      
       - HID++ device support regression fixes (race condition during cleanup,
         device detection fix, opps fix) from Andrey Smirnov
      
       - disable PM on i2c-hid, as it's causing problems with a lot of
         devices; other OSes apparently don't implement/enable it either; from
         Kai-Heng Feng
      
       - error handling fix in intel-ish driver, from Zhang Lixu
      
       - syzbot fuzzer fix for HID core code from Alan Stern
      
       - a few other tiny fixups (printk message cleanup, new device ID)
      
      * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid:
        HID: i2c-hid: add Trekstor Primebook C11B to descriptor override
        HID: logitech-hidpp: do all FF cleanup in hidpp_ff_destroy()
        HID: logitech-hidpp: rework device validation
        HID: logitech-hidpp: split g920_get_config()
        HID: i2c-hid: Remove runtime power management
        HID: intel-ish-hid: fix wrong error handling in ishtp_cl_alloc_tx_ring()
        HID: google: add magnemite/masterball USB ids
        HID: Fix assumption that devices have inputs
        HID: prodikeys: make array keys static const, makes object smaller
        HID: fix error message in hid_open_report()
      0365fb6b
    • Linus Torvalds's avatar
      Merge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost · 9e5eefba
      Linus Torvalds authored
      Pull virtio fixes from Michael Tsirkin:
       "Some minor fixes"
      
      * tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost:
        vringh: fix copy direction of vringh_iov_push_kern()
        vsock/virtio: remove unused 'work' field from 'struct virtio_vsock_pkt'
        virtio_ring: fix stalls for packed rings
      9e5eefba
    • Jason Wang's avatar
      vringh: fix copy direction of vringh_iov_push_kern() · b3683dee
      Jason Wang authored
      We want to copy from iov to buf, so the direction was wrong.
      
      Note: no real user for the helper, but it will be used by future
      features.
      Signed-off-by: default avatarJason Wang <jasowang@redhat.com>
      Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      b3683dee
    • Stefano Garzarella's avatar
      vsock/virtio: remove unused 'work' field from 'struct virtio_vsock_pkt' · 67715961
      Stefano Garzarella authored
      The 'work' field was introduced with commit 06a8fc78
      ("VSOCK: Introduce virtio_vsock_common.ko")
      but it is never used in the code, so we can remove it to save
      memory allocated in the per-packet 'struct virtio_vsock_pkt'
      Suggested-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: default avatarStefano Garzarella <sgarzare@redhat.com>
      Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      67715961
    • Marvin Liu's avatar
      virtio_ring: fix stalls for packed rings · 40ce7919
      Marvin Liu authored
      When VIRTIO_F_RING_EVENT_IDX is negotiated, virtio devices can
      use virtqueue_enable_cb_delayed_packed to reduce the number of device
      interrupts.  At the moment, this is the case for virtio-net when the
      napi_tx module parameter is set to false.
      
      In this case, the virtio driver selects an event offset and expects that
      the device will send a notification when rolling over the event offset
      in the ring.  However, if this roll-over happens before the event
      suppression structure update, the notification won't be sent. To address
      this race condition the driver needs to check wether the device rolled
      over the offset after updating the event suppression structure.
      
      With VIRTIO_F_RING_PACKED, the virtio driver did this by reading the
      flags field of the descriptor at the specified offset.
      
      Unfortunately, checking at the event offset isn't reliable: if
      descriptors are chained (e.g. when INDIRECT is off) not all descriptors
      are overwritten by the device, so it's possible that the device skipped
      the specific descriptor driver is checking when writing out used
      descriptors. If this happens, the driver won't detect the race condition
      and will incorrectly expect the device to send a notification.
      
      For virtio-net, the result will be a TX queue stall, with the
      transmission getting blocked forever.
      
      With the packed ring, it isn't easy to find a location which is
      guaranteed to change upon the roll-over, except the next device
      descriptor, as described in the spec:
      
              Writes of device and driver descriptors can generally be
              reordered, but each side (driver and device) are only required to
              poll (or test) a single location in memory: the next device descriptor after
              the one they processed previously, in circular order.
      
      while this might be sub-optimal, let's do exactly this for now.
      
      Cc: stable@vger.kernel.org
      Cc: Jason Wang <jasowang@redhat.com>
      Fixes: f51f9826 ("virtio_ring: leverage event idx in packed ring")
      Signed-off-by: default avatarMarvin Liu <yong.liu@intel.com>
      Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      40ce7919
  10. 27 Oct, 2019 1 commit