Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp285826imu; Fri, 25 Jan 2019 02:15:00 -0800 (PST) X-Google-Smtp-Source: ALg8bN7BwAQPi4VMAUtppn/NNQSxqoM6/2KY0mdJG471ampHnd0VEHEFdDybXIeQJIKCjkrLuPyO X-Received: by 2002:a62:1a91:: with SMTP id a139mr10703865pfa.64.1548411300794; Fri, 25 Jan 2019 02:15:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548411300; cv=none; d=google.com; s=arc-20160816; b=UMMqTwCPoKHdzvzfGaPRkRXxR7Y2rTjmar76Vdn0A9CTC7B5+oIO7CYmjzLIQm9KWJ 0+ebwdq01HyAbS2Nj1XugTsee0TFIAizbCnSSmfjFSwQdCzGcQoqVRJPglchvt2CTf7r IW0bQDiyuSeTzWhORjkI48dnRj3cB3ezCJxDUVDiyN7JtRAsD7768MWIVd0OKRtd1FmE VyaeBlPB4x87k0NtPwZ31A35ypBLdlreTBU1vm89CKhGgeaGkpJ7Jddbd1QwJ5qVgNVW WtcmvcL3FWpMkzPiyTN9AIEXHpTyOi7EUFql9qY0dG8HiZ+2bZDmuwgdKvQ/3dpX7Yr5 sKMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=063dcY3/vP5rDMt/yMZyLAKDPwT36w8/uKywwVSqR7A=; b=ZyL45cB+ID6xdBdPYuhQAwk2e9y/z3n9TlSwn9TUQmG+tEHDdyO/cTfh+fdwNmBUhJ 560AUFDnRhnOWft9rchpXg9ZCu5slubzEfdguAi22ZP1O2EKp+Tvj4ry4Z9V/kkn2+gd Qg+NACvAK9NggnV4DggXnYzUfufRPosEkM6zYir47oR7go4shzXzFTV5F+3/XYGsX90n CS0d49uPWW8inSb82ONH6Auc4IkxOSC1AgoYTsCbTraZ8gQU+vJOIgwCFjtM/5acIquO xlpat7bCljDdiYnxEhO9YqT+mDuJ4X3k0YyFJFaBkl+PLMs1Q8IERARB4JKivunLmi+6 Ezaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=OUkU7jW5; 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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p2si25791066pgr.133.2019.01.25.02.14.45; Fri, 25 Jan 2019 02:15:00 -0800 (PST) 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=@broadcom.com header.s=google header.b=OUkU7jW5; 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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728531AbfAYKOP (ORCPT + 99 others); Fri, 25 Jan 2019 05:14:15 -0500 Received: from mail-yb1-f195.google.com ([209.85.219.195]:41673 "EHLO mail-yb1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727955AbfAYKOO (ORCPT ); Fri, 25 Jan 2019 05:14:14 -0500 Received: by mail-yb1-f195.google.com with SMTP id y63so3608203ybc.8 for ; Fri, 25 Jan 2019 02:14:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=063dcY3/vP5rDMt/yMZyLAKDPwT36w8/uKywwVSqR7A=; b=OUkU7jW5T0JFjB5c1nbeePMkV51tr14zOf7WXdsd5B45p4Bd28foWEwE0WcL3pJjl8 FlYibvC8s9aUinlGQ/v1A84bDetYuMhxkrRF5F0JlZsF0oERQjwbqJaxf4VQQKwxee7d s/jLCYa7iktz9Q6rYS7yJVYA3JbU9WtyDbCl0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=063dcY3/vP5rDMt/yMZyLAKDPwT36w8/uKywwVSqR7A=; b=dFSWLCz2/WPQKOg/sz34YqHux7zvMG/w8x0M3lNGA6JPlXS//hmh3FbVLo9KiSLMMY QTRQhrki5FWKbnfxGGntb7gDUM+T5XLTz6coCpAMHHL2kZQ+Hr4kssF1IEVgunXxD0bP lqBt/M591CnFzimqKTUe2FT6LpYkp5vkZGx+W/GwXAUXhMcYL7+WGr3xHclcGC03VQ5I o/RDloiiyBHodCTIPENrBRl1dGh9Foo9Hk1hBsqPtzQVzpGX0njDj7y+jFnsNnqGjbvV pdkmq7ChwKYDS70Vwk8NaYvOQbp4PD5THmKIROX0CZtFXhPNgdkn1SJKY8an7yZIpOol cdwQ== X-Gm-Message-State: AJcUukclLzLchSIJXEDo7GeZr/+Z41nL+h4gGYoK5hMSVMH+X1BJ/f0J ZiRi/XlZ2ochxhQ6FW3aAzO2Pg== X-Received: by 2002:a25:6e42:: with SMTP id j63mr9601386ybc.302.1548411253878; Fri, 25 Jan 2019 02:14:13 -0800 (PST) Received: from mannams-OptiPlex-7010.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id x203sm11868695ywd.41.2019.01.25.02.14.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 25 Jan 2019 02:14:13 -0800 (PST) From: Srinath Mannam To: Bjorn Helgaas , Robin Murphy , Joerg Roedel , Lorenzo Pieralisi , poza@codeaurora.org, Ray Jui Cc: bcm-kernel-feedback-list@broadcom.com, linux-pci@vger.kernel.org, iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org, Srinath Mannam Subject: [PATCH v3 2/3] iommu/dma: Reserve IOVA for PCI host reserve address list Date: Fri, 25 Jan 2019 15:43:50 +0530 Message-Id: <1548411231-27549-3-git-send-email-srinath.mannam@broadcom.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1548411231-27549-1-git-send-email-srinath.mannam@broadcom.com> References: <1548411231-27549-1-git-send-email-srinath.mannam@broadcom.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org PCI host bridge has list of resource entries contain address ranges for which IOVA address mapping has to be reserve. These address ranges are the address holes in dma-ranges DT property. It is similar to PCI IO resources address ranges reserving in IOMMU for each EP connected to host bridge. Signed-off-by: Srinath Mannam Based-on-patch-by: Oza Pawandeep Reviewed-by: Oza Pawandeep --- drivers/iommu/dma-iommu.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/iommu/dma-iommu.c b/drivers/iommu/dma-iommu.c index d19f3d6..81b591b 100644 --- a/drivers/iommu/dma-iommu.c +++ b/drivers/iommu/dma-iommu.c @@ -221,6 +221,14 @@ static void iova_reserve_pci_windows(struct pci_dev *dev, hi = iova_pfn(iovad, window->res->end - window->offset); reserve_iova(iovad, lo, hi); } + + /* Get reserved DMA windows from host bridge */ + resource_list_for_each_entry(window, &bridge->dma_resv) { + + lo = iova_pfn(iovad, window->res->start - window->offset); + hi = iova_pfn(iovad, window->res->end - window->offset); + reserve_iova(iovad, lo, hi); + } } static int iova_reserve_iommu_regions(struct device *dev, -- 2.7.4