From patchwork Wed Dec 20 06:02:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Georgi Djakov X-Patchwork-Id: 18348 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:24d3:b0:fb:cd0c:d3e with SMTP id r19csp2443286dyi; Tue, 19 Dec 2023 22:05:24 -0800 (PST) X-Google-Smtp-Source: AGHT+IGo7hJMI29PyLc21NkQcoMLevaJbhGACymvCnV3iKxiDvfuUcriw8N4ByssSJFfOf0tATVr X-Received: by 2002:a05:6870:972c:b0:203:cbfa:1a68 with SMTP id n44-20020a056870972c00b00203cbfa1a68mr4995171oaq.84.1703052324163; Tue, 19 Dec 2023 22:05:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703052324; cv=none; d=google.com; s=arc-20160816; b=mzTb4wf8J+VxNg/H7DjM8NuzTjGnVNsLmm4EWmjkUm3Tnxxcm5pa6PYVKvYtHmIYo6 KqLFvTJHfhnXcrSBY+03uDJ1Z22UT0pJikpvzoQgc2V+UCKwFzIV4z+eF2qAF3Wk5+5G M9sraZPgUfJ8+gA7js6UNuHR56WIZmEglat3riA2K5CxkzT2/ArdFogJbZpskPD98d6c C/jEhLBH/yT+F9W9ahziHoLJVecjuV8Ea7RfoBjj49EooovNCSKk/T+GCoY/rDEDPJCx r7N3SxzU/ti1qVu4awQpPbwE19rRdrllteqW6va4YPfUL8Wf4dcWud+Opzzrj9IyhQws X7ng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :message-id:date:subject:cc:to:from:dkim-signature; bh=OjjER9tIK+8NszfEYxyKNEhImaqZl0+oCS/0pEWKhuQ=; fh=ajqwJHB27W/J8EhLqkTAR2+yy30uzELfRT2VzGpH0WI=; b=orj9VXxKk31GwS8o+FmGqFynefCsJdA4/Fr687QGQFMmhlAzMvOj6xGLgy5HFe439i +YMFFgVZnhRK/uaxdT1kWMgUhlRSE3CN9+P/TYdNKBkBbRUxPNOiWUiAhgNgfAHKH4Tm 1olDSvyU33K80t9g0RZvwnugt8agCf/PKbwKk6ucBwhGlr/PYZxXLbXIhNZt1cxCVnX8 bZWxvTWVLvS83z79VwXvHrb9aV9hPLKu4uR81+AKUgpT5ypzvgHptewenetRfc34pge9 hDUCwVOZMduLWEKPebzMWu6mlG0/wAMux7pyW6CSr5+YkLduKjaqdBb8r69RlJv++71N nnMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=JajfMDgm; spf=pass (google.com: domain of linux-kernel+bounces-6402-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-6402-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id s23-20020a656457000000b005cd90b47498si5531669pgv.486.2023.12.19.22.05.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Dec 2023 22:05:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-6402-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=JajfMDgm; spf=pass (google.com: domain of linux-kernel+bounces-6402-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-6402-ouuuleilei=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 sv.mirrors.kernel.org (Postfix) with ESMTPS id DD2EF2848D3 for ; Wed, 20 Dec 2023 06:05:23 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CA39E1F615; Wed, 20 Dec 2023 06:03:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="JajfMDgm" X-Original-To: linux-kernel@vger.kernel.org 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 8EE7113AF3; Wed, 20 Dec 2023 06:03:01 +0000 (UTC) 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 (m0279867.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 3BK4oRei001889; Wed, 20 Dec 2023 06:02:47 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= from:to:cc:subject:date:message-id:mime-version:content-type; s= qcppdkim1; bh=OjjER9tIK+8NszfEYxyKNEhImaqZl0+oCS/0pEWKhuQ=; b=Ja jfMDgm8Y0e4WTjx07lV9OrGvqvc/pS3loxZTynzAp3xS42ICPXqigOyJZ0/TgdZc YH5VuJQwVITs5byMKffavDMKJ29GnfC9BWnHdyb/zR6wYYbSMkSpawg5uRgi8bRu 7WTZctAi8HOfVAaHnFfk3Y4Q4uzmZaHaqkcwgUPOXDCgHF1PsZ3JAV7XuaCz3dlP MpUjVD1tbkT1h/GcxqWm3NrUeMEHNuFgs8/gp/9zm5zaS+eGz1I5/mFx7j2uRlVX faL0d6duv2/z8hh6Pu8ai2mk+4i4xrWtWqODEZwKnVlSp+jZ6iCRyZVe2Fj+15mX otLc6LJr1vMMpN4L+h/g== Received: from nasanppmta04.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3v37vxtmqf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 20 Dec 2023 06:02:46 +0000 (GMT) Received: from nasanex01a.na.qualcomm.com (nasanex01a.na.qualcomm.com [10.52.223.231]) by NASANPPMTA04.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 3BK62kIJ005126 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 20 Dec 2023 06:02:46 GMT Received: from hu-c-gdjako-lv.qualcomm.com (10.49.16.6) by nasanex01a.na.qualcomm.com (10.52.223.231) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.40; Tue, 19 Dec 2023 22:02:44 -0800 From: Georgi Djakov To: , , , , , CC: , , , , , , , , , , , Subject: [PATCH v3 0/9] Add support for Translation Buffer Units Date: Tue, 19 Dec 2023 22:02:27 -0800 Message-ID: <20231220060236.18600-1-quic_c_gdjako@quicinc.com> X-Mailer: git-send-email 2.17.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: nalasex01a.na.qualcomm.com (10.47.209.196) To nasanex01a.na.qualcomm.com (10.52.223.231) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: ckVum8-2-bd6I-fhiGrXHXgVXMk1-c1R X-Proofpoint-GUID: ckVum8-2-bd6I-fhiGrXHXgVXMk1-c1R X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.997,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-12-09_02,2023-12-07_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=717 suspectscore=0 impostorscore=0 lowpriorityscore=0 malwarescore=0 bulkscore=0 phishscore=0 spamscore=0 clxscore=1011 mlxscore=0 adultscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2311290000 definitions=main-2312200038 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785779793583266982 X-GMAIL-MSGID: 1785779793583266982 The TCUs (Translation Control Units) and TBUs (Translation Buffer Units) are key components of the MMU-500. Multiple TBUs are connected to a single TCU over an interconnect. Each TBU contains a TLB that caches page tables. The MMU-500 implements a TBU for each connected master, and the TBU is designed, so that it is local to the master. The Qualcomm SDM845 and SC7280 platforms have an implementation of the SMMU-500, that has multiple TBUs. A DT schema is added to describe the resources for each TBU (register space, power-domains, interconnects and clocks). The TBU driver will manage the resources and allow the system to operate the TBUs during a context fault to obtain details by doing s1 inv, software + hardware page table walks etc. This is implemented with ATOS/eCATs as the ATS feature is not supported. Being able to query the TBUs is useful for debugging various hardware/software issues on these platforms. v3: - Having a TBU is not Qualcomm specific, so allow having TBU child nodes with no specific constraints on properties. For some of the vendor compatibles however, add a schema to describe specific properties and allow validation. (Rob) - Drop the useless reg-names DT property on TBUs. (Rob) - Make the stream-id-range DT property a common one. (Rob) - Fix the DT example. (Rob) - Minor fixes on the TBU driver. - Add support for SC7280 platforms. v2: https://lore.kernel.org/r/20231118042730.2799-1-quic_c_gdjako@quicinc.com - Improve DT binding description, add full example. (Konrad) - Drop Qcom specific stuff from the generic binding. (Rob) - Unconditionally try to populate subnodes. (Konrad) - Improve TBU driver commit text, remove memory barriers. (Bjorn) - Move TBU stuff into separate file. Make the driver builtin. - TODO: Evaluate whether to keep TBU support as a separate driver or just instantiate things from qcom_smmu_impl_init() v1: https://lore.kernel.org/r/20231019021923.13939-1-quic_c_gdjako@quicinc.com Georgi Djakov (9): dt-bindings: iommu: Add Translation Buffer Unit bindings iommu/arm-smmu-qcom: Add support for TBUs iommu/arm-smmu-qcom-tbu: Add Qualcomm TBU driver iommu/arm-smmu: Allow using a threaded handler for context interrupts iommu/arm-smmu-qcom: Use a custom context fault handler for sdm845 arm64: dts: qcom: sdm845: Add DT nodes for the TBUs dt-bindings: arm-smmu: Add TBU support for sc7280 iommu/arm-smmu-qcom: Use the custom fault handler on more platforms arm64: dts: qcom: sc7280: Add DT nodes for the TBUs .../devicetree/bindings/iommu/arm,smmu.yaml | 33 ++ .../bindings/iommu/qcom,qsmmuv500-tbu.yaml | 77 +++ arch/arm64/boot/dts/qcom/sc7280.dtsi | 97 ++++ arch/arm64/boot/dts/qcom/sdm845.dtsi | 74 +++ drivers/iommu/Kconfig | 8 + drivers/iommu/arm/arm-smmu/Makefile | 1 + .../iommu/arm/arm-smmu/arm-smmu-qcom-tbu.c | 504 ++++++++++++++++++ drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c | 17 + drivers/iommu/arm/arm-smmu/arm-smmu-qcom.h | 6 +- drivers/iommu/arm/arm-smmu/arm-smmu.c | 12 +- drivers/iommu/arm/arm-smmu/arm-smmu.h | 3 + 11 files changed, 829 insertions(+), 3 deletions(-) create mode 100644 Documentation/devicetree/bindings/iommu/qcom,qsmmuv500-tbu.yaml create mode 100644 drivers/iommu/arm/arm-smmu/arm-smmu-qcom-tbu.c