Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp189769imm; Tue, 21 Aug 2018 17:27:07 -0700 (PDT) X-Google-Smtp-Source: AA+uWPyJeEw4kbYAZ032MPReshqnXGoslgEsUIXorS2/w/AgRAg3t7WbqXgOgyURV4JP+4Tx7Ekb X-Received: by 2002:a63:a053:: with SMTP id u19-v6mr22128626pgn.394.1534897627126; Tue, 21 Aug 2018 17:27:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534897627; cv=none; d=google.com; s=arc-20160816; b=WcDD3dCKS63uAy1tW5f9XZnHz/vM6KaRo7qQp+q7uX1x9upoCW5HZgT6zOZdnTs0GY y0lJeku25dQESQQ6MK9GM7iYPmUYsMw/lm36qnBDbwV3vgI255osfeZp0uL1lFEg8Owq Fb/xb9QaVFnXH64uxSyplcEVX8m8/Urycv8O3yNCimDI5fZLL3/Q2ntUhAJ5ydcPRW4o tq64C1ZgxrYsrn45KExkE+b+D+e6WzLrchitPGZ7HAgqvp+BvW0KkB67Xh5CcW2spWu8 VvQyiMwMr2KhBjT+1ayXXai7yzc8IzZob8k2SCMRdf1dtN+CTnMibuLOMeZ7DnGQkGqb cQFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature :arc-authentication-results; bh=vZoCTziB1BK4w5K6aOMYwcKsdM5pkb6Gpmm70xX5LjA=; b=KdojPq4ugKwKwzw6WcbjGSq4fg9TwvJ1NWKZ4uQYSy6ZNGIshi4qQBEgQr4+QrMwVC TzGxoCPFIo2PvFBlQH22RgrXjsOYcXwZJ6zINq8RPz/eJQuGZh8GU5nh3396JB9f6iZ1 rKqkAaayy0fRGkqsoCXMMmlTZacrXGfQkqExpAqUsjUvSVVkqHGmJY+1srGJAoLnV9PS v6U7Eqs278G4BKatxQ0O/OmcZ72FZZopLdItd/lPHoRZ2ijoNPFh7WUaysz6yove+OPB RlCbV9CAA902OWVSE3hBWWKJyW/sThm6x8VtlDTloPzdFkLHfhE9fs78IPcY2m2Bn6Z0 roIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alexfeinman-com.20150623.gappssmtp.com header.s=20150623 header.b=Mwm9xk9N; 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 d36-v6si174930pla.446.2018.08.21.17.26.26; Tue, 21 Aug 2018 17:27:07 -0700 (PDT) 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=@alexfeinman-com.20150623.gappssmtp.com header.s=20150623 header.b=Mwm9xk9N; 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 S1727613AbeHVDMv (ORCPT + 99 others); Tue, 21 Aug 2018 23:12:51 -0400 Received: from mail-yb0-f179.google.com ([209.85.213.179]:34900 "EHLO mail-yb0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727027AbeHVDMv (ORCPT ); Tue, 21 Aug 2018 23:12:51 -0400 Received: by mail-yb0-f179.google.com with SMTP id o17-v6so55199yba.2 for ; Tue, 21 Aug 2018 16:50:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alexfeinman-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=vZoCTziB1BK4w5K6aOMYwcKsdM5pkb6Gpmm70xX5LjA=; b=Mwm9xk9Nh5oXJJwinOCqdhC4/AmayU0cz/GvrWyMCR5cVbR1HN0Fv7TRWB4e9ZPuD2 5rVe9RDwtxRSsOSYSH88bwiRMzPqlvj1tgxF/H8zNuq/qJflBnt7Ly6MUNgnUH4SQFNT CaTVFohBcS6FG/dGRGoXKG+7WTGpW6eh2ZCLf78q2sStsRufUwud9MEGwkk/mVUrJYui 4gSpYJrd5nCC5/Ssj1Fz7wOeisE61MDLta2Z9IzVZAWtcNaQv0chzoS6P06Q+xHpDJNG G3aijKm6T3Vxmncr0uBRWUz1v6/a/w8QKgRj95UmBHrWRkJSETa+QG1gUrCzj1w7zBPp lwRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=vZoCTziB1BK4w5K6aOMYwcKsdM5pkb6Gpmm70xX5LjA=; b=XwkfekQsXrzy96Nfk5Rr86DjoKQX4JMv73cJz29WvqGXxepk98/zTtXb+KHwyeOBxe aP7TnOVcBi985ZBk1z9WD48NhuGxVk+zH68jjSG/GaljrLv13Ukhlck47nLYFtSXAtHa YN7Xaqg3WV3isFbdGCyInrjeyt/RMOaqtpBLXeRvTEJ3xr37yZcnVrGcll4sSZ0XJK0d ZwsXAlJehNyw3fI0ktjVlItCL4aAo9dLwOOsG2fNdv86PqgrYEP+R+jg4VCRsIvp/Srt AXXHHzfMQuPiErO+yW9ymB9rj4tO9JMuJ883xlqJcIrKievhMaQ61nz9+KGiUFRqOJCa 8BQg== X-Gm-Message-State: AOUpUlFTmb/vN3GonWJSMv2rwpbsC61Uqw4LKMuqy/o9qVgobVzvZMPL MxQbOv3XvvGc68B0A4iaI3W8fETHcuGTfXhau4lCXg== X-Received: by 2002:a25:8b:: with SMTP id 133-v6mr16303595yba.11.1534895433629; Tue, 21 Aug 2018 16:50:33 -0700 (PDT) MIME-Version: 1.0 References: <20180820215804.67c78e3d@alans-desktop> In-Reply-To: <20180820215804.67c78e3d@alans-desktop> From: Alex Feinman Date: Tue, 21 Aug 2018 16:50:22 -0700 Message-ID: Subject: Re: Contiguous DMA buffer view for a custom device (Intel/x86) To: gnomes@lxorguk.ukuu.org.uk Cc: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Thanks, this sounds like what I need. However, since this is a custom-purpose system, I am tempted to go with CMA and simply preallocated 200MB on start On Mon, Aug 20, 2018 at 1:58 PM Alan Cox wrote: > > > b) IOMMU can solve this problem for me by providing a device-specific > > contiguous view of a fragmented physical memory allocation > > c) In order to enable IOMMU do the above, I need to allocate DRHDs and > > DMARs in BIOS initialization (I build my own BIOS) > > Yes. The EDK2 firmware toolkit has all the bits you need in it I think. > > https://firmware.intel.com/sites/default/files/Intel_WhitePaper_Using_IOMMU_for_DMA_Protection_in_UEFI.pdf > > isn't quite on the topic you want but it does explain it fairly well in > passing. > > https://software.intel.com/en-us/blogs/2009/03/02/intels-virtualization-for-directed-io-aka-iommu-part-1 > > is a bit out of date but may help too. > > > Please, let me know if I am on the right track? Of course I realize that > > implementing SGDMA would be the best option, but short of that and blocking > > out some physical memory on boot, what are my options? > > If performance is absolutely critical simply stealing a chunk of memory > in the firmware and describing it your device some other way is ugly, but > for a custom solution I guess anything goes 8) > > Alan