All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] iommu: add rmrr Xen command line option
@ 2015-03-09 14:42 elena.ufimtseva
  2015-03-09 14:42 ` [PATCH 1/2] iommu VT-d: separate rmrr addition function elena.ufimtseva
  2015-03-09 14:42 ` [PATCH 2/2] iommu: add rmrr Xen command line option for misc rmrrs elena.ufimtseva
  0 siblings, 2 replies; 19+ messages in thread
From: elena.ufimtseva @ 2015-03-09 14:42 UTC (permalink / raw)
  To: xen-devel
  Cc: Elena Ufimtseva, kevin.tian, jbeulich, yang.z.zhang, boris.ostrovsky

From: Elena Ufimtseva <elena.ufimtseva@oracle.com>

Add Xen command line option rmrr to specify RMRR
regions for devices that are not defined in ACPI thus
causing IO Page Fault while booting dom0 in PVH mode.
These additional regions will be added to the list of
RMRR regions parsed from ACPI.

Elena Ufimtseva (2):
  iommu VT-d: separate rmrr addition function
  iommu: add rmrr Xen command line option for misc rmrrs

 docs/misc/xen-command-line.markdown |    7 ++
 xen/drivers/passthrough/iommu.c     |   86 ++++++++++++++++++++++++
 xen/drivers/passthrough/vtd/dmar.c  |  122 +++++++++++++++++++----------------
 xen/drivers/passthrough/vtd/dmar.h  |    1 +
 xen/drivers/passthrough/vtd/iommu.c |   33 ++++++++++
 xen/drivers/passthrough/vtd/iommu.h |    1 +
 xen/include/xen/iommu.h             |    9 +++
 7 files changed, 202 insertions(+), 57 deletions(-)

-- 
1.7.10.4

^ permalink raw reply	[flat|nested] 19+ messages in thread
* Re: [PATCH 1/2] iommu VT-d: separate rmrr addition function
@ 2015-03-12 21:54 Elena Ufimtseva
  0 siblings, 0 replies; 19+ messages in thread
From: Elena Ufimtseva @ 2015-03-12 21:54 UTC (permalink / raw)
  To: JBeulich; +Cc: yang.z.zhang, boris.ostrovsky, xen-devel, kevin.tian


----- elena.ufimtseva@oracle.com wrote:

> On Wed, Mar 11, 2015 at 10:29:54AM +0000, Jan Beulich wrote:
> > >>> On 09.03.15 at 15:42, <elena.ufimtseva@oracle.com> wrote:
> > > --- a/xen/drivers/passthrough/vtd/dmar.c
> > > +++ b/xen/drivers/passthrough/vtd/dmar.c
> > > @@ -567,6 +567,66 @@ out:
> > >      return ret;
> > >  }
> > >  
> > > +int register_one_rmrr(struct acpi_rmrr_unit *rmrru)
> > 
> > static - I don't see why the command line processing in patch 2
> can't
> > be put in this file.
> 
> I wanted to keep it close to iommu command line parser in iommu.c.
> Andrew mentioned that the parser should be defined as custom_param.
> Did you mean that as well and that it should be moved to dmar.c?

Never mind, I saw the answer.

> 
> > 
> > > +{
> > > +    u8 b, d, f;
> > > +    bool_t ignore = 0;
> > > +    unsigned int i = 0;
> > > +    int ret = 0;
> > > +
> > > +    /* Skip checking if segment is not accessible yet. */
> > > +    if ( !pci_known_segment(rmrru->segment) )
> > > +        i = UINT_MAX;
> > > +
> > > +    for ( ; i < rmrru->scope.devices_cnt; i++ )
> > > +    {
> > > +        b = PCI_BUS(rmrru->scope.devices[i]);
> > > +        d = PCI_SLOT(rmrru->scope.devices[i]);
> > > +        f = PCI_FUNC(rmrru->scope.devices[i]);
> > 
> > Please make this the declarations (with initializers) of these
> variables;
> > they don't appear to be used outside this scope.
> > 
> > > +
> > > +        if ( pci_device_detect(rmrru->segment, b, d, f) == 0 )
> > > +        {
> > > +            dprintk(XENLOG_WARNING VTDPREFIX,
> > > +                    " Non-existent device (%04x:%02x:%02x.%u) is
> reported"
> > > +                    " in RMRR (%"PRIx64", %"PRIx64")'s
> scope!\n",
> > > +                    rmrru->segment, b, d, f,
> > > +                    rmrru->base_address, rmrru->end_address);
> > > +            ignore = 1;
> > > +        }
> > > +        else
> > > +        {
> > > +            ignore = 0;
> > > +            break;
> > > +        }
> > > +    }
> > > +
> > > +    if ( ignore )
> > > +    {
> > > +        dprintk(XENLOG_WARNING VTDPREFIX,
> > > +            "  Ignore the RMRR (%"PRIx64", %"PRIx64") due to "
> > > +            "devices under its scope are not PCI
> discoverable!\n",
> > > +            rmrru->base_address, rmrru->end_address);
> > > +        ret = -EFAULT;
> > > +    }
> > > +    else if ( rmrru->base_address > rmrru->end_address )
> > > +    {
> > > +        dprintk(XENLOG_WARNING VTDPREFIX,
> > > +            "  The RMRR (%"PRIx64", %"PRIx64") is incorrect!\n",
> > > +            rmrru->base_address, rmrru->end_address);
> > > +        ret = -EFAULT;
> > > +    }
> > > +    else
> > > +    {
> > > +        if ( iommu_verbose )
> > > +            dprintk(VTDPREFIX,
> > > +                    "  RMRR region: base_addr %"PRIx64
> > > +                    " end_address %"PRIx64"\n",
> > > +                    rmrru->base_address, rmrru->end_address);
> > > +        acpi_register_rmrr_unit(rmrru);
> > > +    }
> > > +    return ret;
> > 
> > Blank line before return please.
> > 
> > > @@ -618,66 +678,14 @@ acpi_parse_one_rmrr(struct acpi_dmar_header
> *header)
> > >                                 &rmrru->scope, RMRR_TYPE,
> rmrr->segment);
> > >  
> > >      if ( ret || (rmrru->scope.devices_cnt == 0) )
> > > -        xfree(rmrru);
> > > -    else
> > >      {
> > > -        u8 b, d, f;
> > > -        bool_t ignore = 0;
> > > -        unsigned int i = 0;
> > > -
> > > -        /* Skip checking if segment is not accessible yet. */
> > > -        if ( !pci_known_segment(rmrr->segment) )
> > > -            i = UINT_MAX;
> > > -
> > > -        for ( ; i < rmrru->scope.devices_cnt; i++ )
> > > -        {
> > > -            b = PCI_BUS(rmrru->scope.devices[i]);
> > > -            d = PCI_SLOT(rmrru->scope.devices[i]);
> > > -            f = PCI_FUNC(rmrru->scope.devices[i]);
> > > -
> > > -            if ( pci_device_detect(rmrr->segment, b, d, f) == 0
> )
> > > -            {
> > > -                dprintk(XENLOG_WARNING VTDPREFIX,
> > > -                        " Non-existent device (%04x:%02x:%02x.%u)
> is reported"
> > > -                        " in RMRR (%"PRIx64", %"PRIx64")'s
> scope!\n",
> > > -                        rmrr->segment, b, d, f,
> > > -                        rmrru->base_address,
> rmrru->end_address);
> > > -                ignore = 1;
> > > -            }
> > > -            else
> > > -            {
> > > -                ignore = 0;
> > > -                break;
> > > -            }
> > > -        }
> > > -
> > > -        if ( ignore )
> > > -        {
> > > -            dprintk(XENLOG_WARNING VTDPREFIX,
> > > -                "  Ignore the RMRR (%"PRIx64", %"PRIx64") due to
> "
> > > -                "devices under its scope are not PCI
> discoverable!\n",
> > > -                rmrru->base_address, rmrru->end_address);
> > > -            xfree(rmrru);
> > > -        }
> > > -        else if ( base_addr > end_addr )
> > > -        {
> > > -            dprintk(XENLOG_WARNING VTDPREFIX,
> > > -                "  The RMRR (%"PRIx64", %"PRIx64") is
> incorrect!\n",
> > > -                rmrru->base_address, rmrru->end_address);
> > > -            xfree(rmrru);
> > > -            ret = -EFAULT;
> > > -        }
> > > -        else
> > > -        {
> > > -            if ( iommu_verbose )
> > > -                dprintk(VTDPREFIX,
> > > -                        "  RMRR region: base_addr %"PRIx64
> > > -                        " end_address %"PRIx64"\n",
> > > -                        rmrru->base_address,
> rmrru->end_address);
> > > -            acpi_register_rmrr_unit(rmrru);
> > > -        }
> > > +        xfree(rmrru);
> > > +        return ret;
> > >      }
> > >  
> > > +    ret = register_one_rmrr(rmrru);
> > > +    if ( ret )
> > > +        xfree(rmrru);
> > >      return ret;
> > 
> > Please try to make this a single xfree() and a single return (with
> > again a blank line preceding it).
> 
> Got it, I will make changes you mentioned.
> > 
> > Jan

^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2015-03-13  9:36 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-09 14:42 [PATCH 0/2] iommu: add rmrr Xen command line option elena.ufimtseva
2015-03-09 14:42 ` [PATCH 1/2] iommu VT-d: separate rmrr addition function elena.ufimtseva
2015-03-09 15:10   ` Konrad Rzeszutek Wilk
2015-03-10  2:33   ` Tian, Kevin
2015-03-11 10:29   ` Jan Beulich
2015-03-12 20:48     ` Elena Ufimtseva
2015-03-13  8:53       ` Jan Beulich
2015-03-09 14:42 ` [PATCH 2/2] iommu: add rmrr Xen command line option for misc rmrrs elena.ufimtseva
2015-03-09 15:25   ` Konrad Rzeszutek Wilk
2015-03-09 17:16   ` Andrew Cooper
2015-03-12 20:52     ` Elena Ufimtseva
2015-03-13  9:36       ` Jan Beulich
2015-03-10  2:47   ` Tian, Kevin
2015-03-10  6:24     ` Elena Ufimtseva
2015-03-10  8:26     ` Jan Beulich
2015-03-10 16:16     ` Elena Ufimtseva
2015-03-10 16:27       ` Jan Beulich
2015-03-10 18:30         ` Elena Ufimtseva
2015-03-12 21:54 [PATCH 1/2] iommu VT-d: separate rmrr addition function Elena Ufimtseva

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.