[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH v7.1 4/4] xen/x86: Allow stubdom access to irq created for msi.
On 26.09.2019 06:05, Marek Marczykowski-Górecki wrote: > Stubdomains need to be given sufficient privilege over the guest which it > provides emulation for in order for PCI passthrough to work correctly. > When a HVM domain try to enable MSI, QEMU in stubdomain calls > PHYSDEVOP_map_pirq, but later it needs to call XEN_DOMCTL_bind_pt_irq as > part of xc_domain_update_msi_irq. Give the stubdomain enough permissions > over the mapped interrupt in order to bind it successfully to it's > target domain. > > This is not needed for PCI INTx, because IRQ in that case is known > beforehand and the stubdomain is given permissions over this IRQ by > libxl__device_pci_add (there's a do_pci_add against the stubdomain). > > create_irq() already grant IRQ access to hardware_domain, with > assumption the device model lives there. > Modify create_irq() to take additional parameter, whether to grant > permissions to the domain creating the IRQ, which may be dom0 or a > stubdomain. Do this instead of granting access always to > hardware_domain. Save ID of the domain given permission, to revoke it in > destroy_irq() - easier and cleaner than replaying logic of create_irq() > parameter. Use domid instead of actual reference to the domain, > because it might get destroyed before destroying IRQ (stubdomain is > destroyed before its target domain). And it is not an issue, > because IRQ permissions live within domain structure, so destroying > a domain also implicitly revoke the permission. Potential domid > reuse is detected by checking if that domain does have permission > over the IRQ being destroyed. > > Then, adjust all callers to provide the parameter. In case of Xen > internal allocations, set it to false, but for domain accessible > interrupt set it to true. > > Inspired by > https://github.com/OpenXT/xenclient-oe/blob/5e0e7304a5a3c75ef01240a1e3673665b2aaf05e/recipes-extended/xen/files/stubdomain-msi-irq-access.patch > by Eric Chanudet <chanudete@xxxxxxxxxxxx>. > > Signed-off-by: Simon Gaiser <simon@xxxxxxxxxxxxxxxxxxxxxx> > Signed-off-by: Marek Marczykowski-Górecki <marmarek@xxxxxxxxxxxxxxxxxxxxxx> > Reviewed-by: Roger Pau Monné <roger.pau@xxxxxxxxxx> Acked-by: Jan Beulich <jbeulich@xxxxxxxx> with a couple of cosmetic things addressed, which I'll do while committing. Jan _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |