_______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel
Jan Beulich
2012-Sep-27 08:25 UTC
Re: [PATCH 1 of 6 V6] amd iommu: Add 2 hypercalls for libxc
>>> On 26.09.12 at 16:46, Wei Wang <wei.wang2@amd.com> wrote: >-static unsigned int machine_bdf(struct domain *d, uint16_t guest_bdf) >+static unsigned int machine_bdf(struct domain *d, uint16_t guest_seg, >+ uint16_t guest_bdf) > { >- return guest_bdf; >+ struct pci_dev *pdev; >+ uint16_t mbdf = 0;Is that really a suitable error indicator?>@@ -207,7 +224,7 @@ void guest_iommu_add_ppr_log(struct domain *d, u32 entry[]) > log = log_base + tail % (PAGE_SIZE / sizeof(ppr_entry_t)); > > /* Convert physical device id back into virtual device id */ >- gdev_id = guest_bdf(d, iommu_get_devid_from_cmd(entry[0])); >+ gdev_id = guest_bdf(d, 0, iommu_get_devid_from_cmd(entry[0]));Zero (here and below)? You''ll have to get the segment out of the physical IOMMU''s control structure. Using plain zero is only okay (for the time being) for guest devices (under the assumption that they will all get surfaced on segment zero), i.e. for calls to machine_bdf() (and you could shrink the patch by not doing the adjustment there in the first place if only segment 0 is possible right now).>+/* Support for guest iommu emulation */ >+struct xen_domctl_guest_iommu_op { >+ /* XEN_DOMCTL_GUEST_IOMMU_OP_* */ >+#define XEN_DOMCTL_GUEST_IOMMU_OP_SET_MSI 0 >+#define XEN_DOMCTL_GUEST_IOMMU_OP_BIND_BDF 1 >+ uint8_t op; >+ union { >+ struct iommu_msi { >+ uint8_t vector; >+ uint8_t dest;For virtual x2APIC support, this ought to be 32 bits wide.>+ uint8_t dest_mode; >+ uint8_t delivery_mode; >+ uint8_t trig_mode; >+ } msi;Jan