qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Jeremy Kerr <jk@codeconstruct.com.au>
To: Joe Komlodi <komlodi@google.com>, qemu-devel@nongnu.org
Cc: venture@google.com, peter.maydell@linaro.org
Subject: Re: [PATCH 09/16] hw/i3c/aspeed_i3c: Add data TX and RX
Date: Mon, 03 Apr 2023 16:45:29 +0800	[thread overview]
Message-ID: <6e379932f6b74371a464a51727b808ab9115ba9a.camel@codeconstruct.com.au> (raw)
In-Reply-To: <20230331010131.1412571-10-komlodi@google.com>

Hi Joe,

> +static uint8_t aspeed_i3c_device_target_addr(AspeedI3CDevice *s,
> +                                             uint16_t offset)
> +{
> +    if (offset > ASPEED_I3C_NR_DEVICES) {
> +        qemu_log_mask(LOG_GUEST_ERROR, "%s: Device addr table offset %d out of "
> +                      "bounds\n", object_get_canonical_path(OBJECT(s)), offset);
> +        /* If we're out of bounds, return an address of 0. */
> +        return 0;
> +    }
> +
> +    uint16_t dev_index = R_DEVICE_ADDR_TABLE_LOC1 + offset;
> +    /* I2C devices use a static address. */
> +    if (aspeed_i3c_device_target_is_i2c(s, offset)) {
> +        return FIELD_EX32(s->regs[dev_index], DEVICE_ADDR_TABLE_LOC1,
> +                          DEV_STATIC_ADDR);
> +    }
> +    return FIELD_EX32(s->regs[dev_index], DEVICE_ADDR_TABLE_LOC1,
> +                      DEV_DYNAMIC_ADDR);
> +}

Depending on the usage of this function, you'll probably want to mask
out the parity bit (the msb) from the DEV_DYNAMIC_ADDR field.

Currently, you're returning this value directly from the ENTDAA handler,
which is ending up assigning addresses with the high bit set.

(doing a bit of a piecemeal review here, as I'm testing out the
model...)

Cheers,


Jeremy

  reply	other threads:[~2023-04-03  8:46 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-31  1:01 [PATCH 00/16] i3c: aspeed: Add I3C support Joe Komlodi
2023-03-31  1:01 ` [PATCH 01/16] hw/misc/aspeed_i3c: Move to i3c directory Joe Komlodi
2023-03-31  1:01 ` [PATCH 02/16] hw/i3c: Add bus support Joe Komlodi
2023-03-31  1:01 ` [PATCH 03/16] hw/i3c/aspeed_i3c: Add more register fields Joe Komlodi
2023-03-31  1:01 ` [PATCH 04/16] hw/i3c/aspeed_i3c: Add more reset values Joe Komlodi
2023-03-31  1:01 ` [PATCH 05/16] hw/i3c/aspeed_i3c: Add register RO field masks Joe Komlodi
2023-03-31  1:01 ` [PATCH 06/16] hw/i3c/aspeed_i3c: Treat more registers as read-as-zero Joe Komlodi
2023-03-31  1:01 ` [PATCH 07/16] hw/i3c/aspeed_i3c: Use 32 bits on MMIO writes Joe Komlodi
2023-03-31  1:01 ` [PATCH 08/16] hw/i3c/aspeed_i3c: Add IRQ MMIO behavior Joe Komlodi
2023-03-31  1:01 ` [PATCH 09/16] hw/i3c/aspeed_i3c: Add data TX and RX Joe Komlodi
2023-04-03  8:45   ` Jeremy Kerr [this message]
2023-03-31  1:01 ` [PATCH 10/16] hw/i3c/aspeed_i3c: Add IBI handling Joe Komlodi
2023-04-03  3:08   ` Jeremy Kerr
2023-04-11  9:16   ` Jeremy Kerr
2023-04-12 23:13     ` Joe Komlodi
2023-03-31  1:01 ` [PATCH 11/16] hw/i3c/aspeed_i3c: Add ctrl MMIO handling Joe Komlodi
2023-03-31  1:01 ` [PATCH 12/16] hw/i3c/aspeed_i3c: Add controller resets Joe Komlodi
2023-03-31  1:01 ` [PATCH 13/16] hw/i3c: Add Mock target Joe Komlodi
2023-03-31  1:01 ` [PATCH 14/16] hw/i3c: remote_i3c: Add model Joe Komlodi
2023-04-03  6:13   ` Jeremy Kerr
2023-04-05  2:04     ` Joe Komlodi
2023-04-05  2:44       ` Jeremy Kerr
2023-03-31  1:01 ` [PATCH 15/16] qtest: remote_i3c: Add remote I3C qtest Joe Komlodi
2023-03-31  1:01 ` [PATCH 16/16] hw/i3c: Add hotplug support Joe Komlodi
2023-04-01 17:28 ` [PATCH 00/16] i3c: aspeed: Add I3C support Ben Dooks
2023-04-02  7:33   ` Cédric Le Goater
2023-04-02  8:11     ` Jeremy Kerr
2023-04-05  1:55       ` Joe Komlodi
2023-04-05  2:06         ` Jeremy Kerr
2023-04-05  2:30           ` Joel Stanley

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=6e379932f6b74371a464a51727b808ab9115ba9a.camel@codeconstruct.com.au \
    --to=jk@codeconstruct.com.au \
    --cc=komlodi@google.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=venture@google.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).