From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qt1-f174.google.com (mail-qt1-f174.google.com [209.85.160.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2BCE030F545 for ; Tue, 24 Feb 2026 19:43:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.174 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771962207; cv=none; b=PamVkt4nhQjFQOqeAeUjQc/zNIrj1yNRNH0x3FmW4Eh9KqFTnoTUbXbC7bXL9sZnXTtqDLcjblTCTXaIJhNAOmCtsAXx02eiqJQkoCEPeJlPAJuUkNlV6hFzQWe7ZBrtDfKU+BXIEkuhuqQh90FCEBT8NjdyU9Z0xh5Y/ZxLRls= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771962207; c=relaxed/simple; bh=9NPywY1WqiH72ccbR6wJ+8VRtBE0/jLqQcAKN4+hlD8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=UmyP4vkOTezdkna33hakup/uKGI8I+743uQD2IDj8rRsFSWd4IHj2bjo0/wsv+YCLQTCG5CPGIEStkJXtKUsNgJtTRtS7JygyYM1k49/vr5zpcLSshFbzPNoSkIQDg6D85aL9ov7xLUIDrhyZyiejosNg7Mz1gHHO4SCko00z0k= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ziepe.ca; spf=pass smtp.mailfrom=ziepe.ca; dkim=pass (2048-bit key) header.d=ziepe.ca header.i=@ziepe.ca header.b=ldtgor2W; arc=none smtp.client-ip=209.85.160.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ziepe.ca Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ziepe.ca Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ziepe.ca header.i=@ziepe.ca header.b="ldtgor2W" Received: by mail-qt1-f174.google.com with SMTP id d75a77b69052e-506cb1b63d0so63402941cf.2 for ; Tue, 24 Feb 2026 11:43:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; t=1771962205; x=1772567005; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=T8RdEsygv8bZF4bGPNG6h1aXJPCxbAU5PwKhIaLMAAE=; b=ldtgor2W/spsYmFz5buLLgCa9a7TklczPKQd6BD4zStaMFk+0S2Pal894AszncnMGH TVznH6BpBjaIEeb2x9siFFGcBK9rdyOK1DIaCOz0BcB+r+h6AmW6AF1DnAfYjzYQiFA2 a8VQSKdRb0+tqgZb7m+oNuabuaKihkwhXXxmr4IQS71ijudWzYrEfpje5S8R5OvFl4V3 zL5c4Rlo6Od5DT2x30f/yZw7TK9EAsW8twpSowqpNGTVrPE8pW5Vc4Er9Ywe+iHiru5V RGFU/30wPNWS/1t2cAoWSdEx7iRF8ZvbWg0Oar5LRnL4M/wH4QirGmejfsNCb82SJ9lg w+AA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771962205; x=1772567005; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=T8RdEsygv8bZF4bGPNG6h1aXJPCxbAU5PwKhIaLMAAE=; b=edFI5RWy09ddfAPUIKRWrK9fsFL5sjaIovKDBwV1OXl+c8KIxgMUcLBg6/Mb9fiBVu N8c5jY5N/Pn8D4LLSp2v0TL5vx3aeT9lM2Dx335yELQwIDGssDe1cAK1nPIbclt8KuF8 pxZh1bVa7f0pjRXPJ3ibeiY1YWZo6oOSX6sVZK/7UgSTq6iHfBOOlHsbAEcVUj7A7Wuq +1/K2wcsSVelAJSmeLXdjepFYdEoRnI0G0k2tbQVGxCW3dP4eOOOC76ZyRqTVnti5oY2 cZPRHtWVy5YlzElCAM1MK4utK3Xh4H0Q9ClxUStzKd8OEvXQY6XCfhX1/N4RgfcShymq SwsA== X-Forwarded-Encrypted: i=1; AJvYcCUJ8cjW/W4NCwHlHaJvX4ax4LZNW7oiBM+K6R67Jv9klThsBNCWV2pXoKhyWSVtyj1wJmVpJChasgPY9E0=@vger.kernel.org X-Gm-Message-State: AOJu0Yy8Nn/5yj9UI1xnmfjMElAtx6uCHf7mA0t9VLw/NdrZjsVAQ40E SsBcXGgKl1s+6JtXdSyVU1dIr00hIZSUlEVFlOeFEXNRyHiZObzEqFspmm9dqHgdSK3Jy9OOqcW bgiNh X-Gm-Gg: AZuq6aKL2hhUhDAQWrSiIEU7QRb/EhAzVLIaFPYCyywZcEzw9kxjU67UyxPMdy78hiR ZXd8Gfiiv/eVp/hSFp1JljC/SAU3tN7pxQe12qJ/k3xP5mGCxzUHZuB25mYHDVwMkfenRW8NUBV k1tVbtm1MrX8fd6NIvQd3g7j8a5t+JKrOgxRyEavlr3cRCCLkatF91dhXGU9MgH2awipP2umCiR p4D2idLrBt8RILxK2Sf8yDoyKiffMR8MbqDtFq5UKKszNxE8x1Lbv8nBQjo57ACmU8hJZnH0Md9 G/fc2wsSIeCBJGn9IoMESX9lAlGLDPmQlX0UUhxz3KExlnBo5u0EYVa3dr4zl5NYMR4O1ATU13g bDd21uZldyuRkeTfrkvP+MgpuIpqVExfQ4hC6g7mwff2YggwT8IISyOYtUkfdupC5JwjaT4648B 0= X-Received: by 2002:ac8:7d50:0:b0:4f1:ab79:fb18 with SMTP id d75a77b69052e-5070bbde667mr191957571cf.25.1771962204944; Tue, 24 Feb 2026 11:43:24 -0800 (PST) Received: from ziepe.ca ([173.231.112.170]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-5070d54000fsm104631011cf.10.2026.02.24.11.43.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Feb 2026 11:43:24 -0800 (PST) Received: from jgg by jggl with local (Exim 4.95) (envelope-from ) id 1vuyJX-0009cT-Vr; Tue, 24 Feb 2026 15:43:23 -0400 Date: Tue, 24 Feb 2026 15:43:23 -0400 From: Jason Gunthorpe To: Antheas Kapenekakis Cc: iommu@lists.linux.dev, linux-kernel@vger.kernel.org, Joerg Roedel , Will Deacon , Robin Murphy , Vasant Hegde , Alejandro Jimenez , dnaim@cachyos.org, Mario.Limonciello@amd.com Subject: Re: [PATCH v1] iommu: Skip mapping at address 0x0 if it already exists Message-ID: References: <20260221235050.2558321-1-lkml@antheas.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Tue, Feb 24, 2026 at 08:33:50PM +0100, Antheas Kapenekakis wrote: > On Tue, 24 Feb 2026 at 20:23, Jason Gunthorpe wrote: > > > > On Sun, Feb 22, 2026 at 12:50:50AM +0100, Antheas Kapenekakis wrote: > > > Commit 789a5913b29c ("iommu/amd: Use the generic iommu page table") > > > introduces the shared iommu page table for AMD IOMMU. Some bioses > > > contain an identity mapping for address 0x0, which is not parsed > > > properly (e.g., certain Strix Halo devices). This causes the DMA > > > components of the device to fail to initialize (e.g., the NVMe SSD > > > controller), leading to a failed post. > > > > I'm trying to understand the issue here, is it that the old AMD code > > incorrectly succeeded iommu_map() on top of an existing mapping while > > the new code returns -EADDRINUSE? > > > > Then the existing guard for double mapping doesn't work since 0 is an > > ambiguous return? > > Hi Jason, > > It seems like the previous code correctly handled the 0 case, and the > new code does not due to the ambiguous return. I checked the old AMD driver it is definately returning 0 from iommu_iova_to_phys(), so that hasn't changed. > > reasonabe. Just please clean up the commit message to be a bit clearer > > on what caused this regression and add a short comment above the new if: > > > > 0 return from iommu_iova_to_phys() is ambiguous, it could mean a > > present mapping. EADDRINUSE is reliable when supported, it means the > > IOVA is already mapped, so ignore it to resolve the ambiguity. > > If you think that this patch is a long term solution, I can drop the > print, the addr == 0 check, add a comment on top, then repost a V2 > with an updated description to be more concrete. I think it is a good solution as-is, I just want clarity on what actually regressed here, and I think it is that iommu_map() behavior changed. Jason