Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1141898pxb; Thu, 4 Mar 2021 04:33:57 -0800 (PST) X-Google-Smtp-Source: ABdhPJzm5V3ANj7ad7GZkptaEAdZVZ2TDRo0sGixDt0Gnd17HN0Yem4N4Um19W4NetZFrQwv9jVv X-Received: by 2002:a17:906:5e4a:: with SMTP id b10mr4000438eju.116.1614861236992; Thu, 04 Mar 2021 04:33:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614861236; cv=none; d=google.com; s=arc-20160816; b=OuK5LqPG18aYc/uRKew4nSsLoOLnSJj+AMHWFrA6tVxl4+eLO9fVGvLEnQpuT9nxlt dOSqzuHjrUCiXC0iqMAOGWKWsbG5k8H3scmFpHzGtPXLTTTIQ2yKM05069mmC+d2+KN5 sCH9AF9OTzU/Tc8qjc52nLm8eYnm9+Y5ni+76KZOnsZrbP0O4ZyShZJRWLMeMlMA83Fp Oz8BO4o+mu/PYrneOEZ+0LIb562EmG771JaRhoGMkJynEq8nhn4ZkEI/DUvkKvFvf4az VmX3OBPAl4u147RlFLGo1MRj3iodVicMrbHKu6i+X5tnnX3UsAS8vLTyhOokFgsabmEQ BhEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=gVzR7oLstl6ac4ZTkA4CIGL1WR32C+kvWFg+bT72InI=; b=Ag3jWReuDGPAjBZnKMnDCE2WRGPiU7csAO9mnyFRf4t07reUSFglVtTy2mobMVJ4Vk 4XLP+Wxs3Ygi2U69bXY6amU3efE5ALMqTtUQ1DAad7xZ9e7/lcja81OgFxsmZWQxwqIw wENEAdWOJKdVjfHUMGN1mPv+6/F4q6ohCAL2Jy5JVHbcgKFrU4nIy6+m+qFjZ/NuvDEU 1oRBui8VTTbhYlHXGlK4Tote9A32HViS8ACxjbdUopR6Zs8vY+az/1HUXaqk/feLVkU7 3auWE9rViuSohQEt40Jo49u62dm4ZW/DxPe7j12hANtmLsSHpXJW7jYHIf0u2NGZKMDZ zd0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Kdp0z6To; 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=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dj20si5534333edb.250.2021.03.04.04.33.34; Thu, 04 Mar 2021 04:33:56 -0800 (PST) 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=@linaro.org header.s=google header.b=Kdp0z6To; 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=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350895AbhCCTJR (ORCPT + 99 others); Wed, 3 Mar 2021 14:09:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33040 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1382986AbhCCSoa (ORCPT ); Wed, 3 Mar 2021 13:44:30 -0500 Received: from mail-pj1-x1030.google.com (mail-pj1-x1030.google.com [IPv6:2607:f8b0:4864:20::1030]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0E7C5C061761 for ; Wed, 3 Mar 2021 10:43:49 -0800 (PST) Received: by mail-pj1-x1030.google.com with SMTP id e9so4928599pjj.0 for ; Wed, 03 Mar 2021 10:43:49 -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; bh=gVzR7oLstl6ac4ZTkA4CIGL1WR32C+kvWFg+bT72InI=; b=Kdp0z6TouC9vsp6Gaa4T0X4l/lsXsHfBSgHsbjgBgBPnZs72XvLOn3wMnlX2wWvV+U zAMijtl3Db+skGKokSbjFctHPeDghD+JPckIzTRM+Fx2LFOFfIymQelQrxwLgZlOYD4j YO2yBXWtCdBIUxFcBE1BbMM/MVUOP60rUwUdqaOe9MTiaIxQZBVKN3o3iJyV5pEm3h1U pz+M9M2KJbAiQoZiDGGSSqkcchEre8O5f/3u2SuaFDxXZBbBV4J74E4O05bgZTa54tad 9oD8BVbYvPaWNc7HCsQkWiYbEST7gerlhWe9ONUT1GMXJcWy7IjXVQfVNn3IHTPjp0rS lpjw== 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; bh=gVzR7oLstl6ac4ZTkA4CIGL1WR32C+kvWFg+bT72InI=; b=EgBvgfE5z6WbA1JOGDRgJgpnJRzdZb5AGBt77iN0mXGCToCGt2Pmxcm24dins+5BTv VIZ3EcEjlz6ftricamdXRn5R6y9jBmFH0OF0iyT5dubMqW/qBmfcyj3t6rKWsXxKILQ3 I8rsQ0rtwzNReX76iEXcRWoX4QQrF4oCK+jlpCO1YM9bJwquJcojKVgE7Dhka05HU5Ii qByauhEbgdcAYUs7s8UMSa9mf7jSdRuBk6Hn3hVBfdVBmGW21KA6vhAr+6a2O8un87PY +BZYeQCq0PgqyO99cWrVwY9ITCVWYrZJgP/3SvrnF7JxTZbJmivHzgKa7sSULRWJnf+2 C7dg== X-Gm-Message-State: AOAM533SEs8Rz8Jh/Y0v+IcQ4stwzvQ910r0mJuKd5625c6R+xaBLhm2 gvuB4h3dQucdzwpdDKZXAcLaxg== X-Received: by 2002:a17:90a:4882:: with SMTP id b2mr474911pjh.69.1614797028306; Wed, 03 Mar 2021 10:43:48 -0800 (PST) Received: from xps15 (S0106889e681aac74.cg.shawcable.net. [68.147.0.187]) by smtp.gmail.com with ESMTPSA id v126sm23944372pfv.163.2021.03.03.10.43.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Mar 2021 10:43:47 -0800 (PST) Date: Wed, 3 Mar 2021 11:43:45 -0700 From: Mathieu Poirier To: Arnaud Pouliquen Cc: Bjorn Andersson , Ohad Ben-Cohen , Andy Gross , linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-msm@vger.kernel.org Subject: Re: [PATCH v5 11/16] rpmsg: virtio: register the rpmsg_ctrl device Message-ID: <20210303184345.GD3817330@xps15> References: <20210219111501.14261-1-arnaud.pouliquen@foss.st.com> <20210219111501.14261-12-arnaud.pouliquen@foss.st.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210219111501.14261-12-arnaud.pouliquen@foss.st.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Feb 19, 2021 at 12:14:56PM +0100, Arnaud Pouliquen wrote: > Instantiate the rpmsg_ioctl device on virtio RPMsg bus creation. s/rpmsg_ioctl/rpmsg_ctrl Now I understand what you meant in patch 05. > This provides the possibility to expose the RPMSG_CREATE_EPT_IOCTL > to create RPMsg chdev endpoints. You mean RPMSG device endpoints, i.e rpmsg_eptdev? If so I think it should be added to the changelog. Otherwiser someone could be tempted to look for "chdev" and find anything but a rpmsg_eptdev. > > Signed-off-by: Arnaud Pouliquen > > --- > V5: > Fix compilation issue > Reported-by: kernel test robot > Reported-by: Dan Carpenter > --- > drivers/rpmsg/virtio_rpmsg_bus.c | 57 +++++++++++++++++++++++++++++--- > 1 file changed, 52 insertions(+), 5 deletions(-) > > diff --git a/drivers/rpmsg/virtio_rpmsg_bus.c b/drivers/rpmsg/virtio_rpmsg_bus.c > index e87d4cf926eb..2e6b34084012 100644 > --- a/drivers/rpmsg/virtio_rpmsg_bus.c > +++ b/drivers/rpmsg/virtio_rpmsg_bus.c > @@ -813,14 +813,52 @@ static void rpmsg_xmit_done(struct virtqueue *svq) > wake_up_interruptible(&vrp->sendq); > } > > +static struct rpmsg_device *rpmsg_virtio_add_ctrl_dev(struct virtio_device *vdev) > +{ > + struct virtproc_info *vrp = vdev->priv; > + struct virtio_rpmsg_channel *vch; > + struct rpmsg_device *rpdev_ctrl; > + int err = 0; > + > + vch = kzalloc(sizeof(*vch), GFP_KERNEL); > + if (!vch) > + return ERR_PTR(-ENOMEM); > + > + /* Link the channel to the vrp */ > + vch->vrp = vrp; > + > + /* Assign public information to the rpmsg_device */ > + rpdev_ctrl = &vch->rpdev; > + rpdev_ctrl->ops = &virtio_rpmsg_ops; > + > + rpdev_ctrl->dev.parent = &vrp->vdev->dev; > + rpdev_ctrl->dev.release = virtio_rpmsg_release_device; > + rpdev_ctrl->little_endian = virtio_is_little_endian(vrp->vdev); > + > + err = rpmsg_ctrl_register_device(rpdev_ctrl); > + if (err) { > + kfree(vch); > + return ERR_PTR(err); > + } > + > + return rpdev_ctrl; > +} > + > +static void rpmsg_virtio_del_ctrl_dev(struct rpmsg_device *rpdev_ctrl) > +{ > + if (!rpdev_ctrl) > + return; > + kfree(to_virtio_rpmsg_channel(rpdev_ctrl)); > +} > + > static int rpmsg_probe(struct virtio_device *vdev) > { > vq_callback_t *vq_cbs[] = { rpmsg_recv_done, rpmsg_xmit_done }; > static const char * const names[] = { "input", "output" }; > struct virtqueue *vqs[2]; > struct virtproc_info *vrp; > - struct virtio_rpmsg_channel *vch; > - struct rpmsg_device *rpdev_ns; > + struct virtio_rpmsg_channel *vch = NULL; > + struct rpmsg_device *rpdev_ns = NULL, *rpdev_ctrl; As far as I can tell @rpdev_ns doesn't have to be initialized. > void *bufs_va; > int err = 0, i; > size_t total_buf_space; > @@ -894,12 +932,18 @@ static int rpmsg_probe(struct virtio_device *vdev) > > vdev->priv = vrp; > > + rpdev_ctrl = rpmsg_virtio_add_ctrl_dev(vdev); > + if (IS_ERR(rpdev_ctrl)) { > + err = PTR_ERR(rpdev_ctrl); > + goto free_coherent; > + } > + > /* if supported by the remote processor, enable the name service */ > if (virtio_has_feature(vdev, VIRTIO_RPMSG_F_NS)) { > vch = kzalloc(sizeof(*vch), GFP_KERNEL); > if (!vch) { > err = -ENOMEM; > - goto free_coherent; > + goto free_ctrldev; > } > > /* Link the channel to our vrp */ > @@ -915,7 +959,7 @@ static int rpmsg_probe(struct virtio_device *vdev) > > err = rpmsg_ns_register_device(rpdev_ns); > if (err) > - goto free_coherent; > + goto free_vch; > } > > /* > @@ -939,8 +983,11 @@ static int rpmsg_probe(struct virtio_device *vdev) > > return 0; > > -free_coherent: > +free_vch: > kfree(vch); > +free_ctrldev: > + rpmsg_virtio_del_ctrl_dev(rpdev_ctrl); > +free_coherent: > dma_free_coherent(vdev->dev.parent, total_buf_space, > bufs_va, vrp->bufs_dma); > vqs_del: > -- > 2.17.1 >