From nobody Fri May 3 16:06:18 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1613756340456135.0446525552826; Fri, 19 Feb 2021 09:39:00 -0800 (PST) Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-603-bNuaoQvZOdiq1RJoUjBqFQ-1; Fri, 19 Feb 2021 12:38:57 -0500 Received: by mail-wm1-f70.google.com with SMTP id s192so2789418wme.6 for ; Fri, 19 Feb 2021 09:38:57 -0800 (PST) Return-Path: Return-Path: 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) 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= X-MC-Unique: bNuaoQvZOdiq1RJoUjBqFQ-1 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=Ecr98jZjNb+imlRC1bKHnk6vW2wrgo+moN1WHNaKATvYgL5CS/Aw57tBfaddAQO8Ao 2crN+dMp6DyXk0vQ5l1dzb8YdsXDMfiXuCbUMUpI8cC62S4qj74IZ+nXjtKFrPswkiJD XMT0y7Taklb4CbKwVV59+QJrxowYNeVPyk0ytCRrdHpOipd8UIhWCWktfdoh5EEC8lML ApotE9KE7dfuDFzT5L9z6KO2x68OvROkjcTARsrcdrSolWklHq4cEyIzqgpRxdC0aIti 783uL/Dt5Lyk2wOh0qY9iaEDR1kNhRMZ3XGveiqoWIomYFozsOuY0OsIbbgo7QWQ4mVy K4Kg== X-Gm-Message-State: AOAM530GdluEp1/1zvN7Wr9wAP3Q780lt3xTrmNy5nrKMH/Hv0KLb+R+ NYq3MQ5+f/vl4VmvnrOs8zVybMygW/WTM84YQSEbK1hAuGKSj9UNYU5fx8UWMPMpGO04QD4RSKo 20IvDwyQZkFr09Q== X-Received: by 2002:adf:b60f:: with SMTP id f15mr10395970wre.83.1613756336823; 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) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Aurelien Jarno , Peter Maydell , Anthony Perard , qemu-ppc@nongnu.org, qemu-s390x@nongnu.org, Halil Pasic , Huacai Chen , xen-devel@lists.xenproject.org, Marcel Apfelbaum , David Gibson , qemu-arm@nongnu.org, Stefano Stabellini , Paolo Bonzini , kvm@vger.kernel.org, BALATON Zoltan , Leif Lindholm , Richard Henderson , Radoslaw Biernacki , Alistair Francis , Paul Durrant , Eduardo Habkost , "Michael S. Tsirkin" , Thomas Huth , Jiaxun Yang , =?UTF-8?q?Herv=C3=A9=20Poussineau?= , Greg Kurz , Christian Borntraeger , Cornelia Huck , "Edgar E. Iglesias" , David Hildenbrand , Mark Cave-Ayland , Aleksandar Rikalo , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= 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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) MachineClass::kvm_type() can return -1 on failure. Document it, and add a check in kvm_init(). Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- 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 capabilitie= s. + * 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 =3D mc->kvm_type(ms, kvm_type); + if (type < 0) { + ret =3D -EINVAL; + fprintf(stderr, "Failed to detect kvm-type for machine '%s'\n", + mc->name); + goto err; + } } =20 do { --=20 2.26.2 From nobody Fri May 3 16:06:18 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1613756361; cv=none; d=zohomail.com; s=zohoarc; b=P4ujlszGJ2CMnaSDBQArlyqp6v/D5elQij7rawhrYIP1mOVdCXIDmyoSOM1/0vJ7GwNBXNvQNwXlOSOXa+Qabg4offyPfwvX3/r/fNY4/pkMiIzK8Q6hnyzu8KN4J9NAyisAfgw5R/CF/4giJuFbVIlp98DGbkqG5kOuiCRPXtg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1613756361; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=cia92nKBjrGhWlmymfB9YbxEpc3m+J7hFEI/efRN2yM=; b=JdhXlbbwNseC3uY4mKjxBGexjn3bYm8UvOgoI8W8WIbHptkDBEpWnIKSPB3kalWQOMpNgxXtEYs0R5lghGS2oKC2BGL/MYofEPyIpcWu+wD1SP+Z/Ake3nbm5rijv12i8F5h1DlzX8crsBsnBZ0fKkD/zYhNDXKTP1N30S+Q9Pc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1613756361303145.85133193012462; Fri, 19 Feb 2021 09:39:21 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.87025.163960 (Exim 4.92) (envelope-from ) id 1lD9kC-0000eN-CA; Fri, 19 Feb 2021 17:39:08 +0000 Received: by outflank-mailman (output) from mailman id 87025.163960; Fri, 19 Feb 2021 17:39:08 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lD9kC-0000eF-8Z; Fri, 19 Feb 2021 17:39:08 +0000 Received: by outflank-mailman (input) for mailman id 87025; Fri, 19 Feb 2021 17:39:06 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lD9kA-0000XE-EA for xen-devel@lists.xenproject.org; Fri, 19 Feb 2021 17:39:06 +0000 Received: from us-smtp-delivery-124.mimecast.com (unknown [63.128.21.124]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTP id 257d245b-316b-4a44-8beb-86ed9a86aa32; Fri, 19 Feb 2021 17:39:05 +0000 (UTC) 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-190-3Q6zqInTO2egoMIp4B7lXQ-1; Fri, 19 Feb 2021 12:39:03 -0500 Received: by mail-wr1-f71.google.com with SMTP id o10so2762328wru.11 for ; Fri, 19 Feb 2021 09:39:03 -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) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 257d245b-316b-4a44-8beb-86ed9a86aa32 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= X-MC-Unique: 3Q6zqInTO2egoMIp4B7lXQ-1 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=kJ9e1etS4jlgapkwjeohMP6j1h5L+amFT1yjMqDGbITuXw+Pw9UtFhy4n9Ea4S8z+Y 3bI2q7xOmnkZOFryqSNxSXpC8PkQAq7VKMbiqmTomm/rm1tEtklVxNUMhT8fIfBViFi/ h0oT+nAmaojLQF/H/9WaNEAWOFSX7AZbpREMIb/eAsRZeV6A9/jdUKhklrzieRWHAGDZ IG6ao7j4Hkxg/zlIm/nGWeLiZncj8pKRTZGYL+lPdPL6AnowJoOTrcW8Qg7jwP2L7dG1 JaHFvDtjRpmZsCAqs9HlJrOkAsE2gcupzwBJHAS6+9R/20UoZV/jdIQcNFvA0dEJZCG+ 2kwQ== X-Gm-Message-State: AOAM5329OC0huu/KEBfc+jqpyX2evKD5HlirFZRQFre2xAV2WYLs1MUJ ic8y4x4nfWyajj1N7C3j41teQe9CrIlMEJSGz/KR/Mvh8DJEiBepctPWrOHBJJuay50jyBPYX1G kXRQAlFQ53rGcA97cttcr2ACH/CA= X-Received: by 2002:a1c:dd09:: with SMTP id u9mr7417310wmg.183.1613756342444; 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) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Aurelien Jarno , Peter Maydell , Anthony Perard , qemu-ppc@nongnu.org, qemu-s390x@nongnu.org, Halil Pasic , Huacai Chen , xen-devel@lists.xenproject.org, Marcel Apfelbaum , David Gibson , qemu-arm@nongnu.org, Stefano Stabellini , Paolo Bonzini , kvm@vger.kernel.org, BALATON Zoltan , Leif Lindholm , Richard Henderson , Radoslaw Biernacki , Alistair Francis , Paul Durrant , Eduardo Habkost , "Michael S. Tsirkin" , Thomas Huth , Jiaxun Yang , =?UTF-8?q?Herv=C3=A9=20Poussineau?= , Greg Kurz , Christian Borntraeger , Cornelia Huck , "Edgar E. Iglesias" , David Hildenbrand , Mark Cave-Ayland , Aleksandar Rikalo , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= 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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) 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=C3=A9 --- 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); =20 +/** + * 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 accelerato= rs, + * 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; =20 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 =3D g_strdup(value); } =20 +bool machine_class_valid_for_accelerator(MachineClass *mc, const char *acc= _name) +{ + const char *const *name =3D mc->valid_accelerators; + + if (!name) { + return true; + } + if (strcmp(acc_name, "qtest") =3D=3D 0) { + return true; + } + + for (unsigned i =3D 0; name[i]; i++) { + if (strcasecmp(acc_name, name[i]) =3D=3D 0) { + return true; + } + } + return false; +} + +bool machine_class_valid_for_current_accelerator(MachineClass *mc) +{ + AccelClass *ac =3D 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)); --=20 2.26.2 From nobody Fri May 3 16:06:18 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1613756352549252.2139332633908; Fri, 19 Feb 2021 09:39:12 -0800 (PST) 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-328-oY8H8F-AND-PEezhrKDFCA-1; Fri, 19 Feb 2021 12:39:09 -0500 Received: by mail-wr1-f72.google.com with SMTP id w11so2793731wrp.6 for ; Fri, 19 Feb 2021 09:39:08 -0800 (PST) Return-Path: Return-Path: 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) 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= X-MC-Unique: oY8H8F-AND-PEezhrKDFCA-1 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=t6LtV2s1z8lt1wTLZMnDZWcNP0tBhMNTuXJcH3dZTzWJHF15B/jhWTxlTDNci8NBOH G1LaZZrsN2RZvlRcV3hK9qCS7cp8q9F5GNAwXwqkB9mcsfgyUmt7AzI7jGJtxEJZNqqv 2Z8QKt0MzROUNnGSK/HwZubqcwHgfhSlutIcgkFgOFjWJeIjAQubQ59aoSN1+DWI2fpI bvGkaUP4ZJShinDAlEN4VlV4dFQnuHbIZU4wnUJp/hyBN937m6US22nM2oUlFyRfYQ/s tjniHs9F1KlzD+ZZCkU2GoGcLoyvrqbKik+f0pMdEMCJyjl6ITIeaQL3xwLNKtvTcKst tgjQ== X-Gm-Message-State: AOAM533SA9pBNQjQQlPVlkAYUtURtR4xMh9tbnoLZ+bcCKU1eTMxqBDS zJYVjbNzafGfCIjUuPpdgRRYSQMhMkXl5BKT69uD5fg86xyNfHWHnENNVPKx0NNH6HThfA8S2ci GHi1ESxu45ypmXA== X-Received: by 2002:adf:b342:: with SMTP id k2mr10246414wrd.264.1613756347940; Fri, 19 Feb 2021 09:39:07 -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) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Aurelien Jarno , Peter Maydell , Anthony Perard , qemu-ppc@nongnu.org, qemu-s390x@nongnu.org, Halil Pasic , Huacai Chen , xen-devel@lists.xenproject.org, Marcel Apfelbaum , David Gibson , qemu-arm@nongnu.org, Stefano Stabellini , Paolo Bonzini , kvm@vger.kernel.org, BALATON Zoltan , Leif Lindholm , Richard Henderson , Radoslaw Biernacki , Alistair Francis , Paul Durrant , Eduardo Habkost , "Michael S. Tsirkin" , Thomas Huth , Jiaxun Yang , =?UTF-8?q?Herv=C3=A9=20Poussineau?= , Greg Kurz , Christian Borntraeger , Cornelia Huck , "Edgar E. Iglesias" , David Hildenbrand , Mark Cave-Ayland , Aleksandar Rikalo , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Daniel=20Berrang=C3=A9?= 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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Do not let 'query-machines' return machines not valid with the current accelerator. Suggested-by: Daniel Berrang=C3=A9 Signed-off-by: Philippe Mathieu-Daud=C3=A9 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 =3D el->data; MachineInfo *info; =20 + if (!machine_class_valid_for_current_accelerator(mc)) { + continue; + } + info =3D g_malloc0(sizeof(*info)); if (mc->is_default) { info->has_is_default =3D true; --=20 2.26.2 From nobody Fri May 3 16:06:18 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1613756360; cv=none; d=zohomail.com; s=zohoarc; b=OK49oxk7YghX8GhTObhdznUZQ/YGDANDrKl9Ii7F+yRdhiXLue0eT9FQb05EjPYRfNhNM10341RZy49ZYVqA8SjKatqZjrYT5SPgYvqGFecHClrgwSnC1ffGOlDPzrl1izPX4Cs/9z+smg+48PB7mrVplEs1Zuq/HXU3qNDVKh8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1613756360; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=CHXCPuc7uWQdwucv7FWJOUQ8ceg9IO3ZY73rXU3+wF0=; b=DZnna3jBuI7eVCO0FRyirySdnReCub0ty2y9wN99qKKsA5d7Q3pobM8pYh+MTvfp6s79uBmLd7zrtLeEuQ24OL2qD4FuI6ZMLazBDM/VF3773KLjv3EOB38t0ml9gIKa6WDSjIWBs6ZXIMbho9Jr87APO28iNGEA0Ydzfs5MsWk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1613756359659849.5435389851382; Fri, 19 Feb 2021 09:39:19 -0800 (PST) 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-555-OgqA2MbHMOyLKIDaK7EVIA-1; Fri, 19 Feb 2021 12:39:14 -0500 Received: by mail-wr1-f72.google.com with SMTP id c9so2746942wrq.18 for ; Fri, 19 Feb 2021 09:39:14 -0800 (PST) Return-Path: Return-Path: 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) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1613756358; 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=iPXbZj8rGrxPbKEdYl1qsu46ZyVLdqKSX3k6meK0fIWrUdN96qqjWIm6X3GC06TGyjCFTf 4SH9ilSw3RmowoOA//iBhlkTm096ZjbZEGpIHjNToEKZTWNfDzPhster1Cwo2AistWhzPg m61FY8TKA5WoqsvaK5J27fvfbhsi2q8= X-MC-Unique: OgqA2MbHMOyLKIDaK7EVIA-1 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=U3Fmbi0qTUwbcW+q436jqChzxRp9eLRGacBZl4/Inta0f5s0NAe160gg8sqO7J9K6e qVhNj+vd66wfqY50HBJzaACOGGzRV1HqYSRtZCX/R+mOOYyoj7W66UGoW7IDfx7xVqLD 7cT5aWUToRpBXLNUmLwwi1l9vjEaRo7zEJtPndyOJvDpAav+w8OvItAivnwKAk87eaa8 R9yMGrskita0XFwjPOzetL/RoJ/fHEJi5v+Id//jz7OAAZkm94Np2mj/LADXscmRb2dU rd0ePB8TO8EdR1ZOzU8InV+QhOgWoANioaqwsQYTWg3DlQgenfiClRA4mXyqxQNruUvN PjKw== X-Gm-Message-State: AOAM533FKi1WKG7msPo/HRLY5L3dAKWuHrBh79ZxKFstwYmTfGkhikhy Hma5HiKu3vCK31qxxKHbV1mRtQnUA/ipqpCjslUsnmFveS75LQyXWIoCmioZvDU2pVfwIcRSh8M qUtDDZwv10HXQrA== X-Received: by 2002:a05:6000:188c:: with SMTP id a12mr10610945wri.105.1613756353508; 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) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Aurelien Jarno , Peter Maydell , Anthony Perard , qemu-ppc@nongnu.org, qemu-s390x@nongnu.org, Halil Pasic , Huacai Chen , xen-devel@lists.xenproject.org, Marcel Apfelbaum , David Gibson , qemu-arm@nongnu.org, Stefano Stabellini , Paolo Bonzini , kvm@vger.kernel.org, BALATON Zoltan , Leif Lindholm , Richard Henderson , Radoslaw Biernacki , Alistair Francis , Paul Durrant , Eduardo Habkost , "Michael S. Tsirkin" , Thomas Huth , Jiaxun Yang , =?UTF-8?q?Herv=C3=A9=20Poussineau?= , Greg Kurz , Christian Borntraeger , Cornelia Huck , "Edgar E. Iglesias" , David Hildenbrand , Mark Cave-Ayland , Aleksandar Rikalo , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= 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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Restrit KVM to the following ARM machines: - virt - xlnx-versal-virt Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- 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_hand= ler(MachineState *machine, return NULL; } =20 +static const char *const valid_accels[] =3D { + "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 =3D virt_cpu_index_to_props; mc->default_cpu_type =3D ARM_CPU_TYPE_NAME("cortex-a15"); mc->get_default_cpu_node_id =3D virt_get_default_cpu_node_id; + mc->valid_accelerators =3D valid_accels; mc->kvm_type =3D virt_kvm_type; assert(!mc->get_hotplug_handler); mc->get_hotplug_handler =3D 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) { } =20 +static const char *const valid_accels[] =3D { + "tcg", "kvm", NULL +}; + static void versal_virt_machine_class_init(ObjectClass *oc, void *data) { MachineClass *mc =3D MACHINE_CLASS(oc); @@ -621,6 +625,7 @@ static void versal_virt_machine_class_init(ObjectClass = *oc, void *data) mc->default_cpus =3D XLNX_VERSAL_NR_ACPUS; mc->no_cdrom =3D true; mc->default_ram_id =3D "ddr"; + mc->valid_accelerators =3D valid_accels; } =20 static const TypeInfo versal_virt_machine_init_typeinfo =3D { --=20 2.26.2 From nobody Fri May 3 16:06:18 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1613756362863673.9391671477811; Fri, 19 Feb 2021 09:39:22 -0800 (PST) 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-392-_ubJJvcuO6KcfcrmYuJPFw-1; Fri, 19 Feb 2021 12:39:20 -0500 Received: by mail-wr1-f69.google.com with SMTP id p18so2801101wrt.5 for ; Fri, 19 Feb 2021 09:39:20 -0800 (PST) Return-Path: Return-Path: 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) 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= X-MC-Unique: _ubJJvcuO6KcfcrmYuJPFw-1 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=obQT2BQZGQWH/98kfOM5lzyZ+qAEWVpSHsdM2uh7OUgbP3X9CVrww7UwNGwF6XGDng qo+PjZOXQXCgAcvzdZDxsTz79HMYfNfKaJ0ert69QJYRLPs2tiCqgHTygmH/UWRxxcK4 4KSxHYLmC6/d3SRV8e5mGPANHSJSjnPlVjPLdm8zgemzxHOx1bCzCNK5a41GINVpHqR7 GjJUgAT8T7MbxEf8SD2D8y8oJ0SXDVG9QFlqsZfHuGdp+OQk+WERXjs39LwSeXkh2H8s 0wmutra/qavXDN0lXDBOjzr+NDKUHUo2kXAoyMcYX0m8khwRdRbWem5YUvSxK+M9tU4h Twvw== X-Gm-Message-State: AOAM530uDNCKqviNu39/PQUjsJWnR+5OWKZeuYVzccGh+jebCyP0lNeq +NCQ9JK0K4a6rn89fDQGCzeVM0C1YAjjrt+ZrBfkV0z1JGwOs1AXqgj/UaxlflO63BdelWgQ/l1 1STP3YuCuekuS6A== X-Received: by 2002:a5d:558b:: with SMTP id i11mr10341344wrv.125.1613756359010; 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) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Aurelien Jarno , Peter Maydell , Anthony Perard , qemu-ppc@nongnu.org, qemu-s390x@nongnu.org, Halil Pasic , Huacai Chen , xen-devel@lists.xenproject.org, Marcel Apfelbaum , David Gibson , qemu-arm@nongnu.org, Stefano Stabellini , Paolo Bonzini , kvm@vger.kernel.org, BALATON Zoltan , Leif Lindholm , Richard Henderson , Radoslaw Biernacki , Alistair Francis , Paul Durrant , Eduardo Habkost , "Michael S. Tsirkin" , Thomas Huth , Jiaxun Yang , =?UTF-8?q?Herv=C3=A9=20Poussineau?= , Greg Kurz , Christian Borntraeger , Cornelia Huck , "Edgar E. Iglesias" , David Hildenbrand , Mark Cave-Ayland , Aleksandar Rikalo , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= 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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Restrit KVM to the following MIPS machines: - malta - loongson3-virt Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Huacai Chen Reviewed-by: Jiaxun Yang --- 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 *mac= hine) loongson3_virt_devices_init(machine, liointc); } =20 +static const char *const valid_accels[] =3D { + "tcg", "kvm", NULL +}; + static void loongson3v_machine_class_init(ObjectClass *oc, void *data) { MachineClass *mc =3D MACHINE_CLASS(oc); @@ -622,6 +626,7 @@ 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->valid_accelerators =3D valid_accels; mc->kvm_type =3D mips_kvm_type; mc->minimum_page_bits =3D 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 =3D { .instance_init =3D mips_malta_instance_init, }; =20 +static const char *const valid_accels[] =3D { + "tcg", "kvm", NULL +}; + static void mips_malta_machine_init(MachineClass *mc) { mc->desc =3D "MIPS Malta Core LV"; @@ -1456,6 +1460,7 @@ static void mips_malta_machine_init(MachineClass *mc) mc->default_cpu_type =3D MIPS_CPU_TYPE_NAME("24Kf"); #endif mc->default_ram_id =3D "mips_malta.ram"; + mc->valid_accelerators =3D valid_accels; } =20 DEFINE_MACHINE("malta", mips_malta_machine_init) --=20 2.26.2 From nobody Fri May 3 16:06:18 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1613756369; cv=none; d=zohomail.com; s=zohoarc; b=JH58pj2UvZrPXMZvx3dMpWlxEeHt5w2siPZhoScRvV3qqutR6MkZ6KIMoJNeKOGlzF/AB4cItXBhB2bnPFYpQ514oazFrdf6ED9vXD4bOV2r23zi45VaHO4Xej6U6QGL8LUNgkqjguX4rpwDL7vYwyns0TRo9D5A7B6CDJ5nBlw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1613756369; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=Lw4bfUfCEZBd00BTMjyws6AoTKQiuLTiPv1ON4ccv74=; b=YtEG2Vt4SwMb9EsSIPzkymFztsfJnacnW85/CIRzYMtqrxPE0kmGaSSJwiUMbROE3EhZcTILyQOE3ltJuMaplJGyHGCIYc2BgStZ1dZQyjh/RaV+iZGBUg3qoyfl7QDGRdSJkJiQ4O9kQ3UMWZitiEgFszw7RIwrlGh94JLpBbc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1613756369492494.17858287407955; Fri, 19 Feb 2021 09:39:29 -0800 (PST) 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-376-WNm5GmLhNkmxEljf9NHyag-1; Fri, 19 Feb 2021 12:39:26 -0500 Received: by mail-wr1-f69.google.com with SMTP id l3so1135508wrx.15 for ; Fri, 19 Feb 2021 09:39:25 -0800 (PST) Return-Path: Return-Path: 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) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1613756368; 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=AqrXDvEFMzrD2XFTu9jQGrIsrygs0VOiE8ZtwkXXxqCiPLq5slTa5whNvq0ygDnwZn/u1M blPgiSvGvqnwVKC4LaZI8MkKzGtMHNEN43M1OZpdf5ln8Hx5q3aqKXWZwpzKz1lUb7+Yax kJnxIaqzgvlIgwXyZb/2HUlkAeiaA18= X-MC-Unique: WNm5GmLhNkmxEljf9NHyag-1 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=sT/I3KdoX+5qoTgIv4O73bzIO6gKzKid5PYS+wML/n7npBFoxz2HLW6xLIYq6HPhVs ORbcxTsk2Bo0zlJHmEHWp99tJAEQaqIBeuZWXzh3rNhfd+bBGsuUSzieuHKGnRKs1SYw 1qut+2ySgHqLX+U/1PF3HOtvnmClLd/YIIPDXS5DvEdhRP9404U49s0lfilHQhPvNdZ+ EiDnqywVbZQUgFB7hyrpjOY37b5jntyCvkaOoHimXAnvFwP/ERjxzb20qM8Pynak3gIA dX87mUuVSUdbMBRPsUVFv31HRyp6gKWvfDplfsWhbxwSWu6Wdg2KpJFwy2TnVW9fVzhi fqnw== X-Gm-Message-State: AOAM5306yAc/42NwHk7oJOYELYA72MUAr+lPBd3QyOAsj/0V3vPKFpBw uI99/S+oGOqOATQ4lq9zw19E0n+9BCNPKPEw2aqmnixhjdPbvU3DvzeDWnZi0ICbsfqWJhl4TNF cngcYjDb5HK0yjg== X-Received: by 2002:a1c:bb44:: with SMTP id l65mr8964770wmf.86.1613756364618; 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) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Aurelien Jarno , Peter Maydell , Anthony Perard , qemu-ppc@nongnu.org, qemu-s390x@nongnu.org, Halil Pasic , Huacai Chen , xen-devel@lists.xenproject.org, Marcel Apfelbaum , David Gibson , qemu-arm@nongnu.org, Stefano Stabellini , Paolo Bonzini , kvm@vger.kernel.org, BALATON Zoltan , Leif Lindholm , Richard Henderson , Radoslaw Biernacki , Alistair Francis , Paul Durrant , Eduardo Habkost , "Michael S. Tsirkin" , Thomas Huth , Jiaxun Yang , =?UTF-8?q?Herv=C3=A9=20Poussineau?= , Greg Kurz , Christian Borntraeger , Cornelia Huck , "Edgar E. Iglesias" , David Hildenbrand , Mark Cave-Ayland , Aleksandar Rikalo , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= 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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Restrit KVM to the following PPC machines: - 40p - bamboo - g3beige - mac99 - mpc8544ds - ppce500 - pseries - sam460ex - virtex-ml507 Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- 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(Mach= ineState *machine, =20 #define TYPE_E500PLAT_MACHINE MACHINE_TYPE_NAME("ppce500") =20 +static const char *const valid_accels[] =3D { + "tcg", "kvm", NULL +}; + static void e500plat_machine_class_init(ObjectClass *oc, void *data) { PPCE500MachineClass *pmc =3D PPCE500_MACHINE_CLASS(oc); @@ -98,6 +102,7 @@ static void e500plat_machine_class_init(ObjectClass *oc,= void *data) mc->max_cpus =3D 32; mc->default_cpu_type =3D POWERPC_CPU_TYPE_NAME("e500v2_v30"); mc->default_ram_id =3D "mpc8544ds.ram"; + mc->valid_accelerators =3D valid_accels; machine_class_allow_dynamic_sysbus_dev(mc, TYPE_ETSEC_COMMON); } =20 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, Bus= State *bus, =20 return NULL; } + +static const char *const valid_accels[] =3D { + "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 =3D MAX_CPUS; mc->default_boot_order =3D "cd"; mc->default_display =3D "std"; + mc->valid_accelerators =3D valid_accels; mc->kvm_type =3D core99_kvm_type; #ifdef TARGET_PPC64 mc->default_cpu_type =3D 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, B= usState *bus, return NULL; } =20 +static const char *const valid_accels[] =3D { + "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 =3D "cd"; + mc->valid_accelerators =3D valid_accels; mc->kvm_type =3D heathrow_kvm_type; mc->default_cpu_type =3D POWERPC_CPU_TYPE_NAME("750_v3.1"); mc->default_display =3D "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); } =20 +static const char *const valid_accels[] =3D { + "tcg", "kvm", NULL +}; + static void e500plat_machine_class_init(ObjectClass *oc, void *data) { MachineClass *mc =3D MACHINE_CLASS(oc); @@ -56,6 +60,7 @@ static void e500plat_machine_class_init(ObjectClass *oc, = void *data) mc->max_cpus =3D 15; mc->default_cpu_type =3D POWERPC_CPU_TYPE_NAME("e500v2_v30"); mc->default_ram_id =3D "mpc8544ds.ram"; + mc->valid_accelerators =3D valid_accels; } =20 #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) } } =20 +static const char *const valid_accels[] =3D { + "tcg", "kvm", NULL +}; + static void bamboo_machine_init(MachineClass *mc) { mc->desc =3D "bamboo"; mc->init =3D bamboo_init; mc->default_cpu_type =3D POWERPC_CPU_TYPE_NAME("440epb"); mc->default_ram_id =3D "ppc4xx.sdram"; + mc->valid_accelerators =3D valid_accels; } =20 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) } } =20 +static const char *const valid_accels[] =3D { + "tcg", "kvm", NULL +}; + static void ibm_40p_machine_init(MachineClass *mc) { mc->desc =3D "IBM RS/6000 7020 (40p)", @@ -441,6 +445,7 @@ static void ibm_40p_machine_init(MachineClass *mc) mc->default_boot_order =3D "c"; mc->default_cpu_type =3D POWERPC_CPU_TYPE_NAME("604"); mc->default_display =3D "std"; + mc->valid_accelerators =3D valid_accels; } =20 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 =3D entry; } =20 +static const char *const valid_accels[] =3D { + "tcg", "kvm", NULL +}; + static void sam460ex_machine_init(MachineClass *mc) { mc->desc =3D "aCube Sam460ex"; @@ -513,6 +517,7 @@ static void sam460ex_machine_init(MachineClass *mc) mc->default_cpu_type =3D POWERPC_CPU_TYPE_NAME("460exb"); mc->default_ram_size =3D 512 * MiB; mc->default_ram_id =3D "ppc4xx.sdram"; + mc->valid_accelerators =3D valid_accels; } =20 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) } } =20 +static const char *const valid_accels[] =3D { + "tcg", "kvm", NULL +}; + static void spapr_machine_class_init(ObjectClass *oc, void *data) { MachineClass *mc =3D MACHINE_CLASS(oc); @@ -4426,6 +4430,7 @@ static void spapr_machine_class_init(ObjectClass *oc,= void *data) mc->default_ram_size =3D 512 * MiB; mc->default_ram_id =3D "ppc_spapr.ram"; mc->default_display =3D "std"; + mc->valid_accelerators =3D valid_accels; mc->kvm_type =3D spapr_kvm_type; machine_class_allow_dynamic_sysbus_dev(mc, TYPE_SPAPR_PCI_HOST_BRIDGE); mc->pci_allow_0_address =3D true; --=20 2.26.2 From nobody Fri May 3 16:06:18 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1613756389; cv=none; d=zohomail.com; s=zohoarc; b=csbMcfmNSu+pNM72qPAN5d1enhRVigILhZjRVYs3rQ7PGWLvqazts+NPxXky6IrcmanY4OY5GNuklqhqmz7M1w8I2AOq9umKFnwsmj8k/3Cpt9TohWGF8ecdZ1xRi0pteskMDDLIVlYK4sGA4sYDnnODEHLKgAJ9xaxl3W8d5yk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1613756389; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Ueqj+n2dHsbjBHuZ0Hoy+mZlGObPSK9klpKLOoZpu4Y=; b=LK+LkwfRtbjk1O+n66ZiNVdTTyQILHEKBxAVD19SVfYQZ1ARFhpnTsFKhzsFrYcsgPsjHbZaxPfNf12s6GgyqS+BWOfZeA1/VWKtPFXQMbeib/i2TLoe2GlKbLzj8wWYtxP90fJ+Zp1uK4v1TXDU8TvpH5JPRP0idLB/9ayFUlE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1613756389581496.37382143444427; Fri, 19 Feb 2021 09:39:49 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.87034.164020 (Exim 4.92) (envelope-from ) id 1lD9kg-00018U-8U; Fri, 19 Feb 2021 17:39:38 +0000 Received: by outflank-mailman (output) from mailman id 87034.164020; Fri, 19 Feb 2021 17:39:38 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lD9kg-00018L-3w; Fri, 19 Feb 2021 17:39:38 +0000 Received: by outflank-mailman (input) for mailman id 87034; Fri, 19 Feb 2021 17:39:36 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lD9ke-00015B-HZ for xen-devel@lists.xenproject.org; Fri, 19 Feb 2021 17:39:36 +0000 Received: from us-smtp-delivery-124.mimecast.com (unknown [216.205.24.124]) by us1-rack-iad1.inumbo.com (Halon) with ESMTP id 5d3d0e88-38f6-4dbb-b21f-040f82cc7201; Fri, 19 Feb 2021 17:39:35 +0000 (UTC) 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-463-bvpW0CxdNBuwgHTvOAM7jw-1; Fri, 19 Feb 2021 12:39:31 -0500 Received: by mail-wr1-f69.google.com with SMTP id l10so2764903wry.16 for ; Fri, 19 Feb 2021 09:39:31 -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) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 5d3d0e88-38f6-4dbb-b21f-040f82cc7201 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1613756375; 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=MMF33b6NnBdSSOiWvC0VxRqETouFen+FQ7chlscpyNGwpGoPnOVyXD0KOSt6ZNjzrcGLlx e7K3+LMK21YQac6V7nxO0KMpjaaqcNB7cndfaLMYUwlu9nlt+FCYDeVH2LS/Y8rF/bjZu1 N7OsP/RVseweu135mRvasXNezJWyqF4= X-MC-Unique: bvpW0CxdNBuwgHTvOAM7jw-1 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=gvUjCHKHU0o7U/QuNaPovTACBBYo2wXSv5/NdFyA2U0hbNUtt0iIevYBFGzk1kF38l vPyaYsrCRZj/NkV6lec4bsPX1AdEXVWBvcjaU6LKOcI8m07P7ADqpSam6kLMPLBN4LrX FUrfjpePBKkEHrmeXlqqvHpWRdZsJfOm1cy1stSSfLRWhXprQPEBaZMWoH5yywKkDprr PIjX75HTMCStYq2cDziQfKTb7C74uV6KiqxrYrSI+/WnFGnIdsT9+OOJNTwWlAmHPKg1 ZRmlN0RpWHmWM+4pryZNoezVCklvGvWwV+Yxr+tZvVDLdIyD4sVpGHwMoiUpRqZyIdpX wlxA== X-Gm-Message-State: AOAM533Q0ZrM0dkvk6wLFwGYJKk3gDdOg3id8yhifDmb1Vs+WvVRRySv InPqEPmZbZ4dVWr1PXhu2+2lkHJQVfVR3bDCXioBSDkfyU13MoTcg4zerTzUl+ZZd20VCatr9XN JA2dxka/wpfZsFE1ZNiaeTD3sL0I= X-Received: by 2002:a1c:c90c:: with SMTP id f12mr9312000wmb.98.1613756370707; 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) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Aurelien Jarno , Peter Maydell , Anthony Perard , qemu-ppc@nongnu.org, qemu-s390x@nongnu.org, Halil Pasic , Huacai Chen , xen-devel@lists.xenproject.org, Marcel Apfelbaum , David Gibson , qemu-arm@nongnu.org, Stefano Stabellini , Paolo Bonzini , kvm@vger.kernel.org, BALATON Zoltan , Leif Lindholm , Richard Henderson , Radoslaw Biernacki , Alistair Francis , Paul Durrant , Eduardo Habkost , "Michael S. Tsirkin" , Thomas Huth , Jiaxun Yang , =?UTF-8?q?Herv=C3=A9=20Poussineau?= , Greg Kurz , Christian Borntraeger , Cornelia Huck , "Edgar E. Iglesias" , David Hildenbrand , Mark Cave-Ayland , Aleksandar Rikalo , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= 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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) All s390-ccw-virtio machines support TCG and KVM. Signed-off-by: Philippe Mathieu-Daud=C3=A9 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; } =20 +static const char *const valid_accels[] =3D { + "tcg", "kvm", NULL +}; + static void ccw_machine_class_init(ObjectClass *oc, void *data) { MachineClass *mc =3D MACHINE_CLASS(oc); @@ -612,6 +616,7 @@ static void ccw_machine_class_init(ObjectClass *oc, voi= d *data) mc->possible_cpu_arch_ids =3D s390_possible_cpu_arch_ids; /* it is overridden with 'host' cpu *in kvm_arch_init* */ mc->default_cpu_type =3D S390_CPU_TYPE_NAME("qemu"); + mc->valid_accelerators =3D valid_accels; hc->plug =3D s390_machine_device_plug; hc->unplug_request =3D s390_machine_device_unplug_request; nc->nmi_monitor_handler =3D s390_nmi; --=20 2.26.2 From nobody Fri May 3 16:06:18 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1613756381; cv=none; d=zohomail.com; s=zohoarc; b=IXHzZzkWnFTa2F4ni8e4MtGBtYNDLpkZq8yoYmagh8FFRPb+F4rt9NHY5XiIofVFefQIc0XtV9xXrwEzYhYgl7pyJhHjiRyR4S2JZbFBueDuSk6D/XrXZunQfbN+TaWgIZepsGLFvEFTqEb3VPvU5WVbxxy6XaVD/r5LnrFgfxE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1613756381; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=0XNpw7EsZwRfqH5jj+d5q0K26B/2H8ocJXujjf2y0q0=; b=NbRMtu6UlHphb6Vf3ESFgP+TzxG42xlFT0MJkJql0ICWYT7lDPOGr5sfC2DYfvBvZ8gHTBBI1QEd+VZIzwrzRa31w1zhMIZBrab+9Zxkpc6jl7yQZ0GeR/sR4WggnqbCQCyvdBGA3Cg2wVAvbt4TRDFR6LgVLqSljS5SmaL4a/Q= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1613756380773491.1324001219085; Fri, 19 Feb 2021 09:39:40 -0800 (PST) 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-519-iorhZ_t6Ml2320Pf1nW_0w-1; Fri, 19 Feb 2021 12:39:38 -0500 Received: by mail-wm1-f69.google.com with SMTP id z67so2789888wme.3 for ; Fri, 19 Feb 2021 09:39:37 -0800 (PST) Return-Path: Return-Path: 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) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1613756379; 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=ZHMfCRdN/bdY9ziUhL8FHMTvt/ET0FvOdowXpYp4YyGeLfmKK3gCq1Q5yUpR/vx4sBp6od KsswFI/FdlK0RsYDWmNDnarQHauInHORqA5+n6X3gIMFFYUUgQP2bjAX1Jrl/INaeb3oQr zmZDk09RjVLsR0/Ze6jNpbgjNMWyFsU= X-MC-Unique: iorhZ_t6Ml2320Pf1nW_0w-1 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=geAfzSdyHBesyT+IVwXjJod9BkPglpPgR0jbyZtx+Fo26EeyGd1nkQQhSx+MXclC6V REEwMdr/dg0znGYDD+3WYUzdDbQZoOEbOL4I0iMSLZp5EDvy22aAwjap6IK004dfL5UD TKT9jJJXCLKUB0c7WrxWv/SlOeOhRtDWL03FWBbHkMxJg9LDiJERq0YkbiaWKZFWgQRX Cb1WJNyXBjy7EKbQpV7KNre0Zd2xkunV/2BI4S2ufX7B6WY7wMNxL54y/DS589Mt1RBN N3gRktvbeVb6aqTMqVhTXPd9V1rTfXXpf/v3f4Bnh6kRmmrk1+QmPlaSyliSl+3mG5C0 4cKg== X-Gm-Message-State: AOAM53117T+JoPpS179YWoJuiM+5g3zh+7AIt0VSKAhTKHPNznUx+WQx cpnmczyx4/7DOnBBY4NHiirQOi8+H1/gqhq9SbFuCHy/4MvhKTP4dL+J7NC0cXLHfrLVSWFYiwS rT9gi/cXGd8QyWQ== X-Received: by 2002:adf:fb91:: with SMTP id a17mr10124649wrr.93.1613756376929; Fri, 19 Feb 2021 09:39:36 -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) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Aurelien Jarno , Peter Maydell , Anthony Perard , qemu-ppc@nongnu.org, qemu-s390x@nongnu.org, Halil Pasic , Huacai Chen , xen-devel@lists.xenproject.org, Marcel Apfelbaum , David Gibson , qemu-arm@nongnu.org, Stefano Stabellini , Paolo Bonzini , kvm@vger.kernel.org, BALATON Zoltan , Leif Lindholm , Richard Henderson , Radoslaw Biernacki , Alistair Francis , Paul Durrant , Eduardo Habkost , "Michael S. Tsirkin" , Thomas Huth , Jiaxun Yang , =?UTF-8?q?Herv=C3=A9=20Poussineau?= , Greg Kurz , Christian Borntraeger , Cornelia Huck , "Edgar E. Iglesias" , David Hildenbrand , Mark Cave-Ayland , Aleksandar Rikalo , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= 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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) x86 machines currently support all accelerators. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- 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 =3D ACPI_BUILD_PCI_IRQS; } =20 +static const char *const valid_accels[] =3D { + "tcg", "kvm", "xen", "hax", "hvf", "whpx", NULL +}; + static void x86_machine_class_init(ObjectClass *oc, void *data) { MachineClass *mc =3D MACHINE_CLASS(oc); @@ -1218,6 +1222,7 @@ static void x86_machine_class_init(ObjectClass *oc, v= oid *data) mc->cpu_index_to_instance_props =3D x86_cpu_index_to_props; mc->get_default_cpu_node_id =3D x86_get_default_cpu_node_id; mc->possible_cpu_arch_ids =3D x86_possible_cpu_arch_ids; + mc->valid_accelerators =3D valid_accels; x86mc->compat_apic_id_mode =3D false; x86mc->save_tsc_khz =3D true; nc->nmi_monitor_handler =3D x86_nmi; --=20 2.26.2 From nobody Fri May 3 16:06:18 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1613756386; cv=none; d=zohomail.com; s=zohoarc; b=I4fn6Ovu6ax/0YF4LTgMvr75wgwr9gVhFWHXniks3WfNeWreTFgvN4onPqefttiA4GCEEunS4E6pc086ylOYlhxF3XYzU1fCEhVvtIu/RI3O/lIE6Hgpwe8uDg9507YCUnG0JaUhPHkGr8qqKP+IxZ1gjMLGa1X2fuetKXPKgBg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1613756386; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=m89dmrSplgkgoyBA9XFoMMYsKZX69TbxEanq9oDkcW0=; b=D0KCvcDqOSeECpFwS3zSL9wb5dMU6jfJUwOLahOFfu0YsBv17aMEqRkjGP+tvROx5WC+koXz12SRI364cdmvEnip64nXlKX1AtYiZ7PyC+g1T1uyOyRQt7yURep+1DQi4ITQcfwRjRE+ba6GI4272Wys2Kk1/Ydgqp2A6i5/hyw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 161375638609443.583088541511074; Fri, 19 Feb 2021 09:39:46 -0800 (PST) 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-21-wzx01V73NLecSZpa5zPX4Q-1; Fri, 19 Feb 2021 12:39:43 -0500 Received: by mail-wm1-f72.google.com with SMTP id s192so2790109wme.6 for ; Fri, 19 Feb 2021 09:39:43 -0800 (PST) Return-Path: Return-Path: 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) 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= X-MC-Unique: wzx01V73NLecSZpa5zPX4Q-1 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=O9COslrh8rvzBPnNnIrceCaEHlY0i/7AHuTB/jDwI3tYmIuXcWbPwNiuJP9iNylS9+ RAj9gMC6IaqvZyS6OKIHghBp2NhrNLL2mihPF4bCw+7ipkjOnil7ldN0FeAT9LP8AjlA U76bE99Q+FFAF9iMukV9IGATur5MBaMz17L3CsERZ/jXYtuj1irAP0F9+/g492/jiup7 b8+Nwy144+gzDJz2QSP+YHQ4MJi2Cr91lyjJwKJjni/AwsX2pM424GPZShkN45Mgzn20 Jd75oMWuj5E/hcTDRrWtfZoSvTfBIHVZVmAm2ImVjordwKo3BRP+L3rgpY2B1k4A2AtT 1mRA== X-Gm-Message-State: AOAM532fvesMVkyu9mTdbLo4i0WwTpAEgIwyiDc54QCkUS+z3Ujf4Bh8 qIXZjCSQqIx6KNJWX2EVD7D8Kfa9aILlosAwbIP6qgFOQceRuUXP1o7h3Ap42eK6KjT285nyDCS yA1EmQKtORWyMkA== X-Received: by 2002:a1c:c6:: with SMTP id 189mr9272336wma.128.1613756382377; 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) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Aurelien Jarno , Peter Maydell , Anthony Perard , qemu-ppc@nongnu.org, qemu-s390x@nongnu.org, Halil Pasic , Huacai Chen , xen-devel@lists.xenproject.org, Marcel Apfelbaum , David Gibson , qemu-arm@nongnu.org, Stefano Stabellini , Paolo Bonzini , kvm@vger.kernel.org, BALATON Zoltan , Leif Lindholm , Richard Henderson , Radoslaw Biernacki , Alistair Francis , Paul Durrant , Eduardo Habkost , "Michael S. Tsirkin" , Thomas Huth , Jiaxun Yang , =?UTF-8?q?Herv=C3=A9=20Poussineau?= , Greg Kurz , Christian Borntraeger , Cornelia Huck , "Edgar E. Iglesias" , David Hildenbrand , Mark Cave-Ayland , Aleksandar Rikalo , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= 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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) When started with other accelerator than Xen, the XenPV machine fails with a criptic message: $ qemu-system-x86_64 -M xenpv,accel=3Dkvm 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=3Dkvm qemu-system-x86_64: invalid accelerator 'kvm' for machine xenpv Signed-off-by: Philippe Mathieu-Daud=C3=A9 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); } =20 +static const char *valid_accels[] =3D { + "xen", NULL +}; + static void xenpv_machine_init(MachineClass *mc) { mc->desc =3D "Xen Para-virtualized PC"; mc->init =3D xen_init_pv; mc->max_cpus =3D 1; mc->default_machine_opts =3D "accel=3Dxen"; + mc->valid_accelerators =3D valid_accels; } =20 DEFINE_MACHINE("xenpv", xenpv_machine_init) --=20 2.26.2 From nobody Fri May 3 16:06:18 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1613756414; cv=none; d=zohomail.com; s=zohoarc; b=QwZWrzEyRmHLlWDI3C26BvEqGLF9tvuEmtcntb6jUXX7pjFs21AWoWcyUB4OD1rQ+p+qpjrw73Sl1+rLVekwkeKxU1shMI156K9BZ2J97PKZiZmmGL0KXw7OqDZRlQecDr7CL5BLPuikY+P2Xye/mh/bCkN2c3wOl5xdj5fLHyY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1613756414; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=23DXGFBg27YE0s/hCFn43oTEX31jOtnU+ISUArv5+bE=; b=GOGjr+OXyqMpmCc5nROGsaMIizM9vAcI2XwickAJ7AUHf2+F2AVmJ3p8+VEBL0XVf6VL+jfWd6pkhUlXOCTU0eAsn3lmLUWiLXMqFIN5fn+w4UCc7zu1oP2PCkV5N4om7YSsCiGSC+KaM3+dnhrs1Fn1+N1TfNIZS8c2wcU0tuk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1613756414282907.8659613466264; Fri, 19 Feb 2021 09:40:14 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.87043.164056 (Exim 4.92) (envelope-from ) id 1lD9l3-0001T1-9t; Fri, 19 Feb 2021 17:40:01 +0000 Received: by outflank-mailman (output) from mailman id 87043.164056; Fri, 19 Feb 2021 17:40:01 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lD9l3-0001Sn-5F; Fri, 19 Feb 2021 17:40:01 +0000 Received: by outflank-mailman (input) for mailman id 87043; Fri, 19 Feb 2021 17:40:00 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lD9l2-0001FU-0R for xen-devel@lists.xenproject.org; Fri, 19 Feb 2021 17:40:00 +0000 Received: from us-smtp-delivery-124.mimecast.com (unknown [216.205.24.124]) by us1-rack-iad1.inumbo.com (Halon) with ESMTP id 5c1ec71a-6762-4892-b815-30b495f60090; Fri, 19 Feb 2021 17:39:50 +0000 (UTC) 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-125-eeWd5OYkPF2IJSbFAA9Xsg-1; Fri, 19 Feb 2021 12:39:49 -0500 Received: by mail-wr1-f71.google.com with SMTP id w11so2794419wrp.6 for ; Fri, 19 Feb 2021 09:39:48 -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) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 5c1ec71a-6762-4892-b815-30b495f60090 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1613756390; 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=FcHUbTFI2+D1UE2Q92T8b2JIM9nFTt/JKbFLOyM4TygNx1swzrCgcRrxf64R6wJTlRH7mT xFkytyvafaZHjWWHPzMiSJfkdUh85Nq25J787tsuIwr0Y2iWW8mjTF6L1w0bVwb/YBo2KA tixYyBWDLkU5lTbRlL8ZeHKf4LGWttk= X-MC-Unique: eeWd5OYkPF2IJSbFAA9Xsg-1 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=nT5UCHdQMCgrZtOk9VSin1CqQ4hbk2W5E/Pbks/rr6nq3jlzwAHHVN87Xyl1Sv/qbw puSV/zz8loKbOwuA4irabTO3Q2P/XTw3v9Cb204JbBSDOBWnxxs3G1sTHzduPe9njvEB sDlGllblw9jRDa8mRoO1xr1eTU1Aws4G+pCq9fMO8KyJIenpfSBJL80AkGSzj3XVCBr8 HQNPvvQg/4FDtRDLPlsT9q4vdUlkmfFQa80L1bQGOfZeR45poLmXlNiLPmbnZ4mX4tjZ GWQpHLTnCzoFs+nvLgtWht4c2Rg0mYm9GEAqVMEsumcQomagLi911Uh8iOp+AXh3Mz5O 5aXg== X-Gm-Message-State: AOAM532NU0QB5PN1TKRyj3EjRpVQkqKBuBno4PPJRXw7fRSsncDMKBF5 q84QSYMdKKoTqMb4TjFkx6hKzw3eY+TTf2wGnR7TIV9bczdvpRYdoz1HpAI67jALOujdImsrA03 ZwIkSVMqlylW11FRAwXMCkWL0AoI= X-Received: by 2002:a7b:c095:: with SMTP id r21mr3049566wmh.48.1613756387887; 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) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Aurelien Jarno , Peter Maydell , Anthony Perard , qemu-ppc@nongnu.org, qemu-s390x@nongnu.org, Halil Pasic , Huacai Chen , xen-devel@lists.xenproject.org, Marcel Apfelbaum , David Gibson , qemu-arm@nongnu.org, Stefano Stabellini , Paolo Bonzini , kvm@vger.kernel.org, BALATON Zoltan , Leif Lindholm , Richard Henderson , Radoslaw Biernacki , Alistair Francis , Paul Durrant , Eduardo Habkost , "Michael S. Tsirkin" , Thomas Huth , Jiaxun Yang , =?UTF-8?q?Herv=C3=A9=20Poussineau?= , Greg Kurz , Christian Borntraeger , Cornelia Huck , "Edgar E. Iglesias" , David Hildenbrand , Mark Cave-Ayland , Aleksandar Rikalo , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= 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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) 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=C3=A9 --- 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 accelerato= rs, * 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 T= CG + * 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 *ob= j, const char *value, =20 bool machine_class_valid_for_accelerator(MachineClass *mc, const char *acc= _name) { - const char *const *name =3D mc->valid_accelerators; + static const char *const default_accels[] =3D { + "tcg", NULL + }; + const char *const *name =3D mc->valid_accelerators ? : default_accels; =20 - if (!name) { - return true; - } if (strcmp(acc_name, "qtest") =3D=3D 0) { return true; } --=20 2.26.2 From nobody Fri May 3 16:06:18 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1613756397606407.4055424814121; Fri, 19 Feb 2021 09:39:57 -0800 (PST) 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-147-E9znOExEM2Gd0Ve2tT3opQ-1; Fri, 19 Feb 2021 12:39:54 -0500 Received: by mail-wm1-f69.google.com with SMTP id j204so2794700wmj.4 for ; Fri, 19 Feb 2021 09:39:54 -0800 (PST) Return-Path: Return-Path: 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) 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= X-MC-Unique: E9znOExEM2Gd0Ve2tT3opQ-1 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=jk7fKoXKD0BcUWgY6N1rbdxtpAphBylVnH0bgHxgBamj5v6bIOaArkkbu52xmPuTE9 d2VGig4lRZEvN5i0BsDcKnJOZx+IqhRNJ+zZnzTRdiaisNSaw3UpEN5ZmUiXit/0WlSc cMGWfMHzAVbii5gYNZ7MKwPtYDbzCIu2obPmsU/IKHvLGWYV+dLLsMqtdpiVYi0fwkxk YKw75dvSPOGDNXrNArdDBZKllptxPIDdt/t9EeKl5ZYMB7iVyHNTk4bTkugjd9fLO4wd M/HOZkpnSqDWfNjrNzKCpxsjDhkVg/m2eYJvIiy47MZmFdVVTmnKVMdxlu5k7zrrIlo4 NjYQ== X-Gm-Message-State: AOAM533RvejGsuZ+wwXBtD3XzG9Z3MCMmcoET1AkkTM2Y/vqXYD+MQfN JidtFOkPiRG1/y6afUNTZ+ZSuKjbl0w4Jue3EX69DiI5cpajuzpVg5C+dm3BxkGnRi8R2HlVJwG 65LUQiKgrH28s5A== X-Received: by 2002:a1c:4c03:: with SMTP id z3mr9342117wmf.82.1613756393450; 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) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Aurelien Jarno , Peter Maydell , Anthony Perard , qemu-ppc@nongnu.org, qemu-s390x@nongnu.org, Halil Pasic , Huacai Chen , xen-devel@lists.xenproject.org, Marcel Apfelbaum , David Gibson , qemu-arm@nongnu.org, Stefano Stabellini , Paolo Bonzini , kvm@vger.kernel.org, BALATON Zoltan , Leif Lindholm , Richard Henderson , Radoslaw Biernacki , Alistair Francis , Paul Durrant , Eduardo Habkost , "Michael S. Tsirkin" , Thomas Huth , Jiaxun Yang , =?UTF-8?q?Herv=C3=A9=20Poussineau?= , Greg Kurz , Christian Borntraeger , Cornelia Huck , "Edgar E. Iglesias" , David Hildenbrand , Mark Cave-Ayland , Aleksandar Rikalo , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= 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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) 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_spac= e_init: Assertion `asidx =3D=3D 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): Invali= d 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 xl= nx-zcu102 Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- 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, Qem= uOpts *opts, Error **errp) const char *acc =3D qemu_opt_get(opts, "accel"); AccelClass *ac =3D accel_find(acc); AccelState *accel; + MachineClass *mc; int ret; bool qtest_with_kvm; =20 @@ -2145,6 +2146,12 @@ static int do_configure_accelerator(void *opaque, Qe= muOpts *opts, Error **errp) } return 0; } + mc =3D MACHINE_GET_CLASS(current_machine); + if (!qtest_chrdev && !machine_class_valid_for_accelerator(mc, ac->name= )) { + *p_init_failed =3D true; + error_report("invalid accelerator '%s' for machine %s", acc, mc->n= ame); + return 0; + } accel =3D ACCEL(object_new_with_class(OBJECT_CLASS(ac))); object_apply_compat_props(OBJECT(accel)); qemu_opt_foreach(opts, accelerator_set_property, --=20 2.26.2