All of lore.kernel.org
 help / color / mirror / Atom feed
From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: Mukesh Rathor <mukesh.rathor@oracle.com>
Cc: "Xen-devel@lists.xensource.com" <Xen-devel@lists.xensource.com>
Subject: Re: [PATCH 11/18 V2]: PVH xen: some misc changes like mtrr, intr, msi.
Date: Mon, 18 Mar 2013 13:03:10 -0400	[thread overview]
Message-ID: <20130318170310.GC27433@phenom.dumpdata.com> (raw)
In-Reply-To: <20130315174605.4090e816@mantra.us.oracle.com>

On Fri, Mar 15, 2013 at 05:46:05PM -0700, Mukesh Rathor wrote:
>  Changes in irq.c as PVH doesn't use vlapic emulation. In mtrr we add
>  assert and set MTRR_TYPEs for PVH.
> 
> Changes in V2:
>    - Some cleanup of redundant code.
>    - time.c: Honor no rdtsc exiting for PVH by setting vtsc to 0 in time.c
> 
> Signed-off-by: Mukesh Rathor <mukesh.rathor@oracle.com>
> ---
>  xen/arch/x86/hvm/irq.c      |    3 +++
>  xen/arch/x86/hvm/mtrr.c     |   10 ++++++++++
>  xen/arch/x86/hvm/vmx/intr.c |    7 ++++---
>  xen/arch/x86/msi.c          |    9 +++++++--
>  xen/arch/x86/time.c         |    2 +-
>  5 files changed, 25 insertions(+), 6 deletions(-)
> 
> diff --git a/xen/arch/x86/hvm/irq.c b/xen/arch/x86/hvm/irq.c
> index 9eae5de..92fb245 100644
> --- a/xen/arch/x86/hvm/irq.c
> +++ b/xen/arch/x86/hvm/irq.c
> @@ -405,6 +405,9 @@ struct hvm_intack hvm_vcpu_has_pending_irq(struct vcpu *v)
>           && vcpu_info(v, evtchn_upcall_pending) )
>          return hvm_intack_vector(plat->irq.callback_via.vector);
>  
> +    if ( is_pvh_vcpu(v) )
> +        return hvm_intack_none;
> +
>      if ( vlapic_accept_pic_intr(v) && plat->vpic[0].int_output )
>          return hvm_intack_pic(0);
>  
> diff --git a/xen/arch/x86/hvm/mtrr.c b/xen/arch/x86/hvm/mtrr.c
> index ef51a8d..8057e88 100644
> --- a/xen/arch/x86/hvm/mtrr.c
> +++ b/xen/arch/x86/hvm/mtrr.c
> @@ -578,6 +578,9 @@ int32_t hvm_set_mem_pinned_cacheattr(
>  {
>      struct hvm_mem_pinned_cacheattr_range *range;
>  
> +    /* PVH note: The guest writes to MSR_IA32_CR_PAT natively */
> +    ASSERT( !is_pvh_domain(d) );
> +
>      if ( !((type == PAT_TYPE_UNCACHABLE) ||
>             (type == PAT_TYPE_WRCOMB) ||
>             (type == PAT_TYPE_WRTHROUGH) ||
> @@ -693,6 +696,13 @@ uint8_t epte_get_entry_emt(struct domain *d, unsigned long gfn, mfn_t mfn,
>           ((d->vcpu == NULL) || ((v = d->vcpu[0]) == NULL)) )
>          return MTRR_TYPE_WRBACK;
>  
> +    /* PVH: fixme/help: do I have this correct? */
> +    if ( is_pvh_domain(d) ) {
> +        if (direct_mmio)
> +            return MTRR_TYPE_UNCACHABLE;
> +        return MTRR_TYPE_WRBACK;
> +    }
> +

Could we use the other code? The get_mtrr_type for example?

Or just let this code run through?


>      if ( !v->domain->arch.hvm_domain.params[HVM_PARAM_IDENT_PT] )
>          return MTRR_TYPE_WRBACK;
>  
> diff --git a/xen/arch/x86/hvm/vmx/intr.c b/xen/arch/x86/hvm/vmx/intr.c
> index e376f3c..b94f9d5 100644
> --- a/xen/arch/x86/hvm/vmx/intr.c
> +++ b/xen/arch/x86/hvm/vmx/intr.c
> @@ -219,15 +219,16 @@ void vmx_intr_assist(void)
>          return;
>      }
>  
> -    /* Crank the handle on interrupt state. */
> -    pt_vector = pt_update_irq(v);
> +    if ( !is_pvh_vcpu(v) )
> +        /* Crank the handle on interrupt state. */
> +        pt_vector = pt_update_irq(v);
>  
>      do {
>          intack = hvm_vcpu_has_pending_irq(v);
>          if ( likely(intack.source == hvm_intsrc_none) )
>              goto out;
>  
> -        if ( unlikely(nvmx_intr_intercept(v, intack)) )
> +        if ( !is_pvh_vcpu(v) && unlikely(nvmx_intr_intercept(v, intack)) )
>              goto out;
>  
>          intblk = hvm_interrupt_blocked(v, intack);
> diff --git a/xen/arch/x86/msi.c b/xen/arch/x86/msi.c
> index 8804306..0fe3108 100644
> --- a/xen/arch/x86/msi.c
> +++ b/xen/arch/x86/msi.c
> @@ -787,10 +787,15 @@ static int msix_capability_init(struct pci_dev *dev,
>  
>      if ( !dev->msix_used_entries )
>      {
> -        if ( rangeset_add_range(mmio_ro_ranges, dev->msix_table.first,
> +        /* PVH: this is temporary only until linux msi.c is fixed. See xen-devel
> +         * thread: "[PVH]: Help: msi.c".
> +         */
> +        if ( !is_pvh_domain(dev->domain) &&
> +             rangeset_add_range(mmio_ro_ranges, dev->msix_table.first,
>                                  dev->msix_table.last) )
>              WARN();
> -        if ( rangeset_add_range(mmio_ro_ranges, dev->msix_pba.first,
> +        if ( !is_pvh_domain(dev->domain) &&
> +             rangeset_add_range(mmio_ro_ranges, dev->msix_pba.first,
>                                  dev->msix_pba.last) )
>              WARN();
>  
> diff --git a/xen/arch/x86/time.c b/xen/arch/x86/time.c
> index 56bffdb..eaa1989 100644
> --- a/xen/arch/x86/time.c
> +++ b/xen/arch/x86/time.c
> @@ -1879,7 +1879,7 @@ void tsc_set_info(struct domain *d,
>                    uint32_t tsc_mode, uint64_t elapsed_nsec,
>                    uint32_t gtsc_khz, uint32_t incarnation)
>  {
> -    if ( is_idle_domain(d) || (d->domain_id == 0) )
> +    if ( is_idle_domain(d) || (d->domain_id == 0) || is_pvh_domain(d) )

Ah, so the 'timer_mode' option in the guest config if completly ignored
if 'pvh' is set then!

You need to document that in the docs/man/xl.conf.5 file.

>      {
>          d->arch.vtsc = 0;
>          return;
> -- 
> 1.7.2.3
> 
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel
> 

      parent reply	other threads:[~2013-03-18 17:03 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-16  0:46 [PATCH 11/18 V2]: PVH xen: some misc changes like mtrr, intr, msi Mukesh Rathor
2013-03-18 12:21 ` Jan Beulich
2013-03-19  1:20   ` Mukesh Rathor
2013-03-19  8:55     ` Jan Beulich
2013-03-19 14:11       ` Konrad Rzeszutek Wilk
2013-03-18 17:03 ` Konrad Rzeszutek Wilk [this message]

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=20130318170310.GC27433@phenom.dumpdata.com \
    --to=konrad.wilk@oracle.com \
    --cc=Xen-devel@lists.xensource.com \
    --cc=mukesh.rathor@oracle.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.