From nobody Wed May 15 20:14:29 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1666588604; cv=none; d=zohomail.com; s=zohoarc; b=IJW9BWGcTrYVmBGRLmuK1KXzd7sqbwl2vdFJ3wzbHTuqP2pUEsfWky7GMmyxKbR0JjOrpDfkWsQrjmodzOM/GaeE/ErVEFg34QdAXxJCba7raouk9oDfxK7xxzQxVYIk5hNGh/iH1ob11LbEjROudcyNZ+ehW977fHhdneF+Bs4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1666588604; 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=J1StH2dMBzUeyRMEsgfoJeHQ/K4Oy05VZ1BcH9DQeqI=; b=gX3CBPhsEL6aNce3ox3HJJgpbV1eNJ9JyIjCHChkyc2xPlBY8yZEDZhQ7jV4jjmSZdSZzelZ8oEvI3JW0cfh76YpEZCLiLzY+fsOYgFyDDya+WFv46LZ381yMrGJiQql/waT4IoVAHU3kTAFEd5RQGjgtrp0AdyqEBQxQ0ZLW6A= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1666588604890335.11825083457745; Sun, 23 Oct 2022 22:16:44 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1omoXu-0008Bo-CS; Sun, 23 Oct 2022 23:54:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1omoXs-00089z-Sw for qemu-devel@nongnu.org; Sun, 23 Oct 2022 23:54:36 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1omoXr-0000fr-Fk for qemu-devel@nongnu.org; Sun, 23 Oct 2022 23:54:36 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.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-163--TV7x0WtNni4YESCe9IrvQ-1; Sun, 23 Oct 2022 23:54:31 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D542B299E750; Mon, 24 Oct 2022 03:54:30 +0000 (UTC) Received: from gshan.redhat.com (vpn2-54-29.bne.redhat.com [10.64.54.29]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7F0F440C6F75; Mon, 24 Oct 2022 03:54:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1666583674; 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=J1StH2dMBzUeyRMEsgfoJeHQ/K4Oy05VZ1BcH9DQeqI=; b=HX3rHPLinRpfIgtLme71nWLVgekgn6RL1qJCoDTjOfvr9ieu66rejds8StJeVU8HPz0Mce vCF1MwirjScrP/rGKzRutrX8iGjGhwpLhXUvIFp9QqW7KWaXCwxWEKGxw9B/IzmFBtRZUg Yrhxr5j6qWsUCoXN2bHDnHKIyorAvzU= X-MC-Unique: -TV7x0WtNni4YESCe9IrvQ-1 From: Gavin Shan To: qemu-arm@nongnu.org Cc: qemu-devel@nongnu.org, maz@kernel.org, eric.auger@redhat.com, cohuck@redhat.com, zhenyzha@redhat.com, richard.henderson@linaro.org, peter.maydell@linaro.org, shan.gavin@gmail.com Subject: [PATCH v6 1/7] hw/arm/virt: Introduce virt_set_high_memmap() helper Date: Mon, 24 Oct 2022 11:54:10 +0800 Message-Id: <20221024035416.34068-2-gshan@redhat.com> In-Reply-To: <20221024035416.34068-1-gshan@redhat.com> References: <20221024035416.34068-1-gshan@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 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; Received-SPF: pass client-ip=170.10.129.124; envelope-from=gshan@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.517, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Qemu-devel" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1666588605744100003 Content-Type: text/plain; charset="utf-8" This introduces virt_set_high_memmap() helper. The logic of high memory region address assignment is moved to the helper. The intention is to make the subsequent optimization for high memory region address assignment easier. No functional change intended. Signed-off-by: Gavin Shan Reviewed-by: Eric Auger Reviewed-by: Cornelia Huck Tested-by: Zhenyu Zhang Reviewed-by: Marc Zyngier --- hw/arm/virt.c | 74 ++++++++++++++++++++++++++++----------------------- 1 file changed, 41 insertions(+), 33 deletions(-) diff --git a/hw/arm/virt.c b/hw/arm/virt.c index cda9defe8f..7572c44bda 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -1689,6 +1689,46 @@ static uint64_t virt_cpu_mp_affinity(VirtMachineStat= e *vms, int idx) return arm_cpu_mp_affinity(idx, clustersz); } =20 +static void virt_set_high_memmap(VirtMachineState *vms, + hwaddr base, int pa_bits) +{ + int i; + + for (i =3D VIRT_LOWMEMMAP_LAST; i < ARRAY_SIZE(extended_memmap); i++) { + hwaddr size =3D extended_memmap[i].size; + bool fits; + + base =3D ROUND_UP(base, size); + vms->memmap[i].base =3D base; + vms->memmap[i].size =3D size; + + /* + * Check each device to see if they fit in the PA space, + * moving highest_gpa as we go. + * + * For each device that doesn't fit, disable it. + */ + fits =3D (base + size) <=3D BIT_ULL(pa_bits); + if (fits) { + vms->highest_gpa =3D base + size - 1; + } + + switch (i) { + case VIRT_HIGH_GIC_REDIST2: + vms->highmem_redists &=3D fits; + break; + case VIRT_HIGH_PCIE_ECAM: + vms->highmem_ecam &=3D fits; + break; + case VIRT_HIGH_PCIE_MMIO: + vms->highmem_mmio &=3D fits; + break; + } + + base +=3D size; + } +} + static void virt_set_memmap(VirtMachineState *vms, int pa_bits) { MachineState *ms =3D MACHINE(vms); @@ -1744,39 +1784,7 @@ static void virt_set_memmap(VirtMachineState *vms, i= nt pa_bits) /* We know for sure that at least the memory fits in the PA space */ vms->highest_gpa =3D memtop - 1; =20 - for (i =3D VIRT_LOWMEMMAP_LAST; i < ARRAY_SIZE(extended_memmap); i++) { - hwaddr size =3D extended_memmap[i].size; - bool fits; - - base =3D ROUND_UP(base, size); - vms->memmap[i].base =3D base; - vms->memmap[i].size =3D size; - - /* - * Check each device to see if they fit in the PA space, - * moving highest_gpa as we go. - * - * For each device that doesn't fit, disable it. - */ - fits =3D (base + size) <=3D BIT_ULL(pa_bits); - if (fits) { - vms->highest_gpa =3D base + size - 1; - } - - switch (i) { - case VIRT_HIGH_GIC_REDIST2: - vms->highmem_redists &=3D fits; - break; - case VIRT_HIGH_PCIE_ECAM: - vms->highmem_ecam &=3D fits; - break; - case VIRT_HIGH_PCIE_MMIO: - vms->highmem_mmio &=3D fits; - break; - } - - base +=3D size; - } + virt_set_high_memmap(vms, base, pa_bits); =20 if (device_memory_size > 0) { ms->device_memory =3D g_malloc0(sizeof(*ms->device_memory)); --=20 2.23.0 From nobody Wed May 15 20:14:29 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1666594597; cv=none; d=zohomail.com; s=zohoarc; b=c4S7ITI51AwcRHDjXO1Yk0SMXXeoRV808f2AUlz7tcJxvU2Tljt5eRC9Sy8mDbw/Jqr6IXaXzcRUQL1aMNzam9Oz/Ksto6A3w+Gou2I0F14PTmeKgYm5/yqGMkg1LeYX9A69nle8GydwRozVrakCStcKRGfIr/RQqPt6zjs7OKE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1666594597; 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=BJ57TJbYSzGwdVgx3REDNP22E1p8XARhKt6nl56mLwI=; b=DEMhmOvwCzJLH4FxZsKsw8wB7FvddblZr9b1DyyBGtfnWMHnxolXtQw6Smn5N9JJui8L1YF2ne47cgcLL3QgcbXNCQblpR0bvpY/I0GIx+ZyLYoN2KWXnyXW7CqUlxWRbfB2nav3T/AMGObmTZokYopMheOs4CXrDuoOSohD5Pc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1666594597558541.2396588612709; Sun, 23 Oct 2022 23:56:37 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1omoXy-0008Id-FR; Sun, 23 Oct 2022 23:54:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1omoXw-0008G7-S5 for qemu-devel@nongnu.org; Sun, 23 Oct 2022 23:54:40 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1omoXv-0000ga-GK for qemu-devel@nongnu.org; Sun, 23 Oct 2022 23:54:40 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-250-C3AJLYbWOBCSFX_AnIY-xg-1; Sun, 23 Oct 2022 23:54:35 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D00F8811E67; Mon, 24 Oct 2022 03:54:34 +0000 (UTC) Received: from gshan.redhat.com (vpn2-54-29.bne.redhat.com [10.64.54.29]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6F8DB40C6E16; Mon, 24 Oct 2022 03:54:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1666583678; 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=BJ57TJbYSzGwdVgx3REDNP22E1p8XARhKt6nl56mLwI=; b=b+CP4JrtYyj4i4NkduHdh3+l/VQpxTkDCHUn4XuDok+tldajJrs73CTy9fVRF/2BoBfQ3k 8gwKQa+akrvFzdu6Uk7inwD6IJomCZ5NgK1Drm5nzvRYP4kE1KOctEHS2GtK4OQTNQlGR/ hR4JjDNba1Pfovrt3AjBainrumUjSGs= X-MC-Unique: C3AJLYbWOBCSFX_AnIY-xg-1 From: Gavin Shan To: qemu-arm@nongnu.org Cc: qemu-devel@nongnu.org, maz@kernel.org, eric.auger@redhat.com, cohuck@redhat.com, zhenyzha@redhat.com, richard.henderson@linaro.org, peter.maydell@linaro.org, shan.gavin@gmail.com Subject: [PATCH v6 2/7] hw/arm/virt: Rename variable size to region_size in virt_set_high_memmap() Date: Mon, 24 Oct 2022 11:54:11 +0800 Message-Id: <20221024035416.34068-3-gshan@redhat.com> In-Reply-To: <20221024035416.34068-1-gshan@redhat.com> References: <20221024035416.34068-1-gshan@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 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; Received-SPF: pass client-ip=170.10.133.124; envelope-from=gshan@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.517, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Qemu-devel" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1666594598482100002 Content-Type: text/plain; charset="utf-8" This renames variable 'size' to 'region_size' in virt_set_high_memmap(). Its counterpart ('region_base') will be introduced in next patch. No functional change intended. Signed-off-by: Gavin Shan Reviewed-by: Eric Auger Reviewed-by: Cornelia Huck Tested-by: Zhenyu Zhang Reviewed-by: Marc Zyngier --- hw/arm/virt.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/hw/arm/virt.c b/hw/arm/virt.c index 7572c44bda..e2ae88cf8b 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -1692,15 +1692,16 @@ static uint64_t virt_cpu_mp_affinity(VirtMachineSta= te *vms, int idx) static void virt_set_high_memmap(VirtMachineState *vms, hwaddr base, int pa_bits) { + hwaddr region_size; + bool fits; int i; =20 for (i =3D VIRT_LOWMEMMAP_LAST; i < ARRAY_SIZE(extended_memmap); i++) { - hwaddr size =3D extended_memmap[i].size; - bool fits; + region_size =3D extended_memmap[i].size; =20 - base =3D ROUND_UP(base, size); + base =3D ROUND_UP(base, region_size); vms->memmap[i].base =3D base; - vms->memmap[i].size =3D size; + vms->memmap[i].size =3D region_size; =20 /* * Check each device to see if they fit in the PA space, @@ -1708,9 +1709,9 @@ static void virt_set_high_memmap(VirtMachineState *vm= s, * * For each device that doesn't fit, disable it. */ - fits =3D (base + size) <=3D BIT_ULL(pa_bits); + fits =3D (base + region_size) <=3D BIT_ULL(pa_bits); if (fits) { - vms->highest_gpa =3D base + size - 1; + vms->highest_gpa =3D base + region_size - 1; } =20 switch (i) { @@ -1725,7 +1726,7 @@ static void virt_set_high_memmap(VirtMachineState *vm= s, break; } =20 - base +=3D size; + base +=3D region_size; } } =20 --=20 2.23.0 From nobody Wed May 15 20:14:29 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1666592450; cv=none; d=zohomail.com; s=zohoarc; b=H2RDjD0OGKEEqA3h4UF8T5bbrpeN1x1J6RsN5D37XgO4xmkNy1Srk/0zRxD1T5ZE65Bk5Xay2r0tSBeY7hP7srFaT/tfd2bbB0VA9KwUpO1zlJCgJQzAN0QjJELYQRpb6pS4RGjf8l1SHn+biaEzXlk+qslAH/5VvexKf3AKBEM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1666592450; 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=P7/YFIchJM356I62C5VUUHhFJnlQhOpxMt8aJiRvNhE=; b=ikfQicy1PuF369azpaFC6RIamcJdVmzIHGQ86wz6Y2qP7/SylVppXYwJ2CXh9mfCwTSPsOBPaYNIICvFg+IhhvmC+fcOsv6FeVj9eo3Az2dWTOCHqNogFKWOCZgNv2ccjceQTWZrU4kNYsZ3lLwNRBWn1SSXRWzESlS9zh0H9cg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1666592450146887.5107366779622; Sun, 23 Oct 2022 23:20:50 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1omoY2-0008O8-Cs; Sun, 23 Oct 2022 23:54:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1omoY0-0008Ls-GI for qemu-devel@nongnu.org; Sun, 23 Oct 2022 23:54:44 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1omoXz-0000hg-4j for qemu-devel@nongnu.org; Sun, 23 Oct 2022 23:54:44 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-114-bMGhKQ3mMkuPpx-KlBHQYQ-1; Sun, 23 Oct 2022 23:54:39 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id CE2CB811E75; Mon, 24 Oct 2022 03:54:38 +0000 (UTC) Received: from gshan.redhat.com (vpn2-54-29.bne.redhat.com [10.64.54.29]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6E43940C6E16; Mon, 24 Oct 2022 03:54:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1666583682; 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=P7/YFIchJM356I62C5VUUHhFJnlQhOpxMt8aJiRvNhE=; b=CXlN6hizagSvTDbmLTu8BO5DLX+Y9IeadqOu9XjoQ5iKIOijuER5Sw2/9uXlX5F8AOLeld +aiFQhYiiLSFABK02gXvF2azy6WGfxoCa/JgMXj7aJ09d9Nzrrf8Rp0ysBkY7CyprFHry5 EkAQj7xAD1xayNf5gjF4U1E9AqWldWs= X-MC-Unique: bMGhKQ3mMkuPpx-KlBHQYQ-1 From: Gavin Shan To: qemu-arm@nongnu.org Cc: qemu-devel@nongnu.org, maz@kernel.org, eric.auger@redhat.com, cohuck@redhat.com, zhenyzha@redhat.com, richard.henderson@linaro.org, peter.maydell@linaro.org, shan.gavin@gmail.com Subject: [PATCH v6 3/7] hw/arm/virt: Introduce variable region_base in virt_set_high_memmap() Date: Mon, 24 Oct 2022 11:54:12 +0800 Message-Id: <20221024035416.34068-4-gshan@redhat.com> In-Reply-To: <20221024035416.34068-1-gshan@redhat.com> References: <20221024035416.34068-1-gshan@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 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; Received-SPF: pass client-ip=170.10.133.124; envelope-from=gshan@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.517, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Qemu-devel" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1666592451180100002 Content-Type: text/plain; charset="utf-8" This introduces variable 'region_base' for the base address of the specific high memory region. It's the preparatory work to optimize high memory region address assignment. No functional change intended. Signed-off-by: Gavin Shan Reviewed-by: Eric Auger Reviewed-by: Cornelia Huck Tested-by: Zhenyu Zhang Reviewed-by: Marc Zyngier --- hw/arm/virt.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/hw/arm/virt.c b/hw/arm/virt.c index e2ae88cf8b..0bf3cb7057 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -1692,15 +1692,15 @@ static uint64_t virt_cpu_mp_affinity(VirtMachineSta= te *vms, int idx) static void virt_set_high_memmap(VirtMachineState *vms, hwaddr base, int pa_bits) { - hwaddr region_size; + hwaddr region_base, region_size; bool fits; int i; =20 for (i =3D VIRT_LOWMEMMAP_LAST; i < ARRAY_SIZE(extended_memmap); i++) { + region_base =3D ROUND_UP(base, extended_memmap[i].size); region_size =3D extended_memmap[i].size; =20 - base =3D ROUND_UP(base, region_size); - vms->memmap[i].base =3D base; + vms->memmap[i].base =3D region_base; vms->memmap[i].size =3D region_size; =20 /* @@ -1709,9 +1709,9 @@ static void virt_set_high_memmap(VirtMachineState *vm= s, * * For each device that doesn't fit, disable it. */ - fits =3D (base + region_size) <=3D BIT_ULL(pa_bits); + fits =3D (region_base + region_size) <=3D BIT_ULL(pa_bits); if (fits) { - vms->highest_gpa =3D base + region_size - 1; + vms->highest_gpa =3D region_base + region_size - 1; } =20 switch (i) { @@ -1726,7 +1726,7 @@ static void virt_set_high_memmap(VirtMachineState *vm= s, break; } =20 - base +=3D region_size; + base =3D region_base + region_size; } } =20 --=20 2.23.0 From nobody Wed May 15 20:14:29 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1666595451; cv=none; d=zohomail.com; s=zohoarc; b=f5CnCKAxneEoLVU3OBSFvqHSA+Txi4xE1SH9Whl8+wf83WWOsa4z/IUwfK9Cc5iyM9/bPfQGS2cFWE69/OcmOMKcujg9/qQsq20ugjOhm7/zZ3zFaptGWMrIJWwvdT9eSf4pOAxM2+ts1B4dOkf0RS5CuG3AAdwdj3IDUcTLCCo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1666595451; 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=WSq58Oi2QPxK1jylHq564L9qs0YFSerIVcHKNyN5Y4o=; b=U49McJl2Moh+ht243NdRQvIThRfxSsk4xC5Xsh218A3fGLRK7Iy9nXDXqXFwxbENCZkZiGC8F17LLQRSnoM4OmdcU3TTzJGoCSBO6xDMrOwOurdLEL+lG56YxDKNADUn6MRdK673n/Pkqa/YRqhNBuPdglxM1Fv2VQZP2vmfO5Q= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1666595451602294.30820890065434; Mon, 24 Oct 2022 00:10:51 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1omoY7-0008UI-RK; Sun, 23 Oct 2022 23:54:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1omoY6-0008Ss-Kv for qemu-devel@nongnu.org; Sun, 23 Oct 2022 23:54:50 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1omoY5-0000jr-8A for qemu-devel@nongnu.org; Sun, 23 Oct 2022 23:54:50 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.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-627-6Do9aOHbPumzEpKMJ4k5IQ-1; Sun, 23 Oct 2022 23:54:43 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 4D67E1C05AC2; Mon, 24 Oct 2022 03:54:42 +0000 (UTC) Received: from gshan.redhat.com (vpn2-54-29.bne.redhat.com [10.64.54.29]) by smtp.corp.redhat.com (Postfix) with ESMTP id 64AEC40C6F75; Mon, 24 Oct 2022 03:54:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1666583688; 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=WSq58Oi2QPxK1jylHq564L9qs0YFSerIVcHKNyN5Y4o=; b=VdNEQgkZqA5OtttvVR3fxGFNwwsPqza0d0meqWu8caOmwpEZAtomdcF2Z43qMFml8oPICk jqJCiESodeAert+UVNtnyzHzGVqccSo5LBtOciT60EpoDhC+7EcTFvJ60WdHaqaMUQjoJH sF7HbiYLBg13oH7Is5Oyjs0Vt6iHNMw= X-MC-Unique: 6Do9aOHbPumzEpKMJ4k5IQ-1 From: Gavin Shan To: qemu-arm@nongnu.org Cc: qemu-devel@nongnu.org, maz@kernel.org, eric.auger@redhat.com, cohuck@redhat.com, zhenyzha@redhat.com, richard.henderson@linaro.org, peter.maydell@linaro.org, shan.gavin@gmail.com Subject: [PATCH v6 4/7] hw/arm/virt: Introduce virt_get_high_memmap_enabled() helper Date: Mon, 24 Oct 2022 11:54:13 +0800 Message-Id: <20221024035416.34068-5-gshan@redhat.com> In-Reply-To: <20221024035416.34068-1-gshan@redhat.com> References: <20221024035416.34068-1-gshan@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 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; Received-SPF: pass client-ip=170.10.129.124; envelope-from=gshan@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.517, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Qemu-devel" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1666595453560100001 Content-Type: text/plain; charset="utf-8" This introduces virt_get_high_memmap_enabled() helper, which returns the pointer to vms->highmem_{redists, ecam, mmio}. The pointer will be used in the subsequent patches. No functional change intended. Signed-off-by: Gavin Shan Reviewed-by: Eric Auger Reviewed-by: Cornelia Huck Tested-by: Zhenyu Zhang Reviewed-by: Marc Zyngier --- hw/arm/virt.c | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/hw/arm/virt.c b/hw/arm/virt.c index 0bf3cb7057..ee98a8a3b6 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -1689,14 +1689,31 @@ static uint64_t virt_cpu_mp_affinity(VirtMachineSta= te *vms, int idx) return arm_cpu_mp_affinity(idx, clustersz); } =20 +static inline bool *virt_get_high_memmap_enabled(VirtMachineState *vms, + int index) +{ + bool *enabled_array[] =3D { + &vms->highmem_redists, + &vms->highmem_ecam, + &vms->highmem_mmio, + }; + + assert(ARRAY_SIZE(extended_memmap) - VIRT_LOWMEMMAP_LAST =3D=3D + ARRAY_SIZE(enabled_array)); + assert(index - VIRT_LOWMEMMAP_LAST < ARRAY_SIZE(enabled_array)); + + return enabled_array[index - VIRT_LOWMEMMAP_LAST]; +} + static void virt_set_high_memmap(VirtMachineState *vms, hwaddr base, int pa_bits) { hwaddr region_base, region_size; - bool fits; + bool *region_enabled, fits; int i; =20 for (i =3D VIRT_LOWMEMMAP_LAST; i < ARRAY_SIZE(extended_memmap); i++) { + region_enabled =3D virt_get_high_memmap_enabled(vms, i); region_base =3D ROUND_UP(base, extended_memmap[i].size); region_size =3D extended_memmap[i].size; =20 @@ -1714,18 +1731,7 @@ static void virt_set_high_memmap(VirtMachineState *v= ms, vms->highest_gpa =3D region_base + region_size - 1; } =20 - switch (i) { - case VIRT_HIGH_GIC_REDIST2: - vms->highmem_redists &=3D fits; - break; - case VIRT_HIGH_PCIE_ECAM: - vms->highmem_ecam &=3D fits; - break; - case VIRT_HIGH_PCIE_MMIO: - vms->highmem_mmio &=3D fits; - break; - } - + *region_enabled &=3D fits; base =3D region_base + region_size; } } --=20 2.23.0 From nobody Wed May 15 20:14:29 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1666587624; cv=none; d=zohomail.com; s=zohoarc; b=FPPcUnJz0sBbNSNLOsYJwpjNVoYPtHna+FqlYGiA/HQj+46YzMO3W2iMt7D4jVBqWoRQAVTPsTh735qdGmHmzXpooChXkz4sVqTywwRPT9FebbCckVa3Ctbc/5lkRRoJTHAyqi6ILZiaJ4NKdGTDsHeXwWDXcOsG4j16PG0aG7A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1666587624; 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=nsP5JqLfu1xybUwbVvOVW7lKrpO9ImVl/g/gvH5NRmY=; b=drstbtFmM+P10R59Smr6i1wbJ+rnH8NefFYvLMO04y8QA3wRvtWh/+70aMpqC6OWTl0zaQ2J9hEFhOhJzqqILxjUxY3z6JTPtha8ZjpQ0q6oL1bDcA4z1M0w6IDVihtg8X7JujvKSpbGLCkxxpOq9a5lDmeYETzQsMJQGSOG8FM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1666587624530197.90727733108122; Sun, 23 Oct 2022 22:00:24 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1omoYA-000080-I6; Sun, 23 Oct 2022 23:54:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1omoY7-0008Tv-JG for qemu-devel@nongnu.org; Sun, 23 Oct 2022 23:54:51 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1omoY5-0000k2-VU for qemu-devel@nongnu.org; Sun, 23 Oct 2022 23:54:51 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-439-bxTAAC7SMPey4eoqgm2uzw-1; Sun, 23 Oct 2022 23:54:46 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B20A0855438; Mon, 24 Oct 2022 03:54:45 +0000 (UTC) Received: from gshan.redhat.com (vpn2-54-29.bne.redhat.com [10.64.54.29]) by smtp.corp.redhat.com (Postfix) with ESMTP id C971E40C6F9F; Mon, 24 Oct 2022 03:54:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1666583689; 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=nsP5JqLfu1xybUwbVvOVW7lKrpO9ImVl/g/gvH5NRmY=; b=dd3lVM20qP4ijvhpQmQvlLGMYKQowyiEZL4wz6AKHSpfSNbUEIcDpP6MDzWeD+eKnKjROK BrHUohHtiCldZGnnYoRE3EogB6MxkrXWLo3SrjvG2kw8aXelxiuEiQWbeBDh1eWdAZuE17 PxBLH9C5+TXAHbG+Xk4/l0NjxeuXupg= X-MC-Unique: bxTAAC7SMPey4eoqgm2uzw-1 From: Gavin Shan To: qemu-arm@nongnu.org Cc: qemu-devel@nongnu.org, maz@kernel.org, eric.auger@redhat.com, cohuck@redhat.com, zhenyzha@redhat.com, richard.henderson@linaro.org, peter.maydell@linaro.org, shan.gavin@gmail.com Subject: [PATCH v6 5/7] hw/arm/virt: Improve high memory region address assignment Date: Mon, 24 Oct 2022 11:54:14 +0800 Message-Id: <20221024035416.34068-6-gshan@redhat.com> In-Reply-To: <20221024035416.34068-1-gshan@redhat.com> References: <20221024035416.34068-1-gshan@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 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; Received-SPF: pass client-ip=170.10.129.124; envelope-from=gshan@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.517, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Qemu-devel" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1666587626647100003 Content-Type: text/plain; charset="utf-8" There are three high memory regions, which are VIRT_HIGH_REDIST2, VIRT_HIGH_PCIE_ECAM and VIRT_HIGH_PCIE_MMIO. Their base addresses are floating on highest RAM address. However, they can be disabled in several cases. (1) One specific high memory region is likely to be disabled by code by toggling vms->highmem_{redists, ecam, mmio}. (2) VIRT_HIGH_PCIE_ECAM region is disabled on machine, which is 'virt-2.12' or ealier than it. (3) VIRT_HIGH_PCIE_ECAM region is disabled when firmware is loaded on 32-bits system. (4) One specific high memory region is disabled when it breaks the PA space limit. The current implementation of virt_set_{memmap, high_memmap}() isn't optimized because the high memory region's PA space is always reserved, regardless of whatever the actual state in the corresponding vms->highmem_{redists, ecam, mmio} flag. In the code, 'base' and 'vms->highest_gpa' are always increased for case (1), (2) and (3). It's unnecessary since the assigned PA space for the disabled high memory region won't be used afterwards. Improve the address assignment for those three high memory region by skipping the address assignment for one specific high memory region if it has been disabled in case (1), (2) and (3). The memory layout may be changed after the improvement is applied, which leads to potential migration breakage. So 'vms->highmem_compact' is added to control if the improvement should be applied. For now, 'vms->highmem_compact' is set to false, meaning that we don't have memory layout change until it becomes configurable through property 'compact-highmem' in next patch. Signed-off-by: Gavin Shan Reviewed-by: Cornelia Huck Tested-by: Zhenyu Zhang Reviewed-by: Eric Auger Reviewed-by: Marc Zyngier --- hw/arm/virt.c | 15 ++++++++++----- include/hw/arm/virt.h | 1 + 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/hw/arm/virt.c b/hw/arm/virt.c index ee98a8a3b6..4896f600b4 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -1721,18 +1721,23 @@ static void virt_set_high_memmap(VirtMachineState *= vms, vms->memmap[i].size =3D region_size; =20 /* - * Check each device to see if they fit in the PA space, - * moving highest_gpa as we go. + * Check each device to see if it fits in the PA space, + * moving highest_gpa as we go. For compatibility, move + * highest_gpa for disabled fitting devices as well, if + * the compact layout has been disabled. * * For each device that doesn't fit, disable it. */ fits =3D (region_base + region_size) <=3D BIT_ULL(pa_bits); - if (fits) { - vms->highest_gpa =3D region_base + region_size - 1; + *region_enabled &=3D fits; + if (vms->highmem_compact && !*region_enabled) { + continue; } =20 - *region_enabled &=3D fits; base =3D region_base + region_size; + if (fits) { + vms->highest_gpa =3D region_base + region_size - 1; + } } } =20 diff --git a/include/hw/arm/virt.h b/include/hw/arm/virt.h index 6ec479ca2b..709f623741 100644 --- a/include/hw/arm/virt.h +++ b/include/hw/arm/virt.h @@ -144,6 +144,7 @@ struct VirtMachineState { PFlashCFI01 *flash[2]; bool secure; bool highmem; + bool highmem_compact; bool highmem_ecam; bool highmem_mmio; bool highmem_redists; --=20 2.23.0 From nobody Wed May 15 20:14:29 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1666588581; cv=none; d=zohomail.com; s=zohoarc; b=Ab3z0qG5FFZIESXGMNfIZP2waR2nPFekJ0YSe1XtU+jw5IztlOlzVYE4qOtaooGsIbN9cTyIeAIut+sCFEcRrqVcZjny2XfNXvzzjpcU/Dt1K0lbPwktRk1yx+ebEVVGrvc6vvobAm+1lTKyKyYEpzLt2ufCVYOiOngQGngtqRc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1666588581; 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=8vck45eECxnBARm4WHe6d7e/5GucyRRe7WeS8V8sSkk=; b=caAeiZq1sXxw/4XKdPdzarV2+cdPRWu08klE29WVrYPjkDZaQL6PVq2QawO4mFLCHb5wwSTtuHMFUM9WlHnFcek8x5K7ttC5DMaLPdGN/BP3rUJNxneaPzBOCf8qzVEsaqaoIfoKjYkkxPmujBXvFdPky7rfOSqqM8GukvQlTiU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1666588581064661.8425545726677; Sun, 23 Oct 2022 22:16:21 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1omoYC-0000C7-PP; Sun, 23 Oct 2022 23:54:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1omoYB-0000At-RA for qemu-devel@nongnu.org; Sun, 23 Oct 2022 23:54:55 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1omoYA-0000lE-2n for qemu-devel@nongnu.org; Sun, 23 Oct 2022 23:54:55 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.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-27-eyW8NUyoO_OcVBut3iKsYQ-1; Sun, 23 Oct 2022 23:54:50 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 7C9453C0218B; Mon, 24 Oct 2022 03:54:49 +0000 (UTC) Received: from gshan.redhat.com (vpn2-54-29.bne.redhat.com [10.64.54.29]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3A9B340C6F9F; Mon, 24 Oct 2022 03:54:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1666583693; 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=8vck45eECxnBARm4WHe6d7e/5GucyRRe7WeS8V8sSkk=; b=JAUKqolLjoIx3lnj/bZaDHmz4yYnhlLVbl2WgpQC8Be1F18Oc+YbBLdqvPeLIeWubLLuJx sMst09EKO6RkopClyLSQK3Db7AP2f3uw1SjQY4tyGrl7+M9JnsfhvmB2/DT2yd/so5D2Pf DDHMnhHh+hVfoDQj2XOpn4e3qXsOpQY= X-MC-Unique: eyW8NUyoO_OcVBut3iKsYQ-1 From: Gavin Shan To: qemu-arm@nongnu.org Cc: qemu-devel@nongnu.org, maz@kernel.org, eric.auger@redhat.com, cohuck@redhat.com, zhenyzha@redhat.com, richard.henderson@linaro.org, peter.maydell@linaro.org, shan.gavin@gmail.com Subject: [PATCH v6 6/7] hw/arm/virt: Add 'compact-highmem' property Date: Mon, 24 Oct 2022 11:54:15 +0800 Message-Id: <20221024035416.34068-7-gshan@redhat.com> In-Reply-To: <20221024035416.34068-1-gshan@redhat.com> References: <20221024035416.34068-1-gshan@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 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; Received-SPF: pass client-ip=170.10.129.124; envelope-from=gshan@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.517, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Qemu-devel" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1666588581665100003 Content-Type: text/plain; charset="utf-8" After the improvement to high memory region address assignment is applied, the memory layout can be changed, introducing possible migration breakage. For example, VIRT_HIGH_PCIE_MMIO memory region is disabled or enabled when the optimization is applied or not, with the following configuration. The configuration is only achievable by modifying the source code until more properties are added to allow users selectively disable those high memory regions. pa_bits =3D 40; vms->highmem_redists =3D false; vms->highmem_ecam =3D false; vms->highmem_mmio =3D true; # qemu-system-aarch64 -accel kvm -cpu host \ -machine virt-7.2,compact-highmem=3D{on, off} \ -m 4G,maxmem=3D511G -monitor stdio Region compact-highmem=3Doff compact-highmem=3Don ---------------------------------------------------------------- MEM [1GB 512GB] [1GB 512GB] HIGH_GIC_REDISTS2 [512GB 512GB+64MB] [disabled] HIGH_PCIE_ECAM [512GB+256MB 512GB+512MB] [disabled] HIGH_PCIE_MMIO [disabled] [512GB 1TB] In order to keep backwords compatibility, we need to disable the optimization on machine, which is virt-7.1 or ealier than it. It means the optimization is enabled by default from virt-7.2. Besides, 'compact-highmem' property is added so that the optimization can be explicitly enabled or disabled on all machine types by users. Signed-off-by: Gavin Shan Reviewed-by: Cornelia Huck Tested-by: Zhenyu Zhang Reviewed-by: Eric Auger Reviewed-by: Marc Zyngier --- docs/system/arm/virt.rst | 4 ++++ hw/arm/virt.c | 32 ++++++++++++++++++++++++++++++++ include/hw/arm/virt.h | 1 + 3 files changed, 37 insertions(+) diff --git a/docs/system/arm/virt.rst b/docs/system/arm/virt.rst index 20442ea2c1..4454706392 100644 --- a/docs/system/arm/virt.rst +++ b/docs/system/arm/virt.rst @@ -94,6 +94,10 @@ highmem address space above 32 bits. The default is ``on`` for machine types later than ``virt-2.12``. =20 +compact-highmem + Set ``on``/``off`` to enable/disable the compact layout for high memory = regions. + The default is ``on`` for machine types later than ``virt-7.2``. + gic-version Specify the version of the Generic Interrupt Controller (GIC) to provide. Valid values are: diff --git a/hw/arm/virt.c b/hw/arm/virt.c index 4896f600b4..11b5685432 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -174,6 +174,12 @@ static const MemMapEntry base_memmap[] =3D { * Note the extended_memmap is sized so that it eventually also includes t= he * base_memmap entries (VIRT_HIGH_GIC_REDIST2 index is greater than the la= st * index of base_memmap). + * + * The memory map for these Highmem IO Regions can be in legacy or compact + * layout, depending on 'compact-highmem' property. With legacy layout, the + * PA space for one specific region is always reserved, even the region has + * been disabled or doesn't fit into the PA space. However, the PA space f= or + * the region won't be reserved in these circumstances with compact layout. */ static MemMapEntry extended_memmap[] =3D { /* Additional 64 MB redist region (can contain up to 512 redistributor= s) */ @@ -2351,6 +2357,20 @@ static void virt_set_highmem(Object *obj, bool value= , Error **errp) vms->highmem =3D value; } =20 +static bool virt_get_compact_highmem(Object *obj, Error **errp) +{ + VirtMachineState *vms =3D VIRT_MACHINE(obj); + + return vms->highmem_compact; +} + +static void virt_set_compact_highmem(Object *obj, bool value, Error **errp) +{ + VirtMachineState *vms =3D VIRT_MACHINE(obj); + + vms->highmem_compact =3D value; +} + static bool virt_get_its(Object *obj, Error **errp) { VirtMachineState *vms =3D VIRT_MACHINE(obj); @@ -2969,6 +2989,13 @@ static void virt_machine_class_init(ObjectClass *oc,= void *data) "Set on/off to enable/disable us= ing " "physical address space above 32= bits"); =20 + object_class_property_add_bool(oc, "compact-highmem", + virt_get_compact_highmem, + virt_set_compact_highmem); + object_class_property_set_description(oc, "compact-highmem", + "Set on/off to enable/disable co= mpact " + "layout for high memory regions"= ); + object_class_property_add_str(oc, "gic-version", virt_get_gic_version, virt_set_gic_version); object_class_property_set_description(oc, "gic-version", @@ -3053,6 +3080,7 @@ static void virt_instance_init(Object *obj) =20 /* High memory is enabled by default */ vms->highmem =3D true; + vms->highmem_compact =3D !vmc->no_highmem_compact; vms->gic_version =3D VIRT_GIC_VERSION_NOSEL; =20 vms->highmem_ecam =3D !vmc->no_highmem_ecam; @@ -3122,8 +3150,12 @@ DEFINE_VIRT_MACHINE_AS_LATEST(7, 2) =20 static void virt_machine_7_1_options(MachineClass *mc) { + VirtMachineClass *vmc =3D VIRT_MACHINE_CLASS(OBJECT_CLASS(mc)); + virt_machine_7_2_options(mc); compat_props_add(mc->compat_props, hw_compat_7_1, hw_compat_7_1_len); + /* Compact layout for high memory regions was introduced with 7.2 */ + vmc->no_highmem_compact =3D true; } DEFINE_VIRT_MACHINE(7, 1) =20 diff --git a/include/hw/arm/virt.h b/include/hw/arm/virt.h index 709f623741..c7dd59d7f1 100644 --- a/include/hw/arm/virt.h +++ b/include/hw/arm/virt.h @@ -125,6 +125,7 @@ struct VirtMachineClass { bool no_pmu; bool claim_edge_triggered_timers; bool smbios_old_sys_ver; + bool no_highmem_compact; bool no_highmem_ecam; bool no_ged; /* Machines < 4.2 have no support for ACPI GED device */ bool kvm_no_adjvtime; --=20 2.23.0 From nobody Wed May 15 20:14:29 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1666584160; cv=none; d=zohomail.com; s=zohoarc; b=b45dHJ34C0P3fTWbvMYT8arktVf7Olur4yydR+d1NAcm09FEiuS0efHGSrIjodQVsaRP56H4oMH3icTBsfVsrRoBGV0H2SdosCakhjOYcHZoha4R2GRhpK0CbsSZIiWvPWUIvw2E3msFdlwhH3cEOlEUnhXSAMX+GP18TFNcl3A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1666584160; 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=MMkXncs52ndySHJgm8eoiBON5a8d4PMnIToe0RlC2vU=; b=IwCYegVGXNy1V1CYq1wYZUGaKGZbtQReqPzNOWkGslG94WeidwU+x7GeSQ8KWDkHKCokh0EVCvlHG2IcD+QPl93BPiiMbEkKB8JZWCbg1c60jaich9M0Ok+mAiPfXMpSx6rI4o18Zj5n/Frm8z/RlAQJWq74cLvvm+Gds0rb7NE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1666584160693985.3231265686555; Sun, 23 Oct 2022 21:02:40 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1omoYI-0000MF-4V; Sun, 23 Oct 2022 23:55:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1omoYG-0000Ik-Cs for qemu-devel@nongnu.org; Sun, 23 Oct 2022 23:55:00 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1omoYE-0000mi-TQ for qemu-devel@nongnu.org; Sun, 23 Oct 2022 23:55:00 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-556-a7AEOR_zPwizzJDOJaXiXA-1; Sun, 23 Oct 2022 23:54:53 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 7DA58185A794; Mon, 24 Oct 2022 03:54:53 +0000 (UTC) Received: from gshan.redhat.com (vpn2-54-29.bne.redhat.com [10.64.54.29]) by smtp.corp.redhat.com (Postfix) with ESMTP id 178F840C6E16; Mon, 24 Oct 2022 03:54:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1666583697; 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=MMkXncs52ndySHJgm8eoiBON5a8d4PMnIToe0RlC2vU=; b=gIdFlINO3tmEOk6toq/PF1RuYZOHI+AJ1zRLlavJblCBOUTcK4iTUe4azZ/9OwhYHtwTEX 3HntDub8nk1da3Q85j5zjo1LKXxrVOhTvvKrTd36lo+osozPgveX0S21aStyU6rHBOGTwY 5uHWkTcIVfnXX+tt9RbGH0nrOkUUpPE= X-MC-Unique: a7AEOR_zPwizzJDOJaXiXA-1 From: Gavin Shan To: qemu-arm@nongnu.org Cc: qemu-devel@nongnu.org, maz@kernel.org, eric.auger@redhat.com, cohuck@redhat.com, zhenyzha@redhat.com, richard.henderson@linaro.org, peter.maydell@linaro.org, shan.gavin@gmail.com Subject: [PATCH v6 7/7] hw/arm/virt: Add properties to disable high memory regions Date: Mon, 24 Oct 2022 11:54:16 +0800 Message-Id: <20221024035416.34068-8-gshan@redhat.com> In-Reply-To: <20221024035416.34068-1-gshan@redhat.com> References: <20221024035416.34068-1-gshan@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 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; Received-SPF: pass client-ip=170.10.133.124; envelope-from=gshan@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.517, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Qemu-devel" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1666584162550100001 Content-Type: text/plain; charset="utf-8" These 3 high memory regions are usually enabled by default, but they may be not used. For example, VIRT_HIGH_GIC_REDIST2 isn't needed by GICv2. This leads to waste in the PA space. Add properties to allow users selectively disable them if needed: "highmem-redists", "highmem-ecam", "highmem-mmio". Suggested-by: Marc Zyngier Signed-off-by: Gavin Shan Reviewed-by: Marc Zyngier --- docs/system/arm/virt.rst | 12 ++++++++ hw/arm/virt.c | 64 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 76 insertions(+) diff --git a/docs/system/arm/virt.rst b/docs/system/arm/virt.rst index 4454706392..a1668a969d 100644 --- a/docs/system/arm/virt.rst +++ b/docs/system/arm/virt.rst @@ -98,6 +98,18 @@ compact-highmem Set ``on``/``off`` to enable/disable the compact layout for high memory = regions. The default is ``on`` for machine types later than ``virt-7.2``. =20 +highmem-redists + Set ``on``/``off`` to enable/disable the high memry region for GICv3/4 + redistributor. The default is ``on``. + +highmem-ecam + Set ``on``/``off`` to enable/disable the high memry region for PCI ECAM. + The default is ``on`` for machine types later than ``virt-3.0``. + +highmem-mmio + Set ``on``/``off`` to enable/disable the high memry region for PCI MMIO. + The default is ``on``. + gic-version Specify the version of the Generic Interrupt Controller (GIC) to provide. Valid values are: diff --git a/hw/arm/virt.c b/hw/arm/virt.c index 11b5685432..afafc2d1b8 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -2371,6 +2371,49 @@ static void virt_set_compact_highmem(Object *obj, bo= ol value, Error **errp) vms->highmem_compact =3D value; } =20 +static bool virt_get_highmem_redists(Object *obj, Error **errp) +{ + VirtMachineState *vms =3D VIRT_MACHINE(obj); + + return vms->highmem_redists; +} + +static void virt_set_highmem_redists(Object *obj, bool value, Error **errp) +{ + VirtMachineState *vms =3D VIRT_MACHINE(obj); + + vms->highmem_redists =3D value; +} + +static bool virt_get_highmem_ecam(Object *obj, Error **errp) +{ + VirtMachineState *vms =3D VIRT_MACHINE(obj); + + return vms->highmem_ecam; +} + +static void virt_set_highmem_ecam(Object *obj, bool value, Error **errp) +{ + VirtMachineState *vms =3D VIRT_MACHINE(obj); + + vms->highmem_ecam =3D value; +} + +static bool virt_get_highmem_mmio(Object *obj, Error **errp) +{ + VirtMachineState *vms =3D VIRT_MACHINE(obj); + + return vms->highmem_mmio; +} + +static void virt_set_highmem_mmio(Object *obj, bool value, Error **errp) +{ + VirtMachineState *vms =3D VIRT_MACHINE(obj); + + vms->highmem_mmio =3D value; +} + + static bool virt_get_its(Object *obj, Error **errp) { VirtMachineState *vms =3D VIRT_MACHINE(obj); @@ -2996,6 +3039,27 @@ static void virt_machine_class_init(ObjectClass *oc,= void *data) "Set on/off to enable/disable co= mpact " "layout for high memory regions"= ); =20 + object_class_property_add_bool(oc, "highmem-redists", + virt_get_highmem_redists, + virt_set_highmem_redists); + object_class_property_set_description(oc, "highmem-redists", + "Set on/off to enable/disable hi= gh " + "memory region for GICv3/4 redis= tributor"); + + object_class_property_add_bool(oc, "highmem-ecam", + virt_get_highmem_ecam, + virt_set_highmem_ecam); + object_class_property_set_description(oc, "highmem-ecam", + "Set on/off to enable/disable hi= gh " + "memory region for PCI ECAM"); + + object_class_property_add_bool(oc, "highmem-mmio", + virt_get_highmem_mmio, + virt_set_highmem_mmio); + object_class_property_set_description(oc, "highmem-mmio", + "Set on/off to enable/disable hi= gh " + "memory region for PCI MMIO"); + object_class_property_add_str(oc, "gic-version", virt_get_gic_version, virt_set_gic_version); object_class_property_set_description(oc, "gic-version", --=20 2.23.0