From patchwork Wed Apr 5 16:04:45 2023 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: 13202143 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 86DF6C76188 for ; Wed, 5 Apr 2023 16:05:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238634AbjDEQFP (ORCPT ); Wed, 5 Apr 2023 12:05:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54364 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238396AbjDEQFM (ORCPT ); Wed, 5 Apr 2023 12:05:12 -0400 Received: from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com [IPv6:2a00:1450:4864:20::42b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2EFE16582 for ; Wed, 5 Apr 2023 09:05:04 -0700 (PDT) Received: by mail-wr1-x42b.google.com with SMTP id m2so36727142wrh.6 for ; Wed, 05 Apr 2023 09:05:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1680710703; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=xxoSzGepGv7BmEwhIUriUkTSi2iiaajTQsAiWFvibwk=; b=DQmQx5IbN6E4g6+BkWxA6gztVY7c/sHCIzd5stHTLyHiWOEkRlEtrivX3vqbDbGjL7 XxhqdFKDllanEdiwIR+2geFMKUEf51/bjTU6C1eN4FPCiqJiX82RtiNDDdUc4v8TZMlS hfE9xJx7iUvpEr/MKnWta3hPHTH4tZxYVjBbZjbRVHV9SQjjE7MOqQkE5Vx8Ki+X5wTp c5TkfIiumSxeeb7KERAMfNwXTLH281hiqor5R3BeKHaP0CWh9xqCJFkqSyE1Ryn0CRfG Wa9APsQXMmO/K9sEl+9/eYdh12Me4fUTC8mQAdjssj9vMZeCKSBjNoCuzIYv3M364S11 1Z3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680710703; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=xxoSzGepGv7BmEwhIUriUkTSi2iiaajTQsAiWFvibwk=; b=Rwd54se1rY2rdH9gSMvvj0oDYriwvJC6wjYNeDUIacAPc1bydo4Si1RMxLm1SHSnyr bNH7uWLmz6XGFQMthErPMHLWALML0Wue8MDiSMjlXcACxYkgvkl5FAEUKwe+8+PG+szu qb1j2gZ4woWx+BR5PBwpnG7iHI8Y2j0QiM6sV4waGDesV1jPeRnpkxhrW/uan9T2g+dv XbqoMJsXK+qhvG5ahFm4GANdbo8FwNm1VFw4vQuTaLvxO40BrhC+aVbkUsd+HR0URAW2 Xb78ZLvTv719n9Y4mL6qaRZ/mgYUf8tkjOVudD8RUYbCLXx9pml3RRqb2wZVsJ2viOka 5U7Q== X-Gm-Message-State: AAQBX9dLO92SUZhaQ7jQmKgl6vyxvuTuGwcJybCuK4/fB0ucoy3mkO5F 7IIITEm0NtI+RYWvq5ADLhYiIg== X-Google-Smtp-Source: AKy350bS4fbO2z32Jbhpsnm4njKJVeihL7eN5HhQ5ZKA2WfgsKUiX7r37OaZuRjkvBKDgyCpYJKbBg== X-Received: by 2002:adf:de8f:0:b0:2dc:c0da:409 with SMTP id w15-20020adfde8f000000b002dcc0da0409mr3979004wrl.27.1680710703263; Wed, 05 Apr 2023 09:05:03 -0700 (PDT) Received: from localhost.localdomain (4ab54-h01-176-184-52-81.dsl.sta.abo.bbox.fr. [176.184.52.81]) by smtp.gmail.com with ESMTPSA id k16-20020a056000005000b002e116cbe24esm15293404wrx.32.2023.04.05.09.05.01 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 05 Apr 2023 09:05:02 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-s390x@nongnu.org, qemu-riscv@nongnu.org, =?utf-8?q?Alex_Benn=C3=A9e?= , qemu-arm@nongnu.org, kvm@vger.kernel.org, qemu-ppc@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= , Paolo Bonzini Subject: [PATCH 01/10] sysemu/kvm: Remove unused headers Date: Wed, 5 Apr 2023 18:04:45 +0200 Message-Id: <20230405160454.97436-2-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230405160454.97436-1-philmd@linaro.org> References: <20230405160454.97436-1-philmd@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org All types used are forward-declared in "qemu/typedefs.h". Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Alex Bennée Reviewed-by: Richard Henderson --- include/sysemu/kvm.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/include/sysemu/kvm.h b/include/sysemu/kvm.h index cc6c678ed8..7902acdfd9 100644 --- a/include/sysemu/kvm.h +++ b/include/sysemu/kvm.h @@ -16,9 +16,6 @@ #ifndef QEMU_KVM_H #define QEMU_KVM_H -#include "qemu/queue.h" -#include "hw/core/cpu.h" -#include "exec/memattrs.h" #include "qemu/accel.h" #include "qom/object.h" From patchwork Wed Apr 5 16:04:46 2023 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: 13202144 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5FF40C77B62 for ; Wed, 5 Apr 2023 16:05:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238764AbjDEQFS (ORCPT ); Wed, 5 Apr 2023 12:05:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54538 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238396AbjDEQFQ (ORCPT ); Wed, 5 Apr 2023 12:05:16 -0400 Received: from mail-wm1-x336.google.com (mail-wm1-x336.google.com [IPv6:2a00:1450:4864:20::336]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1FCCD61A9 for ; Wed, 5 Apr 2023 09:05:11 -0700 (PDT) Received: by mail-wm1-x336.google.com with SMTP id n10-20020a05600c4f8a00b003ee93d2c914so23715081wmq.2 for ; Wed, 05 Apr 2023 09:05:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1680710709; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=vR5kvRphrC8o/hHrAZxx+p2NR9QjIUYlt0J+xt0JrLs=; b=Kue5crNsn30pNOYpY9SPsIZwYEzatKWT1JwNyC4Tz7AI+Dm1LFg9LUQzgpf2K6tikc mk/JLoWJuJW2YMb/u8tpJRDDD7NE7oEZWhjMD1NIUNYPSkllpMt4dfkpHFl4mXkmb2/c TNeHcs9kjwshAlFLaAd4rINe8sxW9leo230jyONFwRebI56QBZwVXxxrhO9P73poHXtK Y8QJ/YWtGqiDl6UF/8eCPHY7/WUX9shWQCd5AGt9lFkl2TKo5jGKRk9cKJNCtgCpeGep 9jtSe7h0htiRpqIt8S8VefTo70S/iyC9ehr9mAsFxriP5352D4IpRYJpO5PNI1YHwluK zLVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680710709; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=vR5kvRphrC8o/hHrAZxx+p2NR9QjIUYlt0J+xt0JrLs=; b=A9hdibBR0jBu+9JU2ANsbNQTXD4NboFg9R+wT7ZeGueCQNNf0rwo3IOJ3FUH4TpzYi YhOY4JLdWfgZcvv0o+1LjSk/k365JkrXAvvIbcD6V8gn9CAvelmLj08CfDh5Il3UxaCq Qvk+X0IqxL/VO2zSI9nXwkhbZt8tOoXOLLavePaGGJEoeWaX70C3SeBQKG67CPE7lbb4 YKjCBcJH3F7LxiAY7wQbcR/ZSdjYT/xTcSlO5a22A1f2peIPsQLkmq34CbpLEXlo7sD+ DgSvlhToih8HuWymivPPn7Tzxerm8M7LW6Lx29B5XC0AAw7FEgPq9bUroLiXIL2GdWiG h1Kw== X-Gm-Message-State: AAQBX9f7Xj4MKniXyFtQ6uXw4y9RBYzolkGyaWZQwMoT74yJRpuVIaG/ T1yEBDiT9dHL7qmsMJjVx+YKRQ== X-Google-Smtp-Source: AKy350ZaWzKW7gNGd6JCeIyd+5HFBIKAziuH2LQaatqde7bMAk2r3xVbM5UGjlxR3ZLELjGpAEwkSQ== X-Received: by 2002:a7b:c7d4:0:b0:3ed:809b:79ac with SMTP id z20-20020a7bc7d4000000b003ed809b79acmr5056954wmk.19.1680710709383; Wed, 05 Apr 2023 09:05:09 -0700 (PDT) Received: from localhost.localdomain (4ab54-h01-176-184-52-81.dsl.sta.abo.bbox.fr. [176.184.52.81]) by smtp.gmail.com with ESMTPSA id t6-20020a05600c450600b003ee2a0d49dbsm2642061wmo.25.2023.04.05.09.05.07 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 05 Apr 2023 09:05:08 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-s390x@nongnu.org, qemu-riscv@nongnu.org, =?utf-8?q?Alex_Benn=C3=A9e?= , qemu-arm@nongnu.org, kvm@vger.kernel.org, qemu-ppc@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= , Paolo Bonzini Subject: [PATCH 02/10] accel/kvm: Declare kvm_direct_msi_allowed in stubs Date: Wed, 5 Apr 2023 18:04:46 +0200 Message-Id: <20230405160454.97436-3-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230405160454.97436-1-philmd@linaro.org> References: <20230405160454.97436-1-philmd@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Avoid when calling kvm_direct_msi_enabled() from arm_gicv3_its_common.c the next commit: Undefined symbols for architecture arm64: "_kvm_direct_msi_allowed", referenced from: _its_class_name in hw_intc_arm_gicv3_its_common.c.o ld: symbol(s) not found for architecture arm64 Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Alex Bennée Reviewed-by: Richard Henderson --- accel/stubs/kvm-stub.c | 1 + 1 file changed, 1 insertion(+) diff --git a/accel/stubs/kvm-stub.c b/accel/stubs/kvm-stub.c index 5d2dd8f351..235dc661bc 100644 --- a/accel/stubs/kvm-stub.c +++ b/accel/stubs/kvm-stub.c @@ -27,6 +27,7 @@ bool kvm_allowed; bool kvm_readonly_mem_allowed; bool kvm_ioeventfd_any_length_allowed; bool kvm_msi_use_devid; +bool kvm_direct_msi_allowed; void kvm_flush_coalesced_mmio_buffer(void) { From patchwork Wed Apr 5 16:04:47 2023 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: 13202145 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BA1BDC76188 for ; Wed, 5 Apr 2023 16:05:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239050AbjDEQF1 (ORCPT ); Wed, 5 Apr 2023 12:05:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54816 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239070AbjDEQFV (ORCPT ); Wed, 5 Apr 2023 12:05:21 -0400 Received: from mail-wr1-x432.google.com (mail-wr1-x432.google.com [IPv6:2a00:1450:4864:20::432]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 32AF761A9 for ; Wed, 5 Apr 2023 09:05:17 -0700 (PDT) Received: by mail-wr1-x432.google.com with SMTP id e18so36716938wra.9 for ; Wed, 05 Apr 2023 09:05:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1680710715; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=vqJcKhz9mIYMr3Oe650mCrgDSoO6+Z+db2hud5uttJw=; b=HKwM2wDJ1Fum+wqlFpT+ZGNsBPp7MH24wgkXSJwjBKyOE+4yhIpILKEyyjMZxMmiAD DXttce9/UlXfCDXhUY0vpealipGUCFqdh25CESoprzd/G49n7qbtXRObflz9tqSuM1F7 NhEOtd7ocMwbq0oWvCtYAuvh91yLbGhXLXvZ0H3VeVIegPm2GRaXQd0+P7USRVczo9wH OkkavqtWMbctyFZouKLoRT8V4s8VzYy1hTwtmR5fLXDvRCDvderEBMd29GlxvpY9KDh3 HoKoGgz26of/gomablGIAqTVkdsvIcrHjzIM7huMgI0NyHKBbCcGxfoW5vbe7ROmPTjn Ht6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680710715; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=vqJcKhz9mIYMr3Oe650mCrgDSoO6+Z+db2hud5uttJw=; b=IGZcHyja8wH1RLOehj733dq2GzaZIxPndW6kFNihKAFIM6simLBmi0OAFyZoqI/U6X wW6NJkVNTD/x9m1F+DBCCLTzwfnfbZ/1JwcRW2yL3S3zTQe7SFZPZWymPWHMd/O0rPBZ DdVoU3tFHxCoB5463cstKwUeWyB9oZxIjW7UXE7UJHsvYSf6sE8OKXEIGPPB3Wo1+uGo uyQ4vBk+3cwWjpNMDqCb7QsP33z/4yhDckcf1kf9H6/qMxKJdQXql6MIP1v4AlSiHPmJ LP5bRElkUO2RS5KmXDjLpQBhnfNUj3Ggh9/St7wb2mlzg1FCFEtTJVdDSpeJJDDQlaUg +aXA== X-Gm-Message-State: AAQBX9eXrXI/T37zRrrPa2TefV/KvReHqfZb83Tp9tBbFi5JbQFxaWwH owLxxrATuHcijibEs/HzJbQY4Q== X-Google-Smtp-Source: AKy350bN19fJ+yL8EQeK+93Zo/4a5VSKfxzvyGOZ4rYVIwTM+m7Uu71D6zWrGtIgzjY9gZsgTdtgFA== X-Received: by 2002:adf:cd05:0:b0:2cf:e34c:a229 with SMTP id w5-20020adfcd05000000b002cfe34ca229mr4808855wrm.8.1680710715354; Wed, 05 Apr 2023 09:05:15 -0700 (PDT) Received: from localhost.localdomain (4ab54-h01-176-184-52-81.dsl.sta.abo.bbox.fr. [176.184.52.81]) by smtp.gmail.com with ESMTPSA id e38-20020a5d5966000000b002d78a96cf5fsm15467280wri.70.2023.04.05.09.05.13 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 05 Apr 2023 09:05:15 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-s390x@nongnu.org, qemu-riscv@nongnu.org, =?utf-8?q?Alex_Benn=C3=A9e?= , qemu-arm@nongnu.org, kvm@vger.kernel.org, qemu-ppc@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= , Peter Maydell , Shannon Zhao , "Michael S. Tsirkin" , Igor Mammedov , Ani Sinha , Paolo Bonzini Subject: [PATCH 03/10] hw/intc/arm_gic: Un-inline GIC*/ITS class_name() helpers Date: Wed, 5 Apr 2023 18:04:47 +0200 Message-Id: <20230405160454.97436-4-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230405160454.97436-1-philmd@linaro.org> References: <20230405160454.97436-1-philmd@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org "kvm_arm.h" contains external and internal prototype declarations. Files under the hw/ directory should only access the KVM external API. In order to avoid machine / device models to include "kvm_arm.h" simply to get the QOM GIC/ITS class name, un-inline each class name getter to the proper device model file. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- include/hw/intc/arm_gic.h | 2 ++ include/hw/intc/arm_gicv3_common.h | 10 ++++++ include/hw/intc/arm_gicv3_its_common.h | 9 ++++++ target/arm/kvm_arm.h | 45 -------------------------- hw/arm/virt-acpi-build.c | 2 +- hw/arm/virt.c | 1 + hw/intc/arm_gic_common.c | 7 ++++ hw/intc/arm_gicv3_common.c | 14 ++++++++ hw/intc/arm_gicv3_its_common.c | 12 +++++++ 9 files changed, 56 insertions(+), 46 deletions(-) diff --git a/include/hw/intc/arm_gic.h b/include/hw/intc/arm_gic.h index 116ccbb5a9..48f6a51a70 100644 --- a/include/hw/intc/arm_gic.h +++ b/include/hw/intc/arm_gic.h @@ -86,4 +86,6 @@ struct ARMGICClass { DeviceRealize parent_realize; }; +const char *gic_class_name(void); + #endif diff --git a/include/hw/intc/arm_gicv3_common.h b/include/hw/intc/arm_gicv3_common.h index ab5182a28a..4e2fb518e7 100644 --- a/include/hw/intc/arm_gicv3_common.h +++ b/include/hw/intc/arm_gicv3_common.h @@ -329,4 +329,14 @@ struct ARMGICv3CommonClass { void gicv3_init_irqs_and_mmio(GICv3State *s, qemu_irq_handler handler, const MemoryRegionOps *ops); +/** + * gicv3_class_name + * + * Return name of GICv3 class to use depending on whether KVM acceleration is + * in use. May throw an error if the chosen implementation is not available. + * + * Returns: class name to use + */ +const char *gicv3_class_name(void); + #endif diff --git a/include/hw/intc/arm_gicv3_its_common.h b/include/hw/intc/arm_gicv3_its_common.h index a11a0f6654..7dc712b38d 100644 --- a/include/hw/intc/arm_gicv3_its_common.h +++ b/include/hw/intc/arm_gicv3_its_common.h @@ -122,5 +122,14 @@ struct GICv3ITSCommonClass { void (*post_load)(GICv3ITSState *s); }; +/** + * its_class_name: + * + * Return the ITS class name to use depending on whether KVM acceleration + * and KVM CAP_SIGNAL_MSI are supported + * + * Returns: class name to use or NULL + */ +const char *its_class_name(void); #endif diff --git a/target/arm/kvm_arm.h b/target/arm/kvm_arm.h index 99017b635c..fe6d824a52 100644 --- a/target/arm/kvm_arm.h +++ b/target/arm/kvm_arm.h @@ -445,32 +445,6 @@ static inline uint32_t kvm_arm_sve_get_vls(CPUState *cs) #endif -static inline const char *gic_class_name(void) -{ - return kvm_irqchip_in_kernel() ? "kvm-arm-gic" : "arm_gic"; -} - -/** - * gicv3_class_name - * - * Return name of GICv3 class to use depending on whether KVM acceleration is - * in use. May throw an error if the chosen implementation is not available. - * - * Returns: class name to use - */ -static inline const char *gicv3_class_name(void) -{ - if (kvm_irqchip_in_kernel()) { - return "kvm-arm-gicv3"; - } else { - if (kvm_enabled()) { - error_report("Userspace GICv3 is not supported with KVM"); - exit(1); - } - return "arm-gicv3"; - } -} - /** * kvm_arm_handle_debug: * @cs: CPUState @@ -508,23 +482,4 @@ void kvm_arm_copy_hw_debug_data(struct kvm_guest_debug_arch *ptr); */ bool kvm_arm_verify_ext_dabt_pending(CPUState *cs); -/** - * its_class_name: - * - * Return the ITS class name to use depending on whether KVM acceleration - * and KVM CAP_SIGNAL_MSI are supported - * - * Returns: class name to use or NULL - */ -static inline const char *its_class_name(void) -{ - if (kvm_irqchip_in_kernel()) { - /* KVM implementation requires this capability */ - return kvm_direct_msi_enabled() ? "arm-its-kvm" : NULL; - } else { - /* Software emulation based model */ - return "arm-gicv3-its"; - } -} - #endif diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c index 4156111d49..e8bab19847 100644 --- a/hw/arm/virt-acpi-build.c +++ b/hw/arm/virt-acpi-build.c @@ -48,12 +48,12 @@ #include "hw/pci/pci_bus.h" #include "hw/pci-host/gpex.h" #include "hw/arm/virt.h" +#include "hw/intc/arm_gicv3_its_common.h" #include "hw/mem/nvdimm.h" #include "hw/platform-bus.h" #include "sysemu/numa.h" #include "sysemu/reset.h" #include "sysemu/tpm.h" -#include "kvm_arm.h" #include "migration/vmstate.h" #include "hw/acpi/ghes.h" #include "hw/acpi/viot.h" diff --git a/hw/arm/virt.c b/hw/arm/virt.c index 1fe39c6683..dbbe639e61 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -63,6 +63,7 @@ #include "hw/arm/fdt.h" #include "hw/intc/arm_gic.h" #include "hw/intc/arm_gicv3_common.h" +#include "hw/intc/arm_gicv3_its_common.h" #include "hw/irq.h" #include "kvm_arm.h" #include "hw/firmware/smbios.h" diff --git a/hw/intc/arm_gic_common.c b/hw/intc/arm_gic_common.c index a379cea395..9702197856 100644 --- a/hw/intc/arm_gic_common.c +++ b/hw/intc/arm_gic_common.c @@ -21,10 +21,12 @@ #include "qemu/osdep.h" #include "qapi/error.h" #include "qemu/module.h" +#include "qemu/error-report.h" #include "gic_internal.h" #include "hw/arm/linux-boot-if.h" #include "hw/qdev-properties.h" #include "migration/vmstate.h" +#include "sysemu/kvm.h" static int gic_pre_save(void *opaque) { @@ -393,3 +395,8 @@ static void register_types(void) } type_init(register_types) + +const char *gic_class_name(void) +{ + return kvm_irqchip_in_kernel() ? "kvm-arm-gic" : "arm_gic"; +} diff --git a/hw/intc/arm_gicv3_common.c b/hw/intc/arm_gicv3_common.c index 642a8243ed..2ebf880ead 100644 --- a/hw/intc/arm_gicv3_common.c +++ b/hw/intc/arm_gicv3_common.c @@ -24,6 +24,7 @@ #include "qemu/osdep.h" #include "qapi/error.h" #include "qemu/module.h" +#include "qemu/error-report.h" #include "hw/core/cpu.h" #include "hw/intc/arm_gicv3_common.h" #include "hw/qdev-properties.h" @@ -608,3 +609,16 @@ static void register_types(void) } type_init(register_types) + +const char *gicv3_class_name(void) +{ + if (kvm_irqchip_in_kernel()) { + return "kvm-arm-gicv3"; + } else { + if (kvm_enabled()) { + error_report("Userspace GICv3 is not supported with KVM"); + exit(1); + } + return "arm-gicv3"; + } +} diff --git a/hw/intc/arm_gicv3_its_common.c b/hw/intc/arm_gicv3_its_common.c index d7532a7a89..abaf77057e 100644 --- a/hw/intc/arm_gicv3_its_common.c +++ b/hw/intc/arm_gicv3_its_common.c @@ -24,6 +24,7 @@ #include "hw/intc/arm_gicv3_its_common.h" #include "qemu/log.h" #include "qemu/module.h" +#include "sysemu/kvm.h" static int gicv3_its_pre_save(void *opaque) { @@ -158,3 +159,14 @@ static void gicv3_its_common_register_types(void) } type_init(gicv3_its_common_register_types) + +const char *its_class_name(void) +{ + if (kvm_irqchip_in_kernel()) { + /* KVM implementation requires this capability */ + return kvm_direct_msi_enabled() ? "arm-its-kvm" : NULL; + } else { + /* Software emulation based model */ + return "arm-gicv3-its"; + } +} From patchwork Wed Apr 5 16:04:48 2023 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: 13202146 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C3CE5C76188 for ; Wed, 5 Apr 2023 16:05:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239101AbjDEQFd (ORCPT ); Wed, 5 Apr 2023 12:05:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54514 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239118AbjDEQFZ (ORCPT ); Wed, 5 Apr 2023 12:05:25 -0400 Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B66BE6E82 for ; Wed, 5 Apr 2023 09:05:22 -0700 (PDT) Received: by mail-wm1-x335.google.com with SMTP id s13so21172384wmr.4 for ; Wed, 05 Apr 2023 09:05:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1680710721; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=5CSHrPIDjf1IWIN1nnp6I0uB6O25vizWYPyXq8gYKvo=; b=G6pPxv8mxmBXT/A7Fms6p48gVBPAVhCbwwptPPupZJfFBxICRxzF5EfjLYHeeUdIOM KuTVNoN2hg8Z3US/l5DXZyRgclnPh2Svov5K5NTEkQxYcjBSczhbLwslailyhLzmv6Hx 91gp8FcyA1tMzQYLGb0/U7BSEeLNYMUXaL3U64SUPUMVKewIvfK4P2ZczU3Eu+z/zV/O nTNCHqofXowPBxAA4rcW8XP7R0rJ7wuGTOYWFborUVJW0xF27yen/vXwymcuMP8cWAbJ k89Nl96lVK8m1OUz0Xtgy2IppNpCw1q/fBG9RE/e5WdoX3T9mSBBSUEfBaVAMGEYLdkN N91w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680710721; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=5CSHrPIDjf1IWIN1nnp6I0uB6O25vizWYPyXq8gYKvo=; b=o6KzgHWa8IQx09nq7J6lDaEAuNTEUFdPd8wnxF8b0G0LXnzxYJSgJtetHAdwwg0/Lb bhOiVxm3vgESeSXcAgC+O9laAbs0DbAOCpPacJY2oPY6D+GvmXWX7vnG0olgFiYGFQjM +o6mF43PSq5KDBo6D5WYIPW/9CWJu0Y8WkqmX/zcxXNoBk3yn9mvYlI3XtOJxUUTTqSQ 3lUc/fTTOqnZHab9xE0W0aYCSgIdAyvSVRqXlNoUgXAqVRjiHZ4I3ELDwd+YiFmsaryf b0TXElDElIdQlFfPdTUKuX5E/2XmKJ40bZVy3jFkJQ3jRI9MspNic0fdp6+9cEH3nFwE n+9g== X-Gm-Message-State: AAQBX9exGJ21wE9LFyImypXWhNkIqKpppRv+7NeW+t+jZsBVNb1+EweS 4/vF4q06LOsZ+T5iGjUVKWbUAzYRZrwsEcNBGhA= X-Google-Smtp-Source: AKy350b2wk0eAixgIQgLvmWawSUCyvt3DQf5sn09y8olDFh7GE1/OjoIxJal0B3a+G4fHcJYO+q/Sg== X-Received: by 2002:a7b:c4ca:0:b0:3ed:e5db:52e1 with SMTP id g10-20020a7bc4ca000000b003ede5db52e1mr5471510wmk.15.1680710721116; Wed, 05 Apr 2023 09:05:21 -0700 (PDT) Received: from localhost.localdomain (4ab54-h01-176-184-52-81.dsl.sta.abo.bbox.fr. [176.184.52.81]) by smtp.gmail.com with ESMTPSA id r15-20020a05600c458f00b003f03d483966sm2662576wmo.44.2023.04.05.09.05.19 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 05 Apr 2023 09:05:20 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-s390x@nongnu.org, qemu-riscv@nongnu.org, =?utf-8?q?Alex_Benn=C3=A9e?= , qemu-arm@nongnu.org, kvm@vger.kernel.org, qemu-ppc@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= , Peter Maydell Subject: [PATCH 04/10] hw/intc/arm_gic: Rename 'first_cpu' argument Date: Wed, 5 Apr 2023 18:04:48 +0200 Message-Id: <20230405160454.97436-5-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230405160454.97436-1-philmd@linaro.org> References: <20230405160454.97436-1-philmd@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org "hw/core/cpu.h" defines 'first_cpu' as QTAILQ_FIRST_RCU(&cpus). arm_gic_common_reset_irq_state() calls its second argument 'first_cpu', producing a build failure when "hw/core/cpu.h" is included: hw/intc/arm_gic_common.c:238:68: warning: omitting the parameter name in a function definition is a C2x extension [-Wc2x-extensions] static inline void arm_gic_common_reset_irq_state(GICState *s, int first_cpu, ^ include/hw/core/cpu.h:451:26: note: expanded from macro 'first_cpu' #define first_cpu QTAILQ_FIRST_RCU(&cpus) ^ KISS, rename the function argument. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée --- hw/intc/arm_gic_common.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hw/intc/arm_gic_common.c b/hw/intc/arm_gic_common.c index 9702197856..889327a8cf 100644 --- a/hw/intc/arm_gic_common.c +++ b/hw/intc/arm_gic_common.c @@ -235,12 +235,13 @@ static void arm_gic_common_realize(DeviceState *dev, Error **errp) } } -static inline void arm_gic_common_reset_irq_state(GICState *s, int first_cpu, +static inline void arm_gic_common_reset_irq_state(GICState *s, + int first_cpu_index, int resetprio) { int i, j; - for (i = first_cpu; i < first_cpu + s->num_cpu; i++) { + for (i = first_cpu_index; i < first_cpu_index + s->num_cpu; i++) { if (s->revision == REV_11MPCORE) { s->priority_mask[i] = 0xf0; } else { From patchwork Wed Apr 5 16:04:49 2023 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: 13202147 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 997F2C7619A for ; Wed, 5 Apr 2023 16:05:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238886AbjDEQFj (ORCPT ); Wed, 5 Apr 2023 12:05:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53518 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239084AbjDEQFc (ORCPT ); Wed, 5 Apr 2023 12:05:32 -0400 Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B76A86E9B for ; Wed, 5 Apr 2023 09:05:28 -0700 (PDT) Received: by mail-wm1-x32a.google.com with SMTP id j18-20020a05600c1c1200b003ee5157346cso24048518wms.1 for ; Wed, 05 Apr 2023 09:05:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1680710727; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=z2hst+C2Hubq09FNgBe92GHruUqjFSuaPIAbKjAIoI8=; b=hnCYq5Dzl/7iLI0rQYbkc9CUi17FFpKYPMxOnHcemCexKvxTdFYuaru2TQEImK5o9e jTn4K6Pp9zXxdmmJsMb8gD9S2GQ92Q72Ifh8L6RxwgBOR83AYlvxa/V/6Fh3hPXQBoiV z9gKOGSH8bAn5zRrapQGO1yAInmO8o8qVZTpVMRyYOG1CV9m59KTFXQeJKBj8sjGVuru vuCXHX5KYhKDn13HSZVsP5Lq2Qz50f1zC2IoyROHSYrzPF6xJDEsucHmTbgNlZ1jt64p EjINJfxYuBjgAhCrq5BfDf3e2GoiGGEqH9e7WYG8IshZ6uH7iubAr54kkd/PnEXO2Hgf kVGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680710727; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=z2hst+C2Hubq09FNgBe92GHruUqjFSuaPIAbKjAIoI8=; b=AOImJAYvUSOAHz+1dKqZTvqKo58JAfM0zQozUZEbkMPBjJXandpETpJ41F7bzp4TBB xFgkHbBrY7f7okp/kGuTGTQ80kNZic7nDdZjdBHK5JFCkseZRPGJtPkaQRm2SO6ir0n8 mnEK63jCDO6V7i0cO4BfPnsaDcwSnTlm/mLQ7I5qIDROEtQolLOVz29JbqjYKoXFsg9r Tias3PX/BE4Eqsy1jTuIN1b7Y1GNM3i7RJK5COYvm6L19qE/RVaWOls6Ryi9N5LJEqwj NSBE59Oi79rCH1wYDPA05HQZTxSVtPL4lIs54Li1aeUkRYdxinhbbyOag5eIZro7YdIH mBRA== X-Gm-Message-State: AAQBX9dWzFLC01U1w8wqYMioavqfdaHT2PRmyEF1qiBHJjnC7UmURE3e XwXHihbVyzL2205GbTOgMOdcgg== X-Google-Smtp-Source: AKy350ZJ+dZx4arE1dDvn+93xqmfAgQekaQ5sdLBd5m5/mFFyw1t5hipklNUBAa6v3f8yS67ujRRZg== X-Received: by 2002:a05:600c:253:b0:3eb:3f2d:f237 with SMTP id 19-20020a05600c025300b003eb3f2df237mr5280415wmj.6.1680710726924; Wed, 05 Apr 2023 09:05:26 -0700 (PDT) Received: from localhost.localdomain (4ab54-h01-176-184-52-81.dsl.sta.abo.bbox.fr. [176.184.52.81]) by smtp.gmail.com with ESMTPSA id y9-20020a1c4b09000000b003edf2dc7ca3sm2586415wma.34.2023.04.05.09.05.25 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 05 Apr 2023 09:05:26 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-s390x@nongnu.org, qemu-riscv@nongnu.org, =?utf-8?q?Alex_Benn=C3=A9e?= , qemu-arm@nongnu.org, kvm@vger.kernel.org, qemu-ppc@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= , Radoslaw Biernacki , Peter Maydell , Leif Lindholm Subject: [PATCH 05/10] hw/arm/sbsa-ref: Include missing 'sysemu/kvm.h' header Date: Wed, 5 Apr 2023 18:04:49 +0200 Message-Id: <20230405160454.97436-6-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230405160454.97436-1-philmd@linaro.org> References: <20230405160454.97436-1-philmd@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org "sysemu/kvm.h" is indirectly pulled in. Explicit its inclusion to avoid when refactoring include/: hw/arm/sbsa-ref.c:693:9: error: implicit declaration of function 'kvm_enabled' is invalid in C99 [-Werror,-Wimplicit-function-declaration] if (kvm_enabled()) { ^ Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Leif Lindholm Reviewed-by: Richard Henderson --- hw/arm/sbsa-ref.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/arm/sbsa-ref.c b/hw/arm/sbsa-ref.c index 0b93558dde..7df4d7b712 100644 --- a/hw/arm/sbsa-ref.c +++ b/hw/arm/sbsa-ref.c @@ -26,6 +26,7 @@ #include "sysemu/numa.h" #include "sysemu/runstate.h" #include "sysemu/sysemu.h" +#include "sysemu/kvm.h" #include "exec/hwaddr.h" #include "kvm_arm.h" #include "hw/arm/boot.h" From patchwork Wed Apr 5 16:04:50 2023 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: 13202148 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 05D55C761AF for ; Wed, 5 Apr 2023 16:05:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238892AbjDEQFm (ORCPT ); Wed, 5 Apr 2023 12:05:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53376 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238622AbjDEQFh (ORCPT ); Wed, 5 Apr 2023 12:05:37 -0400 Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4A2405FFC for ; Wed, 5 Apr 2023 09:05:34 -0700 (PDT) Received: by mail-wr1-x433.google.com with SMTP id e18so36717854wra.9 for ; Wed, 05 Apr 2023 09:05:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1680710733; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=TXAiv5gPJGzakn6yAF3UQ469jIKkZR4r/iuFrCC5frw=; b=MK0k+l7i0JL0N5tdLRQup0z/tS+z9fsal4eicREogGdlwNf9QVbabnZfiviIAYfHBf JA3Z4LTUT/MZ/596XiLixMfrIvzM7ysklzUO4TTvJDt47/2W4D9/CzYhb/QcW2qM2DGh lV8PnFchupvt62JB8kdIM3YEQBVwi8Y5uTliYYgPdnvE4XiaGrBARmupflOVkRocZ/k8 F0CNMkRh//wn/9/AGrldf70UiFQf2BIvuEBy7QwNDJ6vwKQhDdHoszOmXwaWZsR7hKME u0GX0l3gc0dvqJ6SgJT7MSeNx+4HHimdvMSdJ5XvGckOBpinv7ZG0pcUGyBpL8WdzMFG KJHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680710733; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=TXAiv5gPJGzakn6yAF3UQ469jIKkZR4r/iuFrCC5frw=; b=sNqEZwyo8xxkyalxG0QUr7nHkG6P/EcQnsr1PHUELVEft0xMFKiaim9S2yKR7klJMW 1tFZKCnX3ouo4iFWH0p2ED/8+6pGAgcyXqYXe8HscqMO4LZVUJZDZlAIv+0GzNkuKdXn YKjKcAopKrHwlorBGNd5vuW+sBrtHG4k1hj9ywqy/6IXCM7X76zO0SYdaOqCt3uILrlz t435Pu76gj34jIzVPAu6TpvaQ+pnGvWRfjuenfrvJByV55Qb/eyeiiMaTxQeHW2QRrJX LwlXdfthqFvM0o8+Qd+4dLrGCoLv67YJsLiEhTeezOu3J4T8sm9NLuE8GRZbbSyb9x4g 2Nbg== X-Gm-Message-State: AAQBX9fuVvsvIHI6V//MJ8a+vykV/cb4ZXr+8I6LR/HTLAsXzIkTwDMJ C/ve9NFkuGpcIDMg6+92DXiORg== X-Google-Smtp-Source: AKy350aJfFZROd28tOYQVpVfLU5O7PA/1sFGTeMRr0g366fxZBdFDsolmijBgmnNZ+HUOQGRU0ODxQ== X-Received: by 2002:a5d:52c7:0:b0:2ce:a9e9:4905 with SMTP id r7-20020a5d52c7000000b002cea9e94905mr4246512wrv.34.1680710732675; Wed, 05 Apr 2023 09:05:32 -0700 (PDT) Received: from localhost.localdomain (4ab54-h01-176-184-52-81.dsl.sta.abo.bbox.fr. [176.184.52.81]) by smtp.gmail.com with ESMTPSA id m19-20020a7bce13000000b003ee1acdb036sm2606127wmc.17.2023.04.05.09.05.31 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 05 Apr 2023 09:05:32 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-s390x@nongnu.org, qemu-riscv@nongnu.org, =?utf-8?q?Alex_Benn=C3=A9e?= , qemu-arm@nongnu.org, kvm@vger.kernel.org, qemu-ppc@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= , Peter Maydell Subject: [PATCH 06/10] target/arm: Reduce QMP header pressure by not including 'kvm_arm.h' Date: Wed, 5 Apr 2023 18:04:50 +0200 Message-Id: <20230405160454.97436-7-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230405160454.97436-1-philmd@linaro.org> References: <20230405160454.97436-1-philmd@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org We only need "sysemu/kvm.h" for kvm_enabled() and "cpu.h" for the QOM type definitions (TYPE_ARM_CPU). Avoid including the heavy "kvm_arm.h" header. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- target/arm/arm-qmp-cmds.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/target/arm/arm-qmp-cmds.c b/target/arm/arm-qmp-cmds.c index c8fa524002..91eb450565 100644 --- a/target/arm/arm-qmp-cmds.c +++ b/target/arm/arm-qmp-cmds.c @@ -22,7 +22,7 @@ #include "qemu/osdep.h" #include "hw/boards.h" -#include "kvm_arm.h" +#include "sysemu/kvm.h" #include "qapi/error.h" #include "qapi/visitor.h" #include "qapi/qobject-input-visitor.h" @@ -31,6 +31,7 @@ #include "qapi/qmp/qerror.h" #include "qapi/qmp/qdict.h" #include "qom/qom-qobject.h" +#include "target/arm/cpu.h" static GICCapability *gic_cap_new(int version) { From patchwork Wed Apr 5 16:04:51 2023 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: 13202149 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8C495C7619A for ; Wed, 5 Apr 2023 16:05:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238957AbjDEQFv (ORCPT ); Wed, 5 Apr 2023 12:05:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54538 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238931AbjDEQFp (ORCPT ); Wed, 5 Apr 2023 12:05:45 -0400 Received: from mail-wr1-x431.google.com (mail-wr1-x431.google.com [IPv6:2a00:1450:4864:20::431]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B3D236582 for ; Wed, 5 Apr 2023 09:05:39 -0700 (PDT) Received: by mail-wr1-x431.google.com with SMTP id i9so36737303wrp.3 for ; Wed, 05 Apr 2023 09:05:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1680710738; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=qSZpkYKC0E9O8rqY27roK0ybv9W9NQfMeuFKqLZI7LU=; b=wqNCwi876yROugf5tN+kiLbImBLgk+uYIjohRocygCiSXtq0GiLxJMZsXSek6pHpVR +vfvjXSlWK4qWKr94gcOADBrEVPqgm5CfvJ9deGOWUrdCVM9PHovYkwZHujef3O8MtOZ eXzc0P4Y5NXAVWdLu6uqolhV733Ybgg5UBVQpSLnRk/q1N+A6GEHjHvVwc3QqBqwAdiy BNPfLSrZgGarjn1j7MUV3SoT0FiNvFRNxXYmemHmO/109VPWZrGM4pBbcOVF8ud8YiU5 ASlPsQUvC0UDNDeGKeDi0tm00GS1Eunn4AndcQhBbXGrCKw7wvhL9RVtanHs8lJbVSrB h7iA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680710738; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=qSZpkYKC0E9O8rqY27roK0ybv9W9NQfMeuFKqLZI7LU=; b=Pq6mAkWBHeVO5bbP8i6graVpoz233dQrowkK8Mniini38q7Ehe5xcC8FwwO6FJ8Fy1 wDnkUsAe3huEk1FgmWkcuq241dpDXTcXPJr8J8lRq1HmXBlUihh0/Xe0FpOsmhY+5Zi7 DdZ6TW6ZdaLZJA3f9AzZGKII+wmBvEGsFvwqjlGC256snA7N0KKUqeQOsWdNnmwdBb4g OM01wYWZB2pB9Gmu8OUHiNeFyEq75iiiJAg+eKOR+worwqnE6Vvp/a9XTUoewAi/IyG4 CBMRunMuwpdr7fp2Fo1NjwXAadVSdXdGr7HDPr/ayteqwEkuYJGOBa5Z0VdZb9YIXP+S yWOg== X-Gm-Message-State: AAQBX9cRMRVretekQ0LJl+5vL1HJk/5KWbpQ9bNcTOl1aZXgJiNKbqaK oT8XiNqyR0pKAC8IA5JpTA2yzw== X-Google-Smtp-Source: AKy350aZffoChxbCPg7M2fAcOye2AlE3AkD3kI7o7RFqx/SUBuZegFtLbCZIhwjdYIeXSthO8Irkcg== X-Received: by 2002:adf:eace:0:b0:2ce:a098:c6b8 with SMTP id o14-20020adfeace000000b002cea098c6b8mr5030406wrn.55.1680710738191; Wed, 05 Apr 2023 09:05:38 -0700 (PDT) Received: from localhost.localdomain (4ab54-h01-176-184-52-81.dsl.sta.abo.bbox.fr. [176.184.52.81]) by smtp.gmail.com with ESMTPSA id q18-20020adffed2000000b002c70851fdd8sm15263762wrs.75.2023.04.05.09.05.37 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 05 Apr 2023 09:05:37 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-s390x@nongnu.org, qemu-riscv@nongnu.org, =?utf-8?q?Alex_Benn=C3=A9e?= , qemu-arm@nongnu.org, kvm@vger.kernel.org, qemu-ppc@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= , Peter Maydell Subject: [PATCH 07/10] target/arm: Restrict KVM-specific fields from ArchCPU Date: Wed, 5 Apr 2023 18:04:51 +0200 Message-Id: <20230405160454.97436-8-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230405160454.97436-1-philmd@linaro.org> References: <20230405160454.97436-1-philmd@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org These fields shouldn't be accessed when KVM is not available. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- target/arm/cpu.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/target/arm/cpu.h b/target/arm/cpu.h index c097cae988..efd1b010d5 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -945,6 +945,7 @@ struct ArchCPU { */ uint32_t kvm_target; +#ifdef CONFIG_KVM /* KVM init features for this CPU */ uint32_t kvm_init_features[7]; @@ -957,6 +958,7 @@ struct ArchCPU { /* KVM steal time */ OnOffAuto kvm_steal_time; +#endif /* CONFIG_KVM */ /* Uniprocessor system with MP extensions */ bool mp_is_up; From patchwork Wed Apr 5 16:04:52 2023 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: 13202150 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A7E0DC76188 for ; Wed, 5 Apr 2023 16:05:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238021AbjDEQFz (ORCPT ); Wed, 5 Apr 2023 12:05:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55938 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239059AbjDEQFu (ORCPT ); Wed, 5 Apr 2023 12:05:50 -0400 Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7F35F61A9 for ; Wed, 5 Apr 2023 09:05:45 -0700 (PDT) Received: by mail-wm1-x334.google.com with SMTP id n19so21204566wms.0 for ; Wed, 05 Apr 2023 09:05:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1680710744; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=1nroHqABUajLqRunlI+qD37HAN4v8HXiRYQrqBTvdwE=; b=qw5qTTc4CNQPm1h/LZ0mTTXy0OF7gIZq7jkcglSCTingvHz0cqXrBwBojetrVCnaEU V3XSlu7iPDyJb/v2VW6Mfo7ZEcibrTott+zYeXs/SZP1HCHBMI39vaj3sfGTFwJQbfZo bPbd459qPJhpcD9HW2tSPRWW6uWhsivNaPaKQ8L/mgDLhLP0gasJOaP/HIEJmenRuRRk umwaalz/6EAfiwgdglIA20tavSVgQWBEjmI01ISEOl/XiJZYm6MLszMBTX98bQRndoHx htVpU34jeAGTXaELsldCnNYgFUNan9n4kpcE+bf1j5dhHWTQfNnLz94EFHsmMlTBB75M MoXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680710744; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=1nroHqABUajLqRunlI+qD37HAN4v8HXiRYQrqBTvdwE=; b=vuRRPaVT5JuYDYo7Kz2qxTtqV3+drfKKRji4vVyRyrn1rG0TiLCwhoc4zH0BSD002o TPtmaeUgBwe2d0kmYKj/Bnf73PBs2uWV9kVsICadeQ2pzw+oD1TUgoePSjSYo77HpstJ bDB3MJrz4v+DiCCR7lrVPDmEf4Az3WiJvVuHsL5FoUg3q/Hv3XoDbuhWa2GtFxttyp9w ZI82OXSAC1/nQxB8b3p6CHpfwFViHb/EIg2+mvPwKaO3DtDAzG4swHTciD0D4vQZFO3w O7CRTfvg7TO2W5DmPNzvvtyo99eRuQT+Kp0ywS/aNVq7pYYVlNMcSqqLfC6oJ/kTeedB mIvA== X-Gm-Message-State: AAQBX9ciW6jmQJMV7lmAlH2q/TGP1e/VqB55NXn+SgHAKytk7Yye+AVz 2XbKiJSpiMf1ncx4cmOJI9axPg== X-Google-Smtp-Source: AKy350avtCPFICutt8vrOag6ZCtLMApHyjgYl5gdC/mIgFAzkBuA1jps8xP9/D8yQimuv1rVe3m43w== X-Received: by 2002:a05:600c:20f:b0:3da:2ba4:b97 with SMTP id 15-20020a05600c020f00b003da2ba40b97mr2228281wmi.19.1680710743845; Wed, 05 Apr 2023 09:05:43 -0700 (PDT) Received: from localhost.localdomain (4ab54-h01-176-184-52-81.dsl.sta.abo.bbox.fr. [176.184.52.81]) by smtp.gmail.com with ESMTPSA id o11-20020a05600c4fcb00b003ebff290a52sm2565572wmq.28.2023.04.05.09.05.42 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 05 Apr 2023 09:05:43 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-s390x@nongnu.org, qemu-riscv@nongnu.org, =?utf-8?q?Alex_Benn=C3=A9e?= , qemu-arm@nongnu.org, kvm@vger.kernel.org, qemu-ppc@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= , Daniel Henrique Barboza , =?utf-8?q?C=C3=A9dric_Le_G?= =?utf-8?q?oater?= , David Gibson , Greg Kurz Subject: [PATCH 08/10] target/ppc: Restrict KVM-specific field from ArchCPU Date: Wed, 5 Apr 2023 18:04:52 +0200 Message-Id: <20230405160454.97436-9-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230405160454.97436-1-philmd@linaro.org> References: <20230405160454.97436-1-philmd@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org The 'kvm_sw_tlb' field shouldn't be accessed when KVM is not available. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Daniel Henrique Barboza --- target/ppc/cpu.h | 2 ++ target/ppc/mmu_common.c | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h index 557d736dab..0ec3957397 100644 --- a/target/ppc/cpu.h +++ b/target/ppc/cpu.h @@ -1148,7 +1148,9 @@ struct CPUArchState { int tlb_type; /* Type of TLB we're dealing with */ ppc_tlb_t tlb; /* TLB is optional. Allocate them only if needed */ bool tlb_dirty; /* Set to non-zero when modifying TLB */ +#ifdef CONFIG_KVM bool kvm_sw_tlb; /* non-zero if KVM SW TLB API is active */ +#endif /* CONFIG_KVM */ uint32_t tlb_need_flush; /* Delayed flush needed */ #define TLB_NEED_LOCAL_FLUSH 0x1 #define TLB_NEED_GLOBAL_FLUSH 0x2 diff --git a/target/ppc/mmu_common.c b/target/ppc/mmu_common.c index 7235a4befe..21843c69f6 100644 --- a/target/ppc/mmu_common.c +++ b/target/ppc/mmu_common.c @@ -917,10 +917,12 @@ static void mmubooke_dump_mmu(CPUPPCState *env) ppcemb_tlb_t *entry; int i; +#ifdef CONFIG_KVM if (kvm_enabled() && !env->kvm_sw_tlb) { qemu_printf("Cannot access KVM TLB\n"); return; } +#endif qemu_printf("\nTLB:\n"); qemu_printf("Effective Physical Size PID Prot " @@ -1008,10 +1010,12 @@ static void mmubooke206_dump_mmu(CPUPPCState *env) int offset = 0; int i; +#ifdef CONFIG_KVM if (kvm_enabled() && !env->kvm_sw_tlb) { qemu_printf("Cannot access KVM TLB\n"); return; } +#endif for (i = 0; i < BOOKE206_MAX_TLBN; i++) { int size = booke206_tlb_size(env, i); From patchwork Wed Apr 5 16:04:53 2023 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: 13202151 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E91BDC76188 for ; Wed, 5 Apr 2023 16:06:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238906AbjDEQGF (ORCPT ); Wed, 5 Apr 2023 12:06:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56426 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237745AbjDEQF6 (ORCPT ); Wed, 5 Apr 2023 12:05:58 -0400 Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com [IPv6:2a00:1450:4864:20::32e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6C0775278 for ; Wed, 5 Apr 2023 09:05:51 -0700 (PDT) Received: by mail-wm1-x32e.google.com with SMTP id n9-20020a05600c4f8900b003f05f617f3cso3151266wmq.2 for ; Wed, 05 Apr 2023 09:05:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1680710749; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=v6WERmjWn5FvlAk9wBZ9HpDjQNTvh7yNAmb4fbxF/bQ=; b=ui9pQqlkMvaDWCZp6I6ifckgckCFMdULH8djIjHBtGiKqLjSUyanx69f6iIYVMfxSY PDG366DUK3lbyUBNP2TISRXho9Y39mi+0yOtKEssWyJs8AW+r0iZXdfVcgRVJmp8SyvR jPWJ8qjkwLGf7F7Iy7M1OZPrcf0uWtn65EXI26LFqGpDfTiuMP6i+YQtxah+yEf+3N2I NfyrUvV8ItcveuyyyrfgYuOGCWAsChzWI0Cy5GdHPeHvnwaJTnTNUDpZ7tRMAHPsQguV 7ankTk82Gs8dVyGeY4jCBSGFQ/hPIEZB2U94cG+S76nY5p/JXNSjjluwvo8eICuJ2rnX GNLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680710749; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=v6WERmjWn5FvlAk9wBZ9HpDjQNTvh7yNAmb4fbxF/bQ=; b=4r7U5QhDVnQSHyfhJCqmfZSTftZbUBronRLVekMLVn80rd3sttPFT73ai5BZLaCCYz 3gQs+SXMmBOnELdMN2pDgY6f0I3SdJcR9J0t2QLXGivi3k541JNObTWwYGJC5zeWD/FI BpforYkbNRYdjEWCmajTlJ0dw/p2emYGvHNbJGaDYm7kq8CV0Df/kGVneZdkJ92WEGRt LyPPT6ztr3J0063gZxjsBhGPZUxNFfCK1Ykc8S31etViVMMoOPbPh/g0I8O6qEeePDNr uDEJzhgpi1kJpCVKSRYe2NY4gxz3mYFTqxAh1RnGKEYxUltR5tnrHKce8dT77ooJnjI8 E+xw== X-Gm-Message-State: AAQBX9dP+TXDp/vyjp0w9QfI+hokulSJDaiTg5HDf0eM69s3p1i233J8 v6R6yPOCdSmRs5XXZdzHAL47SQ== X-Google-Smtp-Source: AKy350anKvfZnCI3q7zDlxj99iOPWMUyn9/cm32XZyeYL/HMzbFHfQJWndVFdMqz9Z6VrABSDFBDsQ== X-Received: by 2002:a05:600c:ace:b0:3ed:ea48:cd92 with SMTP id c14-20020a05600c0ace00b003edea48cd92mr5367145wmr.15.1680710749843; Wed, 05 Apr 2023 09:05:49 -0700 (PDT) Received: from localhost.localdomain (4ab54-h01-176-184-52-81.dsl.sta.abo.bbox.fr. [176.184.52.81]) by smtp.gmail.com with ESMTPSA id p26-20020a1c545a000000b003edf2ae2432sm2600498wmi.7.2023.04.05.09.05.48 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 05 Apr 2023 09:05:49 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-s390x@nongnu.org, qemu-riscv@nongnu.org, =?utf-8?q?Alex_Benn=C3=A9e?= , qemu-arm@nongnu.org, kvm@vger.kernel.org, qemu-ppc@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= , Palmer Dabbelt , Alistair Francis , Bin Meng , Weiwei Li , Daniel Henrique Barboza , Liu Zhiwei Subject: [RFC PATCH 09/10] target/riscv: Restrict KVM-specific fields from ArchCPU Date: Wed, 5 Apr 2023 18:04:53 +0200 Message-Id: <20230405160454.97436-10-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230405160454.97436-1-philmd@linaro.org> References: <20230405160454.97436-1-philmd@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org These fields shouldn't be accessed when KVM is not available. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Daniel Henrique Barboza --- RFC: The migration part is likely invalid... kvmtimer_needed() is defined in target/riscv/machine.c as static bool kvmtimer_needed(void *opaque) { return kvm_enabled(); } which depends on a host feature. --- target/riscv/cpu.h | 2 ++ target/riscv/machine.c | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/target/riscv/cpu.h b/target/riscv/cpu.h index 638e47c75a..82939235ab 100644 --- a/target/riscv/cpu.h +++ b/target/riscv/cpu.h @@ -377,12 +377,14 @@ struct CPUArchState { hwaddr kernel_addr; hwaddr fdt_addr; +#ifdef CONFIG_KVM /* kvm timer */ bool kvm_timer_dirty; uint64_t kvm_timer_time; uint64_t kvm_timer_compare; uint64_t kvm_timer_state; uint64_t kvm_timer_frequency; +#endif /* CONFIG_KVM */ }; OBJECT_DECLARE_CPU_TYPE(RISCVCPU, RISCVCPUClass, RISCV_CPU) diff --git a/target/riscv/machine.c b/target/riscv/machine.c index 9c455931d8..e45d564ec3 100644 --- a/target/riscv/machine.c +++ b/target/riscv/machine.c @@ -201,10 +201,12 @@ static bool kvmtimer_needed(void *opaque) static int cpu_post_load(void *opaque, int version_id) { +#ifdef CONFIG_KVM RISCVCPU *cpu = opaque; CPURISCVState *env = &cpu->env; env->kvm_timer_dirty = true; +#endif return 0; } @@ -215,9 +217,11 @@ static const VMStateDescription vmstate_kvmtimer = { .needed = kvmtimer_needed, .post_load = cpu_post_load, .fields = (VMStateField[]) { +#ifdef CONFIG_KVM VMSTATE_UINT64(env.kvm_timer_time, RISCVCPU), VMSTATE_UINT64(env.kvm_timer_compare, RISCVCPU), VMSTATE_UINT64(env.kvm_timer_state, RISCVCPU), +#endif VMSTATE_END_OF_LIST() } }; From patchwork Wed Apr 5 16:04:54 2023 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: 13202152 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EA4E2C761AF for ; Wed, 5 Apr 2023 16:06:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238931AbjDEQGH (ORCPT ); Wed, 5 Apr 2023 12:06:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53518 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238580AbjDEQGC (ORCPT ); Wed, 5 Apr 2023 12:06:02 -0400 Received: from mail-wr1-x431.google.com (mail-wr1-x431.google.com [IPv6:2a00:1450:4864:20::431]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 227465FCF for ; Wed, 5 Apr 2023 09:05:56 -0700 (PDT) Received: by mail-wr1-x431.google.com with SMTP id i9so36738238wrp.3 for ; Wed, 05 Apr 2023 09:05:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1680710755; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=YCSdJqBx+24lo5un4mJkeawVRhwXkPODtT/ypBXdn1k=; b=nYNsq+8yFO7mMRk2/GCs4D4e2iDu1F5AjhPlSj5MwnASO0hw5U/4oxpVLogb6drfmz 3xU+KV29anaINmgzTl9ZhOc9H9utB1dE343KJ/Ch3nsDN2awoc2m/uGIUTaVMxmzxSgG xqRD/xBZxEreYRjFvoqcqzu5XK6hiX/J8pDK3O5eVEHmU9QCzAK4BaAmplmm9aESOaiO ae6Uv7SF5z/IgEENdF+M+eAcH47+wYVpnVgBJUOx9FPSM7Zy1/YL3ZUrvW8BmVJCLBZH ZI65eOSaRJWzT4iXngpJ6wyoT9UFNgKF6YSG3WUY8ns0z8i9D9egnrZvA5oKcJER0raT J/qQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680710755; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=YCSdJqBx+24lo5un4mJkeawVRhwXkPODtT/ypBXdn1k=; b=yNOXmHLpYJ4FOXjwM2GDtebCAb0ISAt5M+ebsWM6DUTvhVgRAJDCLEwOqW+IQwRjpg nh3/+LNm2PvAmqseV//VXr09UxVGHNMzhTIINOxrNb3Mkwx0ljwUqgL5VHIaWoj5EzBa K6CoINMiEacnMiAOnG3HrbRCL7DJIu1hBEdDrcXuXGvflS+N1sbyYzUdhuhxV8j6lEsu zitQ/CB7ee2RbpvTOgDaowHEhhruMNQNwTTibX0o3y9heHeNiQ3X0ZWIMtUgQLlAMWWv FW7yY+nFjmRkVyS59FvhKcGajOs1JpQWjbUcBSn6fBLxA/hhZqSPL7nSaC/nw23z7bZA 4AnQ== X-Gm-Message-State: AAQBX9fSsPk67cEH+Nck+jdlgbAVBDQH/x/yPY2Lqxca+8qtLQSSrQ0K YqJ6tO5kmghppERmIfWnX1i64A== X-Google-Smtp-Source: AKy350YkYdiHXB0g5ih7Cr+SgsA3BhgsWi6U992BWoRDvOtWKxTNhNkKh0iJQeFeR5+OUd9Zhgsf8g== X-Received: by 2002:a5d:4745:0:b0:2ce:a835:83d4 with SMTP id o5-20020a5d4745000000b002cea83583d4mr2147619wrs.27.1680710755745; Wed, 05 Apr 2023 09:05:55 -0700 (PDT) Received: from localhost.localdomain (4ab54-h01-176-184-52-81.dsl.sta.abo.bbox.fr. [176.184.52.81]) by smtp.gmail.com with ESMTPSA id a12-20020a056000100c00b002cea8664304sm15199709wrx.91.2023.04.05.09.05.54 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 05 Apr 2023 09:05:55 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-s390x@nongnu.org, qemu-riscv@nongnu.org, =?utf-8?q?Alex_Benn=C3=A9e?= , qemu-arm@nongnu.org, kvm@vger.kernel.org, qemu-ppc@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= , Halil Pasic , Christian Borntraeger , Eric Farman , Richard Henderson , David Hildenbrand , Ilya Leoshkevich , Thomas Huth Subject: [PATCH 10/10] hw/s390x: Rename pv.c -> pv-kvm.c Date: Wed, 5 Apr 2023 18:04:54 +0200 Message-Id: <20230405160454.97436-11-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230405160454.97436-1-philmd@linaro.org> References: <20230405160454.97436-1-philmd@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Protected Virtualization is specific to KVM. Rename the file as 'pv-kvm.c' to make this clearer. Signed-off-by: Philippe Mathieu-Daudé --- hw/s390x/{pv.c => pv-kvm.c} | 0 hw/s390x/meson.build | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename hw/s390x/{pv.c => pv-kvm.c} (100%) diff --git a/hw/s390x/pv.c b/hw/s390x/pv-kvm.c similarity index 100% rename from hw/s390x/pv.c rename to hw/s390x/pv-kvm.c diff --git a/hw/s390x/meson.build b/hw/s390x/meson.build index f291016fee..2f43b6c473 100644 --- a/hw/s390x/meson.build +++ b/hw/s390x/meson.build @@ -22,7 +22,7 @@ s390x_ss.add(when: 'CONFIG_KVM', if_true: files( 'tod-kvm.c', 's390-skeys-kvm.c', 's390-stattrib-kvm.c', - 'pv.c', + 'pv-kvm.c', 's390-pci-kvm.c', )) s390x_ss.add(when: 'CONFIG_TCG', if_true: files(