From patchwork Mon Sep 16 09:48:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 11146649 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7CBC51747 for ; Mon, 16 Sep 2019 09:49:41 +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 61F2A206A4 for ; Mon, 16 Sep 2019 09:49:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 61F2A206A4 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1i9nbz-0004wv-7J; Mon, 16 Sep 2019 09:47:59 +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.89) (envelope-from ) id 1i9nbx-0004wl-J5 for xen-devel@lists.xenproject.org; Mon, 16 Sep 2019 09:47:57 +0000 X-Inumbo-ID: 0f2f2ac7-d867-11e9-95d9-12813bfff9fa Received: from mx1.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 0f2f2ac7-d867-11e9-95d9-12813bfff9fa; Mon, 16 Sep 2019 09:47:56 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id B7EA6ACBD; Mon, 16 Sep 2019 09:47:55 +0000 (UTC) From: Jan Beulich To: "xen-devel@lists.xenproject.org" References: Message-ID: Date: Mon, 16 Sep 2019 11:48:01 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US Subject: [Xen-devel] [PATCH 1/2] x86emul: treat Hygon guests like AMD ones X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Juergen Gross , Andrew Cooper , Wei Liu , =?utf-8?q?Roger_Pau_Monn=C3=A9?= Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" For some reason the Hygon enabling series left out the insn emulator. Make appropriate adjustments wherever we've been special casing AMD. Signed-off-by: Jan Beulich Reviewed-by: Wei Liu Reviewed-by: Andrew Cooper --- a/xen/arch/x86/x86_emulate/x86_emulate.c +++ b/xen/arch/x86/x86_emulate/x86_emulate.c @@ -1995,7 +1995,8 @@ protmode_load_seg( case x86_seg_tr: goto raise_exn; } - if ( cp->x86_vendor != X86_VENDOR_AMD || !ops->read_segment || + if ( !(cp->x86_vendor & (X86_VENDOR_AMD | X86_VENDOR_HYGON)) || + !ops->read_segment || ops->read_segment(seg, sreg, ctxt) != X86EMUL_OKAY ) memset(sreg, 0, sizeof(*sreg)); else @@ -2122,7 +2123,8 @@ protmode_load_seg( */ bool wide = desc.b & 0x1000 ? false : (desc.b & 0xf00) != 0xc00 && - cp->x86_vendor != X86_VENDOR_AMD + !(cp->x86_vendor & + (X86_VENDOR_AMD | X86_VENDOR_HYGON)) ? mode_64bit() : ctxt->lma; if ( wide ) @@ -2140,7 +2142,8 @@ protmode_load_seg( default: return rc; } - if ( !mode_64bit() && cp->x86_vendor == X86_VENDOR_AMD && + if ( !mode_64bit() && + (cp->x86_vendor & (X86_VENDOR_AMD | X86_VENDOR_HYGON)) && (desc.b & 0xf00) != 0xc00 ) desc_hi.b = desc_hi.a = 0; if ( (desc_hi.b & 0x00001f00) ||