From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pf1-f172.google.com (mail-pf1-f172.google.com [209.85.210.172]) (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 00ECC304BCA for ; Thu, 27 Nov 2025 20:39:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764275984; cv=none; b=Xfs4T31y/tZ580xRov9RZ/fzPTAgh7phZtrRW/kiJRPHh4Qx6QhQhjyysT+7/7UeJAt0Shfd6IhvJVfjGjRS5p1ISBr2+8ElVxOjxIYVAHDfUG6m5du4Om3T/09FdcwjuWxe6HD45IGiE/GZPXQPPogTqeIHog4bIYaZhe5XYNw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764275984; c=relaxed/simple; bh=tvodW7JRvcfiQ+2b1TbMwMXmlYGjYL2Yk/oD6Ttl48o=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=SmNTgAOlro+PyJQRCnMWyfuXYLJgfw7SNQaHMKSNSsLEGRjyuW3UB0RWetfqUMiVAlMDAs/a1sEDgEOfET9vNzsWnsKtkcx50Q/sWg5bkmoHBBLKq40KUmKHtVs3hW2s8TbAFFU4CE6AoN7VCddD3/i5mpFU3v1HcAXaGZe8dn8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=wbinvd.org; spf=pass smtp.mailfrom=wbinvd.org; dkim=pass (2048-bit key) header.d=wbinvd.org header.i=@wbinvd.org header.b=cVrANydd; arc=none smtp.client-ip=209.85.210.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=wbinvd.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=wbinvd.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=wbinvd.org header.i=@wbinvd.org header.b="cVrANydd" Received: by mail-pf1-f172.google.com with SMTP id d2e1a72fcca58-7bb3092e4d7so1210704b3a.0 for ; Thu, 27 Nov 2025 12:39:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wbinvd.org; s=wbinvd; t=1764275982; x=1764880782; 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=4f4zeb8l9u5i+aR98BJaZX6AUgu69rdxc6FAslyPRtU=; b=cVrANydddAp75yYhPEt9Tx8rubkSToRUDKRn/ONijxvhjR0EVIH5ZQUhJhjNPDCIIZ vON58tFQMDqnFtyTNjS7YxpLbS+eGMVQpDcSpQ12nSZP+iSD4CxLc91ggsu7YH0lmsTD 1GJhoiy779A1xDLOAihCAoaB2iLd90wmU+gOgaz90wk80rTYEV5sCuK9Y1ZiLN0WCmKx tGh+bbF0Besz80tn24SKCiB4Yzu+vqWXtHvrLfUY/pUQm0fw8PvpJeIwoKW6yAQ7B6zc ucJGzOAM9bmFtXNaoOizwCO7T7F6GJ0xjZ6bCROfwJYsG+H8X5RLjnBZsEIeSdRoqpPk 4Llg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764275982; x=1764880782; 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=4f4zeb8l9u5i+aR98BJaZX6AUgu69rdxc6FAslyPRtU=; b=Mry1DrP2VBRXXMCf6/Z/9VX4gb5BZOABlsAetfHHDoFI94Q4KlXoZwEVmzxNcWbgkR ZhdHSYp7BDl6fdj8LBJSWBgS/qy72Xxk55xBOPE3C6ZPuBpMfW9le50Ww0LSqiqkdKKC 3gwKe5zZw6+XXTatLSwjcd8aM+s5M0bWSOE5HnsE/1btHiwKi2webv/i1EuPItd4W7LS wdtmLGSR5LqNYXNVmBott7/wnkchejHLwu9xzjaV0SXnCAL4xElzKsVKXgyeUI7PbW4Q EGMtYgaRQhoC07HDgYoQEdWUpUYGzjikp4XsWTqxxP8fLUPMLV2Fd2bZlevrUkOzNpyM g7OQ== X-Gm-Message-State: AOJu0YzHFYV7BN2dzwzRaAN/2+PCzFmaxyBvvGaX0o8kQGTt2MQwlA52 kM6agEuZQWY4gvMuNKYjcG31mD4gaQwsJ1dKi+NLEHBsP8Dw/ePwT7MBOtNhXkf45Cs= X-Gm-Gg: ASbGncsvyJlFYJU1fzRIUzn1IVi9+aCVFPCfDRuDfpB1tMBshirU513CR5o4xjHKgCW xC9h/+HKI7EELvVajj1SrzO90YVOlieTowY5tTM1D9e/xk600m/lBaUrY2AqsLwyP4iVRqhQsg7 ab14C3npiMf1C0xw85/aoQt+sUmOFXOruuMWFS1qiWHpggqIxewt9Ueb5cdIpc6+CpA4EbGuQ7v 5pdEujNunaIHTyKJQpO+oZElKbdK4Eqg0tpEKCkqnr7Mo7yRSecO1wLeOrKA+8YVBwyQWghR0G7 MlTFotl4FsUZRO5Tb1GjM5Exqe3Kks8lZS6Y9rVNR14eh5nrf3I5KFNtSbFLADGquH9vdUHOM38 0cZ+Jweww1ZfYXbn+yNcOTti8LCofr6hShjaWax0ZPYCpgmw5qcLoqBlqA550BzpQTeRE6IZzZi AiXaEOrGkWsyv5 X-Google-Smtp-Source: AGHT+IGQb0w4AY9IxnlagBk5k4aSVNLwiqHrKrAOKZAF+LOvj3KhlnhsUyJNm2KfzNYdC67lMSerlA== X-Received: by 2002:a05:6a00:23d5:b0:7ad:9e8a:1f72 with SMTP id d2e1a72fcca58-7c58c7a7601mr28835992b3a.14.1764275982249; Thu, 27 Nov 2025 12:39:42 -0800 (PST) Received: from mozart.vkv.me ([192.184.167.117]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7d1520a48b2sm2766991b3a.28.2025.11.27.12.39.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Nov 2025 12:39:41 -0800 (PST) Date: Thu, 27 Nov 2025 12:39:39 -0800 From: Calvin Owens To: Jason Gunthorpe 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: 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=utf-8 Content-Disposition: inline In-Reply-To: <20251127183210.GC738503@ziepe.ca> 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, Calvin > Thanks, > Jason