Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp900475ybt; Fri, 10 Jul 2020 15:39:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy38CUf5oXnZgLGk4+inPE8nI5MiEBIl6ZXjzZ2eo6VFnvpDLIg8m5ZH4PGdSLRlz/6KQhZ X-Received: by 2002:a05:6402:2065:: with SMTP id bd5mr74238978edb.67.1594420747192; Fri, 10 Jul 2020 15:39:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594420747; cv=none; d=google.com; s=arc-20160816; b=XA8bjJFDRYAEKwgB/k675/Wy2meGTSKT5Qdj1mW4oVk3Dc+DGhdAYxu1XzyPQwo9dT /+IbeNoFB4c7Kzhc0b0HP0QV564NCeoaBAV1lMXIQQYQsyZmW35Be/N+ALbDUlvuxF64 CWLutM09C80kTLTmsPmnJ8hf4GgRbHgULE+MFgTsn5K0U0x7oUlxf+USD6yie1VwxrkY Irqx72Oktz5wmQ7OS0gEg1qXwNXhC3hUK9l/qVlE6RuzDDXndAdyXGFA+8jDIfNmQsJ4 meKa2UROq2hOKbEsiYmgDCcmQ9PuETo5h2Hw9KUvNhX56VBvRYZvavq82bU3aIynwbh2 7kDw== 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; bh=aIoSCFTOH2zOxsUPajhgnMomtM5xz5pW1MI5RlxCZbQ=; b=DDMbckBxLT8vUZi5ocR3QvZ9g79Sl0W4iP+OzqVEwvCvLlgW4HpWJpQ1arJUEqV8+R RaL5kXRWb8eGvwiQgONgitBm4Jt6cNnFcOmITrSkHosZjnbLfV8mx8TLOdZnKZeAp7vt OckhhGSxHJmH6YlkDUuMaV6Cox3KVSsxnr2X67TmtJN6kijCszdWhlteRbQXeFvkQeZq vx++6XUPNRkb4NqdxXJstZxYYQe5ZD0P+HYqStwvwf/yukoNzEKjrv+RzymX+NH+1Tl9 zuWrTvbIwaELXvMvajkej0xvO4MORVaThgEPCZgzXMOHSZtQMZfUDeVYkqRQI9l1whCx TasQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=vsgLFsqH; 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 z22si4224801edr.357.2020.07.10.15.38.43; Fri, 10 Jul 2020 15:39:07 -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=vsgLFsqH; 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 S1726958AbgGJWey (ORCPT + 99 others); Fri, 10 Jul 2020 18:34:54 -0400 Received: from mail.kernel.org ([198.145.29.99]:46026 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726789AbgGJWed (ORCPT ); Fri, 10 Jul 2020 18:34:33 -0400 Received: from sstabellini-ThinkPad-T480s.hsd1.ca.comcast.net (c-67-164-102-47.hsd1.ca.comcast.net [67.164.102.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id AE6EE2084C; Fri, 10 Jul 2020 22:34:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1594420473; bh=jLgIlw0XpAVuOCkBCu96F/m3f+tfTNFZAXAR4R0KYhQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vsgLFsqHx83ZxrVE357/rAy2BkLYAlHXH3STs/PYChzyTa06t95Oll0lDdW/RvhzA 3w15KyVrAiCPA2w60Luc8SqDOVyQyqkDSy2CJJiPwbNNxRy1ZFtBmpSrg/JPH5N0pg 53S4KsSkr+3N1JIHxPP80eE+akQ+CPF2WRZY7gSM= From: Stefano Stabellini To: jgross@suse.com, boris.ostrovsky@oracle.com, konrad.wilk@oracle.com Cc: sstabellini@kernel.org, xen-devel@lists.xenproject.org, linux-kernel@vger.kernel.org, hch@infradead.org, Stefano Stabellini Subject: [PATCH v3 08/11] swiotlb-xen: remove XEN_PFN_PHYS Date: Fri, 10 Jul 2020 15:34:24 -0700 Message-Id: <20200710223427.6897-8-sstabellini@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Stefano Stabellini XEN_PFN_PHYS is only used in one place in swiotlb-xen making things more complex than need to be. Remove the definition of XEN_PFN_PHYS and open code the cast in the one place where it is needed. Signed-off-by: Stefano Stabellini --- drivers/xen/swiotlb-xen.c | 7 +------ include/xen/page.h | 1 - 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/drivers/xen/swiotlb-xen.c b/drivers/xen/swiotlb-xen.c index e2c35f45f91e..03d118b6c141 100644 --- a/drivers/xen/swiotlb-xen.c +++ b/drivers/xen/swiotlb-xen.c @@ -52,11 +52,6 @@ static unsigned long xen_io_tlb_nslabs; * Quick lookup value of the bus address of the IOTLB. */ -/* - * Both of these functions should avoid XEN_PFN_PHYS because phys_addr_t - * can be 32bit when dma_addr_t is 64bit leading to a loss in - * information if the shift is done before casting to 64bit. - */ static inline dma_addr_t xen_phys_to_bus(struct device *dev, phys_addr_t paddr) { unsigned long bfn = pfn_to_bfn(XEN_PFN_DOWN(paddr)); @@ -101,7 +96,7 @@ static int is_xen_swiotlb_buffer(struct device *dev, dma_addr_t dma_addr) { unsigned long bfn = XEN_PFN_DOWN(dma_addr); unsigned long xen_pfn = bfn_to_local_pfn(bfn); - phys_addr_t paddr = XEN_PFN_PHYS(xen_pfn); + phys_addr_t paddr = (phys_addr_t)xen_pfn << XEN_PAGE_SHIFT; /* If the address is outside our domain, it CAN * have the same virtual address as another address diff --git a/include/xen/page.h b/include/xen/page.h index df6d6b6ec66e..285677b42943 100644 --- a/include/xen/page.h +++ b/include/xen/page.h @@ -24,7 +24,6 @@ #define XEN_PFN_DOWN(x) ((x) >> XEN_PAGE_SHIFT) #define XEN_PFN_UP(x) (((x) + XEN_PAGE_SIZE-1) >> XEN_PAGE_SHIFT) -#define XEN_PFN_PHYS(x) ((phys_addr_t)(x) << XEN_PAGE_SHIFT) #include -- 2.17.1