All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Cédric Le Goater" <clg@kaod.org>
To: Troy Lee <leetroy@gmail.com>
Cc: Peter Maydell <peter.maydell@linaro.org>,
	Andrew Jeffery <andrew@aj.id.au>,
	Troy Lee <troy_lee@aspeedtech.com>,
	qemu-devel@nongnu.org, hailin.wu@aspeedtech.com,
	"open list:ASPEED BMCs" <qemu-arm@nongnu.org>,
	Joel Stanley <joel@jms.id.au>
Subject: Re: [PATCH v2 1/2] hw/misc: Implementating dummy AST2600 I3C model
Date: Tue, 11 Jan 2022 09:25:38 +0100	[thread overview]
Message-ID: <cbeab84b-2d50-3713-63d9-6d8f2af5c85f@kaod.org> (raw)
In-Reply-To: <CAN9Jwz0qFQKe5HuTMwo-u=1vSh47gXJm9DU2wdOjgH8ZcbAsAw@mail.gmail.com>

Hello Troy,


>>> +
>>> +    memory_region_init_io(&s->iomem, OBJECT(s), &aspeed_i3c_ops, s,
>>> +            TYPE_ASPEED_I3C, ASPEED_I3C_NR_REGS << 2);
>>> +
>>> +    sysbus_init_mmio(sbd, &s->iomem);
>>
>> I would add a container region containing all the regions :
>>
>>
>>       memory_region_init(&s->iomem_container, OBJECT(s),
>>                          TYPE_ASPEED_I3C ".container", 0x8000);
>>
>>       sysbus_init_mmio(sbd, &s->iomem_container);
>>
>>       memory_region_init_io(&s->iomem, OBJECT(s), &aspeed_i3c_ops, s,
>>               TYPE_ASPEED_I3C ".regs", 0x70);
>>
>>       memory_region_add_subregion(&s->iomem_container, 0x0, &s->iomem);
>>
>>
>>
>> The goal is to have a stricter layout so that you can catch errors :
>>
>>       000000001e7a0000-000000001e7a7fff (prio 0, i/o): aspeed.i3c.container
>>         000000001e7a0000-000000001e7a006f (prio 0, i/o): aspeed.i3c.regs
>>         000000001e7a2000-000000001e7a22ff (prio 0, i/o): aspeed.i3c.device.0
>>         000000001e7a3000-000000001e7a32ff (prio 0, i/o): aspeed.i3c.device.1
>>         000000001e7a4000-000000001e7a42ff (prio 0, i/o): aspeed.i3c.device.2
>>         000000001e7a5000-000000001e7a52ff (prio 0, i/o): aspeed.i3c.device.3
>>         000000001e7a6000-000000001e7a62ff (prio 0, i/o): aspeed.i3c.device.4
>>         000000001e7a7000-000000001e7a72ff (prio 0, i/o): aspeed.i3c.device.5
>>
>> and if under U-Boot, you peek into unimplemented regs, you get a warning :
>>
>>       ast# md 1e7a0000
>>       1e7a0000: 00000000 00000000 00000000 00000000    ................
>>       1e7a0010: 00000000 00000000 00000000 00000000    ................
>>       1e7a0020: 00000000 00000000 00000000 00000000    ................
>>       1e7a0030: 00000000 00000000 00000000 00000000    ................
>>       1e7a0040: 00000000 00000000 00000000 00000000    ................
>>       1e7a0050: 00000000 00000000 00000000 00000000    ................
>>       1e7a0060: 00000000 00000000 00000000 00000000    ................
>>       1e7a0070:aspeed_soc.io: unimplemented device read  (size 4, offset 0x1a0070)
>>        00000000aspeed_soc.io: unimplemented device read  (size 4, offset 0x1a0074)
> 
> Thanks for the code snippet, learnt and applied.
> Yes, it would be easier to catch driver problems.

That said, not all Aspeed models follow this pattern. We learned along
the way and we could improve some older implementations.

btw, I tried your series with ast2600-default-obmc.tar.gz. It boots fine.

Thanks,

C.


  reply	other threads:[~2022-01-11  8:28 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-10  7:21 [PATCH v2 0/2] Aspeed I3C device model Troy Lee
2022-01-10  7:21 ` [PATCH v2 1/2] hw/misc: Implementating dummy AST2600 I3C model Troy Lee
2022-01-10 14:25   ` Cédric Le Goater
2022-01-11  7:48     ` Troy Lee
2022-01-11  8:25       ` Cédric Le Goater [this message]
2022-01-10  7:21 ` [PATCH v2 2/2] hw/arm/aspeed_ast2600: create i3c instance Troy Lee
2022-01-10 14:31   ` Cédric Le Goater
2022-01-11  7:55     ` Troy Lee

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=cbeab84b-2d50-3713-63d9-6d8f2af5c85f@kaod.org \
    --to=clg@kaod.org \
    --cc=andrew@aj.id.au \
    --cc=hailin.wu@aspeedtech.com \
    --cc=joel@jms.id.au \
    --cc=leetroy@gmail.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=troy_lee@aspeedtech.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 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.