Re: [PATCH] security: keys: delete repeated words in comments
On Fri, Aug 07, 2020 at 09:51:23AM -0700, Randy Dunlap wrote: > Drop repeated words in comments. > {to, will, the} > > Signed-off-by: Randy Dunlap > Cc: David Howells > Cc: Jarkko Sakkinen > Cc: keyri...@vger.kernel.org > Cc: James Morris > Cc: "Serge E. Hallyn" > Cc: linux-security-mod...@vger.kernel.org Reviewed-by: Jarkko Sakkinen /Jarkko
Re: [PATCH 5.7 000/393] 5.7.16-rc1 review
On Mon, 17 Aug 2020 at 21:14, Greg Kroah-Hartman wrote: > > This is the start of the stable review cycle for the 5.7.16 release. > There are 393 patches in this series, all will be posted as a response > to this one. If anyone has any issues with these being applied, please > let me know. > > Responses should be made by Wed, 19 Aug 2020 14:36:49 +. > Anything received after that time might be too late. > > The whole patch series can be found in one patch at: > > https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.7.16-rc1.gz > or in the git tree and branch at: > > git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git > linux-5.7.y > and the diffstat can be found below. > > thanks, > > greg k-h Results from Linaro’s test farm. No regressions on arm64, arm, x86_64, and i386. Summary kernel: 5.7.16-rc1 git repo: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git git branch: linux-5.7.y git commit: 833b53db2607bc32cd4574e9cf2ddf924310a571 git describe: v5.7.15-394-g833b53db2607 Test details: https://qa-reports.linaro.org/lkft/linux-stable-rc-5.7-oe/build/v5.7.15-394-g833b53db2607 No regressions (compared to build v5.7.15) No fixes (compared to build v5.7.15) Ran 32256 total tests in the following environments and test suites. Environments -- - dragonboard-410c - hi6220-hikey - i386 - juno-r2 - juno-r2-compat - juno-r2-kasan - nxp-ls2088 - qemu_arm - qemu_arm64 - qemu_i386 - qemu_x86_64 - x15 - x86 - x86-kasan Test Suites --- * build * igt-gpu-tools * install-android-platform-tools-r2600 * kselftest * kselftest/drivers * kselftest/filesystems * kselftest/net * libhugetlbfs * linux-log-parser * ltp-commands-tests * ltp-containers-tests * ltp-cve-tests * ltp-dio-tests * ltp-fcntl-locktests-tests * ltp-filecaps-tests * ltp-fs_bind-tests * ltp-fs_perms_simple-tests * ltp-fsx-tests * ltp-hugetlb-tests * ltp-io-tests * ltp-ipc-tests * ltp-math-tests * ltp-mm-tests * ltp-nptl-tests * ltp-pty-tests * ltp-securebits-tests * ltp-syscalls-tests * ltp-tracing-tests * perf * v4l2-compliance * ltp-controllers-tests * ltp-sched-tests * network-basic-tests * ltp-cap_bounds-tests * ltp-cpuhotplug-tests * ltp-crypto-tests * ltp-fs-tests * ltp-open-posix-tests * kselftest-vsyscall-mode-native * kselftest-vsyscall-mode-native/drivers * kselftest-vsyscall-mode-native/filesystems * kselftest-vsyscall-mode-native/net * kselftest-vsyscall-mode-none * kselftest-vsyscall-mode-none/drivers * kselftest-vsyscall-mode-none/filesystems * kselftest-vsyscall-mode-none/net * ssuite -- Linaro LKFT https://lkft.linaro.org
Re: [PATCH 11/17] bpf/task_iter: In task_file_seq_get_next use fnext_task
Hi "Eric, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on bpf/master] [also build test WARNING on linus/master v5.9-rc1 next-20200817] [cannot apply to bpf-next/master linux/master] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch] url: https://github.com/0day-ci/linux/commits/Eric-W-Biederman/exec-Move-unshare_files-to-fix-posix-file-locking-during-exec/20200818-061552 base: https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf.git master config: i386-randconfig-m021-20200818 (attached as .config) compiler: gcc-9 (Debian 9.3.0-15) 9.3.0 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot smatch warnings: kernel/bpf/task_iter.c:162 task_file_seq_get_next() warn: ignoring unreachable code. # https://github.com/0day-ci/linux/commit/66f80aa453b17f8932b42e18265dba5fdb32490e git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Eric-W-Biederman/exec-Move-unshare_files-to-fix-posix-file-locking-during-exec/20200818-061552 git checkout 66f80aa453b17f8932b42e18265dba5fdb32490e vim +162 kernel/bpf/task_iter.c 128 129 static struct file * 130 task_file_seq_get_next(struct bpf_iter_seq_task_file_info *info, 131 struct task_struct **task) 132 { 133 struct pid_namespace *ns = info->common.ns; 134 u32 curr_tid = info->tid; 135 struct task_struct *curr_task; 136 unsigned int curr_fd = info->fd; 137 138 /* If this function returns a non-NULL file object, 139 * it held a reference to the task/file. 140 * Otherwise, it does not hold any reference. 141 */ 142 again: 143 if (*task) { 144 curr_task = *task; 145 curr_fd = info->fd; 146 } else { 147 curr_task = task_seq_get_next(ns, _tid); 148 if (!curr_task) 149 return NULL; 150 151 /* set *task and info->tid */ 152 *task = curr_task; 153 if (curr_tid == info->tid) { 154 curr_fd = info->fd; 155 } else { 156 info->tid = curr_tid; 157 curr_fd = 0; 158 } 159 } 160 161 rcu_read_lock(); > 162 for (;; curr_fd++) { 163 struct file *f; 164 165 f = fnext_task(curr_task, _fd); 166 if (!f) 167 break; 168 169 /* set info->fd */ 170 info->fd = curr_fd; 171 get_file(f); 172 rcu_read_unlock(); 173 return f; 174 } 175 176 /* the current task is done, go to the next task */ 177 rcu_read_unlock(); 178 put_task_struct(curr_task); 179 *task = NULL; 180 info->fd = 0; 181 curr_tid = ++(info->tid); 182 goto again; 183 } 184 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-...@lists.01.org .config.gz Description: application/gzip
[PATCH v7 1/2] Add DT bindings YAML schema for PWM fan controller of LGM SoC
Intel's LGM(Lightning Mountain) SoC contains a PWM fan controller which is only used to control the fan attached to the system. This PWM controller does not have any other consumer other than fan. Add DT bindings documentation for this PWM fan controller. Signed-off-by: Rahul Tanwar --- .../devicetree/bindings/pwm/intel,lgm-pwm.yaml | 54 ++ 1 file changed, 54 insertions(+) create mode 100644 Documentation/devicetree/bindings/pwm/intel,lgm-pwm.yaml diff --git a/Documentation/devicetree/bindings/pwm/intel,lgm-pwm.yaml b/Documentation/devicetree/bindings/pwm/intel,lgm-pwm.yaml new file mode 100644 index ..289b82213e23 --- /dev/null +++ b/Documentation/devicetree/bindings/pwm/intel,lgm-pwm.yaml @@ -0,0 +1,54 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/pwm/intel,lgm-pwm.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: LGM SoC PWM fan controller + +maintainers: + - Rahul Tanwar + +properties: + compatible: +const: intel,lgm-pwm + + reg: +maxItems: 1 + + "#pwm-cells": +const: 2 + + clocks: +maxItems: 1 + + resets: +maxItems: 1 + + pwm-fanmode: +$ref: '/schemas/types.yaml#/definitions/uint32' +description: Specifies PWM fan mode. Default when unspecified is 2. + + pwm-maxrpm: +$ref: '/schemas/types.yaml#/definitions/uint32' +description: + Specifies maximum RPM of PWM fan attached to the system. + Default when unspecified is 4000. + +required: + - compatible + - reg + - clocks + - resets + +additionalProperties: false + +examples: + - | +pwm: pwm@e0d0 { +compatible = "intel,lgm-pwm"; +reg = <0xe0d0 0x30>; +#pwm-cells = <2>; +clocks = < 126>; +resets = < 0x30 21>; +}; -- 2.11.0
[PATCH v5] perf test: Introduce script for Arm CoreSight testing
We need a simple method to test Perf with Arm CoreSight drivers, this could be used for smoke testing when new patch is coming for perf or CoreSight drivers, and we also can use the test to confirm if the CoreSight has been enabled successfully on new platforms. This patch introduces the shell script test_arm_coresight.sh which is under the 'pert test' framework. This script provides three testing scenarios: Test scenario 1: traverse all possible paths between source and sink For traversing possible paths, simply to say, the testing rationale is source oriented testing, it traverses every source (now only refers to ETM device) and test its all possible sinks. To search the complete paths from one specific source to its sinks, this patch relies on the sysfs '/sys/bus/coresight/devices/devX/out:Y' for depth-first search (DFS) for iteration connected device nodes, if the output device is detected as a sink device (the script will exclude TPIU device which can not be supported for perf PMU), then it will test trace data recording and decoding for it. The script runs three output testings for every trace data: - Test branch samples dumping with 'perf script' command; - Test branch samples reporting with 'perf report' command; - Use option '--itrace=i1000i' to insert synthesized instructions events and the script will check if perf can output the percentage value successfully based on the instruction samples. Test scenario 2: system-wide test For system-wide testing, it passes option '-a' to perf tool to enable tracing on all CPUs, so it's hard to say which program will be traced. But perf tool itself contributes much overload in this case, so it will parse trace data and check if process 'perf' can be detected or not. Test scenario 3: snapshot mode test. For snapshot mode testing, it uses 'dd' command to launch a long running program, so this can give chance to send signal -USR2; it will check the captured trace data contains 'dd' related thread info or not. If any test fails, it will report failure and directly exit with error. This test will be only applied on a platform with PMU event 'cs_etm//', otherwise will skip the testing. Below is detailed usage for it: # cd $linux/tools/perf -> This is important so can use shell script # perf test list [...] 65: probe libc's inet_pton & backtrace it with ping 66: Check Arm CoreSight trace data recording and branch samples 67: Check open filename arg using perf trace + vfs_getname 68: Zstd perf.data compression/decompression 69: Add vfs_getname probe to get syscall args filenames 70: Use vfs_getname probe to get syscall args filenames # perf test 66 66: Check Arm CoreSight trace data recording and branch samples: Ok Signed-off-by: Leo Yan --- Changes in v5: - Fixed testing name to system-wide testing (Suzuki); - Used 'enable_sink' existence to check if the device is a sink (Suzuki); - Excluded TPIU from sink devices; - Fixed Misleading output (Suzuki); - Removed '--per-thread' option from snapshot testing (Suzuki). tools/perf/tests/shell/test_arm_coresight.sh | 175 +++ 1 file changed, 175 insertions(+) create mode 100755 tools/perf/tests/shell/test_arm_coresight.sh diff --git a/tools/perf/tests/shell/test_arm_coresight.sh b/tools/perf/tests/shell/test_arm_coresight.sh new file mode 100755 index ..8696bb5df45a --- /dev/null +++ b/tools/perf/tests/shell/test_arm_coresight.sh @@ -0,0 +1,175 @@ +#!/bin/sh +# Check Arm CoreSight trace data recording and branch samples + +# Uses the 'perf record' to record trace data with Arm CoreSight sinks; +# then verify if there have any branch samples and instruction samples +# are generated by CoreSight with 'perf script' and 'perf report' +# commands. + +# SPDX-License-Identifier: GPL-2.0 +# Leo Yan , 2020 + +perfdata=$(mktemp /tmp/__perf_test.perf.data.X) +file=$(mktemp /tmp/temporary_file.X) + +skip_if_no_cs_etm_event() { + perf list | grep -q 'cs_etm//' && return 0 + + # cs_etm event doesn't exist + return 2 +} + +skip_if_no_cs_etm_event || exit 2 + +record_touch_file() { + echo "Recording trace (only user mode) with path: CPU$2 => $1" + rm -f $file + perf record -o ${perfdata} -e cs_etm/@$1/u --per-thread \ + -- taskset -c $2 touch $file +} + +perf_script_branch_samples() { + echo "Looking at perf.data file for dumping branch samples:" + + # Below is an example of the branch samples dumping: + # touch 6512 1 branches:u: b220824c strcmp+0xc (/lib/aarch64-linux-gnu/ld-2.27.so) + # touch 6512 1 branches:u: b22082e0 strcmp+0xa0 (/lib/aarch64-linux-gnu/ld-2.27.so) + # touch 6512 1 branches:u: b2208320 strcmp+0xe0 (/lib/aarch64-linux-gnu/ld-2.27.so) + perf script -F,-time -i ${perfdata} | \ + egrep " +$1 +[0-9]+ .* +branches:([u|k]:)? +" +} +
[PATCH v7 2/2] Add PWM fan controller driver for LGM SoC
Intel Lightning Mountain(LGM) SoC contains a PWM fan controller. This PWM controller does not have any other consumer, it is a dedicated PWM controller for fan attached to the system. Add driver for this PWM fan controller. Signed-off-by: Rahul Tanwar --- drivers/pwm/Kconfig | 11 ++ drivers/pwm/Makefile| 1 + drivers/pwm/pwm-intel-lgm.c | 267 3 files changed, 279 insertions(+) create mode 100644 drivers/pwm/pwm-intel-lgm.c diff --git a/drivers/pwm/Kconfig b/drivers/pwm/Kconfig index 7dbcf6973d33..f7a832268c79 100644 --- a/drivers/pwm/Kconfig +++ b/drivers/pwm/Kconfig @@ -232,6 +232,17 @@ config PWM_IMX_TPM To compile this driver as a module, choose M here: the module will be called pwm-imx-tpm. +config PWM_INTEL_LGM + tristate "Intel LGM PWM support" + depends on OF && HAS_IOMEM + depends on X86 || COMPILE_TEST + select REGMAP_MMIO + help + Generic PWM fan controller driver for LGM SoC. + + To compile this driver as a module, choose M here: the module + will be called pwm-intel-lgm. + config PWM_IQS620A tristate "Azoteq IQS620A PWM support" depends on MFD_IQS62X || COMPILE_TEST diff --git a/drivers/pwm/Makefile b/drivers/pwm/Makefile index 2c2ba0a03557..e9431b151694 100644 --- a/drivers/pwm/Makefile +++ b/drivers/pwm/Makefile @@ -20,6 +20,7 @@ obj-$(CONFIG_PWM_IMG) += pwm-img.o obj-$(CONFIG_PWM_IMX1) += pwm-imx1.o obj-$(CONFIG_PWM_IMX27)+= pwm-imx27.o obj-$(CONFIG_PWM_IMX_TPM) += pwm-imx-tpm.o +obj-$(CONFIG_PWM_INTEL_LGM)+= pwm-intel-lgm.o obj-$(CONFIG_PWM_IQS620A) += pwm-iqs620a.o obj-$(CONFIG_PWM_JZ4740) += pwm-jz4740.o obj-$(CONFIG_PWM_LP3943) += pwm-lp3943.o diff --git a/drivers/pwm/pwm-intel-lgm.c b/drivers/pwm/pwm-intel-lgm.c new file mode 100644 index ..7f26a30c70f1 --- /dev/null +++ b/drivers/pwm/pwm-intel-lgm.c @@ -0,0 +1,267 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (C) 2020 Intel Corporation. + * + * Limitations: + * - The hardware supports fixed period which is dependent on 2/3 or 4 + * wire fan mode. + * - Supports normal polarity. Does not support changing polarity. + * - When PWM is disabled, output of PWM will become 0(inactive). It doesn't + * keep track of running period. + * - When duty cycle is changed, PWM output may be a mix of previous setting + * and new setting for the first period. From second period, the output is + * based on new setting. + * - It is a dedicated PWM fan controller. There are no other consumers for + * this PWM controller. + */ +#include +#include +#include +#include +#include +#include +#include + +#define LGM_PWM_FAN_CON0 0x0 +#define LGM_PWM_FAN_EN_EN BIT(0) +#define LGM_PWM_FAN_EN_DIS 0x0 +#define LGM_PWM_FAN_EN_MSK BIT(0) +#define LGM_PWM_FAN_MODE_2WIRE 0x0 +#define LGM_PWM_FAN_MODE_4WIRE 0x1 +#define LGM_PWM_FAN_MODE_MSK BIT(1) +#define LGM_PWM_FAN_DC_MSK GENMASK(23, 16) + +#define LGM_PWM_FAN_CON1 0x4 +#define LGM_PWM_FAN_MAX_RPM_MSKGENMASK(15, 0) + +#define LGM_PWM_MAX_RPM(BIT(16) - 1) +#define LGM_PWM_DEFAULT_RPM4000 +#define LGM_PWM_MAX_DUTY_CYCLE (BIT(8) - 1) + +#define LGM_PWM_DC_BITS8 + +#define LGM_PWM_PERIOD_2WIRE_NSECS 4000 +#define LGM_PWM_PERIOD_4WIRE_NSECS 4 + +struct lgm_pwm_chip { + struct pwm_chip chip; + struct regmap *regmap; + struct clk *clk; + struct reset_control *rst; + u32 period; +}; + +static inline struct lgm_pwm_chip *to_lgm_pwm_chip(struct pwm_chip *chip) +{ + return container_of(chip, struct lgm_pwm_chip, chip); +} + +static int lgm_pwm_enable(struct pwm_chip *chip, bool enable) +{ + struct lgm_pwm_chip *pc = to_lgm_pwm_chip(chip); + struct regmap *regmap = pc->regmap; + + return regmap_update_bits(regmap, LGM_PWM_FAN_CON0, LGM_PWM_FAN_EN_MSK, + enable ? LGM_PWM_FAN_EN_EN : LGM_PWM_FAN_EN_DIS); +} + +static int lgm_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm, +const struct pwm_state *state) +{ + struct lgm_pwm_chip *pc = to_lgm_pwm_chip(chip); + u32 duty_cycle, val; + int ret; + + /* +* The hardware only supports +* normal polarity and fixed period. +*/ + if (state->polarity != PWM_POLARITY_NORMAL || + state->period < pc->period) + return -EINVAL; + + if (!state->enabled) { + ret = lgm_pwm_enable(chip, 0); + return ret; + } + + duty_cycle = min_t(u64, state->duty_cycle, pc->period); + val = duty_cycle * LGM_PWM_MAX_DUTY_CYCLE / pc->period; + + ret = regmap_update_bits(pc->regmap, LGM_PWM_FAN_CON0,
[PATCH] md: only calculate blocksize once and use i_blocksize()
We alreday has the interface i_blocksize(), which can be used to get blocksize, so use it. Only calculate blocksize once and use it within read_page(). Signed-off-by: Xianting Tian --- drivers/md/md-bitmap.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/md/md-bitmap.c b/drivers/md/md-bitmap.c index 95a5f3757..0d5544868 100644 --- a/drivers/md/md-bitmap.c +++ b/drivers/md/md-bitmap.c @@ -357,11 +357,12 @@ static int read_page(struct file *file, unsigned long index, struct inode *inode = file_inode(file); struct buffer_head *bh; sector_t block, blk_cur; + unsigned long blocksize = i_blocksize(inode); pr_debug("read bitmap file (%dB @ %llu)\n", (int)PAGE_SIZE, (unsigned long long)index << PAGE_SHIFT); - bh = alloc_page_buffers(page, 1b_blocknr = block; bh->b_bdev = inode->i_sb->s_bdev; - if (count < (1 b_end_io = end_bitmap_write; bh->b_private = bitmap; -- 2.17.1
[PATCH v7 0/2] pwm: intel: Add PWM driver for a new SoC
Patch 1 adds dt binding document in YAML format. Patch 2 add PWM fan controller driver for LGM SoC. v7: - Address code quality related review concerns. - Rename fan related property to pwm-*. - Fix one make dt_binding_check reported error. v6: - Readjust .apply op as per review feedback. - Add back pwm-cells property to resolve make dt_binding_check error. pwm-cells is a required property for PWM driver. - Add back fan related optional properties. v5: - Address below review concerns from Uwe Kleine-K�nig. * Improve comments about Limitations. * Use return value of regmap_update_bits if container function returns error code. * Modify .apply op to have strict checking for fixed period supported by PWM HW. * Use u64 as type when use min_t for duty_cycle. * Add reset_control_assert() in failure case in probe where it was missing earlier. - Remove fan specific optional properties from pwm dt binding document (Rob Herring) v4: - Address below review concerns from Uwe Kleine-K�nig. * Improve notes and limitations comments. * Add common prefixes for all #defines. * Modify/Improve logic in .apply & .get_state ops as advised. * Skip error messages in probe when error is -EPROBE_DEFER. * Add dependencies in Kconfig (OF & HAS_IOMEM) and add select REGMAP_MMIO. * Address other code quality related review concerns. - Fix make dt_binding_check reported error in YAML file. v3: - Address below review concerns from Uwe Kleine-K�nig. * Remove fan rpm calibration task from the driver. * Modify apply op as per the review feedback. * Add roundup & round down where necessary. * Address other misc code quality related review concerns. * Use devm_reset_control_get_exclusive(). (Philipp Zabel) * Improve dt binding document. v2: - Address below review concerns from Uwe Kleine-K�nig. * Add notes and limitations about PWM HW. * Rename all functions and structure to lgm_pwm_* * Readjust space aligninment in structure fields to single space. * Switch to using apply instead of config/enable/disable. * Address other code quality related concerns. * Rebase to 5.8-rc1. - Address review concerns in dt binding YAML from Rob Herring. v1: - Initial version. Rahul Tanwar (2): Add DT bindings YAML schema for PWM fan controller of LGM SoC Add PWM fan controller driver for LGM SoC .../devicetree/bindings/pwm/intel,lgm-pwm.yaml | 54 + drivers/pwm/Kconfig| 11 + drivers/pwm/Makefile | 1 + drivers/pwm/pwm-intel-lgm.c| 267 + 4 files changed, 333 insertions(+) create mode 100644 Documentation/devicetree/bindings/pwm/intel,lgm-pwm.yaml create mode 100644 drivers/pwm/pwm-intel-lgm.c -- 2.11.0
[PATCH v2 1/3] block: Move bio merge related functions into blk-merge.c
It's better to move bio merge related functions into blk-merge.c, which contains all merge related functions. Signed-off-by: Baolin Wang Reviewed-by: Christoph Hellwig --- block/blk-core.c | 156 - block/blk-merge.c | 157 ++ 2 files changed, 157 insertions(+), 156 deletions(-) diff --git a/block/blk-core.c b/block/blk-core.c index d9d6326..ed79109 100644 --- a/block/blk-core.c +++ b/block/blk-core.c @@ -642,162 +642,6 @@ void blk_put_request(struct request *req) } EXPORT_SYMBOL(blk_put_request); -static void blk_account_io_merge_bio(struct request *req) -{ - if (!blk_do_io_stat(req)) - return; - - part_stat_lock(); - part_stat_inc(req->part, merges[op_stat_group(req_op(req))]); - part_stat_unlock(); -} - -bool bio_attempt_back_merge(struct request *req, struct bio *bio, - unsigned int nr_segs) -{ - const int ff = bio->bi_opf & REQ_FAILFAST_MASK; - - if (!ll_back_merge_fn(req, bio, nr_segs)) - return false; - - trace_block_bio_backmerge(req->q, req, bio); - rq_qos_merge(req->q, req, bio); - - if ((req->cmd_flags & REQ_FAILFAST_MASK) != ff) - blk_rq_set_mixed_merge(req); - - req->biotail->bi_next = bio; - req->biotail = bio; - req->__data_len += bio->bi_iter.bi_size; - - bio_crypt_free_ctx(bio); - - blk_account_io_merge_bio(req); - return true; -} - -bool bio_attempt_front_merge(struct request *req, struct bio *bio, - unsigned int nr_segs) -{ - const int ff = bio->bi_opf & REQ_FAILFAST_MASK; - - if (!ll_front_merge_fn(req, bio, nr_segs)) - return false; - - trace_block_bio_frontmerge(req->q, req, bio); - rq_qos_merge(req->q, req, bio); - - if ((req->cmd_flags & REQ_FAILFAST_MASK) != ff) - blk_rq_set_mixed_merge(req); - - bio->bi_next = req->bio; - req->bio = bio; - - req->__sector = bio->bi_iter.bi_sector; - req->__data_len += bio->bi_iter.bi_size; - - bio_crypt_do_front_merge(req, bio); - - blk_account_io_merge_bio(req); - return true; -} - -bool bio_attempt_discard_merge(struct request_queue *q, struct request *req, - struct bio *bio) -{ - unsigned short segments = blk_rq_nr_discard_segments(req); - - if (segments >= queue_max_discard_segments(q)) - goto no_merge; - if (blk_rq_sectors(req) + bio_sectors(bio) > - blk_rq_get_max_sectors(req, blk_rq_pos(req))) - goto no_merge; - - rq_qos_merge(q, req, bio); - - req->biotail->bi_next = bio; - req->biotail = bio; - req->__data_len += bio->bi_iter.bi_size; - req->nr_phys_segments = segments + 1; - - blk_account_io_merge_bio(req); - return true; -no_merge: - req_set_nomerge(q, req); - return false; -} - -/** - * blk_attempt_plug_merge - try to merge with %current's plugged list - * @q: request_queue new bio is being queued at - * @bio: new bio being queued - * @nr_segs: number of segments in @bio - * @same_queue_rq: pointer to request that gets filled in when - * another request associated with @q is found on the plug list - * (optional, may be %NULL) - * - * Determine whether @bio being queued on @q can be merged with a request - * on %current's plugged list. Returns %true if merge was successful, - * otherwise %false. - * - * Plugging coalesces IOs from the same issuer for the same purpose without - * going through @q->queue_lock. As such it's more of an issuing mechanism - * than scheduling, and the request, while may have elvpriv data, is not - * added on the elevator at this point. In addition, we don't have - * reliable access to the elevator outside queue lock. Only check basic - * merging parameters without querying the elevator. - * - * Caller must ensure !blk_queue_nomerges(q) beforehand. - */ -bool blk_attempt_plug_merge(struct request_queue *q, struct bio *bio, - unsigned int nr_segs, struct request **same_queue_rq) -{ - struct blk_plug *plug; - struct request *rq; - struct list_head *plug_list; - - plug = blk_mq_plug(q, bio); - if (!plug) - return false; - - plug_list = >mq_list; - - list_for_each_entry_reverse(rq, plug_list, queuelist) { - bool merged = false; - - if (rq->q == q && same_queue_rq) { - /* -* Only blk-mq multiple hardware queues case checks the -* rq in the same queue, there should be only one such -* rq in a queue -**/ - *same_queue_rq = rq; - } - - if (rq->q != q || !blk_rq_merge_ok(rq, bio)) - continue; - - switch (blk_try_merge(rq, bio)) {
[PATCH v2 0/3] Some clean-ups for bio merge
Hi, There are some duplicated code when trying to merge bio from pluged list and software queue, thus this patch set did some clean-ups when merging a bio. Any comments are welcome. Thanks. Changes from v1: - Drop patch 2 and patch 5 in v1 patch set. - Add reviewed-by tag from Christoph. - Move blk_mq_bio_list_merge() into blk-merge.c and rename it. - Some coding style improvements. Baolin Wang (3): block: Move bio merge related functions into blk-merge.c block: Add a new helper to attempt to merge a bio block: Remove blk_mq_attempt_merge() function block/blk-core.c | 156 -- block/blk-merge.c | 202 + block/blk-mq-sched.c | 94 +-- block/blk.h| 23 -- block/kyber-iosched.c | 2 +- include/linux/blk-mq.h | 2 - 6 files changed, 239 insertions(+), 240 deletions(-) -- 1.8.3.1
[PATCH v2 2/3] block: Add a new helper to attempt to merge a bio
There are lots of duplicated code when trying to merge a bio from plug list and sw queue, we can introduce a new helper to attempt to merge a bio, which can simplify the blk_mq_bio_list_merge() and blk_attempt_plug_merge(). Meanwhile move the blk_mq_bio_list_merge() into blk-merge.c and rename it as a generic name. Signed-off-by: Baolin Wang --- block/blk-merge.c | 101 +++-- block/blk-mq-sched.c | 52 ++--- block/blk.h| 23 --- block/kyber-iosched.c | 2 +- include/linux/blk-mq.h | 2 - 5 files changed, 95 insertions(+), 85 deletions(-) diff --git a/block/blk-merge.c b/block/blk-merge.c index 3619f2f..6868961 100644 --- a/block/blk-merge.c +++ b/block/blk-merge.c @@ -900,13 +900,14 @@ static void blk_account_io_merge_bio(struct request *req) part_stat_unlock(); } -bool bio_attempt_back_merge(struct request *req, struct bio *bio, - unsigned int nr_segs) +enum bio_merge_status bio_attempt_back_merge(struct request *req, +struct bio *bio, +unsigned int nr_segs) { const int ff = bio->bi_opf & REQ_FAILFAST_MASK; if (!ll_back_merge_fn(req, bio, nr_segs)) - return false; + return BIO_MERGE_FAILED; trace_block_bio_backmerge(req->q, req, bio); rq_qos_merge(req->q, req, bio); @@ -921,16 +922,17 @@ bool bio_attempt_back_merge(struct request *req, struct bio *bio, bio_crypt_free_ctx(bio); blk_account_io_merge_bio(req); - return true; + return BIO_MERGE_OK; } -bool bio_attempt_front_merge(struct request *req, struct bio *bio, - unsigned int nr_segs) +enum bio_merge_status bio_attempt_front_merge(struct request *req, + struct bio *bio, + unsigned int nr_segs) { const int ff = bio->bi_opf & REQ_FAILFAST_MASK; if (!ll_front_merge_fn(req, bio, nr_segs)) - return false; + return BIO_MERGE_FAILED; trace_block_bio_frontmerge(req->q, req, bio); rq_qos_merge(req->q, req, bio); @@ -947,11 +949,12 @@ bool bio_attempt_front_merge(struct request *req, struct bio *bio, bio_crypt_do_front_merge(req, bio); blk_account_io_merge_bio(req); - return true; + return BIO_MERGE_OK; } -bool bio_attempt_discard_merge(struct request_queue *q, struct request *req, - struct bio *bio) +enum bio_merge_status bio_attempt_discard_merge(struct request_queue *q, + struct request *req, + struct bio *bio) { unsigned short segments = blk_rq_nr_discard_segments(req); @@ -969,10 +972,39 @@ bool bio_attempt_discard_merge(struct request_queue *q, struct request *req, req->nr_phys_segments = segments + 1; blk_account_io_merge_bio(req); - return true; + return BIO_MERGE_OK; no_merge: req_set_nomerge(q, req); - return false; + return BIO_MERGE_FAILED; +} + +static enum bio_merge_status blk_attempt_bio_merge(struct request_queue *q, + struct request *rq, + struct bio *bio, + unsigned int nr_segs, + bool sched_allow_merge) +{ + if (!blk_rq_merge_ok(rq, bio)) + return BIO_MERGE_NONE; + + switch (blk_try_merge(rq, bio)) { + case ELEVATOR_BACK_MERGE: + if (!sched_allow_merge || + (sched_allow_merge && blk_mq_sched_allow_merge(q, rq, bio))) + return bio_attempt_back_merge(rq, bio, nr_segs); + break; + case ELEVATOR_FRONT_MERGE: + if (!sched_allow_merge || + (sched_allow_merge && blk_mq_sched_allow_merge(q, rq, bio))) + return bio_attempt_front_merge(rq, bio, nr_segs); + break; + case ELEVATOR_DISCARD_MERGE: + return bio_attempt_discard_merge(q, rq, bio); + default: + return BIO_MERGE_NONE; + } + + return BIO_MERGE_FAILED; } /** @@ -1011,8 +1043,6 @@ bool blk_attempt_plug_merge(struct request_queue *q, struct bio *bio, plug_list = >mq_list; list_for_each_entry_reverse(rq, plug_list, queuelist) { - bool merged = false; - if (rq->q == q && same_queue_rq) { /* * Only blk-mq multiple hardware queues case checks the @@ -1022,26 +1052,41 @@ bool blk_attempt_plug_merge(struct request_queue *q, struct bio *bio, *same_queue_rq = rq; } -
[PATCH v2 3/3] block: Remove blk_mq_attempt_merge() function
The small blk_mq_attempt_merge() function is only called by __blk_mq_sched_bio_merge(), just open code it. Signed-off-by: Baolin Wang --- block/blk-mq-sched.c | 44 1 file changed, 16 insertions(+), 28 deletions(-) diff --git a/block/blk-mq-sched.c b/block/blk-mq-sched.c index 5e63ede..397029d 100644 --- a/block/blk-mq-sched.c +++ b/block/blk-mq-sched.c @@ -382,28 +382,6 @@ bool blk_mq_sched_try_merge(struct request_queue *q, struct bio *bio, } EXPORT_SYMBOL_GPL(blk_mq_sched_try_merge); -/* - * Reverse check our software queue for entries that we could potentially - * merge with. Currently includes a hand-wavy stop count of 8, to not spend - * too much time checking for merges. - */ -static bool blk_mq_attempt_merge(struct request_queue *q, -struct blk_mq_hw_ctx *hctx, -struct blk_mq_ctx *ctx, struct bio *bio, -unsigned int nr_segs) -{ - enum hctx_type type = hctx->type; - - lockdep_assert_held(>lock); - - if (blk_bio_list_merge(q, >rq_lists[type], bio, nr_segs)) { - ctx->rq_merged++; - return true; - } - - return false; -} - bool __blk_mq_sched_bio_merge(struct request_queue *q, struct bio *bio, unsigned int nr_segs) { @@ -417,14 +395,24 @@ bool __blk_mq_sched_bio_merge(struct request_queue *q, struct bio *bio, return e->type->ops.bio_merge(hctx, bio, nr_segs); type = hctx->type; - if ((hctx->flags & BLK_MQ_F_SHOULD_MERGE) && - !list_empty_careful(>rq_lists[type])) { - /* default per sw-queue merge */ - spin_lock(>lock); - ret = blk_mq_attempt_merge(q, hctx, ctx, bio, nr_segs); - spin_unlock(>lock); + if (!(hctx->flags & BLK_MQ_F_SHOULD_MERGE) || + list_empty_careful(>rq_lists[type])) + return false; + + /* default per sw-queue merge */ + spin_lock(>lock); + /* +* Reverse check our software queue for entries that we could +* potentially merge with. Currently includes a hand-wavy stop +* count of 8, to not spend too much time checking for merges. +*/ + if (blk_bio_list_merge(q, >rq_lists[type], bio, nr_segs)) { + ctx->rq_merged++; + ret = true; } + spin_unlock(>lock); + return ret; } -- 1.8.3.1
Re: [PATCH 00/16] wirless: convert tasklets to use new tasklet_setup()
On 17. 08. 20, 11:06, Allen Pais wrote: > From: Allen Pais > > Commit 12cc923f1ccc ("tasklet: Introduce new initialization API")' > introduced a new tasklet initialization API. This series converts > all the wireless drivers to use the new tasklet_setup() API General question for the whole series: have you considered the long-term aim instead? That is: convert away from tasklets completely? I.e. use threaded irqs or workqueues? thanks, -- js suse labs
Re: [PATCH 2/4] Revert "lib/string.c: implement a basic bcmp"
On Mon, Aug 17, 2020 at 03:02:10PM -0700, Nick Desaulniers wrote: > This reverts commit 5f074f3e192f10c9fade898b9b3b8812e3d83342. > > Use `-fno-builtin-bcmp` instead. > > The issue with using `-fno-builtin-*` flags was that they were not > retained during an LTO link with LLVM. This was fixed in clang-11 by > https://reviews.llvm.org/D71193 > (0508c994f0b14144041f2cfd3ba9f9a80f03de08), which is also the minimum > supported version of clang for LTO. > > Signed-off-by: Nick Desaulniers > --- > Makefile | 1 + > include/linux/string.h | 3 --- > lib/string.c | 20 > 3 files changed, 1 insertion(+), 23 deletions(-) > > diff --git a/Makefile b/Makefile > index 211a1b6f6478..722ff5864275 100644 > --- a/Makefile > +++ b/Makefile > @@ -964,6 +964,7 @@ endif > # to provide implementations of these routines, then prevent the compiler > from > # emitting calls to what will be undefined symbols. > KBUILD_CFLAGS+= -fno-builtin-stpcpy > +KBUILD_CFLAGS+= -fno-builtin-bcmp I personally think that this hunk should be its own patch before this one then have this patch just be the revert, that way there is no regression across a bisect (if one were to ever occur) and so the revert is a straight 'git revert', rather than have something else mixed in that requires reading the actual changelog text. No objections if you disagree though. > # include additional Makefiles when needed > include-y:= scripts/Makefile.extrawarn > diff --git a/include/linux/string.h b/include/linux/string.h > index b1f3894a0a3e..f3bdb74bc230 100644 > --- a/include/linux/string.h > +++ b/include/linux/string.h > @@ -155,9 +155,6 @@ extern void * memscan(void *,int,__kernel_size_t); > #ifndef __HAVE_ARCH_MEMCMP > extern int memcmp(const void *,const void *,__kernel_size_t); > #endif > -#ifndef __HAVE_ARCH_BCMP > -extern int bcmp(const void *,const void *,__kernel_size_t); > -#endif > #ifndef __HAVE_ARCH_MEMCHR > extern void * memchr(const void *,int,__kernel_size_t); > #endif > diff --git a/lib/string.c b/lib/string.c > index 6012c385fb31..69328b8353e1 100644 > --- a/lib/string.c > +++ b/lib/string.c > @@ -922,26 +922,6 @@ __visible int memcmp(const void *cs, const void *ct, > size_t count) > EXPORT_SYMBOL(memcmp); > #endif > > -#ifndef __HAVE_ARCH_BCMP > -/** > - * bcmp - returns 0 if and only if the buffers have identical contents. > - * @a: pointer to first buffer. > - * @b: pointer to second buffer. > - * @len: size of buffers. > - * > - * The sign or magnitude of a non-zero return value has no particular > - * meaning, and architectures may implement their own more efficient bcmp(). > So > - * while this particular implementation is a simple (tail) call to memcmp, do > - * not rely on anything but whether the return value is zero or non-zero. > - */ > -#undef bcmp > -int bcmp(const void *a, const void *b, size_t len) > -{ > - return memcmp(a, b, len); > -} > -EXPORT_SYMBOL(bcmp); > -#endif > - > #ifndef __HAVE_ARCH_MEMSCAN > /** > * memscan - Find a character in an area of memory. > -- > 2.28.0.220.ged08abb693-goog > Cheers, Nathan
Re: [PATCH] scsi: ufs: Remove an unpaired ufshcd_scsi_unblock_requests() in err_handler()
On Mon, Aug 17 2020 at 22:21 -0700, Can Guo wrote: Commit 5586dd8ea250a ("scsi: ufs: Fix a race condition between error handler and runtime PM ops") moves the ufshcd_scsi_block_requests() inside err_handler(), but forgets to remove the ufshcd_scsi_unblock_requests() in the early return path. Correct the coding mistake. Signed-off-by: Can Guo Reviewed-by: Asutosh Das diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 2b55c2e..b8441ad 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -5670,7 +5670,6 @@ static void ufshcd_err_handler(struct work_struct *work) if (hba->ufshcd_state != UFSHCD_STATE_ERROR) hba->ufshcd_state = UFSHCD_STATE_OPERATIONAL; spin_unlock_irqrestore(hba->host->host_lock, flags); - ufshcd_scsi_unblock_requests(hba); return; } ufshcd_set_eh_in_progress(hba); -- Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.
[PATCH 2/2] soundwire: fix port_ready[] dynamic allocation in mipi_disco and ASoC codecs
From: Pierre-Louis Bossart The existing code allocates memory for the total number of ports. This only works if the ports are contiguous, but will break if e.g. a Devices uses port0, 1, and 14. The port_ready[] array would contain 3 elements, which would lead to an out-of-bounds access. Conversely in other cases, the wrong port index would be used leading to timeouts on prepare. This can be fixed by allocating for the worst-case of 15 ports (DP0..DP14). In addition since the number is now fixed, we can use an array instead of a dynamic allocation. Signed-off-by: Pierre-Louis Bossart Reviewed-by: Rander Wang Reviewed-by: Guennadi Liakhovetski Signed-off-by: Bard Liao --- drivers/soundwire/mipi_disco.c | 18 +- drivers/soundwire/slave.c | 4 include/linux/soundwire/sdw.h | 2 +- sound/soc/codecs/max98373-sdw.c | 15 +-- sound/soc/codecs/rt1308-sdw.c | 14 +- sound/soc/codecs/rt5682-sdw.c | 15 +-- sound/soc/codecs/rt700-sdw.c| 15 +-- sound/soc/codecs/rt711-sdw.c| 15 +-- sound/soc/codecs/rt715-sdw.c| 33 + 9 files changed, 12 insertions(+), 119 deletions(-) diff --git a/drivers/soundwire/mipi_disco.c b/drivers/soundwire/mipi_disco.c index 4ae62b452b8c..55a9c51c84c1 100644 --- a/drivers/soundwire/mipi_disco.c +++ b/drivers/soundwire/mipi_disco.c @@ -289,7 +289,7 @@ int sdw_slave_read_prop(struct sdw_slave *slave) struct sdw_slave_prop *prop = >prop; struct device *dev = >dev; struct fwnode_handle *port; - int num_of_ports, nval, i, dp0 = 0; + int nval; device_property_read_u32(dev, "mipi-sdw-sw-interface-revision", >mipi_revision); @@ -352,7 +352,6 @@ int sdw_slave_read_prop(struct sdw_slave *slave) return -ENOMEM; sdw_slave_read_dp0(slave, port, prop->dp0_prop); - dp0 = 1; } /* @@ -383,21 +382,6 @@ int sdw_slave_read_prop(struct sdw_slave *slave) sdw_slave_read_dpn(slave, prop->sink_dpn_prop, nval, prop->sink_ports, "sink"); - /* some ports are bidirectional so check total ports by ORing */ - nval = prop->source_ports | prop->sink_ports; - num_of_ports = hweight32(nval) + dp0; /* add DP0 */ - - /* Allocate port_ready based on num_of_ports */ - slave->port_ready = devm_kcalloc(>dev, num_of_ports, -sizeof(*slave->port_ready), -GFP_KERNEL); - if (!slave->port_ready) - return -ENOMEM; - - /* Initialize completion */ - for (i = 0; i < num_of_ports; i++) - init_completion(>port_ready[i]); - return 0; } EXPORT_SYMBOL(sdw_slave_read_prop); diff --git a/drivers/soundwire/slave.c b/drivers/soundwire/slave.c index 0839445ee07b..a762ee24e6fa 100644 --- a/drivers/soundwire/slave.c +++ b/drivers/soundwire/slave.c @@ -25,6 +25,7 @@ static int sdw_slave_add(struct sdw_bus *bus, { struct sdw_slave *slave; int ret; + int i; slave = kzalloc(sizeof(*slave), GFP_KERNEL); if (!slave) @@ -58,6 +59,9 @@ static int sdw_slave_add(struct sdw_bus *bus, init_completion(>probe_complete); slave->probed = false; + for (i = 0; i < SDW_MAX_PORTS; i++) + init_completion(>port_ready[i]); + mutex_lock(>bus_lock); list_add_tail(>node, >slaves); mutex_unlock(>bus_lock); diff --git a/include/linux/soundwire/sdw.h b/include/linux/soundwire/sdw.h index 0aa4c6af7554..63e71645fd13 100644 --- a/include/linux/soundwire/sdw.h +++ b/include/linux/soundwire/sdw.h @@ -619,7 +619,7 @@ struct sdw_slave { struct dentry *debugfs; #endif struct list_head node; - struct completion *port_ready; + struct completion port_ready[SDW_MAX_PORTS]; enum sdw_clk_stop_mode curr_clk_stop_mode; u16 dev_num; u16 dev_num_sticky; diff --git a/sound/soc/codecs/max98373-sdw.c b/sound/soc/codecs/max98373-sdw.c index 5fe724728e84..a3ec92775ea7 100644 --- a/sound/soc/codecs/max98373-sdw.c +++ b/sound/soc/codecs/max98373-sdw.c @@ -282,7 +282,7 @@ static const struct dev_pm_ops max98373_pm = { static int max98373_read_prop(struct sdw_slave *slave) { struct sdw_slave_prop *prop = >prop; - int nval, i, num_of_ports; + int nval, i; u32 bit; unsigned long addr; struct sdw_dpn_prop *dpn; @@ -295,7 +295,6 @@ static int max98373_read_prop(struct sdw_slave *slave) prop->clk_stop_timeout = 20; nval = hweight32(prop->source_ports); - num_of_ports = nval; prop->src_dpn_prop = devm_kcalloc(>dev, nval, sizeof(*prop->src_dpn_prop), GFP_KERNEL); @@ -315,7 +314,6 @@ static int
Re: [PATCH v2] Fixes: tty: serial: earlycon dependency
On 17. 08. 20, 20:54, Tong Zhang wrote: > parse_options() in drivers/tty/serial/earlycon.c calls uart_parse_earlycon > in drivers/tty/serial/serial_core.c therefore selecting SERIAL_EARLYCON > should automatically select SERIAL_CORE, otherwise will result in symbol > not found error during linking if SERIAL_CORE is not configured as builtin > > Signed-off-by: Tong Zhang The "Fixes:" keyword should not have been in the Subject but here. According to your findings something like this: Fixes: 73abaf87f01b (serial: earlycon: Refactor parse_options into serial core) I am not sure: 1) it should be "select" (and not "depends") 2) serial earlycon should depend on serial core. But it's likely OK. > drivers/tty/serial/Kconfig | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig > index 8a0352eb337c..42e844314cbb 100644 > --- a/drivers/tty/serial/Kconfig > +++ b/drivers/tty/serial/Kconfig > @@ -8,6 +8,7 @@ menu "Serial drivers" > > config SERIAL_EARLYCON > bool > + select SERIAL_CORE > help > Support for early consoles with the earlycon parameter. This enables > the console before standard serial driver is probed. The console is > thanks, -- js suse labs
[PATCH 1/2] soundwire: add definition for maximum number of ports
From: Pierre-Louis Bossart A Device may have at most 15 physical ports (DP0, DP1..DP14). Signed-off-by: Pierre-Louis Bossart Reviewed-by: Rander Wang Reviewed-by: Guennadi Liakhovetski Signed-off-by: Bard Liao --- include/linux/soundwire/sdw.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/linux/soundwire/sdw.h b/include/linux/soundwire/sdw.h index 76052f12c9f7..0aa4c6af7554 100644 --- a/include/linux/soundwire/sdw.h +++ b/include/linux/soundwire/sdw.h @@ -38,7 +38,8 @@ struct sdw_slave; #define SDW_FRAME_CTRL_BITS48 #define SDW_MAX_DEVICES11 -#define SDW_VALID_PORT_RANGE(n)((n) <= 14 && (n) >= 1) +#define SDW_MAX_PORTS 15 +#define SDW_VALID_PORT_RANGE(n)((n) < SDW_MAX_PORTS && (n) >= 1) enum { SDW_PORT_DIRN_SINK = 0, -- 2.17.1
[PATCH 0/2] soundwire: fix port_ready[] dynamic allocation in
The existing code allocates memory for the total number of ports. This only works if the ports are contiguous, but will break if e.g. a Devices uses port0, 1, and 14. The port_ready[] array would contain 3 elements, which would lead to an out-of-bounds access. Conversely in other cases, the wrong port index would be used leading to timeouts on prepare. This can be fixed by allocating for the worst-case of 15 ports (DP0..DP14). In addition since the number is now fixed, we can use an array instead of a dynamic allocation. Pierre-Louis Bossart (2): soundwire: add definition for maximum number of ports soundwire: fix port_ready[] dynamic allocation in mipi_disco and ASoC codecs drivers/soundwire/mipi_disco.c | 18 +- drivers/soundwire/slave.c | 4 include/linux/soundwire/sdw.h | 5 +++-- sound/soc/codecs/max98373-sdw.c | 15 +-- sound/soc/codecs/rt1308-sdw.c | 14 +- sound/soc/codecs/rt5682-sdw.c | 15 +-- sound/soc/codecs/rt700-sdw.c| 15 +-- sound/soc/codecs/rt711-sdw.c| 15 +-- sound/soc/codecs/rt715-sdw.c| 33 + 9 files changed, 14 insertions(+), 120 deletions(-) -- 2.17.1
Re: [PATCH 2/2] tasks: Add task_struct addr for lx-ps cmd
On 18.08.20 06:04, Ritesh Harjani wrote: > task_struct addr in lx-ps cmd seems helpful > > > TASK PIDCOMM > 0x82c2b8c0 0 swapper/0 > 0x888a0ba20040 1 systemd > 0x888a0ba24040 2 kthreadd > 0x888a0ba28040 3 rcu_gp > > Signed-off-by: Ritesh Harjani > --- > scripts/gdb/linux/tasks.py | 9 + > 1 file changed, 5 insertions(+), 4 deletions(-) > > diff --git a/scripts/gdb/linux/tasks.py b/scripts/gdb/linux/tasks.py > index 0301dc1e0138..17ec19e9b5bf 100644 > --- a/scripts/gdb/linux/tasks.py > +++ b/scripts/gdb/linux/tasks.py > @@ -73,11 +73,12 @@ class LxPs(gdb.Command): > super(LxPs, self).__init__("lx-ps", gdb.COMMAND_DATA) > > def invoke(self, arg, from_tty): > +gdb.write("{:>10} {:>12} {:>7}\n".format("TASK", "PID", "COMM")) > for task in task_lists(): > -gdb.write("{address} {pid} {comm}\n".format( > -address=task, > -pid=task["pid"], > -comm=task["comm"].string())) > +gdb.write("{} {:^5} {}\n".format( > +task.format_string().split()[0], > +task["pid"].format_string(), > +task["comm"].string())) > > > LxPs() > This patch is confusing me. We already dump the task address. What the patch changes is adding a header and some conversions of the values. Can you elaborate? Jan -- Siemens AG, Corporate Technology, CT RDA IOT SES-DE Corporate Competence Center Embedded Linux
Re: [PATCH 1/2] proc: Add struct mount & struct super_block addr in lx-mounts command
On 18.08.20 06:04, Ritesh Harjani wrote: > This is many times found useful while debugging some FS related issue. > > > mount super_block fstype devname pathname options > 0x888a0bfa4b40 0x888a0bfc1000 rootfs none / rw 0 0 > 0x888a02c065c0 0x8889fcf65000 ext4 /dev/root / rw ,relatime 0 0 > 0x8889fc8cc040 0x888a0bb51000 devtmpfs devtmpfs /dev rw ,relatime 0 0 > > Signed-off-by: Ritesh Harjani > --- > scripts/gdb/linux/proc.py | 15 +++ > 1 file changed, 7 insertions(+), 8 deletions(-) > > diff --git a/scripts/gdb/linux/proc.py b/scripts/gdb/linux/proc.py > index 6a56bba233a9..c16fab981bdd 100644 > --- a/scripts/gdb/linux/proc.py > +++ b/scripts/gdb/linux/proc.py > @@ -167,6 +167,9 @@ values of that process namespace""" > if not namespace: > raise gdb.GdbError("No namespace for current process") > > +gdb.write("{:^18} {:^15} {:>9} {} {} options\n".format( > + "mount", "super_block", "fstype", "devname", "pathname")) > + > for vfs in lists.list_for_each_entry(namespace['list'], > mount_ptr_type, "mnt_list"): > devname = vfs['mnt_devname'].string() > @@ -190,14 +193,10 @@ values of that process namespace""" > m_flags = int(vfs['mnt']['mnt_flags']) > rd = "ro" if (s_flags & constants.LX_SB_RDONLY) else "rw" > > -gdb.write( > -"{} {} {} {}{}{} 0 0\n" > -.format(devname, > -pathname, > -fstype, > -rd, > -info_opts(FS_INFO, s_flags), > -info_opts(MNT_INFO, m_flags))) > +gdb.write("{} {} {} {} {} {} {} {} 0 0\n".format( > + vfs.format_string(), superblock.format_string(), > fstype, > + devname, pathname, rd, info_opts(FS_INFO, s_flags), > + info_opts(MNT_INFO, m_flags))) The last three format elements should not be space-separated. The effect can even be seen in your example above. Jan > > > LxMounts() > -- Siemens AG, Corporate Technology, CT RDA IOT SES-DE Corporate Competence Center Embedded Linux
[PATCH 1/2] nvme: set io-scheduler requirement for ZNS
Set elevator feature ELEVATOR_F_ZBD_SEQ_WRITE required for ZNS. Signed-off-by: Kanchan Joshi --- drivers/nvme/host/zns.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/nvme/host/zns.c b/drivers/nvme/host/zns.c index 57cfd78731fb..cabd870fb64e 100644 --- a/drivers/nvme/host/zns.c +++ b/drivers/nvme/host/zns.c @@ -96,6 +96,7 @@ int nvme_update_zone_info(struct gendisk *disk, struct nvme_ns *ns, q->limits.zoned = BLK_ZONED_HM; blk_queue_flag_set(QUEUE_FLAG_ZONE_RESETALL, q); + blk_queue_required_elevator_features(q, ELEVATOR_F_ZBD_SEQ_WRITE); blk_queue_max_open_zones(q, le32_to_cpu(id->mor) + 1); blk_queue_max_active_zones(q, le32_to_cpu(id->mar) + 1); free_data: -- 2.17.1
[PATCH 0/2] enable append-emulation for ZNS
Currently NVMe driver rejects the ZNS device if zone-append is not supported natively. Make it accept the device and activate append-emulation instead. This is mostly borrowed from SCSI emulation. The other patch enforces a zone-friendly I/O scheduler for ZNS. Kanchan Joshi (2): nvme: set io-scheduler requirement for ZNS nvme: add emulation for zone-append drivers/nvme/host/core.c | 41 +- drivers/nvme/host/nvme.h | 60 drivers/nvme/host/zns.c | 307 ++- 3 files changed, 399 insertions(+), 9 deletions(-) -- 2.17.1
[PATCH 2/2] nvme: add emulation for zone-append
If drive does not support zone-append natively, enable emulation using regular write. Make emulated zone-append cmd write-lock the zone, preventing concurrent append/write on the same zone. To determine the start-lba for such writes, an array of 32 bit zone-relative write-pointer (WP) positions is attached with namespace. This cached WP-position is updated on successful completion as follows: - APPEND/WRITE/WRITE_ZEROS/WRITE_SAME update it by number of sectors (512b) copied - ZONE_RESET updates it to 0 for target zone. ZONE_RESET_ALL does the same for all zones. - ZONE_FINISH sets it to zone-size. On failed-completion for above requests, cached WP-position of target zone is marked invalid. On subsequent zone-append to that zone, WP position is refreshed by querying it from device (i.e. zone-report). If emulated-append cannot immediately proceed due to zone write-lock or invalid WP position, block-layer is asked to retry it. Signed-off-by: Kanchan Joshi Signed-off-by: Nitesh Shetty Signed-off-by: SelvaKumar S Signed-off-by: Javier Gonzalez --- drivers/nvme/host/core.c | 41 +- drivers/nvme/host/nvme.h | 60 drivers/nvme/host/zns.c | 306 ++- 3 files changed, 398 insertions(+), 9 deletions(-) diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index 88cff309d8e4..78faddf444c3 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -287,10 +287,17 @@ void nvme_complete_rq(struct request *req) nvme_retry_req(req); return; } - } else if (IS_ENABLED(CONFIG_BLK_DEV_ZONED) && - req_op(req) == REQ_OP_ZONE_APPEND) { - req->__sector = nvme_lba_to_sect(req->q->queuedata, - le64_to_cpu(nvme_req(req)->result.u64)); + } else if (IS_ENABLED(CONFIG_BLK_DEV_ZONED)) { + bool need_wp_offset_update = false; + struct nvme_ns *ns = req->q->queuedata; + /* append-emulation requires wp update for some cmds*/ + if (ns && nvme_is_append_emulated(ns)) + need_wp_offset_update = nvme_need_zone_wp_update(req); + if (need_wp_offset_update) + nvme_zone_wp_update(ns, req, status); + else if (req_op(req) == REQ_OP_ZONE_APPEND) + req->__sector = nvme_lba_to_sect(ns, + le64_to_cpu(nvme_req(req)->result.u64)); } nvme_trace_bio_complete(req, status); @@ -456,6 +463,8 @@ static void nvme_free_ns(struct kref *kref) { struct nvme_ns *ns = container_of(kref, struct nvme_ns, kref); + if (nvme_is_append_emulated(ns)) + nvme_teardown_append_emulate(ns); if (ns->ndev) nvme_nvm_unregister(ns); @@ -809,7 +818,15 @@ blk_status_t nvme_setup_cmd(struct nvme_ns *ns, struct request *req, ret = nvme_setup_rw(ns, req, cmd, nvme_cmd_write); break; case REQ_OP_ZONE_APPEND: - ret = nvme_setup_rw(ns, req, cmd, nvme_cmd_zone_append); + if (!nvme_is_append_emulated(ns)) + ret = nvme_setup_rw(ns, req, cmd, nvme_cmd_zone_append); + else { + /* prepare append like write, and adjust lba afterwards */ + ret = nvme_setup_rw(ns, req, cmd, nvme_cmd_write); + if (ret) + break; + ret = nvme_append_to_write(ns, req, cmd); + } break; default: WARN_ON_ONCE(1); @@ -2150,7 +2167,7 @@ static int nvme_revalidate_disk(struct gendisk *disk) struct nvme_ns *ns = disk->private_data; struct nvme_ctrl *ctrl = ns->ctrl; - ret = blk_revalidate_disk_zones(disk, NULL); + ret = nvme_revalidate_disk_zones(disk); if (!ret) blk_queue_max_zone_append_sectors(disk->queue, ctrl->max_zone_append); @@ -3900,6 +3917,18 @@ static void nvme_alloc_ns(struct nvme_ctrl *ctrl, unsigned nsid) if (__nvme_revalidate_disk(disk, id)) goto out_put_disk; + /* setup append-emulation if required */ + if (nvme_is_append_emulated(ns)) { + ret = nvme_setup_append_emulate(ns); + if (ret) { + dev_warn(ns->ctrl->device, + "append-emulation failed, zoned namespace:%d\n", + ns->head->ns_id); + nvme_clear_append_emulated(ns); + goto out_put_disk; + } + } + if ((ctrl->quirks & NVME_QUIRK_LIGHTNVM) && id->vs[0] == 0x1) { ret = nvme_nvm_register(ns, disk_name, node); if (ret)
[PATCH] x86/cpu: Fix typos and improve the comments in sync_core()
* tip-bot2 for Ricardo Neri wrote: > --- a/arch/x86/include/asm/sync_core.h > +++ b/arch/x86/include/asm/sync_core.h > @@ -5,6 +5,7 @@ > #include > #include > #include > +#include > > #ifdef CONFIG_X86_32 > static inline void iret_to_self(void) > @@ -54,14 +55,23 @@ static inline void iret_to_self(void) > static inline void sync_core(void) > { > /* > + * The SERIALIZE instruction is the most straightforward way to > + * do this but it not universally available. > + */ > + if (static_cpu_has(X86_FEATURE_SERIALIZE)) { > + serialize(); > + return; > + } > + > + /* > + * For all other processors, there are quite a few ways to do this. > + * IRET-to-self is nice because it works on every CPU, at any CPL > + * (so it's compatible with paravirtualization), and it never exits > + * to a hypervisor. The only down sides are that it's a bit slow > + * (it seems to be a bit more than 2x slower than the fastest > + * options) and that it unmasks NMIs. The "push %cs" is needed > + * because, in paravirtual environments, __KERNEL_CS may not be a > + * valid CS value when we do IRET directly. So there's two typos in the new comments, there are at least two misapplied commas, it departs from existing style, and there's a typo in the existing comments as well. Also, before this patch the 'compiler barrier' comment was valid for the whole function (there was no branching), but after this patch it reads of it was only valid for the legacy IRET-to-self branch. Which together broke my detector and triggered a bit of compulsive bike-shed painting. ;-) See the resulting patch below. Thanks, Ingo > From: Ingo Molnar Date: Tue, 18 Aug 2020 07:24:05 +0200 Subject: [PATCH] x86/cpu: Fix typos and improve the comments in sync_core() - Fix typos. - Move the compiler barrier comment to the top, because it's valid for the whole function, not just the legacy branch. Signed-off-by: Ingo Molnar --- arch/x86/include/asm/sync_core.h | 16 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/arch/x86/include/asm/sync_core.h b/arch/x86/include/asm/sync_core.h index 4631c0f969d4..0fd4a9dfb29c 100644 --- a/arch/x86/include/asm/sync_core.h +++ b/arch/x86/include/asm/sync_core.h @@ -47,16 +47,19 @@ static inline void iret_to_self(void) * * b) Text was modified on a different CPU, may subsequently be * executed on this CPU, and you want to make sure the new version - * gets executed. This generally means you're calling this in a IPI. + * gets executed. This generally means you're calling this in an IPI. * * If you're calling this for a different reason, you're probably doing * it wrong. + * + * Like all of Linux's memory ordering operations, this is a + * compiler barrier as well. */ static inline void sync_core(void) { /* * The SERIALIZE instruction is the most straightforward way to -* do this but it not universally available. +* do this, but it is not universally available. */ if (static_cpu_has(X86_FEATURE_SERIALIZE)) { serialize(); @@ -67,10 +70,10 @@ static inline void sync_core(void) * For all other processors, there are quite a few ways to do this. * IRET-to-self is nice because it works on every CPU, at any CPL * (so it's compatible with paravirtualization), and it never exits -* to a hypervisor. The only down sides are that it's a bit slow +* to a hypervisor. The only downsides are that it's a bit slow * (it seems to be a bit more than 2x slower than the fastest -* options) and that it unmasks NMIs. The "push %cs" is needed -* because, in paravirtual environments, __KERNEL_CS may not be a +* options) and that it unmasks NMIs. The "push %cs" is needed, +* because in paravirtual environments __KERNEL_CS may not be a * valid CS value when we do IRET directly. * * In case NMI unmasking or performance ever becomes a problem, @@ -81,9 +84,6 @@ static inline void sync_core(void) * CPUID is the conventional way, but it's nasty: it doesn't * exist on some 486-like CPUs, and it usually exits to a * hypervisor. -* -* Like all of Linux's memory ordering operations, this is a -* compiler barrier as well. */ iret_to_self(); }
Re: [PATCH v5 5/6] kprobes: Use text_alloc() and text_free()
On Sun, Jul 26, 2020 at 11:14:08AM +0300, Mike Rapoport wrote: > On Sat, Jul 25, 2020 at 06:16:48AM +0300, Jarkko Sakkinen wrote: > > > I've read the observations in the other threads, but this #ifdef > > > jungle is silly, it's a de-facto open coded text_alloc() with a > > > module_alloc() fallback... > > > > In the previous version I had: > > > > > > https://lore.kernel.org/lkml/20200717030422.679972-4-jarkko.sakki...@linux.intel.com/ > > > > and I had just calls to text_alloc() and text_free() in corresponding > > snippet to the above. > > > > I got this feedback from Mike: > > > > https://lore.kernel.org/lkml/20200718162359.ga2919...@kernel.org/ > > > > I'm not still sure that I fully understand this feedback as I don't see > > any inherent and obvious difference to the v4. In that version fallbacks > > are to module_alloc() and module_memfree() and text_alloc() and > > text_memfree() can be overridden by arch. > > Let me try to elaborate. > > There are several subsystems that need to allocate memory for executable > text. As it happens, they use module_alloc() with some abilities for > architectures to override this behaviour. > > For many architectures, it would be enough to rename modules_alloc() to > text_alloc(), make it built-in and this way allow removing dependency on > MODULES. > > Yet, some architectures have different restrictions for code allocation > for different subsystems so it would make sense to have more than one > variant of text_alloc() and a single config option ARCH_HAS_TEXT_ALLOC > won't be sufficient. > > I liked Mark's suggestion to have text_alloc_() and proposed > a way to introduce text_alloc_kprobes() along with > HAVE_KPROBES_TEXT_ALLOC to enable arch overrides of this function. > > The major difference between your v4 and my suggestion is that I'm not > trying to impose a single ARCH_HAS_TEXT_ALLOC as an alternative to > MODULES but rather to use per subsystem config option, e.g. > HAVE_KPROBES_TEXT_ALLOC. > > Another thing, which might be worth doing regardless of the outcome of > this discussion is to rename alloc_insn_pages() to text_alloc_kprobes() > because the former is way too generic and does not emphasize that the > instruction page is actually used by kprobes only. What if we in kernel/kprobes.c just: #ifndef CONFIG_ARCH_HAS_TEXT_ALLOC void __weak *alloc_insn_page(void) { return module_alloc(PAGE_SIZE); } void __weak free_insn_page(void *page) { module_memfree(page); } #endif In Kconfig (as in v5): config KPROBES bool "Kprobes" depends on MODULES || ARCH_HAS_TEXT_ALLOC I checked architectures that override alloc_insn_page(). With the exception of x86, they do not call module_alloc(). If no rename was done, then with this approach a more consistent. config flag name would be CONFIG_ARCH_HAS_ALLOC_INSN_PAGE. I'd call the function just as kprobes_alloc_page(). Then the config flag would become CONFIG_HAS_KPROBES_ALLOC_PAGE. > -- > Sincerely yours, > Mike. Thanks for the feedback! /Jarkko
Re: [PATCH] block: rnbd: rnbd-srv: silence uninitialized variable warning
On Tue, Aug 18, 2020 at 12:03:18AM -0400, Brooke Basile wrote: > Clang warns: > drivers/block/rnbd/rnbd-srv.c:150:6: warning: variable 'err' is used > uninitialized whenever 'if' condition is true > [-Wsometimes-uninitialized] > if (IS_ERR(bio)) { > ^~~ > drivers/block/rnbd/rnbd-srv.c:177:9: note: uninitialized use occurs here > return err; > ^~~ > drivers/block/rnbd/rnbd-srv.c:126:9: note: initialize the variable 'err' > to silence this warning > int err; > ^ > = 0 > > Silence this by replacing `err` with `ret`, returning ret = 0 upon > success. > > Signed-off-by: Brooke Basile > --- > drivers/block/rnbd/rnbd-srv.c | 8 > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/drivers/block/rnbd/rnbd-srv.c b/drivers/block/rnbd/rnbd-srv.c > index 0fb94843a495..f515d1a048a9 100644 > --- a/drivers/block/rnbd/rnbd-srv.c > +++ b/drivers/block/rnbd/rnbd-srv.c > @@ -123,10 +123,10 @@ static int process_rdma(struct rtrs_srv *sess, > struct rnbd_io_private *priv; > struct rnbd_srv_sess_dev *sess_dev; > u32 dev_id; > - int err; > struct rnbd_dev_blk_io *io; > struct bio *bio; > short prio; > + int ret = 0; > > priv = kmalloc(sizeof(*priv), GFP_KERNEL); > if (!priv) > @@ -138,7 +138,7 @@ static int process_rdma(struct rtrs_srv *sess, > if (IS_ERR(sess_dev)) { > pr_err_ratelimited("Got I/O request on session %s for unknown > device id %d\n", > srv_sess->sessname, dev_id); > - err = -ENOTCONN; > + ret = -ENOTCONN; > goto err; > } > > @@ -168,13 +168,13 @@ static int process_rdma(struct rtrs_srv *sess, > > submit_bio(bio); > > - return 0; > + return ret; > > sess_dev_put: > rnbd_put_sess_dev(sess_dev); > err: > kfree(priv); > - return err; > + return ret; > } > > static void destroy_device(struct rnbd_srv_dev *dev) > -- > 2.28.0 > I don't think this is a proper fix since the root cause of the warning appears to be that we are ignoring the return value of rnbd_bio_map_kern. Should we not set err to that value like this (completely untested)? Cheers, Nathan diff --git a/drivers/block/rnbd/rnbd-srv.c b/drivers/block/rnbd/rnbd-srv.c index 0fb94843a495..1b71cb2a885d 100644 --- a/drivers/block/rnbd/rnbd-srv.c +++ b/drivers/block/rnbd/rnbd-srv.c @@ -148,7 +148,8 @@ static int process_rdma(struct rtrs_srv *sess, /* Generate bio with pages pointing to the rdma buffer */ bio = rnbd_bio_map_kern(data, sess_dev->rnbd_dev->ibd_bio_set, datalen, GFP_KERNEL); if (IS_ERR(bio)) { - rnbd_srv_err(sess_dev, "Failed to generate bio, err: %ld\n", PTR_ERR(bio)); + err = PTR_ERR(bio); + rnbd_srv_err(sess_dev, "Failed to generate bio, err: %ld\n", err); goto sess_dev_put; }
Re: [PATCH v2 3/9] ASoC: audio-graph: Identify 'no_pcm' DAI links for DPCM
Hi again > PCM devices are created for FE dai links with 'no-pcm' flag as '0'. > Such DAI links have CPU component which implement either pcm_construct() > or pcm_new() at component or dai level respectively. Based on this, > current patch exposes a helper function to identify such components > and populate 'no_pcm' flag for DPCM DAI link. > > This helps to have BE<->BE component links where PCM devices need > not be created for CPU component involved in such links. > > Signed-off-by: Sameer Pujar > --- (snip) > +static bool soc_component_is_pcm(struct snd_soc_dai_link_component *dlc) > +{ > + struct snd_soc_dai *dai = snd_soc_find_dai(dlc); > + > + if (dai && (dai->component->driver->pcm_construct || > + dai->driver->pcm_new)) > + return true; > + > + return false; > +} This snd_soc_find_dai() will indicate WARNING if .config has CONFIG_LOCKDEP for me. Maybe implement it at soc-core.c with client_mutex lock is needed. Thank you for your help !! Best regards --- Kuninori Morimoto
arch/powerpc/include/asm/reg.h:1376:17: sparse: sparse: context imbalance in 'serial8250_console_write' - wrong count at exit
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master head: 06a4ec1d9dc652e17ee3ac2ceb6c7cf6c2b75cdd commit: b020aa9d1e875c1c91b1390acdf42320e7060d84 powerpc: cleanup hw_irq.h date: 9 months ago config: powerpc64-randconfig-s031-20200818 (attached as .config) compiler: powerpc-linux-gcc (GCC) 9.3.0 reproduce: wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # apt-get install sparse # sparse version: v0.6.2-180-g49f7e13a-dirty git checkout b020aa9d1e875c1c91b1390acdf42320e7060d84 # save the attached .config to linux build tree COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=powerpc64 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot sparse warnings: (new ones prefixed by >>) drivers/tty/serial/8250/8250_port.c: note: in included file (through include/linux/io.h, include/linux/irq.h, arch/powerpc/include/asm/hardirq.h, ...): arch/powerpc/include/asm/io.h:149:1: sparse: sparse: dereference of noderef expression arch/powerpc/include/asm/io.h:144:1: sparse: sparse: dereference of noderef expression arch/powerpc/include/asm/io.h:150:1: sparse: sparse: dereference of noderef expression arch/powerpc/include/asm/io.h:145:1: sparse: sparse: dereference of noderef expression drivers/tty/serial/8250/8250_port.c: note: in included file (through arch/powerpc/include/asm/processor.h, arch/powerpc/include/asm/thread_info.h, include/linux/thread_info.h, ...): >> arch/powerpc/include/asm/reg.h:1376:17: sparse: sparse: context imbalance in >> 'serial8250_console_write' - wrong count at exit # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=b020aa9d1e875c1c91b1390acdf42320e7060d84 git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git git fetch --no-tags linus master git checkout b020aa9d1e875c1c91b1390acdf42320e7060d84 vim +/serial8250_console_write +1376 arch/powerpc/include/asm/reg.h 1359 1360 #define mfspr(rn) ({unsigned long rval; \ 1361 asm volatile("mfspr %0," __stringify(rn) \ 1362 : "=r" (rval)); rval;}) 1363 #ifndef mtspr 1364 #define mtspr(rn, v)asm volatile("mtspr " __stringify(rn) ",%0" : \ 1365 : "r" ((unsigned long)(v)) \ 1366 : "memory") 1367 #endif 1368 #define wrtspr(rn) asm volatile("mtspr " __stringify(rn) ",0" : \ 1369 : : "memory") 1370 1371 static inline void wrtee(unsigned long val) 1372 { 1373 if (__builtin_constant_p(val)) 1374 asm volatile("wrteei %0" : : "i" ((val & MSR_EE) ? 1 : 0) : "memory"); 1375 else > 1376 asm volatile("wrtee %0" : : "r" (val) : "memory"); 1377 } 1378 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-...@lists.01.org .config.gz Description: application/gzip
[PATCH] scsi: ufs: Remove an unpaired ufshcd_scsi_unblock_requests() in err_handler()
Commit 5586dd8ea250a ("scsi: ufs: Fix a race condition between error handler and runtime PM ops") moves the ufshcd_scsi_block_requests() inside err_handler(), but forgets to remove the ufshcd_scsi_unblock_requests() in the early return path. Correct the coding mistake. Signed-off-by: Can Guo diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 2b55c2e..b8441ad 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -5670,7 +5670,6 @@ static void ufshcd_err_handler(struct work_struct *work) if (hba->ufshcd_state != UFSHCD_STATE_ERROR) hba->ufshcd_state = UFSHCD_STATE_OPERATIONAL; spin_unlock_irqrestore(hba->host->host_lock, flags); - ufshcd_scsi_unblock_requests(hba); return; } ufshcd_set_eh_in_progress(hba); -- Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.
Re: [PATCH] Makefile: Yes. Finally remove '-Wdeclaration-after-statement'
* Linus Torvalds wrote: > On Mon, Aug 17, 2020 at 3:09 PM Pavel Machek wrote: > > > > Submitter believes "wild variable placement" can help with > > #ifdefs.. and that may be actually good tradeoff. > > I agree that it can help in some cases. > > But it can also make it really hard to find the variable declarations > in other cases. I've seen a lot of code that ends up actively > declaring the variable close to where it's used (because people find > that to be locally more legible) and then it just means that people > who arent' familiar with the code have a much harder time finding it. > > I'd instead try to discourage people from using #ifdef's inside code. I'm a big fan of -Wdeclaration-after-statement and I think C++ style mixed variables/statements code has several disadvantages: - One advantage of -Wdeclaration-after-statement is that it can detect mismerges that can happen with the 'patch' tool when it applies a patch with fuzz. - Also, enforcing -Wdeclaration-after-statement means we have the nice symmetry that local variable declarations are always at the beginning of curly brace blocks, which includes function definitions. This IMO is a very helpful visual clue that allows the quick reading of kernel code. - A third advantage is that the grouping of local variables at the beginning of curly brace blocks encourages smaller, better structured functions: a large function would look automatically ugly due to the many local variables crammed at the beginning of it. So the gentle code structure message is: you can declare new local variables in a loop construct or branch, at the cost of losing one level of indentation. If it gets too deep, you are encouraged to split your logic up better with helper functions. The kind of run-on mega-functions that C++ style mixed variables often allow looks *automatically* uglier under -Wdeclaration-after-statement and quickly breaks simple kernel style rules such as col80 or indentation level depth or the too high visual complexity of variable definition lines. Basically the removal of -Wdeclaration-after-statement removes a helpful symmetry & allows the addition of random noise to our code base, with very little benefits offered. I'd be sad to see it go. Thanks, Ingo
[PATCH v11 4/5] drm/msm/dpu: add display port support in DPU
From: Jeykumar Sankaran Add display port support in DPU by creating hooks for DP encoder enumeration and encoder mode initialization. changes in v2: - rebase on [2] (Sean Paul) - remove unwanted error checks and switch cases (Jordan Crouse) [1] https://lwn.net/Articles/768265/ [2] https://lkml.org/lkml/2018/11/17/87 changes in V3: -- Moved this change as part of the DP driver changes. -- Addressed compilation issues on the latest code base. Changes in v6: -- Fix checkpatch.pl warning Changes in v7: Remove depends-on tag from commit message. Changes in v8: None Changes in v9: None Signed-off-by: Jeykumar Sankaran Signed-off-by: Chandan Uddaraju Signed-off-by: Vara Reddy Signed-off-by: Tanmay Shah --- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 8 +-- drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 65 + 2 files changed, 58 insertions(+), 15 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c index 8b14d7c42f37..6a9e257d2fe6 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c @@ -2025,7 +2025,7 @@ static int dpu_encoder_setup_display(struct dpu_encoder_virt *dpu_enc, { int ret = 0; int i = 0; - enum dpu_intf_type intf_type; + enum dpu_intf_type intf_type = INTF_NONE; struct dpu_enc_phys_init_params phys_params; if (!dpu_enc) { @@ -2047,9 +2047,9 @@ static int dpu_encoder_setup_display(struct dpu_encoder_virt *dpu_enc, case DRM_MODE_ENCODER_DSI: intf_type = INTF_DSI; break; - default: - DPU_ERROR_ENC(dpu_enc, "unsupported display interface type\n"); - return -EINVAL; + case DRM_MODE_ENCODER_TMDS: + intf_type = INTF_DP; + break; } WARN_ON(disp_info->num_of_h_tiles < 1); diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c index c0a4d4e16d82..62bc33cb0d3a 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c @@ -479,6 +479,33 @@ static int _dpu_kms_initialize_dsi(struct drm_device *dev, return rc; } +static int _dpu_kms_initialize_displayport(struct drm_device *dev, + struct msm_drm_private *priv, + struct dpu_kms *dpu_kms) +{ + struct drm_encoder *encoder = NULL; + int rc = 0; + + if (!priv->dp) + return rc; + + encoder = dpu_encoder_init(dev, DRM_MODE_ENCODER_TMDS); + if (IS_ERR(encoder)) { + DPU_ERROR("encoder init failed for dsi display\n"); + return PTR_ERR(encoder); + } + + rc = msm_dp_modeset_init(priv->dp, dev, encoder); + if (rc) { + DPU_ERROR("modeset_init failed for DP, rc = %d\n", rc); + drm_encoder_cleanup(encoder); + return rc; + } + + priv->encoders[priv->num_encoders++] = encoder; + return rc; +} + /** * _dpu_kms_setup_displays - create encoders, bridges and connectors * for underlying displays @@ -491,12 +518,21 @@ static int _dpu_kms_setup_displays(struct drm_device *dev, struct msm_drm_private *priv, struct dpu_kms *dpu_kms) { - /** -* Extend this function to initialize other -* types of displays -*/ + int rc = 0; + + rc = _dpu_kms_initialize_dsi(dev, priv, dpu_kms); + if (rc) { + DPU_ERROR("initialize_dsi failed, rc = %d\n", rc); + return rc; + } - return _dpu_kms_initialize_dsi(dev, priv, dpu_kms); + rc = _dpu_kms_initialize_displayport(dev, priv, dpu_kms); + if (rc) { + DPU_ERROR("initialize_DP failed, rc = %d\n", rc); + return rc; + } + + return rc; } static void _dpu_kms_drm_obj_destroy(struct dpu_kms *dpu_kms) @@ -681,13 +717,20 @@ static void _dpu_kms_set_encoder_mode(struct msm_kms *kms, info.capabilities = cmd_mode ? MSM_DISPLAY_CAP_CMD_MODE : MSM_DISPLAY_CAP_VID_MODE; - /* TODO: No support for DSI swap */ - for (i = 0; i < ARRAY_SIZE(priv->dsi); i++) { - if (priv->dsi[i]) { - info.h_tile_instance[info.num_of_h_tiles] = i; - info.num_of_h_tiles++; + switch (info.intf_type) { + case DRM_MODE_ENCODER_DSI: + /* TODO: No support for DSI swap */ + for (i = 0; i < ARRAY_SIZE(priv->dsi); i++) { + if (priv->dsi[i]) { + info.h_tile_instance[info.num_of_h_tiles] = i; + info.num_of_h_tiles++; + } } - } +
[PATCH v11 3/5] drm/msm/dp: add support for DP PLL driver
From: Chandan Uddaraju Add the needed DP PLL specific files to support display port interface on msm targets. The DP driver calls the DP PLL driver registration. The DP driver sets the link and pixel clock sources. Changes in v2: -- Update copyright markings on all relevant files. -- Use DRM_DEBUG_DP for debug msgs. Changes in v4: -- Update the DP link clock provider names Changes in V5: -- Addressed comments from Stephen Boyd, Rob clark. Changes in V6: -- Remove PLL as separate driver and include PLL as DP module -- Remove redundant clock parsing from PLL module and make DP as clock provider -- Map USB3 DPCOM and PHY IO using hardcoded register address and move mapping form parser to PLL module -- Access DP PHY modules from same base address using offsets instead of deriving base address of individual module from device tree. -- Remove dp_pll_10nm_util.c and include its functionality in dp_pll_10nm.c -- Introduce new data structures private to PLL module Changes in v7: -- Remove DRM_MSM_DP_PLL config from Makefile and Kconfig -- Remove set_parent from determin_rate API -- Remove phy_pll_vco_div_clk from parent list -- Remove flag CLK_DIVIDER_ONE_BASED -- Remove redundant cell-index property parsing Changes in v8: -- Unregister hardware clocks during driver cleanup Changes in v9: -- Remove redundant Kconfig option DRM_MSM_DP_10NM_PLL Changes in v10: -- Limit 10nm PLL function scope Signed-off-by: Chandan Uddaraju Signed-off-by: Vara Reddy Signed-off-by: Tanmay Shah --- drivers/gpu/drm/msm/Kconfig | 1 + drivers/gpu/drm/msm/Makefile| 4 +- drivers/gpu/drm/msm/dp/dp_catalog.c | 31 +- drivers/gpu/drm/msm/dp/dp_display.c | 18 +- drivers/gpu/drm/msm/dp/dp_display.h | 3 + drivers/gpu/drm/msm/dp/dp_parser.c | 2 + drivers/gpu/drm/msm/dp/dp_parser.h | 7 +- drivers/gpu/drm/msm/dp/dp_pll.c | 99 +++ drivers/gpu/drm/msm/dp/dp_pll.h | 61 ++ drivers/gpu/drm/msm/dp/dp_pll_10nm.c| 930 drivers/gpu/drm/msm/dp/dp_pll_private.h | 89 +++ drivers/gpu/drm/msm/dp/dp_power.c | 10 + drivers/gpu/drm/msm/dp/dp_power.h | 40 +- drivers/gpu/drm/msm/dp/dp_reg.h | 16 + 14 files changed, 1294 insertions(+), 17 deletions(-) create mode 100644 drivers/gpu/drm/msm/dp/dp_pll.c create mode 100644 drivers/gpu/drm/msm/dp/dp_pll.h create mode 100644 drivers/gpu/drm/msm/dp/dp_pll_10nm.c create mode 100644 drivers/gpu/drm/msm/dp/dp_pll_private.h diff --git a/drivers/gpu/drm/msm/Kconfig b/drivers/gpu/drm/msm/Kconfig index 0b59e4f184fb..8e6ca119ea94 100644 --- a/drivers/gpu/drm/msm/Kconfig +++ b/drivers/gpu/drm/msm/Kconfig @@ -60,6 +60,7 @@ config DRM_MSM_HDMI_HDCP config DRM_MSM_DP bool "Enable DisplayPort support in MSM DRM driver" depends on DRM_MSM + default y help Compile in support for DP driver in MSM DRM driver. DP external display support is enabled through this config option. It can diff --git a/drivers/gpu/drm/msm/Makefile b/drivers/gpu/drm/msm/Makefile index af868e791210..6d31188cc776 100644 --- a/drivers/gpu/drm/msm/Makefile +++ b/drivers/gpu/drm/msm/Makefile @@ -109,7 +109,9 @@ msm-$(CONFIG_DRM_MSM_DP)+= dp/dp_aux.o \ dp/dp_link.o \ dp/dp_panel.o \ dp/dp_parser.o \ - dp/dp_power.o + dp/dp_power.o \ + dp/dp_pll.o \ + dp/dp_pll_10nm.o msm-$(CONFIG_DRM_FBDEV_EMULATION) += msm_fbdev.o msm-$(CONFIG_COMMON_CLK) += disp/mdp4/mdp4_lvds_pll.o diff --git a/drivers/gpu/drm/msm/dp/dp_catalog.c b/drivers/gpu/drm/msm/dp/dp_catalog.c index 497f97f86c82..e506e0756e92 100644 --- a/drivers/gpu/drm/msm/dp/dp_catalog.c +++ b/drivers/gpu/drm/msm/dp/dp_catalog.c @@ -5,6 +5,7 @@ #define pr_fmt(fmt)"[drm-dp] %s: " fmt, __func__ +#include #include #include #include @@ -131,51 +132,58 @@ static inline void dp_write_ahb(struct dp_catalog_private *catalog, static inline void dp_write_phy(struct dp_catalog_private *catalog, u32 offset, u32 data) { + offset += DP_PHY_REG_OFFSET; /* * To make sure phy reg writes happens before any other operation, * this function uses writel() instread of writel_relaxed() */ - writel(data, catalog->io->phy_io.base + offset); + writel(data, catalog->io->phy_reg.base + offset); } static inline u32 dp_read_phy(struct dp_catalog_private *catalog, u32 offset) { + offset += DP_PHY_REG_OFFSET; /* * To make sure phy reg writes happens before any other operation, * this function uses writel() instread of writel_relaxed() */ - return readl_relaxed(catalog->io->phy_io.base + offset); + return readl_relaxed(catalog->io->phy_reg.base + offset); } static inline void dp_write_pll(struct dp_catalog_private *catalog, u32 offset, u32 data) { -
[PATCH v11 0/5] Add support for DisplayPort driver on SnapDragon
These patches add Display-Port driver on SnapDragon/msm hardware. This series also contains device-tree bindings for msm DP driver. It also contains Makefile and Kconfig changes to compile msm DP driver. The block diagram of DP driver is shown below: +-+ |DRM FRAMEWORK| +--+--+ | +v+ | DP DRM | +++ | +v+ ++| DP+--++--+ ++---+| DISPLAY |+---+ | | |++-+-+-+| | | || | | | | | || | | | | | || | | | | | vv v v v v v +--+ +--+ +---+ ++ ++ +---+ +-+ | DP | | DP | |DP | | DP | | DP | |DP | | DP | |PARSER| | HPD | |AUX| |LINK| |CTRL| |PHY| |POWER| +--+---+ +---+--+ +---+ ++ +--+-+ +-+-+ +-+ | | | +--v---+ +v-v+ |DEVICE| | DP | | TREE | |CATALOG| +--+ +---+---+ | +---v+ |CTRL/PHY| | HW | ++ Changes in v7: - Modify cover letter description and fix title. - Introduce dp-controller.yaml for common bindings across SOC - Rename dp-sc7180.yaml to dp-controller-sc7180.yaml for SC7180 bindings - Rename compatible string to qcom,sc7180-dp - Add assigned-clocks and assigned-clock-parents properties in bindings - Remove redundant code from driver - Extend series to include HPD detection logic Changes in v8: - Add MDSS AHB clock in bindings - Replace mode->vrefresh use with drm_mode_vrefresh API - Remove redundant aux config code from parser and aux module - Assign default max lanes if data-lanes property is not available - Fix use-after-free during DP driver remove - Unregister hardware clocks during driver cleanup Changes in v9: - Drop YAML bindings change from the series - Use assigne-clock-parents property and remove clk_set_parent use from code - Access register address space without name - Fix DP register dump utility - Disable DP clocks after vsync generated - Avoid 64-bit modulo operation - Drop any unused code and fix function proptotyes to avoid W=1 warnings - Drop DRM_MSM_DP_10NM_PLL config as only 10nm PLL is available Changes in v10: - Fix help description of Kconfig entry Changes in v11: - Fix "stream_pixel" string parsing - Limit 10nm PLL functions' scope Chandan Uddaraju (4): dt-bindings: msm/dp: add bindings of DP/DP-PLL driver for Snapdragon drm: add constant N value in helper file drm/msm/dp: add displayPort driver support drm/msm/dp: add support for DP PLL driver Jeykumar Sankaran (1): drm/msm/dpu: add display port support in DPU Tanmay Shah (1): drm/msm/dp: Add Display Port HPD feature drivers/gpu/drm/i915/display/intel_display.c |2 +- drivers/gpu/drm/msm/Kconfig |9 + drivers/gpu/drm/msm/Makefile | 14 + drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 27 +- .../drm/msm/disp/dpu1/dpu_encoder_phys_vid.c |8 + drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 83 +- drivers/gpu/drm/msm/dp/dp_aux.c | 510 + drivers/gpu/drm/msm/dp/dp_aux.h | 29 + drivers/gpu/drm/msm/dp/dp_catalog.c | 1030 ++ drivers/gpu/drm/msm/dp/dp_catalog.h | 104 + drivers/gpu/drm/msm/dp/dp_ctrl.c | 1693 + drivers/gpu/drm/msm/dp/dp_ctrl.h | 35 + drivers/gpu/drm/msm/dp/dp_display.c | 1017 ++ drivers/gpu/drm/msm/dp/dp_display.h | 31 + drivers/gpu/drm/msm/dp/dp_drm.c | 168 ++ drivers/gpu/drm/msm/dp/dp_drm.h | 18 + drivers/gpu/drm/msm/dp/dp_hpd.c | 69 + drivers/gpu/drm/msm/dp/dp_hpd.h | 79 + drivers/gpu/drm/msm/dp/dp_link.c | 1214 drivers/gpu/drm/msm/dp/dp_link.h | 132 ++ drivers/gpu/drm/msm/dp/dp_panel.c | 486 + drivers/gpu/drm/msm/dp/dp_panel.h | 95 + drivers/gpu/drm/msm/dp/dp_parser.c| 267 +++ drivers/gpu/drm/msm/dp/dp_parser.h| 138 ++ drivers/gpu/drm/msm/dp/dp_pll.c | 99 + drivers/gpu/drm/msm/dp/dp_pll.h | 61 + drivers/gpu/drm/msm/dp/dp_pll_10nm.c | 930 + drivers/gpu/drm/msm/dp/dp_pll_private.h | 89 + drivers/gpu/drm/msm/dp/dp_power.c | 373 drivers/gpu/drm/msm/dp/dp_power.h | 103 + drivers/gpu/drm/msm/dp/dp_reg.h | 517
[PATCH v11 5/5] drm/msm/dp: Add Display Port HPD feature
Configure HPD registers in DP controller and enable HPD interrupt. Add interrupt to handle HPD connect and disconnect events. Changes in v8: None Signed-off-by: Tanmay Shah --- drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 18 drivers/gpu/drm/msm/dp/dp_catalog.c | 63 -- drivers/gpu/drm/msm/dp/dp_catalog.h | 5 +- drivers/gpu/drm/msm/dp/dp_ctrl.c| 1 - drivers/gpu/drm/msm/dp/dp_display.c | 108 ++-- drivers/gpu/drm/msm/dp/dp_reg.h | 12 +++ drivers/gpu/drm/msm/msm_drv.h | 6 ++ 7 files changed, 180 insertions(+), 33 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c index 62bc33cb0d3a..5e977d5ff341 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c @@ -752,6 +752,23 @@ static void dpu_irq_preinstall(struct msm_kms *kms) dpu_core_irq_preinstall(dpu_kms); } +static int dpu_irq_postinstall(struct msm_kms *kms) +{ + struct msm_drm_private *priv; + struct dpu_kms *dpu_kms = to_dpu_kms(kms); + + if (!dpu_kms || !dpu_kms->dev) + return -EINVAL; + + priv = dpu_kms->dev->dev_private; + if (!priv) + return -EINVAL; + + msm_dp_irq_postinstall(priv->dp); + + return 0; +} + static void dpu_irq_uninstall(struct msm_kms *kms) { struct dpu_kms *dpu_kms = to_dpu_kms(kms); @@ -762,6 +779,7 @@ static void dpu_irq_uninstall(struct msm_kms *kms) static const struct msm_kms_funcs kms_funcs = { .hw_init = dpu_kms_hw_init, .irq_preinstall = dpu_irq_preinstall, + .irq_postinstall = dpu_irq_postinstall, .irq_uninstall = dpu_irq_uninstall, .irq = dpu_irq, .enable_commit = dpu_kms_enable_commit, diff --git a/drivers/gpu/drm/msm/dp/dp_catalog.c b/drivers/gpu/drm/msm/dp/dp_catalog.c index e506e0756e92..d186424044b1 100644 --- a/drivers/gpu/drm/msm/dp/dp_catalog.c +++ b/drivers/gpu/drm/msm/dp/dp_catalog.c @@ -17,7 +17,6 @@ #define POLLING_SLEEP_US 1000 #define POLLING_TIMEOUT_US 1 -#define REFTIMER_DEFAULT_VALUE 0x2 #define SCRAMBLER_RESET_COUNT_VALUE0xFC #define DP_INTERRUPT_STATUS_ACK_SHIFT 1 @@ -731,35 +730,51 @@ void dp_catalog_ctrl_enable_irq(struct dp_catalog *dp_catalog, } } -void dp_catalog_ctrl_hpd_config(struct dp_catalog *dp_catalog, bool en) +void dp_catalog_hpd_config_intr(struct dp_catalog *dp_catalog, + u32 intr_mask, bool en) { struct dp_catalog_private *catalog = container_of(dp_catalog, struct dp_catalog_private, dp_catalog); - if (en) { - u32 reftimer = dp_read_aux(catalog, REG_DP_DP_HPD_REFTIMER); + u32 config = dp_read_aux(catalog, REG_DP_DP_HPD_INT_MASK); - dp_write_aux(catalog, REG_DP_DP_HPD_INT_ACK, - DP_DP_HPD_PLUG_INT_ACK | - DP_DP_IRQ_HPD_INT_ACK | - DP_DP_HPD_REPLUG_INT_ACK | - DP_DP_HPD_UNPLUG_INT_ACK); - dp_write_aux(catalog, REG_DP_DP_HPD_INT_MASK, - DP_DP_HPD_PLUG_INT_MASK | - DP_DP_IRQ_HPD_INT_MASK | - DP_DP_HPD_REPLUG_INT_MASK | - DP_DP_HPD_UNPLUG_INT_MASK); + config = (en ? config | intr_mask : config & ~intr_mask); - /* Configure REFTIMER */ - reftimer |= REFTIMER_DEFAULT_VALUE; - dp_write_aux(catalog, REG_DP_DP_HPD_REFTIMER, reftimer); - /* Enable HPD */ - dp_write_aux(catalog, REG_DP_DP_HPD_CTRL, - DP_DP_HPD_CTRL_HPD_EN); - } else { - /* Disable HPD */ - dp_write_aux(catalog, REG_DP_DP_HPD_CTRL, 0x0); - } + dp_write_aux(catalog, REG_DP_DP_HPD_INT_MASK, + config & DP_DP_HPD_INT_MASK); +} + +void dp_catalog_ctrl_hpd_config(struct dp_catalog *dp_catalog) +{ + struct dp_catalog_private *catalog = container_of(dp_catalog, + struct dp_catalog_private, dp_catalog); + + u32 reftimer = dp_read_aux(catalog, REG_DP_DP_HPD_REFTIMER); + + /* enable HPD interrupts */ + dp_catalog_hpd_config_intr(dp_catalog, + DP_DP_HPD_PLUG_INT_MASK | DP_DP_IRQ_HPD_INT_MASK + | DP_DP_HPD_UNPLUG_INT_MASK, true); + + /* Configure REFTIMER and enable it */ + reftimer |= DP_DP_HPD_REFTIMER_ENABLE; + dp_write_aux(catalog, REG_DP_DP_HPD_REFTIMER, reftimer); + + /* Enable HPD */ + dp_write_aux(catalog, REG_DP_DP_HPD_CTRL, DP_DP_HPD_CTRL_HPD_EN); +} + +u32 dp_catalog_hpd_get_intr_status(struct dp_catalog *dp_catalog) +{ + struct
[PATCH v11 1/5] drm: add constant N value in helper file
From: Chandan Uddaraju The constant N value (0x8000) is used by i915 DP driver. Define this value in dp helper header file to use in multiple Display Port drivers. Change i915 driver accordingly. Change in v6: Change commit message Signed-off-by: Chandan Uddaraju Signed-off-by: Vara Reddy Signed-off-by: Tanmay Shah Reviewed-by: Stephen Boyd Acked-by: Jani Nikula --- drivers/gpu/drm/i915/display/intel_display.c | 2 +- include/drm/drm_dp_helper.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c index 729ec6e0d43a..10b8310f290b 100644 --- a/drivers/gpu/drm/i915/display/intel_display.c +++ b/drivers/gpu/drm/i915/display/intel_display.c @@ -8114,7 +8114,7 @@ static void compute_m_n(unsigned int m, unsigned int n, * which the devices expect also in synchronous clock mode. */ if (constant_n) - *ret_n = 0x8000; + *ret_n = DP_LINK_CONSTANT_N_VALUE; else *ret_n = min_t(unsigned int, roundup_pow_of_two(n), DATA_LINK_N_MAX); diff --git a/include/drm/drm_dp_helper.h b/include/drm/drm_dp_helper.h index e47dc22ebf50..a31d7aebb8b8 100644 --- a/include/drm/drm_dp_helper.h +++ b/include/drm/drm_dp_helper.h @@ -1134,6 +1134,7 @@ #define DP_MST_PHYSICAL_PORT_0 0 #define DP_MST_LOGICAL_PORT_0 8 +#define DP_LINK_CONSTANT_N_VALUE 0x8000 #define DP_LINK_STATUS_SIZE 6 bool drm_dp_channel_eq_ok(const u8 link_status[DP_LINK_STATUS_SIZE], int lane_count); -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
Re: [PATCH 5.8 000/464] 5.8.2-rc1 review
On Mon, 17 Aug 2020 at 20:49, Greg Kroah-Hartman wrote: > > This is the start of the stable review cycle for the 5.8.2 release. > There are 464 patches in this series, all will be posted as a response > to this one. If anyone has any issues with these being applied, please > let me know. > > Responses should be made by Wed, 19 Aug 2020 14:36:49 +. > Anything received after that time might be too late. > > The whole patch series can be found in one patch at: > > https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.8.2-rc1.gz > or in the git tree and branch at: > > git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git > linux-5.8.y > and the diffstat can be found below. > > thanks, > > greg k-h Results from Linaro’s test farm. No regressions on arm64, arm, x86_64, and i386. Summary kernel: 5.8.2-rc1 git repo: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git git branch: linux-5.8.y git commit: d74026bb5bef5450a546db519c5dc961c8fae71c git describe: v5.8.1-465-gd74026bb5bef Test details: https://qa-reports.linaro.org/lkft/linux-stable-rc-5.8-oe/build/v5.8.1-465-gd74026bb5bef No regressions (compared to build v5.8.1) No fixes (compared to build v5.8.1) Ran 34528 total tests in the following environments and test suites. Environments -- - dragonboard-410c - hi6220-hikey - i386 - juno-r2 - juno-r2-compat - juno-r2-kasan - nxp-ls2088 - qemu_arm - qemu_arm64 - qemu_i386 - qemu_x86_64 - x15 - x86 - x86-kasan Test Suites --- * build * igt-gpu-tools * install-android-platform-tools-r2600 * kselftest * kselftest/drivers * kselftest/filesystems * kselftest/net * libhugetlbfs * linux-log-parser * ltp-cap_bounds-tests * ltp-commands-tests * ltp-containers-tests * ltp-cpuhotplug-tests * ltp-crypto-tests * ltp-dio-tests * ltp-fcntl-locktests-tests * ltp-filecaps-tests * ltp-fs_bind-tests * ltp-fs_perms_simple-tests * ltp-fsx-tests * ltp-hugetlb-tests * ltp-io-tests * ltp-ipc-tests * ltp-math-tests * ltp-mm-tests * ltp-nptl-tests * ltp-pty-tests * ltp-securebits-tests * ltp-syscalls-tests * ltp-tracing-tests * perf * v4l2-compliance * ltp-controllers-tests * ltp-cve-tests * ltp-sched-tests * network-basic-tests * ltp-fs-tests * ltp-open-posix-tests * kselftest-vsyscall-mode-native * kselftest-vsyscall-mode-native/drivers * kselftest-vsyscall-mode-native/filesystems * kselftest-vsyscall-mode-native/net * kselftest-vsyscall-mode-none * kselftest-vsyscall-mode-none/drivers * kselftest-vsyscall-mode-none/filesystems * kselftest-vsyscall-mode-none/net * ssuite -- Linaro LKFT https://lkft.linaro.org
[PATCH] kprobes: Use module_name() macro
It is advised to use module_name() macro instead of dereferencing mod->name directly. This makes sense for consistencys sake and also it prevents a hard dependency to CONFIG_MODULES. Cc: linux...@kvack.org Cc: Andi Kleen Cc: Ard Biesheuvel Cc: Jessica Yu Cc: Mark Rutland , Cc: Masami Hiramatsu Cc: Mike Rapoport Cc: Peter Zijlstra Cc: Russell King Cc: Will Deacon Signed-off-by: Jarkko Sakkinen --- I thought that to get things moving it would make sense to fix this low hanging fruit issue first. Similarly as Masami's fix kernel/kprobes.c this will make my patch set less rambling, and thus easier to follow. kernel/trace/trace_kprobe.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c index aefb6065b508..19c00ee90945 100644 --- a/kernel/trace/trace_kprobe.c +++ b/kernel/trace/trace_kprobe.c @@ -106,9 +106,10 @@ static nokprobe_inline bool trace_kprobe_has_gone(struct trace_kprobe *tk) static nokprobe_inline bool trace_kprobe_within_module(struct trace_kprobe *tk, struct module *mod) { - int len = strlen(mod->name); + int len = strlen(module_name(mod)); const char *name = trace_kprobe_symbol(tk); - return strncmp(mod->name, name, len) == 0 && name[len] == ':'; + + return strncmp(module_name(mod), name, len) == 0 && name[len] == ':'; } static nokprobe_inline bool trace_kprobe_module_exist(struct trace_kprobe *tk) @@ -688,7 +689,7 @@ static int trace_kprobe_module_callback(struct notifier_block *nb, if (ret) pr_warn("Failed to re-register probe %s on %s: %d\n", trace_probe_name(>tp), - mod->name, ret); + module_name(mod), ret); } } mutex_unlock(_mutex); -- 2.25.1
Re: [PATCH 10/17] proc/fd: In proc_readfd_common use fnext_task
On Mon, Aug 17, 2020 at 8:46 PM Eric W. Biederman wrote: > > I am definitely willing to look at it. Do we think there would be enough > traffic on task_lock from /proc//fd access to make it work doing? not from /proc, but bpf iterator in kernel/bpf/task_iter.c that is being modified in the other patch is used to process 100+k tasks. The faster it can go through them the better. We don't see task spin_lock being a bottleneck though. To test it just do 'bpftool prog show'. It will use task iterator undercover.
linux-next: Tree for Aug 18
Hi all, Changes since 20200817: New tree: memblock-fixes My fixes tree contains: 73c7adb54169 ("device_cgroup: Fix RCU list debugging warning") The kspp-gustavo tree gained a build failure for which I applied a patch. That exposed another failure, so I used the version from next-20200817. The rcu tree gained a build failure so I used the version from next-20200817. Non-merge commits (relative to Linus' tree): 914 1229 files changed, 29621 insertions(+), 8122 deletions(-) I have created today's linux-next tree at git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git (patches at http://www.kernel.org/pub/linux/kernel/next/ ). If you are tracking the linux-next tree using git, you should not use "git pull" to do so as that will try to merge the new linux-next release with the old one. You should use "git fetch" and checkout or reset to the new master. You can see which trees have been included by looking in the Next/Trees file in the source. There are also quilt-import.log and merge.log files in the Next directory. Between each merge, the tree was built with a ppc64_defconfig for powerpc, an allmodconfig for x86_64, a multi_v7_defconfig for arm and a native build of tools/perf. After the final fixups (if any), I do an x86_64 modules_install followed by builds for x86_64 allnoconfig, powerpc allnoconfig (32 and 64 bit), ppc44x_defconfig, allyesconfig and pseries_le_defconfig and i386, sparc and sparc64 defconfig and htmldocs. And finally, a simple boot test of the powerpc pseries_le_defconfig kernel in qemu (with and without kvm enabled). Below is a summary of the state of the merge. I am currently merging 328 trees (counting Linus' and 86 trees of bug fix patches pending for the current merge release). Stats about the size of the tree over time can be seen at http://neuling.org/linux-next-size.html . Status of my local build tests will be at http://kisskb.ellerman.id.au/linux-next . If maintainers want to give advice about cross compilers/configs that work, we are always open to add more builds. Thanks to Randy Dunlap for doing many randconfig builds. And to Paul Gortmaker for triage and bug fixes. -- Cheers, Stephen Rothwell $ git checkout master $ git reset --hard stable Merging origin/master (9123e3a74ec7 Linux 5.9-rc1) Merging fixes/master (73c7adb54169 device_cgroup: Fix RCU list debugging warning) Merging kbuild-current/fixes (06a81c1c7db9 Merge tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux) Merging arc-current/for-curr (97363c07f023 ARC: show_regs: fix r12 printing and simplify) Merging arm-current/fixes (5c6360ee4a0e ARM: 8988/1: mmu: fix crash in EFI calls due to p4d typo in create_mapping_late()) Merging arm64-fixes/for-next/fixes (6a7389f0312f MAINTAINERS: Include drivers subdirs for ARM PMU PROFILING AND DEBUGGING entry) Merging arm-soc-fixes/arm/fixes (fe1d899f4212 ARM: dts: keystone-k2g-evm: fix rgmii phy-mode for ksz9031 phy) Merging uniphier-fixes/fixes (48778464bb7d Linux 5.8-rc2) Merging drivers-memory-fixes/fixes (7ff3a2a626f7 memory: jz4780_nemc: Fix an error pointer vs NULL check in probe()) Merging m68k-current/for-linus (382f429bb559 m68k: defconfig: Update defconfigs for v5.8-rc3) Merging powerpc-fixes/fixes (388692e943a5 powerpc/kernel: Cleanup machine check function declarations) Merging s390-fixes/fixes (b97bf44f9915 s390/pci: fix PF/VF linking on hot plug) Merging sparc/master (0a95a6d1a4cd sparc: use for_each_child_of_node() macro) Merging fscrypt-current/for-stable (2b4eae95c736 fscrypt: don't evict dirty inodes after removing key) Merging net/master (bf2bcd6f1a88 otx2_common: Use devm_kcalloc() in otx2_config_npa()) Merging bpf/master (cf28f3bbfca0 bpf: Use get_file_rcu() instead of get_file() for task_file iterator) Merging ipsec/master (4eb2e1341575 espintcp: restore IP CB before handing the packet to xfrm) Merging netfilter/master (b3b2854dcf70 mptcp: sendmsg: reset iter on error redux) Merging ipvs/master (7c7ab580db49 net: Convert to use the fallthrough macro) Merging wireless-drivers/master (9123e3a74ec7 Linux 5.9-rc1) Merging mac80211/master (b3b2854dcf70 mptcp: sendmsg: reset iter on error redux) Merging rdma-fixes/for-rc (bcf876870b95 Linux 5.8) Merging sound-current/for-linus (d8d0db7bb358 ALSA: usb-audio: ignore broken processing/extension unit) Merging sound-asoc-fixes/for-linus (e4135d350a2d Merge remote-tracking branch 'asoc/for-5.9' into asoc-linus) Merging regmap-fixes/for-linus (9123e3a74ec7 Linux 5.9-rc1) Merging regulator-fixes/for-linus (79d0a6620a76 Merge remote-tracking branch 'regulator/for-5.9' into regulator-linus) Merging spi-fixes/for-linus (e5c9b1cfe42c Merge remote-tracking branch 'spi/for-5.9' into spi-linus) Merging pci-current/for-linus (7c2308f79fc8 PCI/P2PDMA: Fix build without DMA ops) Merging driver-core.current/driver-core-linus (9123e3a74ec7 Linu
arch/mips/include/asm/mach-loongson64/topology.h:7:27: error: implicit declaration of function 'cpu_logical_map'
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master head: 06a4ec1d9dc652e17ee3ac2ceb6c7cf6c2b75cdd commit: 02fce139fd14d3b0126f0a72e8c0a83b5b01f9f5 Merge tag 'mips_fixes_5.4_3' into mips-next date: 10 months ago config: mips-randconfig-r033-20200818 (attached as .config) compiler: mips64el-linux-gcc (GCC) 9.3.0 reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross git checkout 02fce139fd14d3b0126f0a72e8c0a83b5b01f9f5 # save the attached .config to linux build tree COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=mips If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot All errors (new ones prefixed by >>): In file included from arch/mips/include/asm/topology.h:11, from include/linux/topology.h:36, from include/linux/gfp.h:9, from include/linux/slab.h:15, from include/linux/crypto.h:19, from include/crypto/hash.h:11, from include/linux/uio.h:10, from include/linux/socket.h:8, from include/linux/compat.h:15, from arch/mips/kernel/asm-offsets.c:12: include/linux/topology.h: In function 'numa_node_id': >> arch/mips/include/asm/mach-loongson64/topology.h:7:27: error: implicit >> declaration of function 'cpu_logical_map' >> [-Werror=implicit-function-declaration] 7 | #define cpu_to_node(cpu) (cpu_logical_map(cpu) >> 2) | ^~~ include/linux/topology.h:119:9: note: in expansion of macro 'cpu_to_node' 119 | return cpu_to_node(raw_smp_processor_id()); | ^~~ arch/mips/kernel/asm-offsets.c: At top level: arch/mips/kernel/asm-offsets.c:26:6: warning: no previous prototype for 'output_ptreg_defines' [-Wmissing-prototypes] 26 | void output_ptreg_defines(void) | ^~~~ arch/mips/kernel/asm-offsets.c:78:6: warning: no previous prototype for 'output_task_defines' [-Wmissing-prototypes] 78 | void output_task_defines(void) | ^~~ arch/mips/kernel/asm-offsets.c:93:6: warning: no previous prototype for 'output_thread_info_defines' [-Wmissing-prototypes] 93 | void output_thread_info_defines(void) | ^~ arch/mips/kernel/asm-offsets.c:110:6: warning: no previous prototype for 'output_thread_defines' [-Wmissing-prototypes] 110 | void output_thread_defines(void) | ^ arch/mips/kernel/asm-offsets.c:138:6: warning: no previous prototype for 'output_thread_fpu_defines' [-Wmissing-prototypes] 138 | void output_thread_fpu_defines(void) | ^ arch/mips/kernel/asm-offsets.c:181:6: warning: no previous prototype for 'output_mm_defines' [-Wmissing-prototypes] 181 | void output_mm_defines(void) | ^ arch/mips/kernel/asm-offsets.c:242:6: warning: no previous prototype for 'output_sc_defines' [-Wmissing-prototypes] 242 | void output_sc_defines(void) | ^ arch/mips/kernel/asm-offsets.c:255:6: warning: no previous prototype for 'output_signal_defined' [-Wmissing-prototypes] 255 | void output_signal_defined(void) | ^ arch/mips/kernel/asm-offsets.c:322:6: warning: no previous prototype for 'output_pbe_defines' [-Wmissing-prototypes] 322 | void output_pbe_defines(void) | ^~ arch/mips/kernel/asm-offsets.c:348:6: warning: no previous prototype for 'output_kvm_defines' [-Wmissing-prototypes] 348 | void output_kvm_defines(void) | ^~ cc1: some warnings being treated as errors make[2]: *** [scripts/Makefile.build:99: arch/mips/kernel/asm-offsets.s] Error 1 make[2]: Target 'missing-syscalls' not remade because of errors. make[1]: *** [arch/mips/Makefile:418: archprepare] Error 2 make[1]: Target 'prepare' not remade because of errors. make: *** [Makefile:179: sub-make] Error 2 make: Target 'prepare' not remade because of errors. # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=02fce139fd14d3b0126f0a72e8c0a83b5b01f9f5 git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git git fetch --no-tags linus master git checkout 02fce139fd14d3b0126f0a72e8c0a83b5b01f9f5 vim +/cpu_logical_map +7 arch/mips/include/asm/mach-loongson64/topology.h c46173183657bb arch/mips/include/asm/mach-loongson/topology.h Huacai Chen 2014-06-26 6 ec0f8d3fbb7ea1 arch/mips/include/asm/mach-loongson/topology.h Huacai Chen 2014-11-04 @7 #define cpu_to_node(cpu)
Re: [PATCH] ath10k: fix the status check and wrong return
On Mon, Aug 17, 2020 at 6:43 PM Tang Bin wrote: > > Hi Kalle: > > 在 2020/8/17 22:26, Kalle Valo 写道: > >> In the function ath10k_ahb_clock_init(), devm_clk_get() doesn't > >> return NULL. Thus use IS_ERR() and PTR_ERR() to validate > >> the returned value instead of IS_ERR_OR_NULL(). > > Why? What's the benefit of this patch? Or what harm does > > IS_ERR_OR_NULL() create? > > Thanks for you reply, the benefit of this patch is simplify the code, > because in > > this function, I don't think the situation of 'devm_clk_get() return > NULL' exists. > I admit I'm not looking at HEAD, but at least in the two versions I've got checked out, devm_clk_get() can theoretically return NULL. This feels like a gratuitous change anyway, but in any case it's wrong and could cause wrong behavior. - Steve
Re: [PATCH v4 3/7] genirq: Introduce irq_suspend_one() and irq_resume_one() callbacks
Hi, On 8/14/2020 4:28 AM, Doug Anderson wrote: Hi, On Thu, Aug 13, 2020 at 3:09 PM Thomas Gleixner wrote: Specifically the problem we're trying to address is when an IRQ is marked as "disabled" (driver called disable_irq()) but also marked as "wakeup" (driver called enable_irq_wake()). As per my understanding, this means: * Don't call the interrupt handler for this interrupt until I call enable_irq() but keep tracking it (either in hardware or in software). Specifically it's a requirement that if the interrupt fires one or more times while masked the interrupt handler should be called as soon as enable_irq() is called. irq_disable() has two operating modes: 1) Immediately mask the interrupt at the irq chip level 2) Software disable it. If an interrupt is raised while disabled then the flow handler observes disabled state, masks it, marks it pending and returns without invoking any device handler. On a subsequent irq_enable() the interrupt is unmasked if it was masked and if the interrupt is marked pending and the interrupt is not level type then it's attempted to retrigger it. Either in hardware or by a software replay mechanism. * If this interrupt fires while the system is suspended then please wake the system up. Well, that's kinda contradicting itself. If the interrupt is masked then what is the point? I'm surely missing something subtle here. This is how I've always been told that the API works and there are at least a handful of drivers in the kernel whose suspend routines both enable wakeup and call disable_irq(). Isn't this also documented as of commit f9f21cea3113 ("genirq: Clarify that irq wake state is orthogonal to enable/disable")? On some (many?) interrupt controllers a masked interrupt won't wake the system up. Thus we need some point in time where the interrupt controller can unmask interrupts in hardware so that they can act as wakeups. So far nobody told me about this until now, but why exactly do we need yet another unspecified callback instead of simply telling the core via an irq chip flag that it should always unmask the interrupt if it is a wakeup source? Also: if an interrupt was masked lazily this could be a good time to ensure that these interrupts _won't_ wake the system up. Setting IRQCHIP_MASK_ON_SUSPEND does exactly that. No need for a chip driver to do any magic. You just have to use it. So the really obvious counterpart for this is to have: IRQCHIP_UNMASK_WAKEUP_ON_SUSPEND and then do: @@ -81,6 +81,8 @@ static bool suspend_device_irq(struct ir * IRQD_WAKEUP_ARMED is visible before we return from * suspend_device_irqs(). */ + if (chip->flags & IRQCHIP_UNMASK_WAKEUP_ON_SUSPEND) + unmask_irq(desc); return true; } plus the counterpart in the resume path. This also ensures that state is consistent. This sounds wonderful to me. Maulik: I think you could replace quite a few of the patches in the series and just use that. Sure. + if (chip->flags & IRQCHIP_UNMASK_WAKEUP_ON_SUSPEND) + unmask_irq(desc); I tried this patch and it didnot work as is. Calling unmask_irq() only invoke's chip's .irq_unmask callback but the underlying irq_chip have .irq_enable also present. Replacing the call with irq_enable() internally takes care of either invoking chip's .irq_enable (if its present) else it invokes unmask_irq(). + + if (chip->flags & IRQCHIP_UNMASK_WAKEUP_ON_SUSPEND) + irq_enable(desc); probably IRQCHIP_UNMASK_WAKEUP_ON_SUSPEND should also be renamed to IRQCHIP_ENABLE_WAKEUP_ON_SUSPEND. Thanks, Maulik The magic behind the back of the core code unmask brings core state and hardware state out of sync. So if for whatever reason the interrupt is raised in the CPU before the resume path can mask it again, then the flow handler will see disabled state, invoke mask_irq() which does nothing because core state is masked and if that's a level irq it will come back forever. Thus the point of these callbacks is to provide a hook for IRQ chips to do this. Now that you understand the motivation perhaps you can suggest a better way to accomplish this if the approach in this patch is not OK. See above. I will note that a quick audit of existing users of the gernic-chip's irq_suspend() show that they are doing exactly this. So the point of my patch is to actually allow other IRQ chips (ones that aren't using generic-chip) to do this type of thing. At the same time my patch provides a way for current users of generic-chip to adapt their routines so they work without syscore (which, I guess, isn't compatible with s2idle). If that's the main problem which is solved in these callbacks, then I really have to ask why this has not been raised years ago. Why can't people talk? Not all of us have the big picture that you do to know how
[RFC PATCH] xen/gntdev.c: Convert get_user_pages*() to pin_user_pages*()
In 2019, we introduced pin_user_pages*() and now we are converting get_user_pages*() to the new API as appropriate. [1] & [2] could be referred for more information. This is case 5 as per document [1]. [1] Documentation/core-api/pin_user_pages.rst [2] "Explicit pinning of user-space pages": https://lwn.net/Articles/807108/ Signed-off-by: Souptick Joarder Cc: John Hubbard --- drivers/xen/gntdev.c | 7 ++- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/xen/gntdev.c b/drivers/xen/gntdev.c index 64a9025a..e480509 100644 --- a/drivers/xen/gntdev.c +++ b/drivers/xen/gntdev.c @@ -730,7 +730,7 @@ static int gntdev_get_page(struct gntdev_copy_batch *batch, void __user *virt, unsigned long xen_pfn; int ret; - ret = get_user_pages_fast(addr, 1, writeable ? FOLL_WRITE : 0, ); + ret = pin_user_pages_fast(addr, 1, writeable ? FOLL_WRITE : 0, ); if (ret < 0) return ret; @@ -744,10 +744,7 @@ static int gntdev_get_page(struct gntdev_copy_batch *batch, void __user *virt, static void gntdev_put_pages(struct gntdev_copy_batch *batch) { - unsigned int i; - - for (i = 0; i < batch->nr_pages; i++) - put_page(batch->pages[i]); + unpin_user_pages(batch->pages, batch->nr_pages); batch->nr_pages = 0; } -- 1.9.1
[PATCH] mm/hotplug: Enumerate memory range offlining failure reasons
Currently a debug message is printed describing the reason for memory range offline failure. This just enumerates existing reason codes which improves overall readability and makes it cleaner. This does not add any functional change. Cc: Andrew Morton Cc: David Hildenbrand Cc: Michal Hocko Cc: Dan Williams Cc: linux...@kvack.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Anshuman Khandual --- This is based on 5.9-rc1 include/linux/memory.h | 28 mm/memory_hotplug.c| 18 +- 2 files changed, 37 insertions(+), 9 deletions(-) diff --git a/include/linux/memory.h b/include/linux/memory.h index 439a89e758d8..4b52d706edc1 100644 --- a/include/linux/memory.h +++ b/include/linux/memory.h @@ -44,6 +44,34 @@ int set_memory_block_size_order(unsigned int order); #defineMEM_CANCEL_ONLINE (1<<4) #defineMEM_CANCEL_OFFLINE (1<<5) +/* + * Memory offline failure reasons + */ +enum offline_failure_reason { + OFFLINE_FAILURE_MEMHOLES, + OFFLINE_FAILURE_MULTIZONE, + OFFLINE_FAILURE_ISOLATE, + OFFLINE_FAILURE_NOTIFIER, + OFFLINE_FAILURE_SIGNAL, + OFFLINE_FAILURE_UNMOVABLE, + OFFLINE_FAILURE_DISSOLVE, +}; + +static const char *const offline_failure_names[] = { + [OFFLINE_FAILURE_MEMHOLES] = "memory holes", + [OFFLINE_FAILURE_MULTIZONE] = "multizone range", + [OFFLINE_FAILURE_ISOLATE] = "failure to isolate range", + [OFFLINE_FAILURE_NOTIFIER] = "notifier failure", + [OFFLINE_FAILURE_SIGNAL]= "signal backoff", + [OFFLINE_FAILURE_UNMOVABLE] = "unmovable page", + [OFFLINE_FAILURE_DISSOLVE] = "failure to dissolve huge pages", +}; + +static inline const char *offline_failure(enum offline_failure_reason reason) +{ + return offline_failure_names[reason]; +} + struct memory_notify { unsigned long start_pfn; unsigned long nr_pages; diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index e9d5ab5d3ca0..b3fa36a09d7f 100644 --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c @@ -1484,7 +1484,7 @@ static int __ref __offline_pages(unsigned long start_pfn, unsigned long flags; struct zone *zone; struct memory_notify arg; - char *reason; + enum offline_failure_reason reason; mem_hotplug_begin(); @@ -1500,7 +1500,7 @@ static int __ref __offline_pages(unsigned long start_pfn, count_system_ram_pages_cb); if (nr_pages != end_pfn - start_pfn) { ret = -EINVAL; - reason = "memory holes"; + reason = OFFLINE_FAILURE_MEMHOLES; goto failed_removal; } @@ -1509,7 +1509,7 @@ static int __ref __offline_pages(unsigned long start_pfn, zone = test_pages_in_a_zone(start_pfn, end_pfn); if (!zone) { ret = -EINVAL; - reason = "multizone range"; + reason = OFFLINE_FAILURE_MULTIZONE; goto failed_removal; } node = zone_to_nid(zone); @@ -1519,7 +1519,7 @@ static int __ref __offline_pages(unsigned long start_pfn, MIGRATE_MOVABLE, MEMORY_OFFLINE | REPORT_FAILURE); if (ret < 0) { - reason = "failure to isolate range"; + reason = OFFLINE_FAILURE_ISOLATE; goto failed_removal; } nr_isolate_pageblock = ret; @@ -1531,7 +1531,7 @@ static int __ref __offline_pages(unsigned long start_pfn, ret = memory_notify(MEM_GOING_OFFLINE, ); ret = notifier_to_errno(ret); if (ret) { - reason = "notifier failure"; + reason = OFFLINE_FAILURE_NOTIFIER; goto failed_removal_isolated; } @@ -1540,7 +1540,7 @@ static int __ref __offline_pages(unsigned long start_pfn, do { if (signal_pending(current)) { ret = -EINTR; - reason = "signal backoff"; + reason = OFFLINE_FAILURE_SIGNAL; goto failed_removal_isolated; } @@ -1558,7 +1558,7 @@ static int __ref __offline_pages(unsigned long start_pfn, } while (!ret); if (ret != -ENOENT) { - reason = "unmovable page"; + reason = OFFLINE_FAILURE_UNMOVABLE; goto failed_removal_isolated; } @@ -1569,7 +1569,7 @@ static int __ref __offline_pages(unsigned long start_pfn, */ ret = dissolve_free_huge_pages(start_pfn, end_pfn); if (ret) { - reason = "failure to dissolve huge pages"; + reason = OFFLINE_FAILURE_DISSOLVE; goto failed_removal_isolated;
Re: [PATCH bpf-next v8 6/7] bpf: Allow local storage to be used from LSM programs
On Mon, Aug 03, 2020 at 06:46:54PM +0200, KP Singh wrote: > From: KP Singh > > Adds support for both bpf_{sk, inode}_storage_{get, delete} to be used > in LSM programs. These helpers are not used for tracing programs > (currently) as their usage is tied to the life-cycle of the object and > should only be used where the owning object won't be freed (when the > owning object is passed as an argument to the LSM hook). Thus, they > are safer to use in LSM hooks than tracing. Usage of local storage in > tracing programs will probably follow a per function based whitelist > approach. > > Since the UAPI helper signature for bpf_sk_storage expect a bpf_sock, > it, leads to a compilation warning for LSM programs, it's also updated > to accept a void * pointer instead. > > Signed-off-by: KP Singh > --- > include/net/bpf_sk_storage.h | 2 ++ > include/uapi/linux/bpf.h | 8 ++-- > kernel/bpf/bpf_lsm.c | 21 - > net/core/bpf_sk_storage.c | 25 + > tools/include/uapi/linux/bpf.h | 8 ++-- > 5 files changed, 59 insertions(+), 5 deletions(-) > > diff --git a/include/net/bpf_sk_storage.h b/include/net/bpf_sk_storage.h > index 847926cf2899..c5702d7baeaa 100644 > --- a/include/net/bpf_sk_storage.h > +++ b/include/net/bpf_sk_storage.h > @@ -20,6 +20,8 @@ void bpf_sk_storage_free(struct sock *sk); > > extern const struct bpf_func_proto bpf_sk_storage_get_proto; > extern const struct bpf_func_proto bpf_sk_storage_delete_proto; > +extern const struct bpf_func_proto sk_storage_get_btf_proto; > +extern const struct bpf_func_proto sk_storage_delete_btf_proto; > > struct bpf_sk_storage_diag; > struct sk_buff; > diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h > index e17c00eea5d8..6ffc61dafc5c 100644 > --- a/include/uapi/linux/bpf.h > +++ b/include/uapi/linux/bpf.h > @@ -2807,7 +2807,7 @@ union bpf_attr { > * > * **-ERANGE** if resulting value was out of range. > * > - * void *bpf_sk_storage_get(struct bpf_map *map, struct bpf_sock *sk, void > *value, u64 flags) > + * void *bpf_sk_storage_get(struct bpf_map *map, void *sk, void *value, u64 > flags) > * Description > * Get a bpf-local-storage from a *sk*. > * > @@ -2823,6 +2823,10 @@ union bpf_attr { > * "type". The bpf-local-storage "type" (i.e. the *map*) is > * searched against all bpf-local-storages residing at *sk*. > * > + * For socket programs, *sk* should be a **struct bpf_sock** > pointer > + * and an **ARG_PTR_TO_BTF_ID** of type **struct sock** for LSM > + * programs. I found it a little vague on what "socket programs" is. May be: *sk* is a kernel **struct sock** pointer for LSM program. *sk* is a **struct bpf_sock** pointer for other program types. Others LGTM Acked-by: Martin KaFai Lau
Re: [PATCH v6 02/15] iommu: Report domain nesting info
On Sun, 16 Aug 2020 14:40:57 +0200 Auger Eric wrote: > Hi Yi, > > On 8/14/20 9:15 AM, Liu, Yi L wrote: > > Hi Eric, > > > >> From: Auger Eric > >> Sent: Thursday, August 13, 2020 8:53 PM > >> > >> Yi, > >> On 7/28/20 8:27 AM, Liu Yi L wrote: > >>> IOMMUs that support nesting translation needs report the > >>> capability info > >> s/needs/need to > >>> to userspace. It gives information about requirements the > >>> userspace needs to implement plus other features characterizing > >>> the physical implementation. > >>> > >>> This patch reports nesting info by DOMAIN_ATTR_NESTING. Caller > >>> can get nesting info after setting DOMAIN_ATTR_NESTING. For VFIO, > >>> it is after selecting VFIO_TYPE1_NESTING_IOMMU. > >> This is not what this patch does ;-) It introduces a new IOMMU UAPI > >> struct that gives information about the nesting capabilities and > >> features. This struct is supposed to be returned by > >> iommu_domain_get_attr() with DOMAIN_ATTR_NESTING attribute > >> parameter, one a domain whose type has been set to > >> DOMAIN_ATTR_NESTING. > > > > got it. let me apply your suggestion. thanks. :-) > > > >>> > >>> Cc: Kevin Tian > >>> CC: Jacob Pan > >>> Cc: Alex Williamson > >>> Cc: Eric Auger > >>> Cc: Jean-Philippe Brucker > >>> Cc: Joerg Roedel > >>> Cc: Lu Baolu > >>> Signed-off-by: Liu Yi L > >>> Signed-off-by: Jacob Pan > >>> --- > >>> v5 -> v6: > >>> *) rephrase the feature notes per comments from Eric Auger. > >>> *) rename @size of struct iommu_nesting_info to @argsz. > >>> > >>> v4 -> v5: > >>> *) address comments from Eric Auger. > >>> > >>> v3 -> v4: > >>> *) split the SMMU driver changes to be a separate patch > >>> *) move the @addr_width and @pasid_bits from vendor specific > >>>part to generic part. > >>> *) tweak the description for the @features field of struct > >>>iommu_nesting_info. > >>> *) add description on the @data[] field of struct > >>> iommu_nesting_info > >>> > >>> v2 -> v3: > >>> *) remvoe cap/ecap_mask in iommu_nesting_info. > >>> *) reuse DOMAIN_ATTR_NESTING to get nesting info. > >>> *) return an empty iommu_nesting_info for SMMU drivers per Jean' > >>>suggestion. > >>> --- > >>> include/uapi/linux/iommu.h | 74 > >> ++ > >>> 1 file changed, 74 insertions(+) > >>> > >>> diff --git a/include/uapi/linux/iommu.h > >>> b/include/uapi/linux/iommu.h index 7c8e075..5e4745a 100644 > >>> --- a/include/uapi/linux/iommu.h > >>> +++ b/include/uapi/linux/iommu.h > >>> @@ -332,4 +332,78 @@ struct iommu_gpasid_bind_data { > >>> } vendor; > >>> }; > >>> > >>> +/* > >>> + * struct iommu_nesting_info - Information for nesting-capable > >>> IOMMU. > >>> + * userspace should check it > >>> before using > >>> + * nesting capability. > >>> + * > >>> + * @argsz: size of the whole structure. > >>> + * @flags: currently reserved for future extension. must > >>> set to 0. > >>> + * @format: PASID table entry format, the same definition > >>> as struct > >>> + * iommu_gpasid_bind_data @format. > >>> + * @features:supported nesting features. > >>> + * @addr_width: The output addr width of first > >>> level/stage translation > >>> + * @pasid_bits: Maximum supported PASID bits, 0 > >>> represents no PASID > >>> + * support. > >>> + * @data:vendor specific cap info. data[] structure type > >>> can be deduced > >>> + * from @format field. > >>> + * > >>> + * > >> +===+=== > >> ===+ > >>> + * | feature | > >>> Notes | > >>> + * > >> +===+=== > >> ===+ > >>> + * | SYSWIDE_PASID | IOMMU vendor driver sets it to mandate > >>> userspace| > >>> + * | | to allocate PASID from kernel. All PASID > >>> allocation | > >>> + * | | free must be mediated through the TBD > >>> API. | > >> s/TBD/IOMMU > > > > got it. > > > >>> + * > >>> +---+--+ > >>> + * | BIND_PGTBL| IOMMU vendor driver sets it to mandate > >>> userspace| > >>> + * | | bind the first level/stage page table to > >>> associated | > >> s/bind/to bind > > > > got it. > > > >>> + * | | PASID (either the one specified in bind > >>> request or | > >>> + * | | the default PASID of iommu domain), > >>> through IOMMU | > >>> + * | | > >>> UAPI. | > >>> + * > >>> +---+--+ > >>> + * | CACHE_INVLD | IOMMU vendor driver sets it to mandate > >>> userspace| > >> > >>> + * | | explicitly invalidate the IOMMU cache > >>> through IOMMU |
[PATCH] block: rnbd: rnbd-srv: silence uninitialized variable warning
Clang warns: drivers/block/rnbd/rnbd-srv.c:150:6: warning: variable 'err' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized] if (IS_ERR(bio)) { ^~~ drivers/block/rnbd/rnbd-srv.c:177:9: note: uninitialized use occurs here return err; ^~~ drivers/block/rnbd/rnbd-srv.c:126:9: note: initialize the variable 'err' to silence this warning int err; ^ = 0 Silence this by replacing `err` with `ret`, returning ret = 0 upon success. Signed-off-by: Brooke Basile --- drivers/block/rnbd/rnbd-srv.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/block/rnbd/rnbd-srv.c b/drivers/block/rnbd/rnbd-srv.c index 0fb94843a495..f515d1a048a9 100644 --- a/drivers/block/rnbd/rnbd-srv.c +++ b/drivers/block/rnbd/rnbd-srv.c @@ -123,10 +123,10 @@ static int process_rdma(struct rtrs_srv *sess, struct rnbd_io_private *priv; struct rnbd_srv_sess_dev *sess_dev; u32 dev_id; - int err; struct rnbd_dev_blk_io *io; struct bio *bio; short prio; + int ret = 0; priv = kmalloc(sizeof(*priv), GFP_KERNEL); if (!priv) @@ -138,7 +138,7 @@ static int process_rdma(struct rtrs_srv *sess, if (IS_ERR(sess_dev)) { pr_err_ratelimited("Got I/O request on session %s for unknown device id %d\n", srv_sess->sessname, dev_id); - err = -ENOTCONN; + ret = -ENOTCONN; goto err; } @@ -168,13 +168,13 @@ static int process_rdma(struct rtrs_srv *sess, submit_bio(bio); - return 0; + return ret; sess_dev_put: rnbd_put_sess_dev(sess_dev); err: kfree(priv); - return err; + return ret; } static void destroy_device(struct rnbd_srv_dev *dev) -- 2.28.0
[PATCH 2/2] tasks: Add task_struct addr for lx-ps cmd
task_struct addr in lx-ps cmd seems helpful TASK PIDCOMM 0x82c2b8c0 0 swapper/0 0x888a0ba20040 1 systemd 0x888a0ba24040 2 kthreadd 0x888a0ba28040 3 rcu_gp Signed-off-by: Ritesh Harjani --- scripts/gdb/linux/tasks.py | 9 + 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/scripts/gdb/linux/tasks.py b/scripts/gdb/linux/tasks.py index 0301dc1e0138..17ec19e9b5bf 100644 --- a/scripts/gdb/linux/tasks.py +++ b/scripts/gdb/linux/tasks.py @@ -73,11 +73,12 @@ class LxPs(gdb.Command): super(LxPs, self).__init__("lx-ps", gdb.COMMAND_DATA) def invoke(self, arg, from_tty): +gdb.write("{:>10} {:>12} {:>7}\n".format("TASK", "PID", "COMM")) for task in task_lists(): -gdb.write("{address} {pid} {comm}\n".format( -address=task, -pid=task["pid"], -comm=task["comm"].string())) +gdb.write("{} {:^5} {}\n".format( +task.format_string().split()[0], +task["pid"].format_string(), +task["comm"].string())) LxPs() -- 2.25.4
[PATCH 0/2] scripts:gdb: Add few structs in gdb scripts
I was using these structs info internally in my gdb scripts. So sending it out for merge to upstream. Ritesh Harjani (2): proc: Add struct mount & struct super_block addr in lx-mounts command tasks: Add task_struct addr for lx-ps cmd scripts/gdb/linux/lists.py | 43 ++ scripts/gdb/linux/proc.py | 15 +++-- scripts/gdb/linux/tasks.py | 9 3 files changed, 12 insertions(+), 12 deletions(-) -- 2.25.4
[PATCH 1/2] proc: Add struct mount & struct super_block addr in lx-mounts command
This is many times found useful while debugging some FS related issue. mount super_block fstype devname pathname options 0x888a0bfa4b40 0x888a0bfc1000 rootfs none / rw 0 0 0x888a02c065c0 0x8889fcf65000 ext4 /dev/root / rw ,relatime 0 0 0x8889fc8cc040 0x888a0bb51000 devtmpfs devtmpfs /dev rw ,relatime 0 0 Signed-off-by: Ritesh Harjani --- scripts/gdb/linux/proc.py | 15 +++ 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/scripts/gdb/linux/proc.py b/scripts/gdb/linux/proc.py index 6a56bba233a9..c16fab981bdd 100644 --- a/scripts/gdb/linux/proc.py +++ b/scripts/gdb/linux/proc.py @@ -167,6 +167,9 @@ values of that process namespace""" if not namespace: raise gdb.GdbError("No namespace for current process") +gdb.write("{:^18} {:^15} {:>9} {} {} options\n".format( + "mount", "super_block", "fstype", "devname", "pathname")) + for vfs in lists.list_for_each_entry(namespace['list'], mount_ptr_type, "mnt_list"): devname = vfs['mnt_devname'].string() @@ -190,14 +193,10 @@ values of that process namespace""" m_flags = int(vfs['mnt']['mnt_flags']) rd = "ro" if (s_flags & constants.LX_SB_RDONLY) else "rw" -gdb.write( -"{} {} {} {}{}{} 0 0\n" -.format(devname, -pathname, -fstype, -rd, -info_opts(FS_INFO, s_flags), -info_opts(MNT_INFO, m_flags))) +gdb.write("{} {} {} {} {} {} {} {} 0 0\n".format( + vfs.format_string(), superblock.format_string(), fstype, + devname, pathname, rd, info_opts(FS_INFO, s_flags), + info_opts(MNT_INFO, m_flags))) LxMounts() -- 2.25.4
[PATCH net-next] net: dsa: loop: Return VLAN table size through devlink
We return the VLAN table size through devlink as a simple parameter, we do not support altering it at runtime: devlink resource show mdio_bus/fixed-0:1f mdio_bus/fixed-0:1f: name VTU size 4096 occ 4096 unit entry dpipe_tables none Signed-off-by: Florian Fainelli --- drivers/net/dsa/dsa_loop.c | 47 +- 1 file changed, 46 insertions(+), 1 deletion(-) diff --git a/drivers/net/dsa/dsa_loop.c b/drivers/net/dsa/dsa_loop.c index eb600b3dbf26..474d0747d4ed 100644 --- a/drivers/net/dsa/dsa_loop.c +++ b/drivers/net/dsa/dsa_loop.c @@ -28,6 +28,45 @@ static struct dsa_loop_mib_entry dsa_loop_mibs[] = { static struct phy_device *phydevs[PHY_MAX_ADDR]; +enum dsa_loop_devlink_resource_id { + DSA_LOOP_DEVLINK_PARAM_ID_VTU, +}; + +static u64 dsa_loop_devlink_vtu_get(void *priv) +{ + struct dsa_loop_priv *ps = priv; + + return ARRAY_SIZE(ps->vlans); +} + +static int dsa_loop_setup_devlink_resources(struct dsa_switch *ds) +{ + struct devlink_resource_size_params size_params; + struct dsa_loop_priv *ps = ds->priv; + int err; + + devlink_resource_size_params_init(_params, ARRAY_SIZE(ps->vlans), + ARRAY_SIZE(ps->vlans), + 1, DEVLINK_RESOURCE_UNIT_ENTRY); + + err = dsa_devlink_resource_register(ds, "VTU", ARRAY_SIZE(ps->vlans), + DSA_LOOP_DEVLINK_PARAM_ID_VTU, + DEVLINK_RESOURCE_ID_PARENT_TOP, + _params); + if (err) + goto out; + + dsa_devlink_resource_occ_get_register(ds, + DSA_LOOP_DEVLINK_PARAM_ID_VTU, + dsa_loop_devlink_vtu_get, ps); + + return 0; + +out: + dsa_devlink_resources_unregister(ds); + return err; +} + static enum dsa_tag_protocol dsa_loop_get_protocol(struct dsa_switch *ds, int port, enum dsa_tag_protocol mp) @@ -48,7 +87,12 @@ static int dsa_loop_setup(struct dsa_switch *ds) dev_dbg(ds->dev, "%s\n", __func__); - return 0; + return dsa_loop_setup_devlink_resources(ds); +} + +static void dsa_loop_teardown(struct dsa_switch *ds) +{ + dsa_devlink_resources_unregister(ds); } static int dsa_loop_get_sset_count(struct dsa_switch *ds, int port, int sset) @@ -243,6 +287,7 @@ static int dsa_loop_port_max_mtu(struct dsa_switch *ds, int port) static const struct dsa_switch_ops dsa_loop_driver = { .get_tag_protocol = dsa_loop_get_protocol, .setup = dsa_loop_setup, + .teardown = dsa_loop_teardown, .get_strings= dsa_loop_get_strings, .get_ethtool_stats = dsa_loop_get_ethtool_stats, .get_sset_count = dsa_loop_get_sset_count, -- 2.25.1
drivers/scsi/sg.c:1145 sg_ioctl_common() warn: inconsistent returns 'sfp->rq_list_lock'.
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master head: 06a4ec1d9dc652e17ee3ac2ceb6c7cf6c2b75cdd commit: d320a9551e394cb2d842fd32d28e9805c2a18fbb compat_ioctl: scsi: move ioctl handling into drivers date: 8 months ago config: ia64-randconfig-m031-20200818 (attached as .config) compiler: ia64-linux-gcc (GCC) 9.3.0 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot New smatch warnings: drivers/scsi/sg.c:1145 sg_ioctl_common() warn: inconsistent returns 'sfp->rq_list_lock'. Old smatch warnings: drivers/scsi/sg.c:1094 sg_ioctl_common() warn: inconsistent indenting # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=d320a9551e394cb2d842fd32d28e9805c2a18fbb git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git git fetch --no-tags linus master git checkout d320a9551e394cb2d842fd32d28e9805c2a18fbb vim +1145 drivers/scsi/sg.c 912 913 static long 914 sg_ioctl_common(struct file *filp, Sg_device *sdp, Sg_fd *sfp, 915 unsigned int cmd_in, void __user *p) 916 { 917 int __user *ip = p; 918 int result, val, read_only; 919 Sg_request *srp; 920 unsigned long iflags; 921 922 SCSI_LOG_TIMEOUT(3, sg_printk(KERN_INFO, sdp, 923 "sg_ioctl: cmd=0x%x\n", (int) cmd_in)); 924 read_only = (O_RDWR != (filp->f_flags & O_ACCMODE)); 925 926 switch (cmd_in) { 927 case SG_IO: 928 if (atomic_read(>detaching)) 929 return -ENODEV; 930 if (!scsi_block_when_processing_errors(sdp->device)) 931 return -ENXIO; 932 result = sg_new_write(sfp, filp, p, SZ_SG_IO_HDR, 933 1, read_only, 1, ); 934 if (result < 0) 935 return result; 936 result = wait_event_interruptible(sfp->read_wait, 937 (srp_done(sfp, srp) || atomic_read(>detaching))); 938 if (atomic_read(>detaching)) 939 return -ENODEV; 940 write_lock_irq(>rq_list_lock); 941 if (srp->done) { 942 srp->done = 2; 943 write_unlock_irq(>rq_list_lock); 944 result = sg_new_read(sfp, p, SZ_SG_IO_HDR, srp); 945 return (result < 0) ? result : 0; 946 } 947 srp->orphan = 1; 948 write_unlock_irq(>rq_list_lock); 949 return result; /* -ERESTARTSYS because signal hit process */ 950 case SG_SET_TIMEOUT: 951 result = get_user(val, ip); 952 if (result) 953 return result; 954 if (val < 0) 955 return -EIO; 956 if (val >= mult_frac((s64)INT_MAX, USER_HZ, HZ)) 957 val = min_t(s64, mult_frac((s64)INT_MAX, USER_HZ, HZ), 958 INT_MAX); 959 sfp->timeout_user = val; 960 sfp->timeout = mult_frac(val, HZ, USER_HZ); 961 962 return 0; 963 case SG_GET_TIMEOUT:/* N.B. User receives timeout as return value */ 964 /* strange ..., for backward compatibility */ 965 return sfp->timeout_user; 966 case SG_SET_FORCE_LOW_DMA: 967 /* 968 * N.B. This ioctl never worked properly, but failed to 969 * return an error value. So returning '0' to keep compability 970 * with legacy applications. 971 */ 972 return 0; 973 case SG_GET_LOW_DMA: 974 return put_user((int) sdp->device->host->unchecked_isa_dma, ip); 975 case SG_GET_SCSI_ID: 976 { 977 sg_scsi_id_t v; 978 979 if (atomic_read(>detaching)) 980 return -ENODEV; 981 memset(, 0, sizeof(v)); 982 v.host_no = sdp->device->host->host_no; 983 v.channel = sdp->device->channel; 984 v.scsi_id = sdp->device->id; 985 v.lun = sdp->device->lun; 986 v.scsi_type = sdp->device->type; 987 v.h_cmd_per_lun = sdp->device->host->cmd_per_lun; 988 v.d_queue_depth = sdp->device->queue_depth; 989
[PATCH v5 1/2] ASoC: qcom: dt-bindings: Add sc7180 machine bindings
Add devicetree bindings documentation file for sc7180 sound card. Signed-off-by: Cheng-Yi Chiang --- .../bindings/sound/qcom,sc7180.yaml | 127 ++ 1 file changed, 127 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/qcom,sc7180.yaml diff --git a/Documentation/devicetree/bindings/sound/qcom,sc7180.yaml b/Documentation/devicetree/bindings/sound/qcom,sc7180.yaml new file mode 100644 index ..b5cdaa0fe559 --- /dev/null +++ b/Documentation/devicetree/bindings/sound/qcom,sc7180.yaml @@ -0,0 +1,127 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/sound/qcom,sc7180.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Qualcomm Technologies Inc. SC7180 ASoC sound card driver + +maintainers: + - Rohit kumar + - Cheng-Yi Chiang + +description: + This binding describes the SC7180 sound card which uses LPASS for audio. + +properties: + compatible: +contains: + const: qcom,sc7180-sndcard + + audio-routing: +$ref: /schemas/types.yaml#/definitions/non-unique-string-array +description: + A list of the connections between audio components. Each entry is a + pair of strings, the first being the connection's sink, the second + being the connection's source. + + model: +$ref: /schemas/types.yaml#/definitions/string +description: User specified audio sound card name + + aux-dev: +$ref: /schemas/types.yaml#/definitions/phandle +description: phandle of the codec for headset detection + + "#address-cells": +const: 1 + + "#size-cells": +const: 0 + +patternProperties: + "^dai-link(@[0-9]+)?$": +description: + Each subnode represents a dai link. Subnodes of each dai links would be + cpu/codec dais. + +type: object + +properties: + link-name: +description: Indicates dai-link name and PCM stream name. +$ref: /schemas/types.yaml#/definitions/string +maxItems: 1 + + reg: +description: dai link address. +$ref: /schemas/types.yaml#/definitions/uint32 +maxItems: 1 + + cpu: +description: Holds subnode which indicates cpu dai. +type: object +properties: + sound-dai: true + + codec: +description: Holds subnode which indicates codec dai. +type: object +properties: + sound-dai: true + +required: + - link-name + - cpu + - codec + +additionalProperties: false + +required: + - compatible + - model + - "#address-cells" + - "#size-cells" + +additionalProperties: false + +examples: + + - | +sound { +compatible = "qcom,sc7180-sndcard"; +model = "sc7180-snd-card"; + +audio-routing = +"Headphone Jack", "HPOL", +"Headphone Jack", "HPOR"; + +aux-dev = <>; + +#address-cells = <1>; +#size-cells = <0>; + +dai-link@0 { +link-name = "MultiMedia0"; +reg = <0>; +cpu { +sound-dai = <_cpu 0>; +}; + +codec { +sound-dai = < 0>; +}; +}; + +dai-link@1 { +link-name = "MultiMedia1"; +reg = <1>; +cpu { +sound-dai = <_cpu 1>; +}; + +codec { +sound-dai = <>; +}; +}; +}; -- 2.28.0.220.ged08abb693-goog
[PATCH v5 2/2] ASoC: qcom: sc7180: Add machine driver for sound card registration
From: Ajit Pandey Add new driver to register sound card on sc7180 trogdor board and do the required configuration for lpass cpu dai and external codecs connected over MI2S interfaces. Signed-off-by: Ajit Pandey Signed-off-by: Cheng-Yi Chiang Reviewed-by: Tzung-Bi Shih --- sound/soc/qcom/Kconfig | 12 ++ sound/soc/qcom/Makefile | 2 + sound/soc/qcom/sc7180.c | 244 3 files changed, 258 insertions(+) create mode 100644 sound/soc/qcom/sc7180.c diff --git a/sound/soc/qcom/Kconfig b/sound/soc/qcom/Kconfig index 5d6b2466a2f2..54aa2ede229c 100644 --- a/sound/soc/qcom/Kconfig +++ b/sound/soc/qcom/Kconfig @@ -110,3 +110,15 @@ config SND_SOC_SDM845 To add support for audio on Qualcomm Technologies Inc. SDM845 SoC-based systems. Say Y if you want to use audio device on this SoCs. + +config SND_SOC_SC7180 + tristate "SoC Machine driver for SC7180 boards" + depends on SND_SOC_QCOM + select SND_SOC_QCOM_COMMON + select SND_SOC_LPASS_SC7180 + select SND_SOC_MAX98357A + select SND_SOC_RT5682 + help +To add support for audio on Qualcomm Technologies Inc. +SC7180 SoC-based systems. +Say Y if you want to use audio device on this SoCs. diff --git a/sound/soc/qcom/Makefile b/sound/soc/qcom/Makefile index 41b2c7a23a4d..3f6275d90526 100644 --- a/sound/soc/qcom/Makefile +++ b/sound/soc/qcom/Makefile @@ -15,12 +15,14 @@ snd-soc-storm-objs := storm.o snd-soc-apq8016-sbc-objs := apq8016_sbc.o snd-soc-apq8096-objs := apq8096.o snd-soc-sdm845-objs := sdm845.o +snd-soc-sc7180-objs := sc7180.o snd-soc-qcom-common-objs := common.o obj-$(CONFIG_SND_SOC_STORM) += snd-soc-storm.o obj-$(CONFIG_SND_SOC_APQ8016_SBC) += snd-soc-apq8016-sbc.o obj-$(CONFIG_SND_SOC_MSM8996) += snd-soc-apq8096.o obj-$(CONFIG_SND_SOC_SDM845) += snd-soc-sdm845.o +obj-$(CONFIG_SND_SOC_SC7180) += snd-soc-sc7180.o obj-$(CONFIG_SND_SOC_QCOM_COMMON) += snd-soc-qcom-common.o #DSP lib diff --git a/sound/soc/qcom/sc7180.c b/sound/soc/qcom/sc7180.c new file mode 100644 index ..7849376f63ba --- /dev/null +++ b/sound/soc/qcom/sc7180.c @@ -0,0 +1,244 @@ +// SPDX-License-Identifier: GPL-2.0-only +// +// Copyright (c) 2020, The Linux Foundation. All rights reserved. +// +// sc7180.c -- ALSA SoC Machine driver for SC7180 + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../codecs/rt5682.h" +#include "common.h" +#include "lpass.h" + +#define DEFAULT_SAMPLE_RATE_48K48000 +#define DEFAULT_MCLK_RATE 1920 +#define RT5682_PLL1_FREQ (48000 * 512) + +struct sc7180_snd_data { + struct snd_soc_jack jack; + u32 pri_mi2s_clk_count; +}; + +static void sc7180_jack_free(struct snd_jack *jack) +{ + struct snd_soc_component *component = jack->private_data; + + snd_soc_component_set_jack(component, NULL, NULL); +} + +static int sc7180_headset_init(struct snd_soc_component *component) +{ + struct snd_soc_card *card = component->card; + struct sc7180_snd_data *pdata = snd_soc_card_get_drvdata(card); + struct snd_jack *jack; + int rval; + + rval = snd_soc_card_jack_new( + card, "Headset Jack", + SND_JACK_HEADSET | + SND_JACK_HEADPHONE | + SND_JACK_BTN_0 | SND_JACK_BTN_1 | + SND_JACK_BTN_2 | SND_JACK_BTN_3, + >jack, NULL, 0); + + if (rval < 0) { + dev_err(card->dev, "Unable to add Headset Jack\n"); + return rval; + } + + jack = pdata->jack.jack; + + snd_jack_set_key(jack, SND_JACK_BTN_0, KEY_PLAYPAUSE); + snd_jack_set_key(jack, SND_JACK_BTN_1, KEY_VOICECOMMAND); + snd_jack_set_key(jack, SND_JACK_BTN_2, KEY_VOLUMEUP); + snd_jack_set_key(jack, SND_JACK_BTN_3, KEY_VOLUMEDOWN); + + jack->private_data = component; + jack->private_free = sc7180_jack_free; + + rval = snd_soc_component_set_jack(component, + >jack, NULL); + if (rval != 0 && rval != -EOPNOTSUPP) { + dev_warn(card->dev, "Failed to set jack: %d\n", rval); + return rval; + } + + return 0; +} + +static struct snd_soc_aux_dev sc7180_headset_dev = { + .dlc = COMP_EMPTY(), + .init = sc7180_headset_init, +}; + +static int sc7180_snd_startup(struct snd_pcm_substream *substream) +{ + struct snd_soc_pcm_runtime *rtd = substream->private_data; + struct snd_soc_card *card = rtd->card; + struct sc7180_snd_data *data = snd_soc_card_get_drvdata(card); + struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtd, 0); + struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0); + int ret; + + switch (cpu_dai->id) { + case MI2S_PRIMARY: + if (++data->pri_mi2s_clk_count
[PATCH v5 0/2] Add documentation and machine driver for SC7180 sound card
Note: - The machine driver patch depends on LPASS patch series so it is not ready to be merged now. ASoC: qcom: Add support for SC7180 lpass variant https://patchwork.kernel.org/cover/11714317/ - The machine driver patch is made by the collaboration of Cheng-Yi Chiang Rohit kumar Ajit Pandey But Ajit has left codeaurora. Changes from v1 to v2: - Ducumentation: Addressed all suggestions from Doug. - Machine driver: - Fix comment style for license. - Sort includes. - Remove sc7180_snd_hw_params. - Remove sc7180_dai_init and use aux device instead for headset jack registration. - Statically define format for Primary MI2S. - Atomic is not a concern because there is mutex in card to make sure startup and shutdown happen sequentially. - Fix missing return -EINVAL in startup. - Use static sound card. - Use devm_kzalloc to avoid kfree. Changes from v2 to v3: - Ducumentation: Addressed suggestions from Srini. - Machine driver: - Reuse qcom_snd_parse_of to parse properties. - Remove playback-only and capture-only. - Misc fixes to address comments. Changes from v3 to v4: - Ducumentation: Addressed suggestions from Rob. - Remove definition of dai. - Use 'sound-dai: true' for sound-dai schema. - Add reg property to pass 'make dt_binding_check' check although reg is not used in the driver. - Machine driver: - Add Reviewed-by: Tzung-Bi Shih Changes from v4 to v5: - Documentation: Addressed suggestions from Rob. - Add definition for "#address-cells" and "#size-cells". - Add additionalProperties: false - Add required properties. Ajit Pandey (1): ASoC: qcom: sc7180: Add machine driver for sound card registration Cheng-Yi Chiang (1): ASoC: qcom: dt-bindings: Add sc7180 machine bindings .../bindings/sound/qcom,sc7180.yaml | 127 + sound/soc/qcom/Kconfig| 12 + sound/soc/qcom/Makefile | 2 + sound/soc/qcom/sc7180.c | 244 ++ 4 files changed, 385 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/qcom,sc7180.yaml create mode 100644 sound/soc/qcom/sc7180.c -- 2.28.0.220.ged08abb693-goog
Re: [PATCH] ACPI/IORT: Drop the unused @ops of iort_add_device_replay()
On 2020/8/17 18:59, Zenghui Yu wrote: Since commit d2e1a003af56 ("ACPI/IORT: Don't call iommu_ops->add_device directly"), we use the IOMMU core API to replace a direct invoke of the specified callback. The parameter @ops has therefore became unused. Let's drop it. Signed-off-by: Zenghui Yu --- drivers/acpi/arm64/iort.c | 8 +++- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/acpi/arm64/iort.c b/drivers/acpi/arm64/iort.c index ec782e4a0fe4..a0ece0e201b2 100644 --- a/drivers/acpi/arm64/iort.c +++ b/drivers/acpi/arm64/iort.c @@ -811,8 +811,7 @@ static inline const struct iommu_ops *iort_fwspec_iommu_ops(struct device *dev) return (fwspec && fwspec->ops) ? fwspec->ops : NULL; } -static inline int iort_add_device_replay(const struct iommu_ops *ops, -struct device *dev) +static inline int iort_add_device_replay(struct device *dev) { int err = 0; @@ -1072,7 +1071,7 @@ const struct iommu_ops *iort_iommu_configure_id(struct device *dev, */ if (!err) { ops = iort_fwspec_iommu_ops(dev); - err = iort_add_device_replay(ops, dev); + err = iort_add_device_replay(dev); } /* Ignore all other errors apart from EPROBE_DEFER */ @@ -1089,8 +1088,7 @@ const struct iommu_ops *iort_iommu_configure_id(struct device *dev, #else static inline const struct iommu_ops *iort_fwspec_iommu_ops(struct device *dev) { return NULL; } -static inline int iort_add_device_replay(const struct iommu_ops *ops, -struct device *dev) +static inline int iort_add_device_replay(struct device *dev) inline functions iort_fwspec_iommu_ops() and iort_add_device_replay() are not needed anymore after commit 8212688600ed ("ACPI/IORT: Fix build error when IOMMU_SUPPORT is disabled"), could you please add another patch to remove them as well? Thanks Hanjun
Re: [PATCH] perf: arm-spe: Fix check error when synthesizing events
Ping... On 2020/7/24 16:32, Leo Yan wrote: > Hi Wei, > > On Fri, Jul 24, 2020 at 03:26:28PM +0800, Wei Li wrote: >> In arm_spe_read_record(), when we are processing an events packet, >> 'decoder->packet.index' is the length of payload, which has been >> transformed in payloadlen(). So correct the check of 'idx'. >> >> Signed-off-by: Wei Li > > Good catch. I checked the ARMv8 ARM and the function payloadlen(), > can confirm the fixing is correct. > > Reviewed-by: Leo Yan > >> --- >> tools/perf/util/arm-spe-decoder/arm-spe-decoder.c | 6 +++--- >> 1 file changed, 3 insertions(+), 3 deletions(-) >> >> diff --git a/tools/perf/util/arm-spe-decoder/arm-spe-decoder.c >> b/tools/perf/util/arm-spe-decoder/arm-spe-decoder.c >> index 302a14d0aca9..93e063f22be5 100644 >> --- a/tools/perf/util/arm-spe-decoder/arm-spe-decoder.c >> +++ b/tools/perf/util/arm-spe-decoder/arm-spe-decoder.c >> @@ -182,15 +182,15 @@ static int arm_spe_read_record(struct arm_spe_decoder >> *decoder) >> if (payload & BIT(EV_TLB_ACCESS)) >> decoder->record.type |= ARM_SPE_TLB_ACCESS; >> >> -if ((idx == 1 || idx == 2 || idx == 3) && >> +if ((idx == 2 || idx == 4 || idx == 8) && >> (payload & BIT(EV_LLC_MISS))) >> decoder->record.type |= ARM_SPE_LLC_MISS; >> >> -if ((idx == 1 || idx == 2 || idx == 3) && >> +if ((idx == 2 || idx == 4 || idx == 8) && >> (payload & BIT(EV_LLC_ACCESS))) >> decoder->record.type |= ARM_SPE_LLC_ACCESS; >> >> -if ((idx == 1 || idx == 2 || idx == 3) && >> +if ((idx == 2 || idx == 4 || idx == 8) && >> (payload & BIT(EV_REMOTE_ACCESS))) >> decoder->record.type |= ARM_SPE_REMOTE_ACCESS; >> >> -- >> 2.17.1 >>
[PATCH v3] mfd: sprd: Add wakeup capability for PMIC irq
From: Baolin Wang When changing to use suspend-to-idle to save power, the PMIC irq can not wakeup the system due to lack of wakeup capability, which will cause the sub-irqs (such as power key) of the PMIC can not wake up the system. Thus we can add the wakeup capability for PMIC irq to solve this issue, as well as removing the IRQF_NO_SUSPEND flag to allow PMIC irq to be a wakeup source. Reported-by: Chunyan Zhang Signed-off-by: Baolin Wang Tested-by: Chunyan Zhang --- Changes from v2: * rebased on v5.9-rc1; Changes from v1: * addressed comments from Lee; * added tested-by from Chunyan. --- drivers/mfd/sprd-sc27xx-spi.c | 28 +++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/drivers/mfd/sprd-sc27xx-spi.c b/drivers/mfd/sprd-sc27xx-spi.c index f8a8b918c60d..6b7956604a0f 100644 --- a/drivers/mfd/sprd-sc27xx-spi.c +++ b/drivers/mfd/sprd-sc27xx-spi.c @@ -189,7 +189,7 @@ static int sprd_pmic_probe(struct spi_device *spi) ddata->irqs[i].mask = BIT(i); ret = devm_regmap_add_irq_chip(>dev, ddata->regmap, ddata->irq, - IRQF_ONESHOT | IRQF_NO_SUSPEND, 0, + IRQF_ONESHOT, 0, >irq_chip, >irq_data); if (ret) { dev_err(>dev, "Failed to add PMIC irq chip %d\n", ret); @@ -202,9 +202,34 @@ static int sprd_pmic_probe(struct spi_device *spi) return ret; } + device_init_wakeup(>dev, true); return 0; } +#ifdef CONFIG_PM_SLEEP +static int sprd_pmic_suspend(struct device *dev) +{ + struct sprd_pmic *ddata = dev_get_drvdata(dev); + + if (device_may_wakeup(dev)) + enable_irq_wake(ddata->irq); + + return 0; +} + +static int sprd_pmic_resume(struct device *dev) +{ + struct sprd_pmic *ddata = dev_get_drvdata(dev); + + if (device_may_wakeup(dev)) + disable_irq_wake(ddata->irq); + + return 0; +} +#endif + +static SIMPLE_DEV_PM_OPS(sprd_pmic_pm_ops, sprd_pmic_suspend, sprd_pmic_resume); + static const struct of_device_id sprd_pmic_match[] = { { .compatible = "sprd,sc2731", .data = _data }, {}, @@ -215,6 +240,7 @@ static struct spi_driver sprd_pmic_driver = { .driver = { .name = "sc27xx-pmic", .of_match_table = sprd_pmic_match, + .pm = _pmic_pm_ops, }, .probe = sprd_pmic_probe, }; -- 2.20.1
[PATCH V3 3/5] dt-bindings: serial: Convert i.MX uart to json-schema
Convert the i.MX uart binding to DT schema format using json-schema. Signed-off-by: Anson Huang --- no change. --- .../devicetree/bindings/serial/fsl-imx-uart.txt| 40 -- .../devicetree/bindings/serial/fsl-imx-uart.yaml | 92 ++ 2 files changed, 92 insertions(+), 40 deletions(-) delete mode 100644 Documentation/devicetree/bindings/serial/fsl-imx-uart.txt create mode 100644 Documentation/devicetree/bindings/serial/fsl-imx-uart.yaml diff --git a/Documentation/devicetree/bindings/serial/fsl-imx-uart.txt b/Documentation/devicetree/bindings/serial/fsl-imx-uart.txt deleted file mode 100644 index 9582fc2..000 --- a/Documentation/devicetree/bindings/serial/fsl-imx-uart.txt +++ /dev/null @@ -1,40 +0,0 @@ -* Freescale i.MX Universal Asynchronous Receiver/Transmitter (UART) - -Required properties: -- compatible : Should be "fsl,-uart" -- reg : Address and length of the register set for the device -- interrupts : Should contain uart interrupt - -Optional properties: -- fsl,dte-mode : Indicate the uart works in DTE mode. The uart works - in DCE mode by default. -- fsl,inverted-tx , fsl,inverted-rx : Indicate that the hardware attached - to the peripheral inverts the signal transmitted or received, - respectively, and that the peripheral should invert its output/input - using the INVT/INVR registers. -- rs485-rts-delay, rs485-rts-active-low, rs485-rx-during-tx, - linux,rs485-enabled-at-boot-time: see rs485.txt. Note that for RS485 - you must enable either the "uart-has-rtscts" or the "rts-gpios" - properties. In case you use "uart-has-rtscts" the signal that controls - the transceiver is actually CTS_B, not RTS_B. CTS_B is always output, - and RTS_B is input, regardless of dte-mode. - -Please check Documentation/devicetree/bindings/serial/serial.yaml -for the complete list of generic properties. - -Note: Each uart controller should have an alias correctly numbered -in "aliases" node. - -Example: - -aliases { - serial0 = -}; - -uart1: serial@73fbc000 { - compatible = "fsl,imx51-uart", "fsl,imx21-uart"; - reg = <0x73fbc000 0x4000>; - interrupts = <31>; - uart-has-rtscts; - fsl,dte-mode; -}; diff --git a/Documentation/devicetree/bindings/serial/fsl-imx-uart.yaml b/Documentation/devicetree/bindings/serial/fsl-imx-uart.yaml new file mode 100644 index 000..cba3f83 --- /dev/null +++ b/Documentation/devicetree/bindings/serial/fsl-imx-uart.yaml @@ -0,0 +1,92 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/serial/fsl-imx-uart.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Freescale i.MX Universal Asynchronous Receiver/Transmitter (UART) + +maintainers: + - Fabio Estevam + +allOf: + - $ref: "serial.yaml" + - $ref: "rs485.yaml" + +properties: + compatible: +oneOf: + - const: fsl,imx1-uart + - const: fsl,imx21-uart + - const: fsl,imx53-uart + - const: fsl,imx6q-uart + - items: + - enum: +- fsl,imx25-uart +- fsl,imx27-uart +- fsl,imx31-uart +- fsl,imx35-uart +- fsl,imx50-uart +- fsl,imx51-uart + - const: fsl,imx21-uart + - items: + - enum: +- fsl,imx6sl-uart +- fsl,imx6sll-uart +- fsl,imx6sx-uart +- fsl,imx6ul-uart +- fsl,imx7d-uart + - const: fsl,imx6q-uart + + reg: +maxItems: 1 + + interrupts: +maxItems: 1 + + fsl,dte-mode: +$ref: /schemas/types.yaml#/definitions/flag +description: | + Indicate the uart works in DTE mode. The uart works in DCE mode by default. + + fsl,inverted-tx: +$ref: /schemas/types.yaml#/definitions/flag +description: | + Indicate that the hardware attached to the peripheral inverts the signal + transmitted, and that the peripheral should invert its output using the + INVT registers. + + fsl,inverted-rx: +$ref: /schemas/types.yaml#/definitions/flag +description: | + Indicate that the hardware attached to the peripheral inverts the signal + received, and that the peripheral should invert its input using the + INVR registers. + + uart-has-rtscts: true + + rs485-rts-delay: true + rs485-rts-active-low: true + rs485-rx-during-tx: true + linux,rs485-enabled-at-boot-time: true + +required: + - compatible + - reg + - interrupts + +unevaluatedProperties: false + +examples: + - | +aliases { +serial0 = +}; + +uart1: serial@73fbc000 { +compatible = "fsl,imx51-uart", "fsl,imx21-uart"; +reg = <0x73fbc000 0x4000>; +interrupts = <31>; +uart-has-rtscts; +fsl,dte-mode; +}; -- 2.7.4
[PATCH V3 4/5] dt-bindings: serial: Convert MXS auart to json-schema
Convert the MXS auart binding to DT schema format using json-schema. Signed-off-by: Anson Huang --- changes since V2: - update maintainer. --- .../devicetree/bindings/serial/fsl-mxs-auart.txt | 53 - .../devicetree/bindings/serial/fsl-mxs-auart.yaml | 91 ++ 2 files changed, 91 insertions(+), 53 deletions(-) delete mode 100644 Documentation/devicetree/bindings/serial/fsl-mxs-auart.txt create mode 100644 Documentation/devicetree/bindings/serial/fsl-mxs-auart.yaml diff --git a/Documentation/devicetree/bindings/serial/fsl-mxs-auart.txt b/Documentation/devicetree/bindings/serial/fsl-mxs-auart.txt deleted file mode 100644 index 5c96d41..000 --- a/Documentation/devicetree/bindings/serial/fsl-mxs-auart.txt +++ /dev/null @@ -1,53 +0,0 @@ -* Freescale MXS Application UART (AUART) - -Required properties for all SoCs: -- compatible : Should be one of fallowing variants: - "fsl,imx23-auart" - Freescale i.MX23 - "fsl,imx28-auart" - Freescale i.MX28 - "alphascale,asm9260-auart" - Alphascale ASM9260 -- reg : Address and length of the register set for the device -- interrupts : Should contain the auart interrupt numbers -- dmas: DMA specifier, consisting of a phandle to DMA controller node - and AUART DMA channel ID. - Refer to dma.txt and fsl-mxs-dma.txt for details. -- dma-names: "rx" for RX channel, "tx" for TX channel. - -Required properties for "alphascale,asm9260-auart": -- clocks : the clocks feeding the watchdog timer. See clock-bindings.txt -- clock-names : should be set to - "mod" - source for tick counter. - "ahb" - ahb gate. - -Optional properties: -- uart-has-rtscts : Indicate the UART has RTS and CTS lines - for hardware flow control, - it also means you enable the DMA support for this UART. -- {rts,cts,dtr,dsr,rng,dcd}-gpios: specify a GPIO for RTS/CTS/DTR/DSR/RI/DCD - line respectively. It will use specified PIO instead of the peripheral - function pin for the USART feature. - If unsure, don't specify this property. - -Example: -auart0: serial@8006a000 { - compatible = "fsl,imx28-auart", "fsl,imx23-auart"; - reg = <0x8006a000 0x2000>; - interrupts = <112>; - dmas = <_apbx 8>, <_apbx 9>; - dma-names = "rx", "tx"; - cts-gpios = < 15 GPIO_ACTIVE_LOW>; - dsr-gpios = < 16 GPIO_ACTIVE_LOW>; - dcd-gpios = < 17 GPIO_ACTIVE_LOW>; -}; - -Note: Each auart port should have an alias correctly numbered in "aliases" -node. - -Example: - -aliases { - serial0 = - serial1 = - serial2 = - serial3 = - serial4 = -}; diff --git a/Documentation/devicetree/bindings/serial/fsl-mxs-auart.yaml b/Documentation/devicetree/bindings/serial/fsl-mxs-auart.yaml new file mode 100644 index 000..ce1d894 --- /dev/null +++ b/Documentation/devicetree/bindings/serial/fsl-mxs-auart.yaml @@ -0,0 +1,91 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/serial/fsl-mxs-auart.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Freescale MXS Application UART (AUART) + +maintainers: + - Fabio Estevam + +allOf: + - $ref: "serial.yaml" + +properties: + compatible: +enum: + - fsl,imx23-auart + - fsl,imx28-auart + - alphascale,asm9260-auart + + reg: +maxItems: 1 + + interrupts: +maxItems: 1 + + dmas: +items: + - description: DMA controller phandle and request line for RX + - description: DMA controller phandle and request line for TX + + dma-names: +items: + - const: rx + - const: tx + + clocks: +items: + - description: mod clock + - description: ahb clock +minItems: 1 + + clock-names: +items: + - const: mod + - const: ahb +minItems: 1 + + uart-has-rtscts: true + rts-gpios: true + cts-gpios: true + dtr-gpios: true + dsr-gpios: true + rng-gpios: true + dcd-gpios: true + +if: + properties: +compatible: + contains: +enum: + - alphascale,asm9260-auart +then: + required: +- clocks +- clock-names + +required: + - compatible + - reg + - interrupts + - dmas + - dma-names + +unevaluatedProperties: false + +examples: + - | +aliases { +serial0 = +}; + +auart0: serial@8006a000 { +compatible = "fsl,imx28-auart"; +reg = <0x8006a000 0x2000>; +interrupts = <112>; +dmas = <_apbx 8>, <_apbx 9>; +dma-names = "rx", "tx"; +clocks = < 45>; +}; -- 2.7.4
[PATCH V3 1/5] dt-bindings: clock: Update i.MX28 example
Update the i.MX28 clock example to align with MXS AUART binding doc to avoid below build error: Documentation/devicetree/bindings/clock/imx28-clock.example.dt.yaml: serial@8006a000: clocks: [[4294967295, 45]] is too short Documentation/devicetree/bindings/clock/imx28-clock.example.dt.yaml: serial@8006a000: compatible: Additional items are not allowed ('fsl,imx23-auart' was unexpected) Documentation/devicetree/bindings/clock/imx28-clock.example.dt.yaml: serial@8006a000: compatible: ['fsl,imx28-auart', 'fsl,imx23-auart'] is too long Documentation/devicetree/bindings/clock/imx28-clock.example.dt.yaml: serial@8006a000: 'dmas' is a required property Documentation/devicetree/bindings/clock/imx28-clock.example.dt.yaml: serial@8006a000: 'dma-names' is a required property Signed-off-by: Anson Huang --- no change. --- Documentation/devicetree/bindings/clock/imx28-clock.yaml | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Documentation/devicetree/bindings/clock/imx28-clock.yaml b/Documentation/devicetree/bindings/clock/imx28-clock.yaml index 72328d5..671b279 100644 --- a/Documentation/devicetree/bindings/clock/imx28-clock.yaml +++ b/Documentation/devicetree/bindings/clock/imx28-clock.yaml @@ -108,8 +108,10 @@ examples: }; serial@8006a000 { -compatible = "fsl,imx28-auart", "fsl,imx23-auart"; +compatible = "fsl,imx28-auart"; reg = <0x8006a000 0x2000>; -interrupts = <112 70 71>; +interrupts = <112>; +dmas = <_apbx 8>, <_apbx 9>; +dma-names = "rx", "tx"; clocks = < 45>; }; -- 2.7.4
[PATCH V3 2/5] dt-bindings: clock: Update i.MX23 example
Update the i.MX23 clock example to align with MXS AUART binding doc to avoid below build error: Documentation/devicetree/bindings/clock/imx23-clock.example.dt.yaml: serial@8006c000: clocks: [[4294967295, 32]] is too short Documentation/devicetree/bindings/clock/imx23-clock.example.dt.yaml: serial@8006c000: 'dmas' is a required property Documentation/devicetree/bindings/clock/imx23-clock.example.dt.yaml: serial@8006c000: 'dma-names' is a required property Signed-off-by: Anson Huang --- no change. --- Documentation/devicetree/bindings/clock/imx23-clock.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/clock/imx23-clock.yaml b/Documentation/devicetree/bindings/clock/imx23-clock.yaml index 66cb238..4028c1f 100644 --- a/Documentation/devicetree/bindings/clock/imx23-clock.yaml +++ b/Documentation/devicetree/bindings/clock/imx23-clock.yaml @@ -87,6 +87,8 @@ examples: serial@8006c000 { compatible = "fsl,imx23-auart"; reg = <0x8006c000 0x2000>; -interrupts = <24 25 23>; +interrupts = <24>; clocks = < 32>; +dmas = <_apbx 6>, <_apbx 7>; +dma-names = "rx", "tx"; }; -- 2.7.4
[PATCH V3 5/5] dt-bindings: serial: Convert NXP lpuart to json-schema
Convert the NXP lpuart binding to DT schema format using json-schema. Signed-off-by: Anson Huang --- changes since V2: - update maintainer, the original owner's email address is no longer valid, use one of the patch contributors as well as NXP's UART owner as maintainer. --- .../devicetree/bindings/serial/fsl-lpuart.txt | 43 .../devicetree/bindings/serial/fsl-lpuart.yaml | 79 ++ 2 files changed, 79 insertions(+), 43 deletions(-) delete mode 100644 Documentation/devicetree/bindings/serial/fsl-lpuart.txt create mode 100644 Documentation/devicetree/bindings/serial/fsl-lpuart.yaml diff --git a/Documentation/devicetree/bindings/serial/fsl-lpuart.txt b/Documentation/devicetree/bindings/serial/fsl-lpuart.txt deleted file mode 100644 index e7448b9..000 --- a/Documentation/devicetree/bindings/serial/fsl-lpuart.txt +++ /dev/null @@ -1,43 +0,0 @@ -* Freescale low power universal asynchronous receiver/transmitter (lpuart) - -Required properties: -- compatible : - - "fsl,vf610-lpuart" for lpuart compatible with the one integrated -on Vybrid vf610 SoC with 8-bit register organization - - "fsl,ls1021a-lpuart" for lpuart compatible with the one integrated -on LS1021A SoC with 32-bit big-endian register organization - - "fsl,ls1028a-lpuart" for lpuart compatible with the one integrated -on LS1028A SoC with 32-bit little-endian register organization - - "fsl,imx7ulp-lpuart" for lpuart compatible with the one integrated -on i.MX7ULP SoC with 32-bit little-endian register organization - - "fsl,imx8qxp-lpuart" for lpuart compatible with the one integrated -on i.MX8QXP SoC with 32-bit little-endian register organization - - "fsl,imx8qm-lpuart" for lpuart compatible with the one integrated -on i.MX8QM SoC with 32-bit little-endian register organization -- reg : Address and length of the register set for the device -- interrupts : Should contain uart interrupt -- clocks : phandle + clock specifier pairs, one for each entry in clock-names -- clock-names : For vf610/ls1021a/ls1028a/imx7ulp, "ipg" clock is for uart - bus/baud clock. For imx8qxp lpuart, "ipg" clock is bus clock that is used - to access lpuart controller registers, it also requires "baud" clock for - module to receive/transmit data. - -Optional properties: -- dmas: A list of two dma specifiers, one for each entry in dma-names. -- dma-names: should contain "tx" and "rx". -- rs485-rts-active-low, linux,rs485-enabled-at-boot-time: see rs485.txt - -Note: Optional properties for DMA support. Write them both or both not. - -Example: - -uart0: serial@40027000 { - compatible = "fsl,vf610-lpuart"; - reg = <0x40027000 0x1000>; - interrupts = <0 61 0x00>; - clocks = < VF610_CLK_UART0>; - clock-names = "ipg"; - dmas = < 0 2>, - < 0 3>; - dma-names = "rx","tx"; - }; diff --git a/Documentation/devicetree/bindings/serial/fsl-lpuart.yaml b/Documentation/devicetree/bindings/serial/fsl-lpuart.yaml new file mode 100644 index 000..e82c2cf --- /dev/null +++ b/Documentation/devicetree/bindings/serial/fsl-lpuart.yaml @@ -0,0 +1,79 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/serial/fsl-lpuart.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Freescale low power universal asynchronous receiver/transmitter (lpuart) + +maintainers: + - Fugang Duan + +allOf: + - $ref: "rs485.yaml" + +properties: + compatible: +enum: + - fsl,vf610-lpuart + - fsl,ls1021a-lpuart + - fsl,ls1028a-lpuart + - fsl,imx7ulp-lpuart + - fsl,imx8qxp-lpuart + - fsl,imx8qm-lpuart + + reg: +maxItems: 1 + + interrupts: +maxItems: 1 + + clocks: +items: + - description: ipg clock + - description: baud clock +minItems: 1 +maxItems: 2 + + clock-names: +items: + - const: ipg + - const: baud +minItems: 1 +maxItems: 2 + + dmas: +items: + - description: DMA controller phandle and request line for RX + - description: DMA controller phandle and request line for TX + + dma-names: +items: + - const: rx + - const: tx + + rs485-rts-active-low: true + linux,rs485-enabled-at-boot-time: true + +required: + - compatible + - reg + - interrupts + - clocks + - clock-names + +unevaluatedProperties: false + +examples: + - | +#include + +serial@40027000 { +compatible = "fsl,vf610-lpuart"; +reg = <0x40027000 0x1000>; +interrupts = <0 61 0x00>; +clocks = < VF610_CLK_UART0>; +clock-names = "ipg"; +dmas = < 0 2>, < 0 3>; +dma-names = "rx","tx"; +}; -- 2.7.4
[PATCH v3] arm64: dts: qcom: sc7180: Add DisplayPort HPD pin dt node
This node defines alternate DP HPD functionality of GPIO. Signed-off-by: Tanmay Shah --- arch/arm64/boot/dts/qcom/sc7180.dtsi | 13 + 1 file changed, 13 insertions(+) diff --git a/arch/arm64/boot/dts/qcom/sc7180.dtsi b/arch/arm64/boot/dts/qcom/sc7180.dtsi index bf2f2bb1aa79..2e2a0631ab65 100644 --- a/arch/arm64/boot/dts/qcom/sc7180.dtsi +++ b/arch/arm64/boot/dts/qcom/sc7180.dtsi @@ -1082,6 +1082,19 @@ tlmm: pinctrl@350 { gpio-ranges = < 0 0 120>; wakeup-parent = <>; + dp_hot_plug_det: dp-hot-plug-det { + pinmux { + pins = "gpio117"; + function = "dp_hot"; + }; + + pinconf { + pins = "gpio117"; + bias-disable; + input-enable; + }; + }; + qspi_clk: qspi-clk { pinmux { pins = "gpio63"; base-commit: 62975d27d647a40c58d3b96c29b911fc4f33c310 -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
[RFC PATCH 1/2] sparc64: remove mm_cpumask clearing to fix kthread_use_mm race
The de facto (and apparently uncommented) standard for using an mm had, thanks to this code in sparc if nothing else, been that you must have a reference on mm_users *and that reference must have been obtained with mmget()*, i.e., from a thread with a reference to mm_users that had used the mm. The introduction of mmget_not_zero() in commit d2005e3f41d4 ("userfaultfd: don't pin the user memory in userfaultfd_file_create()") allowed mm_count holders to aoperate on user mappings asynchronously from the actual threads using the mm, but they were not to load those mappings into their TLB (i.e., walking vmas and page tables is okay, kthread_use_mm() is not). io_uring 2b188cc1bb857 ("Add io_uring IO interface") added code which does a kthread_use_mm() from a mmget_not_zero() refcount. The problem with this is code which previously assumed mm == current->mm and mm->mm_users == 1 implies the mm will remain single-threaded at least until this thread creates another mm_users reference, has now broken. arch/sparc/kernel/smp_64.c: if (atomic_read(>mm_users) == 1) { cpumask_copy(mm_cpumask(mm), cpumask_of(cpu)); goto local_flush_and_out; } vs fs/io_uring.c if (unlikely(!(ctx->flags & IORING_SETUP_SQPOLL) || !mmget_not_zero(ctx->sqo_mm))) return -EFAULT; kthread_use_mm(ctx->sqo_mm); mmget_not_zero() could come in right after the mm_users == 1 test, then kthread_use_mm() which sets its CPU in the mm_cpumask. That update could be lost if cpumask_copy() occurs afterward. I propose we fix this by allowing mmget_not_zero() to be a first-class reference, and not have this obscure undocumented and unchecked restriction. The basic fix for sparc64 is to remove its mm_cpumask clearing code. The optimisation could be effectively restored by sending IPIs to mm_cpumask members and having them remove themselves from mm_cpumask. This is more tricky so I leave it as an exercise for someone with a sparc64 SMP. powerpc has a (currently similarly broken) example. not-yet-Signed-off-by: Nicholas Piggin --- arch/sparc/kernel/smp_64.c | 58 ++ 1 file changed, 9 insertions(+), 49 deletions(-) diff --git a/arch/sparc/kernel/smp_64.c b/arch/sparc/kernel/smp_64.c index e286e2badc8a..41423c6077d0 100644 --- a/arch/sparc/kernel/smp_64.c +++ b/arch/sparc/kernel/smp_64.c @@ -1039,38 +1039,9 @@ void smp_fetch_global_pmu(void) * are flush_tlb_*() routines, and these run after flush_cache_*() * which performs the flushw. * - * The SMP TLB coherency scheme we use works as follows: - * - * 1) mm->cpu_vm_mask is a bit mask of which cpus an address - *space has (potentially) executed on, this is the heuristic - *we use to avoid doing cross calls. - * - *Also, for flushing from kswapd and also for clones, we - *use cpu_vm_mask as the list of cpus to make run the TLB. - * - * 2) TLB context numbers are shared globally across all processors - *in the system, this allows us to play several games to avoid - *cross calls. - * - *One invariant is that when a cpu switches to a process, and - *that processes tsk->active_mm->cpu_vm_mask does not have the - *current cpu's bit set, that tlb context is flushed locally. - * - *If the address space is non-shared (ie. mm->count == 1) we avoid - *cross calls when we want to flush the currently running process's - *tlb state. This is done by clearing all cpu bits except the current - *processor's in current->mm->cpu_vm_mask and performing the - *flush locally only. This will force any subsequent cpus which run - *this task to flush the context from the local tlb if the process - *migrates to another cpu (again). - * - * 3) For shared address spaces (threads) and swapping we bite the - *bullet for most cases and perform the cross call (but only to - *the cpus listed in cpu_vm_mask). - * - *The performance gain from "optimizing" away the cross call for threads is - *questionable (in theory the big win for threads is the massive sharing of - *address space state across processors). + * mm->cpu_vm_mask is a bit mask of which cpus an address + * space has (potentially) executed on, this is the heuristic + * we use to limit cross calls. */ /* This currently is only used by the hugetlb arch pre-fault @@ -1082,16 +1053,10 @@ void smp_flush_tlb_mm(struct mm_struct *mm) u32 ctx = CTX_HWBITS(mm->context); int cpu = get_cpu(); - if (atomic_read(>mm_users) == 1) { - cpumask_copy(mm_cpumask(mm), cpumask_of(cpu)); - goto local_flush_and_out; - } - smp_cross_call_masked(_flush_tlb_mm, ctx, 0, 0, mm_cpumask(mm)); -local_flush_and_out: __flush_tlb_mm(ctx, SECONDARY_CONTEXT); put_cpu(); @@ -1120,11 +1085,8 @@ void smp_flush_tlb_pending(struct mm_struct *mm, unsigned long nr, unsigned long
[RFC PATCH 2/2] powerpc/64s/radix: Fix mm_cpumask trimming race vs kthread_use_mm
Commit 0cef77c7798a7 ("powerpc/64s/radix: flush remote CPUs out of single-threaded mm_cpumask") added a mechanism to trim the mm_cpumask of a process under certain conditions. One of the assumptions is that mm_users would not be incremented via a reference outside the process context with mmget_not_zero() then go on to kthread_use_mm() via that reference. That invariant was broken by io_uring code (see previous sparc64 fix), but I'll point Fixes: to the original powerpc commit because we are changing that assumption going forward, so this will make backports match up. Fix this by no longer relying on that assumption, but by having each CPU check the mm is not being used, and clearing their own bit from the mask if it's okay. This relies on commit 38cf307c1f20 ("mm: fix kthread_use_mm() vs TLB invalidate") to disable irqs over the mm switch. Fixes: 0cef77c7798a7 ("powerpc/64s/radix: flush remote CPUs out of single-threaded mm_cpumask") not-yet-Signed-off-by: Nicholas Piggin --- arch/powerpc/include/asm/tlb.h | 13 - arch/powerpc/mm/book3s64/radix_tlb.c | 23 --- 2 files changed, 16 insertions(+), 20 deletions(-) diff --git a/arch/powerpc/include/asm/tlb.h b/arch/powerpc/include/asm/tlb.h index fbc6f3002f23..d97f061fecac 100644 --- a/arch/powerpc/include/asm/tlb.h +++ b/arch/powerpc/include/asm/tlb.h @@ -66,19 +66,6 @@ static inline int mm_is_thread_local(struct mm_struct *mm) return false; return cpumask_test_cpu(smp_processor_id(), mm_cpumask(mm)); } -static inline void mm_reset_thread_local(struct mm_struct *mm) -{ - WARN_ON(atomic_read(>context.copros) > 0); - /* -* It's possible for mm_access to take a reference on mm_users to -* access the remote mm from another thread, but it's not allowed -* to set mm_cpumask, so mm_users may be > 1 here. -*/ - WARN_ON(current->mm != mm); - atomic_set(>context.active_cpus, 1); - cpumask_clear(mm_cpumask(mm)); - cpumask_set_cpu(smp_processor_id(), mm_cpumask(mm)); -} #else /* CONFIG_PPC_BOOK3S_64 */ static inline int mm_is_thread_local(struct mm_struct *mm) { diff --git a/arch/powerpc/mm/book3s64/radix_tlb.c b/arch/powerpc/mm/book3s64/radix_tlb.c index 0d233763441f..a421a0e3f930 100644 --- a/arch/powerpc/mm/book3s64/radix_tlb.c +++ b/arch/powerpc/mm/book3s64/radix_tlb.c @@ -645,19 +645,29 @@ static void do_exit_flush_lazy_tlb(void *arg) struct mm_struct *mm = arg; unsigned long pid = mm->context.id; + /* +* A kthread could have done a mmget_not_zero() after the flushing CPU +* checked mm_users == 1, and be in the process of kthread_use_mm when +* interrupted here. In that case, current->mm will be set to mm, +* because kthread_use_mm() setting ->mm and switching to the mm is +* done with interrupts off. +*/ if (current->mm == mm) - return; /* Local CPU */ + goto out_flush; if (current->active_mm == mm) { - /* -* Must be a kernel thread because sender is single-threaded. -*/ - BUG_ON(current->mm); + WARN_ON_ONCE(current->mm != NULL); + /* Is a kernel thread and is using mm as the lazy tlb */ mmgrab(_mm); - switch_mm(mm, _mm, current); current->active_mm = _mm; + switch_mm_irqs_off(mm, _mm, current); mmdrop(mm); } + + atomic_dec(>context.active_cpus); + cpumask_clear_cpu(smp_processor_id(), mm_cpumask(mm)); + +out_flush: _tlbiel_pid(pid, RIC_FLUSH_ALL); } @@ -672,7 +682,6 @@ static void exit_flush_lazy_tlbs(struct mm_struct *mm) */ smp_call_function_many(mm_cpumask(mm), do_exit_flush_lazy_tlb, (void *)mm, 1); - mm_reset_thread_local(mm); } void radix__flush_tlb_mm(struct mm_struct *mm) -- 2.23.0
Re: [PATCH] genksyms: keywords: Use __restrict not _restrict
On 8/17/20 6:05 PM, Masahiro Yamada wrote: > On Sun, Aug 16, 2020 at 7:46 AM Randy Dunlap wrote: >> >> On 8/14/20 8:17 PM, Joe Perches wrote: >>> On Fri, 2020-08-14 at 20:05 -0700, Linus Torvalds wrote: On Fri, Aug 14, 2020 at 7:14 PM Nick Desaulniers wrote: > What's KAO? Urban dictionary has no entry. :^P It goes back to 2003 and the original keywords.gperf file, see https://git.kernel.org/pub/scm/linux/kernel/git/tglx/history.git/commit/?id=46bd1da672d66ccd8a639d3c1f8a166048cca608 from the BK history conversion. It might be Kai Germaschewski's tagger name? >>> >>> I think it was Keith Owens. >> >> Probably. A.K.A. kaos. >> >> -- >> ~Randy >> > > > Perhaps, we can remove "KAO"s ? Should be OK to do that. > Anyway, I was trying to pick up this patch. > > > I take patches from patchwork, but it looks like > the server (https://lore.kernel.org/patchwork/project/lkml/list/) > has been down for a while... Yes, it is having some issues. I have asked for help on that. -- ~Randy
Re: [PATCH v6] arm64: dts: qcom: sc7180: Add Display Port dt node
On 2020-08-17 17:24, Stephen Boyd wrote: Quoting Tanmay Shah (2020-08-17 15:53:00) diff --git a/arch/arm64/boot/dts/qcom/sc7180.dtsi b/arch/arm64/boot/dts/qcom/sc7180.dtsi index 31b9217bb5bf..bf2f2bb1aa79 100644 --- a/arch/arm64/boot/dts/qcom/sc7180.dtsi +++ b/arch/arm64/boot/dts/qcom/sc7180.dtsi @@ -2440,6 +2447,71 @@ dsi_phy: dsi-phy@ae94400 { status = "disabled"; }; + + msm_dp: displayport-controller@ae9 { This should come before dsi-phy and dsi node. It should be sorted by the address (0xae9). + status = "disabled"; + compatible = "qcom,sc7180-dp"; + + reg = <0 0x0ae9 0 0x1400>; + + interrupt-parent = <>; + interrupts = <12>; + [...] }; dispcc: clock-controller@af0 { @@ -2449,8 +2521,8 @@ dispcc: clock-controller@af0 { < GCC_DISP_GPLL0_CLK_SRC>, <_phy 0>, <_phy 1>, -<0>, -<0>; +<_dp 0>, +<_dp 1>; Don't think we should apply this still because the binding will change when the phy is split out to qmp node. Maybe just leave this part off for now? Ok fine. But, that will break DP driver functionality.
Re: [PATCH RESEND 3/5] block: Add a new helper to attempt to merge a bio
On Mon, Aug 17, 2020 at 02:24:40PM +0200, Christoph Hellwig wrote: > On Mon, Aug 17, 2020 at 08:10:02PM +0800, Baolin Wang wrote: > > On Mon, Aug 17, 2020 at 08:26:34AM +0200, Christoph Hellwig wrote: > > > On Mon, Aug 17, 2020 at 12:09:17PM +0800, Baolin Wang wrote: > > > > There are lots of duplicated code when trying to merge a bio from > > > > plug list and sw queue, we can introduce a new helper to attempt > > > > to merge a bio, which can simplify the blk_mq_bio_list_merge() > > > > and blk_attempt_plug_merge(). > > > > > > Looks sensible, but two comments: > > > > > > > +enum bio_merge_status blk_attempt_bio_merge(struct request_queue *q, > > > > + struct request *rq, > > > > + struct bio *bio, > > > > + unsigned int nr_segs) > > > > +{ > > > > + bool merged = false; > > > > + > > > > + if (!blk_rq_merge_ok(rq, bio)) > > > > + return BIO_MERGE_NONE; > > > > + > > > > + switch (blk_try_merge(rq, bio)) { > > > > + case ELEVATOR_BACK_MERGE: > > > > + merged = bio_attempt_back_merge(rq, bio, nr_segs); > > > > + break; > > > > + case ELEVATOR_FRONT_MERGE: > > > > + merged = bio_attempt_front_merge(rq, bio, nr_segs); > > > > + break; > > > > + case ELEVATOR_DISCARD_MERGE: > > > > + merged = bio_attempt_discard_merge(q, rq, bio); > > > > + break; > > > > > > Can't we also switch the bio_attempt_*merge helpers to return > > > enum bio_merge_status to simplify this a bit? > > > > Yes, will do. > > > > > > > > Also I think these helpers can be marked static now, although I didn't > > > actually apply your series, so I might have missed something. > > > > Cause this function will be used by blk_mq_bio_list_merge() in > > blk-mq-sched.c, it should be exported. > > Shouldn't blk_mq_bio_list_merge move to blk-merge.c as well? Yes, I can move it to blk-merge.c and rename to a generic name.
Re: [PATCH RESEND 5/5] block: Remove __blk_mq_sched_bio_merge() helper
On Mon, Aug 17, 2020 at 02:26:08PM +0200, Christoph Hellwig wrote: > On Mon, Aug 17, 2020 at 08:14:08PM +0800, Baolin Wang wrote: > > On Mon, Aug 17, 2020 at 08:32:41AM +0200, Christoph Hellwig wrote: > > > On Mon, Aug 17, 2020 at 12:09:19PM +0800, Baolin Wang wrote: > > > > The blk_mq_sched_bio_merge() just wrap the __blk_mq_sched_bio_merge(), > > > > and > > > > no other places will use __blk_mq_sched_bio_merge(). Thus we can combine > > > > these 2 similar functions into one function. > > > > > > I think the idea was to avoid the function call for the nomerges fast > > > path. Not sure if that is really worth it. > > > > Um, no places will use __blk_mq_sched_bio_merge(), not sure if it is a > > good choice we still keep an unused and similar function? > > Well, blk_mq_sched_bio_merge calls __blk_mq_sched_bio_merge, after > performing two fast path checks. What I mean is blk_mq_sched_bio_merge() just wrap the __blk_mq_sched_bio_merge(), and no other users will call __blk_mq_sched_bio_merge(). Anyway, I will drop this patch as you suggested.
Re: [PATCH] HID: google: add google vivaldi HID driver
On 8/17/20 7:49 PM, Sean O'Brien wrote: > diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig > index 05315b434276..5676d4f521c9 100644 > --- a/drivers/hid/Kconfig > +++ b/drivers/hid/Kconfig > @@ -397,6 +397,15 @@ config HID_GOOGLE_HAMMER > help > Say Y here if you have a Google Hammer device. > > +config HID_GOOGLE_VIVALDI > + tristate "Google Vivaldi Keyboard" > + depends on HID > + help > + Say Y here if you want to enable support for Google vivaldi keyboards. Vivaldi please. > + > + These are keyboards which report physical the order of consumer/action That's an awkward sentence. -EPARSE > + keys in the top row. > + help text lines (those under help) should be indented with one tab + 2 spaces according to Documentation/process/coding-style.rst. > config HID_GT683R > tristate "MSI GT68xR LED support" > depends on LEDS_CLASS && USB_HID -- ~Randy
[PATCH v2 1/2] clocksource: arm_arch_timer: Use stable count reader in erratum sne
In commit 0ea415390cd3 ("clocksource/arm_arch_timer: Use arch_timer_read_counter to access stable counters"), we separate stable and normal count reader to omit unnecessary overhead on systems that have no timer erratum. However, in erratum_set_next_event_tval_generic(), count reader becomes normal reader. This converts it to stable reader. Fixes: 0ea415390cd3 ("clocksource/arm_arch_timer: Use arch_timer_read_counter to access stable counters") Signed-off-by: Keqian Zhu --- drivers/clocksource/arm_arch_timer.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/clocksource/arm_arch_timer.c b/drivers/clocksource/arm_arch_timer.c index 6c3e841..777d38c 100644 --- a/drivers/clocksource/arm_arch_timer.c +++ b/drivers/clocksource/arm_arch_timer.c @@ -396,10 +396,10 @@ static void erratum_set_next_event_tval_generic(const int access, unsigned long ctrl &= ~ARCH_TIMER_CTRL_IT_MASK; if (access == ARCH_TIMER_PHYS_ACCESS) { - cval = evt + arch_counter_get_cntpct(); + cval = evt + arch_counter_get_cntpct_stable(); write_sysreg(cval, cntp_cval_el0); } else { - cval = evt + arch_counter_get_cntvct(); + cval = evt + arch_counter_get_cntvct_stable(); write_sysreg(cval, cntv_cval_el0); } -- 1.8.3.1
[PATCH v2 0/2] clocksource: arm_arch_timer: Some fixes
change log: v2: - Do not revert commit 0ea415390cd3, fix it instead. - Correct the tags of second patch. Keqian Zhu (2): clocksource: arm_arch_timer: Use stable count reader in erratum sne clocksource: arm_arch_timer: Correct fault programming of CNTKCTL_EL1.EVNTI drivers/clocksource/arm_arch_timer.c | 14 +- 1 file changed, 9 insertions(+), 5 deletions(-) -- 1.8.3.1
[PATCH v2 2/2] clocksource: arm_arch_timer: Correct fault programming of CNTKCTL_EL1.EVNTI
ARM virtual counter supports event stream, it can only trigger an event when the trigger bit (the value of CNTKCTL_EL1.EVNTI) of CNTVCT_EL0 changes, so the actual period of event stream is 2^(cntkctl_evnti + 1). For example, when the trigger bit is 0, then virtual counter trigger an event for every two cycles. Fixes: 037f637767a8 ("drivers: clocksource: add support for ARM architected timer event stream") Suggested-by: Marc Zyngier Signed-off-by: Keqian Zhu --- drivers/clocksource/arm_arch_timer.c | 10 +++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/clocksource/arm_arch_timer.c b/drivers/clocksource/arm_arch_timer.c index 777d38c..e3b2ee0 100644 --- a/drivers/clocksource/arm_arch_timer.c +++ b/drivers/clocksource/arm_arch_timer.c @@ -824,10 +824,14 @@ static void arch_timer_configure_evtstream(void) { int evt_stream_div, pos; - /* Find the closest power of two to the divisor */ - evt_stream_div = arch_timer_rate / ARCH_TIMER_EVT_STREAM_FREQ; + /* +* Find the closest power of two to the divisor. As the event +* stream can at most be generated at half the frequency of the +* counter, use half the frequency when computing the divider. +*/ + evt_stream_div = arch_timer_rate / ARCH_TIMER_EVT_STREAM_FREQ / 2; pos = fls(evt_stream_div); - if (pos > 1 && !(evt_stream_div & (1 << (pos - 2 + if ((pos == 1) || (pos > 1 && !(evt_stream_div & (1 << (pos - 2) pos--; /* enable event stream */ arch_timer_evtstrm_enable(min(pos, 15)); -- 1.8.3.1
[PATCH v2 07/12] soundwire: intel: add CLK_STOP_TEARDOWN for pm_runtime suspend
From: Pierre-Louis Bossart Now that we have options, add support for TEARDOWN mode (same functionality as existing code) All other modes will be added in follow-up patches. Signed-off-by: Pierre-Louis Bossart Signed-off-by: Bard Liao --- drivers/soundwire/intel.c | 82 +- drivers/soundwire/intel.h | 2 + drivers/soundwire/intel_init.c | 1 + 3 files changed, 54 insertions(+), 31 deletions(-) diff --git a/drivers/soundwire/intel.c b/drivers/soundwire/intel.c index 3f9015dcb693..68c1cdfb7999 100644 --- a/drivers/soundwire/intel.c +++ b/drivers/soundwire/intel.c @@ -1548,6 +1548,7 @@ static int intel_suspend_runtime(struct device *dev) struct sdw_cdns *cdns = dev_get_drvdata(dev); struct sdw_intel *sdw = cdns_to_intel(cdns); struct sdw_bus *bus = >bus; + u32 clock_stop_quirks; int ret; if (bus->prop.hw_disabled) { @@ -1556,21 +1557,31 @@ static int intel_suspend_runtime(struct device *dev) return 0; } - ret = sdw_cdns_enable_interrupt(cdns, false); - if (ret < 0) { - dev_err(dev, "cannot disable interrupts on suspend\n"); - return ret; - } + clock_stop_quirks = sdw->link_res->clock_stop_quirks; - ret = intel_link_power_down(sdw); - if (ret) { - dev_err(dev, "Link power down failed: %d", ret); - return ret; - } + if (clock_stop_quirks & SDW_INTEL_CLK_STOP_TEARDOWN) { + + ret = sdw_cdns_enable_interrupt(cdns, false); + if (ret < 0) { + dev_err(dev, "cannot disable interrupts on suspend\n"); + return ret; + } - intel_shim_wake(sdw, false); + ret = intel_link_power_down(sdw); + if (ret) { + dev_err(dev, "Link power down failed: %d", ret); + return ret; + } + + intel_shim_wake(sdw, false); + + } else { + dev_err(dev, "%s clock_stop_quirks %x unsupported\n", + __func__, clock_stop_quirks); + ret = -EINVAL; + } - return 0; + return ret; } static int intel_resume(struct device *dev) @@ -1645,6 +1656,7 @@ static int intel_resume_runtime(struct device *dev) struct sdw_cdns *cdns = dev_get_drvdata(dev); struct sdw_intel *sdw = cdns_to_intel(cdns); struct sdw_bus *bus = >bus; + u32 clock_stop_quirks; int ret; if (bus->prop.hw_disabled) { @@ -1653,28 +1665,36 @@ static int intel_resume_runtime(struct device *dev) return 0; } - ret = intel_init(sdw); - if (ret) { - dev_err(dev, "%s failed: %d", __func__, ret); - return ret; - } + clock_stop_quirks = sdw->link_res->clock_stop_quirks; - /* -* make sure all Slaves are tagged as UNATTACHED and provide -* reason for reinitialization -*/ - sdw_clear_slave_status(bus, SDW_UNATTACH_REQUEST_MASTER_RESET); + if (clock_stop_quirks & SDW_INTEL_CLK_STOP_TEARDOWN) { + ret = intel_init(sdw); + if (ret) { + dev_err(dev, "%s failed: %d", __func__, ret); + return ret; + } - ret = sdw_cdns_enable_interrupt(cdns, true); - if (ret < 0) { - dev_err(dev, "cannot enable interrupts during resume\n"); - return ret; - } + /* +* make sure all Slaves are tagged as UNATTACHED and provide +* reason for reinitialization +*/ + sdw_clear_slave_status(bus, SDW_UNATTACH_REQUEST_MASTER_RESET); - ret = sdw_cdns_exit_reset(cdns); - if (ret < 0) { - dev_err(dev, "unable to exit bus reset sequence during resume\n"); - return ret; + ret = sdw_cdns_enable_interrupt(cdns, true); + if (ret < 0) { + dev_err(dev, "cannot enable interrupts during resume\n"); + return ret; + } + + ret = sdw_cdns_exit_reset(cdns); + if (ret < 0) { + dev_err(dev, "unable to exit bus reset sequence during resume\n"); + return ret; + } + } else { + dev_err(dev, "%s clock_stop_quirks %x unsupported\n", + __func__, clock_stop_quirks); + ret = -EINVAL; } return ret; diff --git a/drivers/soundwire/intel.h b/drivers/soundwire/intel.h index 4ea3d262d249..23daab9da329 100644 --- a/drivers/soundwire/intel.h +++ b/drivers/soundwire/intel.h @@ -17,6 +17,7 @@ * @dev: device implementing hw_params and free callbacks * @shim_lock: mutex to handle access to shared SHIM registers * @shim_mask:
[PATCH v2 03/12] soundwire: intel: fix race condition on system resume
From: Pierre-Louis Bossart Previous patches took care of the case where the master device is pm_runtime 'suspended' when a system suspend occurs. In the case where the master device was not suspended, e.g. if suspend occurred while streaming audio, Intel validation noticed a race condition: the pm_runtime suspend may conflict with the enumeration started by the system resume. This can be simply fixed by updating the status before exiting system resume. GitHub issue: https://github.com/thesofproject/linux/issues/1482 Signed-off-by: Pierre-Louis Bossart Signed-off-by: Bard Liao --- drivers/soundwire/intel.c | 12 1 file changed, 12 insertions(+) diff --git a/drivers/soundwire/intel.c b/drivers/soundwire/intel.c index 0e21bae3cd19..00c5de1250ec 100644 --- a/drivers/soundwire/intel.c +++ b/drivers/soundwire/intel.c @@ -1528,6 +1528,18 @@ static int intel_resume(struct device *dev) return ret; } + /* +* after system resume, the pm_runtime suspend() may kick in +* during the enumeration, before any children device force the +* master device to remain active. Using pm_runtime_get() +* routines is not really possible, since it'd prevent the +* master from suspending. +* A reasonable compromise is to update the pm_runtime +* counters and delay the pm_runtime suspend by several +* seconds, by when all enumeration should be complete. +*/ + pm_runtime_mark_last_busy(dev); + return ret; } -- 2.17.1
[PATCH v2 11/12] soundwire: intel: support clock_stop mode without quirks
From: Pierre-Louis Bossart In this mode, on restart the bus restarts immediately, the Slaves remain synchronized and all context is kept intact. Signed-off-by: Pierre-Louis Bossart Signed-off-by: Rander Wang Signed-off-by: Bard Liao --- drivers/soundwire/intel.c | 21 - 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/drivers/soundwire/intel.c b/drivers/soundwire/intel.c index 95b14c034ea7..2899445e2649 100644 --- a/drivers/soundwire/intel.c +++ b/drivers/soundwire/intel.c @@ -1595,7 +1595,8 @@ static int intel_suspend_runtime(struct device *dev) intel_shim_wake(sdw, false); - } else if (clock_stop_quirks & SDW_INTEL_CLK_STOP_BUS_RESET) { + } else if (clock_stop_quirks & SDW_INTEL_CLK_STOP_BUS_RESET || + !clock_stop_quirks) { ret = sdw_cdns_clock_stop(cdns, true); if (ret < 0) { dev_err(dev, "cannot enable clock stop on suspend\n"); @@ -1755,6 +1756,24 @@ static int intel_resume_runtime(struct device *dev) dev_err(dev, "unable to restart clock during resume\n"); return ret; } + } else if (!clock_stop_quirks) { + ret = intel_init(sdw); + if (ret) { + dev_err(dev, "%s failed: %d", __func__, ret); + return ret; + } + + ret = sdw_cdns_enable_interrupt(cdns, true); + if (ret < 0) { + dev_err(dev, "cannot enable interrupts during resume\n"); + return ret; + } + + ret = sdw_cdns_clock_restart(cdns, false); + if (ret < 0) { + dev_err(dev, "unable to resume master during resume\n"); + return ret; + } } else { dev_err(dev, "%s clock_stop_quirks %x unsupported\n", __func__, clock_stop_quirks); -- 2.17.1
[PATCH v2 06/12] soundwire: intel: pm_runtime idle scheduling
From: Pierre-Louis Bossart Add quirk and pm_runtime idle scheduling to let the Master suspend if no Slaves become attached. This can happen when a link is not marked as disabled and has devices exposed in the DSDT, if the power is controlled by sideband means or the link includes a pluggable connector. Signed-off-by: Pierre-Louis Bossart Signed-off-by: Rander Wang Signed-off-by: Bard Liao --- drivers/soundwire/intel.c | 26 -- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/drivers/soundwire/intel.c b/drivers/soundwire/intel.c index 95a1d88a5bfb..3f9015dcb693 100644 --- a/drivers/soundwire/intel.c +++ b/drivers/soundwire/intel.c @@ -31,8 +31,9 @@ * flags reused in each byte, with master0 using the ls-byte, etc. */ -#define SDW_INTEL_MASTER_DISABLE_PM_RUNTIME BIT(0) -#define SDW_INTEL_MASTER_DISABLE_CLOCK_STOP BIT(1) +#define SDW_INTEL_MASTER_DISABLE_PM_RUNTIMEBIT(0) +#define SDW_INTEL_MASTER_DISABLE_CLOCK_STOPBIT(1) +#define SDW_INTEL_MASTER_DISABLE_PM_RUNTIME_IDLE BIT(2) static int md_flags; module_param_named(sdw_md_flags, md_flags, int, 0444); @@ -1422,6 +1423,22 @@ int intel_master_startup(struct platform_device *pdev) pm_runtime_enable(dev); } + /* +* The runtime PM status of Slave devices is "Unsupported" +* until they report as ATTACHED. If they don't, e.g. because +* there are no Slave devices populated or if the power-on is +* delayed or dependent on a power switch, the Master will +* remain active and prevent its parent from suspending. +* +* Conditionally force the pm_runtime core to re-evaluate the +* Master status in the absence of any Slave activity. A quirk +* is provided to e.g. deal with Slaves that may be powered on +* with a delay. A more complete solution would require the +* definition of Master properties. +*/ + if (!(link_flags & SDW_INTEL_MASTER_DISABLE_PM_RUNTIME_IDLE)) + pm_runtime_idle(dev); + return 0; err_interrupt: @@ -1561,6 +1578,7 @@ static int intel_resume(struct device *dev) struct sdw_cdns *cdns = dev_get_drvdata(dev); struct sdw_intel *sdw = cdns_to_intel(cdns); struct sdw_bus *bus = >bus; + int link_flags; int ret; if (bus->prop.hw_disabled) { @@ -1577,6 +1595,10 @@ static int intel_resume(struct device *dev) pm_runtime_set_active(dev); pm_runtime_mark_last_busy(dev); pm_runtime_enable(dev); + + link_flags = md_flags >> (bus->link_id * 8); + if (!(link_flags & SDW_INTEL_MASTER_DISABLE_PM_RUNTIME_IDLE)) + pm_runtime_idle(dev); } ret = intel_init(sdw); -- 2.17.1
[PATCH v2 09/12] soundwire: intel: add CLK_STOP_NOT_ALLOWED support
From: Pierre-Louis Bossart In case the clock needs to keep running, we need to prevent the Master from entering pm_runtime suspend. Signed-off-by: Pierre-Louis Bossart Signed-off-by: Bard Liao --- drivers/soundwire/intel.c | 20 1 file changed, 20 insertions(+) diff --git a/drivers/soundwire/intel.c b/drivers/soundwire/intel.c index ad476e9e4d25..95b14c034ea7 100644 --- a/drivers/soundwire/intel.c +++ b/drivers/soundwire/intel.c @@ -1367,6 +1367,7 @@ int intel_master_startup(struct platform_device *pdev) struct sdw_intel *sdw = cdns_to_intel(cdns); struct sdw_bus *bus = >bus; int link_flags; + u32 clock_stop_quirks; int ret; if (bus->prop.hw_disabled) { @@ -1423,6 +1424,20 @@ int intel_master_startup(struct platform_device *pdev) pm_runtime_enable(dev); } + clock_stop_quirks = sdw->link_res->clock_stop_quirks; + if (clock_stop_quirks & SDW_INTEL_CLK_STOP_NOT_ALLOWED) { + /* +* To keep the clock running we need to prevent +* pm_runtime suspend from happening by increasing the +* reference count. +* This quirk is specified by the parent PCI device in +* case of specific latency requirements. It will have +* no effect if pm_runtime is disabled by the user via +* a module parameter for testing purposes. +*/ + pm_runtime_get_noresume(dev); + } + /* * The runtime PM status of Slave devices is "Unsupported" * until they report as ATTACHED. If they don't, e.g. because @@ -1454,6 +1469,11 @@ static int intel_master_remove(struct platform_device *pdev) struct sdw_intel *sdw = cdns_to_intel(cdns); struct sdw_bus *bus = >bus; + /* +* Since pm_runtime is already disabled, we don't decrease +* the refcount when the clock_stop_quirk is +* SDW_INTEL_CLK_STOP_NOT_ALLOWED +*/ if (!bus->prop.hw_disabled) { intel_debugfs_exit(sdw); sdw_cdns_enable_interrupt(cdns, false); -- 2.17.1
[PATCH v2 04/12] soundwire: intel: call helper to reset Slave states on resume
From: Pierre-Louis Bossart This helps make sure they are all UNATTACHED and reset the state machines. At the moment we perform a bus reset both for system resume and pm_runtime resume, this will be modified when clock-stop mode is supported Signed-off-by: Pierre-Louis Bossart Signed-off-by: Bard Liao --- drivers/soundwire/intel.c | 12 1 file changed, 12 insertions(+) diff --git a/drivers/soundwire/intel.c b/drivers/soundwire/intel.c index 00c5de1250ec..10dd0e208ce7 100644 --- a/drivers/soundwire/intel.c +++ b/drivers/soundwire/intel.c @@ -1516,6 +1516,12 @@ static int intel_resume(struct device *dev) return ret; } + /* +* make sure all Slaves are tagged as UNATTACHED and provide +* reason for reinitialization +*/ + sdw_clear_slave_status(bus, SDW_UNATTACH_REQUEST_MASTER_RESET); + ret = sdw_cdns_enable_interrupt(cdns, true); if (ret < 0) { dev_err(dev, "cannot enable interrupts during resume\n"); @@ -1562,6 +1568,12 @@ static int intel_resume_runtime(struct device *dev) return ret; } + /* +* make sure all Slaves are tagged as UNATTACHED and provide +* reason for reinitialization +*/ + sdw_clear_slave_status(bus, SDW_UNATTACH_REQUEST_MASTER_RESET); + ret = sdw_cdns_enable_interrupt(cdns, true); if (ret < 0) { dev_err(dev, "cannot enable interrupts during resume\n"); -- 2.17.1
[PATCH v2 05/12] soundwire: intel: reinitialize IP+DSP in .prepare(), but only when resuming
The .prepare() callback is invoked for normal streaming, underflows or during the system resume transition. In the latter case, the context for the ALH PDIs is lost, and the DSP is not initialized properly either, but the bus parameters don't need to be recomputed. Conversely, when doing a regular .prepare() during an underflow, the ALH/SHIM registers shall not be changed as the hardware cannot be reprogrammed after the DMA started (hardware spec requirement). This patch adds storage of PDI and hw_params in the DAI dma context, and the difference between the types of .prepare() usages is handled via a simple boolean, updated when suspending, and tested for in the .prepare() case. Signed-off-by: Bard Liao Signed-off-by: Pierre-Louis Bossart --- drivers/soundwire/cadence_master.h | 4 ++ drivers/soundwire/intel.c | 71 +- 2 files changed, 74 insertions(+), 1 deletion(-) diff --git a/drivers/soundwire/cadence_master.h b/drivers/soundwire/cadence_master.h index 7638858397df..fdec62b912d3 100644 --- a/drivers/soundwire/cadence_master.h +++ b/drivers/soundwire/cadence_master.h @@ -84,6 +84,8 @@ struct sdw_cdns_stream_config { * @bus: Bus handle * @stream_type: Stream type * @link_id: Master link id + * @hw_params: hw_params to be applied in .prepare step + * @suspended: status set when suspended, to be used in .prepare */ struct sdw_cdns_dma_data { char *name; @@ -92,6 +94,8 @@ struct sdw_cdns_dma_data { struct sdw_bus *bus; enum sdw_stream_type stream_type; int link_id; + struct snd_pcm_hw_params *hw_params; + bool suspended; }; /** diff --git a/drivers/soundwire/intel.c b/drivers/soundwire/intel.c index 10dd0e208ce7..95a1d88a5bfb 100644 --- a/drivers/soundwire/intel.c +++ b/drivers/soundwire/intel.c @@ -879,6 +879,10 @@ static int intel_hw_params(struct snd_pcm_substream *substream, intel_pdi_alh_configure(sdw, pdi); sdw_cdns_config_stream(cdns, ch, dir, pdi); + /* store pdi and hw_params, may be needed in prepare step */ + dma->suspended = false; + dma->pdi = pdi; + dma->hw_params = params; /* Inform DSP about PDI stream number */ ret = intel_params_stream(sdw, substream, dai, params, @@ -922,7 +926,11 @@ static int intel_hw_params(struct snd_pcm_substream *substream, static int intel_prepare(struct snd_pcm_substream *substream, struct snd_soc_dai *dai) { + struct sdw_cdns *cdns = snd_soc_dai_get_drvdata(dai); + struct sdw_intel *sdw = cdns_to_intel(cdns); struct sdw_cdns_dma_data *dma; + int ch, dir; + int ret; dma = snd_soc_dai_get_dma_data(dai, substream); if (!dma) { @@ -931,7 +939,41 @@ static int intel_prepare(struct snd_pcm_substream *substream, return -EIO; } - return sdw_prepare_stream(dma->stream); + if (dma->suspended) { + dma->suspended = false; + + /* +* .prepare() is called after system resume, where we +* need to reinitialize the SHIM/ALH/Cadence IP. +* .prepare() is also called to deal with underflows, +* but in those cases we cannot touch ALH/SHIM +* registers +*/ + + /* configure stream */ + ch = params_channels(dma->hw_params); + if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) + dir = SDW_DATA_DIR_RX; + else + dir = SDW_DATA_DIR_TX; + + intel_pdi_shim_configure(sdw, dma->pdi); + intel_pdi_alh_configure(sdw, dma->pdi); + sdw_cdns_config_stream(cdns, ch, dir, dma->pdi); + + /* Inform DSP about PDI stream number */ + ret = intel_params_stream(sdw, substream, dai, + dma->hw_params, + sdw->instance, + dma->pdi->intel_alh_id); + if (ret) + goto err; + } + + ret = sdw_prepare_stream(dma->stream); + +err: + return ret; } static int intel_trigger(struct snd_pcm_substream *substream, int cmd, @@ -1002,6 +1044,9 @@ intel_hw_free(struct snd_pcm_substream *substream, struct snd_soc_dai *dai) return ret; } + dma->hw_params = NULL; + dma->pdi = NULL; + return 0; } @@ -1014,6 +1059,29 @@ static void intel_shutdown(struct snd_pcm_substream *substream, pm_runtime_put_autosuspend(cdns->dev); } +static int intel_component_dais_suspend(struct snd_soc_component *component) +{ + struct sdw_cdns_dma_data *dma; + struct snd_soc_dai *dai; + + for_each_component_dais(component, dai) { + /* +* we don't have a .suspend dai_ops, and we don't have access +
[PATCH v2 10/12] soundwire: intel_init: handle power rail dependencies for clock stop mode
From: Pierre-Louis Bossart When none of the clock stop quirks is specified, the Master IP will assume the context is preserved and will not reset the Bus and restart enumeration. Due to power rail dependencies, the HDaudio controller needs to remain powered and prevented from executing its pm_runtime suspend routine. This choice of course has a power impact, and this mode should only be selected when latency requirements are critical or the parent device can enter D0ix modes. Signed-off-by: Pierre-Louis Bossart Signed-off-by: Bard Liao --- drivers/soundwire/intel_init.c | 13 + 1 file changed, 13 insertions(+) diff --git a/drivers/soundwire/intel_init.c b/drivers/soundwire/intel_init.c index dd1050743dca..add46d8fc85c 100644 --- a/drivers/soundwire/intel_init.c +++ b/drivers/soundwire/intel_init.c @@ -73,6 +73,9 @@ static int sdw_intel_cleanup(struct sdw_intel_ctx *ctx) pm_runtime_disable(>pdev->dev); platform_device_unregister(link->pdev); } + + if (!link->clock_stop_quirks) + pm_runtime_put_noidle(link->dev); } return 0; @@ -338,6 +341,16 @@ sdw_intel_startup_controller(struct sdw_intel_ctx *ctx) continue; intel_master_startup(link->pdev); + + if (!link->clock_stop_quirks) { + /* +* we need to prevent the parent PCI device +* from entering pm_runtime suspend, so that +* power rails to the SoundWire IP are not +* turned off. +*/ + pm_runtime_get_noresume(link->dev); + } } return 0; -- 2.17.1
[PATCH v2 01/12] soundwire: intel: add pm_runtime support
From: Pierre-Louis Bossart Add basic hooks in DAI .startup and .shutdown callbacks. The SoundWire IP should be powered between those two calls. The power dependencies between SoundWire and DSP are handled with the parent/child relationship, before the SoundWire master device becomes active the parent device will become active and power-up the shared rails. For now the strategy is to rely on complete enumeration when the device becomes active, so the code is a copy/paste of the sequence for system suspend/resume. In future patches, the strategy will optionally be to rely on clock stop if the enumeration time is prohibitive or when the devices connected to a link can signal a wake. A module parameter is added to make integration of new Slave devices easier, to e.g. keep the device active or prevent clock-stop. Note that we need to we have to disable runtime pm before device unregister, otherwise we will see "Failed to power up link: -11" error on module remove test. Signed-off-by: Pierre-Louis Bossart Signed-off-by: Bard Liao --- drivers/soundwire/intel.c | 112 +++-- drivers/soundwire/intel_init.c | 5 +- 2 files changed, 112 insertions(+), 5 deletions(-) diff --git a/drivers/soundwire/intel.c b/drivers/soundwire/intel.c index 88aeef8b7c0c..85a0bb6af4fe 100644 --- a/drivers/soundwire/intel.c +++ b/drivers/soundwire/intel.c @@ -22,6 +22,22 @@ #include "bus.h" #include "intel.h" +#define INTEL_MASTER_SUSPEND_DELAY_MS 3000 + +/* + * debug/config flags for the Intel SoundWire Master. + * + * Since we may have multiple masters active, we can have up to 8 + * flags reused in each byte, with master0 using the ls-byte, etc. + */ + +#define SDW_INTEL_MASTER_DISABLE_PM_RUNTIME BIT(0) +#define SDW_INTEL_MASTER_DISABLE_CLOCK_STOP BIT(1) + +static int md_flags; +module_param_named(sdw_md_flags, md_flags, int, 0444); +MODULE_PARM_DESC(sdw_md_flags, "SoundWire Intel Master device flags (0x0 all off)"); + /* Intel SHIM Registers Definition */ #define SDW_SHIM_LCAP 0x0 #define SDW_SHIM_LCTL 0x4 @@ -807,10 +823,17 @@ static int intel_post_bank_switch(struct sdw_bus *bus) static int intel_startup(struct snd_pcm_substream *substream, struct snd_soc_dai *dai) { - /* -* TODO: add pm_runtime support here, the startup callback -* will make sure the IP is 'active' -*/ + struct sdw_cdns *cdns = snd_soc_dai_get_drvdata(dai); + int ret; + + ret = pm_runtime_get_sync(cdns->dev); + if (ret < 0 && ret != -EACCES) { + dev_err_ratelimited(cdns->dev, + "pm_runtime_get_sync failed in %s, ret %d\n", + __func__, ret); + pm_runtime_put_noidle(cdns->dev); + return ret; + } return 0; } @@ -985,7 +1008,10 @@ intel_hw_free(struct snd_pcm_substream *substream, struct snd_soc_dai *dai) static void intel_shutdown(struct snd_pcm_substream *substream, struct snd_soc_dai *dai) { + struct sdw_cdns *cdns = snd_soc_dai_get_drvdata(dai); + pm_runtime_mark_last_busy(cdns->dev); + pm_runtime_put_autosuspend(cdns->dev); } static int intel_pcm_set_sdw_stream(struct snd_soc_dai *dai, @@ -1270,6 +1296,7 @@ int intel_master_startup(struct platform_device *pdev) struct sdw_cdns *cdns = dev_get_drvdata(dev); struct sdw_intel *sdw = cdns_to_intel(cdns); struct sdw_bus *bus = >bus; + int link_flags; int ret; if (bus->prop.hw_disabled) { @@ -1314,6 +1341,18 @@ int intel_master_startup(struct platform_device *pdev) intel_debugfs_init(sdw); + /* Enable runtime PM */ + link_flags = md_flags >> (bus->link_id * 8); + if (!(link_flags & SDW_INTEL_MASTER_DISABLE_PM_RUNTIME)) { + pm_runtime_set_autosuspend_delay(dev, +INTEL_MASTER_SUSPEND_DELAY_MS); + pm_runtime_use_autosuspend(dev); + pm_runtime_mark_last_busy(dev); + + pm_runtime_set_active(dev); + pm_runtime_enable(dev); + } + return 0; err_interrupt: @@ -1412,6 +1451,36 @@ static int intel_suspend(struct device *dev) return 0; } +static int intel_suspend_runtime(struct device *dev) +{ + struct sdw_cdns *cdns = dev_get_drvdata(dev); + struct sdw_intel *sdw = cdns_to_intel(cdns); + struct sdw_bus *bus = >bus; + int ret; + + if (bus->prop.hw_disabled) { + dev_dbg(dev, "SoundWire master %d is disabled, ignoring\n", + bus->link_id); + return 0; + } + + ret = sdw_cdns_enable_interrupt(cdns, false); + if (ret < 0) { + dev_err(dev, "cannot disable interrupts on suspend\n"); + return ret; + } + + ret = intel_link_power_down(sdw); +
[PATCH v2 08/12] soundwire: intel: add CLK_STOP_BUS_RESET support
From: Rander Wang Move existing pm_runtime suspend under the CLK_STOP_TEARDOWN case. In this mode the Master IP will lose all context but in-band wakes are supported. On pm_runtime resume a complete re-enumeration will be performed after a bus reset. Signed-off-by: Rander Wang Signed-off-by: Pierre-Louis Bossart Signed-off-by: Bard Liao --- drivers/soundwire/intel.c | 44 +++ 1 file changed, 44 insertions(+) diff --git a/drivers/soundwire/intel.c b/drivers/soundwire/intel.c index 68c1cdfb7999..ad476e9e4d25 100644 --- a/drivers/soundwire/intel.c +++ b/drivers/soundwire/intel.c @@ -1575,6 +1575,26 @@ static int intel_suspend_runtime(struct device *dev) intel_shim_wake(sdw, false); + } else if (clock_stop_quirks & SDW_INTEL_CLK_STOP_BUS_RESET) { + ret = sdw_cdns_clock_stop(cdns, true); + if (ret < 0) { + dev_err(dev, "cannot enable clock stop on suspend\n"); + return ret; + } + + ret = sdw_cdns_enable_interrupt(cdns, false); + if (ret < 0) { + dev_err(dev, "cannot disable interrupts on suspend\n"); + return ret; + } + + ret = intel_link_power_down(sdw); + if (ret) { + dev_err(dev, "Link power down failed: %d", ret); + return ret; + } + + intel_shim_wake(sdw, true); } else { dev_err(dev, "%s clock_stop_quirks %x unsupported\n", __func__, clock_stop_quirks); @@ -1691,6 +1711,30 @@ static int intel_resume_runtime(struct device *dev) dev_err(dev, "unable to exit bus reset sequence during resume\n"); return ret; } + } else if (clock_stop_quirks & SDW_INTEL_CLK_STOP_BUS_RESET) { + ret = intel_init(sdw); + if (ret) { + dev_err(dev, "%s failed: %d", __func__, ret); + return ret; + } + + /* +* make sure all Slaves are tagged as UNATTACHED and +* provide reason for reinitialization +*/ + sdw_clear_slave_status(bus, SDW_UNATTACH_REQUEST_MASTER_RESET); + + ret = sdw_cdns_enable_interrupt(cdns, true); + if (ret < 0) { + dev_err(dev, "cannot enable interrupts during resume\n"); + return ret; + } + + ret = sdw_cdns_clock_restart(cdns, true); + if (ret < 0) { + dev_err(dev, "unable to restart clock during resume\n"); + return ret; + } } else { dev_err(dev, "%s clock_stop_quirks %x unsupported\n", __func__, clock_stop_quirks); -- 2.17.1
[PATCH v2 12/12] soundwire: intel: refine runtime pm for SDW_INTEL_CLK_STOP_BUS_RESET
From: Rander Wang When all the links are suspended, the HDaudio controller may suspend and the power rails to the SoundWire IP may be disabled, requiring a complete re-initialization/enumeration on resume. However, if one or more Masters remained active, the HDaudio controller will remain active and the power rails will remain enabled. As a result, during the link resume step we can check if the context was preserved by verifying if the clock was stopped, and avoid doing a complete bus reset and re-enumeration. Signed-off-by: Rander Wang Signed-off-by: Bard Liao --- drivers/soundwire/intel.c | 19 +-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/drivers/soundwire/intel.c b/drivers/soundwire/intel.c index 2899445e2649..dbcbe2708563 100644 --- a/drivers/soundwire/intel.c +++ b/drivers/soundwire/intel.c @@ -1698,6 +1698,8 @@ static int intel_resume_runtime(struct device *dev) struct sdw_intel *sdw = cdns_to_intel(cdns); struct sdw_bus *bus = >bus; u32 clock_stop_quirks; + bool clock_stop0; + int status; int ret; if (bus->prop.hw_disabled) { @@ -1739,11 +1741,24 @@ static int intel_resume_runtime(struct device *dev) return ret; } + /* +* An exception condition occurs for the CLK_STOP_BUS_RESET +* case if one or more masters remain active. In this condition, +* all the masters are powered on for they are in the same power +* domain. Master can preserve its context for clock stop0, so +* there is no need to clear slave status and reset bus. +*/ + clock_stop0 = sdw_cdns_is_clock_stop(>cdns); + /* * make sure all Slaves are tagged as UNATTACHED and * provide reason for reinitialization */ - sdw_clear_slave_status(bus, SDW_UNATTACH_REQUEST_MASTER_RESET); + if (!clock_stop0) { + status = SDW_UNATTACH_REQUEST_MASTER_RESET; + sdw_clear_slave_status(bus, status); + } + ret = sdw_cdns_enable_interrupt(cdns, true); if (ret < 0) { @@ -1751,7 +1766,7 @@ static int intel_resume_runtime(struct device *dev) return ret; } - ret = sdw_cdns_clock_restart(cdns, true); + ret = sdw_cdns_clock_restart(cdns, !clock_stop0); if (ret < 0) { dev_err(dev, "unable to restart clock during resume\n"); return ret; -- 2.17.1
[PATCH v2 02/12] soundwire: intel: reset pm_runtime status during system resume
From: Pierre-Louis Bossart The system resume does the entire bus re-initialization and brings it to full-power. If the device was pm_runtime suspended, there is no need to run the pm_runtime resume sequence after the system runtime. Follow the documentation from runtime_pm.rst, and conditionally disable, set_active and re-enable the device on system resume. Note that pm_runtime_suspended() is used instead of pm_runtime_status_suspended() so that we can deal with the case where pm_runtime is disabled. Signed-off-by: Pierre-Louis Bossart Signed-off-by: Bard Liao --- drivers/soundwire/intel.c | 16 1 file changed, 16 insertions(+) diff --git a/drivers/soundwire/intel.c b/drivers/soundwire/intel.c index 85a0bb6af4fe..0e21bae3cd19 100644 --- a/drivers/soundwire/intel.c +++ b/drivers/soundwire/intel.c @@ -1434,6 +1434,12 @@ static int intel_suspend(struct device *dev) return 0; } + if (pm_runtime_suspended(dev)) { + dev_dbg(dev, "%s: pm_runtime status: suspended\n", __func__); + + return 0; + } + ret = sdw_cdns_enable_interrupt(cdns, false); if (ret < 0) { dev_err(dev, "cannot disable interrupts on suspend\n"); @@ -1494,6 +1500,16 @@ static int intel_resume(struct device *dev) return 0; } + if (pm_runtime_suspended(dev)) { + dev_dbg(dev, "%s: pm_runtime status was suspended, forcing active\n", __func__); + + /* follow required sequence from runtime_pm.rst */ + pm_runtime_disable(dev); + pm_runtime_set_active(dev); + pm_runtime_mark_last_busy(dev); + pm_runtime_enable(dev); + } + ret = intel_init(sdw); if (ret) { dev_err(dev, "%s failed: %d", __func__, ret); -- 2.17.1
[PATCH v2 00/12] soundwire: intel: add power management support
This series adds power management support for Intel soundwire links. Changes in v2: - Move "#include " to the first required patch. - Fit debug log in single line. Bard Liao (1): soundwire: intel: reinitialize IP+DSP in .prepare(), but only when resuming Pierre-Louis Bossart (9): soundwire: intel: add pm_runtime support soundwire: intel: reset pm_runtime status during system resume soundwire: intel: fix race condition on system resume soundwire: intel: call helper to reset Slave states on resume soundwire: intel: pm_runtime idle scheduling soundwire: intel: add CLK_STOP_TEARDOWN for pm_runtime suspend soundwire: intel: add CLK_STOP_NOT_ALLOWED support soundwire: intel_init: handle power rail dependencies for clock stop mode soundwire: intel: support clock_stop mode without quirks Rander Wang (2): soundwire: intel: add CLK_STOP_BUS_RESET support soundwire: intel: refine runtime pm for SDW_INTEL_CLK_STOP_BUS_RESET drivers/soundwire/cadence_master.h | 4 + drivers/soundwire/intel.c | 363 - drivers/soundwire/intel.h | 2 + drivers/soundwire/intel_init.c | 19 +- 4 files changed, 382 insertions(+), 6 deletions(-) -- 2.17.1
Re: [PATCH] mm/page_reporting: the "page" must not be the list head
On Mon, Aug 17, 2020 at 09:05:32AM -0700, Alexander Duyck wrote: > > >On 8/17/2020 2:35 AM, David Hildenbrand wrote: >> On 17.08.20 10:48, Wei Yang wrote: >> > If "page" is the list head, list_for_each_entry_safe() would stop >> > iteration. >> > >> > Signed-off-by: Wei Yang >> > --- >> > mm/page_reporting.c | 2 +- >> > 1 file changed, 1 insertion(+), 1 deletion(-) >> > >> > diff --git a/mm/page_reporting.c b/mm/page_reporting.c >> > index 3bbd471cfc81..3605123d 100644 >> > --- a/mm/page_reporting.c >> > +++ b/mm/page_reporting.c >> > @@ -178,7 +178,7 @@ page_reporting_cycle(struct page_reporting_dev_info >> > *prdev, struct zone *zone, >> > * the new head of the free list before we release the >> > * zone lock. >> > */ >> > - if (>lru != list && !list_is_first(>lru, list)) >> > + if (!list_is_first(>lru, list)) >> >list_rotate_to_front(>lru, list); >> >/* release lock before waiting on report processing */ >> > >> >> Is this a fix or a cleanup? If it's a fix, can this be reproduced easily >> and what ere the effects? >> > >This should be a clean-up. Since the >lru != list will always be true. > >If I recall at some point the that was a check for >lru != list but I >think I pulled out an additional conditional check somewhere so that we just >go through the start of the loop again and iterate over reported pages until >we are guaranteed to have a non-reported page to rotate to the top of the >list with the general idea being that we wanted the allocator to pull >non-reported pages before reported pages. Hi, Alexander, I see you mentioned in the changelog, this change "mm/page_reporting: rotate reported pages to the tail of the list" brings some performance gain. Would you mind sharing more test detail? I would like to have a try at my side. Thanks :-) -- Wei Yang Help you, Help me
[PATCH 3/3] libnvdimm/bus: simplify walk_to_nvdimm_bus()
I first want to move dev_WARN_ONCE() after "if (dev)" branch, but further I find the "if (dev)" can only be true when is_nvdimm_bus(dev) successed. No functional change. In fact, the compiler can optimize it correctly. I run "size drivers/nvdimm/bus.o" and find nothing has changed. So it's just source code level optimization, make us can read it faster. Signed-off-by: Zhen Lei --- drivers/nvdimm/bus.c | 7 +++ 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/nvdimm/bus.c b/drivers/nvdimm/bus.c index 955265656b96c73..1d89114cb6ab93e 100644 --- a/drivers/nvdimm/bus.c +++ b/drivers/nvdimm/bus.c @@ -316,10 +316,9 @@ struct nvdimm_bus *walk_to_nvdimm_bus(struct device *nd_dev) for (dev = nd_dev; dev; dev = dev->parent) if (is_nvdimm_bus(dev)) - break; - dev_WARN_ONCE(nd_dev, !dev, "invalid dev, not on nd bus\n"); - if (dev) - return to_nvdimm_bus(dev); + return to_nvdimm_bus(dev); + + dev_WARN_ONCE(nd_dev, 1, "invalid dev, not on nd bus\n"); return NULL; } -- 1.8.3
[PATCH 1/3] libnvdimm: fix memleak in of_pmem.c
The memory priv->bus_desc.provider_name allocated by kstrdup() should be freed. Signed-off-by: Zhen Lei --- drivers/nvdimm/of_pmem.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/nvdimm/of_pmem.c b/drivers/nvdimm/of_pmem.c index 10dbdcdfb9ce913..1292ffca7b2ecc0 100644 --- a/drivers/nvdimm/of_pmem.c +++ b/drivers/nvdimm/of_pmem.c @@ -36,6 +36,7 @@ static int of_pmem_region_probe(struct platform_device *pdev) priv->bus = bus = nvdimm_bus_register(>dev, >bus_desc); if (!bus) { + kfree(priv->bus_desc.provider_name); kfree(priv); return -ENODEV; } @@ -83,6 +84,7 @@ static int of_pmem_region_remove(struct platform_device *pdev) struct of_pmem_private *priv = platform_get_drvdata(pdev); nvdimm_bus_unregister(priv->bus); + kfree(priv->bus_desc.provider_name); kfree(priv); return 0; -- 1.8.3
[PATCH 2/3] libnvdimm: add sanity check for provider_name in of_pmem_region_probe()
kstrdup() may return NULL because of no memory, check it. Signed-off-by: Zhen Lei --- drivers/nvdimm/of_pmem.c | 5 + 1 file changed, 5 insertions(+) diff --git a/drivers/nvdimm/of_pmem.c b/drivers/nvdimm/of_pmem.c index 1292ffca7b2ecc0..13c4c274ca6ea88 100644 --- a/drivers/nvdimm/of_pmem.c +++ b/drivers/nvdimm/of_pmem.c @@ -31,6 +31,11 @@ static int of_pmem_region_probe(struct platform_device *pdev) return -ENOMEM; priv->bus_desc.provider_name = kstrdup(pdev->name, GFP_KERNEL); + if (!priv->bus_desc.provider_name) { + kfree(priv); + return -ENOMEM; + } + priv->bus_desc.module = THIS_MODULE; priv->bus_desc.of_node = np; -- 1.8.3
[PATCH 0/3] bugfix and optimize for drivers/nvdimm
I found a memleak when I learned the drivers/nvdimm code today. And I also added a sanity check for priv->bus_desc.provider_name, because strdup() maybe failed. Patch 3 is a trivial source code optimization. Zhen Lei (3): libnvdimm: fix memleak in of_pmem.c libnvdimm: add sanity check for provider_name in of_pmem_region_probe() libnvdimm/bus: simplify walk_to_nvdimm_bus() drivers/nvdimm/bus.c | 7 +++ drivers/nvdimm/of_pmem.c | 7 +++ 2 files changed, 10 insertions(+), 4 deletions(-) -- 1.8.3
Re: [PATCH v2] scsi: ufs: ti-j721e-ufs: Fix error return in ti_j721e_ufs_probe()
On Thu, 6 Aug 2020 15:01:35 +0800, Jing Xiangfeng wrote: > Fix to return error code PTR_ERR() from the error handling case instead > of 0. Applied to 5.9/scsi-fixes, thanks! [1/1] scsi: ufs: ti-j721e-ufs: Fix error return in ti_j721e_ufs_probe() https://git.kernel.org/mkp/scsi/c/2138d1c91824 -- Martin K. Petersen Oracle Linux Engineering
Re: [PATCH v1] scsi: ufs-mediatek: Fix incorrect time to wait link status
On Sun, 9 Aug 2020 13:57:02 +0800, Stanley Chu wrote: > Fix incorrect calculation of "ms" based waiting time in > function ufs_mtk_setup_clocks(). Applied to 5.9/scsi-fixes, thanks! [1/1] scsi: ufs-mediatek: Fix incorrect time to wait link status https://git.kernel.org/mkp/scsi/c/215d32670251 -- Martin K. Petersen Oracle Linux Engineering
Re: [PATCH] scsi: ufs-pci: Add quirk for broken auto-hibernate for Intel EHL
On Mon, 10 Aug 2020 17:10:24 +0300, Adrian Hunter wrote: > Intel EHL UFS host controller advertises auto-hibernate capability but it > does not work correctly. Add a quirk for that. Applied to 5.9/scsi-fixes, thanks! [1/1] scsi: ufs-pci: Add quirk for broken auto-hibernate for Intel EHL https://git.kernel.org/mkp/scsi/c/8da76f71fef7 -- Martin K. Petersen Oracle Linux Engineering
Re: [PATCH V2 1/2] scsi: ufs: Fix interrupt error message for shared interrupts
On Tue, 11 Aug 2020 16:39:35 +0300, Adrian Hunter wrote: > The interrupt might be shared, in which case it is not an error for the > interrupt handler to be called when the interrupt status is zero, so > don't print the message unless there was enabled interrupt status. Applied to 5.9/scsi-fixes, thanks! [1/2] scsi: ufs: Fix interrupt error message for shared interrupts https://git.kernel.org/mkp/scsi/c/6337f58cec03 [2/2] scsi: ufs: Improve interrupt handling for shared interrupts https://git.kernel.org/mkp/scsi/c/127d5f7c4b65 -- Martin K. Petersen Oracle Linux Engineering
Re: [PATCH v3] scsi: ufs: Fix possible infinite loop in ufshcd_hold
On Sun, 9 Aug 2020 13:07:34 +0800, Stanley Chu wrote: > In ufshcd_suspend(), after clk-gating is suspended and link is set > as Hibern8 state, ufshcd_hold() is still possibly invoked before > ufshcd_suspend() returns. For example, MediaTek's suspend vops may > issue UIC commands which would call ufshcd_hold() during the command > issuing flow. > > Now if UFSHCD_CAP_HIBERN8_WITH_CLK_GATING capability is enabled, > then ufshcd_hold() may enter infinite loops because there is no > clk-ungating work scheduled or pending. In this case, ufshcd_hold() > shall just bypass, and keep the link as Hibern8 state. Applied to 5.9/scsi-fixes, thanks! [1/1] scsi: ufs: Fix possible infinite loop in ufshcd_hold https://git.kernel.org/mkp/scsi/c/93b6c5db0602 -- Martin K. Petersen Oracle Linux Engineering
Lieber Freund (Assalamu Alaikum),?
-- Lieber Freund (Assalamu Alaikum), Ich bin vor einer privaten Suche auf Ihren E-Mail-Kontakt gestoßen Ihre Hilfe. Mein Name ist Aisha Al-Qaddafi, eine alleinerziehende Mutter und eine Witwe mit drei Kindern. Ich bin die einzige leibliche Tochter des Spätlibyschen Präsident (verstorbener Oberst Muammar Gaddafi). Ich habe Investmentfonds im Wert von siebenundzwanzig Millionen fünfhunderttausend United State Dollar ($ 27.500.000.00) und ich brauche eine vertrauenswürdige Investition Manager / Partner aufgrund meines aktuellen Flüchtlingsstatus bin ich jedoch Möglicherweise interessieren Sie sich für die Unterstützung von Investitionsprojekten in Ihrem Land Von dort aus können wir in naher Zukunft Geschäftsbeziehungen aufbauen. Ich bin bereit, mit Ihnen über das Verhältnis zwischen Investition und Unternehmensgewinn zu verhandeln Basis für die zukünftige Investition Gewinne zu erzielen. Wenn Sie bereit sind, dieses Projekt in meinem Namen zu bearbeiten, antworten Sie bitte dringend Damit ich Ihnen mehr Informationen über die Investmentfonds geben kann. Ihre dringende Antwort wird geschätzt. schreibe mir an diese email adresse ( ayishagdda...@mail.ru ) zur weiteren Diskussion. Freundliche Grüße Frau Aisha Al-Qaddafi
Re: [PATCH v2 0/2] scsi: ufs: two fixups of ufshcd_abort()
On Tue, 11 Aug 2020 16:18:57 +0200, Bean Huo wrote: > Changelog: > > v1 - v2: > 1. add patch [1/2], which is from Stanley Chu > 2. change goto command in patch [2/2], let it goto cleanup flow > > Bean Huo (1): > scsi: ufs: no need to send one Abort Task TM in case the task in DB > was cleared > > [...] Applied to 5.9/scsi-fixes, thanks! [1/2] scsi: ufs: Clean up completed request without interrupt notification https://git.kernel.org/mkp/scsi/c/b10178ee7fa8 [2/2] scsi: ufs: No need to send Abort Task if the task in DB was cleared https://git.kernel.org/mkp/scsi/c/d87a1f6d021f -- Martin K. Petersen Oracle Linux Engineering