From patchwork Sun May 9 02:26:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shawn Guo X-Patchwork-Id: 432859 Delivered-To: patch@linaro.org Received: by 2002:a02:c901:0:0:0:0:0 with SMTP id t1csp1665869jao; Sat, 8 May 2021 19:26:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwMW/Rttu34I+PFZX6/VCKmnSjNfP0iJruH+ZI9r0S7ioZ3agUWMNlANo7HzfcQiNfDCOsq X-Received: by 2002:a17:906:b03:: with SMTP id u3mr17918391ejg.381.1620527187665; Sat, 08 May 2021 19:26:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620527187; cv=none; d=google.com; s=arc-20160816; b=nXsdyzxe4jZ9BSAfiNuhao1xWlCGWr0PMEflcq0gFl+LbzxczbRPmWuFRn7QijhyLl zbMg6Hu1JnclI7lYlaBOe4W3Rc5Ern3I4UYGdGJtYB3GGWJZhZMyxTFsfJbtQLO7fwnP Qf9qgXV686Cd3l9F8GYy4KvSGvZANKOgbX5RfkNI6m1eqk7CMJoSMMIv0d4MY/DQXset oEhedBDZnLH2mzR0uoomS7M9a9+/l8uXLGqJ2voqvC73DC+k+yfUbHpNJV3C5lk/qG7o RkxghPKPtlbG4ALOYzdNGTl3riUvRg9ikER+IoIQKuMO89AT+/jMmzZgDjYSXwGckrOU HGtQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from :dkim-signature; bh=ZOEuc25/rIIOwe8p+eLjzGoMo3mvFf6W/TQMu7+jAHg=; b=Eyp1gTpk/mVNiQLr26vmKrSsbAm751AtAK3iKo+EQh3c0GGozwk00+Slu/xUQlHApf fe7C5UmNuHnsRsNO3179ogxGXDxx4p6GCPIrJJ4deZ7BkZbAbPf2I6WCw3lGXzvgyA25 7mvCBvgZzBUxtSbX9gd2Qyw7xCPwEUaD51qpz0LZOwGL5PyyNQTVmhUtvI3O2nI5pOQM bVXcZkU6he/ODn3xoV54RsAzjGWTZ1559oBSjzHZM5ItG8s7u0ziqxZVFtj1kaA+dvzN yJuiFjgcos+SfWd6Ib+6XFOIUIq/mevrkjbTvO0kjRzBJ75jmnsS/eFPbhiT6Hf2wxE4 cm9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="k/8/yNmC"; 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 m15si9310012ejr.80.2021.05.08.19.26.26; Sat, 08 May 2021 19:26:27 -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="k/8/yNmC"; 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 S229616AbhEIC1Y (ORCPT + 17 others); Sat, 8 May 2021 22:27:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44862 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229609AbhEIC1X (ORCPT ); Sat, 8 May 2021 22:27:23 -0400 Received: from mail-pg1-x530.google.com (mail-pg1-x530.google.com [IPv6:2607:f8b0:4864:20::530]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EA664C061573 for ; Sat, 8 May 2021 19:26:19 -0700 (PDT) Received: by mail-pg1-x530.google.com with SMTP id j12so4790589pgh.7 for ; Sat, 08 May 2021 19:26: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; bh=ZOEuc25/rIIOwe8p+eLjzGoMo3mvFf6W/TQMu7+jAHg=; b=k/8/yNmCbKkPmo4ByTCqYGLPl51ZMyZtE3J5Z5lVdod4QpXMBm7kcT18cZNEuRJ5RA ua4TpXH9myCyuNd+dV6B6v+lPGTGc8zi6F6/mifD1Dabfrcijh+0fKSmf2ZUGb6Zs9Mw sx3RTktdLO1nM/EDByG4UbZhOyNfVoAY7XCP5zuPuHlYleNyJ5LXYZmIohLDx5uOs2bz 19MibDa/pjNzlS9Hl+B3QupBlQMqEPpnwYXGKTIiIo8LC6O56dSOa6GoVcucVG+wEDbb B03XSYp+PBrqwR6Bijcv86cSHOxCM2WA8QDDupcDCA6FsSuaqYgz8VCOxjQgzwBDFIo5 DjCw== 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; bh=ZOEuc25/rIIOwe8p+eLjzGoMo3mvFf6W/TQMu7+jAHg=; b=BHQkmupAGZ4HmLrw16puL9IpBmpDUXJs4j6v+OSZIhm39av6jbARzXLnLtdxDEyH3x n/zy8rKEJrYzvNVmgtN+jM6HOaqOjrtAWArur09iNC145389QuKNp+MUqASYGxNnJTUG vlN6I3dL1PZjfAvAua3KpKK+RqOBs4kTYGSGCCQK/z0ut/r177WjCRmmo4zK6rQ0vO39 w3U17hSBOi5hOAnLNEKVlS3XE8BVCngz/D1XPDmdDgMlbI8BmTMmb59szhvoS4h0g9eZ 9wPAFWxtlhweVtmgL96S2ccMieB/RCKNKh/2WlEEe+tA1wobCIb0GV0tf8xHqJ2nkdjY l+WA== X-Gm-Message-State: AOAM531ozBiayr+HRxK9wWG0t+pq8J9QGhSfj0cAF2exLV6C5A0agtQ3 hTKF/SvqaSlMF8qV5b73P0s/eA== X-Received: by 2002:a63:930d:: with SMTP id b13mr18394002pge.213.1620527179357; Sat, 08 May 2021 19:26:19 -0700 (PDT) Received: from localhost.localdomain (80.251.214.228.16clouds.com. [80.251.214.228]) by smtp.gmail.com with ESMTPSA id v188sm7798025pfv.119.2021.05.08.19.26.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 08 May 2021 19:26: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 v3] iommu/arm-smmu-qcom: hook up qcom_smmu_impl for ACPI boot Date: Sun, 9 May 2021 10:26:07 +0800 Message-Id: <20210509022607.17534-1-shawn.guo@linaro.org> X-Mailer: git-send-email 2.17.1 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. Define acpi_platform_list for these platforms and match them using acpi_match_platform_list() call, 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 --- Changes for v3: - Call acpi_match_platform_list() to match platform in qcom smmu driver rather than IORT code. Changes for v2: - Rather than using asl_compiler_id in IORT table, follow suggestion from Robin Murphy to use acpi_match_platform_list() to match platform. drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) -- 2.17.1 Reviewed-by: Robin Murphy Reviewed-by: Bjorn Andersson diff --git a/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c b/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c index 98b3a1c2a181..f7e187f3fa66 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 @@ -339,10 +340,22 @@ static const struct of_device_id __maybe_unused qcom_smmu_impl_of_match[] = { { } }; +static struct acpi_platform_list qcom_acpi_platlist[] = { + { "LENOVO", "CB-01 ", 0x8180, ACPI_SIG_IORT, equal, "QCOM SMMU" }, + { "QCOM ", "QCOMEDK2", 0x8180, ACPI_SIG_IORT, equal, "QCOM SMMU" }, + { } +}; + 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) { + /* Match platform for ACPI boot */ + if (acpi_match_platform_list(qcom_acpi_platlist) >= 0) + 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);