Re: [PATCH 2/4] arm64: dts: qcom: sc7180: Add iommus property to ETR
Hi Bjorn, On 2020-06-21 13:39, Sai Prakash Ranjan wrote: Hi Bjorn, On 2020-06-21 12:52, Bjorn Andersson wrote: On Tue 09 Jun 06:30 PDT 2020, Sai Prakash Ranjan wrote: Define iommus property for Coresight ETR component in SC7180 SoC with the SID and mask to enable SMMU translation for this master. We don't have &apps_smmu in linux-next, as we've yet to figure out how to disable the boot splash or support the stream mapping handover. So I'm not able to apply this. This is for SC7180 which has apps_smmu not SM8150. Please let me know if this needs further explanation. Thanks, Sai -- QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
Re: [PATCH v3 4/5] iommu/uapi: Handle data and argsz filled by users
Hi Jacob, On 2020/6/24 1:03, Jacob Pan wrote: IOMMU UAPI data has a user filled argsz field which indicates the data length comes with the API call. User data is not trusted, argsz must be validated based on the current kernel data size, mandatory data size, and feature flags. User data may also be extended, results in possible argsz increase. Backward compatibility is ensured based on size and flags checking. Details are documented in Documentation/userspace-api/iommu.rst This patch adds sanity checks in both IOMMU layer and vendor code, where VT-d is the only user for now. Signed-off-by: Liu Yi L Signed-off-by: Jacob Pan --- drivers/iommu/intel/svm.c | 3 ++ drivers/iommu/iommu.c | 96 --- include/linux/iommu.h | 7 ++-- 3 files changed, 98 insertions(+), 8 deletions(-) diff --git a/drivers/iommu/intel/svm.c b/drivers/iommu/intel/svm.c index 713b3a218483..237db56878c0 100644 --- a/drivers/iommu/intel/svm.c +++ b/drivers/iommu/intel/svm.c @@ -244,6 +244,9 @@ int intel_svm_bind_gpasid(struct iommu_domain *domain, struct device *dev, data->format != IOMMU_PASID_FORMAT_INTEL_VTD) return -EINVAL; + if (data->argsz != offsetofend(struct iommu_gpasid_bind_data, vendor.vtd)) + return -EINVAL; Need to do size check in intel_iommu_sva_invalidate() as well? + if (!dev_is_pci(dev)) return -ENOTSUPP; diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c index d43120eb1dc5..4a025c429b41 100644 --- a/drivers/iommu/iommu.c +++ b/drivers/iommu/iommu.c @@ -1951,22 +1951,108 @@ int iommu_attach_device(struct iommu_domain *domain, struct device *dev) EXPORT_SYMBOL_GPL(iommu_attach_device); int iommu_cache_invalidate(struct iommu_domain *domain, struct device *dev, - struct iommu_cache_invalidate_info *inv_info) + void __user *uinfo) Nit: keep it aligned. { + struct iommu_cache_invalidate_info inv_info; + unsigned long minsz, maxsz; + if (unlikely(!domain->ops->cache_invalidate)) return -ENODEV; - return domain->ops->cache_invalidate(domain, dev, inv_info); + /* Current kernel data size is the max to be copied from user */ + maxsz = sizeof(struct iommu_cache_invalidate_info); + memset((void *)&inv_info, 0, maxsz); + + /* +* No new spaces can be added before the variable sized union, the +* minimum size is the offset to the union. +*/ + minsz = offsetof(struct iommu_cache_invalidate_info, granu); + + /* Copy minsz from user to get flags and argsz */ + if (copy_from_user(&inv_info, uinfo, minsz)) + return -EFAULT; + + /* Fields before variable size union is mandatory */ + if (inv_info.argsz < minsz) + return -EINVAL; + /* +* User might be using a newer UAPI header, we shall let IOMMU vendor +* driver decide on what size it needs. Since the UAPI data extension +* can be vendor specific, larger argsz could be the result of extension +* for one vendor but it should not affect another vendor. +*/ + /* +* User might be using a newer UAPI header which has a larger data +* size, we shall support the existing flags within the current +* size. +*/ + if (inv_info.argsz > maxsz) + inv_info.argsz = maxsz; + + /* Checking the exact argsz based on generic flags */ + if (inv_info.granularity == IOMMU_INV_GRANU_ADDR && + inv_info.argsz != offsetofend(struct iommu_cache_invalidate_info, + granu.addr_info)) + return -EINVAL; + + if (inv_info.granularity == IOMMU_INV_GRANU_PASID && + inv_info.argsz != offsetofend(struct iommu_cache_invalidate_info, + granu.pasid_info)) + return -EINVAL; + + /* Copy the remaining user data _after_ minsz */ + if (copy_from_user((void *)&inv_info + minsz, uinfo + minsz, + inv_info.argsz - minsz)) + return -EFAULT; + + return domain->ops->cache_invalidate(domain, dev, &inv_info); } EXPORT_SYMBOL_GPL(iommu_cache_invalidate); -int iommu_sva_bind_gpasid(struct iommu_domain *domain, - struct device *dev, struct iommu_gpasid_bind_data *data) +int iommu_sva_bind_gpasid(struct iommu_domain *domain, struct device *dev, + void __user *udata) { + + struct iommu_gpasid_bind_data data; + unsigned long minsz, maxsz; + if (unlikely(!domain->ops->sva_bind_gpasid)) return -ENODEV; - return domain->ops->sva_bind_gpasid(domain, dev, data); + /* Current kernel data size is the max to be copied from user */ + maxsz = sizeof(struct iommu_gp
Re: [PATCH v3 07/10] x86/boot/compressed: change definition of STATIC
On Tue, Jun 23, 2020 at 10:23:24AM -0700, Kristen Carlson Accardi wrote: > In preparation for changes to the upcoming fgkaslr commit, change misc.c > to not define STATIC as static, but instead set STATIC to "". This allows > memptr to become accessible to multiple files. Thanks for splitting this out! After looking at the results, I think I finally understand the issue getting solved. tl;dr: I think your patch isn't the right solution (basically making "malloc_ptr" a global so that multiple static copies of malloc() all behave the same). I think the right solution is to avoid the multiple copies of malloc()/free(). I think this patch should be used instead: Subject: [PATCH] x86/boot/compressed: Avoid duplicate malloc() implementations The preboot malloc() (and free()) implementation in include/linux/decompress/mm.h (which is also included by the static decompressors) is static. This is fine when the only thing interested in using malloc() is the decompression code, but the x86 preboot environment uses malloc() in a couple places, leading to a potential collision when the static copies of the available memory region ("malloc_ptr") gets reset to the global "free_mem_ptr" value. As it happens, the existing usage pattern happened to be safe because each user did 1 malloc() and 1 free() before returning and were not nested: extract_kernel() (misc.c) choose_random_location() (kaslr.c) mem_avoid_init() handle_mem_options() malloc() ... free() ... parse_elf() (misc.c) malloc() ... free() Adding FGKASLR, however, will insert additional malloc() calls local to fgkaslr.c in the middle of parse_elf()'s malloc()/free() pair: parse_elf() (misc.c) malloc() if (...) { layout_randomized_image(output, &ehdr, phdrs); malloc() <- boom ... else layout_image(output, &ehdr, phdrs); free() To avoid collisions, there must be a single implementation of malloc(). Adjust include/linux/decompress/mm.h so that visibility can be controlled, provide prototypes in misc.h, and implement the functions in misc.c. This also results in a small size savings: $ size vmlinux.before vmlinux.after textdata bss dec hex filename 8842314 468 178320 9021102 89a6ae vmlinux.before 8842240 468 178320 9021028 89a664 vmlinux.after Signed-off-by: Kees Cook --- arch/x86/boot/compressed/kaslr.c |4 arch/x86/boot/compressed/misc.c |3 +++ arch/x86/boot/compressed/misc.h |2 ++ include/linux/decompress/mm.h| 12 ++-- 4 files changed, 15 insertions(+), 6 deletions(-) diff --git a/arch/x86/boot/compressed/misc.c b/arch/x86/boot/compressed/misc.c index 7667415417dc..ae6691e8bb08 100644 --- a/arch/x86/boot/compressed/misc.c +++ b/arch/x86/boot/compressed/misc.c @@ -44,12 +44,12 @@ void *memmove(void *dest, const void *src, size_t n); */ struct boot_params *boot_params; +/* Initial heap area used to initialize malloc()/free() internals.*/ memptr free_mem_ptr; memptr free_mem_end_ptr; -#ifdef CONFIG_FG_KASLR +/* Global internals for malloc()/free() implementations. */ unsigned long malloc_ptr; int malloc_count; -#endif static char *vidmem; static int vidport; diff --git a/arch/x86/boot/compressed/misc.h b/arch/x86/boot/compressed/misc.h index 86a5f00b018f..45644056572b 100644 --- a/arch/x86/boot/compressed/misc.h +++ b/arch/x86/boot/compressed/misc.h @@ -36,15 +36,14 @@ #define memptr unsigned #endif -/* misc.c */ -extern memptr free_mem_ptr; -extern memptr free_mem_end_ptr; -#define STATIC -#ifdef CONFIG_FG_KASLR +/* malloc()/free() */ +#define STATIC static #define STATIC_RW_DATA extern -#endif #include +/* misc.c */ +extern memptr free_mem_ptr; +extern memptr free_mem_end_ptr; extern struct boot_params *boot_params; void __putstr(const char *s); void __puthex(unsigned long value); However, after all that, I actually think the correct way to solve this is actually to have only one implementation of malloc()/free(). i.e. replace this patch with this: diff --git a/arch/x86/boot/compressed/kaslr.c b/arch/x86/boot/compressed/kaslr.c index d7408af55738..6f596bd5b6e5 100644 --- a/arch/x86/boot/compressed/kaslr.c +++ b/arch/x86/boot/compressed/kaslr.c @@ -39,10 +39,6 @@ #include #include -/* Macros used by the included decompressor code below. */ -#define STATIC -#include - #ifdef CONFIG_X86_5LEVEL unsigned int __pgtable_l5_enabled; unsigned int pgdir_shift __ro_after_init = 39; diff --git a/arch/x86/boot/compressed/misc.c b/arch/x86/boot/compressed/misc.c index 1c8b8aa5539f..f52150ec3ee7 100644 --- a/arch/x86/boot/compressed/misc.c +++ b/arch/x86/boot/compressed/misc.c @
Re: [PATCHv3] coresight: tmc: Add shutdown callback for TMC ETR
On 2020-06-23 22:55, Mathieu Poirier wrote: On Tue, Jun 16, 2020 at 10:26:23AM +0530, Sai Prakash Ranjan wrote: Implement a shutdown callback to ensure ETR hardware is properly shutdown in reboot/shutdown path. This is required for ETR which has SMMU address translation enabled like on SC7180 SoC and few others. If the hardware is still accessing memory after SMMU translation is disabled as part of SMMU shutdown callback in system reboot or shutdown path, then IOVAs(I/O virtual address) which it was using will go on the bus as the physical addresses which might result in unknown crashes (NoC/interconnect errors). So we make sure from this shutdown callback that the ETR is shutdown before SMMU translation is disabled and device_link in SMMU driver will take care of ordering of shutdown callbacks such that SMMU shutdown callback is not called before any of its consumer shutdown callbacks. Signed-off-by: Sai Prakash Ranjan --- I have applied your patch. Thanks Mathieu. -- QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
linux-next: Tree for Jun 24
Hi all, Changes since 20200623: Renamed trees: slave-dma{,-fixes} -> dmaengine{,-fixes} My fixes tree contains: 466d58f824f1 ("device_cgroup: Fix RCU list debugging warning") 9bd7b7c45d71 ("sched: Fix RANDSTRUCT build fail") 2f437faecf71 ("powerpc/boot/dts: Fix dtc "pciex" warnings") The printk tree lost its build failure. The hid tree still had its build failure so I used the version from next-20200618. The amdgpu tree lost its build failure. The tip tree still had one build failure for which I reverted a commit. The rcu tree gained a conflict against the tip tree. Non-merge commits (relative to Linus' tree): 3015 3371 files changed, 258238 insertions(+), 58359 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 321 trees (counting Linus' and 82 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 (3e08a95294a4 Merge tag 'for-5.8-rc2-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux) Merging fixes/master (2f437faecf71 powerpc/boot/dts: Fix dtc "pciex" warnings) Merging kbuild-current/fixes (48778464bb7d Linux 5.8-rc2) Merging arc-current/for-curr (10011f7d95de ARCv2: support loop buffer (LPB) disabling) Merging arm-current/fixes (3866f217aaa8 ARM: 8977/1: ptrace: Fix mask for thumb breakpoint hook) Merging arm-soc-fixes/arm/fixes (99706d62fb50 Merge tag 'omap-for-v5.7/cpsw-fixes-signed' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap into arm/fixes) Merging uniphier-fixes/fixes (0e698dfa2822 Linux 5.7-rc4) Merging arm64-fixes/for-next/fixes (4dc9b282bf5f arm64: Depend on newer binutils when building PAC) Merging m68k-current/for-linus (3381df095419 m68k: tools: Replace zero-length array with flexible-array member) Merging powerpc-fixes/fixes (c0e1c8c22beb powerpc/8xx: Provide ptep_get() with 16k pages) Merging s390-fixes/fixes (827c4913923e s390/debug: avoid kernel warning on too large number of pages) Merging sparc/master (5124b31c1e90 sparc: piggyback: handle invalid image) Merging fscrypt-current/for-stable (2b4eae95c736 fscrypt: don't evict dirty inodes after removing key) Merging net/master (a83024b95ab4 Merge branch 'cxgb4-cxgb4vf-fix-warnings-reported-by-sparse') Merging bpf/master (4e15507fea70 libbpf: Forward-declare bpf_stats_type for systems with outdated UAPI headers) Merging ipsec/master (be01369859b8 esp, ah: modernize the crypto algorithm selections) Merging netfilter/master (a41de0c215ff netfilter: ipset: fix unaligned atomic access) Merging ipvs/master (bdc48fa11e46 checkpatch/coding-style: deprecate 80-column warning) Merging wireless-drivers/master (dc7bd30b97aa mt76: mt7615: fix EEPROM buffer size) Merging mac80211/master (67c20de35a3c net: Add MODULE_DESCRIPTION entries to network modules) Merging rdma-fixes/for-rc (116a1b9f1cb7 IB/mad: Fix use after free when destroying MAD agent) Merging sound-current/for-linus (a32a1fc99807 ALSA: usb-audio: add quirk for Samsung USBC Headset (AKG)) Merging sound-asoc-fixes/for-linus (752b60f9262a Merge remote-tracking branch 'asoc/for-5.8' into asoc-linus) Merging regmap-fixes/for-linus (82228364de4a Merge remote-tracking branch 'regmap/
Re: [PATCH v2 1/2] nvme: Add Arbitration Burst support
On Wed, Jun 24, 2020 at 02:49:57PM +0800, Baolin Wang wrote: > >From the NVMe spec, "In order to make efficient use of the non-volatile > memory, it is often advantageous to execute multiple commands from a > Submission Queue in parallel. For Submission Queues that are using > weighted round robin with urgent priority class or round robin > arbitration, host software may configure an Arbitration Burst setting". > Thus add Arbitration Burst setting support. What is the value add of doing this in the kernel? Wouldn't a nvme-cli subcommand to just set the arbitration burst to the recommended value, either as a saved or current value be both more useful and also cause less kernel bloat?
[PATCH] bcache: journel: use for_each_clear_bit() to simplify the code
Using for_each_clear_bit() to simplify the code. Signed-off-by: Xu Wang --- drivers/md/bcache/journal.c | 5 + 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/md/bcache/journal.c b/drivers/md/bcache/journal.c index 90aac4e2333f..b01c953e214c 100644 --- a/drivers/md/bcache/journal.c +++ b/drivers/md/bcache/journal.c @@ -217,10 +217,7 @@ int bch_journal_read(struct cache_set *c, struct list_head *list) */ pr_debug("falling back to linear search\n"); - for (l = find_first_zero_bit(bitmap, ca->sb.njournal_buckets); -l < ca->sb.njournal_buckets; -l = find_next_zero_bit(bitmap, ca->sb.njournal_buckets, - l + 1)) + for_each_clear_bit(l, bitmap, ca->sb.njournal_buckets) if (read_bucket(l)) goto bsearch; -- 2.17.1
Re: [PATCH 0/3] x86/dumpstack: Print registers with the same log level as the backtrace
On Tue 2020-06-23 17:29:55, Dmitry Safonov wrote: > show_trace_log_lvl() provides x86 platform-specific way to unwind > backtrace with a given log level. Unfortunately, registers dump(s) are > not printed with the same log level - instead, KERN_DEFAULT is always > used. > > Arista's switches uses quite common setup with rsyslog, where only > urgent messages goes to console (console_log_level=KERN_ERR), everything > else goes into /var/log/ as the console baud-rate often is indecently > slow (9600 bps). > > Backtrace dumps without registers printed have proven to be as useful as > morning standups. Furthermore, in order to introduce KERN_UNSUPPRESSED > (which I believe is still the most elegant way to fix raciness of sysrq[1]) > the log level should be passed down the stack to register dumping > functions. Besides, I have a potential use-case for printing traces > with KERN_DEBUG level [2] (where registers dump shouldn't appear with > higher log level than the backtrace). > > Dmitry Safonov (3): > x86/dumpstack: Add log_lvl to show_iret_regs() > x86/dumpstack: Add log_lvl to __show_regs() > x86/dumpstack: Show registers dump with trace's log level The change makes sense. It is natural next step after adding log_lvl parameter for printing stack traces. For the entire patchset: Acked-by: Petr Mladek Are there any plans to add this also for other architectures, please? Best Regards, Petr
Re: [PATCH v3] usb: gadget: u_serial: improve performance for large data
Hi, Macpaul Lin writes: > Nowadays some embedded systems use VCOM to transfer large log and data. > Take LTE MODEM as an example, during the long debugging stage, large > log and data were transfer through VCOM when doing field try or in > operator's lab. Here we suggest slightly increase the transfer buffer > in u_serial.c for performance improving. > > Signed-off-by: Macpaul Lin > --- > Changes for v2: > - Drop previous patch for adding flag which indicates hardware capability in > gadget.h and in DMA engine according to Alan's suggestion. Thanks. > - Replace requested buffer size "REQ_BUF_SIZE" instead of checking hardware > capability. > - Refine commit messages. > Changes for v3: > - Code: no change. > Commit: Add missing change log in v2. > > drivers/usb/gadget/function/u_serial.c |5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/drivers/usb/gadget/function/u_serial.c > b/drivers/usb/gadget/function/u_serial.c > index 3cfc6e2..d7912a9 100644 > --- a/drivers/usb/gadget/function/u_serial.c > +++ b/drivers/usb/gadget/function/u_serial.c > @@ -80,6 +80,7 @@ > #define QUEUE_SIZE 16 > #define WRITE_BUF_SIZE 8192/* TX only */ > #define GS_CONSOLE_BUF_SIZE 8192 > +#define REQ_BUF_SIZE 4096 > > /* console info */ > struct gs_console { > @@ -247,7 +248,7 @@ static int gs_start_tx(struct gs_port *port) > break; > > req = list_entry(pool->next, struct usb_request, list); > - len = gs_send_packet(port, req->buf, in->maxpacket); > + len = gs_send_packet(port, req->buf, REQ_BUF_SIZE); > if (len == 0) { > wake_up_interruptible(&port->drain_wait); > break; > @@ -514,7 +515,7 @@ static int gs_alloc_requests(struct usb_ep *ep, struct > list_head *head, >* be as speedy as we might otherwise be. >*/ > for (i = 0; i < n; i++) { > - req = gs_alloc_req(ep, ep->maxpacket, GFP_ATOMIC); > + req = gs_alloc_req(ep, REQ_BUF_SIZE, GFP_ATOMIC); since this can only be applied for the next merge window, it would be much better if you work rework how requests are used here and, as I mentioned in the other subthread, preallocate a list of requests that get recycled. This would allow us to allocate memory without GFP_ATOMIC. -- balbi signature.asc Description: PGP signature
[PATCH v2 2/2] nvme: Use USEC_PER_SEC instead of magic numbers
Use USEC_PER_SEC instead of magic numbers to make code more readable. Reviewed-by: Sagi Grimberg Signed-off-by: Baolin Wang --- drivers/nvme/host/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index f5f882f..405bafa 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -2967,7 +2967,7 @@ int nvme_init_identify(struct nvme_ctrl *ctrl) if (id->rtd3e) { /* us -> s */ - u32 transition_time = le32_to_cpu(id->rtd3e) / 100; + u32 transition_time = le32_to_cpu(id->rtd3e) / USEC_PER_SEC; ctrl->shutdown_timeout = clamp_t(unsigned int, transition_time, shutdown_timeout, 60); -- 1.8.3.1
Re: Strange problem with SCTP+IPv6
On Wed, Jun 24, 2020 at 12:00 AM Corey Minyard wrote: > > On Tue, Jun 23, 2020 at 11:40:21PM +0800, Xin Long wrote: > > On Tue, Jun 23, 2020 at 9:29 PM Corey Minyard wrote: > > > > > > On Tue, Jun 23, 2020 at 06:13:30PM +0800, Xin Long wrote: > > > > On Tue, Jun 23, 2020 at 2:34 AM Michael Tuexen > > > > wrote: > > > > > > > > > > > On 22. Jun 2020, at 20:32, Marcelo Ricardo Leitner > > > > > > wrote: > > > > > > > > > > > > On Mon, Jun 22, 2020 at 08:01:24PM +0200, Michael Tuexen wrote: > > > > > >>> On 22. Jun 2020, at 18:57, Corey Minyard wrote: > > > > > >>> > > > > > >>> On Mon, Jun 22, 2020 at 08:01:23PM +0800, Xin Long wrote: > > > > > On Sun, Jun 21, 2020 at 11:56 PM Corey Minyard > > > > > wrote: > > > > > > > > > > > > I've stumbled upon a strange problem with SCTP and IPv6. If I > > > > > > create an > > > > > > sctp listening socket on :: and set the IPV6_V6ONLY socket > > > > > > option on it, > > > > > > then I make a connection to it using ::1, the connection will > > > > > > drop after > > > > > > 2.5 seconds with an ECONNRESET error. > > > > > > > > > > > > It only happens on SCTP, it doesn't have the issue if you > > > > > > connect to a > > > > > > full IPv6 address instead of ::1, and it doesn't happen if you > > > > > > don't > > > > > > set IPV6_V6ONLY. I have verified current end of tree > > > > > > kernel.org. > > > > > > I tried on an ARM system and x86_64. > > > > > > > > > > > > I haven't dug into the kernel to see if I could find anything > > > > > > yet, but I > > > > > > thought I would go ahead and report it. I am attaching a > > > > > > reproducer. > > > > > > Basically, compile the following code: > > > > > The code only set IPV6_V6ONLY on server side, so the client side > > > > > will > > > > > still bind all the local ipv4 addresses (as you didn't call > > > > > bind() to > > > > > bind any specific addresses ). Then after the connection is > > > > > created, > > > > > the client will send HB on the v4 paths to the server. The server > > > > > will abort the connection, as it can't support v4. > > > > > > > > > > So you can work around it by either: > > > > > > > > > > - set IPV6_V6ONLY on client side. > > > > > > > > > > or > > > > > > > > > > - bind to the specific v6 addresses on the client side. > > > > > > > > > > I don't see RFC said something about this. > > > > > So it may not be a good idea to change the current behaviour > > > > > to not establish the connection in this case, which may cause > > > > > regression. > > > > > >>> > > > > > >>> Ok, I understand this. It's a little strange, but I see why it > > > > > >>> works > > > > > >>> this way. > > > > > >> I don't. I would expect it to work as I described in my email. > > > > > >> Could someone explain me how and why it is behaving different from > > > > > >> my expectation? > > > > > > > > > > > > It looks like a bug to me. Testing with this test app here, I can > > > > > > see > > > > > > the INIT_ACK being sent with a bunch of ipv4 addresses in it and > > > > > > that's unexpected for a v6only socket. As is, it's the server saying > > > > > > "I'm available at these other addresses too, but not." > > > > > I agree. > > > > Then we need a fix in sctp_bind_addrs_to_raw(): > > > > > > > > @@ -238,6 +240,9 @@ union sctp_params sctp_bind_addrs_to_raw(const > > > > struct sctp_bind_addr *bp, > > > > addrparms = retval; > > > > > > > > list_for_each_entry(addr, &bp->address_list, list) { > > > > + if ((PF_INET6 == sk->sk_family) && inet_v6_ipv6only(sk) > > > > && > > > > + (AF_INET == addr->a.sa.sa_family)) > > > > + continue; > > > > > > This does not compile in the latest mainline. sk is not defined. > > > Also, if you could send a normal git patch, that would be easier to > > > manage. > > sorry, that was just the code to show the idea. > > > > For the compilable one, pls see: > > https://paste.centos.org/view/49f5ff5a > > The kernel community runs on patches. It's hard to talk about changes > if you put things in pastbin type of stuff. Please send full complete > patches in emails. I will do that in a moment. I thought you wanted a temporary patch to run your test. The final patch still needs some change, like drop the *bp param even from sctp_make_init(). > > Anyway, are use sure every bp passed into sctp_bind_addrs_to_raw() > is &asoc->base.bind_addr? It's passed in to sctp_make_init() and the > passed to sctp_bind_addrs_to_raw(). If this is the case, you can remove > it from the parameters of sctp_make_init(). But I suspect it's passed > in for a reason. This is not difficult to track. path 1: sctp_sf_do_5_2_6_stale()/sctp_sf_do_prm_asoc()/ sctp_sf_t1_init_timer_expire() -> sctp_make_init() -> sctp_bin
[PATCH v2 0/2] Some improvements for NVMe
Hi, The fisrt patch adds Arbitration Burst support, and another one is a small improvement. Please help to review. Thanks. Changes from v1: - Add new parameter to decide if use the controller's recommended arbitration burst. - Add arbitration burst mask in case overflow. - Do not export the nvme_set_arbitration_burst(). - Add reviewed tag from Sagi. - Drop patch 2 in v1 patch set. Baolin Wang (2): nvme: Add Arbitration Burst support nvme: Use USEC_PER_SEC instead of magic numbers drivers/nvme/host/core.c | 31 ++- drivers/nvme/host/nvme.h | 1 + include/linux/nvme.h | 1 + 3 files changed, 32 insertions(+), 1 deletion(-) -- 1.8.3.1
[PATCH v2 1/2] nvme: Add Arbitration Burst support
>From the NVMe spec, "In order to make efficient use of the non-volatile memory, it is often advantageous to execute multiple commands from a Submission Queue in parallel. For Submission Queues that are using weighted round robin with urgent priority class or round robin arbitration, host software may configure an Arbitration Burst setting". Thus add Arbitration Burst setting support. Signed-off-by: Baolin Wang --- drivers/nvme/host/core.c | 29 + drivers/nvme/host/nvme.h | 1 + include/linux/nvme.h | 1 + 3 files changed, 31 insertions(+) diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index c2c5bc4..f5f882f 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -61,6 +61,10 @@ module_param(streams, bool, 0644); MODULE_PARM_DESC(streams, "turn on support for Streams write directives"); +static bool use_rab; +module_param(use_rab, bool, 0644); +MODULE_PARM_DESC(use_rab, "use controller's recommended arbitration burst"); + /* * nvme_wq - hosts nvme related works that are not reset or delete * nvme_reset_wq - hosts nvme reset works @@ -1241,6 +1245,28 @@ int nvme_set_queue_count(struct nvme_ctrl *ctrl, int *count) } EXPORT_SYMBOL_GPL(nvme_set_queue_count); +static void nvme_set_arbitration_burst(struct nvme_ctrl *ctrl) +{ + u32 result; + int status; + + if (!use_rab || !ctrl->rab) + return; + + /* +* The Arbitration Burst setting indicates the maximum number of +* commands that the controller may launch at one time from a +* particular Submission Queue. It is recommended that host software +* configure the Arbitration Burst setting as close to the recommended +* value by the controller as possible. +*/ + status = nvme_set_features(ctrl, NVME_FEAT_ARBITRATION, + ctrl->rab & NVME_FEAT_ARBITRATION_MASK, + NULL, 0, &result); + if (status) + dev_warn(ctrl->device, "Failed to set Arbitration Burst\n"); +} + #define NVME_AEN_SUPPORTED \ (NVME_AEN_CFG_NS_ATTR | NVME_AEN_CFG_FW_ACT | \ NVME_AEN_CFG_ANA_CHANGE | NVME_AEN_CFG_DISC_CHANGE) @@ -2953,6 +2979,9 @@ int nvme_init_identify(struct nvme_ctrl *ctrl) } else ctrl->shutdown_timeout = shutdown_timeout; + ctrl->rab = id->rab; + nvme_set_arbitration_burst(ctrl); + ctrl->npss = id->npss; ctrl->apsta = id->apsta; prev_apst_enabled = ctrl->apst_enabled; diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h index c0f4226..bc424c5 100644 --- a/drivers/nvme/host/nvme.h +++ b/drivers/nvme/host/nvme.h @@ -246,6 +246,7 @@ struct nvme_ctrl { u16 kas; u8 npss; u8 apsta; + u8 rab; u16 wctemp; u16 cctemp; u32 oaes; diff --git a/include/linux/nvme.h b/include/linux/nvme.h index 5ce51ab..fa629c8 100644 --- a/include/linux/nvme.h +++ b/include/linux/nvme.h @@ -909,6 +909,7 @@ enum { NVME_SQ_PRIO_MEDIUM = (2 << 1), NVME_SQ_PRIO_LOW= (3 << 1), NVME_FEAT_ARBITRATION = 0x01, + NVME_FEAT_ARBITRATION_MASK = 0x7, NVME_FEAT_POWER_MGMT= 0x02, NVME_FEAT_LBA_RANGE = 0x03, NVME_FEAT_TEMP_THRESH = 0x04, -- 1.8.3.1
Re: [PATCH 2/2] usb: gadget: u_serial: improve performance for large data
Hi, Macpaul Lin writes: > If the hardware (like DMA engine) could support large usb request exceeds > maximum packet size, use larger buffer when performing Rx/Tx could reduce > request numbers and improve performance. > > Signed-off-by: Macpaul Lin > --- > drivers/usb/gadget/function/u_serial.c |9 +++-- > 1 file changed, 7 insertions(+), 2 deletions(-) > > diff --git a/drivers/usb/gadget/function/u_serial.c > b/drivers/usb/gadget/function/u_serial.c > index 3cfc6e2..cdcc070 100644 > --- a/drivers/usb/gadget/function/u_serial.c > +++ b/drivers/usb/gadget/function/u_serial.c > @@ -80,6 +80,8 @@ > #define QUEUE_SIZE 16 > #define WRITE_BUF_SIZE 8192/* TX only */ > #define GS_CONSOLE_BUF_SIZE 8192 > +/* for hardware can do more than max packet */ > +#define REQ_BUF_SIZE 4096 > > /* console info */ > struct gs_console { > @@ -247,7 +249,8 @@ static int gs_start_tx(struct gs_port *port) > break; > > req = list_entry(pool->next, struct usb_request, list); > - len = gs_send_packet(port, req->buf, in->maxpacket); > + len = gs_send_packet(port, req->buf, in->can_exceed_maxp ? > + REQ_BUF_SIZE : in->maxpacket); just do this unconditionally. > if (len == 0) { > wake_up_interruptible(&port->drain_wait); > break; > @@ -514,7 +517,9 @@ static int gs_alloc_requests(struct usb_ep *ep, struct > list_head *head, >* be as speedy as we might otherwise be. >*/ > for (i = 0; i < n; i++) { > - req = gs_alloc_req(ep, ep->maxpacket, GFP_ATOMIC); > + req = gs_alloc_req(ep, ep->can_exceed_maxp ? > + REQ_BUF_SIZE : ep->maxpacket, > + GFP_ATOMIC); allocating 4kiB in atomic isn't very good. A better idea would be to preallocate a list of requests and recycle them, rather than allocating every time you need to do a transfer -- balbi signature.asc Description: PGP signature
Re: [PATCH 1/2] usb: gadget: introduce flag for large request
Hi, Macpaul Lin writes: > Some USB hardware like DMA engine can help to process (split) the data > of each URB request into small packets. For example, the max packet size > of high speed is 512 bytes. These kinds of hardware can help to split > the continue Tx/Rx data requests into packets just at the max packet > size during transmission. Hence upper layer software can reduce some > effort for queueing many requests back and forth for larger data. > > Here we introduce "can_exceed_maxp" flag in gadget when these kinds of > hardware is ready to support these operations. > > Signed-off-by: Macpaul Lin > --- > drivers/usb/mtu3/mtu3_qmu.c | 11 ++- > include/linux/usb/gadget.h |1 + > 2 files changed, 11 insertions(+), 1 deletion(-) > > diff --git a/drivers/usb/mtu3/mtu3_qmu.c b/drivers/usb/mtu3/mtu3_qmu.c > index 3f414f9..2b51a20 100644 > --- a/drivers/usb/mtu3/mtu3_qmu.c > +++ b/drivers/usb/mtu3/mtu3_qmu.c > @@ -620,7 +620,7 @@ irqreturn_t mtu3_qmu_isr(struct mtu3 *mtu) > > int mtu3_qmu_init(struct mtu3 *mtu) > { > - > + int i; > compiletime_assert(QMU_GPD_SIZE == 16, "QMU_GPD size SHOULD be 16B"); > > mtu->qmu_gpd_pool = dma_pool_create("QMU_GPD", mtu->dev, > @@ -629,10 +629,19 @@ int mtu3_qmu_init(struct mtu3 *mtu) > if (!mtu->qmu_gpd_pool) > return -ENOMEM; > > + /* Let gadget know we can process request larger than max packet */ > + for (i = 1; i < mtu->num_eps; i++) > + mtu->ep_array[i].ep.can_exceed_maxp = 1; > + > return 0; > } > > void mtu3_qmu_exit(struct mtu3 *mtu) > { > + int i; > dma_pool_destroy(mtu->qmu_gpd_pool); > + > + /* Disable large request support */ > + for (i = 1; i < mtu->num_eps; i++) > + mtu->ep_array[i].ep.can_exceed_maxp = 0; > } > diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h > index 6a17817..60e0645 100644 > --- a/include/linux/usb/gadget.h > +++ b/include/linux/usb/gadget.h > @@ -236,6 +236,7 @@ struct usb_ep { > unsignedmax_streams:16; > unsignedmult:2; > unsignedmaxburst:5; > + unsignedcan_exceed_maxp:1; every driver does this without this flag. This is unnecessary. -- balbi signature.asc Description: PGP signature
Re: [PATCH] venus: core: add shutdown callback for venus
Hi Mansur, On 2020-06-13 16:03, Mansur Alisha Shaik wrote: After the SMMU translation is disabled in the arm-smmu shutdown callback during reboot, if any subsystem are still alive then IOVAs they are using will become PAs on bus, which may lead to crash. Below are the consumers of smmu from venus arm-smmu: consumer: aa0.video-codec supplier=1500.iommu arm-smmu: consumer: video-firmware.0 supplier=1500.iommu So implemented shutdown callback, which detach iommu maps. Change-Id: I0f0f331056e0b84b92f1d86f66618d4b1caaa24a Signed-off-by: Mansur Alisha Shaik --- drivers/media/platform/qcom/venus/core.c | 9 + 1 file changed, 9 insertions(+) diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c index 30d4b9e..acf798c 100644 --- a/drivers/media/platform/qcom/venus/core.c +++ b/drivers/media/platform/qcom/venus/core.c @@ -371,6 +371,14 @@ static int venus_remove(struct platform_device *pdev) return ret; } +static void venus_core_shutdown(struct platform_device *pdev) +{ + int ret; + + ret = venus_remove(pdev); + WARN_ON(ret < 0); I don't think you should warn here, its shutdown path and you can't do anything with this WARN unlike remove callback where you have to be sure to cleanup properly so that you are able to reload module. But if you still want a hint about this failure, then just add a dev_err() to indicate the failure instead of a big stack trace spamming kernel log. Thanks, Sai -- QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
Re: [dm-devel] [dm-crypt] [RFC PATCH 1/1] Add DM_CRYPT_FORCE_INLINE flag to dm-crypt target
On 2020/06/24 14:27, Eric Biggers wrote: > On Wed, Jun 24, 2020 at 05:21:24AM +, Damien Le Moal wrote: @@ -1458,13 +1459,18 @@ static void crypt_alloc_req_skcipher(struct crypt_config *cc, skcipher_request_set_tfm(ctx->r.req, cc->cipher_tfm.tfms[key_index]); - /* - * Use REQ_MAY_BACKLOG so a cipher driver internally backlogs - * requests if driver request queue is full. - */ - skcipher_request_set_callback(ctx->r.req, - CRYPTO_TFM_REQ_MAY_BACKLOG, - kcryptd_async_done, dmreq_of_req(cc, ctx->r.req)); + if (test_bit(DM_CRYPT_FORCE_INLINE, &cc->flags)) + /* make sure we zero important fields of the request */ + skcipher_request_set_callback(ctx->r.req, + 0, NULL, NULL); + else + /* + * Use REQ_MAY_BACKLOG so a cipher driver internally backlogs + * requests if driver request queue is full. + */ + skcipher_request_set_callback(ctx->r.req, + CRYPTO_TFM_REQ_MAY_BACKLOG, + kcryptd_async_done, dmreq_of_req(cc, ctx->r.req)); } >>> >>> This looks wrong. Unless type=0 and mask=CRYPTO_ALG_ASYNC are passed to >>> crypto_alloc_skcipher(), the skcipher implementation can still be >>> asynchronous, >>> in which case providing a callback is required. >>> >>> Do you intend that the "force_inline" option forces the use of a synchronous >>> skcipher (alongside the other things it does)? Or should it still allow >>> asynchronous ones? >>> >>> We may not actually have a choice in that matter, since xts-aes-aesni has >>> the >>> CRYPTO_ALG_ASYNC bit set (as I mentioned) despite being synchronous in most >>> cases; thus, the crypto API won't give you it if you ask for a synchronous >>> cipher. So I think you still need to allow async skciphers? That means a >>> callback is still always required. >> >> Arg... So it means that some skciphers will not be OK at all for SMR writes. >> I >> was not aware of these differences (tested with aes-xts-plain64 only). The >> ugly >> way to support async ciphers would be to just wait inline for the crypto API >> to >> complete using a completion for instance. But that is very ugly. Back to >> brainstorming, and need to learn more about the crypto API... >> > > It's easy to wait for crypto API requests to complete if you need to -- > just use crypto_wait_req(). OK. Thanks for the information. I will look into this and the performance implications. A quick grep shows that a lot of different accelerators for different architectures have CRYPTO_ALG_ASYNC set. So definitely something that needs to be checked for SMR, and for Ignat inline patch. > We do this in fs/crypto/, for example. (Not many people are using fscrypt > with > crypto API based accelerators, so there hasn't yet been much need to support > the > complexity of issuing multiple async crypto requests like dm-crypt supports.) Zonefs fscrypt support is on my to do list too :) Thanks ! > > - Eric > -- Damien Le Moal Western Digital Research
[PATCH v2 2/7 RESEND] irqchip/loongson-htpic: Remove unneeded select of I8259
LOONGSON_HTPIC depends on MACH_LOONGSON64 and MACH_LOONGSON64 already selects I8259 in arch/mips/Kconfig, so no need to select I8259 again when config LOONGSON_HTPIC. Signed-off-by: Tiezhu Yang --- drivers/irqchip/Kconfig | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/irqchip/Kconfig b/drivers/irqchip/Kconfig index 29fead2..9f57aed 100644 --- a/drivers/irqchip/Kconfig +++ b/drivers/irqchip/Kconfig @@ -541,7 +541,6 @@ config LOONGSON_HTPIC default y select IRQ_DOMAIN select GENERIC_IRQ_CHIP - select I8259 help Support for the Loongson-3 HyperTransport PIC Controller. -- 2.1.0
[PATCH v2 1/7 RESEND] irqchip/loongson-htpic: Remove redundant kfree operation
In the function htpic_of_init(), when kzalloc htpic fails, it should return -ENOMEM directly, no need to execute "goto" to kfree. Signed-off-by: Tiezhu Yang --- drivers/irqchip/irq-loongson-htpic.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/irqchip/irq-loongson-htpic.c b/drivers/irqchip/irq-loongson-htpic.c index dd018c2..63f7280 100644 --- a/drivers/irqchip/irq-loongson-htpic.c +++ b/drivers/irqchip/irq-loongson-htpic.c @@ -93,10 +93,8 @@ int __init htpic_of_init(struct device_node *node, struct device_node *parent) } htpic = kzalloc(sizeof(*htpic), GFP_KERNEL); - if (!htpic) { - err = -ENOMEM; - goto out_free; - } + if (!htpic) + return -ENOMEM; htpic->base = of_iomap(node, 0); if (!htpic->base) { -- 2.1.0
[PATCH] [v5] dmaengine: tegra210-adma: Fix runtime PM imbalance on error
pm_runtime_get_sync() increments the runtime PM usage counter even when it returns an error code. Thus a pairing decrement is needed on the error handling path to keep the counter balanced. Signed-off-by: Dinghao Liu --- Changelog: v2: - Merge two patches that fix runtime PM imbalance in tegra_adma_probe() and tegra_adma_alloc_chan_resources() respectively. v3: - Use pm_runtime_put_noidle() instead of pm_runtime_put_sync() in tegra_adma_alloc_chan_resources(). _noidle() is the simplest one and it is sufficient for fixing this bug. v4: - Use pm_runtime_put_noidle() instead of pm_runtime_put_sync() in tegra_adma_probe(). _noidle() is the simplest one and it is sufficient for fixing this bug. v5: - Refine commit message. --- drivers/dma/tegra210-adma.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/dma/tegra210-adma.c b/drivers/dma/tegra210-adma.c index db58d7e4f9fe..c5fa2ef74abc 100644 --- a/drivers/dma/tegra210-adma.c +++ b/drivers/dma/tegra210-adma.c @@ -658,6 +658,7 @@ static int tegra_adma_alloc_chan_resources(struct dma_chan *dc) ret = pm_runtime_get_sync(tdc2dev(tdc)); if (ret < 0) { + pm_runtime_put_noidle(tdc2dev(tdc)); free_irq(tdc->irq, tdc); return ret; } @@ -869,8 +870,10 @@ static int tegra_adma_probe(struct platform_device *pdev) pm_runtime_enable(&pdev->dev); ret = pm_runtime_get_sync(&pdev->dev); - if (ret < 0) + if (ret < 0) { + pm_runtime_put_noidle(&pdev->dev); goto rpm_disable; + } ret = tegra_adma_init(tdma); if (ret) -- 2.17.1
[PATCH v2 3/7 RESEND] irqchip/loongson-htvec: Fix potential resource leak
There exists potential resource leak in the error path, fix it. Fixes: 818e915fbac5 ("irqchip: Add Loongson HyperTransport Vector support") Signed-off-by: Tiezhu Yang --- drivers/irqchip/irq-loongson-htvec.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/irqchip/irq-loongson-htvec.c b/drivers/irqchip/irq-loongson-htvec.c index 1ece933..b36d403 100644 --- a/drivers/irqchip/irq-loongson-htvec.c +++ b/drivers/irqchip/irq-loongson-htvec.c @@ -192,7 +192,7 @@ static int htvec_of_init(struct device_node *node, if (!priv->htvec_domain) { pr_err("Failed to create IRQ domain\n"); err = -ENOMEM; - goto iounmap_base; + goto irq_dispose; } htvec_reset(priv); @@ -203,6 +203,9 @@ static int htvec_of_init(struct device_node *node, return 0; +irq_dispose: + for (; i > 0; i--) + irq_dispose_mapping(parent_irq[i - 1]); iounmap_base: iounmap(priv->base); free_priv: -- 2.1.0
[PATCH v2 7/7 RESEND] dt-bindings: interrupt-controller: Fix typos in loongson,liointc.yaml
Fix the following two typos in loongson,liointc.yaml: fron -> from it's -> its Fixes: b6280c8bb6f5 ("dt-bindings: interrupt-controller: Add Loongson LIOINTC") Signed-off-by: Tiezhu Yang --- .../devicetree/bindings/interrupt-controller/loongson,liointc.yaml| 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Documentation/devicetree/bindings/interrupt-controller/loongson,liointc.yaml b/Documentation/devicetree/bindings/interrupt-controller/loongson,liointc.yaml index b1db21e..13908ca 100644 --- a/Documentation/devicetree/bindings/interrupt-controller/loongson,liointc.yaml +++ b/Documentation/devicetree/bindings/interrupt-controller/loongson,liointc.yaml @@ -51,8 +51,8 @@ properties: description: | This property points how the children interrupts will be mapped into CPU interrupt lines. Each cell refers to a parent interrupt line from 0 to 3 - and each bit in the cell refers to a children interrupt fron 0 to 31. - If a CPU interrupt line didn't connected with liointc, then keep it's + and each bit in the cell refers to a children interrupt from 0 to 31. + If a CPU interrupt line didn't connected with liointc, then keep its cell with zero. $ref: /schemas/types.yaml#/definitions/uint32-array minItems: 4 -- 2.1.0
[PATCH v2 5/7 RESEND] irqchip/loongson-pch-pic: Check return value of irq_domain_translate_twocell()
Check the return value of irq_domain_translate_twocell() due to it may returns -EINVAL if failed and use variable fwspec for it, and then use a new variable parent_fwspec which is proper for irq_domain_alloc_irqs_parent(). Fixes: ef8c01eb64ca ("irqchip: Add Loongson PCH PIC controller") Signed-off-by: Tiezhu Yang --- drivers/irqchip/irq-loongson-pch-pic.c | 15 +-- 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/drivers/irqchip/irq-loongson-pch-pic.c b/drivers/irqchip/irq-loongson-pch-pic.c index 2a05b93..016f32c 100644 --- a/drivers/irqchip/irq-loongson-pch-pic.c +++ b/drivers/irqchip/irq-loongson-pch-pic.c @@ -135,16 +135,19 @@ static int pch_pic_alloc(struct irq_domain *domain, unsigned int virq, int err; unsigned int type; unsigned long hwirq; - struct irq_fwspec fwspec; + struct irq_fwspec *fwspec = arg; + struct irq_fwspec parent_fwspec; struct pch_pic *priv = domain->host_data; - irq_domain_translate_twocell(domain, arg, &hwirq, &type); + err = irq_domain_translate_twocell(domain, fwspec, &hwirq, &type); + if (err) + return err; - fwspec.fwnode = domain->parent->fwnode; - fwspec.param_count = 1; - fwspec.param[0] = hwirq + priv->ht_vec_base; + parent_fwspec.fwnode = domain->parent->fwnode; + parent_fwspec.param_count = 1; + parent_fwspec.param[0] = hwirq + priv->ht_vec_base; - err = irq_domain_alloc_irqs_parent(domain, virq, 1, &fwspec); + err = irq_domain_alloc_irqs_parent(domain, virq, 1, &parent_fwspec); if (err) return err; -- 2.1.0
[PATCH v2 4/7 RESEND] irqchip/loongson-htvec: Check return value of irq_domain_translate_onecell()
Check the return value of irq_domain_translate_onecell() due to it may returns -EINVAL if failed. Fixes: 818e915fbac5 ("irqchip: Add Loongson HyperTransport Vector support") Signed-off-by: Tiezhu Yang --- drivers/irqchip/irq-loongson-htvec.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/irqchip/irq-loongson-htvec.c b/drivers/irqchip/irq-loongson-htvec.c index b36d403..720cf96 100644 --- a/drivers/irqchip/irq-loongson-htvec.c +++ b/drivers/irqchip/irq-loongson-htvec.c @@ -109,11 +109,14 @@ static struct irq_chip htvec_irq_chip = { static int htvec_domain_alloc(struct irq_domain *domain, unsigned int virq, unsigned int nr_irqs, void *arg) { + int ret; unsigned long hwirq; unsigned int type, i; struct htvec *priv = domain->host_data; - irq_domain_translate_onecell(domain, arg, &hwirq, &type); + ret = irq_domain_translate_onecell(domain, arg, &hwirq, &type); + if (ret) + return ret; for (i = 0; i < nr_irqs; i++) { irq_domain_set_info(domain, virq + i, hwirq + i, &htvec_irq_chip, -- 2.1.0
Re: [PATCH] usb: phy: tegra: Remove unnecessary spaces and tables
Hi, Tang Bin writes: > The macros in phy-tegra-usb.c have inconsistent sapces between > the macro name and the value. Thus sets all the macros to have > a signal space between the name and value. > > Signed-off-by: Tang Bin > --- > drivers/usb/phy/phy-tegra-usb.c | 214 > 1 file changed, 107 insertions(+), 107 deletions(-) > > diff --git a/drivers/usb/phy/phy-tegra-usb.c b/drivers/usb/phy/phy-tegra-usb.c > index 6153cc35a..c294dc617 100644 > --- a/drivers/usb/phy/phy-tegra-usb.c > +++ b/drivers/usb/phy/phy-tegra-usb.c > @@ -30,124 +30,124 @@ > #include > #include > > -#define ULPI_VIEWPORT0x170 > +#define ULPI_VIEWPORT0x170 > > /* PORTSC PTS/PHCD bits, Tegra20 only */ > -#define TEGRA_USB_PORTSC10x184 > -#define TEGRA_USB_PORTSC1_PTS(x) (((x) & 0x3) << 30) > -#define TEGRA_USB_PORTSC1_PHCD BIT(23) > +#define TEGRA_USB_PORTSC10x184 > +#define TEGRA_USB_PORTSC1_PTS(x) (((x) & 0x3) << 30) > +#define TEGRA_USB_PORTSC1_PHCD BIT(23) the idea was the line up the definitions. I'm not taking this, sorry. -- balbi signature.asc Description: PGP signature
tools/bpf: build failed with defconfig(x86_64) on v5.6 and v5.7
- information of machine Linux localhost.localdomain 4.18.0-193.6.3.el8_2.x86_64 #1 SMP Wed Jun 10 11:09:32 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux - configurations make defconfig make kvmconfig - failed logs on v5.6 ``` LINK /mnt/build/1_build/05_build_v5.6/bpf/bpftool//libbpf/libbpf.a LINK /mnt/build/1_build/05_build_v5.6/bpf/bpftool/bpftool DESCEND runqslower GEN /mnt/build/0_code/0_linux/linux/tools/bpf/runqslower/.output/bpf_helper_defs.h make[4]: *** No rule to make target '/mnt/build/0_code/0_linux/linux/tools/include/linux/build_bug.h', needed by '/mnt/build/0_code/0_linux/linux/tools/bpf/runqslower/.output/staticobjs/libbpf.o'. Stop. make[3]: *** [Makefile:183: /mnt/build/0_code/0_linux/linux/tools/bpf/runqslower/.output/staticobjs/libbpf-in.o] Error 2 make[2]: *** [Makefile:79: .output/libbpf.a] Error 2 make[1]: *** [Makefile:119: runqslower] Error 2 make: *** [Makefile:68: bpf] Error 2 ``` - failed logs on v5.7 ``` In file included from /mnt/build/0_code/0_linux/linux/tools/include/linux/build_bug.h:5, from /mnt/build/0_code/0_linux/linux/tools/include/linux/kernel.h:8, from /mnt/build/0_code/0_linux/linux/kernel/bpf/disasm.h:10, from /mnt/build/0_code/0_linux/linux/kernel/bpf/disasm.c:8: /mnt/build/0_code/0_linux/linux/kernel/bpf/disasm.c: In function ‘__func_get_name’: /mnt/build/0_code/0_linux/linux/tools/include/linux/compiler.h:37:38: warning: nested extern declaration of ‘__compiletime_assert_0’ [-Wnested-externs] _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) ^ /mnt/build/0_code/0_linux/linux/tools/include/linux/compiler.h:16:15: note: in definition of macro ‘__compiletime_assert’ extern void prefix ## suffix(void) __compiletime_error(msg); \ ^~ /mnt/build/0_code/0_linux/linux/tools/include/linux/compiler.h:37:2: note: in expansion of macro ‘_compiletime_assert’ _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) ^~~ /mnt/build/0_code/0_linux/linux/tools/include/linux/build_bug.h:39:37: note: in expansion of macro ‘compiletime_assert’ #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) ^~ /mnt/build/0_code/0_linux/linux/tools/include/linux/build_bug.h:50:2: note: in expansion of macro ‘BUILD_BUG_ON_MSG’ BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition) ^~~~ /mnt/build/0_code/0_linux/linux/kernel/bpf/disasm.c:20:2: note: in expansion of macro ‘BUILD_BUG_ON’ BUILD_BUG_ON(ARRAY_SIZE(func_id_str) != __BPF_FUNC_MAX_ID); ^~~~ ``` and ``` LINK /mnt/build/0_code/0_linux/linux/tools/bpf/runqslower/.output/libbpf.a GEN vmlinux.h BPF runqslower.bpf.o In file included from runqslower.bpf.c:3: .output/vmlinux.h:5:15: error: attribute 'preserve_access_index' is not supported by '#pragma clang attribute' #pragma clang attribute push (__attribute__((preserve_access_index)), apply_to = record) ^ .output/vmlinux.h:98607:15: error: '#pragma clang attribute pop' with no matching '#pragma clang attribute push' #pragma clang attribute pop ^ 2 errors generated. make[2]: *** [Makefile:57: .output/runqslower.bpf.o] Error 1 make[1]: *** [Makefile:119: runqslower] Error 2 make: *** [Makefile:68: bpf] Error 2 ``` On this same machine and with same configuration, I've tried v5.4 and v5.5, no failures.
[PATCH v2 6/7 RESEND] irqchip/loongson-pch-msi: Remove unneeded variable
irq_domain_alloc_irqs_parent() returns 0 on success and non-zero value on failure, it is redudant to check its non-zero return value and then return it, so just remove the variable "ret" and return directly in the function pch_msi_parent_domain_alloc(). Signed-off-by: Tiezhu Yang --- drivers/irqchip/irq-loongson-pch-msi.c | 7 +-- 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/drivers/irqchip/irq-loongson-pch-msi.c b/drivers/irqchip/irq-loongson-pch-msi.c index 50becd2..12aeeab 100644 --- a/drivers/irqchip/irq-loongson-pch-msi.c +++ b/drivers/irqchip/irq-loongson-pch-msi.c @@ -100,17 +100,12 @@ static int pch_msi_parent_domain_alloc(struct irq_domain *domain, unsigned int virq, int hwirq) { struct irq_fwspec fwspec; - int ret; fwspec.fwnode = domain->parent->fwnode; fwspec.param_count = 1; fwspec.param[0] = hwirq; - ret = irq_domain_alloc_irqs_parent(domain, virq, 1, &fwspec); - if (ret) - return ret; - - return 0; + return irq_domain_alloc_irqs_parent(domain, virq, 1, &fwspec); } static int pch_msi_middle_domain_alloc(struct irq_domain *domain, -- 2.1.0
[PATCH v2 0/7 RESEND] irqchip: Fix some issues and do some code cleanups about Loongson
[git send-email failed, so resend, sorry for that] Check the return value of irq_domain_translate_onecell() and irq_domain_translate_twocell(), do some code cleanups about Loongson to make it more clean and readable. v2: - In order to avoid git send-email failed, make the related patches about Loongson into a new patch series and add "Fixes" tag Tiezhu Yang (7): irqchip/loongson-htpic: Remove redundant kfree operation irqchip/loongson-htpic: Remove unneeded select of I8259 irqchip/loongson-htvec: Fix potential resource leak irqchip/loongson-htvec: Check return value of irq_domain_translate_onecell() irqchip/loongson-pch-pic: Check return value of irq_domain_translate_twocell() irqchip/loongson-pch-msi: Remove unneeded variable dt-bindings: interrupt-controller: Fix typos in loongson,liointc.yaml .../bindings/interrupt-controller/loongson,liointc.yaml | 4 ++-- drivers/irqchip/Kconfig | 1 - drivers/irqchip/irq-loongson-htpic.c | 6 ++ drivers/irqchip/irq-loongson-htvec.c | 10 -- drivers/irqchip/irq-loongson-pch-msi.c| 7 +-- drivers/irqchip/irq-loongson-pch-pic.c| 15 +-- 6 files changed, 22 insertions(+), 21 deletions(-) -- 2.1.0
Re: [PATCH v2 1/3] mfd: core: Make a best effort attempt to match devices with the correct of_nodes
On Tue, 23 Jun 2020, Frank Rowand wrote: > On 2020-06-11 14:10, Lee Jones wrote: > > Currently, when a child platform device (sometimes referred to as a > > sub-device) is registered via the Multi-Functional Device (MFD) API, > > the framework attempts to match the newly registered platform device > > with its associated Device Tree (OF) node. Until now, the device has > > been allocated the first node found with an identical OF compatible > > string. Unfortunately, if there are, say for example '3' devices > > which are to be handled by the same driver and therefore have the same > > compatible string, each of them will be allocated a pointer to the > > *first* node. > > > > An example Device Tree entry might look like this: > > > > mfd_of_test { > > compatible = "mfd,of-test-parent"; > > #address-cells = <0x02>; > > #size-cells = <0x02>; > > > > child@ { > > compatible = "mfd,of-test-child"; > > reg = <0x 0x 0 0x11>, > > <0x 0x 0 0x22>; > > }; > > > > child@ { > > compatible = "mfd,of-test-child"; > > reg = <0x 0x 0 0x33>; > > }; > > > > child@ { > > compatible = "mfd,of-test-child"; > > reg = <0x 0x 0 0x44>; > > }; > > }; > > > > When used with example sub-device registration like this: > > > > static const struct mfd_cell mfd_of_test_cell[] = { > > OF_MFD_CELL("mfd-of-test-child", NULL, NULL, 0, 0, > > "mfd,of-test-child"), > > OF_MFD_CELL("mfd-of-test-child", NULL, NULL, 0, 1, > > "mfd,of-test-child"), > > OF_MFD_CELL("mfd-of-test-child", NULL, NULL, 0, 2, > > "mfd,of-test-child") > > }; > > > > ... the current implementation will result in all devices being allocated > > the first OF node found containing a matching compatible string: > > > > [0.712511] mfd-of-test-child mfd-of-test-child.0: Probing platform > > device: 0 > > [0.712710] mfd-of-test-child mfd-of-test-child.0: Using OF node: > > child@ > > [0.713033] mfd-of-test-child mfd-of-test-child.1: Probing platform > > device: 1 > > [0.713381] mfd-of-test-child mfd-of-test-child.1: Using OF node: > > child@ > > [0.713691] mfd-of-test-child mfd-of-test-child.2: Probing platform > > device: 2 > > [0.713889] mfd-of-test-child mfd-of-test-child.2: Using OF node: > > child@ > > > > After this patch each device will be allocated a unique OF node: > > > > [0.712511] mfd-of-test-child mfd-of-test-child.0: Probing platform > > device: 0 > > [0.712710] mfd-of-test-child mfd-of-test-child.0: Using OF node: > > child@ > > [0.713033] mfd-of-test-child mfd-of-test-child.1: Probing platform > > device: 1 > > [0.713381] mfd-of-test-child mfd-of-test-child.1: Using OF node: > > child@ > > [0.713691] mfd-of-test-child mfd-of-test-child.2: Probing platform > > device: 2 > > [0.713889] mfd-of-test-child mfd-of-test-child.2: Using OF node: > > child@ > > > > Which is fine if all OF nodes are identical. However if we wish to > > apply an attribute to particular device, we really need to ensure the > > correct OF node will be associated with the device containing the > > correct address. We accomplish this by matching the device's address > > expressed in DT with one provided during sub-device registration. > > Like this: > > > > static const struct mfd_cell mfd_of_test_cell[] = { > > OF_MFD_CELL_REG("mfd-of-test-child", NULL, NULL, 0, 1, > > "mfd,of-test-child", 0x), > > OF_MFD_CELL_REG("mfd-of-test-child", NULL, NULL, 0, 2, > > "mfd,of-test-child", 0x), > > OF_MFD_CELL_REG("mfd-of-test-child", NULL, NULL, 0, 3, > > "mfd,of-test-child", 0x) > > }; > > > > This will ensure a specific device (designated here using the > > platform_ids; 1, 2 and 3) is matched with a particular OF node: > > > > [0.712511] mfd-of-test-child mfd-of-test-child.0: Probing platform > > device: 0 > > [0.712710] mfd-of-test-child mfd-of-test-child.0: Using OF node: > > child@ > > [0.713033] mfd-of-test-child mfd-of-test-child.1: Probing platform > > device: 1 > > [0.713381] mfd-of-test-child mfd-of-test-child.1: Using OF node: > > child@ > > [0.713691] mfd-of-test-child mfd-of-test-child.2: Probing platform > > device: 2 > > [0.713889] mfd-of-test-child mfd-of-test-child.2: Using OF node: > > child@ > > > > This implementation is still not infallible, hence the mention of > > "best effort" in the commit subject. Since we have not *insisted* on > > the existence of 'reg' properties (in some scenarios they just do not > > make sense) and no device currently uses th
Re: next-20200623: oops in btusb_disconnect() at boot on thinkpad x60
Hi Pavel, > I'm getting this at boot: > > [7.984584] *pdpt = 33a31001 *pde = > [7.984584] Oops: [#1] PREEMPT SMP PTI > [7.984584] CPU: 1 PID: 2532 Comm: systemd-udevd Not tainted > 5.8.0-rc2-next-20200623+ #126 > [7.998580] Hardware name: LENOVO 17097HU/17097HU, BIOS 7BETD8WW > (2.19 ) 03/31/2011 > [8.000592] EIP: __queue_work+0x139/0x320 > [8.000592] Code: 90 83 7d f0 08 0f 84 b6 00 00 00 8b 45 ec 8b 9f > 04 01 00 00 03 1c 85 40 63 1f c5 89 f0 e8 df f8 ff ff 85 c0 0f 85 4f > ff ff ff <8b> 03 e9 50 ff ff ff 89 45 e4 e8 48 0a cb 00 8b 4d e8 8b 45 > e4 8b > [8.007883] EAX: EBX: ECX: 47d88848 EDX: 03ff > [8.007883] ESI: f4a348bc EDI: f492a600 EBP: f3b1dd0c ESP: f3b1dcf0 > [8.019981] DS: 007b ES: 007b FS: 00d8 GS: 00e0 SS: 0068 EFLAGS: > 00010046 > [8.023156] CR0: 80050033 CR2: CR3: 33b1e000 CR4: 06b0 > [8.028892] Call Trace: > [8.034199] queue_work_on+0x1d/0x30 > [8.034199] hci_adv_monitors_clear+0x5c/0x80 > [8.042158] hci_unregister_dev+0x161/0x2f0 > [8.042158] ? usb_disable_endpoint+0x94/0xa0 > [8.042158] btusb_disconnect+0x4b/0x120 > [8.057018] usb_unbind_interface+0x64/0x230 > [8.057018] device_release_driver_internal+0xc1/0x180 > [8.065196] device_release_driver+0xc/0x10 > [8.068040] bus_remove_device+0xa8/0x110 > [8.071767] device_del+0x126/0x370 > [8.071767] ? usb_remove_ep_devs+0x15/0x20 > [8.079199] ? remove_intf_ep_devs+0x30/0x50 > [8.081371] usb_disable_device+0x8e/0x240 > [8.087478] usb_set_configuration+0x47c/0x800 > [8.087478] usb_deauthorize_device+0x36/0x50 > [8.092662] authorized_store+0x5d/0x70 > [8.096608] ? authorized_default_store+0x60/0x60 > [8.096608] dev_attr_store+0x13/0x20 > [8.096608] ? component_bind_all.cold+0x52/0x52 > [8.106151] sysfs_kf_write+0x2f/0x50 > [8.106151] ? sysfs_file_ops+0x50/0x50 > [8.106151] kernfs_fop_write+0x105/0x1a0 > [8.106151] ? kernfs_fop_open+0x3c0/0x3c0 > [8.106151] __vfs_write+0x2b/0x1e0 > [8.106151] ? lock_acquire+0x3f/0x70 > [8.106151] ? vfs_write+0x12a/0x180 > [8.106151] ? __sb_start_write+0xd6/0x180 > [8.106151] ? vfs_write+0x12a/0x180 > [8.106151] vfs_write+0xa1/0x180 > [8.106151] ksys_write+0x5c/0xd0 > [8.106151] __ia32_sys_write+0x10/0x20 > [8.106151] do_syscall_32_irqs_on+0x3a/0xf0 > [8.106151] do_int80_syscall_32+0x9/0x20 > [8.106151] entry_INT80_32+0x116/0x116 > [8.106151] EIP: 0xb7f45092 > [8.106151] Code: Bad RIP value. > [8.146079] EAX: ffda EBX: 0007 ECX: 004fb760 EDX: 0001 > [8.146079] ESI: 004fb760 EDI: 0001 EBP: 004c79f0 ESP: bfabc48c > [8.146079] DS: 007b ES: 007b FS: GS: 0033 SS: 007b EFLAGS: > 0246 > [8.150364] Modules linked in: > [8.150364] CR2: > [8.150364] ---[ end trace 468d097aaf220284 ]--- I assume this is caused by commit e5e1e7fd470ccf2eb38ab7fb5a3ab0fc4792fe53 and mainly because it triggers the background scan workqueue. I think we need to distinguish clearing the monitors when removing the controller compared to clearing the controllers from bluetoothd as a runtime operation. Regards Marcel
Re: [PATCH v2 04/12] arm64: dts: qcom: msm8994: Add support for SMD RPM
On Tue 23 Jun 16:34 PDT 2020, Konrad Dybcio wrote: > Thanks for your review. > > I will send the regulators/rpm patch very soon. > > Regarding the mbox, do you know whether it should include any clocks > on 8992/4? What comes to my head is a53/57pll, but that's not there yet.. > So perhaps I should just add it with .clk_name = NULL? > I don't remember how the clocks are controlled on this platform, so my suggestion is that you just skip that for now. Regards, Bjorn
Re: [PATCH v5 2/3] remoteproc: Add inline coredump functionality
Hi Rishabh, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on linux/master] [also build test WARNING on linus/master v5.8-rc2 next-20200623] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use as documented in https://git-scm.com/docs/git-format-patch] url: https://github.com/0day-ci/linux/commits/Rishabh-Bhatnagar/Extend-coredump-functionality/20200624-092759 base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 5e857ce6eae7ca21b2055cca4885545e29228fe2 config: arc-allyesconfig (attached as .config) compiler: arc-elf-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 # save the attached .config to linux build tree COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=arc If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot All warnings (new ones prefixed by >>): In file included from include/linux/device.h:15, from include/linux/devcoredump.h:8, from drivers/remoteproc/remoteproc_coredump.c:9: drivers/remoteproc/remoteproc_coredump.c: In function 'rproc_copy_segment': >> drivers/remoteproc/remoteproc_coredump.c:163:5: warning: format '%zu' >> expects argument of type 'size_t', but argument 3 has type 'dma_addr_t' {aka >> 'long long unsigned int'} [-Wformat=] 163 | "invalid copy request (%zu, %zu)\n", | ^~~ include/linux/dev_printk.h:19:22: note: in definition of macro 'dev_fmt' 19 | #define dev_fmt(fmt) fmt | ^~~ >> drivers/remoteproc/remoteproc_coredump.c:162:4: note: in expansion of macro >> 'dev_err' 162 |dev_err(&rproc->dev, |^~~ drivers/remoteproc/remoteproc_coredump.c:163:30: note: format string is defined here 163 | "invalid copy request (%zu, %zu)\n", |~~^ | | | unsigned int |%llu drivers/remoteproc/remoteproc_coredump.c: In function 'rproc_coredump_read': >> drivers/remoteproc/remoteproc_coredump.c:186:15: warning: comparison of >> unsigned expression < 0 is always false [-Wtype-limits] 186 | if (copy_sz < 0) | ^ vim +163 drivers/remoteproc/remoteproc_coredump.c > 9 #include 10 #include 11 #include 12 #include 13 #include "remoteproc_internal.h" 14 #include "remoteproc_elf_helpers.h" 15 16 struct rproc_coredump_state { 17 struct rproc *rproc; 18 void *header; 19 struct completion dump_done; 20 }; 21 22 /** 23 * rproc_coredump_cleanup() - clean up dump_segments list 24 * @rproc: the remote processor handle 25 */ 26 void rproc_coredump_cleanup(struct rproc *rproc) 27 { 28 struct rproc_dump_segment *entry, *tmp; 29 30 list_for_each_entry_safe(entry, tmp, &rproc->dump_segments, node) { 31 list_del(&entry->node); 32 kfree(entry); 33 } 34 } 35 36 /** 37 * rproc_coredump_add_segment() - add segment of device memory to coredump 38 * @rproc: handle of a remote processor 39 * @da: device address 40 * @size: size of segment 41 * 42 * Add device memory to the list of segments to be included in a coredump for 43 * the remoteproc. 44 * 45 * Return: 0 on success, negative errno on error. 46 */ 47 int rproc_coredump_add_segment(struct rproc *rproc, dma_addr_t da, size_t size) 48 { 49 struct rproc_dump_segment *segment; 50 51 segment = kzalloc(sizeof(*segment), GFP_KERNEL); 52 if (!segment) 53 return -ENOMEM; 54 55 segment->da = da; 56 segment->size = size; 57 58 list_add_tail(&segment->node, &rproc->dump_segments); 59 60 return 0; 61 } 62 EXPORT_SYMBOL(rproc_coredump_add_segment); 63 64 /** 65 * rproc_coredump_add_custom_segment() - add custom coredump segment 66 * @rproc: handle of a remote processor 67 * @da: device address 68 * @size: size of segment 69 * @dumpfn: custom dump function called for each segment during coredump 70 * @priv: private data 71 *
Re: [PATCH v2 1/3] mfd: core: Make a best effort attempt to match devices with the correct of_nodes
On Tue, 23 Jun 2020, Frank Rowand wrote: > On 2020-06-11 14:10, Lee Jones wrote: > > Currently, when a child platform device (sometimes referred to as a > > sub-device) is registered via the Multi-Functional Device (MFD) API, > > the framework attempts to match the newly registered platform device > > with its associated Device Tree (OF) node. Until now, the device has > > been allocated the first node found with an identical OF compatible > > string. Unfortunately, if there are, say for example '3' devices > > which are to be handled by the same driver and therefore have the same > > compatible string, each of them will be allocated a pointer to the > > *first* node. > > As you mentioned elsewhere in this thread, this series "fixes" the > problem related to the "stericsson,ab8500-pwm" compatible. > > I know, I said I would drop discussion of that compatible, but bear > with me for a second. :-) > > The "problem" is that the devices for multiple mfd child nodes with > the same compatible value of "stericsson,ab8500-pwm" will all have > a pointer to the first child node. At the moment the same child > of_node being used by more than one device does not cause any > incorrect behavior. > > Just in case the driver for "stericsson,ab8500-pwm" is modified > in a way that the child of_node needs to be distinct for each > device, and that changes gets back ported, it would be useful > to have Fixes: tags for this patch series. > > So, at your discretion (and I'll let you worry about the correct > Fixes: tag format), this series fixes: > > bad76991d7847b7877ae797cc79745d82ffd9120 mfd: Register ab8500 devices using > the newly DT:ed MFD API This patch isn't actually broken. The issue is the DTB, which [0] addresses. [0] https://lkml.kernel.org/lkml/20200622083432.1491715-1-lee.jo...@linaro.org/ > c94bb233a9fee3314dc5d9c7de9fa702e91283f2 mfd: Make MFD core code Device Tree > and IRQ domain aware It sounds reasonable to list this one, thanks. -- Lee Jones [李琼斯] Senior Technical Lead - Developer Services Linaro.org │ Open source software for Arm SoCs Follow Linaro: Facebook | Twitter | Blog
Re: [PATCH v4 3/7] iommu/mediatek: Set MISC_CTRL register
On Sat, 2020-06-20 at 10:03 +0800, Yong Wu wrote: > Hi Chao, > > On Thu, 2020-06-18 at 19:49 +0800, chao hao wrote: > > On Wed, 2020-06-17 at 11:34 +0200, Matthias Brugger wrote: > > [snip] > > > > > > > > > #define REG_MMU_MISC_CTRL 0x048 > > > > +#define F_MMU_IN_ORDER_WR_EN (BIT(1) | BIT(17)) > > > > +#define F_MMU_STANDARD_AXI_MODE_BIT(BIT(3) | BIT(19)) > > > > + > > > > #define REG_MMU_DCM_DIS0x050 > > > > > > > > #define REG_MMU_CTRL_REG 0x110 > > > > @@ -578,6 +581,14 @@ static int mtk_iommu_hw_init(const struct > > > > mtk_iommu_data *data) > > > > writel_relaxed(0, data->base + REG_MMU_MISC_CTRL); > > > > } > > > > > > > > + if (data->plat_data->has_misc_ctrl) { > > > > > > That's confusing. We renamed the register to misc_ctrl, but it's present > > > in all > > > SoCs. We should find a better name for this flag to describe what the > > > hardware > > > supports. > > > > > > > ok, thanks for you advice, I will rename it in next version. > > ex:has_perf_req(has performance requirement) > > > > > > > Regards, > > > Matthias > > > > > > > + /* For mm_iommu, it can improve performance by the > > > > setting */ > > > > + regval = readl_relaxed(data->base + REG_MMU_MISC_CTRL); > > > > + regval &= ~F_MMU_STANDARD_AXI_MODE_BIT; > > > > + regval &= ~F_MMU_IN_ORDER_WR_EN; > > Note: mt2712 also is MISC_CTRL register, but it don't use this > in_order setting. > > As commented in v3. 0x48 is either STANDARD_AXI_MODE or MISC_CTRL > register. No need two flags(reset_axi/has_xx) for it. > > something like: > > regval = readl_relaxed(data->base + REG_MMU_MISC_CTRL); > if (reset_axi) { > regval = 0; > } else { /* MISC_CTRL */ > if (!apu[1]) > regval &= ~F_MMU_STANDARD_AXI_MODE_BIT; > if (out_order_en) > regval &= ~F_MMU_IN_ORDER_WR_EN; > } > writel_relaxed(regval, data->base + REG_MMU_MISC_CTRL); > > > [1] Your current patch doesn't support apu-iommu, thus, add it when > necessary. ok, the patchset don't need to "if (!apu[1])", I will fix it in next version. thanks > > > > + writel_relaxed(regval, data->base + REG_MMU_MISC_CTRL); > > > > + } > > > > + > > > > if (devm_request_irq(data->dev, data->irq, mtk_iommu_isr, 0, > > > > dev_name(data->dev), (void *)data)) { > > > > writel_relaxed(0, data->base + REG_MMU_PT_BASE_ADDR); > > > > diff --git a/drivers/iommu/mtk_iommu.h b/drivers/iommu/mtk_iommu.h > > > > index 1b6ea839b92c..d711ac630037 100644 > > > > --- a/drivers/iommu/mtk_iommu.h > > > > +++ b/drivers/iommu/mtk_iommu.h > > > > @@ -40,6 +40,7 @@ struct mtk_iommu_plat_data { > > > > > > > > /* HW will use the EMI clock if there isn't the "bclk". */ > > > > boolhas_bclk; > > > > + boolhas_misc_ctrl; > > > > boolhas_vld_pa_rng; > > > > boolreset_axi; > > > > unsigned char larbid_remap[MTK_LARB_NR_MAX]; > > > > > > > > >
Re: xilinx_axienet_main.c:undefined reference to `devm_ioremap_resource'
On 23. 06. 20 23:27, Brendan Higgins wrote: > On Sat, Jun 20, 2020 at 1:59 AM kernel test robot wrote: >> >> Hi Brendan, >> >> It's probably a bug fix that unveils the link errors. >> >> tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git >> master >> head: 4333a9b0b67bb4e8bcd91bdd80da80b0ec151162 >> commit: 1af73a25e6e7d9f2f1e2a14259cc9ffce6d8f6d4 staging: exfat: fix >> multiple definition error of `rename_file' >> date: 6 months ago >> config: um-allyesconfig (attached as .config) >> compiler: gcc-9 (Debian 9.3.0-13) 9.3.0 >> reproduce (this is a W=1 build): >> git checkout 1af73a25e6e7d9f2f1e2a14259cc9ffce6d8f6d4 >> # save the attached .config to linux build tree >> make W=1 ARCH=um >> >> If you fix the issue, kindly add following tag as appropriate >> Reported-by: kernel test robot >> >> All errors (new ones prefixed by >>): >> >>/usr/bin/ld: drivers/net/ethernet/xilinx/xilinx_axienet_main.o: in >> function `axienet_probe': xilinx_axienet_main.c:(.text+0x1aa6): undefined reference to `devm_ioremap_resource' /usr/bin/ld: xilinx_axienet_main.c:(.text+0x1d06): undefined reference to `devm_ioremap_resource' >>/usr/bin/ld: xilinx_axienet_main.c:(.text+0x2001): undefined reference to >> `devm_ioremap_resource' >>collect2: error: ld returned 1 exit status > > I posted a fix for this months ago: > > https://patchwork.ozlabs.org/project/linux-um/patch/20191211192742.95699-4-brendanhigg...@google.com/ > > I thought it got picked up by the maintainer. > Can you please send it again? Thanks, Michal
RE: [PATCH RESEND] net/cisco: Fix a sleep-in-atomic-context bug in enic_init_affinity_hint()
> -Original Message- > From: netdev-ow...@vger.kernel.org > On Behalf Of Kaige Li > Sent: Tuesday, June 23, 2020 8:41 PM > To: David Miller > Cc: Christian Benvenuti (benve) ; _gov...@gmx.com; > net...@vger.kernel.org; linux-kernel@vger.kernel.org; > lixuef...@loongson.cn; yangtie...@loongson.cn > Subject: Re: [PATCH RESEND] net/cisco: Fix a sleep-in-atomic-context bug in > enic_init_affinity_hint() > > > On 06/24/2020 11:23 AM, David Miller wrote: > > From: Kaige Li > > Date: Wed, 24 Jun 2020 09:56:47 +0800 > > > >> On 06/24/2020 06:26 AM, David Miller wrote: > >>> From: David Miller > >>> Date: Tue, 23 Jun 2020 14:33:11 -0700 (PDT) > >>> > Calling a NIC driver open function from a context holding a > spinlock is very much the real problem, so many operations have to > sleep and in face that ->ndo_open() method is defined as being > allowed to sleep and that's why the core networking never invokes > it with spinlocks > >>> > >>> > >>> I mean "without" of course. :-) > >>> > held. > >> Did you mean that open function should be out of spinlock? If so, I > >> will send V2 patch. > > Yes, but only if that is safe. > > > > You have to analyze the locking done by this driver and fix it properly. > > I anticipate it is not just a matter of changing where the spinlock > > is held, you will have to rearchitect things a bit. > > Okay, I will careful analyze this question, and make a suitable patch in V2. > > Thank you. Hi David, Kaige, I assume you are referring to the enic_api_lock spin_lock used in enic_reset() which is used to hard-reset the interface when the driver receives an error interrupt and enic_tx_hang_reset() which is used to soft-reset the interface when the stack detects the TX timeout. Both reset functions above are called in the context of a workqueue. However, the same spin_lock (enic_api_lock) is taken by the enic_api_devcmd_proxy_by_index() api that is exported by the enic driver and that the usnic_verbs driver uses to send commands to the firmware. This spin_lock was likely added to guarantee that no firmware command is sent by usnic_verbs to an enic interface that is undergoing a reset. Unfortunately changing that spin_lock to a mutex will likely not work on the usnic_verbs side, and removing the spin_lock will require a rearchitect of the code as mentioned by David. Kaige, V2 is of course more than welcome and we can test it too. We/Cisco will also look into it, hopefully a small code reorg will be sufficient. David, from your previous emails on this 3D I assume - we can leave request_irq() in ndo_open (ie, no need to move it to pci/probe), which is done by a number of other drivers too. - no need to change GFP_KERNEL to GFP_ATOMIC as it was suggested in the original patch. Thanks! /Chris
[PATCH v2 06/14] irqchip/digicolor: Fix potential resource leaks
There exists potential resource leaks in the error path, fix them. Fixes: 8041dfbd31cf ("irqchip: Conexant CX92755 interrupts controller driver") Signed-off-by: Tiezhu Yang --- drivers/irqchip/irq-digicolor.c | 14 +++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/drivers/irqchip/irq-digicolor.c b/drivers/irqchip/irq-digicolor.c index fc38d2d..18c6e77 100644 --- a/drivers/irqchip/irq-digicolor.c +++ b/drivers/irqchip/irq-digicolor.c @@ -89,7 +89,8 @@ static int __init digicolor_of_init(struct device_node *node, ucregs = syscon_regmap_lookup_by_phandle(node, "syscon"); if (IS_ERR(ucregs)) { pr_err("%pOF: unable to map UC registers\n", node); - return PTR_ERR(ucregs); + ret = PTR_ERR(ucregs); + goto err_iounmap; } /* channel 1, regular IRQs */ regmap_write(ucregs, UC_IRQ_CONTROL, 1); @@ -98,7 +99,8 @@ static int __init digicolor_of_init(struct device_node *node, irq_domain_add_linear(node, 64, &irq_generic_chip_ops, NULL); if (!digicolor_irq_domain) { pr_err("%pOF: unable to create IRQ domain\n", node); - return -ENOMEM; + ret = -ENOMEM; + goto err_iounmap; } ret = irq_alloc_domain_generic_chips(digicolor_irq_domain, 32, 1, @@ -106,7 +108,7 @@ static int __init digicolor_of_init(struct device_node *node, clr, 0, 0); if (ret) { pr_err("%pOF: unable to allocate IRQ gc\n", node); - return ret; + goto err_domain_remove; } digicolor_set_gc(reg_base, 0, IC_INT0ENABLE_LO, IC_FLAG_CLEAR_LO); @@ -115,5 +117,11 @@ static int __init digicolor_of_init(struct device_node *node, set_handle_irq(digicolor_handle_irq); return 0; + +err_domain_remove: + irq_domain_remove(digicolor_irq_domain); +err_iounmap: + iounmap(reg_base); + return ret; } IRQCHIP_DECLARE(conexant_digicolor_ic, "cnxt,cx92755-ic", digicolor_of_init); -- 2.1.0
[PATCH v2 05/14] irqchip/davinci-cp-intc: Fix potential resource leaks
There exists potential resource leaks in the error path, fix them. Fixes: 0fc3d74cf946 ("irqchip: davinci-cp-intc: move the driver to drivers/irqchip") Signed-off-by: Tiezhu Yang --- drivers/irqchip/irq-davinci-cp-intc.c | 17 ++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/drivers/irqchip/irq-davinci-cp-intc.c b/drivers/irqchip/irq-davinci-cp-intc.c index 276da277..991339f 100644 --- a/drivers/irqchip/irq-davinci-cp-intc.c +++ b/drivers/irqchip/irq-davinci-cp-intc.c @@ -175,7 +175,8 @@ davinci_cp_intc_do_init(const struct davinci_cp_intc_config *config, resource_size(&config->reg)); if (!davinci_cp_intc_base) { pr_err("%s: unable to ioremap register range\n", __func__); - return -EINVAL; + ret = -EINVAL; + goto err_release; } davinci_cp_intc_write(0, DAVINCI_CP_INTC_GLOBAL_ENABLE); @@ -210,7 +211,8 @@ davinci_cp_intc_do_init(const struct davinci_cp_intc_config *config, if (irq_base < 0) { pr_err("%s: unable to allocate interrupt descriptors: %d\n", __func__, irq_base); - return irq_base; + ret = irq_base; + goto err_iounmap; } davinci_cp_intc_irq_domain = irq_domain_add_legacy( @@ -219,7 +221,8 @@ davinci_cp_intc_do_init(const struct davinci_cp_intc_config *config, if (!davinci_cp_intc_irq_domain) { pr_err("%s: unable to create an interrupt domain\n", __func__); - return -EINVAL; + ret = -EINVAL; + goto err_free_descs; } set_handle_irq(davinci_cp_intc_handle_irq); @@ -228,6 +231,14 @@ davinci_cp_intc_do_init(const struct davinci_cp_intc_config *config, davinci_cp_intc_write(1, DAVINCI_CP_INTC_GLOBAL_ENABLE); return 0; + +err_free_descs: + irq_free_descs(irq_base, config->num_irqs); +err_iounmap: + iounmap(davinci_cp_intc_base); +err_release: + release_mem_region(config->reg.start, resource_size(&config->reg)); + return ret; } int __init davinci_cp_intc_init(const struct davinci_cp_intc_config *config) -- 2.1.0
[PATCH v2 03/14] irqchip/csky-mpintc: Fix potential resource leaks
There exists potential resource leaks in the error path, fix them. Fixes: d8a5f5f79122 ("irqchip: add C-SKY SMP interrupt controller") Signed-off-by: Tiezhu Yang --- drivers/irqchip/irq-csky-mpintc.c | 26 -- 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/drivers/irqchip/irq-csky-mpintc.c b/drivers/irqchip/irq-csky-mpintc.c index a1534ed..c195e24 100644 --- a/drivers/irqchip/irq-csky-mpintc.c +++ b/drivers/irqchip/irq-csky-mpintc.c @@ -247,8 +247,10 @@ csky_mpintc_init(struct device_node *node, struct device_node *parent) if (INTCG_base == NULL) { INTCG_base = ioremap(mfcr("cr<31, 14>"), INTCL_SIZE*nr_cpu_ids + INTCG_SIZE); - if (INTCG_base == NULL) - return -EIO; + if (INTCG_base == NULL) { + ret = -EIO; + goto err_free; + } INTCL_base = INTCG_base + INTCG_SIZE; @@ -257,8 +259,10 @@ csky_mpintc_init(struct device_node *node, struct device_node *parent) root_domain = irq_domain_add_linear(node, nr_irq, &csky_irqdomain_ops, NULL); - if (!root_domain) - return -ENXIO; + if (!root_domain) { + ret = -ENXIO; + goto err_iounmap; + } /* for every cpu */ for_each_present_cpu(cpu) { @@ -270,12 +274,22 @@ csky_mpintc_init(struct device_node *node, struct device_node *parent) #ifdef CONFIG_SMP ipi_irq = irq_create_mapping(root_domain, IPI_IRQ); - if (!ipi_irq) - return -EIO; + if (!ipi_irq) { + ret = -EIO; + goto err_domain_remove; + } set_send_ipi(&csky_mpintc_send_ipi, ipi_irq); #endif return 0; + +err_domain_remove: + irq_domain_remove(root_domain); +err_iounmap: + iounmap(INTCG_base); +err_free: + kfree(__trigger); + return ret; } IRQCHIP_DECLARE(csky_mpintc, "csky,mpintc", csky_mpintc_init); -- 2.1.0
Re: [PATCH v4 6/7] iommu/mediatek: Add REG_MMU_WR_LEN definition preparing for mt6779
On Sun, 2020-06-21 at 13:01 +0200, Matthias Brugger wrote: > > On 19/06/2020 12:56, chao hao wrote: > > On Wed, 2020-06-17 at 11:22 +0200, Matthias Brugger wrote: > >> > >> On 17/06/2020 05:00, Chao Hao wrote: > >>> Some platforms(ex: mt6779) have a new register called by REG_MMU_WR_LEN > >>> to improve performance. > >>> This patch add this register definition. > >> > >> Please be more specific what this register is about. > >> > > OK. thanks. > > We can use "has_wr_len" flag to control whether we need to set the > > register. If the register uses default value, iommu will send command to > > EMI without restriction, when the number of commands become more and > > more, it will drop the EMI performance. So when more than > > ten_commands(default value) don't be handled for EMI, IOMMU will stop > > send command to EMI for keeping EMI's performace by enabling write > > throttling mechanism(bit[5][21]=0) in MMU_WR_LEN_CTRL register. > > > > I will write description above to commit message in next version > > > >>> > >>> Signed-off-by: Chao Hao > >>> --- > >>> drivers/iommu/mtk_iommu.c | 10 ++ > >>> drivers/iommu/mtk_iommu.h | 2 ++ > >>> 2 files changed, 12 insertions(+) > >>> > >>> diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c > >>> index a687e8db0e51..c706bca6487e 100644 > >>> --- a/drivers/iommu/mtk_iommu.c > >>> +++ b/drivers/iommu/mtk_iommu.c > >>> @@ -46,6 +46,8 @@ > >>> #define F_MMU_STANDARD_AXI_MODE_BIT (BIT(3) | BIT(19)) > >>> > >>> #define REG_MMU_DCM_DIS 0x050 > >>> +#define REG_MMU_WR_LEN 0x054 > >>> +#define F_MMU_WR_THROT_DIS_BIT (BIT(5) | BIT(21)) > >>> > >>> #define REG_MMU_CTRL_REG 0x110 > >>> #define F_MMU_TF_PROT_TO_PROGRAM_ADDR(2 << 4) > >>> @@ -581,6 +583,12 @@ static int mtk_iommu_hw_init(const struct > >>> mtk_iommu_data *data) > >>> writel_relaxed(regval, data->base + REG_MMU_VLD_PA_RNG); > >>> } > >>> writel_relaxed(0, data->base + REG_MMU_DCM_DIS); > >>> + if (data->plat_data->has_wr_len) { > >>> + /* write command throttling mode */ > >>> + regval = readl_relaxed(data->base + REG_MMU_WR_LEN); > >>> + regval &= ~F_MMU_WR_THROT_DIS_BIT; > >>> + writel_relaxed(regval, data->base + REG_MMU_WR_LEN); > >>> + } > >>> > >>> if (data->plat_data->reset_axi) { > >>> /* The register is called STANDARD_AXI_MODE in this case */ > >>> @@ -737,6 +745,7 @@ static int __maybe_unused mtk_iommu_suspend(struct > >>> device *dev) > >>> struct mtk_iommu_suspend_reg *reg = &data->reg; > >>> void __iomem *base = data->base; > >>> > >>> + reg->wr_len = readl_relaxed(base + REG_MMU_WR_LEN); > >> > >> Can we read/write the register without any side effect although hardware > >> has not > >> implemented it (!has_wr_len)? > > > > It doesn't have side effect. Becasue all the MTK platform have the > > register for iommu HW. If we need to have requirement for performance, > > we can set it by has_wr_len. > > But I'm Sorry, the name of flag(has_wr_len) is not exact, I will rename > > it in next version, ex: "wr_throt_en" > > > >> > >> > >>> reg->misc_ctrl = readl_relaxed(base + REG_MMU_MISC_CTRL); > >>> reg->dcm_dis = readl_relaxed(base + REG_MMU_DCM_DIS); > >>> reg->ctrl_reg = readl_relaxed(base + REG_MMU_CTRL_REG); > >>> @@ -761,6 +770,7 @@ static int __maybe_unused mtk_iommu_resume(struct > >>> device *dev) > >>> dev_err(data->dev, "Failed to enable clk(%d) in resume\n", ret); > >>> return ret; > >>> } > >>> + writel_relaxed(reg->wr_len, base + REG_MMU_WR_LEN); > >>> writel_relaxed(reg->misc_ctrl, base + REG_MMU_MISC_CTRL); > >>> writel_relaxed(reg->dcm_dis, base + REG_MMU_DCM_DIS); > >>> writel_relaxed(reg->ctrl_reg, base + REG_MMU_CTRL_REG); > >>> diff --git a/drivers/iommu/mtk_iommu.h b/drivers/iommu/mtk_iommu.h > >>> index d51ff99c2c71..9971cedd72ea 100644 > >>> --- a/drivers/iommu/mtk_iommu.h > >>> +++ b/drivers/iommu/mtk_iommu.h > >>> @@ -25,6 +25,7 @@ struct mtk_iommu_suspend_reg { > >>> u32 int_main_control; > >>> u32 ivrp_paddr; > >>> u32 vld_pa_rng; > >>> + u32 wr_len; > >>> }; > >>> > >>> enum mtk_iommu_plat { > >>> @@ -43,6 +44,7 @@ struct mtk_iommu_plat_data { > >>> boolhas_misc_ctrl; > >>> boolhas_sub_comm; > >>> boolhas_vld_pa_rng; > >>> + boolhas_wr_len; > >> > >> Given the fact that we are adding more and more plat_data bool values, I > >> think > >> it would make sense to use a u32 flags register and add the appropriate > >> macro > >> definitions to set and check for a flag present. > > > > Thanks for your advice. > > do you mean like this: > > struct plat_flag { > > > > #define HAS_4GB_MODE BIT(0) > > #define HAS_BCLK
[PATCH V6 6/9] pinctrl: imx8mp: Support building as module
Change configuration to "tristate", add module device table, author, description and license to support building i.MX8MP pinctrl driver as module. Signed-off-by: Anson Huang --- No change. --- drivers/pinctrl/freescale/Kconfig | 2 +- drivers/pinctrl/freescale/pinctrl-imx8mp.c | 6 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/pinctrl/freescale/Kconfig b/drivers/pinctrl/freescale/Kconfig index df77e752..2bf90b3 100644 --- a/drivers/pinctrl/freescale/Kconfig +++ b/drivers/pinctrl/freescale/Kconfig @@ -138,7 +138,7 @@ config PINCTRL_IMX8MN Say Y here to enable the imx8mn pinctrl driver config PINCTRL_IMX8MP - bool "IMX8MP pinctrl driver" + tristate "IMX8MP pinctrl driver" depends on ARCH_MXC select PINCTRL_IMX help diff --git a/drivers/pinctrl/freescale/pinctrl-imx8mp.c b/drivers/pinctrl/freescale/pinctrl-imx8mp.c index e3f644c..bf4bbb5 100644 --- a/drivers/pinctrl/freescale/pinctrl-imx8mp.c +++ b/drivers/pinctrl/freescale/pinctrl-imx8mp.c @@ -5,6 +5,7 @@ #include #include +#include #include #include #include @@ -324,6 +325,7 @@ static const struct of_device_id imx8mp_pinctrl_of_match[] = { { .compatible = "fsl,imx8mp-iomuxc", .data = &imx8mp_pinctrl_info, }, { /* sentinel */ } }; +MODULE_DEVICE_TABLE(of, imx8mp_pinctrl_of_match); static int imx8mp_pinctrl_probe(struct platform_device *pdev) { @@ -343,3 +345,7 @@ static int __init imx8mp_pinctrl_init(void) return platform_driver_register(&imx8mp_pinctrl_driver); } arch_initcall(imx8mp_pinctrl_init); + +MODULE_AUTHOR("Anson Huang "); +MODULE_DESCRIPTION("NXP i.MX8MP pinctrl driver"); +MODULE_LICENSE("GPL v2"); -- 2.7.4
[PATCH V6 2/9] pinctrl: imx: scu: Support i.MX8 SCU SoCs pinctrl driver built as module
Export necessary APIs to support i.MX8 SCU SoCs pinctrl driver to be built as module. Signed-off-by: Anson Huang --- Changes since V5: - keep it still built in, ONLY export APIs for SoCs pinctrl driver; --- drivers/pinctrl/freescale/pinctrl-scu.c | 4 1 file changed, 4 insertions(+) diff --git a/drivers/pinctrl/freescale/pinctrl-scu.c b/drivers/pinctrl/freescale/pinctrl-scu.c index 23cf04b..9df45d3 100644 --- a/drivers/pinctrl/freescale/pinctrl-scu.c +++ b/drivers/pinctrl/freescale/pinctrl-scu.c @@ -41,6 +41,7 @@ int imx_pinctrl_sc_ipc_init(struct platform_device *pdev) { return imx_scu_get_handle(&pinctrl_ipc_handle); } +EXPORT_SYMBOL_GPL(imx_pinctrl_sc_ipc_init); int imx_pinconf_get_scu(struct pinctrl_dev *pctldev, unsigned pin_id, unsigned long *config) @@ -66,6 +67,7 @@ int imx_pinconf_get_scu(struct pinctrl_dev *pctldev, unsigned pin_id, return 0; } +EXPORT_SYMBOL_GPL(imx_pinconf_get_scu); int imx_pinconf_set_scu(struct pinctrl_dev *pctldev, unsigned pin_id, unsigned long *configs, unsigned num_configs) @@ -101,6 +103,7 @@ int imx_pinconf_set_scu(struct pinctrl_dev *pctldev, unsigned pin_id, return ret; } +EXPORT_SYMBOL_GPL(imx_pinconf_set_scu); void imx_pinctrl_parse_pin_scu(struct imx_pinctrl *ipctl, unsigned int *pin_id, struct imx_pin *pin, @@ -119,3 +122,4 @@ void imx_pinctrl_parse_pin_scu(struct imx_pinctrl *ipctl, dev_dbg(ipctl->dev, "%s: 0x%x 0x%08lx", info->pins[pin->pin].name, pin_scu->mux_mode, pin_scu->config); } +EXPORT_SYMBOL_GPL(imx_pinctrl_parse_pin_scu); -- 2.7.4
[PATCH v2 1/7] irqchip/loongson-htpic: Remove redundant kfree operation
In the function htpic_of_init(), when kzalloc htpic fails, it should return -ENOMEM directly, no need to execute "goto" to kfree. Signed-off-by: Tiezhu Yang --- drivers/irqchip/irq-loongson-htpic.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/irqchip/irq-loongson-htpic.c b/drivers/irqchip/irq-loongson-htpic.c index dd018c2..63f7280 100644 --- a/drivers/irqchip/irq-loongson-htpic.c +++ b/drivers/irqchip/irq-loongson-htpic.c @@ -93,10 +93,8 @@ int __init htpic_of_init(struct device_node *node, struct device_node *parent) } htpic = kzalloc(sizeof(*htpic), GFP_KERNEL); - if (!htpic) { - err = -ENOMEM; - goto out_free; - } + if (!htpic) + return -ENOMEM; htpic->base = of_iomap(node, 0); if (!htpic->base) { -- 2.1.0
[PATCH v2 2/7] irqchip/loongson-htpic: Remove unneeded select of I8259
LOONGSON_HTPIC depends on MACH_LOONGSON64 and MACH_LOONGSON64 already selects I8259 in arch/mips/Kconfig, so no need to select I8259 again when config LOONGSON_HTPIC. Signed-off-by: Tiezhu Yang --- drivers/irqchip/Kconfig | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/irqchip/Kconfig b/drivers/irqchip/Kconfig index 29fead2..9f57aed 100644 --- a/drivers/irqchip/Kconfig +++ b/drivers/irqchip/Kconfig @@ -541,7 +541,6 @@ config LOONGSON_HTPIC default y select IRQ_DOMAIN select GENERIC_IRQ_CHIP - select I8259 help Support for the Loongson-3 HyperTransport PIC Controller. -- 2.1.0
[PATCH v2 3/7] irqchip/loongson-htvec: Fix potential resource leak
There exists potential resource leak in the error path, fix it. Fixes: 818e915fbac5 ("irqchip: Add Loongson HyperTransport Vector support") Signed-off-by: Tiezhu Yang --- drivers/irqchip/irq-loongson-htvec.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/irqchip/irq-loongson-htvec.c b/drivers/irqchip/irq-loongson-htvec.c index 1ece933..b36d403 100644 --- a/drivers/irqchip/irq-loongson-htvec.c +++ b/drivers/irqchip/irq-loongson-htvec.c @@ -192,7 +192,7 @@ static int htvec_of_init(struct device_node *node, if (!priv->htvec_domain) { pr_err("Failed to create IRQ domain\n"); err = -ENOMEM; - goto iounmap_base; + goto irq_dispose; } htvec_reset(priv); @@ -203,6 +203,9 @@ static int htvec_of_init(struct device_node *node, return 0; +irq_dispose: + for (; i > 0; i--) + irq_dispose_mapping(parent_irq[i - 1]); iounmap_base: iounmap(priv->base); free_priv: -- 2.1.0
[PATCH V6 1/9] pinctrl: imx: Support i.MX8 SoCs pinctrl driver built as module
Export necessary APIs to support i.MX8 SoCs pinctrl driver to be built as module. Signed-off-by: Anson Huang --- Changes since V5: - keep it still built in, ONLY export APIs for SoCs pinctrl driver; --- drivers/pinctrl/freescale/pinctrl-imx.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/pinctrl/freescale/pinctrl-imx.c b/drivers/pinctrl/freescale/pinctrl-imx.c index 1f81569..507e4af 100644 --- a/drivers/pinctrl/freescale/pinctrl-imx.c +++ b/drivers/pinctrl/freescale/pinctrl-imx.c @@ -877,6 +877,7 @@ int imx_pinctrl_probe(struct platform_device *pdev, return pinctrl_enable(ipctl->pctl); } +EXPORT_SYMBOL_GPL(imx_pinctrl_probe); static int __maybe_unused imx_pinctrl_suspend(struct device *dev) { @@ -896,3 +897,4 @@ const struct dev_pm_ops imx_pinctrl_pm_ops = { SET_LATE_SYSTEM_SLEEP_PM_OPS(imx_pinctrl_suspend, imx_pinctrl_resume) }; +EXPORT_SYMBOL_GPL(imx_pinctrl_pm_ops); -- 2.7.4
[PATCH V6 9/9] pinctrl: imx8dxl: Support building as module
Change configuration to "tristate", add module device table, author, description and license to support building i.MX8DXL pinctrl driver as module. Signed-off-by: Anson Huang --- No change. --- drivers/pinctrl/freescale/Kconfig | 2 +- drivers/pinctrl/freescale/pinctrl-imx8dxl.c | 5 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/pinctrl/freescale/Kconfig b/drivers/pinctrl/freescale/Kconfig index d9fb5f2..08fcf5c 100644 --- a/drivers/pinctrl/freescale/Kconfig +++ b/drivers/pinctrl/freescale/Kconfig @@ -166,7 +166,7 @@ config PINCTRL_IMX8QXP Say Y here to enable the imx8qxp pinctrl driver config PINCTRL_IMX8DXL - bool "IMX8DXL pinctrl driver" + tristate "IMX8DXL pinctrl driver" depends on IMX_SCU && ARCH_MXC && ARM64 select PINCTRL_IMX_SCU help diff --git a/drivers/pinctrl/freescale/pinctrl-imx8dxl.c b/drivers/pinctrl/freescale/pinctrl-imx8dxl.c index 7f32e57..12b97da 100644 --- a/drivers/pinctrl/freescale/pinctrl-imx8dxl.c +++ b/drivers/pinctrl/freescale/pinctrl-imx8dxl.c @@ -165,6 +165,7 @@ static const struct of_device_id imx8dxl_pinctrl_of_match[] = { { .compatible = "fsl,imx8dxl-iomuxc", }, { /* sentinel */ } }; +MODULE_DEVICE_TABLE(of, imx8dxl_pinctrl_of_match); static int imx8dxl_pinctrl_probe(struct platform_device *pdev) { @@ -191,3 +192,7 @@ static int __init imx8dxl_pinctrl_init(void) return platform_driver_register(&imx8dxl_pinctrl_driver); } arch_initcall(imx8dxl_pinctrl_init); + +MODULE_AUTHOR("Anson Huang "); +MODULE_DESCRIPTION("NXP i.MX8DXL pinctrl driver"); +MODULE_LICENSE("GPL v2"); -- 2.7.4
[PATCH v2 0/7] irqchip: Fix some issues and do some code cleanups about Loongson
Check the return value of irq_domain_translate_onecell() and irq_domain_translate_twocell(), do some code cleanups about Loongson to make it more clean and readable. v2: - In order to avoid git send-email failed, make the related patches about Loongson into a new patch series and add "Fixes" tag Tiezhu Yang (7): irqchip/loongson-htpic: Remove redundant kfree operation irqchip/loongson-htpic: Remove unneeded select of I8259 irqchip/loongson-htvec: Fix potential resource leak irqchip/loongson-htvec: Check return value of irq_domain_translate_onecell() irqchip/loongson-pch-pic: Check return value of irq_domain_translate_twocell() irqchip/loongson-pch-msi: Remove unneeded variable dt-bindings: interrupt-controller: Fix typos in loongson,liointc.yaml .../bindings/interrupt-controller/loongson,liointc.yaml | 4 ++-- drivers/irqchip/Kconfig | 1 - drivers/irqchip/irq-loongson-htpic.c | 6 ++ drivers/irqchip/irq-loongson-htvec.c | 10 -- drivers/irqchip/irq-loongson-pch-msi.c| 7 +-- drivers/irqchip/irq-loongson-pch-pic.c| 15 +-- 6 files changed, 22 insertions(+), 21 deletions(-) -- 2.1.0
[PATCH V6 7/9] pinctrl: imx8qxp: Support building as module
Change configuration to "tristate", add module device table, author, description and license to support building i.MX8QXP pinctrl driver as module. Signed-off-by: Anson Huang --- No change. --- drivers/pinctrl/freescale/Kconfig | 2 +- drivers/pinctrl/freescale/pinctrl-imx8qxp.c | 5 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/pinctrl/freescale/Kconfig b/drivers/pinctrl/freescale/Kconfig index 2bf90b3..0a728bb 100644 --- a/drivers/pinctrl/freescale/Kconfig +++ b/drivers/pinctrl/freescale/Kconfig @@ -159,7 +159,7 @@ config PINCTRL_IMX8QM Say Y here to enable the imx8qm pinctrl driver config PINCTRL_IMX8QXP - bool "IMX8QXP pinctrl driver" + tristate "IMX8QXP pinctrl driver" depends on IMX_SCU && ARCH_MXC && ARM64 select PINCTRL_IMX_SCU help diff --git a/drivers/pinctrl/freescale/pinctrl-imx8qxp.c b/drivers/pinctrl/freescale/pinctrl-imx8qxp.c index 1131dc3..81ebd4c 100644 --- a/drivers/pinctrl/freescale/pinctrl-imx8qxp.c +++ b/drivers/pinctrl/freescale/pinctrl-imx8qxp.c @@ -204,6 +204,7 @@ static const struct of_device_id imx8qxp_pinctrl_of_match[] = { { .compatible = "fsl,imx8qxp-iomuxc", }, { /* sentinel */ } }; +MODULE_DEVICE_TABLE(of, imx8qxp_pinctrl_of_match); static int imx8qxp_pinctrl_probe(struct platform_device *pdev) { @@ -230,3 +231,7 @@ static int __init imx8qxp_pinctrl_init(void) return platform_driver_register(&imx8qxp_pinctrl_driver); } arch_initcall(imx8qxp_pinctrl_init); + +MODULE_AUTHOR("Aisheng Dong "); +MODULE_DESCRIPTION("NXP i.MX8QXP pinctrl driver"); +MODULE_LICENSE("GPL v2"); -- 2.7.4
[PATCH V6 8/9] pinctrl: imx8qm: Support building as module
Change configuration to "tristate", add module device table, author, description and license to support building i.MX8QM pinctrl driver as module. Signed-off-by: Anson Huang --- No change. --- drivers/pinctrl/freescale/Kconfig | 2 +- drivers/pinctrl/freescale/pinctrl-imx8qm.c | 5 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/pinctrl/freescale/Kconfig b/drivers/pinctrl/freescale/Kconfig index 0a728bb..d9fb5f2 100644 --- a/drivers/pinctrl/freescale/Kconfig +++ b/drivers/pinctrl/freescale/Kconfig @@ -152,7 +152,7 @@ config PINCTRL_IMX8MQ Say Y here to enable the imx8mq pinctrl driver config PINCTRL_IMX8QM - bool "IMX8QM pinctrl driver" + tristate "IMX8QM pinctrl driver" depends on IMX_SCU && ARCH_MXC && ARM64 select PINCTRL_IMX_SCU help diff --git a/drivers/pinctrl/freescale/pinctrl-imx8qm.c b/drivers/pinctrl/freescale/pinctrl-imx8qm.c index 0b6029b..095acf4 100644 --- a/drivers/pinctrl/freescale/pinctrl-imx8qm.c +++ b/drivers/pinctrl/freescale/pinctrl-imx8qm.c @@ -298,6 +298,7 @@ static const struct of_device_id imx8qm_pinctrl_of_match[] = { { .compatible = "fsl,imx8qm-iomuxc", }, { /* sentinel */ } }; +MODULE_DEVICE_TABLE(of, imx8qm_pinctrl_of_match); static int imx8qm_pinctrl_probe(struct platform_device *pdev) { @@ -324,3 +325,7 @@ static int __init imx8qm_pinctrl_init(void) return platform_driver_register(&imx8qm_pinctrl_driver); } arch_initcall(imx8qm_pinctrl_init); + +MODULE_AUTHOR("Aisheng Dong "); +MODULE_DESCRIPTION("NXP i.MX8QM pinctrl driver"); +MODULE_LICENSE("GPL v2"); -- 2.7.4
[PATCH V6 4/9] pinctrl: imx8mn: Support building as module
Change configuration to "tristate", add module device table, author, description and license to support building i.MX8MN pinctrl driver as module. Signed-off-by: Anson Huang --- No change. --- drivers/pinctrl/freescale/Kconfig | 2 +- drivers/pinctrl/freescale/pinctrl-imx8mn.c | 6 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/pinctrl/freescale/Kconfig b/drivers/pinctrl/freescale/Kconfig index 3681c4d..b909719 100644 --- a/drivers/pinctrl/freescale/Kconfig +++ b/drivers/pinctrl/freescale/Kconfig @@ -131,7 +131,7 @@ config PINCTRL_IMX8MM Say Y here to enable the imx8mm pinctrl driver config PINCTRL_IMX8MN - bool "IMX8MN pinctrl driver" + tristate "IMX8MN pinctrl driver" depends on ARCH_MXC select PINCTRL_IMX help diff --git a/drivers/pinctrl/freescale/pinctrl-imx8mn.c b/drivers/pinctrl/freescale/pinctrl-imx8mn.c index 100ed8c..14c9deb 100644 --- a/drivers/pinctrl/freescale/pinctrl-imx8mn.c +++ b/drivers/pinctrl/freescale/pinctrl-imx8mn.c @@ -5,6 +5,7 @@ #include #include +#include #include #include #include @@ -326,6 +327,7 @@ static const struct of_device_id imx8mn_pinctrl_of_match[] = { { .compatible = "fsl,imx8mn-iomuxc", .data = &imx8mn_pinctrl_info, }, { /* sentinel */ } }; +MODULE_DEVICE_TABLE(of, imx8mn_pinctrl_of_match); static int imx8mn_pinctrl_probe(struct platform_device *pdev) { @@ -346,3 +348,7 @@ static int __init imx8mn_pinctrl_init(void) return platform_driver_register(&imx8mn_pinctrl_driver); } arch_initcall(imx8mn_pinctrl_init); + +MODULE_AUTHOR("Anson Huang "); +MODULE_DESCRIPTION("NXP i.MX8MN pinctrl driver"); +MODULE_LICENSE("GPL v2"); -- 2.7.4
[PATCH V6 3/9] pinctrl: imx8mm: Support building as module
Change configuration to "tristate", add module device table, author, description and license to support building i.MX8MM pinctrl driver as module. Signed-off-by: Anson Huang --- No change. --- drivers/pinctrl/freescale/Kconfig | 2 +- drivers/pinctrl/freescale/pinctrl-imx8mm.c | 6 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/pinctrl/freescale/Kconfig b/drivers/pinctrl/freescale/Kconfig index 4ca44dd..3681c4d 100644 --- a/drivers/pinctrl/freescale/Kconfig +++ b/drivers/pinctrl/freescale/Kconfig @@ -124,7 +124,7 @@ config PINCTRL_IMX7ULP Say Y here to enable the imx7ulp pinctrl driver config PINCTRL_IMX8MM - bool "IMX8MM pinctrl driver" + tristate "IMX8MM pinctrl driver" depends on ARCH_MXC select PINCTRL_IMX help diff --git a/drivers/pinctrl/freescale/pinctrl-imx8mm.c b/drivers/pinctrl/freescale/pinctrl-imx8mm.c index 6d1038a..31c5d88 100644 --- a/drivers/pinctrl/freescale/pinctrl-imx8mm.c +++ b/drivers/pinctrl/freescale/pinctrl-imx8mm.c @@ -5,6 +5,7 @@ #include #include +#include #include #include #include @@ -326,6 +327,7 @@ static const struct of_device_id imx8mm_pinctrl_of_match[] = { { .compatible = "fsl,imx8mm-iomuxc", .data = &imx8mm_pinctrl_info, }, { /* sentinel */ } }; +MODULE_DEVICE_TABLE(of, imx8mm_pinctrl_of_match); static int imx8mm_pinctrl_probe(struct platform_device *pdev) { @@ -346,3 +348,7 @@ static int __init imx8mm_pinctrl_init(void) return platform_driver_register(&imx8mm_pinctrl_driver); } arch_initcall(imx8mm_pinctrl_init); + +MODULE_AUTHOR("Bai Ping "); +MODULE_DESCRIPTION("NXP i.MX8MM pinctrl driver"); +MODULE_LICENSE("GPL v2"); -- 2.7.4
[PATCH V6 5/9] pinctrl: imx8mq: Support building as module
Change configuration to "tristate", add module device table, author, description and license to support building i.MX8MQ pinctrl driver as module. Signed-off-by: Anson Huang --- No change. --- drivers/pinctrl/freescale/Kconfig | 2 +- drivers/pinctrl/freescale/pinctrl-imx8mq.c | 6 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/pinctrl/freescale/Kconfig b/drivers/pinctrl/freescale/Kconfig index b909719..df77e752 100644 --- a/drivers/pinctrl/freescale/Kconfig +++ b/drivers/pinctrl/freescale/Kconfig @@ -145,7 +145,7 @@ config PINCTRL_IMX8MP Say Y here to enable the imx8mp pinctrl driver config PINCTRL_IMX8MQ - bool "IMX8MQ pinctrl driver" + tristate "IMX8MQ pinctrl driver" depends on ARCH_MXC select PINCTRL_IMX help diff --git a/drivers/pinctrl/freescale/pinctrl-imx8mq.c b/drivers/pinctrl/freescale/pinctrl-imx8mq.c index 50aa1c0..ae3ea5b 100644 --- a/drivers/pinctrl/freescale/pinctrl-imx8mq.c +++ b/drivers/pinctrl/freescale/pinctrl-imx8mq.c @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include @@ -329,6 +330,7 @@ static const struct of_device_id imx8mq_pinctrl_of_match[] = { { .compatible = "fsl,imx8mq-iomuxc", .data = &imx8mq_pinctrl_info, }, { /* sentinel */ } }; +MODULE_DEVICE_TABLE(of, imx8mq_pinctrl_of_match); static int imx8mq_pinctrl_probe(struct platform_device *pdev) { @@ -350,3 +352,7 @@ static int __init imx8mq_pinctrl_init(void) return platform_driver_register(&imx8mq_pinctrl_driver); } arch_initcall(imx8mq_pinctrl_init); + +MODULE_AUTHOR("Lucas Stach "); +MODULE_DESCRIPTION("NXP i.MX8MQ pinctrl driver"); +MODULE_LICENSE("GPL v2"); -- 2.7.4
[PATCH V6 0/9] Support i.MX8 SoCs pinctrl drivers built as module
There are more and mroe requirements that SoC specific modules should be built as module in order to support generic kernel image, such as Android GKI concept. This patch series supports i.MX8 SoCs pinctrl drivers to be built as module, including i.MX8MQ/MM/MN/MP/QXP/QM/DXL SoCs, i.MX common pinctrl driver and i.MX SCU common pinctrl driver as still built-in. Compared to V5, the changes are as below: - Keep i.MX common pinctrl libary built in, ONLY i.MX SoC pinctrl driver support built as module. Anson Huang (9): pinctrl: imx: Support i.MX8 SoCs pinctrl driver built as module pinctrl: imx: scu: Support i.MX8 SCU SoCs pinctrl driver built as module pinctrl: imx8mm: Support building as module pinctrl: imx8mn: Support building as module pinctrl: imx8mq: Support building as module pinctrl: imx8mp: Support building as module pinctrl: imx8qxp: Support building as module pinctrl: imx8qm: Support building as module pinctrl: imx8dxl: Support building as module drivers/pinctrl/freescale/Kconfig | 14 +++--- drivers/pinctrl/freescale/pinctrl-imx.c | 2 ++ drivers/pinctrl/freescale/pinctrl-imx8dxl.c | 5 + drivers/pinctrl/freescale/pinctrl-imx8mm.c | 6 ++ drivers/pinctrl/freescale/pinctrl-imx8mn.c | 6 ++ drivers/pinctrl/freescale/pinctrl-imx8mp.c | 6 ++ drivers/pinctrl/freescale/pinctrl-imx8mq.c | 6 ++ drivers/pinctrl/freescale/pinctrl-imx8qm.c | 5 + drivers/pinctrl/freescale/pinctrl-imx8qxp.c | 5 + drivers/pinctrl/freescale/pinctrl-scu.c | 4 10 files changed, 52 insertions(+), 7 deletions(-) -- 2.7.4
[PATCH v2 14/14] irqchip/xilinx-intc: Fix potential resource leak
There exists potential resource leak in the error path, fix it. Fixes: 9689c99e4950 ("irqchip/xilinx: Add support for parent intc") Signed-off-by: Tiezhu Yang --- drivers/irqchip/irq-xilinx-intc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/irqchip/irq-xilinx-intc.c b/drivers/irqchip/irq-xilinx-intc.c index 1d3d273..dcc51e0 100644 --- a/drivers/irqchip/irq-xilinx-intc.c +++ b/drivers/irqchip/irq-xilinx-intc.c @@ -241,7 +241,7 @@ static int __init xilinx_intc_of_init(struct device_node *intc, } else { pr_err("irq-xilinx: interrupts property not in DT\n"); ret = -EINVAL; - goto error; + goto error_domain_remove; } } else { primary_intc = irqc; @@ -250,6 +250,8 @@ static int __init xilinx_intc_of_init(struct device_node *intc, return 0; +error_domain_remove: + irq_domain_remove(irqc->root_domain); error: iounmap(irqc->base); kfree(irqc); -- 2.1.0
[PATCH v2 09/14] irqchip/mscc-ocelot: Fix potential resource leaks
There exists potential resource leaks in the error path, fix them. Fixes: 19d99164480a ("irqchip: Add a driver for the Microsemi Ocelot controller") Signed-off-by: Tiezhu Yang --- drivers/irqchip/irq-mscc-ocelot.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/irqchip/irq-mscc-ocelot.c b/drivers/irqchip/irq-mscc-ocelot.c index 88143c0..e676ae2 100644 --- a/drivers/irqchip/irq-mscc-ocelot.c +++ b/drivers/irqchip/irq-mscc-ocelot.c @@ -73,7 +73,8 @@ static int __init ocelot_irq_init(struct device_node *node, &irq_generic_chip_ops, NULL); if (!domain) { pr_err("%pOFn: unable to add irq domain\n", node); - return -ENOMEM; + ret = -ENOMEM; + goto err_irq_dispose; } ret = irq_alloc_domain_generic_chips(domain, OCELOT_NR_IRQ, 1, @@ -109,9 +110,10 @@ static int __init ocelot_irq_init(struct device_node *node, err_gc_free: irq_free_generic_chip(gc); - err_domain_remove: irq_domain_remove(domain); +err_irq_dispose: + irq_dispose_mapping(parent_irq); return ret; } -- 2.1.0
[PATCH v2 01/14] irqchip/ath79-misc: Fix potential resource leaks
There exists potential resource leaks in the error path, fix them. Fixes: 07ba4b061a79 ("irqchip/ath79-misc: Move the MISC driver from arch/mips/ath79/") Signed-off-by: Tiezhu Yang --- drivers/irqchip/irq-ath79-misc.c | 14 +++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/drivers/irqchip/irq-ath79-misc.c b/drivers/irqchip/irq-ath79-misc.c index 3d641bb..53e0c50 100644 --- a/drivers/irqchip/irq-ath79-misc.c +++ b/drivers/irqchip/irq-ath79-misc.c @@ -133,7 +133,7 @@ static int __init ath79_misc_intc_of_init( { struct irq_domain *domain; void __iomem *base; - int irq; + int irq, ret; irq = irq_of_parse_and_map(node, 0); if (!irq) { @@ -144,18 +144,26 @@ static int __init ath79_misc_intc_of_init( base = of_iomap(node, 0); if (!base) { pr_err("Failed to get MISC IRQ registers\n"); - return -ENOMEM; + ret = -ENOMEM; + goto err_irq_dispose; } domain = irq_domain_add_linear(node, ATH79_MISC_IRQ_COUNT, &misc_irq_domain_ops, base); if (!domain) { pr_err("Failed to add MISC irqdomain\n"); - return -EINVAL; + ret = -EINVAL; + goto err_iounmap; } ath79_misc_intc_domain_init(domain, irq); return 0; + +err_iounmap: + iounmap(base); +err_irq_dispose: + irq_dispose_mapping(irq); + return ret; } static int __init ar7100_misc_intc_of_init( -- 2.1.0
[PATCH v2 00/14] irqchip: Fix potential resource leaks
When I test the irqchip code of Loongson, I read the related code of other chips in drivers/irqchip and I find some potential resource leaks in the error path, I think it is better to fix them. v2: - Split the first patch into a new patch series which includes small patches and add "Fixes" tag - Use "goto" label to handle error path in some patches Tiezhu Yang (14): irqchip/ath79-misc: Fix potential resource leaks irqchip/csky-apb-intc: Fix potential resource leaks irqchip/csky-mpintc: Fix potential resource leaks irqchip/davinci-aintc: Fix potential resource leaks irqchip/davinci-cp-intc: Fix potential resource leaks irqchip/digicolor: Fix potential resource leaks irqchip/dw-apb-ictl: Fix potential resource leaks irqchip/ls1x: Fix potential resource leaks irqchip/mscc-ocelot: Fix potential resource leaks irqchip/nvic: Fix potential resource leaks irqchip/omap-intc: Fix potential resource leak irqchip/riscv-intc: Fix potential resource leak irqchip/s3c24xx: Fix potential resource leaks irqchip/xilinx-intc: Fix potential resource leak drivers/irqchip/irq-ath79-misc.c | 14 +++--- drivers/irqchip/irq-csky-apb-intc.c | 12 ++-- drivers/irqchip/irq-csky-mpintc.c | 26 -- drivers/irqchip/irq-davinci-aintc.c | 17 + drivers/irqchip/irq-davinci-cp-intc.c | 17 ++--- drivers/irqchip/irq-digicolor.c | 14 +++--- drivers/irqchip/irq-dw-apb-ictl.c | 11 --- drivers/irqchip/irq-ls1x.c| 4 +++- drivers/irqchip/irq-mscc-ocelot.c | 6 -- drivers/irqchip/irq-nvic.c| 12 +--- drivers/irqchip/irq-omap-intc.c | 4 +++- drivers/irqchip/irq-riscv-intc.c | 1 + drivers/irqchip/irq-s3c24xx.c | 20 +++- drivers/irqchip/irq-xilinx-intc.c | 4 +++- 14 files changed, 125 insertions(+), 37 deletions(-) -- 2.1.0
[PATCH v2 10/14] irqchip/nvic: Fix potential resource leaks
There exists potential resource leaks in the error path, fix them. Fixes: 292ec080491d ("irqchip: Add support for ARMv7-M NVIC") Signed-off-by: Tiezhu Yang --- drivers/irqchip/irq-nvic.c | 12 +--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/irqchip/irq-nvic.c b/drivers/irqchip/irq-nvic.c index f747e22..cd17f5d 100644 --- a/drivers/irqchip/irq-nvic.c +++ b/drivers/irqchip/irq-nvic.c @@ -94,7 +94,8 @@ static int __init nvic_of_init(struct device_node *node, if (!nvic_irq_domain) { pr_warn("Failed to allocate irq domain\n"); - return -ENOMEM; + ret = -ENOMEM; + goto err_iounmap; } ret = irq_alloc_domain_generic_chips(nvic_irq_domain, 32, 1, @@ -102,8 +103,7 @@ static int __init nvic_of_init(struct device_node *node, clr, 0, IRQ_GC_INIT_MASK_CACHE); if (ret) { pr_warn("Failed to allocate irq chips\n"); - irq_domain_remove(nvic_irq_domain); - return ret; + goto err_domain_remove; } for (i = 0; i < numbanks; ++i) { @@ -129,5 +129,11 @@ static int __init nvic_of_init(struct device_node *node, writel_relaxed(0, nvic_base + NVIC_IPR + i); return 0; + +err_domain_remove: + irq_domain_remove(nvic_irq_domain); +err_iounmap: + iounmap(nvic_base); + return ret; } IRQCHIP_DECLARE(armv7m_nvic, "arm,armv7m-nvic", nvic_of_init); -- 2.1.0
[PATCH v2 07/14] irqchip/dw-apb-ictl: Fix potential resource leaks
There exists potential resource leaks in the error path, fix them. Fixes: 350d71b94fc9 ("irqchip: add DesignWare APB ICTL interrupt controller") Signed-off-by: Tiezhu Yang --- drivers/irqchip/irq-dw-apb-ictl.c | 11 --- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/irqchip/irq-dw-apb-ictl.c b/drivers/irqchip/irq-dw-apb-ictl.c index e4550e9..bc9b750 100644 --- a/drivers/irqchip/irq-dw-apb-ictl.c +++ b/drivers/irqchip/irq-dw-apb-ictl.c @@ -86,12 +86,13 @@ static int __init dw_apb_ictl_init(struct device_node *np, ret = of_address_to_resource(np, 0, &r); if (ret) { pr_err("%pOF: unable to get resource\n", np); - return ret; + goto err_irq_dispose; } if (!request_mem_region(r.start, resource_size(&r), np->full_name)) { pr_err("%pOF: unable to request mem region\n", np); - return -ENOMEM; + ret = -ENOMEM; + goto err_irq_dispose; } iobase = ioremap(r.start, resource_size(&r)); @@ -133,7 +134,7 @@ static int __init dw_apb_ictl_init(struct device_node *np, IRQ_GC_INIT_MASK_CACHE); if (ret) { pr_err("%pOF: unable to alloc irq domain gc\n", np); - goto err_unmap; + goto err_domain_remove; } for (i = 0; i < DIV_ROUND_UP(nrirqs, 32); i++) { @@ -150,10 +151,14 @@ static int __init dw_apb_ictl_init(struct device_node *np, return 0; +err_domain_remove: + irq_domain_remove(domain); err_unmap: iounmap(iobase); err_release: release_mem_region(r.start, resource_size(&r)); +err_irq_dispose: + irq_dispose_mapping(irq); return ret; } IRQCHIP_DECLARE(dw_apb_ictl, -- 2.1.0
[PATCH v2 13/14] irqchip/s3c24xx: Fix potential resource leaks
There exists potential resource leaks in the error path, fix them. Fixes: f0774d41da0e ("irqchip: s3c24xx: add devicetree support") Signed-off-by: Tiezhu Yang --- drivers/irqchip/irq-s3c24xx.c | 20 +++- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/drivers/irqchip/irq-s3c24xx.c b/drivers/irqchip/irq-s3c24xx.c index d2031fe..ef5d645 100644 --- a/drivers/irqchip/irq-s3c24xx.c +++ b/drivers/irqchip/irq-s3c24xx.c @@ -1239,7 +1239,8 @@ static int __init s3c_init_intc_of(struct device_node *np, &s3c24xx_irq_ops_of, NULL); if (!domain) { pr_err("irq: could not create irq-domain\n"); - return -EINVAL; + ret = -EINVAL; + goto out_iounmap; } for (i = 0; i < num_ctrl; i++) { @@ -1248,15 +1249,17 @@ static int __init s3c_init_intc_of(struct device_node *np, pr_debug("irq: found controller %s\n", ctrl->name); intc = kzalloc(sizeof(struct s3c_irq_intc), GFP_KERNEL); - if (!intc) - return -ENOMEM; + if (!intc) { + ret = -ENOMEM; + goto out_domain_remove; + } intc->domain = domain; intc->irqs = kcalloc(32, sizeof(struct s3c_irq_data), GFP_KERNEL); if (!intc->irqs) { - kfree(intc); - return -ENOMEM; + ret = -ENOMEM; + goto out_free; } if (ctrl->parent) { @@ -1285,6 +1288,13 @@ static int __init s3c_init_intc_of(struct device_node *np, set_handle_irq(s3c24xx_handle_irq); return 0; + +out_free: + kfree(intc); +out_domain_remove: + irq_domain_remove(domain); +out_iounmap: + iounmap(reg_base); } static struct s3c24xx_irq_of_ctrl s3c2410_ctrl[] = { -- 2.1.0
[PATCH v2 08/14] irqchip/ls1x: Fix potential resource leaks
There exists potential resource leaks in the error path, fix them. Fixes: 9e543e22e204 ("irqchip: Add driver for Loongson-1 interrupt controller") Signed-off-by: Tiezhu Yang --- drivers/irqchip/irq-ls1x.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/irqchip/irq-ls1x.c b/drivers/irqchip/irq-ls1x.c index 353111a..409001b 100644 --- a/drivers/irqchip/irq-ls1x.c +++ b/drivers/irqchip/irq-ls1x.c @@ -131,7 +131,7 @@ static int __init ls1x_intc_of_init(struct device_node *node, if (!priv->domain) { pr_err("ls1x-irq: cannot add IRQ domain\n"); err = -ENOMEM; - goto out_iounmap; + goto out_dispose_irq; } err = irq_alloc_domain_generic_chips(priv->domain, 32, 2, @@ -182,6 +182,8 @@ static int __init ls1x_intc_of_init(struct device_node *node, out_free_domain: irq_domain_remove(priv->domain); +out_dispose_irq: + irq_dispose_mapping(parent_irq); out_iounmap: iounmap(priv->intc_base); out_free_priv: -- 2.1.0
[PATCH v2 02/14] irqchip/csky-apb-intc: Fix potential resource leaks
There exists potential resource leaks in the error path, fix them. Fixes: edff1b4835b7 ("irqchip: add C-SKY APB bus interrupt controller") Signed-off-by: Tiezhu Yang --- drivers/irqchip/irq-csky-apb-intc.c | 12 ++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/irqchip/irq-csky-apb-intc.c b/drivers/irqchip/irq-csky-apb-intc.c index 5a2ec43..11a35eb 100644 --- a/drivers/irqchip/irq-csky-apb-intc.c +++ b/drivers/irqchip/irq-csky-apb-intc.c @@ -118,7 +118,8 @@ ck_intc_init_comm(struct device_node *node, struct device_node *parent) &irq_generic_chip_ops, NULL); if (!root_domain) { pr_err("C-SKY Intc irq_domain_add failed.\n"); - return -ENOMEM; + ret = -ENOMEM; + goto err_iounmap; } ret = irq_alloc_domain_generic_chips(root_domain, 32, 1, @@ -126,10 +127,17 @@ ck_intc_init_comm(struct device_node *node, struct device_node *parent) IRQ_NOREQUEST | IRQ_NOPROBE | IRQ_NOAUTOEN, 0, 0); if (ret) { pr_err("C-SKY Intc irq_alloc_gc failed.\n"); - return -ENOMEM; + ret = -ENOMEM; + goto err_domain_remove; } return 0; + +err_domain_remove: + irq_domain_remove(root_domain); +err_iounmap: + iounmap(reg_base); + return ret; } static inline bool handle_irq_perbit(struct pt_regs *regs, u32 hwirq, -- 2.1.0
[PATCH v2 04/14] irqchip/davinci-aintc: Fix potential resource leaks
There exists potential resource leaks in the error path, fix them. Fixes: 0145beed9d26 ("irqchip: davinci-aintc: move the driver to drivers/irqchip") Signed-off-by: Tiezhu Yang --- drivers/irqchip/irq-davinci-aintc.c | 17 + 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/drivers/irqchip/irq-davinci-aintc.c b/drivers/irqchip/irq-davinci-aintc.c index 810ccc4..12db502 100644 --- a/drivers/irqchip/irq-davinci-aintc.c +++ b/drivers/irqchip/irq-davinci-aintc.c @@ -96,7 +96,7 @@ void __init davinci_aintc_init(const struct davinci_aintc_config *config) resource_size(&config->reg)); if (!davinci_aintc_base) { pr_err("%s: unable to ioremap register range\n", __func__); - return; + goto err_release; } /* Clear all interrupt requests */ @@ -133,7 +133,7 @@ void __init davinci_aintc_init(const struct davinci_aintc_config *config) if (irq_base < 0) { pr_err("%s: unable to allocate interrupt descriptors: %d\n", __func__, irq_base); - return; + goto err_iounmap; } davinci_aintc_irq_domain = irq_domain_add_legacy(NULL, @@ -141,7 +141,7 @@ void __init davinci_aintc_init(const struct davinci_aintc_config *config) &irq_domain_simple_ops, NULL); if (!davinci_aintc_irq_domain) { pr_err("%s: unable to create interrupt domain\n", __func__); - return; + goto err_free_descs; } ret = irq_alloc_domain_generic_chips(davinci_aintc_irq_domain, 32, 1, @@ -150,7 +150,7 @@ void __init davinci_aintc_init(const struct davinci_aintc_config *config) if (ret) { pr_err("%s: unable to allocate generic irq chips for domain\n", __func__); - return; + goto err_domain_remove; } for (irq_off = 0, reg_off = 0; @@ -160,4 +160,13 @@ void __init davinci_aintc_init(const struct davinci_aintc_config *config) irq_base + irq_off, 32); set_handle_irq(davinci_aintc_handle_irq); + +err_domain_remove: + irq_domain_remove(davinci_aintc_irq_domain); +err_free_descs: + irq_free_descs(irq_base, config->num_irqs); +err_iounmap: + iounmap(davinci_aintc_base); +err_release: + release_mem_region(config->reg.start, resource_size(&config->reg)); } -- 2.1.0
[PATCH v2 12/14] irqchip/riscv-intc: Fix potential resource leak
There exists potential resource leak in the error path, fix it. Fixes: 6b7ce8927b5a ("irqchip: RISC-V per-HART local interrupt controller driver") Signed-off-by: Tiezhu Yang --- drivers/irqchip/irq-riscv-intc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/irqchip/irq-riscv-intc.c b/drivers/irqchip/irq-riscv-intc.c index a6f97fa..8d6286c 100644 --- a/drivers/irqchip/irq-riscv-intc.c +++ b/drivers/irqchip/irq-riscv-intc.c @@ -122,6 +122,7 @@ static int __init riscv_intc_init(struct device_node *node, rc = set_handle_irq(&riscv_intc_irq); if (rc) { pr_err("failed to set irq handler\n"); + irq_domain_remove(intc_domain); return rc; } -- 2.1.0
[PATCH v2 11/14] irqchip/omap-intc: Fix potential resource leak
There exists potential resource leak in the error path, fix it. Fixes: 8598066cddd1 ("arm: omap: irq: move irq.c to drivers/irqchip/") Signed-off-by: Tiezhu Yang --- drivers/irqchip/irq-omap-intc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/irqchip/irq-omap-intc.c b/drivers/irqchip/irq-omap-intc.c index d360a6e..e711530 100644 --- a/drivers/irqchip/irq-omap-intc.c +++ b/drivers/irqchip/irq-omap-intc.c @@ -254,8 +254,10 @@ static int __init omap_init_irq_of(struct device_node *node) omap_irq_soft_reset(); ret = omap_alloc_gc_of(domain, omap_irq_base); - if (ret < 0) + if (ret < 0) { irq_domain_remove(domain); + iounmap(omap_irq_base); + } return ret; } -- 2.1.0
[PATCH] [v2] media: venus: core: Fix runtime PM imbalance in venus_probe
pm_runtime_get_sync() increments the runtime PM usage counter even when it returns an error code. Thus a pairing decrement is needed on the error handling path to keep the counter balanced. For other error paths after this call, things are the same. Signed-off-by: Dinghao Liu --- Changelog: v2: - Add pm_runtime_get_noresume() on failure of pm_runtime_put_sync() to balance PM counter instead of releasing everything here. --- drivers/media/platform/qcom/venus/core.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c index 203c6538044f..b0b932bf8c02 100644 --- a/drivers/media/platform/qcom/venus/core.c +++ b/drivers/media/platform/qcom/venus/core.c @@ -287,8 +287,10 @@ static int venus_probe(struct platform_device *pdev) goto err_core_deinit; ret = pm_runtime_put_sync(dev); - if (ret) + if (ret) { + pm_runtime_get_noresume(dev); goto err_dev_unregister; + } return 0; @@ -299,6 +301,7 @@ static int venus_probe(struct platform_device *pdev) err_venus_shutdown: venus_shutdown(core); err_runtime_disable: + pm_runtime_put_noidle(dev); pm_runtime_set_suspended(dev); pm_runtime_disable(dev); hfi_destroy(core); -- 2.17.1
Re: [PATCH v3 3/5] iommu/uapi: Use named union for user data
Hi Jacob, On 2020/6/24 1:03, Jacob Pan wrote: IOMMU UAPI data size is filled by the user space which must be validated by ther kernel. To ensure backward compatibility, user data can only be extended by either re-purpose padding bytes or extend the variable sized union at the end. No size change is allowed before the union. Therefore, the minimum size is the offset of the union. To use offsetof() on the union, we must make it named. Link: https://lkml.org/lkml/2020/6/11/834 Signed-off-by: Jacob Pan --- drivers/iommu/intel/iommu.c | 24 drivers/iommu/intel/svm.c | 2 +- include/uapi/linux/iommu.h | 4 ++-- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c index 50fc62413a35..59cba214ef13 100644 --- a/drivers/iommu/intel/iommu.c +++ b/drivers/iommu/intel/iommu.c @@ -5409,8 +5409,8 @@ intel_iommu_sva_invalidate(struct iommu_domain *domain, struct device *dev, /* Size is only valid in address selective invalidation */ if (inv_info->granularity == IOMMU_INV_GRANU_ADDR) - size = to_vtd_size(inv_info->addr_info.granule_size, - inv_info->addr_info.nb_granules); + size = to_vtd_size(inv_info->granu.addr_info.granule_size, + inv_info->granu.addr_info.nb_granules); for_each_set_bit(cache_type, (unsigned long *)&inv_info->cache, @@ -5431,20 +5431,20 @@ intel_iommu_sva_invalidate(struct iommu_domain *domain, struct device *dev, * granularity. */ if (inv_info->granularity == IOMMU_INV_GRANU_PASID && - (inv_info->pasid_info.flags & IOMMU_INV_PASID_FLAGS_PASID)) - pasid = inv_info->pasid_info.pasid; + (inv_info->granu.pasid_info.flags & IOMMU_INV_PASID_FLAGS_PASID)) + pasid = inv_info->granu.pasid_info.pasid; else if (inv_info->granularity == IOMMU_INV_GRANU_ADDR && -(inv_info->addr_info.flags & IOMMU_INV_ADDR_FLAGS_PASID)) - pasid = inv_info->addr_info.pasid; +(inv_info->granu.addr_info.flags & IOMMU_INV_ADDR_FLAGS_PASID)) + pasid = inv_info->granu.addr_info.pasid; switch (BIT(cache_type)) { case IOMMU_CACHE_INV_TYPE_IOTLB: /* HW will ignore LSB bits based on address mask */ if (inv_info->granularity == IOMMU_INV_GRANU_ADDR && size && - (inv_info->addr_info.addr & ((BIT(VTD_PAGE_SHIFT + size)) - 1))) { + (inv_info->granu.addr_info.addr & ((BIT(VTD_PAGE_SHIFT + size)) - 1))) { Nit: Keep it aligned. With this tweaked, Reviewed-by: Lu Baolu Best regards, baolu WARN_ONCE(1, "Address out of range, 0x%llx, size order %llu\n", - inv_info->addr_info.addr, size); + inv_info->granu.addr_info.addr, size); } /* @@ -5452,9 +5452,9 @@ intel_iommu_sva_invalidate(struct iommu_domain *domain, struct device *dev, * We use npages = -1 to indicate that. */ qi_flush_piotlb(iommu, did, pasid, - mm_to_dma_pfn(inv_info->addr_info.addr), + mm_to_dma_pfn(inv_info->granu.addr_info.addr), (granu == QI_GRAN_NONG_PASID) ? -1 : 1 << size, - inv_info->addr_info.flags & IOMMU_INV_ADDR_FLAGS_LEAF); + inv_info->granu.addr_info.flags & IOMMU_INV_ADDR_FLAGS_LEAF); if (!info->ats_enabled) break; @@ -5475,13 +5475,13 @@ intel_iommu_sva_invalidate(struct iommu_domain *domain, struct device *dev, size = 64 - VTD_PAGE_SHIFT; addr = 0; } else if (inv_info->granularity == IOMMU_INV_GRANU_ADDR) - addr = inv_info->addr_info.addr; + addr = inv_info->granu.addr_info.addr; if (info->ats_enabled) qi_flush_dev_iotlb_pasid(iommu, sid, info->pfsid, pasid, info->ats_qdep, - inv_info->addr_info.addr, + inv_info->granu.addr_info.addr, size); else pr_warn_ratelimited("Passdown device IOTLB flush w/o ATS
[PATCH v2 5/6] powerpc/pseries/iommu: Make use of DDW even if it does not map the partition
As of today, if a DDW is created and can't map the whole partition, it's removed and the default DMA window "ibm,dma-window" is used instead. Usually this DDW is bigger than the default DMA window, so it would be better to make use of it instead. Signed-off-by: Leonardo Bras --- arch/powerpc/platforms/pseries/iommu.c | 28 +- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/arch/powerpc/platforms/pseries/iommu.c b/arch/powerpc/platforms/pseries/iommu.c index 4fcf00016fb1..2d217cda4075 100644 --- a/arch/powerpc/platforms/pseries/iommu.c +++ b/arch/powerpc/platforms/pseries/iommu.c @@ -685,7 +685,7 @@ static void pci_dma_bus_setup_pSeriesLP(struct pci_bus *bus) struct iommu_table *tbl; struct device_node *dn, *pdn; struct pci_dn *ppci; - const __be32 *dma_window = NULL; + const __be32 *dma_window = NULL, *alt_dma_window = NULL; dn = pci_bus_to_OF_node(bus); @@ -699,8 +699,13 @@ static void pci_dma_bus_setup_pSeriesLP(struct pci_bus *bus) break; } + /* If there is a DDW available, use it instead */ + alt_dma_window = of_get_property(pdn, DIRECT64_PROPNAME, NULL); + if (alt_dma_window) + dma_window = alt_dma_window; + if (dma_window == NULL) { - pr_debug(" no ibm,dma-window property !\n"); + pr_debug(" no ibm,dma-window nor linux,direct64-ddr-window-info property !\n"); return; } @@ -1166,16 +1171,19 @@ static u64 enable_ddw(struct pci_dev *dev, struct device_node *pdn) query.page_size); goto out_failed; } + /* verify the window * number of ptes will map the partition */ - /* check largest block * page size > max memory hotplug addr */ max_addr = ddw_memory_hotplug_max(); if (query.largest_available_block < (max_addr >> page_shift)) { - dev_dbg(&dev->dev, "can't map partition max 0x%llx with %llu " - "%llu-sized pages\n", max_addr, query.largest_available_block, - 1ULL << page_shift); - goto out_failed; + dev_dbg(&dev->dev, "can't map partition max 0x%llx with %llu %llu-sized pages\n", + max_addr, query.largest_available_block, + 1ULL << page_shift); + + len = order_base_2(query.largest_available_block << page_shift); + } else { + len = order_base_2(max_addr); } - len = order_base_2(max_addr); + win64 = kzalloc(sizeof(struct property), GFP_KERNEL); if (!win64) { dev_info(&dev->dev, @@ -1229,7 +1237,9 @@ static u64 enable_ddw(struct pci_dev *dev, struct device_node *pdn) list_add(&window->list, &direct_window_list); spin_unlock(&direct_window_list_lock); - dma_addr = be64_to_cpu(ddwprop->dma_base); + /* Only returns the dma_addr if DDW maps the whole partition */ + if (len == order_base_2(max_addr)) + dma_addr = be64_to_cpu(ddwprop->dma_base); goto out_unlock; out_free_window: -- 2.25.4
[PATCH v2 6/6] powerpc/pseries/iommu: Avoid errors when DDW starts at 0x00
As of today, enable_ddw() will return a non-null DMA address if the created DDW maps the whole partition. If the address is valid, iommu_bypass_supported_pSeriesLP() will consider iommu bypass enabled. This can cause some trouble if the DDW happens to start at 0x00. Instead if checking if the address is non-null, check directly if the DDW maps the whole partition, so it can bypass iommu. Signed-off-by: Leonardo Bras --- arch/powerpc/platforms/pseries/iommu.c | 17 - 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/arch/powerpc/platforms/pseries/iommu.c b/arch/powerpc/platforms/pseries/iommu.c index 2d217cda4075..967634a379b0 100644 --- a/arch/powerpc/platforms/pseries/iommu.c +++ b/arch/powerpc/platforms/pseries/iommu.c @@ -1078,7 +1078,8 @@ static void reset_dma_window(struct pci_dev *dev, struct device_node *par_dn) * * returns the dma offset for use by the direct mapped DMA code. */ -static u64 enable_ddw(struct pci_dev *dev, struct device_node *pdn) +static u64 enable_ddw(struct pci_dev *dev, struct device_node *pdn, + bool *maps_partition) { int len, ret; struct ddw_query_response query; @@ -1237,9 +1238,9 @@ static u64 enable_ddw(struct pci_dev *dev, struct device_node *pdn) list_add(&window->list, &direct_window_list); spin_unlock(&direct_window_list_lock); - /* Only returns the dma_addr if DDW maps the whole partition */ if (len == order_base_2(max_addr)) - dma_addr = be64_to_cpu(ddwprop->dma_base); + *maps_partition = true; + dma_addr = be64_to_cpu(ddwprop->dma_base); goto out_unlock; out_free_window: @@ -1324,6 +1325,7 @@ static bool iommu_bypass_supported_pSeriesLP(struct pci_dev *pdev, u64 dma_mask) { struct device_node *dn = pci_device_to_OF_node(pdev), *pdn; const __be32 *dma_window = NULL; + bool ret = false; /* only attempt to use a new window if 64-bit DMA is requested */ if (dma_mask < DMA_BIT_MASK(64)) @@ -1344,13 +1346,10 @@ static bool iommu_bypass_supported_pSeriesLP(struct pci_dev *pdev, u64 dma_mask) break; } - if (pdn && PCI_DN(pdn)) { - pdev->dev.archdata.dma_offset = enable_ddw(pdev, pdn); - if (pdev->dev.archdata.dma_offset) - return true; - } + if (pdn && PCI_DN(pdn)) + pdev->dev.archdata.dma_offset = enable_ddw(pdev, pdn, &ret); - return false; + return ret; } static int iommu_mem_notifier(struct notifier_block *nb, unsigned long action, -- 2.25.4
[PATCH v2 3/6] powerpc/pseries/iommu: Move window-removing part of remove_ddw into remove_dma_window
Move the window-removing part of remove_ddw into a new function (remove_dma_window), so it can be used to remove other DMA windows. It's useful for removing DMA windows that don't create DIRECT64_PROPNAME property, like the default DMA window from the device, which uses "ibm,dma-window". Signed-off-by: Leonardo Bras --- arch/powerpc/platforms/pseries/iommu.c | 45 +++--- 1 file changed, 27 insertions(+), 18 deletions(-) diff --git a/arch/powerpc/platforms/pseries/iommu.c b/arch/powerpc/platforms/pseries/iommu.c index 558e5441c355..a8840d9e1c35 100644 --- a/arch/powerpc/platforms/pseries/iommu.c +++ b/arch/powerpc/platforms/pseries/iommu.c @@ -776,25 +776,14 @@ static int __init disable_ddw_setup(char *str) early_param("disable_ddw", disable_ddw_setup); -static void remove_ddw(struct device_node *np, bool remove_prop) +static void remove_dma_window(struct device_node *np, u32 *ddw_avail, + struct property *win) { struct dynamic_dma_window_prop *dwp; - struct property *win64; - u32 ddw_avail[DDW_APPLICABLE_SIZE]; u64 liobn; - int ret = 0; - - ret = of_property_read_u32_array(np, "ibm,ddw-applicable", -&ddw_avail[0], DDW_APPLICABLE_SIZE); - - win64 = of_find_property(np, DIRECT64_PROPNAME, NULL); - if (!win64) - return; - - if (ret || win64->length < sizeof(*dwp)) - goto delprop; + int ret; - dwp = win64->value; + dwp = win->value; liobn = (u64)be32_to_cpu(dwp->liobn); /* clear the whole window, note the arg is in kernel pages */ @@ -816,10 +805,30 @@ static void remove_ddw(struct device_node *np, bool remove_prop) pr_debug("%pOF: successfully removed direct window: rtas returned " "%d to ibm,remove-pe-dma-window(%x) %llx\n", np, ret, ddw_avail[DDW_REMOVE_PE_DMA_WIN], liobn); +} + +static void remove_ddw(struct device_node *np, bool remove_prop) +{ + struct property *win; + u32 ddw_avail[DDW_APPLICABLE_SIZE]; + int ret = 0; + + ret = of_property_read_u32_array(np, "ibm,ddw-applicable", +&ddw_avail[0], DDW_APPLICABLE_SIZE); + if (ret) + return; + + win = of_find_property(np, DIRECT64_PROPNAME, NULL); + if (!win) + return; + + if (win->length >= sizeof(struct dynamic_dma_window_prop)) + remove_dma_window(np, ddw_avail, win); + + if (!remove_prop) + return; -delprop: - if (remove_prop) - ret = of_remove_property(np, win64); + ret = of_remove_property(np, win); if (ret) pr_warn("%pOF: failed to remove direct window property: %d\n", np, ret); -- 2.25.4
[PATCH v2 4/6] powerpc/pseries/iommu: Remove default DMA window before creating DDW
On LoPAR "DMA Window Manipulation Calls", it's recommended to remove the default DMA window for the device, before attempting to configure a DDW, in order to make the maximum resources available for the next DDW to be created. This is a requirement for some devices to use DDW, given they only allow one DMA window. If setting up a new DDW fails anywhere after the removal of this default DMA window, it's needed to restore the default DMA window. For this, an implementation of ibm,reset-pe-dma-windows rtas call is needed: Platforms supporting the DDW option starting with LoPAR level 2.7 implement ibm,ddw-extensions. The first extension available (index 2) carries the token for ibm,reset-pe-dma-windows rtas call, which is used to restore the default DMA window for a device, if it has been deleted. It does so by resetting the TCE table allocation for the PE to it's boot time value, available in "ibm,dma-window" device tree node. Signed-off-by: Leonardo Bras --- arch/powerpc/platforms/pseries/iommu.c | 70 ++ 1 file changed, 61 insertions(+), 9 deletions(-) diff --git a/arch/powerpc/platforms/pseries/iommu.c b/arch/powerpc/platforms/pseries/iommu.c index a8840d9e1c35..4fcf00016fb1 100644 --- a/arch/powerpc/platforms/pseries/iommu.c +++ b/arch/powerpc/platforms/pseries/iommu.c @@ -1029,6 +1029,39 @@ static phys_addr_t ddw_memory_hotplug_max(void) return max_addr; } +/* + * Platforms supporting the DDW option starting with LoPAR level 2.7 implement + * ibm,ddw-extensions, which carries the rtas token for + * ibm,reset-pe-dma-windows. + * That rtas-call can be used to restore the default DMA window for the device. + */ +static void reset_dma_window(struct pci_dev *dev, struct device_node *par_dn) +{ + int ret; + u32 cfg_addr, ddw_ext[DDW_EXT_RESET_DMA_WIN + 1]; + u64 buid; + struct device_node *dn; + struct pci_dn *pdn; + + ret = of_property_read_u32_array(par_dn, "ibm,ddw-extensions", +&ddw_ext[0], DDW_EXT_RESET_DMA_WIN + 1); + if (ret) + return; + + dn = pci_device_to_OF_node(dev); + pdn = PCI_DN(dn); + buid = pdn->phb->buid; + cfg_addr = ((pdn->busno << 16) | (pdn->devfn << 8)); + + ret = rtas_call(ddw_ext[DDW_EXT_RESET_DMA_WIN], 3, 1, NULL, cfg_addr, + BUID_HI(buid), BUID_LO(buid)); + if (ret) + dev_info(&dev->dev, +"ibm,reset-pe-dma-windows(%x) %x %x %x returned %d ", +ddw_ext[1], cfg_addr, BUID_HI(buid), BUID_LO(buid), +ret); +} + /* * If the PE supports dynamic dma windows, and there is space for a table * that can map all pages in a linear offset, then setup such a table, @@ -1049,8 +1082,9 @@ static u64 enable_ddw(struct pci_dev *dev, struct device_node *pdn) u64 dma_addr, max_addr; struct device_node *dn; u32 ddw_avail[DDW_APPLICABLE_SIZE]; + struct direct_window *window; - struct property *win64; + struct property *win64, *default_win = NULL, *ddw_ext = NULL; struct dynamic_dma_window_prop *ddwprop; struct failed_ddw_pdn *fpdn; @@ -1085,7 +1119,7 @@ static u64 enable_ddw(struct pci_dev *dev, struct device_node *pdn) if (ret) goto out_failed; - /* + /* * Query if there is a second window of size to map the * whole partition. Query returns number of windows, largest * block assigned to PE (partition endpoint), and two bitmasks @@ -1096,15 +1130,31 @@ static u64 enable_ddw(struct pci_dev *dev, struct device_node *pdn) if (ret != 0) goto out_failed; + /* +* If there is no window available, remove the default DMA window, +* if it's present. This will make all the resources available to the +* new DDW window. +* If anything fails after this, we need to restore it, so also check +* for extensions presence. +*/ if (query.windows_available == 0) { - /* -* no additional windows are available for this device. -* We might be able to reallocate the existing window, -* trading in for a larger page size. -*/ - dev_dbg(&dev->dev, "no free dynamic windows"); - goto out_failed; + default_win = of_find_property(pdn, "ibm,dma-window", NULL); + ddw_ext = of_find_property(pdn, "ibm,ddw-extensions", NULL); + if (default_win && ddw_ext) + remove_dma_window(pdn, ddw_avail, default_win); + + /* Query again, to check if the window is available */ + ret = query_ddw(dev, ddw_avail, &query, pdn); + if (ret != 0) + goto out_failed; + + if (query.windows_available == 0) { +
[PATCH v2 2/6] powerpc/pseries/iommu: Update call to ibm,query-pe-dma-windows
>From LoPAR level 2.8, "ibm,ddw-extensions" index 3 can make the number of outputs from "ibm,query-pe-dma-windows" go from 5 to 6. This change of output size is meant to expand the address size of largest_available_block PE TCE from 32-bit to 64-bit, which ends up shifting page_size and migration_capable. This ends up requiring the update of ddw_query_response->largest_available_block from u32 to u64, and manually assigning the values from the buffer into this struct, according to output size. Signed-off-by: Leonardo Bras --- arch/powerpc/platforms/pseries/iommu.c | 57 +- 1 file changed, 47 insertions(+), 10 deletions(-) diff --git a/arch/powerpc/platforms/pseries/iommu.c b/arch/powerpc/platforms/pseries/iommu.c index 68d2aa9c71a8..558e5441c355 100644 --- a/arch/powerpc/platforms/pseries/iommu.c +++ b/arch/powerpc/platforms/pseries/iommu.c @@ -44,6 +44,10 @@ #define DDW_REMOVE_PE_DMA_WIN 2 #define DDW_APPLICABLE_SIZE3 +#define DDW_EXT_SIZE 0 +#define DDW_EXT_RESET_DMA_WIN 1 +#define DDW_EXT_QUERY_OUT_SIZE 2 + static struct iommu_table_group *iommu_pseries_alloc_group(int node) { struct iommu_table_group *table_group; @@ -339,7 +343,7 @@ struct direct_window { /* Dynamic DMA Window support */ struct ddw_query_response { u32 windows_available; - u32 largest_available_block; + u64 largest_available_block; u32 page_size; u32 migration_capable; }; @@ -875,13 +879,29 @@ static int find_existing_ddw_windows(void) machine_arch_initcall(pseries, find_existing_ddw_windows); static int query_ddw(struct pci_dev *dev, const u32 *ddw_avail, - struct ddw_query_response *query) +struct ddw_query_response *query, +struct device_node *parent) { struct device_node *dn; struct pci_dn *pdn; - u32 cfg_addr; + u32 cfg_addr, query_out[5], ddw_ext[DDW_EXT_QUERY_OUT_SIZE + 1]; u64 buid; - int ret; + int ret, out_sz; + + /* +* From LoPAR level 2.8, "ibm,ddw-extensions" index 3 can rule how many +* output parameters ibm,query-pe-dma-windows will have, ranging from +* 5 to 6. +*/ + + ret = of_property_read_u32_array(parent, "ibm,ddw-extensions", +&ddw_ext[0], +DDW_EXT_QUERY_OUT_SIZE + 1); + if (ret && ddw_ext[DDW_EXT_SIZE] > 1 && + ddw_ext[DDW_EXT_QUERY_OUT_SIZE] == 1) + out_sz = 6; + else + out_sz = 5; /* * Get the config address and phb buid of the PE window. @@ -894,11 +914,28 @@ static int query_ddw(struct pci_dev *dev, const u32 *ddw_avail, buid = pdn->phb->buid; cfg_addr = ((pdn->busno << 16) | (pdn->devfn << 8)); - ret = rtas_call(ddw_avail[DDW_QUERY_PE_DMA_WIN], 3, 5, (u32 *)query, + ret = rtas_call(ddw_avail[DDW_QUERY_PE_DMA_WIN], 3, out_sz, query_out, cfg_addr, BUID_HI(buid), BUID_LO(buid)); - dev_info(&dev->dev, "ibm,query-pe-dma-windows(%x) %x %x %x" - " returned %d\n", ddw_avail[DDW_QUERY_PE_DMA_WIN], cfg_addr, -BUID_HI(buid), BUID_LO(buid), ret); + dev_info(&dev->dev, "ibm,query-pe-dma-windows(%x) %x %x %x returned %d\n", +ddw_avail[DDW_QUERY_PE_DMA_WIN], cfg_addr, BUID_HI(buid), +BUID_LO(buid), ret); + + switch (out_sz) { + case 5: + query->windows_available = query_out[0]; + query->largest_available_block = query_out[1]; + query->page_size = query_out[2]; + query->migration_capable = query_out[3]; + break; + case 6: + query->windows_available = query_out[0]; + query->largest_available_block = ((u64)query_out[1] << 32) | +query_out[2]; + query->page_size = query_out[3]; + query->migration_capable = query_out[4]; + break; + } + return ret; } @@ -1046,7 +1083,7 @@ static u64 enable_ddw(struct pci_dev *dev, struct device_node *pdn) * of page sizes: supported and supported for migrate-dma. */ dn = pci_device_to_OF_node(dev); - ret = query_ddw(dev, ddw_avail, &query); + ret = query_ddw(dev, ddw_avail, &query, pdn); if (ret != 0) goto out_failed; @@ -1074,7 +,7 @@ static u64 enable_ddw(struct pci_dev *dev, struct device_node *pdn) /* check largest block * page size > max memory hotplug addr */ max_addr = ddw_memory_hotplug_max(); if (query.largest_available_block < (max_addr >> page_shift)) { - dev_dbg(&dev->dev, "can't map partition max 0x%llx with %u " + dev_dbg(&dev->dev, "can't map partition max 0x%llx with %llu " "%llu-sized pag
[PATCH v2 1/6] powerpc/pseries/iommu: Create defines for operations in ibm,ddw-applicable
Create defines to help handling ibm,ddw-applicable values, avoiding confusion about the index of given operations. Signed-off-by: Leonardo Bras --- arch/powerpc/platforms/pseries/iommu.c | 40 +++--- 1 file changed, 23 insertions(+), 17 deletions(-) diff --git a/arch/powerpc/platforms/pseries/iommu.c b/arch/powerpc/platforms/pseries/iommu.c index 6d47b4a3ce39..68d2aa9c71a8 100644 --- a/arch/powerpc/platforms/pseries/iommu.c +++ b/arch/powerpc/platforms/pseries/iommu.c @@ -39,6 +39,11 @@ #include "pseries.h" +#define DDW_QUERY_PE_DMA_WIN 0 +#define DDW_CREATE_PE_DMA_WIN 1 +#define DDW_REMOVE_PE_DMA_WIN 2 +#define DDW_APPLICABLE_SIZE3 + static struct iommu_table_group *iommu_pseries_alloc_group(int node) { struct iommu_table_group *table_group; @@ -771,12 +776,12 @@ static void remove_ddw(struct device_node *np, bool remove_prop) { struct dynamic_dma_window_prop *dwp; struct property *win64; - u32 ddw_avail[3]; + u32 ddw_avail[DDW_APPLICABLE_SIZE]; u64 liobn; int ret = 0; ret = of_property_read_u32_array(np, "ibm,ddw-applicable", -&ddw_avail[0], 3); +&ddw_avail[0], DDW_APPLICABLE_SIZE); win64 = of_find_property(np, DIRECT64_PROPNAME, NULL); if (!win64) @@ -798,15 +803,15 @@ static void remove_ddw(struct device_node *np, bool remove_prop) pr_debug("%pOF successfully cleared tces in window.\n", np); - ret = rtas_call(ddw_avail[2], 1, 1, NULL, liobn); + ret = rtas_call(ddw_avail[DDW_REMOVE_PE_DMA_WIN], 1, 1, NULL, liobn); if (ret) pr_warn("%pOF: failed to remove direct window: rtas returned " "%d to ibm,remove-pe-dma-window(%x) %llx\n", - np, ret, ddw_avail[2], liobn); + np, ret, ddw_avail[DDW_REMOVE_PE_DMA_WIN], liobn); else pr_debug("%pOF: successfully removed direct window: rtas returned " "%d to ibm,remove-pe-dma-window(%x) %llx\n", - np, ret, ddw_avail[2], liobn); + np, ret, ddw_avail[DDW_REMOVE_PE_DMA_WIN], liobn); delprop: if (remove_prop) @@ -889,11 +894,11 @@ static int query_ddw(struct pci_dev *dev, const u32 *ddw_avail, buid = pdn->phb->buid; cfg_addr = ((pdn->busno << 16) | (pdn->devfn << 8)); - ret = rtas_call(ddw_avail[0], 3, 5, (u32 *)query, - cfg_addr, BUID_HI(buid), BUID_LO(buid)); + ret = rtas_call(ddw_avail[DDW_QUERY_PE_DMA_WIN], 3, 5, (u32 *)query, + cfg_addr, BUID_HI(buid), BUID_LO(buid)); dev_info(&dev->dev, "ibm,query-pe-dma-windows(%x) %x %x %x" - " returned %d\n", ddw_avail[0], cfg_addr, BUID_HI(buid), - BUID_LO(buid), ret); + " returned %d\n", ddw_avail[DDW_QUERY_PE_DMA_WIN], cfg_addr, +BUID_HI(buid), BUID_LO(buid), ret); return ret; } @@ -920,15 +925,16 @@ static int create_ddw(struct pci_dev *dev, const u32 *ddw_avail, do { /* extra outputs are LIOBN and dma-addr (hi, lo) */ - ret = rtas_call(ddw_avail[1], 5, 4, (u32 *)create, - cfg_addr, BUID_HI(buid), BUID_LO(buid), - page_shift, window_shift); + ret = rtas_call(ddw_avail[DDW_CREATE_PE_DMA_WIN], 5, 4, + (u32 *)create, cfg_addr, BUID_HI(buid), + BUID_LO(buid), page_shift, window_shift); } while (rtas_busy_delay(ret)); dev_info(&dev->dev, "ibm,create-pe-dma-window(%x) %x %x %x %x %x returned %d " - "(liobn = 0x%x starting addr = %x %x)\n", ddw_avail[1], -cfg_addr, BUID_HI(buid), BUID_LO(buid), page_shift, -window_shift, ret, create->liobn, create->addr_hi, create->addr_lo); + "(liobn = 0x%x starting addr = %x %x)\n", +ddw_avail[DDW_CREATE_PE_DMA_WIN], cfg_addr, BUID_HI(buid), +BUID_LO(buid), page_shift, window_shift, ret, create->liobn, +create->addr_hi, create->addr_lo); return ret; } @@ -996,7 +1002,7 @@ static u64 enable_ddw(struct pci_dev *dev, struct device_node *pdn) int page_shift; u64 dma_addr, max_addr; struct device_node *dn; - u32 ddw_avail[3]; + u32 ddw_avail[DDW_APPLICABLE_SIZE]; struct direct_window *window; struct property *win64; struct dynamic_dma_window_prop *ddwprop; @@ -1029,7 +1035,7 @@ static u64 enable_ddw(struct pci_dev *dev, struct device_node *pdn) * the property is actually in the parent, not the PE */ ret = of_property_read_u32_array(pdn, "ibm,ddw-applicable", -&ddw_avail
[PATCH v2 0/6] Remove default DMA window before creating DDW
There are some devices that only allow 1 DMA window to exist at a time, and in those cases, a DDW is never created to them, since the default DMA window keeps using this resource. LoPAR recommends this procedure: 1. Remove the default DMA window, 2. Query for which configs the DDW can be created, 3. Create a DDW. Patch #1: Create defines for outputs of ibm,ddw-applicable, so it's easier to identify them. Patch #2: - After LoPAR level 2.8, there is an extension that can make ibm,query-pe-dma-windows to have 6 outputs instead of 5. This changes the order of the outputs, and that can cause some trouble. - query_ddw() was updated to check how many outputs the ibm,query-pe-dma-windows is supposed to have, update the rtas_call() and deal correctly with the outputs in both cases. - This patch looks somehow unrelated to the series, but it can avoid future problems on DDW creation. Patch #3 moves the window-removing code from remove_ddw() to remove_dma_window(), creating a way to delete any DMA window, so it can be used to delete the default DMA window. Patch #4 makes use of the remove_dma_window() from patch #3 to remove the default DMA window before query_ddw(). It also implements a new rtas call to recover the default DMA window, in case anything fails after it was removed, and a DDW couldn't be created. Patch #5: Instead of destroying the created DDW if it doesn't map the whole partition, make use of it instead of the default DMA window. Patch #6: Changes the way iommu_bypass_supported_pSeriesLP() check for iommu_bypass: instead of checking the address returned by enable_ddw(), it checks a new output value that reflects if the DDW created maps the whole partition. All patches were tested into an LPAR with an Ethernet VF: 4005:01:00.0 Ethernet controller: Mellanox Technologies MT27700 Family [ConnectX-4 Virtual Function] --- Changes since v1: - Add defines for ibm,ddw-applicable and ibm,ddw-extensions outputs - Merge aux function query_ddw_out_sz() into query_ddw() - Merge reset_dma_window() patch (prev. #2) into remove default DMA window patch (#4). - Keep device_node *np name instead of using pdn in remove_*() - Rename 'device_node *pdn' into 'parent' in new functions - Rename dfl_win to default_win - Only remove the default DMA window if there is no window available in first query. - Check if default DMA window can be restored before removing it. - Fix 'unitialized use' (found by travis mpe:ci-test) - New patches #5 and #6 Special thanks for Alexey Kardashevskiy and Oliver O'Halloran for the feedback provided! Leonardo Bras (6): powerpc/pseries/iommu: Create defines for operations in ibm,ddw-applicable powerpc/pseries/iommu: Update call to ibm,query-pe-dma-windows powerpc/pseries/iommu: Move window-removing part of remove_ddw into remove_dma_window powerpc/pseries/iommu: Remove default DMA window before creating DDW powerpc/pseries/iommu: Make use of DDW even if it does not map the partition powerpc/pseries/iommu: Avoid errors when DDW starts at 0x00 arch/powerpc/platforms/pseries/iommu.c | 239 ++--- 1 file changed, 176 insertions(+), 63 deletions(-) -- 2.25.4
Re: [PATCH 2/3] nvme-pci: Add controller memory buffer supported macro
> On Tue, Jun 23, 2020 at 06:27:51PM +0200, Christoph Hellwig wrote: > > On Tue, Jun 23, 2020 at 09:24:33PM +0800, Baolin Wang wrote: > > > Introduce a new capability macro to indicate if the controller > > > supports the memory buffer or not, instead of reading the > > > NVME_REG_CMBSZ register. > > > > This is a complex issue. The CMBS bit was only added in NVMe 1.4 as > > a backwards incompatible change, as the CMB addressing scheme can lead > > Ah, right, I think I should add another version condition: > if ((ctrl->vs >= NVME_VS(1, 4, 0) && !NVME_CAP_CMBS(dev->ctrl.cap)) || > dev->cmb_size) >return; After more thinking, now we should read NVME_REG_VS register to get the controller version when using the CMBS bit in Capabilities register, there is no benefit, so I'll drop this patch. Thanks. > > to data corruption. The CMBS was added as part of the horribe hack > > that also involves the CBA field, which we'll need to see before > > using it to work around the addressing issue. At the same time we > > should also continue supporting the legacy pre-1.4 CMB with a warning > > (and may reject it if we know we run in a VM).
Re: [PATCH v2 4/6] selftests: pidfd: do not use ksft_exit_skip after ksft_set_plan
On 23/06/20 22:44, Christian Brauner wrote: >> ret = sys_pidfd_send_signal(pidfd, 0, NULL, 0); >> if (ret < 0) { >> -if (errno == ENOSYS) >> -ksft_exit_skip( >> +if (errno == ENOSYS) { >> +ksft_test_result_skip( >> "%s test: pidfd_send_signal() syscall not >> supported\n", >> test_name); > If pidfd_send_signal() is not supported, you're falling through and then > you're reporting: > > ok 5 # SKIP pidfd_send_signal check for support test: pidfd_send_signal() > syscall not supported > ok 6 pidfd_send_signal check for support test: pidfd_send_signal() syscall is > supported. Tests can be executed You're right, this needs a "return". Paolo
Re: Re: [PATCH] media: venus: core: Fix runtime PM imbalance in venus_probe
> > Could you just reorder error labels below instead of releasing > everything here? Thank you for your advice! I'll fix this in the next version of patch. Regards, Dinghao
general protection fault in qrtr_endpoint_post
Hello, syzbot found the following crash on: HEAD commit:7ae77150 Merge tag 'powerpc-5.8-1' of git://git.kernel.org.. git tree: upstream console output: https://syzkaller.appspot.com/x/log.txt?x=12c27f7910 kernel config: https://syzkaller.appspot.com/x/.config?x=d195fe572fb15312 dashboard link: https://syzkaller.appspot.com/bug?extid=03e343dbccf82a5242a2 compiler: gcc (GCC) 9.0.0 20181231 (experimental) syz repro: https://syzkaller.appspot.com/x/repro.syz?x=1715f03d10 C reproducer: https://syzkaller.appspot.com/x/repro.c?x=17dc0db610 IMPORTANT: if you fix the bug, please add the following tag to the commit: Reported-by: syzbot+03e343dbccf82a524...@syzkaller.appspotmail.com general protection fault, probably for non-canonical address 0xdc02: [#1] PREEMPT SMP KASAN KASAN: null-ptr-deref in range [0x0010-0x0017] CPU: 0 PID: 6780 Comm: syz-executor827 Not tainted 5.7.0-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 RIP: 0010:qrtr_endpoint_post+0x92/0xfa0 net/qrtr/qrtr.c:440 Code: 44 89 e6 e8 80 27 4e fe 48 85 c0 48 89 c5 0f 84 57 0e 00 00 e8 4f 7a 9e f9 48 89 da 48 b8 00 00 00 00 00 fc ff df 48 c1 ea 03 <0f> b6 04 02 48 89 da 83 e2 07 38 d0 7f 08 84 c0 0f 85 f7 0c 00 00 RSP: 0018:c900016a7c48 EFLAGS: 00010202 RAX: dc00 RBX: 0010 RCX: 86237e4b RDX: 0002 RSI: 87d55471 RDI: 888090444150 RBP: 888090444140 R08: 8880954ca340 R09: ed1011e43c5d R10: 88808f21e2e3 R11: ed1011e43c5c R12: R13: 88809a089100 R14: c900016a7eb0 R15: FS: 00a65880() GS:8880ae60() knlGS: CS: 0010 DS: ES: CR0: 80050033 CR2: 2000 CR3: 99699000 CR4: 001406f0 DR0: DR1: DR2: DR3: DR6: fffe0ff0 DR7: 0400 Call Trace: qrtr_tun_write_iter+0xf5/0x180 net/qrtr/tun.c:92 call_write_iter include/linux/fs.h:1917 [inline] new_sync_write+0x426/0x650 fs/read_write.c:484 __vfs_write+0xc9/0x100 fs/read_write.c:497 vfs_write+0x268/0x5d0 fs/read_write.c:559 ksys_write+0x12d/0x250 fs/read_write.c:612 do_syscall_64+0xf6/0x7d0 arch/x86/entry/common.c:295 entry_SYSCALL_64_after_hwframe+0x49/0xb3 RIP: 0033:0x4401b9 Code: 18 89 d0 c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 0f 83 fb 13 fc ff c3 66 2e 0f 1f 84 00 00 00 00 RSP: 002b:7fff99653dd8 EFLAGS: 0246 ORIG_RAX: 0001 RAX: ffda RBX: 004002c8 RCX: 004401b9 RDX: RSI: RDI: 0003 RBP: 006ca018 R08: R09: 004002c8 R10: R11: 0246 R12: 00401a40 R13: 00401ad0 R14: R15: Modules linked in: ---[ end trace 5199d7949b247ba3 ]--- RIP: 0010:qrtr_endpoint_post+0x92/0xfa0 net/qrtr/qrtr.c:440 Code: 44 89 e6 e8 80 27 4e fe 48 85 c0 48 89 c5 0f 84 57 0e 00 00 e8 4f 7a 9e f9 48 89 da 48 b8 00 00 00 00 00 fc ff df 48 c1 ea 03 <0f> b6 04 02 48 89 da 83 e2 07 38 d0 7f 08 84 c0 0f 85 f7 0c 00 00 RSP: 0018:c900016a7c48 EFLAGS: 00010202 RAX: dc00 RBX: 0010 RCX: 86237e4b RDX: 0002 RSI: 87d55471 RDI: 888090444150 RBP: 888090444140 R08: 8880954ca340 R09: ed1011e43c5d R10: 88808f21e2e3 R11: ed1011e43c5c R12: R13: 88809a089100 R14: c900016a7eb0 R15: FS: 00a65880() GS:8880ae60() knlGS: CS: 0010 DS: ES: CR0: 80050033 CR2: 2000 CR3: 99699000 CR4: 001406f0 DR0: DR1: DR2: DR3: DR6: fffe0ff0 DR7: 0400 --- This bug is generated by a bot. It may contain errors. See https://goo.gl/tpsmEJ for more information about syzbot. syzbot engineers can be reached at syzkal...@googlegroups.com. syzbot will keep track of this bug report. See: https://goo.gl/tpsmEJ#status for how to communicate with syzbot. syzbot can test patches for this bug, for details see: https://goo.gl/tpsmEJ#testing-patches
Re: [PATCH v4 02/10] dmaengine: Actions: Add support for S700 DMA engine
Hi Amit, On 09-06-20, 15:47, Amit Singh Tomar wrote: > @@ -372,6 +383,7 @@ static inline int owl_dma_cfg_lli(struct owl_dma_vchan > *vchan, > struct dma_slave_config *sconfig, > bool is_cyclic) > { > + struct owl_dma *od = to_owl_dma(vchan->vc.chan.device); > u32 mode, ctrlb; > > mode = OWL_DMA_MODE_PW(0); > @@ -427,14 +439,26 @@ static inline int owl_dma_cfg_lli(struct owl_dma_vchan > *vchan, > lli->hw[OWL_DMADESC_DADDR] = dst; > lli->hw[OWL_DMADESC_SRC_STRIDE] = 0; > lli->hw[OWL_DMADESC_DST_STRIDE] = 0; > - /* > - * Word starts from offset 0xC is shared between frame length > - * (max frame length is 1MB) and frame count, where first 20 > - * bits are for frame length and rest of 12 bits are for frame > - * count. > - */ > - lli->hw[OWL_DMADESC_FLEN] = len | FCNT_VAL << 20; > - lli->hw[OWL_DMADESC_CTRLB] = ctrlb; > + > + if (od->devid == S700_DMA) { > + /* Max frame length is 1MB */ > + lli->hw[OWL_DMADESC_FLEN] = len; > + /* > + * On S700, word starts from offset 0x1C is shared between > + * frame count and ctrlb, where first 12 bits are for frame > + * count and rest of 20 bits are for ctrlb. > + */ > + lli->hw[OWL_DMADESC_CTRLB] = FCNT_VAL | ctrlb; > + } else { > + /* > + * On S900, word starts from offset 0xC is shared between > + * frame length (max frame length is 1MB) and frame count, > + * where first 20 bits are for frame length and rest of > + * 12 bits are for frame count. > + */ > + lli->hw[OWL_DMADESC_FLEN] = len | FCNT_VAL << 20; > + lli->hw[OWL_DMADESC_CTRLB] = ctrlb; Unfortunately this wont scale, we will keep adding new conditions for newer SoC's! So rather than this why not encode max frame length in driver_data rather than S900_DMA/S700_DMA.. In future one can add values for newer SoC and not code above logic again. > +static const struct of_device_id owl_dma_match[] = { > + { .compatible = "actions,s900-dma", .data = (void *)S900_DMA,}, > + { .compatible = "actions,s700-dma", .data = (void *)S700_DMA,}, Is the .compatible documented, Documentation patch should come before the driver use patch in a series > static int owl_dma_probe(struct platform_device *pdev) > { > struct device_node *np = pdev->dev.of_node; > struct owl_dma *od; > int ret, i, nr_channels, nr_requests; > + const struct of_device_id *of_id = > + of_match_device(owl_dma_match, &pdev->dev); You care about driver_data rather than of_id, so using of_device_get_match_data() would be better.. > od = devm_kzalloc(&pdev->dev, sizeof(*od), GFP_KERNEL); > if (!od) > @@ -1083,6 +1116,8 @@ static int owl_dma_probe(struct platform_device *pdev) > dev_info(&pdev->dev, "dma-channels %d, dma-requests %d\n", >nr_channels, nr_requests); > > + od->devid = (enum owl_dma_id)(uintptr_t)of_id->data; Funny casts, I dont think you need uintptr_t! -- ~Vinod
Re: Re: [PATCH] media: venus: vdec: Fix runtime PM imbalance in vdec_open
Hi Stanimir, > > This patch is not applicable anymore after [1]. > > [1] 63342afea65e ("media: venus: vdec: Use pmruntime autosuspend") > Since pm_runtime_get_sync() has been removed from vdec_open(), this patch is no longer needed. Regards, Dinghao
Re: [PATCH drivers/misc 0/4] lkdtm: Various clean ups
On Tue, Jun 23, 2020 at 04:10:23PM -0700, Kees Cook wrote: > On Fri, May 29, 2020 at 01:03:43PM -0700, Kees Cook wrote: > > Hi Greg, > > > > Can you please apply these patches to your drivers/misc tree for LKDTM? > > It's mostly a collection of fixes and improvements and tweaks to the > > selftest integration. > > Friendly ping -- we're past -rc2 now. :) $ mdfrm -c ~/mail/todo/ 1970 messages in /home/gregkh/mail/todo/ You are in good company, give me some time to catch up please... thanks, greg k-h
Re: [PATCH] mm/spase: never partially remove memmap for early section
On Tue, Jun 23, 2020 at 05:18:28PM +0200, Michal Hocko wrote: >On Tue 23-06-20 17:42:58, Wei Yang wrote: >> For early sections, we assumes its memmap will never be partially >> removed. But current behavior breaks this. >> >> Let's correct it. >> >> Fixes: ba72b4c8cf60 ("mm/sparsemem: support sub-section hotplug") >> Signed-off-by: Wei Yang > >Can a user trigger this or is this a theoretical bug? Let me rewrite the changelog a little. Look forward any comments. For early sections, its memmap is handled specially even sub-section is enabled. The memmap could only be populated as a whole. Quoted from the comment of section_activate(): * The early init code does not consider partially populated * initial sections, it simply assumes that memory will never be * referenced. If we hot-add memory into such a section then we * do not need to populate the memmap and can simply reuse what * is already there. While current section_deactivate() breaks this rule. When hot-remove a sub-section, section_deactivate() would depopulate its memmap. The consequence is if we hot-add this subsection again, its memmap never get proper populated. > >> --- >> mm/sparse.c | 6 +++--- >> 1 file changed, 3 insertions(+), 3 deletions(-) >> >> diff --git a/mm/sparse.c b/mm/sparse.c >> index b2b9a3e34696..1a0069f492f5 100644 >> --- a/mm/sparse.c >> +++ b/mm/sparse.c >> @@ -825,10 +825,10 @@ static void section_deactivate(unsigned long pfn, >> unsigned long nr_pages, >> ms->section_mem_map &= ~SECTION_HAS_MEM_MAP; >> } >> >> -if (section_is_early && memmap) >> -free_map_bootmem(memmap); >> -else >> +if (!section_is_early) > >This begs a comment. > >> depopulate_section_memmap(pfn, nr_pages, altmap); >> +else if (memmap) >> +free_map_bootmem(memmap); >> >> if (empty) >> ms->section_mem_map = (unsigned long)NULL; >> -- >> 2.20.1 (Apple Git-117) >> > >-- >Michal Hocko >SUSE Labs -- Wei Yang Help you, Help me
[PATCH 5.7 000/474] 5.7.6-rc2 review
This is the start of the stable review cycle for the 5.7.6 release. There are 474 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 Fri, 26 Jun 2020 05:58:09 +. Anything received after that time might be too late. The whole patch series can be found in one patch at: https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.7.6-rc2.gz or in the git tree and branch at: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-5.7.y and the diffstat can be found below. thanks, greg k-h - Pseudo-Shortlog of commits: Greg Kroah-Hartman Linux 5.7.6-rc2 Jon Derrick iommu/vt-d: Remove real DMA lookup in find_domain Ahmed S. Darwish net: core: device_rename: Use rwsem instead of a seqcount Alexander Sverdlin net: octeon: mgmt: Repair filling of RX ring Chen Yu e1000e: Do not wake up the system via WOL if device wakeup is disabled Nicholas Piggin powerpc/64s: Fix KVM interrupt using wrong save area Jiri Olsa kretprobe: Prevent triggering kretprobe from within kprobe_flush_task Masami Hiramatsu kprobes: Fix to protect kick_kprobe_optimizer() by kprobe_mutex Stefano Brivio netfilter: nft_set_pipapo: Disable preemption before getting per-CPU pointer Stefano Brivio netfilter: nft_set_rbtree: Don't account for expired elements on insertion Kefeng Wang sample-trace-array: Fix sleeping function called from invalid context Kefeng Wang sample-trace-array: Remove trace_array 'sample-instance' Masami Hiramatsu tools/bootconfig: Fix to return 0 if succeeded to show the bootconfig Masami Hiramatsu tools/bootconfig: Fix to use correct quotes for value Masami Hiramatsu proc/bootconfig: Fix to use correct quotes for value Vamshi K Sthambamkadi tracing/probe: Fix memleak in fetch_op_data operations Steven Rostedt (VMware) tracing: Make ftrace packed events have align of 1 Eric Biggers crypto: algboss - don't wait during notifier callback Herbert Xu crypto: algif_skcipher - Cap recv SG list at ctx->used Swathi Dhanavanthri drm/i915/tgl: Make Wa_14010229206 permanent Harry Wentland Revert "drm/amd/display: disable dcn20 abm feature for bring up" Chris Wilson drm/i915/gt: Move gen4 GT workarounds from init_clock_gating to workarounds Chris Wilson drm/i915/gt: Move vlv GT workarounds from init_clock_gating to workarounds Chris Wilson drm/i915/gt: Move ilk GT workarounds from init_clock_gating to workarounds Chris Wilson drm/i915/gt: Move snb GT workarounds from init_clock_gating to workarounds Chris Wilson drm/i915/gt: Move ivb GT workarounds from init_clock_gating to workarounds Chris Wilson drm/i915/gt: Move hsw GT workarounds from init_clock_gating to workarounds Chris Wilson drm/i915/gt: Incrementally check for rewinding Khaled Almahallawy drm/i915/tc: fix the reset of ln0 Imre Deak drm/i915/icl+: Fix hotplug interrupt disabling after storm detection Denis Efremov drm/amd/display: Use kvfree() to free coeff in build_regamma() Lorenz Brun drm/amdkfd: Use correct major in devcgroup check Jeykumar Sankaran drm/connector: notify userspace on hotplug after register complete Chris Wilson drm/i915: Whitelist context-local timestamp in the gen9 cmdparser Chris Wilson drm/i915/gem: Avoid iterating an empty list Jordan Crouse drm/msm: Check for powered down HW in the devfreq callbacks Imre Deak drm/i915: Fix AUX power domain toggling across TypeC mode resets Dmitry V. Levin s390: fix syscall_get_error for compat processes Eric Biggers f2fs: avoid utf8_strncasecmp() with unstable name Eric Biggers f2fs: split f2fs_d_compare() from f2fs_match_name() Denis Efremov net/mlx5: DR, Fix freeing in dr_create_rc_qp() Lyude Paul drm/dp_mst: Increase ACT retry timeout to 3s Theodore Ts'o ext4: avoid race conditions when remounting with options that change dax Xiaoguang Wang io_uring: fix possible race condition against REQ_F_NEED_CLEANUP Jens Axboe io_uring: reap poll completions while waiting for refs to drop on exit Jens Axboe io_uring: acquire 'mm' for task_work for SQPOLL Xiaoguang Wang io_uring: add memory barrier to synchronize io_kiocb's result and iopoll_completed Xiaoguang Wang io_uring: don't fail links for EAGAIN error in IOPOLL mode Xiaoguang Wang io_uring: fix io_kiocb.flags modification race in IOPOLL mode Thomas Zimmermann drm/ast: Don't check new mode if CRTC is being disabled Tom Rix selinux: fix undefined return of cond_evaluate_expr Tom Rix selinux: fix a double free in cond_read_node()/cond_read_list() Tom Rix selinux: fix double free Sandeep Raghuraman drm/amdgpu: Replace invalid device ID with a valid device ID Alex Deucher
[PATCH 4.14 000/135] 4.14.186-rc2 review
This is the start of the stable review cycle for the 4.14.186 release. There are 135 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 Fri, 26 Jun 2020 05:58:15 +. 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/v4.x/stable-review/patch-4.14.186-rc2.gz or in the git tree and branch at: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-4.14.y and the diffstat can be found below. thanks, greg k-h - Pseudo-Shortlog of commits: Greg Kroah-Hartman Linux 4.14.186-rc2 Ahmed S. Darwish net: core: device_rename: Use rwsem instead of a seqcount Thomas Gleixner sched/rt, net: Use CONFIG_PREEMPTION.patch Jiri Olsa kretprobe: Prevent triggering kretprobe from within kprobe_flush_task Chen Yu e1000e: Do not wake up the system via WOL if device wakeup is disabled Masami Hiramatsu kprobes: Fix to protect kick_kprobe_optimizer() by kprobe_mutex Eric Biggers crypto: algboss - don't wait during notifier callback Herbert Xu crypto: algif_skcipher - Cap recv SG list at ctx->used Miquel Raynal mtd: rawnand: tmio: Fix the probe error path Miquel Raynal mtd: rawnand: mtk: Fix the probe error path Miquel Raynal mtd: rawnand: plat_nand: Fix the probe error path Miquel Raynal mtd: rawnand: socrates: Fix the probe error path Miquel Raynal mtd: rawnand: oxnas: Fix the probe error path Nishka Dasgupta mtd: rawnand: oxnas: Add of_node_put() Miquel Raynal mtd: rawnand: orion: Fix the probe error path Miquel Raynal mtd: rawnand: xway: Fix the probe error path Miquel Raynal mtd: rawnand: sharpsl: Fix the probe error path Miquel Raynal mtd: rawnand: diskonchip: Fix the probe error path Boris Brezillon mtd: rawnand: Pass a nand_chip object to nand_release() Ahmed S. Darwish block: nr_sects_write(): Disable preemption on seqcount write Ard Biesheuvel x86/boot/compressed: Relax sed symbol type regex for LLVM ld.lld Lyude Paul drm/dp_mst: Increase ACT retry timeout to 3s Jeffle Xu ext4: fix partial cluster initialization when splitting extent Tom Rix selinux: fix double free Huacai Chen drm/qxl: Use correct notify port address when creating cursor ring Lyude Paul drm/dp_mst: Reformat drm_dp_check_act_status() a bit Wolfram Sang drm: encoder_slave: fix refcouting error for modules Kai-Heng Feng libata: Use per port sync for detach Will Deacon arm64: hw_breakpoint: Don't invoke overflow handler on uaccess watchpoints Jason Yan block: Fix use-after-free in blkdev_get() Zhiqiang Liu bcache: fix potential deadlock problem in btree_gc_coalesce Gaurav Singh perf report: Fix NULL pointer dereference in hists__fprintf_nr_sample_events() Qais Yousef usb/ehci-platform: Set PM runtime as active on resume Qais Yousef usb/xhci-plat: Set PM runtime as active on resume Christophe JAILLET scsi: acornscsi: Fix an error handling path in acornscsi_probe() Jernej Skrabec drm/sun4i: hdmi ddc clk: Fix size of m divider tannerlove selftests/net: in timestamping, strncpy needs to preserve null byte Bob Peterson gfs2: fix use-after-free on transaction ail lists Chaitanya Kulkarni blktrace: fix endianness for blk_log_remap() Chaitanya Kulkarni blktrace: fix endianness in get_pdu_int() Chaitanya Kulkarni blktrace: use errno instead of bi_status Ram Pai selftests/vm/pkeys: fix alloc_random_pkey() to make it really random Nick Desaulniers elfnote: mark all .note sections SHF_ALLOC Arnd Bergmann include/linux/bitops.h: avoid clang shift-count-overflow warnings Jann Horn lib/zlib: remove outdated and incorrect pre-increment optimization Jiri Benc geneve: change from tx_error to tx_dropped on missing metadata Tero Kristo crypto: omap-sham - add proper load balancing support for multicore Christophe JAILLET pinctrl: freescale: imx: Fix an error handling path in 'imx_pinctrl_probe()' Christophe JAILLET pinctrl: imxl: Fix an error handling path in 'imx1_pinctrl_core_probe()' Can Guo scsi: ufs: Don't update urgent bkops level when toggling auto bkops Qiushi Wu scsi: iscsi: Fix reference count leak in iscsi_boot_create_kobj Bob Peterson gfs2: Allow lock_nolock mount to specify jid=X Stafford Horne openrisc: Fix issue with argument clobbering for clone/fork Qiushi Wu vfio/mdev: Fix reference count leak in add_mdev_supported_type Xiyu Yang ASoC: fsl_asrc_dma: Fix dma_chan leak when config DMA channel failed Christophe JAILLET extcon: adc-jack: Fix an error handling path in 'adc_jack_probe()' huhai powerpc/4xx: Don't unmap NULL mbase Olga Kornievskaia NFSv4.1 f
[PATCH 5.4 000/311] 5.4.49-rc2 review
This is the start of the stable review cycle for the 5.4.49 release. There are 311 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 Fri, 26 Jun 2020 05:58:23 +. 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.4.49-rc2.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.4.y and the diffstat can be found below. thanks, greg k-h - Pseudo-Shortlog of commits: Greg Kroah-Hartman Linux 5.4.49-rc2 Ahmed S. Darwish net: core: device_rename: Use rwsem instead of a seqcount Thomas Gleixner sched/rt, net: Use CONFIG_PREEMPTION.patch Paul Cercueil pwm: jz4740: Enhance precision in calculation of duty cycle Alexander Sverdlin net: octeon: mgmt: Repair filling of RX ring Chen Yu e1000e: Do not wake up the system via WOL if device wakeup is disabled Jiri Olsa kretprobe: Prevent triggering kretprobe from within kprobe_flush_task Masami Hiramatsu kprobes: Fix to protect kick_kprobe_optimizer() by kprobe_mutex Vamshi K Sthambamkadi tracing/probe: Fix memleak in fetch_op_data operations Eric Biggers crypto: algboss - don't wait during notifier callback Herbert Xu crypto: algif_skcipher - Cap recv SG list at ctx->used Harry Wentland Revert "drm/amd/display: disable dcn20 abm feature for bring up" Imre Deak drm/i915/icl+: Fix hotplug interrupt disabling after storm detection Denis Efremov drm/amd/display: Use kvfree() to free coeff in build_regamma() Jeykumar Sankaran drm/connector: notify userspace on hotplug after register complete Chris Wilson drm/i915: Whitelist context-local timestamp in the gen9 cmdparser Chris Wilson drm/i915/gem: Avoid iterating an empty list Jordan Crouse drm/msm: Check for powered down HW in the devfreq callbacks Imre Deak drm/i915: Fix AUX power domain toggling across TypeC mode resets Dmitry V. Levin s390: fix syscall_get_error for compat processes Eric Biggers f2fs: avoid utf8_strncasecmp() with unstable name Eric Biggers f2fs: split f2fs_d_compare() from f2fs_match_name() Denis Efremov net/mlx5: DR, Fix freeing in dr_create_rc_qp() Ahmed S. Darwish block: nr_sects_write(): Disable preemption on seqcount write Ard Biesheuvel x86/boot/compressed: Relax sed symbol type regex for LLVM ld.lld Ville Syrjälä drm/amd/display: Use swap() where appropriate Lyude Paul drm/dp_mst: Increase ACT retry timeout to 3s Theodore Ts'o ext4: avoid race conditions when remounting with options that change dax zhangyi (F) jbd2: clean __jbd2_journal_abort_hard() and __journal_abort_soft() Tom Rix selinux: fix double free Sandeep Raghuraman drm/amdgpu: Replace invalid device ID with a valid device ID Huacai Chen drm/qxl: Use correct notify port address when creating cursor ring Lyude Paul drm/dp_mst: Reformat drm_dp_check_act_status() a bit Eric Biggers ext4: avoid utf8_strncasecmp() with unstable name Jeffle Xu ext4: fix partial cluster initialization when splitting extent Wolfram Sang drm: encoder_slave: fix refcouting error for modules Kai-Heng Feng libata: Use per port sync for detach Will Deacon arm64: hw_breakpoint: Don't invoke overflow handler on uaccess watchpoints Sven Auhagen mvpp2: remove module bugfix Jason Yan block: Fix use-after-free in blkdev_get() Dinghao Liu scsi: ufs-bsg: Fix runtime PM imbalance on error Vasundhara Volam bnxt_en: Return from timer if interface is not in open state. David Howells afs: Fix the mapping of the UAEOVERFLOW abort code David Howells afs: Set error flag rather than return error from file status decode David Howells afs: Always include dir in bulk status fetch from afs_do_lookup() David Howells afs: Fix EOF corruption David Howells afs: afs_write_end() should change i_size under the right lock David Howells afs: Fix non-setting of mtime when writing into mmap Aneesh Kumar K.V powerpc: Fix kernel crash in show_instructions() w/DEBUG_VIRTUAL Zhiqiang Liu bcache: fix potential deadlock problem in btree_gc_coalesce yangerkun ext4: stop overwrite the errcode in ext4_setup_super Hongbo Yao perf stat: Fix NULL pointer dereference Gaurav Singh perf report: Fix NULL pointer dereference in hists__fprintf_nr_sample_events() Qais Yousef usb/ehci-platform: Set PM runtime as active on resume Yoshihiro Shimoda usb: host: ehci-platform: add a quirk to avoid stuck Qais Yousef usb/xhci-plat: Set PM runtime as active on resume Andrey Ignatov bpf: Fix memlock accounting for sock_hash Brett Creeley iavf: fix s
[PATCH 4.19 000/203] 4.19.130-rc2 review
This is the start of the stable review cycle for the 4.19.130 release. There are 203 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 Fri, 26 Jun 2020 05:58:19 +. 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/v4.x/stable-review/patch-4.19.130-rc2.gz or in the git tree and branch at: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-4.19.y and the diffstat can be found below. thanks, greg k-h - Pseudo-Shortlog of commits: Greg Kroah-Hartman Linux 4.19.130-rc2 Vladimir Oltean Revert "dpaa_eth: fix usage as DSA master, try 3" Ahmed S. Darwish net: core: device_rename: Use rwsem instead of a seqcount Thomas Gleixner sched/rt, net: Use CONFIG_PREEMPTION.patch Jiri Olsa kretprobe: Prevent triggering kretprobe from within kprobe_flush_task Alexander Sverdlin net: octeon: mgmt: Repair filling of RX ring Chen Yu e1000e: Do not wake up the system via WOL if device wakeup is disabled Masami Hiramatsu kprobes: Fix to protect kick_kprobe_optimizer() by kprobe_mutex Eric Biggers crypto: algboss - don't wait during notifier callback Herbert Xu crypto: algif_skcipher - Cap recv SG list at ctx->used Imre Deak drm/i915/icl+: Fix hotplug interrupt disabling after storm detection Chris Wilson drm/i915: Whitelist context-local timestamp in the gen9 cmdparser Dmitry V. Levin s390: fix syscall_get_error for compat processes Miquel Raynal mtd: rawnand: tmio: Fix the probe error path Miquel Raynal mtd: rawnand: mtk: Fix the probe error path Miquel Raynal mtd: rawnand: plat_nand: Fix the probe error path Miquel Raynal mtd: rawnand: socrates: Fix the probe error path Miquel Raynal mtd: rawnand: oxnas: Fix the probe error path Nishka Dasgupta mtd: rawnand: oxnas: Add of_node_put() Miquel Raynal mtd: rawnand: orion: Fix the probe error path Miquel Raynal mtd: rawnand: xway: Fix the probe error path Miquel Raynal mtd: rawnand: sharpsl: Fix the probe error path Miquel Raynal mtd: rawnand: diskonchip: Fix the probe error path Boris Brezillon mtd: rawnand: Pass a nand_chip object to nand_release() Boris Brezillon mtd: rawnand: Pass a nand_chip object to nand_scan() Ahmed S. Darwish block: nr_sects_write(): Disable preemption on seqcount write Ard Biesheuvel x86/boot/compressed: Relax sed symbol type regex for LLVM ld.lld Lyude Paul drm/dp_mst: Increase ACT retry timeout to 3s Theodore Ts'o ext4: avoid race conditions when remounting with options that change dax Sasha Levin ext4: fix partial cluster initialization when splitting extent Tom Rix selinux: fix double free Sandeep Raghuraman drm/amdgpu: Replace invalid device ID with a valid device ID Huacai Chen drm/qxl: Use correct notify port address when creating cursor ring Lyude Paul drm/dp_mst: Reformat drm_dp_check_act_status() a bit Wolfram Sang drm: encoder_slave: fix refcouting error for modules Kai-Heng Feng libata: Use per port sync for detach Will Deacon arm64: hw_breakpoint: Don't invoke overflow handler on uaccess watchpoints Jason Yan block: Fix use-after-free in blkdev_get() David Howells afs: afs_write_end() should change i_size under the right lock David Howells afs: Fix non-setting of mtime when writing into mmap Zhiqiang Liu bcache: fix potential deadlock problem in btree_gc_coalesce yangerkun ext4: stop overwrite the errcode in ext4_setup_super Gaurav Singh perf report: Fix NULL pointer dereference in hists__fprintf_nr_sample_events() Qais Yousef usb/ehci-platform: Set PM runtime as active on resume Yoshihiro Shimoda usb: host: ehci-platform: add a quirk to avoid stuck Qais Yousef usb/xhci-plat: Set PM runtime as active on resume Li RongQing xdp: Fix xsk_generic_xmit errno YiFei Zhu net/filter: Permit reading NET in load_bytes_relative when MAC not set Vitaly Kuznetsov x86/idt: Keep spurious entries unset in system_vectors Christophe JAILLET scsi: acornscsi: Fix an error handling path in acornscsi_probe() Jernej Skrabec drm/sun4i: hdmi ddc clk: Fix size of m divider Hans de Goede ASoC: rt5645: Add platform-data for Asus T101HA Hans de Goede ASoC: Intel: bytcr_rt5640: Add quirk for Toshiba Encore WT10-A tablet Bard Liao ASoC: core: only convert non DPCM link to DPCM link Zhihao Cheng afs: Fix memory leak in afs_put_sysnames() tannerlove selftests/net: in timestamping, strncpy needs to preserve null byte Shaokun Zhang drivers/perf: hisi: Fix wrong value for all counters enable Logan Gunthorpe NTB: ntb_test: Fix bug when counting remote files Loga
Re: [PATCH] dmaengine: ti: k3-udma: add missing put_device() call in of_xudma_dev_get()
On 18-06-20, 21:01, Yu Kuai wrote: > if of_find_device_by_node() succeed and platform_get_drvdata() failed, > of_xudma_dev_get() will return without put_device(), which will leak > the memory. Applied, thanks -- ~Vinod
Re: [PATCH v9 4/4] ext4: Use generic casefolding support
On Tue, Jun 23, 2020 at 09:33:41PM -0700, Daniel Rosenberg wrote: > This switches ext4 over to the generic support provided in > commit 5f829feca774 ("fs: Add standard casefolding support") Commit IDs aren't determined until the patches are applied. It's possible for the person applying the patches to fix them, but in general people will forget, so it's better not to include non-stable commit IDs. Also, a sentence explaining *why* this change is good would be helpful. Commit messages should always have a *why* unless it's obvious. Likewise for the f2fs commit. - Eric
Re: [PATCH v9 2/4] fs: Add standard casefolding support
On Tue, Jun 23, 2020 at 09:33:39PM -0700, Daniel Rosenberg wrote: > This adds general supporting functions for filesystems that use > utf8 casefolding. It provides standard dentry_operations and adds the > necessary structures in struct super_block to allow this standardization. > > Ext4 and F2fs will switch to these common implementations. > > Signed-off-by: Daniel Rosenberg > --- > fs/libfs.c | 101 + > include/linux/fs.h | 22 ++ > 2 files changed, 123 insertions(+) > > diff --git a/fs/libfs.c b/fs/libfs.c > index 4d08edf19c782..f7345a5ed562f 100644 > --- a/fs/libfs.c > +++ b/fs/libfs.c > @@ -20,6 +20,8 @@ > #include > #include > #include > +#include > +#include > > #include > > @@ -1363,3 +1365,102 @@ bool is_empty_dir_inode(struct inode *inode) > return (inode->i_fop == &empty_dir_operations) && > (inode->i_op == &empty_dir_inode_operations); > } > + > +#ifdef CONFIG_UNICODE > +/** > + * needs_casefold - generic helper to determine if a filename should be > casefolded > + * @dir: Parent directory > + * > + * Generic helper for filesystems to use to determine if the name of a dentry > + * should be casefolded. It does not make sense to casefold the no-key token > of > + * an encrypted filename. > + * > + * Return: if names will need casefolding > + */ > +bool needs_casefold(const struct inode *dir) > +{ > + return IS_CASEFOLDED(dir) && dir->i_sb->s_encoding && > + (!IS_ENCRYPTED(dir) || fscrypt_has_encryption_key(dir)); > +} > +EXPORT_SYMBOL(needs_casefold); Note that the '!IS_ENCRYPTED(dir) || fscrypt_has_encryption_key(dir)' check can be racy, because a process can be looking up a no-key token in a directory while concurrently another process initializes the directory's ->i_crypt_info, causing fscrypt_has_encryption_key(dir) to suddenly start returning true. In my rework of filename handling in f2fs, I actually ended up removing all calls to needs_casefold(), thus avoiding this race. f2fs now decides whether the name is going to need casefolding early on, in __f2fs_setup_filename(), where it knows in a race-free way whether the filename is a no-key token or not. Perhaps ext4 should work the same way? It did look like there would be some extra complexity due to how the ext4 directory hashing works in comparison to f2fs's, but I haven't had a chance to properly investigate it. - Eric
Re: [PATCH][next] dmaengine: hisilicon: Use struct_size() in devm_kzalloc()
On 17-06-20, 16:11, Gustavo A. R. Silva wrote: > Make use of the struct_size() helper instead of an open-coded version > in order to avoid any potential type mistakes. > > This code was detected with the help of Coccinelle and, audited and > fixed manually. Applied, thanks -- ~Vinod
Re: [PATCH][next] dmaengine: ti: k3-udma: Use struct_size() in kzalloc()
On Wed, 2020-06-24 at 11:25 +0530, Vinod Koul wrote: > On 19-06-20, 17:43, Gustavo A. R. Silva wrote: > > Make use of the struct_size() helper instead of an open-coded version > > in order to avoid any potential type mistakes. > > > > This code was detected with the help of Coccinelle and, audited and > > fixed manually. > > > > Addresses-KSPP-ID: https://github.com/KSPP/linux/issues/83 Is this odd tag really useful? > > Signed-off-by: Gustavo A. R. Silva > > --- > > drivers/dma/ti/k3-udma.c | 4 ++-- > > 1 file changed, 2 insertions(+), 2 deletions(-) > > > > diff --git a/drivers/dma/ti/k3-udma.c b/drivers/dma/ti/k3-udma.c > > index 0d5fb154b8e2..411c54b86ba8 100644 > > --- a/drivers/dma/ti/k3-udma.c > > +++ b/drivers/dma/ti/k3-udma.c > > @@ -2209,7 +2209,7 @@ udma_prep_slave_sg_pkt(struct udma_chan *uc, struct > > scatterlist *sgl, > > u32 ring_id; > > unsigned int i; > > > > - d = kzalloc(sizeof(*d) + sglen * sizeof(d->hwdesc[0]), GFP_NOWAIT); > > + d = kzalloc(struct_size(d, hwdesc, sglen), GFP_NOWAIT); > > struct_size() is a * b + c but here we need, a + b * c.. the trailing > struct is N times here.. > > > > if (!d) > > return NULL; > > > > @@ -2525,7 +2525,7 @@ udma_prep_dma_cyclic_pkt(struct udma_chan *uc, > > dma_addr_t buf_addr, > > if (period_len >= SZ_4M) > > return NULL; > > > > - d = kzalloc(sizeof(*d) + periods * sizeof(d->hwdesc[0]), GFP_NOWAIT); > > + d = kzalloc(struct_size(d, hwdesc, periods), GFP_NOWAIT); > > if (!d) > > return NULL; > > > > -- > > 2.27.0
Re: [PATCH v12 00/10] Introduce support for guest CET feature
On Tue, Jun 23, 2020 at 11:39:19AM -0700, Sean Christopherson wrote: > On Thu, Jun 11, 2020 at 09:29:13AM +0800, Yang Weijiang wrote: > > On Wed, Jun 10, 2020 at 09:56:36AM -0700, Sean Christopherson wrote: > > > On Wed, May 06, 2020 at 04:20:59PM +0800, Yang Weijiang wrote: > > > > Several parts in KVM have been updated to provide VM CET support, > > > > including: > > > > CPUID/XSAVES config, MSR pass-through, user space MSR access interface, > > > > vmentry/vmexit config, nested VM etc. These patches have dependency on > > > > CET > > > > kernel patches for xsaves support and CET definitions, e.g., MSR and > > > > related > > > > feature flags. > > > > > > Other than the MSR and cpufeatures flags definitions, is there any direct > > > dependency on kernel CET support? I.e. if/when XSAVES support is merged, > > > is there anything beyond the architectural definitions that are required > > > to > > > merge KVM CET virtualization? > > No, KVM CET patches only depend on kernel CET related definitions and > > XSAVES > > support now. > > Neato. > > > But to make guest CET work, we need CET patches for QEMU. > > Ya, but we don't need to wait for host kernel support, which was the crux of > my question. > > > Can you please respin this series with the CET definition patches included? > The XSAVES support has been queued to tip/x86/fpu. Assuming that lands in > kernel 5.9, I _think_ KVM support for CET can land in 5.10. Sure. Besides this change and the unrestricted guest case change, any other changes I should do to v12 patch? Thanks for review! > > Base your series on kvm/queue, i.e. don't worry about the XSAVES patches, > I'll merge them in from tip/x86/fpu for testing. > > Thanks!
Re: [PATCH 5.4 000/314] 5.4.49-rc1 review
On Tue, Jun 23, 2020 at 09:14:21PM -0700, Nathan Chancellor wrote: > On Tue, Jun 23, 2020 at 09:53:15PM +0200, Greg Kroah-Hartman wrote: > > This is the start of the stable review cycle for the 5.4.49 release. > > There are 314 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, 25 Jun 2020 19:52:30 +. > > 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.4.49-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.4.y > > and the diffstat can be found below. > > > > thanks, > > > > greg k-h > > I ran this through my LLVM build tests and saw no regressions compared > to 5.4.47. Great, thanks for testing! greg k-h
Re: [PATCH][next] dmaengine: ti: k3-udma: Use struct_size() in kzalloc()
On 19-06-20, 17:43, Gustavo A. R. Silva wrote: > Make use of the struct_size() helper instead of an open-coded version > in order to avoid any potential type mistakes. > > This code was detected with the help of Coccinelle and, audited and > fixed manually. > > Addresses-KSPP-ID: https://github.com/KSPP/linux/issues/83 > Signed-off-by: Gustavo A. R. Silva > --- > drivers/dma/ti/k3-udma.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/dma/ti/k3-udma.c b/drivers/dma/ti/k3-udma.c > index 0d5fb154b8e2..411c54b86ba8 100644 > --- a/drivers/dma/ti/k3-udma.c > +++ b/drivers/dma/ti/k3-udma.c > @@ -2209,7 +2209,7 @@ udma_prep_slave_sg_pkt(struct udma_chan *uc, struct > scatterlist *sgl, > u32 ring_id; > unsigned int i; > > - d = kzalloc(sizeof(*d) + sglen * sizeof(d->hwdesc[0]), GFP_NOWAIT); > + d = kzalloc(struct_size(d, hwdesc, sglen), GFP_NOWAIT); struct_size() is a * b + c but here we need, a + b * c.. the trailing struct is N times here.. > if (!d) > return NULL; > > @@ -2525,7 +2525,7 @@ udma_prep_dma_cyclic_pkt(struct udma_chan *uc, > dma_addr_t buf_addr, > if (period_len >= SZ_4M) > return NULL; > > - d = kzalloc(sizeof(*d) + periods * sizeof(d->hwdesc[0]), GFP_NOWAIT); > + d = kzalloc(struct_size(d, hwdesc, periods), GFP_NOWAIT); > if (!d) > return NULL; > > -- > 2.27.0 -- ~Vinod
Re: [PATCH 5.4 000/314] 5.4.49-rc1 review
On Tue, Jun 23, 2020 at 10:05:35PM -0700, Guenter Roeck wrote: > On 6/23/20 12:53 PM, Greg Kroah-Hartman wrote: > > This is the start of the stable review cycle for the 5.4.49 release. > > There are 314 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, 25 Jun 2020 19:52:30 +. > > Anything received after that time might be too late. > > > > [ ... ] > > > Christophe JAILLET > > pinctrl: freescale: imx: Use 'devm_of_iomap()' to avoid a resource leak > > in case of error in 'imx_pinctrl_probe()' > > > This patch has since been reverted in the upstream kernel (commit > 13f2d25b951f) > and needs to be dropped. Now dropped, thanks. greg k-h
Re: [PATCH 5.7 000/477] 5.7.6-rc1 review
On Tue, Jun 23, 2020 at 10:07:08PM -0700, Guenter Roeck wrote: > On 6/23/20 12:49 PM, Greg Kroah-Hartman wrote: > > This is the start of the stable review cycle for the 5.7.6 release. > > There are 477 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, 25 Jun 2020 19:52:30 +. > > Anything received after that time might be too late. > > > [ ... ] > > Christophe JAILLET > > pinctrl: freescale: imx: Use 'devm_of_iomap()' to avoid a resource leak > > in case of error in 'imx_pinctrl_probe()' > > > This patch has since been reverted in the upstream kernel (commit > 13f2d25b951f) > and needs to be dropped. Now dropped, thanks. greg k-h
Re: [PATCH 5.7 318/477] pinctrl: freescale: imx: Use devm_of_iomap() to avoid a resource leak in case of error in imx_pinctrl_probe()
On Wed, Jun 24, 2020 at 07:05:05AM +0200, Marion & Christophe JAILLET wrote: > Hi, > > This one must NOT be included. It generates a regression. > This should be removed from 5.4 as well. > > See 13f2d25b951f139064ec2dd53c0c7ebdf8d8007e. > > There is also a thread on ML about it. I couldn't find it right away, but > I'm sure that Dan will be quicker than me for finding it, if needed ;-). Now dropped, thanks! greg k-h
Re: [PATCH v2 2/2] cpufreq: Specify default governor on command line
On 23-06-20, 15:21, Quentin Perret wrote: > Currently, the only way to specify the default CPUfreq governor is via > Kconfig options, which suits users who can build the kernel themselves > perfectly. > > However, for those who use a distro-like kernel (such as Android, with > the Generic Kernel Image project), the only way to use a different > default is to boot to userspace, and to then switch using the sysfs > interface. Being able to specify the default governor on the command > line, like is the case for cpuidle, would enable those users to specify > their governor of choice earlier on, and to simplify slighlty the > userspace boot procedure. > > To support this use-case, add a kernel command line parameter enabling > to specify a default governor for CPUfreq, which takes precedence over > the builtin default. > > This implementation has one notable limitation: the default governor > must be registered before the driver. This is solved for builtin > governors and drivers using appropriate *_initcall() functions. And in > the modular case, this must be reflected as a constraint on the module > loading order. > > Signed-off-by: Quentin Perret > --- > .../admin-guide/kernel-parameters.txt | 5 > Documentation/admin-guide/pm/cpufreq.rst | 6 ++--- > drivers/cpufreq/cpufreq.c | 23 +++ > 3 files changed, 26 insertions(+), 8 deletions(-) > > diff --git a/Documentation/admin-guide/kernel-parameters.txt > b/Documentation/admin-guide/kernel-parameters.txt > index fb95fad81c79..5fd3c9f187eb 100644 > --- a/Documentation/admin-guide/kernel-parameters.txt > +++ b/Documentation/admin-guide/kernel-parameters.txt > @@ -703,6 +703,11 @@ > cpufreq.off=1 [CPU_FREQ] > disable the cpufreq sub-system > > + cpufreq.default_governor= > + [CPU_FREQ] Name of the default cpufreq governor to use. > + This governor must be registered in the kernel before > + the cpufreq driver probes. > + > cpu_init_udelay=N > [X86] Delay for N microsec between assert and de-assert > of APIC INIT to start processors. This delay occurs > diff --git a/Documentation/admin-guide/pm/cpufreq.rst > b/Documentation/admin-guide/pm/cpufreq.rst > index 0c74a7784964..368e612145d2 100644 > --- a/Documentation/admin-guide/pm/cpufreq.rst > +++ b/Documentation/admin-guide/pm/cpufreq.rst > @@ -147,9 +147,9 @@ CPUs in it. > > The next major initialization step for a new policy object is to attach a > scaling governor to it (to begin with, that is the default scaling governor > -determined by the kernel configuration, but it may be changed later > -via ``sysfs``). First, a pointer to the new policy object is passed to the > -governor's ``->init()`` callback which is expected to initialize all of the > +determined by the kernel command line or configuration, but it may be changed > +later via ``sysfs``). First, a pointer to the new policy object is passed to > +the governor's ``->init()`` callback which is expected to initialize all of > the > data structures necessary to handle the given policy and, possibly, to add > a governor ``sysfs`` interface to it. Next, the governor is started by > invoking its ``->start()`` callback. > diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c > index 0128de3603df..4b1a5c0173cf 100644 > --- a/drivers/cpufreq/cpufreq.c > +++ b/drivers/cpufreq/cpufreq.c > @@ -50,6 +50,9 @@ static LIST_HEAD(cpufreq_governor_list); > #define for_each_governor(__governor)\ > list_for_each_entry(__governor, &cpufreq_governor_list, governor_list) > > +static char cpufreq_param_governor[CPUFREQ_NAME_LEN]; > +static struct cpufreq_governor *default_governor; > + > /** > * The "cpufreq driver" - the arch- or hardware-dependent low > * level driver of CPUFreq support, and its spinlock. This lock > @@ -1055,7 +1058,6 @@ __weak struct cpufreq_governor > *cpufreq_default_governor(void) > > static int cpufreq_init_policy(struct cpufreq_policy *policy) > { > - struct cpufreq_governor *def_gov = cpufreq_default_governor(); > struct cpufreq_governor *gov = NULL; > unsigned int pol = CPUFREQ_POLICY_UNKNOWN; > > @@ -1065,8 +1067,8 @@ static int cpufreq_init_policy(struct cpufreq_policy > *policy) > if (gov) { > pr_debug("Restoring governor %s for cpu %d\n", >policy->governor->name, policy->cpu); > - } else if (def_gov) { > - gov = def_gov; > + } else if (default_governor) { > + gov = default_governor; > } else { > return -ENODATA; > } > @@ -1074,8 +1076,8 @@ static int cpufreq_init_policy(struct cpufreq_policy > *policy) > /* Use the default policy if there is no last_po
Re: linux-next: build failure after merge of the drm-misc tree
On Wed, 24 Jun 2020 at 11:36, Stephen Rothwell wrote: > > Hi all, > > On Wed, 17 Jun 2020 10:59:29 +1000 Stephen Rothwell > wrote: > > > > After merging the drm-misc tree, today's linux-next build (x86_64 > > allmodconfig) failed like this: > > > > drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c: In function > > 'amdgpu_amdkfd_gpuvm_free_memory_of_gpu': > > drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c:1357:2: error: implicit > > declaration of function 'drm_gem_object_put_unlocked'; did you mean > > 'drm_gem_object_put_locked'? [-Werror=implicit-function-declaration] > > 1357 | drm_gem_object_put_unlocked(&mem->bo->tbo.base); > > | ^~~ > > | drm_gem_object_put_locked > > > > Caused by commit > > > > ab15d56e27be ("drm: remove transient drm_gem_object_put_unlocked()") > > > > interacting with commit > > > > fd9a9f8801de ("drm/amdgpu: Use GEM obj reference for KFD BOs") > > > > from Linus' tree. > > > > I have applied the following merge fix up patch for today. > > > > From: Stephen Rothwell > > Date: Wed, 17 Jun 2020 10:55:32 +1000 > > Subject: [PATCH] drm/amdgpu: remove stray drm_gem_object_put_unlocked > > > > Signed-off-by: Stephen Rothwell > > --- > > drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c > > b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c > > index b91b5171270f..9015c7b76d60 100644 > > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c > > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c > > @@ -1354,7 +1354,7 @@ int amdgpu_amdkfd_gpuvm_free_memory_of_gpu( > > } > > > > /* Free the BO*/ > > - drm_gem_object_put_unlocked(&mem->bo->tbo.base); > > + drm_gem_object_put(&mem->bo->tbo.base); > > mutex_destroy(&mem->lock); > > kfree(mem); > > > > -- > > 2.26.2 > > This fix is now needed when I merge the drm tree :-( > > Given that the drm tree is based on v5.8-rc2 and the commit from Linus' > tree above was merged before v5.8-rc1, the above patch should be > applied to the drm tree (and should have been part of the patch that > merged the drm-misc tree). I am a bit suprised that the drm tree > currently passes CI. My bad, my local builds passed, as I had made the change but forgot the commit --amend Pushed out a new head with it in it now. Dave.