From patchwork Wed Mar 3 18:22:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 12115017 Return-Path: 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=-13.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable 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 4193CC4332D for ; Thu, 4 Mar 2021 00:31:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 15C9C64EEC for ; Thu, 4 Mar 2021 00:31:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347752AbhCDAbU (ORCPT ); Wed, 3 Mar 2021 19:31:20 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:20272 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232135AbhCCSfh (ORCPT ); Wed, 3 Mar 2021 13:35:37 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614796446; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=pU0d9Mw8PQdbgfBbP+KMCl6F0o1+MOAeJgm+3OD11Xs=; b=en+gxHXG70jcvFk9XV66lfetdfF37iCQuZn8FW3HVaT4SbjwUFLaZ0w5GTpYyBIdqzBwEb tSTpDR45oD8Q9Sqtskc8ll9aB5RWe/iP6LaZWkWl5AdfdQDxO1IFFCkjUq0Slpfdi24ETR w/cpnlng2UgDB+9onld0oRjVGTURmPg= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-592-uVOQyKdLOTuX4qdHKxbGBw-1; Wed, 03 Mar 2021 13:22:23 -0500 X-MC-Unique: uVOQyKdLOTuX4qdHKxbGBw-1 Received: by mail-wr1-f72.google.com with SMTP id s10so2219125wre.0 for ; Wed, 03 Mar 2021 10:22:23 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=pU0d9Mw8PQdbgfBbP+KMCl6F0o1+MOAeJgm+3OD11Xs=; b=NzIyxVkyIHrboVnFfu8P1LUW+i+I52cNRjrz0bmbZ4mSgwntiIQILqixKaR5QJMIFA fJ7f83If7tze+012d8nUuhD4hxpr1Wdm5VvA0gMfkeZEno/mZ0CkmnTOb6tbzUHXWkd0 qMwIvGUlC2UNGF6aQWD7bGVcDQqeCtcPci3eGbxHm/W/dhh7cuu4tMsf+7c5oSuoc+W7 dThlB67UP102oxNaIEfbzk+WTZ/iyfuMa9QnmkhJo8+GgSBgWDLKE8NVM2gcdXpQiQdN pqARaDLpw8s61VfYlE5oUH6MA1G/kfs5mbDDrH46BZO9OD4zAwJ0ErtuWvCXR+u5LJZ0 MzvA== X-Gm-Message-State: AOAM531QMIT4sBdbkyT2esiJ84Une9CAp4JKxFYa4ixoiniqIE6R9wdL 0jqU1TjiV/Jhyu6FIn4iwxaXQNZBH9G7PLNp5vsC2k+2maAut23BsnbEdD2Ul2HgkZr5IZkgjel izmw5kKToi84F X-Received: by 2002:a5d:430a:: with SMTP id h10mr19960wrq.162.1614795742422; Wed, 03 Mar 2021 10:22:22 -0800 (PST) X-Google-Smtp-Source: ABdhPJwUTywIC+KwxYJXuUyDhzg8Nuj7gHjGLk6CPjSdHmohYvyP+QZLu8kIXtLnUufcrNeJRgTWfQ== X-Received: by 2002:a5d:430a:: with SMTP id h10mr19929wrq.162.1614795742181; Wed, 03 Mar 2021 10:22:22 -0800 (PST) Received: from x1w.redhat.com (68.red-83-57-175.dynamicip.rima-tde.net. [83.57.175.68]) by smtp.gmail.com with ESMTPSA id i3sm35148487wra.66.2021.03.03.10.22.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Mar 2021 10:22:21 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Eduardo Habkost , Cornelia Huck , Richard Henderson , Sunil Muthuswamy , Marcelo Tosatti , David Gibson , Marcel Apfelbaum , kvm@vger.kernel.org, Wenchao Wang , Thomas Huth , Cameron Esfahani , Paolo Bonzini , David Hildenbrand , Roman Bolshakov , Peter Maydell , Greg Kurz , qemu-arm@nongnu.org, Halil Pasic , Colin Xu , Claudio Fontana , qemu-ppc@nongnu.org, Christian Borntraeger , qemu-s390x@nongnu.org, haxm-team@intel.com, =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= Subject: [RFC PATCH 00/19] accel: Introduce AccelvCPUState opaque structure Date: Wed, 3 Mar 2021 19:22:00 +0100 Message-Id: <20210303182219.1631042-1-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Hi, This series introduces the 'AccelvCPUState' which is forward declared opaque in "cpu.h", then each accelerator define it. The opaque CPUState::accel_vcpu pointer is shared by all accelerators (not a problem because there can be at most one accelerator per vCPU). Series is organized as: - preliminary trivial cleanups - introduce AccelvCPUState - move WHPX fields (build-tested) - move HAX fields (not tested) - move KVM fields (build-tested) - move HVF fields (not tested) For now vcpu_dirty is still shared in CPUState. Sending as RFC to see if it is worthwhile. Regards, Phil. Philippe Mathieu-Daudé (19): target/i386/hvf: Use boolean value for vcpu_dirty target/s390x/kvm: Simplify debug code target/s390x/kvm: Reduce deref by declaring 'struct kvm_run' on stack cpu: Croup accelerator-specific fields altogether cpu: Introduce AccelvCPUState opaque structure accel/whpx: Add typedef for 'struct whpx_vcpu' accel/whpx: Rename struct whpx_vcpu -> AccelvCPUState accel/whpx: Use 'accel_vcpu' generic pointer accel/hax: Add typedef for 'struct hax_vcpu_state' accel/hax: Use 'accel_vcpu' generic pointer accel/kvm: Introduce kvm_vcpu_state() helper accel/kvm: Use kvm_vcpu_state() when possible accel/kvm: Declare and allocate AccelvCPUState struct accel/kvm: Move the 'kvm_fd' field to AccelvCPUState accel/kvm: Move the 'kvm_state' field to AccelvCPUState accel/kvm: Move the 'kvm_run' field to AccelvCPUState accel/hvf: Reduce deref by declaring 'hv_vcpuid_t hvf_fd' on stack accel/hvf: Declare and allocate AccelvCPUState struct accel/hvf: Move the 'hvf_fd' field to AccelvCPUState include/hw/core/cpu.h | 17 +-- include/sysemu/kvm.h | 2 + include/sysemu/kvm_int.h | 9 ++ target/i386/hax/hax-i386.h | 10 +- target/i386/hvf/hvf-i386.h | 4 + target/i386/hvf/vmx.h | 28 +++-- accel/kvm/kvm-all.c | 44 ++++--- hw/s390x/pv.c | 3 +- target/arm/kvm.c | 2 +- target/arm/kvm64.c | 12 +- target/i386/cpu.c | 4 +- target/i386/hax/hax-all.c | 22 ++-- target/i386/hax/hax-posix.c | 4 +- target/i386/hax/hax-windows.c | 4 +- target/i386/hvf/hvf.c | 118 +++++++++--------- target/i386/hvf/x86.c | 28 ++--- target/i386/hvf/x86_descr.c | 32 +++-- target/i386/hvf/x86_emu.c | 62 +++++----- target/i386/hvf/x86_mmu.c | 4 +- target/i386/hvf/x86_task.c | 14 ++- target/i386/hvf/x86hvf.c | 227 +++++++++++++++++----------------- target/i386/kvm/kvm.c | 36 +++--- target/i386/whpx/whpx-all.c | 34 ++--- target/ppc/kvm.c | 16 +-- target/s390x/kvm.c | 148 +++++++++++----------- 25 files changed, 466 insertions(+), 418 deletions(-)