On Mon, May 11, 2026 at 12:18:41PM +0200, Philippe Mathieu-Daudé wrote:
> On 7/5/26 14:05, Nicholas Piggin wrote:
> > Alistair suggested moving to Fifo8, which I think is
> > a good improvement.
> > 
> > Broken out for individual review, but IMO we should
> > squash before merge since it changes VMState format.
> > 
> > Signed-off-by: Nicholas Piggin <[email protected]>
> > ---
> >   hw/i2c/designware_i2c.c         | 37 ++++++++++++++++++++-------------
> >   include/hw/i2c/designware_i2c.h |  7 +++----
> >   2 files changed, 25 insertions(+), 19 deletions(-)
> 
> 
> > @@ -53,8 +54,6 @@ typedef enum DesignWareI2CStatus {
> >    * @ic_comp_version: I2C component version register
> >    * @ic_comp_type: I2C component type register
> >    * @rx_fifo: The FIFO buffer for receiving in FIFO mode.
> > - * @rx_cur: The current position of rx_fifo.
> > - * @status: The current status of the SMBus.
> >    */
> >   typedef struct DesignWareI2CState {
> >       SysBusDevice parent_obj;
> > @@ -88,8 +87,8 @@ typedef struct DesignWareI2CState {
> >       uint32_t ic_comp_version;
> >       uint32_t ic_comp_type;
> > -    uint8_t      rx_fifo[DESIGNWARE_I2C_RX_FIFO_SIZE];
> > -    uint8_t      rx_cur;
> > +    /* fifo8_num_used(rx_fifo) should always equal ic_rxflr */
> 
> Why not remove ic_rxflr then?

I did consider that... but the next patch to rework the registers
adds storage for them all as a block. We could still just ignore
the storage and use fifo8_num_used() instead but I was vaguely
worried about complexity of vmstate compat if we change things, but
not sure if that is a rational concern. In the end the code is
quite simple and only a couple of places where this is adjusted so
I kept it this way.

Thanks,
Nick

Reply via email to