From patchwork Fri Apr 30 15:51:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Roger_Pau_Monn=C3=A9?= X-Patchwork-Id: 12233715 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D9E0CC43461 for ; Fri, 30 Apr 2021 15:54:02 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 6421261462 for ; Fri, 30 Apr 2021 15:54:02 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6421261462 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=citrix.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.120596.228068 (Exim 4.92) (envelope-from ) id 1lcVSV-0000VV-K9; Fri, 30 Apr 2021 15:53:39 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 120596.228068; Fri, 30 Apr 2021 15:53:39 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lcVSV-0000VO-HC; Fri, 30 Apr 2021 15:53:39 +0000 Received: by outflank-mailman (input) for mailman id 120596; Fri, 30 Apr 2021 15:53:37 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lcVST-0000Uy-FP for xen-devel@lists.xenproject.org; Fri, 30 Apr 2021 15:53:37 +0000 Received: from esa3.hc3370-68.iphmx.com (unknown [216.71.145.155]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id d3d89862-0dae-4dfc-b2c7-b3bc4ff36182; Fri, 30 Apr 2021 15:53:35 +0000 (UTC) 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: d3d89862-0dae-4dfc-b2c7-b3bc4ff36182 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1619798015; h=from:to:cc:subject:date:message-id: content-transfer-encoding:mime-version; bh=wjV7ebxtK0uP+q4vxYvlR5zF4mPzAmFR4kAEUmMMWTA=; b=dX+fPy5g2j0KsYgrhwmJD2UKCbQKBXJ0PrV0XuSy7Q3QvvVN4lXslS00 lDM/23/f55ltqaYbWVjDa4ppIcO+8i3Y6/liMw+05KeaLDjLPjWdpZAfr cpMjYDKd4p1nrAKgst66iHlDzq5u4GHZw6yNUKUzxRSMA8ruVH1e4oD7s s=; Authentication-Results: esa3.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com IronPort-SDR: VpQ7Su9F3sZBWN8ydXp0kJutSVCOs5pFf7hWUSsSHULjWRqS1yzWqNuf04QYb/id9uqoNXOtBU ty+2iuJ7f0+68I4v1Vfi24oSJxpjU4tZEjZZVNvZNvoTlCGu1BTeLdrsSNnJ8MKWn8JqQW0gjO p8Uq5LXQGPQn0WrPmIlI9Wwy/SOa32eIZhBRZ5X6WjA3A1wpnfjaS6rRs8wtwFZ072EucOq80P yg/6rhgRwv5PTwedHbHheHebU0Vp28OqGhWxBCk7rKaEwWTuSw6c91sthZ0cVEXJFx+XR0CQc6 xVQ= X-SBRS: 5.1 X-MesageID: 42829620 X-Ironport-Server: esa3.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED IronPort-HdrOrdr: A9a23:8P77LahSVFrcUOYBrPgZDcSER3BQXk8ji2hD6mlwRA09T+Wzkc eykPMHkSLugDEKV3063fyGMq+MQXTTnKQFhLU5F7GkQQXgpS+UPJhvhLGSoQHINg/f0qpz1a J8f7MWMrfNJHVZreK/2gm3FN483MKKmZrEuc7yx2pgJDsaD51IwBx+Dm+gfnFeYCljKd4HGI GH5sxBzgDQGkg/SsigHHEKU6ziirTw9a7OWhINCx455ATmt1rB1JfAHwGczlMiVVp0rosKy3 TPkADy+8yY082T9xm07QHuxqUTvOHBo+EpOPCx X-IronPort-AV: E=Sophos;i="5.82,263,1613451600"; d="scan'208";a="42829620" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KE/O9yJgxjPbnTGY+viRy7X+iFw1HLrjUHLuevCOZMvOtycfVwWZxCMPPqJH/qjquIzTvDkWP75i6sKm08dyU1lo0VMtnHd0omRAxfyvWQW2z+ZZYHJmTEs22gBrkqUZY9WgBjyprsuFEHNz4wBWO3cgjAPNGPUx39NrT0smamt2Yv+0ECv5bG085TDgTkhEPGwkhERrCqedAR24I9tr5T9C0qJOnHfq6lDFiIe52ZlpN4EDcAApTqSfyfY2oc1Lt2xiMjEqEdkHI6SqMpFLV8UXVWzMC1weU0wz4pakppwXoNi+9R047NftOLY5ineBfte8H/GrgwFRz8ZhqbDn6Q== 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-SenderADCheck; bh=EY6MmV3Lly/+H2Zssd+ZQFW2+lQksSIYRPGLPmNTCOw=; b=NB5cZBCdeTR4wIjPtbHvycjugIYyMDGRhwENXeCADQpWe5UzSXkAGQkGH0Q7S5LUwJfWVHP+f+zKBEDvjkNYCSlJLJYoJOtUU3BSl0SVI3pbtyek+7KNZ+HJejY8H5X2j/XgftaPP724tCVBqun5xAN3OI3A7N4Lgm0k7VU6u4gtCTCXcGUVRkeBtA1GofLxGsYIlrVknWLSIjntCr5clPWthMCzWgXtAdw+RbiJeLLd1yXww6746rzTvN1t+rk+Xgiw8wzrCgjJQT5G6DUTFENr/gL6UToig7hZWYu2KC2XxjV5hdJqF55l8i/QB7BAY7vtKVhucEVGw+gQILiCvA== 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=EY6MmV3Lly/+H2Zssd+ZQFW2+lQksSIYRPGLPmNTCOw=; b=MitmPq+a/XiR2M3gT7gDA7Vny/KJtGFG2mm4C33/3w/eMwChuR0FYTRi5uH4CRY+WntnExjmSIjtdUpiuLW6j+9W/lpGQVosngAAt1mMkRnw2PcTITzrXMAqFyHn8znNgtn/NbMkjpw88XuQW3ZnA2FA2zm9ildK17VOn+U/hdc= From: Roger Pau Monne To: CC: Andrew Cooper , Roger Pau Monne , Ian Jackson , Wei Liu , Anthony PERARD Subject: [PATCH v3 00/13] libs/guest: new CPUID/MSR interface Date: Fri, 30 Apr 2021 17:51:58 +0200 Message-ID: <20210430155211.3709-1-roger.pau@citrix.com> X-Mailer: git-send-email 2.31.1 X-ClientProxiedBy: MR2P264CA0062.FRAP264.PROD.OUTLOOK.COM (2603:10a6:500:31::26) To DS7PR03MB5608.namprd03.prod.outlook.com (2603:10b6:5:2c9::18) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 3717d5ca-dafa-4080-43ee-08d90bf019e3 X-MS-TrafficTypeDiagnostic: DM5PR03MB2923: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:10000; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: V9ogXIjLseEfOkq/TnzxM8xFIE5DY/FLVHbjvNOns3uEg2yWJwpBfxYuvMTplo2Wdnmf71NWchRaVHZ3JrPephAY3jADLpBELHWDd43U5aaeXVmvu6r0vJr1LIjznSytl+lILW5sf67o8LtHyhfX5JXLul8TokI+xXjXI74nN/Zrc7iLEBAjt+Ulag8M9Pi+LrInM8/VMBqJAWnsQZz2wnYlg3D7DeAhU54pt7ZYCbKAscS5sXP2U+dda/SHQNrqLesYbsFkPB00CtITkAS+rLOg7bXSIf+dH/iztymo17NBzY5cypLmU2YWhWoFpuy8pD44GVyqpno68Kp9s5nXpwUZcse+KRxXDy3J7XzxO6RPYAbeMwMXFCzALxwkfa/mMp/L+Q5b/W8BSbb2FRmu+hAAKjyDS5drEsQ5vhQG65GUXYKGHGN/SBzrQi3xzuFlqoUREvucyWXGulHTbhLzUu958zjM4KOqQ34BAx3dZ/ACvSNgTzd6CQ0ILVoybWm82oI6ibA66i1x7Ue+L9tdMVL6jKkOkbyQuEWyhcl2Zjb96rGwffGIjYtXaPKtcxbYJ/iWlAqePMoMY1m40IWfAirJ13zMYZqzgQUf334dO/8= 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:(4636009)(136003)(366004)(396003)(346002)(376002)(39860400002)(956004)(186003)(16526019)(86362001)(4326008)(8936002)(1076003)(6486002)(2906002)(5660300002)(26005)(66946007)(316002)(2616005)(38100700002)(66476007)(478600001)(83380400001)(107886003)(6496006)(66556008)(6916009)(36756003)(6666004)(54906003)(8676002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: =?utf-8?q?1ud4i8/91wTryWTnrXBl6wCkRtYzsO?= =?utf-8?q?JYqdHSBhvIhic1CNrZu+sR8oQtGoVJNPwpNqn9I5t2hj8XbJhyviOzUzQckoCSiTa?= =?utf-8?q?zl2ARnGyFR3817aX4gykD26KaZpx2JtnjyLv1tPmlqtF9jqKfYB84/tt2DIuQrt7S?= =?utf-8?q?ZH68Bu9cCbCjg1JcHZAaD7DRXJNUC95rkFO0Yes2wVH5VNeSKmcsxhoxdZgCj5jl3?= =?utf-8?q?5+gVJ1fjzvCwO//931TR91oYVH+TWQnoQMUiUDE+9SJn8J4IiTfzxGRsydLglVRJL?= =?utf-8?q?dEg2PRugMw2aTkc7p7WrOqj0z9ljqh8n0qetM3aTVjAak9n04C2a9hq+7ClS9aX23?= =?utf-8?q?+36jD4Dmx/72rOHgo30zc6ozDrBtZQhHVx1fcO+YYPWmt0FClRCN+imikuOOUBkTu?= =?utf-8?q?cI/XDQo8QDFmhDrI8qdeYYOBXW7NshTxzZ6Fk7p6SY+HEJ3xyLhLDjq1vq8qMyQkU?= =?utf-8?q?9VujM6f7coXZLF7m6gCGcMX1+t/hxxoDXsyy6V7EddtPFawgkmHo7nXaTdQxfDDYL?= =?utf-8?q?Ma81hgB+VOurxsfJguy39pEJGTT7TivFSCJf+EB3nwQAwnbYfGtnl8BZwnqUdFcq5?= =?utf-8?q?Th9wa0WRmoWXh64HxuOwE6Nr7ktGMHt89FtTDO6ckF2ajGVTnN5ThZtZcmvvfJ+ou?= =?utf-8?q?+EE14MFcHva/w2W6ETmMUDyCAJU4erTwxStTEU0uhbkLYQdW/wEQErVzW2957dKTY?= =?utf-8?q?dfnzIoBkAkSBHIa9Kd4TSKexdiv+dDO+ef6PoPhdwsfgNF5eBpra4r4Z6KpZj7rSG?= =?utf-8?q?cEcNdSbdKJdocnoqO4SjDQFK8pV68lWM33IImq8TwQeqd4+nn3CRzC2p10aHC5uUL?= =?utf-8?q?n0icn+/g2j7QjKE/bxxD6GASbmKQk6C8I48ez0yhvH4sNBLZzB/M2aVIjK1X8kBjb?= =?utf-8?q?UfxrMIuXQJCU4qyV1f2+jWHCBlEckdFdqULiWjzQ9Bo4Uz8QvQc6fUxNGDXzLsKnc?= =?utf-8?q?HVLCIwEWvN5hTeBGMXOsfv0E4xCvUsVI5/r9VHBFHZP6nsni0VoIZwYmWWwzF5ZvY?= =?utf-8?q?42L0NyafOYQeGvryjQ8C8RUcA5qzy/MwYIHxVkiEfMQZtriljww+KIas3g+QPQcvg?= =?utf-8?q?cEkvQgEqAmf0fT/MHKIj71vgVHE5O6zUJ8tQZ5tkMD37WI44Va5j8cFAts8J3So9I?= =?utf-8?q?hmEWgrleZlc87L7DgzYI2Tha1TkTlOZwYXWg1FyXq2W6UAmf3QH47h2zgbxMBvIEO?= =?utf-8?q?tkrtLtMomtz0QjN9T/UlTxrAE7XETOHz7ggduicDS0VOXZ+X1cxkscXldqZK0qzZN?= =?utf-8?q?1lkU6uYuz/qDdU?= X-MS-Exchange-CrossTenant-Network-Message-Id: 3717d5ca-dafa-4080-43ee-08d90bf019e3 X-MS-Exchange-CrossTenant-AuthSource: DS7PR03MB5608.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Apr 2021 15:53:30.5948 (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: h+gqBqXdsxF5wNW+bIlkCijGKo3Cy1r6Bmg0X+aEbfyL5MFxJ0b0WsGAdn6UrfS0/eVAOjqJXWJ4K6YCAcfsiA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR03MB2923 X-OriginatorOrg: citrix.com Hello, The following series introduces a new CPUID/MSR interface for the xenguest library. Such interface handles both CPUID and MSRs using the same opaque object, and provides some helpers for the user to peek or modify such data without exposing the backing type. This is useful for future development as CPUID and MSRs are closely related, so it makes handling those much easier if they are inside the same object (ie: a change to a CPUID bit might expose or hide an MSR). In this patch series libxl and other in tree users have been switched to use the new interface, so it shouldn't result in any functional change from a user point of view. Note there are still some missing pieces likely. The way to modify CPUID data is not ideal, as it requires fetching a leaf and modifying it directly. We might want some kind of interface in order to set specific CPUID features more easily, but that's to be discussed, and would be done as a follow up series. Thanks, Roger. Roger Pau Monne (13): libxl: don't ignore the return value from xc_cpuid_apply_policy libs/guest: allow fetching a specific CPUID leaf from a cpu policy libs/guest: allow fetching a specific MSR entry from a cpu policy libs/guest: allow updating a cpu policy CPUID data libs/guest: allow updating a cpu policy MSR data libs/guest: introduce helper to check cpu policy compatibility libs/guest: obtain a compatible cpu policy from two input ones libs/guest: make a cpu policy compatible with older Xen versions libs/guest: introduce helper set cpu topology in cpu policy libs/guest: rework xc_cpuid_xend_policy libs/guest: apply a featureset into a cpu policy libs/{light,guest}: implement xc_cpuid_apply_policy in libxl libs/guest: (re)move xc_cpu_policy_apply_cpuid tools/include/libxl.h | 6 +- tools/include/xen-tools/libs.h | 5 + tools/include/xenctrl.h | 75 ++- tools/libs/guest/Makefile | 2 +- tools/libs/guest/xg_cpuid_x86.c | 832 ++++++++++++++++-------------- tools/libs/light/libxl_cpuid.c | 231 ++++++++- tools/libs/light/libxl_create.c | 5 +- tools/libs/light/libxl_dom.c | 2 +- tools/libs/light/libxl_internal.h | 32 +- tools/libs/light/libxl_nocpuid.c | 5 +- 10 files changed, 744 insertions(+), 451 deletions(-)