From nobody Sun Feb 8 12:37:49 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.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.129.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.129.124]) by mx.zohomail.com with SMTPS id 1645622563193632.853110172243; Wed, 23 Feb 2022 05:22:43 -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-193-Alh01qWKPbio3E5DJMqP0w-1; Wed, 23 Feb 2022 08:22:40 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0C141800422; Wed, 23 Feb 2022 13:22:35 +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 DFA3F7C02A; Wed, 23 Feb 2022 13:22:34 +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 AF98F1809CB3; Wed, 23 Feb 2022 13:22:34 +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 21NDKAUh029692 for ; Wed, 23 Feb 2022 08:20:10 -0500 Received: by smtp.corp.redhat.com (Postfix) id 7E697400E136; Wed, 23 Feb 2022 13:20:10 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast09.extmail.prod.ext.rdu2.redhat.com [10.11.55.25]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 79B23400E135 for ; Wed, 23 Feb 2022 13:20:10 +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 62DBB2A8E471 for ; Wed, 23 Feb 2022 13:20:10 +0000 (UTC) Received: from mail-ot1-f51.google.com (mail-ot1-f51.google.com [209.85.210.51]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-384-7nthWRY2ON-4YJdbABpTCA-1; Wed, 23 Feb 2022 08:20:08 -0500 Received: by mail-ot1-f51.google.com with SMTP id l20-20020a0568302b1400b005af8c95bbe4so2029657otv.1 for ; Wed, 23 Feb 2022 05:20:08 -0800 (PST) Received: from rekt.ibmuc.com ([191.193.99.92]) by smtp.gmail.com with ESMTPSA id a4sm27646154oaa.42.2022.02.23.05.20.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Feb 2022 05:20:02 -0800 (PST) X-MC-Unique: Alh01qWKPbio3E5DJMqP0w-1 X-MC-Unique: 7nthWRY2ON-4YJdbABpTCA-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=h3INNCyYav3Qe7vmy4eHaNbxVvOd5lHSDXig1yEQ/WQ=; b=HH72jpIIp5Xf12fOZHPR91BaFUZLxMP/kxgzBa4lZdmeaTqGFnmpDc74CnioBPdCYC shdsHOY4oinCSOiM9lmnJOsPoWY9LFy1l5SH9KkEUTEsXPkToi2lCzyWmvTDyZ1KY5wE 1gKvE3RLXsg0Yuccur85oiFWfaaKDCTisWPMYZKPkd+07tl/OscVBSa9E85qh9LW4fvi veSVxK7cxWQzN4vA8WQ5eYEsE2Tghursf/c/QxbiSkwKLrGBs1zWxQgx0FZPyNXLgzFj lfMUfJDGaZ6ppaKpKDA9dkbK+FiM1JF2FmUq1fWxYVsH95R7qnIaq3XEsp0MNVyZvEzt hFDA== X-Gm-Message-State: AOAM533/smERogYiaD36d3c7TfdMRenBK6YkaBzm1I99vXHN/3zPsBNK nQmGF2ETZ255qfCzn3wylfJMglbaKx0= X-Google-Smtp-Source: ABdhPJxeoIXKTtr1Eac+JLQP/TR8UiF9Bvz4MQmDCJgz3PpZMAceA1fPSm1VCpvO44QiHvoLezMEEQ== X-Received: by 2002:a9d:b93:0:b0:5af:82ec:574e with SMTP id 19-20020a9d0b93000000b005af82ec574emr2173283oth.209.1645622403003; Wed, 23 Feb 2022 05:20:03 -0800 (PST) From: Daniel Henrique Barboza To: libvir-list@redhat.com Subject: [PATCH v3 01/29] qemu_domain.c: add PowerNV machine helpers Date: Wed, 23 Feb 2022 10:19:24 -0300 Message-Id: <20220223131952.922228-2-danielhb413@gmail.com> In-Reply-To: <20220223131952.922228-1-danielhb413@gmail.com> References: <20220223131952.922228-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: 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.14 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1645622565394100003 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: J=C3=A1n Tomko Reviewed-by: Peter Krempa Signed-off-by: Daniel Henrique Barboza --- src/qemu/qemu_domain.c | 36 ++++++++++++++++++++++++++++++++++++ src/qemu/qemu_domain.h | 4 ++++ 2 files changed, 40 insertions(+) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index acc76c1cd6..bacde142f8 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -8759,6 +8759,42 @@ qemuDomainIsPSeries(const virDomainDef *def) } =20 =20 +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 qemuDomainIsMipsMalta(const virDomainDef *def) { diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index be56b5dbb3..f64608660c 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -764,6 +764,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 @@ -773,6 +775,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 qemuDomainIsMipsMalta(const virDomainDef *def); bool qemuDomainHasPCIRoot(const virDomainDef *def); bool qemuDomainHasPCIeRoot(const virDomainDef *def); --=20 2.35.1