Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp925722imj; Sat, 9 Feb 2019 10:57:36 -0800 (PST) X-Google-Smtp-Source: AHgI3IbeNhuKJdEwfkeVB2G7mTZn3XKvQlg1yHjzqeuqAkXiuaaKJyrKsV1rA24k4qdI8XqIQ37s X-Received: by 2002:a63:eb0e:: with SMTP id t14mr26828610pgh.445.1549738656315; Sat, 09 Feb 2019 10:57:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549738656; cv=none; d=google.com; s=arc-20160816; b=slnCciTmLmly+W8AdSM0HRDql9tiHIZcnmNUN61bvKeQva5WHq5rG1zfYlBI/+mlOZ MDz/L7D8S7yn7O2WR+8UC7OOWdHNxT3d2S0U8zjhb/UhODYgbZ+RUmhv6xBishxFeILA EJp6bZY3vFA/HDoplbzeLMm4SQx2sLDrOpX7uHNkW6/8wa0Mpv9MrCH90qPmgZhQbGtJ 2e5o6Gst0NRUgfHkSC9H30LTl9D/gLRhsTBjIzQmcqm7lEkTHEouB4PsZlpAomuftVzK +hlZx5c7IXKiAZLT+P5viRESiSADGa2hT0qLNFaHSG5cj8rmy85r8hQ8mkkScu1sqDtj s1kA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=0uMRPb0LJT1V3n1YdbTLTHHer0l5BFunhjjo45bHUPI=; b=Wa8lTZexjsG9AZyHT888MJ38zAy6NprYfYbNcXelssBOeSLr0DvU7SJVf/kvgpjQSI 4WGggrtSIvEGfR7fKl4neMDNf8czua6Rvw5XobOOE2hEP/P209ZagdatzGafdqncMj5K oez9bsneQ0tGM0UtAg/HLCBY3gWVR0KP+I8pelwSekk2zk/hz1T+tZqZeQQiMlzGLufo ryWbO6uDoc5Y4NsohY5kc4KhpjWk306kiwkcqI3+2zHexMA5T9dWrXcB+o/9W1c/YCh5 gHymM0JjzCaTg9jZZeVSAaeLG5TtCPPZNACHrP5RvfHU6iAPtP5UPo5yV2XmAtprgBpS fEEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=CWtnG5q7; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h1si5543322pgv.0.2019.02.09.10.57.20; Sat, 09 Feb 2019 10:57:36 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=CWtnG5q7; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727509AbfBISsA (ORCPT + 99 others); Sat, 9 Feb 2019 13:48:00 -0500 Received: from mail.kernel.org ([198.145.29.99]:60788 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727490AbfBISr6 (ORCPT ); Sat, 9 Feb 2019 13:47:58 -0500 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 5113021916; Sat, 9 Feb 2019 18:47:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549738078; bh=q194z93Dz4zTJ417OY+FBmmB8Y1WED/dvhUReIbhpxg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CWtnG5q7+xq+mQiSL2zrVaN3T21Y/gpPe0FsHkh6B1TRTjMfkDVND/NbFZtsk7fvv eLOCsJEFsfzKnwVmeZepHo+dX/++9GlsLy2CwBsZnho0k9m3NrugSllXC/JFAA1205 asbx+izmew0CwrkSh1qGTzI2OLL1czsAPhwrvbps= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Liviu Dudau , Christoph Hellwig , Sasha Levin , linux-nvme@lists.infradead.org Subject: [PATCH AUTOSEL 4.20 21/42] nvme-pci: use the same attributes when freeing host_mem_desc_bufs. Date: Sat, 9 Feb 2019 13:47:13 -0500 Message-Id: <20190209184734.125935-21-sashal@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190209184734.125935-1-sashal@kernel.org> References: <20190209184734.125935-1-sashal@kernel.org> MIME-Version: 1.0 X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Liviu Dudau [ Upstream commit cc667f6d5de023ee131e96bb88e5cddca23272bd ] When using HMB the PCIe host driver allocates host_mem_desc_bufs using dma_alloc_attrs() but frees them using dma_free_coherent(). Use the correct dma_free_attrs() function to free the buffers. Signed-off-by: Liviu Dudau Signed-off-by: Christoph Hellwig Signed-off-by: Sasha Levin --- drivers/nvme/host/pci.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c index c33bb201b884..0f45868e8af9 100644 --- a/drivers/nvme/host/pci.c +++ b/drivers/nvme/host/pci.c @@ -1748,8 +1748,9 @@ static void nvme_free_host_mem(struct nvme_dev *dev) struct nvme_host_mem_buf_desc *desc = &dev->host_mem_descs[i]; size_t size = le32_to_cpu(desc->size) * dev->ctrl.page_size; - dma_free_coherent(dev->dev, size, dev->host_mem_desc_bufs[i], - le64_to_cpu(desc->addr)); + dma_free_attrs(dev->dev, size, dev->host_mem_desc_bufs[i], + le64_to_cpu(desc->addr), + DMA_ATTR_NO_KERNEL_MAPPING | DMA_ATTR_NO_WARN); } kfree(dev->host_mem_desc_bufs); @@ -1815,8 +1816,9 @@ out_free_bufs: while (--i >= 0) { size_t size = le32_to_cpu(descs[i].size) * dev->ctrl.page_size; - dma_free_coherent(dev->dev, size, bufs[i], - le64_to_cpu(descs[i].addr)); + dma_free_attrs(dev->dev, size, bufs[i], + le64_to_cpu(descs[i].addr), + DMA_ATTR_NO_KERNEL_MAPPING | DMA_ATTR_NO_WARN); } kfree(bufs); -- 2.19.1