Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp4313548imm; Mon, 20 Aug 2018 13:40:45 -0700 (PDT) X-Google-Smtp-Source: AA+uWPwSExabavE/+QfygPLRr82UXjlMUzIThHHB2iaZdZdq5DIE1PhhRapV3BpuwGm77LWgT4Ld X-Received: by 2002:a17:902:d917:: with SMTP id c23-v6mr12218825plz.65.1534797645280; Mon, 20 Aug 2018 13:40:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534797645; cv=none; d=google.com; s=arc-20160816; b=ev2RZ+Il+Ovty5HyzXZ1oNdTpvOjiwoMsmWqrCxkddy6esNrG0JeZqTK1deT6sFLCI g+0y1Fuwd9xwQaWP2UifUBOGSsLKRnpK3p7K3M+ow6llWcNvXAlvWHFyMg1I5CH2cJCw LNtCIlKCKfrBKBmJ3Z8awQhewO79B7r7FAd1iz1/ECKDl1FXGtXTuiUajr7cP+wvJ4dS oo1kHlMnXrDEa/jMCQmmSmKYqoozPTqCjKSRnLLx2RIvxzeYss0t/qPKquyAEZvtdhCD gk51sYd+i4R9oBpJpTgXZS5Pr0VPk7IiYdUr11eDZRUueIwImNJ9sn/aev2JF+ddU8vr ITGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:subject:message-id:date:from :mime-version:dkim-signature:arc-authentication-results; bh=ZPERd6ujXtX+mvUghseDqBYvP8ppFYj6YEeS+uTpwc8=; b=LYIhzrd/w/QPfLi6uSobjNE+8d45I+bS3eEutHkErTO501yHvjxEIy6ZBi0p3RZKIv ItjdxIKWHpgfVDTMD3nXg0Za/Rqui8O4/KCw+pH+VQ8w5Ywlba/ScGOGLzbvBXMgeSho SSR2aZsOEQP/Ef/4YjOk36QQAiWRlNJ4l2Sc4IwDpwdkowCQeKma6qATpUOQseNdv+8Z 02E7ygwYvSQz424NaYR05j3rOBz/PmmA2S9/oYVKhhDesb1adeJJ+3+p2BHoTa6H3wKl vyqNzd75HkEvCpVb0eO8G4vciGR521Eu63TNZHdmiPLP8bV9YisE5OpHIQS8YDnooOET Iazw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alexfeinman-com.20150623.gappssmtp.com header.s=20150623 header.b=An2naeXi; 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 f27-v6si10679121pfk.97.2018.08.20.13.40.29; Mon, 20 Aug 2018 13:40:45 -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=An2naeXi; 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 S1726681AbeHTX4X (ORCPT + 99 others); Mon, 20 Aug 2018 19:56:23 -0400 Received: from mail-yb0-f178.google.com ([209.85.213.178]:33797 "EHLO mail-yb0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726488AbeHTX4X (ORCPT ); Mon, 20 Aug 2018 19:56:23 -0400 Received: by mail-yb0-f178.google.com with SMTP id t10-v6so1575167ybb.1 for ; Mon, 20 Aug 2018 13:39:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alexfeinman-com.20150623.gappssmtp.com; s=20150623; h=mime-version:from:date:message-id:subject:to; bh=ZPERd6ujXtX+mvUghseDqBYvP8ppFYj6YEeS+uTpwc8=; b=An2naeXiAYqnJyWB+9kGPGNr60GqqF9WZB/ML9MEJJr3Vrl2uSSgJ0NDc5eirYIAgN 3wgx4qOR2wkpVytZ6tPb1LiJMclTpl2HMkDsvl2My7dVmlReFvw6E9MqN9TZXM1DID4O Z/JWmgzY4pPtKAdbfVn/TYpLLYhGmWhf/WPmQOUNt3n0Qx6KwvRvAozNTefBJnfpefuW AlcEduo3pmEtt66eA7VZYwNDm7TZfq94l+Jr9m8zqLL5PPIUhrIvqjEr4QQfft0PGqJW EZXjkE4HA4uvYPkGlC66l6jn76jOCmxCjDRgTfwk02wgkEx6ZOzqXoNA98me0l8L95+6 uO6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=ZPERd6ujXtX+mvUghseDqBYvP8ppFYj6YEeS+uTpwc8=; b=NPchHyFtB2w9fivvB4f46Fdpqauf6MghpiCtuTm09I15SP8VPbzxuDE0OacRXmqC/r Jbd9Z7fh8TEgfSwnVk0Fh9VX10FY7id57AyvLC26OAXEmdcHcRdxVbQs4vM7Ot9RGxLF PBariPJb4IUKH8kQ3Gw9BkRtM6qe7yUMrbzV7BaPSjEdvAZB8/wIJPYI0gjod738SvKy GMtOeGZU5mN4yGlmKITLPSwvukQ8c2x536XMHF4CQd258dM72hqTNqRkH1YcxpvIG8ve +2qbtB99u1+JyWAMA20HYIKAFf7tcBjo+7J6YPfyOvQg2G8XHDq13byz5QnbThR6nXXH 6YRA== X-Gm-Message-State: AOUpUlG861QYL+AVx4dH7OIjDF1PVIvEimkK5t0wbTnUhdCJYRn8jNFh WRkhhXsmi2+tQ3r+9aXFMk4yQ9xKTw5RyhdndVzaf2i+ X-Received: by 2002:a25:ba8f:: with SMTP id s15-v6mr2527307ybg.305.1534797557224; Mon, 20 Aug 2018 13:39:17 -0700 (PDT) MIME-Version: 1.0 From: Alex Feinman Date: Mon, 20 Aug 2018 13:39:06 -0700 Message-ID: Subject: Contiguous DMA buffer view for a custom device (Intel/x86) To: 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 Good morning. I have a custom PCI device that needs to fill memory buffers of up to 16MB in size. For various reasons I would like to avoid implementing scatter-gather support in the device and would much rather prefer a contiguous buffer view instead. The buffers are allocated using dma_alloc_coherent or dma_alloc_attrs (as I don't necessarily need coherent access) This is on a custom Skylake/Kaby Lake platform It is my understanding (possibly incorrect) that a) The contiguous memory space available to subsystems like videobuf2-dma-contig is limited and I won't be likely to be able tp allocate say 4 16MB contiguous buffers reliably 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) 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? Are there any pointers of how exactly achieve this (implementation I could peruse, articles and whatnot)? Best regards Alex Feinman ReplyForward