26 Oct, 2020

1 commit


24 Aug, 2020

4 commits

  • Make use of the struct_size() helper instead of an open-coded version
    in order to avoid any potential type mistakes. Also, remove unnecessary
    variable _struct_size_.

    This code was detected with the help of Coccinelle and, audited and
    fixed manually.

    Addresses-KSPP-ID: https://github.com/KSPP/linux/issues/83
    Signed-off-by: Gustavo A. R. Silva
    Reviewed-by: Logan Gunthorpe
    Signed-off-by: Jon Mason

    Gustavo A. R. Silva
     
  • The default error branch of a series of pdev_is_gen calls
    should free ndev just like what we've done in these calls.

    Fixes: 26bfe3d0b227 ("ntb: intel: Add Icelake (gen4) support for Intel NTB")
    Signed-off-by: Dinghao Liu
    Acked-by: Dave Jiang
    Signed-off-by: Jon Mason

    Dinghao Liu
     
  • The related system resources were not released when pci_set_dma_mask(),
    pci_set_consistent_dma_mask(), or pci_iomap() return error in the
    amd_ntb_init_pci() function. Add pci_release_regions() to fix it.

    Fixes: a1b3695820aa ("NTB: Add support for AMD PCI-Express Non-Transparent Bridge")
    Signed-off-by: Kaige Li
    Signed-off-by: Jon Mason

    Kaige Li
     
  • Replace the existing /* fall through */ comments and its variants with
    the new pseudo-keyword macro fallthrough[1]. Also, remove unnecessary
    fall-through markings when it is the case.

    [1] https://www.kernel.org/doc/html/v5.7/process/deprecated.html?highlight=fallthrough#implicit-switch-case-fall-through

    Signed-off-by: Gustavo A. R. Silva

    Gustavo A. R. Silva
     

15 Aug, 2020

1 commit

  • The ioreadX() helpers have inconsistent interface. On some architectures
    void *__iomem address argument is a pointer to const, on some not.

    Implementations of ioreadX() do not modify the memory under the address so
    they can be converted to a "const" version for const-safety and
    consistency among architectures.

    Signed-off-by: Krzysztof Kozlowski
    Signed-off-by: Andrew Morton
    Reviewed-by: Geert Uytterhoeven
    Acked-by: Dave Jiang
    Cc: Allen Hubbe
    Cc: Arnd Bergmann
    Cc: Benjamin Herrenschmidt
    Cc: "David S. Miller"
    Cc: Geert Uytterhoeven
    Cc: Helge Deller
    Cc: Ivan Kokshaysky
    Cc: Jakub Kicinski
    Cc: "James E.J. Bottomley"
    Cc: Jason Wang
    Cc: Jon Mason
    Cc: Kalle Valo
    Cc: Matt Turner
    Cc: Michael Ellerman
    Cc: "Michael S. Tsirkin"
    Cc: Paul Mackerras
    Cc: Richard Henderson
    Cc: Rich Felker
    Cc: Yoshinori Sato
    Link: http://lkml.kernel.org/r/20200709072837.5869-4-krzk@kernel.org
    Signed-off-by: Linus Torvalds

    Krzysztof Kozlowski
     

06 Jun, 2020

14 commits

  • When running ntb_test, the script tries to run the ntb_perf test
    immediately after probing the modules. Since adding multi-port support,
    this fails seeing the new initialization procedure in ntb_perf
    can not complete instantly.

    To fix this we add a completion which is waited on when a test is
    started. In this way, run can be written any time after the module is
    loaded and it will wait for the initialization to complete instead of
    sending an error.

    Fixes: 5648e56d03fa ("NTB: ntb_perf: Add full multi-port NTB API support")
    Signed-off-by: Logan Gunthorpe
    Acked-by: Allen Hubbe
    Tested-by: Alexander Fomichev
    Signed-off-by: Jon Mason

    Logan Gunthorpe
     
  • Legacy drivers do not have port numbers (but is reliably only two ports)
    and was broken by the recent commit that added mult-port support to
    ntb_perf. This is especially important to support the cross link
    topology which is perfectly symmetric and cannot assign unique port
    numbers easily.

    Hardware that returns zero for both the local port and the peer should
    just always use gidx=0 for the only peer.

    Fixes: 5648e56d03fa ("NTB: ntb_perf: Add full multi-port NTB API support")
    Signed-off-by: Logan Gunthorpe
    Acked-by: Allen Hubbe
    Tested-by: Alexander Fomichev
    Signed-off-by: Jon Mason

    Logan Gunthorpe
     
  • ntb_perf should not require more than one memory window per peer. This
    was probably an off-by-one error.

    Fixes: 5648e56d03fa ("NTB: ntb_perf: Add full multi-port NTB API support")
    Signed-off-by: Logan Gunthorpe
    Acked-by: Allen Hubbe
    Tested-by: Alexander Fomichev
    Signed-off-by: Jon Mason

    Logan Gunthorpe
     
  • This commit fixes pingpong support for existing drivers that do not
    implement ntb_default_port_number() and ntb_default_peer_port_number().
    This is required for hardware (like the crosslink topology of
    switchtec) which cannot assign reasonable port numbers to each port due
    to its perfect symmetry.

    Instead of picking the doorbell to use based on the the index of the
    peer, we use the peer's port number. This is a bit clearer and easier
    to understand.

    Fixes: c7aeb0afdcc2 ("NTB: ntb_pp: Add full multi-port NTB API support")
    Signed-off-by: Logan Gunthorpe
    Acked-by: Allen Hubbe
    Tested-by: Alexander Fomichev
    Signed-off-by: Jon Mason

    Logan Gunthorpe
     
  • When the commit adding ntb_default_port_number() and
    ntb_default_peer_port_number() entered the kernel there was no
    users of it so it was impossible to tell what the API needed.

    When a user finally landed a year later (ntb_pingpong) there were
    more NTB topologies were created and no consideration was considered
    to how other drivers had changed.

    Now that there is a user it can be fixed to provide a sensible default
    for the legacy drivers that do not implement ntb_{peer_}port_number().
    Seeing ntb_pingpong doesn't check error codes returning EINVAL was also
    not sensible.

    Patches for ntb_pingpong and ntb_perf follow (which are broken
    otherwise) to support hardware that doesn't have port numbers. This is
    important not only to not break support with existing drivers but for
    the cross link topology which, due to its perfect symmetry, cannot
    assign unique port numbers to each side.

    Fixes: 1e5301196a88 ("NTB: Add indexed ports NTB API")
    Signed-off-by: Logan Gunthorpe
    Acked-by: Allen Hubbe
    Tested-by: Alexander Fomichev
    Signed-off-by: Jon Mason

    Logan Gunthorpe
     
  • Commit 417cf39cfea9 ("NTB: Set dma mask and dma coherent mask to NTB
    devices") started using the NTB device for DMA allocations which was
    turns out was wrong. If the IOMMU is enabled, such alloctanions will
    always fail with messages such as:

    DMAR: Allocating domain for 0000:02:00.1 failed

    This is because the IOMMU has not setup the device for such use.

    Change the tools back to using the PCI device for allocations seeing
    it doesn't make sense to add an IOMMU group for the non-physical NTB
    device. Also remove the code that sets the DMA mask as it no longer
    makes sense to do this.

    Fixes: 7f46c8b3a552 ("NTB: ntb_tool: Add full multi-port NTB API support")
    Signed-off-by: Logan Gunthorpe
    Tested-by: Alexander Fomichev
    Signed-off-by: Jon Mason

    Logan Gunthorpe
     
  • When running ntb_test this warning is issued:

    ./ntb_test.sh: line 200: warning: command substitution: ignored null
    byte in input

    This is caused by the kernel returning one more byte than is necessary
    when reading the link file.

    Reduce the number of bytes read back to 2 as it was before the
    commit that regressed this.

    Fixes: 7f46c8b3a552 ("NTB: ntb_tool: Add full multi-port NTB API support")
    Signed-off-by: Logan Gunthorpe
    Acked-by: Allen Hubbe
    Tested-by: Alexander Fomichev
    Signed-off-by: Jon Mason

    Logan Gunthorpe
     
  • The DMA map and unmap of destination address is already being
    done in perf_init_test() and perf_clear_test() functions.
    Hence avoiding it by making necessary changes in perf_copy_chunk()
    function.

    Signed-off-by: Sanjay R Mehta
    Signed-off-by: Arindam Nath
    Signed-off-by: Jon Mason

    Sanjay R Mehta
     
  • After trying to send commands for a maximum of MSG_TRIES
    re-tries, link-up fails due to short sleep time(1ms) between
    re-tries. Hence increasing the sleep time to one second providing
    sufficient time for perf link-up.

    Signed-off-by: Sanjay R Mehta
    Signed-off-by: Arindam Nath
    Signed-off-by: Jon Mason

    Sanjay R Mehta
     
  • Currently, ntb->dev is passed to dma_alloc_coherent
    and dma_free_coherent calls. The returned dma_addr_t
    is the CPU physical address. This works fine as long
    as IOMMU is disabled. But when IOMMU is enabled, we
    need to make sure that IOVA is returned for dma_addr_t.
    So the correct way to achieve this is by changing the
    first parameter of dma_alloc_coherent() as ntb->pdev->dev
    instead.

    Fixes: 5648e56d03fa ("NTB: ntb_perf: Add full multi-port NTB API support")
    Signed-off-by: Sanjay R Mehta
    Signed-off-by: Arindam Nath
    Signed-off-by: Jon Mason

    Sanjay R Mehta
     
  • Currently, ntb->dev is passed to dma_alloc_coherent
    and dma_free_coherent calls. The returned dma_addr_t
    is the CPU physical address. This works fine as long
    as IOMMU is disabled. But when IOMMU is enabled, we
    need to make sure that IOVA is returned for dma_addr_t.
    So the correct way to achieve this is by changing the
    first parameter of dma_alloc_coherent() as ntb->pdev->dev
    instead.

    Fixes: 5648e56d03fa ("NTB: ntb_perf: Add full multi-port NTB API support")
    Signed-off-by: Logan Gunthorpe
    Signed-off-by: Sanjay R Mehta
    Signed-off-by: Arindam Nath
    Signed-off-by: Jon Mason

    Sanjay R Mehta
     
  • This patch removes the code that sets the DMA mask as it no longer
    makes sense to do this.

    Fixes: 7f46c8b3a552 ("NTB: ntb_tool: Add full multi-port NTB API support")
    Signed-off-by: Logan Gunthorpe
    Tested-by: Alexander Fomichev
    Signed-off-by: Sanjay R Mehta
    Signed-off-by: Jon Mason

    Logan Gunthorpe
     
  • intel_ntb4_link_disable() missing static declaration.

    Reported-by: kbuild test robot
    Signed-off-by: Dave Jiang
    Signed-off-by: Jon Mason

    Dave Jiang
     
  • Add NTB_HWERR_BAR_ALIGN hw errata flag to work around issue where the
    aligment for the XLAT base must be BAR size aligned rather than 4k page
    aligned. On ICX platform, the XLAT base can be 4k page size aligned
    rather than BAR size aligned unlike the previous gen Intel NTB. However,
    a silicon errata prevented this from working as expected and a workaround
    is introduced to resolve the issue.

    Signed-off-by: Dave Jiang
    Signed-off-by: Jon Mason

    Dave Jiang
     

20 Apr, 2020

1 commit


13 Apr, 2020

1 commit


04 Apr, 2020

1 commit

  • Pull pci updates from Bjorn Helgaas:
    "Enumeration:

    - Revert sysfs "rescan" renames that broke apps (Kelsey Skunberg)

    - Add more 32 GT/s link speed decoding and improve the implementation
    (Yicong Yang)

    Resource management:

    - Add support for sizing programmable host bridge apertures and fix a
    related alpha Nautilus regression (Ivan Kokshaysky)

    Interrupts:

    - Add boot interrupt quirk mechanism for Xeon chipsets and document
    boot interrupts (Sean V Kelley)

    PCIe native device hotplug:

    - When possible, disable in-band presence detect and use PDS
    (Alexandru Gagniuc)

    - Add DMI table for devices that don't use in-band presence detection
    but don't advertise that correctly (Stuart Hayes)

    - Fix hang when powering slots up/down via sysfs (Lukas Wunner)

    - Fix an MSI interrupt race (Stuart Hayes)

    Virtualization:

    - Add ACS quirks for Zhaoxin devices (Raymond Pang)

    Error handling:

    - Add Error Disconnect Recover (EDR) support so firmware can report
    devices disconnected via DPC and we can try to recover (Kuppuswamy
    Sathyanarayanan)

    Peer-to-peer DMA:

    - Add Intel Sky Lake-E Root Ports B, C, D to the whitelist (Andrew
    Maier)

    ASPM:

    - Reduce severity of common clock config message (Chris Packham)

    - Clear the correct bits when enabling L1 substates, so we don't go
    to the wrong state (Yicong Yang)

    Endpoint framework:

    - Replace EPF linkup ops with notifier call chain and improve locking
    (Kishon Vijay Abraham I)

    - Fix concurrent memory allocation in OB address region (Kishon Vijay
    Abraham I)

    - Move PF function number assignment to EPC core to support multiple
    function creation methods (Kishon Vijay Abraham I)

    - Fix issue with clearing configfs "start" entry (Kunihiko Hayashi)

    - Fix issue with endpoint MSI-X ignoring BAR Indicator and Table
    Offset (Kishon Vijay Abraham I)

    - Add support for testing DMA transfers (Kishon Vijay Abraham I)

    - Add support for testing > 10 endpoint devices (Kishon Vijay Abraham I)

    - Add support for tests to clear IRQ (Kishon Vijay Abraham I)

    - Add common DT schema for endpoint controllers (Kishon Vijay Abraham I)

    Amlogic Meson PCIe controller driver:

    - Add DT bindings for AXG PCIe PHY, shared MIPI/PCIe analog PHY (Remi
    Pommarel)

    - Add Amlogic AXG PCIe PHY, AXG MIPI/PCIe analog PHY drivers (Remi
    Pommarel)

    Cadence PCIe controller driver:

    - Add Root Complex/Endpoint DT schema for Cadence PCIe (Kishon Vijay
    Abraham I)

    Intel VMD host bridge driver:

    - Add two VMD Device IDs that require bus restriction mode (Sushma
    Kalakota)

    Mobiveil PCIe controller driver:

    - Refactor and modularize mobiveil driver (Hou Zhiqiang)

    - Add support for Mobiveil GPEX Gen4 host (Hou Zhiqiang)

    Microsoft Hyper-V host bridge driver:

    - Add support for Hyper-V PCI protocol version 1.3 and
    PCI_BUS_RELATIONS2 (Long Li)

    - Refactor to prepare for virtual PCI on non-x86 architectures (Boqun
    Feng)

    - Fix memory leak in hv_pci_probe()'s error path (Dexuan Cui)

    NVIDIA Tegra PCIe controller driver:

    - Use pci_parse_request_of_pci_ranges() (Rob Herring)

    - Add support for endpoint mode and related DT updates (Vidya Sagar)

    - Reduce -EPROBE_DEFER error message log level (Thierry Reding)

    Qualcomm PCIe controller driver:

    - Restrict class fixup to specific Qualcomm devices (Bjorn Andersson)

    Synopsys DesignWare PCIe controller driver:

    - Refactor core initialization code for endpoint mode (Vidya Sagar)

    - Fix endpoint MSI-X to use correct table address (Kishon Vijay
    Abraham I)

    TI DRA7xx PCIe controller driver:

    - Fix MSI IRQ handling (Vignesh Raghavendra)

    TI Keystone PCIe controller driver:

    - Allow AM654 endpoint to raise MSI-X interrupt (Kishon Vijay Abraham I)

    Miscellaneous:

    - Quirk ASMedia XHCI USB to avoid "PME# from D0" defect (Kai-Heng
    Feng)

    - Use ioremap(), not phys_to_virt(), for platform ROM to fix video
    ROM mapping with CONFIG_HIGHMEM (Mikel Rychliski)"

    * tag 'pci-v5.7-changes' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci: (96 commits)
    misc: pci_endpoint_test: remove duplicate macro PCI_ENDPOINT_TEST_STATUS
    PCI: tegra: Print -EPROBE_DEFER error message at debug level
    misc: pci_endpoint_test: Use full pci-endpoint-test name in request_irq()
    misc: pci_endpoint_test: Fix to support > 10 pci-endpoint-test devices
    tools: PCI: Add 'e' to clear IRQ
    misc: pci_endpoint_test: Add ioctl to clear IRQ
    misc: pci_endpoint_test: Avoid using module parameter to determine irqtype
    PCI: keystone: Allow AM654 PCIe Endpoint to raise MSI-X interrupt
    PCI: dwc: Fix dw_pcie_ep_raise_msix_irq() to get correct MSI-X table address
    PCI: endpoint: Fix ->set_msix() to take BIR and offset as arguments
    misc: pci_endpoint_test: Add support to get DMA option from userspace
    tools: PCI: Add 'd' command line option to support DMA
    misc: pci_endpoint_test: Use streaming DMA APIs for buffer allocation
    PCI: endpoint: functions/pci-epf-test: Print throughput information
    PCI: endpoint: functions/pci-epf-test: Add DMA support to transfer data
    PCI: pciehp: Fix MSI interrupt race
    PCI: pciehp: Fix indefinite wait on sysfs requests
    PCI: endpoint: Fix clearing start entry in configfs
    PCI: tegra: Add support for PCIe endpoint mode in Tegra194
    PCI: sysfs: Revert "rescan" file renames
    ...

    Linus Torvalds
     

29 Mar, 2020

1 commit

  • The AER interfaces to clear error status registers were a confusing mess:

    - pci_cleanup_aer_uncorrect_error_status() cleared non-fatal errors
    from the Uncorrectable Error Status register.

    - pci_aer_clear_fatal_status() cleared fatal errors from the
    Uncorrectable Error Status register.

    - pci_cleanup_aer_error_status_regs() cleared the Root Error Status
    register (for Root Ports), the Uncorrectable Error Status register,
    and the Correctable Error Status register.

    Rename them to make them consistent:

    From To
    ---------------------------------------- -------------------------------
    pci_cleanup_aer_uncorrect_error_status() pci_aer_clear_nonfatal_status()
    pci_aer_clear_fatal_status() pci_aer_clear_fatal_status()
    pci_cleanup_aer_error_status_regs() pci_aer_clear_status()

    Since pci_cleanup_aer_error_status_regs() (renamed to
    pci_aer_clear_status()) is only used within drivers/pci/, move the
    declaration from to drivers/pci/pci.h.

    [bhelgaas: commit log, add renames]
    Link: https://lore.kernel.org/r/d1310a75dc3d28f7e8da4e99c45fbd3e60fe238e.1585000084.git.sathyanarayanan.kuppuswamy@linux.intel.com
    Signed-off-by: Kuppuswamy Sathyanarayanan
    Signed-off-by: Bjorn Helgaas

    Kuppuswamy Sathyanarayanan
     

13 Mar, 2020

16 commits

  • The PCI shutdown handler is invoked in response
    to system reboot or shutdown. A data transfer
    might still be in flight when this happens. So
    the very first action we take here is to send
    a link down notification, so that any pending
    data transfer is terminated. Rest of the actions
    are same as that of PCI remove handler.

    Signed-off-by: Arindam Nath
    Signed-off-by: Jon Mason

    Arindam Nath
     
  • When the driver on the local side is loaded, it sets
    SIDE_READY bit in SIDE_INFO register. Likewise, when
    it is un-loaded, it clears the bit.

    Also just after being loaded, the driver polls for
    peer SIDE_READY bit to be set. Since that bit is set
    when the peer side driver has loaded, the polling on
    local side breaks as soon as this condition is met.

    But the situation is different when the driver is
    un-loaded. Since the polling has already been stopped
    as mentioned before, if the peer side driver gets
    un-loaded, the driver on the local side is not notified
    implicitly.

    So, we improvise using existing doorbell mechanism.
    We reserve the highest order bit of the DB register to
    send a notification to peer when the driver on local
    side is un-loaded. This also means that now we are one
    short of 16 DB events and that is taken care of in the
    valid DB mask.

    Signed-off-by: Arindam Nath
    Signed-off-by: Jon Mason

    Arindam Nath
     
  • db_valid_mask is set at two places, once within
    amd_init_ntb(), and again within amd_init_dev().
    Since amd_init_ntb() is actually called from
    amd_init_dev(), setting db_valid_mask from
    former does not really make sense. So remove it.

    Signed-off-by: Arindam Nath
    Signed-off-by: Jon Mason

    Arindam Nath
     
  • Since NTB connects two physically separate systems,
    there can be scenarios where one system goes down
    while the other one remains active. In case of NTB
    primary, if the NTB secondary goes down, a Link-Down
    event is received. For the NTB secondary, if the
    NTB primary goes down, the PCIe hotplug mechanism
    ensures that the driver on the secondary side is also
    unloaded.

    But there are other scenarios to consider as well,
    when suppose the physical link remains active, but
    the driver on primary or secondary side is loaded
    or un-loaded.

    When the driver is loaded, on either side, it sets
    SIDE_READY bit(bit-1) of SIDE_INFO register. Similarly,
    when the driver is un-loaded, it resets the same bit.

    We consider the NTB link to be up and operational
    only when the driver on both sides of link are loaded
    and ready. But we also need to take account of
    Link Up and Down events which signify the physical
    link status. So amd_link_is_up() is modified to take
    care of the above scenarios.

    Signed-off-by: Arindam Nath
    Signed-off-by: Jon Mason

    Arindam Nath
     
  • We define two new helper functions to set and clear
    sideinfo registers respectively. These functions
    take an additional boolean parameter which signifies
    whether we want to set/clear the sideinfo register
    of the peer(true) or local host(false).

    Signed-off-by: Arindam Nath
    Signed-off-by: Jon Mason

    Arindam Nath
     
  • It does not really make sense to enable or disable
    the bits of NTB_CTRL register only during enable
    and disable link callbacks. They should be done
    independent of these callbacks. The correct placement
    for that is during the amd_init_side_info() and
    amd_deinit_side_info() functions, which are invoked
    during probe and remove respectively.

    Signed-off-by: Arindam Nath
    Signed-off-by: Jon Mason

    Arindam Nath
     
  • Just like for Link-Down event, Link-Up and D3 events
    are also mutually exclusive to Link-Down and D0 events
    respectively. So we clear the bitmasks in peer_sta
    depending on event type.

    Signed-off-by: Arindam Nath
    Signed-off-by: Jon Mason

    Arindam Nath
     
  • Link-Up and Link-Down are mutually exclusive events.
    So when we receive a Link-Down event, we should also
    clear the bitmask for Link-Up event in peer_sta.

    Signed-off-by: Arindam Nath
    Signed-off-by: Jon Mason

    Arindam Nath
     
  • amd_link_is_up() is a callback to inquire whether
    the NTB link is up or not. So it should not indulge
    itself into clearing the bitmasks of peer_sta.

    Signed-off-by: Arindam Nath
    Signed-off-by: Jon Mason

    Arindam Nath
     
  • amd_ack_smu() should only set the corresponding
    bits into SMUACK register. Setting the bitmask
    of peer_sta should be done within the event handler.
    They are two different things, and so should be
    handled differently and at different places.

    Signed-off-by: Arindam Nath
    Signed-off-by: Jon Mason

    Arindam Nath
     
  • Bit 1 of SIDE_INFO register is an indication that
    the driver on the other side of link is ready. We
    set this bit during driver initialization sequence.
    So rather than having separate macros to return the
    status, we can simply return the status of this bit
    from amd_poll_link(). So a return of 1 or 0 from
    this function will indicate to the caller whether
    the driver on the other side of link is ready or not,
    respectively.

    Signed-off-by: Arindam Nath
    Signed-off-by: Jon Mason

    Arindam Nath
     
  • Since getting the status of link is a logically separate
    operation, we simply create a new function which will
    store the link status to be used later.

    Signed-off-by: Arindam Nath
    Signed-off-by: Jon Mason

    Arindam Nath
     
  • Link-Up and Link-Down events can occur irrespective
    of whether a data transfer is in progress or not.
    So we need to enable the interrupt delivery for
    these events early during driver load.

    Signed-off-by: Arindam Nath
    Signed-off-by: Jon Mason

    Arindam Nath
     
  • The interrupt status register should be cleared
    by driver once the particular event is handled.
    The patch fixes this.

    Signed-off-by: Arindam Nath
    Signed-off-by: Jon Mason

    Arindam Nath
     
  • The design of AMD NTB implementation is such that
    NTB primary acts as an endpoint device and NTB
    secondary is an endpoint device behind a combination
    of Switch Upstream and Switch Downstream. Considering
    that, the link status and control register needs to
    be accessed differently based on the NTB topology.

    So in the case of NTB secondary, we first get the
    pointer to the Switch Downstream device for the NTB
    device. Then we get the pointer to the Switch Upstream
    device. Once we have that, we read the Link Status
    and Control register to get the correct status of
    link at the secondary.

    In the case of NTB primary, simply reading the Link
    Status and Control register of the NTB device itself
    will suffice.

    Suggested-by: Jiasen Lin
    Signed-off-by: Arindam Nath
    Signed-off-by: Jon Mason

    Arindam Nath
     
  • Since snprintf() returns the would-be-output size instead of the
    actual output size, the succeeding calls may go beyond the given
    buffer limit. Fix it by replacing with scnprintf().

    Fixes: fce8a7bb5b4b (PCI-Express Non-Transparent Bridge Support)
    Fixes: 282a2feeb9bf (NTB: Use DMA Engine to Transmit and Receive)
    Fixes: a754a8fcaf38 (NTB: allocate number transport entries depending on size of ring size)
    Fixes: d98ef99e378b (NTB: Clean up QP stats info)
    Fixes: e74bfeedad08 (NTB: Add flow control to the ntb_netdev)
    Fixes: 569410ca756c (NTB: Use unique DMA channels for TX and RX)
    Signed-off-by: Takashi Iwai
    Reviewed-by: Logan Gunthorpe
    Signed-off-by: Jon Mason

    Takashi Iwai