From patchwork Thu Feb 13 02:35:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: fangying X-Patchwork-Id: 11379673 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2705B1805 for ; Thu, 13 Feb 2020 02:36:47 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0873820873 for ; Thu, 13 Feb 2020 02:36:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0873820873 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=huawei.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:46446 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j24Mw-0008Vo-8K for patchwork-qemu-devel@patchwork.kernel.org; Wed, 12 Feb 2020 21:36:46 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:55439) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j24M3-0007DR-Ms for qemu-devel@nongnu.org; Wed, 12 Feb 2020 21:35:52 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j24M2-0000Yr-K9 for qemu-devel@nongnu.org; Wed, 12 Feb 2020 21:35:51 -0500 Received: from szxga04-in.huawei.com ([45.249.212.190]:2702 helo=huawei.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1j24M0-0000PV-3G; Wed, 12 Feb 2020 21:35:48 -0500 Received: from DGGEMS410-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 24C73388DE11816840F7; Thu, 13 Feb 2020 10:35:43 +0800 (CST) Received: from localhost (10.133.205.53) by DGGEMS410-HUB.china.huawei.com (10.3.19.210) with Microsoft SMTP Server id 14.3.439.0; Thu, 13 Feb 2020 10:35:37 +0800 From: Ying Fang To: , Subject: [PATCH 4/4] arm: Create the cpufreq device Date: Thu, 13 Feb 2020 10:35:32 +0800 Message-ID: <20200213023532.902-5-fangying1@huawei.com> X-Mailer: git-send-email 2.22.0.windows.1 In-Reply-To: <20200213023532.902-1-fangying1@huawei.com> References: <20200213023532.902-1-fangying1@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.133.205.53] 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.190 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, zhang.zhanghailiang@huawei.com, mst@redhat.com, i.mitsyanko@gmail.com, shannon.zhaosl@gmail.com, guoheyi@huawei.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" Add the cpufreq device to arm64 virt machine Signed-off-by: Heyi Guo Signed-off-by: Ying Fang --- default-configs/aarch64-softmmu.mak | 1 + hw/acpi/Kconfig | 4 ++++ hw/arm/virt.c | 13 +++++++++++++ 3 files changed, 18 insertions(+) diff --git a/default-configs/aarch64-softmmu.mak b/default-configs/aarch64-softmmu.mak index 958b1e08e4..0a030e853f 100644 --- a/default-configs/aarch64-softmmu.mak +++ b/default-configs/aarch64-softmmu.mak @@ -6,3 +6,4 @@ include arm-softmmu.mak CONFIG_XLNX_ZYNQMP_ARM=y CONFIG_XLNX_VERSAL=y CONFIG_SBSA_REF=y +CONFIG_CPUFREQ=y diff --git a/hw/acpi/Kconfig b/hw/acpi/Kconfig index 54209c6f2f..7d8aa58492 100644 --- a/hw/acpi/Kconfig +++ b/hw/acpi/Kconfig @@ -38,3 +38,7 @@ config ACPI_VMGENID depends on PC config ACPI_HW_REDUCED + +config CPUFREQ + bool + default y diff --git a/hw/arm/virt.c b/hw/arm/virt.c index ed9dc38b60..53638f9557 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -764,6 +764,17 @@ static void create_uart(const VirtMachineState *vms, int uart, g_free(nodename); } +static void create_cpufreq(const VirtMachineState *vms, MemoryRegion *mem) +{ + hwaddr base = vms->memmap[VIRT_CPUFREQ].base; + DeviceState *dev = qdev_create(NULL, "cpufreq"); + SysBusDevice *s = SYS_BUS_DEVICE(dev); + + qdev_init_nofail(dev); + memory_region_add_subregion(mem, base, sysbus_mmio_get_region(s, 0)); +} + + static void create_rtc(const VirtMachineState *vms) { char *nodename; @@ -1723,6 +1734,8 @@ static void machvirt_init(MachineState *machine) create_uart(vms, VIRT_UART, sysmem, serial_hd(0)); + create_cpufreq(vms, sysmem); + if (vms->secure) { create_secure_ram(vms, secure_sysmem); create_uart(vms, VIRT_SECURE_UART, secure_sysmem, serial_hd(1));