30 Oct, 2020

1 commit


29 Oct, 2020

4 commits

  • We don't need to allocate and reassign the used ring here and remove the
    used_address_updated flag. Since RC has allocated the entire vring,
    including the used ring. Simply add the corresponding offset can get the
    used ring address.

    If following the orginal way to reassign the used ring, will encounter a
    problem. When host finished with descriptor, it will update the used
    ring with putused_kern api, if reassign used ring at EP side, used
    ring will be io device memory for RC, use memcpy in putused_kern will
    cause kernel panic.

    Signed-off-by: Sherry Sun
    Reviewed-by: Fugang Duan

    Sherry Sun
     
  • Remove the dev_is_dma_coherent check because this api is not allowed by
    other interfaces, and use dma_alloc_coherent for vrings and device page
    directly. Use dma_mmap_coherent to map memory allocated by
    dma_alloc_coherent instead of remap_pfn_range, and optimize the vop_mmap
    function code.

    Signed-off-by: Christoph Hellwig
    Signed-off-by: Sherry Sun
    Reviewed-by: Fugang Duan

    Sherry Sun
     
  • Set VIRTIO_F_ACCESS_PLATFORM feature directly for vop driver, as the
    DMA mapping details shouldn't be decided on the virtio implementation,
    but the host PCIe implementation.

    Signed-off-by: Sherry Sun
    Reviewed-by: Fugang Duan

    Sherry Sun
     
  • Since we didn't implement the family and stepping function callbacks for
    cosm_hw_op, when cat /sys/class/mic/mic0/family and
    /sys/class/mic/mic0/stepping at userspace will cause kernel panic:

    root@imx8qmmek:~# cat /sys/class/mic/mic0/family
    [ 44.736286] Unable to handle kernel NULL pointer dereference at
    virtual address 0000000000000000

    root@imx8qmmek:~# cat /sys/class/mic/mic0/stepping
    [ 66.614414] Unable to handle kernel NULL pointer dereference at
    virtual address 0000000000000000

    So add family and stepping callbacks to avoid kernel panic.

    Signed-off-by: Sherry Sun
    Reviewed-by: Fugang Duan

    Sherry Sun
     

14 Oct, 2020

2 commits


08 Oct, 2020

1 commit

  • * tag 'v5.4.70': (3051 commits)
    Linux 5.4.70
    netfilter: ctnetlink: add a range check for l3/l4 protonum
    ep_create_wakeup_source(): dentry name can change under you...
    ...

    Conflicts:
    arch/arm/mach-imx/pm-imx6.c
    arch/arm64/boot/dts/freescale/imx8mm-evk.dts
    arch/arm64/boot/dts/freescale/imx8mn-ddr4-evk.dts
    drivers/crypto/caam/caamalg.c
    drivers/gpu/drm/imx/dw_hdmi-imx.c
    drivers/gpu/drm/imx/imx-ldb.c
    drivers/gpu/drm/imx/ipuv3/ipuv3-crtc.c
    drivers/mmc/host/sdhci-esdhc-imx.c
    drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
    drivers/net/ethernet/freescale/enetc/enetc.c
    drivers/net/ethernet/freescale/enetc/enetc_pf.c
    drivers/thermal/imx_thermal.c
    drivers/usb/cdns3/ep0.c
    drivers/xen/swiotlb-xen.c
    sound/soc/fsl/fsl_esai.c
    sound/soc/fsl/fsl_sai.c

    Signed-off-by: Jason Liu

    Jason Liu
     

22 Sep, 2020

13 commits

  • Add uevent callback for cosm_bus and add cosm_device_id for cosm driver
    which is needed for MODULE_DEVICE_TABLE.
    Cosm driver will be autoloaded when cosm device appears.

    Signed-off-by: Sherry Sun
    Reviewed-by: Frank Li
    Reviewed-by: Fugang Duan

    Sherry Sun
     
  • Add vop support to MODULE_DEVICE_TABLE() by adding info about struct
    vop_device_id in devicetable-offsets.c and add a vop entry point in
    file2alias.c.

    The type argument for MODULE_DEVICE_TABLE(type, name) is vop.

    Signed-off-by: Sherry Sun
    Signed-off-by: Joakim Zhang
    Reviewed-by: Frank Li
    Reviewed-by: Fugang Duan

    Sherry Sun
     
  • For vop bus, the first parameter should be vop in MODULE_DEVICE_TABLE.

    Signed-off-by: Sherry Sun
    Signed-off-by: Joakim Zhang
    Reviewed-by: Frank Li
    Reviewed-by: Fugang Duan

    Sherry Sun
     
  • Build module or builtin VOP based on CONFIG_VOP macro.

    Signed-off-by: Joakim Zhang
    Signed-off-by: Sherry Sun
    Reviewed-by: Frank Li
    Reviewed-by: Fugang Duan

    Sherry Sun
     
  • Read and write io memory should address align on ARCH ARM. Change to use
    memcpy_toio to avoid kernel panic caused by the address un-align issue.

    The reason why we use kmalloc instead of vmalloc:
    1. The temp buffer we need here won't big than one page.
    2. After allocating the temporary buffer, and use it to do memcpy, we
    immediately released it.
    3. Use vmalloc will reduce the virtual-net speed when RC send data to
    EP, the iperf3 test result is as follows:

    use kmalloc:
    - - - - - - - - - - - - - - - - - - - - - - - - -
    [ ID] Interval Transfer Bitrate
    [ 5] 0.00-100.05 sec 2.26 GBytes 194 Mbits/sec receiver
    -----------------------------------------------------------

    use vmalloc:
    - - - - - - - - - - - - - - - - - - - - - - - - -
    [ ID] Interval Transfer Bitrate
    [ 5] 0.00-100.06 sec 1.94 GBytes 166 Mbits/sec receiver
    -----------------------------------------------------------

    Signed-off-by: Sherry Sun
    Signed-off-by: Joakim Zhang
    Reviewed-by: Frank Li
    Reviewed-by: Fugang Duan

    Sherry Sun
     
  • Mapping kernel space memory to user space as noncached, since user space
    need check vring flags ASAP.

    Signed-off-by: Joakim Zhang
    Signed-off-by: Sherry Sun
    Reviewed-by: Frank Li
    Reviewed-by: Fugang Duan

    Sherry Sun
     
  • For i.MX platform, the device page is allocated by dma_alloc_coherent,
    when user space wants to get its physical address, we cannot use
    virt_to_phys api, should just return the device page physical address
    saved during allocation.

    Also change the Intel mic, return the device page physical address
    directly instead of additional virt_to_phys conversion.

    Signed-off-by: Sherry Sun
    Signed-off-by: Joakim Zhang
    Reviewed-by: Frank Li
    Reviewed-by: Fugang Duan

    Sherry Sun
     
  • For i.MX platforms, we should allocate vring through dma_alloc_coherent
    api to ensure timely synchronization of vring. The orginal way which
    used __get_free_pages and dma_map_single does not guaranteed to be
    synchronized, which will cause error on i.MX platforms.

    Signed-off-by: Joakim Zhang
    Signed-off-by: Sherry Sun
    Reviewed-by: Frank Li
    Reviewed-by: Fugang Duan

    Sherry Sun
     
  • Since struct _mic_vring_info and vring are allocated together and follow
    vring, if the vring_size() is not four bytes aligned, which will cause
    the start address of struct _mic_vring_info is not four byte aligned.
    For example, when vring entries is 128, the vring_size() will be 5126
    bytes. The _mic_vring_info struct layout in ddr looks like:
    0x90002400: 00000000 00390000 EE010000 0000C0FF
    Here 0x39 is avail_idx member, and 0xC0FFEE01 is magic member.

    When EP use ioread32(magic) to reads the magic in RC's share memory, it
    will cause kernel panic on ARM64 platform. Here read magic in user space
    use le32toh(vr0->info->magic) will meet the same issue.
    So here add round_up(x,4) for vring_size, then the struct _mic_vring_info
    will store in this way:
    0x90002400: 00000000 00000000 00000039 C0FFEE01
    Which will avoid kernel panic when read magic in struct _mic_vring_info.

    Signed-off-by: Sherry Sun
    Signed-off-by: Joakim Zhang
    Reviewed-by: Frank Li
    Reviewed-by: Fugang Duan

    Sherry Sun
     
  • Set VIRTIO_F_IOMMU_PLATFORM feature bit for imx mic, since we need use
    the DMA API for virtio.

    Signed-off-by: Sherry Sun
    Signed-off-by: Joakim Zhang
    Reviewed-by: Frank Li
    Reviewed-by: Fugang Duan

    Sherry Sun
     
  • For i.MX platforms, we don't need allocate and reassign the used ring.
    Since RC has allocated the used ring already, just get the allocated
    used ring address by adding the corresponding offset.

    If we follow the orginal way to reassign the used ring, we will need to
    change the putused_kern function to use memcpy_toio instead of memcpy,
    since used ring is a io device memory for RC.

    Signed-off-by: Sherry Sun
    Signed-off-by: Joakim Zhang
    Reviewed-by: Frank Li
    Reviewed-by: Fugang Duan

    Joakim Zhang
     
  • Add i.MX MIC host driver which is based on VOP framework. Imx-host
    driver bind a reserved cma region to pci_dev->dev, which can be used to
    alloc device page and rx/tx vring, then map the whole reserved cma
    region to imx-card through pcie to communicate with ep.

    i.MX MIC host mapped three bars of EP:
    BAR0: transfer RC cma region address/size for EP to set outbound region
    BAR2: map EP mu8b registers as doorbell
    BAR4: map EP swiotlb region which is used for virtnet to map the allocated
    rx/tx buffer

    Signed-off-by: Sherry Sun
    Signed-off-by: Joakim Zhang
    Reviewed-by: Frank Li
    Reviewed-by: Fugang Duan

    Sherry Sun
     
  • Add i.MX MIC related driver support which is based on VOP framework.

    The patch contains two parts:
    1. mic card driver
    2. mic interrupt driver

    Signed-off-by: Sherry Sun
    Signed-off-by: Joakim Zhang
    Reviewed-by: Frank Li
    Reviewed-by: Fugang Duan

    Joakim Zhang
     

10 Sep, 2020

2 commits

  • [ Upstream commit 0839152f8c1efc1cc2d515d1ff1e253ca9402ad3 ]

    vmalloc can return different return code than NULL and a valid
    pointer. We must validate it in order to dereference a non valid
    pointer.

    Signed-off-by: Ofir Bitton
    Signed-off-by: Oded Gabbay
    Signed-off-by: Sasha Levin

    Ofir Bitton
     
  • [ Upstream commit bce382a8bb080ed5f2f3a06754526dc58b91cca2 ]

    We must validate FW size in order not to corrupt memory in case
    a malicious FW file will be present in system.

    Signed-off-by: Ofir Bitton
    Signed-off-by: Oded Gabbay
    Signed-off-by: Sasha Levin

    Ofir Bitton
     

19 Aug, 2020

1 commit

  • [ Upstream commit 85c5cbeba8f4fb28e6b9bfb3e467718385f78f76 ]

    Currently the error return path from kobject_init_and_add() is not
    followed by a call to kobject_put() - which means we are leaking
    the kobject.

    Fix it by adding a call to kobject_put() in the error path of
    kobject_init_and_add().

    Fixes: b087e6190ddc ("cxl: Export optional AFU configuration record in sysfs")
    Reported-by: Hulk Robot
    Signed-off-by: Wang Hai
    Acked-by: Andrew Donnellan
    Acked-by: Frederic Barrat
    Link: https://lore.kernel.org/r/20200602120733.5943-1-wanghai38@huawei.com
    Signed-off-by: Greg Kroah-Hartman
    Signed-off-by: Sasha Levin

    Wang Hai
     

22 Jul, 2020

3 commits

  • commit b037d60a3b1d1227609fd858fa34321f41829911 upstream.

    Uninterruptible context is not needed in the driver and causes lockdep
    warning because of mutex taken in of_alias_get_id(). Convert the lock to
    mutex to avoid the issue.

    Cc: stable@vger.kernel.org
    Fixes: 099343c64e16 ("ARM: at91: atmel-ssc: add device tree support")
    Signed-off-by: Michał Mirosław
    Link: https://lore.kernel.org/r/50f0d7fa107f318296afb49477c3571e4d6978c5.1592998403.git.mirq-linux@rere.qmqm.pl
    Signed-off-by: Greg Kroah-Hartman

    Michał Mirosław
     
  • commit e852c2c251ed9c23ae6e3efebc5ec49adb504207 upstream.

    It's not needed to set driver to NULL in mei_cl_device_remove()
    which is bus_type remove() handler as this is done anyway
    in __device_release_driver().

    Actually this is causing an endless loop in driver_detach()
    on ubuntu patched kernel, while removing (rmmod) the mei_hdcp module.
    The reason list_empty(&drv->p->klist_devices.k_list) is always not-empty.
    as the check is always true in __device_release_driver()
    if (dev->driver != drv)
    return;

    The non upstream patch is causing this behavior, titled:
    'vfio -- release device lock before userspace requests'

    Nevertheless the fix is correct also for the upstream.

    Link: https://patchwork.ozlabs.org/project/ubuntu-kernel/patch/20180912085046.3401-2-apw@canonical.com/
    Cc:
    Cc: Andy Whitcroft
    Signed-off-by: Alexander Usyskin
    Signed-off-by: Tomas Winkler
    Link: https://lore.kernel.org/r/20200628225359.2185929-1-tomas.winkler@intel.com
    Signed-off-by: Greg Kroah-Hartman

    Alexander Usyskin
     
  • commit 79c823c57e69d9e584a5ee4ee6406eb3854393ae upstream.

    Align the protection bits configuration of all TPC cores to be as of TPC
    core 0.

    Fixes: a513f9a7eca5 ("habanalabs: make tpc registers secured")

    Signed-off-by: Tomer Tayar
    Reviewed-by: Oded Gabbay
    Signed-off-by: Oded Gabbay
    Signed-off-by: Greg Kroah-Hartman

    Tomer Tayar
     

24 Jun, 2020

4 commits

  • [ Upstream commit 57343d51613227373759f5b0f2eede257fd4b82e ]

    This fixes the case of get_user_pages_fast() returning a -errno.
    The result needs to be stored in a signed integer. And for safe
    signed/unsigned comparisons, it's best to keep everything signed.
    And get_user_pages_fast() also expects a signed value for number
    of pages to pin.

    Therefore, change most relevant variables, from u32 to int. Leave
    "n" unsigned, for convenience in checking for overflow. And provide
    a WARN_ON_ONCE() and early return, if overflow occurs.

    Also, as long as we're tidying up: rename the page array from page,
    to pages, in order to match the conventions used in most other call
    sites.

    Fixes: 20ec628e8007e ("misc: xilinx_sdfec: Add ability to configure LDPC")
    Cc: Derek Kiernan
    Cc: Dragan Cvetic
    Cc: Arnd Bergmann
    Cc: Greg Kroah-Hartman
    Cc: Michal Simek
    Cc: linux-arm-kernel@lists.infradead.org
    Signed-off-by: John Hubbard
    Link: https://lore.kernel.org/r/20200527012628.1100649-2-jhubbard@nvidia.com
    Signed-off-by: Greg Kroah-Hartman
    Signed-off-by: Sasha Levin

    John Hubbard
     
  • [ Upstream commit 7a65ee046b2238e053f6ebb610e1a082cfc49490 ]

    When doing training, the DL framework (e.g. tensorflow) performs hundreds
    of thousands of memory allocations and mappings. In case the driver needs
    to perform hard-reset during training, the driver kills the application and
    unmaps all those memory allocations. Unfortunately, because of that large
    amount of mappings, the driver isn't able to do that in the current timeout
    (5 seconds). Therefore, increase the timeout significantly to 30 seconds
    to avoid situation where the driver resets the device with active mappings,
    which sometime can cause a kernel bug.

    BTW, it doesn't mean we will spend all the 30 seconds because the reset
    thread checks every one second if the unmap operation is done.

    Reviewed-by: Omer Shpigelman
    Signed-off-by: Oded Gabbay
    Signed-off-by: Sasha Levin

    Oded Gabbay
     
  • [ Upstream commit 74003385cf716f1b88cc7753ca282f5493f204a2 ]

    fastrpc_invoke_ctx can have refcount of 2 in error path where
    rpmsg_send() fails to send invoke message. decrement the refcount
    properly in the error path to fix this leak.

    This also fixes below static checker warning:

    drivers/misc/fastrpc.c:990 fastrpc_internal_invoke()
    warn: 'ctx->refcount.refcount.ref.counter' not decremented on lines: 990.

    Fixes: c68cfb718c8f ("misc: fastrpc: Add support for context")
    Reported-by: Dan Carpenter
    Signed-off-by: Srinivas Kandagatla
    Reviewed-by: Bjorn Andersson
    Link: https://lore.kernel.org/r/20200512110930.2550-1-srinivas.kandagatla@linaro.org
    Signed-off-by: Greg Kroah-Hartman
    Signed-off-by: Sasha Levin

    Srinivas Kandagatla
     
  • [ Upstream commit 0978de9fc7335c73934ab8fac189fb4cb3f23191 ]

    fastrpc_channel_ctx is not freed if misc_register() fails, this would
    lead to a memory leak. Fix this leak by adding kfree in misc_register()
    error path.

    Fixes: 278d56f970ae ("misc: fastrpc: Reference count channel context")
    Signed-off-by: Srinivas Kandagatla
    Reviewed-by: Bjorn Andersson
    Link: https://lore.kernel.org/r/20200511162722.2552-1-srinivas.kandagatla@linaro.org
    Signed-off-by: Greg Kroah-Hartman
    Signed-off-by: Sasha Levin

    Srinivas Kandagatla
     

19 Jun, 2020

1 commit

  • * tag 'v5.4.47': (2193 commits)
    Linux 5.4.47
    KVM: arm64: Save the host's PtrAuth keys in non-preemptible context
    KVM: arm64: Synchronize sysreg state on injecting an AArch32 exception
    ...

    Conflicts:
    arch/arm/boot/dts/imx6qdl.dtsi
    arch/arm/mach-imx/Kconfig
    arch/arm/mach-imx/common.h
    arch/arm/mach-imx/suspend-imx6.S
    arch/arm64/boot/dts/freescale/imx8qxp-mek.dts
    arch/powerpc/include/asm/cacheflush.h
    drivers/cpufreq/imx6q-cpufreq.c
    drivers/dma/imx-sdma.c
    drivers/edac/synopsys_edac.c
    drivers/firmware/imx/imx-scu.c
    drivers/net/ethernet/freescale/fec.h
    drivers/net/ethernet/freescale/fec_main.c
    drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
    drivers/net/phy/phy_device.c
    drivers/perf/fsl_imx8_ddr_perf.c
    drivers/usb/cdns3/gadget.c
    drivers/usb/dwc3/gadget.c
    include/uapi/linux/dma-buf.h

    Signed-off-by: Jason Liu

    Jason Liu
     

11 Jun, 2020

1 commit


27 May, 2020

2 commits

  • commit fc9c03ce30f79b71807961bfcb42be191af79873 upstream.

    Allow me_cl object to be freed by releasing the reference
    that was acquired by one of the search functions:
    __mei_me_cl_by_uuid_id() or __mei_me_cl_by_uuid()

    Cc:
    Reported-by: 亿一
    Signed-off-by: Alexander Usyskin
    Signed-off-by: Tomas Winkler
    Link: https://lore.kernel.org/r/20200512223140.32186-1-tomas.winkler@intel.com
    Signed-off-by: Greg Kroah-Hartman

    Alexander Usyskin
     
  • commit 7a839dbab1be59f5ed3b3b046de29e166784c9b4 upstream.

    DMA transfers to and from the SD card stall for 10 seconds and run into
    timeout on RTS5260 card readers after ASPM was enabled.

    Adding a short msleep after disabling ASPM fixes the issue on several
    Dell Precision 7530/7540 systems I tested.

    This function is only called when waking up after the chip went into
    power-save after not transferring data for a few seconds. The added
    msleep does therefore not change anything in data transfer speed or
    induce any excessive waiting while data transfers are running, or the
    chip is sleeping. Only the transition from sleep to active is affected.

    Signed-off-by: Klaus Doth
    Cc: stable
    Link: https://lore.kernel.org/r/4434eaa7-2ee3-a560-faee-6cee63ebd6d4@doth.eu
    Signed-off-by: Greg Kroah-Hartman

    Klaus Doth
     

08 Apr, 2020

4 commits

  • commit 99397d33b763dc554d118aaa38cc5abc6ce985de upstream.

    Add Cedar Fork (CDF) device ids, those belongs to the cannon point family.

    Cc:
    Signed-off-by: Alexander Usyskin
    Signed-off-by: Tomas Winkler
    Link: https://lore.kernel.org/r/20200324210730.17672-1-tomas.winkler@intel.com
    Signed-off-by: Greg Kroah-Hartman

    Alexander Usyskin
     
  • commit b2ba9225e0313b1de631a44b7b48c109032bffec upstream.

    commit e03327122e2c ("pci_endpoint_test: Add 2 ioctl commands")
    uses module parameter 'irqtype' in pci_endpoint_test_set_irq()
    to check if IRQ vectors of a particular type (MSI or MSI-X or
    LEGACY) is already allocated. However with multi-function devices,
    'irqtype' will not correctly reflect the IRQ type of the PCI device.

    Fix it here by adding 'irqtype' for each PCI device to show the
    IRQ type of a particular PCI device.

    Fixes: e03327122e2c ("pci_endpoint_test: Add 2 ioctl commands")
    Signed-off-by: Kishon Vijay Abraham I
    Signed-off-by: Lorenzo Pieralisi
    Cc: stable@vger.kernel.org # v4.19+
    Signed-off-by: Greg Kroah-Hartman

    Kishon Vijay Abraham I
     
  • commit 6b443e5c80b67a7b8a85b33d052d655ef9064e90 upstream.

    Adding more than 10 pci-endpoint-test devices results in
    "kobject_add_internal failed for pci-endpoint-test.1 with -EEXIST, don't
    try to register things with the same name in the same directory". This
    is because commit 2c156ac71c6b ("misc: Add host side PCI driver for PCI
    test function device") limited the length of the "name" to 20 characters.
    Change the length of the name to 24 in order to support upto 10000
    pci-endpoint-test devices.

    Fixes: 2c156ac71c6b ("misc: Add host side PCI driver for PCI test function device")
    Signed-off-by: Kishon Vijay Abraham I
    Signed-off-by: Lorenzo Pieralisi
    Cc: stable@vger.kernel.org # v4.14+
    Signed-off-by: Greg Kroah-Hartman

    Kishon Vijay Abraham I
     
  • commit 10cea23b6aae15e8324f4101d785687f2c514fe5 upstream.

    rts522a should use rts522a_pcr_ops, which is
    diffrent with rts5227 in phy/hw init setting.

    Fixes: ce6a5acc9387 ("mfd: rtsx: Add support for rts522A")
    Signed-off-by: YueHaibing
    Cc: stable
    Link: https://lore.kernel.org/r/20200326032618.20472-1-yuehaibing@huawei.com
    Signed-off-by: Greg Kroah-Hartman

    YueHaibing
     

25 Mar, 2020

1 commit

  • commit 4686392c32361c97e8434adf9cc77ad7991bfa81 upstream.

    The TX/RX register should not be treated the same way to allow for better
    support of tuning. Fix this by using a default initial value for TX.

    Signed-off-by: Ricky Wu
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/r/20200316025232.1167-1-ricky_wu@realtek.com
    [Ulf: Updated changelog]
    Signed-off-by: Ulf Hansson
    Acked-by: Greg Kroah-Hartman
    Signed-off-by: Greg Kroah-Hartman

    Ricky Wu