From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f47.google.com (mail-wr1-f47.google.com [209.85.221.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 94AD83E7173 for ; Wed, 19 Aug 2026 10:00:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.47 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787133652; cv=none; b=iD6e1x1yletX5GHJBfPP5d0EuBL1T+t+h2b3N2FNjnig3btHaihk1UXOp2/CJQu7mMLf03CqJ7f55woHYhImN+xWd4S/VafHNS6gG1Iq6cZx4IxZjCJ8csyy3KdF9/tOv5mG9lngjA8iSf2865cNX7NAOOss7AR2Iu21Ce0ZsFE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787133652; c=relaxed/simple; bh=XlRQY1yElOfjw2da5zx2WUtNBeHVirEa1Gb3u3yXApE=; h=Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition; b=t1T36UHQteTvZh9HkUSKU94k/Lapxf+V0pr6dMitxyj3/RI9WG6RQ/EiY3ZTTJa/pH9kLXF0v5Nk4vdkF7ctIEMb5YGRmgXbkYZh997D5NErgiLD1qJy4AclNZEePqJIciwkYFtBeRjj2nG3zRcZEg5QdWtSn7Qle2VJHWHdtKU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com; spf=pass smtp.mailfrom=baylibre.com; dkim=pass (2048-bit key) header.d=baylibre.com header.i=@baylibre.com header.b=aJj+nqrE; arc=none smtp.client-ip=209.85.221.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baylibre.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=baylibre.com header.i=@baylibre.com header.b="aJj+nqrE" Received: by mail-wr1-f47.google.com with SMTP id ffacd0b85a97d-47f3b39f2a1so663181f8f.2 for ; Wed, 19 Aug 2026 03:00:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre.com; s=google; t=1787133647; x=1787738447; darn=vger.kernel.org; h=content-disposition:content-type:mime-version:message-id:subject:cc :to:from:date:from:to:cc:subject:date:message-id:reply-to :content-type; bh=8i49oOXd/zUkT4DsLFNF4R7qWyXYlreraRRDMMzhyUI=; b=aJj+nqrE9Ge+DSS0X1axnyPcCGYsLVc3WFL0hWvmjpZk2nU17uWDI45yI0USA1GQyh C5K6hhqyQGUPWsF0iTRIx7i+KN6luEe6kfnoScLit4YABRtnyQAxJY+vFuIRhS8BoGHJ vKKjC5xZEwE/gsuC2xPtYaaheRjJkfHAA2wmGZK6G7Cx2jkX5tS1BrPXdFUlyymgPUyR eLdLkiS5QT1MRFlF3Lb2Y/ORo/25Pm6PD7Z4G6fNrDIZbtu6QOdX5TWOak/6tDRYr7j1 qP0T/LLE/YldStuqU6GwW3wc7fCBOoPbG468LS4r3HW57T3eLi8czEy3adSArlOxa28m Jiag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787133647; x=1787738447; h=content-disposition:content-type:mime-version:message-id:subject:cc :to:from:date:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=8i49oOXd/zUkT4DsLFNF4R7qWyXYlreraRRDMMzhyUI=; b=YI4elFKEkEZWf5jPWSiZnW7/jFmco8OpDIOUKRNXeyM7zeChC0HTkaOaMDcsSdk48b 1BcaknnYZBhK7TQ32zlVCYMlaIpvGLHd/pmapI1iRgrvT9UH/G6gHY/RS2ZphU1+hCE7 g3Qydim+vuhHIyMpO+LzQ2rGXuCP4dyh1NYLQI3Ng5Zngtr4dY+Grx1VhBiXDPo611vi vyJddFFAvwtj/gZNhedj0Gz9WwKf44y2ql1YEKusQLUG7fC5Kt83soiTLcVDSmjLAlFJ 6Zb3NpEWX3yUL4akmBwGFC1pbbG8wLx2VA6huu6JhqNXK5BXY1s7Xg6dC4mqyhk2u4re x7gg== X-Gm-Message-State: AOJu0YwMkZpbtUgjgJmsjgOJMF5E9giHGzmHTkCcXenu2O6CuDkwk53a zypoeXOJ87DvPhbv7kEb5wTd9oO3kpo8nXKGEyO76u+0QYtej6YP6IPZenU8kfQmExM= X-Gm-Gg: AR+sD10B6fMZy13cH8mvdUX9T9mrlyLQYU2fmCRLfAW6Q7EHnEO34KgSj8ggpvS4T7D 50gpyFrpTQOTlkyojlXPOqZbEDiqvw0woxEoZPs/Y9UYQjxZAT/Nq8xxgcjqwVBk+RErwzzwy5b 7tq+c/eCy2kQXvG0HOG2GM+8Lg+6ELnGms0J6IwvA1u9AwNPOAFqla+N2tE/RwO49eHz5MKVtD8 MCiN2UhtJkrZyQWFqOq27z1Y9+/7v3h1U2GGsXGudnRG07b1PRkfRBkjtrUz7dzCuqgGzYBP6qF 5ILasCzZMelxa43b8mLiUxTkbG6qHfk4hXiIRlCsracK/vbYEEtEublozFNSbUKXSm6nW+i+XNf 9+gjWWSL04f9023YsjqK2qqWqOcbWOsvPEdpcgUGmo/pvVMV/SWaTzzmXyZt0vnL4YevymuSWZs uvRR5rlB+WED4HseOXtVaaHH6lJOEcKMfMLm7arqVPSJsAIzXMTR41y1XcCf+ztZYdOHSN61KiJ qXKhwBV1AQb4+qmhOnm1/jSNl2+rOlJJywfN3yq/78JyDiSFKR6 X-Received: by 2002:a05:600c:4e94:b0:499:78b3:7b36 with SMTP id 5b1f17b1804b1-499aa1b549cmr57733785e9.11.1787133646038; Wed, 19 Aug 2026 03:00:46 -0700 (PDT) Received: from localhost (p200300f65f0171046476c804efde8023.dip0.t-ipconnect.de. [2003:f6:5f01:7104:6476:c804:efde:8023]) by smtp.gmail.com with UTF8SMTPSA id 5b1f17b1804b1-499aa0d6a84sm45502655e9.10.2026.08.19.03.00.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Aug 2026 03:00:45 -0700 (PDT) Date: Wed, 19 Aug 2026 12:00:43 +0200 From: Uwe =?utf-8?Q?Kleine-K=C3=B6nig?= To: Jassi Brar Cc: linux-kernel@vger.kernel.org Subject: signaling txdone for synchronos mailboxes Message-ID: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="kuixrm6ljgc5np27" Content-Disposition: inline --kuixrm6ljgc5np27 Content-Type: text/plain; protected-headers=v1; charset=us-ascii Content-Disposition: inline Subject: signaling txdone for synchronos mailboxes MIME-Version: 1.0 Hello, I'm working on porting a mailbox/remoteproc driver from a vendor tree[1] to mainline. One thing that is unclear to me is how txdone should be signalled on that hardware. On that platform there is no feedback on how/when the remote side saw/processed the message and the local side is immediately ready to send the next signal. So both MBOX_TXDONE_BY_IRQ and MBOX_TXDONE_BY_POLL are ruled out. It's not completely clear to me how MBOX_TXDONE_BY_ACK is supposed to work and thus also if that is the way to go for that driver. Who is supposed to call mbox_client_txdone()? From what I read I'd expect that it should be called by the client once it saw some return signal---probably using a higher level protocol? My current workaround is that mbox_client_txdone() is called directly after mbox_send_message(), but that feels wrong because then the client has to know the that mailbox in use needs that function call to progress. So a saner approach would be to call tx_tick() from the .send_data() callback as there it's known that the controller needs it. Currently that doesn't work directly as &chan->lock is held by msg_submit() when .send_data() is called and tx_tick() grabs that lock, too. If that is the right approach, we'd need a variant of tx_tick() that assumes that the lock is already taken. Does that make sense? Looking at the first few callers of mbox_client_txdone(): - drivers/acpi/cppc_acpi.c has: mbox_send_message(pcc_ss_data->pcc_channel->mchan, &cmd); ... ret = check_pcc_chan(pcc_ss_id, true); ... if (pcc_ss_data->pcc_channel->mchan->mbox->txdone_irq) mbox_chan_txdone(pcc_ss_data->pcc_channel->mchan, ret); else mbox_client_txdone(pcc_ss_data->pcc_channel->mchan, ret); That looks like the client has to know stuff about the internals of the mailbox, which is ugly and feels like an incomplete abstraction. - drivers/clk/hisilicon/clk-hi3660-stub.c has: mbox_send_message(stub_clk_chan.mbox, stub_clk->msg); mbox_client_txdone(stub_clk_chan.mbox, 0); and so also knows that the used mailbox has MBOX_TXDONE_BY_ACK and instantly assumes the message to be sent. - drivers/crypto/bcm/cipher.c is similar to drivers/acpi/cppc_acpi.c - drivers/devfreq/hisi_uncore_freq.c looks as if it should use MBOX_TXDONE_BY_POLL. - drivers/dma/bcm-sba-raid.c is similar to drivers/acpi/cppc_acpi.c, too - drivers/firmware/arm_scmi/transports/mailbox.c seems to be a legitimate user of mbox_client_txdone(), only calling it after some reply was received from the other side. I wonder however how the driver knows that the used mailbox uses MBOX_TXDONE_BY_ACK? Any thoughts? Best regards Uwe --kuixrm6ljgc5np27 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEP4GsaTp6HlmJrf7Tj4D7WH0S/k4FAmqFfsgACgkQj4D7WH0S /k659wf/bR1UrtUBHHqb1aOqngopLNyPuc9E2GcOIFePV+Gd0GNHnCucBmdC9Mce h3pWuAxS1HUsR3VXTdIMdKttDXaVeSV8brkp9kDjXkjYwBa0r+hxSkT4k+C8/vHK P8PDzZ63N8H2jruzOKAvdLEB9Sux+JpGRAxZnLE9YbzBrL6Mbez1pyodqAZp3opA e1aySMmH51Nw4e/XA3fYtqgSAZN/kWxxEbQ1fRU11ZBIhwwtlxX9sGJHItEseNWb DHYM4KNco35qy7vi/6QK6B3fYxBZVIlLIq9BhejiTc3Z1K4FQKD9/2t/RfX2wV6i SiuQPCXweW0amyan89cgTlYft7Azuw== =waJ9 -----END PGP SIGNATURE----- --kuixrm6ljgc5np27--