From patchwork Fri Jan 25 10:13:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinath Mannam X-Patchwork-Id: 10780967 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0F45E746 for ; Fri, 25 Jan 2019 10:14:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F1F6629A40 for ; Fri, 25 Jan 2019 10:14:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E655D29BBC; Fri, 25 Jan 2019 10:14:16 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AC90729A40 for ; Fri, 25 Jan 2019 10:14:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729238AbfAYKOO (ORCPT ); Fri, 25 Jan 2019 05:14:14 -0500 Received: from mail-yb1-f194.google.com ([209.85.219.194]:36110 "EHLO mail-yb1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728310AbfAYKOK (ORCPT ); Fri, 25 Jan 2019 05:14:10 -0500 Received: by mail-yb1-f194.google.com with SMTP id c65so2001660ybc.3 for ; Fri, 25 Jan 2019 02:14:09 -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=FyX1ArXOVKvRPOp9yrfUP0CSUTYZC9LeUmgndjP+YYQ=; b=Gom59CLttiaYZxslOybT9vf3fqbH7AFri5n3BxXtJ7RNSLMgi0cCWDVthrbS+GZRR2 6B3qCmBp+yQI7dvQ3hWw/X1/tJvOzj3z4ETB+L5eKi3cuSp8NMp/eru2OUFayEmRH2ge DSor2h+FVtKHhp7AJzc1cWNsGhVRmN03vL6Kw= 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=FyX1ArXOVKvRPOp9yrfUP0CSUTYZC9LeUmgndjP+YYQ=; b=Khc6HDXlyEb15Yc5D75NqBZ1aFfYmb7/J33rPnXZfyOfxt3YiUb6+E3GtgvxhhQcqs 39ut6TM1X5RjK7QTSZWlUmVQ/v/R9BEocS7HSozijvNrpbB/oplfXxrwxQnmDML236NW cF2PNAxiPPnShzbb4Kw4wDx1aERIItSfYU+Jt5aENU59hYuya8ox6V5CvPVp28p6kmyk C/WRrj6o+3cREZGUETdAR5O+IgR6d6D4wogmp3OF6sgBWmJxXX0+2vDaFXKradS/xZBx Iw0k9oVP7AvCcB0gItiMM4LMf2iBUuNmz9sPbz8NebtAg5OkjtlNujB32lqr3eN+RkUe +PlQ== X-Gm-Message-State: AJcUukcbuHDLQE1NlFLl0+7jIuar8nY6zHnmDtKjDs5q8IDFXK9kJoU1 OwN2VSSD/YBgBA7AVydx8zASSg== X-Google-Smtp-Source: ALg8bN5NFieCYJeEbFL/ROggRLmjqQxOd+qKsHtnO3lkw1dFFvjboxm5G4RNl+us6HXapOEmhDB1Cg== X-Received: by 2002:a25:6a44:: with SMTP id f65mr9656151ybc.25.1548411249438; Fri, 25 Jan 2019 02:14:09 -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.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 25 Jan 2019 02:14:08 -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 1/3] PCI: Add dma-resv window list Date: Fri, 25 Jan 2019 15:43:49 +0530 Message-Id: <1548411231-27549-2-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-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add a dma_resv parameter in PCI host bridge structure to hold resource entries list of memory regions for which IOVAs have to reserve. PCIe host driver will add resource entries to this list based on its requirements. Few inbound address ranges can't be allowed by few PCIe host, so those address ranges will be add to this list to avoid IOMMU mapping. While initializing IOMMU domain of PCI EPs connected to that host bridge IOVAs for this given list of address ranges will be reserved. Signed-off-by: Srinath Mannam Based-on-patch-by: Oza Pawandeep Reviewed-by: Oza Pawandeep --- drivers/pci/probe.c | 3 +++ include/linux/pci.h | 1 + 2 files changed, 4 insertions(+) diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index 257b9f6..fd4b143 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c @@ -544,6 +544,7 @@ struct pci_host_bridge *pci_alloc_host_bridge(size_t priv) return NULL; INIT_LIST_HEAD(&bridge->windows); + INIT_LIST_HEAD(&bridge->dma_resv); bridge->dev.release = pci_release_host_bridge_dev; /* @@ -572,6 +573,7 @@ struct pci_host_bridge *devm_pci_alloc_host_bridge(struct device *dev, return NULL; INIT_LIST_HEAD(&bridge->windows); + INIT_LIST_HEAD(&bridge->dma_resv); bridge->dev.release = devm_pci_release_host_bridge_dev; return bridge; @@ -581,6 +583,7 @@ EXPORT_SYMBOL(devm_pci_alloc_host_bridge); void pci_free_host_bridge(struct pci_host_bridge *bridge) { pci_free_resource_list(&bridge->windows); + pci_free_resource_list(&bridge->dma_resv); kfree(bridge); } diff --git a/include/linux/pci.h b/include/linux/pci.h index 65f1d8c..aa06105 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -487,6 +487,7 @@ struct pci_host_bridge { void *sysdata; int busnr; struct list_head windows; /* resource_entry */ + struct list_head dma_resv; /* reserv dma ranges */ u8 (*swizzle_irq)(struct pci_dev *, u8 *); /* Platform IRQ swizzler */ int (*map_irq)(const struct pci_dev *, u8, u8); void (*release_fn)(struct pci_host_bridge *);