Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1954690pxb; Sat, 27 Feb 2021 05:56:24 -0800 (PST) X-Google-Smtp-Source: ABdhPJzDkGrOepuFcuQtDPVkM/vdNvxt1+kYMv3NZqqkgcxL+V+BrWaMilZTq1hb61eAd0ts+aFa X-Received: by 2002:aa7:c609:: with SMTP id h9mr8385538edq.256.1614434184499; Sat, 27 Feb 2021 05:56:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614434184; cv=none; d=google.com; s=arc-20160816; b=rQ35YiLL/sWBYllY/15HN/gTCAlXGS2a6BwQDD4VNnS2vkPctcUMaIyKHIjO/1pItw TyMJhBynBMMxCubYO24OLIKtpGSgQL8ClQzpZVdDf41bP+vEGQhrV/VQ8EMIXJCKcI/g 0/wKNYhAtIvHGYxKLKHBSLJ6t5HN5WrHJmnAQQfHLBjE4eMLkSJnIQ6q0CQmTXBARz49 afZuuEY/FWXY60UdfPYXLAhpNb8peyMLSfPE2kNljXaHulmM6AoMphTnj9TyMQx+HaQ0 gaT0y4gJAuREwyijTd2dsRLhJFXdXwgGRSCJbnvDWy5dUajDlQjyDf/kg1LgFqvWZXVt H+Gw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dmarc-filter:sender:dkim-signature; bh=DgtWfT+ggYoDBm8woYV9yvXhaOPvGJGBMdZaWUjPB3U=; b=cqSh8DPrQ4HnwTs7TUf7RFnRkeSt8zSOa1DE2XcRKpKfIaW9GtMZYkV0P/M094eYU7 neYRd4mZsST9k4d5OlWH9T4gvR2prEVy5T9EOcqquuLe2XY08Twox7YRaleZ8CJC5Py+ +q9Ifd1rT5ZwziAEUqw9DrDMektLMO9Sf84JmhVCAArHROQjnb4CUVs7vtXX0/sZplhf Xes6PlnKjiSZQH3ZZLxSSOvVR4j3c7bbGTJM4Px2xSMpOCpMp39yQlsZHpIAI6EIm0u1 I5BljxQZgjR7l/aYp9KgiDOGFfo/oCkGMRv515dn/xYoCYJkBSQUAt57nfD7mFekROLR Fx+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b=ICCh58Yb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z12si7736623edc.34.2021.02.27.05.56.01; Sat, 27 Feb 2021 05:56:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-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=@mg.codeaurora.org header.s=smtp header.b=ICCh58Yb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230082AbhB0Nyk (ORCPT + 99 others); Sat, 27 Feb 2021 08:54:40 -0500 Received: from m42-2.mailgun.net ([69.72.42.2]:46752 "EHLO m42-2.mailgun.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229912AbhB0Nyj (ORCPT ); Sat, 27 Feb 2021 08:54:39 -0500 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1614434055; h=Content-Transfer-Encoding: MIME-Version: References: In-Reply-To: Message-Id: Date: Subject: Cc: To: From: Sender; bh=DgtWfT+ggYoDBm8woYV9yvXhaOPvGJGBMdZaWUjPB3U=; b=ICCh58YbhrF1AVKN6wamRIH1dd7wDTsxWp+3ydG3lvsF7CqNer2lbGktHEWbuccCmZWyrlOj 2s7t8NLeNVAWU6urlT3ZQJRfhlnkOWOBaSy2R9juSDI5m7HDfBtNQt0/B2FrFyTqbj3rtmCP G20Eq9dm3ixInaBEs2rbsmITuUU= X-Mailgun-Sending-Ip: 69.72.42.2 X-Mailgun-Sid: WyI0MWYwYSIsICJsaW51eC1rZXJuZWxAdmdlci5rZXJuZWwub3JnIiwgImJlOWU0YSJd Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n04.prod.us-west-2.postgun.com with SMTP id 603a4ee67aa94c52e7ecf899 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Sat, 27 Feb 2021 13:53:42 GMT Sender: saiprakash.ranjan=codeaurora.org@mg.codeaurora.org Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 34ABEC43464; Sat, 27 Feb 2021 13:53:42 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=ALL_TRUSTED,BAYES_00,SPF_FAIL autolearn=no autolearn_force=no version=3.4.0 Received: from blr-ubuntu-253.qualcomm.com (blr-bdr-fw-01_GlobalNAT_AllZones-Outside.qualcomm.com [103.229.18.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: saiprakash.ranjan) by smtp.codeaurora.org (Postfix) with ESMTPSA id 0E411C433CA; Sat, 27 Feb 2021 13:53:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 0E411C433CA Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=fail smtp.mailfrom=saiprakash.ranjan@codeaurora.org From: Sai Prakash Ranjan To: bjorn.andersson@linaro.org Cc: akhilpo@codeaurora.org, iommu@lists.linux-foundation.org, jcrouse@codeaurora.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, robdclark@gmail.com, robin.murphy@arm.com, will@kernel.org, Sai Prakash Ranjan Subject: Re: [PATCHv2 2/2] iommu/arm-smmu-qcom: Move the adreno smmu specific impl earlier Date: Sat, 27 Feb 2021 19:23:21 +0530 Message-Id: <20210227135321.420-1-saiprakash.ranjan@codeaurora.org> X-Mailer: git-send-email 2.29.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Bjorn, On 2021-02-27 00:44, Bjorn Andersson wrote: > On Fri 26 Feb 12:23 CST 2021, Rob Clark wrote: > > > The current logic picks one of: > 1) is the compatible mentioned in qcom_smmu_impl_of_match[] > 2) is the compatible an adreno > 3) no quirks needed > > The change flips the order of these, so the only way I can see this > change affecting things is if we expected a match on #2, but we got one > on #1. > > Which implies that the instance that we want to act according to the > adreno impl was listed in qcom_smmu_impl_of_match[] - which either is > wrong, or there's a single instance that needs both behaviors. > > (And I believe Jordan's answer confirms the latter - there's a single > SMMU instance that needs all them quirks at once) > Let me go through the problem statement in case my commit message wasn't clear. There are two SMMUs (APSS and GPU) on SC7280 and both are SMMU500 (ARM SMMU IP). APSS SMMU compatible - ("qcom,sc7280-smmu-500", "arm,mmu-500") GPU SMMU compatible - ("qcom,sc7280-smmu-500", "qcom,adreno-smmu", "arm,mmu-500") Now if we take SC7180 as an example, GPU SMMU was QSMMU(QCOM SMMU IP) and APSS SMMU was SMMU500(ARM SMMU IP). APSS SMMU compatible - ("qcom,sc7180-smmu-500", "arm,mmu-500") GPU SMMU compatible - ("qcom,sc7180-smmu-v2", "qcom,adreno-smmu", "qcom,smmu-v2") Current code sequence without this patch, if (of_match_node(qcom_smmu_impl_of_match, np)) return qcom_smmu_create(smmu, &qcom_smmu_impl); if (of_device_is_compatible(np, "qcom,adreno-smmu")) return qcom_smmu_create(smmu, &qcom_adreno_smmu_impl); Now if we look at the compatible for SC7180, there is no problem because the APSS SMMU will match the one in qcom_smmu_impl_of_match[] and GPU SMMU will match "qcom,adreno-smmu" because the compatible strings are different. But for SC7280, both the APSS SMMU and GPU SMMU compatible("qcom,sc7280-smmu-500") are same. So GPU SMMU will match with the one in qcom_smmu_impl_of_match[] i.e.., "qcom,sc7280-smmu-500" which functionally doesn't cause any problem but we will miss settings for split pagetables which are part of GPU SMMU specific implementation. We can avoid this with yet another new compatible for GPU SMMU something like "qcom,sc7280-adreno-smmu-500" but since we can handle this easily in the driver and since the IPs are same, meaning if there was a hardware quirk required, then we would need to apply to both of them and would this additional compatible be of any help? Coming to the part of quirks now, you are right saying both SMMUs will need to have the same quirks in SC7280 and similar others where both are based on same IPs but those should probably be *hardware quirks* and if they are software based like the S2CR quirk depending on the firmware, then it might not be applicable to both. In case if it is applicable, then as Jordan mentioned, we can add the same quirks in GPU SMMU implementation. Thanks, Sai -- QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation