From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Feng Wu <feng.wu@intel.com>, xen-devel@lists.xen.org
Cc: yang.z.zhang@intel.com, kevin.tian@intel.com, keir@xen.org,
JBeulich@suse.com
Subject: Re: [RFC v1 05/15] vmx: Initialize VT-d Posted-Interrupts Descriptor
Date: Thu, 26 Mar 2015 18:53:49 +0000 [thread overview]
Message-ID: <551455BD.2020204@citrix.com> (raw)
In-Reply-To: <1427286717-4093-6-git-send-email-feng.wu@intel.com>
On 25/03/15 12:31, Feng Wu wrote:
> This patch initializes the VT-d Posted-interrupt Descriptor.
>
> Signed-off-by: Feng Wu <feng.wu@intel.com>
> ---
> xen/arch/x86/hvm/vmx/vmcs.c | 3 +++
> xen/include/asm-x86/hvm/vmx/vmx.h | 21 ++++++++++++++++++++-
> 2 files changed, 23 insertions(+), 1 deletion(-)
>
> diff --git a/xen/arch/x86/hvm/vmx/vmcs.c b/xen/arch/x86/hvm/vmx/vmcs.c
> index d614638..942f4b7 100644
> --- a/xen/arch/x86/hvm/vmx/vmcs.c
> +++ b/xen/arch/x86/hvm/vmx/vmcs.c
> @@ -1004,6 +1004,9 @@ static int construct_vmcs(struct vcpu *v)
>
> if ( cpu_has_vmx_posted_intr_processing )
> {
> + if ( iommu_intpost == 1 )
Being a boolean, please shorten this to "if ( iommu_intpost )"
> + pi_desc_init(v);
> +
> __vmwrite(PI_DESC_ADDR, virt_to_maddr(&v->arch.hvm_vmx.pi_desc));
> __vmwrite(POSTED_INTR_NOTIFICATION_VECTOR, posted_intr_vector);
> }
> diff --git a/xen/include/asm-x86/hvm/vmx/vmx.h b/xen/include/asm-x86/hvm/vmx/vmx.h
> index ecc5e17..3cd75eb 100644
> --- a/xen/include/asm-x86/hvm/vmx/vmx.h
> +++ b/xen/include/asm-x86/hvm/vmx/vmx.h
> @@ -28,6 +28,9 @@
> #include <asm/hvm/support.h>
> #include <asm/hvm/trace.h>
> #include <asm/hvm/vmx/vmcs.h>
> +#include <asm/apic.h>
> +
> +extern uint8_t posted_intr_vector;
>
> typedef union {
> struct {
> @@ -146,6 +149,23 @@ static inline unsigned long pi_get_pir(struct pi_desc *pi_desc, int group)
> return xchg(&pi_desc->pir[group], 0);
> }
>
> +static inline void pi_desc_init(struct vcpu *v)
> +{
> + uint32_t dest;
> +
> + pi_clear_sn(&v->arch.hvm_vmx.pi_desc);
This is called during construct_vmcs(). You safely rely on the fact
that all memory is safely zeroed, so you don't need this clear bit, nor
the lower setting of ndm.
> + v->arch.hvm_vmx.pi_desc.nv = posted_intr_vector;
> +
> + /* Physical mode for Notificaiton Event */
> + v->arch.hvm_vmx.pi_desc.ndm = 0;
> + dest = cpu_physical_id(v->processor);
> +
> + if ( x2apic_enabled )
> + v->arch.hvm_vmx.pi_desc.ndst = dest;
> + else
> + v->arch.hvm_vmx.pi_desc.ndst = (dest << 8) & 0xFF00;
What takes care of ensuring that this ndst field gets updated whenever
v->processor changes?
~Andrew
> +}
> +
> /*
> * Exit Reasons
> */
> @@ -265,7 +285,6 @@ static inline unsigned long pi_get_pir(struct pi_desc *pi_desc, int group)
> #define MODRM_EAX_ECX ".byte 0xc1\n" /* EAX, ECX */
>
> extern u64 vmx_ept_vpid_cap;
> -extern uint8_t posted_intr_vector;
>
> #define cpu_has_vmx_ept_exec_only_supported \
> (vmx_ept_vpid_cap & VMX_EPT_EXEC_ONLY_SUPPORTED)
next prev parent reply other threads:[~2015-03-26 18:53 UTC|newest]
Thread overview: 101+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-25 12:31 [RFC v1 00/15] Add VT-d Posted-Interrupts support Feng Wu
2015-03-25 12:31 ` [RFC v1 01/15] iommu: Add iommu_intpost to control VT-d Posted-Interrupts feature Feng Wu
2015-03-26 17:39 ` Andrew Cooper
2015-03-27 4:46 ` Wu, Feng
2015-03-27 9:55 ` Andrew Cooper
2015-03-27 9:52 ` Jan Beulich
2015-03-25 12:31 ` [RFC v1 02/15] vt-d: VT-d Posted-Interrupts feature detection Feng Wu
2015-03-26 18:12 ` Andrew Cooper
2015-03-27 1:21 ` Wu, Feng
2015-03-27 10:06 ` Andrew Cooper
2015-03-27 13:41 ` Wu, Feng
2015-03-25 12:31 ` [RFC v1 03/15] vmx: Extend struct pi_desc to support VT-d Posted-Interrupts Feng Wu
2015-03-26 18:37 ` Andrew Cooper
2015-03-27 1:32 ` Wu, Feng
2015-03-25 12:31 ` [RFC v1 04/15] vmx: Add some helper functions for Posted-Interrupts Feng Wu
2015-03-26 18:44 ` Andrew Cooper
2015-03-25 12:31 ` [RFC v1 05/15] vmx: Initialize VT-d Posted-Interrupts Descriptor Feng Wu
2015-03-26 18:53 ` Andrew Cooper [this message]
2015-03-27 1:45 ` Wu, Feng
2015-03-26 19:29 ` Konrad Rzeszutek Wilk
2015-03-27 1:45 ` Wu, Feng
2015-05-04 5:32 ` Wu, Feng
2015-05-04 8:10 ` Jan Beulich
2015-05-04 8:36 ` Andrew Cooper
2015-05-04 9:07 ` Wu, Feng
2015-03-25 12:31 ` [RFC v1 06/15] vt-d: Extend struct iremap_entry to support VT-d Posted-Interrupts Feng Wu
2015-03-26 19:00 ` Andrew Cooper
2015-03-27 1:53 ` Wu, Feng
2015-03-27 9:58 ` Jan Beulich
2015-04-02 6:32 ` Tian, Kevin
2015-03-25 12:31 ` [RFC v1 07/15] vt-d: Add API to update IRTE when VT-d PI is used Feng Wu
2015-03-26 19:17 ` Andrew Cooper
2015-03-27 2:13 ` Wu, Feng
2015-03-27 10:02 ` Jan Beulich
2015-03-27 4:52 ` Wu, Feng
2015-03-26 19:36 ` Konrad Rzeszutek Wilk
2015-03-27 1:59 ` Wu, Feng
2015-04-02 5:34 ` Tian, Kevin
2015-04-02 6:02 ` Wu, Feng
2015-03-25 12:31 ` [RFC v1 08/15] Update IRTE according to guest interrupt config changes Feng Wu
2015-03-26 19:46 ` Konrad Rzeszutek Wilk
2015-03-27 5:45 ` Wu, Feng
2015-03-26 19:59 ` Andrew Cooper
2015-03-27 5:49 ` Wu, Feng
2015-03-27 11:31 ` Andrew Cooper
2015-04-02 5:52 ` Tian, Kevin
2015-04-02 6:20 ` Wu, Feng
2015-04-02 6:49 ` Tian, Kevin
2015-04-02 8:02 ` Wu, Feng
2015-04-03 8:29 ` Tian, Kevin
2015-03-25 12:31 ` [RFC v1 09/15] Add a new per-vCPU tasklet to wakeup the blocked vCPU Feng Wu
2015-04-02 5:53 ` Tian, Kevin
2015-04-02 7:20 ` Wu, Feng
2015-03-25 12:31 ` [RFC v1 10/15] vmx: Define two per-cpu variants Feng Wu
2015-03-26 19:59 ` Andrew Cooper
2015-04-02 5:54 ` Tian, Kevin
2015-04-02 6:24 ` Wu, Feng
2015-03-25 12:31 ` [RFC v1 11/15] vmx: Add a global wake-up vector for VT-d Posted-Interrupts Feng Wu
2015-03-26 20:07 ` Andrew Cooper
2015-04-02 6:00 ` Tian, Kevin
2015-04-02 7:18 ` Wu, Feng
2015-04-08 9:02 ` Tian, Kevin
2015-04-08 11:14 ` Wu, Feng
2015-03-25 12:31 ` [RFC v1 12/15] vmx: Properly handle notification event when vCPU is running Feng Wu
2015-03-25 14:14 ` Zhang, Yang Z
2015-03-27 4:40 ` Wu, Feng
2015-03-27 4:44 ` Zhang, Yang Z
2015-03-27 4:57 ` Wu, Feng
2015-04-02 6:08 ` Tian, Kevin
2015-04-02 7:21 ` Wu, Feng
2015-04-02 19:15 ` Konrad Rzeszutek Wilk
2015-04-03 2:00 ` Wu, Feng
2015-04-03 13:36 ` Konrad Rzeszutek Wilk
2015-04-07 0:35 ` Wu, Feng
2015-03-26 19:57 ` Konrad Rzeszutek Wilk
2015-03-27 3:06 ` Wu, Feng
2015-03-25 12:31 ` [RFC v1 13/15] Update Posted-Interrupts Descriptor during vCPU scheduling Feng Wu
2015-03-26 20:16 ` Andrew Cooper
2015-03-27 2:59 ` Wu, Feng
2015-04-02 6:24 ` Tian, Kevin
2015-04-02 8:39 ` Wu, Feng
2015-04-08 8:53 ` Tian, Kevin
2015-04-08 11:01 ` Wu, Feng
2015-04-09 2:37 ` Tian, Kevin
2015-03-25 12:31 ` [RFC v1 14/15] Suppress posting interrupts when 'SN' is set Feng Wu
2015-03-26 20:34 ` Andrew Cooper
2015-03-27 3:00 ` Wu, Feng
2015-03-27 12:06 ` Andrew Cooper
2015-03-27 13:45 ` Wu, Feng
2015-03-27 13:49 ` Andrew Cooper
2015-03-30 2:11 ` Wu, Feng
2015-03-30 10:11 ` Andrew Cooper
2015-03-25 12:31 ` [RFC v1 15/15] Add a command line parameter for VT-d posted-interrupts Feng Wu
2015-03-26 18:50 ` [RFC v1 00/15] Add VT-d Posted-Interrupts support Konrad Rzeszutek Wilk
2015-03-27 1:06 ` Wu, Feng
2015-03-27 14:44 ` Konrad Rzeszutek Wilk
2015-04-01 13:21 ` Wu, Feng
2015-04-13 12:12 ` Jan Beulich
2015-04-13 23:38 ` Wu, Feng
2015-04-24 17:50 ` Wu, Feng
2015-04-27 23:40 ` 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=551455BD.2020204@citrix.com \
--to=andrew.cooper3@citrix.com \
--cc=JBeulich@suse.com \
--cc=feng.wu@intel.com \
--cc=keir@xen.org \
--cc=kevin.tian@intel.com \
--cc=xen-devel@lists.xen.org \
--cc=yang.z.zhang@intel.com \
/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 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.