Skip to content

Commit db2b0d7

Browse files
committed
parisc: Add PDC locking functions for rendezvous code
Add pdc_cpu_rendezvous_lock() and pdc_cpu_rendezvous_unlock() to lock PDC while CPU is transitioning into rendezvous state. This is needed, because the transition phase may take up to 8 seconds. Add pdc_pat_get_PDC_entrypoint() to get PDC entry point for current CPU. Signed-off-by: Helge Deller <deller@gmx.de>
1 parent 4d7d4c3 commit db2b0d7

File tree

3 files changed

+42
-1
lines changed

3 files changed

+42
-1
lines changed

arch/parisc/include/asm/pdc.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,9 @@ int pdc_sti_call(unsigned long func, unsigned long flags,
9494
unsigned long glob_cfg);
9595

9696
int __pdc_cpu_rendezvous(void);
97+
void pdc_cpu_rendezvous_lock(void);
98+
void pdc_cpu_rendezvous_unlock(void);
99+
97100
static inline char * os_id_to_string(u16 os_id) {
98101
switch(os_id) {
99102
case OS_ID_NONE: return "No OS";

arch/parisc/include/asm/pdcpat.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@
8383
#define PDC_PAT_CPU_RENDEZVOUS 6L /* Rendezvous CPU */
8484
#define PDC_PAT_CPU_GET_CLOCK_INFO 7L /* Return CPU Clock info */
8585
#define PDC_PAT_CPU_GET_RENDEZVOUS_STATE 8L /* Return Rendezvous State */
86+
#define PDC_PAT_CPU_GET_PDC_ENTRYPOINT 11L /* Return PDC Entry point */
8687
#define PDC_PAT_CPU_PLUNGE_FABRIC 128L /* Plunge Fabric */
8788
#define PDC_PAT_CPU_UPDATE_CACHE_CLEANSING 129L /* Manipulate Cache
8889
* Cleansing Mode */
@@ -356,7 +357,7 @@ struct pdc_pat_cell_mod_maddr_block { /* PDC_PAT_CELL_MODULE */
356357

357358
typedef struct pdc_pat_cell_mod_maddr_block pdc_pat_cell_mod_maddr_block_t;
358359

359-
360+
extern int pdc_pat_get_PDC_entrypoint(unsigned long *pdc_entry);
360361
extern int pdc_pat_chassis_send_log(unsigned long status, unsigned long data);
361362
extern int pdc_pat_cell_get_number(struct pdc_pat_cell_num *cell_info);
362363
extern int pdc_pat_cell_info(struct pdc_pat_cell_info_rtn_block *info,

arch/parisc/kernel/firmware.c

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,44 @@ int __pdc_cpu_rendezvous(void)
329329
return mem_pdc_call(PDC_PROC, 1, 0);
330330
}
331331

332+
/**
333+
* pdc_cpu_rendezvous_lock - Lock PDC while transitioning to rendezvous state
334+
*/
335+
void pdc_cpu_rendezvous_lock(void)
336+
{
337+
spin_lock(&pdc_lock);
338+
}
339+
340+
/**
341+
* pdc_cpu_rendezvous_unlock - Unlock PDC after reaching rendezvous state
342+
*/
343+
void pdc_cpu_rendezvous_unlock(void)
344+
{
345+
spin_unlock(&pdc_lock);
346+
}
347+
348+
/**
349+
* pdc_pat_get_PDC_entrypoint - Get PDC entry point for current CPU
350+
* @retval: -1 on error, 0 on success
351+
*/
352+
int pdc_pat_get_PDC_entrypoint(unsigned long *pdc_entry)
353+
{
354+
int retval = 0;
355+
unsigned long flags;
356+
357+
if (!IS_ENABLED(CONFIG_SMP) || !is_pdc_pat()) {
358+
*pdc_entry = MEM_PDC;
359+
return 0;
360+
}
361+
362+
spin_lock_irqsave(&pdc_lock, flags);
363+
retval = mem_pdc_call(PDC_PAT_CPU, PDC_PAT_CPU_GET_PDC_ENTRYPOINT,
364+
__pa(pdc_result));
365+
*pdc_entry = pdc_result[0];
366+
spin_unlock_irqrestore(&pdc_lock, flags);
332367

368+
return retval;
369+
}
333370
/**
334371
* pdc_chassis_warn - Fetches chassis warnings
335372
* @retval: -1 on error, 0 on success

0 commit comments

Comments
 (0)