From nobody Sun Feb 8 01:30:21 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 16426867936305.946059837808889; Thu, 20 Jan 2022 05:53:13 -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-490-bLTjDsIBNB2GxY5-x1ThMQ-1; Thu, 20 Jan 2022 08:53:09 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C625510B744C; Thu, 20 Jan 2022 13:53:03 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 130A67E2C6; Thu, 20 Jan 2022 13:53:03 +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 49D9F1806D1C; Thu, 20 Jan 2022 13:53:00 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 20KDqwPt008810 for ; Thu, 20 Jan 2022 08:52:58 -0500 Received: by smtp.corp.redhat.com (Postfix) id EDFD3404728F; Thu, 20 Jan 2022 13:52:57 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast10.extmail.prod.ext.rdu2.redhat.com [10.11.55.26]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E9D764047286 for ; Thu, 20 Jan 2022 13:52:57 +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 D1B291C00F71 for ; Thu, 20 Jan 2022 13:52:57 +0000 (UTC) Received: from mail-oo1-f49.google.com (mail-oo1-f49.google.com [209.85.161.49]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-108-vm32yLh9PnuU5o4P7rx3RQ-1; Thu, 20 Jan 2022 08:52:56 -0500 Received: by mail-oo1-f49.google.com with SMTP id x21-20020a4a2a55000000b002ddf492c201so2318821oox.6 for ; Thu, 20 Jan 2022 05:52:55 -0800 (PST) Received: from rekt.COMFAST ([191.8.61.226]) by smtp.gmail.com with ESMTPSA id a26sm1574102oiy.26.2022.01.20.05.52.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Jan 2022 05:52:54 -0800 (PST) X-MC-Unique: bLTjDsIBNB2GxY5-x1ThMQ-1 X-MC-Unique: vm32yLh9PnuU5o4P7rx3RQ-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=lzrkSbj4JwNmojLzQ8eh20wLr2XsOoremOIIvJ6qxGI=; b=IgL80fbjJRIqPq29EsGRF+oSokk/DDscTTUsucSAIhg0+ienboFbMzjMqODMZqxuVh lrAyDNeIKLZq/5/QWyncgf3RlYsAZX4S6iKTPzTGDgX0+1HjOageAnq560AfGSDuZ29b CRTu5PlDmu33XK+axAnvqL7bG/tdkPa37gZYJ1omViUn3xdDKL5udPmBYFBBUwdBHTco EXXJ21peECFFx0yAEsT2WbraqAysqBmxjNrwFzgZLgEUHeYDIzIkrkfDE11guN1Cpw68 x1c7qRHd+zGwCQBnDag7fIpWH2vjqhVzKmBJBtqEgoPO9Itd80gHywGm+HIzv+FRXwPk wHQA== X-Gm-Message-State: AOAM533wRGl2KJy1XHyBIgnCIbozuhAqYaYixpEBBO8RzSoYPE15wpMv CzLA+etSNNdbcjgQwu9RpQehOualoEs= X-Google-Smtp-Source: ABdhPJxHAjsomdR5BCT4YM514pv9cFyG8bEFFNUI1myBJqjMM4DeO1OiMCI/056QlBcrV/idIa9qmw== X-Received: by 2002:a4a:9864:: with SMTP id z33mr25583907ooi.32.1642686775030; Thu, 20 Jan 2022 05:52:55 -0800 (PST) From: Daniel Henrique Barboza To: libvir-list@redhat.com Subject: [PATCH 02/33] qemu_domain.c: add PowerNV machine helpers Date: Thu, 20 Jan 2022 10:52:05 -0300 Message-Id: <20220120135236.719924-3-danielhb413@gmail.com> In-Reply-To: <20220120135236.719924-1-danielhb413@gmail.com> References: <20220120135236.719924-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.84 on 10.11.54.2 X-loop: libvir-list@redhat.com Cc: fbarrat@linux.ibm.com, 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.12 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: 1642686795498100003 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 Signed-off-by: Daniel Henrique Barboza --- 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 a8401bac30..2accd4f766 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -8727,6 +8727,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