Re: [Xen-devel] [PATCH v6 09/14] arm/guest_access: Move vgic_access_guest_memory to guest_access.h

2017-07-18 Thread Sergej Proskurin
On 07/18/2017 02:12 PM, Julien Grall wrote:

>
>
> On 18/07/17 12:59, Sergej Proskurin wrote:
>> Hi Julien,
>>
>>
>> On 07/18/2017 12:43 PM, Julien Grall wrote:
>>>
>>>
>>> On 18/07/17 10:49, Sergej Proskurin wrote:
 Hi Julien,
>>>
>>> Hello Sergej,
>>>

 On 07/17/2017 05:38 PM, Julien Grall wrote:
> Hi Sergej,
>
> On 06/07/17 12:50, Sergej Proskurin wrote:
>> This commit moves the function vgic_access_guest_memory to
>> guestcopy.c
>> and the header asm/guest_access.h. No functional changes are made.
>> Please note that the function will be renamed in the following
>> commit.
>>
>> Signed-off-by: Sergej Proskurin 
>
> Acked-by: Julien Grall 

 Through Travis CI, I have noticed that clang had troubles compiling
 the
 source, as it missed some types in  guest_access.h. I fixed it by
 including  in guest_access.h. With this change, may I
 keep
 your Acked-by or remove it in the next version?
>>>
>>> I can't tell whether this is the right thing to do without seen the
>>> error commit message.
>>>
>>
>> I have just removed the upper include from guest_access.h to reproduce
>> the mentioned errors. To my surprise, Travis works right through without
>> generating any issues; it did though last week. It is likely that the
>> mentioned issues from last week have been provoked by my tests, which I
>> have not immediately recognized as such. I am very sorry for the noise!
>>
>>> But I am a bit surprised that Travis CI is trying to build Xen ARM
>>> with clang...  Last time at looked at it, I remember some missing
>>> patches in Xen to use clang.
>>
>> I recently startet using Travic CI with Xen again and was also surprised
>> that it worked with clang as well. I remember having troubles with it
>> about 6 months ago.
>
> Well clang is well supported for Xen x86. But for ARM... I would be
> interested to see the full logs, clang version, and whether it
> cross-compile.

Sorry for the misunderstanding: As you said, Travis CI uses clang only
for x86 atm. Which is especially strange that I got issues last week, as
this patch does not touch any code that is shared between ARM and x86. I
can't explain it right now. Again, sorry for the noise.

Thanks,
~Sergej


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


Re: [Xen-devel] [PATCH v6 09/14] arm/guest_access: Move vgic_access_guest_memory to guest_access.h

2017-07-18 Thread Julien Grall



On 18/07/17 12:59, Sergej Proskurin wrote:

Hi Julien,


On 07/18/2017 12:43 PM, Julien Grall wrote:



On 18/07/17 10:49, Sergej Proskurin wrote:

Hi Julien,


Hello Sergej,



On 07/17/2017 05:38 PM, Julien Grall wrote:

Hi Sergej,

On 06/07/17 12:50, Sergej Proskurin wrote:

This commit moves the function vgic_access_guest_memory to guestcopy.c
and the header asm/guest_access.h. No functional changes are made.
Please note that the function will be renamed in the following commit.

Signed-off-by: Sergej Proskurin 


Acked-by: Julien Grall 


Through Travis CI, I have noticed that clang had troubles compiling the
source, as it missed some types in  guest_access.h. I fixed it by
including  in guest_access.h. With this change, may I keep
your Acked-by or remove it in the next version?


I can't tell whether this is the right thing to do without seen the
error commit message.



I have just removed the upper include from guest_access.h to reproduce
the mentioned errors. To my surprise, Travis works right through without
generating any issues; it did though last week. It is likely that the
mentioned issues from last week have been provoked by my tests, which I
have not immediately recognized as such. I am very sorry for the noise!


But I am a bit surprised that Travis CI is trying to build Xen ARM
with clang...  Last time at looked at it, I remember some missing
patches in Xen to use clang.


I recently startet using Travic CI with Xen again and was also surprised
that it worked with clang as well. I remember having troubles with it
about 6 months ago.


Well clang is well supported for Xen x86. But for ARM... I would be 
interested to see the full logs, clang version, and whether it 
cross-compile.


Cheers,

--
Julien Grall

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


Re: [Xen-devel] [PATCH v6 09/14] arm/guest_access: Move vgic_access_guest_memory to guest_access.h

2017-07-18 Thread Sergej Proskurin
Hi Julien,


On 07/18/2017 12:43 PM, Julien Grall wrote:
>
>
> On 18/07/17 10:49, Sergej Proskurin wrote:
>> Hi Julien,
>
> Hello Sergej,
>
>>
>> On 07/17/2017 05:38 PM, Julien Grall wrote:
>>> Hi Sergej,
>>>
>>> On 06/07/17 12:50, Sergej Proskurin wrote:
 This commit moves the function vgic_access_guest_memory to guestcopy.c
 and the header asm/guest_access.h. No functional changes are made.
 Please note that the function will be renamed in the following commit.

 Signed-off-by: Sergej Proskurin 
>>>
>>> Acked-by: Julien Grall 
>>
>> Through Travis CI, I have noticed that clang had troubles compiling the
>> source, as it missed some types in  guest_access.h. I fixed it by
>> including  in guest_access.h. With this change, may I keep
>> your Acked-by or remove it in the next version?
>
> I can't tell whether this is the right thing to do without seen the
> error commit message.
>

I have just removed the upper include from guest_access.h to reproduce
the mentioned errors. To my surprise, Travis works right through without
generating any issues; it did though last week. It is likely that the
mentioned issues from last week have been provoked by my tests, which I
have not immediately recognized as such. I am very sorry for the noise!

> But I am a bit surprised that Travis CI is trying to build Xen ARM
> with clang...  Last time at looked at it, I remember some missing
> patches in Xen to use clang.

I recently startet using Travic CI with Xen again and was also surprised
that it worked with clang as well. I remember having troubles with it
about 6 months ago.

Cheers,
~Sergej


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


Re: [Xen-devel] [PATCH v6 09/14] arm/guest_access: Move vgic_access_guest_memory to guest_access.h

2017-07-18 Thread Julien Grall



On 18/07/17 10:49, Sergej Proskurin wrote:

Hi Julien,


Hello Sergej,



On 07/17/2017 05:38 PM, Julien Grall wrote:

Hi Sergej,

On 06/07/17 12:50, Sergej Proskurin wrote:

This commit moves the function vgic_access_guest_memory to guestcopy.c
and the header asm/guest_access.h. No functional changes are made.
Please note that the function will be renamed in the following commit.

Signed-off-by: Sergej Proskurin 


Acked-by: Julien Grall 


Through Travis CI, I have noticed that clang had troubles compiling the
source, as it missed some types in  guest_access.h. I fixed it by
including  in guest_access.h. With this change, may I keep
your Acked-by or remove it in the next version?


I can't tell whether this is the right thing to do without seen the 
error commit message.


But I am a bit surprised that Travis CI is trying to build Xen ARM with 
clang...  Last time at looked at it, I remember some missing patches in 
Xen to use clang.


Cheers,

--
Julien Grall

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


Re: [Xen-devel] [PATCH v6 09/14] arm/guest_access: Move vgic_access_guest_memory to guest_access.h

2017-07-18 Thread Sergej Proskurin
Hi Julien,


On 07/17/2017 05:38 PM, Julien Grall wrote:
> Hi Sergej,
>
> On 06/07/17 12:50, Sergej Proskurin wrote:
>> This commit moves the function vgic_access_guest_memory to guestcopy.c
>> and the header asm/guest_access.h. No functional changes are made.
>> Please note that the function will be renamed in the following commit.
>>
>> Signed-off-by: Sergej Proskurin 
>
> Acked-by: Julien Grall 

Through Travis CI, I have noticed that clang had troubles compiling the
source, as it missed some types in  guest_access.h. I fixed it by
including  in guest_access.h. With this change, may I keep
your Acked-by or remove it in the next version?

Thanks,
~Sergej


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


Re: [Xen-devel] [PATCH v6 09/14] arm/guest_access: Move vgic_access_guest_memory to guest_access.h

2017-07-17 Thread Julien Grall

Hi Sergej,

On 06/07/17 12:50, Sergej Proskurin wrote:

This commit moves the function vgic_access_guest_memory to guestcopy.c
and the header asm/guest_access.h. No functional changes are made.
Please note that the function will be renamed in the following commit.

Signed-off-by: Sergej Proskurin 


Acked-by: Julien Grall 

Cheers,


---
Cc: Stefano Stabellini 
Cc: Julien Grall 
---
v6: We added this patch to our patch series.
---
 xen/arch/arm/guestcopy.c   | 50 ++
 xen/arch/arm/vgic-v3-its.c |  1 +
 xen/arch/arm/vgic.c| 49 -
 xen/include/asm-arm/guest_access.h |  3 +++
 xen/include/asm-arm/vgic.h |  3 ---
 5 files changed, 54 insertions(+), 52 deletions(-)

diff --git a/xen/arch/arm/guestcopy.c b/xen/arch/arm/guestcopy.c
index 413125f02b..938ffe2668 100644
--- a/xen/arch/arm/guestcopy.c
+++ b/xen/arch/arm/guestcopy.c
@@ -118,6 +118,56 @@ unsigned long raw_copy_from_guest(void *to, const void 
__user *from, unsigned le
 }
 return 0;
 }
+
+/*
+ * Temporarily map one physical guest page and copy data to or from it.
+ * The data to be copied cannot cross a page boundary.
+ */
+int vgic_access_guest_memory(struct domain *d, paddr_t gpa, void *buf,
+ uint32_t size, bool is_write)
+{
+struct page_info *page;
+uint64_t offset = gpa & ~PAGE_MASK;  /* Offset within the mapped page */
+p2m_type_t p2mt;
+void *p;
+
+/* Do not cross a page boundary. */
+if ( size > (PAGE_SIZE - offset) )
+{
+printk(XENLOG_G_ERR "d%d: vITS: memory access would cross page 
boundary\n",
+   d->domain_id);
+return -EINVAL;
+}
+
+page = get_page_from_gfn(d, paddr_to_pfn(gpa), , P2M_ALLOC);
+if ( !page )
+{
+printk(XENLOG_G_ERR "d%d: vITS: Failed to get table entry\n",
+   d->domain_id);
+return -EINVAL;
+}
+
+if ( !p2m_is_ram(p2mt) )
+{
+put_page(page);
+printk(XENLOG_G_ERR "d%d: vITS: memory used by the ITS should be RAM.",
+   d->domain_id);
+return -EINVAL;
+}
+
+p = __map_domain_page(page);
+
+if ( is_write )
+memcpy(p + offset, buf, size);
+else
+memcpy(buf, p + offset, size);
+
+unmap_domain_page(p);
+put_page(page);
+
+return 0;
+}
+
 /*
  * Local variables:
  * mode: C
diff --git a/xen/arch/arm/vgic-v3-its.c b/xen/arch/arm/vgic-v3-its.c
index 9ef792f479..1af6820cab 100644
--- a/xen/arch/arm/vgic-v3-its.c
+++ b/xen/arch/arm/vgic-v3-its.c
@@ -39,6 +39,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
diff --git a/xen/arch/arm/vgic.c b/xen/arch/arm/vgic.c
index 1e5107b9f8..7a4e3cdc88 100644
--- a/xen/arch/arm/vgic.c
+++ b/xen/arch/arm/vgic.c
@@ -638,55 +638,6 @@ void vgic_free_virq(struct domain *d, unsigned int virq)
 }

 /*
- * Temporarily map one physical guest page and copy data to or from it.
- * The data to be copied cannot cross a page boundary.
- */
-int vgic_access_guest_memory(struct domain *d, paddr_t gpa, void *buf,
- uint32_t size, bool is_write)
-{
-struct page_info *page;
-uint64_t offset = gpa & ~PAGE_MASK;  /* Offset within the mapped page */
-p2m_type_t p2mt;
-void *p;
-
-/* Do not cross a page boundary. */
-if ( size > (PAGE_SIZE - offset) )
-{
-printk(XENLOG_G_ERR "d%d: vITS: memory access would cross page 
boundary\n",
-   d->domain_id);
-return -EINVAL;
-}
-
-page = get_page_from_gfn(d, paddr_to_pfn(gpa), , P2M_ALLOC);
-if ( !page )
-{
-printk(XENLOG_G_ERR "d%d: vITS: Failed to get table entry\n",
-   d->domain_id);
-return -EINVAL;
-}
-
-if ( !p2m_is_ram(p2mt) )
-{
-put_page(page);
-printk(XENLOG_G_ERR "d%d: vITS: memory used by the ITS should be RAM.",
-   d->domain_id);
-return -EINVAL;
-}
-
-p = __map_domain_page(page);
-
-if ( is_write )
-memcpy(p + offset, buf, size);
-else
-memcpy(buf, p + offset, size);
-
-unmap_domain_page(p);
-put_page(page);
-
-return 0;
-}
-
-/*
  * Local variables:
  * mode: C
  * c-file-style: "BSD"
diff --git a/xen/include/asm-arm/guest_access.h 
b/xen/include/asm-arm/guest_access.h
index 251e935597..49716501a4 100644
--- a/xen/include/asm-arm/guest_access.h
+++ b/xen/include/asm-arm/guest_access.h
@@ -10,6 +10,9 @@ unsigned long raw_copy_to_guest_flush_dcache(void *to, const 
void *from,
 unsigned long raw_copy_from_guest(void *to, const void *from, unsigned len);
 unsigned long raw_clear_guest(void *to, unsigned len);

+int vgic_access_guest_memory(struct domain *d, paddr_t gpa, void *buf,
+ uint32_t size, bool_t is_write);
+
 #define __raw_copy_to_guest raw_copy_to_guest