Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1482447imu; Tue, 11 Dec 2018 21:48:25 -0800 (PST) X-Google-Smtp-Source: AFSGD/VyRvs71UQp1i05KtUQ2ya80hgI6jcQnBUyx/34bbHIQT04ipRggMBkqYxPOTyLVL+jeGfd X-Received: by 2002:a62:2f06:: with SMTP id v6mr19314213pfv.216.1544593705684; Tue, 11 Dec 2018 21:48:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544593705; cv=none; d=google.com; s=arc-20160816; b=r01x7mJGW2+BEFRFeSuAFCqHIw0TUbSJybxKAH2sQdc+CqlYByNzlFrIHejQjvikCj FLftZcrFaW793St/ustNVkzUj0LdUAZrJ9LBGrkqIDgR5RUy2VjWADL78CQKIpfbFesD +dl5IRgMAWczk6FJrGt7/ttNbAaOmEhAK0q7n1UsoJpm7zvwGaGuFQsNDF0sU47dGHCw OBGInKI/mGKb/+xnv/ySUPibkFxUN5W8a+sQBAUnR81EuvHinSPPcj4mEILixpUDbCUm cEnGfsGAlgxnCDI6UjFnhPg6OvdM+vqk21k82vYJn9ObQXTcpwM2B3e3L+45NzcELsRL qGjg== 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=4aT+lpIc+NJpqnZ6pq48JRajzcrSuiEPbqJBDas7aFM=; b=hu9YiiScB3aKnSK/ddHEwCfhFJx1zLKIXK1Tvp2srMk5uPu6qQn4k4yDbVhUKLh48a RbI/8d6B6CRtjNnS5plFcmPEDvGVSotRtuD2cCajHW3qyA89tgx7tQrOGlvNhS4M6afr BZFjTkGaaBuJSKeKWhmut9BlinMemb18oNwzHAoU6HRv24OAamtTD+xtABYoHcp1KZl5 3vTzmBztaZCCrIqaICAQgbYWhL1XDI9jhXSIwg8Xs2Y99KEJyzf6HQTv48HPW1wSMWFy T138BknXTOCdcDwPg0p2tyVNRCB3448RNOZXmD3ZhpYAWOg9gZ6DJkQErcRkPUSWoY04 yzbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=hNkJ0s9N; 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 a6si14352133pfo.90.2018.12.11.21.48.02; Tue, 11 Dec 2018 21:48:25 -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=hNkJ0s9N; 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 S1726522AbeLLFqn (ORCPT + 99 others); Wed, 12 Dec 2018 00:46:43 -0500 Received: from mail-wm1-f66.google.com ([209.85.128.66]:53286 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726500AbeLLFqm (ORCPT ); Wed, 12 Dec 2018 00:46:42 -0500 Received: by mail-wm1-f66.google.com with SMTP id y1so4418526wmi.3 for ; Tue, 11 Dec 2018 21:46:41 -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=4aT+lpIc+NJpqnZ6pq48JRajzcrSuiEPbqJBDas7aFM=; b=hNkJ0s9Nm8OfkASjOtmSpBDFwguWfVpT0QPfrdhUguj4qkvQj62N0NNuETViSSyqrA iU1mq/wR8sHku5gV8M6kcIsL2XYszCnuFGjD5VUwdl283ynfCIT1PuWrOdPvXDwjcDPK H1pkccsxROjIe65x2bT3DEB1wXzUD3pofvqcw= 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=4aT+lpIc+NJpqnZ6pq48JRajzcrSuiEPbqJBDas7aFM=; b=jAZvCSZiUbzc4Ju3xEa8ia9eU+jAGyg06YerRqw/U0J6gMryFO9jEd9k/O7Js+K9KD l6J5/ui6fsACmRjjJ3qmya2+DNWkAw/JMrWSTQp0h5PZgVy74q4s/tSMmT+KrueTzt6g KwXWqhF0o6BaO0O1A7jSqoW/1bWf3pO13onfVCn1UwhoYuzvuTRRwtknb37eEBRptioN oXxlEjowuX8HJ48Lia5LwIz/oYX67gsrFXRLO3ssnu+3bI2eNnMEY3Z4vWCBafXMsYgH 8kjqI77L8yUlValj2UlYs7bjJMoYdZGda34WCc4uuyYH3nI2GtZ37oS31ICfupkhXEji YBTQ== X-Gm-Message-State: AA+aEWZp1a8PMVLM1BJCys9KyK49MJDVV+nyqAlEC5vA01vfn7p7wafi daVmqd/mtW8GHXK9r6OdN5gfgA== X-Received: by 2002:a1c:888d:: with SMTP id k135mr5166553wmd.137.1544593600964; Tue, 11 Dec 2018 21:46:40 -0800 (PST) Received: from mannams-OptiPlex-7010.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id z206sm2015947wmc.18.2018.12.11.21.46.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 11 Dec 2018 21:46:40 -0800 (PST) From: Srinath Mannam To: Bjorn Helgaas , Robin Murphy , Joerg Roedel , Lorenzo Pieralisi , 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: [RFC PATCH 2/3] iommu/dma: IOVA reserve for PCI host reserve address list Date: Wed, 12 Dec 2018 11:16:08 +0530 Message-Id: <1544593569-8923-3-git-send-email-srinath.mannam@broadcom.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1544593569-8923-1-git-send-email-srinath.mannam@broadcom.com> References: <1544593569-8923-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 has list of resource entries contain memory address range for which IOVA address mapping has to be reserve. These address ranges are the address holes in dma-ranges property. It is similar to PCI IO resources address range reserving in IOMMU for each EP connected to corresponding host. Signed-off-by: Srinath Mannam --- 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 511ff9a..346da81 100644 --- a/drivers/iommu/dma-iommu.c +++ b/drivers/iommu/dma-iommu.c @@ -220,6 +220,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