On 12.06.2024 04:43, Chen, Jiqian wrote:
> On 2024/6/10 23:58, Jan Beulich wrote:
>> On 07.06.2024 10:11, Jiqian Chen wrote:
>>> If run Xen with PVH dom0 and hvm domU, hvm will map a pirq for
>>> a passthrough device by using gsi, see qemu code
>>> xen_pt_realize->xc_physdev_map_pirq and libxl code
>>> pci_add_dm_done->xc_physdev_map_pirq. Then xc_physdev_map_pirq
>>> will call into Xen, but in hvm_physdev_op, PHYSDEVOP_map_pirq
>>> is not allowed because currd is PVH dom0 and PVH has no
>>> X86_EMU_USE_PIRQ flag, it will fail at has_pirq check.
>>>
>>> So, allow PHYSDEVOP_map_pirq when dom0 is PVH and also allow
>>> PHYSDEVOP_unmap_pirq for the failed path to unmap pirq. And
>>> add a new check to prevent self map when subject domain has no
>>> PIRQ flag.
>>>
>>> Signed-off-by: Huang Rui <ray.hu...@amd.com>
>>> Signed-off-by: Jiqian Chen <jiqian.c...@amd.com>
>>> Reviewed-by: Stefano Stabellini <sstabell...@kernel.org>
>>
>> What's imo missing in the description is a clarification / justification of
>> why it is going to be a good idea (or at least an acceptable one) to expose
>> the concept of PIRQs to PVH. If I'm not mistaken that concept so far has
>> been entirely a PV one.
> I didn't want to expose the concept of PIRQs to PVH.
> I did this patch is for HVM that use PIRQs, what I said in commit message is 
> HVM will map a pirq for gsi, not PVH.
> For the original code, it checks " !has_pirq(currd)", but currd is PVH dom0, 
> so it failed. So I need to allow PHYSDEVOP_map_pirq
> even currd has no PIRQs, but the subject domain has.

But that's not what you're enforcing in do_physdev_op(). There you only
prevent self-mapping. If I'm not mistaken all you need to do is drop the
"d == current->domain" checks from those conditionals.

Further see also
https://lists.xen.org/archives/html/xen-devel/2024-06/msg00540.html.

Jan

Reply via email to