Skip to content

Commit f671440

Browse files
committed
Merge tag 'char-misc-6.2-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc
Pull char/misc driver fixes from Greg KH: "Here are some small char/misc and other subsystem driver fixes for 6.2-rc5 to resolve a few reported issues. They include: - long time pending fastrpc fixes (should have gone into 6.1, my fault) - mei driver/bus fixes and new device ids - interconnect driver fixes for reported problems - vmci bugfix - w1 driver bugfixes for reported problems Almost all of these have been in linux-next with no reported problems, the rest have all passed 0-day bot testing in my tree and on the mailing lists where they have sat too long due to me taking a long time to catch up on my pending patch queue" * tag 'char-misc-6.2-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc: VMCI: Use threaded irqs instead of tasklets misc: fastrpc: Pass bitfield into qcom_scm_assign_mem gsmi: fix null-deref in gsmi_get_variable misc: fastrpc: Fix use-after-free race condition for maps misc: fastrpc: Don't remove map on creater_process and device_release misc: fastrpc: Fix use-after-free and race in fastrpc_map_find misc: fastrpc: fix error code in fastrpc_req_mmap() mei: me: add meteor lake point M DID mei: bus: fix unlink on bus in error path w1: fix WARNING after calling w1_process() w1: fix deadloop in __w1_remove_master_device() comedi: adv_pci1760: Fix PWM instruction handling interconnect: qcom: rpm: Use _optional func for provider clocks interconnect: qcom: msm8996: Fix regmap max_register values interconnect: qcom: msm8996: Provide UFS clocks to A2NoC dt-bindings: interconnect: Add UFS clocks to MSM8996 A2NoC
2 parents c88a311 + 3daed63 commit f671440

File tree

12 files changed

+122
-91
lines changed

12 files changed

+122
-91
lines changed

Documentation/devicetree/bindings/interconnect/qcom,rpm.yaml

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ allOf:
8484
- qcom,msm8939-pcnoc
8585
- qcom,msm8939-snoc
8686
- qcom,msm8996-a1noc
87-
- qcom,msm8996-a2noc
8887
- qcom,msm8996-bimc
8988
- qcom,msm8996-cnoc
9089
- qcom,msm8996-pnoc
@@ -186,6 +185,29 @@ allOf:
186185
required:
187186
- power-domains
188187

188+
- if:
189+
properties:
190+
compatible:
191+
contains:
192+
enum:
193+
- qcom,msm8996-a2noc
194+
195+
then:
196+
properties:
197+
clock-names:
198+
items:
199+
- const: bus
200+
- const: bus_a
201+
- const: aggre2_ufs_axi
202+
- const: ufs_axi
203+
204+
clocks:
205+
items:
206+
- description: Bus Clock
207+
- description: Bus A Clock
208+
- description: Aggregate2 NoC UFS AXI Clock
209+
- description: UFS AXI Clock
210+
189211
- if:
190212
properties:
191213
compatible:

drivers/comedi/drivers/adv_pci1760.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
#define PCI1760_CMD_CLR_IMB2 0x00 /* Clears IMB2 */
5959
#define PCI1760_CMD_SET_DO 0x01 /* Set output state */
6060
#define PCI1760_CMD_GET_DO 0x02 /* Read output status */
61-
#define PCI1760_CMD_GET_STATUS 0x03 /* Read current status */
61+
#define PCI1760_CMD_GET_STATUS 0x07 /* Read current status */
6262
#define PCI1760_CMD_GET_FW_VER 0x0e /* Read firmware version */
6363
#define PCI1760_CMD_GET_HW_VER 0x0f /* Read hardware version */
6464
#define PCI1760_CMD_SET_PWM_HI(x) (0x10 + (x) * 2) /* Set "hi" period */

drivers/firmware/google/gsmi.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -361,9 +361,10 @@ static efi_status_t gsmi_get_variable(efi_char16_t *name,
361361
memcpy(data, gsmi_dev.data_buf->start, *data_size);
362362

363363
/* All variables are have the following attributes */
364-
*attr = EFI_VARIABLE_NON_VOLATILE |
365-
EFI_VARIABLE_BOOTSERVICE_ACCESS |
366-
EFI_VARIABLE_RUNTIME_ACCESS;
364+
if (attr)
365+
*attr = EFI_VARIABLE_NON_VOLATILE |
366+
EFI_VARIABLE_BOOTSERVICE_ACCESS |
367+
EFI_VARIABLE_RUNTIME_ACCESS;
367368
}
368369

369370
spin_unlock_irqrestore(&gsmi_dev.lock, flags);

drivers/interconnect/qcom/icc-rpm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,7 @@ int qnoc_probe(struct platform_device *pdev)
488488
}
489489

490490
regmap_done:
491-
ret = devm_clk_bulk_get(dev, qp->num_clks, qp->bus_clks);
491+
ret = devm_clk_bulk_get_optional(dev, qp->num_clks, qp->bus_clks);
492492
if (ret)
493493
return ret;
494494

drivers/interconnect/qcom/msm8996.c

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,13 @@ static const char * const bus_a0noc_clocks[] = {
3333
"aggre0_noc_mpu_cfg"
3434
};
3535

36+
static const char * const bus_a2noc_clocks[] = {
37+
"bus",
38+
"bus_a",
39+
"aggre2_ufs_axi",
40+
"ufs_axi"
41+
};
42+
3643
static const u16 mas_a0noc_common_links[] = {
3744
MSM8996_SLAVE_A0NOC_SNOC
3845
};
@@ -1806,7 +1813,7 @@ static const struct regmap_config msm8996_a0noc_regmap_config = {
18061813
.reg_bits = 32,
18071814
.reg_stride = 4,
18081815
.val_bits = 32,
1809-
.max_register = 0x9000,
1816+
.max_register = 0x6000,
18101817
.fast_io = true
18111818
};
18121819

@@ -1830,7 +1837,7 @@ static const struct regmap_config msm8996_a1noc_regmap_config = {
18301837
.reg_bits = 32,
18311838
.reg_stride = 4,
18321839
.val_bits = 32,
1833-
.max_register = 0x7000,
1840+
.max_register = 0x5000,
18341841
.fast_io = true
18351842
};
18361843

@@ -1851,14 +1858,16 @@ static const struct regmap_config msm8996_a2noc_regmap_config = {
18511858
.reg_bits = 32,
18521859
.reg_stride = 4,
18531860
.val_bits = 32,
1854-
.max_register = 0xa000,
1861+
.max_register = 0x7000,
18551862
.fast_io = true
18561863
};
18571864

18581865
static const struct qcom_icc_desc msm8996_a2noc = {
18591866
.type = QCOM_ICC_NOC,
18601867
.nodes = a2noc_nodes,
18611868
.num_nodes = ARRAY_SIZE(a2noc_nodes),
1869+
.clocks = bus_a2noc_clocks,
1870+
.num_clocks = ARRAY_SIZE(bus_a2noc_clocks),
18621871
.regmap_cfg = &msm8996_a2noc_regmap_config
18631872
};
18641873

@@ -1877,7 +1886,7 @@ static const struct regmap_config msm8996_bimc_regmap_config = {
18771886
.reg_bits = 32,
18781887
.reg_stride = 4,
18791888
.val_bits = 32,
1880-
.max_register = 0x62000,
1889+
.max_register = 0x5a000,
18811890
.fast_io = true
18821891
};
18831892

@@ -1988,7 +1997,7 @@ static const struct regmap_config msm8996_mnoc_regmap_config = {
19881997
.reg_bits = 32,
19891998
.reg_stride = 4,
19901999
.val_bits = 32,
1991-
.max_register = 0x20000,
2000+
.max_register = 0x1c000,
19922001
.fast_io = true
19932002
};
19942003

drivers/misc/fastrpc.c

Lines changed: 41 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ static void fastrpc_free_map(struct kref *ref)
321321
perm.vmid = QCOM_SCM_VMID_HLOS;
322322
perm.perm = QCOM_SCM_PERM_RWX;
323323
err = qcom_scm_assign_mem(map->phys, map->size,
324-
&(map->fl->cctx->vmperms[0].vmid), &perm, 1);
324+
&map->fl->cctx->perms, &perm, 1);
325325
if (err) {
326326
dev_err(map->fl->sctx->dev, "Failed to assign memory phys 0x%llx size 0x%llx err %d",
327327
map->phys, map->size, err);
@@ -334,6 +334,13 @@ static void fastrpc_free_map(struct kref *ref)
334334
dma_buf_put(map->buf);
335335
}
336336

337+
if (map->fl) {
338+
spin_lock(&map->fl->lock);
339+
list_del(&map->node);
340+
spin_unlock(&map->fl->lock);
341+
map->fl = NULL;
342+
}
343+
337344
kfree(map);
338345
}
339346

@@ -343,38 +350,41 @@ static void fastrpc_map_put(struct fastrpc_map *map)
343350
kref_put(&map->refcount, fastrpc_free_map);
344351
}
345352

346-
static void fastrpc_map_get(struct fastrpc_map *map)
353+
static int fastrpc_map_get(struct fastrpc_map *map)
347354
{
348-
if (map)
349-
kref_get(&map->refcount);
355+
if (!map)
356+
return -ENOENT;
357+
358+
return kref_get_unless_zero(&map->refcount) ? 0 : -ENOENT;
350359
}
351360

352361

353362
static int fastrpc_map_lookup(struct fastrpc_user *fl, int fd,
354-
struct fastrpc_map **ppmap)
363+
struct fastrpc_map **ppmap, bool take_ref)
355364
{
365+
struct fastrpc_session_ctx *sess = fl->sctx;
356366
struct fastrpc_map *map = NULL;
367+
int ret = -ENOENT;
357368

358-
mutex_lock(&fl->mutex);
369+
spin_lock(&fl->lock);
359370
list_for_each_entry(map, &fl->maps, node) {
360-
if (map->fd == fd) {
361-
*ppmap = map;
362-
mutex_unlock(&fl->mutex);
363-
return 0;
364-
}
365-
}
366-
mutex_unlock(&fl->mutex);
367-
368-
return -ENOENT;
369-
}
371+
if (map->fd != fd)
372+
continue;
370373

371-
static int fastrpc_map_find(struct fastrpc_user *fl, int fd,
372-
struct fastrpc_map **ppmap)
373-
{
374-
int ret = fastrpc_map_lookup(fl, fd, ppmap);
374+
if (take_ref) {
375+
ret = fastrpc_map_get(map);
376+
if (ret) {
377+
dev_dbg(sess->dev, "%s: Failed to get map fd=%d ret=%d\n",
378+
__func__, fd, ret);
379+
break;
380+
}
381+
}
375382

376-
if (!ret)
377-
fastrpc_map_get(*ppmap);
383+
*ppmap = map;
384+
ret = 0;
385+
break;
386+
}
387+
spin_unlock(&fl->lock);
378388

379389
return ret;
380390
}
@@ -746,7 +756,7 @@ static int fastrpc_map_create(struct fastrpc_user *fl, int fd,
746756
struct fastrpc_map *map = NULL;
747757
int err = 0;
748758

749-
if (!fastrpc_map_find(fl, fd, ppmap))
759+
if (!fastrpc_map_lookup(fl, fd, ppmap, true))
750760
return 0;
751761

752762
map = kzalloc(sizeof(*map), GFP_KERNEL);
@@ -788,10 +798,8 @@ static int fastrpc_map_create(struct fastrpc_user *fl, int fd,
788798
* If subsystem VMIDs are defined in DTSI, then do
789799
* hyp_assign from HLOS to those VM(s)
790800
*/
791-
unsigned int perms = BIT(QCOM_SCM_VMID_HLOS);
792-
793801
map->attr = attr;
794-
err = qcom_scm_assign_mem(map->phys, (u64)map->size, &perms,
802+
err = qcom_scm_assign_mem(map->phys, (u64)map->size, &fl->cctx->perms,
795803
fl->cctx->vmperms, fl->cctx->vmcount);
796804
if (err) {
797805
dev_err(sess->dev, "Failed to assign memory with phys 0x%llx size 0x%llx err %d",
@@ -1070,7 +1078,7 @@ static int fastrpc_put_args(struct fastrpc_invoke_ctx *ctx,
10701078
for (i = 0; i < FASTRPC_MAX_FDLIST; i++) {
10711079
if (!fdlist[i])
10721080
break;
1073-
if (!fastrpc_map_lookup(fl, (int)fdlist[i], &mmap))
1081+
if (!fastrpc_map_lookup(fl, (int)fdlist[i], &mmap, false))
10741082
fastrpc_map_put(mmap);
10751083
}
10761084

@@ -1258,10 +1266,9 @@ static int fastrpc_init_create_static_process(struct fastrpc_user *fl,
12581266

12591267
/* Map if we have any heap VMIDs associated with this ADSP Static Process. */
12601268
if (fl->cctx->vmcount) {
1261-
unsigned int perms = BIT(QCOM_SCM_VMID_HLOS);
1262-
12631269
err = qcom_scm_assign_mem(fl->cctx->remote_heap->phys,
1264-
(u64)fl->cctx->remote_heap->size, &perms,
1270+
(u64)fl->cctx->remote_heap->size,
1271+
&fl->cctx->perms,
12651272
fl->cctx->vmperms, fl->cctx->vmcount);
12661273
if (err) {
12671274
dev_err(fl->sctx->dev, "Failed to assign memory with phys 0x%llx size 0x%llx err %d",
@@ -1309,7 +1316,7 @@ static int fastrpc_init_create_static_process(struct fastrpc_user *fl,
13091316
perm.perm = QCOM_SCM_PERM_RWX;
13101317
err = qcom_scm_assign_mem(fl->cctx->remote_heap->phys,
13111318
(u64)fl->cctx->remote_heap->size,
1312-
&(fl->cctx->vmperms[0].vmid), &perm, 1);
1319+
&fl->cctx->perms, &perm, 1);
13131320
if (err)
13141321
dev_err(fl->sctx->dev, "Failed to assign memory phys 0x%llx size 0x%llx err %d",
13151322
fl->cctx->remote_heap->phys, fl->cctx->remote_heap->size, err);
@@ -1433,12 +1440,7 @@ static int fastrpc_init_create_process(struct fastrpc_user *fl,
14331440
fl->init_mem = NULL;
14341441
fastrpc_buf_free(imem);
14351442
err_alloc:
1436-
if (map) {
1437-
spin_lock(&fl->lock);
1438-
list_del(&map->node);
1439-
spin_unlock(&fl->lock);
1440-
fastrpc_map_put(map);
1441-
}
1443+
fastrpc_map_put(map);
14421444
err:
14431445
kfree(args);
14441446

@@ -1514,10 +1516,8 @@ static int fastrpc_device_release(struct inode *inode, struct file *file)
15141516
fastrpc_context_put(ctx);
15151517
}
15161518

1517-
list_for_each_entry_safe(map, m, &fl->maps, node) {
1518-
list_del(&map->node);
1519+
list_for_each_entry_safe(map, m, &fl->maps, node)
15191520
fastrpc_map_put(map);
1520-
}
15211521

15221522
list_for_each_entry_safe(buf, b, &fl->mmaps, node) {
15231523
list_del(&buf->node);
@@ -1894,12 +1894,11 @@ static int fastrpc_req_mmap(struct fastrpc_user *fl, char __user *argp)
18941894
/* Add memory to static PD pool, protection thru hypervisor */
18951895
if (req.flags != ADSP_MMAP_REMOTE_HEAP_ADDR && fl->cctx->vmcount) {
18961896
struct qcom_scm_vmperm perm;
1897-
int err = 0;
18981897

18991898
perm.vmid = QCOM_SCM_VMID_HLOS;
19001899
perm.perm = QCOM_SCM_PERM_RWX;
19011900
err = qcom_scm_assign_mem(buf->phys, buf->size,
1902-
&(fl->cctx->vmperms[0].vmid), &perm, 1);
1901+
&fl->cctx->perms, &perm, 1);
19031902
if (err) {
19041903
dev_err(fl->sctx->dev, "Failed to assign memory phys 0x%llx size 0x%llx err %d",
19051904
buf->phys, buf->size, err);

drivers/misc/mei/bus.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -702,13 +702,15 @@ void *mei_cldev_dma_map(struct mei_cl_device *cldev, u8 buffer_id, size_t size)
702702
if (cl->state == MEI_FILE_UNINITIALIZED) {
703703
ret = mei_cl_link(cl);
704704
if (ret)
705-
goto out;
705+
goto notlinked;
706706
/* update pointers */
707707
cl->cldev = cldev;
708708
}
709709

710710
ret = mei_cl_dma_alloc_and_map(cl, NULL, buffer_id, size);
711-
out:
711+
if (ret)
712+
mei_cl_unlink(cl);
713+
notlinked:
712714
mutex_unlock(&bus->device_lock);
713715
if (ret)
714716
return ERR_PTR(ret);
@@ -758,7 +760,7 @@ int mei_cldev_enable(struct mei_cl_device *cldev)
758760
if (cl->state == MEI_FILE_UNINITIALIZED) {
759761
ret = mei_cl_link(cl);
760762
if (ret)
761-
goto out;
763+
goto notlinked;
762764
/* update pointers */
763765
cl->cldev = cldev;
764766
}
@@ -785,6 +787,9 @@ int mei_cldev_enable(struct mei_cl_device *cldev)
785787
}
786788

787789
out:
790+
if (ret)
791+
mei_cl_unlink(cl);
792+
notlinked:
788793
mutex_unlock(&bus->device_lock);
789794

790795
return ret;
@@ -1277,7 +1282,6 @@ static void mei_cl_bus_dev_release(struct device *dev)
12771282
mei_cl_flush_queues(cldev->cl, NULL);
12781283
mei_me_cl_put(cldev->me_cl);
12791284
mei_dev_bus_put(cldev->bus);
1280-
mei_cl_unlink(cldev->cl);
12811285
kfree(cldev->cl);
12821286
kfree(cldev);
12831287
}

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,8 @@
111111

112112
#define MEI_DEV_ID_RPL_S 0x7A68 /* Raptor Lake Point S */
113113

114+
#define MEI_DEV_ID_MTL_M 0x7E70 /* Meteor Lake Point M */
115+
114116
/*
115117
* MEI HW Section
116118
*/

drivers/misc/mei/pci-me.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,8 @@ static const struct pci_device_id mei_me_pci_tbl[] = {
118118

119119
{MEI_PCI_DEVICE(MEI_DEV_ID_RPL_S, MEI_ME_PCH15_CFG)},
120120

121+
{MEI_PCI_DEVICE(MEI_DEV_ID_MTL_M, MEI_ME_PCH15_CFG)},
122+
121123
/* required last entry */
122124
{0, }
123125
};

0 commit comments

Comments
 (0)