Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp4246991ybl; Mon, 26 Aug 2019 07:40:20 -0700 (PDT) X-Google-Smtp-Source: APXvYqx5jmvsEJj1oTg8JaTAiK4ZlJWosatsPl86JHPHYuac7rv/OlRV93+Kenn3jaKBqS/YeLuH X-Received: by 2002:a17:902:b106:: with SMTP id q6mr7184204plr.333.1566830420478; Mon, 26 Aug 2019 07:40:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566830420; cv=none; d=google.com; s=arc-20160816; b=z3MKsijPqNG1T0Psp+zRHt3zLxP2Kq4tIITEQy1egyIFYQKyFpPByVhSqAbOcdQ+3D oUuWL3TeQEux8pMQDTfxW4vhFjXBWgM+r94FC2oUzHwOlPMsFJkk+mBeFCIdczLbtK9N 22EEoMV2Z7fgNNIXoOXXYrU/SPCviWSE5pnM8vSecwV2p6CBgUTp/29KJjiftKXMDvj4 W25BDLHkgAOo5eNq7bOuJC624D/NHcZ3VaUb1GP6gpltwChYt2OHeeqUlISb0vClUxu6 MRBoiGqHNqRE83ZmS86G7kbKfYLiYFYR20nE6PGPnnfjXb1wxuxCa8bMAsJv6YzvLV7y DEog== 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=9kEGwXzY8QPiMjzdxwXv69yhq2zm5Ld1jbBhLR78W9Y=; b=ueTDIpH/sO1OyN7APvJBJ39mhqwvAaMSlxfjpUZf+3ARJ/CFRxwKPejldbpsy2toEv G4HUcXxe0V4jVGl6dgH91DbYOqm5uWhvLB+WEVa2iAPHJhknQuyL1vQZCKUSXmso2PoM JaTnGWOQ8s99wA/oXAOy2r9VmahIvkdsD1ThKlbD30fuTVP1ybKKpnH7pOnLMrGhIRx2 211CzfzwciW6ngTLma64usI77CiFSrUKrpuXrqfrGvlc74+2gghmM6619Q4+tesQ5bMo MPh6llSS4CNDaa06rlD2j+GfQE7/hZD12zwu6evIb+yl6XrWJJIxhwfwCptDxcNbpnQ6 DYsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=u3M3sAmo; 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 m190si9123323pga.322.2019.08.26.07.40.05; Mon, 26 Aug 2019 07:40:20 -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=u3M3sAmo; 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 S1731864AbfHZMUT (ORCPT + 99 others); Mon, 26 Aug 2019 08:20:19 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:50106 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730964AbfHZMUR (ORCPT ); Mon, 26 Aug 2019 08:20:17 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type: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=9kEGwXzY8QPiMjzdxwXv69yhq2zm5Ld1jbBhLR78W9Y=; b=u3M3sAmoJDqxdnL8WEuRMHoTps fR+jUV18SJJh5OsqY/jCekIbdBhRPm2JWie7l7LtKe8vTDMz4mVWoFiWVo+Zal56YYyxTEbvomQ9c ow7LQQFMiUYtrrLEPO/p8IUbG32UdGQFnzGZUfOuVBTRxPEUQCrvb07rLRFiLLWfkbao2AYtuP9Jw O/pRqmPxnpJpS4ISJIY7neA2M3NCXbUJvLmD1fKyay4UvMP0TMvH/b31oOZwqA35XKNiGIywDG78s HFz6E7y5Lm2Wss01CD3eU9025unFF5YBacNfPRPUeKdlhfv3+c9t45uA0lmB90keI14YAXsKk4WyF Fwh4ig+w==; Received: from clnet-p19-102.ikbnet.co.at ([83.175.77.102] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.92 #3 (Red Hat Linux)) id 1i2Dyf-0002mK-Sh; Mon, 26 Aug 2019 12:20:06 +0000 From: Christoph Hellwig To: Stefano Stabellini , Konrad Rzeszutek Wilk Cc: x86@kernel.org, linux-arm-kernel@lists.infradead.org, xen-devel@lists.xenproject.org, iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org Subject: [PATCH 07/11] swiotlb-xen: use the same foreign page check everywhere Date: Mon, 26 Aug 2019 14:19:40 +0200 Message-Id: <20190826121944.515-8-hch@lst.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190826121944.515-1-hch@lst.de> References: <20190826121944.515-1-hch@lst.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 xen_dma_map_page uses a different and more complicated check for foreign pages than the other three cache maintainance helpers. Switch it to the simpler pfn_valid method a well, and document the scheme with a single improved comment in xen_dma_map_page. Signed-off-by: Christoph Hellwig --- include/xen/arm/page-coherent.h | 31 +++++++++---------------------- 1 file changed, 9 insertions(+), 22 deletions(-) diff --git a/include/xen/arm/page-coherent.h b/include/xen/arm/page-coherent.h index 0e244f4fec1a..07c104dbc21f 100644 --- a/include/xen/arm/page-coherent.h +++ b/include/xen/arm/page-coherent.h @@ -41,23 +41,17 @@ static inline void xen_dma_map_page(struct device *hwdev, struct page *page, dma_addr_t dev_addr, unsigned long offset, size_t size, enum dma_data_direction dir, unsigned long attrs) { - unsigned long page_pfn = page_to_xen_pfn(page); - unsigned long dev_pfn = XEN_PFN_DOWN(dev_addr); - unsigned long compound_pages = - (1<