linux-coco.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: Shanker Donthineni <sdonthineni@nvidia.com>
To: Steven Price <steven.price@arm.com>,
	Matias Ezequiel Vara Larsen <mvaralar@redhat.com>
Cc: kvm@vger.kernel.org, kvmarm@lists.linux.dev,
	Catalin Marinas <catalin.marinas@arm.com>,
	Marc Zyngier <maz@kernel.org>, Will Deacon <will@kernel.org>,
	James Morse <james.morse@arm.com>,
	Oliver Upton <oliver.upton@linux.dev>,
	Suzuki K Poulose <suzuki.poulose@arm.com>,
	Zenghui Yu <yuzenghui@huawei.com>,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, Joey Gouly <joey.gouly@arm.com>,
	Alexandru Elisei <alexandru.elisei@arm.com>,
	Christoffer Dall <christoffer.dall@arm.com>,
	Fuad Tabba <tabba@google.com>,
	linux-coco@lists.linux.dev,
	Ganapatrao Kulkarni <gankulkarni@os.amperecomputing.com>
Subject: Re: [PATCH v4 00/15] arm64: Support for running as a guest in Arm CCA
Date: Fri, 16 Aug 2024 16:13:35 -0500	[thread overview]
Message-ID: <aa9a6b53-cfc4-4010-83f5-ccfa396bb75f@nvidia.com> (raw)
In-Reply-To: <27c942e0-0e7c-4e71-b1df-1a8f70df5411@arm.com>



On 8/16/24 11:06, Steven Price wrote:
> External email: Use caution opening links or attachments
> 
> 
> On 15/08/2024 23:16, Shanker Donthineni wrote:
>> Hi Steven,
>>
>> On 7/12/24 03:54, Matias Ezequiel Vara Larsen wrote:
>>> On Mon, Jul 01, 2024 at 10:54:50AM +0100, Steven Price wrote:
>>>> This series adds support for running Linux in a protected VM under the
>>>> Arm Confidential Compute Architecture (CCA). This has been updated
>>>> following the feedback from the v3 posting[1]. Thanks for the feedback!
>>>> Individual patches have a change log. But things to highlight:
>>>>
>>>>    * a new patch ("firmware/psci: Add psci_early_test_conduit()") to
>>>>      prevent SMC calls being made on systems which don't support them -
>>>>      i.e. systems without EL2/EL3 - thanks Jean-Philippe!
>>>>
>>>>    * two patches dropped (overriding set_fixmap_io). Instead
>>>>      FIXMAP_PAGE_IO is modified to include PROT_NS_SHARED. When support
>>>>      for assigning hardware devices to a realm guest is added this will
>>>>      need to be brought back in some form. But for now it's just adding
>>>>      complixity and confusion for no gain.
>>>>
>>>>    * a new patch ("arm64: mm: Avoid TLBI when marking pages as valid")
>>>>      which avoids doing an extra TLBI when doing the break-before-make.
>>>>      Note that this changes the behaviour in other cases when making
>>>>      memory valid. This should be safe (and saves a TLBI for those
>>>> cases),
>>>>      but it's a separate patch in case of regressions.
>>>>
>>>>    * GIC ITT allocation now uses a custom genpool-based allocator. I
>>>>      expect this will be replaced with a generic way of allocating
>>>>      decrypted memory (see [4]), but for now this gets things working
>>>>      without wasting too much memory.
>>>>
>>>> The ABI to the RMM from a realm (the RSI) is based on the final RMM v1.0
>>>> (EAC 5) specification[2]. Future RMM specifications will be backwards
>>>> compatible so a guest using the v1.0 specification (i.e. this series)
>>>> will be able to run on future versions of the RMM without modification.
>>>>
>>>> This series is based on v6.10-rc1. It is also available as a git
>>>> repository:
>>>>
>>>> https://gitlab.arm.com/linux-arm/linux-cca cca-guest/v4
>>
>> Which cca-host branch should I use for testing cca-guest/v4?
>>
>> I'm getting compilation errors with cca-host/v3 and cca-guest/v4, is there
>> any known WAR or fix to resolve this issue?
> 
> cca-host/v3 should work with cca-guest/v4. I've been working on
> rebasing/updating the branches and should be able to post v4/v5 series
> next week.
> 
>>
>> arch/arm64/kvm/rme.c: In function ‘kvm_realm_reset_id_aa64dfr0_el1’:
>> ././include/linux/compiler_types.h:487:45: error: call to
>> ‘__compiletime_assert_650’ declared with attribute error: FIELD_PREP:
>> value too large for the field
>>    487 |         _compiletime_assert(condition, msg,
>> __compiletime_assert_, __COUNTER__)
>>        |                                             ^
>> ././include/linux/compiler_types.h:468:25: note: in definition of macro
>> ‘__compiletime_assert’
>>    468 |                         prefix ##
>> suffix();                             \
>>        |                         ^~~~~~
>> ././include/linux/compiler_types.h:487:9: note: in expansion of macro
>> ‘_compiletime_assert’
>>    487 |         _compiletime_assert(condition, msg,
>> __compiletime_assert_, __COUNTER__)
>>        |         ^~~~~~~~~~~~~~~~~~~
>> ./include/linux/build_bug.h:39:37: note: in expansion of macro
>> ‘compiletime_assert’
>>     39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond),
>> msg)
>>        |                                     ^~~~~~~~~~~~~~~~~~
>> ./include/linux/bitfield.h:68:17: note: in expansion of macro
>> ‘BUILD_BUG_ON_MSG’
>>     68 |                 BUILD_BUG_ON_MSG(__builtin_constant_p(_val)
>> ?           \
>>        |                 ^~~~~~~~~~~~~~~~
>> ./include/linux/bitfield.h:115:17: note: in expansion of macro
>> ‘__BF_FIELD_CHECK’
>>    115 |                 __BF_FIELD_CHECK(_mask, 0ULL, _val, "FIELD_PREP:
>> ");    \
>>        |                 ^~~~~~~~~~~~~~~~
>> arch/arm64/kvm/rme.c:315:16: note: in expansion of macro ‘FIELD_PREP’
>>    315 |         val |= FIELD_PREP(ID_AA64DFR0_EL1_BRPs_MASK, bps - 1) |
>>        |                ^~~~~~~~~~
>> make[5]: *** [scripts/Makefile.build:244: arch/arm64/kvm/rme.o] Error 1
>> make[4]: *** [scripts/Makefile.build:485: arch/arm64/kvm] Error 2
>> make[3]: *** [scripts/Makefile.build:485: arch/arm64] Error 2
>> make[3]: *** Waiting for unfinished jobs....
>>
>> I'm using gcc-13.3.0 compiler and cross-compiling on X86 machine.
> 
> I'm not sure quite how this happens. The 'value' (bps - 1) shouldn't be
> considered constant, so I don't see how the compiler has decided to
> complain here - the __builtin_constant_p() should really be evaluating to 0.
> 
> The only thing I can think of is if the compiler has somehow determined
> that rmm_feat_reg0 is 0 - which in theory it could do if it knew that
> kvm_init_rme() cannot succeed (rmi_features() would never be called, so
> the variable will never be set). Which makes me wonder if you're
> building with a PAGE_SIZE other than 4k?
> 
> Obviously the code should still build if that's the case (so this would
> be a bug) but we don't currently support CCA with PAGE_SIZE != 4k.
> 

I've encountered this error multiple times with both 4K and 64K, but it's
currently not reproducible. I'll update if the issue reappears. In the
meantime, I've verified the host-v3 and guest-v4 patches using v6.11.rc3,
tested Realm boot, CCA-KVM-UNIT-TESTs, and normal VM boot (without CCA).
No issues have been observed.

Additionally, I've validated Realm and CCA-KVM-UNIT-TESTs on a host with
PSZ=64K. For testing purposes, I modified KVM64 and KVM-UNIT-TESTS to
support PSZ=64K.


Tested-by: Shanker Donthineni <sdonthineni@nvidia.com>


> Steve
> 

      reply	other threads:[~2024-08-16 21:13 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-01  9:54 [PATCH v4 00/15] arm64: Support for running as a guest in Arm CCA Steven Price
2024-07-01  9:54 ` [PATCH v4 01/15] arm64: rsi: Add RSI definitions Steven Price
2024-07-09  5:19   ` Gavin Shan
2024-07-10 15:34     ` Steven Price
2024-07-23  5:35       ` Gavin Shan
2024-07-23  6:22   ` Gavin Shan
2024-08-16 15:56     ` Steven Price
2024-07-01  9:54 ` [PATCH v4 02/15] firmware/psci: Add psci_early_test_conduit() Steven Price
2024-07-09 10:48   ` Will Deacon
2024-07-10 15:34     ` Steven Price
2024-07-01  9:54 ` [PATCH v4 03/15] arm64: Detect if in a realm and set RIPAS RAM Steven Price
2024-07-29 23:37   ` Gavin Shan
2024-07-30 13:51     ` Suzuki K Poulose
2024-07-31  7:03       ` Gavin Shan
2024-07-31  9:05         ` Suzuki K Poulose
2024-07-01  9:54 ` [PATCH v4 04/15] arm64: realm: Query IPA size from the RMM Steven Price
2024-07-09 10:53   ` Will Deacon
2024-07-10 15:34     ` Steven Price
2024-07-01  9:54 ` [PATCH v4 05/15] arm64: Mark all I/O as non-secure shared Steven Price
2024-07-09 11:39   ` Will Deacon
2024-07-09 12:54     ` Suzuki K Poulose
2024-07-10 15:34       ` Steven Price
2024-07-30  1:36   ` Gavin Shan
2024-07-30 10:36     ` Suzuki K Poulose
2024-07-31  6:36       ` Gavin Shan
2024-07-31  9:03         ` Suzuki K Poulose
2024-07-01  9:54 ` [PATCH v4 06/15] arm64: Make the PHYS_MASK_SHIFT dynamic Steven Price
2024-07-09 11:43   ` Will Deacon
2024-07-09 12:55     ` Suzuki K Poulose
2024-07-10 15:34       ` Steven Price
2024-07-01  9:54 ` [PATCH v4 07/15] arm64: Enforce bounce buffers for realm DMA Steven Price
2024-07-09 11:56   ` Will Deacon
2024-07-10 15:43     ` Steven Price
2024-07-01  9:54 ` [PATCH v4 08/15] arm64: mm: Avoid TLBI when marking pages as valid Steven Price
2024-07-09 11:57   ` Will Deacon
2024-07-10 16:04     ` Steven Price
2024-07-01  9:54 ` [PATCH v4 09/15] arm64: Enable memory encrypt for Realms Steven Price
2024-07-01  9:55 ` [PATCH v4 10/15] arm64: Force device mappings to be non-secure shared Steven Price
2024-07-01  9:55 ` [PATCH v4 11/15] efi: arm64: Map Device with Prot Shared Steven Price
2024-07-01  9:55 ` [PATCH v4 12/15] irqchip/gic-v3-its: Share ITS tables with a non-trusted hypervisor Steven Price
2024-07-10 13:17   ` Will Deacon
2024-07-01  9:55 ` [PATCH v4 13/15] irqchip/gic-v3-its: Rely on genpool alignment Steven Price
2024-07-10 13:17   ` Will Deacon
2024-07-01  9:55 ` [PATCH v4 14/15] arm64: rsi: Interfaces to query attestation token Steven Price
2024-07-01  9:55 ` [PATCH v4 15/15] virt: arm-cca-guest: TSM_REPORT support for realms Steven Price
2024-07-09 12:04 ` [PATCH v4 00/15] arm64: Support for running as a guest in Arm CCA Will Deacon
2024-07-12  8:54 ` Matias Ezequiel Vara Larsen
2024-08-15 22:16   ` Shanker Donthineni
2024-08-16 16:06     ` Steven Price
2024-08-16 21:13       ` Shanker Donthineni [this message]

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=aa9a6b53-cfc4-4010-83f5-ccfa396bb75f@nvidia.com \
    --to=sdonthineni@nvidia.com \
    --cc=alexandru.elisei@arm.com \
    --cc=catalin.marinas@arm.com \
    --cc=christoffer.dall@arm.com \
    --cc=gankulkarni@os.amperecomputing.com \
    --cc=james.morse@arm.com \
    --cc=joey.gouly@arm.com \
    --cc=kvm@vger.kernel.org \
    --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=maz@kernel.org \
    --cc=mvaralar@redhat.com \
    --cc=oliver.upton@linux.dev \
    --cc=steven.price@arm.com \
    --cc=suzuki.poulose@arm.com \
    --cc=tabba@google.com \
    --cc=will@kernel.org \
    --cc=yuzenghui@huawei.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).