From nobody Sat Feb 7 15:30:15 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1643143790294840.7114864463509; Tue, 25 Jan 2022 12:49:50 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-502-wSsbRTD2POWc-1HRMZFbBA-1; Tue, 25 Jan 2022 15:49:47 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id F09461006AA0; Tue, 25 Jan 2022 20:49:41 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8C3A34D734; Tue, 25 Jan 2022 20:49:41 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 15D904BB7C; Tue, 25 Jan 2022 20:49:41 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 20PKndWj024173 for ; Tue, 25 Jan 2022 15:49:39 -0500 Received: by smtp.corp.redhat.com (Postfix) id 913DE4328D7; Tue, 25 Jan 2022 20:49:38 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast06.extmail.prod.ext.rdu2.redhat.com [10.11.55.22]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8D6BF401E83 for ; Tue, 25 Jan 2022 20:49:38 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E7C9E181944E for ; Tue, 25 Jan 2022 20:49:31 +0000 (UTC) Received: from mail-oi1-f169.google.com (mail-oi1-f169.google.com [209.85.167.169]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-388-7L6IeStlMbqF_X35mUWI5A-1; Tue, 25 Jan 2022 15:49:19 -0500 Received: by mail-oi1-f169.google.com with SMTP id q186so33517398oih.8 for ; Tue, 25 Jan 2022 12:49:19 -0800 (PST) Received: from rekt.COMFAST ([191.8.61.226]) by smtp.gmail.com with ESMTPSA id ay32sm1368569oob.16.2022.01.25.12.49.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Jan 2022 12:49:18 -0800 (PST) X-MC-Unique: wSsbRTD2POWc-1HRMZFbBA-1 X-MC-Unique: 7L6IeStlMbqF_X35mUWI5A-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=K1rJqDCefxj67B/UltcRkGUw/C5T6o9nddHQcIWFIlI=; b=KXwCX8ao6zFzM2YevPLXahubwwWRfWjU+1DPRY//5RVvh5GtWQvHIMxzC2UDl2ZZ8B 4IlBQZsAPZNPn66otn/Q2GzTD0ioL0GfuvMvyZqhd+DyeKvucTD8QeJ6AyRJSMS9mmr+ ELgQpZE2qzG4I5opSNdzNZm89WTwk//7Ww0nPXCZQyeAWPrCyJnMs7A315DRW3nS4K28 od4Ji7hD23oB2XFpoubLoXN+BUmQeIFW4LPDpuMyiDzi/jPxk0lEYr/Aet3Mafr9vvzc 7EGinnDZEOJ6l2XOCAljgR8XWPGoUn7+HvrcqbN/DvGkMINUV1jj2G5H+x3Y2Pjz+1q8 Vjjw== X-Gm-Message-State: AOAM530vx/GOceAq/BDMgdDUhx7yKT4Cd71t/jMlzumlJKDQDtWJ7+FR bmy7OrD8gEsu4d3SJIMp5CW3BSgYy+Y= X-Google-Smtp-Source: ABdhPJzfYA4rrUF2w0yqA3jzlj5uJFvB/m5W4GePMF80igvsdYZTSvJt5YFoAPnmUldkHUEHhcSzzA== X-Received: by 2002:aca:4b0e:: with SMTP id y14mr1620044oia.297.1643143758411; Tue, 25 Jan 2022 12:49:18 -0800 (PST) From: Daniel Henrique Barboza To: libvir-list@redhat.com Subject: [PATCH v2 01/29] qemu_domain.c: add PowerNV machine helpers Date: Tue, 25 Jan 2022 17:48:34 -0300 Message-Id: <20220125204902.772350-2-danielhb413@gmail.com> In-Reply-To: <20220125204902.772350-1-danielhb413@gmail.com> References: <20220125204902.772350-1-danielhb413@gmail.com> MIME-Version: 1.0 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.85 on 10.11.54.10 X-loop: libvir-list@redhat.com Cc: danielhb413@gmail.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1643143791576100003 Content-Type: text/plain; charset="utf-8" The PowerNV (Power Non-Virtualized) QEMU ppc64 machine is the emulation of a bare-metal IBM Power host. It follows the OPAL (OpenPower Abstration Layer) API/ABI, most specifically Skiboot [1]. For now, Libvirt has support for the pSeries QEMU machine, which is the emulation of a logical partition (guest) that would run on top of a bare-metal system. This patch introduces the helpers that are going to be used to add a basic support for PowerNV domains in Libvirt. Given that there are quite a few similarities in how pSeries and PowerNVv should be handled, we're also adding a 'qemuDomainIsPowerPC' helper that will be used in those instances. [1] https://open-power.github.io/skiboot/doc/overview.html Reviewed-by: Peter Krempa Signed-off-by: Daniel Henrique Barboza Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_domain.c | 41 +++++++++++++++++++++++++++++++++++++++++ src/qemu/qemu_domain.h | 4 ++++ 2 files changed, 45 insertions(+) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index aa8f6b8d05..2e21a95f38 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -8719,6 +8719,47 @@ qemuDomainIsPSeries(const virDomainDef *def) } =20 =20 +/* + * The PowerNV machine does not support KVM acceleration in Power + * hosts. We can skip the usual ARCH_IS_PPC64() since this machine + * is usable with TCG in all host archs. + */ +bool +qemuDomainIsPowerNV(const virDomainDef *def) +{ + if (STRPREFIX(def->os.machine, "powernv")) + return true; + + return false; +} + + +/* + * PowerNV and pSeries domains shares a lot of common traits. This + * helper avoids repeating "if (pseries || powernv)" everywhere this + * is applicable. + */ +bool +qemuDomainIsPowerPC(const virDomainDef *def) +{ + return qemuDomainIsPSeries(def) || qemuDomainIsPowerNV(def); +} + + +/* + * Similar to qemuDomainIsPowerPC(). Usable when the caller doesn't + * have access to a virDomainDef pointer. + */ +bool +qemuDomainMachineIsPowerPC(const char *machine, const virArch arch) +{ + if (STRPREFIX(machine, "powernv")) + return true; + + return qemuDomainMachineIsPSeries(machine, arch); +} + + bool qemuDomainHasPCIRoot(const virDomainDef *def) { diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index e5046367e3..d07a279a1b 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -761,6 +761,8 @@ bool qemuDomainMachineIsARMVirt(const char *machine, const virArch arch); bool qemuDomainMachineIsPSeries(const char *machine, const virArch arch); +bool qemuDomainMachineIsPowerPC(const char *machine, + const virArch arch); bool qemuDomainMachineHasBuiltinIDE(const char *machine, const virArch arch); =20 @@ -770,6 +772,8 @@ bool qemuDomainIsS390CCW(const virDomainDef *def); bool qemuDomainIsARMVirt(const virDomainDef *def); bool qemuDomainIsRISCVVirt(const virDomainDef *def); bool qemuDomainIsPSeries(const virDomainDef *def); +bool qemuDomainIsPowerNV(const virDomainDef *def); +bool qemuDomainIsPowerPC(const virDomainDef *def); bool qemuDomainHasPCIRoot(const virDomainDef *def); bool qemuDomainHasPCIeRoot(const virDomainDef *def); bool qemuDomainHasBuiltinIDE(const virDomainDef *def); --=20 2.34.1