On Mon, 19 Feb 2024 16:33:21 -0600 David Lechner <dlechner@xxxxxxxxxxxx> wrote: > In the AXI SPI Engine driver, compiling the message is an expensive > operation. Previously, it was done per message transfer in the > prepare_message hook. This patch moves the message compile to the > optimize_message hook so that it is only done once per message in > cases where the peripheral driver calls spi_optimize_message(). > > This can be a significant performance improvement for some peripherals. > For example, the ad7380 driver saw a 13% improvement in throughput > when using the AXI SPI Engine driver with this patch. > > Since we now need two message states, one for the optimization stage > that doesn't change for the lifetime of the message and one that is > reset on each transfer for managing the current transfer state, the old > msg->state is split into msg->opt_state and spi_engine->msg_state. The > latter is included in the driver struct now since there is only one > current message at a time that can ever use it and it is in a hot path > so avoiding allocating a new one on each message transfer saves a few > cpu cycles and lets us get rid of the prepare_message callback. > > Signed-off-by: David Lechner <dlechner@xxxxxxxxxxxx> Whilst I'm not familiar with this driver, from a quick look at this patch and the driver code, looks fine to me. So FWIW Reviewed-by: Jonathan Cameron <Jonathan.Cameron@xxxxxxxxxx>