Received: by 2002:ab2:6816:0:b0:1f9:5764:f03e with SMTP id t22csp1253181lqo; Fri, 17 May 2024 16:39:09 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVhv17aRta2jj3MyVUqICFxlYvpx05p3/kHo+MbuZt3BFjj5ijXm5U9w0A9JuCWwoGPgs1XxKGVI8gjAQlssuhrjHs0JDUht4F23nxD2Q== X-Google-Smtp-Source: AGHT+IH0lGFLVD42AJd/V7Jfu6lb6sFw36ZC/ypqe3mZds3Ni1PebPh2m8+Xn1FUs7jsoh0CRwNk X-Received: by 2002:a05:6e02:1d14:b0:36b:3b10:741b with SMTP id e9e14a558f8ab-36cc14bd4demr323147325ab.20.1715989148728; Fri, 17 May 2024 16:39:08 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715989148; cv=pass; d=google.com; s=arc-20160816; b=X8lOdOVuy1IGK+HwXwnwYK/ai2GKlDcXxRfKHjCqyVK66NaRSwaO0ubrJybhpZnw4n me2ZFdTHNWj7tcliTp6cHR7hkG+/dOArQ10700TRd+nr1bMO86EKUaP8NkjryiP7tDsI NcikkDZrEZzsV+oBamgvf6ug8ETjnggTgocgMKi0j97QzpnWWo1gtoFkFjSD9437zSnr CcObWkjlmZKnaARIuS9/st5TABEdi5deI0RxFw+VA+w3uEQLgVAqS03/LvPvzrc6lAxo g7oQfArua9pGRl93fQO8CxCyGVu7vawX3LfJHXYDj8OXi8XWoEfcDwq5w8s+3TdPAE8q PG6w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=0Ls2CuUKaXalqx1DF7aCUy/WgaExfZwxpPT5v5HwlGo=; fh=jIifofimyMhmIwy2lOdiMz6dgdWFM9UE7IPeqtamqCc=; b=OtZNkODOXXWoDPkA7FaL2Ja3XU4ZrtteMZXqcWPJ1MoubzPcBc6UZGn0nsftWGGDZQ qVQG2F1Q80QZZNgOYzYyXoASEDFGTwgeF8frq8CJC0jgj6i+w7vFr9BabQTP/CC4Mjfu SB5BtJaD734StLEnABeFBBadVnPo88t8M974yA0RZiurGXfuQlCYpXFEkXOvaoWARzZs pfuOuSr/hy8rRJmGg1euhtOguJBiA9j4HHLmE/Y3ipEi3lf26BV8t1JVa+5AY6x3TSeC /hewModyGn1stnWWO3bYZEdXamYU0EhmCzVeNtlVt6uXydToPV53cg3jAtJEJsWn8ru3 fVMg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=dsv7+3Mm; arc=pass (i=1 spf=pass spfdomain=quicinc.com dkim=pass dkdomain=quicinc.com dmarc=pass fromdomain=quicinc.com); spf=pass (google.com: domain of linux-kernel+bounces-182701-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-182701-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id 41be03b00d2f7-65bddfafef7si3137587a12.902.2024.05.17.16.39.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 May 2024 16:39:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-182701-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=dsv7+3Mm; arc=pass (i=1 spf=pass spfdomain=quicinc.com dkim=pass dkdomain=quicinc.com dmarc=pass fromdomain=quicinc.com); spf=pass (google.com: domain of linux-kernel+bounces-182701-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-182701-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 6C5EAB20A4F for ; Fri, 17 May 2024 23:39:03 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CF9BA1422C7; Fri, 17 May 2024 23:38:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="dsv7+3Mm" Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 676D31411CB; Fri, 17 May 2024 23:38:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715989106; cv=none; b=RiGmVjwWCUG/r4nG75AWhlPv00DAIBTdQ5ZsGxzQhkLiTs8L6vuMF0TfhDVN/hG4IFi3tmUPWDSltyNre4sgMivS88Nefmf6JIEdNlbcgrCJBXs4lXvqEM6B6vcaf5DQf6nHdpmymuFSlGZkoFrXjU/wLQZcnsIImg14Gofyd30= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715989106; c=relaxed/simple; bh=CFyPzwgT2jQhgiA2Zh230O6bxmrqJkm4Z1nabLhVig0=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=JsQ3lF1rePHP1HYuAIrhUeXOn50YcqopkxB5Qti66rT9muk9XzRCSxX4sK7BlBTNFSMYF7i9oIuIVHSIuBTEiV3qrHniONi0jR8upbdXDCPCA0aytfdAn7lHEePaf5aIRhr9FI0OqSH5fOzaAXs4SKF/iXbgtDERlR/v9z4Lw4M= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=dsv7+3Mm; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Received: from pps.filterd (m0279864.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 44HL1A9k007181; Fri, 17 May 2024 23:38:15 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; s= qcppdkim1; bh=0Ls2CuUKaXalqx1DF7aCUy/WgaExfZwxpPT5v5HwlGo=; b=ds v7+3MmVVv06+JdC1rv4zDcMCkxSjyVe3JBq3aJAxxsMqu+dRAnG3fhtp+XfskvZt sRGtjSs6k254PjyJMhgQb3LtEVNthYwP6txTKok26MnOq0lS5I96qkt6HkMyfKCJ c6Ml4vEH+5GpDeaF2qbn8auZzv98fsDJJH8oBNiwCKHfWjQvvkka+vZXH/GcvQ2d AnXbGLU4rcRhDJ89np9Ha4gIotBieqG3t+zs6Z7ZPb1/0zVlIrPHHtBmiZOaPcQE TNcXxjrFPNOZusaNKzaOUAaNaBFOpq+Lk+stv2PhmVayU1x+lv36rPv6kifG5762 1eVySkufJd4pT9nfVlTA== Received: from nalasppmta05.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3y49ge1a2e-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 17 May 2024 23:38:15 +0000 (GMT) Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA05.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 44HNcERX025127 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 17 May 2024 23:38:14 GMT Received: from abhinavk-linux1.qualcomm.com (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Fri, 17 May 2024 16:38:13 -0700 From: Abhinav Kumar To: , Rob Clark , Abhinav Kumar , Dmitry Baryshkov , Sean Paul , Marijn Suijten , David Airlie , "Daniel Vetter" CC: , , , , , , Subject: [RFC PATCH 3/4] drm/msm/iommu: introduce msm_iommu_disp_new() for msm_kms Date: Fri, 17 May 2024 16:37:58 -0700 Message-ID: <20240517233801.4071868-4-quic_abhinavk@quicinc.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240517233801.4071868-1-quic_abhinavk@quicinc.com> References: <20240517233801.4071868-1-quic_abhinavk@quicinc.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: r3yRdPu4HSeccNj21lMjnKkLRDZeFVIK X-Proofpoint-ORIG-GUID: r3yRdPu4HSeccNj21lMjnKkLRDZeFVIK X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.650,FMLib:17.11.176.26 definitions=2024-05-17_11,2024-05-17_03,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=827 impostorscore=0 clxscore=1015 priorityscore=1501 phishscore=0 spamscore=0 mlxscore=0 lowpriorityscore=0 suspectscore=0 bulkscore=0 adultscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2405010000 definitions=main-2405170184 Introduce a new API msm_iommu_disp_new() for display use-cases. Signed-off-by: Abhinav Kumar --- drivers/gpu/drm/msm/msm_iommu.c | 28 ++++++++++++++++++++++++++++ drivers/gpu/drm/msm/msm_mmu.h | 1 + 2 files changed, 29 insertions(+) diff --git a/drivers/gpu/drm/msm/msm_iommu.c b/drivers/gpu/drm/msm/msm_iommu.c index a79cd18bc4c9..3d5c1bb4c013 100644 --- a/drivers/gpu/drm/msm/msm_iommu.c +++ b/drivers/gpu/drm/msm/msm_iommu.c @@ -343,6 +343,19 @@ static int msm_gpu_fault_handler(struct iommu_domain *domain, struct device *dev return 0; } +static int msm_disp_fault_handler(struct iommu_domain *domain, struct device *dev, + unsigned long iova, int flags, void *arg) +{ + struct msm_iommu *iommu = arg; + + if (iommu->base.handler) + return iommu->base.handler(iommu->base.arg, iova, flags, NULL); + + pr_warn_ratelimited("*** fault: iova=%16lx, flags=%d\n", iova, flags); + + return 0; +} + static void msm_iommu_resume_translation(struct msm_mmu *mmu) { struct adreno_smmu_priv *adreno_smmu = dev_get_drvdata(mmu->dev); @@ -434,6 +447,21 @@ struct msm_mmu *msm_iommu_new(struct device *dev, unsigned long quirks) return &iommu->base; } +struct msm_mmu *msm_iommu_disp_new(struct device *dev, unsigned long quirks) +{ + struct msm_iommu *iommu; + struct msm_mmu *mmu; + + mmu = msm_iommu_new(dev, quirks); + if (IS_ERR_OR_NULL(mmu)) + return mmu; + + iommu = to_msm_iommu(mmu); + iommu_set_fault_handler(iommu->domain, msm_disp_fault_handler, iommu); + + return mmu; +} + struct msm_mmu *msm_iommu_gpu_new(struct device *dev, struct msm_gpu *gpu, unsigned long quirks) { struct adreno_smmu_priv *adreno_smmu = dev_get_drvdata(dev); diff --git a/drivers/gpu/drm/msm/msm_mmu.h b/drivers/gpu/drm/msm/msm_mmu.h index 88af4f490881..730458d08d6b 100644 --- a/drivers/gpu/drm/msm/msm_mmu.h +++ b/drivers/gpu/drm/msm/msm_mmu.h @@ -42,6 +42,7 @@ static inline void msm_mmu_init(struct msm_mmu *mmu, struct device *dev, struct msm_mmu *msm_iommu_new(struct device *dev, unsigned long quirks); struct msm_mmu *msm_iommu_gpu_new(struct device *dev, struct msm_gpu *gpu, unsigned long quirks); +struct msm_mmu *msm_iommu_disp_new(struct device *dev, unsigned long quirks); static inline void msm_mmu_set_fault_handler(struct msm_mmu *mmu, void *arg, int (*handler)(void *arg, unsigned long iova, int flags, void *data)) -- 2.44.0