27 Jul, 2020

1 commit


14 Jul, 2020

1 commit

  • When putting the port in reset, driver must wait for the soft reset
    acknowledgment bit instead of the soft reset bit.

    Fixes: 47c1b19c160f (fpga: dfl: afu: add port ops support)
    Signed-off-by: Matthew Gerlach
    Signed-off-by: Xu Yilun
    Acked-by: Wu Hao
    Reviewed-by: Tom Rix
    Signed-off-by: Moritz Fischer

    Matthew Gerlach
     

07 Jul, 2020

2 commits

  • AFU (Accelerated Function Unit) is dynamic region of the DFL based FPGA,
    and always defined by users. Some DFL based FPGA cards allow users to
    implement their own interrupts in AFU. In order to support this,
    hardware implements a new UINT (AFU Interrupt) private feature with
    related capability register which describes the number of supported
    AFU interrupts as well as the local index of the interrupts for
    software enumeration, and from software side, driver follows the common
    DFL interrupt notification and handling mechanism, and it implements
    two ioctls below for user to query number of irqs supported and set/unset
    interrupt triggers.

    Ioctls:
    * DFL_FPGA_PORT_UINT_GET_IRQ_NUM
    get the number of irqs, which is used to determine how many interrupts
    UINT feature supports.

    * DFL_FPGA_PORT_UINT_SET_IRQ
    set/unset eventfds as AFU interrupt triggers.

    Signed-off-by: Luwei Kang
    Signed-off-by: Wu Hao
    Signed-off-by: Xu Yilun
    Reviewed-by: Marcelo Tosatti
    Acked-by: Wu Hao
    Signed-off-by: Moritz Fischer

    Xu Yilun
     
  • Error reporting interrupt is very useful to notify users that some
    errors are detected by the hardware. Once users are notified, they
    could query hardware logged error states, no need to continuously
    poll on these states.

    This patch adds interrupt support for port error reporting sub feature.
    It follows the common DFL interrupt notification and handling mechanism,
    implements two ioctl commands below for user to query number of irqs
    supported, and set/unset interrupt triggers.

    Ioctls:
    * DFL_FPGA_PORT_ERR_GET_IRQ_NUM
    get the number of irqs, which is used to determine whether/how many
    interrupts error reporting feature supports.

    * DFL_FPGA_PORT_ERR_SET_IRQ
    set/unset given eventfds as error interrupt triggers.

    Signed-off-by: Luwei Kang
    Signed-off-by: Wu Hao
    Signed-off-by: Xu Yilun
    Reviewed-by: Marcelo Tosatti
    Acked-by: Wu Hao
    Signed-off-by: Moritz Fischer

    Xu Yilun
     

30 Apr, 2020

2 commits

  • Allow debug access to memory-mapped regions using e.g. gdb.

    Signed-off-by: Dominic Chen
    Acked-by: Wu Hao
    Signed-off-by: Moritz Fischer

    Dominic Chen
     
  • Each DFL functional block, e.g. AFU (Accelerated Function Unit) and FME
    (FPGA Management Engine), could implement more than one function within
    its region, but current driver only allows one user application to access
    it by exclusive open on device node. So this is not convenient and
    flexible for userspace applications, as they have to combine lots of
    different functions into one single application.

    This patch removes the limitation here to allow multiple opens to each
    feature device node for AFU and FME from userspace applications. If user
    still needs exclusive access to these device node, O_EXCL flag must be
    issued together with open.

    Signed-off-by: Wu Hao
    Signed-off-by: Xu Yilun
    Signed-off-by: Moritz Fischer

    Xu Yilun
     

03 Jan, 2020

1 commit

  • Fixes gcc '-Wunused-but-set-variable' warning:

    drivers/fpga/dfl-afu-main.c: In function ‘afu_dev_destroy’:
    drivers/fpga/dfl-afu-main.c:816:18: warning: variable ‘afu’
    set but not used [-Wunused-but-set-variable]

    It is never used, and so can be removed.

    Acked-by: Wu Hao
    Signed-off-by: yu kuai
    Signed-off-by: Moritz Fischer

    yu kuai
     

04 Sep, 2019

5 commits

  • STP (SignalTap) is one of the private features under the port for
    debugging. This patch adds private feature driver support for it
    to allow userspace applications to mmap related mmio region and
    provide STP service.

    Signed-off-by: Xu Yilun
    Signed-off-by: Wu Hao
    Acked-by: Moritz Fischer
    Acked-by: Alan Tull
    Signed-off-by: Moritz Fischer

    Wu Hao
     
  • Error reporting is one important private feature, it reports error
    detected on port and accelerated function unit (AFU). It introduces
    several sysfs interfaces to allow userspace to check and clear
    errors detected by hardware.

    Signed-off-by: Xu Yilun
    Signed-off-by: Wu Hao
    Acked-by: Alan Tull
    Signed-off-by: Moritz Fischer

    Wu Hao
     
  • As these two functions are used by other private features within the
    same driver module but different driver files. e.g. in error reporting
    private feature, it requires to clear errors when port is in reset.

    Signed-off-by: Xu Yilun
    Signed-off-by: Wu Hao
    Acked-by: Moritz Fischer
    Acked-by: Alan Tull
    Signed-off-by: Moritz Fischer

    Wu Hao
     
  • This patch introduces userclock sysfs interfaces for AFU, user
    could use these interfaces for clock setting to AFU.

    Please note that, this is only working for port header feature
    with revision 0, for later revisions, userclock setting is moved
    to a separated private feature, so one revision sysfs interface
    is exposed to userspace application for this purpose too.

    Signed-off-by: Ananda Ravuri
    Signed-off-by: Russ Weight
    Signed-off-by: Xu Yilun
    Signed-off-by: Wu Hao
    Acked-by: Alan Tull
    Signed-off-by: Moritz Fischer

    Wu Hao
     
  • This patch takes advantage of driver core which helps to create
    and remove sysfs attribute files, so there is no need to register
    sysfs entries manually in dfl-afu platform river code.

    Signed-off-by: Wu Hao
    Acked-by: Moritz Fischer
    Signed-off-by: Moritz Fischer

    Wu Hao
     

06 Aug, 2019

1 commit

  • This patch adds id_table for each dfl private feature driver,
    it allows to reuse same private feature driver to match and support
    multiple dfl private features.

    Signed-off-by: Xu Yilun
    Signed-off-by: Wu Hao
    Acked-by: Moritz Fischer
    Acked-by: Alan Tull
    Signed-off-by: Moritz Fischer
    Link: https://lore.kernel.org/r/1564914022-3710-6-git-send-email-hao.wu@intel.com
    Signed-off-by: Greg Kroah-Hartman

    Wu Hao
     

05 Aug, 2019

1 commit

  • This patch introduces more sysfs interfaces for Accelerated
    Function Unit (AFU). These interfaces allow users to read
    current AFU Power State (APx), read / clear AFU Power (APx)
    events which are sticky to identify transient APx state,
    and manage AFU's LTR (latency tolerance reporting).

    Signed-off-by: Ananda Ravuri
    Signed-off-by: Xu Yilun
    Signed-off-by: Wu Hao
    Acked-by: Alan Tull
    Signed-off-by: Moritz Fischer
    Link: https://lore.kernel.org/r/1564914022-3710-4-git-send-email-hao.wu@intel.com
    Signed-off-by: Greg Kroah-Hartman

    Wu Hao
     

25 Jul, 2019

1 commit

  • This is a driver, do not call "raw" sysfs functions, instead call driver
    core ones. Specifically convert the use of sysfs_create_files() and
    sysfs_remove_files() to use device_add_groups() and
    device_remove_groups()

    Cc: Wu Hao
    Cc: Alan Tull
    Cc: Moritz Fischer
    Cc: linux-fpga@vger.kernel.org
    Signed-off-by: Greg Kroah-Hartman
    Link: https://lore.kernel.org/r/20190704055645.GA15471@kroah.com
    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     

15 Jul, 2018

6 commits

  • DMA memory regions are required for Accelerated Function Unit (AFU) usage.
    These two ioctls allow user space applications to map user memory regions
    for dma, and unmap them after use. Iova is returned from driver to user
    space application via DFL_FPGA_PORT_DMA_MAP ioctl. Application needs to
    unmap it after use, otherwise, driver will unmap them in device file
    release operation.

    Each AFU has its own rb tree to keep track of its mapped DMA regions.

    Ioctl interfaces:
    * DFL_FPGA_PORT_DMA_MAP
    Do the dma mapping per user_addr and length provided by user.
    Return iova in provided struct dfl_fpga_port_dma_map.

    * DFL_FPGA_PORT_DMA_UNMAP
    Unmap the dma region per iova provided by user.

    Signed-off-by: Tim Whisonant
    Signed-off-by: Enno Luebbers
    Signed-off-by: Shiva Rao
    Signed-off-by: Christopher Rauer
    Signed-off-by: Xiao Guangrong
    Signed-off-by: Wu Hao
    Acked-by: Alan Tull
    Signed-off-by: Greg Kroah-Hartman

    Wu Hao
     
  • User Accelerated Function Unit sub feature exposes the MMIO region of
    the AFU. After valid PR bitstream is programmed and the port is enabled,
    then this MMIO region could be accessed.

    This patch adds support to enumerate the AFU MMIO region and expose it
    to userspace via mmap file operation. Below interfaces are exposed to user:

    Sysfs interface:
    * /sys/class/fpga_region///afu_id
    Read-only. Indicate which PR bitstream is programmed to this AFU.

    Ioctl interfaces:
    * DFL_FPGA_PORT_GET_INFO
    Provide info to userspace on the number of supported region.
    Only UAFU region is supported now.

    * DFL_FPGA_PORT_GET_REGION_INFO
    Provide region information, including access permission, region size,
    offset from the start of device fd.

    Signed-off-by: Tim Whisonant
    Signed-off-by: Enno Luebbers
    Signed-off-by: Shiva Rao
    Signed-off-by: Christopher Rauer
    Signed-off-by: Xiao Guangrong
    Signed-off-by: Wu Hao
    Acked-by: Alan Tull
    Signed-off-by: Greg Kroah-Hartman

    Xiao Guangrong
     
  • DFL_FPGA_GET_API_VERSION and DFL_FPGA_CHECK_EXTENSION ioctls are common
    ones which need to be supported by all feature devices drivers including
    FME and AFU. This patch implements above 2 ioctls in FPGA Accelerated
    Function Unit (AFU) driver.

    Signed-off-by: Tim Whisonant
    Signed-off-by: Enno Luebbers
    Signed-off-by: Shiva Rao
    Signed-off-by: Christopher Rauer
    Signed-off-by: Xiao Guangrong
    Signed-off-by: Wu Hao
    Acked-by: Alan Tull
    Acked-by: Moritz Fischer
    Signed-off-by: Greg Kroah-Hartman

    Wu Hao
     
  • The port header register set is always present for port, it is mainly
    for capability, control and status of the ports that AFU connected to.

    This patch implements header sub feature support. Below user interfaces
    are created by this patch.

    Sysfs interface:
    * /sys/class/fpga_region///id
    Read-only. Port ID.

    Ioctl interface:
    * DFL_FPGA_PORT_RESET
    Reset the FPGA Port and its AFU.

    Signed-off-by: Tim Whisonant
    Signed-off-by: Enno Luebbers
    Signed-off-by: Shiva Rao
    Signed-off-by: Christopher Rauer
    Signed-off-by: Xiao Guangrong
    Signed-off-by: Wu Hao
    Acked-by: Alan Tull
    Signed-off-by: Greg Kroah-Hartman

    Wu Hao
     
  • This patch registers the port ops into the global list in the DFL
    framework, and it allows other modules to use the port ops. And
    This patch includes the implementation of the get_id and enable_set
    ops too.

    Signed-off-by: Wu Hao
    Acked-by: Alan Tull
    Signed-off-by: Greg Kroah-Hartman

    Wu Hao
     
  • On DFL FPGA devices, the Accelerated Function Unit (AFU), can be
    reprogrammed for different functions. It connects to the FPGA
    infrastructure (static FPGA region) via a Port. Port CSRs are
    implemented separately from the AFU CSRs to provide control and
    status of the Port. Once valid PR bitstream is programmed into
    the AFU, it allows access to the AFU CSRs in the AFU MMIO space.

    This patch only implements basic driver framework for AFU, including
    device file operation framework.

    Signed-off-by: Tim Whisonant
    Signed-off-by: Enno Luebbers
    Signed-off-by: Shiva Rao
    Signed-off-by: Christopher Rauer
    Signed-off-by: Xiao Guangrong
    Signed-off-by: Wu Hao
    Acked-by: Alan Tull
    Signed-off-by: Greg Kroah-Hartman

    Wu Hao