From nobody Sun Dec 22 01:32:49 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) smtp.mailfrom=devel-bounces@lists.libvirt.org Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1704857469362761.5996157521183; Tue, 9 Jan 2024 19:31:09 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id 4554E1BEB; Tue, 9 Jan 2024 22:31:08 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 7B3BB1C36; Tue, 9 Jan 2024 22:23:36 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id 94C471BDD; Tue, 9 Jan 2024 22:23:23 -0500 (EST) Received: from mx1.osci.io (polly.osci.io [8.43.85.229]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id B0C611B7F for ; Tue, 9 Jan 2024 22:21:44 -0500 (EST) Received: by mx1.osci.io (Postfix, from userid 994) id 15F19220FD; Tue, 9 Jan 2024 22:21:44 -0500 (EST) Received: from mx3.osci.io (carla.osci.io [IPv6:2607:f0d0:1e02:35::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (3072 bits) server-digest SHA256) (No client certificate requested) by mx1.osci.io (Postfix) with ESMTPS id AB79B220FC for ; Tue, 9 Jan 2024 22:21:43 -0500 (EST) Received: by mx3.osci.io (Postfix, from userid 990) id 1CECF30721D1; Tue, 9 Jan 2024 21:21:13 -0600 (CST) Received: from mail.loongson.cn (mail.loongson.cn [114.242.206.163]) by mx3.osci.io (Postfix) with ESMTP id 12A0730721D5 for ; Tue, 9 Jan 2024 21:21:07 -0600 (CST) Received: from loongson.cn (unknown [10.2.5.185]) by gateway (Coremail) with SMTP id _____8AxT+kgDZ5lIbcDAA--.3189S3; Wed, 10 Jan 2024 11:21:04 +0800 (CST) Received: from localhost.localdomain (unknown [10.2.5.185]) by localhost.localdomain (Coremail) with SMTP id AQAAf8Bx+90YDZ5lPBoKAA--.27070S8; Wed, 10 Jan 2024 11:21:04 +0800 (CST) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.4 From: Xianglai Li To: devel@lists.libvirt.org Subject: [PATCH 2/4] Config some capabilities for loongarch virt machine Date: Wed, 10 Jan 2024 11:07:51 +0800 Message-Id: <20240110030812.878812-2-lixianglai@loongson.cn> X-Mailer: git-send-email 2.39.1 In-Reply-To: References: MIME-Version: 1.0 X-CM-TRANSID: AQAAf8Bx+90YDZ5lPBoKAA--.27070S8 X-CM-SenderInfo: 5ol0xt5qjotxo6or00hjvr0hdfq/ X-Coremail-Antispam: 1Uk129KBjDUn29KB7ZKAUJUUUUU529EdanIXcx71UUUUU7KY7 ZEXasCq-sGcSsGvfJ3UbIjqfuFe4nvWSU5nxnvy29KBjDU0xBIdaVrnUUvcSsGvfC2Kfnx nUUI43ZEXa7xR_UUUUUUUUU== Message-ID-Hash: GTTTYGPRD6KMUVJNFWDMNC57HVFDSL2A X-Message-ID-Hash: GTTTYGPRD6KMUVJNFWDMNC57HVFDSL2A X-MailFrom: SRS0=i89f=IU=loongson.cn=lixianglai@osci.io X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header CC: maobibo@loongson.cn, lichao@loongson.cn, jiyin@redhat.com, xianglai li X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1704857470047100001 From: xianglai li Config some capabilities for loongarch virt machine such as PCI multi bus. Signed-off-by: "Xianglai Li" Signed-off-by: Xianglai Li --- src/qemu/qemu_capabilities.c | 10 ++++++++-- src/qemu/qemu_domain.c | 29 ++++++++++++++++++++++++++++- src/qemu/qemu_domain.h | 1 + 3 files changed, 37 insertions(+), 3 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index f2339d6013..357183cdb5 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -1138,7 +1138,8 @@ virQEMUCapsInitGuestFromBinary(virCaps *caps, NULL, NULL, 0, NULL); } =20 - if ((ARCH_IS_X86(guestarch) || guestarch =3D=3D VIR_ARCH_AARCH64)) + if ((ARCH_IS_X86(guestarch) || guestarch =3D=3D VIR_ARCH_AARCH64 || + ARCH_IS_LOONGARCH(guestarch))) virCapabilitiesAddGuestFeatureWithToggle(guest, VIR_CAPS_GUEST_FEA= TURE_TYPE_ACPI, true, true); =20 @@ -2080,6 +2081,11 @@ bool virQEMUCapsHasPCIMultiBus(const virDomainDef *d= ef) return true; } =20 + /* loongarch64 support PCI-multibus on all machine types + * since forever */ + if (ARCH_IS_LOONGARCH(def->os.arch)) + return true; + return false; } =20 @@ -3742,7 +3748,7 @@ virQEMUCapsInitCPUModel(virQEMUCaps *qemuCaps, } else if (ARCH_IS_X86(qemuCaps->arch)) { ret =3D virQEMUCapsInitCPUModelX86(qemuCaps, type, modelInfo, cpu, migratable); - } else if (ARCH_IS_ARM(qemuCaps->arch)) { + } else if (ARCH_IS_ARM(qemuCaps->arch) || ARCH_IS_LOONGARCH(qemuCaps->= arch)) { ret =3D 2; } =20 diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 0cea0b323a..e07fc32630 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -5635,6 +5635,9 @@ qemuDomainControllerDefPostParse(virDomainControllerD= ef *cont, cont->model =3D VIR_DOMAIN_CONTROLLER_MODEL_USB_QEMU_X= HCI; else if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_NEC_USB_XHCI)) cont->model =3D VIR_DOMAIN_CONTROLLER_MODEL_USB_NEC_XH= CI; + } else if (ARCH_IS_LOONGARCH(def->os.arch)) { + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_QEMU_XHCI)) + cont->model =3D VIR_DOMAIN_CONTROLLER_MODEL_USB_QEMU_X= HCI; } } /* forbid usb model 'qusb1' and 'qusb2' in this kind of hyperviosr= */ @@ -5933,7 +5936,8 @@ qemuDomainDefaultVideoDevice(const virDomainDef *def, return VIR_DOMAIN_VIDEO_TYPE_VGA; if (qemuDomainIsARMVirt(def) || qemuDomainIsRISCVVirt(def) || - ARCH_IS_S390(def->os.arch)) { + ARCH_IS_S390(def->os.arch) || + qemuDomainIsLoongArchVirt(def)) { return VIR_DOMAIN_VIDEO_TYPE_VIRTIO; } if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_CIRRUS_VGA)) @@ -8924,6 +8928,22 @@ qemuDomainMachineIsPSeries(const char *machine, } =20 =20 +static bool +qemuDomainMachineIsLoongArchVirt(const char *machine, + const virArch arch) +{ + if (!ARCH_IS_LOONGARCH(arch)) + return false; + + if (STREQ(machine, "virt") || + STRPREFIX(machine, "virt-")) { + return true; + } + + return false; +} + + static bool qemuDomainMachineIsMipsMalta(const char *machine, const virArch arch) @@ -9017,6 +9037,13 @@ qemuDomainIsMipsMalta(const virDomainDef *def) } =20 =20 +bool +qemuDomainIsLoongArchVirt(const virDomainDef *def) +{ + return qemuDomainMachineIsLoongArchVirt(def->os.machine, def->os.arch); +} + + bool qemuDomainHasPCIRoot(const virDomainDef *def) { diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index fa566dded6..cbcf3f0996 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -826,6 +826,7 @@ bool qemuDomainIsQ35(const virDomainDef *def); bool qemuDomainIsI440FX(const virDomainDef *def); bool qemuDomainIsS390CCW(const virDomainDef *def); bool qemuDomainIsARMVirt(const virDomainDef *def); +bool qemuDomainIsLoongArchVirt(const virDomainDef *def); bool qemuDomainIsRISCVVirt(const virDomainDef *def); bool qemuDomainIsPSeries(const virDomainDef *def); bool qemuDomainIsMipsMalta(const virDomainDef *def); --=20 2.39.1 _______________________________________________ Devel mailing list -- devel@lists.libvirt.org To unsubscribe send an email to devel-leave@lists.libvirt.org