Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp941530ybz; Wed, 29 Apr 2020 12:07:51 -0700 (PDT) X-Google-Smtp-Source: APiQypKsjW5eOgvj4Z6Ph5zCO2nHb2Mg+wKXxuu+QF/IIuRU0ghPZkTTlsAtgPeezmshaOEJVUOd X-Received: by 2002:a17:906:9518:: with SMTP id u24mr4090870ejx.320.1588187270823; Wed, 29 Apr 2020 12:07:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588187270; cv=none; d=google.com; s=arc-20160816; b=YxvHYepZnxT+X8inByIpF2OTbJuCcK5IAqxk5cKpFk7J9mfBFT3v/rk+N6Y13DNG/+ 7fIvcdjmZiMjOInvxYvMKqXU//ReOD2EcJxzN55CYFpgbivE0lq4Mgv4MWnXDODxC9JV Ayui+M5vY5Ny6PLh/6yDqpZlsi9OERu79X/O5QZ28jnZnDELJ3HVeUvjiLUutkM2GaNP DoDFB2Mj3P9ufnf2ypo6Uwp58rFTkZ3kaMQngJjkW3WHzgownfdQeAKhbGX0CukV6Z1T d38y2C+19geU39d65kQxV8E1Kep0d/Y9NzKVrBtoFPj4K2v6fV0w6hWp8HTysuMGI8De i0SQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=bcQKFHevt5M2/efAd2NREwTRy1wo6Zk+3v/nh8BE9EU=; b=WeZ6Wusft6fFXKBVGGmKDp5FaT1ph7QgzAoP0V1UKDYFQpQp5bD4U9SetlLZqYAnOi uiiqqcEqbQTnYXjyaj+bDHIivzixs4ahi7XV2WBmeJSNbff0IYhIfj6LtmMjQXPmr+tb 4K0v7GSWpxTEpvtQ3Z0p/kYz/vl2yZn9rGflZ/ivusamXHJcv3OY/CMZIsMreXUm1FXi /9H+3U45Sm7SgxZz3Rp5kaYpOLkFfHE4d9cUknW1KlLpDRh/rXfZK4Lr7w9cZHOV/piu SUGzDdjNzEACK3FR9+d7BRKgjDZsHZteo1JMP0c8rhWDl9cCgbw1CoMdU1nc9awBL5+4 sr7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=obcXkXxf; 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=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ci23si4320189ejb.133.2020.04.29.12.07.26; Wed, 29 Apr 2020 12:07:50 -0700 (PDT) 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=@ti.com header.s=ti-com-17Q1 header.b=obcXkXxf; 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=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726844AbgD2TF5 (ORCPT + 99 others); Wed, 29 Apr 2020 15:05:57 -0400 Received: from fllv0016.ext.ti.com ([198.47.19.142]:46252 "EHLO fllv0016.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726423AbgD2TF4 (ORCPT ); Wed, 29 Apr 2020 15:05:56 -0400 Received: from lelv0265.itg.ti.com ([10.180.67.224]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id 03TJ5inn097706; Wed, 29 Apr 2020 14:05:44 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1588187144; bh=bcQKFHevt5M2/efAd2NREwTRy1wo6Zk+3v/nh8BE9EU=; h=Subject:To:CC:References:From:Date:In-Reply-To; b=obcXkXxfKwvtsOBG3N9C8+NSR+5n2mPeUeoH8C1IASWv7teT1i321N9WBPpjEFz/5 OvLgrRIC3CtR0aXsU0amZUstyzLtzubMQKjxtkKN0/0lRRYKtc6psRSY1NVEz6GvRq BeaCmUr0IImxedlYZwNYE3PlJxhmr++mLreYoH7k= Received: from DLEE114.ent.ti.com (dlee114.ent.ti.com [157.170.170.25]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 03TJ5i9N069473 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 29 Apr 2020 14:05:44 -0500 Received: from DLEE108.ent.ti.com (157.170.170.38) by DLEE114.ent.ti.com (157.170.170.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3; Wed, 29 Apr 2020 14:05:44 -0500 Received: from lelv0327.itg.ti.com (10.180.67.183) by DLEE108.ent.ti.com (157.170.170.38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3 via Frontend Transport; Wed, 29 Apr 2020 14:05:44 -0500 Received: from [10.250.87.22] (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0327.itg.ti.com (8.15.2/8.15.2) with ESMTP id 03TJ5fbx090604; Wed, 29 Apr 2020 14:05:42 -0500 Subject: Re: [PATCH] misc: sram: Add dma-heap-export reserved SRAM area type To: Rob Herring CC: Sumit Semwal , John Stultz , Arnd Bergmann , Greg Kroah-Hartman , Philipp Zabel , dri-devel , , "linux-kernel@vger.kernel.org" References: <20200424222740.16259-1-afd@ti.com> From: "Andrew F. Davis" Message-ID: Date: Wed, 29 Apr 2020 15:05:41 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 4/27/20 11:17 AM, Rob Herring wrote: > On Fri, Apr 24, 2020 at 5:27 PM Andrew F. Davis wrote: >> >> This new export type exposes to userspace the SRAM area as a DMA-Heap, >> this allows for allocations as DMA-BUFs that can be consumed by various >> DMA-BUF supporting devices. >> >> Signed-off-by: Andrew F. Davis >> --- >> .../devicetree/bindings/sram/sram.yaml | 8 + > > Separate patch and needs to go to DT list... > Okay, will split for v2. >> drivers/misc/Kconfig | 7 + >> drivers/misc/Makefile | 1 + >> drivers/misc/sram-dma-heap.c | 243 ++++++++++++++++++ >> drivers/misc/sram.c | 20 +- >> drivers/misc/sram.h | 17 ++ >> 6 files changed, 292 insertions(+), 4 deletions(-) >> create mode 100644 drivers/misc/sram-dma-heap.c >> >> diff --git a/Documentation/devicetree/bindings/sram/sram.yaml b/Documentation/devicetree/bindings/sram/sram.yaml >> index 7b83cc6c9bfa..b8e33c8d205d 100644 >> --- a/Documentation/devicetree/bindings/sram/sram.yaml >> +++ b/Documentation/devicetree/bindings/sram/sram.yaml >> @@ -105,6 +105,14 @@ patternProperties: >> manipulation of the page attributes. >> type: boolean >> >> + dma-heap-export: >> + description: >> + Similar to 'pool' and 'export' this region will be exported for use >> + by drivers, devices, and userspace using the DMA-Heaps framework. >> + NOTE: This region must be page aligned on start and end in order to >> + properly allow manipulation of the page attributes. >> + type: boolean > > Though I'm not sure this should be in DT. You have to change your > firmware to enable a new kernel feature? We also already have 'export' > which sounds like the same function. Or 'pool' though reading the > description, I don't really understand it's use. > Maybe I could just re-use 'export', right now that property causes the SRAM region to be exported to userspace as a file one can read/write. Exporting via dma-heaps/dma-buf allows more flexibility as one can pass the exported regions to other devices or mmap them directly in userspace. It's up to the SRAM driver maintainer if re-purposing that property in the driver is acceptable. 'Pool' doesn't make much sense to me either, it creates a gen-pool out of the region, but I cant find any users not in combination with the other properties. > What combination of all 3 of these options would be valid? > From looking at the SRAM driver, it seems each of the option must be used exclusively per region, combining will cause issues. I can update the documentation for the same after we settle on a strategy for this new property. Andrew > Rob >