[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <yq5att2n8zby.fsf@kernel.org>
Date: Mon, 04 Aug 2025 10:20:41 +0530
From: Aneesh Kumar K.V <aneesh.kumar@...nel.org>
To: Jonathan Cameron <Jonathan.Cameron@...wei.com>
Cc: linux-coco@...ts.linux.dev, kvmarm@...ts.linux.dev,
linux-pci@...r.kernel.org, linux-kernel@...r.kernel.org, aik@....com,
lukas@...ner.de, Samuel Ortiz <sameo@...osinc.com>,
Xu Yilun <yilun.xu@...ux.intel.com>,
Jason Gunthorpe <jgg@...pe.ca>,
Suzuki K Poulose <Suzuki.Poulose@....com>,
Steven Price <steven.price@....com>,
Catalin Marinas <catalin.marinas@....com>,
Marc Zyngier <maz@...nel.org>, Will Deacon <will@...nel.org>,
Oliver Upton <oliver.upton@...ux.dev>
Subject: Re: [RFC PATCH v1 24/38] arm64: CCA: Register guest tsm callback
Jonathan Cameron <Jonathan.Cameron@...wei.com> writes:
> On Mon, 28 Jul 2025 19:22:01 +0530
> "Aneesh Kumar K.V (Arm)" <aneesh.kumar@...nel.org> wrote:
>
>> Register the TSM callback if the DA feature is supported by RSI.
>>
>> Additionally, adjust the build order so that the TSM class is created
>> before the arm-cca-guest driver initialization.
>>
>> Signed-off-by: Aneesh Kumar K.V (Arm) <aneesh.kumar@...nel.org>
> See below.
>
>> diff --git a/arch/arm64/kernel/rsi.c b/arch/arm64/kernel/rsi.c
>> index bf9ea99e2aa1..ef06c083990a 100644
>> --- a/arch/arm64/kernel/rsi.c
>> +++ b/arch/arm64/kernel/rsi.c
>> @@ -15,6 +15,7 @@
>> #include <asm/rsi.h>
>>
>> static struct realm_config config;
>> +static unsigned long rsi_feat_reg0;
>>
>> unsigned long prot_ns_shared;
>> EXPORT_SYMBOL(prot_ns_shared);
>> @@ -22,6 +23,12 @@ EXPORT_SYMBOL(prot_ns_shared);
>> DEFINE_STATIC_KEY_FALSE_RO(rsi_present);
>> EXPORT_SYMBOL(rsi_present);
>>
>> +bool rsi_has_da_feature(void)
>> +{
>> + return !!u64_get_bits(rsi_feat_reg0, RSI_FEATURE_REGISTER_0_DA);
>
> !! not needed.
>
>> +}
>> +EXPORT_SYMBOL_GPL(rsi_has_da_feature);
>
>
>> diff --git a/drivers/virt/coco/arm-cca-guest/arm-cca.c b/drivers/virt/coco/arm-cca-guest/arm-cca.c
>> index 547fc2c79f7d..3adbbd67e06e 100644
>> --- a/drivers/virt/coco/arm-cca-guest/arm-cca.c
>> +++ b/drivers/virt/coco/arm-cca-guest/arm-cca.c
>> @@ -1,6 +1,6 @@
>
>> static int cca_guest_probe(struct platform_device *pdev)
>> {
>> int ret;
>> @@ -200,11 +256,22 @@ static int cca_guest_probe(struct platform_device *pdev)
>> return -ENODEV;
>>
>> ret = tsm_report_register(&arm_cca_tsm_report_ops, NULL);
>> - if (ret < 0)
>> + if (ret < 0) {
>> pr_err("Error %d registering with TSM\n", ret);
>> + goto err_out;
>> + }
>>
>> ret = devm_add_action_or_reset(&pdev->dev, unregister_cca_tsm_report, NULL);
>> + if (ret < 0) {
>> + pr_err("Error %d registering devm action\n", ret);
>> + unregister_cca_tsm_report(NULL);
>> + goto err_out;
>> + }
>> +
>> + if (rsi_has_da_feature())
>> + ret = cca_tsm_register(pdev);
> Why do we not need to call unregister_cca_tsm_report()
> if this fails?
>
`tsm_report` and DA are independent functionalities. I’ll update the
guest probe to return success so that `tsm_report` remains available
even if the DA tsm registration fails.
-aneesh
Powered by blists - more mailing lists