Re: [kvm-unit-tests PATCH v4 09/12] x86: Cleanup PAGE_* constants

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, May 02, 2016 at 03:59:29PM +0200, Alexander Gordeev wrote:
> Cc: Andrew Jones <drjones@xxxxxxxxxx>
> Cc: Thomas Huth <thuth@xxxxxxxxxx>
> Cc: Radim Krčmář <rkrcmar@xxxxxxxxxx>
> Signed-off-by: Alexander Gordeev <agordeev@xxxxxxxxxx>
> ---
>  lib/x86/asm/page.h | 7 ++++++-
>  x86/access.c       | 4 +---
>  x86/vmx.h          | 2 +-
>  3 files changed, 8 insertions(+), 5 deletions(-)
> 
> diff --git a/lib/x86/asm/page.h b/lib/x86/asm/page.h
> index 2d40714..bd7f676 100644
> --- a/lib/x86/asm/page.h
> +++ b/lib/x86/asm/page.h
> @@ -7,7 +7,12 @@
>   */
>  
>  
> -#define PAGE_SIZE   4096ul
> +#include <linux/const.h>
> +
> +#define PAGE_SHIFT	12
> +#define PAGE_SIZE	(_AC(1,UL) << PAGE_SHIFT)

You don't need const.h and _AC unless you also wrap lines that
can't be included from assembler with #ifndef __ASSEMBLY__, and
use _AC for everything you do want accessible by assembly.

> +#define PAGE_MASK	(~(PAGE_SIZE-1))
> +
>  #ifdef __x86_64__
>  #define LARGE_PAGE_SIZE (512 * PAGE_SIZE)
>  #else
> diff --git a/x86/access.c b/x86/access.c
> index 4acaee5..aaf805d 100644
> --- a/x86/access.c
> +++ b/x86/access.c
> @@ -2,6 +2,7 @@
>  #include "libcflat.h"
>  #include "desc.h"
>  #include "processor.h"
> +#include "asm/page.h"
>  
>  #define smp_id() 0
>  
> @@ -15,9 +16,6 @@ static int cpuid_7_ebx;
>  static int cpuid_7_ecx;
>  static int invalid_mask;
>  
> -#define PAGE_SIZE ((pt_element_t)4096)
> -#define PAGE_MASK (~(PAGE_SIZE-1))
> -
>  #define PT_BASE_ADDR_MASK ((pt_element_t)((((pt_element_t)1 << 40) - 1) & PAGE_MASK))
>  #define PT_PSE_BASE_ADDR_MASK (PT_BASE_ADDR_MASK & ~(1ull << 21))
>  
> diff --git a/x86/vmx.h b/x86/vmx.h
> index d6bc217..27f3451 100644
> --- a/x86/vmx.h
> +++ b/x86/vmx.h
> @@ -4,6 +4,7 @@
>  #include "libcflat.h"
>  #include "processor.h"
>  #include "bitops.h"
> +#include "asm/page.h"
>  
>  struct vmcs {
>  	u32 revision_id; /* vmcs revision identifier */
> @@ -476,7 +477,6 @@ enum Ctrl1 {
>  #define EPT_PGDIR_ENTRIES	(1 << EPT_PGDIR_WIDTH)
>  #define EPT_LEVEL_SHIFT(level)	(((level)-1) * EPT_PGDIR_WIDTH + 12)
>  #define EPT_ADDR_MASK		GENMASK_ULL(51, 12)
> -#define PAGE_MASK		(~(PAGE_SIZE-1))
>  #define PAGE_MASK_2M		(~(PAGE_SIZE_2M-1))
>  
>  #define EPT_VLT_RD		1
> -- 
> 1.8.3.1
>

Otherwise looks good.

drew 
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux