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: 12246307 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=-17.4 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,URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable 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 655F1C433B4 for ; Sun, 9 May 2021 02:28:00 +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 D2E9B613D9 for ; Sun, 9 May 2021 02:27:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D2E9B613D9 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: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:In-Reply-To:References:List-Owner; bh=jytkMXsbHWhYMm6vIOC7WlVfOcg71d5QS4+6svkWDzg=; b=q5ULsBgD07HoIsH/4jokFauNpA 36aPb4wBXJu+ihbp1Z42MyzRgp/P45pyqMkRt8iIQXvOSQNO4GwGd+o4oWMZKEVXdtmipVNfrVpvS 734F3rd2Rf4ign8WNXueGJjMDfBgOJt1Gn0NS5S2twB3DqSg2uPaoYQWdp13Q2ZSncz2VAEHG97rI o/hfCY1qvUythi49cxKCkJn8z8r5zR/+LTHq7ofg1APerQfauoV7/MfJpk/nQbp6fW4U1qvKC0U2O NdVLBCPB6HFjKhJAF52yU2emk5b/c+vyRgIBvHAoWpfWwfHDit99fJbfCV9e1/Md0/ZJX1pNtdizy IBmvir7Q==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lfZ9H-00AmwO-Qf; Sun, 09 May 2021 02:26:28 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lfZ9D-00Amw6-Ft for linux-arm-kernel@desiato.infradead.org; Sun, 09 May 2021 02:26:23 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Message-Id:Date:Subject:Cc:To:From: Sender:Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:In-Reply-To:References; bh=ZOEuc25/rIIOwe8p+eLjzGoMo3mvFf6W/TQMu7+jAHg=; b=RQ1xmi4Ufj9XAXJ0clAPA0RzQ6 1wPEJh8KZ/u5Vej5ouKA4Rhpc+hL8avGbWxv4/SwGhZ9wLfXiwn0sgf6okCNYQYR9s20xznWb39Zd llzSbVlWhe/4DVww9M/t/Y1YHTliTu4wmrx2gt6gNsw3QJSN7QxUCF3he3Y3wenYdsU6m/sRiY5Zh rZR/zHmDTtnvZ1V3Nec048ET/Poje1q9ziOQwUQemK8vWtQFleGRTkg2awqHdEvgRDff9dE4W98z8 jRSRSvtBZBwS1G64QF/17kWP/pA5MQJahpN5LvFq+/y3xHBVIsKXnMWnUOgIpfPJFz87S4nWo3tXK C5PDci2A==; Received: from mail-pf1-x436.google.com ([2607:f8b0:4864:20::436]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lfZ9A-007odu-LM for linux-arm-kernel@lists.infradead.org; Sun, 09 May 2021 02:26:22 +0000 Received: by mail-pf1-x436.google.com with SMTP id i190so11186966pfc.12 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=epXv3RXFJ38HMAe/KJ18g6HhK22Ed61RK5pAbaasXpsIql50d2vDRkXAKrAKZwJPyX /nVv67kdAM9CMEvG3SpJ2HzG9cnTtIcSvKpDm3N04cXYxenCjcB5/Ezm7elEIemaIhjd hxIHEXfx0z/J2wlD1njsoXY8Bse27lZYOE7izx/OFOiFp7hGORlaZjJ+3/4esy/COmKa rasdF38+Zarqirnr+Rt5NWSUeT+SMugwNp8lxrkBpkqHJG3GHotDdZsiZJm5Zqn3/Jqv hvdz95evCWdfGnSs9Vk80DZwNWqXGSF98Z7AeV0B3wf8bWxL4TzstKkUstPBS9WHG8j/ Dvpg== X-Gm-Message-State: AOAM532sjgqdyahCeCh8Yk0ZI/0AWE2oglI45cp5iL8fgSwfnpmIFMIY OQEKRsD7kNNjh29mpQJvY25tAw== X-Google-Smtp-Source: ABdhPJw/KH5aZ66Q2gfOHCYVOHIcrtLWODGjTcGA+5soPJUhKRQM8qzwIhL+Hs3pNyPcI6QSSGG1jQ== 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210508_192620_725434_E6EBEB66 X-CRM114-Status: GOOD ( 15.94 ) 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. 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 Reviewed-by: Robin Murphy Reviewed-by: Bjorn Andersson --- 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(+) 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);