Received: by 10.223.185.116 with SMTP id b49csp2860934wrg; Mon, 5 Mar 2018 09:50:25 -0800 (PST) X-Google-Smtp-Source: AG47ELvVDdKO+5zS2LrU3z+TNG5hzacWJ49+usDxjD07dIZat/eKAqweIMHj5dhJJ8l2SfN1VkWH X-Received: by 10.167.130.133 with SMTP id s5mr15932403pfm.238.1520272225559; Mon, 05 Mar 2018 09:50:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520272225; cv=none; d=google.com; s=arc-20160816; b=VUqi46zJS3av4sjB2cHKh78iUvoxlG9Z6OPUX5wAVf6N4QAYaoBwbh3nZTTax+PW0A mk9ju8cV9PZsu+suukjKh1zTu77Pakl800u9Z0itcP+X4Z9WeOlFejaqWOAj9TGSX7+a psX2vHfuuTion+BLf5MAXahgTkuaiTdLydcBz0Pywwzw6YJnaIOAOtfqvwG9534Fibxl pLzvr42RjynPG7WRzPtCO6mxokQ3NuG+8sewpFPWhokDhvdjCYNCyqrP2+z2RnooNgbP jD/X7e/wTS4j/hq0sbuhzTvmKgFxpqf+MtRCKxQuxHN9F0fduxF70bof85H9H9LuMvpP 5Isw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=dvGJjf3y9Y/qw0u5qXQG0p2WMbdlOhPNCnLF6fAaOqc=; b=gi576+2IgbRfKYIYNcvEdBNm17nFNHhnDAmjSRsi7fz2T0Dm5XS55Ae1por0g6OaSG dMhLbr2C7Sg2yulDyPydqwFmjNXZfBxe3RGh0s3D6aPs3AijSOhdnV+20V9/1jOghe3E DpH7+oXmC2MEwIkJlyax7Jm0xum/qYTtX8s63jqhVU/IrQVOVaqpmBgIzHOpx17L+kkH qUd4p3BiwhaOum1PiLK8IOT002Pe2BUPEHzwfXIskh+p6YwWiXfi4Kp70sgkP3YOTYNg mM/xjNJfGAhpZuDRXMJCzNtGJv8JYNxnxYcLVVHORfrN0S+jz03IEjAJrPdvw7YCDRmJ ALow== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=U2WPAS4x; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m3-v6si9699539pld.155.2018.03.05.09.50.11; Mon, 05 Mar 2018 09:50:25 -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=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=U2WPAS4x; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932138AbeCERs3 (ORCPT + 99 others); Mon, 5 Mar 2018 12:48:29 -0500 Received: from bombadil.infradead.org ([198.137.202.133]:60364 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752653AbeCERrP (ORCPT ); Mon, 5 Mar 2018 12:47:15 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=References:In-Reply-To:Message-Id: Date:Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=dvGJjf3y9Y/qw0u5qXQG0p2WMbdlOhPNCnLF6fAaOqc=; b=U2WPAS4xfdWZYxardOpOHH1rM EfUFAWzPMt2+d96UEXoxJq/t1egPM3//83W5XTWVc5wqItakPX63craKEGcqhEITUJnjpoPzZKuzl MW8E7u/HFBgJeYyK37OPzQvrIlkE6FHfjxrkn9LEaP/BE0EhfQQG/dFYkisyA6+VG9M9H1pqgdId2 3/rEFQwitdFuiJmxDFH05cOrhJnpjJcarW5ZgoTyhKVxFcoEb7cQbmL3gQjV2QFj7yK16a4SP/Gx0 tnWnVct44n4UZmisF7VhT87NvZ+MEIgbduVGCzj4X2ddEUS6Fb6B1mQiXLO90IDO59kbwBGmWnTv0 haZoESZDQ==; Received: from [209.116.154.70] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.89 #1 (Red Hat Linux)) id 1esuCV-0002vc-U2; Mon, 05 Mar 2018 17:47:04 +0000 From: Christoph Hellwig To: x86@kernel.org Cc: Konrad Rzeszutek Wilk , Tom Lendacky , David Woodhouse , Muli Ben-Yehuda , Jon Mason , Joerg Roedel , iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org Subject: [PATCH 09/13] x86: remove dma_alloc_coherent_gfp_flags Date: Mon, 5 Mar 2018 09:46:51 -0800 Message-Id: <20180305174655.9878-10-hch@lst.de> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20180305174655.9878-1-hch@lst.de> References: <20180305174655.9878-1-hch@lst.de> X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org All dma_ops implementations used on x86 now take care of setting their own required GFP_ masks for the allocation. And given that the common code now clears harmful flags itself that means we can stop the flags in all the iommu implementations as well. Signed-off-by: Christoph Hellwig --- arch/x86/include/asm/dma-mapping.h | 11 ----------- arch/x86/kernel/pci-calgary_64.c | 2 -- arch/x86/kernel/pci-dma.c | 2 -- arch/x86/mm/mem_encrypt.c | 7 ------- 4 files changed, 22 deletions(-) diff --git a/arch/x86/include/asm/dma-mapping.h b/arch/x86/include/asm/dma-mapping.h index df9816b385eb..89ce4bfd241f 100644 --- a/arch/x86/include/asm/dma-mapping.h +++ b/arch/x86/include/asm/dma-mapping.h @@ -36,15 +36,4 @@ int arch_dma_supported(struct device *dev, u64 mask); bool arch_dma_alloc_attrs(struct device **dev, gfp_t *gfp); #define arch_dma_alloc_attrs arch_dma_alloc_attrs -static inline gfp_t dma_alloc_coherent_gfp_flags(struct device *dev, gfp_t gfp) -{ - if (dev->coherent_dma_mask <= DMA_BIT_MASK(24)) - gfp |= GFP_DMA; -#ifdef CONFIG_X86_64 - if (dev->coherent_dma_mask <= DMA_BIT_MASK(32) && !(gfp & GFP_DMA)) - gfp |= GFP_DMA32; -#endif - return gfp; -} - #endif diff --git a/arch/x86/kernel/pci-calgary_64.c b/arch/x86/kernel/pci-calgary_64.c index 5647853053bd..bbfc8b1e9104 100644 --- a/arch/x86/kernel/pci-calgary_64.c +++ b/arch/x86/kernel/pci-calgary_64.c @@ -446,8 +446,6 @@ static void* calgary_alloc_coherent(struct device *dev, size_t size, npages = size >> PAGE_SHIFT; order = get_order(size); - flag &= ~(__GFP_DMA | __GFP_HIGHMEM | __GFP_DMA32); - /* alloc enough pages (and possibly more) */ ret = (void *)__get_free_pages(flag, order); if (!ret) diff --git a/arch/x86/kernel/pci-dma.c b/arch/x86/kernel/pci-dma.c index db0b88ea8d1b..14437116ffea 100644 --- a/arch/x86/kernel/pci-dma.c +++ b/arch/x86/kernel/pci-dma.c @@ -82,8 +82,6 @@ bool arch_dma_alloc_attrs(struct device **dev, gfp_t *gfp) if (!*dev) *dev = &x86_dma_fallback_dev; - *gfp = dma_alloc_coherent_gfp_flags(*dev, *gfp); - if (!is_device_dma_capable(*dev)) return false; return true; diff --git a/arch/x86/mm/mem_encrypt.c b/arch/x86/mm/mem_encrypt.c index 75dc8b525c12..66beedc8fe3d 100644 --- a/arch/x86/mm/mem_encrypt.c +++ b/arch/x86/mm/mem_encrypt.c @@ -208,13 +208,6 @@ static void *sev_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle, void *vaddr = NULL; order = get_order(size); - - /* - * Memory will be memset to zero after marking decrypted, so don't - * bother clearing it before. - */ - gfp &= ~__GFP_ZERO; - page = alloc_pages_node(dev_to_node(dev), gfp, order); if (page) { dma_addr_t addr; -- 2.14.2