All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Junhui Liu" <junhui.liu@pigmoral.tech>
To: "Norman Herms" <dockseed@proton.me>,
	"Junhui Liu" <junhui.liu@pigmoral.tech>
Cc: <wens@kernel.org>, "Stephen Boyd" <sboyd@kernel.org>,
	"Brian Masney" <bmasney+clk@redhat.com>,
	"Jerome Brunet" <jbrunet+clk@baylibre.com>,
	"Rob Herring" <robh@kernel.org>,
	"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
	"Conor Dooley" <conor+dt@kernel.org>,
	"Jernej Skrabec" <jernej.skrabec@gmail.com>,
	"Samuel Holland" <samuel@sholland.org>,
	"Philipp Zabel" <p.zabel@pengutronix.de>,
	"Paul Walmsley" <pjw@kernel.org>,
	"Palmer Dabbelt" <palmer@dabbelt.com>,
	"Albert Ou" <aou@eecs.berkeley.edu>,
	"Alexandre Ghiti" <alex@ghiti.fr>,
	"Richard Cochran" <richardcochran@gmail.com>,
	<linux-clk@vger.kernel.org>, <devicetree@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-sunxi@lists.linux.dev>, <linux-kernel@vger.kernel.org>,
	<linux-riscv@lists.infradead.org>, <netdev@vger.kernel.org>,
	"Jerome Brunet" <jbrunet@baylibre.com>,
	"Enzo Adriano" <enzo.adriano.code@gmail.com>,
	"Andre Przywara" <andre.przywara@arm.com>,
	"Krzysztof Kozlowski" <krzysztof.kozlowski@oss.qualcomm.com>,
	"Yixun Lan" <dlan@gentoo.org>
Subject: Re: [PATCH v5 0/8] clk: sunxi-ng: Add support for Allwinner A733 CCU and PRCM
Date: Sat, 03 Oct 2026 23:23:22 +0800	[thread overview]
Message-ID: <DLVB1PLRC8GV.2YX3NP2B1KV2A@pigmoral.tech> (raw)
In-Reply-To: <BZm0Br5_P98xkwslO2JLeCMSyqps8EfQzDnH1Ox34cpoxCpkznXDa4RUM40-b1WKuZ3w3Cy0LPBE31oL8T1nq1Z8iT9Z51wUJBRp3iQIn-Y=@proton.me>

Hi Norman,

Thanks for testing this. You saved my A7Z board from an almost certain
sacrifice. :)

On Sat Oct 3, 2026 at 11:05 PM CST, Norman Herms wrote:
> Hi Junhui,
>
>> Thanks for pointing this out. This is indeed something I had not
>> considered before. I will try enabling secure boot on my spare Cubie A7Z
>> board and test it on actual hardware.
>
> First a correction to my earlier reply in this thread. I answered
> ChenYu's "presumably ... the secure/non-secure access bit isn't in
> effect" with "yes" and quoted the UM note that these registers are
> always non-secure in non-security mode. On our non-fused A7S boards
> (SID + 0xA0 = 0, also when read from EL3) that does not hold for every
> register. Read from EL3 with a test BL31, CCMU_SEC_SWITCH_REG is 0x7
> after BL31's security setup, S_TWD_BGR_REG is 0x1 and the SPC status
> registers are 0xffffffff, but from non-secure all of them read 0, and
> non-secure writes to the first two do not stick. So secure filtering
> is active on these parts even without the fuse.

I will double-check this on my side and add the relevant comments as
Chen-Yu suggested.

>
>> For the PLL and AHB/APB bus clock controls, the user manual indicates
>> that the relevant security bits can be set by TF-A to allow the kernel
>> to access these registers. This also appears to be how this has
>> traditionally been handled on sunxi platforms. So I think we can do the
>> same in TF-A for the A733.
>
> That is what the BL31 on our boards does: PRCM_SEC_SWITCH_REG |= 0x7
> and 0x7 to CCMU_SEC_SWITCH_REG at CCU + 0x1F00, as the vendor BL31
> does. From EL3 both read 0 before and 0x7 after. The 0x1F00 versus
> 0x0F00 trap in the A733 TF-A port is in my first reply.
>
>> For bus_r_twd_clk, I will test whether the register is indeed always
>> secure. If it is, I think the clock can be removed from the kernel and
>> left enabled by its hardware reset value or by the boot firmware.
>
> On our non-fused boards it is already inaccessible from the non-secure
> side (reads 0, writes ignored). From EL3 it reads 0x1, the UM default,
> so the gate is open. Details are in my reply to ChenYu on patch 3/8,
> which crossed with yours.

Understood. This bus gate is therefore not meaningful to the kernel,
so I will remove the clock in the next version.

>
> Same boards and caveats as before: AI agents (Claude) on my boards, a
> report, not a Tested-by.
>
> Thanks,
> Norman

-- 
Best regards,
Junhui Liu


WARNING: multiple messages have this Message-ID (diff)
From: "Junhui Liu" <junhui.liu@pigmoral.tech>
To: "Norman Herms" <dockseed@proton.me>,
	"Junhui Liu" <junhui.liu@pigmoral.tech>
Cc: <wens@kernel.org>, "Stephen Boyd" <sboyd@kernel.org>,
	"Brian Masney" <bmasney+clk@redhat.com>,
	"Jerome Brunet" <jbrunet+clk@baylibre.com>,
	"Rob Herring" <robh@kernel.org>,
	"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
	"Conor Dooley" <conor+dt@kernel.org>,
	"Jernej Skrabec" <jernej.skrabec@gmail.com>,
	"Samuel Holland" <samuel@sholland.org>,
	"Philipp Zabel" <p.zabel@pengutronix.de>,
	"Paul Walmsley" <pjw@kernel.org>,
	"Palmer Dabbelt" <palmer@dabbelt.com>,
	"Albert Ou" <aou@eecs.berkeley.edu>,
	"Alexandre Ghiti" <alex@ghiti.fr>,
	"Richard Cochran" <richardcochran@gmail.com>,
	<linux-clk@vger.kernel.org>, <devicetree@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-sunxi@lists.linux.dev>, <linux-kernel@vger.kernel.org>,
	<linux-riscv@lists.infradead.org>, <netdev@vger.kernel.org>,
	"Jerome Brunet" <jbrunet@baylibre.com>,
	"Enzo Adriano" <enzo.adriano.code@gmail.com>,
	"Andre Przywara" <andre.przywara@arm.com>,
	"Krzysztof Kozlowski" <krzysztof.kozlowski@oss.qualcomm.com>,
	"Yixun Lan" <dlan@gentoo.org>
Subject: Re: [PATCH v5 0/8] clk: sunxi-ng: Add support for Allwinner A733 CCU and PRCM
Date: Sat, 03 Oct 2026 23:23:22 +0800	[thread overview]
Message-ID: <DLVB1PLRC8GV.2YX3NP2B1KV2A@pigmoral.tech> (raw)
In-Reply-To: <BZm0Br5_P98xkwslO2JLeCMSyqps8EfQzDnH1Ox34cpoxCpkznXDa4RUM40-b1WKuZ3w3Cy0LPBE31oL8T1nq1Z8iT9Z51wUJBRp3iQIn-Y=@proton.me>

Hi Norman,

Thanks for testing this. You saved my A7Z board from an almost certain
sacrifice. :)

On Sat Oct 3, 2026 at 11:05 PM CST, Norman Herms wrote:
> Hi Junhui,
>
>> Thanks for pointing this out. This is indeed something I had not
>> considered before. I will try enabling secure boot on my spare Cubie A7Z
>> board and test it on actual hardware.
>
> First a correction to my earlier reply in this thread. I answered
> ChenYu's "presumably ... the secure/non-secure access bit isn't in
> effect" with "yes" and quoted the UM note that these registers are
> always non-secure in non-security mode. On our non-fused A7S boards
> (SID + 0xA0 = 0, also when read from EL3) that does not hold for every
> register. Read from EL3 with a test BL31, CCMU_SEC_SWITCH_REG is 0x7
> after BL31's security setup, S_TWD_BGR_REG is 0x1 and the SPC status
> registers are 0xffffffff, but from non-secure all of them read 0, and
> non-secure writes to the first two do not stick. So secure filtering
> is active on these parts even without the fuse.

I will double-check this on my side and add the relevant comments as
Chen-Yu suggested.

>
>> For the PLL and AHB/APB bus clock controls, the user manual indicates
>> that the relevant security bits can be set by TF-A to allow the kernel
>> to access these registers. This also appears to be how this has
>> traditionally been handled on sunxi platforms. So I think we can do the
>> same in TF-A for the A733.
>
> That is what the BL31 on our boards does: PRCM_SEC_SWITCH_REG |= 0x7
> and 0x7 to CCMU_SEC_SWITCH_REG at CCU + 0x1F00, as the vendor BL31
> does. From EL3 both read 0 before and 0x7 after. The 0x1F00 versus
> 0x0F00 trap in the A733 TF-A port is in my first reply.
>
>> For bus_r_twd_clk, I will test whether the register is indeed always
>> secure. If it is, I think the clock can be removed from the kernel and
>> left enabled by its hardware reset value or by the boot firmware.
>
> On our non-fused boards it is already inaccessible from the non-secure
> side (reads 0, writes ignored). From EL3 it reads 0x1, the UM default,
> so the gate is open. Details are in my reply to ChenYu on patch 3/8,
> which crossed with yours.

Understood. This bus gate is therefore not meaningful to the kernel,
so I will remove the clock in the next version.

>
> Same boards and caveats as before: AI agents (Claude) on my boards, a
> report, not a Tested-by.
>
> Thanks,
> Norman

-- 
Best regards,
Junhui Liu


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

  reply	other threads:[~2026-10-03 15:24 UTC|newest]

Thread overview: 62+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-29 17:26 [PATCH v5 0/8] clk: sunxi-ng: Add support for Allwinner A733 CCU and PRCM Junhui Liu
2026-09-29 17:26 ` Junhui Liu
2026-09-29 17:26 ` [PATCH v5 1/8] dt-bindings: clk: sun60i-a733-ccu: Add Allwinner A733 support Junhui Liu
2026-09-29 17:26   ` Junhui Liu
2026-09-29 17:26 ` [PATCH v5 2/8] clk: sunxi-ng: sdm: Add dual patterns support Junhui Liu
2026-09-29 17:26   ` Junhui Liu
2026-09-29 17:26 ` [PATCH v5 3/8] clk: sunxi-ng: a733: Add PRCM CCU Junhui Liu
2026-09-29 17:26   ` Junhui Liu
2026-10-03 14:00   ` Chen-Yu Tsai
2026-10-03 14:00     ` Chen-Yu Tsai
2026-10-03 14:57     ` Junhui Liu
2026-10-03 14:57       ` Junhui Liu
2026-10-03 16:51       ` Norman Herms
2026-10-03 16:51         ` Norman Herms
2026-10-03 14:57     ` Norman Herms
2026-10-03 14:57       ` Norman Herms
2026-10-05 18:30   ` Vinicius Pedrosa
2026-10-05 18:30     ` Vinicius Pedrosa
2026-10-07  3:34     ` Junhui Liu
2026-10-07  3:34       ` Junhui Liu
2026-09-29 17:26 ` [PATCH v5 4/8] clk: sunxi-ng: a733: Add PLL clocks support Junhui Liu
2026-09-29 17:26   ` Junhui Liu
2026-10-04 10:08   ` Chen-Yu Tsai
2026-10-04 10:08     ` Chen-Yu Tsai
2026-09-29 17:26 ` [PATCH v5 5/8] clk: sunxi-ng: a733: Add bus " Junhui Liu
2026-09-29 17:26   ` Junhui Liu
2026-10-04 10:20   ` Chen-Yu Tsai
2026-10-04 10:20     ` Chen-Yu Tsai
2026-09-29 17:26 ` [PATCH v5 6/8] clk: sunxi-ng: a733: Add mod " Junhui Liu
2026-09-29 17:26   ` Junhui Liu
2026-09-29 17:26 ` [PATCH v5 7/8] clk: sunxi-ng: a733: Add bus clock gates Junhui Liu
2026-09-29 17:26   ` Junhui Liu
2026-10-04 11:03   ` Chen-Yu Tsai
2026-10-04 11:03     ` Chen-Yu Tsai
2026-10-04 11:14     ` AW: " Norman Herms
2026-10-04 11:14       ` Norman Herms
2026-10-05  4:41     ` Junhui Liu
2026-10-05  4:41       ` Junhui Liu
2026-10-05  9:17       ` Andre Przywara
2026-10-05  9:17         ` Andre Przywara
2026-10-06 14:50         ` Junhui Liu
2026-10-06 14:50           ` Junhui Liu
2026-10-06 15:29           ` Andre Przywara
2026-10-06 15:29             ` Andre Przywara
2026-10-06 15:59             ` Junhui Liu
2026-10-06 15:59               ` Junhui Liu
2026-09-29 17:26 ` [PATCH v5 8/8] clk: sunxi-ng: a733: Add reset lines Junhui Liu
2026-09-29 17:26   ` Junhui Liu
2026-10-04 11:04   ` Chen-Yu Tsai
2026-10-04 11:04     ` Chen-Yu Tsai
2026-10-03 12:52 ` [PATCH v5 0/8] clk: sunxi-ng: Add support for Allwinner A733 CCU and PRCM Junhui Liu
2026-10-03 12:52   ` Junhui Liu
2026-10-03 13:37 ` Chen-Yu Tsai
2026-10-03 13:37   ` Chen-Yu Tsai
2026-10-03 13:51   ` Norman Herms
2026-10-03 13:51     ` Norman Herms
2026-10-03 14:35   ` Junhui Liu
2026-10-03 14:35     ` Junhui Liu
2026-10-03 15:05     ` Norman Herms
2026-10-03 15:05       ` Norman Herms
2026-10-03 15:23       ` Junhui Liu [this message]
2026-10-03 15:23         ` Junhui Liu

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=DLVB1PLRC8GV.2YX3NP2B1KV2A@pigmoral.tech \
    --to=junhui.liu@pigmoral.tech \
    --cc=alex@ghiti.fr \
    --cc=andre.przywara@arm.com \
    --cc=aou@eecs.berkeley.edu \
    --cc=bmasney+clk@redhat.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dlan@gentoo.org \
    --cc=dockseed@proton.me \
    --cc=enzo.adriano.code@gmail.com \
    --cc=jbrunet+clk@baylibre.com \
    --cc=jbrunet@baylibre.com \
    --cc=jernej.skrabec@gmail.com \
    --cc=krzk+dt@kernel.org \
    --cc=krzysztof.kozlowski@oss.qualcomm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=linux-sunxi@lists.linux.dev \
    --cc=netdev@vger.kernel.org \
    --cc=p.zabel@pengutronix.de \
    --cc=palmer@dabbelt.com \
    --cc=pjw@kernel.org \
    --cc=richardcochran@gmail.com \
    --cc=robh@kernel.org \
    --cc=samuel@sholland.org \
    --cc=sboyd@kernel.org \
    --cc=wens@kernel.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.