Re: [PATCH 0/5] spi: spi-zynqmp-gqspi: fix spi issues

2021-04-16 Thread Quanyang Wang
Hi Mark, Sorry for any confusion caused. Thanks, Quanyang On 4/17/21 12:01 AM, Mark Brown wrote: On Fri, 16 Apr 2021 22:20:42 +0800, quanyang.w...@windriver.com wrote: V2: Remove all "Fixes:" tags since they base on some patches are not with "Fixes:". V1: This series fix some issues that oc

Re: [PATCH 1/5] spi: spi-zynqmp-gqspi: fix clk_enable/disable imbalance issue

2021-04-16 Thread Quanyang Wang
Hi Mark, On 4/16/21 11:12 PM, Mark Brown wrote: On Fri, Apr 16, 2021 at 10:04:30PM +0800, quanyang.wang wrote: I am sorry. These patches should NOT be with "Fixes" tag since they base on the patches which are not with "Fixes". May I send a V2 patch series which remove these "Fixes" tags? Well

[V2][PATCH 3/5] spi: spi-zynqmp-gqspi: Resolved slab-out-of-bounds bug

2021-04-16 Thread quanyang . wang
From: Amit Kumar Mahapatra During a transfer the driver filled the fifo with 4bytes, even if the data that needs to be transfer is less that 4bytes. This resulted in slab-out-of-bounds bug in KernelAddressSanitizer. This patch resolves slab-out-of-bounds bug by filling the fifo with the number o

[V2][PATCH 4/5] spi: spi-zynqmp-gqspi: fix use-after-free in zynqmp_qspi_exec_op

2021-04-16 Thread quanyang . wang
From: Quanyang Wang When handling op->addr, it is using the buffer "tmpbuf" which has been freed. This will trigger a use-after-free KASAN warning. Let's use temporary variables to store op->addr.val and op->cmd.opcode to fix this issue. Signed-off-by: Quanyang Wang ---

[V2][PATCH 5/5] spi: spi-zynqmp-gqspi: return -ENOMEM if dma_map_single fails

2021-04-16 Thread quanyang . wang
From: Quanyang Wang The spi controller supports 44-bit address space on AXI in DMA mode, so set dma_addr_t width to 44-bit to avoid using a swiotlb mapping. In addition, if dma_map_single fails, it should return immediately instead of continuing doing the DMA operation which bases on invalid

[V2][PATCH 2/5] spi: spi-zynqmp-gqspi: fix hang issue when suspend/resume

2021-04-16 Thread quanyang . wang
From: Quanyang Wang After calling platform_set_drvdata(pdev, xqspi) in probe, the return value of dev_get_drvdata(dev) is a pointer to struct zynqmp_qspi but not struct spi_controller. A wrong structure type passing to the functions spi_controller_suspend/resume will hang the system. And we

[V2][PATCH 1/5] spi: spi-zynqmp-gqspi: fix clk_enable/disable imbalance issue

2021-04-16 Thread quanyang . wang
From: Quanyang Wang The clks "pclk" and "ref_clk" are enabled twice during the probe. The first time is in the function zynqmp_qspi_probe and the second time is in zynqmp_qspi_setup_op which is called by devm_spi_register_controller. Then calling zynqmp_qspi_remove (rmmod thi

[V2][PATCH 0/5] spi: spi-zynqmp-gqspi: fix spi issues

2021-04-16 Thread quanyang . wang
From: Quanyang Wang Hi all, V2: Remove all "Fixes:" tags since they base on some patches are not with "Fixes:". V1: This series fix some issues that occurs in spi-zynqmp-gqspi.c. Thanks, Quanyang Amit Kumar Mahapatra (1): spi: spi-zynqmp-gqspi: Resolved slab-out-of-

[PATCH 4/5] spi: spi-zynqmp-gqspi: fix use-after-free in zynqmp_qspi_exec_op

2021-04-15 Thread quanyang . wang
From: Quanyang Wang When handling op->addr, it is using the buffer "tmpbuf" which has been freed. This will trigger a use-after-free KASAN warning. Let's use temporary variables to store op->addr.val and op->cmd.opcode to fix this issue. Fixes: 1c26372e5aa9 ("

[PATCH 5/5] spi: spi-zynqmp-gqspi: return -ENOMEM if dma_map_single fails

2021-04-15 Thread quanyang . wang
From: Quanyang Wang The spi controller supports 44-bit address space on AXI in DMA mode, so set dma_addr_t width to 44-bit to avoid using a swiotlb mapping. In addition, if dma_map_single fails, it should return immediately instead of continuing doing the DMA operation which bases on invalid

[PATCH 1/5] spi: spi-zynqmp-gqspi: fix clk_enable/disable imbalance issue

2021-04-15 Thread quanyang . wang
From: Quanyang Wang The clks "pclk" and "ref_clk" are enabled twice during the probe. The first time is in the function zynqmp_qspi_probe and the second time is in zynqmp_qspi_setup_op which is called by devm_spi_register_controller. Then calling zynqmp_qspi_remove (rmmod thi

[PATCH 3/5] spi: spi-zynqmp-gqspi: Resolved slab-out-of-bounds bug

2021-04-15 Thread quanyang . wang
From: Amit Kumar Mahapatra During a transfer the driver filled the fifo with 4bytes, even if the data that needs to be transfer is less that 4bytes. This resulted in slab-out-of-bounds bug in KernelAddressSanitizer. This patch resolves slab-out-of-bounds bug by filling the fifo with the number o

[PATCH 2/5] spi: spi-zynqmp-gqspi: fix hang issue when suspend/resume

2021-04-15 Thread quanyang . wang
From: Quanyang Wang After calling platform_set_drvdata(pdev, xqspi) in probe, the return value of dev_get_drvdata(dev) is a pointer to struct zynqmp_qspi but not struct spi_controller. A wrong structure type passing to the functions spi_controller_suspend/resume will hang the system. And we

[PATCH 0/5] spi: spi-zynqmp-gqspi: fix spi issues

2021-04-15 Thread quanyang . wang
From: Quanyang Wang Hi all, This series fix some issues that occurs in spi-zynqmp-gqspi.c. Thanks, Quanyang Amit Kumar Mahapatra (1): spi: spi-zynqmp-gqspi: Resolved slab-out-of-bounds bug Quanyang Wang (4): spi: spi-zynqmp-gqspi: fix clk_enable/disable imbalance issue spi: spi-zynqmp

[PATCH 4/4] spi: spi-zynqmp-gqspi: fix incorrect operating mode in zynqmp_qspi_read_op

2021-04-07 Thread quanyang . wang
From: Quanyang Wang When starting a read operation, we should call zynqmp_qspi_setuprxdma first to set xqspi->mode according to xqspi->bytes_to_receive and to calculate correct xqspi->dma_rx_bytes. Then in the function zynqmp_qspi_fillgenfifo, generate the appropriate command with opera

[PATCH 3/4] spi: spi-zynqmp-gqspi: transmit dummy circles by using the controller's internal functionality

2021-04-07 Thread quanyang . wang
From: Quanyang Wang There is a data corruption issue that occurs in the reading operation (cmd:0x6c) when transmitting common data as dummy circles. The gqspi controller has the functionality to send dummy clock circles. When writing data with the fields [receive, transmit, data_xfer] = [0,0,1

[PATCH 2/4] spi: spi-zynqmp-gqspi: add mutex locking for exec_op

2021-04-07 Thread quanyang . wang
From: Quanyang Wang The spi-mem framework has no locking to prevent ctlr->mem_ops->exec_op from concurrency. So add the locking to zynqmp_qspi_exec_op. Fixes: 1c26372e5aa9 ("spi: spi-zynqmp-gqspi: Update driver to use spi-mem framework") Signed-off-by: Quanyang Wang Reviewe

[PATCH 1/4] spi: spi-zynqmp-gqspi: use wait_for_completion_timeout to make zynqmp_qspi_exec_op not interruptible

2021-04-07 Thread quanyang . wang
From: Quanyang Wang When Ctrl+C occurs during the process of zynqmp_qspi_exec_op, the function wait_for_completion_interruptible_timeout will return a non-zero value -ERESTARTSYS immediately. This will disrupt the SPI memory operation because the data transmitting may begin before the command or

[PATCH 0/4] spi: spi-zynqmp-gpspi: fix some issues

2021-04-07 Thread quanyang . wang
From: Quanyang Wang Hello, This series fix some issues that occurs when the gqspi driver switches to spi-mem framework. Hi Amit, I rewrite the "Subject" and "commit message" of these patches, so they look different from the ones which you reviewed before. I still keep yo

[V2][PATCH] clk: zynqmp: move zynqmp_pll_set_mode out of round_rate callback

2021-04-06 Thread quanyang . wang
From: Quanyang Wang The round_rate callback should only perform rate calculation and not involve calling zynqmp_pll_set_mode to change the pll mode. So let's move zynqmp_pll_set_mode out of round_rate and to set_rate callback. Fixes: 3fde0e16d016 ("drivers: clk: Add ZynqMP cl

[V3][PATCH] clk: zynqmp: pll: add set_pll_mode to check condition in zynqmp_pll_enable

2021-04-06 Thread quanyang . wang
From: Quanyang Wang If there is a IOCTL_SET_PLL_FRAC_MODE request sent to ATF ever, we shouldn't skip invoking PM_CLOCK_ENABLE fn even though this pll has been enabled. In ATF implementation, it will only assign the mode to the variable (struct pm_pll *)pll->mode when

[PATCH] clk: zynqmp: move zynqmp_pll_set_mode out of round_rate callback

2021-03-31 Thread quanyang . wang
From: Quanyang Wang The round_rate callback should only perform rate calculation and not involve calling zynqmp_pll_set_mode to change the pll mode. So let's move zynqmp_pll_set_mode out of round_rate and to set_rate callback. Reported-by: Laurent Pinchart Signed-off-by: Quanyang

[V2] [PATCH] clk: zynqmp: pll: add set_pll_mode to check condition in zynqmp_pll_enable

2021-03-30 Thread quanyang . wang
From: Quanyang Wang If there is a IOCTL_SET_PLL_FRAC_MODE request sent to ATF ever, we shouldn't skip invoking PM_CLOCK_ENABLE fn even though this pll has been enabled. In ATF implementation, it will only assign the mode to the variable (struct pm_pll *)pll->mode when

[V2][PATCH] cpufreq: dt: check the -EPROBE_DEFER error returned by dev_pm_opp_of_cpumask_add_table

2021-03-24 Thread quanyang . wang
From: Quanyang Wang The function dev_pm_opp_of_cpumask_add_table may return -EPROBE_DEFER which comes from clk_get(dev, NULL) in _update_opp_table_clk. Ignoring this error and call the next function dev_pm_opp_of_cpumask_add_table may cause dt_cpufreq_probe return -ENODEV instead of

[V2][PATCH] cpufreq: dt: check the -EPROBE_DEFER error returned by dev_pm_opp_of_cpumask_add_table

2021-03-24 Thread quanyang . wang
From: Quanyang Wang The function dev_pm_opp_of_cpumask_add_table may return -EPROBE_DEFER which comes from clk_get(dev, NULL) in _update_opp_table_clk. Ignoring this error and call the next function dev_pm_opp_of_cpumask_add_table may cause dt_cpufreq_probe return -ENODEV instead of

[PATCH] cpufreq: dt: check the error returned by dev_pm_opp_of_cpumask_add_table

2021-03-24 Thread quanyang . wang
From: Quanyang Wang The function dev_pm_opp_of_cpumask_add_table may return zero or an error. When it returns an error, this means that no OPP table is added for the cpumask because _dev_pm_opp_cpumask_remove_table is called to free all OPPs associated with the cpu devices in the error label

[V2][PATCH] drm: xlnx: zynqmp: release reset to DP controller before accessing DP registers

2021-03-22 Thread quanyang . wang
From: Quanyang Wang When insmod zynqmp-dpsub.ko after rmmod it, system will hang with the error log as below: root@xilinx-zynqmp:~# insmod zynqmp-dpsub.ko [ 88.391289] [drm] Initialized zynqmp-dpsub 1.0.0 20130509 for fd4a.display on minor 0 [ 88.529906] Console: switching to colour

[PATCH] drm: xlnx: zynqmp: release reset to DP controller before accessing DP registers

2021-03-20 Thread quanyang . wang
From: Quanyang Wang When insmod zynqmp-dpsub.ko after rmmod it, system will hang with the error log as below: root@xilinx-zynqmp:~# insmod zynqmp-dpsub.ko [ 88.391289] [drm] Initialized zynqmp-dpsub 1.0.0 20130509 for fd4a.display on minor 0 [ 88.529906] Console: switching to colour

[PATCH 1/2] clk: zynqmp: pll: add set_pll_mode to check condition in zynqmp_pll_enable

2021-03-19 Thread quanyang . wang
From: Quanyang Wang If there is a IOCTL_SET_PLL_FRAC_MODE request sent to ATF ever, we shouldn't skip invoking PM_CLOCK_ENABLE fn even though this pll has been enabled. In ATF implementation, it will only assign the mode to the variable (struct pm_pll *)pll->mode when

[PATCH] drm: xlnx: call pm_runtime_get_sync before setting pixel clock

2021-03-09 Thread quanyang . wang
From: Quanyang Wang The Runtime PM subsystem will force the device "fd4a.zynqmp-display" to enter suspend state while booting if the following conditions are met: - the usage counter is zero (pm_runtime_get_sync hasn't been called yet) - no 'active' children (no zy

[PATCH] arm64: dts: zynqmp: Remove si5328 device nodes

2021-03-08 Thread quanyang . wang
From: Quanyang Wang The function of_i2c_get_board_info will call of_modalias_node to check if a device_node contains "compatible" string. But for the device si5328 at zcu102/zcu106 boards, there is no proper DT bindings for them. So remove si5328 device nodes from dts files to eli

[PATCH] arm64: dts: zynqmp: Add compatible strings for si5328

2021-03-07 Thread quanyang . wang
From: Quanyang Wang The function of_i2c_get_board_info will call of_modalias_node to check if a device_node contains "compatible" string. So let's assign the proper string "silabs,si5328" to clock-generator@69's compatible property to eliminate the error info

[RESEND][PATCH] drm/tilcdc: send vblank event when disabling crtc

2021-02-09 Thread quanyang . wang
From: Quanyang Wang When run xrandr to change resolution on Beaglebone Black board, it will print the error information: root@beaglebone:~# xrandr -display :0 --output HDMI-1 --mode 720x400 [drm:drm_crtc_commit_wait] *ERROR* flip_done timed out [drm:drm_atomic_helper_wait_for_dependencies

[PATCH] drm/xlnx: fix kmemleak by sending vblank_event in atomic_disable

2021-02-01 Thread quanyang . wang
From: Quanyang Wang When running xrandr to change resolution of DP, the kmemleak as below can be observed: unreferenced object 0x00080a351000 (size 256): comm "Xorg", pid 248, jiffies 4294899614 (age 19.960s) hex dump (first 32 bytes): 98 a0 bc 01 08 00 ff ff 01 00 00 00 0

[PATCH] gpiolib: free device name on error path to fix kmemleak

2021-01-29 Thread quanyang . wang
From: Quanyang Wang In gpiochip_add_data_with_key, we should check the return value of dev_set_name to ensure that device name is allocated successfully and then add a label on the error path to free device name to fix kmemleak as below: unreferenced object 0xc2d6fc40 (size 64): comm "kw

[PATCH] drm/tilcdc: send vblank event when disabling crtc

2021-01-28 Thread quanyang . wang
From: Quanyang Wang When run xrandr to change resolution on Beaglebone Black board, it will print the error information: root@beaglebone:~# xrandr -display :0 --output HDMI-1 --mode 720x400 [drm:drm_crtc_commit_wait] *ERROR* flip_done timed out [drm:drm_atomic_helper_wait_for_dependencies

[PATCH] opp: fix memory leak in _allocate_opp_table

2020-12-24 Thread quanyang . wang
From: Quanyang Wang In function _allocate_opp_table, opp_dev is allocated and referenced by opp_table via _add_opp_dev. But in the case that the subsequent calls return -EPROBE_DEFER, it will jump to err label and opp_table will be freed. Then opp_dev becomes an unreferenced object to cause

[PATCH] arm64: defconfig: enable clock driver for ZynqMP platforms

2020-12-08 Thread quanyang . wang
From: Quanyang Wang The Zynqmp Ultrascale clock controller generates clocks for peripherals by default. So enable this clock driver for ZynqMP platforms. Signed-off-by: Quanyang Wang --- arch/arm64/configs/defconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm64/configs

[PATCH] clk: zynqmp: enable COMMON_CLK_ZYNQMP for ARCH_ZYNQMP automatically

2020-12-08 Thread quanyang . wang
From: Quanyang Wang The Zynqmp Ultrascale clock controller generates clocks for peripherals, so we need to enable it when ARCH_ZYNQMP is selected. Signed-off-by: Quanyang Wang --- drivers/clk/zynqmp/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/clk/zynqmp/Kconfig b

[tip: timers/urgent] time/sched_clock: Mark sched_clock_read_begin/retry() as notrace

2020-10-26 Thread tip-bot2 for Quanyang Wang
The following commit has been merged into the timers/urgent branch of tip: Commit-ID: 4cd2bb12981165f865d2b8ed92b446b52310ef74 Gitweb: https://git.kernel.org/tip/4cd2bb12981165f865d2b8ed92b446b52310ef74 Author:Quanyang Wang AuthorDate:Tue, 29 Sep 2020 16:20:27 +08:00

Re: [PATCH V2] time/sched_clock: mark sched_clock_read_begin/retry as notrace

2020-09-29 Thread Quanyang Wang
Hi Peter, On 9/29/20 3:49 PM, Peter Zijlstra wrote: On Tue, Sep 29, 2020 at 09:50:51AM +0800, quanyang.w...@windriver.com wrote: From: Quanyang Wang Since sched_clock_read_begin and sched_clock_read_retry are called by notrace function sched_clock, they shouldn't be traceable either, or

Re: [PATCH] time/sched_clock: mark sched_clock_read_begin as notrace

2020-09-28 Thread Quanyang Wang
Hi Peter, On 9/28/20 6:58 PM, Peter Zijlstra wrote: On Mon, Sep 28, 2020 at 06:49:52PM +0800, quanyang.w...@windriver.com wrote: From: Quanyang Wang Since sched_clock_read_begin is called by notrace function sched_clock, it shouldn't be traceable either, or else __ftrace_graph_caller