From nobody Tue Sep 29 10:29:01 2026 Received: from mail-pj1-f43.google.com (mail-pj1-f43.google.com [209.85.216.43]) (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 B2570388868 for ; Sun, 9 Aug 2026 03:28:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786246099; cv=none; b=ragICmn5+u21TJYG/ztOfqZHp9GxGrD7+jDKTrz/vA27VKDvkQohZaYQdorZBLQMyzAQeEKmfDa1Pca5IfTeceBfkBDrNXrk04BMfQAifTu4s0cmgtss4dk32KHnQ6PfEUscbAOOilfTfCfZpdL7IB10O0wzRDGU+bpnjYfNlEQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786246099; c=relaxed/simple; bh=EUTWRYIkv/eb/Z386B6IxzwAsVtI3sCcs16queTkXnw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=NeLBKS4/3MiwgzJpWe+ol2FJ46fWw2FbchwWd1a445MX5SEH+ZDt1vVgIdbjIifKqrpVy59Q4j4oL4THR1GZ1Ee2i6NtDP8kqaCVxasOX6hKoS/gICo1h2DhZ6NrBhavbFOigxax78MO+w3o8OPWkajhzOOQl69t0OPovdCjETk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=GbHWXW4c; arc=none smtp.client-ip=209.85.216.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="GbHWXW4c" Received: by mail-pj1-f43.google.com with SMTP id 98e67ed59e1d1-38125cebfdaso1008465a91.1 for ; Sat, 08 Aug 2026 20:28:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1786246097; x=1786850897; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=htQ3Nh4NK5zZ2RbZHHLwjMu5TBvqvLaS/zwT9S8pras=; b=GbHWXW4cTdlH2njj7u9Tb3WW8C+pb4FRQC8QmMTUxgtuj7gaIXBKrnAKn63gMe0VYU 0JMnUmXmpJCZiu71/Nj1flwexmGsZ6itwDXVIqcUgAuSM4GGHjc1vkKo5fHQLIGhWzlF qLQtE5cBso1qJAbmuUs4M9mF7GhElH1fZVdEHQpZmUrAdVcePXvvLq+LlDM66SpEiViC x8PzPWe1Z2Bm0WzgOomLJXoURsgUCJhY9lOiH6TxF/eYwrU1ZyTcCNJbJ8HIGSvGXp4X eYzFjtdD2SIsMdFXQxKomzisonq+Zckty/rpwBkmY/0SDEPWU76VnK0rR4L8KskA+yD7 BT/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786246097; x=1786850897; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=htQ3Nh4NK5zZ2RbZHHLwjMu5TBvqvLaS/zwT9S8pras=; b=EnNOPIg4FdaIqJBQ6TivjXHziRfIjRDLUiR/56DAmeU3VtdozYEWATQxinLEDnZ7LV jdVurx1/7Kq3Men+fKlf1aXRlKCJRQeZ3hf1p1mVLudz1GAcLhVyM6+T2iDF7VCJr1oE NeUztFoByCzdMLVbOmKh3s5/fgs2d7dR4gCYyjaDG71l/z8uw3IMeLCzLYk2t9oBLN7B vnYxmHSADD525FjTXWKPW8rJCvQ6DvL+M55IaIbSl1h2yFV3KlwGgnLOp1Pjjo0CZK3j 7QEL1JGGs3O+c8r1p1q4n3oAU464NKVND5ZLSayLu7hvXUzdvIL/IfST2aL/DYoLdzn9 F8vA== X-Forwarded-Encrypted: i=1; AHgh+RpNCxOPuyM7wGvVzCtdMbuJ43P1BDp89Xmms+iE8Y0zdvIakmMzgRb/idA75u80gkRRrKfOqK4e2NpzWoQ=@vger.kernel.org X-Gm-Message-State: AOJu0YzQ0YtEOqe6Ie6qRbtahpmUvniOzFksDLoClI1EAwo6A0IgsEg/ 0RUwBvP/ysoaipV5hWqSFrMj6iIn8BnMxQr42qnH6yBHLJYUI46WJnxP X-Gm-Gg: AR+sD10q/MwkEpmvax6dqzmmiR44vVzW3ZiVTkaPgFRnwduUWftzScsaLKyC52uihPV VXGxQ4pTI4xbUW9yPtuDUk0/NhBUFJBXTa5kffmZOx7D9wUWs5yJCKQyKC9Yj7gMuIwB2Sp3tZ9 pU/UGo57ndJ8JMPRLSyJm5nACTy4RFWPOBIwVZKa9dLbRzEox7jJVGkAAba7J+Kfu3gaBOrgsXY 5WRMj9DO7JZwba6dyeFw1vW2n0Zesq3jEriApYgLq267Ppj+O0BOimJZWDGo5lP1sQ05raYuL+L JqvzctXMhuorAJ3VjzdRWVPrXM+ucDnVyVxeSLoFtFE80lUZG+KqZO2WnVkI/dbe4xa8Oq6Nd8/ c49owJ91a0Ben+j9CIuO8oWNsmghNaBCtlSptGRNl5f77URSPzsonF5AZa83nGjoGpgL5LsCZN1 0phixILH1SoY8y9gyJB457fTK18pUGURjef1EvGDeWM9+M5AYtuOv4/HnIx16ZjvlgWCBGs64LB KLzy80tmwCmvBJJsMcfYi5zjHegbIEbp4SORyCBE4u4475Gl36YeNowRgcGmbLxyKo4aSdHkA== X-Received: by 2002:a17:90b:2545:b0:38e:49c0:75a7 with SMTP id 98e67ed59e1d1-39261feb6a2mr16196173a91.8.1786246096980; Sat, 08 Aug 2026 20:28:16 -0700 (PDT) Received: from homelab1-WRX80-Creator.localdomain (p790255fa.sitmnt01.ap.so-net.ne.jp. [121.2.85.250]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-3926254ee45sm7587626a91.2.2026.08.08.20.28.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 08 Aug 2026 20:28:16 -0700 (PDT) From: Shuhei Takeshita To: dennis.dalessandro@cornelisnetworks.com, jgg@ziepe.ca, leon@kernel.org Cc: linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org, dean.luick@cornelisnetworks.com, Shuhei Takeshita , stable@vger.kernel.org Subject: [PATCH 1/2] IB/hfi1: Resolve the credit-return buffer through the send context's node Date: Sun, 9 Aug 2026 12:27:42 +0900 Message-ID: <20260809032743.2671579-2-jyohuku.alterego@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260809032743.2671579-1-jyohuku.alterego@gmail.com> References: <20260809032743.2671579-1-jyohuku.alterego@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" hfi1_file_mmap()'s PIO_CRED case derives this context's credit-return page offset, and the DMA handle for it, from dd->cr_base[uctxt->numa_id]. uctxt->numa_id is the node of whichever CPU the process happened to be running on, but the entry itself lives in the credit-return allocation of the send context's own node: sc->hw_free =3D &sc->dd->cr_base[sc->node].va[gc].cr[index]; and user send contexts are allocated with sc_alloc(dd, SC_USER, ..., dd->node), the HFI-local node. On a multi-socket host with the process running off that node the two allocations differ, so the subtraction produces an offset into an unrelated buffer and the DMA handle belongs to the wrong allocation. Use the send context's own node for all three references. The continuation lines are reindented at the same time; they mixed spaces and tabs. Fixes: 7724105686e7 ("IB/hfi1: add driver files") Cc: stable@vger.kernel.org Signed-off-by: Shuhei Takeshita --- drivers/infiniband/hw/hfi1/file_ops.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/infiniband/hw/hfi1/file_ops.c b/drivers/infiniband/hw/= hfi1/file_ops.c index 56031becb..e05f3c255 100644 --- a/drivers/infiniband/hw/hfi1/file_ops.c +++ b/drivers/infiniband/hw/hfi1/file_ops.c @@ -382,10 +382,10 @@ static int hfi1_file_mmap(struct file *fp, struct vm_= area_struct *vma) * of enabled contexts > 64 and 128 respectively). */ cr_page_offset =3D ((u64)uctxt->sc->hw_free - - (u64)dd->cr_base[uctxt->numa_id].va) & - PAGE_MASK; - memvirt =3D dd->cr_base[uctxt->numa_id].va + cr_page_offset; - memdma =3D dd->cr_base[uctxt->numa_id].dma + cr_page_offset; + (u64)dd->cr_base[uctxt->sc->node].va) & + PAGE_MASK; + memvirt =3D dd->cr_base[uctxt->sc->node].va + cr_page_offset; + memdma =3D dd->cr_base[uctxt->sc->node].dma + cr_page_offset; memlen =3D PAGE_SIZE; flags &=3D ~VM_MAYWRITE; flags |=3D VM_DONTCOPY | VM_DONTEXPAND; --=20 2.43.0 From nobody Tue Sep 29 10:29:01 2026 Received: from mail-pl1-f176.google.com (mail-pl1-f176.google.com [209.85.214.176]) (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 B029037DE8B for ; Sun, 9 Aug 2026 03:28:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.176 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786246101; cv=none; b=GkXnZJNBAjHw0+0HrWLCF4WxYYuJPyLLPVXKGYdC6gmu6J6gugj6fayAvktzYAqhYqA6fE53d0vQSHskLSHGLes6HnPS7rfrUIKz0qepk9cjQMaRRAiMNpOkvOxmLgQ2e/1TGgTRcBr7jjbnkXDmSQwofs2/KLEhLCXWhWCkAmI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786246101; c=relaxed/simple; bh=m9jOM3JnwxnOHunHY32HFFU1VBtGt8WDJlIYoxsl8DA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=d43ma4zofeR8DXeuJBf3sEvvJcmLVIZkOij8ZbZ92zKjOilptG3kqvB4+XtLaNuS27zA6UUbgT8cOxKBt6LcakBbxEue59brJN5ZtdKM5SJJqEqR84qiv2S7Q6Di2HIuHNqUz6akqMit0OKKqTJ9zBqzIKPMX9BWEwQ6d+Peuu4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=duZPvk7f; arc=none smtp.client-ip=209.85.214.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="duZPvk7f" Received: by mail-pl1-f176.google.com with SMTP id d9443c01a7336-2cf52d15d88so5704625ad.2 for ; Sat, 08 Aug 2026 20:28:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1786246099; x=1786850899; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=JEHO0Y8VayIiQ9EQdeJUip1ZA/P378h7uR1P3EclUFk=; b=duZPvk7fFeqwS7cV+/NO9f6wfoJaOIz5JOzUS/4wuEPkjEYfQjpNW+lfEt3WFLnlGF L2emRLD+JjozGeg2WkViLcuHtMWDxurd17uYeDTh5eH02V8P/ld2MUvA00CmJROSGk/I EnNPZvhmSCOd8i47mIVIjYVG4Xcn2ozV6/UpxXWeSEKdxp3tbkhkFepoVVWzWMhpOV+x FC2g+sshV5W7O8TKj+AknH+YJiZUotjYWOHAbBDvOyDzcBoKdej/W7+qKU8wDY2tXc0R t320zCoIKrXkr/oTSghA5unej6tO3qyBu6Wx+fT84iCNfQ8GrxxYtS+lYBPHNrH3O+hn UDOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786246099; x=1786850899; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=JEHO0Y8VayIiQ9EQdeJUip1ZA/P378h7uR1P3EclUFk=; b=ba1uRzTpOqkREOn3n8TInYqo/yesfFWv476DQ9xS4Z8MR/TMCzvFdO6E+sL9lEaCVu 3VcYmgnuKANkw4+Ro/CPbAAxeADy/GBsD3WvCu51nVAI4aydq49zpeEOw0jFbwEDCSUl rb1epy6plE8qlX/qUfPxcR4AR4O43gl3n2IB+HOuudzr0ZFnLWhsDRqI2UpAechx8Oqj dMSFdBfzHyT/YtolnzG0TxheLQQ4TrCwm5+fbx6J51IKlQ54TjYxIwg0zvfQ7cOJA0vJ uVCU1WupO/ercOE3/D9ummi9fosdpWX8PQGbtwwqZOVyM2vOHrzrlXOdIprJPpdn/Z8F Yw6A== X-Forwarded-Encrypted: i=1; AHgh+Rp9cvfz+z8h84wvbLr6XGXiSD4OKHfqX7yNjO7+DrGfkLUa6OLHwsfND3qiOAqkb1mN0B4op2YZCnT4BHQ=@vger.kernel.org X-Gm-Message-State: AOJu0Yy43WJxix9blchD9gfm2vedwJudzKDy51Q6GI4CP5rS5YaSz66C YfqbsoQcd/Oaf7rjWARnX4zGg0Hy6nuPr61GOm4AinLLnko9H8PbVv2j X-Gm-Gg: AR+sD132Mux+SSaitOK6mmVyyW8uxp0O2n11ZlKN9ViQYghmXXIXCu9Iklv275TvhaV /UAY8TSpNKKFMe56RW7SsLKj/Oa5kSO6JPUy5MsamSyfySaFsfk2MCdhBgp2KHAQliE/CM9iNzZ UUZ3clQxuxD3ZnCVzK6r8hpUAto9kJyINvIjTvthemUHHA76NkLku/mRcfM0VWEs8sD394yTqkv 5FsRi898ae8X5TIAm4zFb87JHeFU1kRPjnwQIfKrR5zRYgxiOgP1ntOg5idgTI/2rjc4TjofNLp IoJfqy+C6ByU3EMRnF2ZDOmZj1i3+aRMJYNJ+d8rrVVdwInKyJguXVghJD4L6emVJThedZdX5BE uwVNz9K1D+fsgOslOXdTUyVcG0QZUubrg3Q/gM5EbANtzKp4QoqXHnObDDSs+ynkN1PelnQq7h5 36/3nEzpRZHhaD9KibZ7g3e6930IylhAWxzsgxwBdea92g+bKCw8lizriEy6QWGGHgGvp3NyO0r 1mqfBQOOVdxp2YdtJeyqCStfGTR8h+Bpn85KG0+fjaUXefLcDZ8rU81kWwUeRE= X-Received: by 2002:a17:90b:4c45:b0:38f:efed:5448 with SMTP id 98e67ed59e1d1-392822b7b78mr8987373a91.8.1786246098978; Sat, 08 Aug 2026 20:28:18 -0700 (PDT) Received: from homelab1-WRX80-Creator.localdomain (p790255fa.sitmnt01.ap.so-net.ne.jp. [121.2.85.250]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-3926254ee45sm7587626a91.2.2026.08.08.20.28.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 08 Aug 2026 20:28:18 -0700 (PDT) From: Shuhei Takeshita To: dennis.dalessandro@cornelisnetworks.com, jgg@ziepe.ca, leon@kernel.org Cc: linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org, dean.luick@cornelisnetworks.com, Shuhei Takeshita , stable@vger.kernel.org Subject: [PATCH 2/2] IB/hfi1: Fix the PIO_CRED credit-return mmap Date: Sun, 9 Aug 2026 12:27:43 +0900 Message-ID: <20260809032743.2671579-3-jyohuku.alterego@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260809032743.2671579-1-jyohuku.alterego@gmail.com> References: <20260809032743.2671579-1-jyohuku.alterego@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" hfi1_file_mmap()'s PIO_CRED case must hand user space the single credit-return page that holds this context's entry. That page is the second or third page of the per-node credit-return allocation once the hardware send context index reaches 64 or 128, so the failure below is intermittent: when the entry lands on the first page the offset is zero and everything works. Two things are wrong. First, cr_page_offset is a byte offset but .va is a struct credit_return *, so adding it is pointer arithmetic and scales the offset by sizeof(struct credit_return) =3D=3D 64. memvirt then lands 256 KiB or 512 KiB past a 10240-byte allocation. With an IOMMU translating, that address is inside the vmalloc range but in no vm_area, so dma_mmap_coherent() -> iommu_dma_mmap() finds no pages, vmalloc_to_pfn() returns page_to_pfn(NULL), and remap_pfn_range() installs a frame above MAXPHYADDR. The first user read then takes: psm2_ep_open_pr: Corrupted page table at address 7a14d007e000 PGD 800000013886a067 P4D 800000013886a067 PUD 13886b067 PMD 13886c067 PTE 800049168e911235 Oops: Bad pagetable: 000d [#1] SMP PTI Second, and still wrong once the arithmetic is corrected, dma_mmap_coherent() describes a whole coherent buffer and selects the page within it with vma->vm_pgoff. Offsetting cpu_addr has no effect: for a vmap'd allocation iommu_dma_mmap() uses cpu_addr only to locate the vm_area and then maps pages[vm_pgoff], which hfi1_file_mmap() has just set to 0. User space therefore always receives the first credit-return page, every credit read is for the wrong context, and send PIO stalls forever. Use the DMA API as intended: pass the base of the allocation with its full length and select the page with vm_pgoff. A separate length is needed because memlen must keep describing the VMA for the existing size check. The dma-direct path stays correct as well, since dma_direct_mmap() adds the same vm_pgoff to the base pfn. Tested on a Dell T7610 (Xeon E5-2650 v2, Intel IOMMU in DMA-FQ mode) against a Threadripper PRO 3995WX peer, both Omni-Path 100. Before this change psm2_ep_open() Oopses the kernel; with only the arithmetic corrected psm2_ep_open() succeeds but any transfer that uses send PIO hangs, PSM2_SDMA=3D2 (send PIO disabled) completing normally while PSM2_SDMA=3D0 (send PIO only) hangs every time. With this change send PIO, send DMA and the default mixed mode all work. Fixes: 1ec82317a1da ("IB/hfi1: Use dma_mmap_coherent for matching buffers") Cc: stable@vger.kernel.org Signed-off-by: Shuhei Takeshita --- drivers/infiniband/hw/hfi1/file_ops.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/drivers/infiniband/hw/hfi1/file_ops.c b/drivers/infiniband/hw/= hfi1/file_ops.c index e05f3c255..ad2044d1f 100644 --- a/drivers/infiniband/hw/hfi1/file_ops.c +++ b/drivers/infiniband/hw/hfi1/file_ops.c @@ -326,6 +326,7 @@ static int hfi1_file_mmap(struct file *fp, struct vm_ar= ea_struct *vma) void *memvirt =3D NULL; dma_addr_t memdma =3D 0; u8 subctxt, mapio =3D 0, vmf =3D 0, type; + size_t memdmalen =3D 0; ssize_t memlen =3D 0; int ret =3D 0; u16 ctxt; @@ -371,7 +372,9 @@ static int hfi1_file_mmap(struct file *fp, struct vm_ar= ea_struct *vma) mapio =3D 1; break; case PIO_CRED: { + struct credit_return_base *cr =3D &dd->cr_base[uctxt->sc->node]; u64 cr_page_offset; + if (flags & VM_WRITE) { ret =3D -EPERM; goto done; @@ -381,11 +384,18 @@ static int hfi1_file_mmap(struct file *fp, struct vm_= area_struct *vma) * second or third page allocated for credit returns (if number * of enabled contexts > 64 and 128 respectively). */ - cr_page_offset =3D ((u64)uctxt->sc->hw_free - - (u64)dd->cr_base[uctxt->sc->node].va) & + cr_page_offset =3D ((u64)uctxt->sc->hw_free - (u64)cr->va) & PAGE_MASK; - memvirt =3D dd->cr_base[uctxt->sc->node].va + cr_page_offset; - memdma =3D dd->cr_base[uctxt->sc->node].dma + cr_page_offset; + /* + * dma_mmap_coherent() describes the whole coherent buffer and + * selects the page within it with vma->vm_pgoff, so pass the + * base of the allocation and its length and let vm_pgoff pick + * the page. + */ + vma->vm_pgoff =3D cr_page_offset >> PAGE_SHIFT; + memvirt =3D cr->va; + memdma =3D cr->dma; + memdmalen =3D TXE_NUM_CONTEXTS * sizeof(struct credit_return); memlen =3D PAGE_SIZE; flags &=3D ~VM_MAYWRITE; flags |=3D VM_DONTCOPY | VM_DONTEXPAND; @@ -567,7 +577,8 @@ static int hfi1_file_mmap(struct file *fp, struct vm_ar= ea_struct *vma) ret =3D 0; } else if (memdma) { ret =3D dma_mmap_coherent(&dd->pcidev->dev, vma, - memvirt, memdma, memlen); + memvirt, memdma, + memdmalen ? memdmalen : memlen); } else if (mapio) { ret =3D io_remap_pfn_range(vma, vma->vm_start, PFN_DOWN(memaddr), --=20 2.43.0