[PATCH v4 0/9] x86/hvm: Add Extended MSI destination ID support

Julian Vetter posted 9 patches 1 week ago
Only 0 patches received!
tools/include/xendevicemodel.h          |  34 +-
tools/libs/ctrl/xc_devicemodel_compat.c |   2 +-
tools/libs/ctrl/xc_domain.c             |  52 ++--
tools/libs/devicemodel/core.c           |  41 ++-
xen/arch/arm/ioreq.c                    |   5 +
xen/arch/x86/cpuid.c                    |  13 +
xen/arch/x86/domain.c                   |  10 +
xen/arch/x86/domctl.c                   |  10 +-
xen/arch/x86/hvm/dm.c                   |  68 ++++
xen/arch/x86/hvm/ioreq.c                |  37 +++
xen/arch/x86/hvm/irq.c                  |   9 +-
xen/arch/x86/hvm/vioapic.c              |  50 ++-
xen/arch/x86/hvm/vmsi.c                 |  54 +---
xen/arch/x86/include/asm/hvm/domain.h   |   9 +
xen/arch/x86/include/asm/hvm/hvm.h      |   4 +-
xen/arch/x86/include/asm/hvm/irq.h      |   4 +-
xen/arch/x86/include/asm/hvm/vioapic.h  |  12 +
xen/arch/x86/include/asm/msi.h          |  18 +-
xen/common/ioreq.c                      |  13 +-
xen/drivers/passthrough/x86/hvm.c       | 396 ++++++++++++++----------
xen/include/public/arch-x86/hvm/save.h  |  21 +-
xen/include/public/hvm/dm_op.h          |  53 +++-
xen/include/xen/iommu.h                 |   3 +
xen/include/xen/ioreq.h                 |  27 ++
xen/include/xlat.lst                    |   2 +
25 files changed, 703 insertions(+), 244 deletions(-)
[PATCH v4 0/9] x86/hvm: Add Extended MSI destination ID support
Posted by Julian Vetter 1 week ago
Thank you very much Roger and Jan for your feedback! I have addressed
your feedback, see below. For me there is only one question, I'm not
sure if this is what you had in mind Roger when you wrote:
"Retrofitting the new interface into the old one seems weird.  I would
do it the other way around - implement the old bind domctl on top of
an interface that's more suited for the new DM op."
It requires some preparatory work. But I tried to make the
restructunring diffs as easy to review as possible by splitting the
refactoring into mutliple steps.

Signed-off-by: Julian Vetter <julian.vetter@vates.tech>
---
Changes in v4:
- Replaced the v3 approach of extending the XEN_DOMCTL_bind_pt_irq
  gflags ABI (XEN_DOMCTL_VMSI_X86_EXT_DEST_ID_MASK / VMSI_X86_FULL_DEST)
  with raw MSI addr + data storage throughout. pt_irq_bind_msi() now
  accepts the raw address + data values and decodes the destination
  internally. No public domctl ABI changes
- As suggested by Roger, replaced XEN_DMOP_enable_ext_dest_id (v3 patch
  6, a separate call before domain start) with a flags byte from the
  existing pad[3] field of XEN_DMOP_create_ioreq_server. The new
  XEN_DMOP_IOREQ_SERVER_EXT_DEST_ID flag lets each server signal support
  at registration time and allows the feature to be levelled across all
  servers before arch_domain_creation_finished()
- Redirect xc_domain_{update,unbind}_msi_irq() in libxenctrl to use the
  new DM ops, and reject PT_IRQ_TYPE_MSI in
  XEN_DOMCTL_{bind,unbind}_pt_irq (as suggested by Jan)
- Add three preparatory no-functional-change commits (patches 2-4) that
  wrap the restart block in braces, extract pt_irq_dpci_setup(), and
  extract the PT_IRQ_TYPE_MSI case body into pt_irq_bind_msi(), making
  the interface change in patch 5 reviewable as a clean diff
- Rework ioapic_check() to validate named fields (base_address, APIC ID
  width, ioregsel range) instead of rejecting any non-zero reserved
  bits, which would have falsely rejected RTEs carrying extended
  destination IDs
---
Julian Vetter (9):
  x86/vioapic: Add ioapic_check() to validate IO-APIC state before
    restore
  x86/passthrough: Wrap pt_irq_create_bind() restart block in braces
  x86/passthrough: Extract pt_irq_dpci_setup() from pt_irq_create_bind()
  x86/passthrough: Extract PT_IRQ_TYPE_MSI body into pt_irq_bind_msi()
  x86/passthrough: Introduce pt_irq_bind_msi() as canonical MSI bind
    path
  x86/hvm: Support extended destination IDs in virtual MSI and IO-APIC
  x86/dmop: Add XEN_DMOP_{bind,unbind}_pt_msi_irq DM ops
  hvm/ioreq: Negotiate extended destination ID support per ioreq server
  x86/cpuid: Advertise XEN_HVM_CPUID_EXT_DEST_ID when device model opts
    in

 tools/include/xendevicemodel.h          |  34 +-
 tools/libs/ctrl/xc_devicemodel_compat.c |   2 +-
 tools/libs/ctrl/xc_domain.c             |  52 ++--
 tools/libs/devicemodel/core.c           |  41 ++-
 xen/arch/arm/ioreq.c                    |   5 +
 xen/arch/x86/cpuid.c                    |  13 +
 xen/arch/x86/domain.c                   |  10 +
 xen/arch/x86/domctl.c                   |  10 +-
 xen/arch/x86/hvm/dm.c                   |  68 ++++
 xen/arch/x86/hvm/ioreq.c                |  37 +++
 xen/arch/x86/hvm/irq.c                  |   9 +-
 xen/arch/x86/hvm/vioapic.c              |  50 ++-
 xen/arch/x86/hvm/vmsi.c                 |  54 +---
 xen/arch/x86/include/asm/hvm/domain.h   |   9 +
 xen/arch/x86/include/asm/hvm/hvm.h      |   4 +-
 xen/arch/x86/include/asm/hvm/irq.h      |   4 +-
 xen/arch/x86/include/asm/hvm/vioapic.h  |  12 +
 xen/arch/x86/include/asm/msi.h          |  18 +-
 xen/common/ioreq.c                      |  13 +-
 xen/drivers/passthrough/x86/hvm.c       | 396 ++++++++++++++----------
 xen/include/public/arch-x86/hvm/save.h  |  21 +-
 xen/include/public/hvm/dm_op.h          |  53 +++-
 xen/include/xen/iommu.h                 |   3 +
 xen/include/xen/ioreq.h                 |  27 ++
 xen/include/xlat.lst                    |   2 +
 25 files changed, 703 insertions(+), 244 deletions(-)

-- 
2.53.0



-- 
Julian Vetter | Vates Hypervisor & Kernel Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech