[PATCH 00/14] Fix incorrect use of cpuhp_remove_multi_state parameter
driver inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/IDBQ74 ---------------------------------------------------------------------- Yifan Wu (3): soc_cache: Fix incorrect use of cpuhp_remove_multi_state parameter soc_cache: Fix error code returning from hisi_soc_l3c_do_lock soc_cache: Fix component removal order to avoid race condition Yushan Wang (10): soc cache: cleanup: replace dynamically allocated param with local variable soc cache: cleanup: fix memory leakage on error path soc cache: cleanup: move judgement of soc cache dev into lock protection soc cache: cleanup: avoid tag addr from interfering range validation soc cache: cleanup: Change type of mnt_type soc cache: cleanup: Remove the redundant check of vm_pgoff soc cache: Check address while walking pages soc cache: fix walk page parameter and drop incorrect check soc cache: Drop redundant vm_pgoff soc cache: Don't poll before removing all locks .../soc/hisilicon/hisi_soc_cache_framework.c | 65 ++++++++----------- drivers/soc/hisilicon/hisi_soc_l3c.c | 13 ++-- 2 files changed, 31 insertions(+), 47 deletions(-) -- 2.33.0
driver inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/IDBQ74 ---------------------------------------------------------------------- Replace dynamically allocated param with local variable to save unnecessary procedure. Fixes: e6ecc3b028b8 ("soc cache: Add framework driver for HiSilicon SoC cache") Signed-off-by: Yushan Wang <wangyushan12@huawei.com> Signed-off-by: Hongye Lin <linhongye@h-partners.com> --- .../soc/hisilicon/hisi_soc_cache_framework.c | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/drivers/soc/hisilicon/hisi_soc_cache_framework.c b/drivers/soc/hisilicon/hisi_soc_cache_framework.c index cceeef1b3b12..38bd04be7f32 100644 --- a/drivers/soc/hisilicon/hisi_soc_cache_framework.c +++ b/drivers/soc/hisilicon/hisi_soc_cache_framework.c @@ -499,29 +499,22 @@ static int __hisi_soc_cache_maintain(unsigned long __user vaddr, size_t size, static long hisi_soc_cache_mgmt_ioctl(struct file *file, u32 cmd, unsigned long arg) { - struct hisi_soc_cache_ioctl_param *param = - kzalloc(sizeof(struct hisi_soc_cache_ioctl_param), GFP_KERNEL); + struct hisi_soc_cache_ioctl_param param; long ret; - if (!param) - return -ENOMEM; - - if (copy_from_user(param, (void __user *)arg, sizeof(*param))) { - ret = -EFAULT; - goto out; - } + if (copy_from_user(¶m, (void __user *)arg, sizeof(param))) + return -EFAULT; switch (cmd) { case HISI_CACHE_MAINTAIN: - ret = __hisi_soc_cache_maintain(param->addr, param->size, - param->op_type); + ret = __hisi_soc_cache_maintain(param.addr, param.size, + param.op_type); break; default: ret = -EINVAL; break; } -out: - kfree(param); + return ret; } -- 2.33.0
From: Yifan Wu <wuyifan50@huawei.com> driver inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/IDBQ74 ---------------------------------------------------------------------- The cpuhp_remove_multi_state was called with CPUHP_AP_ONLINE_DYN instead of the dynamically allocated hisi_l3c_cpuhp_state. This may lead to improper CPU hotplug state removal. Fixes: e6ecc3b028b8 ("soc cache: Add framework driver for HiSilicon SoC cache") Signed-off-by: Yifan Wu <wuyifan50@huawei.com> Signed-off-by: Yushan Wang <wangyushan12@huawei.com> Signed-off-by: Hongye Lin <linhongye@h-partners.com> --- drivers/soc/hisilicon/hisi_soc_l3c.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/soc/hisilicon/hisi_soc_l3c.c b/drivers/soc/hisilicon/hisi_soc_l3c.c index a5a8ac6baeb0..e0bf6cc5b47d 100644 --- a/drivers/soc/hisilicon/hisi_soc_l3c.c +++ b/drivers/soc/hisilicon/hisi_soc_l3c.c @@ -592,7 +592,7 @@ static int __init hisi_soc_l3c_init(void) ret = platform_driver_register(&hisi_soc_l3c_driver); if (ret) - cpuhp_remove_multi_state(CPUHP_AP_ONLINE_DYN); + cpuhp_remove_multi_state(hisi_l3c_cpuhp_state); return ret; } @@ -601,7 +601,7 @@ module_init(hisi_soc_l3c_init); static void __exit hisi_soc_l3c_exit(void) { platform_driver_unregister(&hisi_soc_l3c_driver); - cpuhp_remove_multi_state(CPUHP_AP_ONLINE_DYN); + cpuhp_remove_multi_state(hisi_l3c_cpuhp_state); } module_exit(hisi_soc_l3c_exit); -- 2.33.0
From: Yifan Wu <wuyifan50@huawei.com> driver inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/IDBQ74 ---------------------------------------------------------------------- Fix the issue by returning the original error code from hisi_soc_l3c_alloc_lock_reg_set, which makes it possible for the caller to distinguish between different failure scenarios. Fixes: e6ecc3b028b8 ("soc cache: Add framework driver for HiSilicon SoC cache") Signed-off-by: Yifan Wu <wuyifan50@huawei.com> Signed-off-by: Yushan Wang <wangyushan12@huawei.com> Signed-off-by: Hongye Lin <linhongye@h-partners.com> --- drivers/soc/hisilicon/hisi_soc_l3c.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/soc/hisilicon/hisi_soc_l3c.c b/drivers/soc/hisilicon/hisi_soc_l3c.c index e0bf6cc5b47d..258502c09e1b 100644 --- a/drivers/soc/hisilicon/hisi_soc_l3c.c +++ b/drivers/soc/hisilicon/hisi_soc_l3c.c @@ -239,7 +239,7 @@ static int hisi_soc_l3c_do_lock(struct hisi_soc_comp *l3c_comp, regset = hisi_soc_l3c_alloc_lock_reg_set(soc_l3c, addr, size); if (regset < 0) - return -EBUSY; + return regset; if (!hisi_l3c_lock_ctrl_wait_finished(soc_l3c, regset, HISI_L3C_LOCK_CTRL_LOCK_DONE)) { -- 2.33.0
driver inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/IDBQ74 ---------------------------------------------------------------------- Fix memory leakage on error path. Fixes: e6ecc3b028b8 ("soc cache: Add framework driver for HiSilicon SoC cache") Signed-off-by: Yushan Wang <wangyushan12@huawei.com> Signed-off-by: Hongye Lin <linhongye@h-partners.com> --- drivers/soc/hisilicon/hisi_soc_cache_framework.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/soc/hisilicon/hisi_soc_cache_framework.c b/drivers/soc/hisilicon/hisi_soc_cache_framework.c index 38bd04be7f32..a45938ae525e 100644 --- a/drivers/soc/hisilicon/hisi_soc_cache_framework.c +++ b/drivers/soc/hisilicon/hisi_soc_cache_framework.c @@ -421,8 +421,10 @@ static int hisi_soc_cache_mmap(struct file *file, struct vm_area_struct *vma) if (ret) goto out_clr; - if (vma->vm_pgoff > PAGE_SIZE) - return -EINVAL; + if (vma->vm_pgoff > PAGE_SIZE) { + ret = -EINVAL; + goto out_clr; + } ret = remap_pfn_range(vma, vma->vm_start, (addr >> PAGE_SHIFT) + vma->vm_pgoff, -- 2.33.0
driver inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/IDBQ74 ---------------------------------------------------------------------- SoC cache dev array is under the protection of the spinlock, hence the verification should also be protected. Fixes: e6ecc3b028b8 ("soc cache: Add framework driver for HiSilicon SoC cache") Signed-off-by: Yushan Wang <wangyushan12@huawei.com> Signed-off-by: Hongye Lin <linhongye@h-partners.com> --- drivers/soc/hisilicon/hisi_soc_cache_framework.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/soc/hisilicon/hisi_soc_cache_framework.c b/drivers/soc/hisilicon/hisi_soc_cache_framework.c index a45938ae525e..30a2b4148630 100644 --- a/drivers/soc/hisilicon/hisi_soc_cache_framework.c +++ b/drivers/soc/hisilicon/hisi_soc_cache_framework.c @@ -59,12 +59,12 @@ static int hisi_soc_cache_lock(int cpu, phys_addr_t addr, size_t size) struct list_head *head; int ret = -ENOMEM; + guard(spinlock)(&soc_cache_devs[HISI_SOC_L3C].lock); + /* Avoid null pointer when there is no instance onboard. */ if (soc_cache_devs[HISI_SOC_L3C].inst_num <= 0) return ret; - guard(spinlock)(&soc_cache_devs[HISI_SOC_L3C].lock); - /* Iterate L3C instances to perform operation, break loop once found. */ head = &soc_cache_devs[HISI_SOC_L3C].node; list_for_each_entry(inst, head, node) { @@ -92,12 +92,12 @@ static int hisi_soc_cache_unlock(int cpu, phys_addr_t addr) struct list_head *head; int ret = 0; + guard(spinlock)(&soc_cache_devs[HISI_SOC_L3C].lock); + /* Avoid null pointer when there is no instance onboard. */ if (soc_cache_devs[HISI_SOC_L3C].inst_num <= 0) return ret; - guard(spinlock)(&soc_cache_devs[HISI_SOC_L3C].lock); - /* Iterate L3C instances to perform operation, break loop once found. */ head = &soc_cache_devs[HISI_SOC_L3C].node; list_for_each_entry(inst, head, node) { -- 2.33.0
driver inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/IDBQ74 ---------------------------------------------------------------------- The raw address may still have memory tag applied on the high bits of the address, which may interfere the check here. Use untagged variable start to do the validation instead. Fixes: e6ecc3b028b8 ("soc cache: Add framework driver for HiSilicon SoC cache") Signed-off-by: Yushan Wang <wangyushan12@huawei.com> Signed-off-by: Hongye Lin <linhongye@h-partners.com> --- drivers/soc/hisilicon/hisi_soc_cache_framework.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/soc/hisilicon/hisi_soc_cache_framework.c b/drivers/soc/hisilicon/hisi_soc_cache_framework.c index 30a2b4148630..4f9514944ec8 100644 --- a/drivers/soc/hisilicon/hisi_soc_cache_framework.c +++ b/drivers/soc/hisilicon/hisi_soc_cache_framework.c @@ -480,7 +480,7 @@ static int __hisi_soc_cache_maintain(unsigned long __user vaddr, size_t size, mmap_read_lock_killable(current->mm); vma = vma_lookup(current->mm, vaddr); - if (!range_in_vma(vma, vaddr, vaddr + size)) { + if (!range_in_vma(vma, start, vaddr + size)) { ret = -EINVAL; goto out; } -- 2.33.0
driver inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/IDBQ74 ---------------------------------------------------------------------- The type of mnt_type is incorrectly forced changed to unsigned int, which adds the implication that size of unsigned int has be the same as enum. Remove this complication by change the type of local variable mnt_type. Fixes: e6ecc3b028b8 ("soc cache: Add framework driver for HiSilicon SoC cache") Signed-off-by: Yushan Wang <wangyushan12@huawei.com> Signed-off-by: Hongye Lin <linhongye@h-partners.com> --- drivers/soc/hisilicon/hisi_soc_cache_framework.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/soc/hisilicon/hisi_soc_cache_framework.c b/drivers/soc/hisilicon/hisi_soc_cache_framework.c index 4f9514944ec8..67b3b306664d 100644 --- a/drivers/soc/hisilicon/hisi_soc_cache_framework.c +++ b/drivers/soc/hisilicon/hisi_soc_cache_framework.c @@ -154,9 +154,11 @@ static int hisi_soc_cache_maint_pte_entry(pte_t *pte, unsigned long addr, unsigned long next, struct mm_walk *walk) { #ifdef HISI_SOC_CACHE_LLT - unsigned int mnt_type = *((unsigned int *)walk->priv); + enum hisi_soc_cache_maint_type mnt_type = + *((enum hisi_soc_cache_maint_type *)walk->priv); #else - unsigned int mnt_type = *((unsigned int *)walk->private); + enum hisi_soc_cache_maint_type mnt_type = + *((enum hisi_soc_cache_maint_type *)walk->private); #endif size_t size = next - addr; phys_addr_t paddr; -- 2.33.0
driver inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/IDBQ74 ---------------------------------------------------------------------- vma->vm_pgoff has the unit of PAGE_SIZE, this variable is used to represent the offset in mapped file in pages' granuality. The check here is non-sense, and should be shreded. Fixes: e6ecc3b028b8 ("soc cache: Add framework driver for HiSilicon SoC cache") Signed-off-by: Yushan Wang <wangyushan12@huawei.com> Signed-off-by: Hongye Lin <linhongye@h-partners.com> --- drivers/soc/hisilicon/hisi_soc_cache_framework.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/drivers/soc/hisilicon/hisi_soc_cache_framework.c b/drivers/soc/hisilicon/hisi_soc_cache_framework.c index 67b3b306664d..a8903e535e0b 100644 --- a/drivers/soc/hisilicon/hisi_soc_cache_framework.c +++ b/drivers/soc/hisilicon/hisi_soc_cache_framework.c @@ -423,11 +423,6 @@ static int hisi_soc_cache_mmap(struct file *file, struct vm_area_struct *vma) if (ret) goto out_clr; - if (vma->vm_pgoff > PAGE_SIZE) { - ret = -EINVAL; - goto out_clr; - } - ret = remap_pfn_range(vma, vma->vm_start, (addr >> PAGE_SHIFT) + vma->vm_pgoff, size, vma->vm_page_prot); -- 2.33.0
From: Yifan Wu <wuyifan50@huawei.com> driver inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/IDBQ74 ---------------------------------------------------------------------- Fix the order to first call hisi_soc_comp_inst_del to ensure no further operations can be triggered, and then call hisi_soc_l3c_remove_locks to safely release the resources. Fixes: e6ecc3b028b8 ("soc cache: Add framework driver for HiSilicon SoC cache") Signed-off-by: Yifan Wu <wuyifan50@huawei.com> Signed-off-by: Yushan Wang <wangyushan12@huawei.com> Signed-off-by: Hongye Lin <linhongye@h-partners.com> --- drivers/soc/hisilicon/hisi_soc_l3c.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/soc/hisilicon/hisi_soc_l3c.c b/drivers/soc/hisilicon/hisi_soc_l3c.c index 258502c09e1b..3e0c6686da0e 100644 --- a/drivers/soc/hisilicon/hisi_soc_l3c.c +++ b/drivers/soc/hisilicon/hisi_soc_l3c.c @@ -504,13 +504,13 @@ static int hisi_soc_l3c_remove(struct platform_device *pdev) unsigned long idx; struct hisi_soc_l3c_lock_region *entry; - hisi_soc_l3c_remove_locks(soc_l3c); - hisi_soc_comp_inst_del(&soc_l3c->comp); cpuhp_state_remove_instance_nocalls(hisi_l3c_cpuhp_state, &soc_l3c->node); + hisi_soc_l3c_remove_locks(soc_l3c); + xa_for_each(&soc_l3c->lock_sets, idx, entry) { entry = xa_erase(&soc_l3c->lock_sets, idx); kfree(entry); -- 2.33.0
driver inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/IDBQ74 ---------------------------------------------------------------------- While walking VMA pages, the starting address of a page is validated while ending address is not. If user requests cache maintenance over a memory region, that its start address is not aligned to page size, and the modular of memory region size to page size is smaller than the starting address page offset, cache maintenance may be out of desired region, for example: If user requests cache maintenance to address 0x1002 with size 0x1001, the desired maintain range should be 0x1002-0x2003. But when walking the pages to find the physical address of 0x1001, the driver will only check if 0x1000 is a valid PTE, and if so, maintain of 0x1002-0x2003 will be performed even if 0x2000 does not exists. Fix this by adding a check when walking the page. Some refactor is also applied by changing the interfaces to let walk page callback get the total maintain range. Fixes: e6ecc3b028b8 ("soc cache: Add framework driver for HiSilicon SoC cache") Signed-off-by: Yushan Wang <wangyushan12@huawei.com> Signed-off-by: Hongye Lin <linhongye@h-partners.com> --- .../soc/hisilicon/hisi_soc_cache_framework.c | 33 ++++++++++--------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/drivers/soc/hisilicon/hisi_soc_cache_framework.c b/drivers/soc/hisilicon/hisi_soc_cache_framework.c index a8903e535e0b..b37c142bdf08 100644 --- a/drivers/soc/hisilicon/hisi_soc_cache_framework.c +++ b/drivers/soc/hisilicon/hisi_soc_cache_framework.c @@ -154,21 +154,24 @@ static int hisi_soc_cache_maint_pte_entry(pte_t *pte, unsigned long addr, unsigned long next, struct mm_walk *walk) { #ifdef HISI_SOC_CACHE_LLT - enum hisi_soc_cache_maint_type mnt_type = - *((enum hisi_soc_cache_maint_type *)walk->priv); + struct hisi_soc_cache_ioctl_param *param = + (struct hisi_soc_cache_ioctl_param *)walk->priv; #else - enum hisi_soc_cache_maint_type mnt_type = - *((enum hisi_soc_cache_maint_type *)walk->private); + struct hisi_soc_cache_ioctl_param *param = + (struct hisi_soc_cache_ioctl_param *)walk->private; #endif size_t size = next - addr; phys_addr_t paddr; + if (next > param->addr + param->size) + return -EINVAL; + if (!pte_present(ptep_get(pte))) return -EINVAL; paddr = PFN_PHYS(pte_pfn(*pte)) + offset_in_page(addr); - return hisi_soc_cache_maintain(paddr, size, mnt_type); + return hisi_soc_cache_maintain(paddr, size, param->op_type); } static const struct mm_walk_ops hisi_soc_cache_maint_walk = { @@ -459,25 +462,24 @@ static int hisi_soc_cache_mmap(struct file *file, struct vm_area_struct *vma) return ret; } -static int __hisi_soc_cache_maintain(unsigned long __user vaddr, size_t size, - enum hisi_soc_cache_maint_type mnt_type) +static int __hisi_soc_cache_maintain(struct hisi_soc_cache_ioctl_param *param) { - unsigned long start = untagged_addr(vaddr); + unsigned long start = untagged_addr(param->addr); struct vm_area_struct *vma; int ret = 0; /* MakeInvalid is not allowed for calls from userspace. */ - if (mnt_type >= HISI_CACHE_MAINT_MAKEINVALID) + if (param->op_type >= HISI_CACHE_MAINT_MAKEINVALID) return -EINVAL; /* Prevent overflow of vaddr + size. */ - if (!size || vaddr + size < vaddr) + if (!param->size || start + param->size < start) return -EINVAL; mmap_read_lock_killable(current->mm); - vma = vma_lookup(current->mm, vaddr); - if (!range_in_vma(vma, start, vaddr + size)) { + vma = vma_lookup(current->mm, param->addr); + if (!range_in_vma(vma, start, start + param->size)) { ret = -EINVAL; goto out; } @@ -488,8 +490,8 @@ static int __hisi_soc_cache_maintain(unsigned long __user vaddr, size_t size, goto out; } - ret = walk_page_range(current->mm, start, start + size, - &hisi_soc_cache_maint_walk, &mnt_type); + ret = walk_page_range(current->mm, start, start + param->size, + &hisi_soc_cache_maint_walk, param); out: mmap_read_unlock(current->mm); @@ -506,8 +508,7 @@ static long hisi_soc_cache_mgmt_ioctl(struct file *file, u32 cmd, unsigned long switch (cmd) { case HISI_CACHE_MAINTAIN: - ret = __hisi_soc_cache_maintain(param.addr, param.size, - param.op_type); + ret = __hisi_soc_cache_maintain(¶m); break; default: ret = -EINVAL; -- 2.33.0
driver inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/IDBQ74 ---------------------------------------------------------------------- During walking pages, if the memory region assigned is within a pmd, the page offset will be reserved, but if multiple pmds are involved, the offset will not be reserved, causing incorrect failure of page range check and the required range. Fix this by align the requested memory region to PAGE_SIZE, and eliminate the unnecessary check. Fixes: e6ecc3b028b8 ("soc cache: Add framework driver for HiSilicon SoC cache") Signed-off-by: Yushan Wang <wangyushan12@huawei.com> Signed-off-by: Hongye Lin <linhongye@h-partners.com> --- .../soc/hisilicon/hisi_soc_cache_framework.c | 20 +++++++------------ 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/drivers/soc/hisilicon/hisi_soc_cache_framework.c b/drivers/soc/hisilicon/hisi_soc_cache_framework.c index 1247d5aac333..d003bb3ac632 100644 --- a/drivers/soc/hisilicon/hisi_soc_cache_framework.c +++ b/drivers/soc/hisilicon/hisi_soc_cache_framework.c @@ -154,23 +154,17 @@ static int hisi_soc_cache_maint_pte_entry(pte_t *pte, unsigned long addr, unsigned long next, struct mm_walk *walk) { #ifdef HISI_SOC_CACHE_LLT - struct hisi_soc_cache_ioctl_param *param = - (struct hisi_soc_cache_ioctl_param *)walk->priv; + struct hisi_soc_cache_ioctl_param *param = walk->priv; #else - struct hisi_soc_cache_ioctl_param *param = - (struct hisi_soc_cache_ioctl_param *)walk->private; + struct hisi_soc_cache_ioctl_param *param = walk->private; #endif - size_t size = next - addr; - phys_addr_t paddr; - - if (next > param->addr + param->size) - return -EINVAL; + size_t size = min(next - addr, param->size + param->addr - addr); + unsigned long offset = offset_in_page(max(addr, param->addr)); + phys_addr_t paddr = PFN_PHYS(pte_pfn(*pte)) + offset; if (!pte_present(ptep_get(pte))) return -EINVAL; - paddr = PFN_PHYS(pte_pfn(*pte)) + offset_in_page(addr); - return hisi_soc_cache_maintain(paddr, size, param->op_type); } @@ -491,9 +485,9 @@ static int __hisi_soc_cache_maintain(struct hisi_soc_cache_ioctl_param *param) goto out; } - ret = walk_page_range(current->mm, start, start + param->size, + ret = walk_page_range(current->mm, PAGE_ALIGN_DOWN(start), + PAGE_ALIGN(start + param->size), &hisi_soc_cache_maint_walk, param); - out: mmap_read_unlock(current->mm); return ret; -- 2.33.0
driver inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/IDBQ74 ---------------------------------------------------------------------- Drop redundant vm_pgoff since every mmap will have a new vma being created, apply cache lock only at the beginning of a vma. Fixes: e6ecc3b028b8 ("soc cache: Add framework driver for HiSilicon SoC cache") Signed-off-by: Yushan Wang <wangyushan12@huawei.com> Signed-off-by: Hongye Lin <linhongye@h-partners.com> --- drivers/soc/hisilicon/hisi_soc_cache_framework.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/soc/hisilicon/hisi_soc_cache_framework.c b/drivers/soc/hisilicon/hisi_soc_cache_framework.c index d003bb3ac632..7e9100514eb1 100644 --- a/drivers/soc/hisilicon/hisi_soc_cache_framework.c +++ b/drivers/soc/hisilicon/hisi_soc_cache_framework.c @@ -420,9 +420,8 @@ static int hisi_soc_cache_mmap(struct file *file, struct vm_area_struct *vma) if (ret) goto out_clr; - ret = remap_pfn_range(vma, vma->vm_start, - (addr >> PAGE_SHIFT) + vma->vm_pgoff, - size, vma->vm_page_prot); + ret = remap_pfn_range(vma, vma->vm_start, addr >> PAGE_SHIFT, size, + vma->vm_page_prot); if (ret) goto out_page; -- 2.33.0
driver inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/IDBQ74 ---------------------------------------------------------------------- Firstly, all register operations and polls are guraded by the spinlock, so operations of registers in parallel is not possible. Thus, the polling for completion before removing all locks is redundant. Fixes: e6ecc3b028b8 ("soc cache: Add framework driver for HiSilicon SoC cache") Signed-off-by: Yushan Wang <wangyushan12@huawei.com> Signed-off-by: Hongye Lin <linhongye@h-partners.com> --- drivers/soc/hisilicon/hisi_soc_l3c.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/soc/hisilicon/hisi_soc_l3c.c b/drivers/soc/hisilicon/hisi_soc_l3c.c index 3e0c6686da0e..0aec6766b34b 100644 --- a/drivers/soc/hisilicon/hisi_soc_l3c.c +++ b/drivers/soc/hisilicon/hisi_soc_l3c.c @@ -352,9 +352,6 @@ static void hisi_soc_l3c_remove_locks(struct hisi_soc_l3c *soc_l3c) guard(spinlock)(&soc_l3c->reg_lock); xa_for_each(&soc_l3c->lock_sets, regset, entry) { - timeout = hisi_l3c_lock_ctrl_wait_finished(soc_l3c, regset, - HISI_L3C_LOCK_CTRL_UNLOCK_DONE); - ctrl = readl(base + l3c_lock_reg_offset(HISI_L3C_LOCK_CTRL, regset)); ctrl = (ctrl | HISI_L3C_LOCK_CTRL_UNLOCK_EN) & -- 2.33.0
driver inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/IDBQ74 ---------------------------------------------------------------------- Add compilation config for hisi_soc_l3c driver. Fixes: e6ecc3b028b8 ("soc cache: Add framework driver for HiSilicon SoC cache") Signed-off-by: Yushan Wang <wangyushan12@huawei.com> Signed-off-by: Hongye Lin <linhongye@h-partners.com> --- drivers/soc/hisilicon/Kconfig | 11 +++++++++++ drivers/soc/hisilicon/Makefile | 1 + 2 files changed, 12 insertions(+) diff --git a/drivers/soc/hisilicon/Kconfig b/drivers/soc/hisilicon/Kconfig index 56a6360e0c53..591244522960 100644 --- a/drivers/soc/hisilicon/Kconfig +++ b/drivers/soc/hisilicon/Kconfig @@ -68,6 +68,17 @@ config HISI_SOC_CACHE If either HiSilicon L3 cache driver or HiSilicon Hydra Home Agent driver is needed, say yes. +config HISI_SOC_L3C + tristate "HiSilicon L3 Cache device driver" + depends on ARM64 && ACPI || COMPILE_TEST + depends on HISI_SOC_CACHE + help + This driver provides the functions to lock L3 cache entries from + being evicted for better performance. + + This driver can be built as a module. If so, the module will be + called hisi_soc_l3c. + config HISI_SOC_HHA tristate "HiSilicon Hydra Home Agent (HHA) device driver" depends on ARM64 && ACPI || COMPILE_TEST diff --git a/drivers/soc/hisilicon/Makefile b/drivers/soc/hisilicon/Makefile index 2c6534a1350c..21f4bdb277ff 100644 --- a/drivers/soc/hisilicon/Makefile +++ b/drivers/soc/hisilicon/Makefile @@ -6,3 +6,4 @@ obj-$(CONFIG_HISI_HBMCACHE) += hisi_hbmcache.o obj-$(CONFIG_HISI_SOC_CACHE) += hisi_soc_cache_framework.o obj-$(CONFIG_HISI_SOC_HHA) += hisi_soc_hha.o +obj-$(CONFIG_HISI_SOC_L3C) += hisi_soc_l3c.o -- 2.33.0
participants (1)
-
Yushan Wang