All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH RFC] p2m: p2m_mmio_direct set RW permissions
@ 2015-01-22 15:18 Elena Ufimtseva
  2015-01-22 15:36 ` Jan Beulich
  2015-01-22 15:42 ` Roger Pau Monné
  0 siblings, 2 replies; 27+ messages in thread
From: Elena Ufimtseva @ 2015-01-22 15:18 UTC (permalink / raw)
  To: JBeulich
  Cc: kevin.tian, andrew.cooper3, tim, xen-devel, yang.z.zhang,
	boris.ostrovsky, roger.pau


----- JBeulich@suse.com wrote:

> >>> On 22.01.15 at 12:37, <roger.pau@citrix.com> wrote:
> > El 22/01/15 a les 12.09, Jan Beulich ha escrit:
> >>>>> On 22.01.15 at 11:59, <andrew.cooper3@citrix.com> wrote:
> >>> On 22/01/15 09:53, Jan Beulich wrote:
> >>>>>>> On 21.01.15 at 21:55, <elena.ufimtseva@oracle.com> wrote:
> >>>>> p2m_mmio_direct should result in setting IOMMUF_readable and
> IOMMUF_writable
> >>>>> flags.
> >>>>> When pvh domain maps mmio regions, the EPT entries are not
> getting mapped.
> >>>>> This leads to IOMMU Page faults for some devices, as for example
> USB Host
> >>>>> controllers with embedded Debug devices. See
> pvh-set-need_iommu-early RFC
> >>>>> patch discussion fgor detail.
> >>>> Even more so that the two patches aren't even a series, that
> part
> >>>> of the description belongs here, not in the other patch.
> >>>>
> >>>>> I will appreciate your comments and ideas in regards to this
> change.
> >>>>>
> >>>>> Looking at Roger patches (xen/pvh: check permissions when adding
> MMIO 
> >>>>> regions)
> >>>>> the mmio memory type is proposed to be changed from
> p2m_mmio_direct to 
> >>>>> p2m_access_rw.
> >>>>> This type still does not have proper IOMMU flags mapping.
> >>>> A fundamental question is what business devices have to DMA
> their
> >>>> own (or other devices') MMIO space. I could remotely see a need
> >>>> for this for e.g. frame buffers, but I have difficulty
> understanding
> >>>> this for USB devices. Please at the very least provide details on
> the
> >>>> MMIO regions that those devices have, and which of them you
> >>>> observed IOMMU faults on.
> >>>
> >>> It would appear that, in this case, it is a USB controller lacking
> an
> >>> appropriate RMRR description in the ACPI tables.
> >> 
> >> No, RMRRs only reference RAM pages afaik.
> > 
> > According to Linux IOMMU support document RMRRs reference regions
> marked
> > as "reserved" in the e820 memory map:
> > 
> > https://www.kernel.org/doc/Documentation/Intel-IOMMU.txt 
> 
> Exactly. And MMIO PCI BARs in particular are never to be
> reflected in the E820 (not the least because they're relocatable).
> 
> > I don't think we are setting proper IOMMU entries for this regions
> at
> > all with the current PVH Dom0 code. IMHO instead of just adding
> IOMMU
> > entries for every MMIO region we should just add IOMMU entries for
> the
> > RMRR regions.
> 
> Yes, RMRR regions should certainly be put there as r/w entries.
> 
> Jan

How it will help in cases like this when this regions are not reported as RMRRs in ACPI?

Also, pv dom0 has no such problem.


Elena

^ permalink raw reply	[flat|nested] 27+ messages in thread
* Re: [PATCH RFC] p2m: p2m_mmio_direct set RW permissions
@ 2015-01-22 15:43 Elena Ufimtseva
  2015-01-23 11:19 ` Jan Beulich
  0 siblings, 1 reply; 27+ messages in thread
From: Elena Ufimtseva @ 2015-01-22 15:43 UTC (permalink / raw)
  To: JBeulich
  Cc: kevin.tian, andrew.cooper3, tim, xen-devel, yang.z.zhang,
	boris.ostrovsky, roger.pau


----- JBeulich@suse.com wrote:

> >>> On 22.01.15 at 16:18, <elena.ufimtseva@oracle.com> wrote:
> > ----- JBeulich@suse.com wrote:
> >> >>> On 22.01.15 at 12:37, <roger.pau@citrix.com> wrote:
> >> > I don't think we are setting proper IOMMU entries for this
> regions
> >> at
> >> > all with the current PVH Dom0 code. IMHO instead of just adding
> >> IOMMU
> >> > entries for every MMIO region we should just add IOMMU entries
> for
> >> the
> >> > RMRR regions.
> >> 
> >> Yes, RMRR regions should certainly be put there as r/w entries.
> > 
> > How it will help in cases like this when this regions are not
> reported as 
> > RMRRs in ACPI?
> 
> It won't help - I was merely commenting on Roger's statement.
> 
> > Also, pv dom0 has no such problem.
> 
> Even with "iommu=dom0-strict"?
> 
> Jan

Even with iommu=dom0-strict pv dom0 boots just fine.

Elena

^ permalink raw reply	[flat|nested] 27+ messages in thread
* Re: [PATCH RFC] p2m: p2m_mmio_direct set RW permissions
@ 2015-01-22 15:42 Elena Ufimtseva
  0 siblings, 0 replies; 27+ messages in thread
From: Elena Ufimtseva @ 2015-01-22 15:42 UTC (permalink / raw)
  To: JBeulich
  Cc: kevin.tian, tim, xen-devel, yang.z.zhang, boris.ostrovsky, roger.pau


----- JBeulich@suse.com wrote:

> >>> On 22.01.15 at 16:11, <elena.ufimtseva@oracle.com> wrote:
> > ----- JBeulich@suse.com wrote:
> >> A fundamental question is what business devices have to DMA their
> >> own (or other devices') MMIO space. I could remotely see a need
> >> for this for e.g. frame buffers, but I have difficulty
> understanding
> >> this for USB devices. Please at the very least provide details on
> the
> >> MMIO regions that those devices have, and which of them you
> >> observed IOMMU faults on.
> > 
> > The IOMMU Page fault addresses are 0xd5d45 and 0xd5d46 in case of 
> > ThinkCentre machine.
> > If you would like to see any other details I am happy to send them
> as well.
> 
> Yes, the two numbers alone don't tell me anything - I can't even
> judge whether they're MFNs, GFNs, or host/guest physical
> addresses that way. I also specifically asked for providing the
> BAR values of the USB controller in question, to be able to match
> up the numbers. Logs and/or lspci output will be most useful for
> this purpose.
> 
> Jan

I will send all what I have.

Elena

^ permalink raw reply	[flat|nested] 27+ messages in thread
* Re: [PATCH RFC] p2m: p2m_mmio_direct set RW permissions
@ 2015-01-22 15:11 Elena Ufimtseva
  2015-01-22 15:34 ` Jan Beulich
  0 siblings, 1 reply; 27+ messages in thread
From: Elena Ufimtseva @ 2015-01-22 15:11 UTC (permalink / raw)
  To: JBeulich
  Cc: kevin.tian, tim, xen-devel, yang.z.zhang, boris.ostrovsky, roger.pau


----- JBeulich@suse.com wrote:

> >>> On 21.01.15 at 21:55, <elena.ufimtseva@oracle.com> wrote:
> > p2m_mmio_direct should result in setting IOMMUF_readable and
> IOMMUF_writable
> > flags.
> > When pvh domain maps mmio regions, the EPT entries are not getting
> mapped.
> > This leads to IOMMU Page faults for some devices, as for example USB
> Host
> > controllers with embedded Debug devices. See
> pvh-set-need_iommu-early RFC
> > patch discussion fgor detail.
> 
> Even more so that the two patches aren't even a series, that part
> of the description belongs here, not in the other patch.
> 
> > I will appreciate your comments and ideas in regards to this
> change.
> > 
> > Looking at Roger patches (xen/pvh: check permissions when adding
> MMIO 
> > regions)
> > the mmio memory type is proposed to be changed from p2m_mmio_direct
> to 
> > p2m_access_rw.
> > This type still does not have proper IOMMU flags mapping.
> 
> A fundamental question is what business devices have to DMA their
> own (or other devices') MMIO space. I could remotely see a need
> for this for e.g. frame buffers, but I have difficulty understanding
> this for USB devices. Please at the very least provide details on the
> MMIO regions that those devices have, and which of them you
> observed IOMMU faults on.
> 
> Jan

Hi Jan

The IOMMU Page fault addresses are 0xd5d45 and 0xd5d46 in case of ThinkCentre machine.
If you would like to see any other details I am happy to send them as well.

With Dell Precision it is not known what addresses do trigger page faults because it just hangs.

I don't have an answer why the devices need to access DMA of their MMIOs. Will ask linux usb folks.

Elena

^ permalink raw reply	[flat|nested] 27+ messages in thread
* [PATCH RFC] p2m: p2m_mmio_direct set RW permissions
@ 2015-01-21 20:55 Elena Ufimtseva
  2015-01-22  9:53 ` Jan Beulich
  0 siblings, 1 reply; 27+ messages in thread
From: Elena Ufimtseva @ 2015-01-21 20:55 UTC (permalink / raw)
  To: xen-devel
  Cc: kevin.tian, tim, jbeulich, yang.z.zhang, boris.ostrovsky, roger.pau

p2m_mmio_direct should result in setting IOMMUF_readable and IOMMUF_writable
flags.
When pvh domain maps mmio regions, the EPT entries are not getting mapped.
This leads to IOMMU Page faults for some devices, as for example USB Host
controllers with embedded Debug devices. See pvh-set-need_iommu-early RFC
patch discussion fgor detail.

I will appreciate your comments and ideas in regards to this change.

Looking at Roger patches (xen/pvh: check permissions when adding MMIO regions)
the mmio memory type is proposed to be changed from p2m_mmio_direct to p2m_access_rw.
This type still does not have proper IOMMU flags mapping.

Signed-off-by: Elena Ufimtseva <elena.ufimtseva@oracle.com>
---
 xen/include/asm-x86/p2m.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/xen/include/asm-x86/p2m.h b/xen/include/asm-x86/p2m.h
index 5f7fe71..7b918de 100644
--- a/xen/include/asm-x86/p2m.h
+++ b/xen/include/asm-x86/p2m.h
@@ -695,6 +695,7 @@ static inline unsigned int p2m_get_iommu_flags(p2m_type_t p2mt)
     case p2m_grant_map_rw:
     case p2m_ram_logdirty:
     case p2m_map_foreign:
+    case p2m_mmio_direct:
         flags =  IOMMUF_readable | IOMMUF_writable;
         break;
     case p2m_ram_ro:
-- 
2.1.3

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

end of thread, other threads:[~2015-01-30 16:48 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-22 15:18 [PATCH RFC] p2m: p2m_mmio_direct set RW permissions Elena Ufimtseva
2015-01-22 15:36 ` Jan Beulich
2015-01-22 15:42 ` Roger Pau Monné
2015-01-22 16:23   ` Elena Ufimtseva
2015-01-22 17:34   ` Elena Ufimtseva
2015-01-23 10:50     ` Jan Beulich
2015-01-26 16:57       ` Elena Ufimtseva
2015-01-26 17:06         ` Jan Beulich
2015-01-26 17:30           ` Elena Ufimtseva
2015-01-27  6:41             ` Tian, Kevin
2015-01-27 15:05               ` Elena Ufimtseva
2015-01-28  2:28                 ` Tian, Kevin
2015-01-27  8:24             ` Jan Beulich
2015-01-27 15:07               ` Elena Ufimtseva
2015-01-30 16:34               ` Elena Ufimtseva
2015-01-30 16:48                 ` Jan Beulich
  -- strict thread matches above, loose matches on Subject: below --
2015-01-22 15:43 Elena Ufimtseva
2015-01-23 11:19 ` Jan Beulich
2015-01-22 15:42 Elena Ufimtseva
2015-01-22 15:11 Elena Ufimtseva
2015-01-22 15:34 ` Jan Beulich
2015-01-21 20:55 Elena Ufimtseva
2015-01-22  9:53 ` Jan Beulich
2015-01-22 10:59   ` Andrew Cooper
2015-01-22 11:09     ` Jan Beulich
2015-01-22 11:37       ` Roger Pau Monné
2015-01-22 11:54         ` Jan Beulich

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.