01 Aug, 2020

2 commits

  • Fix a missing __iomem tag in the init_pfn() function. This fixes a sparse
    warning of the form:

    $ make C=2 drivers/pci/switch/
    drivers/pci/switch/switchtec.c:... incorrect type assignment(different address spaces)

    Fixes: 080b47def5e5 ("MicroSemi Switchtec management interface driver")
    Link: https://lore.kernel.org/r/20200728192434.18993-2-logang@deltatee.com
    Signed-off-by: Logan Gunthorpe
    Signed-off-by: Bjorn Helgaas

    Logan Gunthorpe
     
  • Fix a number of missing __iomem and __user tags in the ioctl functions of
    the switchtec driver. This fixes a number of sparse warnings of the form:

    $ make C=2 drivers/pci/switch/
    drivers/pci/switch/switchtec.c:... incorrect type in ... (different address spaces)

    Fixes: 52eabba5bcdb ("switchtec: Add IOCTLs to the Switchtec driver")
    Link: https://lore.kernel.org/r/20200728192434.18993-1-logang@deltatee.com
    Signed-off-by: Logan Gunthorpe
    Signed-off-by: Bjorn Helgaas

    Logan Gunthorpe
     

22 May, 2020

1 commit

  • Use "true" instead of 1 to initialize "bool use_dma_mrpc". This resolves
    the following Coccinelle warning:

    drivers/pci/switch/switchtec.c:28:12-24: WARNING: Assignment of 0/1 to bool variable

    Link: https://lore.kernel.org/r/20200521200439.1076672-1-kw@linux.com
    Signed-off-by: Krzysztof Wilczynski
    Signed-off-by: Bjorn Helgaas
    Reviewed-by: Logan Gunthorpe

    Krzysztof Wilczynski
     

21 Mar, 2020

2 commits

  • The poll callback is using the completion wait queue and sticks it into
    poll_wait() to wake up pollers after a command has completed.

    This works to some extent, but cannot provide EPOLLEXCLUSIVE support
    because the waker side uses complete_all() which unconditionally wakes up
    all waiters. complete_all() is required because completions internally use
    exclusive wait and complete() only wakes up one waiter by default.

    This mixes conceptually different mechanisms and relies on internal
    implementation details of completions, which in turn puts contraints on
    changing the internal implementation of completions.

    Replace it with a regular wait queue and store the state in struct
    switchtec_user.

    Signed-off-by: Sebastian Andrzej Siewior
    Signed-off-by: Thomas Gleixner
    Signed-off-by: Peter Zijlstra (Intel)
    Reviewed-by: Logan Gunthorpe
    Acked-by: Bjorn Helgaas
    Acked-by: Peter Zijlstra (Intel)
    Link: https://lkml.kernel.org/r/20200321113240.936097534@linutronix.de

    Sebastian Andrzej Siewior
     
  • The call to init_completion() in mrpc_queue_cmd() can theoretically
    race with the call to poll_wait() in switchtec_dev_poll().

    poll() write()
    switchtec_dev_poll() switchtec_dev_write()
    poll_wait(&s->comp.wait); mrpc_queue_cmd()
    init_completion(&s->comp)
    init_waitqueue_head(&s->comp.wait)

    To my knowledge, no one has hit this bug.

    Fix this by using reinit_completion() instead of init_completion() in
    mrpc_queue_cmd().

    Fixes: 080b47def5e5 ("MicroSemi Switchtec management interface driver")

    Reported-by: Sebastian Andrzej Siewior
    Signed-off-by: Logan Gunthorpe
    Signed-off-by: Thomas Gleixner
    Signed-off-by: Peter Zijlstra (Intel)
    Acked-by: Bjorn Helgaas
    Link: https://lkml.kernel.org/r/20200313183608.2646-1-logang@deltatee.com

    Logan Gunthorpe
     

16 Jan, 2020

11 commits

  • Now that Gen4 is properly supported, advertise support in the module's
    device ID table and add the same IDs to the list of switchtec quirks.

    [logang@deltatee.com: add commit message and quirk IDs]
    Link: https://lore.kernel.org/r/20200115035648.2578-8-logang@deltatee.com
    Signed-off-by: Kelvin Cao
    Signed-off-by: Logan Gunthorpe
    Signed-off-by: Bjorn Helgaas

    Kelvin Cao
     
  • Gen4 hardware provides new MRPC commands to read and write directly from
    any address in the PCI BAR (which Microsemi refers to as GAS). Since
    accessing BARs can be dangerous and break the driver, we don't want
    unprivileged users to have this ability.

    Therefore, require CAP_SYS_ADMIN for the local and remote GAS access MRPC
    commands. Privileged processes will already have access to the BAR through
    the sysfs resource file so this doesn't give userspace any capabilities it
    didn't already have.

    [logang@deltatee.com: rework commit message]
    Link: https://lore.kernel.org/r/20200106190337.2428-11-logang@deltatee.com
    Signed-off-by: Kelvin Cao
    Signed-off-by: Logan Gunthorpe
    Signed-off-by: Bjorn Helgaas

    Kelvin Cao
     
  • Add the new flash_info registers struct and the implementation of
    ioctl_flash_part_info() for the new Gen4 hardware.

    [logang@deltatee.com: rewrote commit message]
    Link: https://lore.kernel.org/r/20200115035648.2578-7-logang@deltatee.com
    Signed-off-by: Kelvin Cao
    Signed-off-by: Logan Gunthorpe
    Signed-off-by: Bjorn Helgaas

    Kelvin Cao
     
  • Add the Gen4-specific system info registers and ensure their usage is
    guarded by a check on the device's generation.

    Link: https://lore.kernel.org/r/20200115035648.2578-6-logang@deltatee.com
    Signed-off-by: Logan Gunthorpe
    Signed-off-by: Bjorn Helgaas

    Logan Gunthorpe
     
  • Since the sys_info and flash_info registers differ significantly in Gen4
    hardware, separate out the Gen3 registers into their own structure with a
    union in the main structure.

    No functional changes intended.

    Link: https://lore.kernel.org/r/20200115035648.2578-5-logang@deltatee.com
    Signed-off-by: Logan Gunthorpe
    Signed-off-by: Bjorn Helgaas

    Logan Gunthorpe
     
  • Refactor ioctl_flash_part_info() into a Gen3-specific function because the
    registers for flash partition information have changed significantly in
    Gen4 and will require a completely different implementation.

    No functional changes intended.

    Co-developed-by: Kelvin Cao
    Link: https://lore.kernel.org/r/20200115035648.2578-4-logang@deltatee.com
    Signed-off-by: Kelvin Cao
    Signed-off-by: Logan Gunthorpe
    Signed-off-by: Bjorn Helgaas

    Logan Gunthorpe
     
  • Add a generation variable passed through the device ID table and test for
    Gen3-specific registers. This will allow us to add Gen4 and other devices
    that extend the programming model.

    Link: https://lore.kernel.org/r/20200115035648.2578-3-logang@deltatee.com
    Signed-off-by: Logan Gunthorpe
    Signed-off-by: Bjorn Helgaas

    Logan Gunthorpe
     
  • Gen4 hardware will have different values for the SWITCHTEC_X_RUNNING and
    SWITCHTEC_IOCTL_NUM_PARTITIONS, so rename them with GEN3 in their name.

    No functional changes intended.

    Link: https://lore.kernel.org/r/20200115035648.2578-2-logang@deltatee.com
    Signed-off-by: Logan Gunthorpe
    Signed-off-by: Bjorn Helgaas

    Logan Gunthorpe
     
  • The event ID check doesn't depend on anything in the mask_all_events() to
    mask_event() path. Do it in switchtec_event_isr() to avoid the CSR read in
    mask_event().

    Link: https://lore.kernel.org/r/20200106190337.2428-6-logang@deltatee.com
    Signed-off-by: Wesley Sheng
    Signed-off-by: Logan Gunthorpe
    Signed-off-by: Bjorn Helgaas

    Wesley Sheng
     
  • Remove the redundant valid PFF number count from ioctl_event_summary(),
    since init_pff() has already counted the valid PFFs.

    Link: https://lore.kernel.org/r/20200106190337.2428-5-logang@deltatee.com
    Signed-off-by: Wesley Sheng
    Signed-off-by: Logan Gunthorpe
    Signed-off-by: Bjorn Helgaas

    Wesley Sheng
     
  • Add support for the Inter Fabric Manager Communication (Intercomm) Notify
    event in PAX variants of Switchtec hardware and the Upstream Error
    Containment port in the MR1 release of Gen3 firmware.

    Link: https://lore.kernel.org/r/20200106190337.2428-4-logang@deltatee.com
    Signed-off-by: Logan Gunthorpe
    Signed-off-by: Bjorn Helgaas

    Logan Gunthorpe
     

09 Jan, 2020

2 commits

  • vep_vector_number is actually a 16 bit register which should be read with
    ioread16() instead of ioread32().

    Fixes: 080b47def5e5 ("MicroSemi Switchtec management interface driver")
    Link: https://lore.kernel.org/r/20200106190337.2428-3-logang@deltatee.com
    Reported-by: Doug Meyer
    Signed-off-by: Logan Gunthorpe
    Signed-off-by: Bjorn Helgaas

    Logan Gunthorpe
     
  • Use dma_set_mask_and_coherent() instead of dma_set_coherent_mask() as the
    Switchtec hardware fully supports 64bit addressing and we should set both
    the streaming and coherent masks the same.

    [logang@deltatee.com: reworked commit message]
    Fixes: aff614c6339c ("switchtec: Set DMA coherent mask")
    Link: https://lore.kernel.org/r/20200106190337.2428-2-logang@deltatee.com
    Signed-off-by: Wesley Sheng
    Signed-off-by: Logan Gunthorpe
    Signed-off-by: Bjorn Helgaas

    Wesley Sheng
     

04 Dec, 2019

1 commit

  • Pull PCI updates from Bjorn Helgaas:
    "Enumeration:

    - Warn if a host bridge has no NUMA info (Yunsheng Lin)

    - Add PCI_STD_NUM_BARS for the number of standard BARs (Denis
    Efremov)

    Resource management:

    - Fix boot-time Embedded Controller GPE storm caused by incorrect
    resource assignment after ACPI Bus Check Notification (Mika
    Westerberg)

    - Protect pci_reassign_bridge_resources() against concurrent
    addition/removal (Benjamin Herrenschmidt)

    - Fix bridge dma_ranges resource list cleanup (Rob Herring)

    - Add "pci=hpmmiosize" and "pci=hpmmioprefsize" parameters to control
    the MMIO and prefetchable MMIO window sizes of hotplug bridges
    independently (Nicholas Johnson)

    - Fix MMIO/MMIO_PREF window assignment that assigned more space than
    desired (Nicholas Johnson)

    - Only enforce bus numbers from bridge EA if the bridge has EA
    devices downstream (Subbaraya Sundeep)

    - Consolidate DT "dma-ranges" parsing and convert all host drivers to
    use shared parsing (Rob Herring)

    Error reporting:

    - Restore AER capability after resume (Mayurkumar Patel)

    - Add PoisonTLPBlocked AER counter (Rajat Jain)

    - Use for_each_set_bit() to simplify AER code (Andy Shevchenko)

    - Fix AER kernel-doc (Andy Shevchenko)

    - Add "pcie_ports=dpc-native" parameter to allow native use of DPC
    even if platform didn't grant control over AER (Olof Johansson)

    Hotplug:

    - Avoid returning prematurely from sysfs requests to enable or
    disable a PCIe hotplug slot (Lukas Wunner)

    - Don't disable interrupts twice when suspending hotplug ports (Mika
    Westerberg)

    - Fix deadlocks when PCIe ports are hot-removed while suspended (Mika
    Westerberg)

    Power management:

    - Remove unnecessary ASPM locking (Bjorn Helgaas)

    - Add support for disabling L1 PM Substates (Heiner Kallweit)

    - Allow re-enabling Clock PM after it has been disabled (Heiner
    Kallweit)

    - Add sysfs attributes for controlling ASPM link states (Heiner
    Kallweit)

    - Remove CONFIG_PCIEASPM_DEBUG, including "link_state" and "clk_ctl"
    sysfs files (Heiner Kallweit)

    - Avoid AMD FCH XHCI USB PME# from D0 defect that prevents wakeup on
    USB 2.0 or 1.1 connect events (Kai-Heng Feng)

    - Move power state check out of pci_msi_supported() (Bjorn Helgaas)

    - Fix incorrect MSI-X masking on resume and revert related nvme quirk
    for Kingston NVME SSD running FW E8FK11.T (Jian-Hong Pan)

    - Always return devices to D0 when thawing to fix hibernation with
    drivers like mlx4 that used legacy power management (previously we
    only did it for drivers with new power management ops) (Dexuan Cui)

    - Clear PCIe PME Status even for legacy power management (Bjorn
    Helgaas)

    - Fix PCI PM documentation errors (Bjorn Helgaas)

    - Use dev_printk() for more power management messages (Bjorn Helgaas)

    - Apply D2 delay as milliseconds, not microseconds (Bjorn Helgaas)

    - Convert xen-platform from legacy to generic power management (Bjorn
    Helgaas)

    - Removed unused .resume_early() and .suspend_late() legacy power
    management hooks (Bjorn Helgaas)

    - Rearrange power management code for clarity (Rafael J. Wysocki)

    - Decode power states more clearly ("4" or "D4" really refers to
    "D3cold") (Bjorn Helgaas)

    - Notice when reading PM Control register returns an error (~0)
    instead of interpreting it as being in D3hot (Bjorn Helgaas)

    - Add missing link delays required by the PCIe spec (Mika Westerberg)

    Virtualization:

    - Move pci_prg_resp_pasid_required() to CONFIG_PCI_PRI (Bjorn
    Helgaas)

    - Allow VFs to use PRI (the PF PRI is shared by the VFs, but the code
    previously didn't recognize that) (Kuppuswamy Sathyanarayanan)

    - Allow VFs to use PASID (the PF PASID capability is shared by the
    VFs, but the code previously didn't recognize that) (Kuppuswamy
    Sathyanarayanan)

    - Disconnect PF and VF ATS enablement, since ATS in PFs and
    associated VFs can be enabled independently (Kuppuswamy
    Sathyanarayanan)

    - Cache PRI and PASID capability offsets (Kuppuswamy Sathyanarayanan)

    - Cache the PRI PRG Response PASID Required bit (Bjorn Helgaas)

    - Consolidate ATS declarations in linux/pci-ats.h (Krzysztof
    Wilczynski)

    - Remove unused PRI and PASID stubs (Bjorn Helgaas)

    - Removed unnecessary EXPORT_SYMBOL_GPL() from ATS, PRI, and PASID
    interfaces that are only used by built-in IOMMU drivers (Bjorn
    Helgaas)

    - Hide PRI and PASID state restoration functions used only inside the
    PCI core (Bjorn Helgaas)

    - Add a DMA alias quirk for the Intel VCA NTB (Slawomir Pawlowski)

    - Serialize sysfs sriov_numvfs reads vs writes (Pierre Crégut)

    - Update Cavium ACS quirk for ThunderX2 and ThunderX3 (George
    Cherian)

    - Fix the UPDCR register address in the Intel ACS quirk (Steffen
    Liebergeld)

    - Unify ACS quirk implementations (Bjorn Helgaas)

    Amlogic Meson host bridge driver:

    - Fix meson PERST# GPIO polarity problem (Remi Pommarel)

    - Add DT bindings for Amlogic Meson G12A (Neil Armstrong)

    - Fix meson clock names to match DT bindings (Neil Armstrong)

    - Add meson support for Amlogic G12A SoC with separate shared PHY
    (Neil Armstrong)

    - Add meson extended PCIe PHY functions for Amlogic G12A USB3+PCIe
    combo PHY (Neil Armstrong)

    - Add arm64 DT for Amlogic G12A PCIe controller node (Neil Armstrong)

    - Add commented-out description of VIM3 USB3/PCIe mux in arm64 DT
    (Neil Armstrong)

    Broadcom iProc host bridge driver:

    - Invalidate iProc PAXB address mapping before programming it
    (Abhishek Shah)

    - Fix iproc-msi and mvebu __iomem annotations (Ben Dooks)

    Cadence host bridge driver:

    - Refactor Cadence PCIe host controller to use as a library for both
    host and endpoint (Tom Joseph)

    Freescale Layerscape host bridge driver:

    - Add layerscape LS1028a support (Xiaowei Bao)

    Intel VMD host bridge driver:

    - Add VMD bus 224-255 restriction decode (Jon Derrick)

    - Add VMD 8086:9A0B device ID (Jon Derrick)

    - Remove Keith from VMD maintainer list (Keith Busch)

    Marvell ARMADA 3700 / Aardvark host bridge driver:

    - Use LTSSM state to build link training flag since Aardvark doesn't
    implement the Link Training bit (Remi Pommarel)

    - Delay before training Aardvark link in case PERST# was asserted
    before the driver probe (Remi Pommarel)

    - Fix Aardvark issues with Root Control reads and writes (Remi
    Pommarel)

    - Don't rely on jiffies in Aardvark config access path since
    interrupts may be disabled (Remi Pommarel)

    - Fix Aardvark big-endian support (Grzegorz Jaszczyk)

    Marvell ARMADA 370 / XP host bridge driver:

    - Make mvebu_pci_bridge_emul_ops static (Ben Dooks)

    Microsoft Hyper-V host bridge driver:

    - Add hibernation support for Hyper-V virtual PCI devices (Dexuan
    Cui)

    - Track Hyper-V pci_protocol_version per-hbus, not globally (Dexuan
    Cui)

    - Avoid kmemleak false positive on hv hbus buffer (Dexuan Cui)

    Mobiveil host bridge driver:

    - Change mobiveil csr_read()/write() function names that conflict
    with riscv arch functions (Kefeng Wang)

    NVIDIA Tegra host bridge driver:

    - Fix Tegra CLKREQ dependency programming (Vidya Sagar)

    Renesas R-Car host bridge driver:

    - Remove unnecessary header include from rcar (Andrew Murray)

    - Tighten register index checking for rcar inbound range programming
    (Marek Vasut)

    - Fix rcar inbound range alignment calculation to improve packing of
    multiple entries (Marek Vasut)

    - Update rcar MACCTLR setting to match documentation (Yoshihiro
    Shimoda)

    - Clear bit 0 of MACCTLR before PCIETCTLR.CFINIT per manual
    (Yoshihiro Shimoda)

    - Add Marek Vasut and Yoshihiro Shimoda as R-Car maintainers (Simon
    Horman)

    Rockchip host bridge driver:

    - Make rockchip 0V9 and 1V8 power regulators non-optional (Robin
    Murphy)

    Socionext UniPhier host bridge driver:

    - Set uniphier to host (RC) mode always (Kunihiko Hayashi)

    Endpoint drivers:

    - Fix endpoint driver sign extension problem when shifting page
    number to phys_addr_t (Alan Mikhak)

    Misc:

    - Add NumaChip SPDX header (Krzysztof Wilczynski)

    - Replace EXTRA_CFLAGS with ccflags-y (Krzysztof Wilczynski)

    - Remove unused includes (Krzysztof Wilczynski)

    - Removed unused sysfs attribute groups (Ben Dooks)

    - Remove PTM and ASPM dependencies on PCIEPORTBUS (Bjorn Helgaas)

    - Add PCIe Link Control 2 register field definitions to replace magic
    numbers in AMDGPU and Radeon CIK/SI (Bjorn Helgaas)

    - Fix incorrect Link Control 2 Transmit Margin usage in AMDGPU and
    Radeon CIK/SI PCIe Gen3 link training (Bjorn Helgaas)

    - Use pcie_capability_read_word() instead of pci_read_config_word()
    in AMDGPU and Radeon CIK/SI (Frederick Lawler)

    - Remove unused pci_irq_get_node() Greg Kroah-Hartman)

    - Make asm/msi.h mandatory and simplify PCI_MSI_IRQ_DOMAIN Kconfig
    (Palmer Dabbelt, Michal Simek)

    - Read all 64 bits of Switchtec part_event_bitmap (Logan Gunthorpe)

    - Fix erroneous intel-iommu dependency on CONFIG_AMD_IOMMU (Bjorn
    Helgaas)

    - Fix bridge emulation big-endian support (Grzegorz Jaszczyk)

    - Fix dwc find_next_bit() usage (Niklas Cassel)

    - Fix pcitest.c fd leak (Hewenliang)

    - Fix typos and comments (Bjorn Helgaas)

    - Fix Kconfig whitespace errors (Krzysztof Kozlowski)"

    * tag 'pci-v5.5-changes' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci: (160 commits)
    PCI: Remove PCI_MSI_IRQ_DOMAIN architecture whitelist
    asm-generic: Make msi.h a mandatory include/asm header
    Revert "nvme: Add quirk for Kingston NVME SSD running FW E8FK11.T"
    PCI/MSI: Fix incorrect MSI-X masking on resume
    PCI/MSI: Move power state check out of pci_msi_supported()
    PCI/MSI: Remove unused pci_irq_get_node()
    PCI: hv: Avoid a kmemleak false positive caused by the hbus buffer
    PCI: hv: Change pci_protocol_version to per-hbus
    PCI: hv: Add hibernation support
    PCI: hv: Reorganize the code in preparation of hibernation
    MAINTAINERS: Remove Keith from VMD maintainer
    PCI/ASPM: Remove PCIEASPM_DEBUG Kconfig option and related code
    PCI/ASPM: Add sysfs attributes for controlling ASPM link states
    PCI: Fix indentation
    drm/radeon: Prefer pcie_capability_read_word()
    drm/radeon: Replace numbers with PCI_EXP_LNKCTL2 definitions
    drm/radeon: Correct Transmit Margin masks
    drm/amdgpu: Prefer pcie_capability_read_word()
    PCI: uniphier: Set mode register to host mode
    drm/amdgpu: Replace numbers with PCI_EXP_LNKCTL2 definitions
    ...

    Linus Torvalds
     

23 Oct, 2019

1 commit

  • The .ioctl and .compat_ioctl file operations have the same prototype so
    they can both point to the same function, which works great almost all
    the time when all the commands are compatible.

    One exception is the s390 architecture, where a compat pointer is only
    31 bit wide, and converting it into a 64-bit pointer requires calling
    compat_ptr(). Most drivers here will never run in s390, but since we now
    have a generic helper for it, it's easy enough to use it consistently.

    I double-checked all these drivers to ensure that all ioctl arguments
    are used as pointers or are ignored, but are not interpreted as integer
    values.

    Acked-by: Jason Gunthorpe
    Acked-by: Daniel Vetter
    Acked-by: Mauro Carvalho Chehab
    Acked-by: Greg Kroah-Hartman
    Acked-by: David Sterba
    Acked-by: Darren Hart (VMware)
    Acked-by: Jonathan Cameron
    Acked-by: Bjorn Andersson
    Acked-by: Dan Williams
    Signed-off-by: Arnd Bergmann

    Arnd Bergmann
     

01 Oct, 2019

1 commit

  • The part_event_bitmap register is 64 bits wide, so read it with ioread64()
    instead of the 32-bit ioread32().

    Fixes: 52eabba5bcdb ("switchtec: Add IOCTLs to the Switchtec driver")
    Link: https://lore.kernel.org/r/20190910195833.3891-1-logang@deltatee.com
    Reported-by: Doug Meyer
    Signed-off-by: Logan Gunthorpe
    Signed-off-by: Bjorn Helgaas
    Cc: stable@vger.kernel.org # v4.12+
    Cc: Kelvin Cao

    Logan Gunthorpe
     

22 Jul, 2019

1 commit

  • Pull NTB updates from Jon Mason:
    "New feature to add support for NTB virtual MSI interrupts, the ability
    to test and use this feature in the NTB transport layer.

    Also, bug fixes for the AMD and Switchtec drivers, as well as some
    general patches"

    * tag 'ntb-5.3' of git://github.com/jonmason/ntb: (22 commits)
    NTB: Describe the ntb_msi_test client in the documentation.
    NTB: Add MSI interrupt support to ntb_transport
    NTB: Add ntb_msi_test support to ntb_test
    NTB: Introduce NTB MSI Test Client
    NTB: Introduce MSI library
    NTB: Rename ntb.c to support multiple source files in the module
    NTB: Introduce functions to calculate multi-port resource index
    NTB: Introduce helper functions to calculate logical port number
    PCI/switchtec: Add module parameter to request more interrupts
    PCI/MSI: Support allocating virtual MSI interrupts
    ntb_hw_switchtec: Fix setup MW with failure bug
    ntb_hw_switchtec: Skip unnecessary re-setup of shared memory window for crosslink case
    ntb_hw_switchtec: Remove redundant steps of switchtec_ntb_reinit_peer() function
    NTB: correct ntb_dev_ops and ntb_dev comment typos
    NTB: amd: Silence shift wrapping warning in amd_ntb_db_vector_mask()
    ntb_hw_switchtec: potential shift wrapping bug in switchtec_ntb_init_sndev()
    NTB: ntb_transport: Ensure qp->tx_mw_dma_addr is initaliazed
    NTB: ntb_hw_amd: set peer limit register
    NTB: ntb_perf: Clear stale values in doorbell and command SPAD register
    NTB: ntb_perf: Disable NTB link after clearing peer XLAT registers
    ...

    Linus Torvalds
     

15 Jul, 2019

1 commit


13 Jun, 2019

1 commit

  • Seeing the we want to use more interrupts in the NTB MSI code
    we need to be able allocate more (sometimes virtual) interrupts
    in the switchtec driver. Therefore add a module parameter to
    request to allocate additional interrupts.

    This puts virtually no limit on the number of MSI interrupts available
    to NTB clients.

    Signed-off-by: Logan Gunthorpe
    Cc: Bjorn Helgaas
    Signed-off-by: Jon Mason

    Logan Gunthorpe
     

15 May, 2019

1 commit

  • Pull PCI updates from Bjorn Helgaas:
    "Enumeration changes:

    - Add _HPX Type 3 settings support, which gives firmware more
    influence over device configuration (Alexandru Gagniuc)

    - Support fixed bus numbers from bridge Enhanced Allocation
    capabilities (Subbaraya Sundeep)

    - Add "external-facing" DT property to identify cases where we
    require IOMMU protection against untrusted devices (Jean-Philippe
    Brucker)

    - Enable PCIe services for host controller drivers that use managed
    host bridge alloc (Jean-Philippe Brucker)

    - Log PCIe port service messages with pci_dev, not the pcie_device
    (Frederick Lawler)

    - Convert pciehp from pciehp_debug module parameter to generic
    dynamic debug (Frederick Lawler)

    Peer-to-peer DMA:

    - Add whitelist of Root Complexes that support peer-to-peer DMA
    between Root Ports (Christian König)

    Native controller drivers:

    - Add PCI host bridge DMA ranges for bridges that can't DMA
    everywhere, e.g., iProc (Srinath Mannam)

    - Add Amazon Annapurna Labs PCIe host controller driver (Jonathan
    Chocron)

    - Fix Tegra MSI target allocation so DMA doesn't generate unwanted
    MSIs (Vidya Sagar)

    - Fix of_node reference leaks (Wen Yang)

    - Fix Hyper-V module unload & device removal issues (Dexuan Cui)

    - Cleanup R-Car driver (Marek Vasut)

    - Cleanup Keystone driver (Kishon Vijay Abraham I)

    - Cleanup i.MX6 driver (Andrey Smirnov)

    Significant bug fixes:

    - Reset Lenovo ThinkPad P50 GPU so nouveau works after reboot (Lyude
    Paul)

    - Fix Switchtec firmware update performance issue (Wesley Sheng)

    - Work around Pericom switch link retraining erratum (Stefan Mätje)"

    * tag 'pci-v5.2-changes' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci: (141 commits)
    MAINTAINERS: Add Karthikeyan Mitran and Hou Zhiqiang for Mobiveil PCI
    PCI: pciehp: Remove pointless MY_NAME definition
    PCI: pciehp: Remove pointless PCIE_MODULE_NAME definition
    PCI: pciehp: Remove unused dbg/err/info/warn() wrappers
    PCI: pciehp: Log messages with pci_dev, not pcie_device
    PCI: pciehp: Replace pciehp_debug module param with dyndbg
    PCI: pciehp: Remove pciehp_debug uses
    PCI/AER: Log messages with pci_dev, not pcie_device
    PCI/DPC: Log messages with pci_dev, not pcie_device
    PCI/PME: Replace dev_printk(KERN_DEBUG) with dev_info()
    PCI/AER: Replace dev_printk(KERN_DEBUG) with dev_info()
    PCI: Replace dev_printk(KERN_DEBUG) with dev_info(), etc
    PCI: Replace printk(KERN_INFO) with pr_info(), etc
    PCI: Use dev_printk() when possible
    PCI: Cleanup setup-bus.c comments and whitespace
    PCI: imx6: Allow asynchronous probing
    PCI: dwc: Save root bus for driver remove hooks
    PCI: dwc: Use devm_pci_alloc_host_bridge() to simplify code
    PCI: dwc: Free MSI in dw_pcie_host_init() error path
    PCI: dwc: Free MSI IRQ page in dw_pcie_free_msi()
    ...

    Linus Torvalds
     

06 May, 2019

1 commit

  • Using scripts/coccinelle/api/stream_open.cocci added in 10dce8af3422
    ("fs: stream_open - opener for stream-like files so that read and write
    can run simultaneously without deadlock"), search and convert to
    stream_open all in-kernel nonseekable_open users for which read and
    write actually do not depend on ppos and where there is no other methods
    in file_operations which assume @offset access.

    I've verified each generated change manually - that it is correct to convert -
    and each other nonseekable_open instance left - that it is either not correct
    to convert there, or that it is not converted due to current stream_open.cocci
    limitations. The script also does not convert files that should be valid to
    convert, but that currently have .llseek = noop_llseek or generic_file_llseek
    for unknown reason despite file being opened with nonseekable_open (e.g.
    drivers/input/mousedev.c)

    Among cases converted 14 were potentially vulnerable to read vs write deadlock
    (see details in 10dce8af3422):

    drivers/char/pcmcia/cm4000_cs.c:1685:7-23: ERROR: cm4000_fops: .read() can deadlock .write(); change nonseekable_open -> stream_open to fix.
    drivers/gnss/core.c:45:1-17: ERROR: gnss_fops: .read() can deadlock .write(); change nonseekable_open -> stream_open to fix.
    drivers/hid/uhid.c:635:1-17: ERROR: uhid_fops: .read() can deadlock .write(); change nonseekable_open -> stream_open to fix.
    drivers/infiniband/core/user_mad.c:988:1-17: ERROR: umad_fops: .read() can deadlock .write(); change nonseekable_open -> stream_open to fix.
    drivers/input/evdev.c:527:1-17: ERROR: evdev_fops: .read() can deadlock .write(); change nonseekable_open -> stream_open to fix.
    drivers/input/misc/uinput.c:401:1-17: ERROR: uinput_fops: .read() can deadlock .write(); change nonseekable_open -> stream_open to fix.
    drivers/isdn/capi/capi.c:963:8-24: ERROR: capi_fops: .read() can deadlock .write(); change nonseekable_open -> stream_open to fix.
    drivers/leds/uleds.c:77:1-17: ERROR: uleds_fops: .read() can deadlock .write(); change nonseekable_open -> stream_open to fix.
    drivers/media/rc/lirc_dev.c:198:1-17: ERROR: lirc_fops: .read() can deadlock .write(); change nonseekable_open -> stream_open to fix.
    drivers/s390/char/fs3270.c:488:1-17: ERROR: fs3270_fops: .read() can deadlock .write(); change nonseekable_open -> stream_open to fix.
    drivers/usb/misc/ldusb.c:310:1-17: ERROR: ld_usb_fops: .read() can deadlock .write(); change nonseekable_open -> stream_open to fix.
    drivers/xen/evtchn.c:667:8-24: ERROR: evtchn_fops: .read() can deadlock .write(); change nonseekable_open -> stream_open to fix.
    net/batman-adv/icmp_socket.c:80:1-17: ERROR: batadv_fops: .read() can deadlock .write(); change nonseekable_open -> stream_open to fix.
    net/rfkill/core.c:1146:8-24: ERROR: rfkill_fops: .read() can deadlock .write(); change nonseekable_open -> stream_open to fix.

    and the rest were just safe to convert to stream_open because their read and
    write do not use ppos at all and corresponding file_operations do not
    have methods that assume @offset file access(*):

    arch/powerpc/platforms/52xx/mpc52xx_gpt.c:631:8-24: WARNING: mpc52xx_wdt_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    arch/powerpc/platforms/cell/spufs/file.c:591:8-24: WARNING: spufs_ibox_fops: .read() has stream semantic; safe to change nonseekable_open -> stream_open.
    arch/powerpc/platforms/cell/spufs/file.c:591:8-24: WARNING: spufs_ibox_stat_fops: .read() has stream semantic; safe to change nonseekable_open -> stream_open.
    arch/powerpc/platforms/cell/spufs/file.c:591:8-24: WARNING: spufs_mbox_fops: .read() has stream semantic; safe to change nonseekable_open -> stream_open.
    arch/powerpc/platforms/cell/spufs/file.c:591:8-24: WARNING: spufs_mbox_stat_fops: .read() has stream semantic; safe to change nonseekable_open -> stream_open.
    arch/powerpc/platforms/cell/spufs/file.c:591:8-24: WARNING: spufs_wbox_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    arch/powerpc/platforms/cell/spufs/file.c:591:8-24: WARNING: spufs_wbox_stat_fops: .read() has stream semantic; safe to change nonseekable_open -> stream_open.
    arch/um/drivers/harddog_kern.c:88:8-24: WARNING: harddog_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    arch/x86/kernel/cpu/microcode/core.c:430:33-49: WARNING: microcode_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/char/ds1620.c:215:8-24: WARNING: ds1620_fops: .read() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/char/dtlk.c:301:1-17: WARNING: dtlk_fops: .read() and .write() have stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/char/ipmi/ipmi_watchdog.c:840:9-25: WARNING: ipmi_wdog_fops: .read() and .write() have stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/char/pcmcia/scr24x_cs.c:95:8-24: WARNING: scr24x_fops: .read() and .write() have stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/char/tb0219.c:246:9-25: WARNING: tb0219_fops: .read() and .write() have stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/firewire/nosy.c:306:8-24: WARNING: nosy_ops: .read() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/hwmon/fschmd.c:840:8-24: WARNING: watchdog_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/hwmon/w83793.c:1344:8-24: WARNING: watchdog_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/infiniband/core/ucma.c:1747:8-24: WARNING: ucma_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/infiniband/core/ucm.c:1178:8-24: WARNING: ucm_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/infiniband/core/uverbs_main.c:1086:8-24: WARNING: uverbs_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/input/joydev.c:282:1-17: WARNING: joydev_fops: .read() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/pci/switch/switchtec.c:393:1-17: WARNING: switchtec_fops: .read() and .write() have stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/platform/chrome/cros_ec_debugfs.c:135:8-24: WARNING: cros_ec_console_log_fops: .read() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/rtc/rtc-ds1374.c:470:9-25: WARNING: ds1374_wdt_fops: .read() and .write() have stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/rtc/rtc-m41t80.c:805:9-25: WARNING: wdt_fops: .read() and .write() have stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/s390/char/tape_char.c:293:2-18: WARNING: tape_fops: .read() and .write() have stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/s390/char/zcore.c:194:8-24: WARNING: zcore_reipl_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/s390/crypto/zcrypt_api.c:528:8-24: WARNING: zcrypt_fops: .read() and .write() have stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/spi/spidev.c:594:1-17: WARNING: spidev_fops: .read() and .write() have stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/staging/pi433/pi433_if.c:974:1-17: WARNING: pi433_fops: .read() and .write() have stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/acquirewdt.c:203:8-24: WARNING: acq_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/advantechwdt.c:202:8-24: WARNING: advwdt_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/alim1535_wdt.c:252:8-24: WARNING: ali_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/alim7101_wdt.c:217:8-24: WARNING: wdt_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/ar7_wdt.c:166:8-24: WARNING: ar7_wdt_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/at91rm9200_wdt.c:113:8-24: WARNING: at91wdt_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/ath79_wdt.c:135:8-24: WARNING: ath79_wdt_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/bcm63xx_wdt.c:119:8-24: WARNING: bcm63xx_wdt_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/cpu5wdt.c:143:8-24: WARNING: cpu5wdt_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/cpwd.c:397:8-24: WARNING: cpwd_fops: .read() and .write() have stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/eurotechwdt.c:319:8-24: WARNING: eurwdt_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/f71808e_wdt.c:528:8-24: WARNING: watchdog_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/gef_wdt.c:232:8-24: WARNING: gef_wdt_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/geodewdt.c:95:8-24: WARNING: geodewdt_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/ib700wdt.c:241:8-24: WARNING: ibwdt_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/ibmasr.c:326:8-24: WARNING: asr_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/indydog.c:80:8-24: WARNING: indydog_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/intel_scu_watchdog.c:307:8-24: WARNING: intel_scu_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/iop_wdt.c:104:8-24: WARNING: iop_wdt_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/it8712f_wdt.c:330:8-24: WARNING: it8712f_wdt_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/ixp4xx_wdt.c:68:8-24: WARNING: ixp4xx_wdt_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/ks8695_wdt.c:145:8-24: WARNING: ks8695wdt_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/m54xx_wdt.c:88:8-24: WARNING: m54xx_wdt_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/machzwd.c:336:8-24: WARNING: zf_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/mixcomwd.c:153:8-24: WARNING: mixcomwd_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/mtx-1_wdt.c:121:8-24: WARNING: mtx1_wdt_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/mv64x60_wdt.c:136:8-24: WARNING: mv64x60_wdt_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/nuc900_wdt.c:134:8-24: WARNING: nuc900wdt_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/nv_tco.c:164:8-24: WARNING: nv_tco_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/pc87413_wdt.c:289:8-24: WARNING: pc87413_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/pcwd.c:698:8-24: WARNING: pcwd_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/pcwd.c:737:8-24: WARNING: pcwd_temp_fops: .read() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/pcwd_pci.c:581:8-24: WARNING: pcipcwd_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/pcwd_pci.c:623:8-24: WARNING: pcipcwd_temp_fops: .read() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/pcwd_usb.c:488:8-24: WARNING: usb_pcwd_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/pcwd_usb.c:527:8-24: WARNING: usb_pcwd_temperature_fops: .read() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/pika_wdt.c:121:8-24: WARNING: pikawdt_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/pnx833x_wdt.c:119:8-24: WARNING: pnx833x_wdt_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/rc32434_wdt.c:153:8-24: WARNING: rc32434_wdt_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/rdc321x_wdt.c:145:8-24: WARNING: rdc321x_wdt_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/riowd.c:79:1-17: WARNING: riowd_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/sa1100_wdt.c:62:8-24: WARNING: sa1100dog_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/sbc60xxwdt.c:211:8-24: WARNING: wdt_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/sbc7240_wdt.c:139:8-24: WARNING: wdt_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/sbc8360.c:274:8-24: WARNING: sbc8360_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/sbc_epx_c3.c:81:8-24: WARNING: epx_c3_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/sbc_fitpc2_wdt.c:78:8-24: WARNING: fitpc2_wdt_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/sb_wdog.c:108:1-17: WARNING: sbwdog_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/sc1200wdt.c:181:8-24: WARNING: sc1200wdt_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/sc520_wdt.c:261:8-24: WARNING: wdt_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/sch311x_wdt.c:319:8-24: WARNING: sch311x_wdt_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/scx200_wdt.c:105:8-24: WARNING: scx200_wdt_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/smsc37b787_wdt.c:369:8-24: WARNING: wb_smsc_wdt_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/w83877f_wdt.c:227:8-24: WARNING: wdt_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/w83977f_wdt.c:301:8-24: WARNING: wdt_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/wafer5823wdt.c:200:8-24: WARNING: wafwdt_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/watchdog_dev.c:828:8-24: WARNING: watchdog_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/wdrtas.c:379:8-24: WARNING: wdrtas_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/wdrtas.c:445:8-24: WARNING: wdrtas_temp_fops: .read() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/wdt285.c:104:1-17: WARNING: watchdog_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/wdt977.c:276:8-24: WARNING: wdt977_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/wdt.c:424:8-24: WARNING: wdt_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/wdt.c:484:8-24: WARNING: wdt_temp_fops: .read() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/wdt_pci.c:464:8-24: WARNING: wdtpci_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
    drivers/watchdog/wdt_pci.c:527:8-24: WARNING: wdtpci_temp_fops: .read() has stream semantic; safe to change nonseekable_open -> stream_open.
    net/batman-adv/log.c:105:1-17: WARNING: batadv_log_fops: .read() has stream semantic; safe to change nonseekable_open -> stream_open.
    sound/core/control.c:57:7-23: WARNING: snd_ctl_f_ops: .read() has stream semantic; safe to change nonseekable_open -> stream_open.
    sound/core/rawmidi.c:385:7-23: WARNING: snd_rawmidi_f_ops: .read() and .write() have stream semantic; safe to change nonseekable_open -> stream_open.
    sound/core/seq/seq_clientmgr.c:310:7-23: WARNING: snd_seq_f_ops: .read() and .write() have stream semantic; safe to change nonseekable_open -> stream_open.
    sound/core/timer.c:1428:7-23: WARNING: snd_timer_f_ops: .read() has stream semantic; safe to change nonseekable_open -> stream_open.

    One can also recheck/review the patch via generating it with explanation comments included via

    $ make coccicheck MODE=patch COCCI=scripts/coccinelle/api/stream_open.cocci SPFLAGS="-D explain"

    (*) This second group also contains cases with read/write deadlocks that
    stream_open.cocci don't yet detect, but which are still valid to convert to
    stream_open since ppos is not used. For example drivers/pci/switch/switchtec.c
    calls wait_for_completion_interruptible() in its .read, but stream_open.cocci
    currently detects only "wait_event*" as blocking.

    Cc: Michael Kerrisk
    Cc: Yongzhi Pan
    Cc: Jonathan Corbet
    Cc: David Vrabel
    Cc: Juergen Gross
    Cc: Miklos Szeredi
    Cc: Tejun Heo
    Cc: Kirill Tkhai
    Cc: Arnd Bergmann
    Cc: Christoph Hellwig
    Cc: Greg Kroah-Hartman
    Cc: Julia Lawall
    Cc: Nikolaus Rath
    Cc: Han-Wen Nienhuys
    Cc: Anatolij Gustschin
    Cc: Jeff Dike
    Cc: Richard Weinberger
    Cc: Anton Ivanov
    Cc: Borislav Petkov
    Cc: Thomas Gleixner
    Cc: Ingo Molnar
    Cc: "James R. Van Zandt"
    Cc: Corey Minyard
    Cc: Harald Welte
    Acked-by: Lubomir Rintel [scr24x_cs]
    Cc: Stefan Richter
    Cc: Johan Hovold
    Cc: David Herrmann
    Cc: Jiri Kosina
    Cc: Benjamin Tissoires
    Cc: Jean Delvare
    Acked-by: Guenter Roeck [watchdog/* hwmon/*]
    Cc: Rudolf Marek
    Cc: Dmitry Torokhov
    Cc: Karsten Keil
    Cc: Jacek Anaszewski
    Cc: Pavel Machek
    Cc: Mauro Carvalho Chehab
    Cc: Kurt Schwemmer
    Acked-by: Logan Gunthorpe [drivers/pci/switch/switchtec]
    Acked-by: Bjorn Helgaas [drivers/pci/switch/switchtec]
    Cc: Benson Leung
    Acked-by: Enric Balletbo i Serra [platform/chrome]
    Cc: Alessandro Zummo
    Acked-by: Alexandre Belloni [rtc/*]
    Cc: Mark Brown
    Cc: Wim Van Sebroeck
    Cc: Florian Fainelli
    Cc: bcm-kernel-feedback-list@broadcom.com
    Cc: Wan ZongShun
    Cc: Zwane Mwaikambo
    Cc: Marek Lindner
    Cc: Simon Wunderlich
    Cc: Antonio Quartulli
    Cc: "David S. Miller"
    Cc: Johannes Berg
    Cc: Jaroslav Kysela
    Cc: Takashi Iwai
    Signed-off-by: Kirill Smelkov

    Kirill Smelkov
     

18 Apr, 2019

2 commits

  • When running application tool switchtec-user's `firmware update` and `event
    wait` commands concurrently, sometimes the firmware update speed reduced
    significantly.

    It is because when the MRPC event happened after MRPC event occurrence
    check but before the event mask loop reaches its header register in event
    ISR, the MRPC event would be masked unintentionally. Since there's no
    chance to enable it again except for a module reload, all the following
    MRPC execution completion checks time out.

    Fix this bug by skipping the mask operation for MRPC event in event ISR,
    same as what we already do for LINK event.

    Fixes: 52eabba5bcdb ("switchtec: Add IOCTLs to the Switchtec driver")
    Signed-off-by: Wesley Sheng
    Signed-off-by: Bjorn Helgaas
    Reviewed-by: Logan Gunthorpe

    Wesley Sheng
     
  • The Switchtec devices supports two PCIe Function Frameworks (PFFs) per
    upstream port (one for the port itself and one for the management endoint),
    and each PFF may have up to 255 ports. Previously the driver only
    supported 48 of those ports, and the SWITCHTEC_IOCTL_EVENT_SUMMARY ioctl
    only returned information about those 48.

    Increase SWITCHTEC_MAX_PFF_CSR from 48 to 255 so the driver supports all
    255 possible ports.

    Rename SWITCHTEC_IOCTL_EVENT_SUMMARY and associated struct
    switchtec_ioctl_event_summary to SWITCHTEC_IOCTL_EVENT_SUMMARY_LEGACY and
    switchtec_ioctl_event_summary_legacy with so existing applications work
    unchanged, supporting up to 48 ports.

    Add replacement SWITCHTEC_IOCTL_EVENT_SUMMARY and struct
    switchtec_ioctl_event_summary that new and recompiled applications support
    up to 255 ports.

    Signed-off-by: Wesley Sheng
    [bhelgaas: changelog]
    Signed-off-by: Bjorn Helgaas
    Reviewed-by: Logan Gunthorpe

    Wesley Sheng
     

08 Jan, 2019

1 commit

  • We already need to zero out memory for dma_alloc_coherent(), as such
    using dma_zalloc_coherent() is superflous. Phase it out.

    This change was generated with the following Coccinelle SmPL patch:

    @ replace_dma_zalloc_coherent @
    expression dev, size, data, handle, flags;
    @@

    -dma_zalloc_coherent(dev, size, handle, flags)
    +dma_alloc_coherent(dev, size, handle, flags)

    Suggested-by: Christoph Hellwig
    Signed-off-by: Luis Chamberlain
    [hch: re-ran the script on the latest tree]
    Signed-off-by: Christoph Hellwig

    Luis Chamberlain
     

13 Dec, 2018

5 commits

  • MRPC normal mode requires the host to read the MRPC command status and
    output data from BAR. This results in high latency responses from the
    Memory Read TLP and potential Completion Timeout (CTO).

    Add support for MRPC DMA mode, including related macro definitions and data
    structures and code to:

    * Retrieve MRPC DMA mode version from adapter firmware
    * Allocate DMA buffer, register ISR, and enable DMA during init
    * Check MRPC execution status and get execution results from DMA buffer
    * Release DMA buffer and disable DMA function when unloading module

    MRPC DMA mode is a new feature of firmware, and the driver will fall back
    to MRPC normal mode if there is no support in the legacy firmware.

    Add a module parameter, "use_dma_mrpc", to select between MRPC DMA mode and
    MRPC normal mode. Since the driver automatically detects DMA support in
    the firmware, this parameter is just for debugging and testing.

    Include so that readq/writeq is replaced by
    two readl/writel on systems that do not support it.

    Signed-off-by: Wesley Sheng
    [bhelgaas: changelog, simplify dma_ver check]
    Signed-off-by: Bjorn Helgaas
    Reviewed-by: Logan Gunthorpe

    Wesley Sheng
     
  • The MRPC Input buffer is mostly memory without any side effects, so we
    can improve the access time by enabling write combining on this region
    of the BAR.

    In a few places, we still need to flush the WC buffer. To do this, we
    simply read from the Outbound Doorbell register because reads to this
    register are processed by low latency hardware.

    Signed-off-by: Kelvin Cao
    Signed-off-by: Wesley Sheng
    Signed-off-by: Bjorn Helgaas
    Reviewed-by: Logan Gunthorpe

    Kelvin Cao
     
  • In the ioctl_event_ctl() SWITCHTEC_IOCTL_EVENT_IDX_ALL case, we call
    event_ctl() several times with the same "ctl" struct. Each call clobbers
    ctl.flags, which leads to the problem that we may not actually enable or
    disable all events as the user requested.

    Preserve the event flag value with a temporary variable.

    Fixes: 52eabba5bcdb ("switchtec: Add IOCTLs to the Switchtec driver")
    Signed-off-by: Joey Zhang
    Signed-off-by: Wesley Sheng
    [bhelgaas: changelog]
    Signed-off-by: Bjorn Helgaas
    Reviewed-by: Logan Gunthorpe

    Joey Zhang
     
  • Switchtec hardware supports 64-bit DMA, so set the correct DMA mask. This
    allows the CMA to allocate larger buffers for memory windows.

    Signed-off-by: Boris Glimcher
    Signed-off-by: Wesley Sheng
    Signed-off-by: Bjorn Helgaas
    Reviewed-by: Logan Gunthorpe

    Boris Glimcher
     
  • After submitting a Firmware Download MRPC command, Switchtec firmware will
    delay Management EP BAR MemRd TLP responses by more than 10ms. This is a
    firmware limitation. Delayed MemRd completions are a problem for systems
    with a low Completion Timeout (CTO).

    The current driver checks the MRPC status immediately after submitting an
    MRPC command, which results in a delayed MemRd completion that may cause a
    Completion Timeout.

    Remove the immediate status check and rely on the check after receiving an
    interrupt or timing out.

    This is only a software workaround to the READ issue and a proper fix of
    this should be done in firmware.

    Fixes: 080b47def5e5 ("MicroSemi Switchtec management interface driver")
    Signed-off-by: Kelvin Cao
    Signed-off-by: Wesley Sheng
    Signed-off-by: Bjorn Helgaas
    Reviewed-by: Logan Gunthorpe

    Kelvin Cao
     

11 Sep, 2018

1 commit

  • p.port can is indirectly controlled by user-space, hence leading to
    a potential exploitation of the Spectre variant 1 vulnerability.

    This issue was detected with the help of Smatch:

    drivers/pci/switch/switchtec.c:912 ioctl_port_to_pff() warn: potential spectre issue 'pcfg->dsp_pff_inst_id' [r]

    Fix this by sanitizing p.port before using it to index
    pcfg->dsp_pff_inst_id

    Notice that given that speculation windows are large, the policy is to kill
    the speculation on the first load and not worry if it can be completed with
    a dependent load/store [1].

    [1] https://marc.info/?l=linux-kernel&m=152449131114778&w=2

    Signed-off-by: Gustavo A. R. Silva
    Signed-off-by: Bjorn Helgaas
    Acked-by: Logan Gunthorpe
    Cc: stable@vger.kernel.org

    Gustavo A. R. Silva
     

30 Jun, 2018

1 commit

  • Move the Microsemi Switchtec PCI Vendor ID (same as
    PCI_VENDOR_ID_PMC_Sierra) to pci_ids.h. Also, replace Microsemi class
    constants with the standard PCI definitions.

    Signed-off-by: Doug Meyer
    [bhelgaas: restore SPDX (I assume it was removed by mistake), remove
    device ID definitions]
    Signed-off-by: Bjorn Helgaas
    Reviewed-by: Logan Gunthorpe

    Doug Meyer
     

12 Feb, 2018

1 commit

  • This is the mindless scripted replacement of kernel use of POLL*
    variables as described by Al, done by this script:

    for V in IN OUT PRI ERR RDNORM RDBAND WRNORM WRBAND HUP RDHUP NVAL MSG; do
    L=`git grep -l -w POLL$V | grep -v '^t' | grep -v /um/ | grep -v '^sa' | grep -v '/poll.h$'|grep -v '^D'`
    for f in $L; do sed -i "-es/^\([^\"]*\)\(\\)/\\1E\\2/" $f; done
    done

    with de-mangling cleanups yet to come.

    NOTE! On almost all architectures, the EPOLL* constants have the same
    values as the POLL* constants do. But they keyword here is "almost".
    For various bad reasons they aren't the same, and epoll() doesn't
    actually work quite correctly in some cases due to this on Sparc et al.

    The next patch from Al will sort out the final differences, and we
    should be all done.

    Scripted-by: Al Viro
    Signed-off-by: Linus Torvalds

    Linus Torvalds
     

07 Feb, 2018

1 commit

  • Pull PCI updates from Bjorn Helgaas:

    - skip AER driver error recovery callbacks for correctable errors
    reported via ACPI APEI, as we already do for errors reported via the
    native path (Tyler Baicar)

    - fix DPC shared interrupt handling (Alex Williamson)

    - print full DPC interrupt number (Keith Busch)

    - enable DPC only if AER is available (Keith Busch)

    - simplify DPC code (Bjorn Helgaas)

    - calculate ASPM L1 substate parameter instead of hardcoding it (Bjorn
    Helgaas)

    - enable Latency Tolerance Reporting for ASPM L1 substates (Bjorn
    Helgaas)

    - move ASPM internal interfaces out of public header (Bjorn Helgaas)

    - allow hot-removal of VGA devices (Mika Westerberg)

    - speed up unplug and shutdown by assuming Thunderbolt controllers
    don't support Command Completed events (Lukas Wunner)

    - add AtomicOps support for GPU and Infiniband drivers (Felix Kuehling,
    Jay Cornwall)

    - expose "ari_enabled" in sysfs to help NIC naming (Stuart Hayes)

    - clean up PCI DMA interface usage (Christoph Hellwig)

    - remove PCI pool API (replaced with DMA pool) (Romain Perier)

    - deprecate pci_get_bus_and_slot(), which assumed PCI domain 0 (Sinan
    Kaya)

    - move DT PCI code from drivers/of/ to drivers/pci/ (Rob Herring)

    - add PCI-specific wrappers for dev_info(), etc (Frederick Lawler)

    - remove warnings on sysfs mmap failure (Bjorn Helgaas)

    - quiet ROM validation messages (Alex Deucher)

    - remove redundant memory alloc failure messages (Markus Elfring)

    - fill in types for compile-time VGA and other I/O port resources
    (Bjorn Helgaas)

    - make "pci=pcie_scan_all" work for Root Ports as well as Downstream
    Ports to help AmigaOne X1000 (Bjorn Helgaas)

    - add SPDX tags to all PCI files (Bjorn Helgaas)

    - quirk Marvell 9128 DMA aliases (Alex Williamson)

    - quirk broken INTx disable on Ceton InfiniTV4 (Bjorn Helgaas)

    - fix CONFIG_PCI=n build by adding dummy pci_irqd_intx_xlate() (Niklas
    Cassel)

    - use DMA API to get MSI address for DesignWare IP (Niklas Cassel)

    - fix endpoint-mode DMA mask configuration (Kishon Vijay Abraham I)

    - fix ARTPEC-6 incorrect IS_ERR() usage (Wei Yongjun)

    - add support for ARTPEC-7 SoC (Niklas Cassel)

    - add endpoint-mode support for ARTPEC (Niklas Cassel)

    - add Cadence PCIe host and endpoint controller driver (Cyrille
    Pitchen)

    - handle multiple INTx status bits being set in dra7xx (Vignesh R)

    - translate dra7xx hwirq range to fix INTD handling (Vignesh R)

    - remove deprecated Exynos PHY initialization code (Jaehoon Chung)

    - fix MSI erratum workaround for HiSilicon Hip06/Hip07 (Dongdong Liu)

    - fix NULL pointer dereference in iProc BCMA driver (Ray Jui)

    - fix Keystone interrupt-controller-node lookup (Johan Hovold)

    - constify qcom driver structures (Julia Lawall)

    - rework Tegra config space mapping to increase space available for
    endpoints (Vidya Sagar)

    - simplify Tegra driver by using bus->sysdata (Manikanta Maddireddy)

    - remove PCI_REASSIGN_ALL_BUS usage on Tegra (Manikanta Maddireddy)

    - add support for Global Fabric Manager Server (GFMS) event to
    Microsemi Switchtec switch driver (Logan Gunthorpe)

    - add IDs for Switchtec PSX 24xG3 and PSX 48xG3 (Kelvin Cao)

    * tag 'pci-v4.16-changes' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci: (140 commits)
    PCI: cadence: Add EndPoint Controller driver for Cadence PCIe controller
    dt-bindings: PCI: cadence: Add DT bindings for Cadence PCIe endpoint controller
    PCI: endpoint: Fix EPF device name to support multi-function devices
    PCI: endpoint: Add the function number as argument to EPC ops
    PCI: cadence: Add host driver for Cadence PCIe controller
    dt-bindings: PCI: cadence: Add DT bindings for Cadence PCIe host controller
    PCI: Add vendor ID for Cadence
    PCI: Add generic function to probe PCI host controllers
    PCI: generic: fix missing call of pci_free_resource_list()
    PCI: OF: Add generic function to parse and allocate PCI resources
    PCI: Regroup all PCI related entries into drivers/pci/Makefile
    PCI/DPC: Reformat DPC register definitions
    PCI/DPC: Add and use DPC Status register field definitions
    PCI/DPC: Squash dpc_rp_pio_get_info() into dpc_process_rp_pio_error()
    PCI/DPC: Remove unnecessary RP PIO register structs
    PCI/DPC: Push dpc->rp_pio_status assignment into dpc_rp_pio_get_info()
    PCI/DPC: Squash dpc_rp_pio_print_error() into dpc_rp_pio_get_info()
    PCI/DPC: Make RP PIO log size check more generic
    PCI/DPC: Rename local "status" to "dpc_status"
    PCI/DPC: Squash dpc_rp_pio_print_tlp_header() into dpc_rp_pio_print_error()
    ...

    Linus Torvalds
     

02 Feb, 2018

1 commit

  • * pci/spdx:
    PCI: Add SPDX GPL-2.0+ to replace implicit GPL v2 or later statement
    PCI: Add SPDX GPL-2.0+ to replace GPL v2 or later boilerplate
    PCI: Add SPDX GPL-2.0 to replace COPYING boilerplate
    PCI: Add SPDX GPL-2.0 to replace GPL v2 boilerplate
    PCI: Add SPDX GPL-2.0 when no license was specified

    Bjorn Helgaas
     

29 Jan, 2018

1 commit

  • Add SPDX GPL-2.0 to all PCI files that specified the GPL version 2 license.

    Remove the boilerplate GPL version 2 language, relying on the assertion in
    b24413180f56 ("License cleanup: add SPDX GPL-2.0 license identifier to
    files with no license") that the SPDX identifier may be used instead of the
    full boilerplate text.

    Signed-off-by: Bjorn Helgaas
    Reviewed-by: Greg Kroah-Hartman

    Bjorn Helgaas