Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp4328415imm; Mon, 20 Aug 2018 13:59:27 -0700 (PDT) X-Google-Smtp-Source: AA+uWPwfsEiiDRQDweDAKTU7PjgerAoyQFwccrJnsSSac1EzGZK6ocQzwf8oNAqH8n1jCPpivVxs X-Received: by 2002:a62:f208:: with SMTP id m8-v6mr49821808pfh.171.1534798767432; Mon, 20 Aug 2018 13:59:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534798767; cv=none; d=google.com; s=arc-20160816; b=ePhYf//E7PuTc3h3Vc8e6B6bzefzWjo36alqn+tru0MnbUJaMSONYVu95cCU7BQcny trRYILylG+KlRi5aAXpAueFiB+n+2bnwnP8jYo18yq8jEIjpUw+ze9vEFuSR2DL5lOJU /VvwzFx8YACtdeumXe5UweH6uRq9iVhHxgnilwiPSWa7V0bXL/JHIokFNPc3ceID7nfl TN2eOUFTKnQBC309GHL0YjjgQRwjHER3CvKisDdUDTCLPR0YvPVSjXFwYSEmvAv7VjRB 1FZ1tMvNuxa0Fwp5ZHAJcPzuLzoSGZktJX/KRvETFVDdOKUtENmSeIndRAiUdgWXum0E buFQ== 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:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date:arc-authentication-results; bh=w77PFM8Rb+4RM1xfWPnV0piSoTFiC86psp0QEtjnRKo=; b=BQ0pPtAeRdPqBIxNAdfqvM7gpdX6AcBlh5Jw9ruznV5Q9Bdb9eWPA9ZK03oJhZDZ4e pOGDj35ck/MnGs75Rbtgd3e2U+ewA3XwWbd8OA7ZnWo3H5PZ/azhTfpB0I2ECGSLsx+D phj7HCZWWw+EjErgr8LIeff6P6yVq0YFCuRyHXZdoaC2zaY6b83w8i6V51z6o9XNSY1b YI36iNlQKTIJRbZ2ue6aUziV8pFhchQipWv4K/n9W4qr1W01h+98hckzSKc0wahXGcjb /mVMORNuyIjbK6WDafSDYOAf4kVBG6+N99+vGZp8HvHBflVK1h44wmXzA7M9UgRxFhmp uyIw== 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 e82-v6si11124516pfh.64.2018.08.20.13.59.12; Mon, 20 Aug 2018 13:59:27 -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; 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 S1726843AbeHUAPT (ORCPT + 99 others); Mon, 20 Aug 2018 20:15:19 -0400 Received: from www.llwyncelyn.cymru ([82.70.14.225]:43874 "EHLO fuzix.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726488AbeHUAPS (ORCPT ); Mon, 20 Aug 2018 20:15:18 -0400 Received: from alans-desktop (82-70-14-226.dsl.in-addr.zen.co.uk [82.70.14.226]) by fuzix.org (8.15.2/8.15.2) with ESMTP id w7KKw5rM002794; Mon, 20 Aug 2018 21:58:05 +0100 Date: Mon, 20 Aug 2018 21:58:04 +0100 From: Alan Cox To: Alex Feinman Cc: linux-kernel@vger.kernel.org Subject: Re: Contiguous DMA buffer view for a custom device (Intel/x86) Message-ID: <20180820215804.67c78e3d@alans-desktop> In-Reply-To: References: Organization: Intel Corporation X-Mailer: Claws Mail 3.16.0 (GTK+ 2.24.32; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > 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