#
ba5f7477 |
| 11-Dec-2024 |
Matt Johnston <matt@codeconstruct.com.au> |
tests: astlpc: Change high-to-low MTU test for txq
The test relies on internal packet queue state, which is going to change in a future commit (packets generated as required). Instead test that upda
tests: astlpc: Change high-to-low MTU test for txq
The test relies on internal packet queue state, which is going to change in a future commit (packets generated as required). Instead test that updating a host from high to low MTU works correctly, without relying on specific buffering.
Change-Id: Id33c1d0e5bb0b8cc0ac2a8cc964e3c694643ac02 Signed-off-by: Matt Johnston <matt@codeconstruct.com.au>
show more ...
|
#
3ef47785 |
| 11-Dec-2024 |
Matt Johnston <matt@codeconstruct.com.au> |
Fix warnings reported by -Wpedantic
Previously CI hasn't been running with -Wpedantic (using autoconf), so these haven't been reported previously.
- replace BUILD_ASSERT with static_assert() - don'
Fix warnings reported by -Wpedantic
Previously CI hasn't been running with -Wpedantic (using autoconf), so these haven't been reported previously.
- replace BUILD_ASSERT with static_assert() - don't use %m GNU extension for printf - don't use arithmetic on void* - remove unused variables
Change-Id: I97d1acc908f06773b8b1ee95bfee80760fdc7a63 Signed-off-by: Matt Johnston <matt@codeconstruct.com.au>
show more ...
|
#
7f7fdc1d |
| 12-May-2023 |
Andrew Jeffery <andrew@aj.id.au> |
clang-format: copy latest and re-format
clang-format-16 has some backwards incompatible changes that require additional settings for best compatibility and re-running the formatter. Copy the latest
clang-format: copy latest and re-format
clang-format-16 has some backwards incompatible changes that require additional settings for best compatibility and re-running the formatter. Copy the latest .clang-format from the docs repository and reformat the repository.
Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Change-Id: Ic5b4c8584fafe5ebe3d01c1f685cab271dd9690b
show more ...
|
#
c9ac4fc5 |
| 29-Sep-2022 |
Andrew Jeffery <andrew@aj.id.au> |
tests: astlpc: MTU renegotiation with populated Tx queue
Capture the behaviour that lead to a complete stall now that we've fixed the bug.
Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Change-Id:
tests: astlpc: MTU renegotiation with populated Tx queue
Capture the behaviour that lead to a complete stall now that we've fixed the bug.
Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Change-Id: I9883a4f4040a282de417cf0e4293ecd1ad45419a
show more ...
|
#
e64c5163 |
| 29-Sep-2022 |
Andrew Jeffery <andrew@aj.id.au> |
tests: astlpc: Rename the message Rx handler
The implementation of the handler is strictly associated with `struct astlpc_test`, so make this clear through the name.
Signed-off-by: Andrew Jeffery <
tests: astlpc: Rename the message Rx handler
The implementation of the handler is strictly associated with `struct astlpc_test`, so make this clear through the name.
Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Change-Id: I5746c0306ef96faed5f778e20c6f4cccf173bb0e
show more ...
|
#
fe763e98 |
| 05-Aug-2022 |
Andrew Jeffery <andrew@aj.id.au> |
astlpc: Implement async support via buffer state tracking
To remove the unbounded loop in mctp_astlpc_kcs_send() we need the capability to retry sending the pending command once the data value has b
astlpc: Implement async support via buffer state tracking
To remove the unbounded loop in mctp_astlpc_kcs_send() we need the capability to retry sending the pending command once the data value has been consumed. However, the link is duplex and we may enter the state where we have multiple pending commands.
Rather than explicitly track the set of pending commands, track the buffer state in order to derive both the pollfd state needed by the caller _and_ the pending buffer synchronisation commands.
Unfortunately due to the structure of the code the integration of the state tracking is a little messy, but is capable of correctly booting a P10 system.
I've put up a less constrained and perhaps aspirational implementation of how the state tracking could be implemented if we feel the need to rework things going forward:
https://github.com/amboar/libmctp-shmb/
Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Change-Id: I693946dae5336aa5d0f07bcd66c36f1ccd391054
show more ...
|
Revision tags: v0.11 |
|
#
f39c3857 |
| 10-Jan-2022 |
Sumanth Bhat <sumanth.bhat@linux.intel.com> |
core: Add TX/RX API that exposes message tag and tag owner
MCTP received packets can carry a message tag and tag owner bit which is set by a remote MCTP endpoint. This can be used by the remote MCTP
core: Add TX/RX API that exposes message tag and tag owner
MCTP received packets can carry a message tag and tag owner bit which is set by a remote MCTP endpoint. This can be used by the remote MCTP endpoint to track the responses. Thus, libmctp should provide a mechanism for the upper layer MCTP applications to respond with the same message tag.
This patchset extends TX and RX API with message tag and tag owner bits.
Signed-off-by: Sumanth Bhat <sumanth.bhat@linux.intel.com> Change-Id: I6d07eafa86c653abdd4313ab7cc77e5a93124477
show more ...
|
#
5ab78259 |
| 17-Feb-2022 |
Andrew Jeffery <andrew@aj.id.au> |
libmctp: Introduce compiler.h
Define __unused here and include compiler.h in all the places we can make use of it. Clean up some header ordering and include styles while we're at it.
Signed-off-by:
libmctp: Introduce compiler.h
Define __unused here and include compiler.h in all the places we can make use of it. Clean up some header ordering and include styles while we're at it.
Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Change-Id: I33ddbdacbddbbf557dc02e42d8dde71a16e1cabe
show more ...
|
#
eba19a3b |
| 09-Mar-2021 |
Andrew Jeffery <andrew@aj.id.au> |
astlpc: Introduce protocol v3 with integrity checks
v3 of the binding adds a CRC-32 value as a medium-specific trailer to each packet passing over the binding interface.
The patch includes a naive
astlpc: Introduce protocol v3 with integrity checks
v3 of the binding adds a CRC-32 value as a medium-specific trailer to each packet passing over the binding interface.
The patch includes a naive bit-shift implementation of CRC-32, we can improve it later as necessary.
Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Change-Id: I93a95bccef30010d56e10e29b6d84554268ab7af
show more ...
|
#
88412be4 |
| 09-Mar-2021 |
Andrew Jeffery <andrew@aj.id.au> |
astlpc: Make packet properties depend on protocol version
The astlpc binding will shortly have an implementation of the v3 protocol specification. v3 adjusts the medium-specific packet size to inclu
astlpc: Make packet properties depend on protocol version
The astlpc binding will shortly have an implementation of the v3 protocol specification. v3 adjusts the medium-specific packet size to include a CRC-32 in a packet trailer. Implementing v3 must not impact the behaviour of earlier protocol versions, so provide an ops struct to handle version-specific details.
Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Change-Id: Iab04defa76b57a592442189e6ade58f25ed1d9ae
show more ...
|
#
3f4bca9a |
| 27-Jan-2021 |
Andrew Jeffery <andrew@aj.id.au> |
tests: astlpc: Exercise mctp_message_tx() before channel init
Attempting to send messages before channel init should intentionally fail, not fail by OOMing the machine.
Signed-off-by: Andrew Jeffer
tests: astlpc: Exercise mctp_message_tx() before channel init
Attempting to send messages before channel init should intentionally fail, not fail by OOMing the machine.
Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Change-Id: If912f488d89f14e66e7bb18dbf3c929648117827
show more ...
|
#
c2b833e4 |
| 27-Oct-2020 |
Andrew Jeffery <andrew@aj.id.au> |
core: Fix large packet buffer overrun
The astlpc binding allows negotiation of Tx/Rx region sizes, but the packet accumulator assumed packet sizes were at most 4096 bytes. Avoid buffer overflow by
core: Fix large packet buffer overrun
The astlpc binding allows negotiation of Tx/Rx region sizes, but the packet accumulator assumed packet sizes were at most 4096 bytes. Avoid buffer overflow by allocating at least the length of the inbound packet if we have not yet initialised the packet buffer.
Fixes:
================================================================= ==42296==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x621000002500 at pc 0x7ff8a22235ce bp 0x7ffd47469750 sp 0x7ffd47468ef8 WRITE of size 8192 at 0x621000002500 thread T0 #0 0x7ff8a22235cd in __interceptor_memcpy (/usr/lib/x86_64-linux-gnu/libasan.so.6+0x3a5cd) #1 0x7ff8a21ac78b in memcpy /usr/include/x86_64-linux-gnu/bits/string_fortified.h:34 #2 0x7ff8a21ac78b in mctp_msg_ctx_add_pkt /home/andrew/src/openbmc/libmctp/core.c:237 #3 0x7ff8a21af245 in mctp_bus_rx /home/andrew/src/openbmc/libmctp/core.c:495 #4 0x56458d3f9648 in mctp_astlpc_rx_start astlpc.c:813 #5 0x56458d3f9648 in mctp_astlpc_poll astlpc.c:931 #6 0x56458d3fc1f4 in astlpc_test_send_large_packet tests/test_astlpc.c:1111 #7 0x56458d3efc86 in main tests/test_astlpc.c:1185 #8 0x7ff8a165dcb1 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x28cb1) #9 0x56458d3efe7d in _start (/home/andrew/src/openbmc/libmctp/tests/.libs/test_astlpc+0x17e7d)
0x621000002500 is located 0 bytes to the right of 4096-byte region [0x621000001500,0x621000002500) allocated by thread T0 here: #0 0x7ff8a22998d0 in __interceptor_realloc (/usr/lib/x86_64-linux-gnu/libasan.so.6+0xb08d0) #1 0x7ff8a21b0533 in __mctp_realloc /home/andrew/src/openbmc/libmctp/alloc.c:48
SUMMARY: AddressSanitizer: heap-buffer-overflow (/usr/lib/x86_64-linux-gnu/libasan.so.6+0x3a5cd) in __interceptor_memcpy Shadow bytes around the buggy address: 0x0c427fff8450: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c427fff8460: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c427fff8470: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c427fff8480: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c427fff8490: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 =>0x0c427fff84a0:[fa]fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c427fff84b0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c427fff84c0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c427fff84d0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c427fff84e0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c427fff84f0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa Shadow byte legend (one shadow byte represents 8 application bytes): Addressable: 00 Partially addressable: 01 02 03 04 05 06 07 Heap left redzone: fa Freed heap region: fd Stack left redzone: f1 Stack mid redzone: f2 Stack right redzone: f3 Stack after return: f5 Stack use after scope: f8 Global redzone: f9 Global init order: f6 Poisoned by user: f7 Container overflow: fc Array cookie: ac Intra object redzone: bb ASan internal: fe Left alloca redzone: ca Right alloca redzone: cb Shadow gap: cc ==42296==ABORTING
Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Change-Id: I9d39090cb9246ec2f6c06942d4f2a91fe0df0202
show more ...
|
#
85c04e47 |
| 27-Oct-2020 |
Andrew Jeffery <andrew@aj.id.au> |
tests: astlpc: Re-order astlpc ops struct definitions
Make it easier to isolate test cases with `#if 0` hackery.
Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Change-Id: Ibc3daef821768407b01f7599
tests: astlpc: Re-order astlpc ops struct definitions
Make it easier to isolate test cases with `#if 0` hackery.
Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Change-Id: Ibc3daef821768407b01f75996d3ab614bb6b6593
show more ...
|
Revision tags: v0.10 |
|
#
a9368980 |
| 08-Jun-2020 |
Andrew Jeffery <andrew@aj.id.au> |
astlpc: Make MTU configurable at binding instantiation
Make the MTU value provided to mctp_astlpc_init() stick. Previously we just printed a warning and forced the MTU to the baseline transmission u
astlpc: Make MTU configurable at binding instantiation
Make the MTU value provided to mctp_astlpc_init() stick. Previously we just printed a warning and forced the MTU to the baseline transmission unit. Now that MTU negotiation is in place, accept the provided value.
Change-Id: I0c026ba0a94a26a6d99755d3debf048b6e0b4aca Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
show more ...
|
#
3a540664 |
| 26-May-2020 |
Andrew Jeffery <andrew@aj.id.au> |
astlpc: Introduce MTU negotiation
MTU negotiation is implemented in a backwards-compatible manner with version 1 of the astlpc binding. Functionally, MTU negotation involves proposing arrangements o
astlpc: Introduce MTU negotiation
MTU negotiation is implemented in a backwards-compatible manner with version 1 of the astlpc binding. Functionally, MTU negotation involves proposing arrangements of the Rx and Tx buffer layouts. It is assumed that the MTU is a packet sized to fill the Tx buffer as described in the control space.
For v1 of the binding the MTU is defined in terms of the MCTP_BTU constant provided by libmctp.h. MCTP_BTU is used regardless of the buffer sizes specified in the control space (which MUST describe buffers supporting at least MCTP_BTU-sized packets).
For v2 of the binding the MTU is defined in terms of the appropriate buffer's size field in the control space.
The sequence of events for negotiating the MTU under v2 is as follows:
1. The BMC initialises its binding, filling out the Rx and Tx buffer properties with the largest configuration it supports.
2. The host initialises its binding, writing its maximum Rx buffer size before sending `channel-init` to the BMC.
3. The BMC receives `channel-init`, negotiates protocol version 2 and then validates the host's proposed buffer configuration. If the proposed configuration is invalid (e.g. out-of-bounds values) the BMC terminates channel initialisation leaving the channel-active bit clear and writing the zero to the negotiated version field. If the proposal is valid, the BMC calculates the buffer sizes according to the available constraints and writes the chosen buffer configuration to the control region.
4. Assuming the version negotiation and buffer configuration are successful, the BMC sets `channel-active` and notifies the host
5. The host reads `channel-active`, accepts the negotiation of v2 and validates the buffer configuration. If the validation passes, then the buffer configuration is the configuration used for the remainder of the session. If validation fails then the host MUST NOT send MCTP packets via the LPC binding until a valid buffer configuration can be negotiated.
Change-Id: I89107593f220418d746c2d73771348ed8f7f3e87 Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
show more ...
|
#
4e8264b7 |
| 23-May-2020 |
Andrew Jeffery <andrew@aj.id.au> |
astlpc: Implement version negotiation
Binding version negotiation was previously left as a todo. With the upcoming efforts to introduce MTU negotiation we need to repurpose some of the fields in the
astlpc: Implement version negotiation
Binding version negotiation was previously left as a todo. With the upcoming efforts to introduce MTU negotiation we need to repurpose some of the fields in the control structure (in a backwards-compatible way), so make sure we can first negotiate the protocol version before proceeding to change the semantics of the fields.
Change-Id: Ibd2283987b8b60b3ab7ada667e2b507b4ac09034 Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
show more ...
|
#
67655e83 |
| 27-May-2020 |
Andrew Jeffery <andrew@aj.id.au> |
test_astlpc: Add astlpc_test_undefined_command()
Any undefined commands recieved should be discarded without affecting channel state.
Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Change-Id: I631
test_astlpc: Add astlpc_test_undefined_command()
Any undefined commands recieved should be discarded without affecting channel state.
Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Change-Id: I63122307a18d02683084951abe6127944de756e0
show more ...
|
#
f3d94dcf |
| 27-May-2020 |
Andrew Jeffery <andrew@aj.id.au> |
test_astlpc: Add astlpc_test_poll_not_ready()
Ensure we don't fail or block the poll operation if there's no data.
Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Change-Id: Iadb63155bf94bf837b215c
test_astlpc: Add astlpc_test_poll_not_ready()
Ensure we don't fail or block the poll operation if there's no data.
Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Change-Id: Iadb63155bf94bf837b215c957fa75a866dcff9f0
show more ...
|
#
3f32507e |
| 27-May-2020 |
Andrew Jeffery <andrew@aj.id.au> |
astlpc: Remove redundant KCS register name enumeration
Seems we grew two separate enums for the registers at some point.
Change-Id: I87eca646a93ca65c783ea6276cbc33b577dcd721 Signed-off-by: Andrew J
astlpc: Remove redundant KCS register name enumeration
Seems we grew two separate enums for the registers at some point.
Change-Id: I87eca646a93ca65c783ea6276cbc33b577dcd721 Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
show more ...
|
#
d0f5da0d |
| 27-May-2020 |
Andrew Jeffery <andrew@aj.id.au> |
astlpc: Handle loss of bmc-ready state
Up until now the host implementation assumed the BMC was always present. This may not be the case, so implement the facility to manage the Tx queue state acros
astlpc: Handle loss of bmc-ready state
Up until now the host implementation assumed the BMC was always present. This may not be the case, so implement the facility to manage the Tx queue state across BMC reboots.
Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Change-Id: I6e4c5270bc2e2bca10fed102e93cec13f763667e
show more ...
|
#
55fb90be |
| 11-May-2020 |
Andrew Jeffery <andrew@aj.id.au> |
astlpc: Consolidate direct vs indirect LPC access
Use helpers to wrap up LPC accessors so we're not littering the code with conditional checks for direct or indirect access. As a result, drop the pr
astlpc: Consolidate direct vs indirect LPC access
Use helpers to wrap up LPC accessors so we're not littering the code with conditional checks for direct or indirect access. As a result, drop the priv_hdr pointer from struct mctp_binding_astlpc as we're utilising the buffers provided by the caller, which in turn removes a heap allocation.
Change-Id: Iab9ca4295879a3f3a0209fb23163c0383476c223 Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
show more ...
|
#
f1cdb165 |
| 23-May-2020 |
Andrew Jeffery <andrew@aj.id.au> |
test_astlpc: Add test initialising the device before the bus owner
This is an invalid initialisation sequence, so ensure the device start-up routine bails out if it detects that data in the control
test_astlpc: Add test initialising the device before the bus owner
This is an invalid initialisation sequence, so ensure the device start-up routine bails out if it detects that data in the control area is invalid.
Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Change-Id: I9575bf6d34439212fe27cd56271c16f38d7b2faa
show more ...
|
#
ec9a0065 |
| 22-May-2020 |
Andrew Jeffery <andrew@aj.id.au> |
test_astlpc: Add test for a simple message from host to BMC
Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Change-Id: Ia763f4704fe0d406ca873b6a58cfd85d2408f5ee
|
#
91f09edb |
| 22-May-2020 |
Andrew Jeffery <andrew@aj.id.au> |
test_astlpc: Improve readability of test output
Add descriptions of which test is running and break up the output between tests.
Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Change-Id: Ibdc43d7e
test_astlpc: Improve readability of test output
Add descriptions of which test is running and break up the output between tests.
Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Change-Id: Ibdc43d7e4162a4cf58659adc428ee093f73ce3e1
show more ...
|
#
8f3eb72a |
| 22-May-2020 |
Andrew Jeffery <andrew@aj.id.au> |
test_astlpc: Test simple message from BMC to host
Remove the corresponding assertions from the packetized message test.
Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Change-Id: Ifd0d857e4e955e57b
test_astlpc: Test simple message from BMC to host
Remove the corresponding assertions from the packetized message test.
Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Change-Id: Ifd0d857e4e955e57b0fb4a4cd2dc0a655b3c9508
show more ...
|