From nobody Tue Nov 5 08:26:30 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 ARC-Seal: i=1; a=rsa-sha256; t=1690446109; cv=none; d=zohomail.com; s=zohoarc; b=QZ1gE49l27UeE0K+IoxqexWXa2Krwi4LzAJ0FWI+k1aJCjoVrwffQAw2e5ZxIL9rEkye84O6PFc+8Bkg9VXUhOnZ2DoycPFqCq+hmr+w+NZg7bysPOYKKRU7kHKxZkcD6GHN6ApBreFUdO1kJNHOJCY3TaqTshy+/FALY0FFyrA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1690446109; h=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; bh=kND/sAP1+EQqRnqZy1RjucLWpLyH8kHXjE52zNB0+ZU=; b=jlfp7Yq0v9C/AQhfqsuNlMGlQ91w6PV5hd4PEVKBDZuOIJE6AQLcNhLyg+mCAtukggyjNabrV4DonKqAPj4pd4W2C1Ap0iloAJXWCP+PGzsdKJpk68WJKa7oXhTDRtXrEbEoxhdIKpKD1DBwUzOnGWZQqjTuB1idfyQuNVOuY04= 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1690446109452531.6775609657403; Thu, 27 Jul 2023 01:21:49 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qOvTX-0005DL-6o; Thu, 27 Jul 2023 03:31:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qOvTV-0005CK-G1 for qemu-devel@nongnu.org; Thu, 27 Jul 2023 03:31:53 -0400 Received: from mail-pf1-x431.google.com ([2607:f8b0:4864:20::431]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qOvTQ-0003TP-W3 for qemu-devel@nongnu.org; Thu, 27 Jul 2023 03:31:50 -0400 Received: by mail-pf1-x431.google.com with SMTP id d2e1a72fcca58-686bc261111so524153b3a.3 for ; Thu, 27 Jul 2023 00:31:47 -0700 (PDT) Received: from alarm.flets-east.jp ([2400:4050:a840:1e00:78d2:b862:10a7:d486]) by smtp.gmail.com with ESMTPSA id d9-20020aa78689000000b0064fa2fdfa9esm802002pfo.81.2023.07.27.00.31.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jul 2023 00:31:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20221208.gappssmtp.com; s=20221208; t=1690443107; x=1691047907; 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=kND/sAP1+EQqRnqZy1RjucLWpLyH8kHXjE52zNB0+ZU=; b=1rmxoN6pK/bfF17VHISxfbhZSMK3pcw2ESQLTR6SKZxQJeCcFKU7EZnyx2Aw2KbKP6 nYtmSRCfskf6ZkQUEZWNxnMnhtwHLmTfMl3jVNa+5CvTStMxqyNqJw8xBKxvl7ipEfEj 91ClpsOXSJ6Mep0byoC/Tg0UIV/qjelJX5yAuB/YoUrY2d9jL4urO05nbQjLafwbC/df EKy4TkWx7H0VbxpCUP8yLx7u2kV2zugjsVed1gpemPdFvj2pJBuNJ1SXPTirOhqrHQ1t gzAjpFRa3H7MOYig5FHDbfDvpGnXrZPzGeSPziIqTWNcb4rex86hjLA7C9O6VvstLl5a xkAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690443107; x=1691047907; 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=kND/sAP1+EQqRnqZy1RjucLWpLyH8kHXjE52zNB0+ZU=; b=DHd8gn98gvUHcfoWEog2x3/C2TZgZ2zP7VCOVsdHYGORH29uxHmCay+XEum1JeuZcQ Ah6xXx9MAi6wNH2WFziTIozXUhLZE7+UQ3oZgF0f9JrOFVKcDnq9EzPpG87R2BkZKxLc zx/mp7Fhrnew9dFpD9RoAKEcdezCzD4LmLg7sHC1artdAaerOGY3i/BNprPV+4mS+MHw poLBkNO4yq5FsBPsIYihGdvt6Pzb5+6R7EgyMQCt4G01JzSusRyeddI1ht/nlOElttC+ AyoIYS6vKwONfuwPJIQTiSljiiFxajsL9thTCurIrVBJ5A2Ht4P8bTS/Tux+EYlsBqMr KfqA== X-Gm-Message-State: ABy/qLZix/ez16UbCbuxy0TtnFjyl/oezFwlxmy5ynPkJs8NhvZ7XOlU 1DjgByI+JoVAOR0Z5lLPILOzinGqjIT3KuM+TK0= X-Google-Smtp-Source: APBJJlGf5/qwEcqQb+YRRIWpgIri8gmY8P66GnOe7AzCnZb6PsAufb6ciQzjEsoLcRtkUCKnkNb3qA== X-Received: by 2002:a05:6a20:2447:b0:13a:ccb9:d5b7 with SMTP id t7-20020a056a20244700b0013accb9d5b7mr4456373pzc.41.1690443106741; Thu, 27 Jul 2023 00:31:46 -0700 (PDT) From: Akihiko Odaki To: Cc: qemu-devel@nongnu.org, qemu-arm@nongnu.org, kvm@vger.kernel.org, Paolo Bonzini , Peter Maydell , Richard Henderson , Akihiko Odaki Subject: [PATCH v5 1/6] kvm: Introduce kvm_arch_get_default_type hook Date: Thu, 27 Jul 2023 16:31:26 +0900 Message-ID: <20230727073134.134102-2-akihiko.odaki@daynix.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230727073134.134102-1-akihiko.odaki@daynix.com> References: <20230727073134.134102-1-akihiko.odaki@daynix.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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: none client-ip=2607:f8b0:4864:20::431; envelope-from=akihiko.odaki@daynix.com; helo=mail-pf1-x431.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @daynix-com.20221208.gappssmtp.com) X-ZM-MESSAGEID: 1690446110585100003 Content-Type: text/plain; charset="utf-8" kvm_arch_get_default_type() returns the default KVM type. This hook is particularly useful to derive a KVM type that is valid for "none" machine model, which is used by libvirt to probe the availability of KVM. For MIPS, the existing mips_kvm_type() is reused. This function ensures the availability of VZ which is mandatory to use KVM on the current QEMU. Signed-off-by: Akihiko Odaki Reviewed-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- include/sysemu/kvm.h | 2 ++ target/mips/kvm_mips.h | 9 --------- accel/kvm/kvm-all.c | 4 +++- hw/mips/loongson3_virt.c | 2 -- target/arm/kvm.c | 5 +++++ target/i386/kvm/kvm.c | 5 +++++ target/mips/kvm.c | 2 +- target/ppc/kvm.c | 5 +++++ target/riscv/kvm.c | 5 +++++ target/s390x/kvm/kvm.c | 5 +++++ 10 files changed, 31 insertions(+), 13 deletions(-) diff --git a/include/sysemu/kvm.h b/include/sysemu/kvm.h index 115f0cca79..ccaf55caf7 100644 --- a/include/sysemu/kvm.h +++ b/include/sysemu/kvm.h @@ -369,6 +369,8 @@ int kvm_arch_get_registers(CPUState *cpu); =20 int kvm_arch_put_registers(CPUState *cpu, int level); =20 +int kvm_arch_get_default_type(MachineState *ms); + int kvm_arch_init(MachineState *ms, KVMState *s); =20 int kvm_arch_init_vcpu(CPUState *cpu); diff --git a/target/mips/kvm_mips.h b/target/mips/kvm_mips.h index 171d53dbe1..c711269d0a 100644 --- a/target/mips/kvm_mips.h +++ b/target/mips/kvm_mips.h @@ -25,13 +25,4 @@ void kvm_mips_reset_vcpu(MIPSCPU *cpu); int kvm_mips_set_interrupt(MIPSCPU *cpu, int irq, int level); int kvm_mips_set_ipi_interrupt(MIPSCPU *cpu, int irq, int level); =20 -#ifdef CONFIG_KVM -int mips_kvm_type(MachineState *machine, const char *vm_type); -#else -static inline int mips_kvm_type(MachineState *machine, const char *vm_type) -{ - return 0; -} -#endif - #endif /* KVM_MIPS_H */ diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c index 373d876c05..d591b5079c 100644 --- a/accel/kvm/kvm-all.c +++ b/accel/kvm/kvm-all.c @@ -2458,7 +2458,7 @@ static int kvm_init(MachineState *ms) KVMState *s; const KVMCapabilityInfo *missing_cap; int ret; - int type =3D 0; + int type; uint64_t dirty_log_manual_caps; =20 qemu_mutex_init(&kml_slots_lock); @@ -2523,6 +2523,8 @@ static int kvm_init(MachineState *ms) type =3D mc->kvm_type(ms, kvm_type); } else if (mc->kvm_type) { type =3D mc->kvm_type(ms, NULL); + } else { + type =3D kvm_arch_get_default_type(ms); } =20 do { diff --git a/hw/mips/loongson3_virt.c b/hw/mips/loongson3_virt.c index 4018b8c1d3..a2c56f7a21 100644 --- a/hw/mips/loongson3_virt.c +++ b/hw/mips/loongson3_virt.c @@ -29,7 +29,6 @@ #include "qemu/datadir.h" #include "qapi/error.h" #include "elf.h" -#include "kvm_mips.h" #include "hw/char/serial.h" #include "hw/intc/loongson_liointc.h" #include "hw/mips/mips.h" @@ -612,7 +611,6 @@ static void loongson3v_machine_class_init(ObjectClass *= oc, void *data) mc->max_cpus =3D LOONGSON_MAX_VCPUS; mc->default_ram_id =3D "loongson3.highram"; mc->default_ram_size =3D 1600 * MiB; - mc->kvm_type =3D mips_kvm_type; mc->minimum_page_bits =3D 14; mc->default_nic =3D "virtio-net-pci"; } diff --git a/target/arm/kvm.c b/target/arm/kvm.c index b4c7654f49..40f577bfd5 100644 --- a/target/arm/kvm.c +++ b/target/arm/kvm.c @@ -247,6 +247,11 @@ int kvm_arm_get_max_vm_ipa_size(MachineState *ms, bool= *fixed_ipa) return ret > 0 ? ret : 40; } =20 +int kvm_arch_get_default_type(MachineState *ms) +{ + return 0; +} + int kvm_arch_init(MachineState *ms, KVMState *s) { int ret =3D 0; diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c index ebfaf3d24c..b45ce20fd8 100644 --- a/target/i386/kvm/kvm.c +++ b/target/i386/kvm/kvm.c @@ -2556,6 +2556,11 @@ static void register_smram_listener(Notifier *n, voi= d *unused) &smram_address_space, 1, "kvm-smram"); } =20 +int kvm_arch_get_default_type(MachineState *ms) +{ + return 0; +} + int kvm_arch_init(MachineState *ms, KVMState *s) { uint64_t identity_base =3D 0xfffbc000; diff --git a/target/mips/kvm.c b/target/mips/kvm.c index c14e8f550f..e98aad01bd 100644 --- a/target/mips/kvm.c +++ b/target/mips/kvm.c @@ -1266,7 +1266,7 @@ int kvm_arch_msi_data_to_gsi(uint32_t data) abort(); } =20 -int mips_kvm_type(MachineState *machine, const char *vm_type) +int kvm_arch_get_default_type(MachineState *machine) { #if defined(KVM_CAP_MIPS_VZ) int r; diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c index a8a935e267..dc1182cd37 100644 --- a/target/ppc/kvm.c +++ b/target/ppc/kvm.c @@ -108,6 +108,11 @@ static int kvm_ppc_register_host_cpu_type(void); static void kvmppc_get_cpu_characteristics(KVMState *s); static int kvmppc_get_dec_bits(void); =20 +int kvm_arch_get_default_type(MachineState *ms) +{ + return 0; +} + int kvm_arch_init(MachineState *ms, KVMState *s) { cap_interrupt_unset =3D kvm_check_extension(s, KVM_CAP_PPC_UNSET_IRQ); diff --git a/target/riscv/kvm.c b/target/riscv/kvm.c index 9d8a8982f9..4266dce092 100644 --- a/target/riscv/kvm.c +++ b/target/riscv/kvm.c @@ -907,6 +907,11 @@ int kvm_arch_add_msi_route_post(struct kvm_irq_routing= _entry *route, return 0; } =20 +int kvm_arch_get_default_type(MachineState *ms) +{ + return 0; +} + int kvm_arch_init(MachineState *ms, KVMState *s) { return 0; diff --git a/target/s390x/kvm/kvm.c b/target/s390x/kvm/kvm.c index a9e5880349..9117fab6e8 100644 --- a/target/s390x/kvm/kvm.c +++ b/target/s390x/kvm/kvm.c @@ -340,6 +340,11 @@ static void ccw_machine_class_foreach(ObjectClass *oc,= void *opaque) mc->default_cpu_type =3D S390_CPU_TYPE_NAME("host"); } =20 +int kvm_arch_get_default_type(MachineState *ms) +{ + return 0; +} + int kvm_arch_init(MachineState *ms, KVMState *s) { object_class_foreach(ccw_machine_class_foreach, TYPE_S390_CCW_MACHINE, --=20 2.41.0 From nobody Tue Nov 5 08:26:30 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 ARC-Seal: i=1; a=rsa-sha256; t=1690447272; cv=none; d=zohomail.com; s=zohoarc; b=E3bPj96zYYrSRwiI+6a6Lg3QTZi/Kn1lWL2ynNkG9fGynfkOEpYEBF19e9mJF9wFfi4OCxxAi7oernY+EXadzHNpwSTkRYisq5q1UMXbuLfR/xUG7Uc7ncJ0PiBEpEahGSzcYWuAUzeOZuAB/ZKZNDP5NfqEaSoHdFfhQjElUCs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1690447272; h=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; bh=aiO61RFWQc576A2x8jBmto7Eq50nA+0j/FFgWXdA55I=; b=YiDSLVVvmmaYEcSmMNS9k2Lbn31KGk1SMb6yk1KfYbwhOqYCd67S+mcErq+hCv6sjfLPjcEp861mG00KsNn9K4NazzgU4xLU2EuqvtedPqCx7ipJawR0FE5wT76ocXjGZLsENFXrZYvp24agWdOb68bqOmo+08EArz/dlhMNT1E= 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1690447272415986.3638242977156; Thu, 27 Jul 2023 01:41:12 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qOvTY-0005E9-Fj; Thu, 27 Jul 2023 03:31:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qOvTW-0005D1-R6 for qemu-devel@nongnu.org; Thu, 27 Jul 2023 03:31:54 -0400 Received: from mail-pf1-x431.google.com ([2607:f8b0:4864:20::431]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qOvTV-0003cq-6U for qemu-devel@nongnu.org; Thu, 27 Jul 2023 03:31:54 -0400 Received: by mail-pf1-x431.google.com with SMTP id d2e1a72fcca58-686b643df5dso504541b3a.1 for ; Thu, 27 Jul 2023 00:31:50 -0700 (PDT) Received: from alarm.flets-east.jp ([2400:4050:a840:1e00:78d2:b862:10a7:d486]) by smtp.gmail.com with ESMTPSA id d9-20020aa78689000000b0064fa2fdfa9esm802002pfo.81.2023.07.27.00.31.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jul 2023 00:31:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20221208.gappssmtp.com; s=20221208; t=1690443109; x=1691047909; 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=aiO61RFWQc576A2x8jBmto7Eq50nA+0j/FFgWXdA55I=; b=VNKaMnEOQNKlZR10dtEZyO1TSdS8k+fSD0DHogH1R6yudKKGkTFXMKAarSnSO2Kzhb xvD1EZKgScgBJoiuS8bn3iq9oS82m2GgS+xDRQL1LO1mZUI0h3QAs51vMSM0GF23EJ36 kplgCIlhxqVOD1kJw6Ndxf2MuGlGp3gf7FYdVXtivp0O9KAty+FICxA19fmvqlbFAaNK VaYy5/5qDpFY1/9OGQo8WReDwdFPntnukR2eDMEbxZ3IC+hZuDnSxabg/c1oO/jw/A5N 2zqYrcpUt7hQTCIvlGGKoh2gtLlNZHxV/k1JPuu0ENiemMNzGr+TMDNr5+hLTalPd13F f+kQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690443109; x=1691047909; 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=aiO61RFWQc576A2x8jBmto7Eq50nA+0j/FFgWXdA55I=; b=Z808+AQZ6eJogfLTxtVl+nI/63glYmNry9qaUW6Idi/RsP7ZJbwhmY/PM6axGw/yki 9DK1T28XNn8E/6B57V3C5zsNaQ5gL7XU+ojMJ6nWhMxfpXxXPQTjV23gDxXCOTHa0Zsf DPB25wnKdsuiVsE9zhulqSK4QJlMbQ/dCBkHImmujdn4NB1PQwlB2M7RpArthGFT3MO3 7iOo7hEhewX2/jnlLmzQiZeeCbr6bQ6rPaIy8bXfgUPY9a6Jyd2bf9OwSHXQ3KbrH6QO xy/t+s/LeZrkRYC4xDZKEu9S0HTsOFIFSmUAbmUFw1RJfvKEFenJrhE3Su4LrSPmyWBI WnIQ== X-Gm-Message-State: ABy/qLa2xdpULNcLvyQSn56CeF2/iVHy5cEXB0ETmROBhj9//gMiUySK ukw+d30/eNJMTTy4T8PXVMf5TofWblynPSa1l+o= X-Google-Smtp-Source: APBJJlEuLZxP0ZyEIi7VHNrW7mhtveHSO5fc5w71A22qd8/dfAl9uK20/rnFzi8GOuvgoOIN1lD60w== X-Received: by 2002:a05:6a00:2184:b0:65e:ec60:b019 with SMTP id h4-20020a056a00218400b0065eec60b019mr4039381pfi.25.1690443108991; Thu, 27 Jul 2023 00:31:48 -0700 (PDT) From: Akihiko Odaki To: Cc: qemu-devel@nongnu.org, qemu-arm@nongnu.org, kvm@vger.kernel.org, Paolo Bonzini , Peter Maydell , Richard Henderson , Akihiko Odaki Subject: [PATCH v5 2/6] accel/kvm: Specify default IPA size for arm64 Date: Thu, 27 Jul 2023 16:31:27 +0900 Message-ID: <20230727073134.134102-3-akihiko.odaki@daynix.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230727073134.134102-1-akihiko.odaki@daynix.com> References: <20230727073134.134102-1-akihiko.odaki@daynix.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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: none client-ip=2607:f8b0:4864:20::431; envelope-from=akihiko.odaki@daynix.com; helo=mail-pf1-x431.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @daynix-com.20221208.gappssmtp.com) X-ZM-MESSAGEID: 1690447273140100001 Content-Type: text/plain; charset="utf-8" Before this change, the default KVM type, which is used for non-virt machine models, was 0. The kernel documentation says: > On arm64, the physical address size for a VM (IPA Size limit) is > limited to 40bits by default. The limit can be configured if the host > supports the extension KVM_CAP_ARM_VM_IPA_SIZE. When supported, use > KVM_VM_TYPE_ARM_IPA_SIZE(IPA_Bits) to set the size in the machine type > identifier, where IPA_Bits is the maximum width of any physical > address used by the VM. The IPA_Bits is encoded in bits[7-0] of the > machine type identifier. > > e.g, to configure a guest to use 48bit physical address size:: > > vm_fd =3D ioctl(dev_fd, KVM_CREATE_VM, KVM_VM_TYPE_ARM_IPA_SIZE(48)); > > The requested size (IPA_Bits) must be: > > =3D=3D =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > 0 Implies default size, 40bits (for backward compatibility) > N Implies N bits, where N is a positive integer such that, > 32 <=3D N <=3D Host_IPA_Limit > =3D=3D =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > Host_IPA_Limit is the maximum possible value for IPA_Bits on the host > and is dependent on the CPU capability and the kernel configuration. > The limit can be retrieved using KVM_CAP_ARM_VM_IPA_SIZE of the > KVM_CHECK_EXTENSION ioctl() at run-time. > > Creation of the VM will fail if the requested IPA size (whether it is > implicit or explicit) is unsupported on the host. https://docs.kernel.org/virt/kvm/api.html#kvm-create-vm So if Host_IPA_Limit < 40, specifying 0 as the type will fail. This actually confused libvirt, which uses "none" machine model to probe the KVM availability, on M2 MacBook Air. Fix this by using Host_IPA_Limit as the default type when KVM_CAP_ARM_VM_IPA_SIZE is available. Signed-off-by: Akihiko Odaki Reviewed-by: Peter Maydell --- target/arm/kvm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/target/arm/kvm.c b/target/arm/kvm.c index 40f577bfd5..23aeb09949 100644 --- a/target/arm/kvm.c +++ b/target/arm/kvm.c @@ -249,7 +249,9 @@ int kvm_arm_get_max_vm_ipa_size(MachineState *ms, bool = *fixed_ipa) =20 int kvm_arch_get_default_type(MachineState *ms) { - return 0; + bool fixed_ipa; + int size =3D kvm_arm_get_max_vm_ipa_size(ms, &fixed_ipa); + return fixed_ipa ? 0 : size; } =20 int kvm_arch_init(MachineState *ms, KVMState *s) --=20 2.41.0 From nobody Tue Nov 5 08:26:30 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 ARC-Seal: i=1; a=rsa-sha256; t=1690443973; cv=none; d=zohomail.com; s=zohoarc; b=jEI0YuUoTfv7ZI+FYQ2qYCM6I/DDw9zwckqzPnei4lHzpCpMdtUSlCDM/v+v9XdnSky8mqGXuJn2CokyZbv6bBYio/MaHim7GqMxhk4I8ijNoaMaJr4ElLC5W6Oaa68/DeshCogx/WBTLZ8QCIOQvtjCFc/nEYUeXt0rschwzB0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1690443973; h=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; bh=26LP4jR8UCRhJyh1M0qdx1yDCFp8JOR+j4jZMhaZd5Y=; b=FvSpbbRGp4Kb9f6+FXTg5mb547XRjdiNS97Vp7hmee7PDuoBlNPyRXNDrFvDOofc/jv3d/1FUNYQwPSjo933U1Euow7RKjMJHhONxtV/cKWKZrfbwb0uIZSmTv6I5W+Y2sL+ycAdcjYlqNPiU0TGo1IGn9vmNs4B6vwCbcFLqWU= 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1690443973488321.6234302583415; Thu, 27 Jul 2023 00:46:13 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qOvTb-0005GB-3t; Thu, 27 Jul 2023 03:31:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qOvTX-0005DZ-Pi for qemu-devel@nongnu.org; Thu, 27 Jul 2023 03:31:55 -0400 Received: from mail-pf1-x430.google.com ([2607:f8b0:4864:20::430]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qOvTV-0003eO-76 for qemu-devel@nongnu.org; Thu, 27 Jul 2023 03:31:55 -0400 Received: by mail-pf1-x430.google.com with SMTP id d2e1a72fcca58-666e916b880so437237b3a.2 for ; Thu, 27 Jul 2023 00:31:52 -0700 (PDT) Received: from alarm.flets-east.jp ([2400:4050:a840:1e00:78d2:b862:10a7:d486]) by smtp.gmail.com with ESMTPSA id d9-20020aa78689000000b0064fa2fdfa9esm802002pfo.81.2023.07.27.00.31.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jul 2023 00:31:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20221208.gappssmtp.com; s=20221208; t=1690443111; x=1691047911; 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=26LP4jR8UCRhJyh1M0qdx1yDCFp8JOR+j4jZMhaZd5Y=; b=FMXUAO4Yoxbd/c3ZDAJO2Eft2gOvbLIXf4hOBH5Dj9DW3gt3d58iYHeQbhg3l1Hpmg I19AscWEwJNXso/G1WZ6tivdoRArUDtLLbJ6rH6XmR1/n+H4xd7fhr11URWhGi2HuOoM YRIhUGNyDTY6U/j1ShMhaPgpHYqhrjN5joKZ+zuJf4vgAeLVFubAD1fgso1+zLlpEBIl aQP0NIhtn5cgY5kVQCeKUcrAVL5klU7kvwre68iLoq9uUIhKDR+roXkSeTWsG2Nj05w3 m2v2Gg9ffatEkLhmzvEW8yEulbHU6UGF2Novf97q8cExbXPUMqDh0NstuyISfzWG1n6w OJdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690443111; x=1691047911; 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=26LP4jR8UCRhJyh1M0qdx1yDCFp8JOR+j4jZMhaZd5Y=; b=Q453W6qpZ7zpLXxDZzqumJT2ZpCpgBiCxTfEQ38b5owywB073bB5uJFQG7GedKN+Ll Td/vJiOsAoRgdveNjwYIFyPLAl184iVezxn7Dm5dEYOQIZnZYc4V2Sepxxlvoe9i4c8v usUjzp6P5Isyz2SXKZXZSdvmYE77DVMGnS5pLQvBds8bnN7XnEB1ItzlBkKEv/3YzjxV YJ2K3ACcZoIDQUdJwMORx6ITxFx8vcMf0WVBok8w8FQCrxP6sFpiPiexDIrr2CgNSvUz +DKlTBhFsDrbnkj25gPxyj6AB6Dwkw6CbNFKPKcy9E3312j+uk5bN6QoFcP0vxth21Ic 5OZg== X-Gm-Message-State: ABy/qLZbd6QUPdlnc5axKs91pS4MS/NwOO6SslwwDzoTrGTQa2+d04MK h6Ow+zrfzILplGzpyjwdNt+jsaDXWjKyhoepELs= X-Google-Smtp-Source: APBJJlF9vyB/rMKDG8kcKzWzhp8EQUmef9v7mW4IywNdEUOM/7FJYAMVAQcRxxvO32/savSwOQjPaA== X-Received: by 2002:a05:6a20:1610:b0:137:53d1:3e2 with SMTP id l16-20020a056a20161000b0013753d103e2mr4116444pzj.41.1690443111088; Thu, 27 Jul 2023 00:31:51 -0700 (PDT) From: Akihiko Odaki To: Cc: qemu-devel@nongnu.org, qemu-arm@nongnu.org, kvm@vger.kernel.org, Paolo Bonzini , Peter Maydell , Richard Henderson , Akihiko Odaki Subject: [PATCH v5 3/6] mips: Report an error when KVM_VM_MIPS_VZ is unavailable Date: Thu, 27 Jul 2023 16:31:28 +0900 Message-ID: <20230727073134.134102-4-akihiko.odaki@daynix.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230727073134.134102-1-akihiko.odaki@daynix.com> References: <20230727073134.134102-1-akihiko.odaki@daynix.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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: none client-ip=2607:f8b0:4864:20::430; envelope-from=akihiko.odaki@daynix.com; helo=mail-pf1-x430.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @daynix-com.20221208.gappssmtp.com) X-ZM-MESSAGEID: 1690443974789100001 Content-Type: text/plain; charset="utf-8" On MIPS, QEMU requires KVM_VM_MIPS_VZ type for KVM. Report an error in such a case as other architectures do when an error occurred during KVM type decision. Signed-off-by: Akihiko Odaki Reviewed-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- target/mips/kvm.c | 1 + 1 file changed, 1 insertion(+) diff --git a/target/mips/kvm.c b/target/mips/kvm.c index e98aad01bd..e22e24ed97 100644 --- a/target/mips/kvm.c +++ b/target/mips/kvm.c @@ -1278,6 +1278,7 @@ int kvm_arch_get_default_type(MachineState *machine) } #endif =20 + error_report("KVM_VM_MIPS_VZ type is not available"); return -1; } =20 --=20 2.41.0 From nobody Tue Nov 5 08:26:30 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 ARC-Seal: i=1; a=rsa-sha256; t=1690446651; cv=none; d=zohomail.com; s=zohoarc; b=YGIGA59CzwEjOLI+fzaN7oAxLbafeqqO+cP3sSeZE0RmZ7gpps93kL8dergyIKqksXLARYOFolR9mseT4utDJoF/OV/Mn2USFCjN5jUixtWK7jYM+qgCOp9dse/54m9ulmVzs8cZEeV1cDono19AIEgc2Bv4kRNz1rm49RPkk/s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1690446651; h=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; bh=WUXy3jNQsy5PFGPCh7DZInihQgiJWpSfcmP70S5aNLc=; b=T0pm1rm6V0vtCF23li2ylbrwYfxTfAaDZvWLECUyWiEvcV7GaH0Tsin+qSoJPUZMSov3CRYL2gcd3P0nz8nTN9UFuquiMR60Wngl3RK+GRjKpDPqoGBvbAFLkBRJaDQZfZ2sqXHY7rxnnbXJTptJX9ZMAvwS+vaRsx3F7pfAIV8= 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1690446651962972.1533244567936; Thu, 27 Jul 2023 01:30:51 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qOvTa-0005Fp-9K; Thu, 27 Jul 2023 03:31:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qOvTY-0005Dl-0z for qemu-devel@nongnu.org; Thu, 27 Jul 2023 03:31:56 -0400 Received: from mail-oo1-xc31.google.com ([2607:f8b0:4864:20::c31]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qOvTW-0003kh-E5 for qemu-devel@nongnu.org; Thu, 27 Jul 2023 03:31:55 -0400 Received: by mail-oo1-xc31.google.com with SMTP id 006d021491bc7-563531a3ad2so501433eaf.3 for ; Thu, 27 Jul 2023 00:31:54 -0700 (PDT) Received: from alarm.flets-east.jp ([2400:4050:a840:1e00:78d2:b862:10a7:d486]) by smtp.gmail.com with ESMTPSA id d9-20020aa78689000000b0064fa2fdfa9esm802002pfo.81.2023.07.27.00.31.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jul 2023 00:31:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20221208.gappssmtp.com; s=20221208; t=1690443113; x=1691047913; 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=WUXy3jNQsy5PFGPCh7DZInihQgiJWpSfcmP70S5aNLc=; b=ErRkuXIDzI8EHN9RJalhLqdArv/g31OAVXPGZTxhgwm4bIExhwd4UPvDSRIJztk0ij 8dWy86F8eEhs10cJ1ENhkeakq42mIoofDOZdQOKp1dEds0/JRCqiJ6HhOsJMRH/UQnvu XZ3bA41tzhxdLnEh+dDQKRh2JsZUz6k7Ciz62r5xlvsrQU86dTcuykBVsw2e58Qcwso8 oeC7DWP3Eel+hhwJofaR9D77yQAaLpOYeISbfXP02vDpcNchsJN0ZtkS9B/TzAEhitnB vv0Vtdgo+pg0o+ZyyM+7Ds0RSgM1M0+ZdxfW0PJGJ0PUhPfSAH1XNeC+9zU3Pp0HHl/8 hjXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690443113; x=1691047913; 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=WUXy3jNQsy5PFGPCh7DZInihQgiJWpSfcmP70S5aNLc=; b=bpeFOJvqKRenXF6PewQi/j8LsM/93XXVbMRqvZX5oSG47kqmze+oVIQKy/x8xkdLeP xAcSw9c2SpkIxSHsk75X+8Pgio35bCpqd01gWSWLNj3+Vn9DCZNFOmuNFAylox6gLGHo nRsYaiEJ+JTbp2HQO8mzvNCec4jXOWG2xLDXe5+L1RgPEIiV3lcSd/c7jRQrj9IB82nQ sAERUFZ0alMvUG3l5SLUO0qBlcVn9B7ZuDVA9Nfe6BlFg6ypXBosuv3yAvL0QtnImIEb +rh8j2reZIK2+QWvCBsMmY9hK7f61E5OLJKpd8iKxTIyHyLTqCakBet4nlaCzFUPBmK6 LuZQ== X-Gm-Message-State: ABy/qLaMQMmiSWgb3JzvF59UzS3QHL2+d/rpmszGnR+IZjZ5AW5O4hgI gxOTkRlWZjC3m6jSlpVNpcm1PXVxz+A48DVHSEk= X-Google-Smtp-Source: APBJJlFEta7887wC+EH2MCZzxvk/JmjxY935l/UatI0IUcVcQUEaVDafFfiot8/j0cB4J/3Md+iDSQ== X-Received: by 2002:a05:6358:e4a7:b0:135:a52c:1d93 with SMTP id by39-20020a056358e4a700b00135a52c1d93mr1995699rwb.28.1690443113170; Thu, 27 Jul 2023 00:31:53 -0700 (PDT) From: Akihiko Odaki To: Cc: qemu-devel@nongnu.org, qemu-arm@nongnu.org, kvm@vger.kernel.org, Paolo Bonzini , Peter Maydell , Richard Henderson , Akihiko Odaki Subject: [PATCH v5 4/6] accel/kvm: Use negative KVM type for error propagation Date: Thu, 27 Jul 2023 16:31:29 +0900 Message-ID: <20230727073134.134102-5-akihiko.odaki@daynix.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230727073134.134102-1-akihiko.odaki@daynix.com> References: <20230727073134.134102-1-akihiko.odaki@daynix.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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: none client-ip=2607:f8b0:4864:20::c31; envelope-from=akihiko.odaki@daynix.com; helo=mail-oo1-xc31.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @daynix-com.20221208.gappssmtp.com) X-ZM-MESSAGEID: 1690446653256100001 Content-Type: text/plain; charset="utf-8" On MIPS, kvm_arch_get_default_type() returns a negative value when an error occurred so handle the case. Also, let other machines return negative values when errors occur and declare returning a negative value as the correct way to propagate an error that happened when determining KVM type. Signed-off-by: Akihiko Odaki Reviewed-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- accel/kvm/kvm-all.c | 5 +++++ hw/arm/virt.c | 2 +- hw/ppc/spapr.c | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c index d591b5079c..94a62efa3c 100644 --- a/accel/kvm/kvm-all.c +++ b/accel/kvm/kvm-all.c @@ -2527,6 +2527,11 @@ static int kvm_init(MachineState *ms) type =3D kvm_arch_get_default_type(ms); } =20 + if (type < 0) { + ret =3D -EINVAL; + goto err; + } + do { ret =3D kvm_ioctl(s, KVM_CREATE_VM, type); } while (ret =3D=3D -EINTR); diff --git a/hw/arm/virt.c b/hw/arm/virt.c index 8a4c663735..161f3ffbf7 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -2977,7 +2977,7 @@ static int virt_kvm_type(MachineState *ms, const char= *type_str) "require an IPA range (%d bits) larger than " "the one supported by the host (%d bits)", requested_pa_size, max_vm_pa_size); - exit(1); + return -1; } /* * We return the requested PA log size, unless KVM only supports diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 54dbfd7fe9..1b522e8e40 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -3104,7 +3104,7 @@ static int spapr_kvm_type(MachineState *machine, cons= t char *vm_type) } =20 error_report("Unknown kvm-type specified '%s'", vm_type); - exit(1); + return -1; } =20 /* --=20 2.41.0 From nobody Tue Nov 5 08:26:30 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 ARC-Seal: i=1; a=rsa-sha256; t=1690443594; cv=none; d=zohomail.com; s=zohoarc; b=DstGJgiz1Bs2WJXgeu/FhV8rCl/qTWokrO5ste47bw8VTZPK8X8qXIroIF/LoFSQj+BORWxMVd3IDY2wIyBK7LSHRh4x6+4v19KkFZKk1jM9fN0HLIKmIKRbgFdC8yY1tsoa4iyi+LjEwIEA5ZtxfUctska6e7ROEDs95vM0Tgs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1690443594; h=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; bh=8W/2glyFNghlOR8aLoJh4rtbBTz1uiLofQu+GK6+ib0=; b=mlT1tk5hWEsFnX6vnHw8H0TDhj7hCSPJHDvJWEV0H9gZ8fk+aNy5fFhl3g3wLxa0mVSVscokpFQtBB5Vto/CYRObKYLo1YbYlO6YE4FK3mf0kAbOZ3cn5sTAz2qO/eaHMUAzvtk2wrxKelnkTw4736VocALav/yT85E2wiBo3G8= 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1690443594372781.3813227450989; Thu, 27 Jul 2023 00:39:54 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qOvTc-0005H3-8B; Thu, 27 Jul 2023 03:32:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qOvTZ-0005FS-TF for qemu-devel@nongnu.org; Thu, 27 Jul 2023 03:31:57 -0400 Received: from mail-pf1-x434.google.com ([2607:f8b0:4864:20::434]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qOvTY-0003op-Ip for qemu-devel@nongnu.org; Thu, 27 Jul 2023 03:31:57 -0400 Received: by mail-pf1-x434.google.com with SMTP id d2e1a72fcca58-686ea67195dso506500b3a.2 for ; Thu, 27 Jul 2023 00:31:56 -0700 (PDT) Received: from alarm.flets-east.jp ([2400:4050:a840:1e00:78d2:b862:10a7:d486]) by smtp.gmail.com with ESMTPSA id d9-20020aa78689000000b0064fa2fdfa9esm802002pfo.81.2023.07.27.00.31.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jul 2023 00:31:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20221208.gappssmtp.com; s=20221208; t=1690443115; x=1691047915; 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=8W/2glyFNghlOR8aLoJh4rtbBTz1uiLofQu+GK6+ib0=; b=TwyLkq7VkQVku7UEGEJGvOxpiLGKqGNn2Z8k57YpSS6ZkWHfSRznN+VshcyamJEJqB zMw97jUDWAXtbrKFdxDdZwZlTw6jMTuKDc69kpYGQ0SwXjls2dSoY2OhR7sH8bIrD4ut G0xxv4KpICYR9eGhbLk7VBV+IuNi87eZcDIuQc2fsSeQHyMLWy9i4ZRqjfD2vLbCVkaS gH2rgu9ptJReOtFpj98D23kSv1ELspNKBm2SZkYIDSxsUsfqx7DVi5tLI2e5vuNCLyJ3 6YmLAZvRauKh3Zadas84zdgYM3WKD/wsk1snqp9KY3I0KaeJVZx2HrbjHlfEjSasJF89 9OSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690443115; x=1691047915; 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=8W/2glyFNghlOR8aLoJh4rtbBTz1uiLofQu+GK6+ib0=; b=dd9kpRXjKS1ok3SjWgDfyRHgaK69NWeVqVX6J+aPY0qb9PRdgBVkeS9htTJpNdFV+X PpI2ihw9D07glWLXWUET1APzEFl0sis/MtJW1bASRcBzxB3YnCakX0bzYzEYZWEzbuq4 xUwVPW+dek2L9x9apCPd92FpasL5MxgxeGo31Y6tlVlKyLBUewDut9sQ04MVlCxIuXT5 ATBCokeqDnWVB49+hZP1zL9Wj+V2wGMJCrC+59QVFLgltUZwB5xu3j9/rT8g18tnwqbz +aySOwjweZiNih4zxNcnbvIoZIPgNiMKgTAJuQ2S+OovKLVdackfPm50aeeUTbODsSn9 tt4w== X-Gm-Message-State: ABy/qLbzVbPKEh/KVfbBh1iWtdX1ziE8H0cMzlk6D4jQtv8IqPWMs3F6 lW2OcfWyJTKwv4g/KhbLenKloAkHNGoeUmES4bs= X-Google-Smtp-Source: APBJJlGH5IK6xCXrgs0jr2kjrwPluYHvsn81u11F09P420p9JlfCazkD9jzO2BEnsFqFVedHPLVqnQ== X-Received: by 2002:a05:6a00:1515:b0:668:74e9:8eea with SMTP id q21-20020a056a00151500b0066874e98eeamr5088101pfu.33.1690443115301; Thu, 27 Jul 2023 00:31:55 -0700 (PDT) From: Akihiko Odaki To: Cc: qemu-devel@nongnu.org, qemu-arm@nongnu.org, kvm@vger.kernel.org, Paolo Bonzini , Peter Maydell , Richard Henderson , Akihiko Odaki Subject: [PATCH v5 5/6] accel/kvm: Free as when an error occurred Date: Thu, 27 Jul 2023 16:31:30 +0900 Message-ID: <20230727073134.134102-6-akihiko.odaki@daynix.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230727073134.134102-1-akihiko.odaki@daynix.com> References: <20230727073134.134102-1-akihiko.odaki@daynix.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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: none client-ip=2607:f8b0:4864:20::434; envelope-from=akihiko.odaki@daynix.com; helo=mail-pf1-x434.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @daynix-com.20221208.gappssmtp.com) X-ZM-MESSAGEID: 1690443596891100002 Content-Type: text/plain; charset="utf-8" An error may occur after s->as is allocated, for example while determining KVM type. Signed-off-by: Akihiko Odaki Reviewed-by: Peter Maydell --- accel/kvm/kvm-all.c | 1 + 1 file changed, 1 insertion(+) diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c index 94a62efa3c..4591669d78 100644 --- a/accel/kvm/kvm-all.c +++ b/accel/kvm/kvm-all.c @@ -2765,6 +2765,7 @@ err: if (s->fd !=3D -1) { close(s->fd); } + g_free(s->as); g_free(s->memory_listener.slots); =20 return ret; --=20 2.41.0 From nobody Tue Nov 5 08:26:30 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 ARC-Seal: i=1; a=rsa-sha256; t=1690448261; cv=none; d=zohomail.com; s=zohoarc; b=ZNc3wxsTLZMLfZxf8xLH9JXnbCF382atdG6PujJOHkdcM7QJbn1aHPO+jPtcrf3A+kJwQQ4xJH7gVcGdHTfj/mvAp94nZLYgbRKO0ZTidfGPS+1CAGcnrJWk44p45ELIkahbsOzxVgKa8+vHnmw6zaxPBT8iuwKUCDeaAPhawls= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1690448261; h=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; bh=KryCFoTvBP3nIdEsg77nTIkWzqmuMWTWodPXHjNoS7w=; b=bqrsSBqK5Zyom2dhpREC8pybggTx+0+stbqPWPL7nwSHa/scxFhd91ntza1FkamhpVx4mBkZHpajcmi53JiudqcEfH6LPLMcuvCFHHKNtr8jgwEwRWxdoZqGcD5+bTY1z9fUoUX8Kd35jyKKAdsUHssQkM6vsgb1LOFxNS/mXFY= 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 169044826135136.17946301238885; Thu, 27 Jul 2023 01:57:41 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qOvTe-0005LC-T3; Thu, 27 Jul 2023 03:32:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qOvTc-0005HS-Fy for qemu-devel@nongnu.org; Thu, 27 Jul 2023 03:32:00 -0400 Received: from mail-pf1-x429.google.com ([2607:f8b0:4864:20::429]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qOvTa-0003pa-TW for qemu-devel@nongnu.org; Thu, 27 Jul 2023 03:32:00 -0400 Received: by mail-pf1-x429.google.com with SMTP id d2e1a72fcca58-686efa1804eso493927b3a.3 for ; Thu, 27 Jul 2023 00:31:58 -0700 (PDT) Received: from alarm.flets-east.jp ([2400:4050:a840:1e00:78d2:b862:10a7:d486]) by smtp.gmail.com with ESMTPSA id d9-20020aa78689000000b0064fa2fdfa9esm802002pfo.81.2023.07.27.00.31.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jul 2023 00:31:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20221208.gappssmtp.com; s=20221208; t=1690443117; x=1691047917; 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=KryCFoTvBP3nIdEsg77nTIkWzqmuMWTWodPXHjNoS7w=; b=sT7eY9uWJvO3BMx6lFVxseP9F1PeovS6Qw2urWg1NPKLVRcu28M/oqgLlLGgrpFyTY 1vwQMtWatcerVjfj2BlQVAOCUoNwR3trS/c72W+2MlMSsV0b1SRJ/hNchg3RtkC4MjBI LhHpdeolCx+g0bz21dokX19IdvNXpMNexhbpVAzG9xhFpD/dnUGuRD6/BBwVxZmgLBu3 ftOlzh/5Z0t49+mijXRwEpCB0a4JJkbr+fFG4Q0KsX3EzJG6cdbx4bnfnnj1IcT6kVjr g3anDuem2i5j0Wxo1P875QPwoecKOhkEmjx85WmYodu52vj5jhygb3Hp0UzHRHwyaCzs /ZFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690443117; x=1691047917; 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=KryCFoTvBP3nIdEsg77nTIkWzqmuMWTWodPXHjNoS7w=; b=TZmKcJk/MyXoJb1sGTXd6NHFQYaPIKR9rm08kq8NnE3H62L/mAcsVTZs9EBwawInJ9 Whafvstz8yN39lZVZpCtJina+ajc/At/9bYvQ33sBPVFzU7CvNxUO3Z4RvR/YXLp1hME iJ7m5zYJWeJj5WUEuFAGR213umYWWhSg3ExMRw1Zb6kofUqDrkf7vIftG91kP+qxZQLG V82blO8/3RzvNOe6sy5dfEjmcUpWG5uwBKiEDOZ1N8XCs4LFhaM9upjA3c2DcuhnutzO 51gqJRNaUp/3t+/h72NtRSwZ770flcpkU0zrvwboT1j9eyr4H7riR9JG9bCFdPmXunoy bzlQ== X-Gm-Message-State: ABy/qLbVVVpeNw/dQpk5NiJkmoJUWQ6TCeroX2sxEF0gxtAqdc3NNgLL +hxdoDWzNAKKVXaCJpnW+ulM5EhZT0R/b7R/umA= X-Google-Smtp-Source: APBJJlGoR80KicuYnq4Q3XY7GzEAoTXmN+bZbfxdkyHGuoNwvVoBjOiW9+g73QffU6YklFvoelFu/A== X-Received: by 2002:a05:6a00:139c:b0:66b:8d48:8e64 with SMTP id t28-20020a056a00139c00b0066b8d488e64mr4516779pfg.12.1690443117393; Thu, 27 Jul 2023 00:31:57 -0700 (PDT) From: Akihiko Odaki To: Cc: qemu-devel@nongnu.org, qemu-arm@nongnu.org, kvm@vger.kernel.org, Paolo Bonzini , Peter Maydell , Richard Henderson , Akihiko Odaki Subject: [PATCH v5 6/6] accel/kvm: Make kvm_dirty_ring_reaper_init() void Date: Thu, 27 Jul 2023 16:31:31 +0900 Message-ID: <20230727073134.134102-7-akihiko.odaki@daynix.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230727073134.134102-1-akihiko.odaki@daynix.com> References: <20230727073134.134102-1-akihiko.odaki@daynix.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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: none client-ip=2607:f8b0:4864:20::429; envelope-from=akihiko.odaki@daynix.com; helo=mail-pf1-x429.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @daynix-com.20221208.gappssmtp.com) X-ZM-MESSAGEID: 1690448261702100003 Content-Type: text/plain; charset="utf-8" The returned value was always zero and had no meaning. Signed-off-by: Akihiko Odaki Reviewed-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- accel/kvm/kvm-all.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c index 4591669d78..a4a1b4e05d 100644 --- a/accel/kvm/kvm-all.c +++ b/accel/kvm/kvm-all.c @@ -1454,15 +1454,13 @@ static void *kvm_dirty_ring_reaper_thread(void *dat= a) return NULL; } =20 -static int kvm_dirty_ring_reaper_init(KVMState *s) +static void kvm_dirty_ring_reaper_init(KVMState *s) { struct KVMDirtyRingReaper *r =3D &s->reaper; =20 qemu_thread_create(&r->reaper_thr, "kvm-reaper", kvm_dirty_ring_reaper_thread, s, QEMU_THREAD_JOINABLE); - - return 0; } =20 static int kvm_dirty_ring_init(KVMState *s) @@ -2744,10 +2742,7 @@ static int kvm_init(MachineState *ms) } =20 if (s->kvm_dirty_ring_size) { - ret =3D kvm_dirty_ring_reaper_init(s); - if (ret) { - goto err; - } + kvm_dirty_ring_reaper_init(s); } =20 if (kvm_check_extension(kvm_state, KVM_CAP_BINARY_STATS_FD)) { --=20 2.41.0