[PATCH OLK-6.6 1/1] soc cache: Adapt to L3C quirk
driver inclusion category: feature bugzilla: https://atomgit.com/openeuler/kernel/issues/10043 ---------------------------------------------------------------------- L3 cache lock hardware restricts lock address to be aligned with the size, the driver gurantees this by using alloc_contig_pages. The size user applies may be arbitrary number but the driver will align the size up to PAGE_SIZE, causing checks of alignment of raw cache lock size and the address to fail. Fix this by change the size into actual allocated memory size and remove unnecessary checks of alignment. Signed-off-by: Yushan Wang <wangyushan12@huawei.com> Signed-off-by: Hongye Lin <linhongye@h-partners.com> --- drivers/soc/hisilicon/hisi_soc_l3c.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/soc/hisilicon/hisi_soc_l3c.c b/drivers/soc/hisilicon/hisi_soc_l3c.c index 0aec6766b34b..8be404da6282 100644 --- a/drivers/soc/hisilicon/hisi_soc_l3c.c +++ b/drivers/soc/hisilicon/hisi_soc_l3c.c @@ -229,8 +229,16 @@ static int hisi_soc_l3c_do_lock(struct hisi_soc_comp *l3c_comp, int regset; u32 ctrl; - if (soc_l3c->max_lock_num == 1 && addr % size != 0) - return -EINVAL; + /* + * Quirk: L3C instance has only one available lock region requires lock + * region address to be aligned to its size. + * + * This is already guranteed by alloc_contig_pages, since we allocate + * minimum power-of-2 pages that fits the size. Make all allocated + * memory get locked to fulfill hardware's requirement. + */ + if (soc_l3c->max_lock_num == 1) + size = (1 << get_order(size)) * PAGE_SIZE; if (size < soc_l3c->min_lock_size) return -EINVAL; -- 2.33.0
反馈: 您发送到kernel@openeuler.org的补丁/补丁集,转换为PR失败! 邮件列表地址:https://mailweb.openeuler.org/archives/list/kernel@openeuler.org/message/FKF... 失败原因:补丁集缺失封面信息 建议解决方法:请提供补丁集并重新发送您的补丁集到邮件列表 FeedBack: The patch(es) which you have sent to kernel@openeuler.org has been converted to PR failed! Mailing list address: https://mailweb.openeuler.org/archives/list/kernel@openeuler.org/message/FKF... Failed Reason: the cover of the patches is missing Suggest Solution: please checkout and apply the patches' cover and send all again
participants (2)
-
patchwork bot -
Yushan Wang