From: Kuan-Wei Chiu <visitorckw@gmail.com>
To: Daniel Palmer <daniel@thingy.jp>
Cc: angelo@kernel-space.org, bmeng.cn@gmail.com, sjg@chromium.org,
u-boot@lists.denx.de
Subject: Re: [PATCH v4 0/6] Add virtio-mmio support to m68k virt machine
Date: Thu, 16 Apr 2026 15:19:42 +0800 [thread overview]
Message-ID: <aeCNjtGCY-mlBWwY@google.com> (raw)
In-Reply-To: <20260413092240.3719260-1-daniel@thingy.jp>
Hi Daniel,
On Mon, Apr 13, 2026 at 06:22:34PM +0900, Daniel Palmer wrote:
> Lets start making the m68k virt machine support useful.
>
> First we need to fix some m68k endian issues.
>
> Then allow virtio mmio driver instances to be created with
> platform data and fix a minor endian issue.
>
> Finally, add the code for the board to create the instances.
>
While testing and playing around with it on the qemu m68k virt machine,
I noticed that the date and sleep commands are broken after applying
these changes.
We will need the following two fixes to address this issue by using
__raw_readl and __raw_writel in goldfish_rtc/timer driver.
Could you please include them in your patchset, placing them before the
io macro changes?
From ffe017353f91e2a068f3a900e815cc11f388163c Mon Sep 17 00:00:00 2001
From: Kuan-Wei Chiu <visitorckw@gmail.com>
Date: Thu, 16 Apr 2026 06:45:09 +0000
Subject: [PATCH 1/2] rtc: goldfish: Use __raw_readl() and __raw_writel()
In QEMU, the Goldfish RTC is explicitly instantiated as a big-endian
device on the m68k virt machine (via the 'big-endian=true' property).
Currently, this driver uses ioread32() and iowrite32(), which works
by luck because the underlying readl() and writel() are currently
broken on m68k.
Use __raw_readl() and __raw_writel() instead to avoid breaking this
driver when the endianness of readl() and writel() is fixed.
Signed-off-by: Kuan-Wei Chiu <visitorckw@gmail.com>
---
drivers/rtc/goldfish_rtc.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/rtc/goldfish_rtc.c b/drivers/rtc/goldfish_rtc.c
index d2991ca6719..4892a63f8d8 100644
--- a/drivers/rtc/goldfish_rtc.c
+++ b/drivers/rtc/goldfish_rtc.c
@@ -40,8 +40,8 @@ static int goldfish_rtc_get(struct udevice *dev, struct rtc_time *time)
u64 time_low;
u64 now;
- time_low = ioread32(base + GOLDFISH_TIME_LOW);
- time_high = ioread32(base + GOLDFISH_TIME_HIGH);
+ time_low = __raw_readl(base + GOLDFISH_TIME_LOW);
+ time_high = __raw_readl(base + GOLDFISH_TIME_HIGH);
now = (time_high << 32) | time_low;
do_div(now, 1000000000U);
@@ -62,8 +62,8 @@ static int goldfish_rtc_set(struct udevice *dev, const struct rtc_time *time)
return -EINVAL;
now = rtc_mktime(time) * 1000000000ULL;
- iowrite32(now >> 32, base + GOLDFISH_TIME_HIGH);
- iowrite32(now, base + GOLDFISH_TIME_LOW);
+ __raw_writel(now >> 32, base + GOLDFISH_TIME_HIGH);
+ __raw_writel(now, base + GOLDFISH_TIME_LOW);
if (time->tm_isdst > 0)
priv->isdst = 1;
--
2.54.0.rc1.513.gad8abe7a5a-goog
From 42f0b7a003be36c633cfcf37a90ebdb28e1b377e Mon Sep 17 00:00:00 2001
From: Kuan-Wei Chiu <visitorckw@gmail.com>
Date: Thu, 16 Apr 2026 06:45:42 +0000
Subject: [PATCH 2/2] timer: goldfish: Use __raw_readl()
The Goldfish timer registers are native endian, so they act as
big-endian on the m68k virt machine. Currently, this driver uses
readl(), which works by luck because it's currently broken on m68k.
Use __raw_readl() instead to avoid breaking this driver when the
endianness of readl() is fixed.
Signed-off-by: Kuan-Wei Chiu <visitorckw@gmail.com>
---
drivers/timer/goldfish_timer.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/timer/goldfish_timer.c b/drivers/timer/goldfish_timer.c
index 70673bbd93c..91277d7932a 100644
--- a/drivers/timer/goldfish_timer.c
+++ b/drivers/timer/goldfish_timer.c
@@ -31,8 +31,8 @@ static u64 goldfish_timer_get_count(struct udevice *dev)
* We must read LOW before HIGH to latch the high 32-bit value
* and ensure a consistent 64-bit timestamp.
*/
- low = readl(priv->base + TIMER_TIME_LOW);
- high = readl(priv->base + TIMER_TIME_HIGH);
+ low = __raw_readl(priv->base + TIMER_TIME_LOW);
+ high = __raw_readl(priv->base + TIMER_TIME_HIGH);
time = ((u64)high << 32) | low;
--
2.54.0.rc1.513.gad8abe7a5a-goog
next prev parent reply other threads:[~2026-04-16 7:19 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-13 9:22 [PATCH v4 0/6] Add virtio-mmio support to m68k virt machine Daniel Palmer
2026-04-13 9:22 ` [PATCH v4 1/6] sysreset: qemu virt: Use __raw_writel() Daniel Palmer
2026-04-13 9:22 ` [PATCH v4 2/6] m68k: Fix writew(), writel(), readw(), readl() endianness for classic m68k Daniel Palmer
2026-04-16 9:06 ` Angelo Dureghello
2026-04-16 9:14 ` Daniel Palmer
2026-04-16 9:25 ` Kuan-Wei Chiu
2026-04-13 9:22 ` [PATCH v4 3/6] virtio: mmio: Allow instantiation via platform data Daniel Palmer
2026-04-16 9:09 ` Angelo Dureghello
2026-04-16 9:26 ` Kuan-Wei Chiu
2026-04-13 9:22 ` [PATCH v4 4/6] virtio: cmd: Depend on VIRTIO_BLK Daniel Palmer
2026-04-13 15:03 ` Simon Glass
2026-04-14 19:23 ` Tom Rini
2026-04-16 9:09 ` Angelo Dureghello
2026-04-16 9:27 ` Kuan-Wei Chiu
2026-04-13 9:22 ` [PATCH v4 5/6] virtio: blk: Fix converting the vendor id to a string Daniel Palmer
2026-04-16 9:28 ` Kuan-Wei Chiu
2026-04-13 9:22 ` [PATCH v4 6/6] board: qemu: m68k: Create virtio mmio instances Daniel Palmer
2026-04-13 15:04 ` Simon Glass
2026-04-16 9:17 ` Angelo Dureghello
2026-04-16 9:29 ` Kuan-Wei Chiu
2026-04-16 7:19 ` Kuan-Wei Chiu [this message]
2026-04-16 9:15 ` [PATCH v4 0/6] Add virtio-mmio support to m68k virt machine Daniel Palmer
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=aeCNjtGCY-mlBWwY@google.com \
--to=visitorckw@gmail.com \
--cc=angelo@kernel-space.org \
--cc=bmeng.cn@gmail.com \
--cc=daniel@thingy.jp \
--cc=sjg@chromium.org \
--cc=u-boot@lists.denx.de \
/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