p2m: p2m_mmio_direct set RW permissions
RFC PATCH 1/1 p2m: p2m_mmio_direct set RW permissions
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.
--- xen/include/asm-x86/p2m.h | 1 + 1 file changed, 1 insertion(+)
xen/include/asm-x86/p2m.h +1 -0
@@ -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:
Signature · 1 line
2.1.3
Quoted 7 lines
Quoted 1 line
Quoted 1 line · On 21.01.15 at 21:55, <[email protected]> wrote:
p2m_mmio_directshould result in settingIOMMUF_readableandIOMMUF_writableflags.
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.
Quoted 7 lines
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 fromp2m_mmio_directtop2m_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
Quoted 17 lines · Jan Beulich
Quoted 7 lines
Quoted 1 line
Quoted 1 line · On 21.01.15 at 21:55, <[email protected]> wrote:
p2m_mmio_directshould result in settingIOMMUF_readableandIOMMUF_writableflags.
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.
Quoted 7 lines
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 fromp2m_mmio_directtop2m_access_rw.
This type still does not have proper IOMMU flags mapping.
Quoted 6 lines
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.
I feel it would be better to have a command line option to add extra RMRRs, similar to ivrs_{hpet,ioapic} for AMD firmware issues. Of course, this would also rely on the RMRR series currently still in design.
~Andrew
Quoted 26 lines
Quoted 1 line
Quoted 1 line · On 22.01.15 at 11:59, <[email protected]> wrote:
Quoted 17 lines · Jan Beulich
Quoted 7 lines
Quoted 1 line
Quoted 1 line · On 21.01.15 at 21:55, <[email protected]> wrote:
p2m_mmio_directshould result in settingIOMMUF_readableandIOMMUF_writableflags.
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.
Quoted 7 lines
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 fromp2m_mmio_directtop2m_access_rw.
This type still does not have proper IOMMU flags mapping.Quoted 6 lines
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.
Quoted 2 lines
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.
Jan
El 22/01/15 a les 12.09, Jan Beulich ha escrit:
Quoted 26 lines
Quoted 26 lines
Quoted 1 line
Quoted 1 line · On 22.01.15 at 11:59, <[email protected]> wrote:
Quoted 23 lines · Jan Beulich
Quoted 7 lines
Quoted 1 line
Quoted 1 line · On 21.01.15 at 21:55, <[email protected]> wrote:
p2m_mmio_directshould result in settingIOMMUF_readableandIOMMUF_writableflags.
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.
Quoted 7 lines
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 fromp2m_mmio_directtop2m_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.
Quoted 4 lines
Quoted 2 lines
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
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.
Roger.
Quoted 31 lines
Quoted 1 line
Quoted 1 line · On 22.01.15 at 12:37, <[email protected]> wrote:
El 22/01/15 a les 12.09, Jan Beulich ha escrit:
Quoted 29 lines
Quoted 28 lines
Quoted 1 line
Quoted 1 line · On 22.01.15 at 11:59, <[email protected]> wrote:
Quoted 17 lines · Jan Beulich
Quoted 7 lines
Quoted 1 line
Quoted 1 line · On 21.01.15 at 21:55, <[email protected]> wrote:
p2m_mmio_directshould result in settingIOMMUF_readableandIOMMUF_writableflags.
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.
Quoted 7 lines
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 fromp2m_mmio_directtop2m_access_rw.
This type still does not have proper IOMMU flags mapping.Quoted 6 lines
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.
Quoted 6 lines
Quoted 1 line
No, RMRRs only reference RAM pages afaik.
According to Linux IOMMU support document RMRRs reference regions marked as "reserved" in the e820 memory map:
Exactly. And MMIO PCI BARs in particular are never to be reflected in the E820 (not the least because they're relocatable).
Quoted 4 lines
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