From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D7B9D266581 for ; Mon, 14 Sep 2026 12:42:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789389759; cv=none; b=DGlatdznGBU9IxkKEDYPhF3+wpCy/7BI3M61WCoNha2rnrLiUaUzm+7V5L9LmoVavODSqQ92Icv3r0sZdjkU17t4Cvvq4jbxVyMAmrWosZ4D+EBEpeWH4IT6kJ70IgQxdYQ3/D6gFGFQis8v1sAAXufgrl/Jr2CTerahMHLMWg8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789389759; c=relaxed/simple; bh=kKUjFxTDzaIvfCLVxP1OmjKiQRgwNhTIUBFn6PNx22w=; h=From:Subject:Date:Message-Id:MIME-Version:Content-Type:To:Cc; b=qLUZu6pdEdiKeozauwTYMK3cl0biKqvkV5fh60AvhYzofLi77J7i6GorUdvDTayMVD9uki2vZkAM4RE7z0iNidV2wHH5TFdbm06dnmN63hROxUXcYkITp0oeU7t+m+oPDrBCU98Vqm4QE+aCGLfUMNhHCKjo6W3+JlzeTZ9R+fA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=h+UzS8wi; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="h+UzS8wi" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1789389755; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=gS0PasUdCVmtQZHlDSGBeMxyLgFshGbkXoV5dyvEzpg=; b=h+UzS8wicisDrfQ2zgj83WBNhOcXFHs9eWa1QJ0ZlK+Q39BCS1wTL+GZa7G5WituAmNsxs 7D1eA9rbPCKl0rpQxzXZ7aR8lWJLLy+KzA3OTIqwspmllevtB2lhYF4wbYKCmidN5EmdvH ZdvYWq1xOHJVMV4EXf4uUPd0T34a+EA= Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-546-ud337pCmNmmsQShMmbfDjA-1; Mon, 14 Sep 2026 08:42:31 -0400 X-MC-Unique: ud337pCmNmmsQShMmbfDjA-1 X-Mimecast-MFC-AGG-ID: ud337pCmNmmsQShMmbfDjA_1789389749 Received: from mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.95]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 01899180ABEA; Mon, 14 Sep 2026 12:42:28 +0000 (UTC) Received: from aesteve-thinkpadp1gen8.rmtes.csb (headnet05.pony-001.prod.iad2.dc.redhat.com [10.2.32.117]) by mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id B83C341D; Mon, 14 Sep 2026 12:42:13 +0000 (UTC) From: Albert Esteve Subject: [PATCH 0/3] firmware: qcom: scm: pass struct qcom_scm through the API Date: Mon, 14 Sep 2026 14:41:53 +0200 Message-Id: <20260914-scm-device-api-v1-0-3573e2596c51@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-B4-Tracking: v=1; b=H4sIAAAAAAAC/x2MQQqAIBAAvyJ7bsE0tPpKdBBdaw+VKEQQ/j3pO DAzLxTKTAVm8UKmmwtfZ4O+E+B3d26EHBqDksrISY5Y/IGhiZ7QJUajB+ets1FbCy1KmSI//3B Za/0AntZYi2AAAAA= X-Change-ID: 20260908-scm-device-api-634ac7a7f377 To: Bjorn Andersson , Konrad Dybcio , Philipp Zabel , Russell King , "Rafael J. Wysocki" , Daniel Lezcano , Christian Loehle , Maximilian Luz , Bartosz Golaszewski , Rob Clark , Sean Paul , Akhil P Oommen , Dmitry Baryshkov , Abhinav Kumar , Jessica Zhang , Marijn Suijten , David Airlie , Simona Vetter , Will Deacon , Robin Murphy , "Joerg Roedel (AMD)" , Thomas Gleixner , Radu Rendec , Vikash Garodia , Dikshita Agarwal , Bryan O'Donoghue , Mauro Carvalho Chehab , Srinivas Kandagatla , Ekansh Gupta , Arnd Bergmann , Greg Kroah-Hartman , Jeff Johnson , Linus Walleij , Mathieu Poirier , Amirreza Zarrabi , Jens Wiklander , Sumit Garg , Amit Kucheria , Thara Gopinath , Zhang Rui , Lukasz Luba , Brian Norris , Govind Singh , Niklas Cassel , Kalle Valo Cc: linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, iommu@lists.linux.dev, linux-media@vger.kernel.org, linux-wireless@vger.kernel.org, ath10k@lists.infradead.org, linux-gpio@vger.kernel.org, linux-remoteproc@vger.kernel.org, op-tee@lists.trustedfirmware.org, Maxime Ripard , Albert Esteve X-Developer-Signature: v=1; a=ed25519-sha256; t=1789389733; l=4126; i=aesteve@redhat.com; s=20260827; h=from:subject:message-id; bh=kKUjFxTDzaIvfCLVxP1OmjKiQRgwNhTIUBFn6PNx22w=; b=ptN78nZt4fGWWnpdDZyVENIgI04y8a4PWpV9Q7ESU1lJXI6I5/2224GMHxqfT8NR3RqXorNth jHJX4SMRZ0tCfmG8DtbgRZpcTf2pE4dns304nz4VWJerDfTGzhcT+6A X-Developer-Key: i=aesteve@redhat.com; a=ed25519; pk=zI2RBeZgocwYm3AkJW4CtjoJnKoDZrfBl1xe5Ed6h+U= X-Scanned-By: MIMEDefang 3.6 on 10.30.177.95 The SCM driver still funnels every call through a process-wide __scm singleton. This series threads struct qcom_scm through the driver and the exported API, then drops the global. Series summary -------------- Patch 1: Internal helpers take the instance. Callbacks that only have a struct device or reset_controller_dev recover it with drvdata / container_of. Exported signatures stay unchanged so this patch is bisectable on its own. Patch 2: Exported calls take struct qcom_scm * as the first argument. The type stays opaque in qcom_scm.h. Children of the SCM device (qseecom, tzmem, qcomtee) use dev_get_drvdata() on the parent. Other consumers call qcom_scm_get(), which finds the bound platform device and returns NULL until probe has marked the instance ready. Callers that need SCM return -EPROBE_DEFER; callers that only use it for an optional path (rmtfs VMIDs, fastrpc vmids, PAS region assign, Venus CP, HDMI HDCP, Adreno fuse poke) skip the lookup or tolerate NULL. qcom_pas_* is unchanged: PAS has a TEE backend, so those ops keep struct device * and the SCM backend uses drvdata. Patch 3: Drop __scm. Readiness is scm->available with the same release/acquire pairing as today. Module-parameter stores reuse qcom_scm_get(); shutdown uses platform_get_drvdata(). No intended change in SCM calling convention or wait-queue behaviour. Testing ------- Booted to a shell on Qualcomm SA8775P Ride4 with current series. qcom_scm bound as firmware:qcom_scm; probe logged SMC ARM 64 and the tz-ffi reserved-memory assignment. Consumers were not exercised. Suggested-by: Maxime Ripard Signed-off-by: Albert Esteve --- Albert Esteve (3): firmware: qcom: scm: pass qcom_scm to internal helpers firmware: qcom: scm: pass qcom_scm through the exported API firmware: qcom: scm: drop the __scm global arch/arm/mach-qcom/platsmp.c | 3 +- drivers/cpuidle/cpuidle-qcom-spm.c | 28 +- drivers/firmware/qcom/qcom_qseecom.c | 3 +- drivers/firmware/qcom/qcom_scm-smc.c | 2 +- drivers/firmware/qcom/qcom_scm.c | 518 +++++++++++++---------- drivers/firmware/qcom/qcom_scm.h | 2 +- drivers/firmware/qcom/qcom_tzmem.c | 6 +- drivers/gpu/drm/msm/adreno/a6xx_gmu.c | 6 +- drivers/gpu/drm/msm/adreno/adreno_gpu.c | 8 +- drivers/gpu/drm/msm/hdmi/hdmi_hdcp.c | 6 +- drivers/iommu/arm/arm-smmu/arm-smmu-qcom-debug.c | 9 +- drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c | 8 +- drivers/iommu/arm/arm-smmu/arm-smmu-qcom.h | 3 + drivers/iommu/arm/arm-smmu/qcom_iommu.c | 18 +- drivers/irqchip/qcom-pdc.c | 6 +- drivers/media/platform/qcom/venus/firmware.c | 10 +- drivers/misc/fastrpc.c | 31 +- drivers/net/wireless/ath/ath10k/qmi.c | 12 +- drivers/net/wireless/ath/ath10k/qmi.h | 3 + drivers/nvmem/sec-qfprom.c | 6 +- drivers/pinctrl/qcom/pinctrl-msm.c | 11 +- drivers/remoteproc/qcom_q6v5_mss.c | 6 +- drivers/remoteproc/qcom_q6v5_pas.c | 12 +- drivers/soc/qcom/ice.c | 23 +- drivers/soc/qcom/ocmem.c | 22 +- drivers/soc/qcom/rmtfs_mem.c | 8 +- drivers/tee/qcomtee/call.c | 7 + drivers/tee/qcomtee/core.c | 6 +- drivers/tee/qcomtee/qcomtee.h | 2 + drivers/thermal/qcom/lmh.c | 22 +- include/linux/firmware/qcom/qcom_qseecom.h | 5 +- include/linux/firmware/qcom/qcom_scm.h | 117 ++--- 32 files changed, 566 insertions(+), 363 deletions(-) --- base-commit: bc35965f6940a9bf834d54187b6088b8eb09206d change-id: 20260908-scm-device-api-634ac7a7f377 Best regards, -- Albert Esteve