All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/7] xen/pvshim: fixes for staging
@ 2018-01-18 11:02 Roger Pau Monne
  2018-01-18 11:02 ` [PATCH v3 1/7] xen/pvshim: map vcpu_info earlier for APs Roger Pau Monne
                   ` (6 more replies)
  0 siblings, 7 replies; 12+ messages in thread
From: Roger Pau Monne @ 2018-01-18 11:02 UTC (permalink / raw)
  To: xen-devel; +Cc: Roger Pau Monne

Hello,

The following series contain some code and style fixes for the pvshim
(comet) code that has been merged into staging. IMHO patches 1-3 should
be backported to the stable comet branch.

A branch with the series is also available at:

git://xenbits.xen.org/people/royger/xen.git pvshim_fixes_v3

Thanks, Roger.

Roger Pau Monne (7):
  xen/pvshim: map vcpu_info earlier for APs
  xen/pvh: place the trampoline starting at MFN 1
  xen/pvshim: identity pin shim vCPUs to pCPUs
  xen/pvshim: re-order replace_va_mapping code
  xen/pvshim: fix coding style issues
  firmware/shim: fix build process to use POSIX find options
  xen/pvshim: switch shim.c to use typesafe mfn_to_page and virt_to_mfn

 tools/firmware/xen-dir/Makefile |  3 +-
 xen/arch/x86/boot/head.S        |  3 ++
 xen/arch/x86/dom0_build.c       |  5 ++--
 xen/arch/x86/mm.c               |  9 ++++--
 xen/arch/x86/pv/shim.c          | 63 ++++++++++++++++++++---------------------
 xen/arch/x86/smpboot.c          |  6 ++--
 6 files changed, 47 insertions(+), 42 deletions(-)

-- 
2.15.1


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH v3 1/7] xen/pvshim: map vcpu_info earlier for APs
  2018-01-18 11:02 [PATCH v3 0/7] xen/pvshim: fixes for staging Roger Pau Monne
@ 2018-01-18 11:02 ` Roger Pau Monne
  2018-01-18 11:02 ` [PATCH v3 2/7] xen/pvh: place the trampoline starting at MFN 1 Roger Pau Monne
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 12+ messages in thread
From: Roger Pau Monne @ 2018-01-18 11:02 UTC (permalink / raw)
  To: xen-devel
  Cc: Andrew Cooper, Ian Jackson, Wei Liu, Jan Beulich, Roger Pau Monne

Or else init_percpu_time is going to dereference a NULL pointer when
trying to access vcpu_info.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Reviewed-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
---
Cc: Jan Beulich <jbeulich@suse.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Wei Liu <wei.liu2@citrix.com>
---
Should be backported to the 4.10.0-shim-comet branch.
---
 xen/arch/x86/smpboot.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/smpboot.c b/xen/arch/x86/smpboot.c
index 63ca053b35..2cdd431b5f 100644
--- a/xen/arch/x86/smpboot.c
+++ b/xen/arch/x86/smpboot.c
@@ -349,6 +349,9 @@ void start_secondary(void *unused)
     else
         microcode_resume_cpu(cpu);
 
+    if ( xen_guest )
+        hypervisor_ap_setup();
+
     smp_callin();
 
     init_percpu_time();
@@ -376,9 +379,6 @@ void start_secondary(void *unused)
     cpumask_set_cpu(cpu, &cpu_online_map);
     unlock_vector_lock();
 
-    if ( xen_guest )
-        hypervisor_ap_setup();
-
     /* We can take interrupts now: we're officially "up". */
     local_irq_enable();
     mtrr_ap_init();
-- 
2.15.1


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v3 2/7] xen/pvh: place the trampoline starting at MFN 1
  2018-01-18 11:02 [PATCH v3 0/7] xen/pvshim: fixes for staging Roger Pau Monne
  2018-01-18 11:02 ` [PATCH v3 1/7] xen/pvshim: map vcpu_info earlier for APs Roger Pau Monne
@ 2018-01-18 11:02 ` Roger Pau Monne
  2018-01-18 11:02 ` [PATCH v3 3/7] xen/pvshim: identity pin shim vCPUs to pCPUs Roger Pau Monne
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 12+ messages in thread
From: Roger Pau Monne @ 2018-01-18 11:02 UTC (permalink / raw)
  To: xen-devel
  Cc: Andrew Cooper, Wei Liu, Ian Jackson, Jan Beulich, Roger Pau Monne

Since PVH guest jump straight into trampoline_setup trampoline_phys is
not initialized, thus the trampoline is relocated to address 0.

This works, but has the undesirable effect of having VA 0 mapped to
MFN 0, which means NULL pointed dereferences no longer trigger a page
fault.

In order to solve this, place the trampoline starting at MFN 1 and
reserve the memory used by it.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Reviewed-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
---
Cc: Jan Beulich <jbeulich@suse.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: Wei Liu <wei.liu2@citrix.com>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
---
Changes since v2:
 - Clarify comments.

Changes since v1:
 - Expand comment in head.S.
 - Add a BUG_ON to check trampoline_phys value in the PVH case.
---
Should be backported to the 4.10.0-shim-comet branch.
---
 xen/arch/x86/boot/head.S | 3 +++
 xen/arch/x86/mm.c        | 9 +++++++--
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/boot/head.S b/xen/arch/x86/boot/head.S
index 4fe5a776b1..0f652cea11 100644
--- a/xen/arch/x86/boot/head.S
+++ b/xen/arch/x86/boot/head.S
@@ -411,6 +411,9 @@ __pvh_start:
         /* Skip bootloader setup and bios setup, go straight to trampoline */
         movb    $1, sym_esi(pvh_boot)
         movb    $1, sym_esi(skip_realmode)
+
+        /* Set trampoline_phys to use mfn 1 to avoid having a mapping at VA 0 */
+        movw    $0x1000, sym_esi(trampoline_phys)
         jmp     trampoline_setup
 
 #endif /* CONFIG_PVH_GUEST */
diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index 1147a1afb1..275e68c417 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -292,9 +292,14 @@ void __init arch_init_memory(void)
     /*
      * First 1MB of RAM is historically marked as I/O.  If we booted PVH,
      * reclaim the space.  Irrespective, leave MFN 0 as special for the sake
-     * of 0 being a very common default value.
+     * of 0 being a very common default value. Also reserve the RAM needed by
+     * the trampoline on PVH starting at MFN 1.
      */
-    for ( i = 0; i < (pvh_boot ? 1 : 0x100); i++ )
+    BUG_ON(pvh_boot && trampoline_phys != 0x1000);
+    for ( i = 0;
+          i < (pvh_boot ? (1 + PFN_UP(trampoline_end - trampoline_start))
+                        : 0x100);
+          i++ )
         share_xen_page_with_guest(mfn_to_page(_mfn(i)),
                                   dom_io, XENSHARE_writable);
 
-- 
2.15.1


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v3 3/7] xen/pvshim: identity pin shim vCPUs to pCPUs
  2018-01-18 11:02 [PATCH v3 0/7] xen/pvshim: fixes for staging Roger Pau Monne
  2018-01-18 11:02 ` [PATCH v3 1/7] xen/pvshim: map vcpu_info earlier for APs Roger Pau Monne
  2018-01-18 11:02 ` [PATCH v3 2/7] xen/pvh: place the trampoline starting at MFN 1 Roger Pau Monne
@ 2018-01-18 11:02 ` Roger Pau Monne
  2018-01-18 11:02 ` [PATCH v3 4/7] xen/pvshim: re-order replace_va_mapping code Roger Pau Monne
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 12+ messages in thread
From: Roger Pau Monne @ 2018-01-18 11:02 UTC (permalink / raw)
  To: xen-devel
  Cc: Andrew Cooper, Wei Liu, Ian Jackson, Jan Beulich, Roger Pau Monne

Since VCPUOP_{up/down} already identity maps vCPU hotplug to pCPU
hotplug also identity pin the vCPUs to the pCPUs in the scheduler.
This prevents vCPU migration and should improve performance.

While there also use __cpumask_set_cpu instead of cpumask_set_cpu,
there's no need to use the locked variant.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Reviewed-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
---
Cc: Jan Beulich <jbeulich@suse.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: Wei Liu <wei.liu2@citrix.com>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
---
Changes since v1:
 - Clarify commit message.
---
Should be backported to the 4.10.0-shim-comet branch.
---
 xen/arch/x86/dom0_build.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/dom0_build.c b/xen/arch/x86/dom0_build.c
index 17cb1272c1..555660b853 100644
--- a/xen/arch/x86/dom0_build.c
+++ b/xen/arch/x86/dom0_build.c
@@ -140,9 +140,8 @@ struct vcpu *__init dom0_setup_vcpu(struct domain *d,
     {
         if ( pv_shim )
         {
-
-            cpumask_setall(v->cpu_hard_affinity);
-            cpumask_setall(v->cpu_soft_affinity);
+            __cpumask_set_cpu(vcpu_id, v->cpu_hard_affinity);
+            __cpumask_set_cpu(vcpu_id, v->cpu_soft_affinity);
         }
         else
         {
-- 
2.15.1


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v3 4/7] xen/pvshim: re-order replace_va_mapping code
  2018-01-18 11:02 [PATCH v3 0/7] xen/pvshim: fixes for staging Roger Pau Monne
                   ` (2 preceding siblings ...)
  2018-01-18 11:02 ` [PATCH v3 3/7] xen/pvshim: identity pin shim vCPUs to pCPUs Roger Pau Monne
@ 2018-01-18 11:02 ` Roger Pau Monne
  2018-01-18 11:02 ` [PATCH v3 5/7] xen/pvshim: fix coding style issues Roger Pau Monne
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 12+ messages in thread
From: Roger Pau Monne @ 2018-01-18 11:02 UTC (permalink / raw)
  To: xen-devel; +Cc: Andrew Cooper, Jan Beulich, Roger Pau Monne

No functional change.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Reviewed-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
---
Cc: Jan Beulich <jbeulich@suse.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
---
Changes since v1:
 - Fix double ; and space.
---
 xen/arch/x86/pv/shim.c | 21 ++++++---------------
 1 file changed, 6 insertions(+), 15 deletions(-)

diff --git a/xen/arch/x86/pv/shim.c b/xen/arch/x86/pv/shim.c
index 702249719e..aa5d416b75 100644
--- a/xen/arch/x86/pv/shim.c
+++ b/xen/arch/x86/pv/shim.c
@@ -117,21 +117,12 @@ uint64_t pv_shim_mem(uint64_t avail)
 static void __init replace_va_mapping(struct domain *d, l4_pgentry_t *l4start,
                                       unsigned long va, unsigned long mfn)
 {
-    struct page_info *page;
-    l4_pgentry_t *pl4e;
-    l3_pgentry_t *pl3e;
-    l2_pgentry_t *pl2e;
-    l1_pgentry_t *pl1e;
-
-    pl4e = l4start + l4_table_offset(va);
-    pl3e = l4e_to_l3e(*pl4e);
-    pl3e += l3_table_offset(va);
-    pl2e = l3e_to_l2e(*pl3e);
-    pl2e += l2_table_offset(va);
-    pl1e = l2e_to_l1e(*pl2e);
-    pl1e += l1_table_offset(va);
-
-    page = mfn_to_page(l1e_get_pfn(*pl1e));
+    l4_pgentry_t *pl4e = l4start + l4_table_offset(va);
+    l3_pgentry_t *pl3e = l4e_to_l3e(*pl4e) + l3_table_offset(va);
+    l2_pgentry_t *pl2e = l3e_to_l2e(*pl3e) + l2_table_offset(va);
+    l1_pgentry_t *pl1e = l2e_to_l1e(*pl2e) + l1_table_offset(va);
+    struct page_info *page = mfn_to_page(l1e_get_pfn(*pl1e));
+
     put_page_and_type(page);
 
     *pl1e = l1e_from_pfn(mfn, (!is_pv_32bit_domain(d) ? L1_PROT
-- 
2.15.1


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v3 5/7] xen/pvshim: fix coding style issues
  2018-01-18 11:02 [PATCH v3 0/7] xen/pvshim: fixes for staging Roger Pau Monne
                   ` (3 preceding siblings ...)
  2018-01-18 11:02 ` [PATCH v3 4/7] xen/pvshim: re-order replace_va_mapping code Roger Pau Monne
@ 2018-01-18 11:02 ` Roger Pau Monne
  2018-01-18 11:02 ` [PATCH v3 6/7] firmware/shim: fix build process to use POSIX find options Roger Pau Monne
  2018-01-18 11:02 ` [PATCH v3 7/7] xen/pvshim: switch shim.c to use typesafe mfn_to_page and virt_to_mfn Roger Pau Monne
  6 siblings, 0 replies; 12+ messages in thread
From: Roger Pau Monne @ 2018-01-18 11:02 UTC (permalink / raw)
  To: xen-devel; +Cc: Andrew Cooper, Jan Beulich, Roger Pau Monne

Fix a couple of coding style issues.

No code or functional change.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Reviewed-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
---
Cc: Jan Beulich <jbeulich@suse.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/pv/shim.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/xen/arch/x86/pv/shim.c b/xen/arch/x86/pv/shim.c
index aa5d416b75..903562e8e4 100644
--- a/xen/arch/x86/pv/shim.c
+++ b/xen/arch/x86/pv/shim.c
@@ -264,14 +264,14 @@ int pv_shim_shutdown(uint8_t reason)
                                            &old_console_pfn));
 
     /* Pause the other vcpus before starting the migration. */
-    for_each_vcpu(d, v)
+    for_each_vcpu ( d, v )
         if ( v != current )
             vcpu_pause_by_systemcontroller(v);
 
     rc = xen_hypercall_shutdown(SHUTDOWN_suspend);
     if ( rc )
     {
-        for_each_vcpu(d, v)
+        for_each_vcpu ( d, v )
             if ( v != current )
                 vcpu_unpause_by_systemcontroller(v);
 
@@ -347,7 +347,7 @@ int pv_shim_shutdown(uint8_t reason)
      */
     write_start_info(d);
 
-    for_each_vcpu(d, v)
+    for_each_vcpu ( d, v )
     {
         /* Unmap guest vcpu_info pages. */
         unmap_vcpu_info(v);
@@ -428,7 +428,7 @@ static long pv_shim_event_channel_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
          */
         rc = xen_hypercall_event_channel_op(EVTCHNOP_alloc_unbound, &alloc);
         if ( rc )
-           break;
+            break;
 
         /* Force L1 to use the event channel port allocated on L0. */
         rc = evtchn_bind_virq(&virq, alloc.port);
@@ -477,7 +477,7 @@ static long pv_shim_event_channel_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
         {
             rc = xen_hypercall_event_channel_op(EVTCHNOP_bind_vcpu, &vcpu);
             if ( !rc )
-                 evtchn_assign_vcpu(d, vcpu.port, vcpu.vcpu);
+                evtchn_assign_vcpu(d, vcpu.port, vcpu.vcpu);
         }
 
         break;
@@ -596,9 +596,9 @@ void pv_shim_inject_evtchn(unsigned int port)
 {
     if ( port_is_valid(guest, port) )
     {
-         struct evtchn *chn = evtchn_from_port(guest, port);
+        struct evtchn *chn = evtchn_from_port(guest, port);
 
-         evtchn_port_set_pending(guest, chn->notify_vcpu_id, chn);
+        evtchn_port_set_pending(guest, chn->notify_vcpu_id, chn);
     }
 }
 
@@ -633,7 +633,7 @@ static long pv_shim_grant_table_op(unsigned int cmd,
         }
         if ( compat )
 #define XLAT_gnttab_setup_table_HNDL_frame_list(d, s)
-                XLAT_gnttab_setup_table(&nat, &cmp);
+            XLAT_gnttab_setup_table(&nat, &cmp);
 #undef XLAT_gnttab_setup_table_HNDL_frame_list
 
         nat.status = GNTST_okay;
@@ -728,7 +728,7 @@ static long pv_shim_grant_table_op(unsigned int cmd,
 
         if ( compat )
 #define XLAT_gnttab_setup_table_HNDL_frame_list(d, s)
-                XLAT_gnttab_setup_table(&cmp, &nat);
+            XLAT_gnttab_setup_table(&cmp, &nat);
 #undef XLAT_gnttab_setup_table_HNDL_frame_list
 
         if ( unlikely(compat ? __copy_to_guest(uop, &cmp, 1)
-- 
2.15.1


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v3 6/7] firmware/shim: fix build process to use POSIX find options
  2018-01-18 11:02 [PATCH v3 0/7] xen/pvshim: fixes for staging Roger Pau Monne
                   ` (4 preceding siblings ...)
  2018-01-18 11:02 ` [PATCH v3 5/7] xen/pvshim: fix coding style issues Roger Pau Monne
@ 2018-01-18 11:02 ` Roger Pau Monne
  2018-01-18 11:13   ` Ian Jackson
  2018-01-18 11:14   ` Wei Liu
  2018-01-18 11:02 ` [PATCH v3 7/7] xen/pvshim: switch shim.c to use typesafe mfn_to_page and virt_to_mfn Roger Pau Monne
  6 siblings, 2 replies; 12+ messages in thread
From: Roger Pau Monne @ 2018-01-18 11:02 UTC (permalink / raw)
  To: xen-devel; +Cc: Wei Liu, Ian Jackson, Roger Pau Monne

The -printf find option is not POSIX compatible, so replace it with
another rune.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
---
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Wei Liu <wei.liu2@citrix.com>
---
Changes since v1:
 - Drop the exec rune and instead process the whole output at once.
---
 tools/firmware/xen-dir/Makefile | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/firmware/xen-dir/Makefile b/tools/firmware/xen-dir/Makefile
index adf6c31e8d..53eb3b6543 100644
--- a/tools/firmware/xen-dir/Makefile
+++ b/tools/firmware/xen-dir/Makefile
@@ -21,7 +21,8 @@ linkfarm.stamp: $(DEP_DIRS) $(DEP_FILES) FORCE
 	$(foreach d, $(LINK_DIRS), \
 		 (mkdir -p $(D)/$(d); \
 		  cd $(D)/$(d); \
-		  find $(XEN_ROOT)/$(d)/ -type d -printf "./%P\n" |  xargs mkdir -p);)
+		  find $(XEN_ROOT)/$(d)/ -type d |\
+			sed 's,^$(XEN_ROOT)/$(d)/,,g' | xargs mkdir -p);)
 	$(foreach d, $(LINK_DIRS), \
 		(cd $(XEN_ROOT); \
 		 find $(d) ! -type l -type f \
-- 
2.15.1


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v3 7/7] xen/pvshim: switch shim.c to use typesafe mfn_to_page and virt_to_mfn
  2018-01-18 11:02 [PATCH v3 0/7] xen/pvshim: fixes for staging Roger Pau Monne
                   ` (5 preceding siblings ...)
  2018-01-18 11:02 ` [PATCH v3 6/7] firmware/shim: fix build process to use POSIX find options Roger Pau Monne
@ 2018-01-18 11:02 ` Roger Pau Monne
  2018-01-18 11:06   ` Andrew Cooper
  2018-01-18 11:12   ` Wei Liu
  6 siblings, 2 replies; 12+ messages in thread
From: Roger Pau Monne @ 2018-01-18 11:02 UTC (permalink / raw)
  To: xen-devel; +Cc: Andrew Cooper, Wei Liu, Jan Beulich, Roger Pau Monne

No functional change intended.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Requested-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
Cc: Jan Beulich <jbeulich@suse.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: Wei Liu <wei.liu2@citrix.com>
---
 xen/arch/x86/pv/shim.c | 26 ++++++++++++++++----------
 1 file changed, 16 insertions(+), 10 deletions(-)

diff --git a/xen/arch/x86/pv/shim.c b/xen/arch/x86/pv/shim.c
index 903562e8e4..d5383dcfc7 100644
--- a/xen/arch/x86/pv/shim.c
+++ b/xen/arch/x86/pv/shim.c
@@ -37,6 +37,11 @@
 
 #include <compat/grant_table.h>
 
+#undef mfn_to_page
+#define mfn_to_page(mfn) __mfn_to_page(mfn_x(mfn))
+#undef virt_to_mfn
+#define virt_to_mfn(va) _mfn(__virt_to_mfn(va))
+
 #ifndef CONFIG_PV_SHIM_EXCLUSIVE
 bool pv_shim;
 boolean_param("pv-shim", pv_shim);
@@ -115,17 +120,17 @@ uint64_t pv_shim_mem(uint64_t avail)
 #define COMPAT_L1_PROT (_PAGE_PRESENT|_PAGE_RW|_PAGE_ACCESSED)
 
 static void __init replace_va_mapping(struct domain *d, l4_pgentry_t *l4start,
-                                      unsigned long va, unsigned long mfn)
+                                      unsigned long va, mfn_t mfn)
 {
     l4_pgentry_t *pl4e = l4start + l4_table_offset(va);
     l3_pgentry_t *pl3e = l4e_to_l3e(*pl4e) + l3_table_offset(va);
     l2_pgentry_t *pl2e = l3e_to_l2e(*pl3e) + l2_table_offset(va);
     l1_pgentry_t *pl1e = l2e_to_l1e(*pl2e) + l1_table_offset(va);
-    struct page_info *page = mfn_to_page(l1e_get_pfn(*pl1e));
+    struct page_info *page = mfn_to_page(l1e_get_mfn(*pl1e));
 
     put_page_and_type(page);
 
-    *pl1e = l1e_from_pfn(mfn, (!is_pv_32bit_domain(d) ? L1_PROT
+    *pl1e = l1e_from_mfn(mfn, (!is_pv_32bit_domain(d) ? L1_PROT
                                                       : COMPAT_L1_PROT));
 }
 
@@ -165,8 +170,9 @@ void __init pv_shim_setup_dom(struct domain *d, l4_pgentry_t *l4start,
     (si) = param;                                                              \
     if ( va )                                                                  \
     {                                                                          \
-        share_xen_page_with_guest(mfn_to_page(param), d, XENSHARE_writable);   \
-        replace_va_mapping(d, l4start, va, param);                             \
+        share_xen_page_with_guest(mfn_to_page(_mfn(param)), d,                 \
+                                  XENSHARE_writable);                          \
+        replace_va_mapping(d, l4start, va, _mfn(param));                       \
         dom0_update_physmap(d, PFN_DOWN((va) - va_start), param, vphysmap);    \
     }                                                                          \
     else                                                                       \
@@ -186,17 +192,17 @@ void __init pv_shim_setup_dom(struct domain *d, l4_pgentry_t *l4start,
     {
         /* Allocate a new page for DomU's PV console */
         void *page = alloc_xenheap_pages(0, MEMF_bits(32));
-        uint64_t console_mfn;
+        mfn_t console_mfn;
 
         ASSERT(page);
         clear_page(page);
         console_mfn = virt_to_mfn(page);
-        si->console.domU.mfn = console_mfn;
+        si->console.domU.mfn = mfn_x(console_mfn);
         share_xen_page_with_guest(mfn_to_page(console_mfn), d,
                                   XENSHARE_writable);
         replace_va_mapping(d, l4start, console_va, console_mfn);
         dom0_update_physmap(d, (console_va - va_start) >> PAGE_SHIFT,
-                            console_mfn, vphysmap);
+                            mfn_x(console_mfn), vphysmap);
         consoled_set_ring_addr(page);
     }
     pv_hypercall_table_replace(__HYPERVISOR_event_channel_op,
@@ -232,7 +238,7 @@ static void write_start_info(struct domain *d)
     BUG_ON(xen_hypercall_hvm_get_param(HVM_PARAM_CONSOLE_EVTCHN, &param));
     si->console.domU.evtchn = param;
     if ( pv_console )
-        si->console.domU.mfn = virt_to_mfn(consoled_get_ring_addr());
+        si->console.domU.mfn = mfn_x(virt_to_mfn(consoled_get_ring_addr()));
     else if ( xen_hypercall_hvm_get_param(HVM_PARAM_CONSOLE_PFN,
                                           &si->console.domU.mfn) )
         BUG();
@@ -334,7 +340,7 @@ int pv_shim_shutdown(uint8_t reason)
     if ( d->arch.pirq_eoi_map != NULL )
     {
         unmap_domain_page_global(d->arch.pirq_eoi_map);
-        put_page_and_type(mfn_to_page(d->arch.pirq_eoi_map_mfn));
+        put_page_and_type(mfn_to_page(_mfn(d->arch.pirq_eoi_map_mfn)));
         d->arch.pirq_eoi_map = NULL;
         d->arch.pirq_eoi_map_mfn = 0;
         d->arch.auto_unmask = 0;
-- 
2.15.1


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH v3 7/7] xen/pvshim: switch shim.c to use typesafe mfn_to_page and virt_to_mfn
  2018-01-18 11:02 ` [PATCH v3 7/7] xen/pvshim: switch shim.c to use typesafe mfn_to_page and virt_to_mfn Roger Pau Monne
@ 2018-01-18 11:06   ` Andrew Cooper
  2018-01-18 11:12   ` Wei Liu
  1 sibling, 0 replies; 12+ messages in thread
From: Andrew Cooper @ 2018-01-18 11:06 UTC (permalink / raw)
  To: Roger Pau Monne, xen-devel; +Cc: Wei Liu, Jan Beulich

On 18/01/18 11:02, Roger Pau Monne wrote:
> No functional change intended.
>
> Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
> Requested-by: Andrew Cooper <andrew.cooper3@citrix.com>
> ---
> Cc: Jan Beulich <jbeulich@suse.com>
> Cc: Andrew Cooper <andrew.cooper3@citrix.com>
> Cc: Wei Liu <wei.liu2@citrix.com>

Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>

Thanks.

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v3 7/7] xen/pvshim: switch shim.c to use typesafe mfn_to_page and virt_to_mfn
  2018-01-18 11:02 ` [PATCH v3 7/7] xen/pvshim: switch shim.c to use typesafe mfn_to_page and virt_to_mfn Roger Pau Monne
  2018-01-18 11:06   ` Andrew Cooper
@ 2018-01-18 11:12   ` Wei Liu
  1 sibling, 0 replies; 12+ messages in thread
From: Wei Liu @ 2018-01-18 11:12 UTC (permalink / raw)
  To: Roger Pau Monne; +Cc: xen-devel, Wei Liu, Jan Beulich, Andrew Cooper

On Thu, Jan 18, 2018 at 11:02:52AM +0000, Roger Pau Monne wrote:
> No functional change intended.
> 
> Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
> Requested-by: Andrew Cooper <andrew.cooper3@citrix.com>

Reviewed-by: Wei Liu <wei.liu2@citrix.com>

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v3 6/7] firmware/shim: fix build process to use POSIX find options
  2018-01-18 11:02 ` [PATCH v3 6/7] firmware/shim: fix build process to use POSIX find options Roger Pau Monne
@ 2018-01-18 11:13   ` Ian Jackson
  2018-01-18 11:14   ` Wei Liu
  1 sibling, 0 replies; 12+ messages in thread
From: Ian Jackson @ 2018-01-18 11:13 UTC (permalink / raw)
  To: Roger Pau Monne; +Cc: xen-devel, Wei Liu

Roger Pau Monne writes ("[PATCH v3 6/7] firmware/shim: fix build process to use POSIX find options"):
> The -printf find option is not POSIX compatible, so replace it with
> another rune.

Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v3 6/7] firmware/shim: fix build process to use POSIX find options
  2018-01-18 11:02 ` [PATCH v3 6/7] firmware/shim: fix build process to use POSIX find options Roger Pau Monne
  2018-01-18 11:13   ` Ian Jackson
@ 2018-01-18 11:14   ` Wei Liu
  1 sibling, 0 replies; 12+ messages in thread
From: Wei Liu @ 2018-01-18 11:14 UTC (permalink / raw)
  To: Roger Pau Monne; +Cc: xen-devel, Ian Jackson, Wei Liu

On Thu, Jan 18, 2018 at 11:02:51AM +0000, Roger Pau Monne wrote:
> The -printf find option is not POSIX compatible, so replace it with
> another rune.
> 
> Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>


Acked-by: Wei Liu <wei.liu2@citrix.com>

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2018-01-18 11:14 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-18 11:02 [PATCH v3 0/7] xen/pvshim: fixes for staging Roger Pau Monne
2018-01-18 11:02 ` [PATCH v3 1/7] xen/pvshim: map vcpu_info earlier for APs Roger Pau Monne
2018-01-18 11:02 ` [PATCH v3 2/7] xen/pvh: place the trampoline starting at MFN 1 Roger Pau Monne
2018-01-18 11:02 ` [PATCH v3 3/7] xen/pvshim: identity pin shim vCPUs to pCPUs Roger Pau Monne
2018-01-18 11:02 ` [PATCH v3 4/7] xen/pvshim: re-order replace_va_mapping code Roger Pau Monne
2018-01-18 11:02 ` [PATCH v3 5/7] xen/pvshim: fix coding style issues Roger Pau Monne
2018-01-18 11:02 ` [PATCH v3 6/7] firmware/shim: fix build process to use POSIX find options Roger Pau Monne
2018-01-18 11:13   ` Ian Jackson
2018-01-18 11:14   ` Wei Liu
2018-01-18 11:02 ` [PATCH v3 7/7] xen/pvshim: switch shim.c to use typesafe mfn_to_page and virt_to_mfn Roger Pau Monne
2018-01-18 11:06   ` Andrew Cooper
2018-01-18 11:12   ` Wei Liu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.