All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tim Deegan <Tim.Deegan@citrix.com>
To: "Zhang, Yang Z" <yang.z.zhang@intel.com>
Cc: Wei Wang <wei.wang2@amd.com>,
	"xen-devel@lists.xensource.com" <xen-devel@lists.xensource.com>,
	"Kay, Allen M" <allen.m.kay@intel.com>
Subject: Re: [RFC PATCH 0/3] AMD IOMMU: Share p2m table with iommu
Date: Mon, 16 May 2011 09:43:12 +0100	[thread overview]
Message-ID: <20110516084312.GQ24068@whitby.uk.xensource.com> (raw)
In-Reply-To: <749B9D3DBF0F054390025D9EAFF47F224C3288C0@shsmsx501.ccr.corp.intel.com>

At 09:36 +0100 on 16 May (1305538573), Zhang, Yang Z wrote:
> > What's the failure mode?  Or better, what change in the common code are
> > you objecting to?

> The following patch cause the vt-d fail to work. I suspect that the
> change is not appropriate for intel platform.

Thank you.  In what way does it fail?

Have you tested with 23300:4b0692880dfa applied?  It's a fix on top of
this change. 

Thanks,

Tim.

> Add allen to CC list. Maybe he can give a more authoritative answer.
> 
> diff -r 51d89366c859 -r 78145a98915c xen/arch/x86/mm/p2m.c
> --- a/xen/arch/x86/mm/p2m.c     Mon Apr 18 15:12:04 2011 +0100
> +++ b/xen/arch/x86/mm/p2m.c     Mon Apr 18 17:24:21 2011 +0100
> @@ -80,7 +80,12 @@ unsigned long p2m_type_to_flags(p2m_type  {
>      unsigned long flags;
>  #ifdef __x86_64__
> -    flags = (unsigned long)(t & 0x3fff) << 9;
> +    /*
> +     * AMD IOMMU: When we share p2m table with iommu, bit 9 - bit 11 will be
> +     * used for iommu hardware to encode next io page level. Bit 59 - bit 62
> +     * are used for iommu flags, We could not use these bits to store p2m types.
> +     */
> +    flags = (unsigned long)(t & 0x7f) << 12;
>  #else
>      flags = (t & 0x7UL) << 9;
>  #endif
> @@ -1826,6 +1831,9 @@ static mfn_t p2m_gfn_to_mfn_current(stru
>              p2mt = p2m_flags_to_type(l1e_get_flags(l1e));
>              ASSERT(l1e_get_pfn(l1e) != INVALID_MFN || !p2m_is_ram(p2mt));
> 
> +            if ( l1e.l1 == 0 )
> +                p2mt = p2m_invalid;
> +
>              if ( p2m_flags_to_type(l1e_get_flags(l1e))
>                   == p2m_populate_on_demand )
>              {
> diff -r 51d89366c859 -r 78145a98915c xen/include/asm-x86/p2m.h
> --- a/xen/include/asm-x86/p2m.h Mon Apr 18 15:12:04 2011 +0100
> +++ b/xen/include/asm-x86/p2m.h Mon Apr 18 17:24:21 2011 +0100
> @@ -63,9 +63,15 @@
>   * Further expansions of the type system will only be supported on
>   * 64-bit Xen.
>   */
> +
> +/*
> + * AMD IOMMU: When we share p2m table with iommu, bit 52 -bit 58 in pte
> + * cannot be non-zero, otherwise, hardware generates io page faults 
> +when
> + * device access those pages. Therefore, p2m_ram_rw has to be defined as 0.
> + */
>  typedef enum {
> -    p2m_invalid = 0,            /* Nothing mapped here */
> -    p2m_ram_rw = 1,             /* Normal read/write guest RAM */
> +    p2m_ram_rw = 0,             /* Normal read/write guest RAM */
> +    p2m_invalid = 1,            /* Nothing mapped here */
>      p2m_ram_logdirty = 2,       /* Temporarily read-only for log-dirty */
>      p2m_ram_ro = 3,             /* Read-only; writes are silently dropped */
>      p2m_mmio_dm = 4,            /* Reads and write go to the device model */
> @@ -375,7 +381,13 @@ static inline p2m_type_t p2m_flags_to_ty  {
>      /* Type is stored in the "available" bits */  #ifdef __x86_64__
> -    return (flags >> 9) & 0x3fff;
> +    /*
> +     * AMD IOMMU: When we share p2m table with iommu, bit 9 - bit 11 will be
> +     * used for iommu hardware to encode next io page level. Bit 59 - bit 62
> +     * are used for iommu flags, We could not use these bits to store p2m types.
> +     */
> +
> +    return (flags >> 12) & 0x7f;
>  #else
>      return (flags >> 9) & 0x7;
>  #endif
> 
> > 
> > BTW, this is not the patch set that was applied; when I applied the
> > revised patches (about a month ago) I CC'd the Intel IOMMU maintainer.
> > 
> > Tim.
> > 
> > > best regards
> > > yang
> > >
> > > > -----Original Message-----
> > > > From: xen-devel-bounces@lists.xensource.com
> > > > [mailto:xen-devel-bounces@lists.xensource.com] On Behalf Of Wei Wang
> > > > Sent: Friday, March 25, 2011 6:32 PM
> > > > To: xen-devel@lists.xensource.com
> > > > Subject: [Xen-devel] [RFC PATCH 0/3] AMD IOMMU: Share p2m table with
> > > > iommu
> > > >
> > > > Hi,
> > > > This patch set implements p2m table sharing for amd iommu. Please
> > > > comment it.
> > > > Thanks,
> > > > Wei
> > > >
> > > > --
> > > > Advanced Micro Devices GmbH
> > > > Sitz: Dornach, Gemeinde Aschheim,
> > > > Landkreis München Registergericht München,
> > > > HRB Nr. 43632
> > > > WEEE-Reg-Nr: DE 12919551
> > > > Geschäftsführer:
> > > > Alberto Bozzo, Andrew Bowd
> > > >
> > > >
> > > >
> > > >
> > > > _______________________________________________
> > > > Xen-devel mailing list
> > > > Xen-devel@lists.xensource.com
> > > > http://lists.xensource.com/xen-devel
> > 
> > --
> > Tim Deegan <Tim.Deegan@citrix.com>
> > Principal Software Engineer, Xen Platform Team
> > Citrix Systems UK Ltd.  (Company #02937203, SL9 0BG)

-- 
Tim Deegan <Tim.Deegan@citrix.com>
Principal Software Engineer, Xen Platform Team
Citrix Systems UK Ltd.  (Company #02937203, SL9 0BG)

  reply	other threads:[~2011-05-16  8:43 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-25 10:31 [RFC PATCH 0/3] AMD IOMMU: Share p2m table with iommu Wei Wang
2011-05-16  1:42 ` Zhang, Yang Z
2011-05-16  8:27   ` Tim Deegan
2011-05-16  8:36     ` Zhang, Yang Z
2011-05-16  8:43       ` Tim Deegan [this message]
2011-05-16  8:50         ` Zhang, Yang Z
2011-05-17  0:13         ` Kay, Allen M
2011-05-17  7:55           ` Keir Fraser
2011-05-17  2:21         ` Kay, Allen M
2011-05-17  7:51           ` Keir Fraser
2011-05-21  0:51       ` Kay, Allen M
2011-05-23 10:58         ` Tim Deegan
2011-05-23 12:08           ` Wei Wang2
2011-05-23 13:19             ` Tim Deegan
2011-05-23 16:13               ` Wei Wang2
2011-05-23 13:33           ` Zhang, Yang Z
2011-05-23 13:40             ` Tim Deegan
2011-05-23 13:46               ` Zhang, Yang Z
2011-05-23 14:27                 ` Tim Deegan
2011-05-24  0:21           ` Kay, Allen M
2011-05-24  9:13             ` Tim Deegan

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=20110516084312.GQ24068@whitby.uk.xensource.com \
    --to=tim.deegan@citrix.com \
    --cc=allen.m.kay@intel.com \
    --cc=wei.wang2@amd.com \
    --cc=xen-devel@lists.xensource.com \
    --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.