Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp6007861imu; Wed, 26 Dec 2018 13:05:48 -0800 (PST) X-Google-Smtp-Source: ALg8bN7dN/S/9RUkrEOEMkOfqok6G1qGcElp6EvxlEd6r64QTHY92ZtXn4I4I/ooPPrqGuO+wtan X-Received: by 2002:a17:902:724a:: with SMTP id c10mr21561853pll.51.1545858348893; Wed, 26 Dec 2018 13:05:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545858348; cv=none; d=google.com; s=arc-20160816; b=ed/2Wx9BjOiht1YXy7UVGrpUatW2nNqmGy8hHQwoL0UyJkY6jWc9msIpozFznhh3SP HHolSCrseAb9O6Fp+JoOtIaY+shEUNgZsePdqQ9yM8WUghx5Al7es4V04RjyhbTV+9hM 9RZyIuFp/hWFTX2mw3b0N9jRe/o6usLSohhaP1ZHgAzlQQqrNpL6++b2ewOVNwgHS+3E qC6fRhlv5aKloiQpvAXPKquQ+eDy2rSIU1uLd3y4/uIqBZTlEM5mMfsHG7cAQ+wA/0Fb koRVxblVUvEtwq3zfdlQ/Lh8V+TLswYJ8JLfvSKq81ATR6u83kX+XIqOcNheUAax0DRu GnMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=KhirqufjEAKM5oH8ZTyukCbgwkV6FFyPZD8bGeSML24=; b=FrswZRHbl/VH0rKq/bQWrJMFNsq6oh5TU6tMyXu7JL55/jdHxgxj5bji1v34kZAfhE poWhw6ta7fM1qtgLLUJ1rCAEdc6gu+KVHZLQsHN6m0t/Xqc6QPxT03qSrUj+NpBXlk+m hYOm1ZURKd80ybU9HYD/ThL/f6I/G1sH9/cIog2/iJpPlxuvNa/nuXjpjU26IvAqnoxg QEUZHUUQUHUoxHQweAUITsekIt15mvo5SGParrCTrSDXUAhEq/ikkt8vcp2RHaFvFieE 1I7jJlkwLkHjSiSkV2s6F1uMS4goTtWPVtd6HKkgksJ/JsKgX8/0XoPCcgA22YAFO5Fm gzeg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CAjSoCts; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z129si26891306pfz.13.2018.12.26.13.05.04; Wed, 26 Dec 2018 13:05:48 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CAjSoCts; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728054AbeLZU2h (ORCPT + 99 others); Wed, 26 Dec 2018 15:28:37 -0500 Received: from mail-pf1-f195.google.com ([209.85.210.195]:35326 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727842AbeLZU2e (ORCPT ); Wed, 26 Dec 2018 15:28:34 -0500 Received: by mail-pf1-f195.google.com with SMTP id z9so8228451pfi.2 for ; Wed, 26 Dec 2018 12:28:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=KhirqufjEAKM5oH8ZTyukCbgwkV6FFyPZD8bGeSML24=; b=CAjSoCtsEBEMhbX+rpcbvaBDg0ZarjdOLhgnuWklQqwVw1XfEHw3nu9tYePgBowsWz UGQ7Il42en7LcAVd49cFQbwwmZ+Js4iILVBujMumYltW7e5CLXsJijLNeF1jGnDK6l+j 4MYYdCnefotmODedzmNDKcIc8JbUrCjgQCEWk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=KhirqufjEAKM5oH8ZTyukCbgwkV6FFyPZD8bGeSML24=; b=UNjcqSi8SGdr6kbyfa0GUDZi8PE+cPa/wkVBxmxZEmIJCs1IURvYuBDh/6nUezgvj6 CnB6Uib/cVZFRMWXlTNpnNNzk8SbcTfb7KOe2XpljPc+cfg22LIuSpCSKQezSeP30cXM 4yniTAGAuO3BwSIFE/UjnSNFzr85kAZg005hyLnKsERoUpQJuge0UK34HY2hduD3Jd63 Q4f6PPjaP5N9d0sqBrmiUIZDzUDebnckdSmR11RyvvPoa7CRODcIV1D00sBa2YhJiYl3 7IFPFlnbV9sQjKyEOoGhIUJ0PVW/BQqvRHftnxlTb0AwOYx5+0aPniD8Y6NAaokfHjzd 1JWQ== X-Gm-Message-State: AJcUukeqY9xr3cwJ0b3DeM2BuaWE4KvvcCKdN/0ONUUQEFHekh8AsAL6 WZ6j8JtqfpLPnuKbLS+XR3WNQb8IxN8= X-Received: by 2002:a63:4c4e:: with SMTP id m14mr20339753pgl.173.1545856113565; Wed, 26 Dec 2018 12:28:33 -0800 (PST) Received: from minitux (104-188-17-28.lightspeed.sndgca.sbcglobal.net. [104.188.17.28]) by smtp.gmail.com with ESMTPSA id m9sm41818013pgd.32.2018.12.26.12.28.32 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 26 Dec 2018 12:28:32 -0800 (PST) Date: Wed, 26 Dec 2018 12:28:30 -0800 From: Bjorn Andersson To: Arun Kumar Neelakantam Cc: Andy Gross , David Brown , Rob Herring , Mark Rutland , linux-arm-msm@vger.kernel.org, linux-soc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/3] soc: qcom: Add AOSS QMP communication driver Message-ID: <20181226202830.GE9704@minitux> References: <20181112080557.22698-1-bjorn.andersson@linaro.org> <20181112080557.22698-3-bjorn.andersson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue 20 Nov 04:22 PST 2018, Arun Kumar Neelakantam wrote: Thanks for the review Arun. > On 11/12/2018 1:35 PM, Bjorn Andersson wrote: [..] > > +int qmp_send(struct qmp *qmp, const void *data, size_t len) > > +{ > > + int ret; > > + > > + if (WARN_ON(len + sizeof(u32) > qmp->size)) { > > + dev_err(qmp->dev, "message too long\n"); > > + return -EINVAL; > > + } > > + > > + if (WARN_ON(len % sizeof(u32))) { > > + dev_err(qmp->dev, "message not 32-bit aligned\n"); > > + return -EINVAL; > > + } > > + > > + mutex_lock(&qmp->tx_lock); > > + > > + if (!qmp_message_empty(qmp)) { > > + dev_err(qmp->dev, "mailbox left busy\n"); > > + ret = -EINVAL; > should it be -EBUSY ? That makes more sense. > And qmp_messge_empty will be done either by remote if it process the data > else by this driver in TIMEOUT case, so does we need this check for every TX > ? I think we can just reset to Zero once in open time. Didn't think about that, should we really make the QMP link ready again when we get a timeout? Can we expect that the firmware of the remote side is ready to serve future messages? Should we keep this check and remove the writel() below? > > + goto out_unlock; > > + } > > + > > + /* The message RAM only implements 32-bit accesses */ > > + __iowrite32_copy(qmp->msgram + qmp->offset + sizeof(u32), > > + data, len / sizeof(u32)); > > + writel(len, qmp->msgram + qmp->offset); > > + qmp_kick(qmp); > > + > > + ret = wait_event_interruptible_timeout(qmp->event, > > + qmp_message_empty(qmp), HZ); > > + if (!ret) { > > + dev_err(qmp->dev, "ucore did not ack channel\n"); > > + ret = -ETIMEDOUT; > > + > > + writel(0, qmp->msgram + qmp->offset); > > + } else { > > + ret = 0; > > + } > > + > > +out_unlock: > > + mutex_unlock(&qmp->tx_lock); > > + > > + return ret; > > +} Regards, Bjorn