[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2 6/8] x86/iommu: call pi_update_irte through an hvm_function callback


  • To: Xenia Ragiadakou <burzalodowa@xxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Fri, 13 Jan 2023 10:13:01 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=UqMdE8TRkZlwe7RW6FFwmS0gNI30pCf2CvesE5gndbc=; b=EpNjBIpiaHcmp02V5NpvW4AJdg0+UvBc54leTRsNvC2ijt9D/6f11dTnNPX7aoChTiOIVh7JkrbTpLRq3Zz7l7fKAFot7BKVHlD7U/0dhXGuIXqMpSH72VM6YP51g7+i1k3H/cj1sl+xzrYq32B9l2ZHt3Mum/Tnl0xO0iGdXpG2550uatbzwqDKaaPDql1224xqDPkJ7NRvbh5b6QM2bjzYf3BKbpB2o3JIH5D/Smb3Mr4moGihwD9FNbtk9/I9ty+xisQfWxkUqfxOpAA5lc2NbFiaX1lm1pXT8GxZuRKUYIAJSTogzPCvTGFf6PS8KCDy1OONxPQ5agYBsz6Zmg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PQkOv7g1o2Zy40OpLBtVVK06i2rZOkRXp46QkgrUVOFkE4dMOzFnSO8/LZnMan+mM7FUasG67Pl2k1Ct0FNtSRHcD4aI8FToaKhJjtPGK7xCdrorF1wib3oxg2ce8pHQ9KvuPV6+BedS/oT59LJorYo88xC3nRPO91hg0pvsMRmodu8apCSi5C0jDElw4XGQ48L5nyTQno1Uwe7vsI+aXsp4zftdV62uGhs+k0WwlAxj4y+JJ+ZTGhWxyupv6ICqbTqA8RKmYJcM932kUXHVDdPSuFOUvW4E6GVtor2zgyXBkdxJUEDXZSrNKoZH6+0E0eyvTsG0axV1Qhr/KNbB4w==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Jun Nakajima <jun.nakajima@xxxxxxxxx>, Kevin Tian <kevin.tian@xxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Paul Durrant <paul@xxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Fri, 13 Jan 2023 09:13:09 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 13.01.2023 08:44, Xenia Ragiadakou wrote:
> 
> On 1/12/23 14:37, Jan Beulich wrote:
>> On 12.01.2023 13:16, Jan Beulich wrote:
>>> On 04.01.2023 09:45, Xenia Ragiadakou wrote:
>>>> --- a/xen/arch/x86/hvm/vmx/vmx.c
>>>> +++ b/xen/arch/x86/hvm/vmx/vmx.c
>>>> @@ -2143,6 +2143,14 @@ static bool cf_check vmx_test_pir(const struct vcpu 
>>>> *v, uint8_t vec)
>>>>       return pi_test_pir(vec, &v->arch.hvm.vmx.pi_desc);
>>>>   }
>>>>   
>>>> +static int cf_check vmx_pi_update_irte(const struct vcpu *v,
>>>> +                                       const struct pirq *pirq, uint8_t 
>>>> gvec)
>>>> +{
>>>> +    const struct pi_desc *pi_desc = v ? &v->arch.hvm.vmx.pi_desc : NULL;
>>>> +
>>>> +    return pi_update_irte(pi_desc, pirq, gvec);
>>>> +}
>>>
>>> This being the only caller of pi_update_irte(), I don't see the point in
>>> having the extra wrapper. Adjust pi_update_irte() such that it can be
>>> used as the intended hook directly. Plus perhaps prefix it with vtd_.
>>
>> Plus move it to vtd/x86/hvm.c (!HVM builds shouldn't need it), albeit I
>> realize this could be done independent of your work. In principle the
>> function shouldn't be VT-d specific (and could hence live in x86/hvm.c),
>> as msi_msg_write_remap_rte() is already available as IOMMU hook anyway,
>> provided struct pi_desc turns out compatible with what's going to be
>> needed for AMD.
> 
> Since the posted interrupt descriptor is vmx specific while 
> msi_msg_write_remap_rte is iommu specific, can I propose the following:
> 
> - Keep the name as is (i.e vmx_pi_update_irte) and keep its definition 
> in xen/arch/x86/hvm/vmx/vmx.c
> 
> - Open code pi_update_irte() inside the body of vmx_pi_update_irte() but 
> replace intel-specific msi_msg_write_remap_rte() with generic 
> iommu_update_ire_from_msi().
> 
> Does this approach make sense?

Why not - decouples one place of the assumed "CPU vendor" == "IOMMU vendor".

Jan



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.