Skip to content

Commit 3e20861

Browse files
Fernando Guzman LugoLuis Henriques
authored andcommitted
SYSLINK: ipc - ipc recovery related patches
SYSLINK: ipc - move check for in recovery state per ipc submodule With this approach, now each submodule can allow which ioctl can go through when the IPC is in recovery state. It is done by exporting a new function in ipc. Change-Id: I3402f2f83cd3dddbdd6a0d8caf94bf061a5b981c Signed-off-by: Fernando Guzman Lugo <[email protected]> SYSLINK: ipc - allow some ioctl go through in recovery state This api can go through even in recovery state: messageq_unblock messageq_delete messageq_close messageq_destroy Change-Id: If738b58c21f1d18c3ef1ba019bb598290096d32b Signed-off-by: Fernando Guzman Lugo <[email protected]> SYSLINK: IPC- provide ipc start and stop notification Enable the notification of IPC start and stop, which devh can use to register/unregister for SYS-ERRORS. This also includes the changes to export ipc_recovery_schedule function. This function should be called by error handlers such as sys error and watchdog error. Change-Id: I436c37b9c4b74d00c771e88c480ea0e96a0268fd Signed-off-by: Hari Kanigeri <[email protected]> Signed-off-by: Wajahat Khan <[email protected]> syslink: ipc: fix compilation warnings Fixing the following compilation warning when including ipc.h and notify_ducatidriver.h in another module: warning: function declaration isn't a prototype Change-Id: Idbb0b5289a3e8406fbe0b86e70d63d55d7e3060f Reported-by: Ricardo Neri <[email protected]> Signed-off-by: Miguel Vadillo <[email protected]>
1 parent e7f60cf commit 3e20861

File tree

14 files changed

+97
-12
lines changed

14 files changed

+97
-12
lines changed

arch/arm/plat-omap/include/syslink/ipc.h

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,11 @@ struct ipc_params {
120120
};
121121

122122
/* IPC events. */
123-
#define IPC_CLOSE 0
123+
enum {
124+
IPC_CLOSE = 0,
125+
IPC_START = 1,
126+
IPC_STOP = 2,
127+
};
124128

125129
/* =============================================================================
126130
* APIs
@@ -174,4 +178,12 @@ int ipc_register_notifier(struct notifier_block *nb);
174178
/* Un-register for IPC events. */
175179
int ipc_unregister_notifier(struct notifier_block *nb);
176180

181+
/* check if ipc is in recovery state */
182+
#ifdef CONFIG_SYSLINK_RECOVERY
183+
bool ipc_recovering(void);
184+
#endif
185+
186+
/* Indicate to schedule the recovery mechanism */
187+
void ipc_recover_schedule(void);
188+
177189
#endif /* ifndef _IPC_H_ */

arch/arm/plat-omap/include/syslink/notify_ducatidriver.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929
#define VOLATILE volatile
3030

31-
extern u32 get_ducati_virt_mem();
31+
extern u32 get_ducati_virt_mem(void);
3232
extern void unmap_ducati_virt_mem(u32 shm_virt_addr);
3333

3434

drivers/dsp/syslink/multicore_ipc/gatemp_ioctl.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include <linux/mm.h>
2424
#include <linux/slab.h>
2525

26+
#include <ipc.h>
2627
#include <gatemp.h>
2728
#include <gatemp_ioctl.h>
2829
#include <sharedregion.h>
@@ -315,6 +316,12 @@ int gatemp_ioctl(struct inode *inode, struct file *filp,
315316

316317

317318
if (user == true) {
319+
#ifdef CONFIG_SYSLINK_RECOVERY
320+
if (ipc_recovering()) {
321+
status = -EIO;
322+
goto exit;
323+
}
324+
#endif
318325
if (_IOC_DIR(cmd) & _IOC_READ)
319326
status = !access_ok(VERIFY_WRITE, uarg, _IOC_SIZE(cmd));
320327
else if (_IOC_DIR(cmd) & _IOC_WRITE)

drivers/dsp/syslink/multicore_ipc/heapbufmp_ioctl.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include <linux/mm.h>
2424
#include <linux/slab.h>
2525

26+
#include <ipc.h>
2627
#include <sharedregion.h>
2728
#include <heap.h>
2829
#include <heapbufmp.h>
@@ -416,6 +417,12 @@ int heapbufmp_ioctl(struct inode *pinode, struct file *filp,
416417
(struct ipc_process_context *)filp->private_data;
417418

418419
if (user == true) {
420+
#ifdef CONFIG_SYSLINK_RECOVERY
421+
if (ipc_recovering()) {
422+
status = -EIO;
423+
goto exit;
424+
}
425+
#endif
419426
if (_IOC_DIR(cmd) & _IOC_READ)
420427
status = !access_ok(VERIFY_WRITE, uarg, _IOC_SIZE(cmd));
421428
else if (_IOC_DIR(cmd) & _IOC_WRITE)

drivers/dsp/syslink/multicore_ipc/heapmemmp_ioctl.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include <linux/mm.h>
2424
#include <linux/slab.h>
2525

26+
#include <ipc.h>
2627
#include <heap.h>
2728
#include <heapmemmp_ioctl.h>
2829
#include <sharedregion.h>
@@ -428,6 +429,12 @@ int heapmemmp_ioctl(struct inode *pinode, struct file *filp,
428429
(struct ipc_process_context *)filp->private_data;
429430

430431
if (user == true) {
432+
#ifdef CONFIG_SYSLINK_RECOVERY
433+
if (ipc_recovering()) {
434+
status = -EIO;
435+
goto exit;
436+
}
437+
#endif
431438
if (_IOC_DIR(cmd) & _IOC_READ)
432439
status = !access_ok(VERIFY_WRITE, uarg, _IOC_SIZE(cmd));
433440
else if (_IOC_DIR(cmd) & _IOC_WRITE)

drivers/dsp/syslink/multicore_ipc/ipc_drv.c

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -106,12 +106,13 @@ static void ipc_recover(struct work_struct *work)
106106
complete_all(&ipc_open_comp);
107107
}
108108

109-
static void ipc_recover_schedule(void)
109+
void ipc_recover_schedule(void)
110110
{
111111
INIT_COMPLETION(ipc_open_comp);
112112
recover = true;
113113
queue_work(ipc_rec_queue, &ipc_recovery_work);
114114
}
115+
EXPORT_SYMBOL_GPL(ipc_recover_schedule);
115116

116117
static int ipc_ducati_iommu_notifier_call(struct notifier_block *nb,
117118
unsigned long val, void *v)
@@ -150,6 +151,11 @@ static int ipc_sysm3_rproc_notifier_call(struct notifier_block *nb,
150151
return 0;
151152
}
152153
}
154+
155+
bool ipc_recovering()
156+
{
157+
return recover;
158+
}
153159
#endif
154160

155161
/*
@@ -238,14 +244,6 @@ static int ipc_ioctl(struct inode *ip, struct file *filp, u32 cmd, ulong arg)
238244
s32 retval = 0;
239245
void __user *argp = (void __user *)arg;
240246

241-
#ifdef CONFIG_SYSLINK_RECOVERY
242-
if (recover) {
243-
if (cmd != CMD_NOTIFY_THREADDETACH) {
244-
retval = -EIO;
245-
goto exit;
246-
}
247-
}
248-
#endif
249247
/* Verify the memory and ensure that it is not is kernel
250248
address space
251249
*/

drivers/dsp/syslink/multicore_ipc/listmp_ioctl.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#include <linux/slab.h>
2828

2929
/* Module Headers */
30+
#include <ipc.h>
3031
#include <listmp.h>
3132
#include <_listmp.h>
3233
#include <listmp_ioctl.h>
@@ -500,6 +501,12 @@ int listmp_ioctl(struct inode *inode, struct file *filp,
500501
(struct ipc_process_context *)filp->private_data;
501502

502503
if (user == true) {
504+
#ifdef CONFIG_SYSLINK_RECOVERY
505+
if (ipc_recovering()) {
506+
status = -EIO;
507+
goto exit;
508+
}
509+
#endif
503510
if (_IOC_DIR(cmd) & _IOC_READ)
504511
status = !access_ok(VERIFY_WRITE, uarg, _IOC_SIZE(cmd));
505512
else if (_IOC_DIR(cmd) & _IOC_WRITE)

drivers/dsp/syslink/multicore_ipc/messageq_ioctl.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#include <linux/slab.h>
2828

2929
/* Module Headers */
30+
#include <ipc.h>
3031
#include <messageq.h>
3132
#include <messageq_ioctl.h>
3233
#include <sharedregion.h>
@@ -539,6 +540,15 @@ int messageq_ioctl(struct inode *inode, struct file *filp,
539540
(struct ipc_process_context *)filp->private_data;
540541

541542
if (user == true) {
543+
#ifdef CONFIG_SYSLINK_RECOVERY
544+
if (ipc_recovering() && cmd != CMD_MESSAGEQ_UNBLOCK
545+
&& cmd != CMD_MESSAGEQ_DELETE
546+
&& cmd != CMD_MESSAGEQ_CLOSE
547+
&& cmd != CMD_MESSAGEQ_DESTROY) {
548+
status = -EIO;
549+
goto exit;
550+
}
551+
#endif
542552
if (_IOC_DIR(cmd) & _IOC_READ)
543553
status = !access_ok(VERIFY_WRITE, uarg, _IOC_SIZE(cmd));
544554
else if (_IOC_DIR(cmd) & _IOC_WRITE)

drivers/dsp/syslink/multicore_ipc/multiproc_ioctl.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include <linux/types.h>
2020
#include <linux/fs.h>
2121
#include <linux/mm.h>
22+
#include <ipc.h>
2223
#include <multiproc.h>
2324
#include <multiproc_ioctl.h>
2425

@@ -142,6 +143,12 @@ int multiproc_ioctl(struct inode *inode, struct file *filp,
142143

143144

144145
if (user == true) {
146+
#ifdef CONFIG_SYSLINK_RECOVERY
147+
if (ipc_recovering()) {
148+
status = -EIO;
149+
goto exit;
150+
}
151+
#endif
145152
if (_IOC_DIR(cmd) & _IOC_READ)
146153
status = !access_ok(VERIFY_WRITE, uarg, _IOC_SIZE(cmd));
147154
else if (_IOC_DIR(cmd) & _IOC_WRITE)

drivers/dsp/syslink/multicore_ipc/nameserver_ioctl.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
#include <linux/fs.h>
2121
#include <linux/mm.h>
2222
#include <linux/slab.h>
23+
24+
#include <ipc.h>
2325
#include <nameserver.h>
2426
#include <nameserver_ioctl.h>
2527

@@ -545,6 +547,12 @@ int nameserver_ioctl(struct inode *inode, struct file *filp,
545547

546548

547549
if (user == true) {
550+
#ifdef CONFIG_SYSLINK_RECOVERY
551+
if (ipc_recovering()) {
552+
status = -EIO;
553+
goto exit;
554+
}
555+
#endif
548556
if (_IOC_DIR(cmd) & _IOC_READ)
549557
status = !access_ok(VERIFY_WRITE, uarg, _IOC_SIZE(cmd));
550558
else if (_IOC_DIR(cmd) & _IOC_WRITE)

drivers/dsp/syslink/multicore_ipc/platform.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1731,6 +1731,8 @@ int platform_start_callback(u16 proc_id, void *arg)
17311731
pr_err("platform_load_callback failed, status [0x%x]\n",
17321732
status);
17331733

1734+
ipc_notify_event(IPC_START, &proc_id);
1735+
17341736
return status;
17351737
}
17361738
EXPORT_SYMBOL(platform_start_callback);
@@ -1788,6 +1790,8 @@ int platform_stop_callback(u16 proc_id, void *arg)
17881790
}
17891791
}
17901792

1793+
ipc_notify_event(IPC_STOP, &proc_id);
1794+
17911795
ipc_detach(proc_id);
17921796

17931797
ipc_stop();

drivers/dsp/syslink/multicore_ipc/sharedregion_ioctl.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include <linux/mm.h>
2525
#include <linux/slab.h>
2626

27+
#include <ipc.h>
2728
#include <multiproc.h>
2829
#include <sharedregion.h>
2930
#include <sharedregion_ioctl.h>
@@ -435,6 +436,12 @@ int sharedregion_ioctl(struct inode *inode, struct file *filp,
435436
(struct ipc_process_context *)filp->private_data;
436437

437438
if (user == true) {
439+
#ifdef CONFIG_SYSLINK_RECOVERY
440+
if (ipc_recovering()) {
441+
status = -EIO;
442+
goto exit;
443+
}
444+
#endif
438445
if (_IOC_DIR(cmd) & _IOC_READ)
439446
status = !access_ok(VERIFY_WRITE, uarg, _IOC_SIZE(cmd));
440447
else if (_IOC_DIR(cmd) & _IOC_WRITE)

drivers/dsp/syslink/multicore_ipc/sysipc_ioctl.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,12 @@ int sysipc_ioctl(struct inode *inode, struct file *filp,
197197
(struct ipc_process_context *)filp->private_data;
198198

199199
if (user == true) {
200+
#ifdef CONFIG_SYSLINK_RECOVERY
201+
if (ipc_recovering()) {
202+
status = -EIO;
203+
goto exit;
204+
}
205+
#endif
200206
if (_IOC_DIR(cmd) & _IOC_READ)
201207
status = !access_ok(VERIFY_WRITE, uarg, _IOC_SIZE(cmd));
202208
else if (_IOC_DIR(cmd) & _IOC_WRITE)

drivers/dsp/syslink/omap_notify/drv_notify.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@
2828
#include <linux/types.h>
2929
#include <linux/cdev.h>
3030

31-
3231
#include <syslink/platform_mem.h>
3332
#include <syslink/ipc_ioctl.h>
33+
#include <syslink/ipc.h>
3434
#include <syslink/drv_notify.h>
3535
#include <syslink/notify_driver.h>
3636
#include <syslink/notify.h>
@@ -239,6 +239,11 @@ int notify_drv_ioctl(struct inode *inode, struct file *filp, u32 cmd,
239239
struct ipc_process_context *pr_ctxt =
240240
(struct ipc_process_context *)filp->private_data;
241241

242+
#ifdef CONFIG_SYSLINK_RECOVERY
243+
if (ipc_recovering() && user && cmd != CMD_NOTIFY_THREADDETACH)
244+
return -EIO;
245+
#endif
246+
242247
switch (cmd) {
243248
case CMD_NOTIFY_GETCONFIG:
244249
{

0 commit comments

Comments
 (0)