From patchwork Sat Nov 2 17:56:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 11224195 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 947A8112B for ; Sat, 2 Nov 2019 17:56:54 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7D48021726 for ; Sat, 2 Nov 2019 17:56:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7D48021726 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C8B426E321; Sat, 2 Nov 2019 17:56:47 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm1-x344.google.com (mail-wm1-x344.google.com [IPv6:2a00:1450:4864:20::344]) by gabe.freedesktop.org (Postfix) with ESMTPS id 59B216E321; Sat, 2 Nov 2019 17:56:46 +0000 (UTC) Received: by mail-wm1-x344.google.com with SMTP id 11so12571220wmk.0; Sat, 02 Nov 2019 10:56:46 -0700 (PDT) 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:mime-version:content-transfer-encoding; bh=B2PT8OgwUzPeHw6hJgNkyoN6vsJ1kDG8Ap5UUKvhze0=; b=H+hg+36TN9Jhyw0HFbzG7+ZTfqy6isEH/lBhi4k4OLmaBYCfvcU5a2SSzuNXE3OJ+A trCZ7KNFuxojo8LLWjhCzrza83sooXN+HQ0Zz2So00efroWaVg1yDj0a3d9as4l6xPe5 0bIJLOGL3dMAR3l8VRkQ58hfEIc6LRKSqDdL+qCwszaWcwc00Bjdyu33m3y7eA/zeqSx h4LNrLzA9NNefmT2Yb4Qs8ScUTWzUrekuu7DkVHa4zKqVVyY2NcmQiVNkc2u6TniFgYg tR6/7Olo5aumn2uge2M4sWl+ArvpoCQvDSj9zb1HhzjaStsLYvqQtPKedtn7c8Xg11iT X0Cg== X-Gm-Message-State: APjAAAVfGF2wcW31Ha/AQ1msdngBCZOVpHTdKJGI/HgcaQ23MLdevP0Z TbQzJ8PfezGaHrVsTCt6f5gCjWRz X-Google-Smtp-Source: APXvYqwh0vcSVJl/llQBGAobzeyZMsr7O0KniFZ1e9AEUl48sSDcCxY9VqTZMS3MRW5xlWyEDtHt4A== X-Received: by 2002:a05:600c:2295:: with SMTP id 21mr14933173wmf.85.1572717404745; Sat, 02 Nov 2019 10:56:44 -0700 (PDT) Received: from localhost (p2E5BE2CE.dip0.t-ipconnect.de. [46.91.226.206]) by smtp.gmail.com with ESMTPSA id t5sm673642wro.76.2019.11.02.10.56.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 02 Nov 2019 10:56:43 -0700 (PDT) From: Thierry Reding To: Ben Skeggs , Joerg Roedel Subject: [PATCH v2 2/9] iommu: Add dummy dev_iommu_fwspec_get() helper Date: Sat, 2 Nov 2019 18:56:30 +0100 Message-Id: <20191102175637.3065-3-thierry.reding@gmail.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191102175637.3065-1-thierry.reding@gmail.com> References: <20191102175637.3065-1-thierry.reding@gmail.com> MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=B2PT8OgwUzPeHw6hJgNkyoN6vsJ1kDG8Ap5UUKvhze0=; b=UoJ1t+XNs6ajs9GVONSz3qXRw34jZ58PHRGKTpcmzpZuD3Rldp27aTujMwoeMc636j 6eYYSls+GuGPc4z5GkVaQO3S6Uj+JAk1AJNbZM+TWhAk/SsBEScS4O2aTPto/521WH5j 25s3jNzMOxDZqwDquoQmQ7o9fgs8hKKS+unmnXs8R1E+5dACuL4NtIdc/0COAUc7Rjqq LnNZKJ08GAL1/1WZG7VIg5Qn81kVdFOBLfgx6IJp3cX4HP9ICsFdtjrlufZQ8KJZaOSX 6m5/eagAAZeFQEoHvsGgoUTWm289Fztk2pB7yQ0B0FZEYFg3jod1/YAb+ET6nm25SdMk /SzA== X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-tegra@vger.kernel.org, nouveau@lists.freedesktop.org, Ben Dooks , dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Thierry Reding This dummy implementation is useful to avoid a dependency on the IOMMU_API Kconfig symbol in drivers that can optionally use the IOMMU API. In order to fully use this, also move the struct iommu_fwspec definition out of the IOMMU_API protected region. Suggested-by: Ben Dooks Signed-off-by: Thierry Reding --- include/linux/iommu.h | 47 ++++++++++++++++++++++++------------------- 1 file changed, 26 insertions(+), 21 deletions(-) diff --git a/include/linux/iommu.h b/include/linux/iommu.h index 7bf038b371b8..b092e73b2c86 100644 --- a/include/linux/iommu.h +++ b/include/linux/iommu.h @@ -190,6 +190,27 @@ struct iommu_sva_ops { iommu_mm_exit_handler_t mm_exit; }; +/** + * struct iommu_fwspec - per-device IOMMU instance data + * @ops: ops for this device's IOMMU + * @iommu_fwnode: firmware handle for this device's IOMMU + * @iommu_priv: IOMMU driver private data for this device + * @flags: IOMMU flags associated with this device + * @num_ids: number of associated device IDs + * @ids: IDs which this device may present to the IOMMU + */ +struct iommu_fwspec { + const struct iommu_ops *ops; + struct fwnode_handle *iommu_fwnode; + void *iommu_priv; + u32 flags; + unsigned int num_ids; + u32 ids[1]; +}; + +/* ATS is supported */ +#define IOMMU_FWSPEC_PCI_RC_ATS (1 << 0) + #ifdef CONFIG_IOMMU_API /** @@ -565,27 +586,6 @@ extern struct iommu_group *generic_device_group(struct device *dev); /* FSL-MC device grouping function */ struct iommu_group *fsl_mc_device_group(struct device *dev); -/** - * struct iommu_fwspec - per-device IOMMU instance data - * @ops: ops for this device's IOMMU - * @iommu_fwnode: firmware handle for this device's IOMMU - * @iommu_priv: IOMMU driver private data for this device - * @flags: IOMMU flags associated with this device - * @num_ids: number of associated device IDs - * @ids: IDs which this device may present to the IOMMU - */ -struct iommu_fwspec { - const struct iommu_ops *ops; - struct fwnode_handle *iommu_fwnode; - void *iommu_priv; - u32 flags; - unsigned int num_ids; - u32 ids[1]; -}; - -/* ATS is supported */ -#define IOMMU_FWSPEC_PCI_RC_ATS (1 << 0) - /** * struct iommu_sva - handle to a device-mm bond */ @@ -980,6 +980,11 @@ const struct iommu_ops *iommu_ops_from_fwnode(struct fwnode_handle *fwnode) return NULL; } +static inline struct iommu_fwspec *dev_iommu_fwspec_get(struct device *dev) +{ + return NULL; +} + static inline bool iommu_dev_has_feature(struct device *dev, enum iommu_dev_features feat) {