Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp11359ybg; Tue, 9 Jun 2020 14:53:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxtzU7kJyZxFsegZtLDpPgYPi8FukLubC8SLMyBQWC5Yvk91CYRF4acdVsqjKpgflPHb+6E X-Received: by 2002:a50:f0c4:: with SMTP id a4mr29892959edm.125.1591739604097; Tue, 09 Jun 2020 14:53:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591739604; cv=none; d=google.com; s=arc-20160816; b=twajuvh2i89oElsctfIM1cSD0XtPB9hP22cHivSckLhpYUqgKOfPHd85Wj6hJJVpBu L4DXXtCTOp+egN9k6ncRCmFfhrjSkHIN6Uqe1eOsCd0FZW9YeFMVP33wO1uof0HCrIwI Czoham0Wl2uLusprowdmSKg5vjvkT9w+DqlyuLruuLjL5SOpdZOAVJktbE33lms5g1Ad TaXJKjWWy+RijpMzKBO640z/+7Yow4u1+aVQhFJxC2Fu6IID3YzWJe7Hr0mIcCYWv02e I9aB7CyuiHlZAf1zoLx7hn4UUQ+spRETzmOUvHQbjPrG76F0fA7lu62Pz5029VgYfu+A bgaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date:dkim-signature; bh=R+YY8B12iyCZGQc1HXjigC2LH1HVTi/lmlGTEujYtoE=; b=Ddgv7r9uPlQK4MDMTtxZQyaFRWdhayzEch1QKZRK2l3Y3Uz5y2ao95zExCE4rTksWx +CL/BafqiYJqKMCyh9Bv7UTmmEEBHTuCDdxD5CaGj/Z9yswylJUnV1tsQro90By0UPwq ka3UTFjVgD9S3BgPBOV/bkB1cjEjuf9RlFqRe2ZDjiRNNpi41INWw5BjDL6glWF1JfuY vAnEFHEaak4yA1acb4MM/6wJCh2hCsLZWj09oevMgay0Vf+eipohjkchuvWb/L7MtqxM QqRjHeRQT71go1BYdZqKN/qtMS54sK8NICZ3pgaOXVomuR6sD6mDoWyow2iw+45DtQDx eQ/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=lVBxOO94; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z9si11381039ejm.47.2020.06.09.14.53.00; Tue, 09 Jun 2020 14:53:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=lVBxOO94; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728202AbgFIVus (ORCPT + 99 others); Tue, 9 Jun 2020 17:50:48 -0400 Received: from mail.kernel.org ([198.145.29.99]:53484 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726992AbgFIVus (ORCPT ); Tue, 9 Jun 2020 17:50:48 -0400 Received: from localhost (c-67-164-102-47.hsd1.ca.comcast.net [67.164.102.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id AA98B206D5; Tue, 9 Jun 2020 21:50:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591739448; bh=n8q6RBqf99l7e7L1EOCdjDHHs3POGMUOsceVpb6TqsY=; h=Date:From:To:cc:Subject:In-Reply-To:References:From; b=lVBxOO94oJCocVzgGYmxBV/gu6l2FaYei13cIzYMryQHWhbZi9YaLr7cUz1MLaG/w 0bRbjImP1w5xBQtTIIuvOMS2PPZMzHArb4ACkNEFsb07qxEhJdHgvYjszfQY3Gfyp9 iAYY4qIeIYOHSZ7he94+zdY72e7wCdtwCk17qwBM= Date: Tue, 9 Jun 2020 14:50:46 -0700 (PDT) From: Stefano Stabellini X-X-Sender: sstabellini@sstabellini-ThinkPad-T480s To: Christoph Hellwig cc: Stefano Stabellini , jgross@suse.com, boris.ostrovsky@oracle.com, konrad.wilk@oracle.com, xen-devel@lists.xenproject.org, linux-kernel@vger.kernel.org, tamas@tklengyel.com, roman@zededa.com, Stefano Stabellini Subject: Re: [PATCH v2 08/11] swiotlb-xen: introduce phys_to_dma/dma_to_phys translations In-Reply-To: <20200609053240.GA3015@infradead.org> Message-ID: References: <20200603222247.11681-8-sstabellini@kernel.org> <20200608070850.GD15742@infradead.org> <20200609053240.GA3015@infradead.org> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 8 Jun 2020, Christoph Hellwig wrote: > On Mon, Jun 08, 2020 at 04:06:57PM -0700, Stefano Stabellini wrote: > > I understand what you are suggesting about having something like: > > > > xen_phys_to_dma(...) > > { > > phys_addr_t phys = xen_phys_to_bus(dev, paddr) > > return phys_to_dma(phys); > > } > > > > I thought about it myself. I'll do it. > > "something", yes. Except that I think the bus is a little confusing, > isn't it? What is the Xen term for these addresses? Xen reasons in terms of frame numbers. Xen calls them "dfn" for device frame number. They were supposed to be called "bfn" but eventually they settled for a different name when the series was committed. I could s/bfn/dfn/g to match the terminology, if that helps. > Also we probably don't need the extra local variable. Sure > > But I don't think I understood the comment about XEN_PFN_PHYS. > > There is a comment above xen_phys_to_bus that it avoids using > XEN_PFN_PHYS because XEN_PFN_PHYS of the phys_addr_t vs dma_addr_t > mismatch. But XEN_PFN_PHYS could just use a u64 instead of the > phys_addr_t and then we could use it. Especially as XEN_PFN_PHYS > isn't actually used anywhere except in swiotlb-xen.c. Or we could > remove XEN_PFN_PHYS enirely, as it isn't all that useful to start > with. I'll remove it.