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

Re: [XEN PATCH v10 5/5] domctl: Add XEN_DOMCTL_gsi_permission to grant gsi


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: "Chen, Jiqian" <Jiqian.Chen@xxxxxxx>
  • Date: Thu, 20 Jun 2024 09:40:25 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.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=XC5nzhJNZXlpnr5jo9kN5ci/J7Al/DdElf+vDCVtvKs=; b=iO0U4Ak1WzHFKRkwW5GXhGjzsb3h8HScyoOn3om2b6GUFliMxnwIob1npf+uJNDA0/lF6BBU4534GHhz208LmH2Dt4iuj+ehjzVsYyOUe5CPqD5BGVqMobYk71x74qmpC3efcP6ar1vuDEiYZLeMhTWYb4nCOSkV3G+0rNRFeiPfzf+DHEz2NwUUk0+dMj1WxqdjMNNE9QvAYt0FEDRt5VJivmNnDNNtoDoe8+nbToZCNuMQkbNMp3kEeIrGq5aLEXZf2BdD2t4su+EpWEwwIp6fuJQtb6Uvlx0XzWwBfVydre0fjaJT19zGmd+JLPz4gxExo2s9roesHQ1Z1wzB8A==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VelB6SPeycDl1UuXY/XXND0vOydbwdLugDBeyU/5mUm06iv4o6o65z/BGp9lqCV0YjOyeXGmGR5siTzy9X81oSAA51DWIFbNbw3b1YKcNCQwwU7KmHcA0vxJ2j8IgpKG4swy1BpmJE6zHsppXRByizfvDzXrnmlMI4ztMUaMV9BeEjHyb/gdBF4yqMvJCNY4PhDIjFEjqBa9bY6FWWkhiND53D8Mp41aKyWZ5a8OnMmH6DB3RF3Ao/td1vC8QpGR4hmb7qImAQcqh03Jt/DaDrkhjpKm1UU9xfnUdzUxInrmphCLE5bkfevaaHAX2fYG1H+ojBkY4LyTr67xZXAoXw==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Anthony PERARD <anthony@xxxxxxxxxxxxxx>, Juergen Gross <jgross@xxxxxxxx>, "Daniel P . Smith" <dpsmith@xxxxxxxxxxxxxxxxxxxx>, "Hildebrand, Stewart" <Stewart.Hildebrand@xxxxxxx>, "Huang, Ray" <Ray.Huang@xxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, "Chen, Jiqian" <Jiqian.Chen@xxxxxxx>
  • Delivery-date: Thu, 20 Jun 2024 09:40:38 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHawJTqXyg3PMEiVUiLHPQ86aZkYrHMFeyAgAGdTwD//43bAIADi4UA
  • Thread-topic: [XEN PATCH v10 5/5] domctl: Add XEN_DOMCTL_gsi_permission to grant gsi

On 2024/6/18 17:23, Jan Beulich wrote:
> On 18.06.2024 10:23, Chen, Jiqian wrote:
>> On 2024/6/17 23:32, Jan Beulich wrote:
>>> On 17.06.2024 11:00, Jiqian Chen wrote:
>>>> @@ -1516,14 +1519,39 @@ static void pci_add_dm_done(libxl__egc *egc,
>>>>              rc = ERROR_FAIL;
>>>>              goto out;
>>>>          }
>>>> -        r = xc_domain_irq_permission(ctx->xch, domid, irq, 1);
>>>> +#ifdef CONFIG_X86
>>>> +        /* If dom0 doesn't have PIRQs, need to use 
>>>> xc_domain_gsi_permission */
>>>> +        r = xc_domain_getinfo_single(ctx->xch, 0, &info);
>>>
>>> Hard-coded 0 is imposing limitations. Ideally you would use DOMID_SELF, but
>>> I didn't check if that can be used with the underlying hypercall(s). 
>>> Otherwise
From the commit 10ef7a91b5a8cb8c58903c60e2dd16ed490b3bcf, DOMID_SELF is not 
allowed for XEN_DOMCTL_getdomaininfo.
And now XEN_DOMCTL_getdomaininfo gets domain through rcu_lock_domain_by_id.

>>> you want to pass the actual domid of the local domain here.
What is the local domain here?
What is method for me to get its domid?

>> But the action of granting permission is from dom0 to domU, what I need to 
>> get is the infomation of dom0,
>> The actual domid here is domU's id I think, it is not useful.
> 
> Note how I said DOMID_SELF and "local domain". There's no talk of using the
> DomU's domid. But what you apparently neglect is the fact that the hardware
> domain isn't necessarily Dom0 (see CONFIG_LATE_HWDOM in the hypervisor).
> While benign in most cases, this is relevant when it comes to referencing
> the hardware domain by domid. And it is the hardware domain which is going
> to drive the device re-assignment, as that domain is who's in possession of
> all the devices not yet assigned to any DomU.
OK, I need to get the information of hardware domain here?

> 
>>>> @@ -237,6 +238,48 @@ long arch_do_domctl(
>>>>          break;
>>>>      }
>>>>  
>>>> +    case XEN_DOMCTL_gsi_permission:
>>>> +    {
>>>> +        unsigned int gsi = domctl->u.gsi_permission.gsi;
>>>> +        int irq;
>>>> +        bool allow = domctl->u.gsi_permission.allow_access;
>>>
>>> See my earlier comments on this conversion of 8 bits into just one.
>> Do you mean that I need to check allow_access is >= 0?
>> But allow_access is u8, it can't be negative.
> 
> Right. What I can only re-iterate from earlier commenting is that you
> want to check for 0 or 1 (can be viewed as looking at just the low bit),
> rejecting everything else. It is only this way that down the road we
> could assign meaning to the other bits, without risking to break existing
> callers. That's the same as the requirement to check padding fields to be
> zero.
OK, I will add check the other bit is zero except the lowest one bit.

> 
> Jan

-- 
Best regards,
Jiqian Chen.

 


Rackspace

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