From nobody Wed Nov 12 11:57:23 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1570205385; cv=none; d=zoho.com; s=zohoarc; b=C+8f3yUl9vyd6CbNmjikofNOZ2bOOM6cSJ/BTuzyvxg42ZycshE/jnGWcuatxWav3IxgDNcSd+VYTyULeM5qLi2EJDFH9KWdfpdrvyKLrljI+VuKQtGGYTfj32NBB1kHdOTelKXgdHwvGijuBh7ZmsY4gODmnGsmfVQBX2+U3AM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1570205385; h=Content-Type: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:ARC-Authentication-Results; bh=qO0npJ+//3i9lZXH5w+hsZxGu9qf9HZDNxWq3faE9DQ=; b=nR1Zp+M3+w0cqVbr85EMmWRgsjk53Kv6IUWm8d+DYh4F1bC2xRdv8cpW3uoOI3QtlTIbiCz9PF2DAT8r50VOWxsqmiWgRG+1/Q7yGjzunH5xoO2nH5ZUFlpPgBeBrW0fVQvrcR5J3dvGXECzkdLKd9Hl+OY7ntHLdkywjPCn4DU= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1570205385359228.7996633418329; Fri, 4 Oct 2019 09:09:45 -0700 (PDT) Received: from localhost ([::1]:50106 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iGQ9E-0007Rs-Lq for importer@patchew.org; Fri, 04 Oct 2019 12:09:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42293) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iGPuc-0006MI-C6 for qemu-devel@nongnu.org; Fri, 04 Oct 2019 11:54:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iGPuZ-0000ck-C0 for qemu-devel@nongnu.org; Fri, 04 Oct 2019 11:54:34 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:2244 helo=huawei.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iGPuP-0000Un-QR; Fri, 04 Oct 2019 11:54:22 -0400 Received: from DGGEMS412-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id C259B1E99BED508086FD; Fri, 4 Oct 2019 23:54:17 +0800 (CST) Received: from S00345302A-PC.china.huawei.com (10.202.227.237) by DGGEMS412-HUB.china.huawei.com (10.3.19.212) with Microsoft SMTP Server id 14.3.439.0; Fri, 4 Oct 2019 23:54:08 +0800 From: Shameer Kolothum To: , , , Subject: [PATCH 3/5] hw/arm/virt: Add nvdimm hot-plug infrastructure Date: Fri, 4 Oct 2019 16:53:00 +0100 Message-ID: <20191004155302.4632-4-shameerali.kolothum.thodi@huawei.com> X-Mailer: git-send-email 2.12.0.windows.1 In-Reply-To: <20191004155302.4632-1-shameerali.kolothum.thodi@huawei.com> References: <20191004155302.4632-1-shameerali.kolothum.thodi@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.202.227.237] X-CFilter-Loop: Reflected X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 45.249.212.191 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: peter.maydell@linaro.org, lersek@redhat.com, linuxarm@huawei.com, xuwei5@hisilicon.com, shannon.zhaosl@gmail.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Kwangwoo Lee Pre-plug and plug handlers are prepared for NVDIMM support. Please note nvdimm_support is not yet enabled. Signed-off-by: Eric Auger Signed-off-by: Kwangwoo Lee Signed-off-by: Shameer Kolothum --- hw/arm/Kconfig | 1 + hw/arm/virt-acpi-build.c | 6 ++++++ hw/arm/virt.c | 22 +++++++++++++++++++++- hw/mem/Kconfig | 2 +- include/hw/arm/virt.h | 1 + 5 files changed, 30 insertions(+), 2 deletions(-) diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig index c6e7782580..851dd81289 100644 --- a/hw/arm/Kconfig +++ b/hw/arm/Kconfig @@ -24,6 +24,7 @@ config ARM_VIRT select DIMM select ACPI_MEMORY_HOTPLUG select ACPI_HW_REDUCED + select ACPI_NVDIMM =20 config CHEETAH bool diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c index 074e0c858e..4e63f5da48 100644 --- a/hw/arm/virt-acpi-build.c +++ b/hw/arm/virt-acpi-build.c @@ -44,6 +44,7 @@ #include "hw/pci/pcie_host.h" #include "hw/pci/pci.h" #include "hw/arm/virt.h" +#include "hw/mem/nvdimm.h" #include "sysemu/numa.h" #include "sysemu/reset.h" #include "kvm_arm.h" @@ -835,6 +836,11 @@ void virt_acpi_build(VirtMachineState *vms, AcpiBuildT= ables *tables) } } =20 + if (ms->nvdimms_state->is_enabled) { + nvdimm_build_acpi(table_offsets, tables_blob, tables->linker, + ms->nvdimms_state, ms->ram_slots); + } + if (its_class_name() && !vmc->no_its) { acpi_add_table(table_offsets, tables_blob); build_iort(tables_blob, tables->linker, vms); diff --git a/hw/arm/virt.c b/hw/arm/virt.c index d4bedc2607..30bc8a7803 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -143,6 +143,7 @@ static const MemMapEntry base_memmap[] =3D { [VIRT_SMMU] =3D { 0x09050000, 0x00020000 }, [VIRT_PCDIMM_ACPI] =3D { 0x09070000, MEMORY_HOTPLUG_IO_LEN }, [VIRT_ACPI_GED] =3D { 0x09080000, ACPI_GED_EVT_SEL_LEN }, + [VIRT_NVDIMM_ACPI] =3D { 0x09090000, NVDIMM_ACPI_IO_LEN}, [VIRT_MMIO] =3D { 0x0a000000, 0x00000200 }, /* ...repeating for a total of NUM_VIRTIO_TRANSPORTS, each of that siz= e */ [VIRT_PLATFORM_BUS] =3D { 0x0c000000, 0x02000000 }, @@ -1750,6 +1751,18 @@ static void machvirt_init(MachineState *machine) =20 create_platform_bus(vms, pic); =20 + if (machine->nvdimms_state->is_enabled) { + const struct AcpiGenericAddress arm_virt_nvdimm_acpi_dsmio =3D { + .space_id =3D AML_AS_SYSTEM_MEMORY, + .address =3D vms->memmap[VIRT_NVDIMM_ACPI].base, + .bit_width =3D NVDIMM_ACPI_IO_LEN << 3 + }; + + nvdimm_init_acpi_state(machine->nvdimms_state, sysmem, + arm_virt_nvdimm_acpi_dsmio, + vms->fw_cfg, OBJECT(vms)); + } + vms->bootinfo.ram_size =3D machine->ram_size; vms->bootinfo.nb_cpus =3D smp_cpus; vms->bootinfo.board_id =3D -1; @@ -1916,9 +1929,10 @@ static void virt_memory_pre_plug(HotplugHandler *hot= plug_dev, DeviceState *dev, Error **errp) { VirtMachineState *vms =3D VIRT_MACHINE(hotplug_dev); + MachineState *ms =3D MACHINE(hotplug_dev); const bool is_nvdimm =3D object_dynamic_cast(OBJECT(dev), TYPE_NVDIMM); =20 - if (is_nvdimm) { + if (is_nvdimm && (!ms->nvdimms_state->is_enabled)) { error_setg(errp, "nvdimm is not yet supported"); return; } @@ -1937,6 +1951,8 @@ static void virt_memory_plug(HotplugHandler *hotplug_= dev, { HotplugHandlerClass *hhc; VirtMachineState *vms =3D VIRT_MACHINE(hotplug_dev); + MachineState *ms =3D MACHINE(hotplug_dev); + bool is_nvdimm =3D object_dynamic_cast(OBJECT(dev), TYPE_NVDIMM); Error *local_err =3D NULL; =20 pc_dimm_plug(PC_DIMM(dev), MACHINE(vms), &local_err); @@ -1944,6 +1960,10 @@ static void virt_memory_plug(HotplugHandler *hotplug= _dev, goto out; } =20 + if (is_nvdimm) { + nvdimm_plug(ms->nvdimms_state); + } + hhc =3D HOTPLUG_HANDLER_GET_CLASS(vms->acpi_dev); hhc->plug(HOTPLUG_HANDLER(vms->acpi_dev), dev, &error_abort); out: diff --git a/hw/mem/Kconfig b/hw/mem/Kconfig index 620fd4cb59..0d5f8f321a 100644 --- a/hw/mem/Kconfig +++ b/hw/mem/Kconfig @@ -8,4 +8,4 @@ config MEM_DEVICE config NVDIMM bool default y - depends on PC + depends on PC || ARM_VIRT diff --git a/include/hw/arm/virt.h b/include/hw/arm/virt.h index 0b41083e9d..06d5e75611 100644 --- a/include/hw/arm/virt.h +++ b/include/hw/arm/virt.h @@ -79,6 +79,7 @@ enum { VIRT_SECURE_MEM, VIRT_PCDIMM_ACPI, VIRT_ACPI_GED, + VIRT_NVDIMM_ACPI, VIRT_LOWMEMMAP_LAST, }; =20 --=20 2.17.1