On 27/11/2019 09:40, Roger Pau Monné wrote: > On Tue, Nov 26, 2019 at 03:01:12PM +0000, Andrew Cooper wrote: >> Print the PCI coordinates in its common format and use d%u notation for the >> domain. As well as printing flags, decode them. IO_PAGE_FAULT is used for >> interrupt remapping errors as well as DMA remapping errors. >> >> Before: >> (XEN) AMD-Vi: IO_PAGE_FAULT: domain = 0, device id = 0xa1, fault address = >> 0xbf695000, flags = 0x10 >> (XEN) AMD-Vi: IO_PAGE_FAULT: domain = 0, device id = 0xa1, fault address = >> 0xbf695040, flags = 0x10 >> (XEN) AMD-Vi: IO_PAGE_FAULT: domain = 0, device id = 0xa1, fault address = >> 0xfffffff0, flags = 0x30 >> (XEN) AMD-Vi: IO_PAGE_FAULT: domain = 0, device id = 0xa1, fault address = >> 0x100000000, flags = 0x30 >> (XEN) AMD-Vi: IO_PAGE_FAULT: domain = 0, device id = 0xa1, fault address = >> 0x100000040, flags = 0x30 >> >> After: >> (XEN) AMD-Vi: IO_PAGE_FAULT: 0000:00:14.1 d0 addr 00000000bf5fc000 flags >> 0x10 PR >> (XEN) AMD-Vi: IO_PAGE_FAULT: 0000:00:14.1 d0 addr 00000000bf5fc040 flags >> 0x10 PR >> (XEN) AMD-Vi: IO_PAGE_FAULT: 0000:00:14.1 d0 addr 00000000fffffff0 flags >> 0x30 RW PR >> (XEN) AMD-Vi: IO_PAGE_FAULT: 0000:00:14.1 d0 addr 0000000100000000 flags >> 0x30 RW PR >> (XEN) AMD-Vi: IO_PAGE_FAULT: 0000:00:14.1 d0 addr 0000000100000040 flags >> 0x30 RW PR > Nit: I would place the domain id information at the beginning (since > that's more similar to gprintk format), and maybe drop the AMD-Vi > prefix, it's not very useful IMO: > > (XEN) d0 IO_PAGE_FAULT 0000:00:14.1 addr 0000000100000040 flags 0x30 RW PR > > But I'm not specially concerned.
So I debated not using d%d format. This is the DTE's "domain_id" (a.k.a. Tag in the IO-TLB) field which by convention we set to the domid of the owning device, but isn't necessarily the best option. In particular, it might be wise to use domid + 1 and choke if we ever find 0 in use. > >> + uint64_t addr = *(uint64_t *)(entry + 2); >> + >> + printk(XENLOG_ERR "AMD-Vi: %s: %04x:%02x:%02x.%u d%d addr >> %016"PRIx64 >> + " flags %#x%s%s%s%s%s%s%s%s%s%s\n", >> + code_str, iommu->seg, PCI_BUS(device_id), >> PCI_SLOT(device_id), >> + PCI_FUNC(device_id), domain_id, addr, flags, >> + (flags & 0xe00) ? " ??" : "", >> + (flags & 0x100) ? " TR" : "", >> + (flags & 0x080) ? " RZ" : "", >> + (flags & 0x040) ? " PE" : "", >> + (flags & 0x020) ? " RW" : "", >> + (flags & 0x010) ? " PR" : "", >> + (flags & 0x008) ? " I" : "", >> + (flags & 0x004) ? " US" : "", >> + (flags & 0x002) ? " NX" : "", >> + (flags & 0x001) ? " GN" : ""); > I wold rather have those added with proper defined names to > amd-iommu-defs.h. All of this is in desperate need of turning into real C structs, rather than being opencoded in terms of u32[] and offsets/shifts/masks, but such a change definitely isn't appropriate for backport. ~Andrew _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
