From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Jones Subject: Re: [PATCH v2 3/9] x86: Introduce lib/x86/asm/page.h Date: Wed, 27 Apr 2016 15:45:10 +0200 Message-ID: <20160427134510.fijhwvxf3iihabfv@hawk.localdomain> References: <8e0aa9421074b10fa754113f9a33331310ef666e.1461762418.git.agordeev@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: kvm@vger.kernel.org, Thomas Huth , Radim =?utf-8?B?S3LEjW3DocWZ?= To: Alexander Gordeev Return-path: Received: from mx1.redhat.com ([209.132.183.28]:58349 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752438AbcD0NpP (ORCPT ); Wed, 27 Apr 2016 09:45:15 -0400 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (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 AB5047F6A6 for ; Wed, 27 Apr 2016 13:45:14 +0000 (UTC) Content-Disposition: inline In-Reply-To: <8e0aa9421074b10fa754113f9a33331310ef666e.1461762418.git.agordeev@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On Wed, Apr 27, 2016 at 03:13:52PM +0200, Alexander Gordeev wrote: > Make x86 consistent with other architectures and put > memory page specific defines to lib/x86/asm/page.h >=20 > Cc: Andrew Jones > Cc: Thomas Huth > Cc: Radim Kr=C4=8Dm=C3=A1=C5=99 > Signed-off-by: Alexander Gordeev > --- > lib/x86/asm/page.h | 27 +++++++++++++++++++++++++++ > lib/x86/vm.c | 17 ----------------- > lib/x86/vm.h | 14 +------------- > 3 files changed, 28 insertions(+), 30 deletions(-) > create mode 100644 lib/x86/asm/page.h Reviewed-by: Andrew Jones >=20 > diff --git a/lib/x86/asm/page.h b/lib/x86/asm/page.h > new file mode 100644 > index 0000000..edfe325 > --- /dev/null > +++ b/lib/x86/asm/page.h > @@ -0,0 +1,27 @@ > +#ifndef _ASM_X86_PAGE_H_ > +#define _ASM_X86_PAGE_H_ > + > +#define PAGE_SIZE 4096ul > +#ifdef __x86_64__ > +#define LARGE_PAGE_SIZE (512 * PAGE_SIZE) > +#else > +#define LARGE_PAGE_SIZE (1024 * PAGE_SIZE) > +#endif > + > +#define PTE_PRESENT (1ull << 0) > +#define PTE_PSE (1ull << 7) > +#define PTE_WRITE (1ull << 1) > +#define PTE_USER (1ull << 2) > +#define PTE_ADDR (0xffffffffff000ull) > + > +#ifdef __x86_64__ > +#define PAGE_LEVEL 4 > +#define PGDIR_WIDTH 9 > +#define PGDIR_MASK 511 > +#else > +#define PAGE_LEVEL 2 > +#define PGDIR_WIDTH 10 > +#define PGDIR_MASK 1023 > +#endif > + > +#endif > diff --git a/lib/x86/vm.c b/lib/x86/vm.c > index 7ce7bbc..9c94ca5 100644 > --- a/lib/x86/vm.c > +++ b/lib/x86/vm.c > @@ -2,13 +2,6 @@ > #include "vm.h" > #include "libcflat.h" > =20 > -#define PAGE_SIZE 4096ul > -#ifdef __x86_64__ > -#define LARGE_PAGE_SIZE (512 * PAGE_SIZE) > -#else > -#define LARGE_PAGE_SIZE (1024 * PAGE_SIZE) > -#endif > - > static void *free =3D 0; > static void *vfree_top =3D 0; > =20 > @@ -44,16 +37,6 @@ void free_page(void *page) > extern char edata; > static unsigned long end_of_memory; > =20 > -#ifdef __x86_64__ > -#define PAGE_LEVEL 4 > -#define PGDIR_WIDTH 9 > -#define PGDIR_MASK 511 > -#else > -#define PAGE_LEVEL 2 > -#define PGDIR_WIDTH 10 > -#define PGDIR_MASK 1023 > -#endif > - > unsigned long *install_pte(unsigned long *cr3, > int pte_level, > void *virt, > diff --git a/lib/x86/vm.h b/lib/x86/vm.h > index 28794d7..72f84e6 100644 > --- a/lib/x86/vm.h > +++ b/lib/x86/vm.h > @@ -2,19 +2,7 @@ > #define VM_H > =20 > #include "processor.h" > - > -#define PAGE_SIZE 4096ul > -#ifdef __x86_64__ > -#define LARGE_PAGE_SIZE (512 * PAGE_SIZE) > -#else > -#define LARGE_PAGE_SIZE (1024 * PAGE_SIZE) > -#endif > - > -#define PTE_PRESENT (1ull << 0) > -#define PTE_PSE (1ull << 7) > -#define PTE_WRITE (1ull << 1) > -#define PTE_USER (1ull << 2) > -#define PTE_ADDR (0xffffffffff000ull) > +#include "asm/page.h" > =20 > void setup_vm(); > =20 > --=20 > 1.8.3.1 >=20 > -- > To unsubscribe from this list: send the line "unsubscribe kvm" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html