From patchwork Fri Apr 2 03:56:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shawn Guo X-Patchwork-Id: 414305 Delivered-To: patch@linaro.org Received: by 2002:a02:8562:0:0:0:0:0 with SMTP id g89csp1103194jai; Thu, 1 Apr 2021 20:56:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw66kM/xo335eQQUBQO6Ivm8zw0qcbLYujUz/0IcND+uNa/bWEN+zjdw51DJT1DRNT4Jp8O X-Received: by 2002:a17:907:788e:: with SMTP id ku14mr12588175ejc.17.1617335783474; Thu, 01 Apr 2021 20:56:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617335783; cv=none; d=google.com; s=arc-20160816; b=0grijJ29NG3EVhz7fCuPEI8MHpV2kR8w0QkwXsROVNEweaESsa0i+ZCn3LX74xB8Wr juBKvS99j47TAoRbN4LuQnKf+nyDDlQkY+3ZEdVtaIMpGNIhwg5itkNm8DcnxU6Mknlt hZjtYVKW/J88edHZ+1b++PTpx7fEw4LwsLpqYvarf56Qi3vRvpmcr6UmYgi7oulXDsMG x887XUSe67lJsmdE306u47mafB+kD4bu+FU7HAxuT85BPm/7wZVEgOqfVNJyv1iTUpDh HqFW2B4e2UUZisQte3c6iciMwHBtIJq39yYnGlmwOwVYOuA1NyXoh9lfKNNRul1auNZj +pyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:dkim-signature; bh=3nQhD90sdJSzQdgo78ZKmX3OfUzD+szW/4QnSrBPjH4=; b=hVVbuj8w9S29vu5NCoKLEGAjHaldvfM8yq0BfY9VuAHNrxHgTVcX2zWD8AwGgjA/zz I0Ia5jglhCy9x/nadU/f205tG5LJFBEZjXeXutqbQ3+hxZ4TvP0OvPHMO9VMRiyNb4u/ +mVZ9lJadpwJNgtPCM5ROXGvUtfLI4hq2vowJ45H6d3x0IhkvpeBfN0MPwtPuQAbcYCx 4vSq7XgaCuRomvSmbb1gSDQbg+Oo4xQog739x9e89Uf+zJsv21euz8KBtkL881hMLOnS CIy42vXVk9Rz8MU0oimoSQT5ueOe3xOg5aZ39fdG63IeWYhe0t1z8RJtkRF13L+Oy0kb 4O1Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=P3kuftwO; spf=pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id rn17si6254058ejb.183.2021.04.01.20.56.23; Thu, 01 Apr 2021 20:56:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=P3kuftwO; spf=pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233665AbhDBD4T (ORCPT + 17 others); Thu, 1 Apr 2021 23:56:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50550 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233786AbhDBD4T (ORCPT ); Thu, 1 Apr 2021 23:56:19 -0400 Received: from mail-pg1-x536.google.com (mail-pg1-x536.google.com [IPv6:2607:f8b0:4864:20::536]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1FB1CC0613E6 for ; Thu, 1 Apr 2021 20:56:19 -0700 (PDT) Received: by mail-pg1-x536.google.com with SMTP id f10so2837365pgl.9 for ; Thu, 01 Apr 2021 20:56:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=3nQhD90sdJSzQdgo78ZKmX3OfUzD+szW/4QnSrBPjH4=; b=P3kuftwOPyckZywrWcQWSfwihuGdzQTnGOBic65JfGR5wzUcOgpXw89JlKDQT7rkS0 RbqTYL/yLLalyBJs88wj5lqkVOya+/SIZptgBr18VHj4ZT/R4ZRnwaObwxukjsYcRe6f jaoRNyNZx9awptdKzVQJvSLmvekEBrXYls+B3UMG5ECMPaXT7Mhh8gzK1KsHe28zv3+U JBBmzgRn3GOTdrPevhVN2AclStD2Jxp0uJVW1Y0+DurvyijGHynD+AQyKBMps2aW6uYa pyfbVa+8zVXyIuaElf+Pckvgf2rG1bbuSpmJacHa8FCMHUWuyL4YX+XbRJfGzykFAqJI mYWQ== 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=3nQhD90sdJSzQdgo78ZKmX3OfUzD+szW/4QnSrBPjH4=; b=gxgVu7Np4m3DopuBpovn8/GaSXR6rBN+Nunjzhn4bqlJJXhZDEZF584n0QKFicbEl5 lfsOCbEdkD65sMGod7NVbcb/dCG0w9q3Hx501oEuKb7YCrBj0jgyj/XouaK7SH96Rqv0 NJrzalE+dcMbsT3P0lHVkSIqAVL+2hPUG78Z9LUALr8u/DJpaRwthmdxV3DQIdYQFeCQ tt+lCRCcNHZJdoxxgJKFG+sDeIz5iuvyyJKNYKsE/y94yRSV1iTz9VKVI4KBVyRFcc9A CoAhQh2pZC/2DfEaXR1AdeLYaSgwSsOeC6yUJY5ASCSHyHvNlFGV3DtLThECkJwoKxy0 /jwQ== X-Gm-Message-State: AOAM532bt7t7b347pJpOW5noL/nvOESk1ryUqu3hBft3mrWyuYLEnT7H jCI7sD3HofMNvt0wV+AjsEiJ3Q== X-Received: by 2002:a63:78cc:: with SMTP id t195mr10067403pgc.196.1617335778655; Thu, 01 Apr 2021 20:56:18 -0700 (PDT) Received: from localhost.localdomain (80.251.214.228.16clouds.com. [80.251.214.228]) by smtp.gmail.com with ESMTPSA id 81sm6875972pfu.164.2021.04.01.20.56.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Apr 2021 20:56:18 -0700 (PDT) From: Shawn Guo To: Will Deacon Cc: Robin Murphy , Bjorn Andersson , Lorenzo Pieralisi , Hanjun Guo , Sudeep Holla , Mark Rutland , linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, Shawn Guo Subject: [PATCH v2 3/3] iommu/arm-smmu-qcom: hook up qcom_smmu_impl for ACPI boot Date: Fri, 2 Apr 2021 11:56:02 +0800 Message-Id: <20210402035602.9484-4-shawn.guo@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210402035602.9484-1-shawn.guo@linaro.org> References: <20210402035602.9484-1-shawn.guo@linaro.org> Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org The hookup with qcom_smmu_impl is required to do ACPI boot on SC8180X based devices like Lenovo Flex 5G laptop and Microsoft Surface Pro X. Check IORT SMMU model identifier and create qcom_smmu_impl accordingly. (np == NULL) is used to check ACPI boot, because fwnode of SMMU device is a static allocation and thus helpers like has_acpi_companion() don't work here. Signed-off-by: Shawn Guo --- drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c | 9 +++++++++ 1 file changed, 9 insertions(+) -- 2.17.1 diff --git a/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c b/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c index 82c7edc6e025..7ced0f93bc99 100644 --- a/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c +++ b/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c @@ -3,6 +3,7 @@ * Copyright (c) 2019, The Linux Foundation. All rights reserved. */ +#include #include #include #include @@ -340,6 +341,14 @@ struct arm_smmu_device *qcom_smmu_impl_init(struct arm_smmu_device *smmu) { const struct device_node *np = smmu->dev->of_node; + if (np == NULL) { + /* ACPI boot */ + struct iort_smmu_pdata *pdata = dev_get_platdata(smmu->dev); + + if (pdata && pdata->model == IORT_SMMU_QCOM) + return qcom_smmu_create(smmu, &qcom_smmu_impl); + } + if (of_match_node(qcom_smmu_impl_of_match, np)) return qcom_smmu_create(smmu, &qcom_smmu_impl);