Skip to content

Commit fc3ebc3

Browse files
committed
Merge tag 'char-misc-5.8-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc
Pull char/misc fixes from Greg KH: "Some tiny char/misc driver fixes for 5.8-rc3. The "largest" changes are in the mei driver, to resolve some reported problems and add some new device ids. There's also a binder bugfix, an fpga driver build fix, and some assorted habanalabs fixes. All of these, except for the habanalabs fixes, have been in linux-next with no reported issues. The habanalabs driver changes showed up in my tree on Friday, but as they are totally self-contained, all should be good there" * tag 'char-misc-5.8-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc: habanalabs: increase h/w timer when checking idle habanalabs: Correct handling when failing to enqueue CB habanalabs: increase GAUDI QMAN ARB WDT timeout habanalabs: rename mmu_write() to mmu_asid_va_write() habanalabs: use PI in MMU cache invalidation habanalabs: block scalar load_and_exe on external queue mei: me: add tiger lake point device ids for H platforms. mei: me: disable mei interface on Mehlow server platforms binder: fix null deref of proc->context fpga: zynqmp: fix modular build
2 parents 42f8f9b + 70b23b8 commit fc3ebc3

File tree

11 files changed

+153
-30
lines changed

11 files changed

+153
-30
lines changed

drivers/android/binder.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4686,8 +4686,15 @@ static struct binder_thread *binder_get_thread(struct binder_proc *proc)
46864686

46874687
static void binder_free_proc(struct binder_proc *proc)
46884688
{
4689+
struct binder_device *device;
4690+
46894691
BUG_ON(!list_empty(&proc->todo));
46904692
BUG_ON(!list_empty(&proc->delivered_death));
4693+
device = container_of(proc->context, struct binder_device, context);
4694+
if (refcount_dec_and_test(&device->ref)) {
4695+
kfree(proc->context->name);
4696+
kfree(device);
4697+
}
46914698
binder_alloc_deferred_release(&proc->alloc);
46924699
put_task_struct(proc->tsk);
46934700
binder_stats_deleted(BINDER_STAT_PROC);
@@ -5406,7 +5413,6 @@ static int binder_node_release(struct binder_node *node, int refs)
54065413
static void binder_deferred_release(struct binder_proc *proc)
54075414
{
54085415
struct binder_context *context = proc->context;
5409-
struct binder_device *device;
54105416
struct rb_node *n;
54115417
int threads, nodes, incoming_refs, outgoing_refs, active_transactions;
54125418

@@ -5423,12 +5429,6 @@ static void binder_deferred_release(struct binder_proc *proc)
54235429
context->binder_context_mgr_node = NULL;
54245430
}
54255431
mutex_unlock(&context->context_mgr_node_lock);
5426-
device = container_of(proc->context, struct binder_device, context);
5427-
if (refcount_dec_and_test(&device->ref)) {
5428-
kfree(context->name);
5429-
kfree(device);
5430-
}
5431-
proc->context = NULL;
54325432
binder_inner_proc_lock(proc);
54335433
/*
54345434
* Make sure proc stays alive after we

drivers/fpga/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ config FPGA_DFL_PCI
208208

209209
config FPGA_MGR_ZYNQMP_FPGA
210210
tristate "Xilinx ZynqMP FPGA"
211-
depends on ARCH_ZYNQMP || COMPILE_TEST
211+
depends on ZYNQMP_FIRMWARE || (!ZYNQMP_FIRMWARE && COMPILE_TEST)
212212
help
213213
FPGA manager driver support for Xilinx ZynqMP FPGAs.
214214
This driver uses the processor configuration port(PCAP)

drivers/misc/habanalabs/command_submission.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,12 @@ static void hl_fence_release(struct dma_fence *fence)
6262
container_of(fence, struct hl_cs_compl, base_fence);
6363
struct hl_device *hdev = hl_cs_cmpl->hdev;
6464

65+
/* EBUSY means the CS was never submitted and hence we don't have
66+
* an attached hw_sob object that we should handle here
67+
*/
68+
if (fence->error == -EBUSY)
69+
goto free;
70+
6571
if ((hl_cs_cmpl->type == CS_TYPE_SIGNAL) ||
6672
(hl_cs_cmpl->type == CS_TYPE_WAIT)) {
6773

@@ -92,6 +98,7 @@ static void hl_fence_release(struct dma_fence *fence)
9298
kref_put(&hl_cs_cmpl->hw_sob->kref, hl_sob_reset);
9399
}
94100

101+
free:
95102
kfree_rcu(hl_cs_cmpl, base_fence.rcu);
96103
}
97104

@@ -328,10 +335,16 @@ static void cs_do_release(struct kref *ref)
328335

329336
hl_ctx_put(cs->ctx);
330337

338+
/* We need to mark an error for not submitted because in that case
339+
* the dma fence release flow is different. Mainly, we don't need
340+
* to handle hw_sob for signal/wait
341+
*/
331342
if (cs->timedout)
332343
dma_fence_set_error(cs->fence, -ETIMEDOUT);
333344
else if (cs->aborted)
334345
dma_fence_set_error(cs->fence, -EIO);
346+
else if (!cs->submitted)
347+
dma_fence_set_error(cs->fence, -EBUSY);
335348

336349
dma_fence_signal(cs->fence);
337350
dma_fence_put(cs->fence);

drivers/misc/habanalabs/debugfs.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,7 @@ static int mmu_show(struct seq_file *s, void *data)
480480
return 0;
481481
}
482482

483-
static ssize_t mmu_write(struct file *file, const char __user *buf,
483+
static ssize_t mmu_asid_va_write(struct file *file, const char __user *buf,
484484
size_t count, loff_t *f_pos)
485485
{
486486
struct seq_file *s = file->private_data;
@@ -1125,7 +1125,7 @@ static const struct hl_info_list hl_debugfs_list[] = {
11251125
{"command_submission_jobs", command_submission_jobs_show, NULL},
11261126
{"userptr", userptr_show, NULL},
11271127
{"vm", vm_show, NULL},
1128-
{"mmu", mmu_show, mmu_write},
1128+
{"mmu", mmu_show, mmu_asid_va_write},
11291129
{"engines", engines_show, NULL}
11301130
};
11311131

drivers/misc/habanalabs/gaudi/gaudi.c

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@
9696

9797
#define GAUDI_NUM_OF_QM_ARB_ERR_CAUSE 3
9898

99-
#define GAUDI_ARB_WDT_TIMEOUT 0x400000
99+
#define GAUDI_ARB_WDT_TIMEOUT 0x1000000
100100

101101
static const char gaudi_irq_name[GAUDI_MSI_ENTRIES][GAUDI_MAX_STRING_LEN] = {
102102
"gaudi cq 0_0", "gaudi cq 0_1", "gaudi cq 0_2", "gaudi cq 0_3",
@@ -1893,6 +1893,8 @@ static void gaudi_init_pci_dma_qman(struct hl_device *hdev, int dma_id,
18931893
WREG32(mmDMA0_QM_CP_MSG_BASE3_ADDR_LO_0 + q_off, so_base_ws_lo);
18941894
WREG32(mmDMA0_QM_CP_MSG_BASE3_ADDR_HI_0 + q_off, so_base_ws_hi);
18951895

1896+
WREG32(mmDMA0_QM_CP_BARRIER_CFG_0 + q_off, 0x100);
1897+
18961898
/* The following configuration is needed only once per QMAN */
18971899
if (qman_id == 0) {
18981900
/* Configure RAZWI IRQ */
@@ -2725,6 +2727,12 @@ static int gaudi_mmu_init(struct hl_device *hdev)
27252727
WREG32(mmSTLB_HOP_CONFIGURATION,
27262728
hdev->mmu_huge_page_opt ? 0x30440 : 0x40440);
27272729

2730+
/*
2731+
* The H/W expects the first PI after init to be 1. After wraparound
2732+
* we'll write 0.
2733+
*/
2734+
gaudi->mmu_cache_inv_pi = 1;
2735+
27282736
gaudi->hw_cap_initialized |= HW_CAP_MMU;
27292737

27302738
return 0;
@@ -3790,6 +3798,25 @@ static int gaudi_validate_dma_pkt_no_mmu(struct hl_device *hdev,
37903798
src_in_host);
37913799
}
37923800

3801+
static int gaudi_validate_load_and_exe_pkt(struct hl_device *hdev,
3802+
struct hl_cs_parser *parser,
3803+
struct packet_load_and_exe *user_pkt)
3804+
{
3805+
u32 cfg;
3806+
3807+
cfg = le32_to_cpu(user_pkt->cfg);
3808+
3809+
if (cfg & GAUDI_PKT_LOAD_AND_EXE_CFG_DST_MASK) {
3810+
dev_err(hdev->dev,
3811+
"User not allowed to use Load and Execute\n");
3812+
return -EPERM;
3813+
}
3814+
3815+
parser->patched_cb_size += sizeof(struct packet_load_and_exe);
3816+
3817+
return 0;
3818+
}
3819+
37933820
static int gaudi_validate_cb(struct hl_device *hdev,
37943821
struct hl_cs_parser *parser, bool is_mmu)
37953822
{
@@ -3838,6 +3865,11 @@ static int gaudi_validate_cb(struct hl_device *hdev,
38383865
rc = -EPERM;
38393866
break;
38403867

3868+
case PACKET_LOAD_AND_EXE:
3869+
rc = gaudi_validate_load_and_exe_pkt(hdev, parser,
3870+
(struct packet_load_and_exe *) user_pkt);
3871+
break;
3872+
38413873
case PACKET_LIN_DMA:
38423874
parser->contains_dma_pkt = true;
38433875
if (is_mmu)
@@ -3855,7 +3887,6 @@ static int gaudi_validate_cb(struct hl_device *hdev,
38553887
case PACKET_FENCE:
38563888
case PACKET_NOP:
38573889
case PACKET_ARB_POINT:
3858-
case PACKET_LOAD_AND_EXE:
38593890
parser->patched_cb_size += pkt_size;
38603891
break;
38613892

@@ -5994,6 +6025,8 @@ static int gaudi_mmu_invalidate_cache(struct hl_device *hdev, bool is_hard,
59946025
mutex_lock(&hdev->mmu_cache_lock);
59956026

59966027
/* L0 & L1 invalidation */
6028+
WREG32(mmSTLB_INV_PS, 3);
6029+
WREG32(mmSTLB_CACHE_INV, gaudi->mmu_cache_inv_pi++);
59976030
WREG32(mmSTLB_INV_PS, 2);
59986031

59996032
rc = hl_poll_timeout(

drivers/misc/habanalabs/gaudi/gaudiP.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,8 @@ struct gaudi_internal_qman_info {
229229
* @multi_msi_mode: whether we are working in multi MSI single MSI mode.
230230
* Multi MSI is possible only with IOMMU enabled.
231231
* @ext_queue_idx: helper index for external queues initialization.
232+
* @mmu_cache_inv_pi: PI for MMU cache invalidation flow. The H/W expects an
233+
* 8-bit value so use u8.
232234
*/
233235
struct gaudi_device {
234236
int (*armcp_info_get)(struct hl_device *hdev);
@@ -248,6 +250,7 @@ struct gaudi_device {
248250
u32 hw_cap_initialized;
249251
u8 multi_msi_mode;
250252
u8 ext_queue_idx;
253+
u8 mmu_cache_inv_pi;
251254
};
252255

253256
void gaudi_init_security(struct hl_device *hdev);

drivers/misc/habanalabs/include/gaudi/gaudi_packets.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,9 @@ struct packet_wait {
197197
__le32 ctl;
198198
};
199199

200+
#define GAUDI_PKT_LOAD_AND_EXE_CFG_DST_SHIFT 0
201+
#define GAUDI_PKT_LOAD_AND_EXE_CFG_DST_MASK 0x00000001
202+
200203
struct packet_load_and_exe {
201204
__le32 cfg;
202205
__le32 ctl;

drivers/misc/mei/hw-me-regs.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@
9494
#define MEI_DEV_ID_JSP_N 0x4DE0 /* Jasper Lake Point N */
9595

9696
#define MEI_DEV_ID_TGP_LP 0xA0E0 /* Tiger Lake Point LP */
97+
#define MEI_DEV_ID_TGP_H 0x43E0 /* Tiger Lake Point H */
9798

9899
#define MEI_DEV_ID_MCC 0x4B70 /* Mule Creek Canyon (EHL) */
99100
#define MEI_DEV_ID_MCC_4 0x4B75 /* Mule Creek Canyon 4 (EHL) */
@@ -107,6 +108,8 @@
107108
# define PCI_CFG_HFS_1_D0I3_MSK 0x80000000
108109
#define PCI_CFG_HFS_2 0x48
109110
#define PCI_CFG_HFS_3 0x60
111+
# define PCI_CFG_HFS_3_FW_SKU_MSK 0x00000070
112+
# define PCI_CFG_HFS_3_FW_SKU_SPS 0x00000060
110113
#define PCI_CFG_HFS_4 0x64
111114
#define PCI_CFG_HFS_5 0x68
112115
#define PCI_CFG_HFS_6 0x6C

drivers/misc/mei/hw-me.c

Lines changed: 64 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1366,7 +1366,7 @@ static bool mei_me_fw_type_nm(struct pci_dev *pdev)
13661366
#define MEI_CFG_FW_NM \
13671367
.quirk_probe = mei_me_fw_type_nm
13681368

1369-
static bool mei_me_fw_type_sps(struct pci_dev *pdev)
1369+
static bool mei_me_fw_type_sps_4(struct pci_dev *pdev)
13701370
{
13711371
u32 reg;
13721372
unsigned int devfn;
@@ -1382,7 +1382,36 @@ static bool mei_me_fw_type_sps(struct pci_dev *pdev)
13821382
return (reg & 0xf0000) == 0xf0000;
13831383
}
13841384

1385-
#define MEI_CFG_FW_SPS \
1385+
#define MEI_CFG_FW_SPS_4 \
1386+
.quirk_probe = mei_me_fw_type_sps_4
1387+
1388+
/**
1389+
* mei_me_fw_sku_sps() - check for sps sku
1390+
*
1391+
* Read ME FW Status register to check for SPS Firmware.
1392+
* The SPS FW is only signaled in pci function 0
1393+
*
1394+
* @pdev: pci device
1395+
*
1396+
* Return: true in case of SPS firmware
1397+
*/
1398+
static bool mei_me_fw_type_sps(struct pci_dev *pdev)
1399+
{
1400+
u32 reg;
1401+
u32 fw_type;
1402+
unsigned int devfn;
1403+
1404+
devfn = PCI_DEVFN(PCI_SLOT(pdev->devfn), 0);
1405+
pci_bus_read_config_dword(pdev->bus, devfn, PCI_CFG_HFS_3, &reg);
1406+
trace_mei_pci_cfg_read(&pdev->dev, "PCI_CFG_HFS_3", PCI_CFG_HFS_3, reg);
1407+
fw_type = (reg & PCI_CFG_HFS_3_FW_SKU_MSK);
1408+
1409+
dev_dbg(&pdev->dev, "fw type is %d\n", fw_type);
1410+
1411+
return fw_type == PCI_CFG_HFS_3_FW_SKU_SPS;
1412+
}
1413+
1414+
#define MEI_CFG_FW_SPS \
13861415
.quirk_probe = mei_me_fw_type_sps
13871416

13881417
#define MEI_CFG_FW_VER_SUPP \
@@ -1452,10 +1481,17 @@ static const struct mei_cfg mei_me_pch8_cfg = {
14521481
};
14531482

14541483
/* PCH8 Lynx Point with quirk for SPS Firmware exclusion */
1455-
static const struct mei_cfg mei_me_pch8_sps_cfg = {
1484+
static const struct mei_cfg mei_me_pch8_sps_4_cfg = {
14561485
MEI_CFG_PCH8_HFS,
14571486
MEI_CFG_FW_VER_SUPP,
1458-
MEI_CFG_FW_SPS,
1487+
MEI_CFG_FW_SPS_4,
1488+
};
1489+
1490+
/* LBG with quirk for SPS (4.0) Firmware exclusion */
1491+
static const struct mei_cfg mei_me_pch12_sps_4_cfg = {
1492+
MEI_CFG_PCH8_HFS,
1493+
MEI_CFG_FW_VER_SUPP,
1494+
MEI_CFG_FW_SPS_4,
14591495
};
14601496

14611497
/* Cannon Lake and newer devices */
@@ -1465,8 +1501,18 @@ static const struct mei_cfg mei_me_pch12_cfg = {
14651501
MEI_CFG_DMA_128,
14661502
};
14671503

1468-
/* LBG with quirk for SPS Firmware exclusion */
1504+
/* Cannon Lake with quirk for SPS 5.0 and newer Firmware exclusion */
14691505
static const struct mei_cfg mei_me_pch12_sps_cfg = {
1506+
MEI_CFG_PCH8_HFS,
1507+
MEI_CFG_FW_VER_SUPP,
1508+
MEI_CFG_DMA_128,
1509+
MEI_CFG_FW_SPS,
1510+
};
1511+
1512+
/* Cannon Lake with quirk for SPS 5.0 and newer Firmware exclusion
1513+
* w/o DMA support
1514+
*/
1515+
static const struct mei_cfg mei_me_pch12_nodma_sps_cfg = {
14701516
MEI_CFG_PCH8_HFS,
14711517
MEI_CFG_FW_VER_SUPP,
14721518
MEI_CFG_FW_SPS,
@@ -1480,6 +1526,15 @@ static const struct mei_cfg mei_me_pch15_cfg = {
14801526
MEI_CFG_TRC,
14811527
};
14821528

1529+
/* Tiger Lake with quirk for SPS 5.0 and newer Firmware exclusion */
1530+
static const struct mei_cfg mei_me_pch15_sps_cfg = {
1531+
MEI_CFG_PCH8_HFS,
1532+
MEI_CFG_FW_VER_SUPP,
1533+
MEI_CFG_DMA_128,
1534+
MEI_CFG_TRC,
1535+
MEI_CFG_FW_SPS,
1536+
};
1537+
14831538
/*
14841539
* mei_cfg_list - A list of platform platform specific configurations.
14851540
* Note: has to be synchronized with enum mei_cfg_idx.
@@ -1492,10 +1547,13 @@ static const struct mei_cfg *const mei_cfg_list[] = {
14921547
[MEI_ME_PCH7_CFG] = &mei_me_pch7_cfg,
14931548
[MEI_ME_PCH_CPT_PBG_CFG] = &mei_me_pch_cpt_pbg_cfg,
14941549
[MEI_ME_PCH8_CFG] = &mei_me_pch8_cfg,
1495-
[MEI_ME_PCH8_SPS_CFG] = &mei_me_pch8_sps_cfg,
1550+
[MEI_ME_PCH8_SPS_4_CFG] = &mei_me_pch8_sps_4_cfg,
14961551
[MEI_ME_PCH12_CFG] = &mei_me_pch12_cfg,
1552+
[MEI_ME_PCH12_SPS_4_CFG] = &mei_me_pch12_sps_4_cfg,
14971553
[MEI_ME_PCH12_SPS_CFG] = &mei_me_pch12_sps_cfg,
1554+
[MEI_ME_PCH12_SPS_NODMA_CFG] = &mei_me_pch12_nodma_sps_cfg,
14981555
[MEI_ME_PCH15_CFG] = &mei_me_pch15_cfg,
1556+
[MEI_ME_PCH15_SPS_CFG] = &mei_me_pch15_sps_cfg,
14991557
};
15001558

15011559
const struct mei_cfg *mei_me_get_cfg(kernel_ulong_t idx)

drivers/misc/mei/hw-me.h

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* SPDX-License-Identifier: GPL-2.0 */
22
/*
3-
* Copyright (c) 2012-2019, Intel Corporation. All rights reserved.
3+
* Copyright (c) 2012-2020, Intel Corporation. All rights reserved.
44
* Intel Management Engine Interface (Intel MEI) Linux driver
55
*/
66

@@ -76,14 +76,20 @@ struct mei_me_hw {
7676
* with quirk for Node Manager exclusion.
7777
* @MEI_ME_PCH8_CFG: Platform Controller Hub Gen8 and newer
7878
* client platforms.
79-
* @MEI_ME_PCH8_SPS_CFG: Platform Controller Hub Gen8 and newer
79+
* @MEI_ME_PCH8_SPS_4_CFG: Platform Controller Hub Gen8 and newer
8080
* servers platforms with quirk for
8181
* SPS firmware exclusion.
8282
* @MEI_ME_PCH12_CFG: Platform Controller Hub Gen12 and newer
83-
* @MEI_ME_PCH12_SPS_CFG: Platform Controller Hub Gen12 and newer
83+
* @MEI_ME_PCH12_SPS_4_CFG:Platform Controller Hub Gen12 up to 4.0
84+
* servers platforms with quirk for
85+
* SPS firmware exclusion.
86+
* @MEI_ME_PCH12_SPS_CFG: Platform Controller Hub Gen12 5.0 and newer
8487
* servers platforms with quirk for
8588
* SPS firmware exclusion.
8689
* @MEI_ME_PCH15_CFG: Platform Controller Hub Gen15 and newer
90+
* @MEI_ME_PCH15_SPS_CFG: Platform Controller Hub Gen15 and newer
91+
* servers platforms with quirk for
92+
* SPS firmware exclusion.
8793
* @MEI_ME_NUM_CFG: Upper Sentinel.
8894
*/
8995
enum mei_cfg_idx {
@@ -94,10 +100,13 @@ enum mei_cfg_idx {
94100
MEI_ME_PCH7_CFG,
95101
MEI_ME_PCH_CPT_PBG_CFG,
96102
MEI_ME_PCH8_CFG,
97-
MEI_ME_PCH8_SPS_CFG,
103+
MEI_ME_PCH8_SPS_4_CFG,
98104
MEI_ME_PCH12_CFG,
105+
MEI_ME_PCH12_SPS_4_CFG,
99106
MEI_ME_PCH12_SPS_CFG,
107+
MEI_ME_PCH12_SPS_NODMA_CFG,
100108
MEI_ME_PCH15_CFG,
109+
MEI_ME_PCH15_SPS_CFG,
101110
MEI_ME_NUM_CFG,
102111
};
103112

0 commit comments

Comments
 (0)