From mboxrd@z Thu Jan 1 00:00:00 1970 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 571123B6C15 for ; Wed, 15 Jul 2026 05:55:58 +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=1784094961; cv=none; b=lkW8Ql3+Hk5qajnwfLoV84aO9cFJ5Tswy0kuP8jT7/SDhHlvy4kE0Rovsgh1+KVHBpFcxoadNdaCUjAZQSwQmhn/fmFVFmBZnNK0QFH+ivvY4+W+G720OoCphvUt8QbDt+y7Ol9RgHXZYGgq30x3yn9IJyy0CgrdI/zGoqfhVc4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784094961; c=relaxed/simple; bh=5HTXX++gicPMEiTjJp/dz1aR1JmBPBM9RA7EJEs+w58=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=R1g2ZaPPpMvWX/XOldaxuIaCY/K+P46SCDmqyIWrMRjXpD8+LDecgFfeuLi1kh5mm/n9iya3NDtehst+GcMNbqXnY/VFfRO4LMSVsVnt67ywBfxFfcmPhy3F1DymfPKM++5nAMdUxkHpQqoNkyR/n6o1KrtguGOtg/eY1zxd86s= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=L9w7LnyF; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=E6S23+qb; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="L9w7LnyF"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="E6S23+qb" Received: from pps.filterd (m0279866.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 66F3l2k22372699 for ; Wed, 15 Jul 2026 05:55:57 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= pB/j4DvH2ZOcHrab8vDDXcKtg1x5ii9LH73zX87n3Ko=; b=L9w7LnyFUmzSTGLy yK2/duhNZU8lZP+CmJGkP12TeN1qlqOHUgI4rMbR7OQVLjvLvgd9afCBbQuXrUr+ ZqJUp0wmuFzSDngL1udumNVEj0hCuv08mZi1Y2f9SeZsv8+/6spv5FTfgza4x1IF fNEce1u0eLMc5e/suI5aYAfswvCcbnoxb+MC1trsZc9S2iMNwSOubGNTP+7mFl6w j5tRExgm3kDrWzzjXAwC5XmQawIX6IpFwNBjUGbBhyQ72BR3dfVOv5rnoBg3q3EA zO5nNb/j9MRaK7z/baBtednwF0k0s6KGI6KBvG3WvqWoA7pjyfnVoLg+huXqN/eS F/iVzg== Received: from mail-pj1-f72.google.com (mail-pj1-f72.google.com [209.85.216.72]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4fdmkk3fwj-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Wed, 15 Jul 2026 05:55:57 +0000 (GMT) Received: by mail-pj1-f72.google.com with SMTP id 98e67ed59e1d1-38db4fa2e25so7023179a91.1 for ; Tue, 14 Jul 2026 22:55:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1784094957; x=1784699757; darn=vger.kernel.org; h=content-transfer-encoding:content-type:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:from:to:cc:subject:date:message-id:reply-to :content-type; bh=pB/j4DvH2ZOcHrab8vDDXcKtg1x5ii9LH73zX87n3Ko=; b=E6S23+qb5S5R500tdax0tJ9+Q55KjB+jhA3PUKDRKXN9I2ih9WUGcoP96rlA/Qk9lE pKDVMw4pBapWvRcz1Go599CejMV9mWUkHiaJ/Nm+R9zwASsFxsOCy6jc7R4IiHaANHRp 4MF6dWpuppYnUtLPt3wewSLxNEbGSMoEUeAdABS/7wizn5J1HQw4p6OUF7HdDuCVDAZQ tGMP3Hver3GH5sEv8dpFnsgk7oRLgqof9D5EYFtdE15QjSh0wxodJOX3wDIhzACk+fQs deOT+HYn/DUSm+phgpt7MT2zO4v72uOAbdnBYy0JdrNGTtQeSKYDI8h3FrIYnnBdMnJB sr8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784094957; x=1784699757; h=content-transfer-encoding:content-type:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=pB/j4DvH2ZOcHrab8vDDXcKtg1x5ii9LH73zX87n3Ko=; b=Met3GZXJhWis6Vhfgcy9pXODQg74g3LUFwabxLfvx/MBjn2G7qZdzcr2W5tFS63Zw6 ujxMlhsuHOML6kRPzy4ejg4YHTaH36GYm9MNV7I2lgDJoBXsBYRrmj8dcaLCebBvWPD2 hcx/Jq3Ya6xoV9ObZsChJgdLUHfNe/nO0TaXeBfLUpZBeZ1NFYWjwniPDvrE3RtHQR/4 wsX1W5ACkjc/rXMMW0muT/SLKgoRRM9ZvS+jIbndIpByr+9l7JSO7KbgRLHmHEJRKBz8 zfIPwmHJUCob5lpj5QJ7DWl/DzIpc85UVpkVO9BiIH/ytEwsrTtOwUluP+auEbXzb9dq k+1w== X-Forwarded-Encrypted: i=1; AHgh+RqLuzWNUyxHs7JdbMhEVCSog0vaN8DNdKXNEESt9MvWUtRKi+kXad68rmq2cjrkgXgv5hlK09aAAyu0avM=@vger.kernel.org X-Gm-Message-State: AOJu0Yz+X1d2ndIvBBXUCcCzZ4saejs3MXHdxIFd+HZArdVQeL0MyzLk VfNn+9Pict80Z1yg3LMFEqWYPIw099CoaQT1yDHHtVKi+HzURwsJhqkSDx1kI5y83OvJ/O5fUdz EmAGZFqQPmXf2tT5KstE5It63ki/FIqtyTXdrzzTwH/UdNdKjPIJWJV9/TqfZ19/3+UU= X-Gm-Gg: AfdE7cnsVQgfUSLiL72wt3o+t5CJ8+r/Tcrts7v26YJk7IcTae/g9YeN061j7RRhLSu ymOXxda2GDs6qqVX/2pDerh97Bo3ZltrHgqvnZlOwKltf8FCV2hsZWzY3r8Ud2+HZYoiPiktH/K atnmYyJE7r+H0x9hTduQypJLUTpg8OmJZKNCQYWQ7TJjK4QIBLs3V+aQONg9Rnes9tWwSp1XI5N mzwpcWksCVVcPfzkq+TytH+ED2KiJBXAE6pHDyaKvebn5XYnGtNDna/pXHuORpHN3U58t0KGCcO QS87hZbn0As1wn1cFYWLnHk3l4mC+mc5bRTZrsTY8dk+I0HOXHpZLD/IVpqrvSTyoCvdkMvvTSw DaHPK1uqyShUbR5h6xT/GzQqaFVb7NAKCOSs7cQ++sW/J X-Received: by 2002:a17:90b:4a:b0:388:cf45:d72c with SMTP id 98e67ed59e1d1-38e1aedd604mr5217135a91.15.1784094956855; Tue, 14 Jul 2026 22:55:56 -0700 (PDT) X-Received: by 2002:a17:90b:4a:b0:388:cf45:d72c with SMTP id 98e67ed59e1d1-38e1aedd604mr5217113a91.15.1784094956377; Tue, 14 Jul 2026 22:55:56 -0700 (PDT) Received: from [10.218.39.50] ([202.46.22.19]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-38e172fd17asm2560963a91.12.2026.07.14.22.55.53 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 14 Jul 2026 22:55:56 -0700 (PDT) Message-ID: Date: Wed, 15 Jul 2026 11:25:42 +0530 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] iommu/io-pgtable-arm: Add support for contiguous hint bit To: Jason Gunthorpe Cc: "Joerg Roedel (AMD)" , Will Deacon , Robin Murphy , linux-arm-msm@vger.kernel.org, iommu@lists.linux.dev, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Prakash Gupta References: <20260618-iommu_contig_hint-v1-1-4502a59e6388@oss.qualcomm.com> <20260703161228.GA1948451@nvidia.com> Content-Language: en-US From: Vijayanand Jitta In-Reply-To: <20260703161228.GA1948451@nvidia.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Proofpoint-GUID: fhCPg6QC4FgClMWgQHp0rbmyzuZ88fkw X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzE1MDA1MyBTYWx0ZWRfX2nLdzCmH8rQG fu9RXpLNOoriyn4XWbuE1UhOFcYLW5T0z741gK1trty4Jajp0OZk61Q72RbgXxKBpLx1b6k2rfV NgpW7Jym1B3E/zbRC+iiO8w+F4RNwniuEAoBZytSy1PMGltVbbo5PODdhFz3RehgZ/kvhM8mkYp 68rEr6b47xgNLMM06QuAwYmVyBGBwXw1Rc+EDISCixTirEnFD99UM0R4PrQjSOVwP7kmBi677K2 +hvbbPLMXVj8oU8CBoHC2VuigpDUzXGNe4eimFE/izwQaR5KAUK6x3tYgThDLRF+aKTCaRjXjnT D5TxrhDwkEMyYQlLLHvHzM10tZ3qmWW1KYAAwWbkJjFJcMN5sIf+0g94g+rc3NT2OZUAOXRbdTp Qhp9Ls0vkjXXJ2xeBpU6o9+CCQOZ970JEok3UyUMPU+yYwaYxWVtZ5U4Rfk5jnZuMan8oB7WT0C 9qBVLdELRUgMlZlRhKg== X-Authority-Analysis: v=2.4 cv=NszhtcdJ c=1 sm=1 tr=0 ts=6a5720ed cx=c_pps a=RP+M6JBNLl+fLTcSJhASfg==:117 a=fChuTYTh2wq5r3m49p7fHw==:17 a=IkcTkHD0fZMA:10 a=RAioF0-LDSMA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=YMgV9FUhrdKAYTUUvYB2:22 a=EUspDBNiAAAA:8 a=fcmBhDXz9gjiIA-sPNYA:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10 a=iS9zxrgQBfv6-_F4QbHw:22 X-Proofpoint-ORIG-GUID: fhCPg6QC4FgClMWgQHp0rbmyzuZ88fkw X-Proofpoint-Spam-Info: AW1haW4tMjYwNzE1MDA1MyBTYWx0ZWRfXyzqUeAaiVv1a D8Xn3Lr2ej0eqeZYcl9cnW5ZUP9dtcYSvP/g+T2XOO1ytH5EWmnoSirMDIJ4lVEDSJeJ0mx3wmx ueYTbgPAkqfkoNYt3llW82hoiIE0WPA= X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-07-15_02,2026-07-14_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 impostorscore=0 clxscore=1015 malwarescore=0 spamscore=0 phishscore=0 lowpriorityscore=0 bulkscore=0 adultscore=0 suspectscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607150053 On 7/3/2026 9:42 PM, Jason Gunthorpe wrote: > On Thu, Jun 18, 2026 at 02:32:09PM +0530, Vijayanand Jitta wrote: >> From: Prakash Gupta >> >> Add support for the contiguous hint (CONT) bit in ARM LPAE page tables. >> When a set of consecutive PTEs map a naturally-aligned contiguous block >> of memory, the CONT bit can be set on all entries in the group to allow >> the hardware to combine them into a single TLB entry, improving TLB >> utilization. >> >> The contiguous hint sizes per granule are: >> >> Page Size | CONT PTE | PMD | CONT PMD >> ----------+----------+-------+--------- >> 4K | 64K | 2M | 32M >> 16K | 2M | 32M | 1G >> 64K | 2M | 512M | 16G > > My series to convert smmuv3 to the iommupt takes care of this and > supports all the orders too. I'd rather we move forward with that then > try to patch up this. > Thanks for details, I have gone through your series. As this patch targets io-pgtable-arm.c directly and would benefit all its users (SMMUv2, Apple DART, etc.), not just SMMUv3. I think there will still be value in this patch for the other users. >> Support is gated behind CONFIG_IOMMU_IO_PGTABLE_CONTIG_HINT, which >> provides a compile-time opt-out for hardware affected by SMMU errata >> related to the contiguous bit. > > I reviewed the errata and didn't find any related to contig that > required disabling contig, the driver was OK with the ones I > found.. Did you find something specific? > >> On the unmapping side, the CONT bit is cleared from all PTEs in the >> affected contiguous group before any individual entry is invalidated, >> following the Break-Before-Make requirement of the architecture. > > BBM means you make it non-present and flush, it doesn't mean you clear > CONT, this is wrong.. > > Jason You're right. The arm_lpae_cont_clear() step was introduced to support partial unmaps of a contiguous group — clearing CONT first so that individual entries could then be invalidated one by one. However, as Daniel also pointed out, partial unmap of a contiguous group should not be supported at all. Since v2 will enforce that an unmap must exactly match the full aligned contiguous range, arm_lpae_cont_clear() is no longer needed and will be removed. The unmap path will simply write invalid entries for all PTEs in the contiguous group and issue a single range TLB flush covering the entire range thereby following BBM. Thanks, Vijay