[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v12.2 09/15] vpci/header: program p2m with guest BAR view



On Tue, Jan 16, 2024 at 10:01:24PM -0500, Stewart Hildebrand wrote:
> On 1/15/24 14:44, Stewart Hildebrand wrote:
> > diff --git a/xen/drivers/vpci/header.c b/xen/drivers/vpci/header.c
> > index feccd070ddd0..8483404c5e91 100644
> > --- a/xen/drivers/vpci/header.c
> > +++ b/xen/drivers/vpci/header.c
> > @@ -41,13 +42,24 @@ static int cf_check map_range(
> >      unsigned long s, unsigned long e, void *data, unsigned long *c)
> >  {
> >      const struct map_data *map = data;
> > +    /* Start address of the BAR as seen by the guest. */
> > +    unsigned long start_gfn = PFN_DOWN(map->bar->guest_addr);
> > +    /* Physical start address of the BAR. */
> > +    unsigned long start_mfn = PFN_DOWN(map->bar->addr);
> >      int rc;
> >  
> >      for ( ; ; )
> >      {
> >          unsigned long size = e - s + 1;
> > +        /*
> > +         * Ranges to be mapped don't always start at the BAR start 
> > address, as
> > +         * there can be holes or partially consumed ranges. Account for the
> > +         * offset of the current address from the BAR start.
> > +         */
> > +        unsigned long map_mfn = start_mfn + s - start_gfn;
> > +        unsigned long m_end = map_mfn + size - 1;
> >  
> > -        if ( !iomem_access_permitted(map->d, s, e) )
> > +        if ( !iomem_access_permitted(map->d, map_mfn, m_end) )
> 
> Nit: since this check will now use map_mfn and m_end...
> 
> >          {
> >              printk(XENLOG_G_WARNING
> >                     "%pd denied access to MMIO range [%#lx, %#lx]\n",
> >                     map->d, s, e);
> 
> ... I'd like to also update the arguments passed to this print statement.

Indeed.  You will need a new version.

Thanks, Roger.



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.