From patchwork Thu Mar 26 15:08:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joerg Roedel X-Patchwork-Id: 11460415 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 9791F14B4 for ; Thu, 26 Mar 2020 15:09:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 82A5E2077D for ; Thu, 26 Mar 2020 15:09:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728551AbgCZPJj (ORCPT ); Thu, 26 Mar 2020 11:09:39 -0400 Received: from 8bytes.org ([81.169.241.247]:55834 "EHLO theia.8bytes.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728148AbgCZPIv (ORCPT ); Thu, 26 Mar 2020 11:08:51 -0400 Received: by theia.8bytes.org (Postfix, from userid 1000) id 516677BA; Thu, 26 Mar 2020 16:08:47 +0100 (CET) From: Joerg Roedel To: iommu@lists.linux-foundation.org Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-mediatek@lists.infradead.org, guohanjun@huawei.com, Sudeep Holla , Rob Clark , Sean Paul , Will Deacon , Robin Murphy , Joerg Roedel , Matthias Brugger , Thierry Reding , Jean-Philippe Brucker , Andy Gross , Bjorn Andersson , Greg Kroah-Hartman , Joerg Roedel Subject: [PATCH v4 08/16] iommu: Introduce accessors for iommu private data Date: Thu, 26 Mar 2020 16:08:33 +0100 Message-Id: <20200326150841.10083-9-joro@8bytes.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200326150841.10083-1-joro@8bytes.org> References: <20200326150841.10083-1-joro@8bytes.org> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org From: Joerg Roedel Add dev_iommu_priv_get/set() functions to access per-device iommu private data. This makes it easier to move the pointer to a different location. Tested-by: Will Deacon # arm-smmu Reviewed-by: Jean-Philippe Brucker Signed-off-by: Joerg Roedel --- include/linux/iommu.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/include/linux/iommu.h b/include/linux/iommu.h index f5edc21a644d..056900e75758 100644 --- a/include/linux/iommu.h +++ b/include/linux/iommu.h @@ -627,6 +627,16 @@ static inline void dev_iommu_fwspec_set(struct device *dev, dev->iommu->fwspec = fwspec; } +static inline void *dev_iommu_priv_get(struct device *dev) +{ + return dev->iommu->fwspec->iommu_priv; +} + +static inline void dev_iommu_priv_set(struct device *dev, void *priv) +{ + dev->iommu->fwspec->iommu_priv = priv; +} + int iommu_probe_device(struct device *dev); void iommu_release_device(struct device *dev);