From 0ffef44f5b07977a5608985c66e7eeaadc29b426 Mon Sep 17 00:00:00 2001 From: Aurora pro automerger Date: Fri, 17 Feb 2023 09:18:51 +0000 Subject: gxp: [Copybara Auto Merge] Merge branch 'gs201-u' into 'android13-gs-pixel-5.10-udc' gcip: fixup: Use devm_* for gcip-pm Bug: 265870718 gcip: Use devm_* for gcip-pm Bug: 265870718 (repeat) gcip: Remove the start log of async power down Bug: 265870718 (repeat) gcip: Add firmware dynamic tracing support Bug: 262916889 gcip: Add PM support Bug: 265870718 (repeat) GCIP_MAIN_REV_ID: c359c8b4c8e11ff2655dbfd8457605b760db383c gxp: remove redundant domain_attach from vd resume Bug: 269587251 gxp: bump version 1.10 Bug: 269587251 (repeat) gxp: move domain detach to block_unready Bug: 269587251 (repeat) gxp: add mcu_crashed flag to gxp_virtual_device Bug: 269587251 (repeat) gxp: use MCU PSM to handle MCU fw crash Bug: 264621513 gxp: add IDs to VD suspend/resume log gxp: skip suspend/resume in full MCU mode Bug: 269717931 gxp: load core FW only once per image Bug: 267713927 gxp: Adopt GCIP PM Bug: 265870718 (repeat) gxp: Log the clients with a wakelock in gxp_platform_suspend Bug: 265870718 (repeat) gxp: Remove suspended from gxp_wakelock_manager Bug: 265870718 (repeat) gxp: support loading DSP core FW in raw binary format Bug: 259215977 gxp: introduce gxp_vd_invalidate_with_client_id Bug: 263994153 gxp: introduce gxp_vd_generate_debug_dump Bug: 263994153 (repeat) gxp: move vd_invalid_eventfd from client to vd Bug: 263994153 (repeat) gxp: gxp_vd_block_unready needs vd_semaphore write lock Bug: 263994153 (repeat) gxp: bump to version 1.9 Bug: 245751727 Bug: 268449263 gxp: unittest: add a unittest for gxp_mapping_iova_log Bug: 245751727 (repeat) gxp: Add a module flag to enable IOVA-space logging Bug: 245751727 (repeat) gxp: introduce debug_dump_lock per vd Bug: 234172464 gxp: gxp_vd_{run,stop} holds vd_sema for writing Bug: 234172464 (repeat) gxp: pass vd to the static functions of debug dump Bug: 234172464 (repeat) gcip: Add a comment about suspend/resume in gcip-pm Bug: 265870718 (repeat) gcip: Add firmware dynamic tracing header Bug: 262916889 (repeat) gcip: Add PM header Bug: 265870718 (repeat) GCIP_HEADERS_REV_ID: 21105099cc4be7a0fec32f06f34cce5026015601 GitOrigin-RevId: 775c7ff3381a68301beb1d3b790d0954e211244c Change-Id: I9637cc7a2ef6bc3b8b184035834ac1ab13ebafb4 --- gxp-firmware.c | 31 +++++++++++-------------------- 1 file changed, 11 insertions(+), 20 deletions(-) (limited to 'gxp-firmware.c') diff --git a/gxp-firmware.c b/gxp-firmware.c index 4a59a13..b0453d5 100644 --- a/gxp-firmware.c +++ b/gxp-firmware.c @@ -138,8 +138,8 @@ static int elf_load_segments(struct gxp_dev *gxp, const u8 *elf_data, (ehdr->e_ident[EI_MAG1] != ELFMAG1) || (ehdr->e_ident[EI_MAG2] != ELFMAG2) || (ehdr->e_ident[EI_MAG3] != ELFMAG3)) { - dev_err(gxp->dev, "Invalid ELF format."); - return -EINVAL; + dev_info(gxp->dev, "Firmware is not an ELF, treated as raw binary."); + return 0; } /* go through the available ELF segments */ @@ -213,15 +213,6 @@ static int elf_load_segments(struct gxp_dev *gxp, const u8 *elf_data, return ret; } -static void elf_fetch_entry_point(struct gxp_dev *gxp, const u8 *elf_data, - uint core) -{ - struct elf32_hdr *ehdr; - - ehdr = (struct elf32_hdr *)elf_data; - gxp->firmware_mgr->entry_points[core] = ehdr->e_entry; -} - static int gxp_firmware_authenticate(struct gxp_dev *gxp, const struct firmware *firmwares[GXP_NUM_CORES]) @@ -322,14 +313,14 @@ static void gxp_program_reset_vector(struct gxp_dev *gxp, uint core, reset_vec = gxp_read_32(gxp, GXP_CORE_REG_ALT_RESET_VECTOR(phys_core)); if (verbose) dev_notice(gxp->dev, - "Current Aurora reset vector for core %u: 0x%x\n", + "Current Aurora reset vector for core %u: %#x\n", phys_core, reset_vec); gxp_write_32(gxp, GXP_CORE_REG_ALT_RESET_VECTOR(phys_core), - gxp->firmware_mgr->entry_points[core]); + gxp->fwbufs[core].daddr); if (verbose) dev_notice(gxp->dev, - "New Aurora reset vector for core %u: 0x%x\n", - phys_core, gxp->firmware_mgr->entry_points[core]); + "New Aurora reset vector for core %u: %#llx\n", + phys_core, gxp->fwbufs[core].daddr); } static void *get_scratchpad_base(struct gxp_dev *gxp, @@ -400,6 +391,8 @@ static int gxp_firmware_load(struct gxp_dev *gxp, struct gxp_virtual_device *vd, if (!mgr->firmwares[core]) return -ENODEV; + if (mgr->loaded[core]) + return 0; /* Load firmware to System RAM */ ret = elf_load_segments(gxp, @@ -411,14 +404,11 @@ static int gxp_firmware_load(struct gxp_dev *gxp, struct gxp_virtual_device *vd, goto out_firmware_unload; } - elf_fetch_entry_point(gxp, - mgr->firmwares[core]->data + FW_HEADER_SIZE, - core); - /* TODO(b/188970444): Cleanup logging of addresses */ dev_notice(gxp->dev, - "ELF loaded at virtual: %pK and physical: 0x%llx\n", + "ELF loaded at virtual: %pK and physical: %#llx\n", gxp->fwbufs[core].vaddr, gxp->fwbufs[core].paddr); + mgr->loaded[core] = true; return 0; @@ -619,6 +609,7 @@ static ssize_t load_dsp_firmware_store(struct device *dev, if (mgr->firmwares[core]) release_firmware(mgr->firmwares[core]); mgr->firmwares[core] = firmwares[core]; + mgr->loaded[core] = false; } kfree(mgr->firmware_name); -- cgit v1.2.3