* [PATCH] Remove HVMMEM_mmio_write_dm from the public interface(patch for 4.7.0).
@ 2016-04-28 8:21 Yu Zhang
2016-04-28 8:30 ` Yu, Zhang
0 siblings, 1 reply; 2+ messages in thread
From: Yu Zhang @ 2016-04-28 8:21 UTC (permalink / raw)
To: xen-devel
Cc: Wei Liu, George Dunlap, Andrew Cooper, Paul Durrant, zhiyuan.lv,
Jan Beulich
HVMMEM_mmio_write_dm is removed for new xen interface versions, and
is replaced with type HVMMEM_unused. Attempts to set a page to this
type will return -EINVAL in xen after 4.7.0. And there will be no
pages with type p2m_mmio_write_dm, therefore HVMOP_get_mem_type will
never get the old type - HVMMEM_mmio_write_dm.
New approaches to write protect guest ram pages will be provided in
future patches.
Signed-off-by: Yu Zhang <yu.c.zhang@linux.intel.com>
---
Cc: Jan Beulich <jbeulich@suse.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: George Dunlap <george.dunlap@eu.citrix.com>
Cc: Paul Durrant <paul.durrant@citrix.com>
Cc: Wei Liu <wei.liu2@citrix.com>
---
xen/arch/x86/hvm/hvm.c | 7 +++----
xen/include/public/hvm/hvm_op.h | 5 +++++
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index 8cb6e9e..82e2ed1 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -5497,8 +5497,6 @@ long do_hvm_op(unsigned long op, XEN_GUEST_HANDLE_PARAM(void) arg)
get_gfn_query_unlocked(d, a.pfn, &t);
if ( p2m_is_mmio(t) )
a.mem_type = HVMMEM_mmio_dm;
- else if ( t == p2m_mmio_write_dm )
- a.mem_type = HVMMEM_mmio_write_dm;
else if ( p2m_is_readonly(t) )
a.mem_type = HVMMEM_ram_ro;
else if ( p2m_is_ram(t) )
@@ -5529,7 +5527,7 @@ long do_hvm_op(unsigned long op, XEN_GUEST_HANDLE_PARAM(void) arg)
[HVMMEM_ram_rw] = p2m_ram_rw,
[HVMMEM_ram_ro] = p2m_ram_ro,
[HVMMEM_mmio_dm] = p2m_mmio_dm,
- [HVMMEM_mmio_write_dm] = p2m_mmio_write_dm
+ [HVMMEM_unused] = p2m_invalid
};
if ( copy_from_guest(&a, arg, 1) )
@@ -5553,7 +5551,8 @@ long do_hvm_op(unsigned long op, XEN_GUEST_HANDLE_PARAM(void) arg)
((a.first_pfn + a.nr - 1) > domain_get_maximum_gpfn(d)) )
goto setmemtype_fail;
- if ( a.hvmmem_type >= ARRAY_SIZE(memtype) )
+ if ( a.hvmmem_type >= ARRAY_SIZE(memtype) ||
+ unlikely(a.hvmmem_type == HVMMEM_unused) )
goto setmemtype_fail;
while ( a.nr > start_iter )
diff --git a/xen/include/public/hvm/hvm_op.h b/xen/include/public/hvm/hvm_op.h
index 1606185..ebb907a 100644
--- a/xen/include/public/hvm/hvm_op.h
+++ b/xen/include/public/hvm/hvm_op.h
@@ -83,7 +83,12 @@ typedef enum {
HVMMEM_ram_rw, /* Normal read/write guest RAM */
HVMMEM_ram_ro, /* Read-only; writes are discarded */
HVMMEM_mmio_dm, /* Reads and write go to the device model */
+#if __XEN_INTERFACE_VERSION__ < 0x00040700
HVMMEM_mmio_write_dm /* Read-only; writes go to the device model */
+#else
+ HVMMEM_unused /* Placeholder; setting memory to this type
+ will fail for code after 4.7.0 */
+#endif
} hvmmem_type_t;
/* Following tools-only interfaces may change in future. */
--
1.9.1
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] Remove HVMMEM_mmio_write_dm from the public interface(patch for 4.7.0).
2016-04-28 8:21 [PATCH] Remove HVMMEM_mmio_write_dm from the public interface(patch for 4.7.0) Yu Zhang
@ 2016-04-28 8:30 ` Yu, Zhang
0 siblings, 0 replies; 2+ messages in thread
From: Yu, Zhang @ 2016-04-28 8:30 UTC (permalink / raw)
To: xen-devel
Cc: Wei Liu, George Dunlap, Andrew Cooper, Paul Durrant, zhiyuan.lv,
Jan Beulich
Sorry, please ignore this patch due to incorrect header.
Will send another one.
On 4/28/2016 4:21 PM, Yu Zhang wrote:
> HVMMEM_mmio_write_dm is removed for new xen interface versions, and
> is replaced with type HVMMEM_unused. Attempts to set a page to this
> type will return -EINVAL in xen after 4.7.0. And there will be no
> pages with type p2m_mmio_write_dm, therefore HVMOP_get_mem_type will
> never get the old type - HVMMEM_mmio_write_dm.
>
> New approaches to write protect guest ram pages will be provided in
> future patches.
>
> Signed-off-by: Yu Zhang <yu.c.zhang@linux.intel.com>
> ---
> Cc: Jan Beulich <jbeulich@suse.com>
> Cc: Andrew Cooper <andrew.cooper3@citrix.com>
> Cc: George Dunlap <george.dunlap@eu.citrix.com>
> Cc: Paul Durrant <paul.durrant@citrix.com>
> Cc: Wei Liu <wei.liu2@citrix.com>
> ---
> xen/arch/x86/hvm/hvm.c | 7 +++----
> xen/include/public/hvm/hvm_op.h | 5 +++++
> 2 files changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
> index 8cb6e9e..82e2ed1 100644
> --- a/xen/arch/x86/hvm/hvm.c
> +++ b/xen/arch/x86/hvm/hvm.c
> @@ -5497,8 +5497,6 @@ long do_hvm_op(unsigned long op, XEN_GUEST_HANDLE_PARAM(void) arg)
> get_gfn_query_unlocked(d, a.pfn, &t);
> if ( p2m_is_mmio(t) )
> a.mem_type = HVMMEM_mmio_dm;
> - else if ( t == p2m_mmio_write_dm )
> - a.mem_type = HVMMEM_mmio_write_dm;
> else if ( p2m_is_readonly(t) )
> a.mem_type = HVMMEM_ram_ro;
> else if ( p2m_is_ram(t) )
> @@ -5529,7 +5527,7 @@ long do_hvm_op(unsigned long op, XEN_GUEST_HANDLE_PARAM(void) arg)
> [HVMMEM_ram_rw] = p2m_ram_rw,
> [HVMMEM_ram_ro] = p2m_ram_ro,
> [HVMMEM_mmio_dm] = p2m_mmio_dm,
> - [HVMMEM_mmio_write_dm] = p2m_mmio_write_dm
> + [HVMMEM_unused] = p2m_invalid
> };
>
> if ( copy_from_guest(&a, arg, 1) )
> @@ -5553,7 +5551,8 @@ long do_hvm_op(unsigned long op, XEN_GUEST_HANDLE_PARAM(void) arg)
> ((a.first_pfn + a.nr - 1) > domain_get_maximum_gpfn(d)) )
> goto setmemtype_fail;
>
> - if ( a.hvmmem_type >= ARRAY_SIZE(memtype) )
> + if ( a.hvmmem_type >= ARRAY_SIZE(memtype) ||
> + unlikely(a.hvmmem_type == HVMMEM_unused) )
> goto setmemtype_fail;
>
> while ( a.nr > start_iter )
> diff --git a/xen/include/public/hvm/hvm_op.h b/xen/include/public/hvm/hvm_op.h
> index 1606185..ebb907a 100644
> --- a/xen/include/public/hvm/hvm_op.h
> +++ b/xen/include/public/hvm/hvm_op.h
> @@ -83,7 +83,12 @@ typedef enum {
> HVMMEM_ram_rw, /* Normal read/write guest RAM */
> HVMMEM_ram_ro, /* Read-only; writes are discarded */
> HVMMEM_mmio_dm, /* Reads and write go to the device model */
> +#if __XEN_INTERFACE_VERSION__ < 0x00040700
> HVMMEM_mmio_write_dm /* Read-only; writes go to the device model */
> +#else
> + HVMMEM_unused /* Placeholder; setting memory to this type
> + will fail for code after 4.7.0 */
> +#endif
> } hvmmem_type_t;
>
> /* Following tools-only interfaces may change in future. */
>
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-04-28 8:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-28 8:21 [PATCH] Remove HVMMEM_mmio_write_dm from the public interface(patch for 4.7.0) Yu Zhang
2016-04-28 8:30 ` Yu, Zhang
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.