Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.219.49 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795949576; b=qlmPCai7qumwEgTkbB9gcKHSTSnxL9wKhslTk5/OCN/VgyRbPJge/T7t2YJJcHMFpwSW QegAWuMb++1HzdFCv5QKme6Hv5qek5HgKIQKJe2a9denuvIZhJmWP8RmP5VxUimWqtTkX n0WhVJeGtk3gZStucyIiUK1RhLXRt6cPiLDe080OL6XjH2Gk6byfXfpROspKKkaK23v// m2nAQqPRpSwfT7cu3k9CpAObWSDO+S+LPTXRfoSsIFM49/qyvfYyn404iL5GNYKY91ibJ bkXSXD1g8H8OKH5j1LVzYP+/+rjnTD7JMjNQMU8RBaJk3+0X5m0UyQ6GS1Cf+m0FICg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795949576; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: From:To:Cc:Subject:Date:Message-ID:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=ZcbVfnO9fhXGL1SwWW6KBnjLtE4XOQZEKD1XMlrCB0Q=; b=tHPpXyXkDAfrSvgLlu8utfDtr521QbiP3L6L6D5UgNem3GuX43vY06kCl8iM2duPdnxw RT+DjYcYtRiitZM/sOher0mFBPSXoKzxn6pmpKimELqw2ZJXrVM3PK9N/R/7SJBT694s3 W0M28NDZZsfhCBuN2JztVoXlKUu2X471p82br82/dInFLD6w/XBWEWryygrThb/6YIQ/t ztx+6lSRdDqDWb7x834PFB45aR35oqwlM5vxCfRz53027ZM0/UDVCTuqLgoUPUoYVvH/E Qy4/9S0kdcWE4EHXihvS9vdv0L4KcBu19Hy+UaxSSVfkOTZtl62UmRN0Ng1XQbtfPvg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=SX14Gze1; arc=none smtp.remote-ip=209.85.219.49 Received: from mail-qv1-f49.google.com (mail-qv1-f49.google.com [209.85.219.49]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6A3DD606A31C for ; Sun, 29 Nov 2026 10:52:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 6A3DD606A31C Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=SX14Gze1 Received: by mail-qv1-f49.google.com with SMTP id 6a1803df08f44-9214032a2fdso81241566d6.0 for ; Sun, 29 Nov 2026 02:52:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1795949575; x=1796554375; darn=lists.linux.dev; h=mime-version:content-transfer-encoding:content-type:message-id:date :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to :content-type; bh=ZcbVfnO9fhXGL1SwWW6KBnjLtE4XOQZEKD1XMlrCB0Q=; b=SX14Gze1LEQWqnuk/yb8srMIAo/zDePaf9S1wN6SIA2IT/5056iEHkJSqH4ajNXzRW fP7FvIa3oXAqeOHp5sZJDK2MtHGhcL6SsPW2FC6zdZzJA3rQpAWgnsEhU6J3auu8hGwJ ScUu2V5xpc4hSQVDZe5ozt9u+6tFZACjXHWCBfL+R9Sjj4a/8TFIxTmTNKPR+G1nKwlq kJPQnLOdODXFnDNN9xUypA3I7JLMEQMRlrCn11ikTv3kHoCtbtxvvB8lZAiXwgiBH+kB Wm5MkCOWteumxA3uNTTK+eymzkL2cZrm0F/MbekXe5PoKBFH2FyYgB/ZflCaV8fxfX5a Cabw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1795949575; x=1796554375; h=mime-version:content-transfer-encoding:content-type:message-id:date :subject:cc:to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to:content-type; bh=ZcbVfnO9fhXGL1SwWW6KBnjLtE4XOQZEKD1XMlrCB0Q=; b=IWvLAWQtJHwuCbrnI3FmTkmCQB0Siz7k5loDVf+Eplkze+eUwa9C3OboswwPNdzTD+ iYrJOLMdbc0SOMdiWI+9si6UPt2WGpAM3v1D9pEYQ8Onrh7vQfQzgw02Sqyg67ZAyjdv D+imdoWtYKJvEITXHLkpF65hw4vRv+rPCIYL4iWhEPFYaqusH4SzGb54+hlICAEYq+up Kc+aAE8HAByryqHNevtx/U/nhu4KgwcVU1zbftxzKhLDVegnEjPsn24OiGH3F9Sh5vTx +ak7RYevkOtS82toNJth1X+pzF65Xua8iZ28KxKn4+xapQxAn9jyCDN6+zCoGfS5IA2y 3PJw== X-Forwarded-Encrypted: i=1; AL+hErHn63z2ezguakm+BnYDAnL7fQQudi8yVZjqCeRFsUV4XIsHVRifAU//CCkdP7r8CJ6a9/Pv+g==@lists.linux.dev X-Gm-Message-State: APuU4Z/wgt4zWvfX4V4ru/Yws2V4li2kzycw2SFNDF9Gvzedg4U4HRd6 H680iFleCTQxmSO1FE64Mt8ELSp2hzZT1fNg9DLhxcs8nBYCZbq033Yg X-Gm-Gg: AZFdTZe9WQsqINe5iXAHMFzJFSCFlZ5I27XfOzaotty0x5IInuakC8I2bOzx+l+2EfG S2O6mI1z/flG5wxA1XrB/lD9KiNbRGeypwgbEw1cYST0d1q6Pm+ketbkuPFAUorpSgUNjnmDpXR 7Re0Z2yEIT0AKC1w50C1ZUFpL3PP5+G2s4pNC+MfiCdsqoC03y9DLfot6lnDodIsco/Tqs2K0cY gH3KWRowFbhHQf+yw4UouXn7oD9lbx0CeP4JbgZdwUn3iSGL651q02QBj2NAWQc3NxuiIdeW+P8 EAXFEHD7e1VX5LfIy2iX3Kr2tzWuueZCK9iJspeZNEwUbsss74dUvHCD5UNCJkKOJvHBWWcEMbQ jaDnP8fSlHFozv9q0oVc02vjqBY5FOkOFjmGBVfrvvW73pmpCoxEN479Ulhr3jjlVAyZ6GaDqp9 U1sKKJ5A+hZvamZEl57eNz36EnglSCvpbzb6tlqH4lERUSMSJlRMpIH+p0j0lpmfxqYw7HIBkeA pP+zU0CRLm9bYTj/i//+aXC3IV//z7HS8iu8/pyRwFszSd1e+gKYLDEjtVpErNe8w9t+Hca8dwU mucMq8L0AyLL23HFHwxaU8c4g9zps662xHvCzFltmubnGV5tdm5/g/5xnZLY7Bz+RSOOXuPfBAI apzi2PPbptDU1nBHza6EcX4JQVUQSlobabkZ97pdG/mWouDWijg== X-Received: by 2002:a05:6214:861f:b0:91e:9664:6e93 with SMTP id 6a1803df08f44-92134a95f76mr556331246d6.25.1795949575245; Sun, 29 Nov 2026 02:52:55 -0800 (PST) Received: from zeppelin-x.local (dhcp-9-244-177-183.gobrightspeed.net. [9.244.177.183]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-921787f6847sm125022086d6.30.2026.11.29.02.52.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Nov 2026 02:52:54 -0800 (PST) From: Felipe Infante de Castro To: Manivannan Sadhasivam , Jingoo Han , Bjorn Helgaas , Joerg Roedel , Will Deacon , Robin Murphy Cc: linux-pci@vger.kernel.org, iommu@lists.linux.dev Subject: [BUG?] PCI: dwc: iMSI-RX target address appears unreserved in endpoint IOMMU IOVA domains Date: Sun, 29 Nov 2026 05:52:53 -0500 Message-ID: <179594957382.39737.12984183923146564234@gmail.com> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Mailing-List: iommu@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Hi all, During a source audit of DesignWare PCIe host MSI handling on Linux v7.3.6 (drivers/pci/controller/dwc/pcie-designware-host.c and drivers/iommu/dma-iommu.c), we found a potential IOVA/MSI address collision when a DWC host uses its integrated MSI receiver (iMSI-RX) with downstream PCI endpoints behind a translating IOMMU. No hardware collision has been observed yet (our test platform currently boots at EL1 without an external PCIe IOMMU), so this is a source-audit report seeking confirmation and guidance on the right fix. Summary of the issue: When pp->use_imsi_rx is true (no msi-map, msi-parent, or custom ops->msi_init), dw_pcie_msi_host_init() chooses a PCI-visible MSI target address pp->msi_data and programs it into PCIE_MSI_ADDR_LO/HI: 1. 32-bit cfg0_base branch (pcie-designware-host.c:370-373): pp->msi_data = pp->cfg0_base (from platform reg "config", not from host-bridge ranges). 2. Above-4-GiB cfg0_base branch (pcie-designware-host.c:375-390): dmam_alloc_coherent(dev, sizeof(u64), &pp->msi_data, GFP_KERNEL), trying a 32-bit coherent mask first. Per the DesignWare PCIe databook note in dw_pcie_msi_host_init() (r6.21a s3.10.2.3), any incoming PCIe Memory Write TLP targeting MSI_CTRL_ADDR is terminated internally by the iMSI-RX module and never reaches the AXI bus / IOMMU. When a downstream PCI endpoint attaches to a translating IOMMU domain (IOMMU_DOMAIN_DMA / IOMMU_DOMAIN_DMA_FQ), iommu_dma_init_domain() calls iova_reserve_iommu_regions() (drivers/iommu/dma-iommu.c:553-583): - iova_reserve_pci_windows() reserves only host-bridge IORESOURCE_MEM windows (from ranges) and gaps outside bridge->dma_ranges. Neither pp->cfg0_base nor a dmam_alloc_coherent() address lies in bridge->windows. - Neither pcie-designware-host.c, arm_smmu_get_resv_regions(), nor viommu_get_resv_regions() registers an IOMMU_RESV_RESERVED region for pp->msi_data. - Under iommu_dma_alloc_iova(), PCI devices with pci_32bit_workaround allocate top-down from 0xffff_ffff first, even with a 64-bit DMA mask. On a concrete layout we examined (Snapdragon X Elite USB4 tunnelled PCIe root pcie@1c28000 with "config" at 0x4_0010_0000 and ranges at [0x4000_0000, 0x4fff_ffff] and [0x4_1000_0000, 0x4_ffff_ffff]), dmam_alloc_coherent() on the controller platform device (no iommus property of its own, no dma-ranges) allocates a 32-bit RAM address in [0x8080_0000, 0xffff_ffff] -- squarely inside the unreserved [0x5000_0000, 0xffff_ffff] top-down 32-bit IOVA pool handed to downstream endpoints. Any endpoint DMA write to that IOVA risks being swallowed by iMSI-RX as a spurious MSI instead of reaching the SMMU. Candidate fix direction: Record the active PCI-visible MSI target (pp->msi_data) on struct pci_host_bridge when pp->use_imsi_rx is enabled in dw_pcie_msi_host_init(), and expose a PAGE_SIZE-aligned IOMMU_RESV_RESERVED region for it in iommu_dma_get_resv_regions() (drivers/iommu/dma-iommu.c:462). That would cover cold discovery, hot-add, rebind, both 32-bit cfg0_base and coherent-allocation paths, and all IOMMU drivers using iommu_dma_get_resv_regions() (arm-smmu-v3, virtio-iommu, etc.), while surfacing the reservation in /sys/kernel/iommu_groups/*/reserved_regions. Full audit notes: https://github.com/fidecastro/surface-laptop-7-15in-facts/blob/main/upstream-reports/linux-pci-dwc-imsi-rx-iova.md Does this look like a real gap in DWC iMSI-RX + dma-iommu, and would a patch along the pci_host_bridge + iommu_dma_get_resv_regions() lines be the right direction? Best regards, Felipe Infante de Castro Signed-off-by: Felipe Infante de Castro