From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qv1-f42.google.com (mail-qv1-f42.google.com [209.85.219.42]) (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 ACB21DF59 for ; Fri, 28 Nov 2025 00:04:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.42 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764288292; cv=none; b=Rom0jdaSA2YIc0ZQ6d+R1/ijZVBYIbfJp+oelTXtu/9q6YCHLS+vtLryZaASxQqtuc5iVX0HNDChZEu1Ks2kIOr33A+WOJ+JKReLipZnIVO8zEMh0nUqhZzjV8wOSqdFhxmLnr0/UUeDTtfj5rSkeDNmQ7UtOtfdN5zOJ+mBJas= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764288292; c=relaxed/simple; bh=lJ/SOLXNmunoo+NUR3+6KmbIhabOxphiqh718CR/9a0=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=JyExjDwz0SrfYfrV9x7BhQrpRnJmAlPpkR2qAx7sy8Xupexzqhm+B08Cejsghpepgbym3wIDJzi7aDofjJF9CILNRE0IUyCbdPEj/RGAbFhd76df0F/9AvI5JbgwPL+ccOIkCaPvW/sk0iewycluumJwY8F+cvIsRzbQXNAblWM= 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=a8YNoL+S; arc=none smtp.client-ip=209.85.219.42 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="a8YNoL+S" Received: by mail-qv1-f42.google.com with SMTP id 6a1803df08f44-88246676008so13865526d6.3 for ; Thu, 27 Nov 2025 16:04:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; t=1764288289; x=1764893089; 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=/u3DqDofTkBTZ7opR1QZKZ+L0ZpwVhBlcL/5S5ynAh4=; b=a8YNoL+SEeh2QjhPLTm3xjseoUYnbws0ox0Wyy+DtOBoTM13vQrudpU/YSRjZlz8Rb GieEZ8s+0009W48Iuf5a4OSryR2+2PivFBtGsc4fF2KEpIKSTlSIayP4uhubV8cj2r+m QPIyxlSml/7H+mngMJwxD6tgf0fItEOZ4ndCp90yEofUZGDbif6pVd3tekpl1X9hiw8p YwoUiifSDaSTVT4CLlUUyUYQt51Azi6lGsvFAcnZMSq6ZkDu5YdJNSYk6IV3xe77WRON kdoJN3uWg5X4Na7iAZCO5FquZBDMNXcrnEf5smZNVrMhU4A47vDSbUj1lnmTNmVChI48 B8JQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764288289; x=1764893089; 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=/u3DqDofTkBTZ7opR1QZKZ+L0ZpwVhBlcL/5S5ynAh4=; b=EZZmJmegPRu2bm/ssn+uTvMyTMwxgQSKqDUevPKSAvrm5jcvI3GU3cTup4M8t+2pAs G7bIJP2i63C8B9GMn1mjV9rNEkYGk/epAHfljVmT/4ITIl2+2fK4LlNWPAGta49ugA4b xSEVZ8jN67x04gzdf8sgBJki70U1oxKweZsR9YUhXE5oioBzNFHs0A5IcYxcRBXybhCh 8kgxnPtQd/L1ywynTfJvFiJDG1koHRghPZlOal5BVI2YWcrSWARLViglTJje2KKrPDm8 G5h4AFWDL1bfOg8v5AvB5iGq8OEbRc6wtrGuhLIDW+6cSEqNfQFBEeVInkZtbameRYBh b6Dw== X-Gm-Message-State: AOJu0YykBNLIj56t/wtgaPqa3j7OoB1XvjmFLZ8lpNGZhNQyl9L7kGYX 5MWkbKkgQ/H3xABWozSieyGSjPN+M7AGY5RJxaxRvgzu6eKZW94xyTMCS0s1G1TSZ565OqpHoaA kp24R X-Gm-Gg: ASbGnctWuc2fu/kn4w/du/C56GfEcgfJjjVZCa6Kn+Sf1M5f24C8+Lh92Iq5kGqPw2e keKRpF+8Q4vwL7GrXbHIKc4I8pkOUQQ9aTvlo9SVv7YMkLMsG/EdhIBFEG7F70BrqKuYtT7cnoq E4kCGbzqEZ0cKDBs38W/r7KshlCABiOYj2KF6hC8St8sajiG/eKCFXf81L6Ucs/LpM5uqY8FM4t lw7t0/jDQvI6EBWbDrrPXIoE9zEZij/50IvQ0eTQ1KsSv9A0KaDPkv0Bc3+cudFV6M5BurI/Zcv ml5NZDWFaHZ0oVlm/6LnnP//N5UDGPIE004R95+2tQJaZgwlnLqHNs0G1NEeB0W8zd8ZxU96Tzg 0SpkV5FX+P1NuzyahkCEfUQ4eVLrvG6iLAkyrhJ3Z/Ptmvo5U4YgtEdl6ogPhtM+nFKnjGobqoC vV1O1hKH3lyAaclYWYRrIo1+zxpeOhBxXhyBCK+kSJGErMXxxejps87JaC X-Google-Smtp-Source: AGHT+IEfcazVHExAeTNppaKhwVlOAuAKEvSGwm0KC8LB5++/v6kqKyav/EoBpEfeLnkmGsUutQRkzQ== X-Received: by 2002:a05:6214:202d:b0:882:762c:6b7a with SMTP id 6a1803df08f44-8847c544e00mr360991956d6.43.1764288289501; Thu, 27 Nov 2025 16:04:49 -0800 (PST) Received: from ziepe.ca (hlfxns017vw-47-55-120-4.dhcp-dynamic.fibreop.ns.bellaliant.net. [47.55.120.4]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-886524e5cfcsm18939956d6.19.2025.11.27.16.04.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Nov 2025 16:04:48 -0800 (PST) Received: from jgg by wakko with local (Exim 4.97) (envelope-from ) id 1vOlyi-00000003IrO-08PY; Thu, 27 Nov 2025 20:04:48 -0400 Date: Thu, 27 Nov 2025 20:04:48 -0400 From: Jason Gunthorpe To: Calvin Owens Cc: linux-kernel@vger.kernel.org, iommu@lists.linux.dev, Lu Baolu , Nicolin Chen , Joerg Roedel , Will Deacon , David Woodhouse , Robin Murphy Subject: Re: [PATCH next] iommu/vt-d: Use shallowest supported table depth in sagaw Message-ID: <20251128000448.GD738503@ziepe.ca> References: <8f257d2651eb8a4358fcbd47b0145002e5f1d638.1764237717.git.calvin@wbinvd.org> <20251127183210.GC738503@ziepe.ca> 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 Thu, Nov 27, 2025 at 12:39:39PM -0800, Calvin Owens wrote: > On Thursday 11/27 at 14:32 -0400, Jason Gunthorpe wrote: > > On Thu, Nov 27, 2025 at 09:06:35AM -0800, Calvin Owens wrote: > > > The failing condition in paging_domain_compatible_second_stage() is: > > > > > > /* Page table level is supported. */ > > > if (!(cap_sagaw(iommu->cap) & BIT(pt_info.aw))) > > > return -EINVAL; > > > > > > This happens because, for many domains on this machine, MGAW=39 but > > > SAGAW=0x04: that claims a 39-bit maximum address width, but also claims > > > to only support 48-bit/4-level paging, which seems odd. > > > > This logic was intended to deal with this: > > > > static int compute_vasz_lg2_ss(struct intel_iommu *iommu) > > { > > unsigned int sagaw = cap_sagaw(iommu->cap); > > unsigned int mgaw = cap_mgaw(iommu->cap); > > > > /* > > * Find the largest table size that both the mgaw and sagaw support. > > * This sets both the number of table levels and the valid range of > > * IOVA. > > */ > > if (mgaw >= 48 && (sagaw & BIT(3))) > > return min(57, mgaw); > > else if (mgaw >= 39 && (sagaw & BIT(2))) > > return min(48, mgaw); > > else if (mgaw >= 30 && (sagaw & BIT(1))) > > return min(39, mgaw); > > > > Though it is not right.. > > > > I didn't consider that this would come up, the only way to solve it is > > to pass in more information so the tree can be higher than the vasz > > requires.. > > > > Can you try these two commits? > > > > https://github.com/jgunthorpe/linux/commits/iommu_pt_vtd/ > > That works on the Skylake machine. If you want it: > > Tested-by: Calvin Owens Thanks!! Jason