From nobody Sun Dec 22 06:24:43 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 170485736240253.313225633905404; Tue, 9 Jan 2024 19:29:22 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id 4E5081CBF; Tue, 9 Jan 2024 22:29:21 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 7C5A71C26; Tue, 9 Jan 2024 22:21:40 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id 7890E1A27; Tue, 9 Jan 2024 22:21:15 -0500 (EST) Received: from mx2.osci.io (francine.osci.io [8.43.85.230]) (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 07B591B38 for ; Tue, 9 Jan 2024 22:21:10 -0500 (EST) Received: by mx2.osci.io (Postfix, from userid 994) id C1EB341D5B; Tue, 9 Jan 2024 22:21:09 -0500 (EST) Received: from mail.loongson.cn (mail.loongson.cn [114.242.206.163]) by mx2.osci.io (Postfix) with ESMTP id 69D7E40C75 for ; Tue, 9 Jan 2024 22:21:05 -0500 (EST) Received: from loongson.cn (unknown [10.2.5.185]) by gateway (Coremail) with SMTP id _____8DxzvAdDZ5lGbcDAA--.11475S3; Wed, 10 Jan 2024 11:21:01 +0800 (CST) Received: from localhost.localdomain (unknown [10.2.5.185]) by localhost.localdomain (Coremail) with SMTP id AQAAf8Bx+90YDZ5lPBoKAA--.27070S4; Wed, 10 Jan 2024 11:21:00 +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: [libvirt PATCH V2 2/4] Config some capabilities for loongarch virt machine Date: Wed, 10 Jan 2024 11:07:47 +0800 Message-Id: <733b7f7044a56db7177ff4ca86ac588899c1fafa.1704369486.git.lixianglai@loongson.cn> X-Mailer: git-send-email 2.39.1 In-Reply-To: References: MIME-Version: 1.0 X-CM-TRANSID: AQAAf8Bx+90YDZ5lPBoKAA--.27070S4 X-CM-SenderInfo: 5ol0xt5qjotxo6or00hjvr0hdfq/ X-Coremail-Antispam: 1Uk129KBjDUn29KB7ZKAUJUUUUU529EdanIXcx71UUUUU7KY7 ZEXasCq-sGcSsGvfJ3UbIjqfuFe4nvWSU5nxnvy29KBjDU0xBIdaVrnUUvcSsGvfC2Kfnx nUUI43ZEXa7xR_UUUUUUUUU== Message-ID-Hash: MRFEDFAB56ICH7Q2IKYV5KOUUSCQJM4W X-Message-ID-Hash: MRFEDFAB56ICH7Q2IKYV5KOUUSCQJM4W X-MailFrom: lixianglai@loongson.cn 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: 1704857363667100001 From: xianglai li Config some capabilities for loongarch virt machine such as PCI multi bus. 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