Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1258335

Re: [RFC] vfio/type1: handle case where IOMMU does not support PAGE_SIZE size

From Will Deacon <will.deacon@arm.com>
Newsgroups linux.kernel
Subject Re: [RFC] vfio/type1: handle case where IOMMU does not support PAGE_SIZE size
Date 2015-10-28 19:00 +0100
Message-ID <qoDaW-5OU-13@gated-at.bofh.it> (permalink)
References <qoyO0-35R-61@gated-at.bofh.it> <qoBLQ-4Ye-11@gated-at.bofh.it> <qoCyd-5zy-3@gated-at.bofh.it> <qoCRz-5GB-13@gated-at.bofh.it> <qoDaW-5OU-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Wed, Oct 28, 2015 at 06:48:41PM +0100, Eric Auger wrote:
> On 10/28/2015 06:37 PM, Alex Williamson wrote:
> > Ok, so with hopefully correcting my understand of what this does, isn't
> > this effectively the same:
> > 
> > diff --git a/drivers/vfio/vfio_iommu_type1.c b/drivers/vfio/vfio_iommu_type1.c
> > index 57d8c37..7db4f5a 100644
> > --- a/drivers/vfio/vfio_iommu_type1.c
> > +++ b/drivers/vfio/vfio_iommu_type1.c
> > @@ -403,13 +403,19 @@ static void vfio_remove_dma(struct vfio_iommu *iommu, stru
> >  static unsigned long vfio_pgsize_bitmap(struct vfio_iommu *iommu)
> >  {
> >         struct vfio_domain *domain;
> > -       unsigned long bitmap = PAGE_MASK;
> > +       unsigned long bitmap = ULONG_MAX;
> >  
> >         mutex_lock(&iommu->lock);
> >         list_for_each_entry(domain, &iommu->domain_list, next)
> >                 bitmap &= domain->domain->ops->pgsize_bitmap;
> >         mutex_unlock(&iommu->lock);
> >  
> > +       /* Some comment about how the IOMMU API splits requests */
> > +       if (bitmap & ~PAGE_MASK) {
> > +               bitmap &= PAGE_MASK;
> > +               bitmap |= PAGE_SIZE;
> > +       }
> > +
> >         return bitmap;
> >  }
> Yes, to me it is indeed the same
> >  
> > This would also expose to the user that we're accepting PAGE_SIZE, which
> > we weren't before, so it was not quite right to just let them do it
> > anyway.  I don't think we even need to get rid of the WARN_ONs, do we?
> > Thanks,
> 
> The end-user might be afraid of those latter. Personally I would get rid
> of them but that's definitively up to you.

I think Alex's point is that the WARN_ON's won't trigger with this patch,
because he clears those lower bits in the bitmap.

Will
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[RFC] vfio/type1: handle case where IOMMU does not support PAGE_SIZE size Eric Auger <eric.auger@linaro.org> - 2015-10-28 14:20 +0100
  Re: [RFC] vfio/type1: handle case where IOMMU does not support  PAGE_SIZE size Will Deacon <will.deacon@arm.com> - 2015-10-28 16:40 +0100
  Re: [RFC] vfio/type1: handle case where IOMMU does not support  PAGE_SIZE size Alex Williamson <alex.williamson@redhat.com> - 2015-10-28 17:30 +0100
    Re: [RFC] vfio/type1: handle case where IOMMU does not support  PAGE_SIZE size Eric Auger <eric.auger@linaro.org> - 2015-10-28 18:20 +0100
      Re: [RFC] vfio/type1: handle case where IOMMU does not support  PAGE_SIZE size Alex Williamson <alex.williamson@redhat.com> - 2015-10-28 18:40 +0100
        Re: [RFC] vfio/type1: handle case where IOMMU does not support  PAGE_SIZE size Will Deacon <will.deacon@arm.com> - 2015-10-28 19:00 +0100
          Re: [RFC] vfio/type1: handle case where IOMMU does not support  PAGE_SIZE size Eric Auger <eric.auger@linaro.org> - 2015-10-28 19:10 +0100
            Re: [RFC] vfio/type1: handle case where IOMMU does not support  PAGE_SIZE size Alex Williamson <alex.williamson@redhat.com> - 2015-10-28 19:20 +0100
        Re: [RFC] vfio/type1: handle case where IOMMU does not support  PAGE_SIZE size Eric Auger <eric.auger@linaro.org> - 2015-10-28 19:00 +0100
    Re: [RFC] vfio/type1: handle case where IOMMU does not support  PAGE_SIZE size Eric Auger <eric.auger@linaro.org> - 2015-10-28 18:20 +0100
    Re: [RFC] vfio/type1: handle case where IOMMU does not support  PAGE_SIZE size Will Deacon <will.deacon@arm.com> - 2015-10-28 18:20 +0100
      Re: [RFC] vfio/type1: handle case where IOMMU does not support  PAGE_SIZE size Alex Williamson <alex.williamson@redhat.com> - 2015-10-28 18:30 +0100
        Re: [RFC] vfio/type1: handle case where IOMMU does not support  PAGE_SIZE size Eric Auger <eric.auger@linaro.org> - 2015-10-28 18:50 +0100

csiph-web