Received: by 2002:ab2:6c55:0:b0:1fd:c486:4f03 with SMTP id v21csp212381lqp; Tue, 11 Jun 2024 21:38:05 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXey7gzNJAXCQsO37tPfDU2xMhWOHRTbKKlr11YH2je5gqEX3xDWCYI6RzX2IDUuy7deU60yvVXtAlscFUjAfwmEsRldtFVJcpi1rTZjg== X-Google-Smtp-Source: AGHT+IFw/flygKJ4bVmmlaMALbi1AkdDSp7sIj/1sBHbJgQZUCyUMC7bnPi7dwx7rbtsSXLXFe7F X-Received: by 2002:a17:90a:5505:b0:2c2:daf4:5e5d with SMTP id 98e67ed59e1d1-2c4a7642d04mr770910a91.24.1718167084859; Tue, 11 Jun 2024 21:38:04 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718167084; cv=pass; d=google.com; s=arc-20160816; b=NBJ2CrBfM1pKIFDU981/MAMlFKXezkv4LgxpJYuAmFri5Y7Gj0o/snrsqPjrTajyAW 8mzV20Vhidz8wlBV9PCUiGyt93lsG1cjnexTUlQNdPZOLpUSuafntOEBS9tc/2jRvb8i u+ue4CKgx2Fv8LTTYrQ+WQaufxjEGcp+/o80e1//IDKHJOs4y38aR/Yaw2jOQ4qMRct5 vrTnnQ+Ag/T+NRicIY9gDW1MeR74QkwcP4rZJEPU4btBt3THLVq5Z4Ipx15kUbRsnQKj vxndlRplL7nhuga/pWcAAMeSuPAOXXfL6g0VhBluLqAxuuXJyUyWf59xLEiptc/ZuZ99 FYkw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=DkRmaXYdVwSedvVUVG2r+hTZqVuOSK1T8k/kpQ+eeNI=; fh=XS16eoqe9xkwWqrz8S47jSSo5CWPYRTP5ao2FhBifzU=; b=GYQb6MsyuJgtOG126TbS675SGHqMzTtLKno7Vch05/ytMFtgThZlUE93yd5naotKsf HOemCsUQ9SbqCqKKSu8Pe39bkNhcofJmRxwB9znyus47ib7MYpH6rhkZRKXNgGuy2gbv z3Cn3Dmoa61nujtfynf8pH8BUomzPwzv0Ewh8+GYZeGBd0Ra/NyXNNiTuoGK3Xh97uxC gSIgJYlHefxX11pFHRP+zYlI2Lrqja0udKANSHBusaxq1YRCNIJmw9jd/+NIm18tIcWn 8oZGca7JBZqLNsT/T66VFtqHJwotvT5RvyI6z3oFgGBlmvCf1E8W8VGDIH8kSSqEJ/1W C3aQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=NlcAwWQW; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-210915-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-210915-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id 98e67ed59e1d1-2c4a761aa35si682141a91.78.2024.06.11.21.38.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Jun 2024 21:38:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-210915-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=NlcAwWQW; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-210915-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-210915-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 251E6281916 for ; Wed, 12 Jun 2024 04:38:04 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 968F6286A8; Wed, 12 Jun 2024 04:37:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="NlcAwWQW" Received: from mail-oa1-f49.google.com (mail-oa1-f49.google.com [209.85.160.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 308B222092 for ; Wed, 12 Jun 2024 04:37:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.49 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718167074; cv=none; b=RefqF6XBXjznJxjmpNV6ToDFRsGNDVLy0IkrG1gHTNjqQJKr+hniahCDYtfVaRsyRKtTO3h42hG6PmBoA2BEKYGyPIi9+J4wcDKW7Pzw1uEwNsaFAcoJufv9pHp7Jq7Gh9CTh33OhIhlKtiSFTHQmflU1e/10flIPBAYWfYsM+8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718167074; c=relaxed/simple; bh=K9aejVQOgTXMFEuZnxUdcghhw58vkvOpgwwON1tbHew=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=HG+uJGmEI+UsTGgicPNZsBfMvQBm4flcUEo8cq+V8iC61PmugV4XvxyB29sgo5lVKT1U2LvglQ8XQi+c86sQnCVCLEobe5/SdfqY6P1ngyTeE+HNZ4nkxaf2pYE50igxTf9Wysq2KimUuK4KPSBOxliSM5mCdA9g1gbmLlm5CfM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=NlcAwWQW; arc=none smtp.client-ip=209.85.160.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Received: by mail-oa1-f49.google.com with SMTP id 586e51a60fabf-24c9f630e51so3126176fac.1 for ; Tue, 11 Jun 2024 21:37:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1718167072; x=1718771872; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=DkRmaXYdVwSedvVUVG2r+hTZqVuOSK1T8k/kpQ+eeNI=; b=NlcAwWQWcz7Z43HUdTxaoSN6Km0dUneoMmRIyxrmoucBy1mrgowwqJ54pGWruJBWV+ xGxl0N970BCrC/SE6DNUhKn7Wy9AW89lz0EPYVOJz2Sj8+lWlvf7GjlvEOvxkdjyjHdf GKjDkVD/aL0OoKLbBbItzawWxwPGQIrUWgRLA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718167072; x=1718771872; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=DkRmaXYdVwSedvVUVG2r+hTZqVuOSK1T8k/kpQ+eeNI=; b=X/tmAF1TbKz6QIcSBDhRoQn7hW5vOuXdSjeQUTX3jYUtBbfVHDOVXnh3nLOyvlT7Ka Eguqn9qdRrM4cbkkRIdovVDN/IG+z7Tg1FoeLRHSH521+SCRcFnq3vsXBRaM1NFqwuv0 GBYGoyC+Ii3mdC3/Oe6kU+2EeC2xKVBkEFwu5l7cw52vWU3cHi9F4UGrkMfb/Xe0I6rc Tscj8JOBV3B9Ssp7+oTlDBb/jERWWRRfT8mk9Xc+7bMHL1e79rFI/IhRAnYYDpHWd7M8 EfhQRQXtP/dkD03WKFyLjHQJGZd9QlwD5CzqU2i+Gk/qNLmmpIojTEb1LstbSf77o/je uWIQ== X-Forwarded-Encrypted: i=1; AJvYcCVYrMaVNv+vJEYEhuqm+RUSEF9yD7NPuAGpJmFPz0k5M+RebTiAPv4W753mBMVaf+RE1hZaThkD3MhfkRub2rD6x7RZKai4/QUmszCa X-Gm-Message-State: AOJu0YzXovEPvu+Q45GiYtD7DjcXVf0wfHTafahinhXAP6pLEbvjx5oZ z8sYZ6U5wiJEk4N/Ku7XLWUIkcg0SfumexzwEABp5iQXsaBUO5IfPMHbybi6WA== X-Received: by 2002:a05:6870:f112:b0:250:7a43:aefd with SMTP id 586e51a60fabf-25514b4e1a3mr793220fac.2.1718167072112; Tue, 11 Jun 2024 21:37:52 -0700 (PDT) Received: from chromium.org (174.71.80.34.bc.googleusercontent.com. [34.80.71.174]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7042a10c359sm6519597b3a.183.2024.06.11.21.37.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Jun 2024 21:37:51 -0700 (PDT) Date: Wed, 12 Jun 2024 13:37:46 +0900 From: Tomasz Figa To: Laurent Pinchart Cc: Yunfei Dong , Jeffrey Kardatzke , =?utf-8?B?TsOtY29sYXMgRiAuIFIgLiBBIC4=?= Prado , Nathan Hebert , Nicolas Dufresne , Hans Verkuil , AngeloGioacchino Del Regno , Benjamin Gaignard , Sebastian Fricke , Mauro Carvalho Chehab , Marek Szyprowski , Chen-Yu Tsai , Yong Wu , Hsin-Yi Wang , Fritz Koenig , Daniel Vetter , Steve Cho , Sumit Semwal , Brian Starkey , John Stultz , "T . J . Mercier" , Christian =?utf-8?B?S8O2bmln?= , Matthias Brugger , linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, Project_Global_Chrome_Upstream_Group@mediatek.com Subject: Re: [PATCH v6,04/24] v4l: add documentation for restricted memory flag Message-ID: References: <20240516122102.16379-1-yunfei.dong@mediatek.com> <20240516122102.16379-5-yunfei.dong@mediatek.com> <20240522111622.GA31185@pendragon.ideasonboard.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240522111622.GA31185@pendragon.ideasonboard.com> On Wed, May 22, 2024 at 02:16:22PM +0300, Laurent Pinchart wrote: > Hi Jefrey, > > Thank you for the patch. > > On Thu, May 16, 2024 at 08:20:42PM +0800, Yunfei Dong wrote: > > From: Jeffrey Kardatzke > > > > Adds documentation for V4L2_MEMORY_FLAG_RESTRICTED. > > > > Signed-off-by: Jeffrey Kardatzke > > Signed-off-by: Yunfei Dong > > --- > > Documentation/userspace-api/media/v4l/buffer.rst | 10 +++++++++- > > 1 file changed, 9 insertions(+), 1 deletion(-) > > > > diff --git a/Documentation/userspace-api/media/v4l/buffer.rst b/Documentation/userspace-api/media/v4l/buffer.rst > > index 52bbee81c080..807e43bfed2b 100644 > > --- a/Documentation/userspace-api/media/v4l/buffer.rst > > +++ b/Documentation/userspace-api/media/v4l/buffer.rst > > @@ -696,7 +696,7 @@ enum v4l2_memory > > > > .. _memory-flags: > > > > -Memory Consistency Flags > > +Memory Flags > > ------------------------ > > > > .. raw:: latex > > @@ -728,6 +728,14 @@ Memory Consistency Flags > > only if the buffer is used for :ref:`memory mapping ` I/O and the > > queue reports the :ref:`V4L2_BUF_CAP_SUPPORTS_MMAP_CACHE_HINTS > > ` capability. > > + * .. _`V4L2-MEMORY-FLAG-RESTRICTED`: > > + > > + - ``V4L2_MEMORY_FLAG_RESTRICTED`` > > + - 0x00000002 > > + - The queued buffers are expected to be in restricted memory. If not, an > > + error will be returned. This flag can only be used with ``V4L2_MEMORY_DMABUF``. > > + Typically restricted buffers are allocated using a restricted dma-heap. This flag > > + can only be specified if the ``V4L2_BUF_CAP_SUPPORTS_RESTRICTED_MEM`` is set. > > Why is this flag needed ? Given that the usage model requires the V4L2 > device to be a dma buf importer, why would userspace set the > V4L2_BUF_CAP_SUPPORTS_RESTRICTED_MEM flag and pass a non-restricted > buffer to the device ? Given that the flag is specified at REQBUF / CREATE_BUFS time, it's actually useful to tell the driver the queue is operating in restricted (aka secure) mode. I suppose we could handle that at the time of a first QBUF, but that would make the driver initialization and validation quite a bit of pain. So I'd say that the design being proposed here makes things simpler and more clear, even if it doesn't add any extra functionality. > > The V4L2_BUF_CAP_SUPPORTS_RESTRICTED_MEM flag also needs to be > documented in the relevant section, I don't think that's done in this > series. > +1 Best regards, Tomasz > > > > .. raw:: latex > > > > -- > Regards, > > Laurent Pinchart