From patchwork Fri Feb 19 17:38:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 12095947 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A10D5C433E0 for ; Fri, 19 Feb 2021 17:42:46 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3243364DA1 for ; Fri, 19 Feb 2021 17:42:46 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3243364DA1 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:41532 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lD9nh-0005Vi-8r for qemu-devel@archiver.kernel.org; Fri, 19 Feb 2021 12:42:45 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:49088) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lD9k7-0002GD-Cw for qemu-devel@nongnu.org; Fri, 19 Feb 2021 12:39:03 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:50700) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1lD9k4-0005Pd-Kd for qemu-devel@nongnu.org; Fri, 19 Feb 2021 12:39:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1613756339; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=98X4DsBNdk1BN09KWcHx0mE3/gzzTZdKxOLSGajyIeI=; b=Q9/iEHjDqTF80Mo33cOYrt6p2Mpt3KYt2U3Ws869lT0OTof6ZPlwvl5CIILLX0q5dD0TsJ GREqXguURm4OuiYckfiL8llnByBBclUng2Ga0xYg7sctKg9dbGPCq2yoHwHUfwCC5Ta4Ih L4BjB9lWVIOwISa+z4fduSomV3HSW/o= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-516-T9xLyIzUMjOy7UZ1BigUcw-1; Fri, 19 Feb 2021 12:38:58 -0500 X-MC-Unique: T9xLyIzUMjOy7UZ1BigUcw-1 Received: by mail-wm1-f72.google.com with SMTP id z67so2789285wme.3 for ; Fri, 19 Feb 2021 09:38:58 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=98X4DsBNdk1BN09KWcHx0mE3/gzzTZdKxOLSGajyIeI=; b=CTv/+Mb+Tl5GLhRMkVfTPgu/hP4v7C9SboOduXu+EvLwbnV7l/eMRm8+2ldFNFu610 PEvCEgWUUOUDCNbAnCQucdBxwfhmfQW+57kjtkBC/6LKzlWjndFyB5ME3ROJSj4TNemO QtgpxPmW8UdhAvy27dBIU1FORA7Mj+ut3/TM0zsTidDVPb6jSGeUzg49wSvmmVO2iM80 4EUMDVjNIKJFAQMm6Z0764Gvn2hrV66NSy1VN4oBss7zkRalk618m5fpK9YV0S2qgx8j npuoo3QkYXu+NoWSO4cfy7kkSToOOrpYYIAkanuUvYzkD5M+Da+SNpQp1B267odMdBFw xEVA== X-Gm-Message-State: AOAM530aMEySpM9qjJAKrPcAvnFfrORmSto2s1QT/EpZT/q0VtBknPks PHGdd7t71A8A9JMulP0xhK6fr7wZwdQkJwAQz/DkrROvwDcY2gMV1yGpctUFUXqeW59dpqvtkus 0U4ZXSDzYcL3fpD02XigxhJUuwM7twegoAxGeMwAfQkVtAqyRDI+PYPjrL61vS86w X-Received: by 2002:adf:b60f:: with SMTP id f15mr10395992wre.83.1613756336913; Fri, 19 Feb 2021 09:38:56 -0800 (PST) X-Google-Smtp-Source: ABdhPJzk+AP79F8l3TWLxyR5RU8SmferiSbz3yhDIC5dQKM04uA2QaqDVPRO6H3UVoBxcUQFmDZVKw== X-Received: by 2002:adf:b60f:: with SMTP id f15mr10395942wre.83.1613756336683; Fri, 19 Feb 2021 09:38:56 -0800 (PST) Received: from localhost.localdomain (68.red-83-57-175.dynamicip.rima-tde.net. [83.57.175.68]) by smtp.gmail.com with ESMTPSA id i7sm23525949wmq.2.2021.02.19.09.38.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Feb 2021 09:38:56 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v2 01/11] accel/kvm: Check MachineClass kvm_type() return value Date: Fri, 19 Feb 2021 18:38:37 +0100 Message-Id: <20210219173847.2054123-2-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210219173847.2054123-1-philmd@redhat.com> References: <20210219173847.2054123-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=63.128.21.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Huacai Chen , kvm@vger.kernel.org, Paul Durrant , David Hildenbrand , Aleksandar Rikalo , "Edgar E. Iglesias" , Stefano Stabellini , "Michael S. Tsirkin" , Halil Pasic , Christian Borntraeger , =?utf-8?q?Herv=C3=A9_Poussi?= =?utf-8?q?neau?= , Anthony Perard , xen-devel@lists.xenproject.org, Leif Lindholm , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Thomas Huth , Eduardo Habkost , Mark Cave-Ayland , Alistair Francis , Richard Henderson , Greg Kurz , qemu-s390x@nongnu.org, qemu-arm@nongnu.org, David Gibson , Radoslaw Biernacki , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= , qemu-ppc@nongnu.org, Cornelia Huck , Paolo Bonzini , Aurelien Jarno Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" MachineClass::kvm_type() can return -1 on failure. Document it, and add a check in kvm_init(). Signed-off-by: Philippe Mathieu-Daudé --- include/hw/boards.h | 3 ++- accel/kvm/kvm-all.c | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/include/hw/boards.h b/include/hw/boards.h index a46dfe5d1a6..68d3d10f6b0 100644 --- a/include/hw/boards.h +++ b/include/hw/boards.h @@ -127,7 +127,8 @@ typedef struct { * implement and a stub device is required. * @kvm_type: * Return the type of KVM corresponding to the kvm-type string option or - * computed based on other criteria such as the host kernel capabilities. + * computed based on other criteria such as the host kernel capabilities + * (which can't be negative), or -1 on error. * @numa_mem_supported: * true if '--numa node.mem' option is supported and false otherwise * @smp_parse: diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c index 84c943fcdb2..b069938d881 100644 --- a/accel/kvm/kvm-all.c +++ b/accel/kvm/kvm-all.c @@ -2057,6 +2057,12 @@ static int kvm_init(MachineState *ms) "kvm-type", &error_abort); type = mc->kvm_type(ms, kvm_type); + if (type < 0) { + ret = -EINVAL; + fprintf(stderr, "Failed to detect kvm-type for machine '%s'\n", + mc->name); + goto err; + } } do { From patchwork Fri Feb 19 17:38:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 12095953 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4F33AC433E0 for ; Fri, 19 Feb 2021 17:47:05 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E0E2264E15 for ; Fri, 19 Feb 2021 17:47:04 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E0E2264E15 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:50856 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lD9rs-0001BQ-1t for qemu-devel@archiver.kernel.org; Fri, 19 Feb 2021 12:47:04 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:49158) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lD9kD-0002Tl-Jl for qemu-devel@nongnu.org; Fri, 19 Feb 2021 12:39:09 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:37855) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1lD9kA-0005Sh-It for qemu-devel@nongnu.org; Fri, 19 Feb 2021 12:39:09 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1613756345; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=cia92nKBjrGhWlmymfB9YbxEpc3m+J7hFEI/efRN2yM=; b=B4hXWITd3MjdLXlv+hDENzBkDbtF1k/RhVVeqq0EQHFIg5KW6/GDY7YCXxmHMWtp0LfMbF 37i31N10OEciZT/BSHw4ryts9n6RJRCAi66FBgyRndsVPHMJn0/5AaHxX+6IfWkwqNv0Ql i3PmLrBdebVcPlgX+3xBrlzsZ65Gpcs= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-189-TNcNUVInMOyUe__ODBA2ow-1; Fri, 19 Feb 2021 12:39:04 -0500 X-MC-Unique: TNcNUVInMOyUe__ODBA2ow-1 Received: by mail-wr1-f69.google.com with SMTP id e11so2715059wro.19 for ; Fri, 19 Feb 2021 09:39:04 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=cia92nKBjrGhWlmymfB9YbxEpc3m+J7hFEI/efRN2yM=; b=d2Ces4wScKyBqybQadYUr0SwKFkeIuxAJJscLdSU8Olg9QcfUY4DrrHZ1sPYwBzbB1 10McnTjdsEf264Jt5TDFfrgPAyHfOboD4bMG8kTJtkf7TqF8IFUF01Ki284ESAlOl7MZ vSoNvBLYsreouTLKx3Sv1hUWqDi0hbQzQ8M7wZKDSxD8c5Vmcr2F+uAobmu/MB8/Ge9w KXZSLxKrw4OxYM3RmCIoglNj2qMnETbc5dikOc3KX8YhbRJcrJOOnmcF+aB8jqMlpCi3 T5Nxlz4UMvKHGhK02QliMdQFQePS0x7lXfgewrM2WTLZI+BXtsG6FXJEaffGplHuhn9T XUdw== X-Gm-Message-State: AOAM533zgRW6UdNxAe2g5qt3/McihAWF6yhX9iKAv9UngO9KRXPrxkqA UTmy+ZHbpQ0uAlELOoc9/5yrVPVb/V9O20yRPx+B+3FjpTSmpDalcwKooqVv5xmxWHYW2oQWr92 VAs5qqJQ9pQ9B18fRx8QqGht7m59zl13829JKNp6X7dY8wQCqBjuN569ZfWJhosbr X-Received: by 2002:a1c:dd09:: with SMTP id u9mr7417338wmg.183.1613756342572; Fri, 19 Feb 2021 09:39:02 -0800 (PST) X-Google-Smtp-Source: ABdhPJxqNL2hop6t3K45dchD7vTDRIpUNwjlifOUsXeOhz1mjGEWf1uUBOU5I8vzusScCU0mSzJMIw== X-Received: by 2002:a1c:dd09:: with SMTP id u9mr7417287wmg.183.1613756342265; Fri, 19 Feb 2021 09:39:02 -0800 (PST) Received: from localhost.localdomain (68.red-83-57-175.dynamicip.rima-tde.net. [83.57.175.68]) by smtp.gmail.com with ESMTPSA id u7sm13826375wrt.67.2021.02.19.09.39.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Feb 2021 09:39:01 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v2 02/11] hw/boards: Introduce machine_class_valid_for_accelerator() Date: Fri, 19 Feb 2021 18:38:38 +0100 Message-Id: <20210219173847.2054123-3-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210219173847.2054123-1-philmd@redhat.com> References: <20210219173847.2054123-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=216.205.24.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Huacai Chen , kvm@vger.kernel.org, Paul Durrant , David Hildenbrand , Aleksandar Rikalo , "Edgar E. Iglesias" , Stefano Stabellini , "Michael S. Tsirkin" , Halil Pasic , Christian Borntraeger , =?utf-8?q?Herv=C3=A9_Poussi?= =?utf-8?q?neau?= , Anthony Perard , xen-devel@lists.xenproject.org, Leif Lindholm , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Thomas Huth , Eduardo Habkost , Mark Cave-Ayland , Alistair Francis , Richard Henderson , Greg Kurz , qemu-s390x@nongnu.org, qemu-arm@nongnu.org, David Gibson , Radoslaw Biernacki , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= , qemu-ppc@nongnu.org, Cornelia Huck , Paolo Bonzini , Aurelien Jarno Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Introduce the valid_accelerators[] field to express the list of valid accelators a machine can use, and add the machine_class_valid_for_current_accelerator() and machine_class_valid_for_accelerator() methods. Signed-off-by: Philippe Mathieu-Daudé --- include/hw/boards.h | 24 ++++++++++++++++++++++++ hw/core/machine.c | 26 ++++++++++++++++++++++++++ 2 files changed, 50 insertions(+) diff --git a/include/hw/boards.h b/include/hw/boards.h index 68d3d10f6b0..4d08bc12093 100644 --- a/include/hw/boards.h +++ b/include/hw/boards.h @@ -36,6 +36,24 @@ void machine_set_cpu_numa_node(MachineState *machine, const CpuInstanceProperties *props, Error **errp); +/** + * machine_class_valid_for_accelerator: + * @mc: the machine class + * @acc_name: accelerator name + * + * Returns %true if the accelerator is valid for the machine, %false + * otherwise. See #MachineClass.valid_accelerators. + */ +bool machine_class_valid_for_accelerator(MachineClass *mc, const char *acc_name); +/** + * machine_class_valid_for_current_accelerator: + * @mc: the machine class + * + * Returns %true if the accelerator is valid for the current machine, + * %false otherwise. See #MachineClass.valid_accelerators. + */ +bool machine_class_valid_for_current_accelerator(MachineClass *mc); + void machine_class_allow_dynamic_sysbus_dev(MachineClass *mc, const char *type); /* * Checks that backend isn't used, preps it for exclusive usage and @@ -125,6 +143,11 @@ typedef struct { * should instead use "unimplemented-device" for all memory ranges where * the guest will attempt to probe for a device that QEMU doesn't * implement and a stub device is required. + * @valid_accelerators: + * If this machine supports a specific set of virtualization accelerators, + * this contains a NULL-terminated list of the accelerators that can be + * used. If this field is not set, any accelerator is valid. The QTest + * accelerator is always valid. * @kvm_type: * Return the type of KVM corresponding to the kvm-type string option or * computed based on other criteria such as the host kernel capabilities @@ -166,6 +189,7 @@ struct MachineClass { const char *alias; const char *desc; const char *deprecation_reason; + const char *const *valid_accelerators; void (*init)(MachineState *state); void (*reset)(MachineState *state); diff --git a/hw/core/machine.c b/hw/core/machine.c index 970046f4388..c42d8e382b1 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -518,6 +518,32 @@ static void machine_set_nvdimm_persistence(Object *obj, const char *value, nvdimms_state->persistence_string = g_strdup(value); } +bool machine_class_valid_for_accelerator(MachineClass *mc, const char *acc_name) +{ + const char *const *name = mc->valid_accelerators; + + if (!name) { + return true; + } + if (strcmp(acc_name, "qtest") == 0) { + return true; + } + + for (unsigned i = 0; name[i]; i++) { + if (strcasecmp(acc_name, name[i]) == 0) { + return true; + } + } + return false; +} + +bool machine_class_valid_for_current_accelerator(MachineClass *mc) +{ + AccelClass *ac = ACCEL_GET_CLASS(current_accel()); + + return machine_class_valid_for_accelerator(mc, ac->name); +} + void machine_class_allow_dynamic_sysbus_dev(MachineClass *mc, const char *type) { QAPI_LIST_PREPEND(mc->allowed_dynamic_sysbus_devices, g_strdup(type)); From patchwork Fri Feb 19 17:38:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 12095951 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AA1A5C433DB for ; Fri, 19 Feb 2021 17:47:00 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1D7CB64E15 for ; Fri, 19 Feb 2021 17:46:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1D7CB64E15 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:50512 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lD9rm-00012X-Vg for qemu-devel@archiver.kernel.org; Fri, 19 Feb 2021 12:46:59 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:49216) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lD9kI-0002g6-Rt for qemu-devel@nongnu.org; Fri, 19 Feb 2021 12:39:14 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:50268) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1lD9kG-0005UG-Bb for qemu-devel@nongnu.org; Fri, 19 Feb 2021 12:39:14 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1613756351; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=HQ6bR9q2nTx8UZfcCwDp8YyWJ5IdPylW4EMLv5ePnSc=; b=aiIBXvVyVz8UZbKJ1VRMWUICNBGe/Ged0aq2gyJIxKbrGg/y/4qW6C+GOeGtIqz8jtKocz 5JzrOWvPQ7Ac/lyOQZIzNKA0PophRMhi2pvyfybwaAlU4CSSoR35XxHQdA1Qhusxog216A 8gIlUEBGhNHKT/IFLkIGd8rknRMOg3c= Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-506-jlinCSUnMfuU5SOmAxnmrg-1; Fri, 19 Feb 2021 12:39:09 -0500 X-MC-Unique: jlinCSUnMfuU5SOmAxnmrg-1 Received: by mail-wr1-f71.google.com with SMTP id q5so2752382wrs.20 for ; Fri, 19 Feb 2021 09:39:09 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=HQ6bR9q2nTx8UZfcCwDp8YyWJ5IdPylW4EMLv5ePnSc=; b=cqiHOYkza//z7loUZ5/86uyU2kpAFp80G7CKJDgNtwOtksb1/FdzDe30Lk5ytE5eye htZwwl+OYm4upiI8Sbakevquw/mwMeXEKfuJqRernTijuRjs2ZM4LbgQO0OFM+W96etp EJn/ptDAlJCP5U/FqeFNHYrdQv63ABH800qsVZQfP6NK/WghXUs1RCuGAQTESZKUJxJ2 qEw1Z8my5YgUG6Z7hUSu5Huh8OzdrvleOiztNkLXnMofXLNhcKtdq1P8YBLGYW5Apzhh PiceNJHTXZdyJQy5tso091t1wvoRkHsKN48FJB+cKGrwiOjwEf8mSAPu+WubygT48PGY 52Mg== X-Gm-Message-State: AOAM532U+HSqwtunGQRLmPP/Z+iHkRemV6oZLQkrdJdzJdONAMAETm9I w9mFhjicaLd0/QgEEa1XF8tiqwRFod+ubmxF+HGcEqz3vHq5N13cuWZMY1SEFeuJwk7x5JaJgQk LqEv1UzyDo9/hghZz8yR256URBAqXDUVnePHc2V79z4FsxrlptGKnRxgxCdPByptl X-Received: by 2002:adf:b342:: with SMTP id k2mr10246419wrd.264.1613756348013; Fri, 19 Feb 2021 09:39:08 -0800 (PST) X-Google-Smtp-Source: ABdhPJzRIsqLMFpNjZYF3WUU2UHyYdzuctCSQdLydicZwE25C3zYE3MQJaOoIUNZctaN8YvHWyznKA== X-Received: by 2002:adf:b342:: with SMTP id k2mr10246368wrd.264.1613756347790; Fri, 19 Feb 2021 09:39:07 -0800 (PST) Received: from localhost.localdomain (68.red-83-57-175.dynamicip.rima-tde.net. [83.57.175.68]) by smtp.gmail.com with ESMTPSA id y62sm15299048wmy.9.2021.02.19.09.39.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Feb 2021 09:39:07 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v2 03/11] hw/core: Restrict 'query-machines' to those supported by current accel Date: Fri, 19 Feb 2021 18:38:39 +0100 Message-Id: <20210219173847.2054123-4-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210219173847.2054123-1-philmd@redhat.com> References: <20210219173847.2054123-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=63.128.21.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Huacai Chen , kvm@vger.kernel.org, Paul Durrant , David Hildenbrand , Aleksandar Rikalo , "Edgar E. Iglesias" , Stefano Stabellini , "Michael S. Tsirkin" , Halil Pasic , Christian Borntraeger , =?utf-8?q?Herv=C3=A9_Poussi?= =?utf-8?q?neau?= , Anthony Perard , xen-devel@lists.xenproject.org, Leif Lindholm , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Thomas Huth , Eduardo Habkost , Mark Cave-Ayland , Alistair Francis , Richard Henderson , Greg Kurz , qemu-s390x@nongnu.org, qemu-arm@nongnu.org, David Gibson , =?utf-8?q?Daniel_Berrang=C3=A9?= , Radoslaw Biernacki , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= , qemu-ppc@nongnu.org, Cornelia Huck , Paolo Bonzini , Aurelien Jarno Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Do not let 'query-machines' return machines not valid with the current accelerator. Suggested-by: Daniel Berrangé Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Cornelia Huck --- hw/core/machine-qmp-cmds.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hw/core/machine-qmp-cmds.c b/hw/core/machine-qmp-cmds.c index 44e979e503b..c8630bc2ddc 100644 --- a/hw/core/machine-qmp-cmds.c +++ b/hw/core/machine-qmp-cmds.c @@ -204,6 +204,10 @@ MachineInfoList *qmp_query_machines(Error **errp) MachineClass *mc = el->data; MachineInfo *info; + if (!machine_class_valid_for_current_accelerator(mc)) { + continue; + } + info = g_malloc0(sizeof(*info)); if (mc->is_default) { info->has_is_default = true; From patchwork Fri Feb 19 17:38:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 12095957 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3A57CC433DB for ; Fri, 19 Feb 2021 17:49:09 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D601C64E86 for ; Fri, 19 Feb 2021 17:49:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D601C64E86 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:56748 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lD9ts-0004AU-1d for qemu-devel@archiver.kernel.org; Fri, 19 Feb 2021 12:49:08 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:49238) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lD9kP-0002le-7b for qemu-devel@nongnu.org; Fri, 19 Feb 2021 12:39:21 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:54619) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1lD9kM-0005WE-CU for qemu-devel@nongnu.org; Fri, 19 Feb 2021 12:39:20 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1613756357; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=CHXCPuc7uWQdwucv7FWJOUQ8ceg9IO3ZY73rXU3+wF0=; b=Q//+IvXATgpteRyAb5zA5a1N4Jbhh7Y/VARQF41rbKKoehBpCZYfXiN3A6qzJk5otpfWBT uw5m8qoBe1OPLYjujE3N/rS37CPpwruk1TvjrUAZsP+GZaWmypi55xt1xrlg28tmuTKSY9 cEK7Zj28mrsA6D3UfjtmIdRRfrUfZo0= Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-430-N4p_Rgt6NoGgGtrbyufGfA-1; Fri, 19 Feb 2021 12:39:14 -0500 X-MC-Unique: N4p_Rgt6NoGgGtrbyufGfA-1 Received: by mail-wr1-f70.google.com with SMTP id c16so934547wro.21 for ; Fri, 19 Feb 2021 09:39:14 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=CHXCPuc7uWQdwucv7FWJOUQ8ceg9IO3ZY73rXU3+wF0=; b=DRy1kqCKFgafyFFTox3v2awUNYBkiZwQQBQYIz0qgmnJ8hmmVwvk+ubs0+QAxVu7lo 7Gm/jGqfNn7+zAXNkwyjPRmxJMqPenYqpSccDd4cpWr3QHMAtJFc5WCr8jGEBpZUHTVj VZLtjqtxwK4kdro+tok0qDWmNX+m9cij+WsZcFGrapJGqXWh+ghAhl1DEa8lJTs866fF rgjxukYRUysxeinfyQ067Q4wXICgJP8Sod7zALm9sTIMeoTb9EtP4yWSv3pqWjWhpplc yPMCYhProPMuQs73LOyIOsAriHrIvbdNYEqm4gJmxy/vxE6Q94awelfH1YFw3ZzkbItC JLvA== X-Gm-Message-State: AOAM532NhbrbEJccP579757ji4ezEzqpcSf5XFbs7vMfE6NWF4W56ZOY Ho47yrzR8fP99g7POfRc1+TJVLy3YA/jlkFqvcOwSPZkoY37x9D5Mt4PA5jgxzBluNlgDTNO/Z9 sKFCzcFF4DTf5f1s+p2pXp1kIzr6T93BvglV3dX9H13CuDHWSINgbnpAZCzdfComS X-Received: by 2002:a05:6000:188c:: with SMTP id a12mr10610963wri.105.1613756353547; Fri, 19 Feb 2021 09:39:13 -0800 (PST) X-Google-Smtp-Source: ABdhPJwrzSzq1o4kGieINb1Q744LtUd4TVffu+lfi/YVrFtocFVQ1Ale5KqgmXk7Upte5EwmyzFbHA== X-Received: by 2002:a05:6000:188c:: with SMTP id a12mr10610915wri.105.1613756353383; Fri, 19 Feb 2021 09:39:13 -0800 (PST) Received: from localhost.localdomain (68.red-83-57-175.dynamicip.rima-tde.net. [83.57.175.68]) by smtp.gmail.com with ESMTPSA id q20sm12010000wmc.14.2021.02.19.09.39.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Feb 2021 09:39:12 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v2 04/11] hw/arm: Restrit KVM to the virt & versal machines Date: Fri, 19 Feb 2021 18:38:40 +0100 Message-Id: <20210219173847.2054123-5-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210219173847.2054123-1-philmd@redhat.com> References: <20210219173847.2054123-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=63.128.21.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Huacai Chen , kvm@vger.kernel.org, Paul Durrant , David Hildenbrand , Aleksandar Rikalo , "Edgar E. Iglesias" , Stefano Stabellini , "Michael S. Tsirkin" , Halil Pasic , Christian Borntraeger , =?utf-8?q?Herv=C3=A9_Poussi?= =?utf-8?q?neau?= , Anthony Perard , xen-devel@lists.xenproject.org, Leif Lindholm , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Thomas Huth , Eduardo Habkost , Mark Cave-Ayland , Alistair Francis , Richard Henderson , Greg Kurz , qemu-s390x@nongnu.org, qemu-arm@nongnu.org, David Gibson , Radoslaw Biernacki , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= , qemu-ppc@nongnu.org, Cornelia Huck , Paolo Bonzini , Aurelien Jarno Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Restrit KVM to the following ARM machines: - virt - xlnx-versal-virt Signed-off-by: Philippe Mathieu-Daudé --- hw/arm/virt.c | 5 +++++ hw/arm/xlnx-versal-virt.c | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/hw/arm/virt.c b/hw/arm/virt.c index 371147f3ae9..8e9861b61a9 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -2527,6 +2527,10 @@ static HotplugHandler *virt_machine_get_hotplug_handler(MachineState *machine, return NULL; } +static const char *const valid_accels[] = { + "tcg", "kvm", "hvf", NULL +}; + /* * for arm64 kvm_type [7-0] encodes the requested number of bits * in the IPA address space @@ -2582,6 +2586,7 @@ static void virt_machine_class_init(ObjectClass *oc, void *data) mc->cpu_index_to_instance_props = virt_cpu_index_to_props; mc->default_cpu_type = ARM_CPU_TYPE_NAME("cortex-a15"); mc->get_default_cpu_node_id = virt_get_default_cpu_node_id; + mc->valid_accelerators = valid_accels; mc->kvm_type = virt_kvm_type; assert(!mc->get_hotplug_handler); mc->get_hotplug_handler = virt_machine_get_hotplug_handler; diff --git a/hw/arm/xlnx-versal-virt.c b/hw/arm/xlnx-versal-virt.c index 8482cd61960..d424813cae1 100644 --- a/hw/arm/xlnx-versal-virt.c +++ b/hw/arm/xlnx-versal-virt.c @@ -610,6 +610,10 @@ static void versal_virt_machine_instance_init(Object *obj) { } +static const char *const valid_accels[] = { + "tcg", "kvm", NULL +}; + static void versal_virt_machine_class_init(ObjectClass *oc, void *data) { MachineClass *mc = MACHINE_CLASS(oc); @@ -621,6 +625,7 @@ static void versal_virt_machine_class_init(ObjectClass *oc, void *data) mc->default_cpus = XLNX_VERSAL_NR_ACPUS; mc->no_cdrom = true; mc->default_ram_id = "ddr"; + mc->valid_accelerators = valid_accels; } static const TypeInfo versal_virt_machine_init_typeinfo = { From patchwork Fri Feb 19 17:38:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 12095949 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2FF0BC433DB for ; Fri, 19 Feb 2021 17:46:14 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C844E64DEC for ; Fri, 19 Feb 2021 17:46:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C844E64DEC Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:49462 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lD9r2-0000WZ-F2 for qemu-devel@archiver.kernel.org; Fri, 19 Feb 2021 12:46:12 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:49370) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lD9ki-0002nd-Jp for qemu-devel@nongnu.org; Fri, 19 Feb 2021 12:39:41 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:39584) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1lD9kR-0005XC-84 for qemu-devel@nongnu.org; Fri, 19 Feb 2021 12:39:33 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1613756361; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ltjnESlJDd3H5QR2j8eiWOyKx9h8jJk2C0jWkjeNUew=; b=L3a9lXk5OZuki7MzffNLSQ0fbMjU1HoI4yglxA8NcJcptlEqqOKr1rmQp+FnIr3PKmabmt pzIPClFZ1iS9xuFt3rE8LcdYaS2Fg4Oc5NPDFhcJfsjXKYukXWzBSA3ufseQc32aDtyiKH d0FsvA9cyINzUlfjpvg3TPi6zf9GMtA= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-539-kzz0O2JUPRWity-TzV0ezA-1; Fri, 19 Feb 2021 12:39:20 -0500 X-MC-Unique: kzz0O2JUPRWity-TzV0ezA-1 Received: by mail-wr1-f72.google.com with SMTP id l3so1135409wrx.15 for ; Fri, 19 Feb 2021 09:39:20 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ltjnESlJDd3H5QR2j8eiWOyKx9h8jJk2C0jWkjeNUew=; b=CUpWSxLgRf4REoyNXtCNnRTMPf8eNhjEfQwvkJIGqX+yszhGWVquxVpsD1Gtpntnhi nEhtDYhv64YTZ9M09WPxzfKJlbk+OWtlKb+J8C4f0vr/zFjD2CbVOtFg3jt8mtUAqIzF 8UO8qSq+X/Es1TNAKbKK+SPVkNLk5siLIkqTY/YBD8QHw0g84JeadUw5+lUKqWBp51EH OPpDhZVzpr1vjmbj620IPUmW22inbWXby0cYFErcpQKDopzQwaoucwXdgV2LiuoEqWIC lVFc5cDzj/BPTjblOx7nOut6HuleaihE9OHaNebbAACLVjElfdUU87tCdXMOAyAjwV8Q YNOQ== X-Gm-Message-State: AOAM532xRKSl37NTocKz2YcA3rcBUxdLxmmDk6vylfGZ7U9nTexlR5ZC 8IH+rEUeY1+XsHzTIhOQtPIv+69D2CdSvw0w5URAAvPBWZ0mN5NLgWwRkytP9ifH+6KfTs3xCWg rFzO7jR+OJCY5JEO0iF2CHYOnwJb46rgx2sHs7akZQJcH6JNFt5vt79FY5tlGbw/G X-Received: by 2002:a5d:558b:: with SMTP id i11mr10341354wrv.125.1613756359057; Fri, 19 Feb 2021 09:39:19 -0800 (PST) X-Google-Smtp-Source: ABdhPJyksADAECUrKIFfE8NXfSBq0p9Yv0QU1jPKKdp6ensUX0SFo+MEZzOE/tMgXW9KlqBOatRsLw== X-Received: by 2002:a5d:558b:: with SMTP id i11mr10341310wrv.125.1613756358861; Fri, 19 Feb 2021 09:39:18 -0800 (PST) Received: from localhost.localdomain (68.red-83-57-175.dynamicip.rima-tde.net. [83.57.175.68]) by smtp.gmail.com with ESMTPSA id f7sm14534967wre.78.2021.02.19.09.39.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Feb 2021 09:39:18 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v2 05/11] hw/mips: Restrict KVM to the malta & virt machines Date: Fri, 19 Feb 2021 18:38:41 +0100 Message-Id: <20210219173847.2054123-6-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210219173847.2054123-1-philmd@redhat.com> References: <20210219173847.2054123-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=216.205.24.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Huacai Chen , kvm@vger.kernel.org, Paul Durrant , David Hildenbrand , Aleksandar Rikalo , "Edgar E. Iglesias" , Stefano Stabellini , "Michael S. Tsirkin" , Halil Pasic , Christian Borntraeger , =?utf-8?q?Herv=C3=A9_Poussi?= =?utf-8?q?neau?= , Anthony Perard , xen-devel@lists.xenproject.org, Leif Lindholm , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Thomas Huth , Eduardo Habkost , Mark Cave-Ayland , Alistair Francis , Richard Henderson , Greg Kurz , qemu-s390x@nongnu.org, qemu-arm@nongnu.org, David Gibson , Radoslaw Biernacki , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= , qemu-ppc@nongnu.org, Cornelia Huck , Paolo Bonzini , Aurelien Jarno Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Restrit KVM to the following MIPS machines: - malta - loongson3-virt Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Jiaxun Yang Reviewed-by: Huacai Chen --- hw/mips/loongson3_virt.c | 5 +++++ hw/mips/malta.c | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/hw/mips/loongson3_virt.c b/hw/mips/loongson3_virt.c index d4a82fa5367..c3679dff043 100644 --- a/hw/mips/loongson3_virt.c +++ b/hw/mips/loongson3_virt.c @@ -612,6 +612,10 @@ static void mips_loongson3_virt_init(MachineState *machine) loongson3_virt_devices_init(machine, liointc); } +static const char *const valid_accels[] = { + "tcg", "kvm", NULL +}; + static void loongson3v_machine_class_init(ObjectClass *oc, void *data) { MachineClass *mc = MACHINE_CLASS(oc); @@ -622,6 +626,7 @@ static void loongson3v_machine_class_init(ObjectClass *oc, void *data) mc->max_cpus = LOONGSON_MAX_VCPUS; mc->default_ram_id = "loongson3.highram"; mc->default_ram_size = 1600 * MiB; + mc->valid_accelerators = valid_accels; mc->kvm_type = mips_kvm_type; mc->minimum_page_bits = 14; } diff --git a/hw/mips/malta.c b/hw/mips/malta.c index 9afc0b427bf..0212048dc63 100644 --- a/hw/mips/malta.c +++ b/hw/mips/malta.c @@ -1443,6 +1443,10 @@ static const TypeInfo mips_malta_device = { .instance_init = mips_malta_instance_init, }; +static const char *const valid_accels[] = { + "tcg", "kvm", NULL +}; + static void mips_malta_machine_init(MachineClass *mc) { mc->desc = "MIPS Malta Core LV"; @@ -1456,6 +1460,7 @@ static void mips_malta_machine_init(MachineClass *mc) mc->default_cpu_type = MIPS_CPU_TYPE_NAME("24Kf"); #endif mc->default_ram_id = "mips_malta.ram"; + mc->valid_accelerators = valid_accels; } DEFINE_MACHINE("malta", mips_malta_machine_init) From patchwork Fri Feb 19 17:38:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 12095955 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3A643C4332D for ; Fri, 19 Feb 2021 17:48:55 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E0D0F64E86 for ; Fri, 19 Feb 2021 17:48:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E0D0F64E86 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:55742 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lD9te-0003jR-0x for qemu-devel@archiver.kernel.org; Fri, 19 Feb 2021 12:48:54 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:49408) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lD9kk-0002qG-MK for qemu-devel@nongnu.org; Fri, 19 Feb 2021 12:39:46 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:35664) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1lD9ka-0005Z8-UU for qemu-devel@nongnu.org; Fri, 19 Feb 2021 12:39:42 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1613756369; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Lw4bfUfCEZBd00BTMjyws6AoTKQiuLTiPv1ON4ccv74=; b=bC8+1d15noKWKx8Hh745rCDU4HZoLgZ63FobWXUUsj7+SAcwubcsmypKDkqTgOylNdtPtm P4hFStTViFqfv7hCZ+qC+blMi3ehAFZTISC81djndPrZbuY468grpX78lSqs76nuRdC4Yj D1XKjd/TqWb1c51yphRt2OgTNG0YVA8= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-439-zK-s3Y_jNJGJBwwKFd5jhg-1; Fri, 19 Feb 2021 12:39:26 -0500 X-MC-Unique: zK-s3Y_jNJGJBwwKFd5jhg-1 Received: by mail-wr1-f69.google.com with SMTP id x14so2174403wrr.13 for ; Fri, 19 Feb 2021 09:39:25 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Lw4bfUfCEZBd00BTMjyws6AoTKQiuLTiPv1ON4ccv74=; b=mdItbanFIJDqLmWEebmWpISjpS2ILMFBfXtAPMwv/CNcU90RTdxxY3cs5B7ezi3k+n QvFk30p/D9DniICWgwY+6ERdClrtuS6DUmn7SAnpyhbj8Ce84l3onGmRQNSsoZl+vgvM YxLM0+7swusLAfLu3qnmhTPNTUQHiJpZv6t4Tl39tOQDK7QiIrv7VKzlIp1WGGtOZ8eI dK3tpZG1q0RvGw1r0S4yJuZhO+opdQL130hcN5guModBjsWr3CoAJH+k4KKL2fGbeBfB Zn7RyKQPfNYpMo8TEk1dBnX+d6JahW8fIyH9TyoQfqY3qC1IXCOSBUFC0DoL1LQ5E0iO pdAQ== X-Gm-Message-State: AOAM531nomkAWurnFmqfznx1ZB/dze/AARAp1ViLgu/IeRKh7k7t1xpX BirYqj0+UU+23w0Km1rI9ubvP5653FZx0krMChqJHCmQQASvTCETFdkZbnzjqzitDY3iy8/UinL sBcKdYoPv1MlaFepyOzvsLNJ32XH7q7ru+RPXzTIFnfwyXdp/iG1BQvEYau7xwhut X-Received: by 2002:a1c:bb44:: with SMTP id l65mr8964776wmf.86.1613756364702; Fri, 19 Feb 2021 09:39:24 -0800 (PST) X-Google-Smtp-Source: ABdhPJxjqRkJ5Ff39xPwSCRnl3K5tBZjqMMFJ/FERHr0iybiVEhoAVRLgd8349suwi9XW5Y8/zboYw== X-Received: by 2002:a1c:bb44:: with SMTP id l65mr8964730wmf.86.1613756364447; Fri, 19 Feb 2021 09:39:24 -0800 (PST) Received: from localhost.localdomain (68.red-83-57-175.dynamicip.rima-tde.net. [83.57.175.68]) by smtp.gmail.com with ESMTPSA id v66sm12701902wme.33.2021.02.19.09.39.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Feb 2021 09:39:24 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [RFC PATCH v2 06/11] hw/ppc: Restrict KVM to various PPC machines Date: Fri, 19 Feb 2021 18:38:42 +0100 Message-Id: <20210219173847.2054123-7-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210219173847.2054123-1-philmd@redhat.com> References: <20210219173847.2054123-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=216.205.24.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Huacai Chen , kvm@vger.kernel.org, Paul Durrant , David Hildenbrand , Aleksandar Rikalo , "Edgar E. Iglesias" , Stefano Stabellini , "Michael S. Tsirkin" , Halil Pasic , Christian Borntraeger , =?utf-8?q?Herv=C3=A9_Poussi?= =?utf-8?q?neau?= , Anthony Perard , xen-devel@lists.xenproject.org, Leif Lindholm , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Thomas Huth , Eduardo Habkost , Mark Cave-Ayland , Alistair Francis , Richard Henderson , Greg Kurz , qemu-s390x@nongnu.org, qemu-arm@nongnu.org, David Gibson , Radoslaw Biernacki , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= , qemu-ppc@nongnu.org, Cornelia Huck , Paolo Bonzini , Aurelien Jarno Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Restrit KVM to the following PPC machines: - 40p - bamboo - g3beige - mac99 - mpc8544ds - ppce500 - pseries - sam460ex - virtex-ml507 Signed-off-by: Philippe Mathieu-Daudé --- RFC: I'm surprise by this list, but this is the result of auditing calls to kvm_enabled() checks. hw/ppc/e500plat.c | 5 +++++ hw/ppc/mac_newworld.c | 6 ++++++ hw/ppc/mac_oldworld.c | 5 +++++ hw/ppc/mpc8544ds.c | 5 +++++ hw/ppc/ppc440_bamboo.c | 5 +++++ hw/ppc/prep.c | 5 +++++ hw/ppc/sam460ex.c | 5 +++++ hw/ppc/spapr.c | 5 +++++ 8 files changed, 41 insertions(+) diff --git a/hw/ppc/e500plat.c b/hw/ppc/e500plat.c index bddd5e7c48f..9701dbc2231 100644 --- a/hw/ppc/e500plat.c +++ b/hw/ppc/e500plat.c @@ -67,6 +67,10 @@ HotplugHandler *e500plat_machine_get_hotpug_handler(MachineState *machine, #define TYPE_E500PLAT_MACHINE MACHINE_TYPE_NAME("ppce500") +static const char *const valid_accels[] = { + "tcg", "kvm", NULL +}; + static void e500plat_machine_class_init(ObjectClass *oc, void *data) { PPCE500MachineClass *pmc = PPCE500_MACHINE_CLASS(oc); @@ -98,6 +102,7 @@ static void e500plat_machine_class_init(ObjectClass *oc, void *data) mc->max_cpus = 32; mc->default_cpu_type = POWERPC_CPU_TYPE_NAME("e500v2_v30"); mc->default_ram_id = "mpc8544ds.ram"; + mc->valid_accelerators = valid_accels; machine_class_allow_dynamic_sysbus_dev(mc, TYPE_ETSEC_COMMON); } diff --git a/hw/ppc/mac_newworld.c b/hw/ppc/mac_newworld.c index e991db4addb..634f5ad19a0 100644 --- a/hw/ppc/mac_newworld.c +++ b/hw/ppc/mac_newworld.c @@ -578,6 +578,11 @@ static char *core99_fw_dev_path(FWPathProvider *p, BusState *bus, return NULL; } + +static const char *const valid_accels[] = { + "tcg", "kvm", NULL +}; + static int core99_kvm_type(MachineState *machine, const char *arg) { /* Always force PR KVM */ @@ -595,6 +600,7 @@ static void core99_machine_class_init(ObjectClass *oc, void *data) mc->max_cpus = MAX_CPUS; mc->default_boot_order = "cd"; mc->default_display = "std"; + mc->valid_accelerators = valid_accels; mc->kvm_type = core99_kvm_type; #ifdef TARGET_PPC64 mc->default_cpu_type = POWERPC_CPU_TYPE_NAME("970fx_v3.1"); diff --git a/hw/ppc/mac_oldworld.c b/hw/ppc/mac_oldworld.c index 44ee99be886..2c58f73b589 100644 --- a/hw/ppc/mac_oldworld.c +++ b/hw/ppc/mac_oldworld.c @@ -424,6 +424,10 @@ static char *heathrow_fw_dev_path(FWPathProvider *p, BusState *bus, return NULL; } +static const char *const valid_accels[] = { + "tcg", "kvm", NULL +}; + static int heathrow_kvm_type(MachineState *machine, const char *arg) { /* Always force PR KVM */ @@ -444,6 +448,7 @@ static void heathrow_class_init(ObjectClass *oc, void *data) #endif /* TOFIX "cad" when Mac floppy is implemented */ mc->default_boot_order = "cd"; + mc->valid_accelerators = valid_accels; mc->kvm_type = heathrow_kvm_type; mc->default_cpu_type = POWERPC_CPU_TYPE_NAME("750_v3.1"); mc->default_display = "std"; diff --git a/hw/ppc/mpc8544ds.c b/hw/ppc/mpc8544ds.c index 81177505f02..92b0e926c1b 100644 --- a/hw/ppc/mpc8544ds.c +++ b/hw/ppc/mpc8544ds.c @@ -36,6 +36,10 @@ static void mpc8544ds_init(MachineState *machine) ppce500_init(machine); } +static const char *const valid_accels[] = { + "tcg", "kvm", NULL +}; + static void e500plat_machine_class_init(ObjectClass *oc, void *data) { MachineClass *mc = MACHINE_CLASS(oc); @@ -56,6 +60,7 @@ static void e500plat_machine_class_init(ObjectClass *oc, void *data) mc->max_cpus = 15; mc->default_cpu_type = POWERPC_CPU_TYPE_NAME("e500v2_v30"); mc->default_ram_id = "mpc8544ds.ram"; + mc->valid_accelerators = valid_accels; } #define TYPE_MPC8544DS_MACHINE MACHINE_TYPE_NAME("mpc8544ds") diff --git a/hw/ppc/ppc440_bamboo.c b/hw/ppc/ppc440_bamboo.c index b156bcb9990..02501f489e4 100644 --- a/hw/ppc/ppc440_bamboo.c +++ b/hw/ppc/ppc440_bamboo.c @@ -298,12 +298,17 @@ static void bamboo_init(MachineState *machine) } } +static const char *const valid_accels[] = { + "tcg", "kvm", NULL +}; + static void bamboo_machine_init(MachineClass *mc) { mc->desc = "bamboo"; mc->init = bamboo_init; mc->default_cpu_type = POWERPC_CPU_TYPE_NAME("440epb"); mc->default_ram_id = "ppc4xx.sdram"; + mc->valid_accelerators = valid_accels; } DEFINE_MACHINE("bamboo", bamboo_machine_init) diff --git a/hw/ppc/prep.c b/hw/ppc/prep.c index 7e72f6e4a9b..90d884b0883 100644 --- a/hw/ppc/prep.c +++ b/hw/ppc/prep.c @@ -431,6 +431,10 @@ static void ibm_40p_init(MachineState *machine) } } +static const char *const valid_accels[] = { + "tcg", "kvm", NULL +}; + static void ibm_40p_machine_init(MachineClass *mc) { mc->desc = "IBM RS/6000 7020 (40p)", @@ -441,6 +445,7 @@ static void ibm_40p_machine_init(MachineClass *mc) mc->default_boot_order = "c"; mc->default_cpu_type = POWERPC_CPU_TYPE_NAME("604"); mc->default_display = "std"; + mc->valid_accelerators = valid_accels; } DEFINE_MACHINE("40p", ibm_40p_machine_init) diff --git a/hw/ppc/sam460ex.c b/hw/ppc/sam460ex.c index e459b43065b..79adb3352f0 100644 --- a/hw/ppc/sam460ex.c +++ b/hw/ppc/sam460ex.c @@ -506,6 +506,10 @@ static void sam460ex_init(MachineState *machine) boot_info->entry = entry; } +static const char *const valid_accels[] = { + "tcg", "kvm", NULL +}; + static void sam460ex_machine_init(MachineClass *mc) { mc->desc = "aCube Sam460ex"; @@ -513,6 +517,7 @@ static void sam460ex_machine_init(MachineClass *mc) mc->default_cpu_type = POWERPC_CPU_TYPE_NAME("460exb"); mc->default_ram_size = 512 * MiB; mc->default_ram_id = "ppc4xx.sdram"; + mc->valid_accelerators = valid_accels; } DEFINE_MACHINE("sam460ex", sam460ex_machine_init) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 85fe65f8947..c5f985f0187 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -4397,6 +4397,10 @@ static void spapr_cpu_exec_exit(PPCVirtualHypervisor *vhyp, PowerPCCPU *cpu) } } +static const char *const valid_accels[] = { + "tcg", "kvm", NULL +}; + static void spapr_machine_class_init(ObjectClass *oc, void *data) { MachineClass *mc = MACHINE_CLASS(oc); @@ -4426,6 +4430,7 @@ static void spapr_machine_class_init(ObjectClass *oc, void *data) mc->default_ram_size = 512 * MiB; mc->default_ram_id = "ppc_spapr.ram"; mc->default_display = "std"; + mc->valid_accelerators = valid_accels; mc->kvm_type = spapr_kvm_type; machine_class_allow_dynamic_sysbus_dev(mc, TYPE_SPAPR_PCI_HOST_BRIDGE); mc->pci_allow_0_address = true; From patchwork Fri Feb 19 17:38:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 12095959 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BB944C433E0 for ; Fri, 19 Feb 2021 17:51:03 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 330BF64DDC for ; Fri, 19 Feb 2021 17:51:03 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 330BF64DDC Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:33836 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lD9vi-0006fI-A7 for qemu-devel@archiver.kernel.org; Fri, 19 Feb 2021 12:51:02 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:49488) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lD9ko-0002sI-Vh for qemu-devel@nongnu.org; Fri, 19 Feb 2021 12:39:46 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:36656) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1lD9ki-0005a2-DW for qemu-devel@nongnu.org; Fri, 19 Feb 2021 12:39:44 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1613756373; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Ueqj+n2dHsbjBHuZ0Hoy+mZlGObPSK9klpKLOoZpu4Y=; b=gS9gFcTc29lGbzA9TGtZVJjmLZ2DsvalXDYrgj52AGPDcHgBajrLLeyCgYvrAsDq22wD2Z yYh/well8zumKHdE1ojLFP4vEAx9a6jtTV1YCt5DJt21rFSpTrOej321UaS07i1Cb8y40n brIBOS52mffkAzOKwl2pakdRhdy0AI4= Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-543-Md9tAcG2P7CUHRm2tvS5lw-1; Fri, 19 Feb 2021 12:39:32 -0500 X-MC-Unique: Md9tAcG2P7CUHRm2tvS5lw-1 Received: by mail-wr1-f70.google.com with SMTP id v18so485895wrr.8 for ; Fri, 19 Feb 2021 09:39:31 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Ueqj+n2dHsbjBHuZ0Hoy+mZlGObPSK9klpKLOoZpu4Y=; b=AzEcN6KfY9NdqovuU02ofKVVqmnbMtexW5ulsktegKbL8yesE0RcJoCBgRL0Cn5l7j nvMFAYVYQ5COw/q1Jis0UREoG997pCQ5iBo9/3q8s7gWNn3GbMItZ20gKcxp5uEsInmC Zi3mf1sprROjUMLec3THVk6itFn6w86WzrFyD4W0vps5ePEnCcsF1PpQR1+C6Gw/DvY/ zJlTDPFMNbSZVCnrDkAYe/I4zAxJQFi7tlPHt28UazIoXMPmP5v8Wv4PWyKpdXFBDpxG /L9n7vFNjIbkBFtCA+RCwXGkftoELngit3Ru6wjVmF2VEthnv7UO1qEITNj4QFb1qkgF YevQ== X-Gm-Message-State: AOAM5330RVrVpoEdKRBmauuow7LoGenl56/8ix740+Z/GNSgAbPBN03Z bvyjeuGJTTCC4FjxqZ8S02N1iv3BBbDQBo5se0ZqcgIO2nIJzDadN2WCea7oD38j8FOFIhKSZ5h z8Y386L2RljPfuIgclPwozgv56zaC3gXyENyt8xs2Xtsz+94ER51AyD+RHq+6Jkqb X-Received: by 2002:a1c:c90c:: with SMTP id f12mr9312032wmb.98.1613756370790; Fri, 19 Feb 2021 09:39:30 -0800 (PST) X-Google-Smtp-Source: ABdhPJyQVxSvgdKIkMYLk6jZPql9ZCAN0WXriT+5Nc8pY51dY+mHxFK5IkbcVQRBV0rvadWM1WYfTA== X-Received: by 2002:a1c:c90c:: with SMTP id f12mr9311979wmb.98.1613756370490; Fri, 19 Feb 2021 09:39:30 -0800 (PST) Received: from localhost.localdomain (68.red-83-57-175.dynamicip.rima-tde.net. [83.57.175.68]) by smtp.gmail.com with ESMTPSA id r12sm3052972wrt.69.2021.02.19.09.39.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Feb 2021 09:39:30 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v2 07/11] hw/s390x: Explicit the s390-ccw-virtio machines support TCG and KVM Date: Fri, 19 Feb 2021 18:38:43 +0100 Message-Id: <20210219173847.2054123-8-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210219173847.2054123-1-philmd@redhat.com> References: <20210219173847.2054123-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=216.205.24.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Huacai Chen , kvm@vger.kernel.org, Paul Durrant , David Hildenbrand , Aleksandar Rikalo , "Edgar E. Iglesias" , Stefano Stabellini , "Michael S. Tsirkin" , Halil Pasic , Christian Borntraeger , =?utf-8?q?Herv=C3=A9_Poussi?= =?utf-8?q?neau?= , Anthony Perard , xen-devel@lists.xenproject.org, Leif Lindholm , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Thomas Huth , Eduardo Habkost , Mark Cave-Ayland , Alistair Francis , Richard Henderson , Greg Kurz , qemu-s390x@nongnu.org, qemu-arm@nongnu.org, David Gibson , Radoslaw Biernacki , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= , qemu-ppc@nongnu.org, Cornelia Huck , Paolo Bonzini , Aurelien Jarno Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" All s390-ccw-virtio machines support TCG and KVM. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Cornelia Huck --- hw/s390x/s390-virtio-ccw.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c index 2972b607f36..1f168485066 100644 --- a/hw/s390x/s390-virtio-ccw.c +++ b/hw/s390x/s390-virtio-ccw.c @@ -586,6 +586,10 @@ static ram_addr_t s390_fixup_ram_size(ram_addr_t sz) return newsz; } +static const char *const valid_accels[] = { + "tcg", "kvm", NULL +}; + static void ccw_machine_class_init(ObjectClass *oc, void *data) { MachineClass *mc = MACHINE_CLASS(oc); @@ -612,6 +616,7 @@ static void ccw_machine_class_init(ObjectClass *oc, void *data) mc->possible_cpu_arch_ids = s390_possible_cpu_arch_ids; /* it is overridden with 'host' cpu *in kvm_arch_init* */ mc->default_cpu_type = S390_CPU_TYPE_NAME("qemu"); + mc->valid_accelerators = valid_accels; hc->plug = s390_machine_device_plug; hc->unplug_request = s390_machine_device_unplug_request; nc->nmi_monitor_handler = s390_nmi; From patchwork Fri Feb 19 17:38:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 12095987 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F0115C433DB for ; Fri, 19 Feb 2021 17:53:23 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 60E6F60C3D for ; Fri, 19 Feb 2021 17:53:23 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 60E6F60C3D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:40870 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lD9xy-0001IJ-AG for qemu-devel@archiver.kernel.org; Fri, 19 Feb 2021 12:53:22 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:49530) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lD9kq-0002xD-GY for qemu-devel@nongnu.org; Fri, 19 Feb 2021 12:39:48 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:47335) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1lD9km-0005b8-Ph for qemu-devel@nongnu.org; Fri, 19 Feb 2021 12:39:48 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1613756381; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0XNpw7EsZwRfqH5jj+d5q0K26B/2H8ocJXujjf2y0q0=; b=RDQEjTRLZTWO2mxBVuE+CjuwWYnePnPDhe8EbBtHCO5ciJX6yb2P6dMZLwdDp105DHn+43 Wv5sAUTAyloJyAW4gJabhwg3ByiTlGol+azzEp4iDiIbEuA8TSWDwMwzJ4m3WXVtyG3h8Q DTITpNp4g3ky6p7qnB3q5/xLThu8hm0= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-521-sh_GMLRLMjOS0ZtzegpcLw-1; Fri, 19 Feb 2021 12:39:38 -0500 X-MC-Unique: sh_GMLRLMjOS0ZtzegpcLw-1 Received: by mail-wm1-f71.google.com with SMTP id y18so2778485wma.8 for ; Fri, 19 Feb 2021 09:39:38 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=0XNpw7EsZwRfqH5jj+d5q0K26B/2H8ocJXujjf2y0q0=; b=c7YASDI4EpNeVRfnA1IKBODy7MDe/qVo19gE+XeW4A6GzqNOy52OcAZq/Qj/yIO6/B Oc1ZJDxCU372aYJ7V3d+L+FNc9U4tyaaFJ52Ee6AMsRHqoYRVCvfhkfcQ3dv5PaFbbrN +0SExT/+avvfHMW+PtCgjm0Zcj/sYqNnqq3H8XiVnbdnyLD9lHgyaAaBFBDDtgtWeWv6 oZVAf+xcuKT6WLGmgRDEW1i6tFQi7KCsBQmgtMlbQHI2f5VHY11CkfFzI0vejUn7ROnM jZf+m061VOcTZcqy7O1dOPgDbN1x3t/Ng1E35KLHqDALd54ksGHp2HJ9Fl8ML7JLv/FR F0aQ== X-Gm-Message-State: AOAM531z52c8O8+CL5sIlZFIjNW8kEQIJWSL6xEQPGuKI9yHB3OwT949 xSTWy5YrRVMzPHY1UCTFkWJrrL1wdABm7XgySDYwD8LPsaIF+kfWirGA9qOXFWB9CfwmklTsLps Wd3Qw5vF27gWibRVkqhZKTZwXAeJkdVEy/oITaWh5f/W84x44K+8OYtupYfXLga3U X-Received: by 2002:adf:fb91:: with SMTP id a17mr10124663wrr.93.1613756377041; Fri, 19 Feb 2021 09:39:37 -0800 (PST) X-Google-Smtp-Source: ABdhPJwUWYk16cfFnjfBZLMWl2Vy5aAjSJDcFd3Zrj54+kp+HHEcqph2ioitLZ00EdqyQhCQF2e9eA== X-Received: by 2002:adf:fb91:: with SMTP id a17mr10124607wrr.93.1613756376757; Fri, 19 Feb 2021 09:39:36 -0800 (PST) Received: from localhost.localdomain (68.red-83-57-175.dynamicip.rima-tde.net. [83.57.175.68]) by smtp.gmail.com with ESMTPSA id c133sm2365046wme.46.2021.02.19.09.39.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Feb 2021 09:39:36 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [RFC PATCH v2 08/11] hw/i386: Explicit x86 machines support all current accelerators Date: Fri, 19 Feb 2021 18:38:44 +0100 Message-Id: <20210219173847.2054123-9-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210219173847.2054123-1-philmd@redhat.com> References: <20210219173847.2054123-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=216.205.24.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Huacai Chen , kvm@vger.kernel.org, Paul Durrant , David Hildenbrand , Aleksandar Rikalo , "Edgar E. Iglesias" , Stefano Stabellini , "Michael S. Tsirkin" , Halil Pasic , Christian Borntraeger , =?utf-8?q?Herv=C3=A9_Poussi?= =?utf-8?q?neau?= , Anthony Perard , xen-devel@lists.xenproject.org, Leif Lindholm , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Thomas Huth , Eduardo Habkost , Mark Cave-Ayland , Alistair Francis , Richard Henderson , Greg Kurz , qemu-s390x@nongnu.org, qemu-arm@nongnu.org, David Gibson , Radoslaw Biernacki , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= , qemu-ppc@nongnu.org, Cornelia Huck , Paolo Bonzini , Aurelien Jarno Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" x86 machines currently support all accelerators. Signed-off-by: Philippe Mathieu-Daudé --- RFC: not sure about this, x86 is not my cup of tea hw/i386/x86.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/hw/i386/x86.c b/hw/i386/x86.c index 6329f90ef90..2dc10e7d386 100644 --- a/hw/i386/x86.c +++ b/hw/i386/x86.c @@ -1209,6 +1209,10 @@ static void x86_machine_initfn(Object *obj) x86ms->pci_irq_mask = ACPI_BUILD_PCI_IRQS; } +static const char *const valid_accels[] = { + "tcg", "kvm", "xen", "hax", "hvf", "whpx", NULL +}; + static void x86_machine_class_init(ObjectClass *oc, void *data) { MachineClass *mc = MACHINE_CLASS(oc); @@ -1218,6 +1222,7 @@ static void x86_machine_class_init(ObjectClass *oc, void *data) mc->cpu_index_to_instance_props = x86_cpu_index_to_props; mc->get_default_cpu_node_id = x86_get_default_cpu_node_id; mc->possible_cpu_arch_ids = x86_possible_cpu_arch_ids; + mc->valid_accelerators = valid_accels; x86mc->compat_apic_id_mode = false; x86mc->save_tsc_khz = true; nc->nmi_monitor_handler = x86_nmi; From patchwork Fri Feb 19 17:38:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 12095985 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EAF5CC43381 for ; Fri, 19 Feb 2021 17:52:25 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7875664EC7 for ; Fri, 19 Feb 2021 17:52:25 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7875664EC7 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:37032 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lD9x2-00085R-9k for qemu-devel@archiver.kernel.org; Fri, 19 Feb 2021 12:52:24 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:49552) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lD9kr-00030Q-Pt for qemu-devel@nongnu.org; Fri, 19 Feb 2021 12:39:49 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:45044) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1lD9ko-0005hX-My for qemu-devel@nongnu.org; Fri, 19 Feb 2021 12:39:49 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1613756385; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=m89dmrSplgkgoyBA9XFoMMYsKZX69TbxEanq9oDkcW0=; b=JEKKxhMc4fPJKMm8IN1nbv2+K5pOJGMwCJpYZ3by1SgsbEYLRuEpDK//Q2ZmcQHmTlZe5h 0pVMeyHrg6cpiUfX90g3lutN3L4jh+VYpMbz12nyaUoBkiAs7aw68Qdhu8VkoWFUJYhe0+ Cc7PtECKSByiWWyKTW/d6gqn9e9Nxqo= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-284-u8Gt22P0OaC9GMMfnzOgdw-1; Fri, 19 Feb 2021 12:39:43 -0500 X-MC-Unique: u8Gt22P0OaC9GMMfnzOgdw-1 Received: by mail-wm1-f69.google.com with SMTP id o18so1443053wmq.2 for ; Fri, 19 Feb 2021 09:39:43 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=m89dmrSplgkgoyBA9XFoMMYsKZX69TbxEanq9oDkcW0=; b=FsQ/qJwCmJtUpIq81Kz739noFhMOivi0h/oizOOmKy0Wom0whLHRHsvsKbCe8mmHJ4 nqs5XwNlK2OBTGMce0WV/OH0oS7+PJwz65ROrSCMRPS0HJpUNm8ZMJRoDAk3LKZX1mNq 5N1us2tgXDfsdZvOxPoI5LR5oS2WV4ogZ4A0b1PqXmHcIPAwS8vOgG2xzx2aZosjoNkJ 5AjKbFYDja9MV5VD4lqXEMEWbRUtsM74c1OTcX3L/QzOI9pZ2KuMJBaVp6teeN0NcaND Ualmb+LAniXNeVgnH+yi3otPvPbCNGHpu0+rNsDgPcL+G3MpMhyGH8kMIZ9/cAQrzK4K dXZQ== X-Gm-Message-State: AOAM530whxnTFn4TK2EDDJdCRMcDwZWOTB6/Y7/6s1BaZIZeAL0OgUEU RgZvYEQvii5noZ7GPJPStpm8oLpvgEwwbIMF/z9k4VP9A9bgMoHX1aKtIZt42I4C3bm2lWYN93Z EDw/Zq5aegiB6yb8J4D8QRED8Metje4JTbhBoqGSKVrTzVjcQ5bGhe7tvyU5fOdY9 X-Received: by 2002:a1c:c6:: with SMTP id 189mr9272338wma.128.1613756382399; Fri, 19 Feb 2021 09:39:42 -0800 (PST) X-Google-Smtp-Source: ABdhPJyfL/zeX1Twd/41yRwfBzbYwswnUhtDRMBecaJ3a8NHeinaw0+wzScyZWOOrq01liX3KOGGMQ== X-Received: by 2002:a1c:c6:: with SMTP id 189mr9272291wma.128.1613756382214; Fri, 19 Feb 2021 09:39:42 -0800 (PST) Received: from localhost.localdomain (68.red-83-57-175.dynamicip.rima-tde.net. [83.57.175.68]) by smtp.gmail.com with ESMTPSA id b72sm13082236wmd.4.2021.02.19.09.39.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Feb 2021 09:39:41 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v2 09/11] hw/xenpv: Restrict Xen Para-virtualized machine to Xen accelerator Date: Fri, 19 Feb 2021 18:38:45 +0100 Message-Id: <20210219173847.2054123-10-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210219173847.2054123-1-philmd@redhat.com> References: <20210219173847.2054123-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=63.128.21.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Huacai Chen , kvm@vger.kernel.org, Paul Durrant , David Hildenbrand , Aleksandar Rikalo , "Edgar E. Iglesias" , Stefano Stabellini , "Michael S. Tsirkin" , Halil Pasic , Christian Borntraeger , =?utf-8?q?Herv=C3=A9_Poussi?= =?utf-8?q?neau?= , Anthony Perard , xen-devel@lists.xenproject.org, Leif Lindholm , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Thomas Huth , Eduardo Habkost , Mark Cave-Ayland , Alistair Francis , Richard Henderson , Greg Kurz , qemu-s390x@nongnu.org, qemu-arm@nongnu.org, David Gibson , Radoslaw Biernacki , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= , qemu-ppc@nongnu.org, Cornelia Huck , Paolo Bonzini , Aurelien Jarno Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" When started with other accelerator than Xen, the XenPV machine fails with a criptic message: $ qemu-system-x86_64 -M xenpv,accel=kvm xen be core: can't connect to xenstored qemu-system-x86_64: xen_init_pv: xen backend core setup failed By restricting it to Xen, we display a clearer error message: $ qemu-system-x86_64 -M xenpv,accel=kvm qemu-system-x86_64: invalid accelerator 'kvm' for machine xenpv Signed-off-by: Philippe Mathieu-Daudé Acked-by: Paul Durrant --- hw/xenpv/xen_machine_pv.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/hw/xenpv/xen_machine_pv.c b/hw/xenpv/xen_machine_pv.c index 8df575a457c..d7747bcec98 100644 --- a/hw/xenpv/xen_machine_pv.c +++ b/hw/xenpv/xen_machine_pv.c @@ -86,12 +86,17 @@ static void xen_init_pv(MachineState *machine) atexit(xen_config_cleanup); } +static const char *valid_accels[] = { + "xen", NULL +}; + static void xenpv_machine_init(MachineClass *mc) { mc->desc = "Xen Para-virtualized PC"; mc->init = xen_init_pv; mc->max_cpus = 1; mc->default_machine_opts = "accel=xen"; + mc->valid_accelerators = valid_accels; } DEFINE_MACHINE("xenpv", xenpv_machine_init) From patchwork Fri Feb 19 17:38:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 12095995 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BE646C433DB for ; Fri, 19 Feb 2021 17:57:28 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3CD4764DED for ; Fri, 19 Feb 2021 17:57:28 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3CD4764DED Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:49012 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lDA1r-00052q-K7 for qemu-devel@archiver.kernel.org; Fri, 19 Feb 2021 12:57:27 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:49652) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lD9kv-0003C3-Mx for qemu-devel@nongnu.org; Fri, 19 Feb 2021 12:39:53 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:48632) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1lD9kt-0005ji-TA for qemu-devel@nongnu.org; Fri, 19 Feb 2021 12:39:53 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1613756391; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=23DXGFBg27YE0s/hCFn43oTEX31jOtnU+ISUArv5+bE=; b=EKjm6U6bY70wuhb3vqQGR0Dvq4DkQm+EDbhBjkhqCZglaKi2kBY4U0AWXtIJSVUuX/58Yn RQgzII0JbRNuCnwWXWwtBHEN+Ws0ecKeDdCLOQgu5FUVD7Xck0TGAroIx+0v6u28C2D/JD eI07p4PyhgiGh74tN4QNTrtPlgrCQ0k= Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-472-sw-QugbvOCiLU9DgZJM50Q-1; Fri, 19 Feb 2021 12:39:49 -0500 X-MC-Unique: sw-QugbvOCiLU9DgZJM50Q-1 Received: by mail-wr1-f71.google.com with SMTP id l3so1135889wrx.15 for ; Fri, 19 Feb 2021 09:39:49 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=23DXGFBg27YE0s/hCFn43oTEX31jOtnU+ISUArv5+bE=; b=ma/ZmOhfZNCOfB2GTbuPw0WhxsDp73SsTorjfLlhQ4SqvtyO1To26MgBRJn8IAv72l yzm1/S+/fHuhiezK2T4yNIcV1ytfFgS43+YCdLV+ozfSwOJDghHDQlxeja3H/kJNAcLg AKbLUSszX9ZDdbO24VHWziN/5Y2UHT66zda9QoSApJJCmniLQjEpNElgNbKOPGT90iqe DsMBhdBxsERQQAflMy5K3t6kmR3DOBugYEDKiWMwebnQGY8YQB1wVfDMML3AYCrEJOtY DTuqAIxe7LInHUiaRsWX+O399c4wwjQns2eeV3gPW7eeBAO7cPoESkb4J77KZym6WMd+ ECAg== X-Gm-Message-State: AOAM533NH6dsXrvMeK1ueF/qQ5lW/WUjXGfm1wXmYGVALbq9gEUR3lPG fLfBxWlA86ar3TIS+C7T8o3gT0uZXV4FBI8kFmZnh6hKPwMcRMkuaTB6f0R8r/vB0AVbL03cBeA LdeERuqQTw3KnlZDu4+2H16Bj2X3A+CID0zVHetTxkeAdv+wWBKS2RJj3uyB1n5Xq X-Received: by 2002:a7b:c095:: with SMTP id r21mr3049575wmh.48.1613756387978; Fri, 19 Feb 2021 09:39:47 -0800 (PST) X-Google-Smtp-Source: ABdhPJxiAWfgHRpHyAW3kKe8U38bgrZikJVMduVGw3sP0TrSilsr1/3Kg29a0ZDcfjt7MheizWAw2g== X-Received: by 2002:a7b:c095:: with SMTP id r21mr3049522wmh.48.1613756387730; Fri, 19 Feb 2021 09:39:47 -0800 (PST) Received: from localhost.localdomain (68.red-83-57-175.dynamicip.rima-tde.net. [83.57.175.68]) by smtp.gmail.com with ESMTPSA id v9sm9098392wrn.86.2021.02.19.09.39.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Feb 2021 09:39:47 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v2 10/11] hw/board: Only allow TCG accelerator by default Date: Fri, 19 Feb 2021 18:38:46 +0100 Message-Id: <20210219173847.2054123-11-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210219173847.2054123-1-philmd@redhat.com> References: <20210219173847.2054123-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=63.128.21.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Huacai Chen , kvm@vger.kernel.org, Paul Durrant , David Hildenbrand , Aleksandar Rikalo , "Edgar E. Iglesias" , Stefano Stabellini , "Michael S. Tsirkin" , Halil Pasic , Christian Borntraeger , =?utf-8?q?Herv=C3=A9_Poussi?= =?utf-8?q?neau?= , Anthony Perard , xen-devel@lists.xenproject.org, Leif Lindholm , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Thomas Huth , Eduardo Habkost , Mark Cave-Ayland , Alistair Francis , Richard Henderson , Greg Kurz , qemu-s390x@nongnu.org, qemu-arm@nongnu.org, David Gibson , Radoslaw Biernacki , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= , qemu-ppc@nongnu.org, Cornelia Huck , Paolo Bonzini , Aurelien Jarno Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" By default machines can only use the TCG and QTest accelerators. If a machine can use another accelerator, it has to explicitly list it in its MachineClass valid_accelerators[]. Signed-off-by: Philippe Mathieu-Daudé --- include/hw/boards.h | 4 ++-- hw/core/machine.c | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/include/hw/boards.h b/include/hw/boards.h index 4d08bc12093..b93d290b348 100644 --- a/include/hw/boards.h +++ b/include/hw/boards.h @@ -146,8 +146,8 @@ typedef struct { * @valid_accelerators: * If this machine supports a specific set of virtualization accelerators, * this contains a NULL-terminated list of the accelerators that can be - * used. If this field is not set, any accelerator is valid. The QTest - * accelerator is always valid. + * used. If this field is not set, a default list containing only the TCG + * accelerator is used. The QTest accelerator is always valid. * @kvm_type: * Return the type of KVM corresponding to the kvm-type string option or * computed based on other criteria such as the host kernel capabilities diff --git a/hw/core/machine.c b/hw/core/machine.c index c42d8e382b1..ca7c9ee2a0c 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -520,11 +520,11 @@ static void machine_set_nvdimm_persistence(Object *obj, const char *value, bool machine_class_valid_for_accelerator(MachineClass *mc, const char *acc_name) { - const char *const *name = mc->valid_accelerators; + static const char *const default_accels[] = { + "tcg", NULL + }; + const char *const *name = mc->valid_accelerators ? : default_accels; - if (!name) { - return true; - } if (strcmp(acc_name, "qtest") == 0) { return true; } From patchwork Fri Feb 19 17:38:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 12095989 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 999ECC433DB for ; Fri, 19 Feb 2021 17:55:20 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1212C64DEC for ; Fri, 19 Feb 2021 17:55:20 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1212C64DEC Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:44638 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lD9zr-00031J-19 for qemu-devel@archiver.kernel.org; Fri, 19 Feb 2021 12:55:19 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:49716) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lD9l1-0003P8-5e for qemu-devel@nongnu.org; Fri, 19 Feb 2021 12:39:59 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:59833) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1lD9kz-0005mW-8w for qemu-devel@nongnu.org; Fri, 19 Feb 2021 12:39:58 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1613756396; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=LKRfXZiJfNSqbVRL/SaOx1v+Z64xt5w41cSycQqYFFE=; b=GTGuLyHKA7H+YnH3Uu3iTtQ+U1LQZZw8r8pYOHnpZIL03nQP/p49zvNtTr6DDEs+FfO339 MlUeC5k7DORyMQkrLc5Ffofic0/gm+cTparvBsgSG96kk7xy4dAxk/7soqzmcnKrFr6BRW FxV1xpM60TxLOKkb6qZSbqJXVYTiFtQ= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-576-gk_WQwzePlSdcLjKBZH8bg-1; Fri, 19 Feb 2021 12:39:55 -0500 X-MC-Unique: gk_WQwzePlSdcLjKBZH8bg-1 Received: by mail-wr1-f69.google.com with SMTP id d10so2748662wrq.17 for ; Fri, 19 Feb 2021 09:39:54 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=LKRfXZiJfNSqbVRL/SaOx1v+Z64xt5w41cSycQqYFFE=; b=duSr9eEx3Zj9ndd6Ul45AK1fLJzHshfFka+NK1L4VL4QsbvviJoyM9e3/htHcib88F csVfMhc4WtiTpfYPZzF61dvrqbNkpgQdLoGsA776GYv7r89GR08j0afW7wzNp+0lZyfP bwO2XJlcBRppnhxsczSi70zDxWQCj7lEow2sn+jY+PRfT1pbcZPIlV88inCoSLxxGDSA 3HPSdCSV96yzuhPm1N4gc3oLVfyY1l+CJCF8J1Qw1TghLWTkOpzw+pXV75SbRwCBMe6t pLgZONxYzJK3+T1Sp6/QaFajFcs3blwdMo/MOcN4Qf+az/Rr17eiQ8fXxYDL8/YulJlK OwVg== X-Gm-Message-State: AOAM530b/rqjBrc7C9nblhimoGR5R8FuUlj9xItXQmAUQC/MJ3roYP2E lQ0i/mvUsY+USYRkx/Pts6h9z3SzCq82fDdMbs/TGs0lWwPU7OuyorC/D88Kjy/NQZgpf+WqqTJ LnEfOWbiNSgtaSZBsUnOObEQ0tqyyTqWdh4dmiN030wR+iWNHBLmHXrOWTqmVveIU X-Received: by 2002:a1c:4c03:: with SMTP id z3mr9342140wmf.82.1613756393712; Fri, 19 Feb 2021 09:39:53 -0800 (PST) X-Google-Smtp-Source: ABdhPJx2yrJUDqwa1ymG/2RErXjJWx3WIzkQzNQF90+7ijmcN7yAwa2G2hjcHhwa/T8ilbMl1bPCyw== X-Received: by 2002:a1c:4c03:: with SMTP id z3mr9342087wmf.82.1613756393314; Fri, 19 Feb 2021 09:39:53 -0800 (PST) Received: from localhost.localdomain (68.red-83-57-175.dynamicip.rima-tde.net. [83.57.175.68]) by smtp.gmail.com with ESMTPSA id r7sm15304999wre.25.2021.02.19.09.39.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Feb 2021 09:39:52 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v2 11/11] softmmu/vl: Exit gracefully when accelerator is not supported Date: Fri, 19 Feb 2021 18:38:47 +0100 Message-Id: <20210219173847.2054123-12-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210219173847.2054123-1-philmd@redhat.com> References: <20210219173847.2054123-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=63.128.21.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Huacai Chen , kvm@vger.kernel.org, Paul Durrant , David Hildenbrand , Aleksandar Rikalo , "Edgar E. Iglesias" , Stefano Stabellini , "Michael S. Tsirkin" , Halil Pasic , Christian Borntraeger , =?utf-8?q?Herv=C3=A9_Poussi?= =?utf-8?q?neau?= , Anthony Perard , xen-devel@lists.xenproject.org, Leif Lindholm , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Thomas Huth , Eduardo Habkost , Mark Cave-Ayland , Alistair Francis , Richard Henderson , Greg Kurz , qemu-s390x@nongnu.org, qemu-arm@nongnu.org, David Gibson , Radoslaw Biernacki , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= , qemu-ppc@nongnu.org, Cornelia Huck , Paolo Bonzini , Aurelien Jarno Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Before configuring an accelerator, check it is valid for the current machine. Doing so we can return a simple error message instead of criptic one. Before: $ qemu-system-arm -M raspi2b -enable-kvm qemu-system-arm: /build/qemu-ETIdrs/qemu-4.2/exec.c:865: cpu_address_space_init: Assertion `asidx == 0 || !kvm_enabled()' failed. Aborted $ qemu-system-aarch64 -M xlnx-zcu102 -enable-kvm -smp 6 qemu-system-aarch64: kvm_init_vcpu: kvm_arch_init_vcpu failed (0): Invalid argument After: $ qemu-system-arm -M raspi2b -enable-kvm qemu-system-aarch64: invalid accelerator 'kvm' for machine raspi2b $ qemu-system-aarch64 -M xlnx-zcu102 -enable-kvm -smp 6 qemu-system-aarch64: -accel kvm: invalid accelerator 'kvm' for machine xlnx-zcu102 Signed-off-by: Philippe Mathieu-Daudé --- softmmu/vl.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/softmmu/vl.c b/softmmu/vl.c index b219ce1f357..f2c4074310b 100644 --- a/softmmu/vl.c +++ b/softmmu/vl.c @@ -2133,6 +2133,7 @@ static int do_configure_accelerator(void *opaque, QemuOpts *opts, Error **errp) const char *acc = qemu_opt_get(opts, "accel"); AccelClass *ac = accel_find(acc); AccelState *accel; + MachineClass *mc; int ret; bool qtest_with_kvm; @@ -2145,6 +2146,12 @@ static int do_configure_accelerator(void *opaque, QemuOpts *opts, Error **errp) } return 0; } + mc = MACHINE_GET_CLASS(current_machine); + if (!qtest_chrdev && !machine_class_valid_for_accelerator(mc, ac->name)) { + *p_init_failed = true; + error_report("invalid accelerator '%s' for machine %s", acc, mc->name); + return 0; + } accel = ACCEL(object_new_with_class(OBJECT_CLASS(ac))); object_apply_compat_props(OBJECT(accel)); qemu_opt_foreach(opts, accelerator_set_property,