From mboxrd@z Thu Jan 1 00:00:00 1970 From: Robin Murphy Subject: Re: [PATCH V10 05/12] ACPI/IORT: Add function to check SMMUs drivers presence Date: Tue, 4 Apr 2017 12:04:39 +0100 Message-ID: References: <1489086061-9356-1-git-send-email-sricharan@codeaurora.org> <1491301105-5274-1-git-send-email-sricharan@codeaurora.org> <1491301105-5274-6-git-send-email-sricharan@codeaurora.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1491301105-5274-6-git-send-email-sricharan-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: iommu-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org Errors-To: iommu-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org To: Sricharan R , will.deacon-5wv7dgnIgG8@public.gmane.org, joro-zLv9SwRftAIdnm+yROfE0A@public.gmane.org, lorenzo.pieralisi-5wv7dgnIgG8@public.gmane.org, iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org, linux-arm-msm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, m.szyprowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org, bhelgaas-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org, linux-pci-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-acpi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, tn-nYOzD4b6Jr9Wk0Htik3J/w@public.gmane.org, hanjun.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org, okaya-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org, robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org, frowand.list-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org, devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, sudeep.holla-5wv7dgnIgG8@public.gmane.org, rjw-LthD3rsA81gm4RdzfppkhA@public.gmane.org, lenb-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org, catalin.marinas-5wv7dgnIgG8@public.gmane.org, arnd-r2nGTMty4D4@public.gmane.org, linux-arch-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org List-Id: iommu@lists.linux-foundation.org On 04/04/17 11:18, Sricharan R wrote: > From: Lorenzo Pieralisi > > The IOMMU probe deferral implementation requires a mechanism to detect > if drivers for SMMU components are built-in in the kernel to detect > whether IOMMU configuration for a given device should be deferred (ie > SMMU drivers present but still not probed) or not (drivers not present). > > Add a simple function to IORT to detect if SMMU drivers for SMMU > components managed by IORT are built-in in the kernel. Ah, if only DT could be this neat and tidy :D Reviewed-by: Robin Murphy > Tested-by: Hanjun Guo > Signed-off-by: Lorenzo Pieralisi > Cc: Robin Murphy > Cc: Sricharan R > --- > drivers/acpi/arm64/iort.c | 13 +++++++++++++ > 1 file changed, 13 insertions(+) > > diff --git a/drivers/acpi/arm64/iort.c b/drivers/acpi/arm64/iort.c > index 4a5bb96..3dd9ec3 100644 > --- a/drivers/acpi/arm64/iort.c > +++ b/drivers/acpi/arm64/iort.c > @@ -523,6 +523,19 @@ static int arm_smmu_iort_xlate(struct device *dev, u32 streamid, > return ret; > } > > +static inline bool iort_iommu_driver_enabled(u8 type) > +{ > + switch (type) { > + case ACPI_IORT_NODE_SMMU_V3: > + return IS_BUILTIN(CONFIG_ARM_SMMU_V3); > + case ACPI_IORT_NODE_SMMU: > + return IS_BUILTIN(CONFIG_ARM_SMMU); > + default: > + pr_warn("IORT node type %u does not describe an SMMU\n", type); > + return false; > + } > +} > + > static const struct iommu_ops *iort_iommu_xlate(struct device *dev, > struct acpi_iort_node *node, > u32 streamid) >