Re: [PATCH v11 7/7] coco: guest: arm64: Replace dummy CCA device with sysfs ABI
From: Catalin Marinas
Date: Thu Sep 17 2026 - 06:10:23 EST
On Wed, Sep 16, 2026 at 07:39:59PM +0530, Aneesh Kumar K.V wrote:
> Catalin Marinas <catalin.marinas@xxxxxxx> writes:
> > On Mon, Sep 14, 2026 at 11:35:11AM +0530, Aneesh Kumar K.V (Arm) wrote:
> >> diff --git a/Documentation/ABI/testing/sysfs-firmware-cca b/Documentation/ABI/testing/sysfs-firmware-cca
> >> new file mode 100644
> >> index 000000000000..bf177d636b92
> >> --- /dev/null
> >> +++ b/Documentation/ABI/testing/sysfs-firmware-cca
> >> @@ -0,0 +1,10 @@
> >> +What: /sys/firmware/cca/realm_guest
> >> +Date: May 2026
> >> +Contact: Linux ARM Kernel Mailing list <linux-arm-kernel@xxxxxxxxxxxxxxxxxxx>
> >> +Description: Read-only. Indicates whether the kernel is running as an
> >> + Arm Confidential Compute Architecture (CCA) Realm guest.
> >> +
> >> + The value is one of:
> >> +
> >> + 0: the kernel is not running as a Realm guest
> >> + 1: the kernel is running as a Realm guest
> >
> > Does this file ever read as 0? It is created only if rsi_present and
> > always reads as 1. That's fine by me but we shouldn't document 0 as a
> > value. More like if present, it always reads 1 and RSI is present.
> >
>
> For now, that is correct. However, the two checks could diverge if Realm
> guest support is enabled only after additional checks, such as version
> compatibility.
>
> In that case, is_realm_world() and static_branch_unlikely(&rsi_present)
> could return different results.
They can indeed diverge in either direction but would we ever end up
reporting 0? I also think we should gate realm_sysfs_init() on
is_realm_world() rather than rsi_present. I know it's the same at the
moment but it would read better if we just did:
if (!is_realm_world())
return 0;
and realm_guest_show() just return 1.
The file description could be (without any values 0 or 1):
Description: Read-only. Present only when the kernel is running as an
Arm Confidential Compute Architecture (CCA) Realm guest, in
which case it reads 1. If the file does not exist, the kernel
is not running as a Realm guest.
or something along these lines, no description of value 0 (well, you
could say if "if the file does not exist or reads 0..." but only if we
envisage a use-case for this.
--
Catalin