Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp686717imu; Wed, 23 Jan 2019 04:00:39 -0800 (PST) X-Google-Smtp-Source: ALg8bN60yMyGMgKflKPjaTdAGUQYjWDsTHe+g10R50UmuPZwnLsy6DZUCXwjCVEWwpeSakj8fbRG X-Received: by 2002:a63:bd1a:: with SMTP id a26mr1702572pgf.121.1548244839452; Wed, 23 Jan 2019 04:00:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548244839; cv=none; d=google.com; s=arc-20160816; b=Wr4g29/jTuL3woFl6XQNvjRILrGNU4OG87KLVD3CHl+WH5BHdYEi1nlNuamQYIL8zy rqJcOIPHkjqea5nXG1yOdtFN3uU6INyJXWfaupufG3tSLj93yQm7to9eWlgkM0rEP6iF PN4d8B8VfHt7BPGPsJxeHedUUF5y3c+DFOoEPb3SoNpMThuzIyPcYqTHh+sa/NQ61Iht a3rzUfPkseLGNnhuw3lniQkm+4IwRhGuTcfquqZFlIaUs9UoLJATnQV/S0KoBfMXOFMI X79+IepgxwDplRiSjKgR+vswjVUTblCVpeVSkgjKEmUGMPcnfqjCEFBzl5ytBnAuLltF fayQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:subject:cc:to:from:message-id:date; bh=Dl9aPFYLRp8FxQ/W0vEXJ06sK6QUyQZ5A7wlKY3psgs=; b=BUalCRTYQJ9Q2VIPhtG82aRE4Swi67aWMoV3eGsgLZOT4RW/DkgnHhJ+kZmuPSrs8H c8HvnsDivmxfHz8zK0ajzrRV+SOjTYlW93NJm4qaxKYtLw7e3pVj++L98DkLryMKhdtq qrUaJdwlpHxVuMxCGEZrCTRhxwUPmKnvPiRUKWN23XAWsOXXh2wb9OcMoh74g3F4dS4u kwMq2MzUQx5Cd5AoSR7jbhdIdbJW9Ahw0y50TzOGRVQt6hhfV+rAvg68BrCC9ZxzF20e rgsjC2gPRaodQLD1W7Mf7kRSiOnrr74V1alIc+UmgoteslRmymAqmBaHljKXn0TsRALZ FjDg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u23si17294867pfi.175.2019.01.23.04.00.22; Wed, 23 Jan 2019 04:00:39 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726993AbfAWL64 (ORCPT + 99 others); Wed, 23 Jan 2019 06:58:56 -0500 Received: from mx2.suse.de ([195.135.220.15]:34374 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725991AbfAWL64 (ORCPT ); Wed, 23 Jan 2019 06:58:56 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 6DC7BAFED; Wed, 23 Jan 2019 11:58:54 +0000 (UTC) Date: Wed, 23 Jan 2019 12:58:51 +0100 Message-ID: From: Takashi Iwai To: Mark Brown Cc: Jaroslav Kysela , alsa-devel@alsa-project.org, arnd@arndb.de, keescook@chromium.org, bgoswami@codeaurora.org, sr@denx.de, gustavo@embeddedor.com, philburk@google.com, willy@infradead.org, mchehab+samsung@kernel.org, sboyd@kernel.org, vkoul@kernel.org, Baolin Wang , daniel.thompson@linaro.org, leo.yan@linaro.org, mathieu.poirier@linaro.org, srinivas.kandagatla@linaro.org, anna-maria@linutronix.de, corbet@lwn.net, jmiller@neverware.com, ckeepax@opensource.wolfsonmicro.com, joe@perches.com, o-takashi@sakamocchi.jp, colyli@suse.de, linux-kernel@vger.kernel.org Subject: Re: [RFC PATCH] ALSA: core: Add DMA share buffer support In-Reply-To: <20190122202535.GK7579@sirena.org.uk> References: <290f6d3a5fe288b87480cc5fa12c5139728daeca.1547787189.git.baolin.wang@linaro.org> <81e894ba-acad-2fd4-996d-8d35edd8825a@perex.cz> <20190118190805.GF6260@sirena.org.uk> <20190121124053.GA12679@sirena.org.uk> <20190122202535.GK7579@sirena.org.uk> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.8 Emacs/25.3 (x86_64-suse-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 22 Jan 2019 21:25:35 +0100, Mark Brown wrote: > > On Mon, Jan 21, 2019 at 03:15:43PM +0100, Jaroslav Kysela wrote: > > Dne 21.1.2019 v 13:40 Mark Brown napsal(a): > > > > It was the bit about adding more extended permission control that I was > > > worried about there, not the initial O_APPEND bit. Indeed the O_APPEND > > > bit sounds like it might also work from the base buffer sharing point of > > > view, I have to confess I'd not heard of that feature before (it didn't > > > come up in the discussion when Eric raised this in Prague). > > > With permissions, I meant to make possible to restrict the file > > descriptor operations (ioctls) for the depending task (like access to > > the DMA buffer, synchronize it for the non-coherent platforms and maybe > > read/write the actual position, delay etc.). It should be relatively > > easy to implement using the snd_pcm_file structure. > > Right, that's what I understood you to mean. If you want to have a > policy saying "it's OK to export a PCM file descriptor if it's only got > permissions X and Y" the security module is going to need to know about > the mechanism for setting those permissions. With dma_buf that's all a > bit easier as there's less new stuff, though I've no real idea how much > of a big deal that actually is. There are many ways to implement such a thing, yeah. If we'd need an implementation that is done solely in the sound driver layer, I can imagine to introduce either a new ioctl or an open flag (like O_EXCL) to specify the restricted sharing. That is, a kind of master / slave model where only the master is allowed to manipulate the stream while the slave can mmap, read/write and get status. thanks, Takashi