From nobody Sun Feb 8 18:44:48 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; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1695385022; cv=none; d=zohomail.com; s=zohoarc; b=jvjmr+p5BDsBc23NjNXyKKxz0WEFEJGaukkqsBv9l0gEK7T+hdHC47HAVKoKJaFYfhGMgDiW7CfE5Mu/zf/7OprB9PDUMFD+UdnqO8HiPSFmK9lIQY1Gr0hCDPt670I5aOeLtAlmYw8Um2tbpWSJ3Rb8lRqSeYOiM4oaLOv+8wc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1695385022; h=Content-Type:Content-Transfer-Encoding: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=+T7O73v+lhsZTgSwngu683HSwdHSKDvAIlh5uDHIn8M=; b=F2iOS3LA4yX2eXOq+6h3ZmDa/Ei7i68IM6VJgZLLHUq65epmH1Xx+7j56SiWI6/EWGaD3pDxThGHOIkeXn8XPskakBJqGXSUNM2ZvBLKPoY342a57rmycxZD2sA9ob1WBCEXzV0h5zt53bOeDM4yaKyG7T6ghQkL+Pd0fY4/xGM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) 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 1695385022932266.7947697228758; Fri, 22 Sep 2023 05:17:02 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-508-btLTQQWZMjO6Tz_uVFqBoQ-1; Fri, 22 Sep 2023 08:16:57 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (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 988DD3C0F676; Fri, 22 Sep 2023 12:16:54 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 75A14C154CB; Fri, 22 Sep 2023 12:16:54 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 3218119466F8; Fri, 22 Sep 2023 12:16:54 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 3782219466F5 for ; Fri, 22 Sep 2023 12:16:52 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 19544C154CA; Fri, 22 Sep 2023 12:16:52 +0000 (UTC) Received: from maggie.brq.redhat.com (unknown [10.43.2.46]) by smtp.corp.redhat.com (Postfix) with ESMTP id B4D05C15BB8 for ; Fri, 22 Sep 2023 12:16:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1695385022; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=+T7O73v+lhsZTgSwngu683HSwdHSKDvAIlh5uDHIn8M=; b=B88/NCp47rKI3p2WoxabZ9gD5keZyJjcDrpZj/R6iW64qPtRGrdKTO4VUzTzm0nZgbnoey 6abIwfBQJqBeV7XopBNg6BLc3cD8+sMQp6Fz/jGe7DlpBMl75eAdu8UQv5bGWS31XQizxG sxGK5LCpwhPsTBHRQtDRe6Bnrnmy03A= X-MC-Unique: btLTQQWZMjO6Tz_uVFqBoQ-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 1/3] domain_validate: Validate VIRTIO_PMEM address alignment Date: Fri, 22 Sep 2023 14:16:47 +0200 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1695385024242100005 Content-Type: text/plain; charset="utf-8"; x-default="true" QEMU mandates the VIRTIO_PMEM address is aligned to a pagesize. This is a very reasonable requirement. So much so, that it deserves to be in hypervisor agnostic validation code (virDomainMemoryDefValidate()). Not that any other hypervisor would support VIRTIO_PMEM yet. But even if they did, this would surely be still valid. Signed-off-by: Michal Privoznik --- src/conf/domain_validate.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/conf/domain_validate.c b/src/conf/domain_validate.c index ac32fa1477..e423383e22 100644 --- a/src/conf/domain_validate.c +++ b/src/conf/domain_validate.c @@ -2221,6 +2221,7 @@ static int virDomainMemoryDefValidate(const virDomainMemoryDef *mem, const virDomainDef *def) { + const long pagesize =3D virGetSystemPageSize(); unsigned long long thpSize; =20 /* Guest NUMA nodes are continuous and indexed from zero. */ @@ -2295,6 +2296,14 @@ virDomainMemoryDefValidate(const virDomainMemoryDef = *mem, _("virtio-pmem does not support NUMA nodes")); return -1; } + + if (pagesize > 0 && + mem->target.virtio_pmem.address % pagesize !=3D 0) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("memory address must be aligned to %1$ld byte= s"), + pagesize); + return -1; + } break; =20 case VIR_DOMAIN_MEMORY_MODEL_VIRTIO_MEM: --=20 2.41.0