Re: [RFC PATCH 0/2] mm: fix OOMs for binding workloads to movable zone only node
On Wed 04-11-20 15:38:26, Feng Tang wrote: [...] > > Could you be more specific about the usecase here? Why do you need a > > binding to a pure movable node? > > One common configuration for a platform is small size of DRAM plus huge > size of PMEM (which is slower but cheaper), and my guess of their use > is to try to lead the bulk of user space allocation (GFP_HIGHUSER_MOVABLE) > to PMEM node, and only let DRAM be used as less as possible. While this is possible, it is a tricky configuration. It is essentially get us back to 32b and highmem... As I've said in reply to your second patch. I think we can make the oom killer behavior more sensible in this misconfigured cases but I do not think we want break the cpuset isolation for such a configuration. -- Michal Hocko SUSE Labs
Re: [PATCH v1 1/4] LF-2571-1: dt-bindings: soc: imx8m: add DT Binding doc for soc unique ID
On Wed, 4 Nov 2020 at 04:09, Alice Guo wrote: > > Add DT Binding doc for the Unique ID of i.MX 8M series. > > Signed-off-by: Alice Guo > --- > .../bindings/soc/imx/imx8m-unique-id.yaml | 32 +++ > 1 file changed, 32 insertions(+) > create mode 100644 > Documentation/devicetree/bindings/soc/imx/imx8m-unique-id.yaml > > diff --git a/Documentation/devicetree/bindings/soc/imx/imx8m-unique-id.yaml > b/Documentation/devicetree/bindings/soc/imx/imx8m-unique-id.yaml > new file mode 100644 > index ..f1e45458cec7 > --- /dev/null > +++ b/Documentation/devicetree/bindings/soc/imx/imx8m-unique-id.yaml > @@ -0,0 +1,32 @@ > +# SPDX-License-Identifier: GPL-2.0 > +%YAML 1.2 > +--- > +$id: http://devicetree.org/schemas/arm/nxp/imx8m-unique-id.yaml# > +$schema: http://devicetree.org/meta-schemas/core.yaml# > + > +title: NXP i.MX8M Platforms Device Tree Bindings This is not a title for these bindings. Please describe the bindings for this device. Based on description, this might could go to bindings/nvmem directory. > + > +properties: > + compatible: > +oneOf: No need for oneOf. > + - items: > + - enum: > + - fsl,imx8mm-soc > + - fsl,imx8mn-soc > + - fsl,imx8mp-soc > + - fsl,imx8mq-soc > + - const: simple-bus > + > + nvmem-cells: > +maxItems: 1 > +description: > + Reference to an nvmem node for the SOC Unique ID. Misleading description - nvmem-cells do not contain a reference. Just skip it, nvmem-cells should be obvious from the nvmem provider bindings. > + > + nvmem-cells-names: > +const: soc_unique_id additionalProperties: false Best regards, Krzysztof
Re: [PATCH] powerpc/32s: Setup the early hash table at all time.
Christophe Leroy writes: > To be sure we are not in front of a long lasting bug, could you try > CONFIG_KASAN=y on v5.9 ? Indeed it started to fail somewhere between v5.6 and v5.7. v5.7 fails early with few messages on the console with reboot, v5.8 and later hang right at bootloader. I'm bisecting now.
sound/soc/intel/skylake/skl-topology.c:3642:1: warning: the frame size of 1256 bytes is larger than 1024 bytes
Hi Mateusz, FYI, the error/warning still remains. tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master head: 4ef8451b332662d004df269d4cdeb7d9f31419b5 commit: 2d744ecf2b98405723a2138a547e5c75009bc4e5 ASoC: Intel: Skylake: Automatic DMIC format configuration according to information from NHLT date: 6 months ago config: x86_64-customedconfig-lck8195-cfld1 (attached as .config) compiler: gcc-9 (Debian 9.3.0-15) 9.3.0 reproduce (this is a W=1 build): # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=2d744ecf2b98405723a2138a547e5c75009bc4e5 git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git git fetch --no-tags linus master git checkout 2d744ecf2b98405723a2138a547e5c75009bc4e5 # save the attached .config to linux build tree make W=1 ARCH=x86_64 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot All warnings (new ones prefixed by >>): sound/soc/intel/skylake/skl-topology.c: In function 'skl_tplg_complete': >> sound/soc/intel/skylake/skl-topology.c:3642:1: warning: the frame size of >> 1256 bytes is larger than 1024 bytes [-Wframe-larger-than=] 3642 | } | ^ vim +3642 sound/soc/intel/skylake/skl-topology.c 3612 3613 static void skl_tplg_complete(struct snd_soc_component *component) 3614 { 3615 struct snd_soc_dobj *dobj; 3616 struct snd_soc_acpi_mach *mach = 3617 dev_get_platdata(component->card->dev); 3618 int i; 3619 3620 list_for_each_entry(dobj, >dobj_list, list) { 3621 struct snd_kcontrol *kcontrol = dobj->control.kcontrol; 3622 struct soc_enum *se = 3623 (struct soc_enum *)kcontrol->private_value; 3624 char **texts = dobj->control.dtexts; 3625 char chan_text[4]; 3626 3627 if (dobj->type != SND_SOC_DOBJ_ENUM || 3628 dobj->control.kcontrol->put != 3629 skl_tplg_multi_config_set_dmic) 3630 continue; 3631 sprintf(chan_text, "c%d", mach->mach_params.dmic_num); 3632 3633 for (i = 0; i < se->items; i++) { 3634 struct snd_ctl_elem_value val; 3635 3636 if (strstr(texts[i], chan_text)) { 3637 val.value.enumerated.item[0] = i; 3638 kcontrol->put(kcontrol, ); 3639 } 3640 } 3641 } > 3642 } 3643 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-...@lists.01.org .config.gz Description: application/gzip
Re: [PATCH v1 0/4] change drivers/soc/imx/soc-imx8m.c to use platform driver
On Wed, 4 Nov 2020 at 04:09, Alice Guo wrote: > > Directly reading ocotp register relies on bootloader to enable the ocotp > clock, > which is not always true, so we need to use nvmem API. Using nvmem API means > that driver defer probe needs to be supported. > > Alice Guo (4): > LF-2571-1: dt-bindings: soc: imx8m: add DT Binding doc for soc unique > ID Judging by recipient address, you are sending to Linux kernel. In such case, the subject prefix "LF" is wrong and please use "git log --oneline" to get the list of prefixes for the given subsystem. Best regards, Krzysztof
Re: [PATCH 4.19 146/191] HID: wacom: Avoid entering wacom_wac_pen_report for pad / battery
Hi! > To correct this, we restore a version of the `WACOM_PAD_FIELD` check > in `wacom_wac_collection()` and return early. This effectively prevents > pad / battery collections from being reported until the very end of the > report as originally intended. Okay... but code is either wrong or very confusing: > +++ b/drivers/hid/wacom_wac.c > @@ -2729,7 +2729,9 @@ static int wacom_wac_collection(struct h > if (report->type != HID_INPUT_REPORT) > return -1; > > - if (WACOM_PEN_FIELD(field) && wacom->wacom_wac.pen_input) > + if (WACOM_PAD_FIELD(field)) > + return 0; > + else if (WACOM_PEN_FIELD(field) && wacom->wacom_wac.pen_input) > wacom_wac_pen_report(hdev, report); wacom_wac_pen_report() can never be called, because WACOM_PEN_FIELD() can not be true here; if it was we'd return in the line above. Best regards, Pavel -- http://www.livejournal.com/~pavelmachek signature.asc Description: Digital signature
[PATCH] binfmt_elf: simplify error handling in load_elf_phdrs()
Signed-off-by: Rolf Eike Beer --- fs/binfmt_elf.c | 10 ++ 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c index b588d1291b25..74827a7a06d0 100644 --- a/fs/binfmt_elf.c +++ b/fs/binfmt_elf.c @@ -458,7 +458,7 @@ static struct elf_phdr *load_elf_phdrs(const struct elfhdr *elf_ex, struct file *elf_file) { struct elf_phdr *elf_phdata = NULL; - int retval, err = -1; + int retval = -1; unsigned int size; /* @@ -480,15 +480,9 @@ static struct elf_phdr *load_elf_phdrs(const struct elfhdr *elf_ex, /* Read in the program headers */ retval = elf_read(elf_file, elf_phdata, size, elf_ex->e_phoff); - if (retval < 0) { - err = retval; - goto out; - } - /* Success! */ - err = 0; out: - if (err) { + if (retval) { kfree(elf_phdata); elf_phdata = NULL; } -- 2.29.1 -- Rolf Eike Beer, emlix GmbH, http://www.emlix.com Fon +49 551 30664-0, Fax +49 551 30664-11 Gothaer Platz 3, 37083 Göttingen, Germany Sitz der Gesellschaft: Göttingen, Amtsgericht Göttingen HR B 3160 Geschäftsführung: Heike Jordan, Dr. Uwe Kracke – Ust-IdNr.: DE 205 198 055 emlix - smart embedded open source
fix typos in "compress" variants
Signed-off-by: Rolf Eike Beer --- arch/x86/kernel/head64.c | 2 +- fs/f2fs/data.c | 2 +- scripts/kallsyms.c | 2 +- scripts/spelling.txt | 3 +++ 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/arch/x86/kernel/head64.c b/arch/x86/kernel/head64.c index 05e117137b45..a18a11acad92 100644 --- a/arch/x86/kernel/head64.c +++ b/arch/x86/kernel/head64.c @@ -105,7 +105,7 @@ static unsigned int __head *fixup_int(void *ptr, unsigned long physaddr) static bool __head check_la57_support(unsigned long physaddr) { /* -* 5-level paging is detected and enabled at kernel decomression +* 5-level paging is detected and enabled at kernel decompression * stage. Only check if it has been enabled there. */ if (!(native_read_cr4() & X86_CR4_LA57)) diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index be4da52604ed..93c23ae5723d 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -2377,7 +2377,7 @@ static int f2fs_mpage_readpages(struct inode *inode, #ifdef CONFIG_F2FS_FS_COMPRESSION if (f2fs_compressed_file(inode)) { - /* there are remained comressed pages, submit them */ + /* there are remained compressed pages, submit them */ if (!f2fs_cluster_can_merge_page(, page->index)) { ret = f2fs_read_multi_pages(, , max_nr_pages, diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c index 7ecd2ccba531..623dedecd8e3 100644 --- a/scripts/kallsyms.c +++ b/scripts/kallsyms.c @@ -12,7 +12,7 @@ * map char code 0xF7 to represent "write_" and then in every symbol where * "write_" appears it can be replaced by 0xF7, saving 5 bytes. * The used codes themselves are also placed in the table so that the - * decompresion can work without "special cases". + * decompression can work without "special cases". * Applied to kernel symbols, this usually produces a compression ratio * of about 50%. * diff --git a/scripts/spelling.txt b/scripts/spelling.txt index 953f4a2de1e5..061e15201739 100644 --- a/scripts/spelling.txt +++ b/scripts/spelling.txt @@ -338,6 +338,7 @@ compoment||component comppatible||compatible compres||compress compresion||compression +comressed||compressed comression||compression comunication||communication conbination||combination @@ -406,6 +407,8 @@ debouce||debounce decendant||descendant decendants||descendants decompres||decompress +decompresion||decompression +decomression||decompression decsribed||described decription||description dectected||detected -- 2.29.1 -- Rolf Eike Beer, emlix GmbH, http://www.emlix.com Fon +49 551 30664-0, Fax +49 551 30664-11 Gothaer Platz 3, 37083 Göttingen, Germany Sitz der Gesellschaft: Göttingen, Amtsgericht Göttingen HR B 3160 Geschäftsführung: Heike Jordan, Dr. Uwe Kracke – Ust-IdNr.: DE 205 198 055 emlix - smart embedded open source
Re: [PATCH 0/3] Add support to handle prefetchable memory
Lorenzo / Bjorn, Could you please review patches-1 & 2 in this series? For the third patch, we already went with Rob's patch @ http://patchwork.ozlabs.org/project/linux-pci/patch/20201026154852.221483-1-r...@kernel.org/ Thanks, Vidya Sagar On 10/26/2020 6:02 PM, Thierry Reding wrote: On Sat, Oct 24, 2020 at 04:03:41AM +, Jingoo Han wrote: On 10/23/20, 3:57 PM, Vidya Sagar wrote: This patch series adds support for configuring the DesignWare IP's ATU region for prefetchable memory translations. It first starts by flagging a warning if the size of non-prefetchable aperture goes beyond 32-bit as PCIe spec doesn't allow it. And then adds required support for programming the ATU to handle higher (i.e. >4GB) sizes and then finally adds support for differentiating between prefetchable and non-prefetchable regions and configuring one of the ATU regions for prefetchable memory translations purpose. Vidya Sagar (3): PCI: of: Warn if non-prefetchable memory aperture size is > 32-bit PCI: dwc: Add support to program ATU for >4GB memory aperture sizes PCI: dwc: Add support to handle prefetchable memory mapping For 2nd & 3rd, Acked-by: Jingoo But, I still want someone to ack 1st patch, not me. To Vidya, If possible, can you ask your coworker to give 'Tested-by'? It will be very helpful. Thank you. On next-20201026 (but also going back quite a while) I'm seeing this during boot on Jetson AGX Xavier (Tegra194): [3.493382] ahci 0001:01:00.0: version 3.0 [3.493889] ahci 0001:01:00.0: SSS flag set, parallel bus scan disabled [4.497706] ahci 0001:01:00.0: controller reset failed (0x) [4.498114] ahci: probe of 0001:01:00.0 failed with error -5 After applying this series, AHCI over PCI is back to normal: [3.543230] ahci 0001:01:00.0: AHCI 0001. 32 slots 1 ports 6 Gbps 0x1 impl SATA mode [3.550841] ahci 0001:01:00.0: flags: 64bit ncq sntf led only pmp fbs pio slum part sxs [3.559747] scsi host0: ahci [3.561998] ata1: SATA max UDMA/133 abar m512@0x123001 port 0x1230010100 irq 63 So for the series: Tested-by: Thierry Reding
Re: BUG_ON(!newowner) in fixup_pi_state_owner()
On Wed, 2020-11-04 at 01:56 +0100, Mike Galbraith wrote: > On Tue, 2020-11-03 at 17:31 -0600, Gratian Crisan wrote: > > Hi all, > > > > I apologize for waking up the futex demons (and replying to my own > > email), but ... > > > > Gratian Crisan writes: > > > > > > Brandon and I have been debugging a nasty race that leads to > > > BUG_ON(!newowner) in fixup_pi_state_owner() in futex.c. So far > > > we've only been able to reproduce the issue on 4.9.y-rt kernels. > > > We are still testing if this is a problem for later RT branches. > > > > I was able to reproduce the BUG_ON(!newowner) in fixup_pi_state_owner() > > with a 5.10.0-rc1-rt1 kernel (currently testing 5.10.0-rc2-rt4). > > My box says it's generic. --- kernel/futex.c | 13 - 1 file changed, 12 insertions(+), 1 deletion(-) --- a/kernel/futex.c +++ b/kernel/futex.c @@ -2383,7 +2383,18 @@ static int fixup_pi_state_owner(u32 __us * Since we just failed the trylock; there must be an owner. */ newowner = rt_mutex_owner(_state->pi_mutex); - BUG_ON(!newowner); + + /* +* Why? Because I know what I'm doing with these beasts? Nope, +* but what the hell, a busy restart loop let f_boosted become +* owner, so go for it. Box still boots, works, no longer makes +* boom with fbomb_v2, and as an added bonus, didn't even blow +* futextests all up. Maybe it'll help... or not, we'll see. +*/ + if (unlikely(!newowner)) { + err = -EAGAIN; + goto handle_err; + } } else { WARN_ON_ONCE(argowner != current); if (oldowner == current) {
Re: [PATCH 5.9 000/391] 5.9.4-rc1 review
On Wed, 4 Nov 2020 at 12:42, Naresh Kamboju wrote: > > On Wed, 4 Nov 2020 at 02:07, Greg Kroah-Hartman > wrote: > > > > This is the start of the stable review cycle for the 5.9.4 release. > > There are 391 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 Thu, 05 Nov 2020 20:29:58 +. > > 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.9.4-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.9.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. > > Tested-by: Linux Kernel Functional Testing > > NOTE: > The kernel warning noticed on arm64 nxp ls2088 device with KASAN config > enabled while booting the device. We are not considering this as regression > because this is the first arm64 KASAN config enabled on nxp ls2088 device. > > [3.301882] dwc3 310.usb3: Failed to get clk 'ref': -2 > [3.307433] [ cut here ] > [3.312048] dwc3 310.usb3: request value same as default, ignoring > [3.318596] WARNING: CPU: 3 PID: 1 at > /home/jenkins/ci/lsdk/master/all/packages/linux/linux/drivers/usb/dwc3/core.c:347 > dwc3_core_init+0xd14/0xd70 Please ignore this warning that this is coming from stable rc 4.19. - Naresh
Re: [RFC PATCH 0/2] mm: fix OOMs for binding workloads to movable zone only node
Hi Michal, Thanks for the prompt review! On Wed, Nov 04, 2020 at 08:13:08AM +0100, Michal Hocko wrote: > On Wed 04-11-20 14:10:08, Feng Tang wrote: > > Hi, > > > > This patchset tries to report a problem and get suggestion/review > > for the RFC fix patches. > > > > We recently got a OOM report, that when user try to bind a docker(container) > > instance to a memory node which only has movable zones, and OOM killing > > still can't solve the page allocation failure. > > This is a cpuset node binding right? Yes. A simple test command is 'docker run -it --cpuset-mems 3 ubuntu:latest' while the node 3 is a movable only PMEM node. > > The callstack was: > > > > [ 1387.877565] runc:[2:INIT] invoked oom-killer: > > gfp_mask=0x500cc2(GFP_HIGHUSER|__GFP_ACCOUNT), order=0, oom_score_adj=0 > > [ 1387.877568] CPU: 8 PID: 8291 Comm: runc:[2:INIT] Tainted: GW > > I E 5.8.2-0.g71b519a-default #1 openSUSE Tumbleweed (unreleased) > > [ 1387.877569] Hardware name: Dell Inc. PowerEdge R640/0PHYDR, BIOS > > 2.6.4 04/09/2020 > > [ 1387.877570] Call Trace: > > [ 1387.877579] dump_stack+0x6b/0x88 > > [ 1387.877584] dump_header+0x4a/0x1e2 > > [ 1387.877586] oom_kill_process.cold+0xb/0x10 > > [ 1387.877588] out_of_memory.part.0+0xaf/0x230 > > [ 1387.877591] out_of_memory+0x3d/0x80 > > [ 1387.877595] __alloc_pages_slowpath.constprop.0+0x954/0xa20 > > [ 1387.877599] __alloc_pages_nodemask+0x2d3/0x300 > > [ 1387.877602] pipe_write+0x322/0x590 > > [ 1387.877607] new_sync_write+0x196/0x1b0 > > [ 1387.877609] vfs_write+0x1c3/0x1f0 > > [ 1387.877611] ksys_write+0xa7/0xe0 > > [ 1387.877617] do_syscall_64+0x52/0xd0 > > [ 1387.877621] entry_SYSCALL_64_after_hwframe+0x44/0xa9 > > > > The meminfo log only shows the movable only node, which has plenty > > of free memory. And in our reproducing with 1/2 patch, the normal > > node (has DMA/DMA32/Normal) also has lot of free memory when OOM > > happens. > > OK, so you are bidning to a movable node only and your above request is > for GFP_HIGHUSER which _cannot_ be satisfied from the movable zones > because that memory is not movable. So the system behaves as expected. > Your cpuset is misconfigured IMHO. Movable only nodes come with their > risk and configuration price. Aha, this is what we told the reporter at first. Their platform is 2S platform, and each socket has one DRAM node + one persistent memory node, and we suggested to bind the docker to one DRAM + one PMEM node. > > If we hack to make this (GFP_HIGHUSER|__GFP_ACCOUNT) request get > > a page, and following full docker run (like installing and running > > 'stress-ng' stress test) will see more allocation failures due to > > different kinds of request(gfp_masks). And the 2/2 patch will detect > > such cases that the allowed target nodes only have movable zones > > and loose the binding check, otherwise it will trigger OOM while > > the OOM won't do any help, as the problem is not lack of free memory. > > Well, this breaks the cpuset containment, right? I consider this quite > unexpected for something that looks like a misconfiguration. I do agree > that this is unexpected for anybody who is not really familiar with > concept of movable zone but we should probably call out all these > details rather than tweak the existing semantic. Yes, it does break the cpuset containment > Could you be more specific about the usecase here? Why do you need a > binding to a pure movable node? One common configuration for a platform is small size of DRAM plus huge size of PMEM (which is slower but cheaper), and my guess of their use is to try to lead the bulk of user space allocation (GFP_HIGHUSER_MOVABLE) to PMEM node, and only let DRAM be used as less as possible. Thanks, Feng > -- > Michal Hocko > SUSE Labs
[git pull] habanalabs fixes for 5.10-rc3
Hello Greg, This pull request contains three small fixes for 5.10-rc3. Details are in the tag. Thanks, Oded The following changes since commit bcbc0b2e275f0a797de11a10eff495b4571863fc: mei: protect mei_cl_mtu from null dereference (2020-11-03 10:13:48 +0100) are available in the Git repository at: ssh://g...@gitolite.kernel.org/pub/scm/linux/kernel/git/ogabbay/linux.git tags/misc-habanalabs-fixes-2020-11-04 for you to fetch changes up to f83f3a31b2972ddc907fbb286c6446dd9db6e198: habanalabs/gaudi: mask WDT error in QMAN (2020-11-04 08:56:07 +0200) This tag contains the following fixes: - Fix the kernel pointer type we are using across the driver to prevent compiler warnings (from u64 to void*) - Configure GAUDI's MMU coresight component in the correct location. The current code had a bug where the configuration was not executed in some cases - Mask watchdog timeout errors in QMANs which can spam the kernel log Arnd Bergmann (1): habanalabs: fix kernel pointer type Oded Gabbay (1): habanalabs/gaudi: mask WDT error in QMAN Ofir Bitton (1): habanalabs/gaudi: move coresight mmu config drivers/misc/habanalabs/common/command_buffer.c| 9 +++-- drivers/misc/habanalabs/common/habanalabs.h| 14 drivers/misc/habanalabs/common/hw_queue.c | 19 +-- drivers/misc/habanalabs/common/irq.c | 17 +- drivers/misc/habanalabs/gaudi/gaudi.c | 38 +- drivers/misc/habanalabs/gaudi/gaudiP.h | 1 + drivers/misc/habanalabs/gaudi/gaudi_coresight.c| 5 +++ drivers/misc/habanalabs/goya/goya.c| 26 +++ drivers/misc/habanalabs/goya/goyaP.h | 2 +- .../misc/habanalabs/include/gaudi/gaudi_masks.h| 1 - 10 files changed, 62 insertions(+), 70 deletions(-)
Re: Re: [PATCH v13 2/8] mtd: rawnand: rockchip: NFC drivers for RK3308, RK2928 and others
Hi Johan, On 2020/10/31 19:58, Johan Jonker wrote: >Hi Yifeng, ... >> + >> +static int rk_nfc_read_page_hwecc(struct nand_chip *chip, u8 *buf, int >> oob_on, >> + int page) >> +{ >> +struct mtd_info *mtd = nand_to_mtd(chip); >> +struct rk_nfc *nfc = nand_get_controller_data(chip); >> +struct rk_nfc_nand_chip *rknand = rk_nfc_to_rknand(chip); >> +struct nand_ecc_ctrl *ecc = >ecc; >> +int oob_step = (ecc->bytes > 60) ? NFC_MAX_OOB_PER_STEP : >> +NFC_MIN_OOB_PER_STEP; >> +int pages_per_blk = mtd->erasesize / mtd->writesize; >> +dma_addr_t dma_data, dma_oob; > >> +int ret = 0, i, boot_rom_mode = 0; > > int ret = 0, i, cnt, boot_rom_mode = 0; > >> +int bitflips = 0, bch_st; >> +u8 *oob; >> +u32 tmp; >> + >> +nand_read_page_op(chip, page, 0, NULL, 0); >> + >> +dma_data = dma_map_single(nfc->dev, nfc->page_buf, >> + mtd->writesize, >> + DMA_FROM_DEVICE); >> +dma_oob = dma_map_single(nfc->dev, nfc->oob_buf, >> +ecc->steps * oob_step, >> +DMA_FROM_DEVICE); >> + >> +/* >> +* The first blocks (4, 8 or 16 depending on the device) >> +* are used by the boot ROM. >> +* Configure the ECC algorithm supported by the boot ROM. >> +*/ > >> +if ((page < pages_per_blk * rknand->boot_blks) && > >> +if ((page < (pages_per_blk * rknand->boot_blks)) && > >> + (chip->options & NAND_IS_BOOT_MEDIUM)) { >> +boot_rom_mode = 1; >> +if (rknand->boot_ecc != ecc->strength) >> +rk_nfc_hw_ecc_setup(chip, ecc, >> + rknand->boot_ecc); >> +} >> + >> +reinit_completion(>done); >> +writel(INT_DMA, nfc->regs + nfc->cfg->int_en_off); >> +rk_nfc_xfer_start(nfc, NFC_READ, ecc->steps, dma_data, >> + dma_oob); >> +ret = wait_for_completion_timeout(>done, >> + msecs_to_jiffies(100)); >> +if (!ret) >> +dev_warn(nfc->dev, "read: wait dma done timeout.\n"); >> +/* >> +* Whether the DMA transfer is completed or not. The driver >> +* needs to check the NFC`s status register to see if the data >> +* transfer was completed. >> +*/ >> +ret = rk_nfc_wait_for_xfer_done(nfc); > >add empty line > >> +dma_unmap_single(nfc->dev, dma_data, mtd->writesize, >> +DMA_FROM_DEVICE); >> +dma_unmap_single(nfc->dev, dma_oob, ecc->steps * oob_step, >> +DMA_FROM_DEVICE); >> + >> +if (ret) { > >> +bitflips = -EIO; > > ret = -EIO; > >return only "0" or official error codes > >> +dev_err(nfc->dev, >> +"read: wait transfer done timeout.\n"); >> +goto out; >> +} >> + >> +for (i = 1; i < ecc->steps; i++) { >> +oob = chip->oob_poi + (i - 1) * NFC_SYS_DATA_SIZE; >> +if (nfc->cfg->type == NFC_V9) >> +tmp = nfc->oob_buf[i]; >> +else >> +tmp = nfc->oob_buf[i * (oob_step / 4)]; >> +*oob++ = (u8)tmp; >> +*oob++ = (u8)(tmp >> 8); >> +*oob++ = (u8)(tmp >> 16); >> +*oob++ = (u8)(tmp >> 24); >> +} >> + >> +for (i = 0; i < (ecc->steps / 2); i++) { >> +bch_st = readl_relaxed(nfc->regs + >> + nfc->cfg->bch_st_off + i * 4); >> +if (bch_st & BIT(nfc->cfg->ecc0.err_flag_bit) || >> + bch_st & BIT(nfc->cfg->ecc1.err_flag_bit)) { >> +mtd->ecc_stats.failed++; > >> +bitflips = 0; > >max_bitflips = -1; > >use max_bitflips only for the error warning, not as return value > >> +} else { > >> +ret = ECC_ERR_CNT(bch_st, nfc->cfg->ecc0); > >use ret only with "0" or official error codes, use cnt instead > > cnt = ECC_ERR_CNT(bch_st, nfc->cfg->ecc0); > >> +mtd->ecc_stats.corrected += ret; > mtd->ecc_stats.corrected += cnt; > >> +bitflips = max_t(u32, bitflips, ret); > > bitflips = max_t(u32, bitflips, cnt); > >> + >> +ret = ECC_ERR_CNT(bch_st, nfc->cfg->ecc1); > > cnt = ECC_ERR_CNT(bch_st, nfc->cfg->ecc1); > >> +mtd->ecc_stats.corrected += ret; > > mtd->ecc_stats.corrected += cnt; > >> +bitflips = max_t(u32, bitflips, ret); > > bitflips = max_t(u32, bitflips, cnt); >> +} >> +} >> +out: >> +memcpy(buf, nfc->page_buf, mtd->writesize); >> + > >> +if (boot_rom_mode && rknand->boot_ecc != ecc->strength) >> +rk_nfc_hw_ecc_setup(chip, ecc, ecc->strength); >> + > >> +if (bitflips > ecc->strength) > > if (bitflips == -1) { > ret = -EIO; > >> +dev_err(nfc->dev, "read page: %x ecc error!\n", page); > >} It cannot return - EIO while ECC fail, refer to the function nand_do_read_ops, maybe need do read_retry while ECC fail. I think return 0 is better while ecc fail,as suggested by Miquel. In other cases, return the actual ECC error bit, because the file system(such as ubifs) needs to know whether the data is reliable or needs to be refreshed (-EUCLEAN). int mtd_read_oob(struct mtd_info *mtd, loff_t from, struct mtd_oob_ops *ops) { ... return ret_code >= mtd->bitflip_threshold ? -EUCLEAN : 0; } >> + >> +/* >> +* Deselect the currently selected target after the ops is done >> +
Re: Re: [PATCH v13 2/8] mtd: rawnand: rockchip: NFC drivers for RK3308, RK2928 and others
On 2020/11/3 1:11, Johan Jonker wrote: >On 11/2/20 6:00 PM, Miquel Raynal wrote: >> Hi Johan, >> >> Johan Jonker wrote on Mon, 2 Nov 2020 17:31:18 >> +0100: >> >>> On 11/2/20 2:11 PM, Johan Jonker wrote: Hi, On 11/2/20 2:07 PM, Miquel Raynal wrote: > Hi Johan, Yifeng > > Johan Jonker wrote on Mon, 2 Nov 2020 13:57:56 > +0100: > >> Hi Yifeng, >> >> Don't poke with "ecc->bytes" ones it is set in rk_nfc_ecc_init(). It >> will not be noted by the MTD frame work or userspace. I think there's >> currently no way to let the user know that a different ECC must be used. >> Neither can the user set ECC on the fly. >> >> Example R/W flow: >> >> nand_select_target() >> chip->ecc.write_page_raw() >> chip->ecc.write_page() >> >> [..] >> >> chip->ecc.read_page_raw() >> chip->ecc.read_page() >> nand_deselect_target() >> >> A write/read with: >> >> rk_nfc_read_page_hwecc() >> rk_nfc_write_page_hwecc() >> >> or >> >> rk_nfc_read_page_raw() >> rk_nfc_write_page_raw() >> >> must end up with the same result. If we can't archive that, then we >> shouldn't offer RAW mode to the user for now. If Miquel agrees you >> should just get the driver ready now without these 2 functions and round >> things up. > > What about just not supporting the BootROM area if it was marked > "reserved" by the BRom in the DT? Should we just fill the buffers with '0xff' for boot blocks? >>> >>> (part 2) ;) >>> My fault >>> Better use: >>> >>> if ((chip->options & NAND_IS_BOOT_MEDIUM) && >>> (page < (pages_per_blk * rknand->boot_blks))) { >>> >>> return -EIO; >>> >>> } >> >> Yup, I was about to tell you that I would prefer returning a nice >> error, this is fine I guess. >> >> Anyway, I think reading bad block markers is done in raw mode, so if >> raw accessors refuse to return valid values for boot blocks, you won't >> be able to access it neither with raw nor corrected hooks. >> >> Perhaps refusing the access to the regular page access is ok, but maybe >> we should be able to at least read these pages in raw mode >> (and move the BBM to its right location). What do you think? > >I think that the problem with asymmetric read and write access is that a >user reads data successful, but that it can't write it back after it's >block is erased. You shouldn't give the illusion that the boot ROM >blocks can be accessed in RAW mode. Something with perception...does >user space known that Rockchip's NFC is special... > > Is it possible to return a error when the ECC is different between the boot ROM blocks and other blocks? If the ECC is the same, and the OOB layout is the same and does not need special treatment. static int rk_nfc_read_page_raw(struct nand_chip *chip, u8 *buf, int oob_on,int page) { ... if ((chip->options & NAND_IS_BOOT_MEDIUM) && (page < (pages_per_blk * rknand->boot_blks)) && (rknand->boot_ecc != ecc->strength)) { return -EIO; } ... } About the BBM, the u-boot will create BBT at the first power up. chip->bbt_options = NAND_BBT_USE_FLASH | NAND_BBT_NO_OOB; If uboot does not create BBT, then the framework will scan the OOB of all blocks and create it. I modified the read OOB function (enable ECC) ,and it can read the correct bad block mask. static int rk_nfc_write_oob(struct nand_chip *chip, int page) { return rk_nfc_write_page_hwecc(chip, NULL, 1, page); } static int rk_nfc_read_oob(struct nand_chip *chip, int page) { return rk_nfc_read_page_hwecc(chip, NULL, 1, page); } chip->ecc.read_oob = rk_nfc_read_oob; chip->ecc.write_oob = rk_nfc_write_oob; >> >> Thanks, >> Miquèl >> >>> >>> > > Raw accessors is really a nice and basic feature that I would like to > have in every new driver. > > Thanks, > Miquèl > >>> > > > >
Re: [PATCH v4 3/3,RESEND 2] KEYS: trusted: Reserve TPM for seal and unseal operations
Hi Jarkko, On Wed, 4 Nov 2020 at 06:49, Jarkko Sakkinen wrote: > > When TPM 2.0 trusted keys code was moved to the trusted keys subsystem, > the operations were unwrapped from tpm_try_get_ops() and tpm_put_ops(), > which are used to take temporarily the ownership of the TPM chip. The > ownership is only taken inside tpm_send(), but this is not sufficient, > as in the key load TPM2_CC_LOAD, TPM2_CC_UNSEAL and TPM2_FLUSH_CONTEXT > need to be done as a one single atom. > > Fix this issue by introducting trusted_tpm_load() and trusted_tpm_new(), > which wrap these operations, and take the TPM chip ownership before > sending anything. I am not sure if we really need these new APIs in order to fix this issue, see below. > Use tpm_transmit_cmd() to send TPM commands instead > of tpm_send(), reverting back to the old behaviour. > > Fixes: 2e19e10131a0 ("KEYS: trusted: Move TPM2 trusted keys code") > Reported-by: "James E.J. Bottomley" > Cc: sta...@vger.kernel.org > Cc: David Howells > Cc: Mimi Zohar > Cc: Sumit Garg > Signed-off-by: Jarkko Sakkinen > Reported-by: kernel test robot > --- > drivers/char/tpm/tpm.h| 4 -- > include/linux/tpm.h | 5 +- > security/keys/trusted-keys/trusted_tpm1.c | 78 +++ > security/keys/trusted-keys/trusted_tpm2.c | 6 +- > 4 files changed, 60 insertions(+), 33 deletions(-) > > diff --git a/drivers/char/tpm/tpm.h b/drivers/char/tpm/tpm.h > index 947d1db0a5cc..283f78211c3a 100644 > --- a/drivers/char/tpm/tpm.h > +++ b/drivers/char/tpm/tpm.h > @@ -164,8 +164,6 @@ extern const struct file_operations tpmrm_fops; > extern struct idr dev_nums_idr; > > ssize_t tpm_transmit(struct tpm_chip *chip, u8 *buf, size_t bufsiz); > -ssize_t tpm_transmit_cmd(struct tpm_chip *chip, struct tpm_buf *buf, > -size_t min_rsp_body_length, const char *desc); > int tpm_get_timeouts(struct tpm_chip *); > int tpm_auto_startup(struct tpm_chip *chip); > > @@ -194,8 +192,6 @@ static inline void tpm_msleep(unsigned int delay_msec) > int tpm_chip_start(struct tpm_chip *chip); > void tpm_chip_stop(struct tpm_chip *chip); > struct tpm_chip *tpm_find_get_ops(struct tpm_chip *chip); > -__must_check int tpm_try_get_ops(struct tpm_chip *chip); > -void tpm_put_ops(struct tpm_chip *chip); > > struct tpm_chip *tpm_chip_alloc(struct device *dev, > const struct tpm_class_ops *ops); > diff --git a/include/linux/tpm.h b/include/linux/tpm.h > index 8f4ff39f51e7..804a3f69bbd9 100644 > --- a/include/linux/tpm.h > +++ b/include/linux/tpm.h > @@ -397,6 +397,10 @@ static inline u32 tpm2_rc_value(u32 rc) > #if defined(CONFIG_TCG_TPM) || defined(CONFIG_TCG_TPM_MODULE) > > extern int tpm_is_tpm2(struct tpm_chip *chip); > +extern __must_check int tpm_try_get_ops(struct tpm_chip *chip); > +extern void tpm_put_ops(struct tpm_chip *chip); > +extern ssize_t tpm_transmit_cmd(struct tpm_chip *chip, struct tpm_buf *buf, > + size_t min_rsp_body_length, const char *desc); > extern int tpm_pcr_read(struct tpm_chip *chip, u32 pcr_idx, > struct tpm_digest *digest); > extern int tpm_pcr_extend(struct tpm_chip *chip, u32 pcr_idx, > @@ -410,7 +414,6 @@ static inline int tpm_is_tpm2(struct tpm_chip *chip) > { > return -ENODEV; > } > - > static inline int tpm_pcr_read(struct tpm_chip *chip, int pcr_idx, >struct tpm_digest *digest) > { > diff --git a/security/keys/trusted-keys/trusted_tpm1.c > b/security/keys/trusted-keys/trusted_tpm1.c > index 7a937c3c5283..20ca18e17437 100644 > --- a/security/keys/trusted-keys/trusted_tpm1.c > +++ b/security/keys/trusted-keys/trusted_tpm1.c > @@ -950,6 +950,51 @@ static struct trusted_key_payload > *trusted_payload_alloc(struct key *key) > return p; > } > > +static int trusted_tpm_load(struct tpm_chip *chip, > + struct trusted_key_payload *payload, > + struct trusted_key_options *options) > +{ > + int ret; > + > + if (tpm_is_tpm2(chip)) { > + ret = tpm_try_get_ops(chip); Can't we move this TPM 2.0 specific operation within tpm2_unseal_trusted() instead? > + if (!ret) { > + ret = tpm2_unseal_trusted(chip, payload, options); > + tpm_put_ops(chip); Ditto. > + } > + } else { > + ret = key_unseal(payload, options); > + } > + > + return ret; > +} > + > +static int trusted_tpm_new(struct tpm_chip *chip, > + struct trusted_key_payload *payload, > + struct trusted_key_options *options) > +{ > + int ret; > + > + ret = tpm_get_random(chip, payload->key, payload->key_len); > + if (ret < 0) > + return ret; > + > + if (ret != payload->key_len) > + return -EIO; > + > + if (tpm_is_tpm2(chip)) { > +
Re: Linux 4.19.153
Hi! > I'll go do a new 4.19 release with the rest of the patches missed here, > thank you for finding this. You are welcome :-). Best regards, Pavel -- http://www.livejournal.com/~pavelmachek signature.asc Description: Digital signature
Re: [PATCH 4.19 000/191] 4.19.155-rc1 review
Hi! > This is the start of the stable review cycle for the 4.19.155 release. > There are 191 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 Thu, 05 Nov 2020 20:29:58 +. > Anything received after that time might be too late. No errors detected in CIP testing: https://gitlab.com/cip-project/cip-testing/linux-stable-rc-ci/-/tree/linux-4.19.y Tested-by: Pavel Machek (CIP) Best regards, Pavel -- DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany signature.asc Description: Digital signature
Re: [RFC PATCH 2/2] mm, page_alloc: loose the node binding check to avoid helpless oom killing
On Wed 04-11-20 14:10:10, Feng Tang wrote: > With the incoming of memory hotplug feature and persitent memory, in > some platform there are memory nodes which only have movable zone. > > Users may bind some of their workload(like docker/container) to > these nodes, and there are many reports of OOM and page allocation > failures, one callstack is: > > [ 1387.877565] runc:[2:INIT] invoked oom-killer: > gfp_mask=0x500cc2(GFP_HIGHUSER|__GFP_ACCOUNT), order=0, oom_score_adj=0 > [ 1387.877568] CPU: 8 PID: 8291 Comm: runc:[2:INIT] Tainted: GW > I E 5.8.2-0.g71b519a-default #1 openSUSE Tumbleweed (unreleased) > [ 1387.877569] Hardware name: Dell Inc. PowerEdge R640/0PHYDR, BIOS > 2.6.4 04/09/2020 > [ 1387.877570] Call Trace: > [ 1387.877579] dump_stack+0x6b/0x88 > [ 1387.877584] dump_header+0x4a/0x1e2 > [ 1387.877586] oom_kill_process.cold+0xb/0x10 > [ 1387.877588] out_of_memory.part.0+0xaf/0x230 > [ 1387.877591] out_of_memory+0x3d/0x80 > [ 1387.877595] __alloc_pages_slowpath.constprop.0+0x954/0xa20 > [ 1387.877599] __alloc_pages_nodemask+0x2d3/0x300 > [ 1387.877602] pipe_write+0x322/0x590 > [ 1387.877607] new_sync_write+0x196/0x1b0 > [ 1387.877609] vfs_write+0x1c3/0x1f0 > [ 1387.877611] ksys_write+0xa7/0xe0 > [ 1387.877617] do_syscall_64+0x52/0xd0 > [ 1387.877621] entry_SYSCALL_64_after_hwframe+0x44/0xa9 > > In a full container run, like installing and running the stress tool > "stress-ng", there are many different kinds of page requests (gfp_masks), > many of which only allow non-movable zones. Some of them can fall back > to other nodes with NORMAL/DMA32/DMA zones, but others are blocked by > the __GFP_HARDWALL or ALLOC_CPUSET check, and cause OOM killing. But > OOM killing won't do any help here, as this is not an issue of lack of > free memory, but simply blocked by the node binding policy check. > > So loose the policy check for this case. This allows to spill memory allocations over to any other node which has Normal (or other lower) zones and as such it breaks cpuset isolation. As I've pointed out in the reply to your cover letter it seems that this is more of a misconfiguration than a bug. I do understand that killing any other task which can allocate from this node is quite goofy and that is something we can detect and better target. E.g. fail the allocation or kill the allocating context when the allocation request cannot be satisfied by no means. But breaking the node isolation which is a user contract sounds like a bad workaround. Binding to a movable node(s) without any other fallback is simply something you shouldn't do. > Signed-off-by: Feng Tang > --- > mm/page_alloc.c | 22 ++ > 1 file changed, 22 insertions(+) > > diff --git a/mm/page_alloc.c b/mm/page_alloc.c > index d772206..efd49a9 100644 > --- a/mm/page_alloc.c > +++ b/mm/page_alloc.c > @@ -4669,6 +4669,28 @@ __alloc_pages_slowpath(gfp_t gfp_mask, unsigned int > order, > if (!ac->preferred_zoneref->zone) > goto nopage; > > + /* > + * If the task's target memory nodes only has movable zones, while the > + * gfp_mask allowed zone is lower than ZONE_MOVABLE, loose the check > + * for __GFP_HARDWALL and ALLOC_CPUSET, otherwise it could trigger OOM > + * killing, which still can not solve this policy check. > + */ > + if (ac->highest_zoneidx <= ZONE_NORMAL) { > + int nid; > + unsigned long unmovable = 0; > + > + /* FIXME: this could be a separate function */ > + for_each_node_mask(nid, cpuset_current_mems_allowed) { > + unmovable += NODE_DATA(nid)->node_present_pages - > + > NODE_DATA(nid)->node_zones[ZONE_MOVABLE].present_pages; > + } > + > + if (!unmovable) { > + gfp_mask &= ~(__GFP_HARDWALL); > + alloc_flags &= ~ALLOC_CPUSET; > + } > + } > + > if (alloc_flags & ALLOC_KSWAPD) > wake_all_kswapds(order, gfp_mask, ac); > > -- > 2.7.4 > -- Michal Hocko SUSE Labs
[PATCH] Input: elan_i2c - Modify the correct input of the iap page type command.
The iap page type command of the parameter is page_size. --- drivers/input/mouse/elan_i2c.h | 2 +- drivers/input/mouse/elan_i2c_core.c | 3 ++- drivers/input/mouse/elan_i2c_i2c.c | 10 +- drivers/input/mouse/elan_i2c_smbus.c | 2 +- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/drivers/input/mouse/elan_i2c.h b/drivers/input/mouse/elan_i2c.h index c75b00c45d75..36e3cd908671 100644 --- a/drivers/input/mouse/elan_i2c.h +++ b/drivers/input/mouse/elan_i2c.h @@ -78,7 +78,7 @@ struct elan_transport_ops { int (*iap_reset)(struct i2c_client *client); int (*prepare_fw_update)(struct i2c_client *client, u16 ic_type, -u8 iap_version); +u8 iap_version, u16 fw_page_size); int (*write_fw_block)(struct i2c_client *client, u16 fw_page_size, const u8 *page, u16 checksum, int idx); int (*finish_fw_update)(struct i2c_client *client, diff --git a/drivers/input/mouse/elan_i2c_core.c b/drivers/input/mouse/elan_i2c_core.c index c599e21a8478..61ed3f5ca219 100644 --- a/drivers/input/mouse/elan_i2c_core.c +++ b/drivers/input/mouse/elan_i2c_core.c @@ -497,7 +497,8 @@ static int __elan_update_firmware(struct elan_tp_data *data, u16 sw_checksum = 0, fw_checksum = 0; error = data->ops->prepare_fw_update(client, data->ic_type, -data->iap_version); +data->iap_version, +data->fw_page_size); if (error) return error; diff --git a/drivers/input/mouse/elan_i2c_i2c.c b/drivers/input/mouse/elan_i2c_i2c.c index 5a496d4ffa49..13dc097eb6c6 100644 --- a/drivers/input/mouse/elan_i2c_i2c.c +++ b/drivers/input/mouse/elan_i2c_i2c.c @@ -517,7 +517,7 @@ static int elan_i2c_set_flash_key(struct i2c_client *client) return 0; } -static int elan_read_write_iap_type(struct i2c_client *client) +static int elan_read_write_iap_type(struct i2c_client *client, u16 fw_page_size) { int error; u16 constant; @@ -526,7 +526,7 @@ static int elan_read_write_iap_type(struct i2c_client *client) do { error = elan_i2c_write_cmd(client, ETP_I2C_IAP_TYPE_CMD, - ETP_I2C_IAP_TYPE_REG); + fw_page_size / 2); if (error) { dev_err(>dev, "cannot write iap type: %d\n", error); @@ -543,7 +543,7 @@ static int elan_read_write_iap_type(struct i2c_client *client) constant = le16_to_cpup((__le16 *)val); dev_dbg(>dev, "iap type reg: 0x%04x\n", constant); - if (constant == ETP_I2C_IAP_TYPE_REG) + if (constant == fw_page_size / 2) return 0; } while (--retry > 0); @@ -553,7 +553,7 @@ static int elan_read_write_iap_type(struct i2c_client *client) } static int elan_i2c_prepare_fw_update(struct i2c_client *client, u16 ic_type, - u8 iap_version) + u8 iap_version, u16 fw_page_size) { struct device *dev = >dev; int error; @@ -594,7 +594,7 @@ static int elan_i2c_prepare_fw_update(struct i2c_client *client, u16 ic_type, } if (ic_type >= 0x0D && iap_version >= 1) { - error = elan_read_write_iap_type(client); + error = elan_read_write_iap_type(client, fw_page_size); if (error) return error; } diff --git a/drivers/input/mouse/elan_i2c_smbus.c b/drivers/input/mouse/elan_i2c_smbus.c index 8ff823751f3b..1820f1cfc1dc 100644 --- a/drivers/input/mouse/elan_i2c_smbus.c +++ b/drivers/input/mouse/elan_i2c_smbus.c @@ -340,7 +340,7 @@ static int elan_smbus_set_flash_key(struct i2c_client *client) } static int elan_smbus_prepare_fw_update(struct i2c_client *client, u16 ic_type, - u8 iap_version) + u8 iap_version, u16 fw_page_size) { struct device *dev = >dev; int len; -- 2.17.1
Re: [PATCH v3 5/6] MIPS: Loongson64: SMP: Fix up play_dead jump indicator
On 11/04/2020 03:04 PM, Jiaxun Yang wrote: 在 2020/11/4 14:31, Jinyang He 写道: Hi, all, On 11/03/2020 03:12 PM, Tiezhu Yang wrote: In play_dead function, the whole 64-bit PC mailbox was used as a indicator to determine if the master core had written boot jump information. However, after we introduced CSR mailsend, the hardware will not guarante an atomic write for the 64-bit PC mailbox. Thus we have to use the lower 32-bit which is written at the last as the jump indicator instead. Signed-off-by: Lu Zeng Signed-off-by: Jun Yi Signed-off-by: Tiezhu Yang --- v2: No changes v3: Update the commit message and comment arch/mips/loongson64/smp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/mips/loongson64/smp.c b/arch/mips/loongson64/smp.c index 736e98d..aa0cd72 100644 --- a/arch/mips/loongson64/smp.c +++ b/arch/mips/loongson64/smp.c @@ -764,9 +764,10 @@ static void loongson3_type3_play_dead(int *state_addr) "1: li%[count], 0x100 \n" /* wait for init loop */ "2: bnez %[count], 2b\n" /* limit mailbox access */ " addiu %[count], -1\n" -" ld%[initfunc], 0x20(%[base]) \n" /* get PC via mailbox */ I have some confusion here. Play_dead CPUs is always brought up by cpu_up(). On Loongson64, it calls loongson3_boot_secondary(). The value of startargs[0] is the address of smp_bootstrap() which is in CKSEG0 and a constant after the kernel is compiled. That means its value likes 0x8... and only the low 32bit is useful. As "lw" is sign-extended, could we replace "ld" with "lw" simply? Hi Jinyang, I'd prefer not to do so. In future we may have kernel running in other spaces, (e.g. xkphys), and there is no reason to add a barrier on that without actual benefit. I had check PMON firmware and it's also loading the full 64-bit address. Also to keep consistent, mailbox writing part needs to be refined to match the behavior of reading. Otherwise other readers will be confused. Thus leaving it as is looks much more reasonable. OK, the current code looks better, please ignore my comment, sorry for the noise. Thanks, Jinyang Thanks. - Jiaxun Thanks, Jinyang +" lw%[initfunc], 0x20(%[base]) \n" /* check lower 32-bit as jump indicator */ " beqz %[initfunc], 1b \n" " nop \n" +" ld%[initfunc], 0x20(%[base]) \n" /* get PC (whole 64-bit) via mailbox */ " ld$sp, 0x28(%[base]) \n" /* get SP via mailbox */ " ld$gp, 0x30(%[base]) \n" /* get GP via mailbox */ " ld$a1, 0x38(%[base]) \n"
Re: [RFC PATCH 1/2] mm, oom: dump meminfo for all memory nodes
On Wed 04-11-20 14:10:09, Feng Tang wrote: > In some OOM cases, if there is memory node binding(current->mems_allowed > is not NULL), system may only print the meminfo for these bound nodes, > while other nodes' info could still be important for debugging. > > For example on a platform with one normal node (has DMA/DMA32/NORMAL... > zones) and one node which only has movable zone (either for memory hotplug > case or a persistent memory node), some user will run docker while binding > memory to the movable node. many memory allocations originated from the > docker instance will fall back to the other node, and when a OOM happens, > meminfo for both nodes are needed. > > So extend the show_mem() to cover all memory nodes. I do not like this change. The reason why we print only relevant numa nodes is the size of the oom report. Also all other numa nodes are not really relevant to the allocation so there is no real reason to print their info. We used to do that in the past and decided that this is more than suboptimal. I do understand that this is a preliminary work for your later patch which tweaks the node binding and so more numa nodes are eligible but then I would propose to merge the two patches. > Signed-off-by: Feng Tang > --- > mm/oom_kill.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/mm/oom_kill.c b/mm/oom_kill.c > index 8b84661..601476cc 100644 > --- a/mm/oom_kill.c > +++ b/mm/oom_kill.c > @@ -462,7 +462,7 @@ static void dump_header(struct oom_control *oc, struct > task_struct *p) > if (is_memcg_oom(oc)) > mem_cgroup_print_oom_meminfo(oc->memcg); > else { > - show_mem(SHOW_MEM_FILTER_NODES, oc->nodemask); > + show_mem(SHOW_MEM_FILTER_NODES, _states[N_MEMORY]); > if (is_dump_unreclaim_slabs()) > dump_unreclaimable_slab(); > } > -- > 2.7.4 -- Michal Hocko SUSE Labs
arch/sh/kernel/cpu/sh2a/clock-sh7264.c:44:33: sparse: sparse: incorrect type in argument 1 (different base types)
Hi Luc, First bad commit (maybe != root cause): tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master head: 4ef8451b332662d004df269d4cdeb7d9f31419b5 commit: e5fc436f06eef54ef512ea55a9db8eb9f2e76959 sparse: use static inline for __chk_{user,io}_ptr() date: 10 weeks ago config: sh-randconfig-s032-20201103 (attached as .config) compiler: sh4-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.3-76-gf680124b-dirty # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=e5fc436f06eef54ef512ea55a9db8eb9f2e76959 git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git git fetch --no-tags linus master git checkout e5fc436f06eef54ef512ea55a9db8eb9f2e76959 # 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=sh If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot "sparse warnings: (new ones prefixed by >>)" >> arch/sh/kernel/cpu/sh2a/clock-sh7264.c:44:33: sparse: sparse: incorrect type >> in argument 1 (different base types) @@ expected void const volatile >> [noderef] __iomem *ptr @@ got unsigned int @@ >> arch/sh/kernel/cpu/sh2a/clock-sh7264.c:44:33: sparse: expected void >> const volatile [noderef] __iomem *ptr arch/sh/kernel/cpu/sh2a/clock-sh7264.c:44:33: sparse: got unsigned int arch/sh/kernel/cpu/sh2a/clock-sh7264.c:93:20: sparse: sparse: Using plain integer as NULL pointer arch/sh/kernel/cpu/sh2a/clock-sh7264.c:94:20: sparse: sparse: Using plain integer as NULL pointer arch/sh/kernel/cpu/sh2a/clock-sh7264.c:95:20: sparse: sparse: Using plain integer as NULL pointer arch/sh/kernel/cpu/sh2a/clock-sh7264.c:96:20: sparse: sparse: Using plain integer as NULL pointer arch/sh/kernel/cpu/sh2a/clock-sh7264.c:97:20: sparse: sparse: Using plain integer as NULL pointer arch/sh/kernel/cpu/sh2a/clock-sh7264.c:98:20: sparse: sparse: Using plain integer as NULL pointer arch/sh/kernel/cpu/sh2a/clock-sh7264.c:99:20: sparse: sparse: Using plain integer as NULL pointer arch/sh/kernel/cpu/sh2a/clock-sh7264.c:100:20: sparse: sparse: Using plain integer as NULL pointer arch/sh/kernel/cpu/sh2a/clock-sh7264.c:101:20: sparse: sparse: Using plain integer as NULL pointer -- >> arch/sh/kernel/cpu/sh2a/setup-sh7264.c:474:9: sparse: sparse: incorrect type >> in argument 1 (different base types) @@ expected void const volatile >> [noderef] __iomem *ptr @@ got unsigned int @@ >> arch/sh/kernel/cpu/sh2a/setup-sh7264.c:474:9: sparse: expected void >> const volatile [noderef] __iomem *ptr arch/sh/kernel/cpu/sh2a/setup-sh7264.c:474:9: sparse: got unsigned int -- drivers/hwmon/w83793.c:1372:37: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected char const *__gu_addr @@ got char const [noderef] __user * @@ drivers/hwmon/w83793.c:1372:37: sparse: expected char const *__gu_addr drivers/hwmon/w83793.c:1372:37: sparse: got char const [noderef] __user * >> drivers/hwmon/w83793.c:1372:37: sparse: sparse: incorrect type in argument 1 >> (different address spaces) @@ expected void const volatile [noderef] >> __user *ptr @@ got char const *__gu_addr @@ >> drivers/hwmon/w83793.c:1372:37: sparse: expected void const volatile >> [noderef] __user *ptr drivers/hwmon/w83793.c:1372:37: sparse: got char const *__gu_addr drivers/hwmon/w83793.c:1425:21: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected int const *__gu_addr @@ got int [noderef] __user * @@ drivers/hwmon/w83793.c:1425:21: sparse: expected int const *__gu_addr drivers/hwmon/w83793.c:1425:21: sparse: got int [noderef] __user * >> drivers/hwmon/w83793.c:1425:21: sparse: sparse: incorrect type in argument 1 >> (different address spaces) @@ expected void const volatile [noderef] >> __user *ptr @@ got int const *__gu_addr @@ drivers/hwmon/w83793.c:1425:21: sparse: expected void const volatile [noderef] __user *ptr drivers/hwmon/w83793.c:1425:21: sparse: got int const *__gu_addr drivers/hwmon/w83793.c:1435:21: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected int const *__gu_addr @@ got int [noderef] __user * @@ drivers/hwmon/w83793.c:1435:21: sparse: expected int const *__gu_addr drivers/hwmon/w83793.c:1435:21: sparse: got int [noderef] __user * drivers/hwmon/w83793.c:1435:21: sparse: sparse: incorr
[PATCH] clk: ingenic/TCU: Remove NULL pointer check before clk_enable/disable
Because clk_enable and clk_disable already checked NULL clock parameter, so the additional checks are unnecessary, just remove them. Signed-off-by: Xu Wang --- drivers/clk/ingenic/tcu.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/clk/ingenic/tcu.c b/drivers/clk/ingenic/tcu.c index 9382dc3aa27e..ffcb3667fd2b 100644 --- a/drivers/clk/ingenic/tcu.c +++ b/drivers/clk/ingenic/tcu.c @@ -445,8 +445,7 @@ static int __maybe_unused tcu_pm_suspend(void) { struct ingenic_tcu *tcu = ingenic_tcu; - if (tcu->clk) - clk_disable(tcu->clk); + clk_disable(tcu->clk); return 0; } @@ -455,8 +454,7 @@ static void __maybe_unused tcu_pm_resume(void) { struct ingenic_tcu *tcu = ingenic_tcu; - if (tcu->clk) - clk_enable(tcu->clk); + clk_enable(tcu->clk); } static struct syscore_ops __maybe_unused tcu_pm_ops = { -- 2.17.1
Re: [RFC PATCH 0/2] mm: fix OOMs for binding workloads to movable zone only node
On Wed 04-11-20 14:10:08, Feng Tang wrote: > Hi, > > This patchset tries to report a problem and get suggestion/review > for the RFC fix patches. > > We recently got a OOM report, that when user try to bind a docker(container) > instance to a memory node which only has movable zones, and OOM killing > still can't solve the page allocation failure. This is a cpuset node binding right? > The callstack was: > > [ 1387.877565] runc:[2:INIT] invoked oom-killer: > gfp_mask=0x500cc2(GFP_HIGHUSER|__GFP_ACCOUNT), order=0, oom_score_adj=0 > [ 1387.877568] CPU: 8 PID: 8291 Comm: runc:[2:INIT] Tainted: GW > I E 5.8.2-0.g71b519a-default #1 openSUSE Tumbleweed (unreleased) > [ 1387.877569] Hardware name: Dell Inc. PowerEdge R640/0PHYDR, BIOS > 2.6.4 04/09/2020 > [ 1387.877570] Call Trace: > [ 1387.877579] dump_stack+0x6b/0x88 > [ 1387.877584] dump_header+0x4a/0x1e2 > [ 1387.877586] oom_kill_process.cold+0xb/0x10 > [ 1387.877588] out_of_memory.part.0+0xaf/0x230 > [ 1387.877591] out_of_memory+0x3d/0x80 > [ 1387.877595] __alloc_pages_slowpath.constprop.0+0x954/0xa20 > [ 1387.877599] __alloc_pages_nodemask+0x2d3/0x300 > [ 1387.877602] pipe_write+0x322/0x590 > [ 1387.877607] new_sync_write+0x196/0x1b0 > [ 1387.877609] vfs_write+0x1c3/0x1f0 > [ 1387.877611] ksys_write+0xa7/0xe0 > [ 1387.877617] do_syscall_64+0x52/0xd0 > [ 1387.877621] entry_SYSCALL_64_after_hwframe+0x44/0xa9 > > The meminfo log only shows the movable only node, which has plenty > of free memory. And in our reproducing with 1/2 patch, the normal > node (has DMA/DMA32/Normal) also has lot of free memory when OOM > happens. OK, so you are bidning to a movable node only and your above request is for GFP_HIGHUSER which _cannot_ be satisfied from the movable zones because that memory is not movable. So the system behaves as expected. Your cpuset is misconfigured IMHO. Movable only nodes come with their risk and configuration price. > If we hack to make this (GFP_HIGHUSER|__GFP_ACCOUNT) request get > a page, and following full docker run (like installing and running > 'stress-ng' stress test) will see more allocation failures due to > different kinds of request(gfp_masks). And the 2/2 patch will detect > such cases that the allowed target nodes only have movable zones > and loose the binding check, otherwise it will trigger OOM while > the OOM won't do any help, as the problem is not lack of free memory. Well, this breaks the cpuset containment, right? I consider this quite unexpected for something that looks like a misconfiguration. I do agree that this is unexpected for anybody who is not really familiar with concept of movable zone but we should probably call out all these details rather than tweak the existing semantic. Could you be more specific about the usecase here? Why do you need a binding to a pure movable node? -- Michal Hocko SUSE Labs
Re: [PATCH 5.9 000/391] 5.9.4-rc1 review
On Wed, 4 Nov 2020 at 02:07, Greg Kroah-Hartman wrote: > > This is the start of the stable review cycle for the 5.9.4 release. > There are 391 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 Thu, 05 Nov 2020 20:29:58 +. > 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.9.4-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.9.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. Tested-by: Linux Kernel Functional Testing NOTE: The kernel warning noticed on arm64 nxp ls2088 device with KASAN config enabled while booting the device. We are not considering this as regression because this is the first arm64 KASAN config enabled on nxp ls2088 device. [3.301882] dwc3 310.usb3: Failed to get clk 'ref': -2 [3.307433] [ cut here ] [3.312048] dwc3 310.usb3: request value same as default, ignoring [3.318596] WARNING: CPU: 3 PID: 1 at /home/jenkins/ci/lsdk/master/all/packages/linux/linux/drivers/usb/dwc3/core.c:347 dwc3_core_init+0xd14/0xd70 [3.331716] Modules linked in: [3.334766] CPU: 3 PID: 1 Comm: swapper/0 Not tainted 4.19.46 #1 [3.340765] Hardware name: Freescale Layerscape 2088A RDB Board (DT) [3.347111] pstate: 4005 (nZcv daif -PAN -UAO) [3.351895] pc : dwc3_core_init+0xd14/0xd70 [3.356070] lr : dwc3_core_init+0xd14/0xd70 [3.360243] sp : 08063b00 [3.363550] x29: 08063b00 x28: 0007 [3.368855] x27: 09624068 x26: 09532768 [3.374160] x25: 8082cd5ea1a0 x24: 08f27000 [3.379465] x23: 8082ef45a410 x22: 096ca000 [3.384770] x21: 0041 x20: 30c11004 [3.390075] x19: 8082ef6f9080 x18: [3.395380] x17: x16: [3.400685] x15: 096ca708 x14: 898776ff [3.405991] x13: 0987770d x12: 096ca980 [3.411297] x11: 08707260 x10: 080637d0 [3.416603] x9 : 0016 x8 : 6769202c746c7561 [3.421908] x7 : 6665642073612065 x6 : 0163 [3.427213] x5 : x4 : [3.432517] x3 : x2 : 096e3cf8 [3.437823] x1 : 4d579be806451100 x0 : [3.443129] Call trace: [3.445568] dwc3_core_init+0xd14/0xd70 [3.449395] dwc3_probe+0x8b0/0xd30 [3.452877] platform_drv_probe+0x50/0xa0 [3.456878] really_probe+0x1b8/0x288 [3.460531] driver_probe_device+0x58/0x100 [3.464705] __driver_attach+0xd4/0xd8 [3.468446] bus_for_each_dev+0x74/0xc8 [3.472273] driver_attach+0x20/0x28 [3.475840] bus_add_driver+0x1ac/0x218 [3.479667] driver_register+0x60/0x110 [3.483494] __platform_driver_register+0x40/0x48 [3.488192] dwc3_driver_init+0x18/0x20 [3.492020] do_one_initcall+0x5c/0x178 [3.495848] kernel_init_freeable+0x198/0x244 [3.500197] kernel_init+0x10/0x108 [3.503677] ret_from_fork+0x10/0x18 [3.507245] ---[ end trace 13f260065c84085c ]--- [3.512196] dwc3 311.usb3: Failed to get clk 'ref': -2 full boot log: https://qa-reports.linaro.org/lkft/linux-stable-rc-linux-5.9.y/build/v5.9.3-392-g53574a4c558e/testrun/3391440/suite/linux-log-parser/test/check-kernel-warning-121687/log Summary kernel: 5.9.4-rc1 git repo: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git git branch: linux-5.9.y git commit: 53574a4c558e8da7cfde86a77fe760ba375394b8 git describe: v5.9.3-392-g53574a4c558e Test details: https://qa-reports.linaro.org/lkft/linux-stable-rc-linux-5.9.y/build/v5.9.3-392-g53574a4c558e No regressions (compared to build v5.9.3) No fixes (compared to build v5.9.3) Ran 38015 total tests in the following environments and test suites. Environments -- - dragonboard-410c - hi6220-hikey - i386 - juno-r2 - juno-r2-compat - nxp-ls2088 - nxp-ls2088-kasan - qemu-arm64-kasan - qemu-x86_64-kasan - qemu_arm - qemu_arm64 - qemu_i386 - qemu_x86_64 - x15 - x86 - x86-kasan Test Suites --- * build * install-android-platform-tools-r2600 * libhugetlbfs * linux-log-parser * ltp-cap_bounds-tests * ltp-containers-tests * ltp-cpuhotplug-tests * ltp-crypto-tests * ltp-fcntl-locktests-tests * ltp-filecaps-tests * ltp-fs-tests * ltp-fs_bind-tests * ltp-fs_perms_simple-tests * ltp-fsx-tests * ltp-hugetlb-tests * ltp-ipc-tests * ltp-mm-tests * ltp-nptl-tests * ltp-pty-tests * ltp-sched-tests * ltp-securebits-tests * ltp-tracing-tests * perf *
sound/soc/intel/skylake/skl-topology.c:3642:1: warning: the frame size of 1256 bytes is larger than 1024 bytes
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master head: 4ef8451b332662d004df269d4cdeb7d9f31419b5 commit: 2d744ecf2b98405723a2138a547e5c75009bc4e5 ASoC: Intel: Skylake: Automatic DMIC format configuration according to information from NHLT date: 6 months ago config: x86_64-customedconfig-lck8195-cfld1 (attached as .config) compiler: gcc-9 (Debian 9.3.0-15) 9.3.0 reproduce (this is a W=1 build): # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=2d744ecf2b98405723a2138a547e5c75009bc4e5 git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git git fetch --no-tags linus master git checkout 2d744ecf2b98405723a2138a547e5c75009bc4e5 # save the attached .config to linux build tree make W=1 ARCH=x86_64 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot All warnings (new ones prefixed by >>): sound/soc/intel/skylake/skl-topology.c: In function 'skl_tplg_complete': >> sound/soc/intel/skylake/skl-topology.c:3642:1: warning: the frame size of >> 1256 bytes is larger than 1024 bytes [-Wframe-larger-than=] 3642 | } | ^ vim +3642 sound/soc/intel/skylake/skl-topology.c 3612 3613 static void skl_tplg_complete(struct snd_soc_component *component) 3614 { 3615 struct snd_soc_dobj *dobj; 3616 struct snd_soc_acpi_mach *mach = 3617 dev_get_platdata(component->card->dev); 3618 int i; 3619 3620 list_for_each_entry(dobj, >dobj_list, list) { 3621 struct snd_kcontrol *kcontrol = dobj->control.kcontrol; 3622 struct soc_enum *se = 3623 (struct soc_enum *)kcontrol->private_value; 3624 char **texts = dobj->control.dtexts; 3625 char chan_text[4]; 3626 3627 if (dobj->type != SND_SOC_DOBJ_ENUM || 3628 dobj->control.kcontrol->put != 3629 skl_tplg_multi_config_set_dmic) 3630 continue; 3631 sprintf(chan_text, "c%d", mach->mach_params.dmic_num); 3632 3633 for (i = 0; i < se->items; i++) { 3634 struct snd_ctl_elem_value val; 3635 3636 if (strstr(texts[i], chan_text)) { 3637 val.value.enumerated.item[0] = i; 3638 kcontrol->put(kcontrol, ); 3639 } 3640 } 3641 } > 3642 } 3643 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-...@lists.01.org .config.gz Description: application/gzip
[PATCH] hwmon: (pmbus) Add driver for STMicroelectronics PM6764 Voltage Regulator
Add the pmbus driver for the STMicroelectronics pm6764 voltage regulator. the output voltage use the MFR_READ_VOUT 0xD4 vout value returned is linear11 Signed-off-by: Charles Hsu --- drivers/hwmon/pmbus/Kconfig| 8 drivers/hwmon/pmbus/Makefile | 1 + drivers/hwmon/pmbus/pm6764tr.c | 74 ++ 3 files changed, 83 insertions(+) create mode 100644 drivers/hwmon/pmbus/pm6764tr.c diff --git a/drivers/hwmon/pmbus/Kconfig b/drivers/hwmon/pmbus/Kconfig index a25faf69fce3..2b487c401a4e 100644 --- a/drivers/hwmon/pmbus/Kconfig +++ b/drivers/hwmon/pmbus/Kconfig @@ -220,6 +220,14 @@ config SENSORS_MP2975 This driver can also be built as a module. If so, the module will be called mp2975. +config SENSORS_PM6764TR + tristate "PM6764TR" + help + If you say yes here you get hardware monitoring support for PM6764TR. + + This driver can also be built as a module. If so, the module will + be called pm6764tr. + config SENSORS_PXE1610 tristate "Infineon PXE1610" help diff --git a/drivers/hwmon/pmbus/Makefile b/drivers/hwmon/pmbus/Makefile index 4c97ad0bd791..31ebdef5d4a6 100644 --- a/drivers/hwmon/pmbus/Makefile +++ b/drivers/hwmon/pmbus/Makefile @@ -25,6 +25,7 @@ obj-$(CONFIG_SENSORS_MAX31785) += max31785.o obj-$(CONFIG_SENSORS_MAX34440) += max34440.o obj-$(CONFIG_SENSORS_MAX8688) += max8688.o obj-$(CONFIG_SENSORS_MP2975) += mp2975.o +obj-$(CONFIG_SENSORS_PM6764TR) += pm6764tr.o obj-$(CONFIG_SENSORS_PXE1610) += pxe1610.o obj-$(CONFIG_SENSORS_TPS40422) += tps40422.o obj-$(CONFIG_SENSORS_TPS53679) += tps53679.o diff --git a/drivers/hwmon/pmbus/pm6764tr.c b/drivers/hwmon/pmbus/pm6764tr.c new file mode 100644 index ..b125a1cbfea5 --- /dev/null +++ b/drivers/hwmon/pmbus/pm6764tr.c @@ -0,0 +1,74 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include "pmbus.h" + +#define PM6764TR_PMBUS_READ_VOUT 0xD4 + +static int pm6764tr_read_word_data(struct i2c_client *client, int page, int reg) +{ + int ret; + + switch (reg) { + case PMBUS_VIRT_READ_VMON: + ret = pmbus_read_word_data(client, page, + PM6764TR_PMBUS_READ_VOUT); + break; + default: + ret = -ENODATA; + break; + } + return ret; +} + +static struct pmbus_driver_info pm6764tr_info = { + .pages = 1, + .format[PSC_VOLTAGE_IN] = linear, + .format[PSC_VOLTAGE_OUT] = vid, + .format[PSC_TEMPERATURE] = linear, + .format[PSC_CURRENT_OUT] = linear, + .format[PSC_POWER] = linear, + .func[0] = PMBUS_HAVE_VIN | PMBUS_HAVE_IIN | PMBUS_HAVE_PIN | +PMBUS_HAVE_IOUT | PMBUS_HAVE_POUT | PMBUS_HAVE_VMON | + PMBUS_HAVE_STATUS_IOUT | PMBUS_HAVE_STATUS_VOUT | + PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP, +.read_word_data = pm6764tr_read_word_data, +}; + +static int pm6764tr_probe(struct i2c_client *client, + const struct i2c_device_id *id) +{ + return pmbus_do_probe(client, id, _info); +} + +static const struct i2c_device_id pm6764tr_id[] = { + {"pm6764tr", 0}, + {} +}; +MODULE_DEVICE_TABLE(i2c, pm6764tr_id); + +static const struct of_device_id pm6764tr_of_match[] = { + {.compatible = "pm6764tr"}, + {} +}; +/* This is the driver that will be inserted */ +static struct i2c_driver pm6764tr_driver = { + .driver = { + .name = "pm6764tr", + .of_match_table = of_match_ptr(pm6764tr_of_match), + }, + .probe = pm6764tr_probe, + .remove = pmbus_do_remove, + .id_table = pm6764tr_id, +}; + +module_i2c_driver(pm6764tr_driver); + +MODULE_AUTHOR("Charles Hsu"); +MODULE_DESCRIPTION("PMBus driver for ST PM6764TR"); +MODULE_LICENSE("GPL"); -- 2.25.1
Re: [PATCH] PCI/ASPM: Save/restore ASPM-L1SS controls for suspend/resume
Bjorn / Lorenzo, Could you please review this change? Thanks, Vidya Sagar On 10/25/2020 12:34 AM, Vidya Sagar wrote: Previously ASPM L1-Sub-States control registers (CTL1 and CTL2) weren't saved and restored during suspend/resume leading to ASPM-L1SS configuration being lost post resume. Save the ASPM-L1SS control registers so that the configuration is retained post resume. Signed-off-by: Vidya Sagar --- v1: * It would be really good if someone can verify it on a non tegra194 platform drivers/pci/pci.c | 7 +++ drivers/pci/pci.h | 4 drivers/pci/pcie/aspm.c | 41 + 3 files changed, 52 insertions(+) diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index a458c46d7e39..034497264bde 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -1551,6 +1551,7 @@ int pci_save_state(struct pci_dev *dev) return i; pci_save_ltr_state(dev); + pci_save_aspm_l1ss_state(dev); pci_save_dpc_state(dev); pci_save_aer_state(dev); return pci_save_vc_state(dev); @@ -1656,6 +1657,7 @@ void pci_restore_state(struct pci_dev *dev) * LTR itself (in the PCIe capability). */ pci_restore_ltr_state(dev); + pci_restore_aspm_l1ss_state(dev); pci_restore_pcie_state(dev); pci_restore_pasid_state(dev); @@ -3319,6 +3321,11 @@ void pci_allocate_cap_save_buffers(struct pci_dev *dev) if (error) pci_err(dev, "unable to allocate suspend buffer for LTR\n"); + error = pci_add_ext_cap_save_buffer(dev, PCI_EXT_CAP_ID_L1SS, + 2 * sizeof(u32)); + if (error) + pci_err(dev, "unable to allocate suspend buffer for ASPM-L1SS\n"); + pci_allocate_vc_save_buffers(dev); } diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h index fa12f7cbc1a0..8d2135f61e36 100644 --- a/drivers/pci/pci.h +++ b/drivers/pci/pci.h @@ -565,11 +565,15 @@ void pcie_aspm_init_link_state(struct pci_dev *pdev); void pcie_aspm_exit_link_state(struct pci_dev *pdev); void pcie_aspm_pm_state_change(struct pci_dev *pdev); void pcie_aspm_powersave_config_link(struct pci_dev *pdev); +void pci_save_aspm_l1ss_state(struct pci_dev *dev); +void pci_restore_aspm_l1ss_state(struct pci_dev *dev); #else static inline void pcie_aspm_init_link_state(struct pci_dev *pdev) { } static inline void pcie_aspm_exit_link_state(struct pci_dev *pdev) { } static inline void pcie_aspm_pm_state_change(struct pci_dev *pdev) { } static inline void pcie_aspm_powersave_config_link(struct pci_dev *pdev) { } +static inline void pci_save_aspm_l1ss_state(struct pci_dev *dev) { } +static inline void pci_restore_aspm_l1ss_state(struct pci_dev *dev) { } #endif #ifdef CONFIG_PCIE_ECRC diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c index 253c30cc1967..d965bbc563ed 100644 --- a/drivers/pci/pcie/aspm.c +++ b/drivers/pci/pcie/aspm.c @@ -742,6 +742,47 @@ static void pcie_config_aspm_l1ss(struct pcie_link_state *link, u32 state) PCI_L1SS_CTL1_L1SS_MASK, val); } +void pci_save_aspm_l1ss_state(struct pci_dev *dev) +{ + struct pci_cap_saved_state *save_state; + int aspm_l1ss; + u32 *cap; + + if (!pci_is_pcie(dev)) + return; + + aspm_l1ss = pci_find_ext_capability(dev, PCI_EXT_CAP_ID_L1SS); + if (!aspm_l1ss) + return; + + save_state = pci_find_saved_ext_cap(dev, PCI_EXT_CAP_ID_L1SS); + if (!save_state) + return; + + cap = (u32 *)_state->cap.data[0]; + pci_read_config_dword(dev, aspm_l1ss + PCI_L1SS_CTL1, cap++); + pci_read_config_dword(dev, aspm_l1ss + PCI_L1SS_CTL2, cap++); +} + +void pci_restore_aspm_l1ss_state(struct pci_dev *dev) +{ + struct pci_cap_saved_state *save_state; + int aspm_l1ss; + u32 *cap; + + if (!pci_is_pcie(dev)) + return; + + save_state = pci_find_saved_ext_cap(dev, PCI_EXT_CAP_ID_L1SS); + aspm_l1ss = pci_find_ext_capability(dev, PCI_EXT_CAP_ID_L1SS); + if (!save_state || !aspm_l1ss) + return; + + cap = (u32 *)_state->cap.data[0]; + pci_write_config_dword(dev, aspm_l1ss + PCI_L1SS_CTL1, *cap++); + pci_write_config_dword(dev, aspm_l1ss + PCI_L1SS_CTL2, *cap++); +} + static void pcie_config_aspm_dev(struct pci_dev *pdev, u32 val) { pcie_capability_clear_and_set_word(pdev, PCI_EXP_LNKCTL,
[PATCH 1/2] remoteproc: qcom_q6v5_mss: Replace ioremap with memremap
Fix the sparse warnings reported by the kernel test bot by replacing ioremap calls with memremap. Reported-by: kernel test robot Signed-off-by: Sibi Sankar --- I'll send out the patches to convert ioremap to memremap on other qc remoteproc drivers once I get a chance to test them. drivers/remoteproc/qcom_q6v5_mss.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/remoteproc/qcom_q6v5_mss.c b/drivers/remoteproc/qcom_q6v5_mss.c index 9a473cfef758..2c866b6da23c 100644 --- a/drivers/remoteproc/qcom_q6v5_mss.c +++ b/drivers/remoteproc/qcom_q6v5_mss.c @@ -1194,7 +1194,7 @@ static int q6v5_mpss_load(struct q6v5 *qproc) goto release_firmware; } - ptr = ioremap_wc(qproc->mpss_phys + offset, phdr->p_memsz); + ptr = memremap(qproc->mpss_phys + offset, phdr->p_memsz, MEMREMAP_WC); if (!ptr) { dev_err(qproc->dev, "unable to map memory region: %pa+%zx-%x\n", @@ -1209,7 +1209,7 @@ static int q6v5_mpss_load(struct q6v5 *qproc) "failed to load segment %d from truncated file %s\n", i, fw_name); ret = -EINVAL; - iounmap(ptr); + memunmap(ptr); goto release_firmware; } @@ -1221,7 +1221,7 @@ static int q6v5_mpss_load(struct q6v5 *qproc) ptr, phdr->p_filesz); if (ret) { dev_err(qproc->dev, "failed to load %s\n", fw_name); - iounmap(ptr); + memunmap(ptr); goto release_firmware; } @@ -1232,7 +1232,7 @@ static int q6v5_mpss_load(struct q6v5 *qproc) memset(ptr + phdr->p_filesz, 0, phdr->p_memsz - phdr->p_filesz); } - iounmap(ptr); + memunmap(ptr); size += phdr->p_memsz; code_length = readl(qproc->rmb_base + RMB_PMI_CODE_LENGTH_REG); @@ -1299,11 +1299,11 @@ static void qcom_q6v5_dump_segment(struct rproc *rproc, } if (!ret) - ptr = ioremap_wc(qproc->mpss_phys + offset + cp_offset, size); + ptr = memremap(qproc->mpss_phys + offset + cp_offset, size, MEMREMAP_WC); if (ptr) { memcpy(dest, ptr, size); - iounmap(ptr); + memunmap(ptr); } else { memset(dest, 0xff, size); } -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
Re: [PATCH v3 5/6] MIPS: Loongson64: SMP: Fix up play_dead jump indicator
在 2020/11/4 14:31, Jinyang He 写道: Hi, all, On 11/03/2020 03:12 PM, Tiezhu Yang wrote: In play_dead function, the whole 64-bit PC mailbox was used as a indicator to determine if the master core had written boot jump information. However, after we introduced CSR mailsend, the hardware will not guarante an atomic write for the 64-bit PC mailbox. Thus we have to use the lower 32-bit which is written at the last as the jump indicator instead. Signed-off-by: Lu Zeng Signed-off-by: Jun Yi Signed-off-by: Tiezhu Yang --- v2: No changes v3: Update the commit message and comment arch/mips/loongson64/smp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/mips/loongson64/smp.c b/arch/mips/loongson64/smp.c index 736e98d..aa0cd72 100644 --- a/arch/mips/loongson64/smp.c +++ b/arch/mips/loongson64/smp.c @@ -764,9 +764,10 @@ static void loongson3_type3_play_dead(int *state_addr) "1: li %[count], 0x100 \n" /* wait for init loop */ "2: bnez %[count], 2b \n" /* limit mailbox access */ " addiu %[count], -1 \n" - " ld %[initfunc], 0x20(%[base]) \n" /* get PC via mailbox */ I have some confusion here. Play_dead CPUs is always brought up by cpu_up(). On Loongson64, it calls loongson3_boot_secondary(). The value of startargs[0] is the address of smp_bootstrap() which is in CKSEG0 and a constant after the kernel is compiled. That means its value likes 0x8... and only the low 32bit is useful. As "lw" is sign-extended, could we replace "ld" with "lw" simply? Hi Jinyang, I'd prefer not to do so. In future we may have kernel running in other spaces, (e.g. xkphys), and there is no reason to add a barrier on that without actual benefit. I had check PMON firmware and it's also loading the full 64-bit address. Also to keep consistent, mailbox writing part needs to be refined to match the behavior of reading. Otherwise other readers will be confused. Thus leaving it as is looks much more reasonable. Thanks. - Jiaxun Thanks, Jinyang + " lw %[initfunc], 0x20(%[base]) \n" /* check lower 32-bit as jump indicator */ " beqz %[initfunc], 1b \n" " nop \n" + " ld %[initfunc], 0x20(%[base]) \n" /* get PC (whole 64-bit) via mailbox */ " ld $sp, 0x28(%[base]) \n" /* get SP via mailbox */ " ld $gp, 0x30(%[base]) \n" /* get GP via mailbox */ " ld $a1, 0x38(%[base]) \n"
[PATCH 2/2] remoteproc: qcom_q6v5_mss: map/unmap MBA region before/after use
The application processor accessing the MBA region after assigning it to the remote Q6 would lead to an XPU violation. Fix this by un-mapping the MBA region post firmware copy and MBA text log dumps. Signed-off-by: Sibi Sankar --- drivers/remoteproc/qcom_q6v5_mss.c | 37 ++--- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/drivers/remoteproc/qcom_q6v5_mss.c b/drivers/remoteproc/qcom_q6v5_mss.c index 2c866b6da23c..1b4a34325788 100644 --- a/drivers/remoteproc/qcom_q6v5_mss.c +++ b/drivers/remoteproc/qcom_q6v5_mss.c @@ -189,7 +189,6 @@ struct q6v5 { size_t total_dump_size; phys_addr_t mba_phys; - void *mba_region; size_t mba_size; size_t dp_size; @@ -408,7 +407,7 @@ static int q6v5_xfer_mem_ownership(struct q6v5 *qproc, int *current_perm, current_perm, next, perms); } -static void q6v5_debug_policy_load(struct q6v5 *qproc) +static void q6v5_debug_policy_load(struct q6v5 *qproc, void *ptr) { const struct firmware *dp_fw; @@ -416,7 +415,7 @@ static void q6v5_debug_policy_load(struct q6v5 *qproc) return; if (SZ_1M + dp_fw->size <= qproc->mba_size) { - memcpy(qproc->mba_region + SZ_1M, dp_fw->data, dp_fw->size); + memcpy(ptr + SZ_1M, dp_fw->data, dp_fw->size); qproc->dp_size = dp_fw->size; } @@ -426,6 +425,7 @@ static void q6v5_debug_policy_load(struct q6v5 *qproc) static int q6v5_load(struct rproc *rproc, const struct firmware *fw) { struct q6v5 *qproc = rproc->priv; + void *ptr; /* MBA is restricted to a maximum size of 1M */ if (fw->size > qproc->mba_size || fw->size > SZ_1M) { @@ -433,8 +433,16 @@ static int q6v5_load(struct rproc *rproc, const struct firmware *fw) return -EINVAL; } - memcpy(qproc->mba_region, fw->data, fw->size); - q6v5_debug_policy_load(qproc); + ptr = memremap(qproc->mba_phys, qproc->mba_size, MEMREMAP_WC); + if (!ptr) { + dev_err(qproc->dev, "unable to map memory region: %pa+%zx\n", + >mba_phys, qproc->mba_size); + return -EBUSY; + } + + memcpy(ptr, fw->data, fw->size); + q6v5_debug_policy_load(qproc, ptr); + memunmap(ptr); return 0; } @@ -541,6 +549,7 @@ static void q6v5_dump_mba_logs(struct q6v5 *qproc) { struct rproc *rproc = qproc->rproc; void *data; + void *ptr; if (!qproc->has_mba_logs) return; @@ -549,12 +558,16 @@ static void q6v5_dump_mba_logs(struct q6v5 *qproc) qproc->mba_size)) return; - data = vmalloc(MBA_LOG_SIZE); - if (!data) + ptr = memremap(qproc->mba_phys, qproc->mba_size, MEMREMAP_WC); + if (!ptr) return; - memcpy(data, qproc->mba_region, MBA_LOG_SIZE); - dev_coredumpv(>dev, data, MBA_LOG_SIZE, GFP_KERNEL); + data = vmalloc(MBA_LOG_SIZE); + if (data) { + memcpy(data, ptr, MBA_LOG_SIZE); + dev_coredumpv(>dev, data, MBA_LOG_SIZE, GFP_KERNEL); + } + memunmap(ptr); } static int q6v5proc_reset(struct q6v5 *qproc) @@ -1605,12 +1618,6 @@ static int q6v5_alloc_memory_region(struct q6v5 *qproc) qproc->mba_phys = r.start; qproc->mba_size = resource_size(); - qproc->mba_region = devm_ioremap_wc(qproc->dev, qproc->mba_phys, qproc->mba_size); - if (!qproc->mba_region) { - dev_err(qproc->dev, "unable to map memory region: %pa+%zx\n", - , qproc->mba_size); - return -EBUSY; - } if (!child) { node = of_parse_phandle(qproc->dev->of_node, -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
[PATCH 3/3] dmaengine: xilinx_dma: Fix SG capability check for MCDMA
From: Matthew Murrian The SG capability is inherently present with Multichannel DMA operation. The register used to check for this capability with other DMA driver types is not defined for MCDMA. Fixes: 6ccd692bfb7f ("dmaengine: xilinx_dma: Add Xilinx AXI MCDMA Engine driver support") Signed-off-by: Matthew Murrian Signed-off-by: Radhey Shyam Pandey --- drivers/dma/xilinx/xilinx_dma.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/dma/xilinx/xilinx_dma.c b/drivers/dma/xilinx/xilinx_dma.c index ade4e6e1a5bd..993297d585c0 100644 --- a/drivers/dma/xilinx/xilinx_dma.c +++ b/drivers/dma/xilinx/xilinx_dma.c @@ -2875,10 +2875,11 @@ static int xilinx_dma_chan_probe(struct xilinx_dma_device *xdev, chan->stop_transfer = xilinx_dma_stop_transfer; } - /* check if SG is enabled (only for AXIDMA and CDMA) */ + /* check if SG is enabled (only for AXIDMA, AXIMCDMA, and CDMA) */ if (xdev->dma_config->dmatype != XDMA_TYPE_VDMA) { - if (dma_ctrl_read(chan, XILINX_DMA_REG_DMASR) & - XILINX_DMA_DMASR_SG_MASK) + if (xdev->dma_config->dmatype == XDMA_TYPE_AXIMCDMA || + dma_ctrl_read(chan, XILINX_DMA_REG_DMASR) & + XILINX_DMA_DMASR_SG_MASK) chan->has_sg = true; dev_dbg(chan->dev, "ch %d: SG %s\n", chan->id, chan->has_sg ? "enabled" : "disabled"); -- 2.7.4
[PATCH 2/3] dmaengine: xilinx_dma: Fix usage of xilinx_aximcdma_tx_segment
From: Matthew Murrian Several code sections incorrectly use struct xilinx_axidma_tx_segment instead of struct xilinx_aximcdma_tx_segment when operating as Multichannel DMA. As their structures are similar, this just works. Fixes: 6ccd692bfb7f ("dmaengine: xilinx_dma: Add Xilinx AXI MCDMA Engine driver support") Signed-off-by: Matthew Murrian Signed-off-by: Radhey Shyam Pandey --- drivers/dma/xilinx/xilinx_dma.c | 29 - 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/drivers/dma/xilinx/xilinx_dma.c b/drivers/dma/xilinx/xilinx_dma.c index 9c747b08bb0f..ade4e6e1a5bd 100644 --- a/drivers/dma/xilinx/xilinx_dma.c +++ b/drivers/dma/xilinx/xilinx_dma.c @@ -948,8 +948,10 @@ static u32 xilinx_dma_get_residue(struct xilinx_dma_chan *chan, { struct xilinx_cdma_tx_segment *cdma_seg; struct xilinx_axidma_tx_segment *axidma_seg; + struct xilinx_aximcdma_tx_segment *aximcdma_seg; struct xilinx_cdma_desc_hw *cdma_hw; struct xilinx_axidma_desc_hw *axidma_hw; + struct xilinx_aximcdma_desc_hw *aximcdma_hw; struct list_head *entry; u32 residue = 0; @@ -961,13 +963,23 @@ static u32 xilinx_dma_get_residue(struct xilinx_dma_chan *chan, cdma_hw = _seg->hw; residue += (cdma_hw->control - cdma_hw->status) & chan->xdev->max_buffer_len; - } else { + } else if (chan->xdev->dma_config->dmatype == + XDMA_TYPE_AXIDMA) { axidma_seg = list_entry(entry, struct xilinx_axidma_tx_segment, node); axidma_hw = _seg->hw; residue += (axidma_hw->control - axidma_hw->status) & chan->xdev->max_buffer_len; + } else { + aximcdma_seg = + list_entry(entry, + struct xilinx_aximcdma_tx_segment, + node); + aximcdma_hw = _seg->hw; + residue += + (aximcdma_hw->control - aximcdma_hw->status) & + chan->xdev->max_buffer_len; } } @@ -1135,7 +1147,7 @@ static int xilinx_dma_alloc_chan_resources(struct dma_chan *dchan) upper_32_bits(chan->seg_p + sizeof(*chan->seg_mv) * ((i + 1) % XILINX_DMA_NUM_DESCS)); chan->seg_mv[i].phys = chan->seg_p + - sizeof(*chan->seg_v) * i; + sizeof(*chan->seg_mv) * i; list_add_tail(>seg_mv[i].node, >free_seg_list); } @@ -1560,7 +1572,7 @@ static void xilinx_dma_start_transfer(struct xilinx_dma_chan *chan) static void xilinx_mcdma_start_transfer(struct xilinx_dma_chan *chan) { struct xilinx_dma_tx_descriptor *head_desc, *tail_desc; - struct xilinx_axidma_tx_segment *tail_segment; + struct xilinx_aximcdma_tx_segment *tail_segment; u32 reg; /* @@ -1582,7 +1594,7 @@ static void xilinx_mcdma_start_transfer(struct xilinx_dma_chan *chan) tail_desc = list_last_entry(>pending_list, struct xilinx_dma_tx_descriptor, node); tail_segment = list_last_entry(_desc->segments, - struct xilinx_axidma_tx_segment, node); + struct xilinx_aximcdma_tx_segment, node); reg = dma_ctrl_read(chan, XILINX_MCDMA_CHAN_CR_OFFSET(chan->tdest)); @@ -1864,6 +1876,7 @@ static void append_desc_queue(struct xilinx_dma_chan *chan, struct xilinx_vdma_tx_segment *tail_segment; struct xilinx_dma_tx_descriptor *tail_desc; struct xilinx_axidma_tx_segment *axidma_tail_segment; + struct xilinx_aximcdma_tx_segment *aximcdma_tail_segment; struct xilinx_cdma_tx_segment *cdma_tail_segment; if (list_empty(>pending_list)) @@ -1885,11 +1898,17 @@ static void append_desc_queue(struct xilinx_dma_chan *chan, struct xilinx_cdma_tx_segment, node); cdma_tail_segment->hw.next_desc = (u32)desc->async_tx.phys; - } else { + } else if (chan->xdev->dma_config->dmatype == XDMA_TYPE_AXIDMA) { axidma_tail_segment = list_last_entry(_desc->segments, struct xilinx_axidma_tx_segment, node); axidma_tail_segment->hw.next_desc = (u32)desc->async_tx.phys; + } else { + aximcdma_tail_segment
[PATCH 1/3] dmaengine: xilinx_dma: use readl_poll_timeout_atomic variant
From: Marc Ferland The xilinx_dma_poll_timeout macro is sometimes called while holding a spinlock (see xilinx_dma_issue_pending() for an example) this means we shouldn't sleep when polling the dma channel registers. To address it in xilinx poll timeout macro use readl_poll_timeout_atomic instead of readl_poll_timeout variant. Signed-off-by: Marc Ferland Signed-off-by: Radhey Shyam Pandey --- drivers/dma/xilinx/xilinx_dma.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/dma/xilinx/xilinx_dma.c b/drivers/dma/xilinx/xilinx_dma.c index 5429497d3560..9c747b08bb0f 100644 --- a/drivers/dma/xilinx/xilinx_dma.c +++ b/drivers/dma/xilinx/xilinx_dma.c @@ -517,8 +517,8 @@ struct xilinx_dma_device { #define to_dma_tx_descriptor(tx) \ container_of(tx, struct xilinx_dma_tx_descriptor, async_tx) #define xilinx_dma_poll_timeout(chan, reg, val, cond, delay_us, timeout_us) \ - readl_poll_timeout(chan->xdev->regs + chan->ctrl_offset + reg, val, \ - cond, delay_us, timeout_us) + readl_poll_timeout_atomic(chan->xdev->regs + chan->ctrl_offset + reg, \ + val, cond, delay_us, timeout_us) /* IO accessors */ static inline u32 dma_read(struct xilinx_dma_chan *chan, u32 reg) -- 2.7.4
[PATCH 0/3] dmaengine: xilinx_dma: mcdma fixes
This patchset fixes usage of mcdma tx segment and SG capability. It also make use of readl_poll_timeout_atomic variant. Marc Ferland (1): dmaengine: xilinx_dma: use readl_poll_timeout_atomic variant Matthew Murrian (2): dmaengine: xilinx_dma: Fix usage of xilinx_aximcdma_tx_segment dmaengine: xilinx_dma: Fix SG capability check for MCDMA drivers/dma/xilinx/xilinx_dma.c | 40 ++-- 1 file changed, 30 insertions(+), 10 deletions(-) -- 2.7.4
Re: [RFC]: userspace memory reaping
On Tue 03-11-20 13:32:28, Minchan Kim wrote: > On Tue, Nov 03, 2020 at 10:35:50AM +0100, Michal Hocko wrote: > > On Mon 02-11-20 12:29:24, Suren Baghdasaryan wrote: > > [...] > > > To follow up on this. Should I post an RFC implementing SIGKILL_SYNC > > > which in addition to sending a kill signal would also reap the > > > victim's mm in the context of the caller? Maybe having some code will > > > get the discussion moving forward? > > > > Yeah, having a code, even preliminary, might help here. This definitely > > needs a good to go from process management people as that proper is land > > full of surprises... > > Just to remind a idea I suggested to reuse existing concept > > fd = pidfd_open(victim process) > fdatasync(fd); > close(fd); I must have missed this proposal. Anyway, are you suggesting fdatasync to act as a destructive operation? -- Michal Hocko SUSE Labs
Re: [PATCH bpf-next v2 7/8] bpf: Add tests for task_local_storage
Alexei Starovoitov wrote: > On Tue, Nov 3, 2020 at 5:55 PM KP Singh wrote: > > > > [...] > > > > > > > > > > I saw the docs mention that these are not exposed to tracing programs > > > > due to > > > > insufficient preemption checks. Do you think it would be okay to allow > > > > them > > > > for LSM programs? > > > > > > hmm. Isn't it allowed already? > > > The verifier does: > > > if ((is_tracing_prog_type(prog_type) || > > > prog_type == BPF_PROG_TYPE_SOCKET_FILTER) && > > > map_value_has_spin_lock(map)) { > > > verbose(env, "tracing progs cannot use bpf_spin_lock > > > yet\n"); > > > return -EINVAL; > > > } > > > > > > BPF_PROG_TYPE_LSM is not in this list. > > > > The verifier does not have any problem, it's just that the helpers are not > > exposed to LSM programs via bpf_lsm_func_proto. > > > > So all we need is: > > > > diff --git a/kernel/bpf/bpf_lsm.c b/kernel/bpf/bpf_lsm.c > > index 61f8cc52fd5b..93383df2140b 100644 > > --- a/kernel/bpf/bpf_lsm.c > > +++ b/kernel/bpf/bpf_lsm.c > > @@ -63,6 +63,10 @@ bpf_lsm_func_proto(enum bpf_func_id func_id, const > > struct bpf_prog *prog) > > return _task_storage_get_proto; > > case BPF_FUNC_task_storage_delete: > > return _task_storage_delete_proto; > > + case BPF_FUNC_spin_lock: > > + return _spin_lock_proto; > > + case BPF_FUNC_spin_unlock: > > + return _spin_unlock_proto; > > Ahh. Yes. That should do it. Right now I don't see concerns with safety > of the bpf_spin_lock in bpf_lsm progs. What about sleepable lsm hooks? Normally we wouldn't expect to sleep with a spinlock held. Should we have a check to ensure programs bpf_spin_lock are not also sleepable?
Re: [PATCH 0/2] drivers/tty: delete break after return
On Tue, Nov 03, 2020 at 10:33:22PM -0800, Bernard Zhao wrote: > This patch sereies delete break after return, which will never run. > > Signed-off-by: Bernard Zhao > *** BLURB HERE *** No blurb? > > Bernard Zhao (2): > drivers/tty: delete break after return > drivers/tty: delete break after return You sent different patches, doing different things, yet they have the same subject lines? That's not acceptable, sorry. Please fix up and resend a new version of this series. Also, you sent 4 patches, not 2. thanks, greg k-h
drivers/scsi/lpfc/lpfc_nvme.c:879:19: warning: variable 'phba' set but not used
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master head: 4ef8451b332662d004df269d4cdeb7d9f31419b5 commit: e96a22b0b7c252295180c12128af380282e3b8c5 lpfc: Refactor Send LS Abort support date: 6 months ago config: x86_64-customedconfig-lck8195-cfld1 (attached as .config) compiler: gcc-9 (Debian 9.3.0-15) 9.3.0 reproduce (this is a W=1 build): # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=e96a22b0b7c252295180c12128af380282e3b8c5 git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git git fetch --no-tags linus master git checkout e96a22b0b7c252295180c12128af380282e3b8c5 # save the attached .config to linux build tree make W=1 ARCH=x86_64 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot All warnings (new ones prefixed by >>): drivers/scsi/lpfc/lpfc_nvme.c: In function 'lpfc_nvme_ls_abort': >> drivers/scsi/lpfc/lpfc_nvme.c:879:19: warning: variable 'phba' set but not >> used [-Wunused-but-set-variable] 879 | struct lpfc_hba *phba; | ^~~~ vim +/phba +879 drivers/scsi/lpfc/lpfc_nvme.c 862 863 /** 864 * lpfc_nvme_ls_abort - Abort a prior NVME LS request 865 * @lpfc_nvme_lport: Transport localport that LS is to be issued from. 866 * @lpfc_nvme_rport: Transport remoteport that LS is to be sent to. 867 * @pnvme_lsreq - the transport nvme_ls_req structure for the LS 868 * 869 * Driver registers this routine to abort a NVME LS request that is 870 * in progress (from the transports perspective). 871 **/ 872 static void 873 lpfc_nvme_ls_abort(struct nvme_fc_local_port *pnvme_lport, 874 struct nvme_fc_remote_port *pnvme_rport, 875 struct nvmefc_ls_req *pnvme_lsreq) 876 { 877 struct lpfc_nvme_lport *lport; 878 struct lpfc_vport *vport; > 879 struct lpfc_hba *phba; 880 struct lpfc_nodelist *ndlp; 881 int ret; 882 883 lport = (struct lpfc_nvme_lport *)pnvme_lport->private; 884 if (unlikely(!lport)) 885 return; 886 vport = lport->vport; 887 phba = vport->phba; 888 889 if (vport->load_flag & FC_UNLOADING) 890 return; 891 892 ndlp = lpfc_findnode_did(vport, pnvme_rport->port_id); 893 894 ret = __lpfc_nvme_ls_abort(vport, ndlp, pnvme_lsreq); 895 if (!ret) 896 atomic_inc(>xmt_ls_abort); 897 } 898 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-...@lists.01.org .config.gz Description: application/gzip
[PATCH 11/15] usb: serial: ipaq: use usb_control_msg_send()
The new usb_control_msg_send() nicely wraps usb_control_msg() with proper error check. Hence use the wrapper instead of calling usb_control_msg() directly. Signed-off-by: Himadri Pandya --- drivers/usb/serial/ipaq.c | 9 - 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/usb/serial/ipaq.c b/drivers/usb/serial/ipaq.c index f81746c3c26c..99505a76035d 100644 --- a/drivers/usb/serial/ipaq.c +++ b/drivers/usb/serial/ipaq.c @@ -530,15 +530,14 @@ static int ipaq_open(struct tty_struct *tty, */ while (retries) { retries--; - result = usb_control_msg(serial->dev, - usb_sndctrlpipe(serial->dev, 0), 0x22, 0x21, - 0x1, 0, NULL, 0, 100); - if (!result) + result = usb_control_msg_send(serial->dev, 0, 0x22, 0x21, 0x1, + 0, NULL, 0, 100, GFP_KERNEL); + if (result == 0) break; msleep(1000); } - if (!retries && result) { + if (result) { dev_err(>dev, "%s - failed doing control urb, error %d\n", __func__, result); return result; -- 2.17.1
[PATCH 07/15] usb: serial: f81534: use usb_control_msg_recv() and usb_control_msg_send()
The new usb_control_msg_recv() and usb_control_msg_send() nicely wraps usb_control_msg() with proper error check. Hence use the wrappers instead of calling usb_control_msg() directly. Signed-off-by: Himadri Pandya --- drivers/usb/serial/f81534.c | 63 +++-- 1 file changed, 18 insertions(+), 45 deletions(-) diff --git a/drivers/usb/serial/f81534.c b/drivers/usb/serial/f81534.c index 5661fd03e545..23eb17a2c052 100644 --- a/drivers/usb/serial/f81534.c +++ b/drivers/usb/serial/f81534.c @@ -217,38 +217,26 @@ static int f81534_set_register(struct usb_serial *serial, u16 reg, u8 data) struct usb_device *dev = serial->dev; size_t count = F81534_USB_MAX_RETRY; int status; - u8 *tmp; - - tmp = kmalloc(sizeof(u8), GFP_KERNEL); - if (!tmp) - return -ENOMEM; - - *tmp = data; /* * Our device maybe not reply when heavily loading, We'll retry for * F81534_USB_MAX_RETRY times. */ while (count--) { - status = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), -F81534_SET_GET_REGISTER, -USB_TYPE_VENDOR | USB_DIR_OUT, -reg, 0, tmp, sizeof(u8), -F81534_USB_TIMEOUT); - if (status > 0) { - status = 0; - break; - } else if (status == 0) { - status = -EIO; + status = usb_control_msg_send(dev, 0, F81534_SET_GET_REGISTER, + USB_TYPE_VENDOR | USB_DIR_OUT, + reg, 0, , sizeof(u8), + F81534_USB_TIMEOUT, GFP_KERNEL); + if (status) { + /* Try again */ + continue; } } - if (status < 0) { + if (status) dev_err(>dev, "%s: reg: %x data: %x failed: %d\n", - __func__, reg, data, status); - } + __func__, reg, data, status); - kfree(tmp); return status; } @@ -258,40 +246,25 @@ static int f81534_get_register(struct usb_serial *serial, u16 reg, u8 *data) struct usb_device *dev = serial->dev; size_t count = F81534_USB_MAX_RETRY; int status; - u8 *tmp; - - tmp = kmalloc(sizeof(u8), GFP_KERNEL); - if (!tmp) - return -ENOMEM; /* * Our device maybe not reply when heavily loading, We'll retry for * F81534_USB_MAX_RETRY times. */ while (count--) { - status = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), -F81534_SET_GET_REGISTER, -USB_TYPE_VENDOR | USB_DIR_IN, -reg, 0, tmp, sizeof(u8), -F81534_USB_TIMEOUT); - if (status > 0) { - status = 0; - break; - } else if (status == 0) { - status = -EIO; + status = usb_control_msg_recv(dev, 0, F81534_SET_GET_REGISTER, + USB_TYPE_VENDOR | USB_DIR_IN, reg, + 0, data, sizeof(u8), + F81534_USB_TIMEOUT, GFP_KERNEL); + if (status) { + /* Try again */ + continue; } } - if (status < 0) { + if (status) dev_err(>dev, "%s: reg: %x failed: %d\n", __func__, - reg, status); - goto end; - } - - *data = *tmp; - -end: - kfree(tmp); + reg, status); return status; } -- 2.17.1
[PATCH 08/15] usb: serial: ftdi_sio: use usb_control_msg_recv() and usb_control_msg_send()
The new usb_control_msg_recv() and usb_control_msg_send() nicely wraps usb_control_msg() with proper error check. Hence use the wrappers instead of calling usb_control_msg() directly. Signed-off-by: Himadri Pandya --- drivers/usb/serial/ftdi_sio.c | 182 +++--- 1 file changed, 78 insertions(+), 104 deletions(-) diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index e0f4c3d9649c..37e9e75b90d0 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c @@ -1245,13 +1245,12 @@ static int update_mctrl(struct usb_serial_port *port, unsigned int set, value |= FTDI_SIO_SET_DTR_HIGH; if (set & TIOCM_RTS) value |= FTDI_SIO_SET_RTS_HIGH; - rv = usb_control_msg(port->serial->dev, - usb_sndctrlpipe(port->serial->dev, 0), - FTDI_SIO_SET_MODEM_CTRL_REQUEST, - FTDI_SIO_SET_MODEM_CTRL_REQUEST_TYPE, - value, priv->interface, - NULL, 0, WDR_TIMEOUT); - if (rv < 0) { + rv = usb_control_msg_send(port->serial->dev, 0, + FTDI_SIO_SET_MODEM_CTRL_REQUEST, + FTDI_SIO_SET_MODEM_CTRL_REQUEST_TYPE, + value, priv->interface, + NULL, 0, WDR_TIMEOUT, GFP_KERNEL); + if (rv) { dev_dbg(dev, "%s Error from MODEM_CTRL urb: DTR %s, RTS %s\n", __func__, (set & TIOCM_DTR) ? "HIGH" : (clear & TIOCM_DTR) ? "LOW" : "unchanged", @@ -1393,12 +1392,11 @@ static int change_speed(struct tty_struct *tty, struct usb_serial_port *port) index = (u16)((index << 8) | priv->interface); } - rv = usb_control_msg(port->serial->dev, - usb_sndctrlpipe(port->serial->dev, 0), - FTDI_SIO_SET_BAUDRATE_REQUEST, - FTDI_SIO_SET_BAUDRATE_REQUEST_TYPE, - value, index, - NULL, 0, WDR_SHORT_TIMEOUT); + rv = usb_control_msg_send(port->serial->dev, 0, + FTDI_SIO_SET_BAUDRATE_REQUEST, + FTDI_SIO_SET_BAUDRATE_REQUEST_TYPE, + value, index, + NULL, 0, WDR_SHORT_TIMEOUT, GFP_KERNEL); return rv; } @@ -1417,13 +1415,12 @@ static int write_latency_timer(struct usb_serial_port *port) dev_dbg(>dev, "%s: setting latency timer = %i\n", __func__, l); - rv = usb_control_msg(udev, -usb_sndctrlpipe(udev, 0), -FTDI_SIO_SET_LATENCY_TIMER_REQUEST, -FTDI_SIO_SET_LATENCY_TIMER_REQUEST_TYPE, -l, priv->interface, -NULL, 0, WDR_TIMEOUT); - if (rv < 0) + rv = usb_control_msg_send(udev, 0, + FTDI_SIO_SET_LATENCY_TIMER_REQUEST, + FTDI_SIO_SET_LATENCY_TIMER_REQUEST_TYPE, + l, priv->interface, + NULL, 0, WDR_TIMEOUT, GFP_KERNEL); + if (rv) dev_err(>dev, "Unable to write latency timer: %i\n", rv); return rv; } @@ -1432,27 +1429,16 @@ static int _read_latency_timer(struct usb_serial_port *port) { struct ftdi_private *priv = usb_get_serial_port_data(port); struct usb_device *udev = port->serial->dev; - unsigned char *buf; + u8 buf; int rv; - buf = kmalloc(1, GFP_KERNEL); - if (!buf) - return -ENOMEM; - - rv = usb_control_msg(udev, -usb_rcvctrlpipe(udev, 0), -FTDI_SIO_GET_LATENCY_TIMER_REQUEST, -FTDI_SIO_GET_LATENCY_TIMER_REQUEST_TYPE, -0, priv->interface, -buf, 1, WDR_TIMEOUT); - if (rv < 1) { - if (rv >= 0) - rv = -EIO; - } else { - rv = buf[0]; - } - - kfree(buf); + rv = usb_control_msg_recv(udev, 0, + FTDI_SIO_GET_LATENCY_TIMER_REQUEST, + FTDI_SIO_GET_LATENCY_TIMER_REQUEST_TYPE, + 0, priv->interface, + , 1, WDR_TIMEOUT, GFP_KERNEL); + if (rv == 0) + rv = buf; return rv; } @@ -1731,13 +1717,12 @@ static ssize_t event_char_store(struct device *dev, dev_dbg(>dev, "%s: setting event char = 0x%03x\n", __func__, v); - rv = usb_control_msg(udev, -usb_sndctrlpipe(udev, 0), -
[PATCH 06/15] usb: serial: f81232: use usb_control_msg_recv() and usb_control_msg_send()
The new usb_control_msg_recv() and usb_control_msg_send() nicely wraps usb_control_msg() with proper error check. Hence use the wrappers instead of calling usb_control_msg() directly. Signed-off-by: Himadri Pandya --- drivers/usb/serial/f81232.c | 88 - 1 file changed, 18 insertions(+), 70 deletions(-) diff --git a/drivers/usb/serial/f81232.c b/drivers/usb/serial/f81232.c index 0c7eacc630e0..78107feef8a8 100644 --- a/drivers/usb/serial/f81232.c +++ b/drivers/usb/serial/f81232.c @@ -139,71 +139,36 @@ static int calc_baud_divisor(speed_t baudrate, speed_t clockrate) static int f81232_get_register(struct usb_serial_port *port, u16 reg, u8 *val) { int status; - u8 *tmp; struct usb_device *dev = port->serial->dev; - tmp = kmalloc(sizeof(*val), GFP_KERNEL); - if (!tmp) - return -ENOMEM; - - status = usb_control_msg(dev, - usb_rcvctrlpipe(dev, 0), - F81232_REGISTER_REQUEST, - F81232_GET_REGISTER, - reg, - 0, - tmp, - sizeof(*val), - USB_CTRL_GET_TIMEOUT); - if (status != sizeof(*val)) { + status = usb_control_msg_recv(dev, 0, F81232_REGISTER_REQUEST, + F81232_GET_REGISTER, reg, 0, val, + sizeof(*val), USB_CTRL_GET_TIMEOUT, + GFP_KERNEL); + if (status) { dev_err(>dev, "%s failed status: %d\n", __func__, status); - if (status < 0) - status = usb_translate_errors(status); - else - status = -EIO; - } else { - status = 0; - *val = *tmp; + status = usb_translate_errors(status); } - kfree(tmp); return status; } static int f81232_set_register(struct usb_serial_port *port, u16 reg, u8 val) { int status; - u8 *tmp; struct usb_device *dev = port->serial->dev; - tmp = kmalloc(sizeof(val), GFP_KERNEL); - if (!tmp) - return -ENOMEM; - - *tmp = val; - - status = usb_control_msg(dev, - usb_sndctrlpipe(dev, 0), - F81232_REGISTER_REQUEST, - F81232_SET_REGISTER, - reg, - 0, - tmp, - sizeof(val), - USB_CTRL_SET_TIMEOUT); - if (status != sizeof(val)) { + status = usb_control_msg_send(dev, 0, + F81232_REGISTER_REQUEST, + F81232_SET_REGISTER, reg, 0, + , sizeof(val), USB_CTRL_SET_TIMEOUT, + GFP_KERNEL); + if (status) { dev_err(>dev, "%s failed status: %d\n", __func__, status); - if (status < 0) - status = usb_translate_errors(status); - else - status = -EIO; - } else { - status = 0; + status = usb_translate_errors(status); } - - kfree(tmp); return status; } @@ -866,32 +831,16 @@ static int f81534a_ctrl_set_register(struct usb_interface *intf, u16 reg, struct usb_device *dev = interface_to_usbdev(intf); int retry = F81534A_ACCESS_REG_RETRY; int status; - u8 *tmp; - - tmp = kmemdup(val, size, GFP_KERNEL); - if (!tmp) - return -ENOMEM; while (retry--) { - status = usb_control_msg(dev, - usb_sndctrlpipe(dev, 0), - F81232_REGISTER_REQUEST, - F81232_SET_REGISTER, - reg, - 0, - tmp, - size, - USB_CTRL_SET_TIMEOUT); - if (status < 0) { + status = usb_control_msg_send(dev, 0, F81232_REGISTER_REQUEST, + F81232_SET_REGISTER, reg, 0, val, + size, USB_CTRL_SET_TIMEOUT, GFP_KERNEL); + if (status) { + /* Retry on error or short transfers */ status = usb_translate_errors(status); if (status == -EIO) continue; - } else if (status != size) { - /* Retry on short transfers */ -
[PATCH 13/15] usb: serial: iuu_phoenix: use usb_control_msg_send()
The new usb_control_msg_send() nicely wraps usb_control_msg() with proper error check. Hence use the wrapper instead of calling usb_control_msg() directly. Signed-off-by: Himadri Pandya --- drivers/usb/serial/iuu_phoenix.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/usb/serial/iuu_phoenix.c b/drivers/usb/serial/iuu_phoenix.c index b4ba79123d9d..dfbcdcec94e7 100644 --- a/drivers/usb/serial/iuu_phoenix.c +++ b/drivers/usb/serial/iuu_phoenix.c @@ -968,9 +968,8 @@ static int iuu_open(struct tty_struct *tty, struct usb_serial_port *port) priv->poll = 0; #define SOUP(a, b, c, d) do { \ - result = usb_control_msg(port->serial->dev, \ - usb_sndctrlpipe(port->serial->dev, 0), \ - b, a, c, d, NULL, 0, 1000); \ + result = usb_control_msg_send(port->serial->dev, 0, b, a, c, d, NULL,\ + 0, 1000, GFP_KERNEL); \ dev_dbg(dev, "0x%x:0x%x:0x%x:0x%x %d\n", a, b, c, d, result); } while (0) /* This is not UART related but IUU USB driver related or something */ -- 2.17.1
[PATCH 15/15] usb: serial: kl5kusb105: use usb_control_msg_recv() and usb_control_msg_send()
The new usb_control_msg_recv() and usb_control_msg_send() nicely wraps usb_control_msg() with proper error check. Hence use the wrappers instead of calling usb_control_msg() directly Signed-off-by: Himadri Pandya --- drivers/usb/serial/kl5kusb105.c | 94 +++-- 1 file changed, 44 insertions(+), 50 deletions(-) diff --git a/drivers/usb/serial/kl5kusb105.c b/drivers/usb/serial/kl5kusb105.c index 5ee48b0650c4..75cfd1c907f3 100644 --- a/drivers/usb/serial/kl5kusb105.c +++ b/drivers/usb/serial/kl5kusb105.c @@ -124,16 +124,17 @@ static int klsi_105_chg_port_settings(struct usb_serial_port *port, { int rc; - rc = usb_control_msg(port->serial->dev, - usb_sndctrlpipe(port->serial->dev, 0), - KL5KUSB105A_SIO_SET_DATA, - USB_TYPE_VENDOR | USB_DIR_OUT | USB_RECIP_INTERFACE, - 0, /* value */ - 0, /* index */ - settings, - sizeof(struct klsi_105_port_settings), - KLSI_TIMEOUT); - if (rc < 0) + rc = usb_control_msg_send(port->serial->dev, 0, + KL5KUSB105A_SIO_SET_DATA, + USB_TYPE_VENDOR | USB_DIR_OUT | + USB_RECIP_INTERFACE, + 0, /* value */ + 0, /* index */ + settings, + sizeof(struct klsi_105_port_settings), + KLSI_TIMEOUT, + GFP_KERNEL); + if (rc) dev_err(>dev, "Change port settings failed (error = %d)\n", rc); @@ -167,28 +168,21 @@ static int klsi_105_get_line_state(struct usb_serial_port *port, unsigned long *line_state_p) { int rc; - u8 *status_buf; + u8 status_buf[2]; __u16 status; - status_buf = kmalloc(KLSI_STATUSBUF_LEN, GFP_KERNEL); - if (!status_buf) - return -ENOMEM; - status_buf[0] = 0xff; status_buf[1] = 0xff; - rc = usb_control_msg(port->serial->dev, -usb_rcvctrlpipe(port->serial->dev, 0), -KL5KUSB105A_SIO_POLL, -USB_TYPE_VENDOR | USB_DIR_IN, -0, /* value */ -0, /* index */ -status_buf, KLSI_STATUSBUF_LEN, -1 -); - if (rc != KLSI_STATUSBUF_LEN) { + rc = usb_control_msg_recv(port->serial->dev, 0, + KL5KUSB105A_SIO_POLL, + USB_TYPE_VENDOR | USB_DIR_IN, + 0, /* value */ + 0, /* index */ + _buf, KLSI_STATUSBUF_LEN, + 1, + GFP_KERNEL); + if (rc) { dev_err(>dev, "reading line status failed: %d\n", rc); - if (rc >= 0) - rc = -EIO; } else { status = get_unaligned_le16(status_buf); @@ -198,7 +192,6 @@ static int klsi_105_get_line_state(struct usb_serial_port *port, *line_state_p = klsi_105_status2linestate(status); } - kfree(status_buf); return rc; } @@ -283,16 +276,17 @@ static int klsi_105_open(struct tty_struct *tty, struct usb_serial_port *port) goto err_free_cfg; } - rc = usb_control_msg(port->serial->dev, -usb_sndctrlpipe(port->serial->dev, 0), -KL5KUSB105A_SIO_CONFIGURE, -USB_TYPE_VENDOR|USB_DIR_OUT|USB_RECIP_INTERFACE, -KL5KUSB105A_SIO_CONFIGURE_READ_ON, -0, /* index */ -NULL, -0, -KLSI_TIMEOUT); - if (rc < 0) { + rc = usb_control_msg_send(port->serial->dev, 0, + KL5KUSB105A_SIO_CONFIGURE, + USB_TYPE_VENDOR | USB_DIR_OUT | + USB_RECIP_INTERFACE, + KL5KUSB105A_SIO_CONFIGURE_READ_ON, + 0, /* index */ + NULL, + 0, + KLSI_TIMEOUT, + GFP_KERNEL); + if (rc) { dev_err(>dev, "Enabling read failed (error = %d)\n", rc); retval = rc; goto err_generic_close; @@ -314,14 +308,14 @@ static int klsi_105_open(struct tty_struct *tty, struct
[PATCH 10/15] usb: serial: io_ti: use usb_control_msg_recv() and usb_control_msg_send()
The new usb_control_msg_recv() and usb_control_msg_send() nicely wraps usb_control_msg() with proper error check. Hence use the wrappers instead of calling usb_control_msg() directly Signed-off-by: Himadri Pandya --- drivers/usb/serial/io_ti.c | 28 ++-- 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/drivers/usb/serial/io_ti.c b/drivers/usb/serial/io_ti.c index c327d4cf7928..ab2370b80b3c 100644 --- a/drivers/usb/serial/io_ti.c +++ b/drivers/usb/serial/io_ti.c @@ -260,16 +260,12 @@ static int ti_vread_sync(struct usb_device *dev, __u8 request, { int status; - status = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), request, - (USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN), - value, index, data, size, 1000); - if (status < 0) + status = usb_control_msg_recv(dev, 0, request, USB_TYPE_VENDOR | + USB_RECIP_DEVICE | USB_DIR_IN, value, + index, data, size, 1000, GFP_KERNEL); + if (status) return status; - if (status != size) { - dev_dbg(>dev, "%s - wanted to write %d, but only wrote %d\n", - __func__, size, status); - return -ECOMM; - } + return 0; } @@ -278,16 +274,12 @@ static int ti_vsend_sync(struct usb_device *dev, u8 request, u16 value, { int status; - status = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), request, - (USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_OUT), - value, index, data, size, timeout); - if (status < 0) + status = usb_control_msg_send(dev, 0, request, USB_TYPE_VENDOR | + USB_RECIP_DEVICE | USB_DIR_OUT, value, + index, data, size, timeout, GFP_KERNEL); + if (status) return status; - if (status != size) { - dev_dbg(>dev, "%s - wanted to write %d, but only wrote %d\n", - __func__, size, status); - return -ECOMM; - } + return 0; } -- 2.17.1
[PATCH 12/15] usb: serial: ipw: use usb_control_msg_send()
The new usb_control_msg_send() nicely wraps usb_control_msg() with proper error check. Hence use the wrapper instead of calling usb_control_msg() directly. Signed-off-by: Himadri Pandya --- drivers/usb/serial/ipw.c | 107 +-- 1 file changed, 36 insertions(+), 71 deletions(-) diff --git a/drivers/usb/serial/ipw.c b/drivers/usb/serial/ipw.c index d04c7cc5c1c2..3c3895b4dff8 100644 --- a/drivers/usb/serial/ipw.c +++ b/drivers/usb/serial/ipw.c @@ -134,26 +134,16 @@ static int ipw_open(struct tty_struct *tty, struct usb_serial_port *port) struct usb_device *udev = port->serial->dev; struct device *dev = >dev; u8 buf_flow_static[16] = IPW_BYTES_FLOWINIT; - u8 *buf_flow_init; int result; - buf_flow_init = kmemdup(buf_flow_static, 16, GFP_KERNEL); - if (!buf_flow_init) - return -ENOMEM; - /* --1: Tell the modem to initialize (we think) From sniffs this is * always the first thing that gets sent to the modem during * opening of the device */ dev_dbg(dev, "%s: Sending SIO_INIT (we guess)\n", __func__); - result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), -IPW_SIO_INIT, -USB_TYPE_VENDOR | USB_RECIP_INTERFACE | USB_DIR_OUT, -0, -0, /* index */ -NULL, -0, -10); - if (result < 0) + result = usb_control_msg_send(udev, 0, IPW_SIO_INIT, USB_TYPE_VENDOR | + USB_RECIP_INTERFACE | USB_DIR_OUT, 0, + 0, NULL, 0, 10, GFP_KERNEL); + if (result) dev_err(dev, "Init of modem failed (error = %d)\n", result); /* reset the bulk pipes */ @@ -166,31 +156,22 @@ static int ipw_open(struct tty_struct *tty, struct usb_serial_port *port) /*--3: Tell the modem to open the floodgates on the rx bulk channel */ dev_dbg(dev, "%s:asking modem for RxRead (RXBULK_ON)\n", __func__); - result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), -IPW_SIO_RXCTL, -USB_TYPE_VENDOR | USB_RECIP_INTERFACE | USB_DIR_OUT, -IPW_RXBULK_ON, -0, /* index */ -NULL, -0, -10); - if (result < 0) + result = usb_control_msg_send(udev, 0, IPW_SIO_RXCTL, USB_TYPE_VENDOR | + USB_RECIP_INTERFACE | USB_DIR_OUT, + IPW_RXBULK_ON, 0, NULL, 0, 10, + GFP_KERNEL); + if (result) dev_err(dev, "Enabling bulk RxRead failed (error = %d)\n", result); /*--4: setup the initial flowcontrol */ - dev_dbg(dev, "%s:setting init flowcontrol (%s)\n", __func__, buf_flow_init); - result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), -IPW_SIO_HANDFLOW, -USB_TYPE_VENDOR | USB_RECIP_INTERFACE | USB_DIR_OUT, -0, -0, -buf_flow_init, -0x10, -20); - if (result < 0) + dev_dbg(dev, "%s:setting init flowcontrol (%s)\n", __func__, buf_flow_static); + result = usb_control_msg_send(udev, 0, IPW_SIO_HANDFLOW, + USB_TYPE_VENDOR | USB_RECIP_INTERFACE | + USB_DIR_OUT, 0, 0, _flow_static, 0x10, + 20, GFP_KERNEL); + if (result) dev_err(dev, "initial flowcontrol failed (error = %d)\n", result); - kfree(buf_flow_init); return 0; } @@ -223,26 +204,20 @@ static void ipw_dtr_rts(struct usb_serial_port *port, int on) dev_dbg(dev, "%s: on = %d\n", __func__, on); - result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), -IPW_SIO_SET_PIN, -USB_TYPE_VENDOR | USB_RECIP_INTERFACE | USB_DIR_OUT, -on ? IPW_PIN_SETDTR : IPW_PIN_CLRDTR, -0, -NULL, -0, -20); - if (result < 0) + result = usb_control_msg_send(udev, 0, IPW_SIO_SET_PIN, + USB_TYPE_VENDOR | USB_RECIP_INTERFACE | + USB_DIR_OUT, + on ? IPW_PIN_SETDTR : IPW_PIN_CLRDTR, 0, + NULL, 0, 20, GFP_KERNEL); + if (result) dev_err(dev, "setting dtr failed (error = %d)\n", result); - result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), -
[PATCH 14/15] usb: serial: keyspan_pda: use usb_control_msg_recv() and usb_control_msg_send()
The new usb_control_msg_recv() and usb_control_msg_send() nicely wraps usb_control_msg() with proper error check. Hence use the wrappers instead of calling usb_control_msg() directly. Signed-off-by: Himadri Pandya --- drivers/usb/serial/keyspan_pda.c | 172 +-- 1 file changed, 72 insertions(+), 100 deletions(-) diff --git a/drivers/usb/serial/keyspan_pda.c b/drivers/usb/serial/keyspan_pda.c index c1333919716b..44e1c4490fa9 100644 --- a/drivers/usb/serial/keyspan_pda.c +++ b/drivers/usb/serial/keyspan_pda.c @@ -115,17 +115,17 @@ static void keyspan_pda_request_unthrottle(struct work_struct *work) /* ask the device to tell us when the tx buffer becomes sufficiently empty */ - result = usb_control_msg(serial->dev, -usb_sndctrlpipe(serial->dev, 0), -7, /* request_unthrottle */ -USB_TYPE_VENDOR | USB_RECIP_INTERFACE -| USB_DIR_OUT, -16, /* value: threshold */ -0, /* index */ -NULL, -0, -2000); - if (result < 0) + result = usb_control_msg_send(serial->dev, 0, + 7, /* request_unthrottle */ + USB_TYPE_VENDOR | USB_RECIP_INTERFACE + | USB_DIR_OUT, + 16, /* value: threshold */ + 0, /* index */ + NULL, + 0, + 2000, + GFP_KERNEL); + if (result) dev_dbg(>dev->dev, "%s - error %d from usb_control_msg\n", __func__, result); } @@ -269,17 +269,18 @@ static speed_t keyspan_pda_setbaud(struct usb_serial *serial, speed_t baud) /* rather than figure out how to sleep while waiting for this to complete, I just use the "legacy" API. */ - rc = usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0), -0, /* set baud */ -USB_TYPE_VENDOR -| USB_RECIP_INTERFACE -| USB_DIR_OUT, /* type */ -bindex, /* value */ -0, /* index */ -NULL, /* */ -0, /* size */ -2000); /* timeout */ - if (rc < 0) + rc = usb_control_msg_send(serial->dev, 0, + 0, /* set baud */ + USB_TYPE_VENDOR + | USB_RECIP_INTERFACE + | USB_DIR_OUT, /* type */ + bindex, /* value */ + 0, /* index */ + NULL, /* */ + 0, /* size */ + 2000, /* timeout */ + GFP_KERNEL); + if (rc) return 0; return baud; } @@ -296,11 +297,12 @@ static void keyspan_pda_break_ctl(struct tty_struct *tty, int break_state) value = 1; /* start break */ else value = 0; /* clear break */ - result = usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0), - 4, /* set break */ - USB_TYPE_VENDOR | USB_RECIP_INTERFACE | USB_DIR_OUT, - value, 0, NULL, 0, 2000); - if (result < 0) + result = usb_control_msg_send(serial->dev, 0, + 4, /* set break */ + USB_TYPE_VENDOR | USB_RECIP_INTERFACE | + USB_DIR_OUT, + value, 0, NULL, 0, 2000, GFP_KERNEL); + if (result) dev_dbg(>dev, "%s - error %d from usb_control_msg\n", __func__, result); /* there is something funky about this.. the TCSBRK that 'cu' performs @@ -359,22 +361,11 @@ static int keyspan_pda_get_modem_info(struct usb_serial *serial, unsigned char *value) { int rc; - u8 *data; - - data = kmalloc(1, GFP_KERNEL); - if (!data) - return -ENOMEM; - - rc = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0), -3, /* get pins */ -USB_TYPE_VENDOR|USB_RECIP_INTERFACE|USB_DIR_IN, -0, 0, data, 1, 2000); - if (rc == 1) - *value = *data; - else if (rc >= 0) - rc = -EIO; - -
[PATCH 09/15] usb: serial: io_edgeport: use usb_control_msg_recv() and usb_control_msg_send()
The new usb_control_msg_recv() and usb_control_msg_send() nicely wraps usb_control_msg() with proper error check. Hence use the wrappers instead of calling usb_control_msg() directly. Signed-off-by: Himadri Pandya --- drivers/usb/serial/io_edgeport.c | 73 1 file changed, 27 insertions(+), 46 deletions(-) diff --git a/drivers/usb/serial/io_edgeport.c b/drivers/usb/serial/io_edgeport.c index ba5d8df69518..8479d5684af7 100644 --- a/drivers/usb/serial/io_edgeport.c +++ b/drivers/usb/serial/io_edgeport.c @@ -568,34 +568,29 @@ static int get_epic_descriptor(struct edgeport_serial *ep) int result; struct usb_serial *serial = ep->serial; struct edgeport_product_info *product_info = >product_info; - struct edge_compatibility_descriptor *epic; + struct edge_compatibility_descriptor epic; struct edge_compatibility_bits *bits; struct device *dev = >dev->dev; ep->is_epic = 0; - epic = kmalloc(sizeof(*epic), GFP_KERNEL); - if (!epic) - return -ENOMEM; - - result = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0), -USB_REQUEST_ION_GET_EPIC_DESC, -0xC0, 0x00, 0x00, -epic, sizeof(*epic), -300); - if (result == sizeof(*epic)) { + result = usb_control_msg_recv(serial->dev, 0, + USB_REQUEST_ION_GET_EPIC_DESC, 0xC0, + 0x00, 0x00, , sizeof(epic), 300, + GFP_KERNEL); + if (result) { ep->is_epic = 1; - memcpy(>epic_descriptor, epic, sizeof(*epic)); + memcpy(>epic_descriptor, , sizeof(epic)); memset(product_info, 0, sizeof(struct edgeport_product_info)); - product_info->NumPorts = epic->NumPorts; + product_info->NumPorts = epic.NumPorts; product_info->ProdInfoVer = 0; - product_info->FirmwareMajorVersion = epic->MajorVersion; - product_info->FirmwareMinorVersion = epic->MinorVersion; - product_info->FirmwareBuildNumber = epic->BuildNumber; - product_info->iDownloadFile = epic->iDownloadFile; - product_info->EpicVer = epic->EpicVer; - product_info->Epic = epic->Supports; + product_info->FirmwareMajorVersion = epic.MajorVersion; + product_info->FirmwareMinorVersion = epic.MinorVersion; + product_info->FirmwareBuildNumber = epic.BuildNumber; + product_info->iDownloadFile = epic.iDownloadFile; + product_info->EpicVer = epic.EpicVer; + product_info->Epic = epic.Supports; product_info->ProductId = ION_DEVICE_ID_EDGEPORT_COMPATIBLE; dump_product_info(ep, product_info); @@ -614,16 +609,12 @@ static int get_epic_descriptor(struct edgeport_serial *ep) dev_dbg(dev, " IOSPWriteLCR : %s\n", bits->IOSPWriteLCR ? "TRUE": "FALSE"); dev_dbg(dev, " IOSPSetBaudRate : %s\n", bits->IOSPSetBaudRate ? "TRUE": "FALSE"); dev_dbg(dev, " TrueEdgeport : %s\n", bits->TrueEdgeport ? "TRUE": "FALSE"); - - result = 0; - } else if (result >= 0) { + } else { dev_warn(>interface->dev, "short epic descriptor received: %d\n", result); result = -EIO; } - kfree(epic); - return result; } @@ -2168,11 +2159,6 @@ static int rom_read(struct usb_serial *serial, __u16 extAddr, { int result; __u16 current_length; - unsigned char *transfer_buffer; - - transfer_buffer = kmalloc(64, GFP_KERNEL); - if (!transfer_buffer) - return -ENOMEM; /* need to split these reads up into 64 byte chunks */ result = 0; @@ -2181,25 +2167,18 @@ static int rom_read(struct usb_serial *serial, __u16 extAddr, current_length = 64; else current_length = length; - result = usb_control_msg(serial->dev, - usb_rcvctrlpipe(serial->dev, 0), - USB_REQUEST_ION_READ_ROM, - 0xC0, addr, extAddr, transfer_buffer, - current_length, 300); - if (result < current_length) { - if (result >= 0) - result = -EIO; + result = usb_control_msg_recv(serial->dev, 0, + USB_REQUEST_ION_READ_ROM, 0xC0, + addr, extAddr, data, + current_length, 300, GFP_KERNEL);
[PATCH 02/15] usb: serial: belkin_sa: use usb_control_msg_send()
The new usb_control_msg_send() nicely wraps usb_control_msg() with proper error check. Hence use the wrapper instead of calling usb_control_msg() directly. Signed-off-by: Himadri Pandya --- drivers/usb/serial/belkin_sa.c | 35 +- 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/drivers/usb/serial/belkin_sa.c b/drivers/usb/serial/belkin_sa.c index 9bb123ab9bc9..a5ff55f48303 100644 --- a/drivers/usb/serial/belkin_sa.c +++ b/drivers/usb/serial/belkin_sa.c @@ -105,9 +105,10 @@ struct belkin_sa_private { #define WDR_TIMEOUT 5000 /* default urb timeout */ /* assumes that struct usb_serial *serial is available */ -#define BSA_USB_CMD(c, v) usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0), \ - (c), BELKIN_SA_SET_REQUEST_TYPE, \ - (v), 0, NULL, 0, WDR_TIMEOUT) +#define BSA_USB_CMD(c, v) usb_control_msg_send(serial->dev, 0, (c), \ + BELKIN_SA_SET_REQUEST_TYPE, \ + (v), 0, NULL, 0, WDR_TIMEOUT, \ + GFP_KERNEL) static int belkin_sa_port_probe(struct usb_serial_port *port) { @@ -309,12 +310,11 @@ static void belkin_sa_set_termios(struct tty_struct *tty, /* reassert DTR and (maybe) RTS on transition from B0 */ if ((old_cflag & CBAUD) == B0) { control_state |= (TIOCM_DTR|TIOCM_RTS); - if (BSA_USB_CMD(BELKIN_SA_SET_DTR_REQUEST, 1) < 0) + if (BSA_USB_CMD(BELKIN_SA_SET_DTR_REQUEST, 1)) dev_err(>dev, "Set DTR error\n"); /* don't set RTS if using hardware flow control */ if (!(old_cflag & CRTSCTS)) - if (BSA_USB_CMD(BELKIN_SA_SET_RTS_REQUEST - , 1) < 0) + if (BSA_USB_CMD(BELKIN_SA_SET_RTS_REQUEST, 1)) dev_err(>dev, "Set RTS error\n"); } } @@ -330,18 +330,18 @@ static void belkin_sa_set_termios(struct tty_struct *tty, /* Report the actual baud rate back to the caller */ tty_encode_baud_rate(tty, baud, baud); - if (BSA_USB_CMD(BELKIN_SA_SET_BAUDRATE_REQUEST, urb_value) < 0) + if (BSA_USB_CMD(BELKIN_SA_SET_BAUDRATE_REQUEST, urb_value)) dev_err(>dev, "Set baudrate error\n"); } else { /* Disable flow control */ if (BSA_USB_CMD(BELKIN_SA_SET_FLOW_CTRL_REQUEST, - BELKIN_SA_FLOW_NONE) < 0) + BELKIN_SA_FLOW_NONE)) dev_err(>dev, "Disable flowcontrol error\n"); /* Drop RTS and DTR */ control_state &= ~(TIOCM_DTR | TIOCM_RTS); - if (BSA_USB_CMD(BELKIN_SA_SET_DTR_REQUEST, 0) < 0) + if (BSA_USB_CMD(BELKIN_SA_SET_DTR_REQUEST, 0)) dev_err(>dev, "DTR LOW error\n"); - if (BSA_USB_CMD(BELKIN_SA_SET_RTS_REQUEST, 0) < 0) + if (BSA_USB_CMD(BELKIN_SA_SET_RTS_REQUEST, 0)) dev_err(>dev, "RTS LOW error\n"); } @@ -352,7 +352,7 @@ static void belkin_sa_set_termios(struct tty_struct *tty, : BELKIN_SA_PARITY_EVEN; else urb_value = BELKIN_SA_PARITY_NONE; - if (BSA_USB_CMD(BELKIN_SA_SET_PARITY_REQUEST, urb_value) < 0) + if (BSA_USB_CMD(BELKIN_SA_SET_PARITY_REQUEST, urb_value)) dev_err(>dev, "Set parity error\n"); } @@ -377,7 +377,7 @@ static void belkin_sa_set_termios(struct tty_struct *tty, urb_value = BELKIN_SA_DATA_BITS(8); break; } - if (BSA_USB_CMD(BELKIN_SA_SET_DATA_BITS_REQUEST, urb_value) < 0) + if (BSA_USB_CMD(BELKIN_SA_SET_DATA_BITS_REQUEST, urb_value)) dev_err(>dev, "Set data bits error\n"); } @@ -385,8 +385,7 @@ static void belkin_sa_set_termios(struct tty_struct *tty, if ((cflag & CSTOPB) != (old_cflag & CSTOPB)) { urb_value = (cflag & CSTOPB) ? BELKIN_SA_STOP_BITS(2) : BELKIN_SA_STOP_BITS(1); - if (BSA_USB_CMD(BELKIN_SA_SET_STOP_BITS_REQUEST, - urb_value) < 0) + if (BSA_USB_CMD(BELKIN_SA_SET_STOP_BITS_REQUEST, urb_value)) dev_err(>dev, "Set stop bits error\n"); } @@ -407,7 +406,7 @@ static void belkin_sa_set_termios(struct tty_struct *tty, if (bad_flow_control)
[PATCH 05/15] usb: serial: cypress_m8: use usb_control_msg_recv() and usb_control_msg_send()
The new usb_control_msg_recv() and usb_control_msg_send() nicely wraps usb_control_msg() with proper error check. Hence use the wrappers instead of calling usb_control_msg() directly. Signed-off-by: Himadri Pandya --- drivers/usb/serial/cypress_m8.c | 38 + 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/drivers/usb/serial/cypress_m8.c b/drivers/usb/serial/cypress_m8.c index cc028601c388..4d66cab8eece 100644 --- a/drivers/usb/serial/cypress_m8.c +++ b/drivers/usb/serial/cypress_m8.c @@ -341,20 +341,21 @@ static int cypress_serial_control(struct tty_struct *tty, feature_buffer[4]); do { - retval = usb_control_msg(port->serial->dev, - usb_sndctrlpipe(port->serial->dev, 0), - HID_REQ_SET_REPORT, - USB_DIR_OUT | USB_RECIP_INTERFACE | USB_TYPE_CLASS, - 0x0300, 0, feature_buffer, - feature_len, 500); + retval = usb_control_msg_send(port->serial->dev, 0, + HID_REQ_SET_REPORT, + USB_DIR_OUT | + USB_RECIP_INTERFACE | + USB_TYPE_CLASS, 0x0300, + 0, feature_buffer, + feature_len, 500, + GFP_KERNEL); if (tries++ >= 3) break; - } while (retval != feature_len && -retval != -ENODEV); + } while (retval != -ENODEV); - if (retval != feature_len) { + if (retval) { dev_err(dev, "%s - failed sending serial line settings - %d\n", __func__, retval); cypress_set_dead(port); @@ -379,19 +380,20 @@ static int cypress_serial_control(struct tty_struct *tty, } dev_dbg(dev, "%s - retrieving serial line settings\n", __func__); do { - retval = usb_control_msg(port->serial->dev, - usb_rcvctrlpipe(port->serial->dev, 0), - HID_REQ_GET_REPORT, - USB_DIR_IN | USB_RECIP_INTERFACE | USB_TYPE_CLASS, - 0x0300, 0, feature_buffer, - feature_len, 500); + retval = usb_control_msg_recv(port->serial->dev, 0, + HID_REQ_GET_REPORT, + USB_DIR_IN | + USB_RECIP_INTERFACE | + USB_TYPE_CLASS, 0x0300, + 0, feature_buffer, + feature_len, 500, + GFP_KERNEL); if (tries++ >= 3) break; - } while (retval != feature_len - && retval != -ENODEV); + } while (retval != -ENODEV); - if (retval != feature_len) { + if (retval) { dev_err(dev, "%s - failed to retrieve serial line settings - %d\n", __func__, retval); cypress_set_dead(port); -- 2.17.1
[PATCH 04/15] usb: serial: cp210x: use usb_control_msg_recv() and usb_control_msg_send()
The new usb_control_msg_recv() and usb_control_msg_send() nicely wraps usb_control_msg() with proper error check. Hence use the wrappers instead of calling usb_control_msg() directly. Signed-off-by: Himadri Pandya --- drivers/usb/serial/cp210x.c | 148 ++-- 1 file changed, 42 insertions(+), 106 deletions(-) diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c index d0c05aa8a0d6..29436ab392e8 100644 --- a/drivers/usb/serial/cp210x.c +++ b/drivers/usb/serial/cp210x.c @@ -555,31 +555,15 @@ static int cp210x_read_reg_block(struct usb_serial_port *port, u8 req, { struct usb_serial *serial = port->serial; struct cp210x_port_private *port_priv = usb_get_serial_port_data(port); - void *dmabuf; int result; - dmabuf = kmalloc(bufsize, GFP_KERNEL); - if (!dmabuf) { - /* -* FIXME Some callers don't bother to check for error, -* at least give them consistent junk until they are fixed -*/ - memset(buf, 0, bufsize); - return -ENOMEM; - } - - result = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0), - req, REQTYPE_INTERFACE_TO_HOST, 0, - port_priv->bInterfaceNumber, dmabuf, bufsize, - USB_CTRL_SET_TIMEOUT); - if (result == bufsize) { - memcpy(buf, dmabuf, bufsize); - result = 0; - } else { + result = usb_control_msg_recv(serial->dev, 0, req, + REQTYPE_INTERFACE_TO_HOST, 0, + port_priv->bInterfaceNumber, buf, bufsize, + USB_CTRL_SET_TIMEOUT, GFP_KERNEL); + if (result) { dev_err(>dev, "failed get req 0x%x size %d status: %d\n", - req, bufsize, result); - if (result >= 0) - result = -EIO; + req, bufsize, result); /* * FIXME Some callers don't bother to check for error, @@ -588,8 +572,6 @@ static int cp210x_read_reg_block(struct usb_serial_port *port, u8 req, memset(buf, 0, bufsize); } - kfree(dmabuf); - return result; } @@ -648,29 +630,16 @@ static int cp210x_read_u8_reg(struct usb_serial_port *port, u8 req, u8 *val) static int cp210x_read_vendor_block(struct usb_serial *serial, u8 type, u16 val, void *buf, int bufsize) { - void *dmabuf; int result; - dmabuf = kmalloc(bufsize, GFP_KERNEL); - if (!dmabuf) - return -ENOMEM; - - result = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0), -CP210X_VENDOR_SPECIFIC, type, val, -cp210x_interface_num(serial), dmabuf, bufsize, -USB_CTRL_GET_TIMEOUT); - if (result == bufsize) { - memcpy(buf, dmabuf, bufsize); - result = 0; - } else { + result = usb_control_msg_recv(serial->dev, 0, CP210X_VENDOR_SPECIFIC, + type, val, cp210x_interface_num(serial), + buf, bufsize, USB_CTRL_GET_TIMEOUT, + GFP_KERNEL); + if (result) dev_err(>interface->dev, "failed to get vendor val 0x%04x size %d: %d\n", val, bufsize, result); - if (result >= 0) - result = -EIO; - } - - kfree(dmabuf); return result; } @@ -685,14 +654,13 @@ static int cp210x_write_u16_reg(struct usb_serial_port *port, u8 req, u16 val) struct cp210x_port_private *port_priv = usb_get_serial_port_data(port); int result; - result = usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0), - req, REQTYPE_HOST_TO_INTERFACE, val, - port_priv->bInterfaceNumber, NULL, 0, - USB_CTRL_SET_TIMEOUT); - if (result < 0) { + result = usb_control_msg_send(serial->dev, 0, req, + REQTYPE_HOST_TO_INTERFACE, val, + port_priv->bInterfaceNumber, NULL, 0, + USB_CTRL_SET_TIMEOUT, GFP_KERNEL); + if (result) dev_err(>dev, "failed set request 0x%x status: %d\n", req, result); - } return result; } @@ -706,28 +674,17 @@ static int cp210x_write_reg_block(struct usb_serial_port *port, u8 req, { struct usb_serial *serial = port->serial; struct cp210x_port_private *port_priv = usb_get_serial_port_data(port); - void *dmabuf; int result; - dmabuf = kmemdup(buf, bufsize,
[PATCH 01/15] usb: serial: ark3116: use usb_control_msg_recv() and usb_control_msg_send()
The new usb_control_msg_recv() and usb_control_msg_send() nicely wraps usb_control_msg() with proper error check. Hence use the wrappers instead of calling usb_control_msg() directly. Signed-off-by: Himadri Pandya --- drivers/usb/serial/ark3116.c | 29 - 1 file changed, 4 insertions(+), 25 deletions(-) diff --git a/drivers/usb/serial/ark3116.c b/drivers/usb/serial/ark3116.c index 71a9206ea1e2..51302892c779 100644 --- a/drivers/usb/serial/ark3116.c +++ b/drivers/usb/serial/ark3116.c @@ -77,38 +77,17 @@ struct ark3116_private { static int ark3116_write_reg(struct usb_serial *serial, unsigned reg, __u8 val) { - int result; /* 0xfe 0x40 are magic values taken from original driver */ - result = usb_control_msg(serial->dev, -usb_sndctrlpipe(serial->dev, 0), -0xfe, 0x40, val, reg, -NULL, 0, ARK_TIMEOUT); - if (result) - return result; - - return 0; + return usb_control_msg_send(serial->dev, 0, 0xfe, 0x40, val, reg, NULL, 0, + ARK_TIMEOUT, GFP_KERNEL); } static int ark3116_read_reg(struct usb_serial *serial, unsigned reg, unsigned char *buf) { - int result; /* 0xfe 0xc0 are magic values taken from original driver */ - result = usb_control_msg(serial->dev, -usb_rcvctrlpipe(serial->dev, 0), -0xfe, 0xc0, 0, reg, -buf, 1, ARK_TIMEOUT); - if (result < 1) { - dev_err(>interface->dev, - "failed to read register %u: %d\n", - reg, result); - if (result >= 0) - result = -EIO; - - return result; - } - - return 0; + return usb_control_msg_recv(serial->dev, 0, 0xfe, 0xc0, 0, reg, buf, 1, + ARK_TIMEOUT, GFP_KERNEL); } static inline int calc_divisor(int bps) -- 2.17.1
[PATCH 00/15] usb: serial: avoid using usb_control_msg() directly
There are many usages of usb_control_msg() that can use the new wrapper functions usb_contro_msg_send() & usb_control_msg_recv() for better error checks on short reads and writes. Hence use them whenever possible and avoid using usb_control_msg() directly. Himadri Pandya (15): usb: serial: ark3116: use usb_control_msg_recv() and usb_control_msg_send() usb: serial: belkin_sa: use usb_control_msg_send() usb: serial: ch314: use usb_control_msg_recv() and usb_control_msg_send() usb: serial: cp210x: use usb_control_msg_recv() and usb_control_msg_send() usb: serial: cypress_m8: use usb_control_msg_recv() and usb_control_msg_send() usb: serial: f81232: use usb_control_msg_recv() and usb_control_msg_send() usb: serial: f81534: use usb_control_msg_recv() and usb_control_msg_send() usb: serial: ftdi_sio: use usb_control_msg_recv() and usb_control_msg_send() usb: serial: io_edgeport: use usb_control_msg_recv() and usb_control_msg_send() usb: serial: io_ti: use usb_control_msg_recv() and usb_control_msg_send() usb: serial: ipaq: use usb_control_msg_send() usb: serial: ipw: use usb_control_msg_send() usb: serial: iuu_phoenix: use usb_control_msg_send() usb: serial: keyspan_pda: use usb_control_msg_recv() and usb_control_msg_send() usb: serial: kl5kusb105: use usb_control_msg_recv() and usb_control_msg_send() drivers/usb/serial/ark3116.c | 29 + drivers/usb/serial/belkin_sa.c | 35 +++--- drivers/usb/serial/ch341.c | 45 +++- drivers/usb/serial/cp210x.c | 148 +++-- drivers/usb/serial/cypress_m8.c | 38 --- drivers/usb/serial/f81232.c | 88 +++ drivers/usb/serial/f81534.c | 63 +++ drivers/usb/serial/ftdi_sio.c| 182 +-- drivers/usb/serial/io_edgeport.c | 73 + drivers/usb/serial/io_ti.c | 28 ++--- drivers/usb/serial/ipaq.c| 9 +- drivers/usb/serial/ipw.c | 107 ++ drivers/usb/serial/iuu_phoenix.c | 5 +- drivers/usb/serial/keyspan_pda.c | 172 - drivers/usb/serial/kl5kusb105.c | 94 15 files changed, 406 insertions(+), 710 deletions(-) -- 2.17.1
[PATCH 03/15] usb: serial: ch314: use usb_control_msg_recv() and usb_control_msg_send()
The new usb_control_msg_recv() and usb_control_msg_send() nicely wraps usb_control_msg() with proper error check. Hence use the wrappers instead of calling usb_control_msg() directly. Signed-off-by: Himadri Pandya --- drivers/usb/serial/ch341.c | 45 -- 1 file changed, 14 insertions(+), 31 deletions(-) diff --git a/drivers/usb/serial/ch341.c b/drivers/usb/serial/ch341.c index a2e2f56c88cd..58c5d3ce4f75 100644 --- a/drivers/usb/serial/ch341.c +++ b/drivers/usb/serial/ch341.c @@ -111,10 +111,10 @@ static int ch341_control_out(struct usb_device *dev, u8 request, dev_dbg(>dev, "%s - (%02x,%04x,%04x)\n", __func__, request, value, index); - r = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), request, - USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_OUT, - value, index, NULL, 0, DEFAULT_TIMEOUT); - if (r < 0) + r = usb_control_msg_send(dev, 0, request, USB_TYPE_VENDOR | +USB_RECIP_DEVICE | USB_DIR_OUT, value, index, +NULL, 0, DEFAULT_TIMEOUT, GFP_KERNEL); + if (r) dev_err(>dev, "failed to send control message: %d\n", r); return r; @@ -129,23 +129,14 @@ static int ch341_control_in(struct usb_device *dev, dev_dbg(>dev, "%s - (%02x,%04x,%04x,%u)\n", __func__, request, value, index, bufsize); - r = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), request, - USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, - value, index, buf, bufsize, DEFAULT_TIMEOUT); - if (r < (int)bufsize) { - if (r >= 0) { - dev_err(>dev, - "short control message received (%d < %u)\n", - r, bufsize); - r = -EIO; - } - + r = usb_control_msg_recv(dev, 0, request, USB_TYPE_VENDOR | +USB_RECIP_DEVICE | USB_DIR_IN, value, index, +buf, bufsize, DEFAULT_TIMEOUT, GFP_KERNEL); + if (r) dev_err(>dev, "failed to receive control message: %d\n", r); - return r; - } - return 0; + return r; } #define CH341_CLKRATE 4800 @@ -343,22 +334,18 @@ static int ch341_detect_quirks(struct usb_serial_port *port) struct usb_device *udev = port->serial->dev; const unsigned int size = 2; unsigned long quirks = 0; - char *buffer; + u8 buffer[2]; int r; - buffer = kmalloc(size, GFP_KERNEL); - if (!buffer) - return -ENOMEM; - /* * A subset of CH34x devices does not support all features. The * prescaler is limited and there is no support for sending a RS232 * break condition. A read failure when trying to set up the latter is * used to detect these devices. */ - r = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), CH341_REQ_READ_REG, - USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, - CH341_REG_BREAK, 0, buffer, size, DEFAULT_TIMEOUT); + r = usb_control_msg_recv(udev, 0, CH341_REQ_READ_REG, USB_TYPE_VENDOR | +USB_RECIP_DEVICE | USB_DIR_IN, CH341_REG_BREAK, +0, , size, DEFAULT_TIMEOUT, GFP_KERNEL); if (r == -EPIPE) { dev_info(>dev, "break control not supported, using simulated break\n"); quirks = CH341_QUIRK_LIMITED_PRESCALER | CH341_QUIRK_SIMULATE_BREAK; @@ -366,17 +353,13 @@ static int ch341_detect_quirks(struct usb_serial_port *port) goto out; } - if (r != size) { - if (r >= 0) - r = -EIO; + if (r) { dev_err(>dev, "failed to read break control: %d\n", r); goto out; } r = 0; out: - kfree(buffer); - if (quirks) { dev_dbg(>dev, "enabling quirk flags: 0x%02lx\n", quirks); priv->quirks |= quirks; -- 2.17.1
[PATCH] ARM: OMAP2+: Remove redundant null check before clk_prepare_enable/clk_disable_unprepare
Because clk_prepare_enable() and clk_disable_unprepare() already checked NULL clock parameter, so the additional checks are unnecessary, just remove them. Signed-off-by: Xu Wang --- arch/arm/mach-omap2/display.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/arch/arm/mach-omap2/display.c b/arch/arm/mach-omap2/display.c index 2000fca6bd4e..6daaa645ae5d 100644 --- a/arch/arm/mach-omap2/display.c +++ b/arch/arm/mach-omap2/display.c @@ -385,8 +385,7 @@ int omap_dss_reset(struct omap_hwmod *oh) } for (i = oh->opt_clks_cnt, oc = oh->opt_clks; i > 0; i--, oc++) - if (oc->_clk) - clk_prepare_enable(oc->_clk); + clk_prepare_enable(oc->_clk); dispc_disable_outputs(); @@ -412,8 +411,7 @@ int omap_dss_reset(struct omap_hwmod *oh) pr_debug("dss_core: softreset done\n"); for (i = oh->opt_clks_cnt, oc = oh->opt_clks; i > 0; i--, oc++) - if (oc->_clk) - clk_disable_unprepare(oc->_clk); + clk_disable_unprepare(oc->_clk); r = (c == MAX_MODULE_SOFTRESET_WAIT) ? -ETIMEDOUT : 0; -- 2.17.1
Re: [PATCH] powerpc/32s: Setup the early hash table at all time.
Le 03/11/2020 à 19:58, Serge Belyshev a écrit : Would you mind checking that with that patch reverted, you are able to boot a kernel built with CONFIG_KASAN ? I can reproduce the same problem on a powerbook G4, and no, CONFIG_KASAN=y kernel with that patch reverted also does not boot with the same symptom: white screen at the bootloader right after "Booting Linux via __start() @ 0x014 ..." Thanks for the test Serge. To be sure we are not in front of a long lasting bug, could you try CONFIG_KASAN=y on v5.9 ? Christophe
[PATCH v2 1/2] f2fs: avoid unneeded data copy in f2fs_ioc_move_range()
Fields in struct f2fs_move_range won't change in f2fs_ioc_move_range(), let's avoid copying this structure's data to userspace. Signed-off-by: Chao Yu --- fs/f2fs/file.c | 6 -- 1 file changed, 6 deletions(-) diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index 52417a2e3f4f..22ae8ae0072f 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -2898,12 +2898,6 @@ static int f2fs_ioc_move_range(struct file *filp, unsigned long arg) range.pos_out, range.len); mnt_drop_write_file(filp); - if (err) - goto err_out; - - if (copy_to_user((struct f2fs_move_range __user *)arg, - , sizeof(range))) - err = -EFAULT; err_out: fdput(dst); return err; -- 2.26.2
[PATCH v2 2/2] f2fs: fix compat F2FS_IOC_{MOVE,GARBAGE_COLLECT}_RANGE
Eric reported a ioctl bug in below link: https://lore.kernel.org/linux-f2fs-devel/20201103032234.GB2875@sol.localdomain/ That said, on some 32-bit architectures, u64 has only 32-bit alignment, notably i386 and x86_32, so that size of struct f2fs_gc_range compiled in x86_32 is 20 bytes, however the size in x86_64 is 24 bytes, binary compiled in x86_32 can not call F2FS_IOC_GARBAGE_COLLECT_RANGE successfully due to mismatched value of ioctl command in between binary and f2fs module, similarly, F2FS_IOC_MOVE_RANGE will fail too. In this patch we introduce two ioctls for compatibility of above special 32-bit binary: - F2FS_IOC32_GARBAGE_COLLECT_RANGE - F2FS_IOC32_MOVE_RANGE Signed-off-by: Chao Yu --- v2: - fix wrong parameter passed to f2fs_ioc_gc_range and f2fs_ioc_move_range. - use -m32 to build 32-bit binary & do test on two new wrapped interfaces. fs/f2fs/file.c| 127 -- include/uapi/linux/f2fs.h | 25 2 files changed, 119 insertions(+), 33 deletions(-) diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index 22ae8ae0072f..74d555aba78f 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -2480,26 +2480,15 @@ static int f2fs_ioc_gc(struct file *filp, unsigned long arg) return ret; } -static int f2fs_ioc_gc_range(struct file *filp, unsigned long arg) +static int __f2fs_ioc_gc_range(struct file *filp, struct f2fs_gc_range *range) { struct inode *inode = file_inode(filp); struct f2fs_sb_info *sbi = F2FS_I_SB(inode); - struct f2fs_gc_range range; u64 end; int ret; - if (!capable(CAP_SYS_ADMIN)) - return -EPERM; - - if (copy_from_user(, (struct f2fs_gc_range __user *)arg, - sizeof(range))) - return -EFAULT; - - if (f2fs_readonly(sbi->sb)) - return -EROFS; - - end = range.start + range.len; - if (end < range.start || range.start < MAIN_BLKADDR(sbi) || + end = range->start + range->len; + if (end < range->start || range->start < MAIN_BLKADDR(sbi) || end >= MAX_BLKADDR(sbi)) return -EINVAL; @@ -2508,7 +2497,7 @@ static int f2fs_ioc_gc_range(struct file *filp, unsigned long arg) return ret; do_more: - if (!range.sync) { + if (!range->sync) { if (!down_write_trylock(>gc_lock)) { ret = -EBUSY; goto out; @@ -2517,20 +2506,36 @@ static int f2fs_ioc_gc_range(struct file *filp, unsigned long arg) down_write(>gc_lock); } - ret = f2fs_gc(sbi, range.sync, true, GET_SEGNO(sbi, range.start)); + ret = f2fs_gc(sbi, range->sync, true, GET_SEGNO(sbi, range->start)); if (ret) { if (ret == -EBUSY) ret = -EAGAIN; goto out; } - range.start += BLKS_PER_SEC(sbi); - if (range.start <= end) + range->start += BLKS_PER_SEC(sbi); + if (range->start <= end) goto do_more; out: mnt_drop_write_file(filp); return ret; } +static int f2fs_ioc_gc_range(struct file *filp, unsigned long arg) +{ + struct f2fs_gc_range range; + struct f2fs_sb_info *sbi = F2FS_I_SB(file_inode(filp)); + + if (!capable(CAP_SYS_ADMIN)) + return -EPERM; + if (f2fs_readonly(sbi->sb)) + return -EROFS; + if (copy_from_user(, (struct f2fs_gc_range __user *)arg, + sizeof(range))) + return -EFAULT; + + return __f2fs_ioc_gc_range(filp, ); +} + static int f2fs_ioc_write_checkpoint(struct file *filp, unsigned long arg) { struct inode *inode = file_inode(filp); @@ -2867,21 +2872,13 @@ static int f2fs_move_file_range(struct file *file_in, loff_t pos_in, return ret; } -static int f2fs_ioc_move_range(struct file *filp, unsigned long arg) +static int __f2fs_ioc_move_range(struct file *filp, + struct f2fs_move_range *range) { - struct f2fs_move_range range; struct fd dst; int err; - if (!(filp->f_mode & FMODE_READ) || - !(filp->f_mode & FMODE_WRITE)) - return -EBADF; - - if (copy_from_user(, (struct f2fs_move_range __user *)arg, - sizeof(range))) - return -EFAULT; - - dst = fdget(range.dst_fd); + dst = fdget(range->dst_fd); if (!dst.file) return -EBADF; @@ -2894,8 +2891,8 @@ static int f2fs_ioc_move_range(struct file *filp, unsigned long arg) if (err) goto err_out; - err = f2fs_move_file_range(filp, range.pos_in, dst.file, - range.pos_out, range.len); + err = f2fs_move_file_range(filp,
Re: [PATCH] platform/x86: dell-privacy: Add support for new privacy driver
Hi Perry, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on linus/master] [also build test WARNING on v5.10-rc2] [cannot apply to next-20201103] [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/Perry-Yuan/platform-x86-dell-privacy-Add-support-for-new-privacy-driver/20201103-205721 base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git b7cbaf59f62f8ab8f157698f9e31642bff525bd0 config: x86_64-randconfig-m001-20201104 (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: drivers/platform/x86/dell-wmi.c:414 dell_wmi_notify() warn: inconsistent indenting drivers/platform/x86/dell-laptop.c:2207 dell_init() warn: inconsistent indenting drivers/platform/x86/dell-laptop.c:2289 dell_exit() warn: inconsistent indenting drivers/platform/x86/dell-laptop.c:2291 dell_exit() warn: curly braces intended? vim +414 drivers/platform/x86/dell-wmi.c 83fc44c32ad8b8b Pali Rohár 2014-11-11 377 bff589be59c5092 Andy Lutomirski 2015-11-25 378 static void dell_wmi_notify(struct wmi_device *wdev, bff589be59c5092 Andy Lutomirski 2015-11-25 379 union acpi_object *obj) 0b3f6109f0c9ff9 Matthew Garrett 2009-01-09 380 { 00ebbeb39b70072 Andy Lutomirski 2017-08-01 381 struct dell_wmi_priv *priv = dev_get_drvdata(>dev); 83fc44c32ad8b8b Pali Rohár 2014-11-11 382 u16 *buffer_entry, *buffer_end; bff589be59c5092 Andy Lutomirski 2015-11-25 383 acpi_size buffer_size; 83fc44c32ad8b8b Pali Rohár 2014-11-11 384 int len, i; 0b3f6109f0c9ff9 Matthew Garrett 2009-01-09 385 83fc44c32ad8b8b Pali Rohár 2014-11-11 386 if (obj->type != ACPI_TYPE_BUFFER) { 83fc44c32ad8b8b Pali Rohár 2014-11-11 387 pr_warn("bad response type %x\n", obj->type); 5ea2559726b7862 Rezwanul Kabir 2009-11-02 388 return; 5ea2559726b7862 Rezwanul Kabir 2009-11-02 389 } 5ea2559726b7862 Rezwanul Kabir 2009-11-02 390 83fc44c32ad8b8b Pali Rohár 2014-11-11 391 pr_debug("Received WMI event (%*ph)\n", 83fc44c32ad8b8b Pali Rohár 2014-11-11 392 obj->buffer.length, obj->buffer.pointer); 83fc44c32ad8b8b Pali Rohár 2014-11-11 393 83fc44c32ad8b8b Pali Rohár 2014-11-11 394 buffer_entry = (u16 *)obj->buffer.pointer; 83fc44c32ad8b8b Pali Rohár 2014-11-11 395 buffer_size = obj->buffer.length/2; 83fc44c32ad8b8b Pali Rohár 2014-11-11 396 buffer_end = buffer_entry + buffer_size; 83fc44c32ad8b8b Pali Rohár 2014-11-11 397 481fe5be821c3d0 Pali Rohár 2016-01-04 398 /* 481fe5be821c3d0 Pali Rohár 2016-01-04 399 * BIOS/ACPI on devices with WMI interface version 0 does not clear 481fe5be821c3d0 Pali Rohár 2016-01-04 400 * buffer before filling it. So next time when BIOS/ACPI send WMI event 481fe5be821c3d0 Pali Rohár 2016-01-04 401 * which is smaller as previous then it contains garbage in buffer from 481fe5be821c3d0 Pali Rohár 2016-01-04 402 * previous event. 481fe5be821c3d0 Pali Rohár 2016-01-04 403 * 481fe5be821c3d0 Pali Rohár 2016-01-04 404 * BIOS/ACPI on devices with WMI interface version 1 clears buffer and 481fe5be821c3d0 Pali Rohár 2016-01-04 405 * sometimes send more events in buffer at one call. 481fe5be821c3d0 Pali Rohár 2016-01-04 406 * 481fe5be821c3d0 Pali Rohár 2016-01-04 407 * So to prevent reading garbage from buffer we will process only first 481fe5be821c3d0 Pali Rohár 2016-01-04 408 * one event on devices with WMI interface version 0. 481fe5be821c3d0 Pali Rohár 2016-01-04 409 */ 00ebbeb39b70072 Andy Lutomirski 2017-08-01 410 if (priv->interface_version == 0 && buffer_entry < buffer_end) 481fe5be821c3d0 Pali Rohár 2016-01-04 411 if (buffer_end > buffer_entry + buffer_entry[0] + 1) 481fe5be821c3d0 Pali Rohár 2016-01-04 412 buffer_end = buffer_entry + buffer_entry[0] + 1; 481fe5be821c3d0 Pali Rohár 2016-01-04 413 83fc44c32ad8b8b Pali Rohár 2014-11-11 @414 while (buffer_entry < buffer_end) { 83fc44c32ad8b8b Pali Rohár 2014-11-11 415 83fc44c32ad8b8b Pali Rohár 2014-11-11 416 len = buffer_entry[0]; 83fc44c32ad8b8b Pali Rohár 2014-11-11 417 if (len == 0) 83fc44c32ad8b8b Pali Rohár 2014-11-11 418 break; 83fc44c32ad8b8b Pali Rohár 2014-11-11 419 83fc44c32ad8b8b Pali Rohár 2014-11-11 420
Re: [PATCH 0/4] clk: add driver for the SiFive FU740
On Fri, Oct 16, 2020 at 10:56 PM Zong Li wrote: > > On Fri, Oct 16, 2020 at 10:17 PM Sean Anderson wrote: > > > > On 10/16/20 5:18 AM, Zong Li wrote: > > > Add a driver for the SiFive FU740 PRCI IP block, which handles more > > > clocks than FU540. These patches also refactor the original > > > implementation by spliting the dependent-code of fu540 and fu740 > > > respectively. > > > > > > Zong Li (4): > > > clk: sifive: Extract prci core to common base > > > > I don't see this patch, and it isn't listed on the web archive. Was it > > not CC'd to this list? > > > > --Sean > > > > There is a problem on linux-riscv mailing list for the first one > patch, the size of it is too big, it needs to be approved and posted > on the list by moderator. > > This patch set is also sent to clk mailing list, and I can see it on that: > https://patchwork.kernel.org/project/linux-clk/patch/b10784643665ad56ca41ea6754c7f28f8be1c7ca.1602838910.git.zong...@sifive.com/ > > > > > > > clk: sifive: Use common name for prci configuration > > > clk: sifive: Add a driver for the SiFive FU740 PRCI IP block > > > clk: sifive: Refactor __prci_clock array by using macro > > > > > > arch/riscv/Kconfig.socs | 2 +- > > > drivers/clk/sifive/Kconfig| 8 +- > > > drivers/clk/sifive/Makefile | 5 +- > > > drivers/clk/sifive/fu540-prci.c | 618 +- > > > drivers/clk/sifive/fu540-prci.h | 21 + > > > drivers/clk/sifive/fu740-prci.c | 102 +++ > > > drivers/clk/sifive/fu740-prci.h | 21 + > > > drivers/clk/sifive/sifive-prci.c | 529 +++ > > > drivers/clk/sifive/sifive-prci.h | 297 + > > > include/dt-bindings/clock/sifive-fu740-prci.h | 23 + > > > 10 files changed, 1032 insertions(+), 594 deletions(-) > > > create mode 100644 drivers/clk/sifive/fu540-prci.h > > > create mode 100644 drivers/clk/sifive/fu740-prci.c > > > create mode 100644 drivers/clk/sifive/fu740-prci.h > > > create mode 100644 drivers/clk/sifive/sifive-prci.c > > > create mode 100644 drivers/clk/sifive/sifive-prci.h > > > create mode 100644 include/dt-bindings/clock/sifive-fu740-prci.h > > > > > ping
[PATCH] RISC-V: Use non-PGD mappings for early DTB access
Currently, we use PGD mappings for early DTB mapping in early_pgd but this breaks Linux kernel on SiFive Unleashed because on SiFive Unleashed PMP checks don't work correctly for PGD mappings. To fix early DTB mappings on SiFive Unleashed, we use non-PGD mappings (i.e. PMD) for early DTB access. Fixes: 8f3a2b4a96dc ("RISC-V: Move DT mapping outof fixmap") Signed-off-by: Anup Patel --- arch/riscv/mm/init.c | 14 ++ 1 file changed, 14 insertions(+) diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c index ea933b789a88..0d13d0c36a7d 100644 --- a/arch/riscv/mm/init.c +++ b/arch/riscv/mm/init.c @@ -297,6 +297,7 @@ pmd_t fixmap_pmd[PTRS_PER_PMD] __page_aligned_bss; #define NUM_EARLY_PMDS (1UL + MAX_EARLY_MAPPING_SIZE / PGDIR_SIZE) #endif pmd_t early_pmd[PTRS_PER_PMD * NUM_EARLY_PMDS] __initdata __aligned(PAGE_SIZE); +pmd_t early_dtb_pmd[PTRS_PER_PMD] __initdata __aligned(PAGE_SIZE); static pmd_t *__init get_pmd_virt_early(phys_addr_t pa) { @@ -494,6 +495,18 @@ asmlinkage void __init setup_vm(uintptr_t dtb_pa) load_pa + (va - PAGE_OFFSET), map_size, PAGE_KERNEL_EXEC); +#ifndef __PAGETABLE_PMD_FOLDED + /* Setup early PMD for DTB */ + create_pgd_mapping(early_pg_dir, DTB_EARLY_BASE_VA, + (uintptr_t)early_dtb_pmd, PGDIR_SIZE, PAGE_TABLE); + /* Create two consecutive PMD mappings for FDT early scan */ + pa = dtb_pa & ~(PMD_SIZE - 1); + create_pmd_mapping(early_dtb_pmd, DTB_EARLY_BASE_VA, + pa, PMD_SIZE, PAGE_KERNEL); + create_pmd_mapping(early_dtb_pmd, DTB_EARLY_BASE_VA + PMD_SIZE, + pa + PMD_SIZE, PMD_SIZE, PAGE_KERNEL); + dtb_early_va = (void *)DTB_EARLY_BASE_VA + (dtb_pa & (PMD_SIZE - 1)); +#else /* Create two consecutive PGD mappings for FDT early scan */ pa = dtb_pa & ~(PGDIR_SIZE - 1); create_pgd_mapping(early_pg_dir, DTB_EARLY_BASE_VA, @@ -501,6 +514,7 @@ asmlinkage void __init setup_vm(uintptr_t dtb_pa) create_pgd_mapping(early_pg_dir, DTB_EARLY_BASE_VA + PGDIR_SIZE, pa + PGDIR_SIZE, PGDIR_SIZE, PAGE_KERNEL); dtb_early_va = (void *)DTB_EARLY_BASE_VA + (dtb_pa & (PGDIR_SIZE - 1)); +#endif dtb_early_pa = dtb_pa; /* -- 2.25.1
[PATCH 0/2] drivers/tty: delete break after return
This patch sereies delete break after return, which will never run. Signed-off-by: Bernard Zhao *** BLURB HERE *** Bernard Zhao (2): drivers/tty: delete break after return drivers/tty: delete break after return drivers/tty/nozomi.c | 4 drivers/tty/serial/imx.c | 5 - 2 files changed, 9 deletions(-) -- 2.29.0
[PATCH 2/2] drivers/tty: delete break after return
Delete break after return, which will never run. Signed-off-by: Bernard Zhao --- drivers/tty/serial/imx.c | 5 - 1 file changed, 5 deletions(-) diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c index 1731d9728865..09703079db7b 100644 --- a/drivers/tty/serial/imx.c +++ b/drivers/tty/serial/imx.c @@ -320,7 +320,6 @@ static u32 imx_uart_readl(struct imx_port *sport, u32 offset) switch (offset) { case UCR1: return sport->ucr1; - break; case UCR2: /* * UCR2_SRST is the only bit in the cached registers that might @@ -331,16 +330,12 @@ static u32 imx_uart_readl(struct imx_port *sport, u32 offset) if (!(sport->ucr2 & UCR2_SRST)) sport->ucr2 = readl(sport->port.membase + offset); return sport->ucr2; - break; case UCR3: return sport->ucr3; - break; case UCR4: return sport->ucr4; - break; case UFCR: return sport->ufcr; - break; default: return readl(sport->port.membase + offset); } -- 2.29.0
[PATCH 1/2] drivers/tty: delete break after return
Delete break after return, which will never run. Signed-off-by: Bernard Zhao --- drivers/tty/nozomi.c | 4 1 file changed, 4 deletions(-) diff --git a/drivers/tty/nozomi.c b/drivers/tty/nozomi.c index d42b854cb7df..946cc16827aa 100644 --- a/drivers/tty/nozomi.c +++ b/drivers/tty/nozomi.c @@ -414,11 +414,9 @@ static void read_mem32(u32 *buf, const void __iomem *mem_addr_start, buf16 = (u16 *) buf; *buf16 = __le16_to_cpu(readw(ptr)); goto out; - break; case 4: /* 4 bytes */ *(buf) = __le32_to_cpu(readl(ptr)); goto out; - break; } while (i < size_bytes) { @@ -460,7 +458,6 @@ static u32 write_mem32(void __iomem *mem_addr_start, const u32 *buf, buf16 = (const u16 *)buf; writew(__cpu_to_le16(*buf16), ptr); return 2; - break; case 1: /* * also needs to write 4 bytes in this case * so falling through.. @@ -468,7 +465,6 @@ static u32 write_mem32(void __iomem *mem_addr_start, const u32 *buf, case 4: /* 4 bytes */ writel(__cpu_to_le32(*buf), ptr); return 4; - break; } while (i < size_bytes) { -- 2.29.0
[PATCH 1/2] drivers/tty: delete break after return
Delete break after return, which will never run. Signed-off-by: Bernard Zhao --- drivers/tty/nozomi.c | 4 1 file changed, 4 deletions(-) diff --git a/drivers/tty/nozomi.c b/drivers/tty/nozomi.c index d42b854cb7df..946cc16827aa 100644 --- a/drivers/tty/nozomi.c +++ b/drivers/tty/nozomi.c @@ -414,11 +414,9 @@ static void read_mem32(u32 *buf, const void __iomem *mem_addr_start, buf16 = (u16 *) buf; *buf16 = __le16_to_cpu(readw(ptr)); goto out; - break; case 4: /* 4 bytes */ *(buf) = __le32_to_cpu(readl(ptr)); goto out; - break; } while (i < size_bytes) { @@ -460,7 +458,6 @@ static u32 write_mem32(void __iomem *mem_addr_start, const u32 *buf, buf16 = (const u16 *)buf; writew(__cpu_to_le16(*buf16), ptr); return 2; - break; case 1: /* * also needs to write 4 bytes in this case * so falling through.. @@ -468,7 +465,6 @@ static u32 write_mem32(void __iomem *mem_addr_start, const u32 *buf, case 4: /* 4 bytes */ writel(__cpu_to_le32(*buf), ptr); return 4; - break; } while (i < size_bytes) { -- 2.29.0
[PATCH 0/2] drivers/tty: delete break after return
This patch sereies delete break after return, which will never run. Signed-off-by: Bernard Zhao *** BLURB HERE *** Bernard Zhao (2): drivers/tty: delete break after return drivers/tty: delete break after return drivers/tty/nozomi.c | 4 drivers/tty/serial/imx.c | 5 - 2 files changed, 9 deletions(-) -- 2.29.0
[PATCH 2/2] drivers/tty: delete break after return
Delete break after return, which will never run. Signed-off-by: Bernard Zhao --- drivers/tty/serial/imx.c | 5 - 1 file changed, 5 deletions(-) diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c index 1731d9728865..09703079db7b 100644 --- a/drivers/tty/serial/imx.c +++ b/drivers/tty/serial/imx.c @@ -320,7 +320,6 @@ static u32 imx_uart_readl(struct imx_port *sport, u32 offset) switch (offset) { case UCR1: return sport->ucr1; - break; case UCR2: /* * UCR2_SRST is the only bit in the cached registers that might @@ -331,16 +330,12 @@ static u32 imx_uart_readl(struct imx_port *sport, u32 offset) if (!(sport->ucr2 & UCR2_SRST)) sport->ucr2 = readl(sport->port.membase + offset); return sport->ucr2; - break; case UCR3: return sport->ucr3; - break; case UCR4: return sport->ucr4; - break; case UFCR: return sport->ufcr; - break; default: return readl(sport->port.membase + offset); } -- 2.29.0
Re: [PATCH v3 5/6] MIPS: Loongson64: SMP: Fix up play_dead jump indicator
Hi, all, On 11/03/2020 03:12 PM, Tiezhu Yang wrote: In play_dead function, the whole 64-bit PC mailbox was used as a indicator to determine if the master core had written boot jump information. However, after we introduced CSR mailsend, the hardware will not guarante an atomic write for the 64-bit PC mailbox. Thus we have to use the lower 32-bit which is written at the last as the jump indicator instead. Signed-off-by: Lu Zeng Signed-off-by: Jun Yi Signed-off-by: Tiezhu Yang --- v2: No changes v3: Update the commit message and comment arch/mips/loongson64/smp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/mips/loongson64/smp.c b/arch/mips/loongson64/smp.c index 736e98d..aa0cd72 100644 --- a/arch/mips/loongson64/smp.c +++ b/arch/mips/loongson64/smp.c @@ -764,9 +764,10 @@ static void loongson3_type3_play_dead(int *state_addr) "1: li%[count], 0x100 \n" /* wait for init loop */ "2: bnez %[count], 2b\n" /* limit mailbox access */ " addiu %[count], -1\n" - " ld%[initfunc], 0x20(%[base]) \n" /* get PC via mailbox */ I have some confusion here. Play_dead CPUs is always brought up by cpu_up(). On Loongson64, it calls loongson3_boot_secondary(). The value of startargs[0] is the address of smp_bootstrap() which is in CKSEG0 and a constant after the kernel is compiled. That means its value likes 0x8... and only the low 32bit is useful. As "lw" is sign-extended, could we replace "ld" with "lw" simply? Thanks, Jinyang + " lw%[initfunc], 0x20(%[base]) \n" /* check lower 32-bit as jump indicator */ " beqz %[initfunc], 1b \n" " nop \n" + " ld%[initfunc], 0x20(%[base]) \n" /* get PC (whole 64-bit) via mailbox */ " ld$sp, 0x28(%[base]) \n" /* get SP via mailbox */ " ld$gp, 0x30(%[base]) \n" /* get GP via mailbox */ " ld$a1, 0x38(%[base]) \n"
[PATCH] mfd: htc-i2cpld: Add the missed i2c_put_adapter() in htcpld_register_chip_i2c()
htcpld_register_chip_i2c() misses to call i2c_put_adapter() in an error path. Add the missed function call to fix it. Signed-off-by: Jing Xiangfeng --- drivers/mfd/htc-i2cpld.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/mfd/htc-i2cpld.c b/drivers/mfd/htc-i2cpld.c index 247f9849e54a..417b0355d904 100644 --- a/drivers/mfd/htc-i2cpld.c +++ b/drivers/mfd/htc-i2cpld.c @@ -346,6 +346,7 @@ static int htcpld_register_chip_i2c( if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_READ_BYTE_DATA)) { dev_warn(dev, "i2c adapter %d non-functional\n", pdata->i2c_adapter_id); + i2c_put_adapter(adapter); return -EINVAL; } @@ -360,6 +361,7 @@ static int htcpld_register_chip_i2c( /* I2C device registration failed, contineu with the next */ dev_warn(dev, "Unable to add I2C device for 0x%x\n", plat_chip_data->addr); + i2c_put_adapter(adapter); return PTR_ERR(client); } -- 2.17.1
[PATCH 1/2] tee: amdtee: fix memory leak due to reset of global shm list
The driver maintains a list of shared memory buffers along with their mapped buffer id's in a global linked list. These buffers need to be unmapped after use by the user-space client. The global shared memory list is initialized to zero entries in the function amdtee_open(). This clearing of list entries can be a source for memory leak on secure side if the global linked list previously held some mapped buffer entries allocated from another TEE context. Fix potential memory leak issue by moving global shared memory list to AMD-TEE driver context data structure. Fixes: 757cc3e9ff1d ("tee: add AMD-TEE driver") Reviewed-by: Devaraj Rangasamy Signed-off-by: Rijo Thomas --- drivers/tee/amdtee/amdtee_private.h | 7 +++ drivers/tee/amdtee/core.c | 18 +++--- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/drivers/tee/amdtee/amdtee_private.h b/drivers/tee/amdtee/amdtee_private.h index d7f798c3394b..97df16a17285 100644 --- a/drivers/tee/amdtee/amdtee_private.h +++ b/drivers/tee/amdtee/amdtee_private.h @@ -64,9 +64,12 @@ struct amdtee_session { /** * struct amdtee_context_data - AMD-TEE driver context data * @sess_list:Keeps track of sessions opened in current TEE context + * @shm_list: Keeps track of buffers allocated and mapped in current TEE + *context */ struct amdtee_context_data { struct list_head sess_list; + struct list_head shm_list; }; struct amdtee_driver_data { @@ -89,10 +92,6 @@ struct amdtee_shm_data { u32 buf_id; }; -struct amdtee_shm_context { - struct list_head shmdata_list; -}; - #define LOWER_TWO_BYTE_MASK0x /** diff --git a/drivers/tee/amdtee/core.c b/drivers/tee/amdtee/core.c index 27b4cd77d0db..ce61c68ec58c 100644 --- a/drivers/tee/amdtee/core.c +++ b/drivers/tee/amdtee/core.c @@ -20,7 +20,6 @@ static struct amdtee_driver_data *drv_data; static DEFINE_MUTEX(session_list_mutex); -static struct amdtee_shm_context shmctx; static void amdtee_get_version(struct tee_device *teedev, struct tee_ioctl_version_data *vers) @@ -42,7 +41,7 @@ static int amdtee_open(struct tee_context *ctx) return -ENOMEM; INIT_LIST_HEAD(>sess_list); - INIT_LIST_HEAD(_list); + INIT_LIST_HEAD(>shm_list); ctx->data = ctxdata; return 0; @@ -152,10 +151,11 @@ static struct amdtee_session *find_session(struct amdtee_context_data *ctxdata, u32 get_buffer_id(struct tee_shm *shm) { - u32 buf_id = 0; + struct amdtee_context_data *ctxdata = shm->ctx->data; struct amdtee_shm_data *shmdata; + u32 buf_id = 0; - list_for_each_entry(shmdata, _list, shm_node) + list_for_each_entry(shmdata, >shm_list, shm_node) if (shmdata->kaddr == shm->kaddr) { buf_id = shmdata->buf_id; break; @@ -333,8 +333,9 @@ int amdtee_close_session(struct tee_context *ctx, u32 session) int amdtee_map_shmem(struct tee_shm *shm) { - struct shmem_desc shmem; + struct amdtee_context_data *ctxdata; struct amdtee_shm_data *shmnode; + struct shmem_desc shmem; int rc, count; u32 buf_id; @@ -362,7 +363,8 @@ int amdtee_map_shmem(struct tee_shm *shm) shmnode->kaddr = shm->kaddr; shmnode->buf_id = buf_id; - list_add(>shm_node, _list); + ctxdata = shm->ctx->data; + list_add(>shm_node, >shm_list); pr_debug("buf_id :[%x] kaddr[%p]\n", shmnode->buf_id, shmnode->kaddr); @@ -371,6 +373,7 @@ int amdtee_map_shmem(struct tee_shm *shm) void amdtee_unmap_shmem(struct tee_shm *shm) { + struct amdtee_context_data *ctxdata; struct amdtee_shm_data *shmnode; u32 buf_id; @@ -381,7 +384,8 @@ void amdtee_unmap_shmem(struct tee_shm *shm) /* Unmap the shared memory from TEE */ handle_unmap_shmem(buf_id); - list_for_each_entry(shmnode, _list, shm_node) + ctxdata = shm->ctx->data; + list_for_each_entry(shmnode, >shm_list, shm_node) if (buf_id == shmnode->buf_id) { list_del(>shm_node); kfree(shmnode); -- 2.17.1
[PATCH 0/2] AMD-TEE driver bug fixes
AMD-TEE driver keeps track of shared memory buffers and their corresponding buffer id's in a global linked list. These buffers are used to share data between x86 and AMD Secure Processor. This patchset fixes issues related to maintaining mapped buffers in a shared linked list. Rijo Thomas (2): tee: amdtee: fix memory leak due to reset of global shm list tee: amdtee: synchronize access to shm list drivers/tee/amdtee/amdtee_private.h | 8 drivers/tee/amdtee/core.c | 26 +++--- 2 files changed, 23 insertions(+), 11 deletions(-) -- 2.17.1
[PATCH 2/2] tee: amdtee: synchronize access to shm list
Synchronize access to shm or shared memory buffer list to prevent race conditions due to concurrent updates to shared shm list by multiple threads. Fixes: 757cc3e9ff1d ("tee: add AMD-TEE driver") Reviewed-by: Devaraj Rangasamy Signed-off-by: Rijo Thomas --- drivers/tee/amdtee/amdtee_private.h | 1 + drivers/tee/amdtee/core.c | 8 2 files changed, 9 insertions(+) diff --git a/drivers/tee/amdtee/amdtee_private.h b/drivers/tee/amdtee/amdtee_private.h index 97df16a17285..337c8d82f74e 100644 --- a/drivers/tee/amdtee/amdtee_private.h +++ b/drivers/tee/amdtee/amdtee_private.h @@ -70,6 +70,7 @@ struct amdtee_session { struct amdtee_context_data { struct list_head sess_list; struct list_head shm_list; + struct mutex shm_mutex; /* synchronizes access to @shm_list */ }; struct amdtee_driver_data { diff --git a/drivers/tee/amdtee/core.c b/drivers/tee/amdtee/core.c index ce61c68ec58c..8a6a8f30bb42 100644 --- a/drivers/tee/amdtee/core.c +++ b/drivers/tee/amdtee/core.c @@ -42,6 +42,7 @@ static int amdtee_open(struct tee_context *ctx) INIT_LIST_HEAD(>sess_list); INIT_LIST_HEAD(>shm_list); + mutex_init(>shm_mutex); ctx->data = ctxdata; return 0; @@ -85,6 +86,7 @@ static void amdtee_release(struct tee_context *ctx) list_del(>list_node); release_session(sess); } + mutex_destroy(>shm_mutex); kfree(ctxdata); ctx->data = NULL; @@ -155,11 +157,13 @@ u32 get_buffer_id(struct tee_shm *shm) struct amdtee_shm_data *shmdata; u32 buf_id = 0; + mutex_lock(>shm_mutex); list_for_each_entry(shmdata, >shm_list, shm_node) if (shmdata->kaddr == shm->kaddr) { buf_id = shmdata->buf_id; break; } + mutex_unlock(>shm_mutex); return buf_id; } @@ -364,7 +368,9 @@ int amdtee_map_shmem(struct tee_shm *shm) shmnode->kaddr = shm->kaddr; shmnode->buf_id = buf_id; ctxdata = shm->ctx->data; + mutex_lock(>shm_mutex); list_add(>shm_node, >shm_list); + mutex_unlock(>shm_mutex); pr_debug("buf_id :[%x] kaddr[%p]\n", shmnode->buf_id, shmnode->kaddr); @@ -385,12 +391,14 @@ void amdtee_unmap_shmem(struct tee_shm *shm) handle_unmap_shmem(buf_id); ctxdata = shm->ctx->data; + mutex_lock(>shm_mutex); list_for_each_entry(shmnode, >shm_list, shm_node) if (buf_id == shmnode->buf_id) { list_del(>shm_node); kfree(shmnode); break; } + mutex_unlock(>shm_mutex); } int amdtee_invoke_func(struct tee_context *ctx, -- 2.17.1
[RFC PATCH 1/2] mm, oom: dump meminfo for all memory nodes
In some OOM cases, if there is memory node binding(current->mems_allowed is not NULL), system may only print the meminfo for these bound nodes, while other nodes' info could still be important for debugging. For example on a platform with one normal node (has DMA/DMA32/NORMAL... zones) and one node which only has movable zone (either for memory hotplug case or a persistent memory node), some user will run docker while binding memory to the movable node. many memory allocations originated from the docker instance will fall back to the other node, and when a OOM happens, meminfo for both nodes are needed. So extend the show_mem() to cover all memory nodes. Signed-off-by: Feng Tang --- mm/oom_kill.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/oom_kill.c b/mm/oom_kill.c index 8b84661..601476cc 100644 --- a/mm/oom_kill.c +++ b/mm/oom_kill.c @@ -462,7 +462,7 @@ static void dump_header(struct oom_control *oc, struct task_struct *p) if (is_memcg_oom(oc)) mem_cgroup_print_oom_meminfo(oc->memcg); else { - show_mem(SHOW_MEM_FILTER_NODES, oc->nodemask); + show_mem(SHOW_MEM_FILTER_NODES, _states[N_MEMORY]); if (is_dump_unreclaim_slabs()) dump_unreclaimable_slab(); } -- 2.7.4
[RFC PATCH 0/2] mm: fix OOMs for binding workloads to movable zone only node
Hi, This patchset tries to report a problem and get suggestion/review for the RFC fix patches. We recently got a OOM report, that when user try to bind a docker(container) instance to a memory node which only has movable zones, and OOM killing still can't solve the page allocation failure. The callstack was: [ 1387.877565] runc:[2:INIT] invoked oom-killer: gfp_mask=0x500cc2(GFP_HIGHUSER|__GFP_ACCOUNT), order=0, oom_score_adj=0 [ 1387.877568] CPU: 8 PID: 8291 Comm: runc:[2:INIT] Tainted: GW I E 5.8.2-0.g71b519a-default #1 openSUSE Tumbleweed (unreleased) [ 1387.877569] Hardware name: Dell Inc. PowerEdge R640/0PHYDR, BIOS 2.6.4 04/09/2020 [ 1387.877570] Call Trace: [ 1387.877579] dump_stack+0x6b/0x88 [ 1387.877584] dump_header+0x4a/0x1e2 [ 1387.877586] oom_kill_process.cold+0xb/0x10 [ 1387.877588] out_of_memory.part.0+0xaf/0x230 [ 1387.877591] out_of_memory+0x3d/0x80 [ 1387.877595] __alloc_pages_slowpath.constprop.0+0x954/0xa20 [ 1387.877599] __alloc_pages_nodemask+0x2d3/0x300 [ 1387.877602] pipe_write+0x322/0x590 [ 1387.877607] new_sync_write+0x196/0x1b0 [ 1387.877609] vfs_write+0x1c3/0x1f0 [ 1387.877611] ksys_write+0xa7/0xe0 [ 1387.877617] do_syscall_64+0x52/0xd0 [ 1387.877621] entry_SYSCALL_64_after_hwframe+0x44/0xa9 The meminfo log only shows the movable only node, which has plenty of free memory. And in our reproducing with 1/2 patch, the normal node (has DMA/DMA32/Normal) also has lot of free memory when OOM happens. If we hack to make this (GFP_HIGHUSER|__GFP_ACCOUNT) request get a page, and following full docker run (like installing and running 'stress-ng' stress test) will see more allocation failures due to different kinds of request(gfp_masks). And the 2/2 patch will detect such cases that the allowed target nodes only have movable zones and loose the binding check, otherwise it will trigger OOM while the OOM won't do any help, as the problem is not lack of free memory. Feng Tang (2): mm, oom: dump meminfo for all memory nodes mm, page_alloc: loose the node binding check to avoid helpless oom killing mm/oom_kill.c | 2 +- mm/page_alloc.c | 22 ++ 2 files changed, 23 insertions(+), 1 deletion(-) -- 2.7.4
[RFC PATCH 2/2] mm, page_alloc: loose the node binding check to avoid helpless oom killing
With the incoming of memory hotplug feature and persitent memory, in some platform there are memory nodes which only have movable zone. Users may bind some of their workload(like docker/container) to these nodes, and there are many reports of OOM and page allocation failures, one callstack is: [ 1387.877565] runc:[2:INIT] invoked oom-killer: gfp_mask=0x500cc2(GFP_HIGHUSER|__GFP_ACCOUNT), order=0, oom_score_adj=0 [ 1387.877568] CPU: 8 PID: 8291 Comm: runc:[2:INIT] Tainted: GW I E 5.8.2-0.g71b519a-default #1 openSUSE Tumbleweed (unreleased) [ 1387.877569] Hardware name: Dell Inc. PowerEdge R640/0PHYDR, BIOS 2.6.4 04/09/2020 [ 1387.877570] Call Trace: [ 1387.877579] dump_stack+0x6b/0x88 [ 1387.877584] dump_header+0x4a/0x1e2 [ 1387.877586] oom_kill_process.cold+0xb/0x10 [ 1387.877588] out_of_memory.part.0+0xaf/0x230 [ 1387.877591] out_of_memory+0x3d/0x80 [ 1387.877595] __alloc_pages_slowpath.constprop.0+0x954/0xa20 [ 1387.877599] __alloc_pages_nodemask+0x2d3/0x300 [ 1387.877602] pipe_write+0x322/0x590 [ 1387.877607] new_sync_write+0x196/0x1b0 [ 1387.877609] vfs_write+0x1c3/0x1f0 [ 1387.877611] ksys_write+0xa7/0xe0 [ 1387.877617] do_syscall_64+0x52/0xd0 [ 1387.877621] entry_SYSCALL_64_after_hwframe+0x44/0xa9 In a full container run, like installing and running the stress tool "stress-ng", there are many different kinds of page requests (gfp_masks), many of which only allow non-movable zones. Some of them can fall back to other nodes with NORMAL/DMA32/DMA zones, but others are blocked by the __GFP_HARDWALL or ALLOC_CPUSET check, and cause OOM killing. But OOM killing won't do any help here, as this is not an issue of lack of free memory, but simply blocked by the node binding policy check. So loose the policy check for this case. Signed-off-by: Feng Tang --- mm/page_alloc.c | 22 ++ 1 file changed, 22 insertions(+) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index d772206..efd49a9 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -4669,6 +4669,28 @@ __alloc_pages_slowpath(gfp_t gfp_mask, unsigned int order, if (!ac->preferred_zoneref->zone) goto nopage; + /* +* If the task's target memory nodes only has movable zones, while the +* gfp_mask allowed zone is lower than ZONE_MOVABLE, loose the check +* for __GFP_HARDWALL and ALLOC_CPUSET, otherwise it could trigger OOM +* killing, which still can not solve this policy check. +*/ + if (ac->highest_zoneidx <= ZONE_NORMAL) { + int nid; + unsigned long unmovable = 0; + + /* FIXME: this could be a separate function */ + for_each_node_mask(nid, cpuset_current_mems_allowed) { + unmovable += NODE_DATA(nid)->node_present_pages - + NODE_DATA(nid)->node_zones[ZONE_MOVABLE].present_pages; + } + + if (!unmovable) { + gfp_mask &= ~(__GFP_HARDWALL); + alloc_flags &= ~ALLOC_CPUSET; + } + } + if (alloc_flags & ALLOC_KSWAPD) wake_all_kswapds(order, gfp_mask, ac); -- 2.7.4
[PATCH] ttyprintk: optimize tpk_close flush code
tpk_printk(NULL,0) do nothing but call tpk_flush to flush buffer, so why don't use tpk_flush diretcly? this is a small optimization. Signed-off-by: Junyong Sun --- drivers/char/ttyprintk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/char/ttyprintk.c b/drivers/char/ttyprintk.c index 6a0059e..2ce78b3 100644 --- a/drivers/char/ttyprintk.c +++ b/drivers/char/ttyprintk.c @@ -104,7 +104,7 @@ static void tpk_close(struct tty_struct *tty, struct file *filp) spin_lock_irqsave(>spinlock, flags); /* flush tpk_printk buffer */ - tpk_printk(NULL, 0); + tpk_flush(); spin_unlock_irqrestore(>spinlock, flags); tty_port_close(>port, tty, filp); -- 2.7.4
linux-next: Tree for Nov 4
Hi all, Changes since 20201103: The drm-intel-fixes tree gained a build failure for which I reverted a commit. The imx-mxs tree lost its build failure. The f2fs tree lost its build failure. The net-next tree gained a conflict against the net tree. The pinctrl tree still had its build failure. Non-merge commits (relative to Linus' tree): 2755 3141 files changed, 353135 insertions(+), 36522 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 327 trees (counting Linus' and 85 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 (4ef8451b3326 Merge tag 'perf-tools-for-v5.10-2020-11-03' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux) Merging fixes/fixes (9123e3a74ec7 Linux 5.9-rc1) Merging kbuild-current/fixes (d1889589a4f5 builddeb: Fix rootless build in setuid/setgid directory) Merging arc-current/for-curr (3b57533b460c ARC: [plat-hsdk] Remap CCMs super early in asm boot trampoline) Merging arm-current/fixes (9fa2e7af3d53 ARM: 9019/1: kprobes: Avoid fortify_panic() when copying optprobe template) Merging arm64-fixes/for-next/fixes (7ee31a3aa8f4 arm64: kprobes: Use BRK instead of single-step when executing instructions out-of-line) Merging arm-soc-fixes/arm/fixes (3d696f42c7f4 soc: ti: ti_sci_pm_domains: check for proper args count in xlate) Merging drivers-memory-fixes/fixes (3650b228f83a Linux 5.10-rc1) Merging m68k-current/for-linus (50c5feeea0af ide/macide: Convert Mac IDE driver to platform driver) Merging powerpc-fixes/fixes (99f070b62322 powerpc/smp: Call rcu_cpu_starting() earlier) Merging s390-fixes/fixes (0b2ca2c7d0c9 s390/pci: fix hot-plug of PCI function missing bus) 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 (dbfe394dad33 chelsio/chtls: fix always leaking ctrl_skb) Merging bpf/master (7a078d2d1880 libbpf, hashmap: Fix undefined behavior in hash_bits) Merging ipsec/master (a779d91314ca net: xfrm: fix a race condition during allocing spi) Merging netfilter/master (859191b234f8 Merge git://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf) Merging ipvs/master (859191b234f8 Merge git://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf) Merging wireless-drivers/master (04516706bb99 iwlwifi: pcie: limit memory read spin time) Merging mac80211/master (c2f468145211 mac80211: don't require VHT elements for HE on 2.4 GHz) Merging rdma-fixes/for-rc (00469c97ef64 RDMA/vmw_pvrdma: Fix the active_speed and phys_state value) Merging sound-current/for-linus (ef9ce66fab95 ALSA: hda/realtek - Enable headphone for ASUS TM420) Merging sound-asoc-fixes/for-linus (15961bc475e0 Merge remote-tracking branch 'asoc/for-5.10' into asoc-linus) Merging regmap-fixes/for-linus (780f88b04704 Merge remote-tracking branch 'regmap/for-5.10' into regmap-linus) Merging regulator-fixes/for-linus (cf1ad559a20d regulator: defer probe when trying to get voltage from unresolved supply) Merging spi-fixes/for-linus (21d3055d1ac7 Merge remote-tracking branch 'spi/for-5.10' into spi-linus) Merging pci-current/for-linus (af0dd809f3d3 PCI: Add Designated Vendor-Specific Extended Capability #defines) Merging driver-core.curre
mmotm 2020-11-03-21-56 uploaded
The mm-of-the-moment snapshot 2020-11-03-21-56 has been uploaded to https://www.ozlabs.org/~akpm/mmotm/ mmotm-readme.txt says README for mm-of-the-moment: https://www.ozlabs.org/~akpm/mmotm/ This is a snapshot of my -mm patch queue. Uploaded at random hopefully more than once a week. You will need quilt to apply these patches to the latest Linus release (5.x or 5.x-rcY). The series file is in broken-out.tar.gz and is duplicated in https://ozlabs.org/~akpm/mmotm/series The file broken-out.tar.gz contains two datestamp files: .DATE and .DATE--mm-dd-hh-mm-ss. Both contain the string -mm-dd-hh-mm-ss, followed by the base kernel version against which this patch series is to be applied. This tree is partially included in linux-next. To see which patches are included in linux-next, consult the `series' file. Only the patches within the #NEXT_PATCHES_START/#NEXT_PATCHES_END markers are included in linux-next. A full copy of the full kernel tree with the linux-next and mmotm patches already applied is available through git within an hour of the mmotm release. Individual mmotm releases are tagged. The master branch always points to the latest release, so it's constantly rebasing. https://github.com/hnaz/linux-mm The directory https://www.ozlabs.org/~akpm/mmots/ (mm-of-the-second) contains daily snapshots of the -mm tree. It is updated more frequently than mmotm, and is untested. A git copy of this tree is also available at https://github.com/hnaz/linux-mm This mmotm tree contains the following patches against 5.10-rc2: (patches marked "*" will be included in linux-next) origin.patch * mm-compaction-count-pages-and-stop-correctly-during-page-isolation.patch * mm-compaction-stop-isolation-if-too-many-pages-are-isolated-and-we-have-pages-to-migrate.patch * mm-vmscan-fix-nr_isolated_file-corruption-on-64-bit.patch * mailmap-fix-entry-for-dmitry-baryshkov-eremin-solenikov.patch * mm-slub-fix-panic-in-slab_alloc_node.patch * mm-gup-use-unpin_user_pages-in-__gup_longterm_locked.patch * compilerh-fix-barrier_data-on-clang.patch * compilerh-fix-barrier_data-on-clang-fix.patch * revert-kernel-rebootc-convert-simple_strtoul-to-kstrtoint.patch * reboot-fix-overflow-parsing-reboot-cpu-number.patch * mm-fix-readahead_page_batch-for-retry-entries.patch * proc-kpageflags-prevent-an-integer-overflow-in-stable_page_flags.patch * proc-kpageflags-do-not-use-uninitialized-struct-pages.patch * kthread-add-kthread_work-tracepoints.patch * kthread_worker-document-cpu-hotplug-handling.patch * kthread_worker-document-cpu-hotplug-handling-fix.patch * uapi-move-constants-from-linux-kernelh-to-linux-consth.patch * fs-ocfs2-remove-unneeded-break.patch * ocfs2-ratelimit-the-max-lookup-times-reached-notice.patch * ocfs2-clear-links-count-in-ocfs2_mknod-if-an-error-occurs.patch * ocfs2-fix-ocfs2-corrupt-when-iputting-an-inode.patch * ramfs-support-o_tmpfile.patch * kernel-watchdog-flush-all-printk-nmi-buffers-when-hardlockup-detected.patch mm.patch * mmslab_common-use-list_for_each_entry-in-dump_unreclaimable_slab.patch * mm-slub-use-kmem_cache_debug_flags-in-deactivate_slab.patch * device-dax-kmem-use-struct_size.patch * mm-fix-page_owner-initializing-issue-for-arm32.patch * fs-break-generic_file_buffered_read-up-into-multiple-functions.patch * fs-generic_file_buffered_read-now-uses-find_get_pages_contig.patch * mm-msync-exit-early-when-the-flags-is-an-ms_async-and-start-vm_start.patch * mm-gup_benchmark-rename-to-mm-gup_test.patch * selftests-vm-use-a-common-gup_testh.patch * selftests-vm-rename-run_vmtests-run_vmtestssh.patch * selftests-vm-minor-cleanup-makefile-and-gup_testc.patch * selftests-vm-only-some-gup_test-items-are-really-benchmarks.patch * selftests-vm-gup_test-introduce-the-dump_pages-sub-test.patch * selftests-vm-run_vmtestssh-update-and-clean-up-gup_test-invocation.patch * selftests-vm-hmm-tests-remove-the-libhugetlbfs-dependency.patch * selftests-vm-2x-speedup-for-run_vmtestssh.patch * mm-gup_benchmark-mark-gup_benchmark_init-as-__init-function.patch * mm-handle-zone-device-pages-in-release_pages.patch * mm-swapfilec-use-helper-function-swap_count-in-add_swap_count_continuation.patch * mm-swap_state-skip-meaningless-swap-cache-readahead-when-ra_infowin-==-0.patch * mm-swap_state-skip-meaningless-swap-cache-readahead-when-ra_infowin-==-0-fix.patch * mm-swapfilec-remove-unnecessary-out-label-in-__swap_duplicate.patch * mm-swap-use-memset-to-fill-the-swap_map-with-swap_has_cache.patch * mm-memcontrol-add-file_thp-shmem_thp-to-memorystat.patch * mm-memcontrol-add-file_thp-shmem_thp-to-memorystat-fix.patch * mm-memcontrol-remove-unused-mod_memcg_obj_state.patch * mm-memcontrol-eliminate-redundant-check-in-__mem_cgroup_insert_exceeded.patch * mm-memcontrol-use-helpers-to-read-pages-memcg-data.patch * mm-memcontrol-slab-use-helpers-to-access-slab-pages-memcg_data.patch * mm-introduce-page-memcg-flags.patch * mm-convert-page-kmemcg-type-to-a-page-memcg-flag.patch *
Re: [PATCH 1/3] hwmon: ltc2992: Add support
On Thu, Oct 29, 2020 at 11:49:09AM +0200, alexandru.tach...@analog.com wrote: > From: Alexandru Tachici > > LTC2992 is a rail-to-rail system monitor that > measures current, voltage, and power of two supplies. > > Two ADCs simultaneously measure each supply’s current. > A third ADC monitors the input voltages and four > auxiliary external voltages. > > Signed-off-by: Alexandru Tachici High level comment: checkpatch finds a number of spelling errors. Please fix. > --- > Documentation/hwmon/index.rst | 1 + > Documentation/hwmon/ltc2992.rst | 51 +++ > drivers/hwmon/Kconfig | 11 + > drivers/hwmon/Makefile | 1 + > drivers/hwmon/ltc2992.c | 735 > 5 files changed, 799 insertions(+) > create mode 100644 Documentation/hwmon/ltc2992.rst > create mode 100644 drivers/hwmon/ltc2992.c > > diff --git a/Documentation/hwmon/index.rst b/Documentation/hwmon/index.rst > index e6b91ab12978..f759d70ae9fd 100644 > --- a/Documentation/hwmon/index.rst > +++ b/Documentation/hwmon/index.rst > @@ -104,6 +104,7 @@ Hardware Monitoring Kernel Drivers > ltc2947 > ltc2978 > ltc2990 > + ltc2992 > ltc3815 > ltc4151 > ltc4215 > diff --git a/Documentation/hwmon/ltc2992.rst b/Documentation/hwmon/ltc2992.rst > new file mode 100644 > index ..1dd48ef9f655 > --- /dev/null > +++ b/Documentation/hwmon/ltc2992.rst > @@ -0,0 +1,51 @@ > +.. SPDX-License-Identifier: GPL-2.0 > + > +Kernel driver ltc2992 > += > + > +Supported chips: > + * Linear Technology LTC2992 > +Prefix: 'ltc2992' > +Datasheet: > https://www.analog.com/media/en/technical-documentation/data-sheets/ltc2992.pdf > + > +Author: Alexandru Tachici > + > + > +Description > +--- > + > +This driver supports hardware monitoring for Linear Technology LTC2992 power > monitor. > + > +LTC2992 is is a rail-to-rail system monitor that measures current, > +voltage, and power of two supplies. > + > +Two ADCs simultaneously measure each supply’s current. A third ADC monitors > +the input voltages and four auxiliary external voltages. > + > + > +Sysfs entries > +- > + > +The following attributes are supported. Limits are read-write, > +all other attributes are read-only. > + > +inX_inputMeasured voltage. > +inX_min Minimum voltage. > +inX_max Maximum voltage. > +inX_min_alarmVoltage low alarm. > +inX_max_alarmVoltage high alarm. > +inX_alarmAn overvoltage or undervoltage occured. Cleared on read. > + > +currX_input Measured current. > +currX_minMinimum current. > +currX_maxMaximum current. > +currX_min_alarm Current low alarm. > +currX_max_alarm Current high alarm. > +currX_alarm An overvoltage or undervoltage occured. Cleared on read. > + > +powerX_input Measured power. > +powerX_min Minimum power. > +powerX_max Maximum power. > +powerX_min_alarm Power low alarm. > +powerX_max_alarm Power high alarm. > +powerX_alarm An overpower or underpower occured. Cleared on read. > diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig > index a850e4f0e0bd..bf9e387270d6 100644 > --- a/drivers/hwmon/Kconfig > +++ b/drivers/hwmon/Kconfig > @@ -858,6 +858,17 @@ config SENSORS_LTC2990 > This driver can also be built as a module. If so, the module will > be called ltc2990. > > +config SENSORS_LTC2992 > + tristate "Linear Technology LTC2992" > + depends on I2C > + help > + If you say yes here you get support for Linear Technology LTC2992 > + I2C System Monitor. The LTC2992 measures current, voltage, and > + power of two supplies. > + > + This driver can also be built as a module. If so, the module will > + be called ltc2992. > + > config SENSORS_LTC4151 > tristate "Linear Technology LTC4151" > depends on I2C > diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile > index 9db2903b61e5..d6172c4807c4 100644 > --- a/drivers/hwmon/Makefile > +++ b/drivers/hwmon/Makefile > @@ -118,6 +118,7 @@ obj-$(CONFIG_SENSORS_LTC2947) += ltc2947-core.o > obj-$(CONFIG_SENSORS_LTC2947_I2C) += ltc2947-i2c.o > obj-$(CONFIG_SENSORS_LTC2947_SPI) += ltc2947-spi.o > obj-$(CONFIG_SENSORS_LTC2990)+= ltc2990.o > +obj-$(CONFIG_SENSORS_LTC2992)+= ltc2992.o > obj-$(CONFIG_SENSORS_LTC4151)+= ltc4151.o > obj-$(CONFIG_SENSORS_LTC4215)+= ltc4215.o > obj-$(CONFIG_SENSORS_LTC4222)+= ltc4222.o > diff --git a/drivers/hwmon/ltc2992.c b/drivers/hwmon/ltc2992.c > new file mode 100644 > index ..940d92b4a1d0 > --- /dev/null > +++ b/drivers/hwmon/ltc2992.c > @@ -0,0 +1,735 @@ > +// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) > +/* > + * LTC2992 - Dual Wide Range Power Monitor > + * > + * Copyright 2020 Analog Devices Inc. > + */ > + >
Re: [PATCH 0/4] aarch64: avoid mprotect(PROT_BTI|PROT_EXEC) [BZ #26831]
Hi, On 11/3/20 11:34 AM, Mark Brown wrote: On Tue, Nov 03, 2020 at 10:25:37AM +, Szabolcs Nagy wrote: Re-mmap executable segments instead of mprotecting them in case mprotect is seccomp filtered. For the kernel mapped main executable we don't have the fd for re-mmap so linux needs to be updated to add BTI. (In the presence of seccomp filters for mprotect(PROT_EXEC) the libc cannot change BTI protection at runtime based on user space policy so it is better if the kernel maps BTI compatible binaries with PROT_BTI by default.) Given that there were still some ongoing discussions on a more robust kernel interface here and there seem to be a few concerns with this series should we perhaps just take a step back and disable this seccomp filter in systemd on arm64, at least for the time being? That seems safer than rolling out things that set ABI quickly, a big part of the So, that's a bigger hammer than I think is needed and punishes !BTI machines. I'm going to suggest that if we need to carry a temp patch its more like the glibc patch I mentioned in the Fedora defect. That patch simply logs a message, on the mprotect failures rather than aborting. Its fairly non-intrusive. That leaves seccomp functional, and BTI generally functional except when seccomp is restricting it. I've also been asked that if a patch like that is needed, its (temporary?) merged to the glibc trunk, rather than just being carried by the distro's. Thanks, reason we went with having the dynamic linker enable PROT_BTI in the first place was to give us more flexibility to handle any unforseen consequences of enabling BTI that we run into. We are going to have similar issues with other features like MTE so we need to make sure that whatever we're doing works with them too. Also updated to Will's current e-mail address - Will, do you have thoughts on what we should do here?
Re: [PATCH -V2 2/2] autonuma: Migrate on fault among multiple bound nodes
Hi, Mel, Thanks for comments! Mel Gorman writes: > On Wed, Oct 28, 2020 at 10:34:11AM +0800, Huang Ying wrote: >> Now, AutoNUMA can only optimize the page placement among the NUMA nodes if >> the >> default memory policy is used. Because the memory policy specified >> explicitly >> should take precedence. But this seems too strict in some situations. For >> example, on a system with 4 NUMA nodes, if the memory of an application is >> bound >> to the node 0 and 1, AutoNUMA can potentially migrate the pages between the >> node >> 0 and 1 to reduce cross-node accessing without breaking the explicit memory >> binding policy. >> >> So in this patch, if mbind(.mode=MPOL_BIND, .flags=MPOL_MF_LAZY) is used to >> bind >> the memory of the application to multiple nodes, and in the hint page fault >> handler both the faulting page node and the accessing node are in the policy >> nodemask, the page will be tried to be migrated to the accessing node to >> reduce >> the cross-node accessing. >> >> [Peter Zijlstra: provided the simplified implementation method.] >> >> Questions: >> >> Sysctl knob kernel.numa_balancing can enable/disable AutoNUMA optimizing >> globally. But for the memory areas that are bound to multiple NUMA nodes, >> even >> if the AutoNUMA is enabled globally via the sysctl knob, we still need to >> enable >> AutoNUMA again with a special flag. Why not just optimize the page >> placement if >> possible as long as AutoNUMA is enabled globally? The interface would look >> simpler with that. >> >> Signed-off-by: "Huang, Ying" > > I've no specific objection to the patch or the name change. I can't > remember exactly why I picked the name, it was 8 years ago but I think it > was because the policy represented the most basic possible approach that > could be done without any attempt at being intelligent and established > a baseline. The intent was that anything built on top had to be better > than the most basic policy imaginable. The name reflected the dictionary > definition at the time and happened to match the acronym closely enough > and I wanted to make it absolutely clear to reviewers that the policy > was not good enough (ruling out MPOL_BASIC or variants thereof) even if > it happened to work for some workload and there was no intent to report > it to the userspace API. > > The only hazard with the patch is that applications that use MPOL_BIND > on multiple nodes may now incur some NUMA balancing overhead due to > trapping faults and migrations. For this specific version of patch, I don't think this will happen. Because now, MPOL_F_MOF need to be set in struct mempolicy, for MPOL_BIND, only if mbind() syscall is called with MPOL_MF_LAZY, that will be the case. So I think most workloads will not be affected by this patch. The feature is opt-in. But from another point of view, I suggest to remove the constraints of MPOL_F_MOF in the future. If the overhead of AutoNUMA isn't acceptable, why not just disable AutoNUMA globally via sysctl knob? > It might still end up being better but I was not aware of a > *realistic* workload that binds to multiple nodes > deliberately. Generally I expect if an application is binding, it's > binding to one local node. Yes. It's not popular configuration for now. But for the memory tiering system with both DRAM and PMEM, the DRAM and PMEM in one socket will become 2 NUMA nodes. To avoid too much cross-socket memory accessing, but take advantage of both the DRAM and PMEM, the workload can be bound to 2 NUMA nodes (DRAM and PMEM). > If it shows up in regressions, it'll be interesting to get a detailed > description of the workload. Pay particular attention to if THP is > disabled as I learned relatively recently that NUMA balancing with THP > disabled has higher overhead (which is hardly surprising). Got it! > Lacking data or a specific objection > > Acked-by: Mel Gorman Thanks! Best Regards, Huang, Ying
[PATCH] cxgb4: Fix the -Wmisleading-indentation warning
From: Kaixu Xia Fix the gcc warning: drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c:2673:9: warning: this 'for' clause does not guard... [-Wmisleading-indentation] 2673 | for (i = 0; i < n; ++i) \ Reported-by: Tosk Robot Signed-off-by: Kaixu Xia --- drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c index 0273f40b85f7..c24d34a937c8 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c @@ -2671,7 +2671,7 @@ do { \ seq_printf(seq, "%-12s", s); \ for (i = 0; i < n; ++i) \ seq_printf(seq, " %16" fmt_spec, v); \ - seq_putc(seq, '\n'); \ + seq_putc(seq, '\n'); \ } while (0) #define S(s, v) S3("s", s, v) #define T3(fmt_spec, s, v) S3(fmt_spec, s, tx[i].v) -- 2.20.0
Re: [RFC PATCH] .clang-format: Remove conditional comments
Hi Joe, First of all, thanks for taking the time to write your reasoning. On Wed, Nov 4, 2020 at 5:17 AM Joe Perches wrote: > > The current kernel is v5.10 which requires clang 10.0 or higher. For building, yes. > This patch is not to be applied or backported to old kernels so no > person is going to use this patch on any old or backported kernel. Agreed (see my answer to Nick). > If a person is going to use clang-format on the current kernel sources > unless they are developing for the current kernel. > > They are going to have to be using clang 10.0 or higher and therefore > also will have and be using clang-format 10.0 or higher. No, they might be using GCC as usual and installed clang-format from their distro. In fact, I'd expect most developers accustomed to GCC to try it out that way, and also most of them to install compilers from their distro, not from the webpage, unless they need a newer version for some reason (e.g. new warnings, new debugging features in the kernel, etc.). In principle, clang-format (as a tool) is not related to building the kernel. We may call it "x-format" and think about it as a statically linked binary. What I am saying is that aligning clang-format to LLVM (now that LLVM has a minimum supported version) is not a necessity. We can still do it, of course, since there are new features for everyone and anybody that complains can install a newer version from the webpage. But there is nothing that forces us to require it. It is a decision that we balance w.r.t. new features. To put it concretely: if there were 0 new features or big fixes in clang-format 10 compared to 4, there would be no reason whatsoever to require users to download a new version. On the other side of the spectrum, some projects require a concrete version (not just a minimum), because they automatically format their entire codebase and want to avoid differences in output between clang-format versions. But we are far from automatically formatting the entire codebase. > Take it or not, apply it or not. I don't use clang-format and unless > there are improvements to it, I imagine I'll continue to use emacs > indent-region and a few other reformatting tools instead. Again, I am not opposed to the change. In fact, I am eager to improve the output of clang-format so that more people get engaged with it. I was just surprised you asserted so strongly that nobody is using clang-format from their distro. Cheers, Miguel
Re: [PATCH v3] hwmon: add Corsair PSU HID controller driver
On Tue, Oct 27, 2020 at 02:17:10PM +0100, Wilken Gottwalt wrote: > The Corsair digital power supplies of the series RMi, HXi and AXi include > a small micro-controller with a lot of sensors attached. The sensors can > be accessed by an USB connector from the outside. > > This micro-controller provides the data by a simple proprietary USB HID > protocol. The data consist of temperatures, current and voltage levels, > power usage, uptimes, fan speed and some more. It is also possible to > configure the PSU (fan mode, mono/multi-rail, over current protection). > > This driver provides access to the sensors/statistics of the RMi and HXi > series power supplies. It does not support configuring these devices, > because there would be many ways to misconfigure or even damage the PSU. > > This patch adds: > - hwmon driver corsair-psu > - hwmon documentation > - updates MAINTAINERS > > Signed-off-by: Wilken Gottwalt Applied. Thanks, Guenter > --- > Changes in v3: > - changed the email addresses because of serious email provider problems > - fixed all multi-line comments > - simplifiend some more switches > - added more explanations about the values provied by the micro-controller > - cached the raw value delivered by the usb_cmd function > Changes in v2: > - changed comments to hwmon style comments > - simplified some switches > - removed redundant code > - removed misuse of EIO > - changed a todo to a proper explanation > - changed debugfs init/remove code > - added 2 more HXi/RMi devices > - updated documentation > --- > Documentation/hwmon/corsair-psu.rst | 82 > Documentation/hwmon/index.rst | 1 + > MAINTAINERS | 7 + > drivers/hwmon/Kconfig | 13 + > drivers/hwmon/Makefile | 1 + > drivers/hwmon/corsair-psu.c | 605 > 6 files changed, 709 insertions(+) > create mode 100644 Documentation/hwmon/corsair-psu.rst > create mode 100644 drivers/hwmon/corsair-psu.c > > diff --git a/Documentation/hwmon/corsair-psu.rst > b/Documentation/hwmon/corsair-psu.rst > new file mode 100644 > index ..396b95c9a76a > --- /dev/null > +++ b/Documentation/hwmon/corsair-psu.rst > @@ -0,0 +1,82 @@ > +.. SPDX-License-Identifier: GPL-2.0-or-later > + > +Kernel driver corsair-psu > += > + > +Supported devices: > + > +* Corsair Power Supplies > + > + Corsair HX550i > + > + Corsair HX650i > + > + Corsair HX750i > + > + Corsair HX850i > + > + Corsair HX1000i > + > + Corsair HX1200i > + > + Corsair RM550i > + > + Corsair RM650i > + > + Corsair RM750i > + > + Corsair RM850i > + > + Corsair RM1000i > + > +Author: Wilken Gottwalt > + > +Description > +--- > + > +This driver implements the sysfs interface for the Corsair PSUs with a HID > protocol > +interface of the HXi and RMi series. > +These power supplies provide access to a micro-controller with 2 attached > +temperature sensors, 1 fan rpm sensor, 4 sensors for volt levels, 4 sensors > for > +power usage and 4 sensors for current levels and addtional non-sensor > information > +like uptimes. > + > +Sysfs entries > +- > + > +=== > > +curr1_input Total current usage > +curr2_input Current on the 12v psu rail > +curr3_input Current on the 5v psu rail > +curr4_input Current on the 3.3v psu rail > +fan1_input RPM of psu fan > +in0_inputVoltage of the psu ac input > +in1_inputVoltage of the 12v psu rail > +in2_inputVoltage of the 5v psu rail > +in3_inputVoltage of the 3.3 psu rail > +power1_input Total power usage > +power2_input Power usage of the 12v psu rail > +power3_input Power usage of the 5v psu rail > +power4_input Power usage of the 3.3v psu rail > +temp1_input Temperature of the psu vrm component > +temp2_input Temperature of the psu case > +=== > > + > +Usage Notes > +--- > + > +It is an USB HID device, so it is auto-detected and supports hot-swapping. > + > +Flickering values in the rail voltage levels can be an indicator for a > failing > +PSU. The driver also provides some additional useful values via debugfs, > which > +do not fit into the hwmon class. > + > +Debugfs entries > +--- > + > +=== > > +uptime Current uptime of the psu > +uptime_total Total uptime of the psu > +vendor Vendor name of the psu > +product Product name of the psu > +=== > > diff --git a/Documentation/hwmon/index.rst
[PATCH 5/5] ASoC/SoundWire: rt711-sdca: Add RT711 SDCA vendor-specific driver
From: Shuming Fan This is the initial codec driver for rt711 SDCA version. Signed-off-by: Shuming Fan Reviewed-by: Pierre-Louis Bossart Signed-off-by: Bard Liao --- sound/soc/codecs/Kconfig |7 + sound/soc/codecs/Makefile |2 + sound/soc/codecs/rt711-sdca-sdw.c | 424 + sound/soc/codecs/rt711-sdca-sdw.h | 101 ++ sound/soc/codecs/rt711-sdca.c | 1481 + sound/soc/codecs/rt711-sdca.h | 246 + 6 files changed, 2261 insertions(+) create mode 100644 sound/soc/codecs/rt711-sdca-sdw.c create mode 100644 sound/soc/codecs/rt711-sdca-sdw.h create mode 100644 sound/soc/codecs/rt711-sdca.c create mode 100644 sound/soc/codecs/rt711-sdca.h diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig index 08582d002b90..2f7e278b4dc0 100644 --- a/sound/soc/codecs/Kconfig +++ b/sound/soc/codecs/Kconfig @@ -176,6 +176,7 @@ config SND_SOC_ALL_CODECS imply SND_SOC_RT5682_SDW imply SND_SOC_RT700_SDW imply SND_SOC_RT711_SDW + imply SND_SOC_RT711_SDCA_SDW imply SND_SOC_RT715_SDW imply SND_SOC_RT715_SDCA_SDW imply SND_SOC_RT1308_SDW @@ -1214,6 +1215,12 @@ config SND_SOC_RT711_SDW select SND_SOC_RT711 select REGMAP_SOUNDWIRE +config SND_SOC_RT711_SDCA_SDW + tristate "Realtek RT711 SDCA Codec - SDW" + depends on SOUNDWIRE + select REGMAP_SOUNDWIRE + select REGMAP_SOUNDWIRE_MBQ + config SND_SOC_RT715 tristate diff --git a/sound/soc/codecs/Makefile b/sound/soc/codecs/Makefile index 601bbb8b46e7..8bdd587bbd3b 100644 --- a/sound/soc/codecs/Makefile +++ b/sound/soc/codecs/Makefile @@ -188,6 +188,7 @@ snd-soc-rt5682-sdw-objs := rt5682-sdw.o snd-soc-rt5682-i2c-objs := rt5682-i2c.o snd-soc-rt700-objs := rt700.o rt700-sdw.o snd-soc-rt711-objs := rt711.o rt711-sdw.o +snd-soc-rt711-sdca-objs := rt711-sdca.o rt711-sdca-sdw.o snd-soc-rt715-objs := rt715.o rt715-sdw.o snd-soc-rt715-sdca-objs := rt715-sdca.o rt715-sdca-sdw.o snd-soc-sgtl5000-objs := sgtl5000.o @@ -500,6 +501,7 @@ obj-$(CONFIG_SND_SOC_RT5682_I2C)+= snd-soc-rt5682-i2c.o obj-$(CONFIG_SND_SOC_RT5682_SDW) += snd-soc-rt5682-sdw.o obj-$(CONFIG_SND_SOC_RT700) += snd-soc-rt700.o obj-$(CONFIG_SND_SOC_RT711) += snd-soc-rt711.o +obj-$(CONFIG_SND_SOC_RT711_SDCA_SDW) += snd-soc-rt711-sdca.o obj-$(CONFIG_SND_SOC_RT715) += snd-soc-rt715.o obj-$(CONFIG_SND_SOC_RT715_SDCA_SDW) += snd-soc-rt715-sdca.o obj-$(CONFIG_SND_SOC_SGTL5000) += snd-soc-sgtl5000.o diff --git a/sound/soc/codecs/rt711-sdca-sdw.c b/sound/soc/codecs/rt711-sdca-sdw.c new file mode 100644 index ..6aaf9e09c118 --- /dev/null +++ b/sound/soc/codecs/rt711-sdca-sdw.c @@ -0,0 +1,424 @@ +// SPDX-License-Identifier: GPL-2.0-only +// +// rt711-sdw-sdca.c -- rt711 SDCA ALSA SoC audio driver +// +// Copyright(c) 2020 Realtek Semiconductor Corp. +// +// + +#include +#include +#include +#include +#include + +#include "rt711-sdca.h" +#include "rt711-sdca-sdw.h" + +static bool rt711_sdca_readable_register(struct device *dev, unsigned int reg) +{ + switch (reg) { + case SDW_DP0_INT: + case SDW_SCP_SDCA_INT1 ... SDW_SCP_SDCA_INTMASK4: + case 0x201a ... 0x2027: + case 0x2029 ... 0x202a: + case 0x202d ... 0x2034: + case 0x2200 ... 0x2204: + case 0x2206 ... 0x2212: + case 0x2220 ... 0x2223: + case 0x2230 ... 0x2239: + case 0x2f01 ... 0x2f0f: + case 0x2f30 ... 0x2f36: + case 0x2f50 ... 0x2f5a: + case 0x2f60: + case 0x3200 ... 0x3212: + case SDW_SDCA_CTL(FUN_JACK_CODEC, RT711_SDCA_ENT_GE49, RT711_SDCA_CTL_SELECTED_MODE, 0): + case SDW_SDCA_CTL(FUN_JACK_CODEC, RT711_SDCA_ENT_GE49, RT711_SDCA_CTL_DETECTED_MODE, 0): + case SDW_SDCA_CTL(FUN_HID, RT711_SDCA_ENT_HID01, RT711_SDCA_CTL_HIDTX_CURRENT_OWNER, 0) ... + SDW_SDCA_CTL(FUN_HID, RT711_SDCA_ENT_HID01, RT711_SDCA_CTL_HIDTX_MESSAGE_LENGTH, 0): + case RT711_BUF_ADDR_HID1 ... RT711_BUF_ADDR_HID2: + return true; + default: + return false; + } +} + +static bool rt711_sdca_volatile_register(struct device *dev, unsigned int reg) +{ + switch (reg) { + case SDW_DP0_INT: + case SDW_SCP_SDCA_INT1 ... SDW_SCP_SDCA_INT4: + case 0x201b: + case 0x201c: + case 0x201d: + case 0x201f: + case 0x2021: + case 0x2023: + case 0x2230: + case 0x202d ... 0x202f: /* BRA */ + case 0x2200 ... 0x2212: /* i2c debug */ + case RT711_RC_CAL_STATUS: + case SDW_SDCA_CTL(FUN_JACK_CODEC, RT711_SDCA_ENT_GE49, RT711_SDCA_CTL_DETECTED_MODE, 0): + case SDW_SDCA_CTL(FUN_HID, RT711_SDCA_ENT_HID01, RT711_SDCA_CTL_HIDTX_CURRENT_OWNER, 0) ... + SDW_SDCA_CTL(FUN_HID, RT711_SDCA_ENT_HID01, RT711_SDCA_CTL_HIDTX_MESSAGE_LENGTH, 0): + case RT711_BUF_ADDR_HID1 ... RT711_BUF_ADDR_HID2: + return true; +
[PATCH 4/5] ASoC/SoundWire: rt1316: Add RT1316 SDCA vendor-specific driver
From: Shuming Fan This is the initial amplifier driver for rt1316 SDCA version. Signed-off-by: Shuming Fan Reviewed-by: Pierre-Louis Bossart Signed-off-by: Bard Liao --- sound/soc/codecs/Kconfig | 6 + sound/soc/codecs/Makefile | 2 + sound/soc/codecs/rt1316-sdw.c | 756 ++ sound/soc/codecs/rt1316-sdw.h | 115 ++ 4 files changed, 879 insertions(+) create mode 100644 sound/soc/codecs/rt1316-sdw.c create mode 100644 sound/soc/codecs/rt1316-sdw.h diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig index b80d07df5b55..08582d002b90 100644 --- a/sound/soc/codecs/Kconfig +++ b/sound/soc/codecs/Kconfig @@ -179,6 +179,7 @@ config SND_SOC_ALL_CODECS imply SND_SOC_RT715_SDW imply SND_SOC_RT715_SDCA_SDW imply SND_SOC_RT1308_SDW + imply SND_SOC_RT1316_SDW imply SND_SOC_SGTL5000 imply SND_SOC_SI476X imply SND_SOC_SIMPLE_AMPLIFIER @@ -1110,6 +,11 @@ config SND_SOC_RT1308_SDW depends on I2C && SOUNDWIRE select REGMAP_SOUNDWIRE +config SND_SOC_RT1316_SDW + tristate "Realtek RT1316 Codec - SDW" + depends on SOUNDWIRE + select REGMAP_SOUNDWIRE + config SND_SOC_RT5514 tristate depends on I2C diff --git a/sound/soc/codecs/Makefile b/sound/soc/codecs/Makefile index b1683403afb3..601bbb8b46e7 100644 --- a/sound/soc/codecs/Makefile +++ b/sound/soc/codecs/Makefile @@ -164,6 +164,7 @@ snd-soc-rt1015p-objs := rt1015p.o snd-soc-rt1305-objs := rt1305.o snd-soc-rt1308-objs := rt1308.o snd-soc-rt1308-sdw-objs := rt1308-sdw.o +snd-soc-rt1316-sdw-objs := rt1316-sdw.o snd-soc-rt274-objs := rt274.o snd-soc-rt286-objs := rt286.o snd-soc-rt298-objs := rt298.o @@ -474,6 +475,7 @@ obj-$(CONFIG_SND_SOC_RT1015P) += snd-soc-rt1015p.o obj-$(CONFIG_SND_SOC_RT1305) += snd-soc-rt1305.o obj-$(CONFIG_SND_SOC_RT1308) += snd-soc-rt1308.o obj-$(CONFIG_SND_SOC_RT1308_SDW) += snd-soc-rt1308-sdw.o +obj-$(CONFIG_SND_SOC_RT1316_SDW) += snd-soc-rt1316-sdw.o obj-$(CONFIG_SND_SOC_RT274)+= snd-soc-rt274.o obj-$(CONFIG_SND_SOC_RT286)+= snd-soc-rt286.o obj-$(CONFIG_SND_SOC_RT298)+= snd-soc-rt298.o diff --git a/sound/soc/codecs/rt1316-sdw.c b/sound/soc/codecs/rt1316-sdw.c new file mode 100644 index ..145ffb8cd1ca --- /dev/null +++ b/sound/soc/codecs/rt1316-sdw.c @@ -0,0 +1,756 @@ +// SPDX-License-Identifier: GPL-2.0-only +// +// rt1316-sdw.c -- rt1316 SDCA ALSA SoC amplifier audio driver +// +// Copyright(c) 2020 Realtek Semiconductor Corp. +// +// +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "rt1316-sdw.h" + +static bool rt1316_readable_register(struct device *dev, unsigned int reg) +{ + switch (reg) { + case 0x2f0a: + case 0x2f36: + case 0x3203 ... 0x320e: + case 0xc000 ... 0xc7b4: + case 0xcf00 ... 0xcf03: + case 0xd101 ... 0xd103: + case SDW_SDCA_CTL(FUN_SMART_AMP, RT1316_SDCA_ENT_UDMPU21, RT1316_SDCA_CTL_UDMPU_CLUSTER, 0): + case SDW_SDCA_CTL(FUN_SMART_AMP, RT1316_SDCA_ENT_FU21, RT1316_SDCA_CTL_FU_MUTE, CH_L): + case SDW_SDCA_CTL(FUN_SMART_AMP, RT1316_SDCA_ENT_FU21, RT1316_SDCA_CTL_FU_MUTE, CH_R): + case SDW_SDCA_CTL(FUN_SMART_AMP, RT1316_SDCA_ENT_PDE23, RT1316_SDCA_CTL_REQ_POWER_STATE, 0): + case SDW_SDCA_CTL(FUN_SMART_AMP, RT1316_SDCA_ENT_PDE27, RT1316_SDCA_CTL_REQ_POWER_STATE, 0): + case SDW_SDCA_CTL(FUN_SMART_AMP, RT1316_SDCA_ENT_PDE22, RT1316_SDCA_CTL_REQ_POWER_STATE, 0): + case SDW_SDCA_CTL(FUN_SMART_AMP, RT1316_SDCA_ENT_PDE24, RT1316_SDCA_CTL_REQ_POWER_STATE, 0): + return true; + default: + return false; + } +} + +static bool rt1316_volatile_register(struct device *dev, unsigned int reg) +{ + switch (reg) { + case 0xc000: + case 0xc093: + case 0xc09d: + case 0xc0a3: + case 0xc201: + case 0xc427 ... 0xc428: + case 0xd102: + return true; + default: + return false; + } +} + +static const struct regmap_config rt1316_sdw_regmap = { + .reg_bits = 32, + .val_bits = 8, + .readable_reg = rt1316_readable_register, + .volatile_reg = rt1316_volatile_register, + .max_register = 0x4108, + .reg_defaults = rt1316_reg_defaults, + .num_reg_defaults = ARRAY_SIZE(rt1316_reg_defaults), + .cache_type = REGCACHE_RBTREE, + .use_single_read = true, + .use_single_write = true, +}; + +static int rt1316_read_prop(struct sdw_slave *slave) +{ + struct sdw_slave_prop *prop = >prop; + int nval; + int i, j; + u32 bit; + unsigned long addr; + struct sdw_dpn_prop *dpn; + + prop->scp_int1_mask = SDW_SCP_INT1_BUS_CLASH | SDW_SCP_INT1_PARITY; + prop->quirks = SDW_SLAVE_QUIRKS_INVALID_INITIAL_PARITY; + prop->is_sdca = true; + +
[PATCH 0/5] regmap/SoundWire/ASoC: Add SoundWire SDCA support
The MIPI SoundWire Device Class standard will define audio functionality beyond the scope of the existing SoundWire 1.2 standard, which is limited to the bus and interface. The description is inspired by the USB Audio Class, with "functions", "entities", "control selectors", "audio clusters". The main difference with the USB Audio class is that the devices are typically on a motherboard and descriptors stored in platform firmware instead of being retrieved from the device. The current set of devices managed in this patchset are conformant with the SDCA 0.6 specification and require dedicated drivers since the descriptors and platform firmware specification is not complete at this time. They do however rely on the hierarchical addressing required by the SDCA standard. Future devices conformant with SDCA 1.0 should rely on a class driver. This series adds support for the hierarchical SDCA addressing and extends regmap. It then provides 3 codecs for RT711-sdca headset codec, RT1316 amplifier and RT715-scda microphone codec. Note that the release of this code before the formal adoption of the SDCA 1.0 specification was formally endorsed by the MIPI Board to make sure there is no delay for Linux-based support of this specification. Jack Yu (1): ASoC/SoundWire: rt715-sdca: First version of rt715 sdw sdca codec driver Pierre-Louis Bossart (2): soundwire: SDCA: add helper macro to access controls regmap/SoundWire: sdw: add support for SoundWire 1.2 MBQ Shuming Fan (2): ASoC/SoundWire: rt1316: Add RT1316 SDCA vendor-specific driver ASoC/SoundWire: rt711-sdca: Add RT711 SDCA vendor-specific driver drivers/base/regmap/Kconfig |6 +- drivers/base/regmap/Makefile|1 + drivers/base/regmap/regmap-sdw-mbq.c| 101 ++ include/linux/regmap.h | 35 + include/linux/soundwire/sdw_registers.h | 32 + sound/soc/codecs/Kconfig| 20 + sound/soc/codecs/Makefile |6 + sound/soc/codecs/rt1316-sdw.c | 756 sound/soc/codecs/rt1316-sdw.h | 115 ++ sound/soc/codecs/rt711-sdca-sdw.c | 424 +++ sound/soc/codecs/rt711-sdca-sdw.h | 101 ++ sound/soc/codecs/rt711-sdca.c | 1481 +++ sound/soc/codecs/rt711-sdca.h | 246 sound/soc/codecs/rt715-sdca-sdw.c | 278 + sound/soc/codecs/rt715-sdca-sdw.h | 170 +++ sound/soc/codecs/rt715-sdca.c | 936 ++ sound/soc/codecs/rt715-sdca.h | 124 ++ 17 files changed, 4831 insertions(+), 1 deletion(-) create mode 100644 drivers/base/regmap/regmap-sdw-mbq.c create mode 100644 sound/soc/codecs/rt1316-sdw.c create mode 100644 sound/soc/codecs/rt1316-sdw.h create mode 100644 sound/soc/codecs/rt711-sdca-sdw.c create mode 100644 sound/soc/codecs/rt711-sdca-sdw.h create mode 100644 sound/soc/codecs/rt711-sdca.c create mode 100644 sound/soc/codecs/rt711-sdca.h create mode 100644 sound/soc/codecs/rt715-sdca-sdw.c create mode 100644 sound/soc/codecs/rt715-sdca-sdw.h create mode 100644 sound/soc/codecs/rt715-sdca.c create mode 100644 sound/soc/codecs/rt715-sdca.h -- 2.17.1
[PATCH 1/5] soundwire: SDCA: add helper macro to access controls
From: Pierre-Louis Bossart The upcoming SDCA (SoundWire Device Class Audio) specification defines a hierarchical encoding to interface with Class-defined capabilities. The specification is not yet accessible to the general public but this information is released with explicit permission from the MIPI Board to avoid delays with SDCA support on Linux platforms. A block of 64 MBytes of register addresses are allocated to SDCA controls, starting at address 0x4000. The 26 LSBs which identify individual controls are set based on the following variables: - Function Number. An SCDA device can be split in up to 8 independent Functions. Each of these Functions is described in the SDCA specification, e.g. Smart Amplifier, Smart Microphone, Simple Microphone, Jack codec, HID, etc. - Entity Number. Within each Function, an Entity is an identifiable block. Up to 127 Entities are connected in a pre-defined graph (similar to USB), with Entity0 reserved for Function-level configurations. In contrast to USB, the SDCA spec pre-defines Function Types, topologies, and allowed options, i.e. the degree of freedom is not unlimited to limit the possibility of errors in descriptors leading to software quirks. - Control Selector. Within each Entity, the SDCA specification defines 48 controls such as Mute, Gain, AGC, etc, and 16 implementation defined ones. Some Control Selectors might be used for low-level platform setup, and other exposed to applications and users. Note that the same Control Selector capability, e.g. Latency control, might be located at different offsets in different entities, the Control Selector mapping is Entity-specific. - Control Number. Some Control Selectors allow channel-specific values to be set, with up to 64 channels allowed. This is mostly used for volume control. - Current/Next values. Some Control Selectors are 'Dual-Ranked'. Software may either update the Current value directly for immediate effect. Alternatively, software may write into the 'Next' values and update the SoundWire 1.2 'Commit Groups' register to copy 'Next' values into 'Current' ones in a synchronized manner. This is different from bank switching which is typically used to change the bus configuration only. - MBQ. the Multi-Byte Quantity bit is used to provide atomic updates when accessing more that one byte, for example a 16-bit volume control would be updated consistently, the intermediate values mixing old MSB with new LSB are not applied. These 6 parameters are used to build a 32-bit address to access the desired Controls. Because of address range, paging is required, but the most often used parameter values are placed in the lower 16 bits of the address. This helps to keep the paging registers constant while updating Controls for a specific Device/Function. Reviewed-by: Rander Wang Reviewed-by: Guennadi Liakhovetski Reviewed-by: Kai Vehmanen Signed-off-by: Pierre-Louis Bossart Signed-off-by: Bard Liao --- include/linux/soundwire/sdw_registers.h | 32 + 1 file changed, 32 insertions(+) diff --git a/include/linux/soundwire/sdw_registers.h b/include/linux/soundwire/sdw_registers.h index f420e8059779..e14dff9a9c7f 100644 --- a/include/linux/soundwire/sdw_registers.h +++ b/include/linux/soundwire/sdw_registers.h @@ -298,4 +298,36 @@ #define SDW_CASC_PORT_MASK_INTSTAT31 #define SDW_CASC_PORT_REG_OFFSET_INTSTAT3 2 +/* + * v1.2 device - SDCA address mapping + * + * Spec definition + * BitsContents + * 31 0 (required by addressing range) + * 30:26 0b1 (Control Prefix) + * 25 0 (Reserved) + * 24:22 Function Number [2:0] + * 21 Entity[6] + * 20:19 Control Selector[5:4] + * 18 0 (Reserved) + * 17:15 Control Number[5:3] + * 14 Next + * 13 MBQ + * 12:7Entity[5:0] + * 6:3 Control Selector[3:0] + * 2:0 Control Number[2:0] + */ + +#define SDW_SDCA_CTL(fun, ent, ctl, ch)(BIT(30) | \ +(((fun) & 0x7) << 22) | \ +(((ent) & 0x40) << 15) | \ +(((ent) & 0x3f) << 7) | \ +(((ctl) & 0x30) << 15) | \ +(((ctl) & 0x0f) << 3) | \ +(((ch) & 0x38) << 12) | \ +((ch) & 0x07)) + +#define SDW_SDCA_MBQ_CTL(reg) ((reg) | BIT(13)) +#define SDW_SDCA_NEXT_CTL(reg) ((reg) | BIT(14)) + #endif /* __SDW_REGISTERS_H */ -- 2.17.1
[PATCH 2/5] regmap/SoundWire: sdw: add support for SoundWire 1.2 MBQ
From: Pierre-Louis Bossart The SoundWire 1.1 specification only allowed for reads and writes of bytes. The SoundWire 1.2 specification adds a new capability to transfer "Multi-Byte Quantities" (MBQ) across the bus. The transfers still happens one-byte-at-a-time, but the update is atomic. For example when writing a 16-bit volume, the first byte transferred is only taken into account when the second byte is successfully transferred. The mechanism is symmetrical for read and writes: - On a read, the address of the last byte to be read is modified by setting the MBQ bit - On a write, the address of all but the last byte to be written are modified by setting the MBQ bit. The address for the last byte relies on the MBQ bit being cleared. The current definitions for MBQ-based controls in the SDCA draft standard are limited to 16 bits for volumes, so for now this is the only supported format. An update will be provided if and when support for 24-bit and 32-bit values is specified by the SDCA standard. One possible objection is that this code could have been handled with regmap-sdw.c. However this is a new spec addition not handled by every SoundWire 1.1 and non-SDCA device, so there's no reason to load code that will never be used. Also in practice it's extremely unlikely that CONFIG_REGMAP would not be selected with CONFIG_REGMAP_MBQ selected. However there's no functional dependency between the two modules so they can be selected separately. Reviewed-by: Rander Wang Reviewed-by: Guennadi Liakhovetski Reviewed-by: Kai Vehmanen Signed-off-by: Pierre-Louis Bossart Signed-off-by: Bard Liao --- drivers/base/regmap/Kconfig | 6 +- drivers/base/regmap/Makefile | 1 + drivers/base/regmap/regmap-sdw-mbq.c | 101 +++ include/linux/regmap.h | 35 ++ 4 files changed, 142 insertions(+), 1 deletion(-) create mode 100644 drivers/base/regmap/regmap-sdw-mbq.c diff --git a/drivers/base/regmap/Kconfig b/drivers/base/regmap/Kconfig index bcb90d8c3960..50b1e2d06a25 100644 --- a/drivers/base/regmap/Kconfig +++ b/drivers/base/regmap/Kconfig @@ -4,7 +4,7 @@ # subsystems should select the appropriate symbols. config REGMAP - default y if (REGMAP_I2C || REGMAP_SPI || REGMAP_SPMI || REGMAP_W1 || REGMAP_AC97 || REGMAP_MMIO || REGMAP_IRQ || REGMAP_SOUNDWIRE || REGMAP_SCCB || REGMAP_I3C || REGMAP_SPI_AVMM) + default y if (REGMAP_I2C || REGMAP_SPI || REGMAP_SPMI || REGMAP_W1 || REGMAP_AC97 || REGMAP_MMIO || REGMAP_IRQ || REGMAP_SOUNDWIRE || REGMAP_SOUNDWIRE_MBQ || REGMAP_SCCB || REGMAP_I3C || REGMAP_SPI_AVMM) select IRQ_DOMAIN if REGMAP_IRQ bool @@ -46,6 +46,10 @@ config REGMAP_SOUNDWIRE tristate depends on SOUNDWIRE +config REGMAP_SOUNDWIRE_MBQ + tristate + depends on SOUNDWIRE + config REGMAP_SCCB tristate depends on I2C diff --git a/drivers/base/regmap/Makefile b/drivers/base/regmap/Makefile index ac1b69ee4051..33f63adb5b3d 100644 --- a/drivers/base/regmap/Makefile +++ b/drivers/base/regmap/Makefile @@ -15,6 +15,7 @@ obj-$(CONFIG_REGMAP_MMIO) += regmap-mmio.o obj-$(CONFIG_REGMAP_IRQ) += regmap-irq.o obj-$(CONFIG_REGMAP_W1) += regmap-w1.o obj-$(CONFIG_REGMAP_SOUNDWIRE) += regmap-sdw.o +obj-$(CONFIG_REGMAP_SOUNDWIRE_MBQ) += regmap-sdw-mbq.o obj-$(CONFIG_REGMAP_SCCB) += regmap-sccb.o obj-$(CONFIG_REGMAP_I3C) += regmap-i3c.o obj-$(CONFIG_REGMAP_SPI_AVMM) += regmap-spi-avmm.o diff --git a/drivers/base/regmap/regmap-sdw-mbq.c b/drivers/base/regmap/regmap-sdw-mbq.c new file mode 100644 index ..8ce30650b97c --- /dev/null +++ b/drivers/base/regmap/regmap-sdw-mbq.c @@ -0,0 +1,101 @@ +// SPDX-License-Identifier: GPL-2.0 +// Copyright(c) 2020 Intel Corporation. + +#include +#include +#include +#include +#include +#include +#include "internal.h" + +static int regmap_sdw_mbq_write(void *context, unsigned int reg, unsigned int val) +{ + struct device *dev = context; + struct sdw_slave *slave = dev_to_sdw_dev(dev); + int ret; + + ret = sdw_write(slave, SDW_SDCA_MBQ_CTL(reg), (val >> 8) & 0xff); + if (ret < 0) + return ret; + + return sdw_write(slave, reg, val & 0xff); +} + +static int regmap_sdw_mbq_read(void *context, unsigned int reg, unsigned int *val) +{ + struct device *dev = context; + struct sdw_slave *slave = dev_to_sdw_dev(dev); + int read0; + int read1; + + read0 = sdw_read(slave, reg); + if (read0 < 0) + return read0; + + read1 = sdw_read(slave, SDW_SDCA_MBQ_CTL(reg)); + if (read1 < 0) + return read1; + + *val = (read1 << 8) | read0; + + return 0; +} + +static struct regmap_bus regmap_sdw_mbq = { + .reg_read = regmap_sdw_mbq_read, + .reg_write = regmap_sdw_mbq_write, + .reg_format_endian_default = REGMAP_ENDIAN_LITTLE, + .val_format_endian_default = REGMAP_ENDIAN_LITTLE, +}; + +static int
[PATCH 3/5] ASoC/SoundWire: rt715-sdca: First version of rt715 sdw sdca codec driver
From: Jack Yu First version of rt715 sdw sdca codec driver. Signed-off-by: Jack Yu Reviewed-by: Pierre-Louis Bossart Signed-off-by: Bard Liao --- sound/soc/codecs/Kconfig | 7 + sound/soc/codecs/Makefile | 2 + sound/soc/codecs/rt715-sdca-sdw.c | 278 + sound/soc/codecs/rt715-sdca-sdw.h | 170 ++ sound/soc/codecs/rt715-sdca.c | 936 ++ sound/soc/codecs/rt715-sdca.h | 124 6 files changed, 1517 insertions(+) create mode 100644 sound/soc/codecs/rt715-sdca-sdw.c create mode 100644 sound/soc/codecs/rt715-sdca-sdw.h create mode 100644 sound/soc/codecs/rt715-sdca.c create mode 100644 sound/soc/codecs/rt715-sdca.h diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig index 5791b7056af6..b80d07df5b55 100644 --- a/sound/soc/codecs/Kconfig +++ b/sound/soc/codecs/Kconfig @@ -177,6 +177,7 @@ config SND_SOC_ALL_CODECS imply SND_SOC_RT700_SDW imply SND_SOC_RT711_SDW imply SND_SOC_RT715_SDW + imply SND_SOC_RT715_SDCA_SDW imply SND_SOC_RT1308_SDW imply SND_SOC_SGTL5000 imply SND_SOC_SI476X @@ -1216,6 +1217,12 @@ config SND_SOC_RT715_SDW select SND_SOC_RT715 select REGMAP_SOUNDWIRE +config SND_SOC_RT715_SDCA_SDW + tristate "Realtek RT715 SDCA Codec - SDW" + depends on SOUNDWIRE + select REGMAP_SOUNDWIRE + select REGMAP_SOUNDWIRE_MBQ + #Freescale sgtl5000 codec config SND_SOC_SGTL5000 tristate "Freescale SGTL5000 CODEC" diff --git a/sound/soc/codecs/Makefile b/sound/soc/codecs/Makefile index 11ce98c25d6c..b1683403afb3 100644 --- a/sound/soc/codecs/Makefile +++ b/sound/soc/codecs/Makefile @@ -188,6 +188,7 @@ snd-soc-rt5682-i2c-objs := rt5682-i2c.o snd-soc-rt700-objs := rt700.o rt700-sdw.o snd-soc-rt711-objs := rt711.o rt711-sdw.o snd-soc-rt715-objs := rt715.o rt715-sdw.o +snd-soc-rt715-sdca-objs := rt715-sdca.o rt715-sdca-sdw.o snd-soc-sgtl5000-objs := sgtl5000.o snd-soc-alc5623-objs := alc5623.o snd-soc-alc5632-objs := alc5632.o @@ -498,6 +499,7 @@ obj-$(CONFIG_SND_SOC_RT5682_SDW)+= snd-soc-rt5682-sdw.o obj-$(CONFIG_SND_SOC_RT700) += snd-soc-rt700.o obj-$(CONFIG_SND_SOC_RT711) += snd-soc-rt711.o obj-$(CONFIG_SND_SOC_RT715) += snd-soc-rt715.o +obj-$(CONFIG_SND_SOC_RT715_SDCA_SDW) += snd-soc-rt715-sdca.o obj-$(CONFIG_SND_SOC_SGTL5000) += snd-soc-sgtl5000.o obj-$(CONFIG_SND_SOC_SIGMADSP) += snd-soc-sigmadsp.o obj-$(CONFIG_SND_SOC_SIGMADSP_I2C) += snd-soc-sigmadsp-i2c.o diff --git a/sound/soc/codecs/rt715-sdca-sdw.c b/sound/soc/codecs/rt715-sdca-sdw.c new file mode 100644 index ..889b6b3b0009 --- /dev/null +++ b/sound/soc/codecs/rt715-sdca-sdw.c @@ -0,0 +1,278 @@ +// SPDX-License-Identifier: GPL-2.0-only +// +// rt715-sdca-sdw.c -- rt715 ALSA SoC audio driver +// +// Copyright(c) 2020 Realtek Semiconductor Corp. +// +// + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "rt715-sdca.h" +#include "rt715-sdca-sdw.h" + +static bool rt715_sdca_readable_register(struct device *dev, unsigned int reg) +{ + switch (reg) { + case 0x201a ... 0x2027: + case 0x2029 ... 0x202a: + case 0x202d ... 0x2034: + case 0x2200 ... 0x2204: + case 0x2206 ... 0x2212: + case 0x2230 ... 0x2239: + case 0x2f5b: + case SDW_SDCA_CTL(FUN_MIC_ARRAY, RT715_SDCA_SMPU_TRIG_ST_EN, + RT715_SDCA_SMPU_TRIG_ST_CTRL, CH_00): + return true; + default: + return false; + } +} + +static bool rt715_sdca_volatile_register(struct device *dev, unsigned int reg) +{ + switch (reg) { + case 0x201b: + case 0x201c: + case 0x201d: + case 0x201f: + case 0x2021: + case 0x2023: + case 0x2230: + case 0x202d ... 0x202f: /* BRA */ + case 0x2200 ... 0x2212: /* i2c debug */ + case 0x2f07: + case 0x2f1b ... 0x2f1e: + case 0x2f30 ... 0x2f34: + case 0x2f50 ... 0x2f51: + case 0x2f53 ... 0x2f59: + case 0x2f5c ... 0x2f5f: + case SDW_SDCA_CTL(FUN_MIC_ARRAY, RT715_SDCA_SMPU_TRIG_ST_EN, + RT715_SDCA_SMPU_TRIG_ST_CTRL, CH_00): /* VAD Searching status */ + return true; + default: + return false; + } +} + +static bool rt715_sdca_mbq_readable_register(struct device *dev, unsigned int reg) +{ + switch (reg) { + case 0x200: + case 0x22b: + case 0x236: + case 0x237: + case 0x239: + case 0x610: + return true; + default: + return false; + } +} + +static bool rt715_sdca_mbq_volatile_register(struct device *dev, unsigned int reg) +{ + switch (reg) { + case 0x200: + return true; + default: + return false; + } +} + +static const struct regmap_config rt715_sdca_regmap = { +
Re: [PATCH] ACPI: Remove trailing whitespace
On Tue, 2020-11-03 at 22:30 +0100, Maximilian Luz wrote: > On 11/3/20 10:12 PM, Bjorn Helgaas wrote: > > On Mon, Nov 02, 2020 at 02:36:41PM +0100, Maximilian Luz wrote: > > > Remove trailing whitespace and fix some whitespace inconsitencies while > > > at it. > > > > I'm OK with this as long as somebody fixes the > > s/inconsitencies/inconsistencies/ > > Sorry about that, I can resubmit if necessary. > > > above. I assume you've scanned all of drivers/acpi/ for similar > > issues so they can all be fixed at once. > > Yes. I scanned drivers/acpi for trailing whitespaces after I noticed a > couple of them. I did not explicitly scan for other stuff like spaces > where there should be tabs, mostly because I haven't found a quick and > reliable solution for that. I only noticed an inconsistent indentation > when committing, so I fixed that too. You could try: $ git ls-files -- 'drivers/acpi/*.[ch]' | \ xargs ./scripts/checkpatch.pl -f --fix-inplace --types=CODE_INDENT Right now that produces: --- drivers/acpi/ac.c | 6 +++--- drivers/acpi/acpi_processor.c | 6 +++--- drivers/acpi/acpi_video.c | 6 +++--- drivers/acpi/acpica/rslist.c| 2 +- drivers/acpi/battery.c | 6 +++--- drivers/acpi/bus.c | 12 ++-- drivers/acpi/button.c | 4 ++-- drivers/acpi/ec.c | 2 +- drivers/acpi/event.c| 2 +- drivers/acpi/internal.h | 16 drivers/acpi/nfit/core.c| 10 +- drivers/acpi/pci_irq.c | 4 ++-- drivers/acpi/pci_link.c | 6 +++--- drivers/acpi/pci_mcfg.c | 2 +- drivers/acpi/power.c| 6 +++--- drivers/acpi/processor_perflib.c| 2 +- drivers/acpi/processor_throttling.c | 2 +- drivers/acpi/sbs.c | 6 +++--- drivers/acpi/sbshc.c| 2 +- drivers/acpi/sbshc.h| 2 +- drivers/acpi/scan.c | 2 +- drivers/acpi/thermal.c | 4 ++-- drivers/acpi/utils.c| 2 +- drivers/acpi/video_detect.c | 16 drivers/acpi/wakeup.c | 4 ++-- 25 files changed, 66 insertions(+), 66 deletions(-) diff --git a/drivers/acpi/ac.c b/drivers/acpi/ac.c index 46a64e9fa716..46be80976a03 100644 --- a/drivers/acpi/ac.c +++ b/drivers/acpi/ac.c @@ -89,7 +89,7 @@ struct acpi_ac { #define to_acpi_ac(x) power_supply_get_drvdata(x) /* -- - AC Adapter Management + AC Adapter Management -- */ static int acpi_ac_get_state(struct acpi_ac *ac) @@ -112,7 +112,7 @@ static int acpi_ac_get_state(struct acpi_ac *ac) } /* -- -sysfs I/F + sysfs I/F -- */ static int get_ac_property(struct power_supply *psy, enum power_supply_property psp, @@ -141,7 +141,7 @@ static enum power_supply_property ac_props[] = { }; /* -- - Driver Model + Driver Model -- */ static void acpi_ac_notify(struct acpi_device *device, u32 event) diff --git a/drivers/acpi/acpi_processor.c b/drivers/acpi/acpi_processor.c index 2ee5e05a0d69..b45102e4fbfc 100644 --- a/drivers/acpi/acpi_processor.c +++ b/drivers/acpi/acpi_processor.c @@ -30,7 +30,7 @@ DEFINE_PER_CPU(struct acpi_processor *, processors); EXPORT_PER_CPU_SYMBOL(processors); /* -- -Errata Handling + Errata Handling -- */ struct acpi_processor_errata errata __read_mostly; @@ -158,7 +158,7 @@ static int acpi_processor_errata(void) } /* -- -Initialization + Initialization -- */ #ifdef CONFIG_ACPI_HOTPLUG_CPU @@ -441,7 +441,7 @@ static int acpi_processor_add(struct acpi_device *device, #ifdef CONFIG_ACPI_HOTPLUG_CPU /* -- -Removal + Removal -- */ static void
Re: [PATCH] bcache: consider the fragmentation when update the writeback rate
Hi Dongdong, Thank you for the patch! Yet something to improve: [auto build test ERROR on linus/master] [also build test ERROR on v5.10-rc2 next-20201103] [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/Dongdong-Tao/bcache-consider-the-fragmentation-when-update-the-writeback-rate/20201103-204517 base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git b7cbaf59f62f8ab8f157698f9e31642bff525bd0 config: nds32-randconfig-p002-20201103 (attached as .config) compiler: nds32le-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 # https://github.com/0day-ci/linux/commit/4e57aac94bb0d0822473657d7ef0f3a0455e81f6 git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Dongdong-Tao/bcache-consider-the-fragmentation-when-update-the-writeback-rate/20201103-204517 git checkout 4e57aac94bb0d0822473657d7ef0f3a0455e81f6 # save the attached .config to linux build tree COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=nds32 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot All errors (new ones prefixed by >>): nds32le-linux-ld: arch/nds32/kernel/ex-entry.o: in function `common_exception_handler': (.text+0xfe): undefined reference to `__trace_hardirqs_off' (.text+0xfe): relocation truncated to fit: R_NDS32_25_PCREL_RELA against undefined symbol `__trace_hardirqs_off' nds32le-linux-ld: arch/nds32/kernel/ex-exit.o: in function `no_work_pending': (.text+0xce): undefined reference to `__trace_hardirqs_off' nds32le-linux-ld: (.text+0xd2): undefined reference to `__trace_hardirqs_off' nds32le-linux-ld: (.text+0xd6): undefined reference to `__trace_hardirqs_on' nds32le-linux-ld: (.text+0xda): undefined reference to `__trace_hardirqs_on' nds32le-linux-ld: drivers/md/bcache/writeback.o: in function `update_writeback_rate': >> writeback.c:(.text+0x1ffa): undefined reference to `__divdi3' >> nds32le-linux-ld: writeback.c:(.text+0x1ffe): undefined reference to >> `__divdi3' --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-...@lists.01.org .config.gz Description: application/gzip
Re: [perf metricgroup] fcc9c5243c: perf-sanity-tests.Parse_and_process_metrics.fail
On 11/3/20 10:24 PM, John Garry wrote: > On 03/11/2020 16:05, Ian Rogers wrote: >> On Tue, Nov 3, 2020 at 6:43 AM John Garry wrote: >>> On 20/10/2020 17:53, Ian Rogers wrote: >> Thanks for taking a look John. If you want help you can send the >> output of "perf test 67 -vvv" to me. It is possible Broadwell has >> similar glitches in the json to Skylake. I tested the original test on >> server parts as I can access them as cloud machines. >> >>> I will have a look, but I was hoping that Ian would have a proper fix >>> for this on top of ("perf metricgroup: Fix uncore metric expressions"), >>> which now looks to be merged. >> I still have these changes to look at in my inbox but I'm assuming >> they're good:-) Sorry for not getting to them, but it's good they are >> merged. > Hi Ian, > Checked in upstream kernel with your fix patch, in powerpc also test > case 67 is passing. > But I am getting issue in test 10 for powerpc > > [command]# ./perf test 10 > 10: PMU events : > 10.1: PMU event table sanity : Ok > 10.2: PMU event map aliases : Ok > 10.3: Parsing of PMU event table metrics : > Skip (some metrics failed) > 10.4: Parsing of PMU event table metrics with fake PMUs : > FAILED! > > Was debugging it, issue is with commit e1c92a7fbbc5 perf tests: Add > another metric parsing test. > > So, there we are passing different runtime parameter value in > "expr__find_other and expr__parse" > in function `metric_parse_fake`. I believe we need to send same value. > I will send fix patch for the same. >>> Just wondering, was a patch ever submitted for this? Something still >>> broken? I can't see any recent relevant changes to tests/pmu-events.c >> The test itself shouldn't have changed, but the json files parsed by >> jevents and turned into C code that the test exercises should have >> changed. Jin Yao has sent two patch sets fixing a metric issue on SKL >> (Skylake non-server) that should hopefully fix the issue there - I'll >> check the status on these. Are you testing on Skylake? > > So I have re-read this thread, and it seems that 2x different things are > being discussed: > a. some breakage for test #10 on skylake > b. test #67 being broken > > It seems that a. has been addressed. That's what I was asking about just now. Hi Ian/John, The breakage for test #10 which I mentioned is for power9 machine, if that you were asking. I still need to send fix patch out. I will send it soon. Thanks, Kajol Jain > > So about b., which I thought may be broken for some other reason apart from > my hacky patch. But it seems not the case, and a proper patch is needed there. > > Ian, have you had a chance to consider this issue in b.? That is, we have > breakage for metrics using uncore alias expressions for when multiple uncore > PMUs associated exist in the system? As before, looks broken by ded80bda8bc9 > ("perf expr: Migrate expr ids table to a hashmap") > > Thanks, > John > >
Re: [PATCH v2 1/2] media: i2c: Add driver for the Sony Exmor-RS IMX300 camera sensor
Hi, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on linuxtv-media/master] [also build test WARNING on robh/for-next linus/master v5.10-rc2 next-20201103] [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/kholk11-gmail-com/Add-support-for-the-Sony-Exmor-RS-IMX300-camera-sensor/20201030-013153 base: git://linuxtv.org/media_tree.git master config: parisc-randconfig-s031-20201104 (attached as .config) compiler: hppa-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.3-76-gf680124b-dirty # https://github.com/0day-ci/linux/commit/8be57de72d799d8cffbdb7bbb8a5eca25cedfb0f git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review kholk11-gmail-com/Add-support-for-the-Sony-Exmor-RS-IMX300-camera-sensor/20201030-013153 git checkout 8be57de72d799d8cffbdb7bbb8a5eca25cedfb0f # 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=parisc If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot "sparse warnings: (new ones prefixed by >>)" >> drivers/media/i2c/imx300.c:1876:17: sparse: sparse: incompatible types in >> comparison expression (different signedness): >> drivers/media/i2c/imx300.c:1876:17: sparse:signed long long * >> drivers/media/i2c/imx300.c:1876:17: sparse:unsigned long long [usertype] >> * vim +1876 drivers/media/i2c/imx300.c 1864 1865 static s64 get_pixel_rate(struct imx300 *imx300) 1866 { 1867 s64 prate; 1868 1869 if (imx300->mode->high_bw) 1870 prate = IMX300_HIGH_BW_PIXEL_RATE; 1871 else 1872 prate = IMX300_LOW_BW_PIXEL_RATE; 1873 1874 /* Satisfy the settle time for 8bits */ 1875 if (imx300->cur_bps == 8) { > 1876 do_div(prate, 10); 1877 prate *= 12; 1878 } 1879 1880 return prate; 1881 } 1882 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-...@lists.01.org .config.gz Description: application/gzip
cc1: fatal error: opening output file arch/powerpc/boot/dts/fsl/.mpc8560ads.dtb.dts.tmp: No such file or directory
Hi Masahiro, FYI, the error/warning still remains. tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master head: 4ef8451b332662d004df269d4cdeb7d9f31419b5 commit: cc8a51ca6f05ade72f7dd2624bc5f9b948e216fc kbuild: always create directories of targets date: 3 months ago config: powerpc64-randconfig-r016-20201104 (attached as .config) compiler: powerpc-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 # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=cc8a51ca6f05ade72f7dd2624bc5f9b948e216fc git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git git fetch --no-tags linus master git checkout cc8a51ca6f05ade72f7dd2624bc5f9b948e216fc # save the attached .config to linux build tree COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=powerpc64 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot All errors (new ones prefixed by >>): >> cc1: fatal error: opening output file >> arch/powerpc/boot/dts/fsl/.mpc8560ads.dtb.dts.tmp: No such file or directory compilation terminated. --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-...@lists.01.org .config.gz Description: application/gzip
[RESEND PATCH v20 1/3] MAINTAINERS: da7280 updates to the Dialog Semiconductor search terms
This patch adds the da7280 bindings doc and driver to the Dialog Semiconductor support list. Signed-off-by: Roy Im --- v20: No changes. v19: No changes. v18: No changes. v17: No changes. v16: No changes. v15: No changes. v14: No changes. v13: No changes. v12: Corrected file list order. v11: No changes. v10: No changes. v9: No changes. v8: No changes. v7: No changes. v6: No changes. v5: No changes. v4: No changes. v3: No changes. v2: No changes. MAINTAINERS | 2 ++ 1 file changed, 2 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index b516bb3..f64e18b 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -5117,6 +5117,7 @@ M:Support Opensource S: Supported W: http://www.dialog-semiconductor.com/products F: Documentation/devicetree/bindings/input/da90??-onkey.txt +F: Documentation/devicetree/bindings/input/dlg,da72??.txt F: Documentation/devicetree/bindings/mfd/da90*.txt F: Documentation/devicetree/bindings/regulator/da92*.txt F: Documentation/devicetree/bindings/regulator/slg51000.txt @@ -5127,6 +5128,7 @@ F:Documentation/hwmon/da90??.rst F: drivers/gpio/gpio-da90??.c F: drivers/hwmon/da90??-hwmon.c F: drivers/iio/adc/da91??-*.c +F: drivers/input/misc/da72??.[ch] F: drivers/input/misc/da90??_onkey.c F: drivers/input/touchscreen/da9052_tsi.c F: drivers/leds/leds-da90??.c -- end-of-patch for RESEND PATCH v20
[RESEND PATCH v20 0/3] da7280: haptic driver submission
This patch adds support for the Dialog DA7280 Haptic driver IC. In this patch set the following is provided: [PATCH v20 1/3] MAINTAINERS file update for DA7280 [PATCH v20 2/3] DA7280 DT Binding [PATCH v20 3/3] DA7280 Driver This patch applies against linux-mainline and v5.10-rc2 Thank you, Roy Im, Dialog Semiconductor Ltd. Roy Im (3): MAINTAINERS: da7280 updates to the Dialog Semiconductor search terms dt-bindings: input: Add document bindings for DA7280 Input: new da7280 haptic driver .../devicetree/bindings/input/dlg,da7280.txt | 109 ++ MAINTAINERS|2 + drivers/input/misc/Kconfig | 12 + drivers/input/misc/Makefile|1 + drivers/input/misc/da7280.c| 1375 5 files changed, 1499 insertions(+) create mode 100644 Documentation/devicetree/bindings/input/dlg,da7280.txt create mode 100644 drivers/input/misc/da7280.c -- end-of-patch for RESEND PATCH v20
[RESEND PATCH v20 3/3] Input: new da7280 haptic driver
Adds support for the Dialog DA7280 LRA/ERM Haptic Driver with multiple mode and integrated waveform memory and wideband support. It communicates via an I2C bus to the device. Reviewed-by: Jes Sorensen . Signed-off-by: Roy Im --- v20: - Simplified the code with dev_err_probe(). - Removed some work queues. v19: - Corrected some errors and replaced some code to proper one. - Improved work queues and removed sysfs attributes - Added changes for gpix id in upload effect. v18: - Corrected comments in Kconfig - Updated to preferred style for multi line comments in c file. v17: - fixed an issue. v16: - Corrected some code and updated description in Kconfig. v15: - Removed some defines and updated some comments. v14: - Updated pwm related code, alignments and comments. v13: - Updated some conditions in pwm function and alignments. v12: No changes. v11: - Updated the pwm related code, comments and typo. v10: - Updated the pwm related function and added some comments. v9: - Removed the header file and put the definitions into the c file. - Updated the pwm code and error logs with %pE v8: - Added changes to support FF_PERIODIC/FF_CUSTOM and FF_CONSTANT. - Updated the dt-related code. - Removed memless related functions. v7: - Added more attributes to handle one value per file. - Replaced and updated the dt-related code and functions called. - Fixed error/functions. v6: No changes. v5: Fixed errors in Kconfig file. v4: Updated code as dt-bindings are changed. v3: No changes. v2: Fixed kbuild error/warning drivers/input/misc/Kconfig | 12 + drivers/input/misc/Makefile |1 + drivers/input/misc/da7280.c | 1375 +++ 3 files changed, 1388 insertions(+) create mode 100644 drivers/input/misc/da7280.c diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig index 362e8a0..d38b466 100644 --- a/drivers/input/misc/Kconfig +++ b/drivers/input/misc/Kconfig @@ -869,4 +869,16 @@ config INPUT_STPMIC1_ONKEY To compile this driver as a module, choose M here: the module will be called stpmic1_onkey. +config INPUT_DA7280_HAPTICS + tristate "Dialog Semiconductor DA7280 haptics support" + depends on INPUT && I2C + select REGMAP_I2C + help + Say Y to enable support for the Dialog DA7280 haptics driver. + The haptics can be controlled by PWM or GPIO + with I2C communication. + + To compile this driver as a module, choose M here: the + module will be called da7280. + endif diff --git a/drivers/input/misc/Makefile b/drivers/input/misc/Makefile index a48e5f2..9cfd6ab 100644 --- a/drivers/input/misc/Makefile +++ b/drivers/input/misc/Makefile @@ -25,6 +25,7 @@ obj-$(CONFIG_INPUT_CMA3000) += cma3000_d0x.o obj-$(CONFIG_INPUT_CMA3000_I2C)+= cma3000_d0x_i2c.o obj-$(CONFIG_INPUT_COBALT_BTNS)+= cobalt_btns.o obj-$(CONFIG_INPUT_CPCAP_PWRBUTTON)+= cpcap-pwrbutton.o +obj-$(CONFIG_INPUT_DA7280_HAPTICS) += da7280.o obj-$(CONFIG_INPUT_DA9052_ONKEY) += da9052_onkey.o obj-$(CONFIG_INPUT_DA9055_ONKEY) += da9055_onkey.o obj-$(CONFIG_INPUT_DA9063_ONKEY) += da9063_onkey.o diff --git a/drivers/input/misc/da7280.c b/drivers/input/misc/da7280.c new file mode 100644 index 000..21d4d37 --- /dev/null +++ b/drivers/input/misc/da7280.c @@ -0,0 +1,1375 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * DA7280 Haptic device driver + * + * Copyright (c) 2020 Dialog Semiconductor. + * Author: Roy Im + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* Registers */ +#define DA7280_IRQ_EVENT1 0x03 +#define DA7280_IRQ_EVENT_WARNING_DIAG 0x04 +#define DA7280_IRQ_EVENT_SEQ_DIAG 0x05 +#define DA7280_IRQ_STATUS10x06 +#define DA7280_IRQ_MASK1 0x07 +#define DA7280_FRQ_LRA_PER_H 0x0A +#define DA7280_FRQ_LRA_PER_L 0x0B +#define DA7280_ACTUATOR1 0x0C +#define DA7280_ACTUATOR2 0x0D +#define DA7280_ACTUATOR3 0x0E +#define DA7280_CALIB_V2I_H0x0F +#define DA7280_CALIB_V2I_L0x10 +#define DA7280_TOP_CFG1 0x13 +#define DA7280_TOP_CFG2 0x14 +#define DA7280_TOP_CFG4 0x16 +#define DA7280_TOP_INT_CFG1 0x17 +#define DA7280_TOP_CTL1 0x22 +#define DA7280_TOP_CTL2 0x23 +#define DA7280_SEQ_CTL2 0x28 +#define DA7280_GPI_0_CTL 0x29 +#define DA7280_GPI_1_CTL 0x2A +#define DA7280_GPI_2_CTL 0x2B