From patchwork Thu Sep 7 10:41:53 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 9942121 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 4507C6035F for ; Thu, 7 Sep 2017 10:44:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 09686280B0 for ; Thu, 7 Sep 2017 10:44:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F27C52843B; Thu, 7 Sep 2017 10:44:48 +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=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id F15F628464 for ; Thu, 7 Sep 2017 10:44:47 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dpuFy-0002GA-5B; Thu, 07 Sep 2017 10:41:58 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dpuFw-0002G2-Hr for xen-devel@lists.xenproject.org; Thu, 07 Sep 2017 10:41:56 +0000 Received: from [85.158.143.35] by server-11.bemta-6.messagelabs.com id BE/4E-03616-37221B95; Thu, 07 Sep 2017 10:41:55 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrFIsWRWlGSWpSXmKPExsXS6fjDS7dYaWO kwa1LEhbft0xmcmD0OPzhCksAYxRrZl5SfkUCa8bDhj7GggXsFSeet7A3MN5i6WLk5BASyJNo fXaeFcTmFbCTWPRtIhuILSFgKHF64U2wGhYBVYklF/vA4mwC6hJtz7YD1XNwiAgYSJw7mgQSZ haIkuhbfpUJxBYWCJJ4PH8FK8R4O4kvz2aygZTzCghK/N0hDFGuJfHwF8QFzALaEssWvmYGKW EWkJZY/o9jAiPvLISGWUgaZiFpmIXQsICRZRWjRnFqUVlqka6xsV5SUWZ6RkluYmaOrqGBmV5 uanFxYnpqTmJSsV5yfu4mRmCIMQDBDsad6wMPMUpyMCmJ8l5WWx8pxJeUn1KZkVicEV9UmpNa fIhRhoNDSYL3ucLGSCHBotT01Iq0zBxgsMOkJTh4lER474OkeYsLEnOLM9MhUqcYjTluPLz+h 4mj4+bdP0xCLHn5ealS4rwPQUoFQEozSvPgBsGi8BKjrJQwLyPQaUI8BalFuZklqPKvGMU5GJ WEeTeDTOHJzCuB2/cK6BQmoFNKnm8AOaUkESEl1cDIve2V68WwU/lrZ6799u/gxI13zFdP2bi tmCEke4G7b4vttJKHmZ1dH0zTZH+nMMcf/OC/R5577rJnvrynBCus7FJeJ1vNVsieNqvs1inb a8qy/a7GMvnBf94m/WwoPvgsSOB4bfHimEk7uf/cuGfZO3PZnnL134u5DCyaI5ZYmVjf8t744 NsEJZbijERDLeai4kQAgleIH70CAAA= X-Env-Sender: JBeulich@suse.com X-Msg-Ref: server-12.tower-21.messagelabs.com!1504780913!81641824!1 X-Originating-IP: [137.65.248.74] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 47932 invoked from network); 7 Sep 2017 10:41:55 -0000 Received: from prv-mh.provo.novell.com (HELO prv-mh.provo.novell.com) (137.65.248.74) by server-12.tower-21.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 7 Sep 2017 10:41:55 -0000 Received: from INET-PRV-MTA by prv-mh.provo.novell.com with Novell_GroupWise; Thu, 07 Sep 2017 04:41:53 -0600 Message-Id: <59B13E9102000078001783E2@prv-mh.provo.novell.com> X-Mailer: Novell GroupWise Internet Agent 14.2.2 Date: Thu, 07 Sep 2017 04:41:53 -0600 From: "Jan Beulich" To: "xen-devel" References: <59B13E9102000078001783E2@prv-mh.provo.novell.com> Mime-Version: 1.0 Content-Disposition: inline Cc: Andrew Cooper , Paul Durrant Subject: [Xen-devel] [PATCH] x86/HVM: correct repeat count update in linear->phys translation X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP For the insn emulator's fallback logic in REP MOVS/STOS/INS/OUTS handling to work correctly, *reps must not be set to zero when returning X86EMUL_UNHANDLEABLE. Signed-off-by: Jan Beulich Acked-by: Paul Durrant --- a/xen/arch/x86/hvm/emulate.c +++ b/xen/arch/x86/hvm/emulate.c @@ -566,15 +566,16 @@ static int hvmemul_linear_to_phys( if ( pfec & (PFEC_page_paged | PFEC_page_shared) ) return X86EMUL_RETRY; done /= bytes_per_rep; - *reps = done; if ( done == 0 ) { ASSERT(!reverse); if ( npfn != gfn_x(INVALID_GFN) ) return X86EMUL_UNHANDLEABLE; + *reps = 0; x86_emul_pagefault(pfec, addr & PAGE_MASK, &hvmemul_ctxt->ctxt); return X86EMUL_EXCEPTION; } + *reps = done; break; }