From: Suzuki K Poulose <suzuki.poulose@arm.com>
To: Marc Zyngier <maz@kernel.org>,
"Aneesh Kumar K.V" <aneesh.kumar@kernel.org>
Cc: linux-kernel@vger.kernel.org, iommu@lists.linux.dev,
linux-coco@lists.linux.dev, linux-arm-kernel@lists.infradead.org,
kvmarm@lists.linux.dev, Catalin Marinas <catalin.marinas@arm.com>,
Jason Gunthorpe <jgg@ziepe.ca>,
Marek Szyprowski <m.szyprowski@samsung.com>,
Robin Murphy <robin.murphy@arm.com>,
Steven Price <steven.price@arm.com>,
Thomas Gleixner <tglx@kernel.org>, Will Deacon <will@kernel.org>
Subject: Re: [PATCH v4 3/3] coco: guest: arm64: Query host IPA-change alignment via RHI
Date: Tue, 28 Apr 2026 16:22:59 +0100 [thread overview]
Message-ID: <5399c16f-faf1-471e-ac37-7dd9d5ddb897@arm.com> (raw)
In-Reply-To: <86tssvyz2v.wl-maz@kernel.org>
On 28/04/2026 14:49, Marc Zyngier wrote:
> On Tue, 28 Apr 2026 13:49:46 +0100,
> Aneesh Kumar K.V <aneesh.kumar@kernel.org> wrote:
>>
>> Marc Zyngier <maz@kernel.org> writes:
>>
>>> On Mon, 27 Apr 2026 07:31:08 +0100,
>>> "Aneesh Kumar K.V (Arm)" <aneesh.kumar@kernel.org> wrote:
>>>>
>>>> Add the Realm Host Interface support needed to query host configuration
>>>> from a Realm guest. Define the RHI hostconf SMCs, add rsi_host_call(), and
>>>> use them during Realm initialization to retrieve the host IPA-change
>>>> alignment size.
>>>
>>> I don't understand what "IPA-change" means. What you are after is the
>>> host's sharing granule size.
>>>
>>
>> This is part of the RHI specification, and the call is named
>> RHI_HOSTCONF_GET_IPA_CHANGE_ALIGNMENT. The intent is to determine the
>> alignment requirements for changing IPA attributes (protected vs.
>> unprotected IPA
>
> This really is a terrible name. Why the 'change' part? It doesn't
> change, it is a constant.
Agreed, it was supposed to mean IPA_STATE_CHANGE.
>
> Oh well...
>
> [...]
>
...
>>>> +unsigned long rhi_get_ipa_change_alignment(void)
>>>> +{
>>>> + long ret;
>>>> + unsigned long ipa_change_align;
>>>> +
>>>> + hyp_pagesize_rhicall.imm = 0;
>>>> + hyp_pagesize_rhicall.gprs[0] = RHI_HOSTCONF_VERSION;
>>>> + ret = rsi_host_call(lm_alias(&hyp_pagesize_rhicall));
>>>> + if (ret != RSI_SUCCESS)
>>>> + goto err_out;
>>>> +
>>>> + if (hyp_pagesize_rhicall.gprs[0] != RHI_HOSTCONF_VER_1_0)
>>>> + goto err_out;
>>>> +
>>>> + hyp_pagesize_rhicall.imm = 0;
>>>> + hyp_pagesize_rhicall.gprs[0] = RHI_HOSTCONF_FEATURES;
>>>> + ret = rsi_host_call(lm_alias(&hyp_pagesize_rhicall));
>>>> + if (ret != RSI_SUCCESS)
>>>> + goto err_out;
>>>> +
>>>> + if (!(hyp_pagesize_rhicall.gprs[0] & __RHI_HOSTCONF_GET_IPA_CHANGE_ALIGNMENT))
>>>> + goto err_out;
>>>> +
>>>> + hyp_pagesize_rhicall.imm = 0;
>>>> + hyp_pagesize_rhicall.gprs[0] = RHI_HOSTCONF_GET_IPA_CHANGE_ALIGNMENT;
>>>> + ret = rsi_host_call(lm_alias(&hyp_pagesize_rhicall));
>>>> + if (ret != RSI_SUCCESS)
>>>> + goto err_out;
>>>> +
>>>> + ipa_change_align = hyp_pagesize_rhicall.gprs[0];
>>>> + /* This error needs special handling in the caller */
>>>> + if (ipa_change_align & (SZ_4K - 1))
>>>> + return 0;
>>>> +
>>>> + return ipa_change_align;
>>>> +
>>>> +err_out:
>>>> + /*
>>>> + * For failure condition assume host is built with 4K page size
>>>> + * and hence ipa change alignment can be guest PAGE_SIZE.
>>>> + */
>>>> + return PAGE_SIZE;
>>>> +}
>>>
>>> Why can't this be part of rsi.c? This is an RSI call, and it should be
>>> part of the RSI initialisation.
>>>
>>
>> This is an RHI call as per the specification, hence it has been added to
>> rhi.c.
>
> News flash: this is the Linux kernel, not an ARM spec. We organise
> things based on the logical use, not on the TLA associated with it.
>
> And RHI is implemented in terms of RSI. In rsi.c it goes. We don't
> need this pointless proliferation of helper files that only result in
> equally pointless global symbols.
RHI (Realm Host Interface) is not really the same as RSI. The former is
a service mechanism for Realms with the "Non-secure Hypervisor". And
this single call is just one of the services. There are further more
services that will eventually come up (e.g., Device Assignment, Boot
Sync Protocol, Firmware Activity Log etc).
RSI (to be precise, RSI_HOST_CALL) is the transport to talk to the Host,
as that is the only way for the Realm to reach the Host. So, tbh, it
does make sense to keep this in rhic ?
Suzuki
next prev parent reply other threads:[~2026-04-28 15:23 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-27 6:31 [PATCH v4 0/3] Enforce host page-size alignment for shared buffers Aneesh Kumar K.V (Arm)
2026-04-27 6:31 ` [PATCH v4 1/3] dma-direct: swiotlb: handle swiotlb alloc/free outside __dma_direct_alloc_pages Aneesh Kumar K.V (Arm)
2026-04-27 6:31 ` [PATCH v4 2/3] swiotlb: dma: its: Enforce host page-size alignment for shared buffers Aneesh Kumar K.V (Arm)
2026-04-27 9:27 ` Marc Zyngier
2026-04-27 13:38 ` Jason Gunthorpe
2026-04-28 12:20 ` Aneesh Kumar K.V
2026-04-28 13:31 ` Marc Zyngier
2026-04-27 13:49 ` Jason Gunthorpe
2026-04-28 12:22 ` Aneesh Kumar K.V
2026-04-27 6:31 ` [PATCH v4 3/3] coco: guest: arm64: Query host IPA-change alignment via RHI Aneesh Kumar K.V (Arm)
2026-04-27 10:33 ` Marc Zyngier
2026-04-28 12:49 ` Aneesh Kumar K.V
2026-04-28 13:49 ` Marc Zyngier
2026-04-28 15:22 ` Suzuki K Poulose [this message]
2026-04-29 9:01 ` Aneesh Kumar K.V
2026-04-28 13:56 ` Will Deacon
2026-04-29 9:03 ` Aneesh Kumar K.V
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=5399c16f-faf1-471e-ac37-7dd9d5ddb897@arm.com \
--to=suzuki.poulose@arm.com \
--cc=aneesh.kumar@kernel.org \
--cc=catalin.marinas@arm.com \
--cc=iommu@lists.linux.dev \
--cc=jgg@ziepe.ca \
--cc=kvmarm@lists.linux.dev \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-coco@lists.linux.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=m.szyprowski@samsung.com \
--cc=maz@kernel.org \
--cc=robin.murphy@arm.com \
--cc=steven.price@arm.com \
--cc=tglx@kernel.org \
--cc=will@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox