[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1032c158-c5a6-4845-affa-f444e0071e5a@redhat.com>
Date: Tue, 28 Jan 2025 15:47:02 +1000
From: Gavin Shan <gshan@...hat.com>
To: "Aneesh Kumar K.V" <aneesh.kumar@...nel.org>,
Steven Price <steven.price@....com>, kvm@...r.kernel.org,
kvmarm@...ts.linux.dev
Cc: Catalin Marinas <catalin.marinas@....com>, Marc Zyngier <maz@...nel.org>,
Will Deacon <will@...nel.org>, James Morse <james.morse@....com>,
Oliver Upton <oliver.upton@...ux.dev>,
Suzuki K Poulose <suzuki.poulose@....com>, Zenghui Yu
<yuzenghui@...wei.com>, linux-arm-kernel@...ts.infradead.org,
linux-kernel@...r.kernel.org, Joey Gouly <joey.gouly@....com>,
Alexandru Elisei <alexandru.elisei@....com>,
Christoffer Dall <christoffer.dall@....com>, Fuad Tabba <tabba@...gle.com>,
linux-coco@...ts.linux.dev,
Ganapatrao Kulkarni <gankulkarni@...amperecomputing.com>,
Shanker Donthineni <sdonthineni@...dia.com>, Alper Gun <alpergun@...gle.com>
Subject: Re: [PATCH v6 06/43] arm64: RME: Check for RME support at KVM init
On 12/19/24 3:44 PM, Aneesh Kumar K.V wrote:
> Steven Price <steven.price@....com> writes:
>
>> +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) we want v%d.%d\n",
>> + version_major, version_minor,
>> + RMI_ABI_MAJOR_VERSION,
>> + RMI_ABI_MINOR_VERSION);
>> + return -ENXIO;
>> + }
>> +
>> + kvm_info("RMI ABI version %d.%d\n", version_major, version_minor);
>> +
>> + return 0;
>> +}
>> +
>
> Should we include both high and low version numbers in the kvm_err
> message on error? ie,
>
> high_version_major = RMI_ABI_VERSION_GET_MAJOR(res.a2);
> high_version_minor = RMI_ABI_VERSION_GET_MINOR(res.a2);
>
I think so since a range of supported versions are returned in the failing case.
Besides, 'unsigned short' is more suitable for the local variable version_{major, minor}
since both are 16-bits in width. 'unsigned short' explicitly indicates their
width.
Thanks,
Gavin
Powered by blists - more mailing lists