Re: [kvm-unit-tests PATCH v5 08/11] x86: Cleanup PAGE_* constants

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

 



On Tue, May 03, 2016 at 01:48:08PM +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 | 10 +++++++++-
>  x86/access.c       |  4 +---
>  x86/vmx.h          |  2 +-
>  3 files changed, 11 insertions(+), 5 deletions(-)

Reviewed-by: Andrew Jones <drjones@xxxxxxxxxx>

> 
> diff --git a/lib/x86/asm/page.h b/lib/x86/asm/page.h
> index d4580b4..916462d 100644
> --- a/lib/x86/asm/page.h
> +++ b/lib/x86/asm/page.h
> @@ -7,7 +7,14 @@
>   */
>  
>  
> -#define PAGE_SIZE	4096ul
> +#include <linux/const.h>
> +
> +#define PAGE_SHIFT	12
> +#define PAGE_SIZE	(_AC(1,UL) << PAGE_SHIFT)
> +#define PAGE_MASK	(~(PAGE_SIZE-1))
> +
> +#ifndef __ASSEMBLY__
> +
>  #ifdef __x86_64__
>  #define LARGE_PAGE_SIZE	(512 * PAGE_SIZE)
>  #else
> @@ -30,4 +37,5 @@
>  #define	PGDIR_MASK	1023
>  #endif
>  
> +#endif /* !__ASSEMBLY__ */
>  #endif
> 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
> 
> --
> 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
--
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