xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Paul Durrant <Paul.Durrant@citrix.com>
To: 'Jan Beulich' <JBeulich@suse.com>,
	Roger Pau Monne <roger.pau@citrix.com>
Cc: Andrew Cooper <Andrew.Cooper3@citrix.com>,
	Boris Ostrovsky <boris.ostrovsky@oracle.com>,
	"xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>
Subject: Re: [PATCH v8 03/11] x86/physdev: enable PHYSDEVOP_pci_mmcfg_reserved for PVH Dom0
Date: Fri, 23 Feb 2018 17:44:14 +0000	[thread overview]
Message-ID: <860c8e3466b44dfc8efc22d8058934ad@AMSPEX02CL03.citrite.net> (raw)
In-Reply-To: <5A9047E202000078001AAFF4@prv-mh.provo.novell.com>

> -----Original Message-----
> From: Jan Beulich [mailto:JBeulich@suse.com]
> Sent: 23 February 2018 15:57
> To: Paul Durrant <Paul.Durrant@citrix.com>; Roger Pau Monne
> <roger.pau@citrix.com>
> Cc: Andrew Cooper <Andrew.Cooper3@citrix.com>; xen-
> devel@lists.xenproject.org; Boris Ostrovsky <boris.ostrovsky@oracle.com>;
> Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> Subject: Re: [PATCH v8 03/11] x86/physdev: enable
> PHYSDEVOP_pci_mmcfg_reserved for PVH Dom0
> 
> >>> On 23.01.18 at 16:07, <roger.pau@citrix.com> wrote:
> > So that MMCFG regions not present in the MCFG ACPI table can be added
> > at run time by the hardware domain.
> >
> > Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
> > Reviewed-by: Jan Beulich <jbeulich@suse.com>
> > ---
> > Cc: Jan Beulich <jbeulich@suse.com>
> > Cc: Andrew Cooper <andrew.cooper3@citrix.com>
> > ---
> > Changes since v7:
> >  - Add newline in hvm_physdev_op for non-fallthrough case.
> >
> > Changes since v6:
> >  - Do not return EEXIST if the same exact region is already tracked by
> >    Xen.
> >
> > Changes since v5:
> >  - Check for has_vpci before calling register_vpci_mmcfg_handler
> >    instead of checking for is_hvm_domain.
> >
> > Changes since v4:
> >  - Change the hardware_domain check in hvm_physdev_op to a vpci check.
> >  - Only register the MMCFG area, but don't scan it.
> >
> > Changes since v3:
> >  - New in this version.
> > ---
> >  xen/arch/x86/hvm/hypercall.c |  5 +++++
> >  xen/arch/x86/hvm/io.c        | 16 +++++++++++-----
> 
> Sadly you forgot to Cc Paul for this one. Paul - any chance you could
> take a look?
> 

Sure. LGTM.

Reviewed-by: Paul Durrant <paul.durrant@citrix.com>

> Jan
> 
> >  xen/arch/x86/physdev.c       | 11 +++++++++++
> >  3 files changed, 27 insertions(+), 5 deletions(-)
> >
> > diff --git a/xen/arch/x86/hvm/hypercall.c b/xen/arch/x86/hvm/hypercall.c
> > index 5742dd1797..85eacd7d33 100644
> > --- a/xen/arch/x86/hvm/hypercall.c
> > +++ b/xen/arch/x86/hvm/hypercall.c
> > @@ -89,6 +89,11 @@ static long hvm_physdev_op(int cmd,
> > XEN_GUEST_HANDLE_PARAM(void) arg)
> >          if ( !has_pirq(curr->domain) )
> >              return -ENOSYS;
> >          break;
> > +
> > +    case PHYSDEVOP_pci_mmcfg_reserved:
> > +        if ( !has_vpci(curr->domain) )
> > +            return -ENOSYS;
> > +        break;
> >      }
> >
> >      if ( !curr->hcall_compat )
> > diff --git a/xen/arch/x86/hvm/io.c b/xen/arch/x86/hvm/io.c
> > index 04425c064b..556810c126 100644
> > --- a/xen/arch/x86/hvm/io.c
> > +++ b/xen/arch/x86/hvm/io.c
> > @@ -507,10 +507,9 @@ static const struct hvm_mmio_ops
> vpci_mmcfg_ops = {
> >      .write = vpci_mmcfg_write,
> >  };
> >
> > -int __hwdom_init register_vpci_mmcfg_handler(struct domain *d,
> paddr_t
> > addr,
> > -                                             unsigned int start_bus,
> > -                                             unsigned int end_bus,
> > -                                             unsigned int seg)
> > +int register_vpci_mmcfg_handler(struct domain *d, paddr_t addr,
> > +                                unsigned int start_bus, unsigned int
> > end_bus,
> > +                                unsigned int seg)
> >  {
> >      struct hvm_mmcfg *mmcfg, *new = xmalloc(struct hvm_mmcfg);
> >
> > @@ -535,9 +534,16 @@ int __hwdom_init
> register_vpci_mmcfg_handler(struct
> > domain *d, paddr_t addr,
> >          if ( new->addr < mmcfg->addr + mmcfg->size &&
> >               mmcfg->addr < new->addr + new->size )
> >          {
> > +            int ret = -EEXIST;
> > +
> > +            if ( new->addr == mmcfg->addr &&
> > +                 new->start_bus == mmcfg->start_bus &&
> > +                 new->segment == mmcfg->segment &&
> > +                 new->size == mmcfg->size )
> > +                ret = 0;
> >              write_unlock(&d->arch.hvm_domain.mmcfg_lock);
> >              xfree(new);
> > -            return -EEXIST;
> > +            return ret;
> >          }
> >
> >      if ( list_empty(&d->arch.hvm_domain.mmcfg_regions) )
> > diff --git a/xen/arch/x86/physdev.c b/xen/arch/x86/physdev.c
> > index 380d36f6b9..984491c3dc 100644
> > --- a/xen/arch/x86/physdev.c
> > +++ b/xen/arch/x86/physdev.c
> > @@ -557,6 +557,17 @@ ret_t do_physdev_op(int cmd,
> > XEN_GUEST_HANDLE_PARAM(void) arg)
> >
> >          ret = pci_mmcfg_reserved(info.address, info.segment,
> >                                   info.start_bus, info.end_bus, info.flags);
> > +        if ( !ret && has_vpci(currd) )
> > +        {
> > +            /*
> > +             * For HVM (PVH) domains try to add the newly found MMCFG to
> > the
> > +             * domain.
> > +             */
> > +            ret = register_vpci_mmcfg_handler(currd, info.address,
> > +                                              info.start_bus, info.end_bus,
> > +                                              info.segment);
> > +        }
> > +
> >          break;
> >      }
> >
> > --
> > 2.15.1
> 

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

  reply	other threads:[~2018-02-23 17:44 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-23 15:07 [PATCH v8 00/11] vpci: PCI config space emulation Roger Pau Monne
2018-01-23 15:07 ` [PATCH v8 01/11] vpci: introduce basic handlers to trap accesses to the PCI config space Roger Pau Monne
2018-02-23 15:55   ` Jan Beulich
2018-02-23 16:02     ` Julien Grall
2018-02-23 17:25       ` Roger Pau Monné
2018-02-23 17:45         ` Julien Grall
2018-01-23 15:07 ` [PATCH v8 02/11] x86/mmcfg: add handlers for the PVH Dom0 MMCFG areas Roger Pau Monne
2018-01-23 15:07 ` [PATCH v8 03/11] x86/physdev: enable PHYSDEVOP_pci_mmcfg_reserved for PVH Dom0 Roger Pau Monne
2018-02-23 15:57   ` Jan Beulich
2018-02-23 17:44     ` Paul Durrant [this message]
2018-01-23 15:07 ` [PATCH v8 04/11] pci: split code to size BARs from pci_add_device Roger Pau Monne
2018-02-23 15:58   ` Jan Beulich
2018-01-23 15:07 ` [PATCH v8 05/11] pci: add support to size ROM BARs to pci_size_mem_bar Roger Pau Monne
2018-01-23 15:07 ` [PATCH v8 06/11] xen: introduce rangeset_consume_ranges Roger Pau Monne
2018-01-23 15:07 ` [PATCH v8 07/11] vpci/bars: add handlers to map the BARs Roger Pau Monne
2018-01-29 14:01   ` Roger Pau Monné
2018-01-23 15:07 ` [PATCH v8 08/11] x86/pt: mask MSI vectors on unbind Roger Pau Monne
2018-02-28 11:27   ` Jan Beulich
2018-01-23 15:07 ` [PATCH v8 09/11] vpci/msi: add MSI handlers Roger Pau Monne
2018-02-28 14:10   ` Jan Beulich
2018-01-23 15:07 ` [PATCH v8 10/11] vpci: add a priority parameter to the vPCI register initializer Roger Pau Monne
2018-01-23 15:07 ` [PATCH v8 11/11] vpci/msix: add MSI-X handlers Roger Pau Monne
2018-02-28 14:33   ` Jan Beulich
2018-03-02 14:52     ` Roger Pau Monné

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=860c8e3466b44dfc8efc22d8058934ad@AMSPEX02CL03.citrite.net \
    --to=paul.durrant@citrix.com \
    --cc=Andrew.Cooper3@citrix.com \
    --cc=JBeulich@suse.com \
    --cc=boris.ostrovsky@oracle.com \
    --cc=roger.pau@citrix.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).