1. 22 11月, 2019 2 次提交
    • N
      dma-mapping: treat dev->bus_dma_mask as a DMA limit · a7ba70f1
      Nicolas Saenz Julienne 提交于
      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: NNicolas Saenz Julienne <nsaenzjulienne@suse.de>
      Reviewed-by: NRobin Murphy <robin.murphy@arm.com>
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      a7ba70f1
    • C
      Merge branch 'for-next/zone-dma' of... · d7293f79
      Christoph Hellwig 提交于
      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. 21 11月, 2019 7 次提交
  3. 11 11月, 2019 7 次提交
    • N
      x86/PCI: sta2x11: use default DMA address translation · e380a039
      Nicolas Saenz Julienne 提交于
      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: NNicolas Saenz Julienne <nsaenzjulienne@suse.de>
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      e380a039
    • N
      dma-direct: check for overflows on 32 bit DMA addresses · b12d6627
      Nicolas Saenz Julienne 提交于
      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: NNicolas Saenz Julienne <nsaenzjulienne@suse.de>
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      b12d6627
    • E
      dma-debug: increase HASH_SIZE · 5e76f564
      Eric Dumazet 提交于
      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: NEric Dumazet <edumazet@google.com>
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      5e76f564
    • E
      dma-debug: reorder struct dma_debug_entry fields · d3694f30
      Eric Dumazet 提交于
      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: NEric Dumazet <edumazet@google.com>
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      d3694f30
    • C
      xtensa: use the generic uncached segment support · 0f665b9e
      Christoph Hellwig 提交于
      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: NChristoph Hellwig <hch@lst.de>
      Reviewed-by: NMax Filippov <jcmvbkbc@gmail.com>
      Tested-by: NMax Filippov <jcmvbkbc@gmail.com>
      0f665b9e
    • C
      dma-mapping: merge the generic remapping helpers into dma-direct · 3acac065
      Christoph Hellwig 提交于
      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: NChristoph Hellwig <hch@lst.de>
      Reviewed-by: NMax Filippov <jcmvbkbc@gmail.com>
      3acac065
    • C
      dma-direct: provide mmap and get_sgtable method overrides · 34dc0ea6
      Christoph Hellwig 提交于
      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: NChristoph Hellwig <hch@lst.de>
      Reviewed-by: NMax Filippov <jcmvbkbc@gmail.com>
      34dc0ea6
  4. 08 11月, 2019 2 次提交
  5. 07 11月, 2019 1 次提交
  6. 01 11月, 2019 1 次提交
  7. 31 10月, 2019 5 次提交
  8. 30 10月, 2019 7 次提交
    • L
      Merge tag 'iommu-fixes-v5.4-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu · 320000e7
      Linus Torvalds 提交于
      Pull iommu fixes from Joerg Roedel:
      
       - Follow-on fix for Renesas IPMMU to get rid of a redundant error
         message.
      
       - Quirk for AMD IOMMU to make it work on another Acer Laptop model with
         a broken IVRS ACPI table.
      
       - Fix for a panic at kdump in the Intel IOMMU driver.
      
      * tag 'iommu-fixes-v5.4-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu:
        iommu/vt-d: Fix panic after kexec -p for kdump
        iommu/amd: Apply the same IVRS IOAPIC workaround to Acer Aspire A315-41
        iommu/ipmmu-vmsa: Remove dev_err() on platform_get_irq() failure
      320000e7
    • L
      Merge tag 'gfs2-v5.4-rc5.fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/gfs2/linux-gfs2 · b66b4498
      Linus Torvalds 提交于
      Pull gfs2 fix from Andreas Gruenbacher:
       "Fix remounting (broken in -rc1)."
      
      * tag 'gfs2-v5.4-rc5.fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/gfs2/linux-gfs2:
        gfs2: Fix initialisation of args for remount
      b66b4498
    • A
      gfs2: Fix initialisation of args for remount · d5798141
      Andrew Price 提交于
      When gfs2 was converted to use fs_context, the initialisation of the
      mount args structure to the currently active args was lost with the
      removal of gfs2_remount_fs(), so the checks of the new args on remount
      became checks against the default values instead of the current ones.
      This caused unexpected remount behaviour and test failures (xfstests
      generic/294, generic/306 and generic/452).
      
      Reinstate the args initialisation, this time in gfs2_init_fs_context()
      and conditional upon fc->purpose, as that's the only time we get control
      before the mount args are parsed in the remount process.
      
      Fixes: 1f52aa08 ("gfs2: Convert gfs2 to fs_context")
      Signed-off-by: NAndrew Price <anprice@redhat.com>
      Signed-off-by: NAndreas Gruenbacher <agruenba@redhat.com>
      d5798141
    • J
      iommu/vt-d: Fix panic after kexec -p for kdump · 160c63f9
      John Donnelly 提交于
      This cures a panic on restart after a kexec operation on 5.3 and 5.4
      kernels.
      
      The underlying state of the iommu registers (iommu->flags &
      VTD_FLAG_TRANS_PRE_ENABLED) on a restart results in a domain being marked as
      "DEFER_DEVICE_DOMAIN_INFO" that produces an Oops in identity_mapping().
      
      [   43.654737] BUG: kernel NULL pointer dereference, address:
      0000000000000056
      [   43.655720] #PF: supervisor read access in kernel mode
      [   43.655720] #PF: error_code(0x0000) - not-present page
      [   43.655720] PGD 0 P4D 0
      [   43.655720] Oops: 0000 [#1] SMP PTI
      [   43.655720] CPU: 0 PID: 1 Comm: swapper/0 Not tainted
      5.3.2-1940.el8uek.x86_64 #1
      [   43.655720] Hardware name: Oracle Corporation ORACLE SERVER
      X5-2/ASM,MOTHERBOARD,1U, BIOS 30140300 09/20/2018
      [   43.655720] RIP: 0010:iommu_need_mapping+0x29/0xd0
      [   43.655720] Code: 00 0f 1f 44 00 00 48 8b 97 70 02 00 00 48 83 fa ff
      74 53 48 8d 4a ff b8 01 00 00 00 48 83 f9 fd 76 01 c3 48 8b 35 7f 58 e0
      01 <48> 39 72 58 75 f2 55 48 89 e5 41 54 53 48 8b 87 28 02 00 00 4c 8b
      [   43.655720] RSP: 0018:ffffc9000001b9b0 EFLAGS: 00010246
      [   43.655720] RAX: 0000000000000001 RBX: 0000000000001000 RCX:
      fffffffffffffffd
      [   43.655720] RDX: fffffffffffffffe RSI: ffff8880719b8000 RDI:
      ffff8880477460b0
      [   43.655720] RBP: ffffc9000001b9e8 R08: 0000000000000000 R09:
      ffff888047c01700
      [   43.655720] R10: 00002194036fc692 R11: 0000000000000000 R12:
      0000000000000000
      [   43.655720] R13: ffff8880477460b0 R14: 0000000000000cc0 R15:
      ffff888072d2b558
      [   43.655720] FS:  0000000000000000(0000) GS:ffff888071c00000(0000)
      knlGS:0000000000000000
      [   43.655720] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      [   43.655720] CR2: 0000000000000056 CR3: 000000007440a002 CR4:
      00000000001606b0
      [   43.655720] Call Trace:
      [   43.655720]  ? intel_alloc_coherent+0x2a/0x180
      [   43.655720]  ? __schedule+0x2c2/0x650
      [   43.655720]  dma_alloc_attrs+0x8c/0xd0
      [   43.655720]  dma_pool_alloc+0xdf/0x200
      [   43.655720]  ehci_qh_alloc+0x58/0x130
      [   43.655720]  ehci_setup+0x287/0x7ba
      [   43.655720]  ? _dev_info+0x6c/0x83
      [   43.655720]  ehci_pci_setup+0x91/0x436
      [   43.655720]  usb_add_hcd.cold.48+0x1d4/0x754
      [   43.655720]  usb_hcd_pci_probe+0x2bc/0x3f0
      [   43.655720]  ehci_pci_probe+0x39/0x40
      [   43.655720]  local_pci_probe+0x47/0x80
      [   43.655720]  pci_device_probe+0xff/0x1b0
      [   43.655720]  really_probe+0xf5/0x3a0
      [   43.655720]  driver_probe_device+0xbb/0x100
      [   43.655720]  device_driver_attach+0x58/0x60
      [   43.655720]  __driver_attach+0x8f/0x150
      [   43.655720]  ? device_driver_attach+0x60/0x60
      [   43.655720]  bus_for_each_dev+0x74/0xb0
      [   43.655720]  driver_attach+0x1e/0x20
      [   43.655720]  bus_add_driver+0x151/0x1f0
      [   43.655720]  ? ehci_hcd_init+0xb2/0xb2
      [   43.655720]  ? do_early_param+0x95/0x95
      [   43.655720]  driver_register+0x70/0xc0
      [   43.655720]  ? ehci_hcd_init+0xb2/0xb2
      [   43.655720]  __pci_register_driver+0x57/0x60
      [   43.655720]  ehci_pci_init+0x6a/0x6c
      [   43.655720]  do_one_initcall+0x4a/0x1fa
      [   43.655720]  ? do_early_param+0x95/0x95
      [   43.655720]  kernel_init_freeable+0x1bd/0x262
      [   43.655720]  ? rest_init+0xb0/0xb0
      [   43.655720]  kernel_init+0xe/0x110
      [   43.655720]  ret_from_fork+0x24/0x50
      
      Fixes: 8af46c78 ("iommu/vt-d: Implement is_attach_deferred iommu ops entry")
      Cc: stable@vger.kernel.org # v5.3+
      Signed-off-by: NJohn Donnelly <john.p.donnelly@oracle.com>
      Reviewed-by: NLu Baolu <baolu.lu@linux.intel.com>
      Signed-off-by: NJoerg Roedel <jroedel@suse.de>
      160c63f9
    • T
      iommu/amd: Apply the same IVRS IOAPIC workaround to Acer Aspire A315-41 · ad3e8da2
      Takashi Iwai 提交于
      Acer Aspire A315-41 requires the very same workaround as the existing
      quirk for Dell Latitude 5495.  Add the new entry for that.
      
      BugLink: https://bugzilla.suse.com/show_bug.cgi?id=1137799Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      Signed-off-by: NJoerg Roedel <jroedel@suse.de>
      ad3e8da2
    • Y
      iommu/ipmmu-vmsa: Remove dev_err() on platform_get_irq() failure · 565d4542
      YueHaibing 提交于
      platform_get_irq() will call dev_err() itself on failure,
      so there is no need for the driver to also do this.
      This is detected by coccinelle.
      Signed-off-by: NYueHaibing <yuehaibing@huawei.com>
      Reviewed-by: NGeert Uytterhoeven <geert+renesas@glider.be>
      Signed-off-by: NJoerg Roedel <jroedel@suse.de>
      565d4542
    • L
      Merge tag 'fuse-fixes-5.4-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/fuse · 23fdb198
      Linus Torvalds 提交于
      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. 29 10月, 2019 2 次提交
  10. 28 10月, 2019 6 次提交
    • L
      Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid · 0365fb6b
      Linus Torvalds 提交于
      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
    • L
      Merge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost · 9e5eefba
      Linus Torvalds 提交于
      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
    • J
      vringh: fix copy direction of vringh_iov_push_kern() · b3683dee
      Jason Wang 提交于
      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: NJason Wang <jasowang@redhat.com>
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      b3683dee
    • S
      vsock/virtio: remove unused 'work' field from 'struct virtio_vsock_pkt' · 67715961
      Stefano Garzarella 提交于
      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: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NStefano Garzarella <sgarzare@redhat.com>
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      67715961
    • M
      virtio_ring: fix stalls for packed rings · 40ce7919
      Marvin Liu 提交于
      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: NMarvin Liu <yong.liu@intel.com>
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      40ce7919
    • L
      Linux 5.4-rc5 · d6d5df1d
      Linus Torvalds 提交于
      d6d5df1d