aboutsummaryrefslogtreecommitdiff
path: root/libflash
AgeCommit message (Collapse)AuthorFilesLines
2019-07-16libflash: Fix broken continuationsOliver O'Halloran1-5/+5
Some of the libflash debug messages don't print a newlines at the end of the line and assume that the next print will be contigious with the last. This isn't true in skiboot since log messages are prefixed with a timestamp. This results in funny looking output such as: LIBFLASH: Verifying... LIBFLASH: reading page 0x01963000..0x01964000...[3.084846885,7] same ! LIBFLASH: reading page 0x01964000..0x01965000...[3.086164489,7] same ! Fix this by moving the "same !" debug message to a new line with the prefix "LIBFLASH: ..." to indicate it's a continuation of the last statement. First reported in https://github.com/open-power/skiboot/issues/51 Reported-by: Joel Stanley <joel@jms.id.au> Signed-off-by: Oliver O'Halloran <oohall@gmail.com> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2019-05-20include/mem_region-malloc: Define calloc for CCAN HeapJordan Niethe1-8/+0
We would like to be able to use dump_trace to dump multiple trace buffers at a time. The entries should be displayed in timestamp order. As each buffer is already ordered on timestamp, a k-way merge is an efficient method to sort the buffers together by timestamp. A heap can be used to implement a k-way merge. As CCAN is already included in Skiboot, use the CCAN heap. The heap uses the calloc function which is currently not defined in skiboot. Prepare for adding this heap by defining calloc. Remove local calloc definition from libffs.c. Signed-off-by: Jordan Niethe <jniethe5@gmail.com> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2019-04-09test-ipmi-hiomap: Add read-one-byte testVasant Hegde1-0/+40
Add test case to read: - 1 byte - 1 block and 1 byte data Cc: Andrew Jeffery <andrew@aj.id.au> Cc: skiboot-stable@lists.ozlabs.org Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> Reviewed-by: Andrew Jeffery <andrew@aj.id.au> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2019-04-09test-ipmi-hiomap: Fix lpc-read-successVasant Hegde1-1/+3
Cc: Andrew Jeffery <andrew@aj.id.au> Cc: skiboot-stable@lists.ozlabs.org Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> Reviewed-by: Andrew Jeffery <andrew@aj.id.au> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2019-04-09test-ipmi-hiomap: Add write-one-byte testVasant Hegde1-0/+38
Add test case to write: - 1 byte - 1 block and 1 byte data Cc: Andrew Jeffery <andrew@aj.id.au> Cc: skiboot-stable@lists.ozlabs.org Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> Reviewed-by: Andrew Jeffery <andrew@aj.id.au> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2019-04-09test-ipmi-hiomap: Assert if size is zeroVasant Hegde1-1/+2
Cc: Andrew Jeffery <andrew@aj.id.au> Cc: skiboot-stable@lists.ozlabs.org Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> Reviewed-by: Andrew Jeffery <andrew@aj.id.au> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2019-04-09libflash/ipmi-hiomap: Fix blocks count issueVasant Hegde1-3/+18
We convert data size to block count and pass block count to BMC. If data size is not block aligned then we endup sending block count less than actual data. BMC will write partial data to flash memory. Sample log : [ 594.388458416,7] HIOMAP: Marked flash dirty at 0x42010 for 8 [ 594.398756487,7] HIOMAP: Flushed writes [ 594.409596439,7] HIOMAP: Marked flash dirty at 0x42018 for 3970 [ 594.419897507,7] HIOMAP: Flushed writes In this case HIOMAP sent data with block count=0 and hence BMC didn't flush data to flash. Lets fix this issue by adjusting block count before sending it to BMC. Cc: Andrew Jeffery <andrew@aj.id.au> Cc: skiboot-stable@lists.ozlabs.org Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> Reviewed-by: Andrew Jeffery <andrew@aj.id.au> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2019-03-20libffs: Fix string truncation gcc warning.Michal Suchanek1-1/+1
Use memcpy as other libffs functions do. Signed-off-by: Michal Suchanek <msuchanek@suse.de> Reviewed-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2019-02-24test-ipmi-hiomap: Add erase-one-block-twice testAndrew Jeffery1-0/+61
Cc: stable Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2019-02-24test-ipmi-hiomap: Add write-one-block-twice testAndrew Jeffery1-0/+65
Cc: stable Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2019-02-24test-ipmi-hiomap: Add read-one-block-twice testAndrew Jeffery1-0/+33
Cc: stable Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2019-02-24test-ipmi-hiomap: Add protocol-recovery-get-flash-info-failure testAndrew Jeffery1-0/+195
Cc: stable Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2019-02-24test-ipmi-hiomap: Add protocol-recovery-failure-get-info testAndrew Jeffery1-0/+191
Cc: stable Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2019-02-24test-ipmi-hiomap: Add protocol-recovery-failure-ack testAndrew Jeffery1-0/+170
Cc: stable Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2019-02-24test-ipmi-hiomap: Add erase-malformed testsAndrew Jeffery1-0/+92
Cc: stable Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2019-02-24test-ipmi-hiomap: Add flush-malformed testsAndrew Jeffery1-0/+95
Cc: stable Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2019-02-24test-ipmi-hiomap: Add mark-dirty-malformed testsAndrew Jeffery1-0/+101
Cc: stable Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2019-02-24test-ipmi-hiomap: Add create-write-window-malformed testsAndrew Jeffery1-0/+95
Cc: stable Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2019-02-24test-ipmi-hiomap: Add create-read-window-malformed testsAndrew Jeffery1-0/+95
Cc: stable Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2019-02-24test-ipmi-hiomap: Add get-flash-info-malformed testsAndrew Jeffery1-0/+64
Cc: stable Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2019-02-24test-ipmi-hiomap: Add get-info-malformed testsAndrew Jeffery1-0/+64
Cc: stable Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2019-02-24test-ipmi-hiomap: Add ack-malformed testsAndrew Jeffery1-0/+60
Cc: stable Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2019-02-24test-ipmi-hiomap: Add erase-error testAndrew Jeffery1-0/+41
Cc: stable Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2019-02-24test-ipmi-hiomap: Add ack-error testAndrew Jeffery1-0/+7
Cc: stable Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2019-02-24test-ipmi-hiomap: Add flush-error testAndrew Jeffery1-0/+42
Cc: stable Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2019-02-24test-ipmi-hiomap: Add mark-dirty-error testAndrew Jeffery1-0/+45
Cc: stable Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2019-02-24test-ipmi-hiomap: Add create-write-window-error testAndrew Jeffery1-0/+42
Cc: stable Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2019-02-24test-ipmi-hiomap: Add create-read-window-error testAndrew Jeffery1-0/+42
Cc: stable Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2019-02-24test-ipmi-hiomap: Add get-flash-info-error testAndrew Jeffery1-0/+30
Cc: stable Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2019-02-24test-ipmi-hiomap: Add get-info-error testAndrew Jeffery1-0/+29
Cc: stable Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2019-02-24test-ipmi-hiomap: Add get-flash-info testAndrew Jeffery1-0/+46
Cc: stable Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2019-02-24test-ipmi-hiomap: Add action-error testAndrew Jeffery1-0/+30
Cc: stable Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2019-02-24test-ipmi-hiomap: Add bad-sequence testAndrew Jeffery1-0/+31
Cc: stable Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2019-02-24test-ipmi-hiomap: Add event-during-eraseAndrew Jeffery1-0/+37
Cc: stable Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2019-02-24test-ipmi-hiomap: Add event-before-erase testAndrew Jeffery1-0/+18
Cc: stable Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2019-02-24test-ipmi-hiomap: Add erase-two-blocks testAndrew Jeffery1-0/+64
Cc: stable Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2019-02-24test-ipmi-hiomap: Add erase-one-block testAndrew Jeffery1-0/+54
Cc: stable Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2019-02-24test-ipmi-hiomap: Add event-during-write testAndrew Jeffery1-0/+41
Cc: stable Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2019-02-24test-ipmi-hiomap: Add event-before-write testAndrew Jeffery1-0/+15
Cc: stable Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2019-02-24test-ipmi-hiomap: Add write-two-blocks testAndrew Jeffery1-0/+118
Cc: stable Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2019-02-24test-ipmi-hiomap: Add write-one-block testAndrew Jeffery1-0/+92
Cc: stable Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2019-02-24test-ipmi-hiomap: Add event-during-read testAndrew Jeffery1-0/+41
Cc: stable Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2019-02-24test-ipmi-hiomap: Add event-before-readAndrew Jeffery1-0/+30
Cc: stable Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2019-02-24test-ipmi-hiomap: Add read-two-blocks testAndrew Jeffery1-7/+98
Cc: stable Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2019-02-24test-ipmi-hiomap: Add read-one-block testAndrew Jeffery1-3/+68
Cc: stable Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2019-02-24test-ipmi-hiomap: Add protocol-persistent-error testAndrew Jeffery1-0/+33
Cc: stable Cc: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Tested-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2019-02-24libflash/ipmi-hiomap: Enforce message size for empty responseAndrew Jeffery1-0/+6
The protocol defines the response to the associated messages as empty except for the command ID and sequence fields. If the BMC is returning extra data consider the message malformed. Cc: stable Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2019-02-24libflash/ipmi-hiomap: Remove unused close handlingAndrew Jeffery1-5/+0
Issuing a HIOMAP_C_CLOSE is not required by the protocol specification, rather a close can be implicit in a subsequent CREATE_{READ,WRITE}_WINDOW request. The implicit close provides an opportunity to reduce LPC traffic and the implementation takes up that optimisation, so remove the case from the IPMI callback handler. Cc: stable Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2019-02-24libflash/ipmi-hiomap: Overhaul event handlingAndrew Jeffery2-64/+58
Reworking the event handling was inspired by a bug report by Vasant where the host would get wedged on multiple flash access attempts in the face of a persistent error state on the BMC-side. The cause of this bug was the early-exit based on ctx->update, which erronously assumed that all events had been completely handled in prior calls to ipmi_hiomap_handle_events(). This is not true if e.g. HIOMAP_E_DAEMON_READY is clear in the prior calls. Regardless, there were other correctness and efficiency problems with the handling strategy: * Ack-able event state was not restored in the face of errors in the process of re-establishing protocol state * It forced needless window restoration with respect to the context in which ipmi_hiomap_handle_events() was called. * Tests for HIOMAP_E_DAEMON_READY and HIOMAP_E_FLASH_LOST were redundant with the overhauled error handling introduced in the previous patch Fix all of the above issues and add comments to explain the event handling flow. Tests for correctness follow later in the series. Cc: stable Cc: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2019-02-24libflash/ipmi-hiomap: Overhaul error handlingAndrew Jeffery1-107/+197
The aim is to improve the robustness with respect to absence of the BMC-side daemon. The current error handling roughly mirrors what was done for the mailbox implementation, but there's room for improvement. Errors are split into two classes, those that affect the transport state and those that affect the window validity. From here, we push the transport state error checks right to the bottom of the stack, to ensure the link is known to be in a good state before any message is sent. Window validity tests remain as they were in the hiomap_window_move() and ipmi_hiomap_read() functions. Validity tests are not necessary in the write and erase paths as we will receive an error response from the BMC when performing a dirty or flush on an invalid window. Recovery also remains as it was, done on entry to the blocklevel callbacks. If an error state is encountered in the middle of an operation no attempt is made to recover it on the spot, instead the error is returned up the stack and the caller can choose how it wishes to respond. Cc: stable Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>