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: 12180289 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E84F1C43460 for ; Fri, 2 Apr 2021 03:58:20 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (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 7BD056023C for ; Fri, 2 Apr 2021 03:58:20 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7BD056023C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:MIME-Version:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:References:In-Reply-To:Message-Id:Date:Subject:Cc:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=j+YCjtgwVXK5Vxah2882ySJO5YBpDUoEfCRZ5kRuCfc=; b=PaACaE/lOAj5ysZ2J+1WTaeJK9 HG/n5ayknSw2oH5INPbrh/gQXPL3E67ZSVdnoMmkdIRL3GRTcJb2FJnCatW/0GXx+UUC75/zjlVZS Bi5Jx7O35o51vxHCAQ9FQgDEhVJPdzQNyImOTj/QwZWaW8yWwgWAU5BcgVAVbnIez7p9r7tZd2u8/ c26+EdAwuPqbscEP8bfHyo5xnps0kz01pJsKfngM56jUVuqIIkXIh1HnF7ZD/VBXnbiPIcgFoDTtf R1XzK0RrUhbt/Qpx+b0cAmkv4lFIMWzHqoRM+uJTb9DKzXZT3htM/ErUlFL5TxuUQ9Zik54qvPQPE 5FG0LDTw==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lSAvU-00BskW-J8; Fri, 02 Apr 2021 03:56:52 +0000 Received: from mail-pg1-x52d.google.com ([2607:f8b0:4864:20::52d]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lSAuy-00BsiC-2z for linux-arm-kernel@lists.infradead.org; Fri, 02 Apr 2021 03:56:22 +0000 Received: by mail-pg1-x52d.google.com with SMTP id y32so2831565pga.11 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=Sr43jlav+ZIkAEv/Bg0by2DwdCWDGbiFYmyZbzWCbNLka0o//m5in8owdRCWeMRt2N 0CwKZgpelt/TpEYpLrUCNFWQPk8QC8l9gCVdynrAJjB1r63WsvHSlEA76BXJ5x0lVpzL tlY0afUh5HK5MvZkWKfCpZdLwUwx/R4w32DpWMXR9J+azXitCxO7LowQgseG9i3sYm1i ydhHWFRNZHeytUY8LSMBex3MHZgUCjNSsolDmJ5LSfFKSIPSeOUMkxJPFUhonG41SEfa 2YLorX36bF657JDZ06KlV7lRSPVwmGzVyvqfVB9czGZ59IZcl28UfTFt7HKSlhP0V6zp P+5g== X-Gm-Message-State: AOAM530sWMOvs6yBLeZQLH2yBlHd18TURcNnWI4Vemfo57lKJpQAXwP2 04LNllWoJHcHK0ecDuxJRDjZtZYBs95xzQ== X-Google-Smtp-Source: ABdhPJy32aJ5h5W9VDt0+416R7LPGrBxJo/5XMIv4vXMiY/T97i7LwN6fp7RvRCavYrY/JMeod4r9A== 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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210402_045620_425334_686D1448 X-CRM114-Status: GOOD ( 14.31 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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(+) 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);