Jonathan Cameron <Jonathan.Cameron@xxxxxxxxxx> writes: > On Mon, 28 Jul 2025 19:22:01 +0530 > "Aneesh Kumar K.V (Arm)" <aneesh.kumar@xxxxxxxxxx> 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@xxxxxxxxxx> > 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