From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alexander Gordeev Subject: [PATCH 6/9] x86: Optimize virt_to_phys() and phys_to_virt() Date: Wed, 20 Apr 2016 15:18:52 +0200 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: Alexander Gordeev , Andrew Jones , Thomas Huth , =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= To: kvm@vger.kernel.org Return-path: Received: from mx1.redhat.com ([209.132.183.28]:43652 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932603AbcDTNTL (ORCPT ); Wed, 20 Apr 2016 09:19:11 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 50758C00032E for ; Wed, 20 Apr 2016 13:19:11 +0000 (UTC) In-Reply-To: Sender: kvm-owner@vger.kernel.org List-ID: Make use of generic implementations and remove x86 specific virt_to_phys() and phys_to_virt() functions. Cc: Andrew Jones Cc: Thomas Huth Cc: Radim Kr=C4=8Dm=C3=A1=C5=99 Signed-off-by: Alexander Gordeev --- lib/asm-generic/io.h | 2 ++ lib/x86/asm/io.h | 10 +--------- lib/x86/asm/page.h | 3 +++ 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/lib/asm-generic/io.h b/lib/asm-generic/io.h index 931415a..3585ac0 100644 --- a/lib/asm-generic/io.h +++ b/lib/asm-generic/io.h @@ -165,7 +165,9 @@ static inline unsigned long virt_to_phys(volatile v= oid *address) { return __pa((unsigned long)address); } +#endif =20 +#ifndef phys_to_virt static inline void *phys_to_virt(unsigned long address) { return __va(address); diff --git a/lib/x86/asm/io.h b/lib/x86/asm/io.h index 5b901a3..74451d5 100644 --- a/lib/x86/asm/io.h +++ b/lib/x86/asm/io.h @@ -40,14 +40,6 @@ static inline void outl(unsigned int value, unsigned= short port) asm volatile("outl %0, %w1" : : "a"(value), "Nd"(port)); } =20 -static inline unsigned long virt_to_phys(const void *virt) -{ - return (unsigned long)virt; -} - -static inline void *phys_to_virt(unsigned long phys) -{ - return (void *)phys; -} +#include =20 #endif diff --git a/lib/x86/asm/page.h b/lib/x86/asm/page.h index edfe325..a9280ed 100644 --- a/lib/x86/asm/page.h +++ b/lib/x86/asm/page.h @@ -24,4 +24,7 @@ #define PGDIR_MASK 1023 #endif =20 +#define __va(x) ((void *)((unsigned long) (x))) +#define __pa(x) ((unsigned long) (x)) + #endif --=20 1.8.3.1