All of lore.kernel.org
 help / color / mirror / Atom feed
From: Timur Maksimov <gessingate@gmail.com>
To: "Markus Armbruster" <armbru@redhat.com>,
	"Cédric Le Goater" <clg@kaod.org>
Cc: qemu-devel@nongnu.org, Paolo Bonzini <pbonzini@redhat.com>,
	Peter Maydell	 <peter.maydell@linaro.org>,
	Jamin Lin <jamin_lin@aspeedtech.com>,
	Kane Chen	 <kane_chen@aspeedtech.com>,
	qemu-arm@nongnu.org, Fabiano Rosas <farosas@suse.de>,
	 Laurent Vivier <lvivier@redhat.com>,
	Corey Minyard <cminyard@mvista.com>
Subject: Re: [PATCH v2 1/6] hw/i2c: add dummy device
Date: Wed, 28 Oct 2026 19:20:48 +0300	[thread overview]
Message-ID: <5d219f231fb1f97c6d90cbef4068e82dff803a18.camel@gmail.com> (raw)
In-Reply-To: <874ie6ku2u.fsf@pond.sub.org>

Hi, thanks for the review. 

It was my decision to use such API, I thought it would be okay for a
test device. I don't think there is a way to expose integer array as a
single QOM property.

Actually, we can go without this model. I suppose I will rewrite tests
so they don't use it.

On Wed, 2026-10-28 at 11:17 +0100, Markus Armbruster wrote:
> Cédric Le Goater <clg@kaod.org> writes:
> 
> > + Corey for I2C feed back.
> > 
> > + Markus for QOM
> > 
> > The brute-force solution to expose the contents of the device array
> > with 128 properties has a slight AI smell. I find it ugly but I am
> > human :)
> 
> Timur, have you read docs/devel/code-provenance.rst section "Use of
> AI-generated content"?
> 
> >          That said I don't know if there are better alternatives.
> > My approach would have been to use a string property :
> > 
> >       object_property_add_str(obj, "tx",
> >                               i2c_dummy_device_get_tx, NULL);
> >       object_property_add_str(obj, "rx",
> >                               i2c_dummy_device_get_rx,
> >                               i2c_dummy_device_set_rx);
> >  Any better ideas ?
> 
> I believe you're talking about this function:
> 
> [...]
> 
> > > +static void i2c_dummy_device_init(Object *obj)
> > > +{
> > > +    I2CDummyDeviceState *s = I2C_DUMMY_DEVICE(obj);
> > > 
> > > +    for (int i = 0; i < I2C_DUMMY_ARRAY_SIZE; i++) {
> > > +        g_autofree char *name = g_strdup_printf("tx[%d]", i);
> > > +
> > > +        object_property_add_uint8_ptr(
> > > +            obj, name, &s->tx[i],
> > > +            OBJ_PROP_FLAG_READWRITE);
> > > +    }
> > > +
> > > +    for (int i = 0; i < I2C_DUMMY_ARRAY_SIZE; i++) {
> > > +        g_autofree char *name = g_strdup_printf("rx[%d]", i);
> > > +
> > > +        object_property_add_uint8_ptr(
> > > +            obj, name, &s->rx[i],
> > > +            OBJ_PROP_FLAG_READWRITE);
> > > +    }
> > > +
> > > +    object_property_add_uint8_ptr(
> > > +            obj, "tx-pos", &s->tx_pos,
> > > +            OBJ_PROP_FLAG_READWRITE);
> > > +    object_property_add_uint8_ptr(
> > > +            obj, "rx-pos", &s->rx_pos,
> > > +            OBJ_PROP_FLAG_READWRITE);
> > 
> > alignment could be improved.
> 
> Yes, this style is unusual in QEMU, and should therefore be avoided.
> 
> > > +}
> 
> The function adds properties "tx-pos", "tx[0]", ... "tx[63]", and
> same
> for rx.
> 
> The commit message tells us this is a "Simple I2C device with QOM
> properties to access transmit and receive buffers [...] for testing
> or
> prototyping."  It doesn't tell us how it could be used, and I can't
> see
> any documentation, either.  So let's start right there: please show
> us
> how this device could be used.  This should help me understand what
> the
> properties are for.  Only then can I advise on proper QOM usage.
> 
> [...]


  parent reply	other threads:[~2026-10-28 16:21 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-27 19:50 [PATCH v2 0/6] hw/i2c/aspeed: fix non-packet buffer and DMA transfer modes Timur Maksimov
2026-10-27 19:50 ` [PATCH v2 1/6] hw/i2c: add dummy device Timur Maksimov
2026-10-28  8:54   ` Cédric Le Goater
2026-10-28 10:17     ` Markus Armbruster
2026-10-28 11:04       ` Cédric Le Goater
2026-10-28 11:26         ` Markus Armbruster
2026-10-28 16:20       ` Timur Maksimov [this message]
2026-10-29  7:22         ` Markus Armbruster
2026-10-29  8:20           ` Timur Maksimov
2026-10-29  8:37             ` Cédric Le Goater
2026-10-29 12:45               ` Corey Minyard
2026-10-29 13:04                 ` Cédric Le Goater
2026-10-29 15:56                   ` Corey Minyard
2026-10-27 19:50 ` [PATCH v2 2/6] hw/i2c/aspeed: fix BUSY status reading in new register mode Timur Maksimov
2026-10-28  8:17   ` Cédric Le Goater
2026-10-28 21:24   ` Cédric Le Goater
2026-10-29  5:21   ` Jamin Lin
2026-10-27 19:50 ` [PATCH v2 3/6] hw/i2c/aspeed: fix I2CD_CMD register reading Timur Maksimov
2026-10-29  5:23   ` Jamin Lin
2026-10-27 19:50 ` [PATCH v2 4/6] hw/i2c/aspeed: fix buffer transfer in non-packet mode Timur Maksimov
2026-10-29  6:33   ` Jamin Lin
2026-10-29  7:23     ` Timur Maksimov
2026-10-29  7:44       ` Jamin Lin
2026-10-29  8:45         ` Timur Maksimov
2026-10-27 19:50 ` [PATCH v2 5/6] hw/i2c/aspeed: fix DMA " Timur Maksimov
2026-10-28 21:32   ` Cédric Le Goater
2026-10-29  6:23     ` Jamin Lin
2026-10-27 19:50 ` [PATCH v2 6/6] tests/qtest: Add cases for 32-bit Aspeed I2C controllers Timur Maksimov
2026-10-28  8:56   ` Cédric Le Goater
2026-10-28 14:47     ` Timur Maksimov
2026-10-29  7:25       ` Jamin Lin
2026-10-29  8:25         ` Timur Maksimov
2026-10-28 11:07 ` [PATCH v2 0/6] hw/i2c/aspeed: fix non-packet buffer and DMA transfer modes Cédric Le Goater

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5d219f231fb1f97c6d90cbef4068e82dff803a18.camel@gmail.com \
    --to=gessingate@gmail.com \
    --cc=armbru@redhat.com \
    --cc=clg@kaod.org \
    --cc=cminyard@mvista.com \
    --cc=farosas@suse.de \
    --cc=jamin_lin@aspeedtech.com \
    --cc=kane_chen@aspeedtech.com \
    --cc=lvivier@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.