From patchwork Mon Oct 2 15:11:26 2023 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: 13406376 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 4ACA8E784BC for ; Mon, 2 Oct 2023 15:27:13 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.611673.951222 (Exim 4.92) (envelope-from ) id 1qnKp0-0002dX-Ti; Mon, 02 Oct 2023 15:26:58 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 611673.951222; Mon, 02 Oct 2023 15:26:58 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qnKp0-0002dQ-Ot; Mon, 02 Oct 2023 15:26:58 +0000 Received: by outflank-mailman (input) for mailman id 611673; Mon, 02 Oct 2023 15:26:57 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qnKbH-0001wY-Pj for xen-devel@lists.xenproject.org; Mon, 02 Oct 2023 15:12:47 +0000 Received: from esa5.hc3370-68.iphmx.com (esa5.hc3370-68.iphmx.com [216.71.155.168]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 235d5713-6136-11ee-9b0d-b553b5be7939; Mon, 02 Oct 2023 17:12:45 +0200 (CEST) Received: from mail-bn1nam02lp2045.outbound.protection.outlook.com (HELO NAM02-BN1-obe.outbound.protection.outlook.com) ([104.47.51.45]) by ob1.hc3370-68.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 02 Oct 2023 11:12:40 -0400 Received: from MW4PR03MB6428.namprd03.prod.outlook.com (2603:10b6:303:123::8) by PH0PR03MB6680.namprd03.prod.outlook.com (2603:10b6:510:b8::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6813.28; Mon, 2 Oct 2023 15:12:37 +0000 Received: from MW4PR03MB6428.namprd03.prod.outlook.com ([fe80::ddbc:172e:c4a3:ec6f]) by MW4PR03MB6428.namprd03.prod.outlook.com ([fe80::ddbc:172e:c4a3:ec6f%4]) with mapi id 15.20.6813.035; Mon, 2 Oct 2023 15:12:37 +0000 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: 235d5713-6136-11ee-9b0d-b553b5be7939 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1696259565; h=from:to:cc:subject:date:message-id:in-reply-to: references:content-transfer-encoding:mime-version; bh=ISEr4708eEwbI3KjLaRXRXqE7bGvsZ1eF/8NLrTQb+w=; b=huMNTENRjU57cQQW1AMrils2MTHUbL3gWoRqQbP+US/WARSMXJr0iPZ+ VgHCRuDMCljiTLzo29Z7AXaovmGAaGSlbxNmJLz8cRcmxH78JpMx1CfgK 3RH6n2q8sI/sJ4haJcm8EfTeIrNbS7lc/JIVS8AcWzoVjqKLwxTg1MydC Y=; X-CSE-ConnectionGUID: EThC2Pw1SM+Pq+xJ5JBmVQ== X-CSE-MsgGUID: bcCHyozXS4KaOg4WvcpTGQ== X-IronPort-RemoteIP: 104.47.51.45 X-IronPort-MID: 123016651 X-IronPort-Reputation: None X-IronPort-Listener: OutboundMail X-IronPort-SenderGroup: RELAY_O365 X-IronPort-MailFlowPolicy: $RELAYED X-ThreatScanner-Verdict: Negative IronPort-Data: A9a23:XVvm86JGMkjTNITLFE+RCpQlxSXFcZb7ZxGr2PjKsXjdYENS0mcCn zRMWj+GaamJazD8eIx3boyy9ksFvpPTx9ExSgVlqX01Q3x08seUXt7xwmUcnc+xBpaaEB84t ZV2hv3odp1coqr0/0/1WlTZhSAhk/nOHvylULKs1hlZHWdMUD0mhQ9oh9k3i4tphcnRKw6Ws Jb5rta31GWNglaYCUpKrfrYwP9TlK6q4mhB5gRkPakjUGL2zBH5MrpOfcldEFOgKmVkNrbSb /rOyri/4lTY838FYj9yuu+mGqGiaue60Tmm0hK6aYD76vRxjnVaPpIAHOgdcS9qZwChxLid/ jnvWauYEm/FNoWU8AgUvoIx/ytWZcWq85efSZSzXFD6I+QrvBIAzt03ZHzaM7H09c5aPWFlr 8QHcQsoLSiaxPKUnZCRT9dV05FLwMnDZOvzu1lG5BSBV7MMZ8mGRK/Ho9hFwD03m8ZCW+7EY NYUYiZuaxKGZABTPlAQC9Q1m+LAanvXKmUE7g7K4/dupTSOpOBy+OGF3N79YNuFSN8Thk+Fj mnH4374ElcRM9n3JT+tqyj33raRw36iMG4UPLez3d57h0+j/TAwAToZCWSlquGFpXfrDrqzL GRRoELCt5Ma5EGtC9XwQRC8iHqFpQIHHcpdFfUg7wOAwbaS5ByWbkAEQzhbeZo5vck5bTUw0 xmCmNaBLT5lvaCRSHmd3qyJtj70Mi8QRUcdYQcUQA1D5MPsyKkxkxbOQ9BLAKOzyNrvFlnY2 CuWpSIzg7ESi88j1Kih+13DxTW2qfD0ohUd4wzWWiev6Fp/bYv9PYiwswCHsLBHMZqTSUSHs D4cgc+C4esSDJaL0iuQXOEKG7Lv7PGAWNHBvWNS81Aa32zF0xaekUp4uVmS+G8B3h44RALU IronPort-HdrOrdr: A9a23:Bhuvq6NHWMNAzcBcTsWjsMiBIKoaSvp037BL7SxMoHluGfBw+P rAoB1273HJYVQqOE3I6OrgBEDoexq1n/NICOIqTNSftWfdyQ+VBbAnwYz+wyDxXw3Sn9Qtsp uIqpIOauEY22IK6PrH3A== X-Talos-CUID: 9a23:8hRE6GnzKgGtZc9ay+adNyhAc1LXOVDhzFyKG1DhMkMqcKTWWX3N2olhrfM7zg== X-Talos-MUID: 9a23:K4lArQw3M77h7+Xaes4WGthnBwCaqK6lI2Acloc2gJWnPAt/ZwiDhyyLbbZyfw== X-IronPort-AV: E=Sophos;i="6.03,194,1694750400"; d="scan'208";a="123016651" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=B6kI5LCSU2srIB1HfXrjCwMEFt0JS9nLmfA1cIRT+6xhDABP383HQxmxSxIBdhaM6DmqSNOTom9+bxwxgB3K1awH46/52wU3fkzJWTxKsbAnmK8HQ9QeuPYDj3YZCa4eGNrvw0CdMSGIq4KXKypRDLkFNbfCv7IvL6fc8qOBUBhJB8bcoigiB3ZqyCEx0Ha7rA304Cp3potgLgh2SDOH8314FY+uE6/phbMwfqXHpN1pz6ny3qJtc+qIYzcI1ya7tTv2Xav0aQAAi52TKkhn7da5MiFTQ59ZkhGAvKEYz5I/C8iL/zJ3evPiEn/uZumyUmAVF0nWjQSKNFxoTWNhbw== 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=7m2lah6wFlfwWH+A26m4qMx9JvqC1q31TDTiVbHZVwE=; b=JhK6fpJM+kTBKRt29lBa9ROx2IP1RZ7LSji2ioJPzDfmlAZ2ENl6FUHLEezNwJZjvq9LeBf+4w15i79gQJAV8qbur8SEKFMoGW179RtxnZJYGVdOVSUiThyCoKXygRaX8kMDn5w5nDC0MdyRmNGe+r//qQQBQ8BIbwZidYq6WvD5zFJaDrE2ARcBlXqxb8Sr2o1LfmHe6n12ey0bTyRgFelAlWdWvPp2aabeMC1IPKf7m0/NfN5C4lLANqtWcSbF3qgqeOT9L9uvYFH0xsOkyC/VcT0tIgycplRUIwvobrIxjpSw+qnL2+qN6KjDed1QLVMxpk6Eoog7EBjvh8FUyw== 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=7m2lah6wFlfwWH+A26m4qMx9JvqC1q31TDTiVbHZVwE=; b=sIWT0N62ft08A98pBrp+A/jb5otBpQgG4f1t/qdf+lcXKG4X82VmOGlildttBJPiId5ribSoCiFyssKMBcmbA/4ncLKVFxCRfiCux13XmdznJfrJT9mkNuQAKX3CQvNs2XjN6K26f9oQgj+WbbqSMTdUJfyzvh8C4RhWCP0WWX8= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com; From: Roger Pau Monne To: xen-devel@lists.xenproject.org, henry.wang@arm.com Cc: Jan Beulich , Andrew Cooper , =?utf-8?q?Roger_Pau_Monn=C3=A9?= , Wei Liu , George Dunlap , Julien Grall , Stefano Stabellini Subject: [PATCH v5 09/10] x86: introduce GADDR based secondary time area registration alternative Date: Mon, 2 Oct 2023 17:11:26 +0200 Message-ID: <20231002151127.71020-10-roger.pau@citrix.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231002151127.71020-1-roger.pau@citrix.com> References: <20231002151127.71020-1-roger.pau@citrix.com> X-ClientProxiedBy: LO4P123CA0612.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:314::6) To MW4PR03MB6428.namprd03.prod.outlook.com (2603:10b6:303:123::8) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MW4PR03MB6428:EE_|PH0PR03MB6680:EE_ X-MS-Office365-Filtering-Correlation-Id: 64533fec-d3b2-4872-8c6a-08dbc35a0307 X-LD-Processed: 335836de-42ef-43a2-b145-348c2ee9ca5b,ExtAddr,ExtFwd X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: /nFX61vIBpa8OF5B51IvTc6x5Q0bxZiK66nBTbZZCU5BWhcbk/pRi+X1n4LhlWK5AorC1MNjpWVHivSqKeDbMFk0iFXOlqzyNZfC5R3LKO0AQ3r6SSsSqVRHROd+8uOexGOVvKgMBmTPXoUh4mzWAAkcMHyRaO7Ui6STVH3zXK5rAL3PQNQjEz1aJZ4utH4dACFppcdYuySD/5aNBUUE/tJjlfioyfAwZyW/xbshGrh0VTRMqblxzkpLPnif9JdTfdoxg+ksIglEv9YKpDgJBImP7nNtDiVpdHykNWH8Y6hJ6cWYY5C+K2jwD5Q4l89ZJIAr1ApqlH6Aw80z/jzObP8dmGIul8IDBfGQd5sOWal1vmaoKvVyvD2T1e9gIe2k+wAG9tc2ckGFvY9AZ0uPgd6KZUDlTSIvXJVJ4ei6W0vCDhFHdM2VlqeqLjqoK5aJQTmgwYS1e1Q11MdyxguHBhX0V6wXYLPPwDXSJgr2LjXWBS9aY7UaL40wtjgicoGoyS8c3GfVBEkh2b6KdhOkDyp7t03/qv1p9A2cbTyXA/DtOJZ1sKGhFciCd9/19dtt X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MW4PR03MB6428.namprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(376002)(366004)(396003)(346002)(136003)(39860400002)(230922051799003)(451199024)(186009)(1800799009)(64100799003)(36756003)(2906002)(26005)(478600001)(4326008)(8676002)(8936002)(6666004)(6486002)(6512007)(6506007)(83380400001)(2616005)(1076003)(41300700001)(316002)(54906003)(66556008)(66476007)(66946007)(5660300002)(38100700002)(86362001)(82960400001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?/cd4zj24L+TYFyaCkxhwDlUEqQ0+?= =?utf-8?q?9dFf4rCI6cnUvmuXz8cKiOp1w2XGbki8AAigCDArzuQg8bEgtt0uTcD0QlfnBDwGb?= =?utf-8?q?hHGn7/KA6ZRLXJMCrsSOTy+FeSNSMFtpC3NWwg4PFmJo8Gy2WsxWcgTY8RimiBS+a?= =?utf-8?q?1boH51ENRKiyM1h9XnG5ltJ8uTXmxI6LBu5hWn5DKJvBhUcV9P8WSif+MXTVCFpOp?= =?utf-8?q?87nq5R4KqKgt7O/LSSikotUhWrcNGp8B7ku4+8ZpA5SNKN3iHGIaAqBPDDQnuC+1d?= =?utf-8?q?7MubteHZiIUFm5Y4bamWlcEItrdkf3V0YGHZ9+wAZRiqfKSam1lJPlcl4/dT3w+bj?= =?utf-8?q?MzFeVPBOzucMDFS+jSyEAZ86hfWBzWs9cdHP+SngL9HNZmwusfD/aEzC/dVImw2V9?= =?utf-8?q?mdPbnc3vlWY+a3jFy6r3SPO8Bqj5RBX7C1zg5o8q0so3yxquN/PH0XugWFpOXdekx?= =?utf-8?q?8Sj3NYBB4GnTW4dp9SvLJS5e3uy9JrGrkapQ0PA5/HwAKYK34t2VKJTSiVVQqfDfC?= =?utf-8?q?X4ZTaup1mwaH3RbFLtWGyvZssRqwhcdNKhc3TYGLJia6AEoyCisqTzgIJVuEoEOZr?= =?utf-8?q?jVy6Bz1g/Z2HiomZ7gBnFySJ1fsXZWkLJaTBZK05hnkGHLCCWwAhdE+LjvFO54cLX?= =?utf-8?q?Faldtc2yfv7vI3W5VfND4MfjmNetkk/rJ8ZOkjhVYzVDZ24Wvx8pV94sBTqDtnSgz?= =?utf-8?q?1JxZCwowfiAurLnEgqlD9daweNb/hLoXKOo4bzuG06nonVhz3AojvJchEHJw06u4J?= =?utf-8?q?co/qThXbsrBhVNFa5QjnOwLX7LQxxG+23CBUZ8A8EJi3kxAjj/jYEg6rFpZd+8/U8?= =?utf-8?q?H6sCoS1gyaQ2ZHlTFabEcZdrNaI+VBS/UT+E7xpoPeemR+zCWq3TClTvoScdHBeb9?= =?utf-8?q?kTLwKwTGMcSW4Qyy1TLzWDMb7HswsJ+E+Wt651qix09URCXHu9Bb5rrwRCGT0SML9?= =?utf-8?q?cYOnyb18/3Au9PP87KDnbk4UD3BeKWGowrjswIGfhWMuOiC+/y/Hv6c58UtsXYmUC?= =?utf-8?q?T16JPg9z9xwFoBWQ6+v46dmytp+QLo7RLfi2Noes8CNUudifwpoY1HmsIJDKLmwqo?= =?utf-8?q?CAoJXhUZWu5H9qlCfbX43vexYFayPlhklLlu5rzvRJ/xiBe1SI59tn+T9AzSC2v7D?= =?utf-8?q?IPnnwBYBr+G0RghwQDDf3Ltmpt4yo0ZfnlHxC/bo6zeigkBCU4SA7oKLDO0AGtEf2?= =?utf-8?q?M/inlBJvPjtRy2GcIOtCJu7eAAHhdHU3XWD8b+qlsSkmfkGg5w6aUt/OU4mlCLpot?= =?utf-8?q?Ew5y1LrP5WtGpeltfeiPmpHz7SibCHigPpITeUYIXLVOFmU2cVCPiH1/J74fuoveU?= =?utf-8?q?oeLf7EgX+YXKhau4KlR8wCviylHeGfe1hVatKRn+L/34dSdJ5ZBntw8aKyclILND4?= =?utf-8?q?RoWgPiNRQn18k9Sqn7vzewADzbywEIcX6QhzrI/supNkIMrz++PQ5WgDDHC4hAtaP?= =?utf-8?q?ENvtg1C0QP6Z491uu9Ow1b0/g4GUXT+JUTlb/gqSC39fj33fRw8ARHfaI1xnP1hhF?= =?utf-8?q?cZYnd0Q8s/8wXhxmyPE1X7afdGfPehQ7Fg=3D=3D?= X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: Y9nBoyHWajCiTn9EZ3PIX/lCb2YF/XDZXan2x4PdTMIMDfR06hOKYt3u6xaYdmeUTUjxAUKXPzRa98FYjg+QjiVyJVjL/gSzTFY8N0XV0ADJXJa6r/ZnNOaemwC8d1rZ8j/yY2lSwPpL58RewNWl5/t/nfBUXCx5TtRM150WlL6V3EHOTASbsb183Acffaq+aRJnJzj5XJC3CVUsHd1GoVtRlmHcBZookppVCgq6mAoizsHX7eGOOFfB+sPY3g7zCBPIpuoH0qdVEilE8orbifRmddMKDGbAbxNYvz6Sx3WLOTkYCVLGuTvMhdOS3F4+z1AMZ1hpn5HDCGCgl5Ql0bqIkKtAvNVzU7eQQI2LuXmg1DNiVwbxNbMn0ynqfYtHeTXHdfG1s2pFuFqJA6Rh8hllcad81e2rH7VrH2ND+PVq6fxFt67CugfWWC6bQ8UfMSmAqPnA8d8FquEbbGpphTWcbJYb/YrYAoHBkveTFtKdcccuhrFPhb9sa1/NFZz/bOQ9Ka2z4syvUNKjV2n7xl9pEj1Muns2RWMlzvS41RYcZ6JSb9BnsAJbHufY2WTsDdXmkhdLRveXnCR13x6I1HCzpIv/iiuUuzQpfUSAeZ6hXanV9KyoYDnMu09KkhOqc1wRkXBey1eOk6JPUkXIPB36wv91Cv10j9hoI+rN3kT5fsgHjyxENhLpz6l7lwthmSaIfBSOT5d73HuX67k14kOkR/PkL1QTVI6ya1WB7xrltWqeMDxFMTvwR8M3VhZ1jNBnQ3P+/cvKeBf6pGnIxXiUaX8CwX9nmw9YDXEU3GwpjJwUokOaMqJDUwwaIyrzmqb+1FR/sUMS6wlpEpwH+aREPOFcej4BtAAoagcbdhIazIcrb9rYS+QD1buBxs87 X-OriginatorOrg: citrix.com X-MS-Exchange-CrossTenant-Network-Message-Id: 64533fec-d3b2-4872-8c6a-08dbc35a0307 X-MS-Exchange-CrossTenant-AuthSource: MW4PR03MB6428.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Oct 2023 15:12:37.0561 (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: m9tow9Svx7jXfQE2ndqbaUEWA1ca68dugLABnDYk91/hrfHf7oGIkvxnlGjfNo5XZzjTDHzL40mtsl6Fa+/V9w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR03MB6680 From: Jan Beulich The registration by virtual/linear address has downsides: The access is expensive for HVM/PVH domains. Furthermore for 64-bit PV domains the area is inaccessible (and hence cannot be updated by Xen) when in guest-user mode. Introduce a new vCPU operation allowing to register the secondary time area by guest-physical address. An at least theoretical downside to using physically registered areas is that PV then won't see dirty (and perhaps also accessed) bits set in its respective page table entries. Signed-off-by: Jan Beulich Reviewed-by: Roger Pau Monné Acked-by: Julien Grall --- xen/arch/x86/domain.c | 28 ++++++++++++++++++++++++++++ xen/arch/x86/include/asm/domain.h | 2 ++ xen/arch/x86/time.c | 10 ++++++++++ xen/arch/x86/x86_64/domain.c | 1 + xen/include/public/vcpu.h | 4 ++++ 5 files changed, 45 insertions(+) diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c index 9d352defa25e..8e0af2278104 100644 --- a/xen/arch/x86/domain.c +++ b/xen/arch/x86/domain.c @@ -1529,6 +1529,15 @@ int arch_vcpu_reset(struct vcpu *v) return 0; } +static void cf_check +time_area_populate(void *map, struct vcpu *v) +{ + if ( is_pv_vcpu(v) ) + v->arch.pv.pending_system_time.version = 0; + + force_update_secondary_system_time(v, map); +} + long do_vcpu_op(int cmd, unsigned int vcpuid, XEN_GUEST_HANDLE_PARAM(void) arg) { long rc = 0; @@ -1567,6 +1576,25 @@ long do_vcpu_op(int cmd, unsigned int vcpuid, XEN_GUEST_HANDLE_PARAM(void) arg) break; } + case VCPUOP_register_vcpu_time_phys_area: + { + struct vcpu_register_time_memory_area area; + + rc = -EFAULT; + if ( copy_from_guest(&area.addr.p, arg, 1) ) + break; + + rc = map_guest_area(v, area.addr.p, + sizeof(vcpu_time_info_t), + &v->arch.time_guest_area, + time_area_populate); + if ( rc == -ERESTART ) + rc = hypercall_create_continuation(__HYPERVISOR_vcpu_op, "iih", + cmd, vcpuid, arg); + + break; + } + case VCPUOP_get_physid: { struct vcpu_get_physid cpu_id; diff --git a/xen/arch/x86/include/asm/domain.h b/xen/arch/x86/include/asm/domain.h index e0bd28e424e0..619e667938ed 100644 --- a/xen/arch/x86/include/asm/domain.h +++ b/xen/arch/x86/include/asm/domain.h @@ -692,6 +692,8 @@ void domain_cpu_policy_changed(struct domain *d); bool update_secondary_system_time(struct vcpu *, struct vcpu_time_info *); +void force_update_secondary_system_time(struct vcpu *, + struct vcpu_time_info *); void vcpu_show_registers(const struct vcpu *); diff --git a/xen/arch/x86/time.c b/xen/arch/x86/time.c index 332d2d79aeae..73df1639a301 100644 --- a/xen/arch/x86/time.c +++ b/xen/arch/x86/time.c @@ -1628,6 +1628,16 @@ void force_update_vcpu_system_time(struct vcpu *v) __update_vcpu_system_time(v, 1); } +void force_update_secondary_system_time(struct vcpu *v, + struct vcpu_time_info *map) +{ + struct vcpu_time_info u; + + collect_time_info(v, &u); + u.version = -1; /* Compensate for version_update_end(). */ + write_time_guest_area(map, &u); +} + static void update_domain_rtc(void) { struct domain *d; diff --git a/xen/arch/x86/x86_64/domain.c b/xen/arch/x86/x86_64/domain.c index 494b0b54e64e..a02d4f569ee5 100644 --- a/xen/arch/x86/x86_64/domain.c +++ b/xen/arch/x86/x86_64/domain.c @@ -115,6 +115,7 @@ compat_vcpu_op(int cmd, unsigned int vcpuid, XEN_GUEST_HANDLE_PARAM(void) arg) case VCPUOP_send_nmi: case VCPUOP_get_physid: + case VCPUOP_register_vcpu_time_phys_area: rc = do_vcpu_op(cmd, vcpuid, arg); break; diff --git a/xen/include/public/vcpu.h b/xen/include/public/vcpu.h index 9dac0f9748ca..8fb0bd1b6c03 100644 --- a/xen/include/public/vcpu.h +++ b/xen/include/public/vcpu.h @@ -209,6 +209,9 @@ DEFINE_XEN_GUEST_HANDLE(vcpu_get_physid_t); * segment limit). It can then apply the normal algorithm to compute * system time from the tsc. * + * New code wants to prefer VCPUOP_register_vcpu_time_phys_area, and only + * fall back to the operation here for backwards compatibility. + * * @extra_arg == pointer to vcpu_register_time_info_memory_area structure. */ #define VCPUOP_register_vcpu_time_memory_area 13 @@ -235,6 +238,7 @@ DEFINE_XEN_GUEST_HANDLE(vcpu_register_time_memory_area_t); * VMASST_TYPE_runstate_update_flag engaged by the domain. */ #define VCPUOP_register_runstate_phys_area 14 +#define VCPUOP_register_vcpu_time_phys_area 15 #endif /* __XEN_PUBLIC_VCPU_H__ */