Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp948840ybl; Fri, 16 Aug 2019 06:38:55 -0700 (PDT) X-Google-Smtp-Source: APXvYqzFYZkJKHUE4pQvnoUZgs3BqQ4iM92Ebe35XiqB+THBl4e8sEIrPwJPrvK1FiwXULyQPBRw X-Received: by 2002:a17:90a:d146:: with SMTP id t6mr7388998pjw.76.1565962735277; Fri, 16 Aug 2019 06:38:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565962735; cv=none; d=google.com; s=arc-20160816; b=FzlRe+h+IczjIMzQ2Ag6WPJNfo2icsgGCrBl8lvFdKdoct7Uy3KtOkSCbwq3+3S116 CnP8Ykl/kr4+GX1izBcVRDXbFY0Xr/sRMz7B4kawTr2GfR/sVVdjHYDYOPUptKSQPANV QpBq6KU/rf4+0cI2vWlACvfzTpUe448/JsL5YqiPQEs8X5fEYiogxfzJnAW2i7Jam751 IpZjx7x/evexj4vrpDFrT7cg77+TtirHbMsjQV6Oj6nsEiSosxwYKqRioZZYPuCFmCyT l3g+HYaEB0SOaJxpmZyWUrneVzWJheu1MC4ddHfo5p8GSovX85B5xGrjjmTA3Z8UkZHz Z4Ww== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=wzVDb4HE0ToewEfb/LFlKvRK8AW+axV2DKXdveGCLFg=; b=YUwRnL4sI+CZ1Vj3xMS1Qka0OF1tmE/xyfOoeBFHgmRQTRjlL0XJvpUDKqVatgiz7c A6nSyny0zJCx0uxvNYQKNWnhg3T+OcXtL2y5LGy4Onk1wLII+avFuulueoiYbND7u/BJ xvG423bHXoBHQi/Z4S1YrzoQZ1GtcJPnNbZKulwLqkXyA1jp8bDZ6B1PtBxGU+KI+k5R hZYiGcLyYcUSBv84nz9rNUe1FKtxwvczJZtdygoYTfS5i6Bk7jCyGiqFeE4FyGMN3dMV uzHoWOuCXgr4zaDq83O7wlW4SdaHnCvfNU5+0LNtdjQOVrMXloxocLm88vWuZPX85kRf lirA== ARC-Authentication-Results: i=1; mx.google.com; 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 185si4497982pfv.39.2019.08.16.06.38.38; Fri, 16 Aug 2019 06:38:55 -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; 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 S1727358AbfHPNiC (ORCPT + 99 others); Fri, 16 Aug 2019 09:38:02 -0400 Received: from foss.arm.com ([217.140.110.172]:57178 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726981AbfHPNiB (ORCPT ); Fri, 16 Aug 2019 09:38:01 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id E95ED344; Fri, 16 Aug 2019 06:38:00 -0700 (PDT) Received: from [10.1.197.57] (e110467-lin.cambridge.arm.com [10.1.197.57]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id DEF273F694; Fri, 16 Aug 2019 06:37:59 -0700 (PDT) Subject: Re: [PATCH 03/11] xen/arm: pass one less argument to dma_cache_maint To: Christoph Hellwig , Stefano Stabellini , Konrad Rzeszutek Wilk Cc: xen-devel@lists.xenproject.org, iommu@lists.linux-foundation.org, x86@kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org References: <20190816130013.31154-1-hch@lst.de> <20190816130013.31154-4-hch@lst.de> From: Robin Murphy Message-ID: <8585fb27-14e0-888c-6749-6862b4e16418@arm.com> Date: Fri, 16 Aug 2019 14:37:58 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <20190816130013.31154-4-hch@lst.de> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 16/08/2019 14:00, Christoph Hellwig wrote: > Instead of taking apart the dma address in both callers do it inside > dma_cache_maint itself. > > Signed-off-by: Christoph Hellwig > --- > arch/arm/xen/mm.c | 10 ++++++---- > 1 file changed, 6 insertions(+), 4 deletions(-) > > diff --git a/arch/arm/xen/mm.c b/arch/arm/xen/mm.c > index 90574d89d0d4..d9da24fda2f7 100644 > --- a/arch/arm/xen/mm.c > +++ b/arch/arm/xen/mm.c > @@ -43,13 +43,15 @@ static bool hypercall_cflush = false; > > /* functions called by SWIOTLB */ > > -static void dma_cache_maint(dma_addr_t handle, unsigned long offset, > - size_t size, enum dma_data_direction dir, enum dma_cache_op op) > +static void dma_cache_maint(dma_addr_t handle, size_t size, > + enum dma_data_direction dir, enum dma_cache_op op) > { > struct gnttab_cache_flush cflush; > unsigned long xen_pfn; > + unsigned long offset = handle & ~PAGE_MASK; > size_t left = size; > > + offset &= PAGE_MASK; Ahem... presumably that should be handle, not offset. Robin. > xen_pfn = (handle >> XEN_PAGE_SHIFT) + offset / XEN_PAGE_SIZE; > offset %= XEN_PAGE_SIZE; > > @@ -86,13 +88,13 @@ static void dma_cache_maint(dma_addr_t handle, unsigned long offset, > static void __xen_dma_page_dev_to_cpu(struct device *hwdev, dma_addr_t handle, > size_t size, enum dma_data_direction dir) > { > - dma_cache_maint(handle & PAGE_MASK, handle & ~PAGE_MASK, size, dir, DMA_UNMAP); > + dma_cache_maint(handle, size, dir, DMA_UNMAP); > } > > static void __xen_dma_page_cpu_to_dev(struct device *hwdev, dma_addr_t handle, > size_t size, enum dma_data_direction dir) > { > - dma_cache_maint(handle & PAGE_MASK, handle & ~PAGE_MASK, size, dir, DMA_MAP); > + dma_cache_maint(handle, size, dir, DMA_MAP); > } > > void __xen_dma_map_page(struct device *hwdev, struct page *page, >