From patchwork Thu Mar 3 10:30:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Roger_Pau_Monn=C3=A9?= X-Patchwork-Id: 12767305 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DDFC2C433EF for ; Thu, 3 Mar 2022 10:31:43 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.282992.481895 (Exim 4.92) (envelope-from ) id 1nPik8-0003YH-SQ; Thu, 03 Mar 2022 10:31:32 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 282992.481895; Thu, 03 Mar 2022 10:31:32 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nPik8-0003Y2-NF; Thu, 03 Mar 2022 10:31:32 +0000 Received: by outflank-mailman (input) for mailman id 282992; Thu, 03 Mar 2022 10:31:31 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nPik7-0003Bk-5v for xen-devel@lists.xenproject.org; Thu, 03 Mar 2022 10:31:31 +0000 Received: from esa1.hc3370-68.iphmx.com (esa1.hc3370-68.iphmx.com [216.71.145.142]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 165bcf86-9add-11ec-8eba-a37418f5ba1a; Thu, 03 Mar 2022 11:31:29 +0100 (CET) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 165bcf86-9add-11ec-8eba-a37418f5ba1a DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1646303489; h=from:to:cc:subject:date:message-id:in-reply-to: references:content-transfer-encoding:mime-version; bh=mRratOgkzBnDfVL65Q/q6CME3fnvGL4txg0FZdaWXe4=; b=F013AGF+gmXTifXtJbcegSLMmQe4ikfN1Kjs/v90XjG/hgNKoFIT+j31 kQ10u2VXcwtHY0+iusOzvLzGhZNNJ3DOAF41XDsDndb7K8MSZcTf6Zotj j0FrrgXv7kgUbawAeX9ht2Cq8vSgJ0e/WU0TxkKLaiViZ2WA6eLn1PrmK 0=; Authentication-Results: esa1.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com X-SBRS: 5.1 X-MesageID: 65783144 X-Ironport-Server: esa1.hc3370-68.iphmx.com X-Remote-IP: 162.221.156.83 X-Policy: $RELAYED IronPort-Data: A9a23:NE4+zq8zV1J7QPWF+NyrDrUDqH6TJUtcMsCJ2f8bNWPcYEJGY0x3z WpJXT3TbK3YNzamc950bYzl8EkCuZCHndQxGlBrpHg8E34SpcT7XtnIdU2Y0wF+jyHgoOCLy +1EN7Es+ehtFie0Si+Fa+Sn9T8mvU2xbuKU5NTsY0idfic5DnZ54f5fs7Rh2NQw2oDiW1rlV e7a+KUzBnf0g1aYDUpMg06zgEsHUCPa4W5wUvQWPJinjXeG/5UnJMt3yZKZdhMUdrJ8DO+iL 9sv+Znilo/vE7XBPfv++lrzWhVirrc/pmFigFIOM0SpqkAqSiDfTs/XnRfTAKtao2zhojx/9 DlCnZCiTBwnFfz1o/Q6cSUBHgthfp9q5rCSdBBTseTLp6HHW37lwvEoB0AqJ4wIvO1wBAmi9 9RBdmpLNErawbvrnvTrEYGAhex6RCXvFJkYtXx6iynQEN4tQIzZQrWM7thdtNs1rp4TQqaFP pZFAdZpRDrKWDESAWsqMqgdkOiugX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4G7dpUGmjd3yRTo8BcYEr5leaAHl500pu8w5+L 5X3kqC3qAnQi/orWDY3ZzlRhtqnk27rT4JiugIlUFSVoMYdft4sZEfxkVIC50NdRiKpLzPKN MeTf002cwmMW9zNxvizypSKZ2XLzkO9y69MwY/Upf/6UkVoJh7p3FosPD30E1wsa7VcKM0lN gsAp4Y5I2mcfVmH56VfN1xOfdfKla9Ny4kY1jiaGgOKsk8SgfwQtjMkfEI2N0= X-IronPort-AV: E=Sophos;i="5.90,151,1643691600"; d="scan'208";a="65783144" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZvwK6wCgl47O4ZB2XLNxdx9JFPlHy1IFkjp9jwBm0+U3+DWfhhr6VB39Q47S3klwd3mPn0E6FB20oz53JuUsSH0eD2yWqU4dS/JhsnxZ+pT5SlP+CgcCcwUJSOnAPc7kT6SuUrtyaPt1sJKKYK1MrhB14r6d4NxXUvQQaXqF+sHw79vL3y87hsKsPMQYuLHUhbiQi1OIVdmO7VZz9hmYFH3a3GPOGJ8oG4FjtaYl9I7DzOUXT6QTX70ORO5vgSYEUcKQQobBT/hPxE8lId92rsm4ybmgU8ZvHeojuPsH2jHqAAaznONp3HsG9zRVR3GwZrBpuCrqA0O1lY8lLiucBg== 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=vrDS53nrLLQmuLsxvZpPkLlor7GHN4Niyf5R3N6D0us=; b=ZAOSsL3/k3l1ERY4U5oB/bXhQEHzdIpxYZSdk7ULwgH7LGnQh5uOGM9nt+XcLXHHIuGK6MJUvbbQTCoOZ8Jpho96qpWMsMvxahA3c9YQkp8tUATIXvXtY3epBguvWi7h9kbCOsgkW5+wJbQNEBELV74VsEIf47gW2NjLUa8dKBaO0k95SwocCeVz6LZ3Rvi3T4WqTVkY9ItMuf1Of/DDMY5GizGHLujsm6G3nAuGRi/AdEOO/ydrwzI4Py/GqjZ7VQElA+NNC0jNH67C6WNOGBEWsC+kBHFas+UjrkwVOlNnNnrgj8LYg2XgrilT3ShZ9Rc+5iJT3EJDy+z8vNw4yg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.onmicrosoft.com; s=selector2-citrix-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=vrDS53nrLLQmuLsxvZpPkLlor7GHN4Niyf5R3N6D0us=; b=vAQqLyZ1ToV1Po65twx8+oUOEBeidXc9YlejWb+JzWt1vUZmgDah3Y7qfHLy76O5I/tn6u6ci/XJ3/SnHsJoo5LassHXsuNU9H3w6yKv1vNP8xZAXNrBb7C1d+8AVLbcVg3AwqRaS4WVzVk/wBK0EnO5SEm3T48Fmw5R1y9qrEw= From: Roger Pau Monne To: CC: Roger Pau Monne , Jan Beulich , Andrew Cooper , Wei Liu , Alex Olson , Andrew Cooper Subject: [PATCH 3/3] hvm/pirq: allow control domains usage of PHYSDEVOP_{un,}map_pirq Date: Thu, 3 Mar 2022 11:30:57 +0100 Message-ID: <20220303103057.49181-4-roger.pau@citrix.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220303103057.49181-1-roger.pau@citrix.com> References: <20220303103057.49181-1-roger.pau@citrix.com> X-ClientProxiedBy: LO2P123CA0086.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:138::19) To DS7PR03MB5608.namprd03.prod.outlook.com (2603:10b6:5:2c9::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 5dadd1f2-682e-4a83-83df-08d9fd00f842 X-MS-TrafficTypeDiagnostic: SN6PR03MB4464:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 1lzmrsbplqXhBYRiOG9gmuhpcG2y6dd2KTsqWMnnCvkEaavJ7PkR6XGkRLFytaEj7MUEWB3Us1WCDhqBu/5h0qk+CeJfqywGzL0XaN6F4JfPdvitCYXo/HJluCo0nm0wCzORkslH3Tvf/Bto5lSRtKmhRACqpOBqKZNU1g9dRrR6teJRMud0BUTqDGGKmkwJstSYnO6gy88Ym1FcnNC9YzswMoCkNES41K7mq6RFfpbZwG6pQMsICnKEzpoKF4A7aTmGCq5qgfL22qQxp1xV2gLcJqWsgsIdJ/DFI/DvgomGE3oGuDQDDQehbaBzHUic76zWXVH7qye/aNdkwyRuTsbsuQ+f1WpqJHM3OhLzJ6PMUJrZisoGhQXlGhuRdjtaWriAwbWoPE5sR6ZLEzF+uPtywbj9w6kG2jBNdv/lRWJa9bY8CR7CXjdnZernyg1sdjC8T8bbNdBOIYsSkuiw1SvZ/nwL5LAjJpKOmplqN6v0rHIAp2fSFZh/JDvH93x5t47n3QZYwJzqqztxH3BDoa5IvJM6lL1jh59KWMGcQF/vBjeKPNQErahJsGmRpxloD3VUo3BxOj4qFWOBh23u6KSpK35icEIx1pJRtDxd2rk+uqYSHaW6Nfu4fZ77h7zD2bYYlXeR7jySpK6tKsI4Vw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DS7PR03MB5608.namprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(4636009)(366004)(66556008)(66946007)(66476007)(8676002)(4326008)(86362001)(8936002)(5660300002)(82960400001)(38100700002)(2906002)(26005)(186003)(1076003)(2616005)(6486002)(6506007)(6512007)(6666004)(508600001)(6916009)(54906003)(107886003)(316002)(83380400001)(36756003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?IXZr56RjkJfVN+sPAh45zN+HvPr6?= =?utf-8?q?zantc/QqG4GfPr9tAw4Mt7inRVhKXjw0QQxb3Kuys/Q3ixRfPOBJ8xVqOsLsq7OyH?= =?utf-8?q?YHi5erjTAGDkPrrUsnJqbSjbA8asenVa0mAM04ypVbE1t24OD62qDCtibgLxivFsD?= =?utf-8?q?ut7GyQggHyVcfSzWJsBG5TWy25rH8rB5pC/zJTAARCRAlJPun/iuHEa5Bcjh1g4hj?= =?utf-8?q?9xGgP509MxYe3T9aurf7bpT2hGXTGz+W4mgxqvIo3F9Md60PaAglkurrT5rtkG3sD?= =?utf-8?q?uwLkXj1H77aMH+g0DLa5Skf0XiU8dPvAv2injuJurRsaE3skVzysZ/4vFAj67/CtH?= =?utf-8?q?V5I/lSSE7aHIm52nFQRz9oYKLu57CWK4GjPrxxz05JWuj0c0lwSZcQQQgLYJ4oAPL?= =?utf-8?q?dij7S0fPj5WWmIRlkn+htDtMvl66eoOsAc1RdtgT3w9B9f+A4lujn7s6jpzWWn2k3?= =?utf-8?q?IVgYiiKWaQDOfkvjNvTxpZfio6df0nO3EetixQDIRNGKD4D8ZUibNku2C0A3nWYuA?= =?utf-8?q?NuZNCqi8DiBhzkD5S/IN5jScHd+z05l1aXfktI0dPyU6J6PDNRfbO1F0Ox06SI+Z/?= =?utf-8?q?kGNF7itGA+cXI15eVRE4RrB7NZ4+sqJ6Iej2MFWy2kR8yYjX5wdMEOAkcALJQ9OmR?= =?utf-8?q?/Mfuw1zv0784iFJuafbUZMTaye/4NeYZjI67QG1lbWVjH4QcW2U4F0Hyx2yfNcIoB?= =?utf-8?q?c8gukg8Lz3JOhvWxotN1Ej92peb+FuBasV6DX+gzPWpKAEGkIbtS4pqFxLYUiyqZw?= =?utf-8?q?56eMNL5ESWTSgYLxsN1Y6kEGWLNEXfay7ka6yrCW2spKFN7CNkXUBULrp+pDrxjR0?= =?utf-8?q?2988hCBBv3RkIfnKxm7sJWoBaCshYQOgQkeY3Lij8ECxSnf+zWU+F519hdGwswiyU?= =?utf-8?q?R5wCvVcSyqXwvTq93CJ4UI5y2+E4qdeOEt1evFPIsK4gX9j2JFK4ruI/nIXKeWaEO?= =?utf-8?q?gw+qcpzdvip50oBV7033bTklG9xZw79JltY/YMVUmghwlGvVA1IWnBvoVXToLpwr6?= =?utf-8?q?5ZRKN7uC/+XjFN0cmykoLk8XFznaM+oXocewANfMiSb7t/0XPpY9tYPr6n8WrKGLm?= =?utf-8?q?T5A7HgJ7E6pihDTMiI1z3dKe2hVn+K9+6IIMg0T6nXfoPopzjazjB3e0Zl7/CoYYs?= =?utf-8?q?olq807sXko+MyTdSn5OLCCQmFxf9tWYJAtECDJzdaTwx2Tv5jmFULgC1p3Dcz6K/p?= =?utf-8?q?ybQF0pbii0E6MMDWuFqbkLaAEZC1/zSS1OQVuBEiGxWcxoFv43oM1gKBV3tUerMAf?= =?utf-8?q?asAOZDWHAkWldymFgfSyGzcSsYrP5qhxQc2WNYQd+kWfpaXy4X1zhf9A4VuLO6soA?= =?utf-8?q?fQMbwi5pUOpG7whAT/a2olyaAKerExSdR9we/QI9b0YaAjB3YlWXEP0r3jXnAwqHa?= =?utf-8?q?7MlNRXKPWh/E4/0FXXj3RMw8hIZS0n7HxW8o2Xae/l5c+UTeZ1MHWc3UY8pOVsVHc?= =?utf-8?q?joT/pIp8BGhO8j4/dnOQVoyUsMQib6rhXDGOGcN0nKvsJ5xtEm7pRmIyXZHOd86mz?= =?utf-8?q?CNcAgkajFTy6ODKZypCstAfSOwPG2wc3hMT1h4+8E965sHhw4FEypow=3D?= X-MS-Exchange-CrossTenant-Network-Message-Id: 5dadd1f2-682e-4a83-83df-08d9fd00f842 X-MS-Exchange-CrossTenant-AuthSource: DS7PR03MB5608.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Mar 2022 10:31:25.8928 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 335836de-42ef-43a2-b145-348c2ee9ca5b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: w2dEKg2fXNMKVhXtDje0QZds7NB37jiiL9Vqt4ay/qKOXzC0v0hlmW06/VLnjlc7fSwqsb56EZtAFi5S924ZEA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR03MB4464 X-OriginatorOrg: citrix.com Control domains (including domains having control over a single other guest) need access to PHYSDEVOP_{un,}map_pirq in order to setup bindings of interrupts from devices assigned to the controlled guest. As such relax the check for HVM based guests and allow the usage of the hypercalls for any control domains. Note that further safety checks will be performed in order to assert that the current domain has the right permissions against the target of the hypercall. Reported-by: Alex Olson Reported-by: Andrew Cooper Signed-off-by: Roger Pau Monné --- xen/arch/x86/hvm/hypercall.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/xen/arch/x86/hvm/hypercall.c b/xen/arch/x86/hvm/hypercall.c index 030243810e..9128e4d025 100644 --- a/xen/arch/x86/hvm/hypercall.c +++ b/xen/arch/x86/hvm/hypercall.c @@ -87,6 +87,13 @@ static long hvm_physdev_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg) { case PHYSDEVOP_map_pirq: case PHYSDEVOP_unmap_pirq: + /* + * Control domain (and domains controlling others) need to use + * PHYSDEVOP_{un,}map_pirq in order to setup interrupts for passthrough + * devices on behalf of other guests. + */ + if ( is_control_domain(currd) || currd->target ) + break; case PHYSDEVOP_eoi: case PHYSDEVOP_irq_status_query: case PHYSDEVOP_get_free_pirq: