platform: Drop IPI warm init and exit hooks

Now that the SBI IPI core clears IPIs at warm boot in a generic way,
none of the drivers or platforms use these hooks, and we can remove
them. Platforms need only to initialize the driver once during cold
init. If other hooks are needed in the future, they can be added to
struct sbi_ipi_device.

Signed-off-by: Samuel Holland <samuel.holland@sifive.com>
Reviewed-by: Anup Patel <anup@brainfault.org>
This commit is contained in:
Samuel Holland
2024-10-25 11:59:48 -07:00
committed by Anup Patel
parent 693afc818f
commit 86d2c1797a
12 changed files with 26 additions and 123 deletions

View File

@@ -116,10 +116,8 @@ struct sbi_platform_operations {
/** Exit the platform interrupt controller for current HART */ /** Exit the platform interrupt controller for current HART */
void (*irqchip_exit)(void); void (*irqchip_exit)(void);
/** Initialize IPI for current HART */ /** Initialize IPI during cold boot */
int (*ipi_init)(bool cold_boot); int (*ipi_init)(void);
/** Exit IPI for current HART */
void (*ipi_exit)(void);
/** Get tlb flush limit value **/ /** Get tlb flush limit value **/
u64 (*get_tlbr_flush_limit)(void); u64 (*get_tlbr_flush_limit)(void);
@@ -572,32 +570,19 @@ static inline void sbi_platform_irqchip_exit(const struct sbi_platform *plat)
} }
/** /**
* Initialize the platform IPI support for current HART * Initialize the platform IPI support during cold boot
* *
* @param plat pointer to struct sbi_platform * @param plat pointer to struct sbi_platform
* @param cold_boot whether cold boot (true) or warm_boot (false)
* *
* @return 0 on success and negative error code on failure * @return 0 on success and negative error code on failure
*/ */
static inline int sbi_platform_ipi_init(const struct sbi_platform *plat, static inline int sbi_platform_ipi_init(const struct sbi_platform *plat)
bool cold_boot)
{ {
if (plat && sbi_platform_ops(plat)->ipi_init) if (plat && sbi_platform_ops(plat)->ipi_init)
return sbi_platform_ops(plat)->ipi_init(cold_boot); return sbi_platform_ops(plat)->ipi_init();
return 0; return 0;
} }
/**
* Exit the platform IPI support for current HART
*
* @param plat pointer to struct sbi_platform
*/
static inline void sbi_platform_ipi_exit(const struct sbi_platform *plat)
{
if (plat && sbi_platform_ops(plat)->ipi_exit)
sbi_platform_ops(plat)->ipi_exit();
}
/** /**
* Initialize the platform timer during cold boot * Initialize the platform timer during cold boot
* *

View File

@@ -17,18 +17,13 @@
struct fdt_ipi { struct fdt_ipi {
const struct fdt_match *match_table; const struct fdt_match *match_table;
int (*cold_init)(const void *fdt, int nodeoff, const struct fdt_match *match); int (*cold_init)(const void *fdt, int nodeoff, const struct fdt_match *match);
int (*warm_init)(void);
void (*exit)(void);
}; };
void fdt_ipi_exit(void); int fdt_ipi_init(void);
int fdt_ipi_init(bool cold_boot);
#else #else
static inline void fdt_ipi_exit(void) { } static inline int fdt_ipi_init(void) { return 0; }
static inline int fdt_ipi_init(bool cold_boot) { return 0; }
#endif #endif

View File

@@ -321,6 +321,11 @@ int sbi_ipi_init(struct sbi_scratch *scratch, bool cold_boot)
if (ret < 0) if (ret < 0)
return ret; return ret;
ipi_halt_event = ret; ipi_halt_event = ret;
/* Initialize platform IPI support */
ret = sbi_platform_ipi_init(sbi_platform_ptr(scratch));
if (ret)
return ret;
} else { } else {
if (!ipi_data_off) if (!ipi_data_off)
return SBI_ENOMEM; return SBI_ENOMEM;
@@ -332,11 +337,6 @@ int sbi_ipi_init(struct sbi_scratch *scratch, bool cold_boot)
ipi_data = sbi_scratch_offset_ptr(scratch, ipi_data_off); ipi_data = sbi_scratch_offset_ptr(scratch, ipi_data_off);
ipi_data->ipi_type = 0x00; ipi_data->ipi_type = 0x00;
/* Initialize platform IPI support */
ret = sbi_platform_ipi_init(sbi_platform_ptr(scratch), cold_boot);
if (ret)
return ret;
/* Clear any pending IPIs for the current hart */ /* Clear any pending IPIs for the current hart */
sbi_ipi_raw_clear(); sbi_ipi_raw_clear();
@@ -353,7 +353,4 @@ void sbi_ipi_exit(struct sbi_scratch *scratch)
/* Process pending IPIs */ /* Process pending IPIs */
sbi_ipi_process(); sbi_ipi_process();
/* Platform exit */
sbi_platform_ipi_exit(sbi_platform_ptr(scratch));
} }

View File

@@ -16,22 +16,7 @@
extern struct fdt_ipi *fdt_ipi_drivers[]; extern struct fdt_ipi *fdt_ipi_drivers[];
extern unsigned long fdt_ipi_drivers_size; extern unsigned long fdt_ipi_drivers_size;
static struct fdt_ipi *current_driver = NULL; int fdt_ipi_init(void)
void fdt_ipi_exit(void)
{
if (current_driver && current_driver->exit)
current_driver->exit();
}
static int fdt_ipi_warm_init(void)
{
if (current_driver && current_driver->warm_init)
return current_driver->warm_init();
return 0;
}
static int fdt_ipi_cold_init(void)
{ {
int pos, noff, rc; int pos, noff, rc;
struct fdt_ipi *drv; struct fdt_ipi *drv;
@@ -56,7 +41,6 @@ static int fdt_ipi_cold_init(void)
continue; continue;
if (rc) if (rc)
return rc; return rc;
current_driver = drv;
/* /*
* We will have multiple IPI devices on multi-die or * We will have multiple IPI devices on multi-die or
@@ -71,16 +55,3 @@ static int fdt_ipi_cold_init(void)
*/ */
return 0; return 0;
} }
int fdt_ipi_init(bool cold_boot)
{
int rc;
if (cold_boot) {
rc = fdt_ipi_cold_init();
if (rc)
return rc;
}
return fdt_ipi_warm_init();
}

View File

@@ -64,6 +64,4 @@ static const struct fdt_match ipi_mswi_match[] = {
struct fdt_ipi fdt_ipi_mswi = { struct fdt_ipi fdt_ipi_mswi = {
.match_table = ipi_mswi_match, .match_table = ipi_mswi_match,
.cold_init = ipi_mswi_cold_init, .cold_init = ipi_mswi_cold_init,
.warm_init = NULL,
.exit = NULL,
}; };

View File

@@ -42,6 +42,4 @@ static const struct fdt_match ipi_plicsw_match[] = {
struct fdt_ipi fdt_ipi_plicsw = { struct fdt_ipi fdt_ipi_plicsw = {
.match_table = ipi_plicsw_match, .match_table = ipi_plicsw_match,
.cold_init = fdt_plicsw_cold_ipi_init, .cold_init = fdt_plicsw_cold_ipi_init,
.warm_init = NULL,
.exit = NULL,
}; };

View File

@@ -131,19 +131,11 @@ static int ariane_irqchip_init(bool cold_boot)
} }
/* /*
* Initialize IPI for current HART. * Initialize IPI during cold boot.
*/ */
static int ariane_ipi_init(bool cold_boot) static int ariane_ipi_init(void)
{ {
int ret; return aclint_mswi_cold_init(&mswi);
if (cold_boot) {
ret = aclint_mswi_cold_init(&mswi);
if (ret)
return ret;
}
return 0;
} }
/* /*

View File

@@ -162,19 +162,11 @@ static int openpiton_irqchip_init(bool cold_boot)
} }
/* /*
* Initialize IPI for current HART. * Initialize IPI during cold boot.
*/ */
static int openpiton_ipi_init(bool cold_boot) static int openpiton_ipi_init(void)
{ {
int ret; return aclint_mswi_cold_init(&mswi);
if (cold_boot) {
ret = aclint_mswi_cold_init(&mswi);
if (ret)
return ret;
}
return 0;
} }
/* /*

View File

@@ -421,7 +421,6 @@ const struct sbi_platform_operations platform_ops = {
.irqchip_init = fdt_irqchip_init, .irqchip_init = fdt_irqchip_init,
.irqchip_exit = fdt_irqchip_exit, .irqchip_exit = fdt_irqchip_exit,
.ipi_init = fdt_ipi_init, .ipi_init = fdt_ipi_init,
.ipi_exit = fdt_ipi_exit,
.pmu_init = generic_pmu_init, .pmu_init = generic_pmu_init,
.pmu_xlate_to_mhpmevent = generic_pmu_xlate_to_mhpmevent, .pmu_xlate_to_mhpmevent = generic_pmu_xlate_to_mhpmevent,
.get_tlbr_flush_limit = generic_tlbr_flush_limit, .get_tlbr_flush_limit = generic_tlbr_flush_limit,

View File

@@ -146,17 +146,9 @@ static int k210_irqchip_init(bool cold_boot)
return plic_warm_irqchip_init(&plic, hartid * 2, hartid * 2 + 1); return plic_warm_irqchip_init(&plic, hartid * 2, hartid * 2 + 1);
} }
static int k210_ipi_init(bool cold_boot) static int k210_ipi_init(void)
{ {
int rc; return aclint_mswi_cold_init(&mswi);
if (cold_boot) {
rc = aclint_mswi_cold_init(&mswi);
if (rc)
return rc;
}
return 0;
} }
static int k210_timer_init(void) static int k210_timer_init(void)

View File

@@ -202,17 +202,9 @@ static int ux600_irqchip_init(bool cold_boot)
(hartid) ? (2 * hartid) : -1); (hartid) ? (2 * hartid) : -1);
} }
static int ux600_ipi_init(bool cold_boot) static int ux600_ipi_init(void)
{ {
int rc; return aclint_mswi_cold_init(&mswi);
if (cold_boot) {
rc = aclint_mswi_cold_init(&mswi);
if (rc)
return rc;
}
return 0;
} }
static int ux600_timer_init(void) static int ux600_timer_init(void)

View File

@@ -99,20 +99,12 @@ static int platform_irqchip_init(bool cold_boot)
} }
/* /*
* Initialize IPI for current HART. * Initialize IPI during cold boot.
*/ */
static int platform_ipi_init(bool cold_boot) static int platform_ipi_init(void)
{ {
int ret;
/* Example if the generic ACLINT driver is used */ /* Example if the generic ACLINT driver is used */
if (cold_boot) { return aclint_mswi_cold_init(&mswi);
ret = aclint_mswi_cold_init(&mswi);
if (ret)
return ret;
}
return 0;
} }
/* /*