Received: by 10.213.65.68 with SMTP id h4csp1447910imn; Mon, 19 Mar 2018 04:35:07 -0700 (PDT) X-Google-Smtp-Source: AG47ELvFk6iIAISdhMieh5vwtePODY+eCTvprlVwuH4ntLCZvy3t/uxRCQHZpgO0+8HWKt23EyS7 X-Received: by 10.99.164.74 with SMTP id c10mr5388073pgp.187.1521459307870; Mon, 19 Mar 2018 04:35:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521459307; cv=none; d=google.com; s=arc-20160816; b=mgjVvSkoln+USh6muW3O5/1knKS0lkX0+g6FEOBpHt+aKNdiYtJSDw0yUMJ3MiTp5K PQjVUgUAUosrFrBLcFhh1he67X3+aKU/5qoSDDnVrJJ5haMaVH41yWNgrFUOK1kycVLG gbBZy/1SaL0iO8Z7LuAaVWVMFgJ3/MyHENmQCKadzp6WLJ5wwKCWMys2JFnm4zklDg8Q kE5Uau3yVHSsTxsfLNEWTU9a+6LW0ExcZY6uAGy0Kmkyu9l1PblTnjbcSZVKRL8ZZsT2 ll+mby4SUcwhz0l7XOHqFkEnXUut6+5PKptOCXT1WvIx+QzhPc8kKf4+zL1QpNWqMMUu 7row== 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=zdT8x6U9lYaoLIOZDJ2ISIATMBhZjtqNejgqw7o+mLYVmyM3hLmHAlTjjVpvA3/I7C 6enfxBI2phEuNFwpdSUjeOGYuVm41+vkxyD/RVXD1uIcYOCtEi7Bj7tu34rJMRMLllTe YG/pMHbfOmwe3gKAf8KOXNBs3YT5OEsm4nmq26fikwayMenZYEnst/jey+b4Qqdawt3h Tb7ojHXaR3LBtTyReD6IGARPtbCFjBnOWy1s9OhGYoVz+V5FZmoFrwiPa1ShhOfjY9tU /Lf1oYcSCVMyEm24ULRjYAIx3SzuUyKVp5FN6tNe3xTJzoBxbWSM1RuzrDKRpZYOQbCn vpIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=nHSevzL3; 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 q4si9524691pgc.269.2018.03.19.04.34.53; Mon, 19 Mar 2018 04:35:07 -0700 (PDT) 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=nHSevzL3; 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 S932978AbeCSKlb (ORCPT + 99 others); Mon, 19 Mar 2018 06:41:31 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:55152 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932913AbeCSKjJ (ORCPT ); Mon, 19 Mar 2018 06:39:09 -0400 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=nHSevzL3ALeCZGdh2QgMk6xDC 856gmJ0UB2rMCKZDOpITnAsanZ0Qdygfg//wI2jB88BPBrBD6wVpVLnZ0T7lQpIMXFtESMnSnBtzF nekBYsfkb79TOGFiKIKEd+zcis1ORW0RKDfx0baJM9mFi7eYaq4zRMhVSXsyfkYKNWhWPKD4RwDAa jzNns3w+5swbzyBi54+lnOPRap+SaBOH0fN73noDHVhr50D0y2hKjQmf3XASUr2l1/3zg9UdeBLPt lhxN/Oevaci8ezt4URmfoZZj2R1bHV+UNuzaAzacr3pvZzBIOy9G7CpY0D3WfXh5KDSfC/OwVL8zK WIv6iyh6w==; Received: from 178.114.187.156.wireless.dyn.drei.com ([178.114.187.156] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1exsBz-0005wP-Ls; Mon, 19 Mar 2018 10:39: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/14] x86: remove dma_alloc_coherent_gfp_flags Date: Mon, 19 Mar 2018 11:38:21 +0100 Message-Id: <20180319103826.12853-10-hch@lst.de> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20180319103826.12853-1-hch@lst.de> References: <20180319103826.12853-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