From patchwork Thu Oct 17 16:36:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tudor Ambarus X-Patchwork-Id: 13840358 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8F84BD3C523 for ; Thu, 17 Oct 2024 16:38:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=Fg01EDslkFVUhzMkkUb4hB5z0mSu8A5C2uHNCojkyKY=; b=bYnT9t868qFqb42isLqNh8VwNw GhLfgfSTj6DMhLEzNhw8H5PyKb3AkQknvLI7h32Hd6OT2fh+6MIy+/EJbYJiD3rxmu9xXw5hIu3t8 WVcjWcdnKFODSYGPZJ8tF1GfIGWxqBI/el5vkP1JPQii8WOB5q5d6omqHE+NfOrUNWOIxdZke1u2N gFGWBU9uQjfgsGEdTyjRzWhtNoK3QsZJ4PeyZ1zfzMyM5ejQL90gOXMmMHnx7FpWY2T7MzX+mNBgE VERGdeq8LyHG8ukmFyRvNsXzzrV+WwknYp/kDohAjwwMiMJ9zcsIFfn/0hfATXqOcqdxnBaWsPNSd nhyR0ktA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t1TWQ-0000000FX6m-3FT0; Thu, 17 Oct 2024 16:38:46 +0000 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t1TUi-0000000FWoB-1RN3 for linux-arm-kernel@lists.infradead.org; Thu, 17 Oct 2024 16:37:04 +0000 Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-43115887867so8461805e9.0 for ; Thu, 17 Oct 2024 09:36:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1729183018; x=1729787818; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=Fg01EDslkFVUhzMkkUb4hB5z0mSu8A5C2uHNCojkyKY=; b=gTrYXY9pNlFbYBEqN5vv4q/vnqi/xTdLxWupttkbweSh65lHKK0yHzcd1dPPQkWeC7 odqdK00HwAGnDORAhFtrQ3WbGQG21yteX6kWvBLxYcjnlsv0Lmnp8R37Au2iX0EaGoHm jd3ya9KNYwkSoxEFb/3lyOTMVDQILhIq8GIG9mJvNrj+nQX7XOWS/EFAjArfFbCQ9Wax LOuz7A+194/dyO6NL0VsjSD+NaQgYS6lHbfBikwX2lZCGmmPyPmpXlvtMauEVReD56Yk Y/Hw3tLARHo5N5QI9Hq2IZW/Q4px7fADgBBWPh9IJwvBM+XzdvODK1d2jppW4AKRXZJX 9oOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729183018; x=1729787818; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Fg01EDslkFVUhzMkkUb4hB5z0mSu8A5C2uHNCojkyKY=; b=gb6XKo3RP7FcCANKNJ/xrYPka6nIFo5Bt6cZyrU2E7x78Pe6ExnJeKOy8dFdoGMCGv p7z/XKlARKfs0C7b+wfk5OCIFfss0Ide6YdG5K9yTsZ3h5mHss4TbEaIou3ADm7Xvk0X wX/9C30fGogV3nFKFEVnIkkq9BV6t0ApynWBJEQ1UUANkbmg3uMeNq4FjA0k8D6o4Jc9 kkoaOkHcNXffKAuXWamzlKQylE/AQXR+JxwHUOzxQ4Q3I1UYsTMmpnDN6N7HU4uyW7qf eSR+CP4X+OD7yszwPV9DX948EWu74PgQ/clZcR07u+6QUW8SUTdJnOgUx3yMoCLlkNi/ J+4Q== X-Forwarded-Encrypted: i=1; AJvYcCURW/6FghwyL/YUiuTt8H5WeFvf25aN2Zl8zbQuvVlUiuo4Sm0LqXdoNvSm3BuuVkyAabITwk8y4GMZyPhHVNAC@lists.infradead.org X-Gm-Message-State: AOJu0Yx/gHz0D3JDJx5Q7ZhQqltP0NrH5ZOljQ+41tG6AXhlFxDJlbR/ PDpc67bDpqHbRNF5u+meBqarbG4fFtef5am21tDBM5rbAsLffuxjYhjdVQv1jLU= X-Google-Smtp-Source: AGHT+IFRSodLproKws30Fwmeh9U5gZJ48F5btqXXPZbS12I3VrKrnbwPTFo3tKyGKXkjTmOb9njy7w== X-Received: by 2002:a05:600c:1f12:b0:431:5226:1633 with SMTP id 5b1f17b1804b1-431587173a2mr26093615e9.6.1729183017642; Thu, 17 Oct 2024 09:36:57 -0700 (PDT) Received: from ta2.c.googlers.com.com (32.134.38.34.bc.googleusercontent.com. [34.38.134.32]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-37d7fc11aefsm7710376f8f.93.2024.10.17.09.36.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Oct 2024 09:36:57 -0700 (PDT) From: Tudor Ambarus To: jassisinghbrar@gmail.com, krzk@kernel.org Cc: alim.akhtar@samsung.com, mst@redhat.com, javierm@redhat.com, tzimmermann@suse.de, bartosz.golaszewski@linaro.org, luzmaximilian@gmail.com, sudeep.holla@arm.com, conor.dooley@microchip.com, bjorn@rivosinc.com, ulf.hansson@linaro.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, marcan@marcan.st, neal@gompa.dev, alyssa@rosenzweig.io, broonie@kernel.org, andre.draszik@linaro.org, willmcvicker@google.com, peter.griffin@linaro.org, kernel-team@android.com, vincent.guittot@linaro.org, daniel.lezcano@linaro.org, Tudor Ambarus Subject: [PATCH v2 0/2] mailbox: add async request mechanism w/ a user Date: Thu, 17 Oct 2024 16:36:47 +0000 Message-ID: <20241017163649.3007062-1-tudor.ambarus@linaro.org> X-Mailer: git-send-email 2.47.0.rc1.288.g06298d1525-goog MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241017_093700_416050_1FDB5BEF X-CRM114-Status: GOOD ( 17.36 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi, This adds a simple mailbox async mechanism, similar to the one found in the crypto subsystem. It empowers mailbox controllers with hardware queue support. It then adds a user for this mechanism, the ACPM driver. ACPM (Alive Clock and Power Manager) is a firmware that operates on the APM (Active Power Management) module that handles overall power management activities. ACPM and masters communicate with each other using mailbox messages and shared memory (mmio-sram). The shared memory contains channel configuration data. It exposes at a specific offset into the memory the channel ID, message and queue lengths, pointers to the TX and RX queues (which are also part of the shared memory), and whether the RX queues work by polling or interrupts. It resembles in a way to the arm-scmi driver as that too uses mailbox messages and shared memory to communicate with the firmware. The set is marked as v2 because the mailbox core patch was already sent for review a few weeks ago: Link: https://lore.kernel.org/linux-arm-kernel/20241004165301.1979527-1-tudor.ambarus@linaro.org/ If everyone is happy with the current form of the set, we'll probably need an immutable tag/branch to be shared between the mailbox and firmware trees. Thanks, ta Changes in v2: - add the exynos acpm driver - new patch. - extend the mailbox request with rx and tx len - let the client decide how much to write and get back from the controller. The controller can verify the lengths by comparing them with its channel length. - extend the mailbox request with flags, in particular with MBOX_REQ_MAY_SLEEP. All requests that don't set this flag are considered in atomic context. - remove a dereference that was done before checking for null. - update the commit message, rebased on top of v6.12-rc3. Tudor Ambarus (2): mailbox: add async request mechanism to empower controllers w/ hw queues firmware: add exynos acpm driver drivers/firmware/Kconfig | 1 + drivers/firmware/Makefile | 1 + drivers/firmware/samsung/Kconfig | 11 + drivers/firmware/samsung/Makefile | 3 + drivers/firmware/samsung/exynos-acpm.c | 703 ++++++++++++++++++++ drivers/mailbox/mailbox.c | 127 +++- include/linux/mailbox/exynos-acpm-message.h | 21 + include/linux/mailbox_client.h | 4 + include/linux/mailbox_controller.h | 7 + include/linux/mailbox_request.h | 33 + 10 files changed, 888 insertions(+), 23 deletions(-) create mode 100644 drivers/firmware/samsung/Kconfig create mode 100644 drivers/firmware/samsung/Makefile create mode 100644 drivers/firmware/samsung/exynos-acpm.c create mode 100644 include/linux/mailbox/exynos-acpm-message.h create mode 100644 include/linux/mailbox_request.h