From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B83DD18B473; Mon, 7 Oct 2024 10:34:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728297261; cv=none; b=VKZ4g0SZruwdE4ae3FjwNM70EfedP2yO0Fj45xh65xli4cZzCO7qHEFp9qw31P8xn1Y/YZ9HiHXbzsYRG2ksazhp0Mnn93AOiHIHqV2GlU+gtatyT/5fCwtr8LB5tw0+3JoQ8ILejSDBX9PXV4SycX9okSdi1j9DRcmqkfC3eJ4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728297261; c=relaxed/simple; bh=SRtgvXeFZSpW+RrYYS6tr8keYP5TXm0Uqjm9sx3J1M0=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=oa2GUQsWSog14GQgKs9AsZKue9NsT5VE8/Y3lb9KlgRLJ3budKq9HaFpc/nmU9MwkXFy1TKEE1wKN9BJ2pL0vToJ2mpZgfvDCL5YDoCOXITfPinaX5LZ702qE+rnV5sAUpj4LvR22kOBz1xSEiLOpidhNyvXG0yQpYqNCEye/Lw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 81B13FEC; Mon, 7 Oct 2024 03:34:48 -0700 (PDT) Received: from [10.96.9.194] (PW05HE0L.arm.com [10.96.9.194]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 040BA3F64C; Mon, 7 Oct 2024 03:34:13 -0700 (PDT) Message-ID: Date: Mon, 7 Oct 2024 11:34:11 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v5 07/43] arm64: RME: Check for RME support at KVM init Content-Language: en-GB To: Steven Price , kvm@vger.kernel.org, kvmarm@lists.linux.dev Cc: Catalin Marinas , Marc Zyngier , Will Deacon , James Morse , Oliver Upton , Zenghui Yu , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Joey Gouly , Alexandru Elisei , Christoffer Dall , Fuad Tabba , linux-coco@lists.linux.dev, Ganapatrao Kulkarni , Gavin Shan , Shanker Donthineni , Alper Gun , "Aneesh Kumar K . V" References: <20241004152804.72508-1-steven.price@arm.com> <20241004152804.72508-8-steven.price@arm.com> From: Suzuki K Poulose In-Reply-To: <20241004152804.72508-8-steven.price@arm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 04/10/2024 16:27, Steven Price wrote: > Query the RMI version number and check if it is a compatible version. A > static key is also provided to signal that a supported RMM is available. > > Functions are provided to query if a VM or VCPU is a realm (or rec) > which currently will always return false. > > Signed-off-by: Steven Price > --- > > diff --git a/arch/arm64/kvm/rme.c b/arch/arm64/kvm/rme.c > new file mode 100644 > index 000000000000..418685fbf6ed > --- /dev/null > +++ b/arch/arm64/kvm/rme.c > @@ -0,0 +1,50 @@ > +// SPDX-License-Identifier: GPL-2.0 > +/* > + * Copyright (C) 2023 ARM Ltd. > + */ > + > +#include > + > +#include > +#include > + > +static int rmi_check_version(void) > +{ > + struct arm_smccc_res res; > + int version_major, version_minor; > + unsigned long host_version = RMI_ABI_VERSION(RMI_ABI_MAJOR_VERSION, > + RMI_ABI_MINOR_VERSION); > + > + arm_smccc_1_1_invoke(SMC_RMI_VERSION, host_version, &res); > + > + if (res.a0 == SMCCC_RET_NOT_SUPPORTED) > + return -ENXIO; > + > + version_major = RMI_ABI_VERSION_GET_MAJOR(res.a1); > + version_minor = RMI_ABI_VERSION_GET_MINOR(res.a1); > + > + if (res.a0 != RMI_SUCCESS) { > + kvm_err("Unsupported RMI ABI (v%d.%d) host supports v%d.%d\n", minor nit: s/host supports/we want ? (or something similar) "host" could be confusing from a user perspective ? Rest looks good to me Suzuki