Message ID | 20210413140140.73690-14-roger.pau@citrix.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show
Return-Path: <SRS0=+ia2=JK=lists.xenproject.org=xen-devel-bounces@kernel.org> 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=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, 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 CB2E9C433B4 for <xen-devel@archiver.kernel.org>; Tue, 13 Apr 2021 14:03:23 +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 61BFD61206 for <xen-devel@archiver.kernel.org>; Tue, 13 Apr 2021 14:03:23 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 61BFD61206 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.109807.209648 (Exim 4.92) (envelope-from <xen-devel-bounces@lists.xenproject.org>) id 1lWJdK-0005uF-RA; Tue, 13 Apr 2021 14:03:14 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 109807.209648; Tue, 13 Apr 2021 14:03:14 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from <xen-devel-bounces@lists.xenproject.org>) id 1lWJdK-0005u2-Ma; Tue, 13 Apr 2021 14:03:14 +0000 Received: by outflank-mailman (input) for mailman id 109807; Tue, 13 Apr 2021 14:03:13 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from <SRS0=51M0=JK=citrix.com=roger.pau@srs-us1.protection.inumbo.net>) id 1lWJdJ-0005sc-3M for xen-devel@lists.xenproject.org; Tue, 13 Apr 2021 14:03:13 +0000 Received: from esa6.hc3370-68.iphmx.com (unknown [216.71.155.175]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 1fb40aef-70d4-467a-8144-dd57e73ae0be; Tue, 13 Apr 2021 14:03:12 +0000 (UTC) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion <xen-devel.lists.xenproject.org> List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-devel>, <mailto:xen-devel-request@lists.xenproject.org?subject=unsubscribe> List-Post: <mailto:xen-devel@lists.xenproject.org> List-Help: <mailto:xen-devel-request@lists.xenproject.org?subject=help> List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xenproject.org?subject=subscribe> Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" <xen-devel-bounces@lists.xenproject.org> X-Inumbo-ID: 1fb40aef-70d4-467a-8144-dd57e73ae0be DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1618322592; h=from:to:cc:subject:date:message-id:in-reply-to: references:content-transfer-encoding:mime-version; bh=uEN8vdruq4R26ejVTvoHnlj4zKLnkKaq8by+dBWlaWM=; b=X6QvBQVW6wgWmjPObBJpU3D3kSFDPDzGW8iarWPjLcJbbcM9c9Cvr1ZW p+Uvlr6/OobVTJLlj/oiu0X7OwDrvYmRXgNRIvBCG+F+qUCAiZXUW2FCE v+stWOC2GjGE/lGVd+Nt4SsSUsQfcsES4L59OTn+/1ZbEvyetkASSOBcI M=; Authentication-Results: esa6.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com IronPort-SDR: UvUOwl0n7404jnOeNInaf0XiQm+TDLJgyj1L8gyDMXm7gqmpkGJXB1DFE8eEr/Ow33Vzk131SN UEuZMtb8lMHd+2Hhy1Mhy4Q6F2ChXyZsHTq6Zy2chFtMWAWrpr5PS9IoiV+1udualNRPrfHjH4 6Z1t6052sy0bl3lRJQUoRlylWW/vQYcw33FRaiafF5x2xko1PsHBJDD30ySSVHtm/KNYNRTC9/ gUfsloqv/NLx0z0qJm1iXaAgNkuYzjg6szm2WAqwe+GZLkbm7N0iE4H8ieCJL7XvDyF6vcZAcv kqE= X-SBRS: 5.2 X-MesageID: 41613953 X-Ironport-Server: esa6.hc3370-68.iphmx.com X-Remote-IP: 162.221.156.83 X-Policy: $RELAYED IronPort-HdrOrdr: A9a23:muOtX6sSYC+vRwxdcLCfb3YS7skCrIMji2hD6mlwRA09T+Wxi9 2ukPMH1RX9lTYWXzUalcqdPbSbKEmwybde544NMbC+GDT3oWfAFvAG0aLO4R3FXxf/+OlUyL t6f8FFYuHYIFBmga/BjzWQPM0nxLC8npyAocf74zNTQRpxa6dmhj0JaDqzNkFtXgFJCd4YOf OnhvZvnDardXQJYsnTPBBsM9TrnNHXiIngJScPGh9P0mKzpAm14733GQXw5GZ8bxpzx94ZkF TtokjCyYiI99q6zRLd0GG71eUtpPLRjuFtKebJpswcKjDHghulaoJ7S9S5zU0IidDq0nkGup 3hpAohItRS5hrqDx2IiCqo4SbM+nIP7GLv0lCRi3eLm72HeBsKT/BvqKgcVzmx0TtFgPhMlJ hl8kjcir9sSTTHpyj578igbWATqmOE5UAMvMRWs2ZSSuIlGdhshL1axmx5OrEaEhn37Yg2ed Med/301bJtfVSWY2uxhBgI/PWcGnA6HhKxSkMfoMCi0z9PgHBjz0cDrfZv50s9yA== X-IronPort-AV: E=Sophos;i="5.82,219,1613451600"; d="scan'208";a="41613953" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZwVANm0qhv5f/T6gaMK7OXEZyxJVMIQrbyFB3AFurCCogxs0xoGNxk65NVG5I2jDuKckeGKJYwl9rwTAN4xT0xjSrswH6ncNjWYGJ6e4bgL/0K92oNlTvxOoxWiZQCQh1+MZQ5uwhpc5gTVDzOzoDMBmp2Q9K+XjwVj8hqRAqJ+B8UkWbTm0zIQVg0kSm3WN83w63Lvqozpn8WEraruWwzJl5AYHi83wdbKE+dhdAsTlH5BHiYyAcjGBU4OYhGltaGNSed9DOIJXF95o39dQ2wLFMaDccFwOUSf6qP0RXKgEPu/K+fZPWMhxIjv1XpFE8gqLkgMKbwJyLmxV9WKOkQ== 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=4zjRbsyq+DaWv6wnjrp/39MtyMLtRSSqzlhDBppNwHA=; b=dVwroCq1zzWGRtUBiZ+QSTsOACxThy4KsBpY5gobjrF5kOuf+n2c0JerA0+HwBQibTF0c3BifHaZUM2pdv8qdjIRrOVRwrVjRgvVwk0I4Ie1LGyckuE/8Dx3eMLWVG4q2QeESg/PZYHMR89hF5KUqznM8UIBRPgUJJsxbck2Y3ckjkvy2cU4NPaszXMqMqCC6k5cT0rxI1D1/rpXGs4k8nwzFt98VgYAOL6+RZE7qvhTBt/MRtN+sRRAbIxKMlVFsekx7bpY4hDHDE4ZyNEIGlH1dzTP4vP6+x8zRAkyS0EXXNu1oNRmBTs6HOUoa+5/goyvytiDWEoobMBxALWjnQ== 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=4zjRbsyq+DaWv6wnjrp/39MtyMLtRSSqzlhDBppNwHA=; b=ay8pvTHaaoefeJzIGKHYTPuWm1BkIiEYI+AqI9O6zbWlhSLBwgFqwFtX6HxnSOHX/Lfh4HmAUhGxzRi9DFjb9vuhM6qiKk1H+OauL/BDmW+ehZuk8PpAi6plAH7ZOXA+cI+SqyTFvmCmSF3qZg6arQPa45X7cD6Gh6RnlWH4nuw= From: Roger Pau Monne <roger.pau@citrix.com> To: <xen-devel@lists.xenproject.org> CC: Andrew Cooper <andrew.cooper3@citrix.com>, Roger Pau Monne <roger.pau@citrix.com>, Ian Jackson <iwj@xenproject.org>, Wei Liu <wl@xen.org> Subject: [PATCH v2 13/21] libs/guest: allow updating a cpu policy MSR data Date: Tue, 13 Apr 2021 16:01:31 +0200 Message-ID: <20210413140140.73690-14-roger.pau@citrix.com> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210413140140.73690-1-roger.pau@citrix.com> References: <20210413140140.73690-1-roger.pau@citrix.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-ClientProxiedBy: MR2P264CA0157.FRAP264.PROD.OUTLOOK.COM (2603:10a6:501:1::20) 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: 7c5831c7-9221-454a-6ee7-08d8fe84de13 X-MS-TrafficTypeDiagnostic: DM5PR03MB2553: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: <DM5PR03MB2553FBF104CC45392D5B91108F4F9@DM5PR03MB2553.namprd03.prod.outlook.com> X-MS-Oob-TLC-OOBClassifiers: OLM:7219; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: iP48MwPvjkxfeHds+UhOHvvY78axBKbnoz9h6a9+hPhXTvp+Q1JtDhCFSEbbWOwlakS6tSOTVrVxSPc07piAhAcwZobLde6d74fDc5wtrWJc8fKU3dzfFiBoAIIZe97pbDFLT9k7XcFAXGPr0PUUWBXqsCGgxkRqk2sV5uhebrYYB2C/oOPoanD2ygl8gQL+VQygC+WSOs7S27oPoN5UvJI2DtqUT9uofrTlD1lhG5EGFuffRAUpkJyKjqAEF8BYvHNWSfSwQAh2X1QPDmcgpWsuj0u0IxqawOT95tzJR28zgtzOlVsSnfhB71e5T382eRLFxUKHaq1Q9ruMPvE2ntiT8DzttY44HBYCVvTQRHdseOJEM5TGUAU+N8R1NyrzHhNj5yPABDEIBdXocjWNNQttUvZAp5BY9bPTN629mLRyrN9JB83/eA+25t2j13YRls3IcR8FzE8p+A+V/XlAmES6EN+v8mLJhQ4nCUwJQzWad0FXR8+CZZda/1sxJ7eDMFQ7XUPIsJG1X1t9yB/wcgSfKE71j6HdC10CgSeR/Ifn36SaoSThXz5o8Hx7aH+5VLUwWiJL2BnVfifw/PzEGA== 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)(366004)(376002)(136003)(396003)(346002)(39850400004)(8936002)(6496006)(186003)(83380400001)(38100700002)(2906002)(66476007)(86362001)(956004)(2616005)(8676002)(478600001)(66556008)(66946007)(6666004)(6486002)(16526019)(316002)(6916009)(36756003)(54906003)(1076003)(5660300002)(4326008)(26005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: =?utf-8?q?g6ujbK6nV9smMa0KTeaPvsvgV15LAD?= =?utf-8?q?FtY1REfVmKr4gdac60lmh0C8Y0/BKY7L/Bm10fMHN0rI9hrt2R7ly5vNeH0QT/VY3?= =?utf-8?q?mzoPGzPbN7Sa3Pwvot/9H/b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ZX4syLeVn2Iwivj2igGTk8mglbEWAa4JnrGHvGQc7g?= =?utf-8?q?nnps+ykGXvryhaOwqelATLZ2V/E0IaT783FSUH+97g0FOHKPAbjndnnxuvkG358+Z?= =?utf-8?q?MbvqJpWaBl6OyK7jl6YyacToTqTSvDPv3jjs9VCu3t8d3C1P3XJXDJCy810D+co8l?= =?utf-8?q?MU86LiO6WeU0OI/rJjg7xmd1fQ09VDqWWLxaKKxM/zRNZI4PCgw3krwgbcmTYX42X?= =?utf-8?q?Z9MbxfkdMMzTz9NFC+LUi3pWT2a29OWOr6krTlQKaAC6uRzvg2AwpXR1XAMD1CDSZ?= =?utf-8?q?kjQuYZPk3OyiUD?= X-MS-Exchange-CrossTenant-Network-Message-Id: 7c5831c7-9221-454a-6ee7-08d8fe84de13 X-MS-Exchange-CrossTenant-AuthSource: DS7PR03MB5608.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Apr 2021 14:03:09.1632 (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: pcWNFVqJ3mA7hl6vYTgE/RKSAyjN7eXZUXHdVq/x2mkJxmbhNov/vu/6x29R2IEGf2GCP7lcZgd5c/gtBY0QLw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR03MB2553 X-OriginatorOrg: citrix.com |
Series |
libs/guest: new CPUID/MSR interface
|
expand
|
diff --git a/tools/include/xenctrl.h b/tools/include/xenctrl.h index 49f919f16a7..9a6d1b126d8 100644 --- a/tools/include/xenctrl.h +++ b/tools/include/xenctrl.h @@ -2616,6 +2616,8 @@ int xc_cpu_policy_get_msr(xc_interface *xch, const xc_cpu_policy_t policy, int xc_cpu_policy_update_cpuid(xc_interface *xch, xc_cpu_policy_t policy, const xen_cpuid_leaf_t *leaves, uint32_t nr); +int xc_cpu_policy_update_msrs(xc_interface *xch, xc_cpu_policy_t policy, + const xen_msr_entry_t *msrs, uint32_t nr); int xc_get_cpu_levelling_caps(xc_interface *xch, uint32_t *caps); int xc_get_cpu_featureset(xc_interface *xch, uint32_t index, diff --git a/tools/libs/guest/xg_cpuid_x86.c b/tools/libs/guest/xg_cpuid_x86.c index 00595e14cc3..26b09322dfa 100644 --- a/tools/libs/guest/xg_cpuid_x86.c +++ b/tools/libs/guest/xg_cpuid_x86.c @@ -907,3 +907,21 @@ int xc_cpu_policy_update_cpuid(xc_interface *xch, xc_cpu_policy_t policy, return rc; } + +int xc_cpu_policy_update_msrs(xc_interface *xch, xc_cpu_policy_t policy, + const xen_msr_entry_t *msrs, uint32_t nr) +{ + unsigned int err_msr = -1; + int rc = x86_msr_copy_from_buffer(&policy->msr, msrs, nr, &err_msr); + + if ( rc ) + { + if ( err_msr != -1 ) + ERROR("Failed to deserialise MSRS (err index %#x) (%d = %s)", + err_msr, -rc, strerror(-rc)); + errno = -rc; + rc = -1; + } + + return rc; +}
Introduce a helper to update the MSR policy using an array of xen_msr_entry_t entries. Note the MSRs present in the input xen_msr_entry_t array will replace any existing entries on the policy. No user of the interface introduced on this patch. Signed-off-by: Roger Pau Monné <roger.pau@citrix.com> --- Changes since v1: - Drop logic to update entries manually. - Only print failure message if err_msr != -1. --- tools/include/xenctrl.h | 2 ++ tools/libs/guest/xg_cpuid_x86.c | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+)