summaryrefslogtreecommitdiffstats
path: root/test
Commit message (Collapse)AuthorAgeFilesLines
* mboxd: Add backend DBus interface and commandline optionsAndrew Jeffery2019-03-192-12/+1
| | | | | | | | | | | | Also implement a backend commandline option to mboxctl: `mboxctl --backend ...`, to allow easy run-time switching of the backend from the commandline. Switching between VPNOR and file backends via mboxctl was tested on Witherspoon, and MTD and file backends on Romulus. Change-Id: Iaf0e27ecf1d5cdd9e3a31729fb179096bbc37408 Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* mboxd: Remove flash API compatibility shimAndrew Jeffery2019-03-183-19/+19
| | | | | | | | | The flash API compatibility was kept to reduce the line noise in the previous backend patch. Remove the compatibility layer now and convert the remaining call-sites. Change-Id: I4b6e54f4463059a7804918add81e7572db7b7c21 Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* mboxd: Add a backend abstraction layer to mboxd.Evan Lojewski2019-03-1811-33/+83
| | | | | | | | | | | | | | | | | | | | | | Introduce a backend abstraction, enabling multiple implementations to be compiled in at once. This change formally abstracts the two existing backends, mtd and vpnor. With the backend abstraction in place, subsequent backends are easier to implement. This change is based of Evan's work and he retains authorship credit. I (AJ) have reworked the patch to pass the vpnor tests, refactored some parts to enable broader use of const structures and others to clarify the initialisation sequences. Due to the existing lack of abstraction the patch has unfortunately wide-ranging impacts. I've whittled it down as much as I consider reasonable. Change-Id: I29984a36dae4ea86ec00b853d2a756f0b9afb3ec Signed-off-by: Evan Lojewski <github@meklort.com> Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* flash: Introduce flash_validate()Andrew Jeffery2019-03-181-2/+1
| | | | | | | | | | Clean up the protocol_negotiate_version() mess. The existing approach came about due to viewing the vpnor implementation as an edge case in its own right. The code becomes much neater if we consider all backends as equal and afford them the callbacks necessary for correct behaviour. Change-Id: Ifaeee9da459818cf22b2f137ddc5b8d0356b9be9 Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* test/flash_copy: Configure MTD device to avoid undefined behaviourAndrew Jeffery2019-03-152-2/+6
| | | | | | | | Otherwise we observe invalid memory accesses due to uninitialised variables. Change-Id: I8b9063ccc9a25b225a562ebe120f2a99a28788ca Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* test/mbox: Assert that the flash fd is saneAndrew Jeffery2019-03-151-0/+2
| | | | | Change-Id: I8f08db1b0ae19197c3fb8c4053deab900154a125 Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* test/mbox: Use assertions for error handlingAndrew Jeffery2019-03-151-5/+2
| | | | | | | No need to try to exit gracefully in the test cases. Change-Id: Id558c5201c08bdb0b34859cb3af1a0efa1a2809b Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* test: Add windows_equally_evictableAndrew Jeffery2018-09-142-1/+90
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Tests for the condition where the minimum age is less than any window's current age, in which case we can get a NULL dereference if the windows_reset_all() implementation is broken. windows.c:409:23: runtime error: member access within null pointer of type 'struct window_context' ASAN:DEADLYSIGNAL ================================================================= ==31400==ERROR: AddressSanitizer: SEGV on unknown address 0x00000004 (pc 0x0002b658 bp 0x74c00270 sp 0x7eb7c678 T0) ==31400==The signal is caused by a WRITE memory access. ==31400==Hint: address points to the zero page. #0 0x2b657 in window_reset windows.c:410 #1 0x2cc9b in windows_create_map windows.c:572 #2 0x1f3f3 in protocol_v1_create_window protocol.c:167 #3 0x2121b in protocol_v2_create_window protocol.c:417 #4 0x24cd7f in generic_vpnor_create_window vpnor/protocol.cpp:51 #5 0x24d053 in protocol_v2_vpnor_create_window vpnor/protocol.cpp:63 #6 0x2663b in mbox_handle_create_window transport_mbox.c:282 #7 0x276db in handle_mbox_req transport_mbox.c:568 #8 0x276db in transport_mbox_dispatch transport_mbox.c:649 #9 0x17fcb in poll_loop mboxd.c:185 #10 0x17fcb in main mboxd.c:423 #11 0x46b68517 in __libc_start_main (/lib/libc.so.6+0x46b68517) AddressSanitizer can not provide additional info. SUMMARY: AddressSanitizer: SEGV windows.c:410 in window_reset ==31400==ABORTING Change-Id: I8161e2ea17953e196d4bb3ca90d19e44ec10c86d Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* daemon: Remove the concept of triggering or suppressing eventsAndrew Jeffery2018-09-141-1/+1
| | | | | | | | | | Rather, trigger them (or not) as necessary in the relevant code-paths. This ensures that any call to one of protocol_events_{set,clear}() actually has a consequence that we can set about dealing with in the transport layer. Change-Id: If64733fa53ed9def0da8330c99cbe48327bab934 Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* transport: Switch transports as required on GET_MBOX_INFOAndrew Jeffery2018-09-141-0/+2
| | | | | | | | Also flush the event state out via the new transport. This must be done after the command has completed for the mbox transport. Change-Id: I251fb949ae67a477288d0d57a1a6afe5b2af5f8f Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* mboxd: Refactor and rename mbox.h to mboxd.hAndrew Jeffery2018-09-1228-28/+36
| | | | | | | | | | | | Refine the purpose of the header file to represent what's required for the daemon itself, not its constituent pieces. Rather, split those definitions out to their respective header files and include them as necessary. Finally the header file is renamed to better reflect its purpose. Change-Id: I48c409f57d96c844589cd865b24f197477dfe87c Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* transport: mbox: Rename *init_mbox_dev to *transport_mbox_initAndrew Jeffery2018-09-121-3/+3
| | | | | Change-Id: I212277ed2462089b905546ef048308d24a5489d0 Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* transport: mbox: Rename dispatch_mbox to transport_mbox_dispatchAndrew Jeffery2018-09-121-1/+1
| | | | | Change-Id: I7c5457099e90ea4ed498fd1898b4504f051d13fc Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* protocol: Provide abstraction over event notificationAndrew Jeffery2018-09-121-1/+1
| | | | | | | | | How this works will be transport-dependent. Move the event notification helpers into the protocol abstraction and call-back through the registered flush handler as necessary. Change-Id: I29e3a9a9785b92de46a2b2750257fb7f8480a184 Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* vpnor: Hijack protocol rather than transportAndrew Jeffery2018-09-121-1/+2
| | | | | | | | | | | | By hijacking the transport the changes in behaviour were limited to the mailbox interface. Now that we have a DBus interface as well this would lead to inconsistent behaviour dependent on the transport. Instead of hooking the transport, push the hook down to the protocol level where we will achieve consistent behaviour across all transports. Change-Id: I437866a6dbda107149336c15a00ee1aa058f5875 Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* protocol: Add get_infoAndrew Jeffery2018-09-122-1/+5
| | | | | Change-Id: Ie3338714813bb65f5d37fcd046dd5bebc0ba21f0 Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* mboxd: Rename mboxd_msg to transport_mboxAndrew Jeffery2018-09-1226-26/+26
| | | | | Change-Id: I0f4e206648c02a98fa938a7e582470c8d90904f1 Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* windows: Rename init_windows to windows_initAndrew Jeffery2018-09-051-1/+1
| | | | | Change-Id: Icdee1694b230d3c03075b840ec31450a236ab9e1 Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* mboxd: Rename windows filesAndrew Jeffery2018-09-052-2/+2
| | | | | Change-Id: I44e110906fd0f751f8f34b175f971e65896a7301 Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* lpc: Rename init_lpc_dev to lpc_dev_initAndrew Jeffery2018-09-051-2/+2
| | | | | Change-Id: I1b3d8f4b561fda13dee8c9c0460aa463d6200e1d Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* mboxd: Rename lpc source filesAndrew Jeffery2018-09-052-3/+3
| | | | | Change-Id: I289618c90b2df8911e362397b7eab99403c86c05 Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* flash: Rename write_flash to flash_writeAndrew Jeffery2018-09-053-14/+14
| | | | | Change-Id: I4b41aac597299c93369d8998b03a7d3e2a128742 Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* flash: Rename erase_flash to flash_eraseAndrew Jeffery2018-09-052-10/+10
| | | | | Change-Id: I417319aadb2fdbfa2d688bb26b5515d2f9265994 Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* flash: Rename copy_flash to flash_copyAndrew Jeffery2018-09-052-4/+4
| | | | | Change-Id: If449889fca3370e25a65719d2f5c5ec90258d633 Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* flash: Rename free_flash_dev to flash_dev_freeAndrew Jeffery2018-09-052-2/+2
| | | | | Change-Id: I3d3da6312217b6b869fa3f62a1d4752be98fd609 Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* flash: Rename init_flash_dev to flash_dev_initAndrew Jeffery2018-09-053-3/+3
| | | | | Change-Id: I6b9a916053baf09c34100dcb5262a4b66a44bc80 Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* mboxd: Rename flash filesAndrew Jeffery2018-09-055-8/+8
| | | | | Change-Id: Icfe9d61775a198c5a0f8227bf5d6c4b7f11aeec3 Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* test: bmc_event_ack_v2 must negotiate v2Andrew Jeffery2018-09-051-5/+15
| | | | | | | | The test checks for a v2-specific masking behaviour of the BMC status byte. Ensure we have v2 before assuming v2 semantics. Change-Id: I9791b000b8f11db4ccc34af6da554aea2139a732 Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* tests: Ensure we don't disable assertsAndrew Jeffery2018-08-021-5/+0
| | | | | Change-Id: Ieede7bc3c7b9d7dadc48a41b54dbe6c2b474c555 Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* mbox_msg: Move handler table to struct mbox_contextAndrew Jeffery2018-04-041-2/+7
| | | | | | | | | This allows us to provide alternative implementations for the handlers as necessary. The vpnor feature, which enforces the read-only property of FFS partitions, requires this for handling CREATE_WRITE_WINDOW. Change-Id: Ia969a6f085244b194c500e66b62adca5e10bacba Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* test: Move vpnor tests to vpnor directoryAndrew Jeffery2018-04-0431-2155/+0
| | | | | | | | | In the spirit of things that are together should be kept together. The repository layout now better corresponds to upstream with the exception of the vpnor directory and some modifications to Makefile.am Change-Id: I16d59a3c9ee846065f6a8c83eb4459715d525f3f Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* vpnor: Isolate relevant code in vpnor directoryAndrew Jeffery2018-04-0426-193/+96
| | | | | | | | | | | | This is prepatory work for introducing more vpnor-specific behaviours to window handling. We will be introducing more objects to link, in order to hook some of the window command handlers. This change takes the opportunity to revert back to the upstream names for some of the original C files. Change-Id: I6b67ae466a2695054035e65ba752881be9c32d1a Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* test: vpnor: Add create_write_window_unmappedAndrew Jeffery2018-04-042-1/+81
| | | | | | | | | | Deny attempts to open write windows to flash space that is unmapped in the ToC. This gives explicit feedback that any data written would not be persisted if it were possible create the write window in the first place. Change-Id: I0e7967247b122aa8d0c1de38af43162ba0ccc8fa Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* test: vpnor: Add create_write_window_rw_partitionAndrew Jeffery2018-04-042-1/+79
| | | | | | | | This test case should always pass. Ensure it does in the face of modifications to how the request is processed. Change-Id: I090aa6518750615c6b931404f5ad54b13cf95e28 Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* test: vpnor: Add create_write_window_ro_partitionAndrew Jeffery2018-04-042-1/+81
| | | | | | | | | | | | | | | | The virtual PNOR implementation enforces the read-only attribute of partitions out of the box. This causes trouble when the host requests a write window over a read-only partition, as the flush command will fail. Further, by design, we have open-implies-close-implies-flush semantics, which means once a flush fails, any subsequent request to open a window also fails. We want the daemon to deny attempts to open write windows over a read-only partition during the CREATE_WRITE_WINDOW request, to avoid the cascading failures later on. Change-Id: Ib6bec3d34a8a47e517088dd504f7a74641882f5d Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* mboxd_windows: Shrink windows accessing the end of flashAndrew Jeffery2018-04-041-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The host may request a window over the end of the flash where the window size combined with the requested offset exceeds the limit of the flash. This issue was introduced with the virtual PNOR, as copy_flash() now may return a size less than requested. This leads to offset requests that are still block aligned, but the windows may no longer be aligned with respect to the flash size. This issue triggers the read error reported from the Petitboot environment in an earlier commit message: / # cat /dev/mtd0 > /dev/null [ 501.061616288,3] MBOX-FLASH: Bad response code from BMC 2 [ 501.150405995,3] MBOX-FLASH: Error waiting for BMC cat: read error: Input/output error / # echo $? 1 / # With the corresponding mboxd trace on the BMC: [ 1519966031.652036815] Received MBOX command: 4 [ 1519966031.652272613] Host requested flash @ 0x03f1a000 [ 1519966031.652411603] Tried to open read window past flash limit [ 1519966031.652500088] Couldn't create window mapping for offset 0x03f1a000 [ 1519966031.652607966] Error handling mbox cmd: 4 [ 1519966031.652661421] Writing MBOX response: 2 [ 1519966031.652762229] Error handling MBOX event Instead, shrink the request such that the resulting window exactly maps the flash limit, and no further. Change-Id: Id33ae3b14252eb40240ef1925311f22aceb103b4 Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* mboxd_windows: Reset evicted windowsAndrew Jeffery2018-04-041-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | After copying a portion of the backing store to a window, create_map_window() "resizes" the window to the aligned-up size reported by copy_flash(). This allows use of the window size as the content size elsewhere in the codebase. However, if we needed to evict a window to satisfy a request, the window properties were not reset. This lead to inefficient use of the reserved memory by limiting the effective window size to the minimum size of all requests that were previously allocated the window in question. Inefficient use of reserved memory isn't the only side effect; the host takes an eye-watering hit to throughput that gets exponentionally worse over time: From the petitboot shell without the patch applied: / # time cat /dev/mtd0 > /dev/null real 0m 49.77s user 0m 0.00s sys 0m 49.76s / # time cat /dev/mtd0 > /dev/null real 1m 33.57s user 0m 0.00s sys 1m 33.55s / # time cat /dev/mtd0 > /dev/null real 4m 45.37s user 0m 0.00s sys 4m 45.35s / # time cat /dev/mtd0 > /dev/null real 9m 17.77s user 0m 0.00s sys 9m 17.76s / # And with the patch applied: / # time cat /dev/mtd0 > /dev/null real 0m 43.00s user 0m 0.00s sys 0m 42.99s / # time cat /dev/mtd0 > /dev/null real 0m 42.40s user 0m 0.00s sys 0m 42.39s / # time cat /dev/mtd0 > /dev/null real 0m 42.41s user 0m 0.00s sys 0m 42.39s / # Reset the properties to allow use of the entire reserved memory region allocated to the window, improving memory efficiency, throughput, and minimising throughput variance. Change-Id: I7be78ec5e0a9ee0caf31133b0861e333844b8975 Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* test: vpnor: Add create_read_window_remapAndrew Jeffery2018-04-042-1/+92
| | | | | | | | | | Sanity check that requesting arbitrary offsets inside a partition will map to an existing window containing that partitions data. This ensures we don't have multiple windows mapping the same content and shooting ourselves in the foot with coherency issues. Change-Id: Ie13cc36a9f092381660d5c45ed6d2477c3a4d6ce Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* test: vpnor: Add create_read_window_sizeAndrew Jeffery2018-04-042-1/+93
| | | | | | | | Tests to make sure that the window size returned has not been shrunk inappropriately by previous requests. Change-Id: Ib86d0744c774b5cf57235833a402bc79ef9979b9 Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* test: mbox: LPC reserve memory size is not MTD sizeAndrew Jeffery2018-04-041-2/+2
| | | | | | | | | | | | | | The backing file for the LPC reserved memory region was being allocated as the size of the MTD device. These sizes are completely unrelated. The current configuration causes segfaults when the reserved memory region exceeds the size of the flash. Instead, resize the backing file once we know how big it needs to be. Thankfully __init_lpc_dev() doesn't need the file to be sized to the reported reserved memory size. Change-Id: I89fd85ffe991ce0503055117684ac7d4d7b8abb1 Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* test: vpnor: Add dump_flash testAndrew Jeffery2018-04-042-1/+109
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | The test is intended to read and verify the content of the flash, and verify that the read completes without error in the face of unusual flash size with respect to the window configuration. Specifically, the test is arranged such that the reserved memory exceeds the flash size, and the flash layout conspires such that the final request is for a window whose flash offset and window size exceed the flash size. This currently triggers an error condition in the mbox window handling, and causes the host to receive an error response to its CREATE_READ_WINDOW request. On the host side this results in the reading process receiving an EIO. Due to what is probably an oversight in the mbox window handling, some care needs to be taken in the test configuration: The current behaviour is that copy_flash() will return a length that may be less than the size of the reserved memory window. The returned value is aligned up to the next block and assigned as the current window's size. However, when evicting a window, we do not reset the size to the default size. As a consequence, windows can shrink and remain at a size below the default window size. Without careful control of the test parameters this can lead to the appearance that there is no bug in the window handling as, serendipitously, a window of the correct size can be evicted for the final CREATE_READ_WINDOW request. Change-Id: I436595f428bf4e93392315ec1110b6b6f4a11821 Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* test: mbox: Add mbox_rspcpy()Andrew Jeffery2018-04-042-2/+23
| | | | | | | | | | | mbox_rspcpy() copies the mboxd response into a struct mbox_msg for use by the caller. This is useful in test cases that want to read contiguous chunks of the flash. mbox_rspcpy() allows them to extract the current window's offset and length to dynamically construct the CREATE_READ_WINDOW request for the subsequent blocks. Change-Id: I4d35889a0785b2d9ab737eba6755892caed53270 Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* pnor_partition: Handle requests exceeding partition's actual sizeAndrew Jeffery2018-04-041-3/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Partitions with patch files whose size was less than the partition size in the ToC could not be completely read by the host. For example when scanning over the entire PNOR on the host with `cat /dev/mtd0 > /dev/null` the host would lock up. A trace from mboxd under these circumstances shows: [ 1519832857.966501396] Received MBOX command: 4 [ 1519832857.966695620] Host requested flash @ 0x02a44000 [ 1519832857.968642020] Window @ 0x730ce000 for size 0x00024000 maps flash offset 0x02a44000 [ 1519832857.968808728] Writing MBOX response: 1 [ 1519832858.222090630] Received MBOX command: 4 [ 1519832858.222284692] Host requested flash @ 0x02a68000 [ 1519832858.223964544] Window @ 0x73cce000 for size 0x00009000 maps flash offset 0x02a68000 [ 1519832858.224136142] Writing MBOX response: 1 [ 1519832858.435944292] Received MBOX command: 4 [ 1519832858.436138394] Host requested flash @ 0x02a71000 [ 1519832858.437026725] Window @ 0x734ce000 for size 0x00007000 maps flash offset 0x02a71000 [ 1519832858.437195251] Writing MBOX response: 1 [ 1519832858.646768070] Received MBOX command: 4 [ 1519832858.646968637] Host requested flash @ 0x02a78000 [ 1519832858.647567228] Window @ 0x768ce000 for size 0x00001000 maps flash offset 0x02a78000 [ 1519832858.647731755] Writing MBOX response: 1 [ 1519832858.848288015] Received MBOX command: 4 [ 1519832858.848489188] Host requested flash @ 0x02a79000 [ 1519832858.849006404] Window @ 0x758ce000 for size 0x00000000 maps flash offset 0x02a79000 [ 1519832858.849168870] Writing MBOX response: 1 [ 1519832859.048631708] Received MBOX command: 4 [ 1519832859.048827305] Host requested flash @ 0x02a79000 [ 1519832859.049343956] Window @ 0x756ce000 for size 0x00000000 maps flash offset 0x02a79000 [ 1519832859.049503553] Writing MBOX response: 1 [ 1519832859.248950916] Received MBOX command: 4 [ 1519832859.249142069] Host requested flash @ 0x02a79000 [ 1519832859.249649871] Window @ 0x741ce000 for size 0x00000000 maps flash offset 0x02a79000 Of significance are the last three CREATE_READ_WINDOW requests, where the request succeeds but mboxd reports back a zero-sized window to the host. The host immediately considers itself done with the window, and requests a new window offset from the previous by size, which is zero. Thus it re-requests the same offset, and receives the same zero-sized window in return. As a result, firmware gets stuck in an unterminated loop, stealing the core from Linux, which promptly starts reporting a constant stream of RCU stall warnings among the rest of the failures. Everyone is miserable. The offset in question maps to a partition but not to a valid offset in the file backing that partition. Resize the backing file to meet the maximum access address within the limits of the partition size defined in the ToC. By doing so, we are able to map as much of the partition as necessary. However, we're not done. Whilst we no longer crash the host, we still don't successfully complete the operation the host requested. From Petitboot: / # cat /dev/mtd0 > /dev/null [ 501.061616288,3] MBOX-FLASH: Bad response code from BMC 2 [ 501.150405995,3] MBOX-FLASH: Error waiting for BMC cat: read error: Input/output error / # echo $? 1 / # And the corresponding mboxd trace on the BMC: [ 1519966031.652036815] Received MBOX command: 4 [ 1519966031.652272613] Host requested flash @ 0x03f1a000 [ 1519966031.652411603] Tried to open read window past flash limit [ 1519966031.652500088] Couldn't create window mapping for offset 0x03f1a000 [ 1519966031.652607966] Error handling mbox cmd: 4 [ 1519966031.652661421] Writing MBOX response: 2 [ 1519966031.652762229] Error handling MBOX event The read failure will be fixed in a follow-up patch. Change-Id: Iffdfb8af6f739df5e6d9c171b584a7244bdb7099 Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* pnor_partition_table: Refactor to allow tests to specify patch locationAndrew Jeffery2018-04-0417-27/+45
| | | | | | | | | | | | | | | | | | | | | | | | | The Table class was unhelpful for testing in a couple of ways: 1. It attempted to access files on the filesystem whilst parsing ToC entries 2. It incorrectly assumed the location of the files it was accessing Both of these issues come down to handling of patch files and the configuration of the 'actual' member of the partition struct. Hoist the handling of the partition entry's data size out of the ToC parser, and rework the Table constructor to only require a struct mbox_context pointer. We can then use the paths member of mbox_context to find the patch location rather than hard-code the value generated by the configure script. This prompts a rework and rename of the wrapper functions in mboxd_pnor_partition_table.{cpp,h} to better align with the new behaviour of the Table constructor. Reworking the wrappers has knock-on effects in the tests, but the changes are straight-forward. Change-Id: I87e63daf0d28b93566f7e5cb565cbf0790428479 Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* test: vpnor: Add write_patch_resizeAndrew Jeffery2018-04-042-1/+87
| | | | | | | | Ensures writes can resize the backing files up to the limit of the partition size. Change-Id: Ie399d556dd485a235b7f6731d35536b2a6c703be Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* test: vpnor: Add read_patchAndrew Jeffery2018-04-042-1/+89
| | | | | | | | | | | The patch file in question is smaller than the partition defined for it. This configuration exposes a bug where mboxd responds to a CREATE_READ_WINDOW for the blocks after the length of the patch file with a 0-sized window. Outside of the test environment this behaviour causes the host to enter an unterminated loop in firmware. Change-Id: I13aafb58a7876dc1589f695a9f5c80d082b4e15f Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* test: vpnor: Add ability to deploy patches in VpnorRootAndrew Jeffery2018-04-042-0/+12
| | | | | Change-Id: If557811530f9a886355d023ea73c3412ba5797f8 Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* test: vpnor: Add create_read_window_partition_invalidAndrew Jeffery2018-03-242-1/+71
| | | | | | | | The CREATE_READ_WINDOW request asks for an offset below the one defined partition, between it and the ToC. Change-Id: Iafaa530a3d6b02626106508b81c7aa7eaef9c876 Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* pnor_partition_table: Raise exception for unmapped offsetsAndrew Jeffery2018-03-242-3/+1
| | | | | | | | | | | | | | | Allow reads and writes of offsets that don't map onto partitions defined in the ToC. Do so by ignoring the mapping failure and filling a window with 0xff in the hole from the requested offset to the following partition. This change also removes the reliance on InternalFailure as the exception of choice for communicating failures. We can do better without the teeth-pulling required by phosphor-logging by translating custom exceptions into phosphor-logging exceptions at the edges. Change-Id: Ibfa961a66b0b979354c6dc226ccbe7e9fbafc16d Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* test: vpnor: Add create_read_window_straddle_partitionsAndrew Jeffery2018-03-242-1/+89
| | | | | Change-Id: Icde607847812bcba3c7e2a131d7f46e223d44440 Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
OpenPOWER on IntegriCloud