From 01015b0e58ef363990d6fcf0f3edbff8237f1c55 Mon Sep 17 00:00:00 2001 From: Sasha Levin Date: Thu, 14 Jan 2021 19:15:26 -0500 Subject: [PATCH] Fixes for 5.10 Signed-off-by: Sasha Levin --- ...-t-corrupt-the-queue-mutex-on-open-c.patch | 75 +++++++++++++++++++ ...urn-value-from-alloc_fixed_file_ref_.patch | 68 +++++++++++++++++ ...com-initialize-sctlr-of-the-bypass-c.patch | 45 +++++++++++ ...filling-sl-in-high-3-bits-of-vlan_id.patch | 59 +++++++++++++++ ...fix-wsometimes-uninitialized-warning.patch | 48 ++++++++++++ queue-5.10/series | 5 ++ 6 files changed, 300 insertions(+) create mode 100644 queue-5.10/drm-panfrost-don-t-corrupt-the-queue-mutex-on-open-c.patch create mode 100644 queue-5.10/io_uring-fix-return-value-from-alloc_fixed_file_ref_.patch create mode 100644 queue-5.10/iommu-arm-smmu-qcom-initialize-sctlr-of-the-bypass-c.patch create mode 100644 queue-5.10/rdma-hns-avoid-filling-sl-in-high-3-bits-of-vlan_id.patch create mode 100644 queue-5.10/scsi-ufs-fix-wsometimes-uninitialized-warning.patch diff --git a/queue-5.10/drm-panfrost-don-t-corrupt-the-queue-mutex-on-open-c.patch b/queue-5.10/drm-panfrost-don-t-corrupt-the-queue-mutex-on-open-c.patch new file mode 100644 index 00000000000..148582d80c3 --- /dev/null +++ b/queue-5.10/drm-panfrost-don-t-corrupt-the-queue-mutex-on-open-c.patch @@ -0,0 +1,75 @@ +From a7ea7e813b40876b5608a2dea63e0cb1a6b1a12b Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 29 Oct 2020 17:00:47 +0000 +Subject: drm/panfrost: Don't corrupt the queue mutex on open/close + +From: Steven Price + +[ Upstream commit a17d609e3e216c406f7c0cec2a94086a4401ac06 ] + +The mutex within the panfrost_queue_state should have the lifetime of +the queue, however it was erroneously initialised/destroyed during +panfrost_job_{open,close} which is called every time a client +opens/closes the drm node. + +Move the initialisation/destruction to panfrost_job_{init,fini} where it +belongs. + +Fixes: 1a11a88cfd9a ("drm/panfrost: Fix job timeout handling") +Signed-off-by: Steven Price +Reviewed-by: Boris Brezillon +Signed-off-by: Boris Brezillon +Link: https://patchwork.freedesktop.org/patch/msgid/20201029170047.30564-1-steven.price@arm.com +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/panfrost/panfrost_job.c | 11 ++++++----- + 1 file changed, 6 insertions(+), 5 deletions(-) + +diff --git a/drivers/gpu/drm/panfrost/panfrost_job.c b/drivers/gpu/drm/panfrost/panfrost_job.c +index 1ce2001106e56..517dfb247a801 100644 +--- a/drivers/gpu/drm/panfrost/panfrost_job.c ++++ b/drivers/gpu/drm/panfrost/panfrost_job.c +@@ -617,6 +617,8 @@ int panfrost_job_init(struct panfrost_device *pfdev) + } + + for (j = 0; j < NUM_JOB_SLOTS; j++) { ++ mutex_init(&js->queue[j].lock); ++ + js->queue[j].fence_context = dma_fence_context_alloc(1); + + ret = drm_sched_init(&js->queue[j].sched, +@@ -647,8 +649,10 @@ void panfrost_job_fini(struct panfrost_device *pfdev) + + job_write(pfdev, JOB_INT_MASK, 0); + +- for (j = 0; j < NUM_JOB_SLOTS; j++) ++ for (j = 0; j < NUM_JOB_SLOTS; j++) { + drm_sched_fini(&js->queue[j].sched); ++ mutex_destroy(&js->queue[j].lock); ++ } + + } + +@@ -660,7 +664,6 @@ int panfrost_job_open(struct panfrost_file_priv *panfrost_priv) + int ret, i; + + for (i = 0; i < NUM_JOB_SLOTS; i++) { +- mutex_init(&js->queue[i].lock); + sched = &js->queue[i].sched; + ret = drm_sched_entity_init(&panfrost_priv->sched_entity[i], + DRM_SCHED_PRIORITY_NORMAL, &sched, +@@ -677,10 +680,8 @@ void panfrost_job_close(struct panfrost_file_priv *panfrost_priv) + struct panfrost_job_slot *js = pfdev->js; + int i; + +- for (i = 0; i < NUM_JOB_SLOTS; i++) { ++ for (i = 0; i < NUM_JOB_SLOTS; i++) + drm_sched_entity_destroy(&panfrost_priv->sched_entity[i]); +- mutex_destroy(&js->queue[i].lock); +- } + } + + int panfrost_job_is_idle(struct panfrost_device *pfdev) +-- +2.27.0 + diff --git a/queue-5.10/io_uring-fix-return-value-from-alloc_fixed_file_ref_.patch b/queue-5.10/io_uring-fix-return-value-from-alloc_fixed_file_ref_.patch new file mode 100644 index 00000000000..475fde2fbff --- /dev/null +++ b/queue-5.10/io_uring-fix-return-value-from-alloc_fixed_file_ref_.patch @@ -0,0 +1,68 @@ +From fac52c94e5633b99768ac5a8d5255bb4da4882e0 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 6 Jan 2021 16:09:26 +0000 +Subject: io_uring: Fix return value from alloc_fixed_file_ref_node + +From: Matthew Wilcox (Oracle) + +[ Upstream commit 3e2224c5867fead6c0b94b84727cc676ac6353a3 ] + +alloc_fixed_file_ref_node() currently returns an ERR_PTR on failure. +io_sqe_files_unregister() expects it to return NULL and since it can only +return -ENOMEM, it makes more sense to change alloc_fixed_file_ref_node() +to behave that way. + +Fixes: 1ffc54220c44 ("io_uring: fix io_sqe_files_unregister() hangs") +Reported-by: Dan Carpenter +Signed-off-by: Matthew Wilcox (Oracle) +Signed-off-by: Jens Axboe +Signed-off-by: Sasha Levin +--- + fs/io_uring.c | 12 ++++++------ + 1 file changed, 6 insertions(+), 6 deletions(-) + +diff --git a/fs/io_uring.c b/fs/io_uring.c +index 492492a010a2f..4833b68f1a1cc 100644 +--- a/fs/io_uring.c ++++ b/fs/io_uring.c +@@ -7461,12 +7461,12 @@ static struct fixed_file_ref_node *alloc_fixed_file_ref_node( + + ref_node = kzalloc(sizeof(*ref_node), GFP_KERNEL); + if (!ref_node) +- return ERR_PTR(-ENOMEM); ++ return NULL; + + if (percpu_ref_init(&ref_node->refs, io_file_data_ref_zero, + 0, GFP_KERNEL)) { + kfree(ref_node); +- return ERR_PTR(-ENOMEM); ++ return NULL; + } + INIT_LIST_HEAD(&ref_node->node); + INIT_LIST_HEAD(&ref_node->file_list); +@@ -7560,9 +7560,9 @@ static int io_sqe_files_register(struct io_ring_ctx *ctx, void __user *arg, + } + + ref_node = alloc_fixed_file_ref_node(ctx); +- if (IS_ERR(ref_node)) { ++ if (!ref_node) { + io_sqe_files_unregister(ctx); +- return PTR_ERR(ref_node); ++ return -ENOMEM; + } + + io_sqe_files_set_node(file_data, ref_node); +@@ -7662,8 +7662,8 @@ static int __io_sqe_files_update(struct io_ring_ctx *ctx, + return -EINVAL; + + ref_node = alloc_fixed_file_ref_node(ctx); +- if (IS_ERR(ref_node)) +- return PTR_ERR(ref_node); ++ if (!ref_node) ++ return -ENOMEM; + + done = 0; + fds = u64_to_user_ptr(up->fds); +-- +2.27.0 + diff --git a/queue-5.10/iommu-arm-smmu-qcom-initialize-sctlr-of-the-bypass-c.patch b/queue-5.10/iommu-arm-smmu-qcom-initialize-sctlr-of-the-bypass-c.patch new file mode 100644 index 00000000000..77aa99dd4d6 --- /dev/null +++ b/queue-5.10/iommu-arm-smmu-qcom-initialize-sctlr-of-the-bypass-c.patch @@ -0,0 +1,45 @@ +From 34f1d9c54957d6479aafa79996200a591fe687c7 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 5 Jan 2021 16:50:38 -0800 +Subject: iommu/arm-smmu-qcom: Initialize SCTLR of the bypass context + +From: Bjorn Andersson + +[ Upstream commit aded8c7c2b72f846a07a2c736b8e75bb8cf50a87 ] + +On SM8150 it's occasionally observed that the boot hangs in between the +writing of SMEs and context banks in arm_smmu_device_reset(). + +The problem seems to coincide with a display refresh happening after +updating the stream mapping, but before clearing - and there by +disabling translation - the context bank picked to emulate translation +bypass. + +Resolve this by explicitly disabling the bypass context already in +cfg_probe. + +Fixes: f9081b8ff593 ("iommu/arm-smmu-qcom: Implement S2CR quirk") +Signed-off-by: Bjorn Andersson +Link: https://lore.kernel.org/r/20210106005038.4152731-1-bjorn.andersson@linaro.org +Signed-off-by: Will Deacon +Signed-off-by: Sasha Levin +--- + drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c b/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c +index ef37ccfa82562..0eba5e883e3f1 100644 +--- a/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c ++++ b/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c +@@ -55,6 +55,8 @@ static int qcom_smmu_cfg_probe(struct arm_smmu_device *smmu) + + set_bit(qsmmu->bypass_cbndx, smmu->context_map); + ++ arm_smmu_cb_write(smmu, qsmmu->bypass_cbndx, ARM_SMMU_CB_SCTLR, 0); ++ + reg = FIELD_PREP(ARM_SMMU_CBAR_TYPE, CBAR_TYPE_S1_TRANS_S2_BYPASS); + arm_smmu_gr1_write(smmu, ARM_SMMU_GR1_CBAR(qsmmu->bypass_cbndx), reg); + } +-- +2.27.0 + diff --git a/queue-5.10/rdma-hns-avoid-filling-sl-in-high-3-bits-of-vlan_id.patch b/queue-5.10/rdma-hns-avoid-filling-sl-in-high-3-bits-of-vlan_id.patch new file mode 100644 index 00000000000..819e4f556d4 --- /dev/null +++ b/queue-5.10/rdma-hns-avoid-filling-sl-in-high-3-bits-of-vlan_id.patch @@ -0,0 +1,59 @@ +From 08a9e39d3e4176993a2c00017e69020ce7fe0db1 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 11 Dec 2020 09:37:30 +0800 +Subject: RDMA/hns: Avoid filling sl in high 3 bits of vlan_id + +From: Weihang Li + +[ Upstream commit 94a8c4dfcdb2b4fcb3dfafc39c1033a0b4637c86 ] + +Only the low 12 bits of vlan_id is valid, and service level has been +filled in Address Vector. So there is no need to fill sl in vlan_id in +Address Vector. + +Fixes: 7406c0036f85 ("RDMA/hns: Only record vlan info for HIP08") +Link: https://lore.kernel.org/r/1607650657-35992-5-git-send-email-liweihang@huawei.com +Signed-off-by: Weihang Li +Signed-off-by: Jason Gunthorpe +Signed-off-by: Sasha Levin +--- + drivers/infiniband/hw/hns/hns_roce_ah.c | 11 +---------- + 1 file changed, 1 insertion(+), 10 deletions(-) + +diff --git a/drivers/infiniband/hw/hns/hns_roce_ah.c b/drivers/infiniband/hw/hns/hns_roce_ah.c +index 7dd3b6097226f..174b19e397124 100644 +--- a/drivers/infiniband/hw/hns/hns_roce_ah.c ++++ b/drivers/infiniband/hw/hns/hns_roce_ah.c +@@ -36,9 +36,6 @@ + #include + #include "hns_roce_device.h" + +-#define VLAN_SL_MASK 7 +-#define VLAN_SL_SHIFT 13 +- + static inline u16 get_ah_udp_sport(const struct rdma_ah_attr *ah_attr) + { + u32 fl = ah_attr->grh.flow_label; +@@ -81,18 +78,12 @@ int hns_roce_create_ah(struct ib_ah *ibah, struct rdma_ah_init_attr *init_attr, + + /* HIP08 needs to record vlan info in Address Vector */ + if (hr_dev->pci_dev->revision <= PCI_REVISION_ID_HIP08) { +- ah->av.vlan_en = 0; +- + ret = rdma_read_gid_l2_fields(ah_attr->grh.sgid_attr, + &ah->av.vlan_id, NULL); + if (ret) + return ret; + +- if (ah->av.vlan_id < VLAN_N_VID) { +- ah->av.vlan_en = 1; +- ah->av.vlan_id |= (rdma_ah_get_sl(ah_attr) & VLAN_SL_MASK) << +- VLAN_SL_SHIFT; +- } ++ ah->av.vlan_en = ah->av.vlan_id < VLAN_N_VID; + } + + return ret; +-- +2.27.0 + diff --git a/queue-5.10/scsi-ufs-fix-wsometimes-uninitialized-warning.patch b/queue-5.10/scsi-ufs-fix-wsometimes-uninitialized-warning.patch new file mode 100644 index 00000000000..600783152ba --- /dev/null +++ b/queue-5.10/scsi-ufs-fix-wsometimes-uninitialized-warning.patch @@ -0,0 +1,48 @@ +From 6f466a97ae5a0023407a3d45b04299c6351661fb Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 3 Dec 2020 23:31:26 +0100 +Subject: scsi: ufs: Fix -Wsometimes-uninitialized warning + +From: Arnd Bergmann + +[ Upstream commit 4c60244dc37262023d24b167e245055c06bc0b77 ] + +clang complains about a possible code path in which a variable is used +without an initialization: + +drivers/scsi/ufs/ufshcd.c:7690:3: error: variable 'sdp' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized] + BUG_ON(1); + ^~~~~~~~~ +include/asm-generic/bug.h:63:36: note: expanded from macro 'BUG_ON' + #define BUG_ON(condition) do { if (unlikely(condition)) BUG(); } while (0) + ^~~~~~~~~~~~~~~~~~~ + +Turn the BUG_ON(1) into an unconditional BUG() that makes it clear to clang +that this code path is never hit. + +Link: https://lore.kernel.org/r/20201203223137.1205933-1-arnd@kernel.org +Fixes: 4f3e900b6282 ("scsi: ufs: Clear UAC for FFU and RPMB LUNs") +Reviewed-by: Avri Altman +Signed-off-by: Arnd Bergmann +Signed-off-by: Martin K. Petersen +Signed-off-by: Sasha Levin +--- + drivers/scsi/ufs/ufshcd.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c +index 02f161468daf5..7558b4abebfc5 100644 +--- a/drivers/scsi/ufs/ufshcd.c ++++ b/drivers/scsi/ufs/ufshcd.c +@@ -7651,7 +7651,7 @@ static int ufshcd_clear_ua_wlun(struct ufs_hba *hba, u8 wlun) + else if (wlun == UFS_UPIU_RPMB_WLUN) + sdp = hba->sdev_rpmb; + else +- BUG_ON(1); ++ BUG(); + if (sdp) { + ret = scsi_device_get(sdp); + if (!ret && !scsi_device_online(sdp)) { +-- +2.27.0 + diff --git a/queue-5.10/series b/queue-5.10/series index 790da9248e4..9ecdd94575a 100644 --- a/queue-5.10/series +++ b/queue-5.10/series @@ -2,3 +2,8 @@ powerpc-32s-fix-rtas-machine-check-with-vmap-stack.patch io_uring-synchronise-iopoll-on-task_submit-fail.patch io_uring-limit-io-sq-poll-submit-locking-scope.patch io_uring-patch-up-iopoll-overflow_flush-sync.patch +rdma-hns-avoid-filling-sl-in-high-3-bits-of-vlan_id.patch +iommu-arm-smmu-qcom-initialize-sctlr-of-the-bypass-c.patch +drm-panfrost-don-t-corrupt-the-queue-mutex-on-open-c.patch +io_uring-fix-return-value-from-alloc_fixed_file_ref_.patch +scsi-ufs-fix-wsometimes-uninitialized-warning.patch -- 2.47.3