diff options
author | Alexey Kardashevskiy <aik@ozlabs.ru> | 2019-01-11 15:03:35 +1100 |
---|---|---|
committer | Stewart Smith <stewart@linux.ibm.com> | 2019-02-18 22:12:37 -0600 |
commit | fd0950488f7f2c34e921888f69e76d75498078f2 (patch) | |
tree | 88ab224819b0c5bd1b20f02d5f07d6fc1f117a4a | |
parent | 639f67285c2cf2ca122638d2c7469da81236b365 (diff) | |
download | blackbird-skiboot-fd0950488f7f2c34e921888f69e76d75498078f2.tar.gz blackbird-skiboot-fd0950488f7f2c34e921888f69e76d75498078f2.zip |
opal: Deprecate reading the PHB status
The OPAL_PCI_EEH_FREEZE_STATUS call takes a bunch of parameters, one of
them is @phb_status. It is defined as __be64* and always NULL in
the current Linux upstream but if anyone ever decides to read that status,
then the PHB3's handler will assume it is struct OpalIoPhb3ErrorData*
(which is a lot bigger than 8 bytes) and zero it causing the stack
corruption; p7ioc-phb has the same issue.
This removes @phb_status from all eeh_freeze_status() hooks and moves
the error message from PHB4 to the affected OPAL handlers.
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Reviewed-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
Reviewed-By: Oliver O'Halloran <oohall@gmail.com>
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
-rw-r--r-- | core/pci-opal.c | 14 | ||||
-rw-r--r-- | core/pci.c | 2 | ||||
-rw-r--r-- | hw/npu.c | 3 | ||||
-rw-r--r-- | hw/npu2.c | 3 | ||||
-rw-r--r-- | hw/p7ioc-phb.c | 11 | ||||
-rw-r--r-- | hw/phb3.c | 10 | ||||
-rw-r--r-- | hw/phb4.c | 9 | ||||
-rw-r--r-- | include/npu2.h | 3 | ||||
-rw-r--r-- | include/pci.h | 3 |
9 files changed, 24 insertions, 34 deletions
diff --git a/core/pci-opal.c b/core/pci-opal.c index a4d6eeed..d7abb15b 100644 --- a/core/pci-opal.c +++ b/core/pci-opal.c @@ -111,8 +111,13 @@ static int64_t opal_pci_eeh_freeze_status(uint64_t phb_id, uint64_t pe_number, if (!phb->ops->eeh_freeze_status) return OPAL_UNSUPPORTED; phb_lock(phb); + + if (phb_status) + prlog(PR_ERR, "PHB#%04llx: %s: deprecated PHB status\n", + phb_id, __func__); + rc = phb->ops->eeh_freeze_status(phb, pe_number, freeze_state, - pci_error_type, NULL, phb_status); + pci_error_type, NULL); phb_unlock(phb); return rc; @@ -961,8 +966,13 @@ static int64_t opal_pci_eeh_freeze_status2(uint64_t phb_id, uint64_t pe_number, if (!phb->ops->eeh_freeze_status) return OPAL_UNSUPPORTED; phb_lock(phb); + + if (phb_status) + prlog(PR_ERR, "PHB#%04llx: %s: deprecated PHB status\n", + phb_id, __func__); + rc = phb->ops->eeh_freeze_status(phb, pe_number, freeze_state, - pci_error_type, severity, phb_status); + pci_error_type, severity); phb_unlock(phb); return rc; @@ -337,7 +337,7 @@ static void pci_check_clear_freeze(struct phb *phb) /* Retrieve the frozen state */ rc = phb->ops->eeh_freeze_status(phb, pe_number, &freeze_state, - &pci_error_type, &sev, NULL); + &pci_error_type, &sev); if (rc) return; if (freeze_state == OPAL_EEH_STOPPED_NOT_FROZEN) @@ -882,8 +882,7 @@ static int64_t npu_freeze_status(struct phb *phb, uint64_t pe_number __unused, uint8_t *freeze_state, uint16_t *pci_error_type __unused, - uint16_t *severity __unused, - uint64_t *phb_status __unused) + uint16_t *severity __unused) { /* FIXME: When it's called by skiboot PCI config accessor, * the PE number is fixed to 0, which is incorrect. We need @@ -1274,8 +1274,7 @@ int64_t npu2_freeze_status(struct phb *phb __unused, uint64_t pe_number __unused, uint8_t *freeze_state, uint16_t *pci_error_type, - uint16_t *severity, - uint64_t *phb_status __unused) + uint16_t *severity) { /* * FIXME: When it's called by skiboot PCI config accessor, diff --git a/hw/p7ioc-phb.c b/hw/p7ioc-phb.c index 33de10ad..47f4f3c9 100644 --- a/hw/p7ioc-phb.c +++ b/hw/p7ioc-phb.c @@ -284,8 +284,7 @@ static void p7ioc_eeh_read_phb_status(struct p7ioc_phb *p, static int64_t p7ioc_eeh_freeze_status(struct phb *phb, uint64_t pe_number, uint8_t *freeze_state, uint16_t *pci_error_type, - uint16_t *severity, - uint64_t *phb_status) + uint16_t *severity) { struct p7ioc_phb *p = phb_to_p7ioc_phb(phb); uint64_t peev_bit = PPC_BIT(pe_number & 0x3f); @@ -301,7 +300,7 @@ static int64_t p7ioc_eeh_freeze_status(struct phb *phb, uint64_t pe_number, *pci_error_type = OPAL_EEH_PHB_ERROR; if (severity) *severity = OPAL_EEH_SEV_PHB_DEAD; - goto bail; + return OPAL_SUCCESS; } /* Check fence */ @@ -311,7 +310,7 @@ static int64_t p7ioc_eeh_freeze_status(struct phb *phb, uint64_t pe_number, *pci_error_type = OPAL_EEH_PHB_ERROR; if (severity) *severity = OPAL_EEH_SEV_PHB_FENCED; - goto bail; + return OPAL_SUCCESS; } /* Check the PEEV */ @@ -345,10 +344,6 @@ static int64_t p7ioc_eeh_freeze_status(struct phb *phb, uint64_t pe_number, else *pci_error_type = OPAL_EEH_PE_DMA_ERROR; - bail: - if (phb_status) - p7ioc_eeh_read_phb_status(p, (struct OpalIoP7IOCPhbErrorData *) - phb_status); return OPAL_SUCCESS; } @@ -2718,8 +2718,7 @@ static struct pci_slot *phb3_slot_create(struct phb *phb) static int64_t phb3_eeh_freeze_status(struct phb *phb, uint64_t pe_number, uint8_t *freeze_state, uint16_t *pci_error_type, - uint16_t *severity, - uint64_t *phb_status) + uint16_t *severity) { struct phb3 *p = phb_to_phb3(phb); uint64_t peev_bit = PPC_BIT(pe_number & 0x3f); @@ -2744,7 +2743,7 @@ static int64_t phb3_eeh_freeze_status(struct phb *phb, uint64_t pe_number, *pci_error_type = OPAL_EEH_PHB_ERROR; if (severity) *severity = OPAL_EEH_SEV_PHB_FENCED; - goto bail; + return OPAL_SUCCESS; } /* Check the PEEV */ @@ -2770,11 +2769,6 @@ static int64_t phb3_eeh_freeze_status(struct phb *phb, uint64_t pe_number, if (pestb & IODA2_PESTB_DMA_STOPPED) *freeze_state |= OPAL_EEH_STOPPED_DMA_FREEZE; -bail: - if (phb_status) - phb3_read_phb_status(p, - (struct OpalIoPhb3ErrorData *)phb_status); - return OPAL_SUCCESS; } @@ -3398,8 +3398,7 @@ static bool phb4_freeze_escalate(uint64_t pesta) static int64_t phb4_eeh_freeze_status(struct phb *phb, uint64_t pe_number, uint8_t *freeze_state, uint16_t *pci_error_type, - uint16_t *severity, - uint64_t *phb_status) + uint16_t *severity) { struct phb4 *p = phb_to_phb4(phb); uint64_t peev_bit = PPC_BIT(pe_number & 0x3f); @@ -3424,7 +3423,7 @@ static int64_t phb4_eeh_freeze_status(struct phb *phb, uint64_t pe_number, *pci_error_type = OPAL_EEH_PHB_ERROR; if (severity) *severity = OPAL_EEH_SEV_PHB_FENCED; - goto bail; + return OPAL_SUCCESS; } /* Check the PEEV */ @@ -3458,10 +3457,6 @@ static int64_t phb4_eeh_freeze_status(struct phb *phb, uint64_t pe_number, if (pestb & IODA3_PESTB_DMA_STOPPED) *freeze_state |= OPAL_EEH_STOPPED_DMA_FREEZE; -bail: - if (phb_status) - PHBERR(p, "%s: deprecated PHB status\n", __func__); - return OPAL_SUCCESS; } diff --git a/include/npu2.h b/include/npu2.h index f51a6a2a..0e79e0e0 100644 --- a/include/npu2.h +++ b/include/npu2.h @@ -225,6 +225,5 @@ int64_t npu2_freeze_status(struct phb *phb __unused, uint64_t pe_number __unused, uint8_t *freeze_state, uint16_t *pci_error_type __unused, - uint16_t *severity __unused, - uint64_t *phb_status __unused); + uint16_t *severity __unused); #endif /* __NPU2_H */ diff --git a/include/pci.h b/include/pci.h index 05165614..b49641ca 100644 --- a/include/pci.h +++ b/include/pci.h @@ -260,8 +260,7 @@ struct phb_ops { int64_t (*eeh_freeze_status)(struct phb *phb, uint64_t pe_number, uint8_t *freeze_state, uint16_t *pci_error_type, - uint16_t *severity, - uint64_t *phb_status); + uint16_t *severity); int64_t (*eeh_freeze_clear)(struct phb *phb, uint64_t pe_number, uint64_t eeh_action_token); int64_t (*eeh_freeze_set)(struct phb *phb, uint64_t pe_number, |