All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Kambalin, Sergey" <sergey.kambalin@auriga.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: Sergey Kambalin <serg.oker@gmail.com>,
	"qemu-arm@nongnu.org" <qemu-arm@nongnu.org>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>
Subject: Re: [PATCH v4 00/45] Raspberry Pi 4B machine
Date: Tue, 19 Dec 2023 17:07:41 +0000	[thread overview]
Message-ID: <1af36710e4ca4aefaced4ceadbdc8b4c@auriga.com> (raw)
In-Reply-To: <CAFEAcA8QHVy2xYYMxxO3TzLeUWk5AGcq4y6mKvXun02UayBzpw@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2047 bytes --]

Thanks!

I know about the 'offset' parameter, but in this particular case I use these structures as layouts only and don't 'switch' over them. So I decided to set the offsets to 0 in order to simplify the code.


And extra thanks for highlighting the potential issue with memcpy() 😊. I'll fix it in [v5] as well as the comments to first 10 patches.


Have a nice holidays!



Sergey Kambalin
Software Developer,
Auriga Inc.


________________________________
От: Peter Maydell <peter.maydell@linaro.org>
Отправлено: 19 декабря 2023 г. 10:39:13
Кому: Kambalin, Sergey
Копия: Sergey Kambalin; qemu-arm@nongnu.org; qemu-devel@nongnu.org
Тема: Re: [PATCH v4 00/45] Raspberry Pi 4B machine

On Tue, 19 Dec 2023 at 16:18, Kambalin, Sergey
<sergey.kambalin@auriga.com> wrote:
>
> Thank you a lot for the review Peter!
>
>
> May I kindly ask you to take just a brief look at the first patches of GENET? I'd like to know if I've chosen the right way to replace bitfields with  QEMU REG32/FIELD32 macros.

The FIELD and REG32 uses look mostly OK, but the
second argument to REG32() should not be 0 each time:

REG32(GENET_SYS_REV_CTRL,              0)
REG32(GENET_INTRL_0,                0)

etc. The idea is that that second argument is the offset
in the register file of the register; then the macro
defines you an A_GENET_SYS_REV_CTRL which is that value,
and you can use it as a case label in the "switch (offset) {"
in the read/write function.

I'm a also a bit confused about the use of offsetof() in patch 27.

In patch 28 the implementation of bcm2838_genet_read() and
bcm2838_genet_write() use a memcpy() between a local variable
and memory which I'm assuming is an index into one of these
register structs, which won't do the right thing if the host
is big-endian. If you need a "load/store N bytes to memory in
host order", we have ldn_he_p() and stn_he_p(); also available
in _le_ and _be_ flavours for load/store in specific endianness.

thanks
-- PMM

[-- Attachment #2: Type: text/html, Size: 4442 bytes --]

  reply	other threads:[~2023-12-19 17:08 UTC|newest]

Thread overview: 83+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-08  2:31 [PATCH v4 00/45] Raspberry Pi 4B machine Sergey Kambalin
2023-12-08  2:31 ` [PATCH v4 01/45] Split out common part of BCM283X classes Sergey Kambalin
2023-12-18 15:58   ` Peter Maydell
2023-12-08  2:31 ` [PATCH v4 02/45] Split out common part of peripherals Sergey Kambalin
2023-12-18 15:58   ` Peter Maydell
2023-12-08  2:31 ` [PATCH v4 03/45] Split out raspi machine common part Sergey Kambalin
2023-12-18 15:59   ` Peter Maydell
2023-12-08  2:31 ` [PATCH v4 04/45] Introduce BCM2838 SoC Sergey Kambalin
2023-12-18 16:07   ` Peter Maydell
2023-12-08  2:31 ` [PATCH v4 05/45] Add GIC-400 to " Sergey Kambalin
2023-12-18 16:23   ` Peter Maydell
2023-12-08  2:31 ` [PATCH v4 06/45] Add BCM2838 GPIO stub Sergey Kambalin
2023-12-18 16:28   ` Peter Maydell
2023-12-08  2:31 ` [PATCH v4 07/45] Implement BCM2838 GPIO functionality Sergey Kambalin
2023-12-18 16:35   ` Peter Maydell
2023-12-08  2:31 ` [PATCH v4 08/45] Connect SD controller to BCM2838 GPIO Sergey Kambalin
2023-12-18 16:38   ` Peter Maydell
2023-12-08  2:31 ` [PATCH v4 09/45] Add GPIO and SD to BCM2838 periph Sergey Kambalin
2023-12-18 16:41   ` Peter Maydell
2023-12-08  2:31 ` [PATCH v4 10/45] Add BCM2838 checkpoint support Sergey Kambalin
2023-12-18 16:42   ` Peter Maydell
2023-12-08  2:31 ` [PATCH v4 11/45] Introduce Raspberry PI 4 machine Sergey Kambalin
2024-01-15 12:32   ` Peter Maydell
2023-12-08  2:31 ` [PATCH v4 12/45] Temporarily disable unimplemented rpi4b devices Sergey Kambalin
2024-01-15 12:37   ` Peter Maydell
2023-12-08  2:31 ` [PATCH v4 13/45] Add memory region for BCM2837 RPiVid ASB Sergey Kambalin
2024-01-15 13:12   ` Peter Maydell
2023-12-08  2:31 ` [PATCH v4 14/45] Add BCM2838 PCIE Root Complex Sergey Kambalin
2024-01-15 13:57   ` Peter Maydell
2023-12-08  2:31 ` [PATCH v4 15/45] Add BCM2838 PCIE host Sergey Kambalin
2024-01-15 14:08   ` Peter Maydell
2024-01-29  3:18   ` Sergei Kambalin
2023-12-08  2:31 ` [PATCH v4 16/45] Enable BCM2838 PCIE Sergey Kambalin
2024-01-15 14:10   ` Peter Maydell
2023-12-08  2:31 ` [PATCH v4 17/45] Add RNG200 skeleton Sergey Kambalin
2024-01-15 14:19   ` Peter Maydell
2023-12-08  2:31 ` [PATCH v4 18/45] Add RNG200 RNG and RBG Sergey Kambalin
2024-01-15 14:29   ` Peter Maydell
2023-12-08  2:31 ` [PATCH v4 19/45] Get rid of RNG200 timer Sergey Kambalin
2024-01-15 14:33   ` Peter Maydell
2023-12-08  2:31 ` [PATCH v4 20/45] Implement BCM2838 thermal sensor Sergey Kambalin
2024-01-15 14:42   ` Peter Maydell
2023-12-08  2:31 ` [PATCH v4 21/45] Add clock_isp stub Sergey Kambalin
2024-01-15 14:43   ` Peter Maydell
2023-12-08  2:31 ` [PATCH v4 22/45] Add GENET stub Sergey Kambalin
2023-12-08  2:31 ` [PATCH v4 23/45] Add GENET register structs. Part 1 Sergey Kambalin
2023-12-08  2:31 ` [PATCH v4 24/45] Add GENET register structs. Part 2 Sergey Kambalin
2023-12-08  2:31 ` [PATCH v4 25/45] Add GENET register structs. Part 3 Sergey Kambalin
2023-12-08  2:31 ` [PATCH v4 26/45] Add GENET register structs. Part 4 Sergey Kambalin
2023-12-08  2:31 ` [PATCH v4 27/45] Add GENET register access macros Sergey Kambalin
2023-12-08  2:31 ` [PATCH v4 28/45] Implement GENET register ops Sergey Kambalin
2023-12-08  2:31 ` [PATCH v4 29/45] Implement GENET MDIO Sergey Kambalin
2023-12-08  2:31 ` [PATCH v4 30/45] Implement GENET TX path Sergey Kambalin
2023-12-08  2:31 ` [PATCH v4 31/45] Implement GENET RX path Sergey Kambalin
2023-12-08  2:31 ` [PATCH v4 32/45] Enable BCM2838 GENET controller Sergey Kambalin
2024-01-15 15:13   ` Peter Maydell
2023-12-08  2:31 ` [PATCH v4 33/45] Connect RNG200, PCIE and GENET to GIC Sergey Kambalin
2024-01-15 14:48   ` Peter Maydell
2023-12-08  2:31 ` [PATCH v4 34/45] Add Rpi4b boot tests Sergey Kambalin
2023-12-08  2:31 ` [PATCH v4 35/45] Add mailbox test stub Sergey Kambalin
2024-01-15 14:52   ` Peter Maydell
2023-12-08  2:31 ` [PATCH v4 36/45] Add mailbox test constants Sergey Kambalin
2024-01-15 14:55   ` Peter Maydell
2023-12-08  2:31 ` [PATCH v4 37/45] Add mailbox tests tags. Part 1 Sergey Kambalin
2024-01-15 14:58   ` Peter Maydell
2023-12-08  2:31 ` [PATCH v4 38/45] Add mailbox tests tags. Part 2 Sergey Kambalin
2023-12-08  2:31 ` [PATCH v4 39/45] Add mailbox tests tags. Part 3 Sergey Kambalin
2023-12-08  2:31 ` [PATCH v4 40/45] Add mailbox property tests. Part 1 Sergey Kambalin
2024-01-15 15:01   ` Peter Maydell
2023-12-08  2:31 ` [PATCH v4 41/45] Add mailbox property tests. Part 2 Sergey Kambalin
2023-12-08  2:31 ` [PATCH v4 42/45] Add mailbox property tests. Part 3 Sergey Kambalin
2023-12-08  2:31 ` [PATCH v4 43/45] Add missed BCM2835 properties Sergey Kambalin
2024-01-15 15:07   ` Peter Maydell
2023-12-08  2:31 ` [PATCH v4 44/45] Append added properties to mailbox test Sergey Kambalin
2023-12-08  2:31 ` [PATCH v4 45/45] Add RPi4B to paspi4.rst Sergey Kambalin
2024-01-15 15:02   ` Peter Maydell
2023-12-09 10:47 ` [PATCH v4 00/45] Raspberry Pi 4B machine Philippe Mathieu-Daudé
2023-12-19 16:11 ` Peter Maydell
2023-12-19 16:18   ` Kambalin, Sergey
2023-12-19 16:39     ` Peter Maydell
2023-12-19 17:07       ` Kambalin, Sergey [this message]
2024-01-15 15:17   ` Peter Maydell
  -- strict thread matches above, loose matches on Subject: below --
2023-12-19 17:08 Kambalin, Sergey

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=1af36710e4ca4aefaced4ceadbdc8b4c@auriga.com \
    --to=sergey.kambalin@auriga.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=serg.oker@gmail.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.