Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

soc: qcom: mdtloader: Add PAS context aware qcom_mdt_pas_load() function

Introduce a new PAS context-aware function, qcom_mdt_pas_load(), for
remote processor drivers. This function utilizes the PAS context
pointer returned from qcom_scm_pas_ctx_init() to perform firmware
metadata verification and memory setup via SMC calls.

The qcom_mdt_pas_load() and qcom_mdt_load() functions are largely
similar, but the former is designed for clients using the PAS
context-based data structure. Over time, all users of qcom_mdt_load()
can be migrated to use qcom_mdt_pas_load() for consistency and
improved abstraction.

As the remoteproc PAS driver (qcom_q6v5_pas) has already adopted the
PAS context-based approach, update it to use qcom_mdt_pas_load().

Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Signed-off-by: Mukesh Ojha <mukesh.ojha@oss.qualcomm.com>
Link: https://lore.kernel.org/r/20260105-kvmrprocv10-v10-6-022e96815380@oss.qualcomm.com
Signed-off-by: Bjorn Andersson <andersson@kernel.org>

authored by

Mukesh Ojha and committed by
Bjorn Andersson
8a4fcffd b13d8baf

+46 -19
+5 -19
drivers/remoteproc/qcom_q6v5_pas.c
··· 239 239 return ret; 240 240 } 241 241 242 - ret = qcom_mdt_pas_init(pas->dev, pas->dtb_firmware, pas->dtb_firmware_name, 243 - pas->dtb_pas_id, pas->dtb_mem_phys, 244 - pas->dtb_pas_ctx); 245 - if (ret) 246 - goto release_dtb_firmware; 247 - 248 - ret = qcom_mdt_load_no_init(pas->dev, pas->dtb_firmware, pas->dtb_firmware_name, 249 - pas->dtb_mem_region, pas->dtb_mem_phys, 250 - pas->dtb_mem_size, &pas->dtb_mem_reloc); 242 + ret = qcom_mdt_pas_load(pas->dtb_pas_ctx, pas->dtb_firmware, 243 + pas->dtb_firmware_name, pas->dtb_mem_region, 244 + &pas->dtb_mem_reloc); 251 245 if (ret) 252 246 goto release_dtb_metadata; 253 247 } ··· 250 256 251 257 release_dtb_metadata: 252 258 qcom_scm_pas_metadata_release(pas->dtb_pas_ctx); 253 - 254 - release_dtb_firmware: 255 259 release_firmware(pas->dtb_firmware); 256 260 257 261 return ret; ··· 297 305 } 298 306 } 299 307 300 - ret = qcom_mdt_pas_init(pas->dev, pas->firmware, rproc->firmware, pas->pas_id, 301 - pas->mem_phys, pas->pas_ctx); 302 - if (ret) 303 - goto disable_px_supply; 304 - 305 - ret = qcom_mdt_load_no_init(pas->dev, pas->firmware, rproc->firmware, 306 - pas->mem_region, pas->mem_phys, pas->mem_size, 307 - &pas->mem_reloc); 308 + ret = qcom_mdt_pas_load(pas->pas_ctx, pas->firmware, rproc->firmware, 309 + pas->mem_region, &pas->mem_reloc); 308 310 if (ret) 309 311 goto release_pas_metadata; 310 312
+31
drivers/soc/qcom/mdt_loader.c
··· 478 478 } 479 479 EXPORT_SYMBOL_GPL(qcom_mdt_load); 480 480 481 + /** 482 + * qcom_mdt_pas_load - Loads and authenticates the metadata of the firmware 483 + * (typically contained in the .mdt file), followed by loading the actual 484 + * firmware segments (e.g., .bXX files). Authentication of the segments done 485 + * by a separate call. 486 + * 487 + * The PAS context must be initialized using qcom_scm_pas_context_init() 488 + * prior to invoking this function. 489 + * 490 + * @ctx: Pointer to the PAS (Peripheral Authentication Service) context 491 + * @fw: Firmware object representing the .mdt file 492 + * @firmware: Name of the firmware used to construct segment file names 493 + * @mem_region: Memory region allocated for loading the firmware 494 + * @reloc_base: Physical address adjusted after relocation 495 + * 496 + * Return: 0 on success or a negative error code on failure. 497 + */ 498 + int qcom_mdt_pas_load(struct qcom_scm_pas_context *ctx, const struct firmware *fw, 499 + const char *firmware, void *mem_region, phys_addr_t *reloc_base) 500 + { 501 + int ret; 502 + 503 + ret = qcom_mdt_pas_init(ctx->dev, fw, firmware, ctx->pas_id, ctx->mem_phys, ctx); 504 + if (ret) 505 + return ret; 506 + 507 + return qcom_mdt_load_no_init(ctx->dev, fw, firmware, mem_region, ctx->mem_phys, 508 + ctx->mem_size, reloc_base); 509 + } 510 + EXPORT_SYMBOL_GPL(qcom_mdt_pas_load); 511 + 481 512 MODULE_DESCRIPTION("Firmware parser for Qualcomm MDT format"); 482 513 MODULE_LICENSE("GPL v2");
+10
include/linux/soc/qcom/mdt_loader.h
··· 23 23 phys_addr_t mem_phys, size_t mem_size, 24 24 phys_addr_t *reloc_base); 25 25 26 + int qcom_mdt_pas_load(struct qcom_scm_pas_context *ctx, const struct firmware *fw, 27 + const char *firmware, void *mem_region, phys_addr_t *reloc_base); 28 + 26 29 int qcom_mdt_load_no_init(struct device *dev, const struct firmware *fw, 27 30 const char *fw_name, void *mem_region, 28 31 phys_addr_t mem_phys, size_t mem_size, ··· 51 48 const char *fw_name, int pas_id, 52 49 void *mem_region, phys_addr_t mem_phys, 53 50 size_t mem_size, phys_addr_t *reloc_base) 51 + { 52 + return -ENODEV; 53 + } 54 + 55 + static inline int qcom_mdt_pas_load(struct qcom_scm_pas_context *ctx, 56 + const struct firmware *fw, const char *firmware, 57 + void *mem_region, phys_addr_t *reloc_base) 54 58 { 55 59 return -ENODEV; 56 60 }