nvadsp: Pass shared mem via MBX in backdoor boot

In backdoor boot if shared memory region is not defined in the
ADSP FW then assume it to be placed at the start of OS memory
and communicate the same via MBX. In case MBX is not available
then the boot is aborted.

Bug 200745795
Bug 200746669

Change-Id: I15cd4f3f07dd91c2700479906d19b9219814e2f6
Signed-off-by: Viswanath L <viswanathl@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2613565
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Sharad Gupta <sharadg@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Viswanath L
2021-10-20 09:03:44 +00:00
committed by Laxman Dewangan
parent 6360f074cf
commit bb93b07676

View File

@@ -526,7 +526,7 @@ static void *get_mailbox_shared_region(const struct firmware *fw)
shdr = nvadsp_get_section(fw, MAILBOX_REGION);
if (!shdr) {
dev_err(dev, "section %s not found\n", MAILBOX_REGION);
dev_dbg(dev, "section %s not found\n", MAILBOX_REGION);
return ERR_PTR(-EINVAL);
}
@@ -832,6 +832,7 @@ static int __nvadsp_os_secload(struct platform_device *pdev)
static int nvadsp_firmware_load(struct platform_device *pdev)
{
struct nvadsp_shared_mem *shared_mem;
struct nvadsp_drv_data *drv_data = platform_get_drvdata(pdev);
struct device *dev = &pdev->dev;
const struct firmware *fw;
int ret = 0;
@@ -864,6 +865,21 @@ static int nvadsp_firmware_load(struct platform_device *pdev)
}
shared_mem = get_mailbox_shared_region(fw);
if (IS_ERR(shared_mem)) {
if (drv_data->chip_data->adsp_shared_mem_hwmbox != 0) {
/*
* If FW is not explicitly defining a shared memory
* region then assume it to be placed at the start
* of OS memory and communicate the same via MBX
*/
drv_data->shared_adsp_os_data_iova = priv.adsp_os_addr;
shared_mem = nvadsp_da_to_va_mappings(
priv.adsp_os_addr, priv.adsp_os_size);
} else {
dev_err(dev, "failed to locate shared memory\n");
goto deallocate_os_memory;
}
}
nvadsp_set_shared_mem(pdev, shared_mem, 1);
ret = dram_app_mem_init(priv.app_alloc_addr, priv.app_size);