Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp571161ybe; Mon, 2 Sep 2019 06:08:38 -0700 (PDT) X-Google-Smtp-Source: APXvYqwWm9QGfFroGIfXm21ND874IkFzacuSn59xamFPJ7b463w8er1h0VXXqvNHS/ECr3Qv8/X4 X-Received: by 2002:a17:902:b497:: with SMTP id y23mr5443266plr.201.1567429718221; Mon, 02 Sep 2019 06:08:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567429718; cv=none; d=google.com; s=arc-20160816; b=SmGrSo/c2/G66+78AV9i8BADR+HpiRxg+0r1uEPBbSxK04tMLHGAuWPSN1KMmfzLf1 IAm+A9qLq1vOJAqrU5LliI+otqkTr4PTTAeFVel8h+HaxGRYD8WRzjDrGRw8OdKs5xtp npKgHSu3tVDRVLrRBwUyx5PrCrrHF8uoFB1IK+Lqdt9aCwoLpHhbV/DYK/hPk0v2aGLn Vv9QqICoFayZ9vslXGS5NIbKJdo6hWUzRuZPO9zbLPQWHgG6JfSoZv0Oku08FbI9PIsc 4NaU8dibMhoRZRtyj8htIiO6zM04tPChF3jv4h6bv3oNxpRJQjwtJueP3BljlmOt/Okc UZOw== 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=sZTEAgPmhnxnngHfnvEbQsrU5etCxPhvpRqBQENBmaM=; b=jyrQkG89xR4O+eJjbuErheYyvNdJm7sIXQr+CgAGEnmjmP6EluNvcpKyWx0aekH0Hs 7vqKFBSiv2o2lUEbLMNVjMncnMaAucFGA3yD/wExP6ch8uQvOvRCoYu1PGCDY9Dgr8AC dO7vcBY+BACgzAT/8IdVPkT2gkenFCbuBLtLGqsw6ymYPuomcpo3lsp9/upij6ggeuY0 XA6PjfEzXsEhNKppLT7YGchV1AHt3LsYG2YHH0GqSed8ndi3uAEUuno6fS9FJp8ItCSV N8KK04qHpfT0IB2QEupBNKMj5ZzSEEiPim/n60AHfUMRLAInaqzEsCU7mnRvdm2Mn63Y 8y3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=alhEYSaq; 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 f12si545853plt.227.2019.09.02.06.08.22; Mon, 02 Sep 2019 06:08:38 -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=alhEYSaq; 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 S1730787AbfIBNGa (ORCPT + 99 others); Mon, 2 Sep 2019 09:06:30 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:50032 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729761AbfIBNG3 (ORCPT ); Mon, 2 Sep 2019 09:06:29 -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=sZTEAgPmhnxnngHfnvEbQsrU5etCxPhvpRqBQENBmaM=; b=alhEYSaqagjorgd0iX1B6Ixzyk 1w+GU4gTDXD26zrYHIrge+oL1um/VIN37Yx4uZEHSKKZO7C0qTBp81LQJKkLxGVvAdLw/Do28l/LP +mHaBAWfHtT/ShWhRHOKjGKW3l3J8CTBmjRJmiciUkdxJ/7z2GVBtnjxlLSO4JPinf5lbusCuYZTr mac/6p9wBr/82hZMtu6aBoTXVpOGJrw06nxWEiCURFA1a0E0+pktouQTBlIIj+SMHgHxSe1vMzptZ lKrvI9m1niPSOlW62+Hr/dJiyezwMM/fspRK33j+geNe6HWP85tDwfAL3bcp8oz1Bq3fCFuYJl5gU Zd4pIySg==; Received: from 213-225-38-191.nat.highway.a1.net ([213.225.38.191] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.92 #3 (Red Hat Linux)) id 1i4m2J-00054g-KL; Mon, 02 Sep 2019 13:06:24 +0000 From: Christoph Hellwig To: Stefano Stabellini , Konrad Rzeszutek Wilk , gross@suse.com, boris.ostrovsky@oracle.com 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 09/13] swiotlb-xen: use the same foreign page check everywhere Date: Mon, 2 Sep 2019 15:03:35 +0200 Message-Id: <20190902130339.23163-10-hch@lst.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190902130339.23163-1-hch@lst.de> References: <20190902130339.23163-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 Reviewed-by: Stefano Stabellini --- 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<