From: Roger Pau Monne <roger.pau@citrix.com>
To: xen-devel@lists.xenproject.org
Cc: Andrew Cooper <andrew.cooper3@citrix.com>,
boris.ostrovsky@oracle.com,
Roger Pau Monne <roger.pau@citrix.com>,
Jan Beulich <jbeulich@suse.com>,
konrad.wilk@oracle.com
Subject: [PATCH v5 1/9] xen/x86: remove XENFEAT_hvm_pirqs for PVHv2 guests
Date: Thu, 19 Jan 2017 17:29:33 +0000 [thread overview]
Message-ID: <20170119172941.65642-2-roger.pau@citrix.com> (raw)
In-Reply-To: <20170119172941.65642-1-roger.pau@citrix.com>
PVHv2 guests, unlike HVM guests, won't have the option to route interrupts
from physical or emulated devices over event channels using PIRQs. This
applies to both DomU and Dom0 PVHv2 guests.
Introduce a new XEN_X86_EMU_USE_PIRQ to notify Xen whether a HVM guest can
route physical interrupts (even from emulated devices) over event channels,
and is thus allowed to use some of the PHYSDEV ops.
Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
---
Cc: Jan Beulich <jbeulich@suse.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
---
Changes since v3:
- Update docs.
Changes since v2:
- Change local variable name to currd instead of d.
- Use currd where it makes sense.
---
docs/misc/hvmlite.markdown | 20 ++++++++++++++++++++
xen/arch/x86/hvm/hvm.c | 25 ++++++++++++++++---------
xen/arch/x86/physdev.c | 5 +++--
xen/common/kernel.c | 3 ++-
xen/include/public/arch-x86/xen.h | 4 +++-
5 files changed, 44 insertions(+), 13 deletions(-)
diff --git a/docs/misc/hvmlite.markdown b/docs/misc/hvmlite.markdown
index 898b8ee..b2557f7 100644
--- a/docs/misc/hvmlite.markdown
+++ b/docs/misc/hvmlite.markdown
@@ -75,3 +75,23 @@ info structure that's passed at boot time (field rsdp_paddr).
Description of paravirtualized devices will come from XenStore, just as it's
done for HVM guests.
+
+## Interrupts ##
+
+### Interrupts from physical devices ###
+
+Interrupts from physical devices are delivered using native methods, this is
+done in order to take advantage of new hardware assisted virtualization
+functions, like posted interrupts. This implies that PVHv2 guests with physical
+devices will also have the necessary interrupt controllers in order to manage
+the delivery of interrupts from those devices, using the same interfaces that
+are available on native hardware.
+
+### Interrupts from paravirtualized devices ###
+
+Interrupts from paravirtualized devices are delivered using event channels, see
+[Event Channel Internals][event_channels] for more detailed information about
+event channels. Delivery of those interrupts can be configured in the same way
+as HVM guests, check xen/include/public/hvm/params.h and
+xen/include/public/hvm/hvm_op.h for more information about available delivery
+methods.
diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index 63748dc..41a44c9 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -3757,10 +3757,12 @@ static long hvm_memory_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
static long hvm_physdev_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
{
+ struct domain *currd = current->domain;
+
switch ( cmd )
{
default:
- if ( !is_pvh_vcpu(current) || !is_hardware_domain(current->domain) )
+ if ( !is_pvh_domain(currd) || !is_hardware_domain(currd) )
return -ENOSYS;
/* fall through */
case PHYSDEVOP_map_pirq:
@@ -3768,7 +3770,9 @@ static long hvm_physdev_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
case PHYSDEVOP_eoi:
case PHYSDEVOP_irq_status_query:
case PHYSDEVOP_get_free_pirq:
- return do_physdev_op(cmd, arg);
+ return ((currd->arch.emulation_flags & XEN_X86_EMU_USE_PIRQ) ||
+ is_pvh_domain(currd)) ?
+ do_physdev_op(cmd, arg) : -ENOSYS;
}
}
@@ -3801,17 +3805,20 @@ static long hvm_memory_op_compat32(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
static long hvm_physdev_op_compat32(
int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
{
+ struct domain *d = current->domain;
+
switch ( cmd )
{
- case PHYSDEVOP_map_pirq:
- case PHYSDEVOP_unmap_pirq:
- case PHYSDEVOP_eoi:
- case PHYSDEVOP_irq_status_query:
- case PHYSDEVOP_get_free_pirq:
- return compat_physdev_op(cmd, arg);
+ case PHYSDEVOP_map_pirq:
+ case PHYSDEVOP_unmap_pirq:
+ case PHYSDEVOP_eoi:
+ case PHYSDEVOP_irq_status_query:
+ case PHYSDEVOP_get_free_pirq:
+ return (d->arch.emulation_flags & XEN_X86_EMU_USE_PIRQ) ?
+ compat_physdev_op(cmd, arg) : -ENOSYS;
break;
default:
- return -ENOSYS;
+ return -ENOSYS;
break;
}
}
diff --git a/xen/arch/x86/physdev.c b/xen/arch/x86/physdev.c
index 5a49796..0bea6e1 100644
--- a/xen/arch/x86/physdev.c
+++ b/xen/arch/x86/physdev.c
@@ -94,7 +94,8 @@ int physdev_map_pirq(domid_t domid, int type, int *index, int *pirq_p,
int pirq, irq, ret = 0;
void *map_data = NULL;
- if ( domid == DOMID_SELF && is_hvm_domain(d) )
+ if ( domid == DOMID_SELF && is_hvm_domain(d) &&
+ (d->arch.emulation_flags & XEN_X86_EMU_USE_PIRQ) )
{
/*
* Only makes sense for vector-based callback, else HVM-IRQ logic
@@ -265,7 +266,7 @@ int physdev_unmap_pirq(domid_t domid, int pirq)
if ( ret )
goto free_domain;
- if ( is_hvm_domain(d) )
+ if ( is_hvm_domain(d) && (d->arch.emulation_flags & XEN_X86_EMU_USE_PIRQ) )
{
spin_lock(&d->event_lock);
if ( domain_pirq_to_emuirq(d, pirq) != IRQ_UNBOUND )
diff --git a/xen/common/kernel.c b/xen/common/kernel.c
index d0edb13..a82f55f 100644
--- a/xen/common/kernel.c
+++ b/xen/common/kernel.c
@@ -332,7 +332,8 @@ DO(xen_version)(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
case guest_type_hvm:
fi.submap |= (1U << XENFEAT_hvm_safe_pvclock) |
(1U << XENFEAT_hvm_callback_vector) |
- (1U << XENFEAT_hvm_pirqs);
+ ((d->arch.emulation_flags & XEN_X86_EMU_USE_PIRQ) ?
+ (1U << XENFEAT_hvm_pirqs) : 0);
break;
}
#endif
diff --git a/xen/include/public/arch-x86/xen.h b/xen/include/public/arch-x86/xen.h
index 363c8cc..73c829a 100644
--- a/xen/include/public/arch-x86/xen.h
+++ b/xen/include/public/arch-x86/xen.h
@@ -293,12 +293,14 @@ struct xen_arch_domainconfig {
#define XEN_X86_EMU_IOMMU (1U<<_XEN_X86_EMU_IOMMU)
#define _XEN_X86_EMU_PIT 8
#define XEN_X86_EMU_PIT (1U<<_XEN_X86_EMU_PIT)
+#define _XEN_X86_EMU_USE_PIRQ 9
+#define XEN_X86_EMU_USE_PIRQ (1U<<_XEN_X86_EMU_USE_PIRQ)
#define XEN_X86_EMU_ALL (XEN_X86_EMU_LAPIC | XEN_X86_EMU_HPET | \
XEN_X86_EMU_PM | XEN_X86_EMU_RTC | \
XEN_X86_EMU_IOAPIC | XEN_X86_EMU_PIC | \
XEN_X86_EMU_VGA | XEN_X86_EMU_IOMMU | \
- XEN_X86_EMU_PIT)
+ XEN_X86_EMU_PIT | XEN_X86_EMU_USE_PIRQ)
uint32_t emulation_flags;
};
--
2.10.1 (Apple Git-78)
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
next prev parent reply other threads:[~2017-01-19 17:29 UTC|newest]
Thread overview: 68+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-19 17:29 [PATCH v5 0/9] Initial PVHv2 Dom0 support Roger Pau Monne
2017-01-19 17:29 ` Roger Pau Monne [this message]
2017-01-20 18:41 ` [PATCH v5 1/9] xen/x86: remove XENFEAT_hvm_pirqs for PVHv2 guests Andrew Cooper
2017-01-23 12:28 ` Roger Pau Monne
2017-01-19 17:29 ` [PATCH v5 2/9] x86/iommu: add IOMMU entries for p2m_mmio_direct pages Roger Pau Monne
2017-01-20 6:41 ` Tian, Kevin
2017-01-20 10:28 ` Roger Pau Monne
2017-01-20 18:44 ` Andrew Cooper
2017-01-22 4:45 ` Tian, Kevin
2017-01-19 17:29 ` [PATCH v5 3/9] xen/x86: split Dom0 build into PV and PVHv2 Roger Pau Monne
2017-01-20 19:03 ` Andrew Cooper
2017-01-23 12:58 ` Roger Pau Monne
2017-01-23 12:59 ` Andrew Cooper
2017-01-20 19:13 ` Boris Ostrovsky
2017-01-20 19:27 ` Andrew Cooper
2017-01-26 11:43 ` Jan Beulich
2017-01-26 16:36 ` Roger Pau Monne
2017-01-19 17:29 ` [PATCH v5 4/9] xen/x86: populate PVHv2 Dom0 physical memory map Roger Pau Monne
2017-01-20 19:41 ` Andrew Cooper
2017-01-23 11:23 ` Jan Beulich
2017-01-23 14:11 ` Boris Ostrovsky
2017-01-23 14:43 ` Roger Pau Monne
2017-01-26 12:41 ` Jan Beulich
2017-01-27 11:14 ` Tim Deegan
2017-01-27 12:37 ` Roger Pau Monne
2017-01-27 12:51 ` Andrew Cooper
2017-01-27 13:20 ` Tim Deegan
2017-01-27 13:46 ` Andrew Cooper
2017-01-27 14:01 ` Tim Deegan
2017-01-27 14:35 ` Andrew Cooper
2017-01-27 19:43 ` Tim Deegan
2017-01-30 10:43 ` Jan Beulich
2017-01-30 11:06 ` Andrew Cooper
2017-01-27 16:40 ` Jan Beulich
2017-01-27 18:06 ` Andrew Cooper
2017-02-03 13:57 ` Jan Beulich
2017-01-27 19:48 ` Tim Deegan
2017-02-02 15:38 ` Jan Beulich
2017-01-27 12:23 ` Roger Pau Monne
2017-01-27 15:11 ` Jan Beulich
2017-01-27 16:04 ` Roger Pau Monne
2017-01-27 16:29 ` Jan Beulich
2017-01-19 17:29 ` [PATCH v5 5/9] x86/hvm: add vcpu parameter to guest memory copy function Roger Pau Monne
2017-01-20 19:45 ` Andrew Cooper
2017-01-23 13:50 ` Roger Pau Monne
2017-01-26 12:51 ` Jan Beulich
2017-01-26 13:33 ` Jan Beulich
2017-01-27 14:55 ` Roger Pau Monne
2017-01-19 17:29 ` [PATCH v5 6/9] xen/x86: parse Dom0 kernel for PVHv2 Roger Pau Monne
2017-01-26 13:37 ` Jan Beulich
2017-01-27 17:22 ` Roger Pau Monne
2017-01-27 17:28 ` Roger Pau Monne
2017-01-30 10:20 ` Jan Beulich
2017-01-27 18:03 ` Roger Pau Monne
2017-01-30 10:14 ` Jan Beulich
2017-01-19 17:29 ` [PATCH v5 7/9] x86/PVHv2: fix dom0_max_vcpus so it's capped to 128 for PVHv2 Dom0 Roger Pau Monne
2017-01-19 17:32 ` Andrew Cooper
2017-01-26 13:39 ` Jan Beulich
2017-01-19 17:29 ` [PATCH v5 8/9] xen/x86: Setup PVHv2 Dom0 CPUs Roger Pau Monne
2017-01-26 13:46 ` Jan Beulich
2017-02-08 12:48 ` Roger Pau Monne
2017-02-08 13:02 ` Jan Beulich
2017-01-19 17:29 ` [PATCH v5 9/9] xen/x86: setup PVHv2 Dom0 ACPI tables Roger Pau Monne
2017-01-26 14:16 ` Jan Beulich
2017-02-08 15:10 ` Roger Pau Monne
2017-02-08 15:50 ` Jan Beulich
2017-02-08 15:58 ` Roger Pau Monne
2017-02-08 16:03 ` Jan Beulich
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170119172941.65642-2-roger.pau@citrix.com \
--to=roger.pau@citrix.com \
--cc=andrew.cooper3@citrix.com \
--cc=boris.ostrovsky@oracle.com \
--cc=jbeulich@suse.com \
--cc=konrad.wilk@oracle.com \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).