diff mbox

[08/11] xen/arm: vpl011: Allocate a new PFN in the toolstack and pass to Xen using a hvm call

Message ID 1487676368-22356-9-git-send-email-bhupinder.thakur@linaro.org (mailing list archive)
State New, archived
Headers show

Commit Message

Bhupinder Thakur Feb. 21, 2017, 11:26 a.m. UTC
Allocates a new pfn, initializes it and passes on to Xen using a hvm call.

Another changes is in xc_hvm_param_deprecated_check () to allow new vpl011 HVM params,
which have been defined to some deprecated HVM params.

Signed-off-by: Bhupinder Thakur <bhupinder.thakur@linaro.org>
---
 tools/libxc/include/xc_dom.h | 5 +++++
 tools/libxc/xc_dom_arm.c     | 7 ++++++-
 tools/libxc/xc_dom_boot.c    | 5 +++++
 tools/libxc/xc_domain.c      | 3 +++
 4 files changed, 19 insertions(+), 1 deletion(-)

Comments

Konrad Rzeszutek Wilk March 3, 2017, 8:51 p.m. UTC | #1
On Tue, Feb 21, 2017 at 04:56:05PM +0530, Bhupinder Thakur wrote:
> Allocates a new pfn, initializes it and passes on to Xen using a hvm call.

s/passes/pass/
> 
> Another changes is in xc_hvm_param_deprecated_check () to allow new vpl011 HVM params,
> which have been defined to some deprecated HVM params.

Do you need to do something special with migration?

Or does migration not work yet on ARM?

> 
> Signed-off-by: Bhupinder Thakur <bhupinder.thakur@linaro.org>
> ---
>  tools/libxc/include/xc_dom.h | 5 +++++
>  tools/libxc/xc_dom_arm.c     | 7 ++++++-
>  tools/libxc/xc_dom_boot.c    | 5 +++++
>  tools/libxc/xc_domain.c      | 3 +++
>  4 files changed, 19 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/libxc/include/xc_dom.h b/tools/libxc/include/xc_dom.h
> index 608cbc2..c763cf1 100644
> --- a/tools/libxc/include/xc_dom.h
> +++ b/tools/libxc/include/xc_dom.h
> @@ -218,6 +218,11 @@ struct xc_dom_image {
>  
>      /* Extra SMBIOS structures passed to HVMLOADER */
>      struct xc_hvm_firmware_module smbios_module;
> +
> +#if defined(__arm__) || defined(__aarch64__)
> +    xen_pfn_t vpl011_console_pfn;
> +    unsigned int vpl011_console_evtchn;
> +#endif
>  };
>  
>  /* --- pluggable kernel loader ------------------------------------- */
> diff --git a/tools/libxc/xc_dom_arm.c b/tools/libxc/xc_dom_arm.c
> index a7e839e..7060a22 100644
> --- a/tools/libxc/xc_dom_arm.c
> +++ b/tools/libxc/xc_dom_arm.c
> @@ -26,10 +26,11 @@
>  #include "xg_private.h"
>  #include "xc_dom.h"
>  
> -#define NR_MAGIC_PAGES 3
> +#define NR_MAGIC_PAGES 4
>  #define CONSOLE_PFN_OFFSET 0
>  #define XENSTORE_PFN_OFFSET 1
>  #define MEMACCESS_PFN_OFFSET 2
> +#define VPL011_CONSOLE_PFN_OFFSET 3
>  
>  #define LPAE_SHIFT 9
>  
> @@ -85,6 +86,7 @@ static int alloc_magic_pages(struct xc_dom_image *dom)
>  
>      dom->console_pfn = base + CONSOLE_PFN_OFFSET;
>      dom->xenstore_pfn = base + XENSTORE_PFN_OFFSET;
> +    dom->vpl011_console_pfn = base + VPL011_CONSOLE_PFN_OFFSET;
>  
>      xc_clear_domain_page(dom->xch, dom->guest_domid, dom->console_pfn);
>      xc_clear_domain_page(dom->xch, dom->guest_domid, dom->xenstore_pfn);
> @@ -95,6 +97,9 @@ static int alloc_magic_pages(struct xc_dom_image *dom)
>              dom->xenstore_pfn);
>      xc_hvm_param_set(dom->xch, dom->guest_domid, HVM_PARAM_MONITOR_RING_PFN,
>              base + MEMACCESS_PFN_OFFSET);
> +    xc_hvm_param_set(dom->xch, dom->guest_domid, HVM_PARAM_VPL011_CONSOLE_PFN,
> +            base + VPL011_CONSOLE_PFN_OFFSET);
> +
>      /* allocated by toolstack */
>      xc_hvm_param_set(dom->xch, dom->guest_domid, HVM_PARAM_CONSOLE_EVTCHN,
>              dom->console_evtchn);
> diff --git a/tools/libxc/xc_dom_boot.c b/tools/libxc/xc_dom_boot.c
> index 791041b..933e92f 100644
> --- a/tools/libxc/xc_dom_boot.c
> +++ b/tools/libxc/xc_dom_boot.c
> @@ -227,6 +227,11 @@ int xc_dom_boot_image(struct xc_dom_image *dom)
>      if ( (rc = clear_page(dom, dom->xenstore_pfn)) != 0 )
>          return rc;
>  
> +#if defined (__arm__) || defined(__aarch64__)
> +    if ( (rc = clear_page(dom, dom->vpl011_console_pfn)) != 0 )
> +        return rc;
> +#endif
> +
>      /* start info page */
>      if ( dom->arch_hooks->start_info )
>          dom->arch_hooks->start_info(dom);
> diff --git a/tools/libxc/xc_domain.c b/tools/libxc/xc_domain.c
> index fa1daeb..d881288 100644
> --- a/tools/libxc/xc_domain.c
> +++ b/tools/libxc/xc_domain.c
> @@ -1337,9 +1337,12 @@ static inline int xc_hvm_param_deprecated_check(uint32_t param)
>  {
>      switch ( param )
>      {
> +#if defined (__arm__) || defined(__aarch64__)

Can you add a comment here saying why it is empty please?

> +#else
>          case HVM_PARAM_MEMORY_EVENT_CR0:
>          case HVM_PARAM_MEMORY_EVENT_CR3:
>          case HVM_PARAM_MEMORY_EVENT_CR4:
> +#endif
>          case HVM_PARAM_MEMORY_EVENT_INT3:
>          case HVM_PARAM_MEMORY_EVENT_SINGLE_STEP:
>          case HVM_PARAM_MEMORY_EVENT_MSR:
> -- 
> 2.7.4
> 
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> https://lists.xen.org/xen-devel
Julien Grall March 5, 2017, 1:07 p.m. UTC | #2
Hi Konrad,

On 03/03/2017 08:51 PM, Konrad Rzeszutek Wilk wrote:
> On Tue, Feb 21, 2017 at 04:56:05PM +0530, Bhupinder Thakur wrote:
>> Allocates a new pfn, initializes it and passes on to Xen using a hvm call.
>
> s/passes/pass/
>>
>> Another changes is in xc_hvm_param_deprecated_check () to allow new vpl011 HVM params,
>> which have been defined to some deprecated HVM params.
>
> Do you need to do something special with migration?
>
> Or does migration not work yet on ARM?

I will answer to this question and leave Bhupinder answering the rest. 
Sadly, the migration support does not yet exist on ARM.

Regardless that, I am sure whether re-purposing deprecating HVM params 
is fine. Although they should have never been used on ARM.

Cheers,
diff mbox

Patch

diff --git a/tools/libxc/include/xc_dom.h b/tools/libxc/include/xc_dom.h
index 608cbc2..c763cf1 100644
--- a/tools/libxc/include/xc_dom.h
+++ b/tools/libxc/include/xc_dom.h
@@ -218,6 +218,11 @@  struct xc_dom_image {
 
     /* Extra SMBIOS structures passed to HVMLOADER */
     struct xc_hvm_firmware_module smbios_module;
+
+#if defined(__arm__) || defined(__aarch64__)
+    xen_pfn_t vpl011_console_pfn;
+    unsigned int vpl011_console_evtchn;
+#endif
 };
 
 /* --- pluggable kernel loader ------------------------------------- */
diff --git a/tools/libxc/xc_dom_arm.c b/tools/libxc/xc_dom_arm.c
index a7e839e..7060a22 100644
--- a/tools/libxc/xc_dom_arm.c
+++ b/tools/libxc/xc_dom_arm.c
@@ -26,10 +26,11 @@ 
 #include "xg_private.h"
 #include "xc_dom.h"
 
-#define NR_MAGIC_PAGES 3
+#define NR_MAGIC_PAGES 4
 #define CONSOLE_PFN_OFFSET 0
 #define XENSTORE_PFN_OFFSET 1
 #define MEMACCESS_PFN_OFFSET 2
+#define VPL011_CONSOLE_PFN_OFFSET 3
 
 #define LPAE_SHIFT 9
 
@@ -85,6 +86,7 @@  static int alloc_magic_pages(struct xc_dom_image *dom)
 
     dom->console_pfn = base + CONSOLE_PFN_OFFSET;
     dom->xenstore_pfn = base + XENSTORE_PFN_OFFSET;
+    dom->vpl011_console_pfn = base + VPL011_CONSOLE_PFN_OFFSET;
 
     xc_clear_domain_page(dom->xch, dom->guest_domid, dom->console_pfn);
     xc_clear_domain_page(dom->xch, dom->guest_domid, dom->xenstore_pfn);
@@ -95,6 +97,9 @@  static int alloc_magic_pages(struct xc_dom_image *dom)
             dom->xenstore_pfn);
     xc_hvm_param_set(dom->xch, dom->guest_domid, HVM_PARAM_MONITOR_RING_PFN,
             base + MEMACCESS_PFN_OFFSET);
+    xc_hvm_param_set(dom->xch, dom->guest_domid, HVM_PARAM_VPL011_CONSOLE_PFN,
+            base + VPL011_CONSOLE_PFN_OFFSET);
+
     /* allocated by toolstack */
     xc_hvm_param_set(dom->xch, dom->guest_domid, HVM_PARAM_CONSOLE_EVTCHN,
             dom->console_evtchn);
diff --git a/tools/libxc/xc_dom_boot.c b/tools/libxc/xc_dom_boot.c
index 791041b..933e92f 100644
--- a/tools/libxc/xc_dom_boot.c
+++ b/tools/libxc/xc_dom_boot.c
@@ -227,6 +227,11 @@  int xc_dom_boot_image(struct xc_dom_image *dom)
     if ( (rc = clear_page(dom, dom->xenstore_pfn)) != 0 )
         return rc;
 
+#if defined (__arm__) || defined(__aarch64__)
+    if ( (rc = clear_page(dom, dom->vpl011_console_pfn)) != 0 )
+        return rc;
+#endif
+
     /* start info page */
     if ( dom->arch_hooks->start_info )
         dom->arch_hooks->start_info(dom);
diff --git a/tools/libxc/xc_domain.c b/tools/libxc/xc_domain.c
index fa1daeb..d881288 100644
--- a/tools/libxc/xc_domain.c
+++ b/tools/libxc/xc_domain.c
@@ -1337,9 +1337,12 @@  static inline int xc_hvm_param_deprecated_check(uint32_t param)
 {
     switch ( param )
     {
+#if defined (__arm__) || defined(__aarch64__)
+#else
         case HVM_PARAM_MEMORY_EVENT_CR0:
         case HVM_PARAM_MEMORY_EVENT_CR3:
         case HVM_PARAM_MEMORY_EVENT_CR4:
+#endif
         case HVM_PARAM_MEMORY_EVENT_INT3:
         case HVM_PARAM_MEMORY_EVENT_SINGLE_STEP:
         case HVM_PARAM_MEMORY_EVENT_MSR: