From 47657548ae6e075d3a649a2f6bdb228d51543d05 Mon Sep 17 00:00:00 2001 From: Elliot Berman Date: Thu, 13 Feb 2025 13:26:31 -0800 Subject: [PATCH] ANDROID: virt: gunyah: Convert core gunyah driver to pure module Now that Gunyah modules can be probed without devicetree, there is no reason to bind/populate the gunyah-hypervisor node, even if it exists. Convert the probe function, which checked if we were running under Gunyah and tested for the info_area, into a regular initcall. core_initcall() used because Gunyah-aware protected guest needs to initialize early for virtio-balloon/free page reporting. Bug: 395833312 Change-Id: I7e2787d814c45d44d8868e249a512c66f90a725c Signed-off-by: Elliot Berman --- drivers/virt/gunyah/gunyah.c | 27 ++++++--------------------- 1 file changed, 6 insertions(+), 21 deletions(-) diff --git a/drivers/virt/gunyah/gunyah.c b/drivers/virt/gunyah/gunyah.c index 7a6669a5675c..b0bc18d0a3bd 100644 --- a/drivers/virt/gunyah/gunyah.c +++ b/drivers/virt/gunyah/gunyah.c @@ -3,6 +3,8 @@ * Copyright (c) 2023-2024 Qualcomm Innovation Center, Inc. All rights reserved. */ +#define pr_fmt(fmt) "gunyah: " fmt + #include #include #include @@ -42,7 +44,7 @@ void *gunyah_get_info(u16 owner, u16 id, size_t *size) } EXPORT_SYMBOL_GPL(gunyah_get_info); -static int gunyah_probe(struct platform_device *pdev) +static int __init gunyah_init(void) { struct gunyah_hypercall_hyp_identify_resp gunyah_api; unsigned long info_ipa, info_size; @@ -67,7 +69,7 @@ static int gunyah_probe(struct platform_device *pdev) gh_error = gunyah_hypercall_addrspace_find_info_area(&info_ipa, &info_size); /* ignore errors for compatability with gh without info_area support */ if (gh_error != GUNYAH_ERROR_OK) - goto out; + return 0; info_area = memremap(info_ipa, info_size, MEMREMAP_WB); if (!info_area) { @@ -75,26 +77,9 @@ static int gunyah_probe(struct platform_device *pdev) return -ENOMEM; } -out: - return devm_of_platform_populate(&pdev->dev); + return 0; } - -static const struct of_device_id gunyah_of_match[] = { - { .compatible = "gunyah-hypervisor" }, - {} -}; -MODULE_DEVICE_TABLE(of, gunyah_of_match); - -/* clang-format off */ -static struct platform_driver gunyah_driver = { - .probe = gunyah_probe, - .driver = { - .name = "gunyah", - .of_match_table = gunyah_of_match, - } -}; -/* clang-format on */ -module_platform_driver(gunyah_driver); +core_initcall(gunyah_init); MODULE_LICENSE("GPL"); MODULE_DESCRIPTION("Gunyah Driver");