File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -351,6 +351,17 @@ struct psp_device *psp_get_master_device(void)
351351 return sp ? sp -> psp_data : NULL ;
352352}
353353
354+ int psp_restore (struct sp_device * sp )
355+ {
356+ struct psp_device * psp = sp -> psp_data ;
357+ int ret = 0 ;
358+
359+ if (psp -> tee_data )
360+ ret = tee_restore (psp );
361+
362+ return ret ;
363+ }
364+
354365void psp_pci_init (void )
355366{
356367 psp_master = psp_get_master_device ();
Original file line number Diff line number Diff line change @@ -230,6 +230,18 @@ int sp_resume(struct sp_device *sp)
230230 return 0 ;
231231}
232232
233+ int sp_restore (struct sp_device * sp )
234+ {
235+ if (sp -> psp_data ) {
236+ int ret = psp_restore (sp );
237+
238+ if (ret )
239+ return ret ;
240+ }
241+
242+ return sp_resume (sp );
243+ }
244+
233245struct sp_device * sp_get_psp_master_device (void )
234246{
235247 struct sp_device * i , * ret = NULL ;
Original file line number Diff line number Diff line change @@ -141,6 +141,7 @@ void sp_destroy(struct sp_device *sp);
141141
142142int sp_suspend (struct sp_device * sp );
143143int sp_resume (struct sp_device * sp );
144+ int sp_restore (struct sp_device * sp );
144145int sp_request_ccp_irq (struct sp_device * sp , irq_handler_t handler ,
145146 const char * name , void * data );
146147void sp_free_ccp_irq (struct sp_device * sp , void * data );
@@ -174,13 +175,15 @@ int psp_dev_init(struct sp_device *sp);
174175void psp_pci_init (void );
175176void psp_dev_destroy (struct sp_device * sp );
176177void psp_pci_exit (void );
178+ int psp_restore (struct sp_device * sp );
177179
178180#else /* !CONFIG_CRYPTO_DEV_SP_PSP */
179181
180182static inline int psp_dev_init (struct sp_device * sp ) { return 0 ; }
181183static inline void psp_pci_init (void ) { }
182184static inline void psp_dev_destroy (struct sp_device * sp ) { }
183185static inline void psp_pci_exit (void ) { }
186+ static inline int psp_restore (struct sp_device * sp ) { return 0 ; }
184187
185188#endif /* CONFIG_CRYPTO_DEV_SP_PSP */
186189
Original file line number Diff line number Diff line change @@ -353,6 +353,13 @@ static int __maybe_unused sp_pci_resume(struct device *dev)
353353 return sp_resume (sp );
354354}
355355
356+ static int __maybe_unused sp_pci_restore (struct device * dev )
357+ {
358+ struct sp_device * sp = dev_get_drvdata (dev );
359+
360+ return sp_restore (sp );
361+ }
362+
356363#ifdef CONFIG_CRYPTO_DEV_SP_PSP
357364static const struct sev_vdata sevv1 = {
358365 .cmdresp_reg = 0x10580 , /* C2PMSG_32 */
@@ -563,7 +570,14 @@ static const struct pci_device_id sp_pci_table[] = {
563570};
564571MODULE_DEVICE_TABLE (pci , sp_pci_table );
565572
566- static SIMPLE_DEV_PM_OPS (sp_pci_pm_ops , sp_pci_suspend , sp_pci_resume ) ;
573+ static const struct dev_pm_ops sp_pci_pm_ops = {
574+ .suspend = pm_sleep_ptr (sp_pci_suspend ),
575+ .resume = pm_sleep_ptr (sp_pci_resume ),
576+ .freeze = pm_sleep_ptr (sp_pci_suspend ),
577+ .thaw = pm_sleep_ptr (sp_pci_resume ),
578+ .poweroff = pm_sleep_ptr (sp_pci_suspend ),
579+ .restore_early = pm_sleep_ptr (sp_pci_restore ),
580+ };
567581
568582static struct pci_driver sp_pci_driver = {
569583 .name = "ccp" ,
Original file line number Diff line number Diff line change @@ -366,3 +366,8 @@ int psp_check_tee_status(void)
366366 return 0 ;
367367}
368368EXPORT_SYMBOL (psp_check_tee_status );
369+
370+ int tee_restore (struct psp_device * psp )
371+ {
372+ return tee_init_ring (psp -> tee_data );
373+ }
Original file line number Diff line number Diff line change @@ -111,5 +111,6 @@ struct tee_ring_cmd {
111111
112112int tee_dev_init (struct psp_device * psp );
113113void tee_dev_destroy (struct psp_device * psp );
114+ int tee_restore (struct psp_device * psp );
114115
115116#endif /* __TEE_DEV_H__ */
You can’t perform that action at this time.
0 commit comments