From patchwork Wed Nov 22 18:14:17 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roman Kagan X-Patchwork-Id: 10070727 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id CCA2E601D5 for ; Wed, 22 Nov 2017 18:15:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CA73229DF3 for ; Wed, 22 Nov 2017 18:15:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BF69B29E4E; Wed, 22 Nov 2017 18:15:44 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 515DA29DF3 for ; Wed, 22 Nov 2017 18:15:44 +0000 (UTC) Received: from localhost ([::1]:40784 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eHZYl-0000hQ-GD for patchwork-qemu-devel@patchwork.kernel.org; Wed, 22 Nov 2017 13:15:43 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48468) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eHZXd-0000g2-MW for qemu-devel@nongnu.org; Wed, 22 Nov 2017 13:14:34 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eHZXb-0007bR-Rt for qemu-devel@nongnu.org; Wed, 22 Nov 2017 13:14:33 -0500 Received: from mail-eopbgr20115.outbound.protection.outlook.com ([40.107.2.115]:44320 helo=EUR02-VE1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eHZXb-0007aQ-Kc for qemu-devel@nongnu.org; Wed, 22 Nov 2017 13:14:31 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=bjVrrqS1WJWdEz6UlelBXXu/OH9QdYRRQVYgw3Uh6XA=; b=Aq8LAptxValDKhuv8BwicE38uSDTQQjyE6istRtORqWJMMytf2MUha32/60nsPgoFq3thiMnkYjj1dmgr+V5bC3AOekC3h7iM7TNTqh16hQqPofkUee0Jx3PsCHH9OZ6OQ2+io2KCnWTO+P5vunqhWBNSL2oekIez1rj1a4uR3U= Received: from rkaganb.sw.ru (195.214.232.6) by VI1PR08MB0846.eurprd08.prod.outlook.com (2a01:111:e400:5a05::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.239.5; Wed, 22 Nov 2017 18:14:27 +0000 From: Roman Kagan To: qemu-devel@nongnu.org, Paolo Bonzini , Eduardo Habkost Date: Wed, 22 Nov 2017 21:14:17 +0300 Message-Id: <20171122181418.14180-3-rkagan@virtuozzo.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20171122181418.14180-1-rkagan@virtuozzo.com> References: <20171122181418.14180-1-rkagan@virtuozzo.com> MIME-Version: 1.0 X-Originating-IP: [195.214.232.6] X-ClientProxiedBy: HE1P18901CA0021.EURP189.PROD.OUTLOOK.COM (2603:10a6:3:8b::31) To VI1PR08MB0846.eurprd08.prod.outlook.com (2a01:111:e400:5a05::16) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0cc7c635-3e2f-4e13-c461-08d531d4decd X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(4534020)(4602075)(7168020)(4627115)(201703031133081)(201702281549075)(5600022)(4604075)(2017052603258); SRVR:VI1PR08MB0846; X-Microsoft-Exchange-Diagnostics: 1; VI1PR08MB0846; 3:ZN0WyrF5DNJARBibETSwH4Hq/3tCukg4rCdDTpOX6gBEAOKOgAB/9R74+DRWxVaUmH357t9baYy2coYUahltrVp9Wbuy1FxeV2npDEQMsQknMrX7eiaOH2JFlnIIBFm0X4A5IIrhc/K3Gxi/u4uuD6vJ0QiIwFsI1MFcpG2yKGrbRSPlXNG7RWg+3EuuHsFezv0/7kV96vv/rApzokcE54bJqyuYbDA9RRme9zfP1I25UFPlDSPgoZl+EMbisP1l; 25:IvNLWBi0ljYSriUht+xRQ4rGULOr0YWhE7/xzCMpCW9paqSrKOgW4qC/3jJk5+yKRJCMS+IGyNxFmQVtneoycg6FFL0DuY7XmGzcMrDlS7QJ6bPm9jmm05X1pTsVZExJZbc2mc5YtV8prrLafuXTVwI5vflITj/rEwEWOx3s2m4ORRhh1YwgrsVuAwch7VvhM3QMJhfemC5GVRhDPLUXXCY+5okIpfuZ1r/5yhuOzHXlW/N5zCPl1hMSvpeHxfj9yntq4OCLu6xkCRbt2kxUf2ANKwI9JPsRRKjseffmm0sR0K2XyjbOrHBYJH69nTerFuqUHeN1gGzw6oIRtCVvRg==; 31:ShkptFMd1WeSXXRR4rJ6i73E5BjJf7XomtWDBUf7Iq7RbOlwS2W2lek5Nm1FHV2J/iIOT1Vt1k4tUEysy4bisenwl2x8pIofhELfrvI5OlVVI7BjoUO3Me/eu30ooSb3WMHs+VAFVPsgEF5SRnYIweaLpV7kDp3jp171s3/c8dZ7hEXQhwcuuRSHac972S4uoTd8+DWQpATDRGMmSVZI8iQtIr6PTDZR8++uflqX3iI= X-MS-TrafficTypeDiagnostic: VI1PR08MB0846: X-Microsoft-Exchange-Diagnostics: 1; VI1PR08MB0846; 20:ciC1sN/mKF8d6lpzhn4keWIM6yioFbkeykfTFnyaNj2KxFdv1WGyaUpIDn4XzTscd0F6TyBJveRdObC0nGf1oHWFJHmBfbErh0ML+jMQO0Vh6WS3cLBal7VhEkQZVlIRXuXtjbMCOTkVRMhUFIjE12dY4ysDDB4gb4U9xucyc+JCPcO8MhzUXISJa37tuyIOPuq9QANtH2RbnHJhm63LfoNZBgDNBX4nDsZ7qrX18rr6y0YLgn2rBjUdrDdkNM+Z2nem/DBfNCaug5duZq/8nlhdsYyeHn88EooAj0otma+IzTKDAxFd668bz2KRBeEXDZ5yJYnZChz7UkhO1IxefjnO14W4B0IqTIIb0SgXrUFpDeA0U3gdqQQNJcsela00oi4+VC/c66j4mE965Ro9HDDz3DNh0FxeO29M3iZDxjw=; 4:/JgCfYq+n2Da9EkNAsORWeDVwfb0f5pnCXuBRDaTUQl+EuPkVGK05rathgm3FuQDmF8pPWfjFFEN8hy2bvKYZDrahQ+XAqB3KZkKBEVEVVceRcWnjFe8TRWdcLSfUxtTe5LylrMdY3ZqZRReiQFcN5t/4GLN9gqSMEyW55RHp74fMQVR8hQ4Cnkxf8W9ab9lXwCGtlr53JxW9tBH9iPYsMBFQj0LxBgcZclgKSrKHfd5JGzau7LGJpH+bE5TDvsV/AdepaPKHXF/obiZYwnQnw== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(5005006)(8121501046)(10201501046)(100000703101)(100105400095)(93006095)(93001095)(3231022)(3002001)(6041248)(20161123562025)(20161123564025)(20161123555025)(20161123558100)(20161123560025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:VI1PR08MB0846; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:VI1PR08MB0846; X-Forefront-PRVS: 0499DAF22A X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(6009001)(346002)(39830400002)(376002)(199003)(189002)(110136005)(50226002)(16586007)(66066001)(316002)(47776003)(8936002)(5003940100001)(2906002)(55236003)(53936002)(97736004)(86362001)(16526018)(2950100002)(76176999)(101416001)(6512007)(107886003)(50986999)(4326008)(6666003)(6486002)(5660300001)(1076002)(6506006)(305945005)(81156014)(81166006)(7736002)(53416004)(25786009)(48376002)(3846002)(6116002)(189998001)(68736007)(33646002)(69596002)(478600001)(105586002)(106356001)(8676002)(36756003)(50466002); DIR:OUT; SFP:1102; SCL:1; SRVR:VI1PR08MB0846; H:rkaganb.sw.ru; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: virtuozzo.com does not designate permitted sender hosts) Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=rkagan@virtuozzo.com; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; VI1PR08MB0846; 23:sRkubM+1W2t2SJJ3PhjJytFw+cAvsVFluHadJvgc9?= =?us-ascii?Q?fIFl13epi8YymUNkilh6TIjZ+fMO/RnPmoM78noDmmBf8h7j4SFLIemS8T0f?= =?us-ascii?Q?FeAaPvGDwNJeV+Pix2H4tg6hSQEb2eZGlb8Vu/dagtF6FRjb0FJg7fuJ0QlM?= =?us-ascii?Q?iukJlI1jPJEOl0/mNuNbXN6u9YEcBD7Vg41y2RiitV8eJYpzpUxLBxKjYwNA?= =?us-ascii?Q?viiWKTboW+i39XQxyEYpD+Mdm5fVSJ4TeeH5JDWsH3vPzxkEC+kqM27aO2PR?= =?us-ascii?Q?kgqsTzAZQUhBFAAnovJAFIXfY70Vwj6vWWwcjg0/akJAmSwlGZrB1HoH8+DH?= =?us-ascii?Q?+IYs1YkP0SW8H5YtjnfjzCzjLd2DaA0va1GeFWu0eW0EEVPHtEC8Y4dvMld0?= =?us-ascii?Q?BDHksQwnnQO7aZKlMK8shjFI+shRzCUD8tR0yuurmHsUjkoEMRLx5/qwRw/0?= =?us-ascii?Q?QISbBCKO4mgk6kFf4zJqzomthl3y5dd8IJaAcpgyxdIXm1kFz3IOkuRrVf97?= =?us-ascii?Q?vSQAVlE3JIAXsaXAmOvYUBWU9nDwz5A0OWzv/aXnvL3a3Utban6rPbmjxDfP?= =?us-ascii?Q?BsUBZZ/A9FbNgRpWrOxzhR0FEhdttGyAZ24BNEyRGMLBvNbb/RSqJylZOZsP?= =?us-ascii?Q?djsLNyb0RKOLcWtkLUdsf/xSnrDAv9yyRxx6/3Aojy1QAGKOgCQsbHwNHhPQ?= =?us-ascii?Q?9ZV3ZqvsFQU5qB/bsg5X1cw+GfW72mtckKj/z5jFbJoofmXcrP6BYwS7lVaj?= =?us-ascii?Q?tTt49zP6MW0R1x6Idb1z5lju0yFIbkkmZ1zIBThQBpmR1MSEMuM5NyIxUAy6?= =?us-ascii?Q?cPzjCs/AoW1X1frc56oak9Nk4OBFRW/ads1+8RIIz0rp1mvhITLekmzPwr33?= =?us-ascii?Q?1lyOxQNdqote/IW/gBKoPdhx9Mne3j1/z8zCfwKfmBdmj7+4LwCCnxcipLrW?= =?us-ascii?Q?u///G/HBnWBkO8+LF2SaM5rh/rmF72+qE8VKt+TtEEDS5inGqDFf6LSK2ovR?= =?us-ascii?Q?TnnWb6wVBeMlKHJEamXawaE/ahbCiol238Z7Z0tWuR8jI8VMEFn63Mk/csKT?= =?us-ascii?Q?qm+dZudouJsCsmDaqKE22so+1Qy+sRKNNFThRUVMv+DjCtbqdeWKIzFrOIbF?= =?us-ascii?Q?vhh+BMIuFsLWki2sc9+9QCIGpfwKlJcz+wxDATysbAjS567VxiPdP3BStRqb?= =?us-ascii?Q?OwxHheLSdMfxZju2PGcYyGlVgOipOEND4vd?= X-Microsoft-Exchange-Diagnostics: 1; VI1PR08MB0846; 6:9xVPF4oD/mh4KUM8/UA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wKSvRGoDDg1hL3MFKdxyA/clEEYampo9ln4rxNSHSls/+aO5kBbBWlBEz0= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Nov 2017 18:14:27.9429 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0cc7c635-3e2f-4e13-c461-08d531d4decd X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB0846 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 40.107.2.115 Subject: [Qemu-devel] [PATCH 2/3] hyperv: ensure SINTx msrs are reset properly X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Denis V. Lunev" Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Initially SINTx msrs should be in "masked" state. To ensure that happens on *every* reset, move setting their values to kvm_arch_vcpu_reset. Signed-off-by: Roman Kagan --- target/i386/kvm.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/target/i386/kvm.c b/target/i386/kvm.c index 563967241b..ea6e6e5f30 100644 --- a/target/i386/kvm.c +++ b/target/i386/kvm.c @@ -662,8 +662,6 @@ static int hyperv_handle_properties(CPUState *cs) env->features[FEAT_HYPERV_EAX] |= HV_VP_RUNTIME_AVAILABLE; } if (cpu->hyperv_synic) { - int sint; - if (!has_msr_hv_synic || kvm_vcpu_enable_cap(cs, KVM_CAP_HYPERV_SYNIC, 0)) { fprintf(stderr, "Hyper-V SynIC is not supported by kernel\n"); @@ -672,9 +670,6 @@ static int hyperv_handle_properties(CPUState *cs) env->features[FEAT_HYPERV_EAX] |= HV_SYNIC_AVAILABLE; env->msr_hv_synic_version = HV_SYNIC_VERSION; - for (sint = 0; sint < ARRAY_SIZE(env->msr_hv_synic_sint); sint++) { - env->msr_hv_synic_sint[sint] = HV_SINT_MASKED; - } } if (cpu->hyperv_stimer) { if (!has_msr_hv_stimer) { @@ -1053,6 +1048,13 @@ void kvm_arch_reset_vcpu(X86CPU *cpu) } else { env->mp_state = KVM_MP_STATE_RUNNABLE; } + + if (cpu->hyperv_synic) { + int i; + for (i = 0; i < ARRAY_SIZE(env->msr_hv_synic_sint); i++) { + env->msr_hv_synic_sint[i] = HV_SINT_MASKED; + } + } } void kvm_arch_do_init_vcpu(X86CPU *cpu)