Skip to content

Commit

Permalink
hw/psi: Remove explicit external IRQ policy
Browse files Browse the repository at this point in the history
Rather than having an explicit policy use the presence of a platform
defined external interrupt handler to determine whether we should direct
the interrupt to OPAL or not. This lets us remove a pile of
comments about why the policy is necessary and the comments about why
we need to un-set it on P8+

Reviewed-by: Cédric Le Goater <clg@kaod.org>
Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
  • Loading branch information
oohal committed Sep 6, 2019
1 parent fa161cd commit 9c9375f
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 45 deletions.
14 changes: 6 additions & 8 deletions hw/psi.c
Expand Up @@ -29,7 +29,6 @@ static LIST_HEAD(psis);
static u64 psi_link_timer;
static u64 psi_link_timeout;
static bool psi_link_poll_active;
static bool psi_ext_irq_policy = EXTERNAL_IRQ_POLICY_LINUX;

static void psi_activate_phb(struct psi *psi);

Expand Down Expand Up @@ -471,8 +470,8 @@ static uint64_t psi_p8_irq_attributes(struct irq_source *is, uint32_t isn)
if (psi->no_lpc_irqs && idx == P8_IRQ_PSI_LPC)
return IRQ_ATTR_TARGET_LINUX;

if (idx == P8_IRQ_PSI_EXTERNAL &&
psi_ext_irq_policy == EXTERNAL_IRQ_POLICY_LINUX)
/* Only direct external interrupts to OPAL if we have a handler */
if (idx == P8_IRQ_PSI_EXTERNAL && !platform.external_irq)
return IRQ_ATTR_TARGET_LINUX;

attr = IRQ_ATTR_TARGET_OPAL | IRQ_ATTR_TYPE_LSI;
Expand Down Expand Up @@ -625,6 +624,10 @@ static uint64_t psi_p9_irq_attributes(struct irq_source *is __unused,
if (is_lpc_serirq)
return lpc_get_irq_policy(psi->chip_id, idx - P9_PSI_IRQ_LPC_SIRQ0);

/* Only direct external interrupts to OPAL if we have a handler */
if (idx == P9_PSI_IRQ_EXTERNAL && !platform.external_irq)
return IRQ_ATTR_TARGET_LINUX | IRQ_ATTR_TYPE_LSI;

return IRQ_ATTR_TARGET_OPAL | IRQ_ATTR_TYPE_LSI;
}

Expand All @@ -649,11 +652,6 @@ static const struct irq_source_ops psi_p9_irq_ops = {
.name = psi_p9_irq_name,
};

void psi_set_external_irq_policy(bool policy)
{
psi_ext_irq_policy = policy;
}

static void psi_init_p8_interrupts(struct psi *psi)
{
uint32_t irq;
Expand Down
12 changes: 0 additions & 12 deletions include/psi.h
Expand Up @@ -247,18 +247,6 @@ extern void psi_irq_reset(void);
extern void psi_enable_fsp_interrupt(struct psi *psi);
extern void psi_fsp_link_in_use(struct psi *psi);

/*
* Must be called by the platform probe() function as the policy
* is established before platform.init
*
* This defines whether the external interrupt should be passed to
* the OS or handled locally in skiboot. Return true for skiboot
* handling. Default if not called is Linux.
*/
#define EXTERNAL_IRQ_POLICY_LINUX false
#define EXTERNAL_IRQ_POLICY_SKIBOOT true
extern void psi_set_external_irq_policy(bool policy);

extern struct lock psi_lock;

#endif /* __PSI_H */
3 changes: 0 additions & 3 deletions platforms/astbmc/common.c
Expand Up @@ -465,9 +465,6 @@ void astbmc_early_init(void)
/* Hostboot forgets to populate the PSI BAR */
astbmc_fixup_psi_bar();

/* Send external interrupts to me */
psi_set_external_irq_policy(EXTERNAL_IRQ_POLICY_SKIBOOT);

if (ast_sio_init()) {
if (ast_io_init()) {
astbmc_fixup_uart();
Expand Down
11 changes: 0 additions & 11 deletions platforms/astbmc/garrison.c
Expand Up @@ -258,17 +258,6 @@ static bool garrison_probe(void)
/* Lot of common early inits here */
astbmc_early_init();

/*
* Override external interrupt policy -> send to Linux
*
* On Naples, we get LPC interrupts via the built-in LPC
* controller demuxer, not an external CPLD. The external
* interrupt is for other uses, such as the TPM chip, we
* currently route it to Linux, but we might change that
* later if we decide we need it.
*/
psi_set_external_irq_policy(EXTERNAL_IRQ_POLICY_LINUX);

/* Fixups until HB get the NPU bindings */
dt_create_npu();

Expand Down
11 changes: 0 additions & 11 deletions platforms/astbmc/p8dnu.c
Expand Up @@ -307,17 +307,6 @@ static bool p8dnu_probe(void)
/* Lot of common early inits here */
astbmc_early_init();

/*
* Override external interrupt policy -> send to Linux
*
* On Naples, we get LPC interrupts via the built-in LPC
* controller demuxer, not an external CPLD. The external
* interrupt is for other uses, such as the TPM chip, we
* currently route it to Linux, but we might change that
* later if we decide we need it.
*/
psi_set_external_irq_policy(EXTERNAL_IRQ_POLICY_LINUX);

/* Fixups until HB get the NPU bindings */
dt_create_npu();

Expand Down

0 comments on commit 9c9375f

Please sign in to comment.