From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.221.69 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1792750603; b=bCEMbJbt3x2A7KazbCdcsgbfMGwVrTTj0IDVKNo2IfQDTBcLJ7ECsJtqNZALbWX1B3+h MbmdOQTkqQ7ermtvp6/9XuELMamdH6efwBmF0mIq2+W46inSv5H1E8kpxb9InSm6fJbzR bw6MNFglrBza0urOLOTLIpdj5FZ4j35FCeZZwQjiPMg8VQFPKNqWna3CCsqSvEVm8P6cs vdvq0Z/b6jbx2J/wCS/nunhKEjjcDQeC+FbO/VGaEDJr6hXMbYF8L2905Y0ZgRInyG4vx RayxG0ebf4JR5GECiq749tbz2s06vh7ijrbfCyHRLbd9Fem3+LphNBJFWnWrcui+G9g== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1792750603; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Gm-Message-State:X-Received:Date:In-Reply-To:Mime-Version: References:X-Mailer:Message-ID:Subject:From:To:Cc:Content-Type; bh=/z+CNiWz7aa6AS1V1mN86DIGD1P9Q5f6dX5ydwPWWJ8=; b=DtxmrartjJ89jJsWrYYzd3cKlyCdNpRhgXnOJG1LPaWCKYENYGomY2pII5DRDYyACWv+ a8BSwpSb5lNy0uP/KT/y2ilB4iNnv/M3fksPMFNQXl/81Q2V3uy7lKIRrCMpsxLjZnC8s PuxQWet4mMWXXF30VNbgB44QyD7AGVvV10Hlqop5y+u6Btix3T9B0DTfwgnOBtzIigxc7 uzRdIt4khIiL0oC8S6dsAThOqPgAjAR1qh+pM7WTwb8SVg+Enr7gv1KDOJMqyVse53+qQ PedPTvIXrtFf8OnBQgtI4YHYl9/wWnC2h3lC1cpzCDJauwmnyx99UAqZcIObL29Zlcw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=google.com; spf=pass smtp.mailfrom=flex--smostafa.bounces.google.com; dkim=pass header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20251104 header.b=QjncHXzV; arc=none smtp.remote-ip=209.85.221.69 Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A19CD606A32D for ; Fri, 23 Oct 2026 10:16:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org A19CD606A32D Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--smostafa.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20251104 header.b=QjncHXzV Received: by mail-wr1-f69.google.com with SMTP id ffacd0b85a97d-48b01a74792so475486f8f.0 for ; Fri, 23 Oct 2026 03:16:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1792750596; x=1793355396; darn=vger.kernel.org; h=content-type:cc:to:from:subject:message-id:references:mime-version :in-reply-to:date:from:to:cc:subject:date:message-id:reply-to :content-type; bh=/z+CNiWz7aa6AS1V1mN86DIGD1P9Q5f6dX5ydwPWWJ8=; b=QjncHXzVqh8zHbTAxnjVY0N8VzXDR70plAjCDKAabNbo1hsw9DqwCx5SyR7SCwOh7e jVgwxcf0zmCg/w+KYUn+2gIrMf9mMTVd1qW78Oe/EuDXm2PtJ163wPwLlqsrXvQ2f0LH O9Ak3UiRb9qdookhCrOwSDeuiy2nSEY6ijemnARRHVgJTGj5fluPCEvwJykaVbEaNoN9 q3cb9+BO4+rff3u1vzHAqxJNp5a0eRx2I3jA5/aHbEZjsI2TJmcqhmOuolWFj553wtRW qoqtZmazAWwQwVeoJ2MAcx80ifdMJ3YzmLQKYSAxVfdVpiptiOr1HfBVm995w9MsgCAH P5gg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1792750596; x=1793355396; h=content-type:cc:to:from:subject:message-id:references:mime-version :in-reply-to:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=/z+CNiWz7aa6AS1V1mN86DIGD1P9Q5f6dX5ydwPWWJ8=; b=M/PAoytzHYftOFq19FYwsPJS535Jn5fg7AzNANzILdKxnvrdx0yx/ViHngKQwRwJPB o5lAiU1Pqi07bMDW0AcLYpXvT1KyYgnMjDqcAKM32Z1EBRxexqNO5i31W0ZQNVdOucCL ma51KyE8VCBsQXX9D7eyk4T3xicHL0FGbS9DdQqUd5liYrUY8thhLXbBqiPDlLBBU8Kh qzMDRue0vY0E0g4JEenzFUjNbqEVwy1FGDW/X2ycOuZeFQTLYAErM1lwQE7VMBQO64Y8 qdSXf2sDy9XIDM68G3cXlBVT0gobTHy+jNWXXZKArMXNJo/Ax4jvtoI7m3qqoJAzHRaI VI/A== X-Gm-Message-State: AFq9FYL3GijfDTwfgol9w8ItRKpn3s6aozUuO/3yI2dO8qYmMzetKR7A IEkGn8eeXLlTbmzO3vfXdMbX2+91z6Zuu2UmfzKhfqkZVETsXChhfqzeLx+0ZcrCmK27Iqyt6zg 6MtlpO1Gishq2Wg== X-Received: from wmoo1.prod.google.com ([2002:a05:600d:101:b0:4a2:1396:ef32]) (user=smostafa job=prod-delivery.src-stubby-dispatcher) by 2002:a05:600c:1909:b0:4a2:1398:dd05 with SMTP id 5b1f17b1804b1-4a21398df21mr25661445e9.16.1792750595975; Fri, 23 Oct 2026 03:16:35 -0700 (PDT) Date: Fri, 23 Oct 2026 10:15:36 +0000 In-Reply-To: <20261023101536.3965344-1-smostafa@google.com> X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Mime-Version: 1.0 References: <20261023101536.3965344-1-smostafa@google.com> X-Mailer: git-send-email 2.56.0.307.g5fe7bd680c-goog Message-ID: <20261023101536.3965344-3-smostafa@google.com> Subject: [PATCH v2 2/2] dmaengine: qcom: bam_dma: Do not touch remote BAM in remove() From: Mostafa Saleh To: linux-kernel@vger.kernel.org, dmaengine@vger.kernel.org Cc: linux-arm-msm@vger.kernel.org, vkoul@kernel.org, Frank.Li@kernel.org, bartosz.golaszewski@oss.qualcomm.com, Mostafa Saleh , Frank Li Content-Type: text/plain; charset="UTF-8" Unbinding the crypto BAM through sysfs on X1P42100 resets the board. bam_dma_remove() clears BAM_IRQ_SRCS_MSK_EE unconditionally. For a BAM that is controlled or powered remotely the register may not be accessible: the clock and power of the block belong to the remote side or to the consumer of the BAM, which is why bam_init() already avoids every register access for such a BAM when the DT provides num-channels and qcom,num-ees. The write is also unnecessary. On a remotely controlled BAM the driver only ever sets per channel bits in the EE mask, in bam_chan_init_hw(), and bam_free_chan() clears them again. Both run on behalf of a consumer, which keeps the block clocked while they do. Skip the write for both kinds of remotely managed BAM, using the same condition as bam_init(). Fixes: 5172c9eb89d4 ("dmaengine: qcom: bam_dma: add controlled-remotely dt property") Reviewed-by: Frank Li Signed-off-by: Mostafa Saleh --- drivers/dma/qcom/bam_dma.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/dma/qcom/bam_dma.c b/drivers/dma/qcom/bam_dma.c index 8a1f4e5d24d1..e01f0fec1599 100644 --- a/drivers/dma/qcom/bam_dma.c +++ b/drivers/dma/qcom/bam_dma.c @@ -1407,8 +1407,15 @@ static void bam_dma_remove(struct platform_device *pdev) dma_async_device_unregister(&bdev->common); pm_runtime_get_sync(&pdev->dev); - /* mask all interrupts for this execution environment */ - writel_relaxed(0, bam_addr(bdev, 0, BAM_IRQ_SRCS_MSK_EE)); + + /* + * Mask all interrupts for this execution environment. A remotely + * controlled or powered BAM is left alone: it may be unclocked, and + * the only bits this driver sets in its mask are the per channel + * ones that bam_free_chan() cleared. + */ + if (!bdev->controlled_remotely && !bdev->powered_remotely) + writel_relaxed(0, bam_addr(bdev, 0, BAM_IRQ_SRCS_MSK_EE)); free_irq(bdev->irq, bdev); -- 2.56.0.307.g5fe7bd680c-goog