From nobody Mon Feb 9 11:38:03 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1577999037; cv=none; d=zohomail.com; s=zohoarc; b=DEYNykCCV1tFhG/2oNNMQrwMF/icDeuXblIHA5bwyLuSmgwu6ljBljbvcsmRfgR3WNgp5+mTL/TbYfDkJXKA2uVZaYpvsTIYlWMZlS6IdYnhhkB2txKewN/FLeOAY3yktDuh3Gjf06XSC7Bz+AB29Mdrb9P9DiLRGJTxGi2KxoY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1577999037; 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=XvM+x+U//sNpxwKnWsxJ8Igu9nUn0utM6MJUGCdIYMs=; b=HUbgTpNOXCQfnXM1jV9m9LO1LRLWD3kkNHp829wPkVcE9p0h9ofBYCvbtaGEqxcpmqbz9HxUudVLCMxiynhCeXxf9xEIUqM4ISwvy3XSUoaPJDHW9fx/Is11li45aewLOky7JetfCDstJVjfZYgD1D+U0kK5tFnrfrJesG1QkbI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1577999037276326.9362475297348; Thu, 2 Jan 2020 13:03:57 -0800 (PST) Received: from localhost ([::1]:45632 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1in7dL-0005r6-SO for importer@patchew.org; Thu, 02 Jan 2020 16:03:55 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:54528) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1in7bf-0004CB-18 for qemu-devel@nongnu.org; Thu, 02 Jan 2020 16:02:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1in7bd-0001lB-Vl for qemu-devel@nongnu.org; Thu, 02 Jan 2020 16:02:10 -0500 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:46688 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1in7bd-0001jZ-Os for qemu-devel@nongnu.org; Thu, 02 Jan 2020 16:02:09 -0500 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-231-O7DYVPx-PgeJMuWhSlxORA-1; Thu, 02 Jan 2020 16:02:08 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2542918C8C02; Thu, 2 Jan 2020 21:02:07 +0000 (UTC) Received: from localhost (ovpn-112-20.ams2.redhat.com [10.36.112.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id 85B54101F942; Thu, 2 Jan 2020 21:02:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1577998929; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=XvM+x+U//sNpxwKnWsxJ8Igu9nUn0utM6MJUGCdIYMs=; b=beTFWhlm6S6bphwJQZqE+Zmrat/FPk4wREKfUU4c+6ieJKVbGiNvwlMsHjtyBpwAqAJsmd IyZfI5ulrD099dmbqECDqLMOsXMawYPsnfJFl5wLow23I12Rrbm+0F7GSXx1rWjtw/BEFb u/EhsLiVQJ8wtPDJUO+G/JALK6U/ypA= From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Subject: [PATCH 1/2] RFC: savevm: check RAM is page_size aligned Date: Fri, 3 Jan 2020 01:01:48 +0400 Message-Id: <20200102210149.926077-2-marcandre.lureau@redhat.com> In-Reply-To: <20200102210149.926077-1-marcandre.lureau@redhat.com> References: <20200102210149.926077-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-MC-Unique: O7DYVPx-PgeJMuWhSlxORA-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.120 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Stefan Berger , "Dr. David Alan Gilbert" , Juan Quintela Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Check the host pointer is correctly aligned, otherwise we may fail during migration in ram_block_discard_range(). Signed-off-by: Marc-Andr=C3=A9 Lureau --- migration/savevm.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/migration/savevm.c b/migration/savevm.c index a71b930b91..ab6e02011f 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -2910,6 +2910,11 @@ err_drain: =20 void vmstate_register_ram(MemoryRegion *mr, DeviceState *dev) { + RAMBlock *rb =3D mr->ram_block; + uintptr_t hostaddr =3D (uintptr_t)qemu_ram_get_host_addr(rb); + + assert((hostaddr & (qemu_ram_pagesize(rb) - 1)) =3D=3D 0); + qemu_ram_set_idstr(mr->ram_block, memory_region_name(mr), dev); qemu_ram_set_migratable(mr->ram_block); --=20 2.24.0.308.g228f53135a From nobody Mon Feb 9 11:38:03 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1577999070; cv=none; d=zohomail.com; s=zohoarc; b=Awps5ZfYXp7A+Mn5NSdwoQT/541Ane2RPTrpWvyl9fYysFPaYle8ji6aglJGhgxpGpEWFQKcSEP7sdA1MOppraO/SXpvR1nXNZXYWy37ECwshFaLBtKTI9c/eNACkX60aEvwHb3XZrdIg0Kr7M+E/A/bh9kRn/XnrLQt+hWUR1M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1577999070; 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=49WrcwhgmLKeNLSi0Xl/yoFIFoNOEA1ECXOFvggs1PA=; b=SOOmZdB+LKDmfBi+H9ea6Tfr0CaNkZAycrTLg3mH4LNc5urRG0R8XtWrjEmjd4aa1eojcvhsfDUe3u8yT6MW+ApRW2CSC20zCFqaiOVo/zvU4UD/7/KYhCF9kRxaYoGZq0IXp8Tmx4q63xae03yVtbMukrg5KcdVZ1/nK+ugKPc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1577999070510573.3783706145695; Thu, 2 Jan 2020 13:04:30 -0800 (PST) Received: from localhost ([::1]:45634 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1in7ds-0006Bx-K7 for importer@patchew.org; Thu, 02 Jan 2020 16:04:29 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:55253) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1in7bn-0004OV-St for qemu-devel@nongnu.org; Thu, 02 Jan 2020 16:02:22 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1in7bm-00027b-Pb for qemu-devel@nongnu.org; Thu, 02 Jan 2020 16:02:19 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:34250 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1in7bm-00026U-KZ for qemu-devel@nongnu.org; Thu, 02 Jan 2020 16:02:18 -0500 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-228-4wXuRmGlPDieiwhuJO-nGg-1; Thu, 02 Jan 2020 16:02:17 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 389E018C8C01; Thu, 2 Jan 2020 21:02:16 +0000 (UTC) Received: from localhost (ovpn-112-20.ams2.redhat.com [10.36.112.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id A25947BF80; Thu, 2 Jan 2020 21:02:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1577998938; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=49WrcwhgmLKeNLSi0Xl/yoFIFoNOEA1ECXOFvggs1PA=; b=LcBmQn7Nm05I/zPQMuVciwztBsufjTfr9B/Zz/MdXmZ+9xxAcxrTHpvBVOQ3zJsC4jNLiN dKAsj1nt7OHumwqpDNTwSUa/n85yJrXIvLPGIl43FC9ohdUSu4tmhUID6Ehen9EoUru//0 gnCbHIf6oiMsrJWnW34Q3Han9uU/YL4= From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Subject: [PATCH 2/2] tpm-ppi: page-align PPI RAM Date: Fri, 3 Jan 2020 01:01:49 +0400 Message-Id: <20200102210149.926077-3-marcandre.lureau@redhat.com> In-Reply-To: <20200102210149.926077-1-marcandre.lureau@redhat.com> References: <20200102210149.926077-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: 4wXuRmGlPDieiwhuJO-nGg-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 205.139.110.120 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , qemu-stable@nongnu.org, Stefan Berger , "Dr. David Alan Gilbert" , Juan Quintela Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" post-copy migration fails on destination with error such as: 2019-12-26T10:22:44.714644Z qemu-kvm: ram_block_discard_range: Unaligned start address: 0x559d2afae9a0 Use qemu_memalign() to constrain the PPI RAM memory alignment. Cc: qemu-stable@nongnu.org Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/tpm/tpm_ppi.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/tpm/tpm_ppi.c b/hw/tpm/tpm_ppi.c index ff314592b4..6d9c1a3e40 100644 --- a/hw/tpm/tpm_ppi.c +++ b/hw/tpm/tpm_ppi.c @@ -43,7 +43,8 @@ void tpm_ppi_reset(TPMPPI *tpmppi) void tpm_ppi_init(TPMPPI *tpmppi, struct MemoryRegion *m, hwaddr addr, Object *obj) { - tpmppi->buf =3D g_malloc0(HOST_PAGE_ALIGN(TPM_PPI_ADDR_SIZE)); + tpmppi->buf =3D qemu_memalign(qemu_real_host_page_size, + HOST_PAGE_ALIGN(TPM_PPI_ADDR_SIZE)); memory_region_init_ram_device_ptr(&tpmppi->ram, obj, "tpm-ppi", TPM_PPI_ADDR_SIZE, tpmppi->buf); vmstate_register_ram(&tpmppi->ram, DEVICE(obj)); --=20 2.24.0.308.g228f53135a