Re: [Xen-devel] [PATCH v4 11/39] altp2m: Move (MAX|INVALID)_ALTP2M to xen/p2m-common.h

2017-08-31 Thread Sergej Proskurin
Hi Jan,


On 08/31/2017 12:19 PM, Jan Beulich wrote:
 On 31.08.17 at 11:49,  wrote:
>> On 08/31/2017 10:04 AM, Jan Beulich wrote:
>> On 30.08.17 at 20:32,  wrote:
 We move the macros (MAX|INVALID)_ALTP2M out of x86-related code to
 common code, as the following patches will make use of them on ARM.
>>> But both seem not impossible to be require arch-specific values.
>> Right. The general idea at this point is to move as much of altp2m
>> functionality/configuration as possible into a common place. Yet, if you
>> believe that, e.g., the number of altp2m views could/should diverge
>> between both architectures, I will gladly move the defines back into
>> arch-related parts. However, we need to consider that while x86/Intel
>> supports up to 512 entries for EPT pointers as part of the VMCS, we are
>> quite flexible on ARM: we manage the views entirely in software and
>> hence on ARM we can easily keep up with Intel's specification. This
>> allows us to hold parts of the altp2m configuration in a unified place.
>> Or do you believe this is not the right way to go?
> Well, you've basically answered this yourself: Why would you
> want to constrain ARM just because of VMX restrictions? Requiring
> all architectures to surface the same constants (regardless of
> actual values) is all you need to be able to commonize code.

Alright, I will remove the upper constants from common code in v5.

Thanks,
~Sergej

___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


Re: [Xen-devel] [PATCH v4 11/39] altp2m: Move (MAX|INVALID)_ALTP2M to xen/p2m-common.h

2017-08-31 Thread Jan Beulich
>>> On 31.08.17 at 11:49,  wrote:
> On 08/31/2017 10:04 AM, Jan Beulich wrote:
> On 30.08.17 at 20:32,  wrote:
>>> We move the macros (MAX|INVALID)_ALTP2M out of x86-related code to
>>> common code, as the following patches will make use of them on ARM.
>> But both seem not impossible to be require arch-specific values.
> 
> Right. The general idea at this point is to move as much of altp2m
> functionality/configuration as possible into a common place. Yet, if you
> believe that, e.g., the number of altp2m views could/should diverge
> between both architectures, I will gladly move the defines back into
> arch-related parts. However, we need to consider that while x86/Intel
> supports up to 512 entries for EPT pointers as part of the VMCS, we are
> quite flexible on ARM: we manage the views entirely in software and
> hence on ARM we can easily keep up with Intel's specification. This
> allows us to hold parts of the altp2m configuration in a unified place.
> Or do you believe this is not the right way to go?

Well, you've basically answered this yourself: Why would you
want to constrain ARM just because of VMX restrictions? Requiring
all architectures to surface the same constants (regardless of
actual values) is all you need to be able to commonize code.

Jan


___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


Re: [Xen-devel] [PATCH v4 11/39] altp2m: Move (MAX|INVALID)_ALTP2M to xen/p2m-common.h

2017-08-31 Thread Sergej Proskurin
Hi Jan,


On 08/31/2017 10:04 AM, Jan Beulich wrote:
 On 30.08.17 at 20:32,  wrote:
>> We move the macros (MAX|INVALID)_ALTP2M out of x86-related code to
>> common code, as the following patches will make use of them on ARM.
> But both seem not impossible to be require arch-specific values.

Right. The general idea at this point is to move as much of altp2m
functionality/configuration as possible into a common place. Yet, if you
believe that, e.g., the number of altp2m views could/should diverge
between both architectures, I will gladly move the defines back into
arch-related parts. However, we need to consider that while x86/Intel
supports up to 512 entries for EPT pointers as part of the VMCS, we are
quite flexible on ARM: we manage the views entirely in software and
hence on ARM we can easily keep up with Intel's specification. This
allows us to hold parts of the altp2m configuration in a unified place.
Or do you believe this is not the right way to go?

Thanks,
~Sergej


___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


Re: [Xen-devel] [PATCH v4 11/39] altp2m: Move (MAX|INVALID)_ALTP2M to xen/p2m-common.h

2017-08-31 Thread Jan Beulich
>>> On 30.08.17 at 20:32,  wrote:
> We move the macros (MAX|INVALID)_ALTP2M out of x86-related code to
> common code, as the following patches will make use of them on ARM.

But both seem not impossible to be require arch-specific values.

Jan


___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


[Xen-devel] [PATCH v4 11/39] altp2m: Move (MAX|INVALID)_ALTP2M to xen/p2m-common.h

2017-08-30 Thread Sergej Proskurin
We move the macros (MAX|INVALID)_ALTP2M out of x86-related code to
common code, as the following patches will make use of them on ARM.

Signed-off-by: Sergej Proskurin 
---
Cc: Andrew Cooper 
Cc: George Dunlap 
Cc: Ian Jackson 
Cc: Jan Beulich 
Cc: Konrad Rzeszutek Wilk 
Cc: Stefano Stabellini 
Cc: Tim Deegan 
Cc: Wei Liu 
Cc: Julien Grall 
---
v4: We have introduced this patch to our patch series.
---
 xen/include/asm-arm/altp2m.h| 1 +
 xen/include/asm-x86/domain.h| 3 +--
 xen/include/xen/altp2m-common.h | 8 
 3 files changed, 10 insertions(+), 2 deletions(-)
 create mode 100644 xen/include/xen/altp2m-common.h

diff --git a/xen/include/asm-arm/altp2m.h b/xen/include/asm-arm/altp2m.h
index 0711796123..66afa959f6 100644
--- a/xen/include/asm-arm/altp2m.h
+++ b/xen/include/asm-arm/altp2m.h
@@ -20,6 +20,7 @@
 #ifndef __ASM_ARM_ALTP2M_H
 #define __ASM_ARM_ALTP2M_H
 
+#include 
 #include 
 
 /* Alternate p2m on/off per domain */
diff --git a/xen/include/asm-x86/domain.h b/xen/include/asm-x86/domain.h
index fb8bf17458..1d10f4b59f 100644
--- a/xen/include/asm-x86/domain.h
+++ b/xen/include/asm-x86/domain.h
@@ -1,6 +1,7 @@
 #ifndef __ASM_DOMAIN_H__
 #define __ASM_DOMAIN_H__
 
+#include 
 #include 
 #include 
 #include 
@@ -234,8 +235,6 @@ struct paging_vcpu {
 
 #define MAX_NESTEDP2M 10
 
-#define MAX_ALTP2M  10 /* arbitrary */
-#define INVALID_ALTP2M  0x
 #define MAX_EPTP(PAGE_SIZE / sizeof(uint64_t))
 struct p2m_domain;
 struct time_scale {
diff --git a/xen/include/xen/altp2m-common.h b/xen/include/xen/altp2m-common.h
new file mode 100644
index 00..670fb42292
--- /dev/null
+++ b/xen/include/xen/altp2m-common.h
@@ -0,0 +1,8 @@
+#ifndef __XEN_ALTP2M_COMMON_H__
+#define __XEN_ALTP2M_COMMON_H__
+
+#define MAX_ALTP2M  10  /* The system may contain an arbitrary number
+   of altp2m views. */
+#define INVALID_ALTP2M  0x
+
+#endif /* __XEN_ALTP2M_COMMON_H__ */
-- 
2.13.3


___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel