Skip to content

Commit 1ada901

Browse files
committed
Merge tag 'char-misc-5.8-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc into master
Pull char/misc driver fixes from Greg KH: "Here are a few small driver fixes for 5.8-rc7 They include: - habanalabs fixes - tiny fpga driver fixes - /dev/mem fixup from previous changes - interconnect driver fixes - binder fix All of these have been in linux-next for a while with no reported issues" * tag 'char-misc-5.8-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc: interconnect: msm8916: Fix buswidth of pcnoc_s nodes interconnect: Do not skip aggregation for disabled paths /dev/mem: Add missing memory barriers for devmem_inode binder: Don't use mmput() from shrinker function. habanalabs: prevent possible out-of-bounds array access fpga: dfl: fix bug in port reset handshake fpga: dfl: pci: reduce the scope of variable 'ret' habanalabs: set 4s timeout for message to device CPU habanalabs: set clock gating per engine habanalabs: block WREG_BULK packet on PDMA
2 parents 7f2e231 + 92d232d commit 1ada901

File tree

17 files changed

+186
-112
lines changed

17 files changed

+186
-112
lines changed

Documentation/ABI/testing/debugfs-driver-habanalabs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,16 @@ Description: Allow the root user to disable/enable in runtime the clock
1616
gating mechanism in Gaudi. Due to how Gaudi is built, the
1717
clock gating needs to be disabled in order to access the
1818
registers of the TPC and MME engines. This is sometimes needed
19-
during debug by the user and hence the user needs this option
19+
during debug by the user and hence the user needs this option.
20+
The user can supply a bitmask value, each bit represents
21+
a different engine to disable/enable its clock gating feature.
22+
The bitmask is composed of 20 bits:
23+
0 - 7 : DMA channels
24+
8 - 11 : MME engines
25+
12 - 19 : TPC engines
26+
The bit's location of a specific engine can be determined
27+
using (1 << GAUDI_ENGINE_ID_*). GAUDI_ENGINE_ID_* values
28+
are defined in uapi habanalabs.h file in enum gaudi_engine_id
2029

2130
What: /sys/kernel/debug/habanalabs/hl<n>/command_buffers
2231
Date: Jan 2019

drivers/android/binder_alloc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -947,7 +947,7 @@ enum lru_status binder_alloc_free_page(struct list_head *item,
947947
trace_binder_unmap_user_end(alloc, index);
948948
}
949949
mmap_read_unlock(mm);
950-
mmput(mm);
950+
mmput_async(mm);
951951

952952
trace_binder_unmap_kernel_start(alloc, index);
953953

drivers/char/mem.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -814,7 +814,8 @@ static struct inode *devmem_inode;
814814
#ifdef CONFIG_IO_STRICT_DEVMEM
815815
void revoke_devmem(struct resource *res)
816816
{
817-
struct inode *inode = READ_ONCE(devmem_inode);
817+
/* pairs with smp_store_release() in devmem_init_inode() */
818+
struct inode *inode = smp_load_acquire(&devmem_inode);
818819

819820
/*
820821
* Check that the initialization has completed. Losing the race
@@ -1028,8 +1029,11 @@ static int devmem_init_inode(void)
10281029
return rc;
10291030
}
10301031

1031-
/* publish /dev/mem initialized */
1032-
WRITE_ONCE(devmem_inode, inode);
1032+
/*
1033+
* Publish /dev/mem initialized.
1034+
* Pairs with smp_load_acquire() in revoke_devmem().
1035+
*/
1036+
smp_store_release(&devmem_inode, inode);
10331037

10341038
return 0;
10351039
}

drivers/fpga/dfl-afu-main.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,8 @@ int __afu_port_disable(struct platform_device *pdev)
8383
* on this port and minimum soft reset pulse width has elapsed.
8484
* Driver polls port_soft_reset_ack to determine if reset done by HW.
8585
*/
86-
if (readq_poll_timeout(base + PORT_HDR_CTRL, v, v & PORT_CTRL_SFTRST,
86+
if (readq_poll_timeout(base + PORT_HDR_CTRL, v,
87+
v & PORT_CTRL_SFTRST_ACK,
8788
RST_POLL_INVL, RST_POLL_TIMEOUT)) {
8889
dev_err(&pdev->dev, "timeout, fail to reset device\n");
8990
return -ETIMEDOUT;

drivers/fpga/dfl-pci.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,6 @@ static int cci_pci_sriov_configure(struct pci_dev *pcidev, int num_vfs)
227227
{
228228
struct cci_drvdata *drvdata = pci_get_drvdata(pcidev);
229229
struct dfl_fpga_cdev *cdev = drvdata->cdev;
230-
int ret = 0;
231230

232231
if (!num_vfs) {
233232
/*
@@ -239,6 +238,8 @@ static int cci_pci_sriov_configure(struct pci_dev *pcidev, int num_vfs)
239238
dfl_fpga_cdev_config_ports_pf(cdev);
240239

241240
} else {
241+
int ret;
242+
242243
/*
243244
* before enable SRIOV, put released ports into VF access mode
244245
* first of all.

drivers/interconnect/core.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,7 @@ static int aggregate_requests(struct icc_node *node)
243243
{
244244
struct icc_provider *p = node->provider;
245245
struct icc_req *r;
246+
u32 avg_bw, peak_bw;
246247

247248
node->avg_bw = 0;
248249
node->peak_bw = 0;
@@ -251,9 +252,14 @@ static int aggregate_requests(struct icc_node *node)
251252
p->pre_aggregate(node);
252253

253254
hlist_for_each_entry(r, &node->req_list, req_node) {
254-
if (!r->enabled)
255-
continue;
256-
p->aggregate(node, r->tag, r->avg_bw, r->peak_bw,
255+
if (r->enabled) {
256+
avg_bw = r->avg_bw;
257+
peak_bw = r->peak_bw;
258+
} else {
259+
avg_bw = 0;
260+
peak_bw = 0;
261+
}
262+
p->aggregate(node, r->tag, avg_bw, peak_bw,
257263
&node->avg_bw, &node->peak_bw);
258264
}
259265

drivers/interconnect/qcom/msm8916.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -197,13 +197,13 @@ DEFINE_QNODE(pcnoc_int_0, MSM8916_PNOC_INT_0, 8, -1, -1, MSM8916_PNOC_SNOC_MAS,
197197
DEFINE_QNODE(pcnoc_int_1, MSM8916_PNOC_INT_1, 8, -1, -1, MSM8916_PNOC_SNOC_MAS);
198198
DEFINE_QNODE(pcnoc_m_0, MSM8916_PNOC_MAS_0, 8, -1, -1, MSM8916_PNOC_INT_0);
199199
DEFINE_QNODE(pcnoc_m_1, MSM8916_PNOC_MAS_1, 8, -1, -1, MSM8916_PNOC_SNOC_MAS);
200-
DEFINE_QNODE(pcnoc_s_0, MSM8916_PNOC_SLV_0, 8, -1, -1, MSM8916_SLAVE_CLK_CTL, MSM8916_SLAVE_TLMM, MSM8916_SLAVE_TCSR, MSM8916_SLAVE_SECURITY, MSM8916_SLAVE_MSS);
201-
DEFINE_QNODE(pcnoc_s_1, MSM8916_PNOC_SLV_1, 8, -1, -1, MSM8916_SLAVE_IMEM_CFG, MSM8916_SLAVE_CRYPTO_0_CFG, MSM8916_SLAVE_MSG_RAM, MSM8916_SLAVE_PDM, MSM8916_SLAVE_PRNG);
202-
DEFINE_QNODE(pcnoc_s_2, MSM8916_PNOC_SLV_2, 8, -1, -1, MSM8916_SLAVE_SPDM, MSM8916_SLAVE_BOOT_ROM, MSM8916_SLAVE_BIMC_CFG, MSM8916_SLAVE_PNOC_CFG, MSM8916_SLAVE_PMIC_ARB);
203-
DEFINE_QNODE(pcnoc_s_3, MSM8916_PNOC_SLV_3, 8, -1, -1, MSM8916_SLAVE_MPM, MSM8916_SLAVE_SNOC_CFG, MSM8916_SLAVE_RBCPR_CFG, MSM8916_SLAVE_QDSS_CFG, MSM8916_SLAVE_DEHR_CFG);
204-
DEFINE_QNODE(pcnoc_s_4, MSM8916_PNOC_SLV_4, 8, -1, -1, MSM8916_SLAVE_VENUS_CFG, MSM8916_SLAVE_CAMERA_CFG, MSM8916_SLAVE_DISPLAY_CFG);
205-
DEFINE_QNODE(pcnoc_s_8, MSM8916_PNOC_SLV_8, 8, -1, -1, MSM8916_SLAVE_USB_HS, MSM8916_SLAVE_SDCC_1, MSM8916_SLAVE_BLSP_1);
206-
DEFINE_QNODE(pcnoc_s_9, MSM8916_PNOC_SLV_9, 8, -1, -1, MSM8916_SLAVE_SDCC_2, MSM8916_SLAVE_LPASS, MSM8916_SLAVE_GRAPHICS_3D_CFG);
200+
DEFINE_QNODE(pcnoc_s_0, MSM8916_PNOC_SLV_0, 4, -1, -1, MSM8916_SLAVE_CLK_CTL, MSM8916_SLAVE_TLMM, MSM8916_SLAVE_TCSR, MSM8916_SLAVE_SECURITY, MSM8916_SLAVE_MSS);
201+
DEFINE_QNODE(pcnoc_s_1, MSM8916_PNOC_SLV_1, 4, -1, -1, MSM8916_SLAVE_IMEM_CFG, MSM8916_SLAVE_CRYPTO_0_CFG, MSM8916_SLAVE_MSG_RAM, MSM8916_SLAVE_PDM, MSM8916_SLAVE_PRNG);
202+
DEFINE_QNODE(pcnoc_s_2, MSM8916_PNOC_SLV_2, 4, -1, -1, MSM8916_SLAVE_SPDM, MSM8916_SLAVE_BOOT_ROM, MSM8916_SLAVE_BIMC_CFG, MSM8916_SLAVE_PNOC_CFG, MSM8916_SLAVE_PMIC_ARB);
203+
DEFINE_QNODE(pcnoc_s_3, MSM8916_PNOC_SLV_3, 4, -1, -1, MSM8916_SLAVE_MPM, MSM8916_SLAVE_SNOC_CFG, MSM8916_SLAVE_RBCPR_CFG, MSM8916_SLAVE_QDSS_CFG, MSM8916_SLAVE_DEHR_CFG);
204+
DEFINE_QNODE(pcnoc_s_4, MSM8916_PNOC_SLV_4, 4, -1, -1, MSM8916_SLAVE_VENUS_CFG, MSM8916_SLAVE_CAMERA_CFG, MSM8916_SLAVE_DISPLAY_CFG);
205+
DEFINE_QNODE(pcnoc_s_8, MSM8916_PNOC_SLV_8, 4, -1, -1, MSM8916_SLAVE_USB_HS, MSM8916_SLAVE_SDCC_1, MSM8916_SLAVE_BLSP_1);
206+
DEFINE_QNODE(pcnoc_s_9, MSM8916_PNOC_SLV_9, 4, -1, -1, MSM8916_SLAVE_SDCC_2, MSM8916_SLAVE_LPASS, MSM8916_SLAVE_GRAPHICS_3D_CFG);
207207
DEFINE_QNODE(pcnoc_snoc_mas, MSM8916_PNOC_SNOC_MAS, 8, 29, -1, MSM8916_PNOC_SNOC_SLV);
208208
DEFINE_QNODE(pcnoc_snoc_slv, MSM8916_PNOC_SNOC_SLV, 8, -1, 45, MSM8916_SNOC_INT_0, MSM8916_SNOC_INT_BIMC, MSM8916_SNOC_INT_1);
209209
DEFINE_QNODE(qdss_int, MSM8916_SNOC_QDSS_INT, 8, -1, -1, MSM8916_SNOC_INT_0, MSM8916_SNOC_INT_BIMC);

drivers/misc/habanalabs/command_submission.c

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -499,11 +499,19 @@ static int validate_queue_index(struct hl_device *hdev,
499499
struct asic_fixed_properties *asic = &hdev->asic_prop;
500500
struct hw_queue_properties *hw_queue_prop;
501501

502+
/* This must be checked here to prevent out-of-bounds access to
503+
* hw_queues_props array
504+
*/
505+
if (chunk->queue_index >= HL_MAX_QUEUES) {
506+
dev_err(hdev->dev, "Queue index %d is invalid\n",
507+
chunk->queue_index);
508+
return -EINVAL;
509+
}
510+
502511
hw_queue_prop = &asic->hw_queues_props[chunk->queue_index];
503512

504-
if ((chunk->queue_index >= HL_MAX_QUEUES) ||
505-
(hw_queue_prop->type == QUEUE_TYPE_NA)) {
506-
dev_err(hdev->dev, "Queue index %d is invalid\n",
513+
if (hw_queue_prop->type == QUEUE_TYPE_NA) {
514+
dev_err(hdev->dev, "Queue index %d is not applicable\n",
507515
chunk->queue_index);
508516
return -EINVAL;
509517
}

drivers/misc/habanalabs/debugfs.c

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ static int hl_debugfs_i2c_read(struct hl_device *hdev, u8 i2c_bus, u8 i2c_addr,
3636
pkt.i2c_reg = i2c_reg;
3737

3838
rc = hdev->asic_funcs->send_cpu_message(hdev, (u32 *) &pkt, sizeof(pkt),
39-
HL_DEVICE_TIMEOUT_USEC, (long *) val);
39+
0, (long *) val);
4040

4141
if (rc)
4242
dev_err(hdev->dev, "Failed to read from I2C, error %d\n", rc);
@@ -63,7 +63,7 @@ static int hl_debugfs_i2c_write(struct hl_device *hdev, u8 i2c_bus, u8 i2c_addr,
6363
pkt.value = cpu_to_le64(val);
6464

6565
rc = hdev->asic_funcs->send_cpu_message(hdev, (u32 *) &pkt, sizeof(pkt),
66-
HL_DEVICE_TIMEOUT_USEC, NULL);
66+
0, NULL);
6767

6868
if (rc)
6969
dev_err(hdev->dev, "Failed to write to I2C, error %d\n", rc);
@@ -87,7 +87,7 @@ static void hl_debugfs_led_set(struct hl_device *hdev, u8 led, u8 state)
8787
pkt.value = cpu_to_le64(state);
8888

8989
rc = hdev->asic_funcs->send_cpu_message(hdev, (u32 *) &pkt, sizeof(pkt),
90-
HL_DEVICE_TIMEOUT_USEC, NULL);
90+
0, NULL);
9191

9292
if (rc)
9393
dev_err(hdev->dev, "Failed to set LED %d, error %d\n", led, rc);
@@ -981,7 +981,7 @@ static ssize_t hl_clk_gate_read(struct file *f, char __user *buf,
981981
if (*ppos)
982982
return 0;
983983

984-
sprintf(tmp_buf, "%d\n", hdev->clock_gating);
984+
sprintf(tmp_buf, "0x%llx\n", hdev->clock_gating_mask);
985985
rc = simple_read_from_buffer(buf, strlen(tmp_buf) + 1, ppos, tmp_buf,
986986
strlen(tmp_buf) + 1);
987987

@@ -993,7 +993,7 @@ static ssize_t hl_clk_gate_write(struct file *f, const char __user *buf,
993993
{
994994
struct hl_dbg_device_entry *entry = file_inode(f)->i_private;
995995
struct hl_device *hdev = entry->hdev;
996-
u32 value;
996+
u64 value;
997997
ssize_t rc;
998998

999999
if (atomic_read(&hdev->in_reset)) {
@@ -1002,19 +1002,12 @@ static ssize_t hl_clk_gate_write(struct file *f, const char __user *buf,
10021002
return 0;
10031003
}
10041004

1005-
rc = kstrtouint_from_user(buf, count, 10, &value);
1005+
rc = kstrtoull_from_user(buf, count, 16, &value);
10061006
if (rc)
10071007
return rc;
10081008

1009-
if (value) {
1010-
hdev->clock_gating = 1;
1011-
if (hdev->asic_funcs->enable_clock_gating)
1012-
hdev->asic_funcs->enable_clock_gating(hdev);
1013-
} else {
1014-
if (hdev->asic_funcs->disable_clock_gating)
1015-
hdev->asic_funcs->disable_clock_gating(hdev);
1016-
hdev->clock_gating = 0;
1017-
}
1009+
hdev->clock_gating_mask = value;
1010+
hdev->asic_funcs->set_clock_gating(hdev);
10181011

10191012
return count;
10201013
}

drivers/misc/habanalabs/device.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -608,7 +608,7 @@ int hl_device_set_debug_mode(struct hl_device *hdev, bool enable)
608608
hdev->in_debug = 0;
609609

610610
if (!hdev->hard_reset_pending)
611-
hdev->asic_funcs->enable_clock_gating(hdev);
611+
hdev->asic_funcs->set_clock_gating(hdev);
612612

613613
goto out;
614614
}

0 commit comments

Comments
 (0)