[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [RFC XEN PATCH v4 4/5] domctl: Use gsi to grant/revoke irq permission
- To: Jiqian Chen <Jiqian.Chen@xxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>
- From: Stewart Hildebrand <stewart.hildebrand@xxxxxxx>
- Date: Wed, 10 Jan 2024 15:09:14 -0500
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
- 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=a3pHfw4H89dtASITYqiGXbLY90yUJiRBtlD4JKK92Kg=; b=IExF+7EvoEPxVZ/c3M0h3ENnnbs2eN0KUsvh0e8A39OwqxDy/mtjK7dMGcu0WT4iXE/hLa8CRRV0rJzUuc3Xf8gQD/PIkcZTHL3yUFGYTv6PELbozVCYLdqUnbR8GcbaL1wVizT3nIJfE20vA/PxowwE9qk5v9lLvIaKOcmZrt/NfGqhSuWfyaVZx6HYl+6fariZfydgPI5UZr/ctl7MpadqQudcWk3vK1WTfjbCfO4yljhUvAfG1lEDS8A57Uq/yaZAfPVBKIdJ3lkMc99E3ST8piIyL8QbNNmTX1AFH3L5su29xywCMg90aU9y5qYUz3q8CCHJXvmHkAz1OCeIkQ==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Lmd5A7Q+X2kAI7Bp8cmaZ/nVFyinX6noX7iuh2OSwy79AztBTeVMAU1um00xUOhwrp4ONUWPFmt3KGHfiU9RcZccadjl2cGRbGo8ReyzP0stUjEi6QklWLeM5NVj1ehGYDkjqD6U3W9bdIgC7OyWIcB1ugnn1dOEBq9SwHLstM1n5sVIHK4W8rzq/LzADTzqYjeD+8sWV9IwxDT1z70bBhAMv+JsbzMotNIXsKQimAUDj6wp/QmPhfn+/c44ZRdcoTbCus6NqzyzIfP1GUfi2pOjfBoDrE1A+xFGnM76xATRoUN6Z2OtaIRQdVfRSlqnQphvstQnIFioBxO00ZluFA==
- Cc: Jan Beulich <jbeulich@xxxxxxxx>, 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.perard@xxxxxxxxxx>, "Juergen Gross" <jgross@xxxxxxxx>, Huang Rui <Ray.Huang@xxxxxxx>
- Delivery-date: Wed, 10 Jan 2024 20:09:34 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On 1/5/24 02:09, Jiqian Chen wrote:
> diff --git a/xen/common/domctl.c b/xen/common/domctl.c
> index f5a71ee5f78d..eeb975bd0194 100644
> --- a/xen/common/domctl.c
> +++ b/xen/common/domctl.c
> @@ -653,12 +653,20 @@ long do_domctl(XEN_GUEST_HANDLE_PARAM(xen_domctl_t)
> u_domctl)
> unsigned int pirq = op->u.irq_permission.pirq, irq;
> int allow = op->u.irq_permission.allow_access;
>
> - if ( pirq >= current->domain->nr_pirqs )
> + if ( pirq >= nr_irqs_gsi )
This doesn't build on ARM, as nr_irqs_gsi is x86 only. This is a wild guess: we
may want keep the existing current->domain->nr_pirqs check, then add the new
nr_irqs_gsi check wrapped in #ifdef CONFIG_X86.
> {
> ret = -EINVAL;
> break;
> }
> - irq = pirq_access_permitted(current->domain, pirq);
> +
> + if ( irq_access_permitted(current->domain, pirq) )
> + irq = pirq;
> + else
> + {
> + ret = -EPERM;
> + break;
> + }
> +
> if ( !irq || xsm_irq_permission(XSM_HOOK, d, irq, allow) )
> ret = -EPERM;
> else if ( allow )
|