Received: by 2002:a05:7412:2a91:b0:fc:a2b0:25d7 with SMTP id u17csp233161rdh; Tue, 13 Feb 2024 15:31:33 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXIsg3qmqkFn+S1DhldrIcP1W26Uco5eS/kvddTBcDVVXVaimG3yHvmeIfb9N7ryGRFGd5tBG1Tckgf23E7YUPzXBMQy38spNG954keHw== X-Google-Smtp-Source: AGHT+IEibUiTTk2BB1qDMT+whc68jd4CFwZyTDsCTdJZxtYLhE1A8o4haLBIMscbJA64T+ESeg2G X-Received: by 2002:ac2:5589:0:b0:511:2e97:add2 with SMTP id v9-20020ac25589000000b005112e97add2mr627066lfg.66.1707867093293; Tue, 13 Feb 2024 15:31:33 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707867093; cv=pass; d=google.com; s=arc-20160816; b=PSp/+84YEaYYF5HQADPw90GsuLvr810G/ePxyDsxFUpyxfF/a8ZpP9XeISFud608g/ t1xUOQuV5rjR3SF1b5h3lSCucmpXArZqo1tC2FvvvKKIYm9F7PWlNZNurB/M2P4HItt5 Rg9xeBqEMKMp02l2Z0/VQbodpLqElvDGwfA7QpbwasghEKkvXpVdEp0Z9Uzjmf9ChhND /KEDR0Rur4h0Hzq9nA3iJg14xvQ+ET1Jnw4F58JYv63yUzrITXOsrxOXd7TjVcON19+s zuZnZJ0++LxvsKBQn0GbRpgfUleV5qiOdwJSB0HbUq+iF1akgrwudSZ658KwISnlBplp yanA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=Al0q0uimyLX0AHAwflhCX/ownoDnvBB+e7WXRUT8iRY=; fh=QxmM5e4p6fAdQukMNYzwEL/cdAgEPYsH+Nym9G4kX3Y=; b=gIgF8kI/3WQUJVfJVJq0yxhheckJlAedqycGzQjxS9IjLdqhAjON566vxaNtGopq4B uN7/0Q7FI9Eh9v7GWTXfgFopPWZKOXT7JxIVe4+ko0ioJa+Pkj13v/ka4u0PLgyPn6aN wH5xobDDQdJxpiDPL4lSbm5KetJqbxPmOlVaNh/TFm/Lhnr2idIO+oX2bpXXAzk9xt3C uOm28p803KlYvK4DcX0G7USBCVdB7YAn3vPGjm/aNVNJpOObeV7fyB+EktJBKWEAidPE zi26Mof86101f25PWI8FCc+ryCpSTt/QhuzkyUFYRqezNc/ZOFcB8LS+o/ygJ4Hfti+q +oVw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=s9YUNyUn; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-64544-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-64544-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Forwarded-Encrypted: i=2; AJvYcCVl1NHiWK6RXMx21JnJOajkupP/yXmUPl+6SEjYF9J5S3xzYd2wR7rWXkbCboGHU/eF4DIYC9+idC6USgsvRVBqnPNdNiBB3BItnuJ5/Q== Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id s21-20020a170906bc5500b00a3d3307b52fsi243833ejv.279.2024.02.13.15.31.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Feb 2024 15:31:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-64544-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=s9YUNyUn; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-64544-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-64544-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id A3CBD1F241FF for ; Tue, 13 Feb 2024 23:31:15 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 58E2C6310B; Tue, 13 Feb 2024 23:31:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="s9YUNyUn" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 71B0F63103; Tue, 13 Feb 2024 23:31:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707867068; cv=none; b=R9S181TncO7Qcb1wlNx95ZIqsQy3UjepynCU2leFSr0KYpZN7SYRMUPMamTQ300yRfl/g2DxQl0qBFARrTwX2Izw6IJL1cj4RjogCZSLBUGiC+6CDkG2+olOZ7wrZdFhwEKaha7gFjev+IR7m5v+n5gJEkS0DeRgmbF3v2HuXMo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707867068; c=relaxed/simple; bh=+1XO1udNmWXaAaAH+rF9p1f8AZwXVEeDmta7ROf/3XY=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=kjg6hqPFSYT96uIk7sPosAuqJp1ZGs7ygk2b1NLKLJJ9H/lFWsL9AysQ3zdySposUhprfd+2Fk5XwwmalX4ZbeIo3g6arTUa2HIY4a+kDpfbBy3qcLBAnc6pT+Le3qUeWpLUJSPhhEPQxCnKy4t32DVUIkWih5EfETRSMP86jk0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=s9YUNyUn; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id CC4B0C433C7; Tue, 13 Feb 2024 23:31:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1707867068; bh=+1XO1udNmWXaAaAH+rF9p1f8AZwXVEeDmta7ROf/3XY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=s9YUNyUn0t7j5CNHgYBkSAnYHa0C6gVdTD9py7ZxdxGyeK94mU494TH7GrLxx2swf gTg+oaApSBgHuPbZ3VQVQ2fJwsGShy/HHQD8LGP/dy4NdeVnuRwY3X18ntO8FIuJ3L sOAh3UAefrnDqRzqD0z3kZNtZpOrFUjv4k+0i4jkdSi97N/lceDsj7Z2h2ECR0wLQ9 9kyJRk81RrB5Wtxm8qVAxGiqYYCrz5WspPCBZp8RhTcCeR5D5y1PiqSgPj50z5pRvQ 3VNuJHmd0KXNJyID1bcgSGNftoRjUkrMPcyBrZ09dxUJDXgvny61k2fTM5z751JJGy eEietQT1NiWtA== Date: Tue, 13 Feb 2024 16:31:04 -0700 From: Keith Busch To: Nicolin Chen Cc: sagi@grimberg.me, hch@lst.de, axboe@kernel.dk, will@kernel.org, joro@8bytes.org, robin.murphy@arm.com, jgg@nvidia.com, linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org, iommu@lists.linux.dev, murphyt7@tcd.ie, baolu.lu@linux.intel.com Subject: Re: [PATCH v1 2/2] nvme-pci: Fix iommu map (via swiotlb) failures when PAGE_SIZE=64KB Message-ID: References: <60bdcc29a2bcf12c6ab95cf0ea480d67c41c51e7.1707851466.git.nicolinc@nvidia.com> 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: <60bdcc29a2bcf12c6ab95cf0ea480d67c41c51e7.1707851466.git.nicolinc@nvidia.com> On Tue, Feb 13, 2024 at 01:53:57PM -0800, Nicolin Chen wrote: > @@ -2967,7 +2967,7 @@ static struct nvme_dev *nvme_pci_alloc_dev(struct pci_dev *pdev, > dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(48)); > else > dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)); > - dma_set_min_align_mask(&pdev->dev, NVME_CTRL_PAGE_SIZE - 1); > + dma_set_min_align_mask(&pdev->dev, PAGE_SIZE - 1); > dma_set_max_seg_size(&pdev->dev, 0xffffffff); I recall we had to do this for POWER because they have 64k pages, but page aligned addresses IOMMU map to 4k, so we needed to allow the lower dma alignment to efficiently use it.