Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp616084pxb; Wed, 27 Jan 2021 16:54:18 -0800 (PST) X-Google-Smtp-Source: ABdhPJxakaN7KjuYgKC1SV8gnc5e54AoAfRKhbF8W2NMKXK8JqIaNqQnwHQB35NIIp4GYYw6fhWd X-Received: by 2002:a17:907:9604:: with SMTP id gb4mr9265146ejc.474.1611795258389; Wed, 27 Jan 2021 16:54:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611795258; cv=none; d=google.com; s=arc-20160816; b=HW91xem8SMjXCJIA5SXa6MuNlxZgr3FnkXWrkaUF8vTVdux589oQzfY+a6c8JEyIkL szx+faTuwJvWvhl+JC6803mRprJ+C4jNeC4XQ6+ze+Yt1Rh/B2iU+yLSR8X9b5YFTC4w BdbuWBq4oxMh/Qh2jRz4cXiMfpIU3EHI6jSkFjknGdvk4CBHGKziq19/rAaGdSH1cTAU 0Q94guagfWZFPTedVEeBdIIt3GcdGXjrt1dQ/pB6my53eQt05bszXMJkhBpwxNLIHSWD LKxxQ8M/BVwFgKv4/SiNdbKwehWOGBvYON9SkDOsgUCPjqfeOtfLA9w/wRqj0FUAcu+O 4jCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:from:subject:mime-version:message-id:date :sender:dkim-signature; bh=jmVH+B5byuoeCWBByF+rlgs1IXxlR3I67Dpk6zRz3g4=; b=Uz/r72liTodvPR0ZeMrBLLtH1HKDdiveM0M4Gb1nL4eGMRlaSXjcNK95gEMeybhCAm mZw2A1PcvUaQjodJpBZu7Xt0/gvoli4olbSoGjSwHO4uDLWBDlBP5CaLQSCdbAwGkf7p yPQGH15UK30p58uLXtE1hE/cXBRvYonZ1USzYQiBpjjOJlIRRJdTgskOeaXI3CJQN1vv 2cA5cn5K/s3UA3J2vVvMhljBoRF6vFMXrd/CA0Vm/Wx3kER76xPi1oimWD7th2psDVYE KZaxUbDmVNhlV+Z+h2xyVv8Iygz9WGmy/n80e9ut4iAJUoE0zU3qSQY5M0+8404pS/Uf 6USw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=ika8x4rg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s10si1756003edd.231.2021.01.27.16.53.54; Wed, 27 Jan 2021 16:54:18 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=ika8x4rg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231774AbhA1Ak7 (ORCPT + 99 others); Wed, 27 Jan 2021 19:40:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34556 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231618AbhA1AjY (ORCPT ); Wed, 27 Jan 2021 19:39:24 -0500 Received: from mail-pf1-x44a.google.com (mail-pf1-x44a.google.com [IPv6:2607:f8b0:4864:20::44a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A00EEC061574 for ; Wed, 27 Jan 2021 16:38:42 -0800 (PST) Received: by mail-pf1-x44a.google.com with SMTP id l17so2374791pff.17 for ; Wed, 27 Jan 2021 16:38:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:date:message-id:mime-version:subject:from:to; bh=jmVH+B5byuoeCWBByF+rlgs1IXxlR3I67Dpk6zRz3g4=; b=ika8x4rgJdL4GFh0YJshUwWatHQjTXQ6jtilrMjzjB5sX9mt0EINzDY8IG5gykxg+V gtt0xZreieN+Cl9Zk4vH0z+L75qd0s7an5EkYb64eAua3UBdHun+3RuVtNay74rRmljF w5FPFyJlgdiwd0MdSbvafLRju/MC00+cfc/WbLCEtHZUfpqz6G5N0GL3pImWJyq728PK YpGO0gtXK2jnCNQoOP//2fEhqOtPi8l/Kif+ts7PTih+MaXF9ASUVT2b7QL1viThPJSu nBl/vQz8MYZ+b63p0HxtEj+3y1yHtHp8vbQsXi2xfJj8uwDwMO5ETL38SDXURD71ibF7 ChIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:message-id:mime-version:subject:from :to; bh=jmVH+B5byuoeCWBByF+rlgs1IXxlR3I67Dpk6zRz3g4=; b=hcBBdjZtIPH/NpZaOz+DRDGBGD7FOqVpwk3PbiOQaKkF8+U3IYOkPEF+H0/KJB12VM 5r1zNuryAblj8Nmc00DbqrjUGfz9OwqrdoZoYwmfTV2kdJFi5fJDrxgidfD/paNMvSFt dlY4QFNrOE7cT99W8DN3gLO6/N7Fn4s0XW27d9RAxUHkyBHZoMNfMISjwZEb5sveh6KJ f2Rd7yXkbN+He1dDGN+vIpNM0UoFob51ug4ruY57QOqCqvxOZeh2fRnogL2ZC6Yf4zq/ byZRaYmJOT0D7VCH//PNZbQHyDBh9woUgHPK1PEopYzLEojdGBJzK99+Aq8QU4J82Zow ZwBw== X-Gm-Message-State: AOAM5306X9aq583PpNr6c2HZ67aHJ2ZWz++x+k42/uqu6i4SR6WUxe9E L8hEVRr/VRZtG5LL71C+CuAcuvdumw== Sender: "jxgao via sendgmr" X-Received: from jxgao.kir.corp.google.com ([2620:0:1008:11:4d90:620d:7a68:ffc5]) (user=jxgao job=sendgmr) by 2002:a17:902:67:b029:de:c5e0:87ca with SMTP id 94-20020a1709020067b02900dec5e087camr13986024pla.64.1611794321730; Wed, 27 Jan 2021 16:38:41 -0800 (PST) Date: Wed, 27 Jan 2021 16:38:26 -0800 Message-Id: <20210128003829.1892018-1-jxgao@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.30.0.280.ga3ce27912f-goog Subject: [PATCH 0/3] Adding offset keeping option when mapping data via SWIOTLB.* From: Jianxiong Gao To: jxgao@google.com, erdemaktas@google.com, marcorr@google.com, hch@lst.de, m.szyprowski@samsung.com, robin.murphy@arm.com, gregkh@linuxfoundation.org, saravanak@google.com, heikki.krogerus@linux.intel.com, rafael.j.wysocki@intel.com, andriy.shevchenko@linux.intel.com, dan.j.williams@intel.com, bgolaszewski@baylibre.com, jroedel@suse.de, iommu@lists.linux-foundation.org, konrad.wilk@oracle.com, kbusch@kernel.org, axboe@fb.com, sagi@grimberg.me, linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org NVMe driver and other applications may depend on the data offset to operate correctly. Currently when unaligned data is mapped via SWIOTLB, the data is mapped as slab aligned with the SWIOTLB. This patch adds an option to make sure the mapped data preserves its offset of the orginal addrss. Without the patch when creating xfs formatted disk on NVMe backends, with swiotlb=force in kernel boot option, creates the following error: meta-data=/dev/nvme2n1 isize=512 agcount=4, agsize=131072 blks = sectsz=512 attr=2, projid32bit=1 = crc=1 finobt=1, sparse=0, rmapbt=0, refl ink=0 data = bsize=4096 blocks=524288, imaxpct=25 = sunit=0 swidth=0 blks naming =version 2 bsize=4096 ascii-ci=0 ftype=1 log =internal log bsize=4096 blocks=2560, version=2 = sectsz=512 sunit=0 blks, lazy-count=1 realtime =none extsz=4096 blocks=0, rtextents=0 mkfs.xfs: pwrite failed: Input/output error Jianxiong Gao (3): Adding page_offset_mask to device_dma_parameters Add swiotlb offset preserving mapping when dma_dma_parameters->page_offset_mask is non zero. Adding device_dma_parameters->offset_preserve_mask to NVMe driver. drivers/nvme/host/pci.c | 4 ++++ include/linux/device.h | 1 + include/linux/dma-mapping.h | 17 +++++++++++++++++ kernel/dma/swiotlb.c | 16 +++++++++++++++- 4 files changed, 37 insertions(+), 1 deletion(-) -- 2.27.0