From nobody Sun May 5 17:18:10 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=yadro.com ARC-Seal: i=1; a=rsa-sha256; t=1593039751; cv=none; d=zohomail.com; s=zohoarc; b=lwNbijzTg6HHJxTm9ipmWzL+xXoDc7XbtcXhZTUNDeUU+x0FtYVpcCwee1JAzymBbeuqtce3DCMKq4F16gyJ1eI9IRC7z4moWNo5RzB5pjTZANTAhra2yK8AS5G4qDBxjuHW7CQIPO8J/GLmHYZq+xmbQfIctyGTgWKYzIZ1zig= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1593039751; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=x9yqA/SVECw8QrMI1U/FVP4uL/O1StH2dYELO2vztro=; b=VvopyFgyGb9xdFg9u73/Q/u0CxP0Zhr4gG+BVmAxJkeUBcotfIMwcFRfcEaL6Rm2Uu0dmq0fyXw0HYIQNeCJB65Nl+jOnk7m6o/h1J5fA6e5p+UlGrvnLyILP9QV7ShNgh+BVxMGmVP2VEJVJSjquaKLE9kIDrtg5LD48Q9EKUU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1593039751830688.0617411843098; Wed, 24 Jun 2020 16:02:31 -0700 (PDT) Received: from localhost ([::1]:52622 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1joEPW-0001Bd-Cw for importer@patchew.org; Wed, 24 Jun 2020 19:02:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40414) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1joEO6-0007xp-GJ for qemu-devel@nongnu.org; Wed, 24 Jun 2020 19:01:02 -0400 Received: from mta-02.yadro.com ([89.207.88.252]:32864 helo=mta-01.yadro.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1joEO4-0006kf-PX for qemu-devel@nongnu.org; Wed, 24 Jun 2020 19:01:02 -0400 Received: from localhost (unknown [127.0.0.1]) by mta-01.yadro.com (Postfix) with ESMTP id C834D4C8A5; Wed, 24 Jun 2020 23:00:58 +0000 (UTC) Received: from mta-01.yadro.com ([127.0.0.1]) by localhost (mta-01.yadro.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id mShg5_6uawVf; Thu, 25 Jun 2020 02:00:56 +0300 (MSK) Received: from T-EXCH-02.corp.yadro.com (t-exch-02.corp.yadro.com [172.17.10.102]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mta-01.yadro.com (Postfix) with ESMTPS id 48D334C8A8; Thu, 25 Jun 2020 02:00:56 +0300 (MSK) Received: from localhost (172.17.204.212) by T-EXCH-02.corp.yadro.com (172.17.10.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.669.32; Thu, 25 Jun 2020 02:00:56 +0300 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=yadro.com; h= content-type:content-type:content-transfer-encoding:mime-version :references:in-reply-to:x-mailer:message-id:date:date:subject :subject:from:from:received:received:received; s=mta-01; t= 1593039656; x=1594854057; bh=oeWDG+WWzJ1ddsNbdkQSnBzk7CCguEOTiGP 81HTc41Y=; b=Xwf9qjNIRZOlojOtE4pFELU6gZrQRyl6kxUq3a9c0WL591g7Vbe 2NywKILBe+YAM4FpHhBDkJ0jI9ECx4RPYurlKicHD3oFL/OIcZnxWXm8vGYbyPot CSmROhr9aevHwJVJ29s+Ip9a8Ney9TC4mogjhPPJ7eX+gNJ5t2drBTzo= X-Virus-Scanned: amavisd-new at yadro.com From: Roman Bolshakov To: Subject: [PATCH 1/8] i386: hvf: Set env->eip in macvm_set_rip() Date: Thu, 25 Jun 2020 01:58:44 +0300 Message-ID: <20200624225850.16982-2-r.bolshakov@yadro.com> X-Mailer: git-send-email 2.26.1 In-Reply-To: <20200624225850.16982-1-r.bolshakov@yadro.com> References: <20200624225850.16982-1-r.bolshakov@yadro.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [172.17.204.212] X-ClientProxiedBy: T-EXCH-01.corp.yadro.com (172.17.10.101) To T-EXCH-02.corp.yadro.com (172.17.10.102) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=89.207.88.252; envelope-from=r.bolshakov@yadro.com; helo=mta-01.yadro.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/24 19:00:57 X-ACL-Warn: Detected OS = Linux 3.11 and newer X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Eduardo Habkost , Cameron Esfahani , Roman Bolshakov , Claudio Fontana , Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @yadro.com) Content-Type: text/plain; charset="utf-8" cpu_synchronize_state() is currently no-op for hvf but BIOS will hang in vAPIC option ROM when cpu_synchronize_state() is wired to hvf_cpu_synchronize_state(). cpu_synchronize_state() state is called from vapic_write() during option ROM initialization. It sets dirty flag on the cpu. macvm_set_rip() is then invoked to advance IP after the I/O write to vAPIC port. macvm_set_rip() only modifies VMCS, it doesn't change env->eip. Therefore on the next iteration of vCPU loop, vcpu_dirty flag is checked and hvf_put_registers() overwrites correct RIP in VMCS with the value of env->eip that points to the I/O write instruction. Execution of the CPU gets stuck on the instruction. The issue can be avoided if eip doesn't contain stale value when dirty flag is set on cpu. Cc: Cameron Esfahani Signed-off-by: Roman Bolshakov --- target/i386/hvf/vmx.h | 1 + 1 file changed, 1 insertion(+) diff --git a/target/i386/hvf/vmx.h b/target/i386/hvf/vmx.h index ce2a1532d5..1e8b29bf7d 100644 --- a/target/i386/hvf/vmx.h +++ b/target/i386/hvf/vmx.h @@ -173,6 +173,7 @@ static inline void macvm_set_rip(CPUState *cpu, uint64_= t rip) =20 /* BUG, should take considering overlap.. */ wreg(cpu->hvf_fd, HV_X86_RIP, rip); + env->eip =3D rip; =20 /* after moving forward in rip, we need to clean INTERRUPTABILITY */ val =3D rvmcs(cpu->hvf_fd, VMCS_GUEST_INTERRUPTIBILITY); --=20 2.26.1 From nobody Sun May 5 17:18:10 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=yadro.com ARC-Seal: i=1; a=rsa-sha256; t=1593039848; cv=none; d=zohomail.com; s=zohoarc; b=H/zzkL0ZInXTc1MvWS1R50F4SHvrFy7OgRGeKLhcdYqP28AYr4Z/UgeI4ybWDyy950TYMjWR/bAGFuHIbPU1FMAd0uM5rWV12WoSxr9MOTXm26vdC83rBNEFkZrD6/0WsaTxCq2LiXQal+vvc6ufJNrnkdStzSSVLApIdHkWiU0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1593039848; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Jq54RGkceTx2b781NRtt1IDJhK1+h6uVsvGAVx4B+3c=; b=VvdDP3B6jM1xoryzSBJtihRdbzFUF/Ty6hJfamoq2MB+PSff4rFwtXY2MohgZtHeIuRVae8iUX3u5wdE+TuPTzIQibKulBVXrXRaHJb+piK8B5xUeS+l/Hn/7S70cFGAlztmPnVnmPeMAwBsOJqMWuDI2WyfSxdDDJPAKbp3JEA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1593039848551641.4153763814212; Wed, 24 Jun 2020 16:04:08 -0700 (PDT) Received: from localhost ([::1]:59052 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1joER5-00043D-3q for importer@patchew.org; Wed, 24 Jun 2020 19:04:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40446) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1joEO8-0007zF-By for qemu-devel@nongnu.org; Wed, 24 Jun 2020 19:01:04 -0400 Received: from mta-02.yadro.com ([89.207.88.252]:32880 helo=mta-01.yadro.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1joEO4-0006lK-PZ for qemu-devel@nongnu.org; Wed, 24 Jun 2020 19:01:04 -0400 Received: from localhost (unknown [127.0.0.1]) by mta-01.yadro.com (Postfix) with ESMTP id 677224C8B2; Wed, 24 Jun 2020 23:00:59 +0000 (UTC) Received: from mta-01.yadro.com ([127.0.0.1]) by localhost (mta-01.yadro.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id hvh5Qxh-11fM; Thu, 25 Jun 2020 02:00:57 +0300 (MSK) Received: from T-EXCH-02.corp.yadro.com (t-exch-02.corp.yadro.com [172.17.10.102]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mta-01.yadro.com (Postfix) with ESMTPS id E7EF34C8AB; Thu, 25 Jun 2020 02:00:56 +0300 (MSK) Received: from localhost (172.17.204.212) by T-EXCH-02.corp.yadro.com (172.17.10.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.669.32; Thu, 25 Jun 2020 02:00:56 +0300 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=yadro.com; h= content-type:content-type:content-transfer-encoding:mime-version :references:in-reply-to:x-mailer:message-id:date:date:subject :subject:from:from:received:received:received; s=mta-01; t= 1593039657; x=1594854058; bh=O+oD/8e5D+BiPYJW8vexoxBygMLUSq69Ksz h5Vme0KY=; b=Ve33mCRdTnKZCz/qGoRt5QiDgyRPFFjfU7xvt5UGtGlvS+s8J6B Pza4tttxYuHM67TrZnvZtqoqOHh51tXRfJ4r9+JEgN7+5aGCBFU98CbQ2xdRl9Bm VVTludNQ7kJJ/LSOiNL5sNf+hPGjPgHA2nSiYqu0emH6lZYmKqFZ5PIY= X-Virus-Scanned: amavisd-new at yadro.com From: Roman Bolshakov To: Subject: [PATCH 2/8] i386: hvf: Move synchronize functions to sysemu Date: Thu, 25 Jun 2020 01:58:45 +0300 Message-ID: <20200624225850.16982-3-r.bolshakov@yadro.com> X-Mailer: git-send-email 2.26.1 In-Reply-To: <20200624225850.16982-1-r.bolshakov@yadro.com> References: <20200624225850.16982-1-r.bolshakov@yadro.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [172.17.204.212] X-ClientProxiedBy: T-EXCH-01.corp.yadro.com (172.17.10.101) To T-EXCH-02.corp.yadro.com (172.17.10.102) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=89.207.88.252; envelope-from=r.bolshakov@yadro.com; helo=mta-01.yadro.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/24 19:00:57 X-ACL-Warn: Detected OS = Linux 3.11 and newer X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Roman Bolshakov , Claudio Fontana , Cameron Esfahani , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @yadro.com) Content-Type: text/plain; charset="utf-8" Cc: Cameron Esfahani Signed-off-by: Roman Bolshakov Reviewed-by: Claudio Fontana --- cpus.c | 12 ------------ include/sysemu/hw_accel.h | 10 ++++++++++ 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/cpus.c b/cpus.c index 7317ae06b9..26709677d3 100644 --- a/cpus.c +++ b/cpus.c @@ -1017,10 +1017,6 @@ void cpu_synchronize_all_states(void) =20 CPU_FOREACH(cpu) { cpu_synchronize_state(cpu); - /* TODO: move to cpu_synchronize_state() */ - if (hvf_enabled()) { - hvf_cpu_synchronize_state(cpu); - } } } =20 @@ -1030,10 +1026,6 @@ void cpu_synchronize_all_post_reset(void) =20 CPU_FOREACH(cpu) { cpu_synchronize_post_reset(cpu); - /* TODO: move to cpu_synchronize_post_reset() */ - if (hvf_enabled()) { - hvf_cpu_synchronize_post_reset(cpu); - } } } =20 @@ -1043,10 +1035,6 @@ void cpu_synchronize_all_post_init(void) =20 CPU_FOREACH(cpu) { cpu_synchronize_post_init(cpu); - /* TODO: move to cpu_synchronize_post_init() */ - if (hvf_enabled()) { - hvf_cpu_synchronize_post_init(cpu); - } } } =20 diff --git a/include/sysemu/hw_accel.h b/include/sysemu/hw_accel.h index 0ec2372477..80bce75921 100644 --- a/include/sysemu/hw_accel.h +++ b/include/sysemu/hw_accel.h @@ -14,6 +14,7 @@ #include "hw/core/cpu.h" #include "sysemu/hax.h" #include "sysemu/kvm.h" +#include "sysemu/hvf.h" #include "sysemu/whpx.h" =20 static inline void cpu_synchronize_state(CPUState *cpu) @@ -24,6 +25,9 @@ static inline void cpu_synchronize_state(CPUState *cpu) if (hax_enabled()) { hax_cpu_synchronize_state(cpu); } + if (hvf_enabled()) { + hvf_cpu_synchronize_state(cpu); + } if (whpx_enabled()) { whpx_cpu_synchronize_state(cpu); } @@ -37,6 +41,9 @@ static inline void cpu_synchronize_post_reset(CPUState *c= pu) if (hax_enabled()) { hax_cpu_synchronize_post_reset(cpu); } + if (hvf_enabled()) { + hvf_cpu_synchronize_post_reset(cpu); + } if (whpx_enabled()) { whpx_cpu_synchronize_post_reset(cpu); } @@ -50,6 +57,9 @@ static inline void cpu_synchronize_post_init(CPUState *cp= u) if (hax_enabled()) { hax_cpu_synchronize_post_init(cpu); } + if (hvf_enabled()) { + hvf_cpu_synchronize_post_init(cpu); + } if (whpx_enabled()) { whpx_cpu_synchronize_post_init(cpu); } --=20 2.26.1 From nobody Sun May 5 17:18:10 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=yadro.com ARC-Seal: i=1; a=rsa-sha256; t=1593039755; cv=none; d=zohomail.com; s=zohoarc; b=issNuv9VNk1b7/Fsp45WvbJnaKZ4iBwngicvU6e1bKQ1FWYPowy5zZE2EqvudWtfQiTBGtDdY3LHEHCscZ9AUFjWt6a6DmN5faICZWwwc/+rwzg3M4AiuFGq2T7K5/VbMZskUplHasigGfzbYbD710KTIk+mkCXMLe4CCu+cSkA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1593039755; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=pULZLDqZtEPSe63lljR6AOUWi3y52MwdwkOyv4rJJIw=; b=NlegM2Nng9VZwaeTkcDcdhe3xwDA+7R9z6ZEofvvrdhTFGUH6Yt1MorK/GM7sXl1BHMqdhsAhEu9VayXXby74EJrL6liDZ4Jkwr7blM0KJScLO8eHyJRyoZQfMlzTsBULqkVgxoJcF3hcWeTtQ2Jl+CeqnMzd0ZuR485N6Znl5k= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1593039755005563.2694445042846; Wed, 24 Jun 2020 16:02:35 -0700 (PDT) Received: from localhost ([::1]:52678 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1joEPZ-0001D3-NR for importer@patchew.org; Wed, 24 Jun 2020 19:02:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40430) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1joEO7-0007yb-Os for qemu-devel@nongnu.org; Wed, 24 Jun 2020 19:01:03 -0400 Received: from mta-02.yadro.com ([89.207.88.252]:32894 helo=mta-01.yadro.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1joEO5-0006lz-83 for qemu-devel@nongnu.org; Wed, 24 Jun 2020 19:01:03 -0400 Received: from localhost (unknown [127.0.0.1]) by mta-01.yadro.com (Postfix) with ESMTP id D94C84C8B3; Wed, 24 Jun 2020 23:00:59 +0000 (UTC) Received: from mta-01.yadro.com ([127.0.0.1]) by localhost (mta-01.yadro.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 63d2OYZHT7Nv; Thu, 25 Jun 2020 02:00:58 +0300 (MSK) Received: from T-EXCH-02.corp.yadro.com (t-exch-02.corp.yadro.com [172.17.10.102]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mta-01.yadro.com (Postfix) with ESMTPS id 4410F4C8AE; Thu, 25 Jun 2020 02:00:57 +0300 (MSK) Received: from localhost (172.17.204.212) by T-EXCH-02.corp.yadro.com (172.17.10.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.669.32; Thu, 25 Jun 2020 02:00:57 +0300 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=yadro.com; h= content-type:content-type:content-transfer-encoding:mime-version :references:in-reply-to:x-mailer:message-id:date:date:subject :subject:from:from:received:received:received; s=mta-01; t= 1593039658; x=1594854059; bh=mc5EETSvNJkKYQCiUzu9RpiV7bYmTNQc+eO rchr6x10=; b=Kh6hiTuqmk4Q8su/9+c5dkj9m0D3ljeVuaM1HxYmNGRtHFkUiP4 SHKj60y4YLlWZTKeE51UZDtL/zhIQ8fgxEpeFxBkMBK2IDhxAgA0uYxekgzWJc9F L67WuZAgBzqGZvHE8Hod7Bz7BuNiYCvb5NlcA5lQE4iuRY918bWkMX+c= X-Virus-Scanned: amavisd-new at yadro.com From: Roman Bolshakov To: Subject: [PATCH 3/8] i386: hvf: Add hvf_cpu_synchronize_pre_loadvm() Date: Thu, 25 Jun 2020 01:58:46 +0300 Message-ID: <20200624225850.16982-4-r.bolshakov@yadro.com> X-Mailer: git-send-email 2.26.1 In-Reply-To: <20200624225850.16982-1-r.bolshakov@yadro.com> References: <20200624225850.16982-1-r.bolshakov@yadro.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [172.17.204.212] X-ClientProxiedBy: T-EXCH-01.corp.yadro.com (172.17.10.101) To T-EXCH-02.corp.yadro.com (172.17.10.102) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=89.207.88.252; envelope-from=r.bolshakov@yadro.com; helo=mta-01.yadro.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/24 19:00:57 X-ACL-Warn: Detected OS = Linux 3.11 and newer X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Eduardo Habkost , Cameron Esfahani , Roman Bolshakov , Claudio Fontana , Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @yadro.com) Content-Type: text/plain; charset="utf-8" hvf lacks an implementation of cpu_synchronize_pre_loadvm(). Cc: Cameron Esfahani Signed-off-by: Roman Bolshakov --- include/sysemu/hvf.h | 1 + include/sysemu/hw_accel.h | 3 +++ target/i386/hvf/hvf.c | 11 +++++++++++ 3 files changed, 15 insertions(+) diff --git a/include/sysemu/hvf.h b/include/sysemu/hvf.h index 5214ed5202..1d40a8ec01 100644 --- a/include/sysemu/hvf.h +++ b/include/sysemu/hvf.h @@ -28,6 +28,7 @@ int hvf_vcpu_exec(CPUState *); void hvf_cpu_synchronize_state(CPUState *); void hvf_cpu_synchronize_post_reset(CPUState *); void hvf_cpu_synchronize_post_init(CPUState *); +void hvf_cpu_synchronize_pre_loadvm(CPUState *); void hvf_vcpu_destroy(CPUState *); void hvf_reset_vcpu(CPUState *); =20 diff --git a/include/sysemu/hw_accel.h b/include/sysemu/hw_accel.h index 80bce75921..e128f8b06b 100644 --- a/include/sysemu/hw_accel.h +++ b/include/sysemu/hw_accel.h @@ -73,6 +73,9 @@ static inline void cpu_synchronize_pre_loadvm(CPUState *c= pu) if (hax_enabled()) { hax_cpu_synchronize_pre_loadvm(cpu); } + if (hvf_enabled()) { + hvf_cpu_synchronize_pre_loadvm(cpu); + } if (whpx_enabled()) { whpx_cpu_synchronize_pre_loadvm(cpu); } diff --git a/target/i386/hvf/hvf.c b/target/i386/hvf/hvf.c index be016b951a..efe9802962 100644 --- a/target/i386/hvf/hvf.c +++ b/target/i386/hvf/hvf.c @@ -325,6 +325,17 @@ void hvf_cpu_synchronize_post_init(CPUState *cpu_state) run_on_cpu(cpu_state, do_hvf_cpu_synchronize_post_init, RUN_ON_CPU_NUL= L); } =20 +static void do_hvf_cpu_synchronize_pre_loadvm(CPUState *cpu, + run_on_cpu_data arg) +{ + cpu->vcpu_dirty =3D true; +} + +void hvf_cpu_synchronize_pre_loadvm(CPUState *cpu) +{ + run_on_cpu(cpu, do_hvf_cpu_synchronize_pre_loadvm, RUN_ON_CPU_NULL); +} + static bool ept_emulation_fault(hvf_slot *slot, uint64_t gpa, uint64_t ept= _qual) { int read, write; --=20 2.26.1 From nobody Sun May 5 17:18:10 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=yadro.com ARC-Seal: i=1; a=rsa-sha256; t=1593039944; cv=none; d=zohomail.com; s=zohoarc; b=VpdShBRyq470DCFnjuSx5Q3tAy+t7jSHsdynPElHJ5Zwgq+fsa8Vbse0WoI/dFvKzcWtHBpRifPzZ9EyXw5v0YPqGdoL/Lpv/ocEu0NfEv+Z0GjgxRGWTcPaVAT8TJWw2sWs7/cEu6Hd2zituOYucG2mMCTIGz01qWYN4oIBA4w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1593039944; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=s4odE67H/+F1I24OBntPyUBowoKfhTe6ZbT3rTF3wo0=; b=BXBkbzv2Y7jx6Ool7ls+4Udn0iLp3zyD8Z3bio3zy4IHazSrU7LPfX9oOFTvonEKM0+a6JcdELSm1I5j/CC7bkZqBi+0+SmpeIqhl8PKNpCJGlkfKOc/rT2zilIKCbXlPidXVnPJj66Hf39O/sKCHuNGuh+1/96Iz6xAUQE1gCA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1593039944572124.21236235418576; Wed, 24 Jun 2020 16:05:44 -0700 (PDT) Received: from localhost ([::1]:35326 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1joESd-0006BF-9E for importer@patchew.org; Wed, 24 Jun 2020 19:05:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40484) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1joEO9-00081z-UK for qemu-devel@nongnu.org; Wed, 24 Jun 2020 19:01:05 -0400 Received: from mta-02.yadro.com ([89.207.88.252]:32906 helo=mta-01.yadro.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1joEO6-0006mU-6l for qemu-devel@nongnu.org; Wed, 24 Jun 2020 19:01:05 -0400 Received: from localhost (unknown [127.0.0.1]) by mta-01.yadro.com (Postfix) with ESMTP id D0DAA4C8B1; Wed, 24 Jun 2020 23:01:00 +0000 (UTC) Received: from mta-01.yadro.com ([127.0.0.1]) by localhost (mta-01.yadro.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id JLYubegpmftb; Thu, 25 Jun 2020 02:00:59 +0300 (MSK) Received: from T-EXCH-02.corp.yadro.com (t-exch-02.corp.yadro.com [172.17.10.102]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mta-01.yadro.com (Postfix) with ESMTPS id DF0334C8AD; Thu, 25 Jun 2020 02:00:57 +0300 (MSK) Received: from localhost (172.17.204.212) by T-EXCH-02.corp.yadro.com (172.17.10.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.669.32; Thu, 25 Jun 2020 02:00:57 +0300 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=yadro.com; h= content-type:content-type:content-transfer-encoding:mime-version :references:in-reply-to:x-mailer:message-id:date:date:subject :subject:from:from:received:received:received; s=mta-01; t= 1593039659; x=1594854060; bh=5eLzJTuOmT/x7yLO7cQ7PGZ56UuXWSdJnvj 6AQTqRfo=; b=Xxlc8UHtHofSP3SdkU26CTt1TdrFyo1B5zsDTqbTBEh3KU96fC6 CUkFVHxMmNYoVyuQcdrf+PLAM8brlyHM8cgrpfVdlgQWodmMWKzIAB0d4a93J8c8 dDYCbCGniZVYc/gWYJOdVX6h8tTDPf5jq4ZKIHpfAAE7CyHqc7zfWW84= X-Virus-Scanned: amavisd-new at yadro.com From: Roman Bolshakov To: Subject: [PATCH 4/8] i386: hvf: Implement CPU kick Date: Thu, 25 Jun 2020 01:58:47 +0300 Message-ID: <20200624225850.16982-5-r.bolshakov@yadro.com> X-Mailer: git-send-email 2.26.1 In-Reply-To: <20200624225850.16982-1-r.bolshakov@yadro.com> References: <20200624225850.16982-1-r.bolshakov@yadro.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [172.17.204.212] X-ClientProxiedBy: T-EXCH-01.corp.yadro.com (172.17.10.101) To T-EXCH-02.corp.yadro.com (172.17.10.102) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=89.207.88.252; envelope-from=r.bolshakov@yadro.com; helo=mta-01.yadro.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/24 19:00:57 X-ACL-Warn: Detected OS = Linux 3.11 and newer X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Eduardo Habkost , Cameron Esfahani , Roman Bolshakov , Claudio Fontana , Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @yadro.com) Content-Type: text/plain; charset="utf-8" HVF doesn't have a CPU kick and without it it's not possible to perform an action on CPU thread until a VMEXIT happens. The kick is also needed for timely interrupt delivery. Existing implementation of CPU kick sends SIG_IPI (aka SIGUSR1) to vCPU thread, but it's different from what hv_vcpu_interrupt does. The latter one results in invocation of mp_cpus_kick() in XNU kernel [1]. While at it, correct type of hvf_fd to the type of hv_vcpuid_t to avoid compilation warnings. 1. https://opensource.apple.com/source/xnu/xnu-6153.81.5/osfmk/i386/mp.c Cc: Cameron Esfahani Signed-off-by: Roman Bolshakov --- cpus.c | 13 +++++++++---- include/hw/core/cpu.h | 2 +- include/sysemu/hvf.h | 1 + target/i386/hvf/hvf.c | 11 +++++++++++ 4 files changed, 22 insertions(+), 5 deletions(-) diff --git a/cpus.c b/cpus.c index 26709677d3..36f38ce5c8 100644 --- a/cpus.c +++ b/cpus.c @@ -1783,10 +1783,15 @@ static void qemu_cpu_kick_thread(CPUState *cpu) return; } cpu->thread_kicked =3D true; - err =3D pthread_kill(cpu->thread->thread, SIG_IPI); - if (err && err !=3D ESRCH) { - fprintf(stderr, "qemu:%s: %s", __func__, strerror(err)); - exit(1); + + if (hvf_enabled()) { + hvf_vcpu_kick(cpu); + } else { + err =3D pthread_kill(cpu->thread->thread, SIG_IPI); + if (err && err !=3D ESRCH) { + fprintf(stderr, "qemu:%s: %s", __func__, strerror(err)); + exit(1); + } } #else /* _WIN32 */ if (!qemu_cpu_is_self(cpu)) { diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index b3f4b79318..288a2bd57e 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -438,7 +438,7 @@ struct CPUState { =20 struct hax_vcpu_state *hax_vcpu; =20 - int hvf_fd; + unsigned hvf_fd; =20 /* track IOMMUs whose translations we've cached in the TCG TLB */ GArray *iommu_notifiers; diff --git a/include/sysemu/hvf.h b/include/sysemu/hvf.h index 1d40a8ec01..aaa00cbf05 100644 --- a/include/sysemu/hvf.h +++ b/include/sysemu/hvf.h @@ -25,6 +25,7 @@ extern bool hvf_allowed; =20 int hvf_init_vcpu(CPUState *); int hvf_vcpu_exec(CPUState *); +void hvf_vcpu_kick(CPUState *); void hvf_cpu_synchronize_state(CPUState *); void hvf_cpu_synchronize_post_reset(CPUState *); void hvf_cpu_synchronize_post_init(CPUState *); diff --git a/target/i386/hvf/hvf.c b/target/i386/hvf/hvf.c index efe9802962..4d254a477a 100644 --- a/target/i386/hvf/hvf.c +++ b/target/i386/hvf/hvf.c @@ -966,6 +966,17 @@ int hvf_vcpu_exec(CPUState *cpu) return ret; } =20 +void hvf_vcpu_kick(CPUState *cpu) +{ + hv_return_t err; + + err =3D hv_vcpu_interrupt(&cpu->hvf_fd, 1); + if (err) { + fprintf(stderr, "qemu:%s error %#x\n", __func__, err); + exit(1); + } +} + bool hvf_allowed; =20 static int hvf_accel_init(MachineState *ms) --=20 2.26.1 From nobody Sun May 5 17:18:10 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=yadro.com ARC-Seal: i=1; a=rsa-sha256; t=1593039853; cv=none; d=zohomail.com; s=zohoarc; b=C//vujf34G+auWVDr8k6oeWOCyRMvA323aqz2Je9u8IMDLSXvIeBSNO8dj2aNJ433v0QTKg/EE6rs+EuP6JlJyX0yKRRN+y9PMn2DB4Swj/6KMZLUTDSGHjFHIbuVG9+rB5ca1NKfeEKBwmz7p4W5mNRXuPLZCf+TObpT5ef84Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1593039853; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=/gSFzn2NUj5tWtda0o7wJeR3rLeNmYS5rKzKaHB6d7I=; b=KGxp5wuSCYayjki7yT62OxTcNQ13S+WqbMOIr5GnGDmZs60EIcdTEPNXDahR2Jacat+7iG7hPmkqOL2iClmwqvRFRRQa65IxcNIgXVBSpRcBE1qCjbGfpU+sRPb67RtH4kjxoZMDzP1G5pA8XOE4izvSTrWRjNmGVZohtaUJ1SM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1593039853744718.8732553049579; Wed, 24 Jun 2020 16:04:13 -0700 (PDT) Received: from localhost ([::1]:59324 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1joERA-0004A7-9m for importer@patchew.org; Wed, 24 Jun 2020 19:04:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40468) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1joEO9-00080n-Ci for qemu-devel@nongnu.org; Wed, 24 Jun 2020 19:01:05 -0400 Received: from mta-02.yadro.com ([89.207.88.252]:32926 helo=mta-01.yadro.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1joEO7-0006nQ-0j for qemu-devel@nongnu.org; Wed, 24 Jun 2020 19:01:05 -0400 Received: from localhost (unknown [127.0.0.1]) by mta-01.yadro.com (Postfix) with ESMTP id 181F04C8AD; Wed, 24 Jun 2020 23:01:01 +0000 (UTC) Received: from mta-01.yadro.com ([127.0.0.1]) by localhost (mta-01.yadro.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id sPCVySG97sVg; Thu, 25 Jun 2020 02:00:59 +0300 (MSK) Received: from T-EXCH-02.corp.yadro.com (t-exch-02.corp.yadro.com [172.17.10.102]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mta-01.yadro.com (Postfix) with ESMTPS id 6C5064C8A7; Thu, 25 Jun 2020 02:00:58 +0300 (MSK) Received: from localhost (172.17.204.212) by T-EXCH-02.corp.yadro.com (172.17.10.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.669.32; Thu, 25 Jun 2020 02:00:58 +0300 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=yadro.com; h= content-type:content-type:content-transfer-encoding:mime-version :references:in-reply-to:x-mailer:message-id:date:date:subject :subject:from:from:received:received:received; s=mta-01; t= 1593039659; x=1594854060; bh=/agBQHSopimvaBz9V7rqhDp/Hc7pXQlgE5U iRtZKlKc=; b=Oa4og9+j+uGjcqAsI3RPExG2O44MIbRfQqcvrE3re1W/hS8hUog b8uu/w7VJKN9kwNqRDX0hpUj6w7tGlWf9Ir9+k00C7Tu/ul9Gpl68E2GabGgjgN2 mDjiXgiE/qSrmP23Sxeu2sLfSvMZ46pxq6A8ZRI6NHbXfCIXPubbcFI4= X-Virus-Scanned: amavisd-new at yadro.com From: Roman Bolshakov To: Subject: [PATCH 5/8] i386: hvf: Don't duplicate register reset Date: Thu, 25 Jun 2020 01:58:48 +0300 Message-ID: <20200624225850.16982-6-r.bolshakov@yadro.com> X-Mailer: git-send-email 2.26.1 In-Reply-To: <20200624225850.16982-1-r.bolshakov@yadro.com> References: <20200624225850.16982-1-r.bolshakov@yadro.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [172.17.204.212] X-ClientProxiedBy: T-EXCH-01.corp.yadro.com (172.17.10.101) To T-EXCH-02.corp.yadro.com (172.17.10.102) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=89.207.88.252; envelope-from=r.bolshakov@yadro.com; helo=mta-01.yadro.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/24 19:00:57 X-ACL-Warn: Detected OS = Linux 3.11 and newer X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Eduardo Habkost , Cameron Esfahani , Roman Bolshakov , Claudio Fontana , Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @yadro.com) Content-Type: text/plain; charset="utf-8" hvf_reset_vcpu() duplicates actions performed by x86_cpu_reset(). The difference is that hvf_reset_vcpu() stores initial values directly to VMCS while x86_cpu_reset() stores it in CPUX86State and then cpu_synchronize_all_post_init() or cpu_synchronize_all_post_reset() flushes CPUX86State into VMCS. That makes most of the hvf_reset_vcpu() a kind of no-op. Here's the trace of CPU state modifications during VM start: hvf_reset_vcpu (resets VMCS) cpu_synchronize_all_post_init (overwrites VMCS fields written by hvf_reset_vcpu()) cpu_synchronize_all_states hvf_reset_vcpu (resets VMCS) cpu_synchronize_all_post_reset (overwrites VMCS fields written by hvf_reset_vcpu()) General purpose registers, system registers, segment descriptors, flags and IP are set by hvf_put_segments() in post-init and post-reset, therefore it's safe to remove them from hvf_reset_vcpu(). Cc: Cameron Esfahani Signed-off-by: Roman Bolshakov --- target/i386/hvf/hvf.c | 78 ------------------------------------------- 1 file changed, 78 deletions(-) diff --git a/target/i386/hvf/hvf.c b/target/i386/hvf/hvf.c index 4d254a477a..2c4028d08c 100644 --- a/target/i386/hvf/hvf.c +++ b/target/i386/hvf/hvf.c @@ -456,90 +456,12 @@ void hvf_reset_vcpu(CPUState *cpu) { uint64_t pdpte[4] =3D {0, 0, 0, 0}; int i; =20 - /* TODO: this shouldn't be needed; there is already a call to - * cpu_synchronize_all_post_reset in vl.c - */ wvmcs(cpu->hvf_fd, VMCS_ENTRY_CTLS, 0); - wvmcs(cpu->hvf_fd, VMCS_GUEST_IA32_EFER, 0); =20 /* Initialize PDPTE */ for (i =3D 0; i < 4; i++) { wvmcs(cpu->hvf_fd, VMCS_GUEST_PDPTE0 + i * 2, pdpte[i]); } - - macvm_set_cr0(cpu->hvf_fd, 0x60000010); - - wvmcs(cpu->hvf_fd, VMCS_CR4_MASK, CR4_VMXE_MASK); - wvmcs(cpu->hvf_fd, VMCS_CR4_SHADOW, 0x0); - wvmcs(cpu->hvf_fd, VMCS_GUEST_CR4, CR4_VMXE_MASK); - - /* set VMCS guest state fields */ - wvmcs(cpu->hvf_fd, VMCS_GUEST_CS_SELECTOR, 0xf000); - wvmcs(cpu->hvf_fd, VMCS_GUEST_CS_LIMIT, 0xffff); - wvmcs(cpu->hvf_fd, VMCS_GUEST_CS_ACCESS_RIGHTS, 0x9b); - wvmcs(cpu->hvf_fd, VMCS_GUEST_CS_BASE, 0xffff0000); - - wvmcs(cpu->hvf_fd, VMCS_GUEST_DS_SELECTOR, 0); - wvmcs(cpu->hvf_fd, VMCS_GUEST_DS_LIMIT, 0xffff); - wvmcs(cpu->hvf_fd, VMCS_GUEST_DS_ACCESS_RIGHTS, 0x93); - wvmcs(cpu->hvf_fd, VMCS_GUEST_DS_BASE, 0); - - wvmcs(cpu->hvf_fd, VMCS_GUEST_ES_SELECTOR, 0); - wvmcs(cpu->hvf_fd, VMCS_GUEST_ES_LIMIT, 0xffff); - wvmcs(cpu->hvf_fd, VMCS_GUEST_ES_ACCESS_RIGHTS, 0x93); - wvmcs(cpu->hvf_fd, VMCS_GUEST_ES_BASE, 0); - - wvmcs(cpu->hvf_fd, VMCS_GUEST_FS_SELECTOR, 0); - wvmcs(cpu->hvf_fd, VMCS_GUEST_FS_LIMIT, 0xffff); - wvmcs(cpu->hvf_fd, VMCS_GUEST_FS_ACCESS_RIGHTS, 0x93); - wvmcs(cpu->hvf_fd, VMCS_GUEST_FS_BASE, 0); - - wvmcs(cpu->hvf_fd, VMCS_GUEST_GS_SELECTOR, 0); - wvmcs(cpu->hvf_fd, VMCS_GUEST_GS_LIMIT, 0xffff); - wvmcs(cpu->hvf_fd, VMCS_GUEST_GS_ACCESS_RIGHTS, 0x93); - wvmcs(cpu->hvf_fd, VMCS_GUEST_GS_BASE, 0); - - wvmcs(cpu->hvf_fd, VMCS_GUEST_SS_SELECTOR, 0); - wvmcs(cpu->hvf_fd, VMCS_GUEST_SS_LIMIT, 0xffff); - wvmcs(cpu->hvf_fd, VMCS_GUEST_SS_ACCESS_RIGHTS, 0x93); - wvmcs(cpu->hvf_fd, VMCS_GUEST_SS_BASE, 0); - - wvmcs(cpu->hvf_fd, VMCS_GUEST_LDTR_SELECTOR, 0); - wvmcs(cpu->hvf_fd, VMCS_GUEST_LDTR_LIMIT, 0); - wvmcs(cpu->hvf_fd, VMCS_GUEST_LDTR_ACCESS_RIGHTS, 0x10000); - wvmcs(cpu->hvf_fd, VMCS_GUEST_LDTR_BASE, 0); - - wvmcs(cpu->hvf_fd, VMCS_GUEST_TR_SELECTOR, 0); - wvmcs(cpu->hvf_fd, VMCS_GUEST_TR_LIMIT, 0); - wvmcs(cpu->hvf_fd, VMCS_GUEST_TR_ACCESS_RIGHTS, 0x83); - wvmcs(cpu->hvf_fd, VMCS_GUEST_TR_BASE, 0); - - wvmcs(cpu->hvf_fd, VMCS_GUEST_GDTR_LIMIT, 0); - wvmcs(cpu->hvf_fd, VMCS_GUEST_GDTR_BASE, 0); - - wvmcs(cpu->hvf_fd, VMCS_GUEST_IDTR_LIMIT, 0); - wvmcs(cpu->hvf_fd, VMCS_GUEST_IDTR_BASE, 0); - - /*wvmcs(cpu->hvf_fd, VMCS_GUEST_CR2, 0x0);*/ - wvmcs(cpu->hvf_fd, VMCS_GUEST_CR3, 0x0); - - wreg(cpu->hvf_fd, HV_X86_RIP, 0xfff0); - wreg(cpu->hvf_fd, HV_X86_RDX, 0x623); - wreg(cpu->hvf_fd, HV_X86_RFLAGS, 0x2); - wreg(cpu->hvf_fd, HV_X86_RSP, 0x0); - wreg(cpu->hvf_fd, HV_X86_RAX, 0x0); - wreg(cpu->hvf_fd, HV_X86_RBX, 0x0); - wreg(cpu->hvf_fd, HV_X86_RCX, 0x0); - wreg(cpu->hvf_fd, HV_X86_RSI, 0x0); - wreg(cpu->hvf_fd, HV_X86_RDI, 0x0); - wreg(cpu->hvf_fd, HV_X86_RBP, 0x0); - - for (int i =3D 0; i < 8; i++) { - wreg(cpu->hvf_fd, HV_X86_R8 + i, 0x0); - } - - hv_vcpu_invalidate_tlb(cpu->hvf_fd); - hv_vcpu_flush(cpu->hvf_fd); } =20 void hvf_vcpu_destroy(CPUState *cpu) --=20 2.26.1 From nobody Sun May 5 17:18:10 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=yadro.com ARC-Seal: i=1; a=rsa-sha256; t=1593039937; cv=none; d=zohomail.com; s=zohoarc; b=CudlE+dHm2Nrl5sXy0LNTOcB13iWbT6IfmJmWvJ9l4SzwwuSLnCFQE1YxUhKubkxlm7zOIx8kJo18l46XkdHCIszRuuPky6uJLUte9BGS7br1Uh1QDXtq0tTWv9pb4Y6uHkBCsOgNTmIaGEHRFRQhq4I/QEVqIYqVqa2GCwiBlw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1593039937; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=jTAmCU8ZxDM6MNn/DiymfNM/4nijs35qWVvrjS4uJDM=; b=VnAftB30tNr6fmslny1czvBtw1vRRzGNKPyglxHkXkH2iM5l8KmFT5h1BbV5BnI+EVW82vFaFwmk4NuEzCyEW1C5Q4gUb8hnI76kLjj9msX/3qiKAkzAblrLflO/yR1/a7KMgoKpOETrZOKb8nFnJfKyR76pNiZKvUm6zE9lu9c= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1593039937845447.7015988192527; Wed, 24 Jun 2020 16:05:37 -0700 (PDT) Received: from localhost ([::1]:35044 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1joESW-00061l-Lw for importer@patchew.org; Wed, 24 Jun 2020 19:05:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40486) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1joEOA-00083V-Mt for qemu-devel@nongnu.org; Wed, 24 Jun 2020 19:01:06 -0400 Received: from mta-02.yadro.com ([89.207.88.252]:32936 helo=mta-01.yadro.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1joEO7-0006nW-8N for qemu-devel@nongnu.org; Wed, 24 Jun 2020 19:01:06 -0400 Received: from localhost (unknown [127.0.0.1]) by mta-01.yadro.com (Postfix) with ESMTP id E64674C8A8; Wed, 24 Jun 2020 23:01:01 +0000 (UTC) Received: from mta-01.yadro.com ([127.0.0.1]) by localhost (mta-01.yadro.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id rI7ock36h5b3; Thu, 25 Jun 2020 02:01:00 +0300 (MSK) Received: from T-EXCH-02.corp.yadro.com (t-exch-02.corp.yadro.com [172.17.10.102]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mta-01.yadro.com (Postfix) with ESMTPS id 019424C8AC; Thu, 25 Jun 2020 02:00:59 +0300 (MSK) Received: from localhost (172.17.204.212) by T-EXCH-02.corp.yadro.com (172.17.10.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.669.32; Thu, 25 Jun 2020 02:00:58 +0300 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=yadro.com; h= content-type:content-type:content-transfer-encoding:mime-version :references:in-reply-to:x-mailer:message-id:date:date:subject :subject:from:from:received:received:received; s=mta-01; t= 1593039660; x=1594854061; bh=DOa3xdIj/2ZyMZbRe6WLqoWwFvtCcErZNfp 47YEjZE0=; b=pAR1kexHvXIOuE+pA3mN5Wfp6c6r3cHS/SBnsGcpwl4e9ZSyZ5O vDMZDfa5J9zZS8UXmjmi9rDVG/GF9y80grNa7mq3c1GRhrwrd/bzStQIzSEsvhMk InthMqA0qAbYvirARZ8tVy68hZmfOW//KkZ8XL0jy1wZvMRf/hcjC55c= X-Virus-Scanned: amavisd-new at yadro.com From: Roman Bolshakov To: Subject: [PATCH 6/8] i386: hvf: Drop hvf_reset_vcpu() Date: Thu, 25 Jun 2020 01:58:49 +0300 Message-ID: <20200624225850.16982-7-r.bolshakov@yadro.com> X-Mailer: git-send-email 2.26.1 In-Reply-To: <20200624225850.16982-1-r.bolshakov@yadro.com> References: <20200624225850.16982-1-r.bolshakov@yadro.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [172.17.204.212] X-ClientProxiedBy: T-EXCH-01.corp.yadro.com (172.17.10.101) To T-EXCH-02.corp.yadro.com (172.17.10.102) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=89.207.88.252; envelope-from=r.bolshakov@yadro.com; helo=mta-01.yadro.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/24 19:00:57 X-ACL-Warn: Detected OS = Linux 3.11 and newer X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Eduardo Habkost , Cameron Esfahani , Roman Bolshakov , Claudio Fontana , Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @yadro.com) Content-Type: text/plain; charset="utf-8" It's worth to have a custom accel-specific reset in x86_cpu_reset() only if something related to CPUState has to be reset and that can't be done in post-init or post-reset. Cc: Cameron Esfahani Signed-off-by: Roman Bolshakov --- include/sysemu/hvf.h | 1 - target/i386/cpu.c | 3 --- target/i386/hvf/hvf.c | 23 +++++++++++------------ 3 files changed, 11 insertions(+), 16 deletions(-) diff --git a/include/sysemu/hvf.h b/include/sysemu/hvf.h index aaa00cbf05..a1ab61403f 100644 --- a/include/sysemu/hvf.h +++ b/include/sysemu/hvf.h @@ -31,7 +31,6 @@ void hvf_cpu_synchronize_post_reset(CPUState *); void hvf_cpu_synchronize_post_init(CPUState *); void hvf_cpu_synchronize_pre_loadvm(CPUState *); void hvf_vcpu_destroy(CPUState *); -void hvf_reset_vcpu(CPUState *); =20 #define TYPE_HVF_ACCEL ACCEL_CLASS_NAME("hvf") =20 diff --git a/target/i386/cpu.c b/target/i386/cpu.c index b1b311baa2..bfa3eed9b6 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -6089,9 +6089,6 @@ static void x86_cpu_reset(DeviceState *dev) if (kvm_enabled()) { kvm_arch_reset_vcpu(cpu); } - else if (hvf_enabled()) { - hvf_reset_vcpu(s); - } #endif } =20 diff --git a/target/i386/hvf/hvf.c b/target/i386/hvf/hvf.c index 2c4028d08c..0b2be8de47 100644 --- a/target/i386/hvf/hvf.c +++ b/target/i386/hvf/hvf.c @@ -303,6 +303,17 @@ void hvf_cpu_synchronize_state(CPUState *cpu_state) static void do_hvf_cpu_synchronize_post_reset(CPUState *cpu, run_on_cpu_da= ta arg) { CPUState *cpu_state =3D cpu; + uint64_t pdpte[4] =3D {0, 0, 0, 0}; + int i; + + /* Reset IA-32e mode guest (LMA) */ + wvmcs(cpu->hvf_fd, VMCS_ENTRY_CTLS, 0); + + /* Initialize PDPTE */ + for (i =3D 0; i < 4; i++) { + wvmcs(cpu->hvf_fd, VMCS_GUEST_PDPTE0 + i * 2, pdpte[i]); + } + hvf_put_registers(cpu_state); cpu_state->vcpu_dirty =3D false; } @@ -452,18 +463,6 @@ static MemoryListener hvf_memory_listener =3D { .log_sync =3D hvf_log_sync, }; =20 -void hvf_reset_vcpu(CPUState *cpu) { - uint64_t pdpte[4] =3D {0, 0, 0, 0}; - int i; - - wvmcs(cpu->hvf_fd, VMCS_ENTRY_CTLS, 0); - - /* Initialize PDPTE */ - for (i =3D 0; i < 4; i++) { - wvmcs(cpu->hvf_fd, VMCS_GUEST_PDPTE0 + i * 2, pdpte[i]); - } -} - void hvf_vcpu_destroy(CPUState *cpu) { X86CPU *x86_cpu =3D X86_CPU(cpu); --=20 2.26.1 From nobody Sun May 5 17:18:10 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=yadro.com ARC-Seal: i=1; a=rsa-sha256; t=1593039757; cv=none; d=zohomail.com; s=zohoarc; b=nIOlf341W9eiYgvyliww45Wq8Tk6nR5m/0bS6MtQLmMJb7E5o3rttPoCAXyQqHCPE88xbOPPYZ8d1mCGVz7fHK9v1bMiuWi2mbvkK9caem2gKuCOdBGiowYoc5doMyJZkt4ZjqRzNbXhM6Hv8A/MfTAipSnY1lW443qPSfkypSk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1593039757; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=9pqN9uU7J4zcPaWuf0STTXke1m76KNvmwnO169f9OHw=; b=agukCU7FgXy8FF73HuuaJ1XawSixoL9axPHnHEBmXbsDsrPbEg61fi+Wn/4aRmfjYgHCsdQOlXXfAbRFLNffigzW68FGKMCdyxWWVbPtzDDEAwMtFElw0pVcN2gUshWtAjGLHqa06N30zSSE4qnyBoEpXHi2/8s6zVF5dOolAAE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1593039757897961.3205390887583; Wed, 24 Jun 2020 16:02:37 -0700 (PDT) Received: from localhost ([::1]:52960 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1joEPc-0001K0-Lo for importer@patchew.org; Wed, 24 Jun 2020 19:02:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40480) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1joEO9-00081d-Ox for qemu-devel@nongnu.org; Wed, 24 Jun 2020 19:01:05 -0400 Received: from mta-02.yadro.com ([89.207.88.252]:32950 helo=mta-01.yadro.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1joEO7-0006nj-Ib for qemu-devel@nongnu.org; Wed, 24 Jun 2020 19:01:05 -0400 Received: from localhost (unknown [127.0.0.1]) by mta-01.yadro.com (Postfix) with ESMTP id 3000D4C8AF; Wed, 24 Jun 2020 23:01:02 +0000 (UTC) Received: from mta-01.yadro.com ([127.0.0.1]) by localhost (mta-01.yadro.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id it99qvdGabhf; Thu, 25 Jun 2020 02:01:01 +0300 (MSK) Received: from T-EXCH-02.corp.yadro.com (t-exch-02.corp.yadro.com [172.17.10.102]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mta-01.yadro.com (Postfix) with ESMTPS id 87AEE4C8AB; Thu, 25 Jun 2020 02:00:59 +0300 (MSK) Received: from localhost (172.17.204.212) by T-EXCH-02.corp.yadro.com (172.17.10.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.669.32; Thu, 25 Jun 2020 02:00:59 +0300 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=yadro.com; h= content-type:content-type:content-transfer-encoding:mime-version :references:in-reply-to:x-mailer:message-id:date:date:subject :subject:from:from:received:received:received; s=mta-01; t= 1593039661; x=1594854062; bh=22wHRyTsBRe+6CKxRp3j1EgsD5Q4dokkEn8 iGFdtGvA=; b=NrWuDIZG/1wEd7PirLoyCUY1w+7j5VfXgVIDsp1Zya/xT/rq46L MYyYNAruNosMCEoPg8meWSrbVIASKLiKpTzYr7p62GWhhQRqAwjFsuEe/e9K3W5f wb3qYtRgSRNbWjhXp1OSqFhoq+40H4TEzkEDQSO5eOf+wJtLFm9gSa7Q= X-Virus-Scanned: amavisd-new at yadro.com From: Roman Bolshakov To: Subject: [PATCH 7/8] i386: hvf: Clean up synchronize functions Date: Thu, 25 Jun 2020 01:58:50 +0300 Message-ID: <20200624225850.16982-8-r.bolshakov@yadro.com> X-Mailer: git-send-email 2.26.1 In-Reply-To: <20200624225850.16982-1-r.bolshakov@yadro.com> References: <20200624225850.16982-1-r.bolshakov@yadro.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [172.17.204.212] X-ClientProxiedBy: T-EXCH-01.corp.yadro.com (172.17.10.101) To T-EXCH-02.corp.yadro.com (172.17.10.102) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=89.207.88.252; envelope-from=r.bolshakov@yadro.com; helo=mta-01.yadro.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/24 19:00:57 X-ACL-Warn: Detected OS = Linux 3.11 and newer X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Eduardo Habkost , Cameron Esfahani , Roman Bolshakov , Claudio Fontana , Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @yadro.com) Content-Type: text/plain; charset="utf-8" Make them more concise and consitent with the rest of the code in the file and drop non-relevant TODO. Cc: Cameron Esfahani Signed-off-by: Roman Bolshakov --- target/i386/hvf/hvf.c | 36 ++++++++++++++++-------------------- 1 file changed, 16 insertions(+), 20 deletions(-) diff --git a/target/i386/hvf/hvf.c b/target/i386/hvf/hvf.c index 0b2be8de47..18fe843834 100644 --- a/target/i386/hvf/hvf.c +++ b/target/i386/hvf/hvf.c @@ -282,27 +282,24 @@ void hvf_handle_io(CPUArchState *env, uint16_t port, = void *buffer, } } =20 -/* TODO: synchronize vcpu state */ static void do_hvf_cpu_synchronize_state(CPUState *cpu, run_on_cpu_data ar= g) { - CPUState *cpu_state =3D cpu; - if (cpu_state->vcpu_dirty =3D=3D 0) { - hvf_get_registers(cpu_state); + if (!cpu->vcpu_dirty) { + hvf_get_registers(cpu); + cpu->vcpu_dirty =3D true; } - - cpu_state->vcpu_dirty =3D 1; } =20 -void hvf_cpu_synchronize_state(CPUState *cpu_state) +void hvf_cpu_synchronize_state(CPUState *cpu) { - if (cpu_state->vcpu_dirty =3D=3D 0) { - run_on_cpu(cpu_state, do_hvf_cpu_synchronize_state, RUN_ON_CPU_NUL= L); + if (!cpu->vcpu_dirty) { + run_on_cpu(cpu, do_hvf_cpu_synchronize_state, RUN_ON_CPU_NULL); } } =20 -static void do_hvf_cpu_synchronize_post_reset(CPUState *cpu, run_on_cpu_da= ta arg) +static void do_hvf_cpu_synchronize_post_reset(CPUState *cpu, + run_on_cpu_data arg) { - CPUState *cpu_state =3D cpu; uint64_t pdpte[4] =3D {0, 0, 0, 0}; int i; =20 @@ -314,26 +311,25 @@ static void do_hvf_cpu_synchronize_post_reset(CPUStat= e *cpu, run_on_cpu_data arg wvmcs(cpu->hvf_fd, VMCS_GUEST_PDPTE0 + i * 2, pdpte[i]); } =20 - hvf_put_registers(cpu_state); - cpu_state->vcpu_dirty =3D false; + hvf_put_registers(cpu); + cpu->vcpu_dirty =3D false; } =20 -void hvf_cpu_synchronize_post_reset(CPUState *cpu_state) +void hvf_cpu_synchronize_post_reset(CPUState *cpu) { - run_on_cpu(cpu_state, do_hvf_cpu_synchronize_post_reset, RUN_ON_CPU_NU= LL); + run_on_cpu(cpu, do_hvf_cpu_synchronize_post_reset, RUN_ON_CPU_NULL); } =20 static void do_hvf_cpu_synchronize_post_init(CPUState *cpu, run_on_cpu_data arg) { - CPUState *cpu_state =3D cpu; - hvf_put_registers(cpu_state); - cpu_state->vcpu_dirty =3D false; + hvf_put_registers(cpu); + cpu->vcpu_dirty =3D false; } =20 -void hvf_cpu_synchronize_post_init(CPUState *cpu_state) +void hvf_cpu_synchronize_post_init(CPUState *cpu) { - run_on_cpu(cpu_state, do_hvf_cpu_synchronize_post_init, RUN_ON_CPU_NUL= L); + run_on_cpu(cpu, do_hvf_cpu_synchronize_post_init, RUN_ON_CPU_NULL); } =20 static void do_hvf_cpu_synchronize_pre_loadvm(CPUState *cpu, --=20 2.26.1 From nobody Sun May 5 17:18:10 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=yadro.com ARC-Seal: i=1; a=rsa-sha256; t=1593040045; cv=none; d=zohomail.com; s=zohoarc; b=j/Dhh8kiSOai1wEiroTaYxN3/JkQkuzI8rxSjZ2hCKepsTT6W6mlVgPD+CV6m4h3PTf3afl7T66WdgnEk9qQ36pC0sCx/4OyE2MzSV4NnD49tiOJzS/L0Vu4/W7mJ1qZeAHV0+sZVB1sTH3WFfTVNip3VCDPWzKYSW8Gb83q3cU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1593040045; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=vazSfsKpkxBzssnjPIKgTPwZo0AKRjU8oNjJZNTU9Rg=; b=MNWXCQlSSjLHnMcnbLd358pUEyXxMnqKNqdaX8niScDzjxIlXNSPmpGfGGHY1JfBB9YnC5SIAD5TkZrcgQ3hExmz9Xe1h1crk07RbetNm+9FftqVACGxeeMdV77hbJ9Na51y+E1lr+hHyimNi07yRN+ovQ+fpuKxCHA4FApu/6Q= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1593040045280600.8283717823448; Wed, 24 Jun 2020 16:07:25 -0700 (PDT) Received: from localhost ([::1]:40702 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1joEUF-00005j-RM for importer@patchew.org; Wed, 24 Jun 2020 19:07:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40488) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1joEOA-00083n-Uf for qemu-devel@nongnu.org; Wed, 24 Jun 2020 19:01:06 -0400 Received: from mta-02.yadro.com ([89.207.88.252]:32954 helo=mta-01.yadro.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1joEO8-0006oS-Jz for qemu-devel@nongnu.org; Wed, 24 Jun 2020 19:01:06 -0400 Received: from localhost (unknown [127.0.0.1]) by mta-01.yadro.com (Postfix) with ESMTP id 40A7B4C8A5; Wed, 24 Jun 2020 23:01:03 +0000 (UTC) Received: from mta-01.yadro.com ([127.0.0.1]) by localhost (mta-01.yadro.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 5cSOTwuckfHI; Thu, 25 Jun 2020 02:01:01 +0300 (MSK) Received: from T-EXCH-02.corp.yadro.com (t-exch-02.corp.yadro.com [172.17.10.102]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mta-01.yadro.com (Postfix) with ESMTPS id 1EC4B4C8AE; Thu, 25 Jun 2020 02:01:00 +0300 (MSK) Received: from localhost (172.17.204.212) by T-EXCH-02.corp.yadro.com (172.17.10.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.669.32; Thu, 25 Jun 2020 02:01:00 +0300 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=yadro.com; h= content-type:content-type:content-transfer-encoding:mime-version :references:in-reply-to:x-mailer:message-id:date:date:subject :subject:from:from:received:received:received; s=mta-01; t= 1593039661; x=1594854062; bh=rRhKxqXWvG/YdGOJC7TPFk5dHkA1wtB7Wq2 ddWYaXz8=; b=bLVsuyy8AtFs7dKRIOsb149jg0+VVR4oBSQXbz0zkW5a6T335cm +joN9epQYhGN7LNjnFCgzHL6022HiHetPGuY9q2kJa8RF6IwdqzoJ9U+VB0K586V May/KbaVDxediWavBqW3xAcsBCvPOToNQcamHnA+KwFnBXr06K7BFbSc= X-Virus-Scanned: amavisd-new at yadro.com From: Roman Bolshakov To: Subject: [PATCH 8/8] MAINTAINERS: Add Cameron as HVF co-maintainer Date: Thu, 25 Jun 2020 01:58:51 +0300 Message-ID: <20200624225850.16982-9-r.bolshakov@yadro.com> X-Mailer: git-send-email 2.26.1 In-Reply-To: <20200624225850.16982-1-r.bolshakov@yadro.com> References: <20200624225850.16982-1-r.bolshakov@yadro.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [172.17.204.212] X-ClientProxiedBy: T-EXCH-01.corp.yadro.com (172.17.10.101) To T-EXCH-02.corp.yadro.com (172.17.10.102) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=89.207.88.252; envelope-from=r.bolshakov@yadro.com; helo=mta-01.yadro.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/24 19:00:57 X-ACL-Warn: Detected OS = Linux 3.11 and newer X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Roman Bolshakov , Claudio Fontana , Cameron Esfahani Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @yadro.com) Content-Type: text/plain; charset="utf-8" Similar patch was sent a while ago but got lost. While at it, add a status wiki page. Cc: Cameron Esfahani Signed-off-by: Roman Bolshakov --- MAINTAINERS | 2 ++ 1 file changed, 2 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 01e6b3fefe..f54a50cdb2 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -417,7 +417,9 @@ F: target/i386/kvm.c F: scripts/kvm/vmxcap =20 X86 HVF CPUs +M: Cameron Esfahani M: Roman Bolshakov +W: https://wiki.qemu.org/Features/HVF S: Maintained F: accel/stubs/hvf-stub.c F: target/i386/hvf/ --=20 2.26.1