Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp406318pxb; Thu, 9 Sep 2021 03:47:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwWFAQ6ctHFOrCP02LIaMqM2f0PFeSIQZVy1i6IZ6GjqutRElGUcMxfCnYbad+FLXVpYKVU X-Received: by 2002:a17:906:265a:: with SMTP id i26mr2616350ejc.522.1631184462920; Thu, 09 Sep 2021 03:47:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631184462; cv=none; d=google.com; s=arc-20160816; b=b8d/asaibdQxi69m8hz0VIwzA/4Uq1368I+ScgLo1HNNeysAXX00acMOvuwxOoFG1h 6UU6hNyHgvpI37AIJDj+FFvMyj+eQ1DdS1Cowd+U4vJQpCyFB6s7X3aGCa8vzP3kpAXM o+n1BS2Pd/z6Zp0mCPsBK73x3kMJQrzAyan740xlLA2Sfzq8rct94DMAywf61JpUUA7H dSauUv9ho/bhEec2T58N+B5qKCmz3A3Ia1CsAJHJsZS4kem2rqKxZYCjNpyHGb1z6zNp 2ICeNzwgEI0USPxhX8XsL4lnWY9CIcemU8LxOmvtUSgKZmHF1Wze5dZHl1xiZY028LV7 gFCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:subject:cc:to:from:date:references:in-reply-to :message-id:mime-version:user-agent:dkim-signature:dkim-signature; bh=zjIGVs2CTSfPn8AaN0qQdBKPQtKqvzq2wmfTBbAMSSQ=; b=ajbo4njk7YX8ognWLBK5NOeZL3fnzqfD5i+LkwNoE2GdAv+GYGzBVF4Cbrj+b2GrrI Cka9IL9gi4YxZnDOGu9DFlsAi99/BVdt98wuGBowqrLAAy9RfvPvbH+LMTUdsH12+nxj 9LKemYUIaSG4veaRrDssDG8U5ra7xA1DjX5l+wl3qsyJgBKRj0oLKL7nCLEDuE2C4ObI LVa0tt3SQdMn8g7QkyBbW5pcmpKEbBswb03zTQUP7ACxjImOpusBn0F2c5ZMmv6GdX8U jE6GwSILRtbrzGjgcv3J+WoVp/4rRVNVOm6SwJwH677J160YtVRJmy1yJc+llskpfHDg ddqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@svenpeter.dev header.s=fm2 header.b="fj/s+jh7"; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=uSx4m4kg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=svenpeter.dev Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 4si1405400ejm.546.2021.09.09.03.47.18; Thu, 09 Sep 2021 03:47:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@svenpeter.dev header.s=fm2 header.b="fj/s+jh7"; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=uSx4m4kg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=svenpeter.dev Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234327AbhIIKqx (ORCPT + 99 others); Thu, 9 Sep 2021 06:46:53 -0400 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:47825 "EHLO out3-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234319AbhIIKqw (ORCPT ); Thu, 9 Sep 2021 06:46:52 -0400 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 39B0A5C01B2; Thu, 9 Sep 2021 06:45:41 -0400 (EDT) Received: from imap21 ([10.202.2.71]) by compute1.internal (MEProxy); Thu, 09 Sep 2021 06:45:41 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=svenpeter.dev; h=mime-version:message-id:in-reply-to:references:date:from:to :cc:subject:content-type; s=fm2; bh=zjIGVs2CTSfPn8AaN0qQdBKPQtKq vzq2wmfTBbAMSSQ=; b=fj/s+jh7Uib0rMCoCxGuDxNn2kpbAswm52/4fCPlbViD fDdjJOOKaDe9yiyE18zJNHzBvGzqswalewOo69DRh0fQp2Y79hcB3+2EIMUYOaig BLpliyouCg7CKy6hnw334EEf3dOMq3UqdDHT3//h/2RgMXSVOhnhoJJa6aHz3Hke sVXmId0PhEcI/UZlj3MkzcH6HDzI/aEqzSQW0uo20cGnfoQvy1hIocmP8D1xyAmT uHPuQOZuyw9ICwen9gzicq8s+gSIJK4N2sX2e4SQwWUa8vOULhmDJ7WNOsCWwq3Y x5VIFanVeOzgJSuylNyXiLurtpaBu51OwuVQP4NIvQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=zjIGVs 2CTSfPn8AaN0qQdBKPQtKqvzq2wmfTBbAMSSQ=; b=uSx4m4kgEySHfBqsvIYM5e HHSnI1utlcUFa5O+se5kaPWcXf5b70xYGZqS5/lo9WLfolkbp2mqtkRGC4JGpLWg UMRG0M1LAJRDjU+V4XRSZiUOYXztA7kKiNBrAXe5lK7Hqt7/ujfITEKlOWzRDCz0 27WQcF5OSNk7DmML/vbQM2EThNuSX7yaiTqPRS3veJvG6c3EtXaDYGbH97GkHSAV WDphF3WeYpjdTM/DYLMmqs2B0XS0I52iLt6GuFYrFvrhBEdKnVhDnuL/CQ9H9aVS nzY8qd6tCJD+gFMpH0QEdKHcb5nMJhDggOpY6USmlH4g/VYYRMs7J2JR0z9o9drA == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrudefledgfeefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepofgfggfkjghffffhvffutgesthdtredtreertdenucfhrhhomhepfdfuvhgv nhcurfgvthgvrhdfuceoshhvvghnsehsvhgvnhhpvghtvghrrdguvghvqeenucggtffrrg htthgvrhhnpefgieegieffuefhtedtjefgteejteefleefgfefgfdvvddtgffhffduhedv feekffenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpe hsvhgvnhesshhvvghnphgvthgvrhdruggvvh X-ME-Proxy: Received: by mailuser.nyi.internal (Postfix, from userid 501) id 45F5451C0061; Thu, 9 Sep 2021 06:45:40 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.5.0-alpha0-1229-g7ca81dfce5-fm-20210908.005-g7ca81dfc Mime-Version: 1.0 Message-Id: <8d646201-5257-47bd-b89e-d702051ff363@www.fastmail.com> In-Reply-To: References: <20210907145501.69161-1-sven@svenpeter.dev> Date: Thu, 09 Sep 2021 12:44:46 +0200 From: "Sven Peter" To: "Jassi Brar" Cc: "Rob Herring" , "Mark Kettenis" , "Hector Martin" , "Alyssa Rosenzweig" , "Mohamed Mediouni" , "Stan Skowronek" , "Devicetree List" , linux-arm-kernel , "Linux Kernel Mailing List" Subject: Re: [PATCH 0/3] Apple Mailbox Controller support Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Sep 8, 2021, at 22:48, Jassi Brar wrote: > On Tue, Sep 7, 2021 at 9:55 AM Sven Peter wrote: > > > > Hi, > > > > This series adds support for the mailbox HW found in the Apple M1. These SoCs > > have various co-processors controlling different peripherals (NVMe, display > > controller, SMC (required for WiFi), Thunderbolt, and probably more > > we don't know about yet). All these co-processors communicate with the main CPU > > using these mailboxes. These mailboxes transmit 64+32 bit messages, are > > backed by a hardware FIFO and have four interrupts (FIFO empty and FIFO not > > empty for the transmit and receive FIFO each). > > > > The hardware itself allows to send 64+32 bit message using two hardware > > registers. A write to or read from the second register transmits or receives a > > message. Usually, the first 64 bit register is used for the message itself and > > 8 bits of the second register are used as an endpoint. I originally considered > > to have the endpoint exposed as a mailbox-channel, but finally decided against > > it: The hardware itself only provides a single channel to the co-processor and > > the endpoint bits are only an implementation detail of the firmware. There's > > even one co-processor (SEP) which uses 8 bits of the first register as its > > endpoint number instead. > > There was a similar discussion about the BCM2835 / Raspberry Pi mailboxes > > which came to the same conclusion [1]. > > > > These mailboxes also have a hardware FIFO which make implementing them with the > > current mailbox a bit tricky: There is no "transmission done" interrupt because > > most transmissions are "done" immediately. There is only a "transmission fifo > > empty" level interrupt. I have instead implemented this by adding a fast-path to > > the core mailbox code as a new txready_fifo mode. > > The other possibilities (which would not require any changes to the core mailbox > > code) are to either use the polling mode or to enable the "tx fifo empty" > > interrupt in send_message and then call txready from the irq handler before > > disabling it again. I'd like to avoid those though since so far I've never seen > > the TX FIFO run full which allows to almost always avoid the context switch when > > sending a message. I can easily switch to one of these modes if you prefer to > > keep the core code untouched though. > > > Yes, please keep the api unchanged. > Let us please not dig our own tunnels when the existing ways serve the purpose. > Ok, I'll use txdone_irq for v2 then and just ignore the HW FIFO. Thanks, Sven