Path: csiph.com!news.mixmin.net!news.unit0.net!news.panservice.it!bofh.it!news.nic.it!robomod From: Jassi Brar Newsgroups: linux.kernel Subject: Re: [PATCH v3 2/4] soc: qcom: Introduce APCS IPC driver Date: Thu, 04 May 2017 19:10:02 +0200 Message-ID: References: Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=FHNZOD4X46DslU8cDOA81rkPDi06APFARla7ES528CM=; b=Mvb0QgYr2GN5Mrhd4V7CiYDUCJJkF1ja4Gs617IWRs6xTipOTqRrcFIf6pbnV03MA4 4a60Ji7lEdcXI6fhTe9HslUSuKdkUbY9qGbEN7CxJe3jQNcoLmvy90hmxhwm58Js9Xt7 AvHbyP45dRzoDjk4ejje4wcZTEQVO+r23Bf0vKOV6rnzWTl7okvW5/m5Q8rv2P3JuLY6 mSa6rcqrXe5K7HjADge2yCK7Ym1NwnzAScBEkWxDv8BTjrjWiRK4qJTerIPdVtyU/h+k 2NKVdywWd5q7RBgxWPlxJjisFlZ07m3L/44QV0niKUF6kVlcmtU7e0Arwoe5DYEGoHQR agBg== X-Google-Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=FHNZOD4X46DslU8cDOA81rkPDi06APFARla7ES528CM=; b=TUIV5WO1Z/htOvlay6iOthOE+dWaLviqMsgDAK2iKs1Mbgpwf+I+ZiwQjppxWlJkyP qPrhMtfh0wMZe+wakTGk84YcTna/EhDzFTceAc4Y4zx5wlN2Y/WIUrFh/5Y4NQLrY/Ha Z1JUVCEI+ATo9wfSvl1KqLzLsxToVs2ayQnCvRhbDT4UaxB2UjNXH95Q9w9NIIfJvK7n Ts0OEX/vFBUQw54WKRiztGRHdO0BJIT46fybmmtor8WgBSq1ZaBIGASLqcaAgoOr48dC jrIzkt/IDdNl6XFBwVBy0FPQ+ayIUWXV3/vgRmxaDUMqaGIuFV2JJ2fa0TjEOREY5Vi4 hn6Q== X-Gm-Message-State: AN3rC/5ts7rlks94B6dUnS/BQtaOPKWQ1pSfDDhommTs1QA36xisfaGr LsQz1o+uwh9RtqAnEju4CTEMaONGWA== X-Received: by 10.80.132.70 with SMTP id 64mr1317780edp.181.1493917242637; Thu, 04 May 2017 10:00:42 -0700 (PDT) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: robomod@news.nic.it List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Approved: robomod@news.nic.it Lines: 130 Organization: linux.* mail to news gateway X-Original-Cc: Loic PALLARDY , Andy Gross , Rob Herring , Mark Rutland , Ohad Ben-Cohen , "linux-arm-msm@vger.kernel.org" , "linux-soc@vger.kernel.org" , "devicetree@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-remoteproc@vger.kernel.org" X-Original-Date: Thu, 4 May 2017 22:30:42 +0530 X-Original-Message-ID: X-Original-References: <20170503052929.17422-1-bjorn.andersson@linaro.org> <20170503052929.17422-2-bjorn.andersson@linaro.org> <20170504054516.GB15143@minitux> <20170504161035.GC15143@minitux> X-Original-Sender: linux-kernel-owner@vger.kernel.org Xref: csiph.com linux.kernel:1635905 On Thu, May 4, 2017 at 9:40 PM, Bjorn Andersson wrote: > On Thu 04 May 00:54 PDT 2017, Jassi Brar wrote: > >> On Thu, May 4, 2017 at 11:15 AM, Bjorn Andersson >> wrote: >> > On Wed 03 May 02:55 PDT 2017, Jassi Brar wrote: >> > >> >> Loic, thanks for adding me. >> >> >> >> On Wed, May 3, 2017 at 2:58 PM, Loic PALLARDY wrote: >> >> > >> >> > >> >> >> -----Original Message----- >> >> >> From: linux-remoteproc-owner@vger.kernel.org [mailto:linux-remoteproc- >> >> >> owner@vger.kernel.org] On Behalf Of Bjorn Andersson >> >> >> Sent: Wednesday, May 03, 2017 7:29 AM >> >> >> To: Andy Gross ; Rob Herring >> >> >> ; Mark Rutland ; Ohad Ben- >> >> >> Cohen >> >> >> Cc: linux-arm-msm@vger.kernel.org; linux-soc@vger.kernel.org; >> >> >> devicetree@vger.kernel.org; linux-kernel@vger.kernel.org; linux- >> >> >> remoteproc@vger.kernel.org >> >> >> Subject: [PATCH v3 2/4] soc: qcom: Introduce APCS IPC driver >> >> >> >> >> >> This implements a driver that exposes the IPC bits found in the APCS Global >> >> >> block in various Qualcomm platforms. The bits are used to signal inter- >> >> >> processor communication signals from the application CPU to other masters. >> >> >> >> >> >> The driver implements the "doorbell" binding and could be used as basis for a >> >> >> new Linux framework, if found useful outside Qualcomm. >> >> >> >> >> > Hi Bjorn, >> >> > >> >> > Even if Qualcom APCS IPC is limited, why don't you rely on existing mailbox framework. >> >> > It is there to gather all IPC management under the same interface. >> >> > No need to create a new one from my pov. >> >> > If you don't provide message data, mailbox framework behaves as doorbell. >> >> > >> >> QCOM RPM reinvented the wheel for what mailbox framework already did, >> >> despite my pointing it out => >> >> http://lkml.iu.edu/hypermail//linux/kernel/1406.2/03918.html >> >> >> > >> > The RPM interface works by writing various information in shared DRAM >> > and then invoking an interrupt on the remote processor. >> > >> This is what _most_ platforms do, and they use mailbox framework. If >> mailbox framework doesn't suit RPM, then it doesn't suit most >> platforms that use it. >> >> > My argumentation against using the mailbox framework for the RPM case >> > was that the message model is a software construct and doesn't fit the >> > mailbox framework. >> > >> Mailbox framework works beneath protocol layer (software construct). >> As I said years ago, the h/w bits of the controller should be under >> mailbox api, while the message structures and signals are protocol >> specific and be in QCOM specific location. >> > > Okay, now I finally get what you're saying. The RPM driver handles the > protocol but the actual triggering of the remote interrupt should be > done via the mailbox framework. > > That makes sense, until now I haven't seen the need for having a driver > exposing the APCS IPC register (used by among others the RPM driver), > but I will rewrite this patch as a mailbox controller and turn the RPM > driver into a mailbox client. > Cool, thanks. >> >> > But which one of these would be appropriate for a "mailbox channel" that >> > doesn't have any actual messages? >> > >> > mbox_send_message(chan, NULL) >> > or >> > const int one = 1; >> > mbox_send_message(chan, (void*)&one); >> > >> It depends upon your h/w. >> If each physical channel is hardwired to work on a predefined single >> bit, then the driver could do without that bit being explicitly >> passed. >> If a physical channel can be mapped onto any bit(s), then you do need >> to pass that info via mbox_send_message(). >> > > It's a 32-bit register, writing a bit invokes the associated interrupt > on some remote processor. I.e. bits 0, 1 and 2 represents different > interrupts on the resource-power-management CPU while bit 12, 13, 14 and > 15 will invoke interrupts on a modem CPU. > No problem. For such arrangement, you could have a channel per interrupt/bit. Have the DT specify which bit goes as what interrupt to which cpu. The controller driver would then associate each channel to its 'bit' and a client would always acquire the right channel (specified by DT) and need not know/pass which bit should be set for its messages i.e, mbox_send_message(chan, NULL) > I'll rework the proposed driver and we can look at the actual > implementation instead. > >> >> >> The driver bypassed mailbox framework and was pushed via another tree. >> >> Same is being attempted now, only now it is more expensive to switch >> >> to generic mailbox framework having spent so much time on QCOM >> >> specific implementation of controller and protocol drivers inside >> >> drivers/soc/qcom/ >> > >> > I'm not sure I follow this, there's no extensive rework going on here - >> > all I'm trying to do is abstract the "writel(BIT(x), ipc_reg)" line of >> > the RPM driver, because it's being used in other clients as well. >> > >> No, I meant ideally RPM should have used mailbox api for the >> controller programming, but moving to that now will be expensive >> because you already developed huge code base around QCOM specific >> mailbox implementation. >> > > The part discussed above was implemented using syscon, so it's a few > lines of code to grab hold of a handle and instead of > mbox_send_message() there is a single call to regmap_write(). All the > other parts of the implementation is protocol-specific, and as you say > the next layer up. So the transition is quite straight forward! > Great! Thanks.