Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp845095pxb; Wed, 8 Sep 2021 13:50:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyxbPFSc+9w/5Pv2ChldHhPxPf1nQ6T1uWAoUg3sZ3IBQ7w+bhPtK1tOueU0Nsj4JbP+tBY X-Received: by 2002:a50:8757:: with SMTP id 23mr161569edv.191.1631134256364; Wed, 08 Sep 2021 13:50:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631134256; cv=none; d=google.com; s=arc-20160816; b=sTKw1mzGtgAuEDiiWcqFEz49Zq8qqhh9LmxM/lJVWA1wpPmfnn3QbKHYpSOgZcdxJp nOR9nq5hAIoeQfrsahOdMIfj/7g3oEy1JMDGRU5J50N6T2UeUfQts7PB6HQD8ghO65NG 4tPuaV1ernSFSc74PcRKZKpbIhbNSyOjDiL6qydm3xtb+DK3qt5SVBy4SpQ7jpE69IGG MVKITrb/Z606zMfIyJbgddryr1DugVTTisZQIkGJDX1yEzp2ReQm/umniHBpZflaFEoa QfVk6XBEA6nVoJE+z57ocldrxzGMJS++8eEBiJ3igHpbnPwDTjOhXEdcWnYGlMWAGpfA VnmQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=Nqyp+lOHavn3kMru/T+vHedvAXQzg5WGRJd6AHmc1Kc=; b=JI6OuUtPQhSik1BWq4YlCY7CdeTxxPnpmcnGN7SI/REFqFCJehH+Gxx/rTqp2V6224 nrZrNeSI/DPcVYIp9PgEvnniqkoO4p/G9UDM2J/AeXo7ACadP55mqR/H7GGH9hCYzyXg CgUm+0w7eztgLamGtTWVNwMvGlNjGClTNNbbLevyjAIppy9Os61/bW5z4LxfYle2D4pa ty6aGx7CW8isC57bwRdFEU5eiRqg5e7fgws36FQIgh+1ud9urMS9cmM3WVCGNsCPqEpV P3WQkeVWNUuco91anTgdHf49ClpR7gbXOFNqbamK4SEs1BAFwFec0MuxEvkrrto9X3Kb VrdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=gkSXmAj1; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bo16si184736edb.144.2021.09.08.13.50.31; Wed, 08 Sep 2021 13:50:56 -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=@gmail.com header.s=20210112 header.b=gkSXmAj1; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350272AbhIHUt2 (ORCPT + 99 others); Wed, 8 Sep 2021 16:49:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33398 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237766AbhIHUt1 (ORCPT ); Wed, 8 Sep 2021 16:49:27 -0400 Received: from mail-il1-x12d.google.com (mail-il1-x12d.google.com [IPv6:2607:f8b0:4864:20::12d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BAF01C061575; Wed, 8 Sep 2021 13:48:19 -0700 (PDT) Received: by mail-il1-x12d.google.com with SMTP id s16so3738956ilo.9; Wed, 08 Sep 2021 13:48:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Nqyp+lOHavn3kMru/T+vHedvAXQzg5WGRJd6AHmc1Kc=; b=gkSXmAj13MhVsl8YuiUAR4XRq//FNYriVENQAcmlDsIi2uvoXQijlr5P5Owc+6C9dI VzBbmXkY0cRcds0m74u7YbCdvWCEx7JE30ch7jCOOYfiqughpLViaW5+XbSAizDBhDWW Hrc3nQTwBfIJskn/+DylLyX4ErYCyUVDPPCZlytYBSlHXBZHcwwwk4OIcNeSJtfLIvW+ Ut9+V5nY/yzQ/W+5X/Yp/UpPkP8F6926Q1hzNpU+0lgZDibbsg5OISoEq8VpVCwWEtr5 cSsOuLRuI5GdvGlxwfF4IbOqr51LoUIC4z9bp21PXaCrcN14eXiz67mFGFcCtv64lGsx tWMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Nqyp+lOHavn3kMru/T+vHedvAXQzg5WGRJd6AHmc1Kc=; b=p9clUjCGlOhsxR7zIlRW/xsE/E+Ke0AtJZaFVd0NsIvcBuMnLHupp4xnPRlJzJepYE 227y/v/h8xbrNvOsvJqShCtPSaZIwS8/pIRLkK49O1FtYe8uOaWKex/7irZclU257Dm7 R7gwRulSzP80hLqzj6wmjgZ0+B6kzWyQYIx7dmj7ZMLo/vJLovBKBjW5KArc/p39O5PG DzIU14D+pXg50KrsSErhgcvsUPr9iTFs8r1KbNbZkawegBxaItDElKVlwWZEJAsW+H6c 1PnAfeEccW5khbXUQ1P1KUYLfPrbtG//07EU+FXN4zvtRGVaH0UP0upYXy/Uu/dBOF4j maEA== X-Gm-Message-State: AOAM530wuBLCr9r53LUkF+W/nnlSvjTEiOBAdyOYWig5nCLYi5L2H1K+ jhT5fLabk46+5MvfXlGqFVHKadqYe+hkxpns9do= X-Received: by 2002:a92:c144:: with SMTP id b4mr126876ilh.67.1631134099131; Wed, 08 Sep 2021 13:48:19 -0700 (PDT) MIME-Version: 1.0 References: <20210907145501.69161-1-sven@svenpeter.dev> In-Reply-To: <20210907145501.69161-1-sven@svenpeter.dev> From: Jassi Brar Date: Wed, 8 Sep 2021 15:48:08 -0500 Message-ID: Subject: Re: [PATCH 0/3] Apple Mailbox Controller support To: Sven Peter Cc: Rob Herring , Mark Kettenis , Hector Martin , Alyssa Rosenzweig , Mohamed Mediouni , Stan Skowronek , Devicetree List , linux-arm-kernel , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Thanks.