From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=205.220.180.131 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1793985341; b=KMjfXpeQW7etvuZsKNno1UdzUThy/3PAS71Zjy+A/TWZg5NbDgJrHPpo2TmkT7g6cAOv wL5GGKuiYW5U1Dz5k6MlUuFw54jK5NZreCtvD5VhmMjUypkJv1DvROIEpf26/Zb2G6tm1 VQ5gyHIpHnNbBS+DjMDPYva+Vqk50aExUAsV2muD6ykwIVbSj0BkDQcH+4dwgBx8aJAX3 Fp5thyxNmN5BuKXBiSfbqn51NeGqQbuVifF73fJZrIeaDIU867jdGeGUWWf+fZVLRaVt1 aKjuxvNo0v1F+pRtj39gyWWXhEicRGYDHlC8PTxgBXQKSQrPMvXJawmcWDGbr+G3BNA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793985341; h=DMARC-Filter:Received:DKIM-Signature:Received:Received: DKIM-Signature:X-Google-DKIM-Signature:X-Forwarded-Encrypted: X-Gm-Message-State:X-Gm-Gg:X-Received:X-Received:Received:From:Date: Subject:MIME-Version:Content-Type:Content-Transfer-Encoding: Message-Id:References:In-Reply-To:To:Cc:X-Mailer: X-Developer-Signature:X-Developer-Key:X-Proofpoint-GUID: X-Proofpoint-Spam-Details-Enc:X-Proofpoint-ORIG-GUID: X-Authority-Analysis:X-Proofpoint-Spam-Info: X-Proofpoint-Virus-Version:X-Proofpoint-Spam-Details; bh=ktnp8h8HYMjSZRjDLlt4pPs82/7KOH2Yv0rLDfthZeI=; b=F0IOPlzF8SM4MD0JerRfabzKibXz6qoerKO3gaQhFnwV2rESYqBtLrhWDOcKT3EIflDn 5x+Hos/fPLFDhBLca0ucpQx7TFiouKgETioJFHf5E7kCUJ4L51ZgfVYwkfA60V59AqYdW PwTt9rBHs2loZXWiVYQiJoYY7NCR7U9p6EdFANTuoLa42aALoU/ZjTwise6FecgimBIer bJA2PrYuBhhh7qbPHU3EFt+xbGeo8DsrHv5/1Tje9QJ1HhIhkfEAvg9hiGZf3rno4Ejyb HBNHmox2RJY0PAcDFL1g96MIdJz3kwBxDapEW+78/VB5ZwqXcY3aSTKO89DC6zg1oqA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass header.d=qualcomm.com header.i=@qualcomm.com header.a=rsa-sha256 header.s=qcppdkim1 header.b=PxynK2so; dkim=pass header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.a=rsa-sha256 header.s=google header.b=buoJxTlb; arc=none smtp.remote-ip=205.220.180.131 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 47183606A32C for ; Fri, 6 Nov 2026 17:15:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 47183606A32C Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none 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, unprotected) header.d=qualcomm.com header.i=@qualcomm.com header.a=rsa-sha256 header.s=qcppdkim1 header.b=PxynK2so; dkim=pass (2048-bit key, unprotected) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.a=rsa-sha256 header.s=google header.b=buoJxTlb Received: from pps.filterd (m0279872.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 6A6F04jg3184983 for ; Fri, 6 Nov 2026 17:15:40 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= ktnp8h8HYMjSZRjDLlt4pPs82/7KOH2Yv0rLDfthZeI=; b=PxynK2soVuo53JjN 5aj46e3rVH7kXRVGRgHizLTk7r1efV79/U0yrirlZ7/QvmE9lWyP1ixbn046WYHW mRNkgaEaaU5spk5b068thk09RJAnom8M5OiVBPi47dlSmBWBNLB8ncWTx78AAh7p jhzXb/yblbck7Ox/MlVS8y+fvGb/gylJcl6EgNx+NlJ/9KmmI9gZjdwjFDv3oZYX ZDE+4oTOJNA6cPFKwCcls9o+Dp7zL00pMeN6/9V06JMNLlCrP4ae9Xy4jH1E9HOI bLaYdwKm+bI35HThXY48Od99Ofdf7AebqtXjmLlDrhKozB/bTqxzNqKmWqfkJLuy dkCcwQ== Received: from mail-dy1-f197.google.com (mail-dy1-f197.google.com [74.125.82.197]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4hs3pabs82-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Fri, 06 Nov 2026 17:15:40 +0000 (GMT) Received: by mail-dy1-f197.google.com with SMTP id 5a478bee46e88-36f1e7d9d4dso1730542eec.0 for ; Fri, 06 Nov 2026 09:15:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1793985339; x=1794590139; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=ktnp8h8HYMjSZRjDLlt4pPs82/7KOH2Yv0rLDfthZeI=; b=buoJxTlbXc0+IbRZZQJBqPREtjlrOLASWu0PAprRuh3GthtMrqHrY+k8UJ1Zksdc76 hMBF8nUYG59zfXGEYwroyKhfriPZiEy0AvpY7TqN1r05V+P1tNFBNy3icX1qRlbwBeFp 2Bid6gfxbqTxQUwhVB8Tb8PVhVgVISKhFos59uIQRwQ0D1YceQKeUUqV5XJ0QohrvS4l MzwICVeuRZ3nflcewWYQHmYaZCU3QUHdThGPfMuY/7QhNurirLBqmbvyaZaJfiEg68tB +HMs9A6tZUu+qZ7+mVQAVe6wEHFtx3ATvaU7FwVzsC3LTCQ+DFL1OJuaDfGbI9PzLz6o vz7w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1793985339; x=1794590139; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=ktnp8h8HYMjSZRjDLlt4pPs82/7KOH2Yv0rLDfthZeI=; b=OZ0QxAY0Adpfdgku4G/FJeZ8MrDwKHAweasl1ZPqjUdg1bs9dKDrab9gqo4kLmD+3b 1Ip9G0dhAgPNgTfnMsvNAqJVmzhuE7uO+hrMNnzVOUNJGmM6HFIveLIKo/cxRpXhb/Wd nskKEUaAPTE8GiaaQTUdw46jJ8gnOL5oDI+C1hgnYfi5wyNeHvfktoenakUaxHVE7WZS kGM684EZNYUjnnchca4ZBmxpEUUd1qgR6p5Vu0g4VunJ+0AlBdDedKUAaFZDRVOzZ2Mi 0kBSSiQPsh6yk/3WjnWFiAW8Fj44pW46MQumjfYFnrnEikYT4KF4vRA9LInwX5DUwDiX GFlQ== X-Forwarded-Encrypted: i=1; AL+hErGkbzq3WRxL5TWnJp9tWKF5BJqnu4FpeEaxateAsoEkJs+SkkZRfEQP3cwG4M54chzG13aoE/LLJ1mmiM0=@vger.kernel.org X-Gm-Message-State: APuU4Z/CgAa/F7/Hlq3WouJ2U4VTobJdAxkCQApBk8njNnhh4XqIO9Qa fXuX71kxGAocnjbsRJGc0xb+UnRyHQV0SPqUGtjJKVWLulteevcY2mXApE4crevhP4KTj6sRROe HvMlq9rANTGLq+sZEvxyca3UZAEXfYGx1Vt18amGs1x024z8zzJY+q3G0mqaoz7/mTY0= X-Gm-Gg: AYBFou2fsRHKZfrLDzOz/gGEjnU3omVXgC9JerXGlUB/8FKfZdKNkcXdhA7vSv7a4id ZQ58Gf8b32Kl75XmjOYy6GIpSUhylCo9MUJj/wW7tUj471dyB7t39jYGwt6VIQP3HX637YE+LxG 4JnLI6QutzaRBX1EIJjzbcv7pGU8HOmCeZEWz6nv6WHxoBEdKyoYJaQGWTX/NKIKsT8ZP1b7pij b1D+tSbnkrazVtirGm2bTU9XrLtbWnrxMmcKF6qjsZNWi1A805Tfo69jaSRXLOrXaWd/O670TKe PaSAqDnI+B8JUTCLQcOK70lh5UPBpEpON1iUJc4QPZrHP1VD/MI75+YGp1tHV1990w8Z+6PF7Kg C84LPLY2ppo+gQieuUlr7yH13IuvoXH4GKukYRaoM4sO6vA9fNon+SOuuhoPYMHz0JfadaW9GmW OdLbCXGm+Y X-Received: by 2002:a05:693c:839a:20b0:36e:371:8255 with SMTP id 5a478bee46e88-36f6fb7f6b0mr4460545eec.0.1793985338813; Fri, 06 Nov 2026 09:15:38 -0800 (PST) X-Received: by 2002:a05:693c:839a:20b0:36e:371:8255 with SMTP id 5a478bee46e88-36f6fb7f6b0mr4460485eec.0.1793985338092; Fri, 06 Nov 2026 09:15:38 -0800 (PST) Received: from hu-vgarodia-hyd.qualcomm.com ([202.46.23.25]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-36fa9aea75fsm14693756eec.15.2026.11.06.09.15.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Nov 2026 09:15:37 -0800 (PST) From: Vikash Garodia Date: Fri, 06 Nov 2026 22:44:27 +0530 Subject: [PATCH v7 4/5] iommu/of: Require reg for iommu-addresses X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20261106-add_iommu_ranges-v7-4-5c0f72083e52@oss.qualcomm.com> References: <20261106-add_iommu_ranges-v7-0-5c0f72083e52@oss.qualcomm.com> In-Reply-To: <20261106-add_iommu_ranges-v7-0-5c0f72083e52@oss.qualcomm.com> To: "Joerg Roedel (AMD)" , Vasant Hegde , Suravee Suthikulpanit , Will Deacon , Robin Murphy , David Woodhouse , Lu Baolu , Jean-Philippe Brucker , Rob Herring , Saravana Kannan , Tomasz Nowicki , Eric Auger , Bryan O'Donoghue , Joerg Roedel , Srinath Mannam , Oza Pawandeep , Lorenzo Pieralisi , Bjorn Helgaas , Alex Williamson Cc: iommu@lists.linux.dev, linux-kernel@vger.kernel.org, virtualization@lists.linux.dev, devicetree@vger.kernel.org, kvm@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-media@vger.kernel.org, Vikash Garodia , Vishnu Reddy X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1793985294; l=3341; i=vikash.garodia@oss.qualcomm.com; s=20241104; h=from:subject:message-id; bh=eqYY4N+b5bBNKlPSwJkXdHdjtL4HfBKjpUYn+IsXKkA=; b=GBQVa8RApuiz6ercB/DdrPne5hpMvwbz+39mcf5Gak8TM+/DOIR+JsQkatd14qD1YxOVp3Bni be5cEvNi0vbASIajgNIko9PHVXfje8oKBQGQwGiGrYCVoXQBWE0ZAFZ X-Developer-Key: i=vikash.garodia@oss.qualcomm.com; a=ed25519; pk=LY9Eqp4KiHWxzGNKGHbwRFEJOfRCSzG/rxQNmvZvaKE= X-Proofpoint-GUID: BMBGIm9JioCJfIn3U1RhyLuYrrfWe1y2 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMTA2MDA2OCBTYWx0ZWRfX80L61t0crE7Z DCd7zoH30uu6jaGv0WIKXu6HS7Nf8p5wowJY19y7ABNWjhLLhYkxaatFwVDkGXGctFlb9BKVgsm gLugHvpvxFg+ZH445QCETKsD/nQOUO4tRQ97JG6iGs++5B6TSCUgdzWaLVBZAAjx8wm9Tq4xvsk 7w7PhZ0ATVjio81alIMr4WMf1LB+yUEaUIPtRjfnHTVN0DqHpE4nCREkIoACyLs5QJ9QEv2hP2M rCq01LU590OeHlCJo8IgXS5ZNcQlxJcFHltm3F0AMAKMyiG81pvodmYzEueByxB/4d5b3i5jxQ2 lzb8CdMiFvXR0CHOnbM+iwbaW1RwaO0j0p/6j5nrOhuS68S2xCLhXISaVzXxawafKNJuZ7hc5Qz c7C5/q+anT9fk00XRtCJfTnO7JMo014RYZRSNw8nFjsQE2BsJsOpnCW6Qf+IZqof0CMwS296kvs VvXR7XuOxPtU99clucw== X-Proofpoint-ORIG-GUID: BMBGIm9JioCJfIn3U1RhyLuYrrfWe1y2 X-Authority-Analysis: v=2.4 cv=X7rHu2Te c=1 sm=1 tr=0 ts=6aee0b3c cx=c_pps a=Uww141gWH0fZj/3QKPojxA==:117 a=ZePRamnt/+rB5gQjfz0u9A==:17 a=IkcTkHD0fZMA:10 a=zJRp6_cAMcgA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=yx91gb_oNiZeI1HMLzn7:22 a=NEAV23lmAAAA:8 a=VwQbUJbxAAAA:8 a=EUspDBNiAAAA:8 a=S4w_zJ8MM8sBhC3S0vwA:9 a=QEXdDO2ut3YA:10 a=PxkB5W3o20Ba91AHUih5:22 X-Proofpoint-Spam-Info: AW1haW4tMjYxMTA2MDA2OCBTYWx0ZWRfX+iyEEblWmKtC TaBGQoRuBm9881ln+cYMqJ+PCRKunR2axaoB/OqEiMCtqhSaFvfJ2/ugbq3LS9IMnv2V3P0BLB3 bbjoPJJ6pn5qriDBK8U4YM30QA2JLpk= X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.138,FMLib:17.12.100.49 definitions=2026-11-06_05,2026-11-06_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 clxscore=1015 impostorscore=0 phishscore=0 malwarescore=0 bulkscore=0 spamscore=0 priorityscore=1501 lowpriorityscore=0 adultscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2611040001 definitions=main-2611060068 The "iommu-addresses" property describes an identity 1:1 mapping between an IOVA range and the physical memory specified by "reg" in the same reserved-memory node. Without "reg", there is no physical memory to map. The DT schema now requires "reg" whenever "iommu-addresses" is present. Align the kernel implementation with this requirement. https://github.com/devicetree-org/dt-schema/pull/207 An identity mapping requires matching IOVA and "reg" ranges. Reject mismatched ranges and report an error. Suggested-by: Rob Herring Co-developed-by: Vishnu Reddy Signed-off-by: Vishnu Reddy Signed-off-by: Vikash Garodia --- drivers/iommu/of_iommu.c | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/drivers/iommu/of_iommu.c b/drivers/iommu/of_iommu.c index 6675fc900e6c2d55b34c61dc9effaeb48e24f18f..00b02c19f27e195fc36c4bc1d91253255147c9ab 100644 --- a/drivers/iommu/of_iommu.c +++ b/drivers/iommu/of_iommu.c @@ -174,19 +174,12 @@ iommu_resv_region_get_type(struct device *dev, { phys_addr_t end = start + length - 1; - /* - * IOMMU regions without an associated physical region cannot be - * mapped and are simply reservations. - */ - if (phys->start >= phys->end) - return IOMMU_RESV_RESERVED; - /* may be IOMMU_RESV_DIRECT_RELAXABLE for certain cases */ if (start == phys->start && end == phys->end) return IOMMU_RESV_DIRECT; - dev_warn(dev, "treating non-direct mapping [%pr] -> [%pap-%pap] as reservation\n", phys, - &start, &end); + dev_err(dev, "non-direct mapping [%pr] -> [%pap-%pap] is not supported\n", phys, + &start, &end); return IOMMU_RESV_RESERVED; } @@ -211,12 +204,14 @@ void of_iommu_get_resv_regions(struct device *dev, struct list_head *list) struct resource phys; int size; - memset(&phys, 0, sizeof(phys)); + maps = of_get_property(it.node, "iommu-addresses", &size); + if (!maps) + continue; /* - * The "reg" property is optional and can be omitted by reserved-memory regions - * that represent reservations in the IOVA space, which are regions that should - * not be mapped. + * "iommu-addresses" must be used in combination with a "reg" that provides + * the physical address and size of this memory region, for an identity 1:1 + * IOVA mapping to that physical memory. */ if (of_property_present(it.node, "reg")) { err = of_address_to_resource(it.node, 0, &phys); @@ -225,11 +220,11 @@ void of_iommu_get_resv_regions(struct device *dev, struct list_head *list) it.node, err); continue; } - } - - maps = of_get_property(it.node, "iommu-addresses", &size); - if (!maps) + } else { + dev_err(dev, "%pOF: iommu-addresses requires a reg property\n", + it.node); continue; + } end = maps + size / sizeof(__be32); @@ -257,6 +252,9 @@ void of_iommu_get_resv_regions(struct device *dev, struct list_head *list) } type = iommu_resv_region_get_type(dev, &phys, iova, length); + if (type != IOMMU_RESV_DIRECT) + continue; + region = iommu_alloc_resv_region(iova, length, prot, type, GFP_KERNEL); if (region) -- 2.34.1