Skip to content

add new p2m type class and new p2m type

Yu Zhang xen-devel 3 versions – New

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v7 Latest2 patches 0 repliesNew
  2. v62 patches 7 repliesSuperseded
  3. v52 patches 4 repliesSuperseded

Changes in v7 from the cover letter

- Handle the new p2m type in the shadow-pagetable code.

Patches in v7 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2add a new p2m type class - P2M_DISCARD_WRITE_TYPESxen/arch/x86/hvm/hvm.c xen/arch/x86/mm/shadow/multi.c xen/include/asm-x86/p2m.h+9 -140 replies
2/2add a new p2m type - p2m_mmio_write_dmxen/arch/x86/hvm/hvm.c xen/arch/x86/mm/p2m-ept.c xen/arch/x86/mm/p2m-pt.c +3 more+16 -50 replies

Reviews trailers per patch

All 2 patches have a Reviewed-by or Acked-by.

PatchTim DeeganJan Beulich
1/2R-b
2/2R-b R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v7 thread

Cover letter [PATCH v7 0/2] add new p2m type class and new p2m type

XenGT (Intel Graphics Virtualization technology, please refer to
https://01.org/xen/blogs/srclarkx/2013/graphics-virtualization-
xengt) driver runs inside Dom0 as a virtual graphics device model, and needs to trap and emulate the guest's write operations to some specific memory pages, like memory pages used by guest graphics driver as PPGTT(per-process graphics translation table). We added a new p2m type, p2m_mmio_write_dm, to trap and emulate the write operations on these graphic page tables.

Handling of this new p2m type are similar with existing p2m_ram_ro in most condition checks, with only difference on final policy of emulation vs. drop. For p2m_ram_ro types, write operations will not trigger the device model, and will be discarded later in __hvm_copy(); while for the p2m_mmio_write_dm type pages, writes will go to the device model via ioreq-server.

Previously, the conclusion in our v3 patch review is to provide a more generalized HVMOP_map_io_range_to_ioreq_server hypercall, by seperating rangesets inside a ioreq server to read-protected/write- protected/both-prtected. Yet, after offline discussion with Paul, we believe a more simplified solution may suffice. We can keep the existing HVMOP_map_io_range_to_ioreq_server hypercall, and let the user decide whether or not a p2m type change is necessary, because in most cases the emulator will already use the p2m_mmio_dm type.

Changes from v6:
- Handle the new p2m type in the shadow-pagetable code.

Changes from v5:
- Stricter type checks for p2m type transitions;
- One code style change.

Changes from v4:
- A new p2m type class, P2M_DISCARD_WRITE_TYPES, is added;
- A new predicate, p2m_is_discard_write, is used in __hvm_copy()/ __hvm_clear()/emulate_gva_to_mfn()/hvm_hap_nested_page_fault(), to discard the write operations;
- The new p2m type, p2m_mmio_write_dm, is added to P2M_RO_TYPES;
- Coding style changes;

Changes from v3:
- Use the existing HVMOP_map_io_range_to_ioreq_server hypercall to add write protected range;
- Modify the HVMOP_set_mem_type hypercall to support the new p2m type for this range.

Changes from v2:
- Remove excute attribute of the new p2m type p2m_mmio_write_dm;
- Use existing rangeset for keeping the write protection page range instead of introducing hash table;
- Some code style fix.

Changes from v1:
- Changes the new p2m type name from p2m_ram_wp to p2m_mmio_write_dm. This means that we treat the pages as a special mmio range instead of ram;
- Move macros to c file since only this file is using them.
- Address various comments from Jan.

Yu Zhang (2):
Add a new p2m type class - P2M_DISCARD_WRITE_TYPES add a new p2m type - p2m_mmio_write_dm

 xen/arch/x86/hvm/hvm.c          | 25 ++++++++++---------------
 xen/arch/x86/mm/p2m-ept.c       |  1 +
 xen/arch/x86/mm/p2m-pt.c        |  1 +
 xen/arch/x86/mm/shadow/multi.c  |  2 +-
 xen/include/asm-x86/p2m.h       |  9 ++++++++-
 xen/include/public/hvm/hvm_op.h |  1 +
 6 files changed, 22 insertions(+), 17 deletions(-)
Signature · 1 line
1.9.1