From nobody Sun Feb 8 21:26:24 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1606245670; cv=none; d=zohomail.com; s=zohoarc; b=aPFm6M5okOegkyNcNGd6eBLkevYmMx57RuPzYdgJciMdRKQlNhp2fiYDyUBM/P5qe+I42ZSBVASKnRdP7SwWINq+Cm1nz4rqf8DrZupKpzdVkJmhFPUURpgBLMvj/NgkvRQF4fx/4sHV8r53v1vJYh6yZqUdFjRJJqA7Pne+HMw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1606245670; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=AkBDY1uDSrzxHgiVEiOXT6wK6R+s5GXidoxwjr/aX70=; b=AKQF40wteT30Fo7mfADJe4mO309xpkIC/cGmomhEVlJ+1LJkaq8mRrMcyrvtwmJrG32ibVZ7vWrQKUFa3+iBmjkcOE7TOkb+SR5VEXSe6Vu8XHI4h3nqno4i5jEyQVhUUVqOR2U2+73SRo3pXqnHqH247AOtyTVfnDrx42tGfqw= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1606245670209184.0993371894774; Tue, 24 Nov 2020 11:21:10 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-395-z0QgPgmTPI-6rcLwYMTmAg-1; Tue, 24 Nov 2020 14:21:06 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9CCCE1009446; Tue, 24 Nov 2020 19:21:00 +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 47A875C1BD; Tue, 24 Nov 2020 19:21:00 +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 9CD12180954D; Tue, 24 Nov 2020 19:20:57 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0AOJKua9004045 for ; Tue, 24 Nov 2020 14:20:56 -0500 Received: by smtp.corp.redhat.com (Postfix) id 81B85110F0D4; Tue, 24 Nov 2020 19:20:56 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast05.extmail.prod.ext.rdu2.redhat.com [10.11.55.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7D311110F0D2 for ; Tue, 24 Nov 2020 19:20:55 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id CB57D800883 for ; Tue, 24 Nov 2020 19:20:55 +0000 (UTC) Received: from mail-qk1-f195.google.com (mail-qk1-f195.google.com [209.85.222.195]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-384-4yZoHmOXOa-4-WFnrjy9wA-1; Tue, 24 Nov 2020 14:20:53 -0500 Received: by mail-qk1-f195.google.com with SMTP id n132so22178241qke.1 for ; Tue, 24 Nov 2020 11:20:53 -0800 (PST) Received: from rekt.redhat.com ([2804:431:c7c7:d88a:482:7c39:5cca:96f6]) by smtp.gmail.com with ESMTPSA id l79sm88837qke.1.2020.11.24.11.20.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Nov 2020 11:20:51 -0800 (PST) X-MC-Unique: z0QgPgmTPI-6rcLwYMTmAg-1 X-MC-Unique: 4yZoHmOXOa-4-WFnrjy9wA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=AkBDY1uDSrzxHgiVEiOXT6wK6R+s5GXidoxwjr/aX70=; b=dfxxAavNH4VLU5tUYQRITyoJxyrRnoinRNAVmb8HbQIXU+OAZeEfnCvPklo/rYNJGd 5OaKjkeP4N3VMR5gKzfGZLAQJLAXteEmhq7KLk44WuS6/aIxGmKpwypsfQATn0nl3Wbl oQV+/dniWtpHCTlBm/pHrjllCHTpE6VI4UcLVhWXIoq7J1AbX0oli1qJ4fA6kmbFFSBT VrjpPSyxkkbV8kebLXRkCcu2aHst6OpC2HdITEfXgl6GdqlGyS9VN8jrP9pI7grAZ24O box1+PbytkeYmFg0gNYTuz9w+bLI+q0jU9s+E40k2p0J2TUHSBoLHCUSIuvwBHZmiFHR ulrw== X-Gm-Message-State: AOAM5332P6BdRqvRhGqdWb1XGnEZpSH6gMJ7HDNf1BMHoPjsInJSsz5h KedZPLV6S9qT1QJFghTDGfLPqsrGJsg= X-Google-Smtp-Source: ABdhPJytmxdZeAN+sVBRBZsrw/XCq4alNNBOR3FUr5QrdagwJeqO7uaDUWa5dfJGklGEzmXYTU/rbA== X-Received: by 2002:a37:ac11:: with SMTP id e17mr6278624qkm.238.1606245652419; Tue, 24 Nov 2020 11:20:52 -0800 (PST) From: Daniel Henrique Barboza To: libvir-list@redhat.com Subject: [PATCH 01/21] domain_conf.c: move NVDIMM 'labelsize' check to post parse Date: Tue, 24 Nov 2020 16:20:15 -0300 Message-Id: <20201124192035.2343063-2-danielhb413@gmail.com> In-Reply-To: <20201124192035.2343063-1-danielhb413@gmail.com> References: <20201124192035.2343063-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.78 on 10.11.54.3 X-loop: libvir-list@redhat.com Cc: Daniel Henrique Barboza 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.16 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 Content-Type: text/plain; charset="utf-8" Move 'labelsize' validation to virDomainMemoryDefPostParse(). Signed-off-by: Daniel Henrique Barboza reviewed-by. --- src/conf/domain_conf.c | 43 +++++++++++++++++++++--------------------- 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index b1534dcc1e..5e5905f483 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -5363,15 +5363,28 @@ static int virDomainMemoryDefPostParse(virDomainMemoryDefPtr mem, const virDomainDef *def) { - /* Although only the QEMU driver implements PPC64 support, this - * code is related to the platform specification (PAPR), i.e. it - * is hypervisor agnostic, and any future PPC64 hypervisor driver - * will have the same restriction. - */ - if (ARCH_IS_PPC64(def->os.arch) && - mem->model =3D=3D VIR_DOMAIN_MEMORY_MODEL_NVDIMM && - virDomainNVDimmAlignSizePseries(mem) < 0) - return -1; + if (mem->model =3D=3D VIR_DOMAIN_MEMORY_MODEL_NVDIMM) { + if (mem->labelsize && mem->labelsize < 128) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("nvdimm label must be at least 128KiB")); + return -1; + } + + if (mem->labelsize >=3D mem->size) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("label size must be smaller than NVDIMM size"= )); + return -1; + } + + /* Although only the QEMU driver implements PPC64 support, this + * code is related to the platform specification (PAPR), i.e. it + * is hypervisor agnostic, and any future PPC64 hypervisor driver + * will have the same restriction. + */ + if (ARCH_IS_PPC64(def->os.arch) && + virDomainNVDimmAlignSizePseries(mem) < 0) + return -1; + } =20 return 0; } @@ -16766,18 +16779,6 @@ virDomainMemoryTargetDefParseXML(xmlNodePtr node, &def->labelsize, false, false) < 0) return -1; =20 - if (def->labelsize && def->labelsize < 128) { - virReportError(VIR_ERR_XML_ERROR, "%s", - _("nvdimm label must be at least 128KiB")); - return -1; - } - - if (def->labelsize >=3D def->size) { - virReportError(VIR_ERR_XML_ERROR, "%s", - _("label size must be smaller than NVDIMM size"= )); - return -1; - } - if (virXPathBoolean("boolean(./readonly)", ctxt)) def->readonly =3D true; } --=20 2.26.2