From patchwork Fri Jan 8 08:23:03 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Niklas_S=C3=B6derlund?= X-Patchwork-Id: 7983231 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: X-Original-To: patchwork-linux-sh@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id D259CBEEE5 for ; Fri, 8 Jan 2016 08:23:47 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id EDB082017E for ; Fri, 8 Jan 2016 08:23:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 98DC8201BB for ; Fri, 8 Jan 2016 08:23:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751700AbcAHIXo (ORCPT ); Fri, 8 Jan 2016 03:23:44 -0500 Received: from mail-lb0-f174.google.com ([209.85.217.174]:33536 "EHLO mail-lb0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751401AbcAHIXn (ORCPT ); Fri, 8 Jan 2016 03:23:43 -0500 Received: by mail-lb0-f174.google.com with SMTP id sv6so213195856lbb.0 for ; Fri, 08 Jan 2016 00:23:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ragnatech-se.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; bh=Hokf6VnuPe/eVXQdex/fa4bYBXmFxEJVFOs8qZJAooM=; b=BmlnhsUrknjqdCtze6c6qoWjnjmQeIr6mNII51YFBRk8mxZ3lFDwQz01DRvHoPRyM5 Z6PDfxRbbB8N5cD59n/iZShn2D4hcW3sts9/CEg4RrUhyqO+ynou2WM8s+SygpmQhNgG BogE5371oF2YtqsqmYfTYz9DVwnBwpIQWzXxXzUhzAfItvMO2GKRngzQ9T2JHEWvs5br HtZnO2yR1XmzEJ1ltxB+q11nER8q1yNh0IofaGQ/obszY74w0psoCOBLTwxTA0gaVWx0 VnAx/PbiM/MrfllOQth/kLjE1N8e2SJ1dqp1twIXKf8MwJNzlvpM5IvLxcS6m5J0aVW0 KQow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-type:content-transfer-encoding; bh=Hokf6VnuPe/eVXQdex/fa4bYBXmFxEJVFOs8qZJAooM=; b=KF0BWtTnhdSqYj8uLXby6bRqnLDAYwIr1rmswTpOale5gO4YY+MBbTvwOWMxAgbmpm EjKW+n8oZEYK+GTfKoVMfRuT8H70//CO0lLXuSv6UHlwyIFx89cH/7gjeEKYEzhj7HJW yD+ehK1mBAKyyJTolXIp4OuANoFD5a+Fvw7+VyQ6hQ4QgrfCwul3IZqvjbHIvwjDb76g UUugJ5FYDNOOgkV1BpP5UfGXAQ0OG91cUEq3+Ncsf9QLRKCMbXsfeVQMNZ5ttm22amBy Cuyrn/Kkrh0l+ve5A9bOVKV5tFzfDkErxislQVrnHlzYOHIKumAWct2wqjh9ays7vQi8 0VIg== X-Gm-Message-State: ALoCoQmfZkmhWh0UsuuUX+nTP/MX+D65HxOTb89lF+/zGcl1TcwPnuoJTkGdXHOmQywF2NmYaXCgjeM9ar07LFE0w6Ys4OymYQ== X-Received: by 10.112.198.102 with SMTP id jb6mr1527653lbc.44.1452241422421; Fri, 08 Jan 2016 00:23:42 -0800 (PST) Received: from bismarck.berto.se (dynamic.0.6.79d1f80.14cc20ac3a53.cust.bredband2.com. [89.233.230.99]) by smtp.gmail.com with ESMTPSA id qb3sm18374691lbb.39.2016.01.08.00.23.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 08 Jan 2016 00:23:41 -0800 (PST) From: "=?UTF-8?q?Niklas=20S=C3=B6derlund?=" X-Google-Original-From: =?UTF-8?q?Niklas=20S=C3=B6derlund?= To: linux-sh@vger.kernel.org Cc: vinod.koul@intel.com, geert+renesas@glider.be, laurent.pinchart+renesas@ideasonboard.com, =?UTF-8?q?Niklas=20S=C3=B6derlund?= Subject: [RFC 1/4] iommu: add function iommu_min_pgsize Date: Fri, 8 Jan 2016 09:23:03 +0100 Message-Id: <1452241386-22830-2-git-send-email-niklas.soderlund+renesas@ragnatech.se> X-Mailer: git-send-email 2.6.4 In-Reply-To: <1452241386-22830-1-git-send-email-niklas.soderlund+renesas@ragnatech.se> References: <1452241386-22830-1-git-send-email-niklas.soderlund+renesas@ragnatech.se> MIME-Version: 1.0 Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This function is useful for drivers wishing to learn about the minimum supported page size of the IOMMU. This information can for example be used by drivers to align memory addresses it wish to map into its iommu domain. Signed-off-by: Niklas Söderlund --- include/linux/iommu.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/include/linux/iommu.h b/include/linux/iommu.h index f28dff3..53d7e69 100644 --- a/include/linux/iommu.h +++ b/include/linux/iommu.h @@ -317,6 +317,11 @@ static inline size_t iommu_map_sg(struct iommu_domain *domain, return domain->ops->map_sg(domain, iova, sg, nents, prot); } +static inline size_t iommu_min_pgsize(struct iommu_domain *domain) +{ + return 1 << __ffs(domain->ops->pgsize_bitmap); +} + /* PCI device grouping function */ extern struct iommu_group *pci_device_group(struct device *dev); /* Generic device grouping function */ @@ -386,6 +391,11 @@ static inline size_t iommu_map_sg(struct iommu_domain *domain, return -ENODEV; } +static inline size_t iommu_min_pgsize(struct iommu_domain *domain) +{ + return -ENODEV; +} + static inline int iommu_domain_window_enable(struct iommu_domain *domain, u32 wnd_nr, phys_addr_t paddr, u64 size, int prot)