From patchwork Mon Feb 17 07:51:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xu Yandong X-Patchwork-Id: 1239015 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=huawei.com 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 ozlabs.org (Postfix) with ESMTPS id 48LbdS2Rxlz9sP7 for ; Mon, 17 Feb 2020 18:46:04 +1100 (AEDT) Received: from localhost ([::1]:41476 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j3b6Q-0002gh-7P for incoming@patchwork.ozlabs.org; Mon, 17 Feb 2020 02:46:02 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:39443) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j3b30-0004Md-1q for qemu-devel@nongnu.org; Mon, 17 Feb 2020 02:42:31 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j3b2y-0000bn-MR for qemu-devel@nongnu.org; Mon, 17 Feb 2020 02:42:29 -0500 Received: from szxga05-in.huawei.com ([45.249.212.191]:3231 helo=huawei.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1j3b2u-0000Ro-8H; Mon, 17 Feb 2020 02:42:24 -0500 Received: from DGGEMS405-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 0F484F9413AD7C18766C; Mon, 17 Feb 2020 15:42:20 +0800 (CST) Received: from localhost (10.175.124.177) by DGGEMS405-HUB.china.huawei.com (10.3.19.205) with Microsoft SMTP Server id 14.3.439.0; Mon, 17 Feb 2020 15:42:12 +0800 From: Xu Yandong To: Subject: [PATCH RFC 14/16] hw/arm: move shared bootinfo member to ArmMachine Date: Mon, 17 Feb 2020 02:51:26 -0500 Message-ID: <1581925888-103620-15-git-send-email-xuyandong2@huawei.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1581925888-103620-1-git-send-email-xuyandong2@huawei.com> References: <1581925888-103620-1-git-send-email-xuyandong2@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.124.177] 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: zhang.zhanghailiang@huawei.com, slp@redhat.com, Xu Yandong , qemu-devel@nongnu.org, qemu-arm@nongnu.org, wu.wubin@huawei.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Move bootinfo member from VirtMachineState to ArmMachineState. Signed-off-by: Xu Yandong --- hw/arm/arm.c | 9 +++++++++ hw/arm/virt.c | 28 +++++++++------------------- include/hw/arm/arm.h | 3 +++ include/hw/arm/virt.h | 1 - 4 files changed, 21 insertions(+), 20 deletions(-) diff --git a/hw/arm/arm.c b/hw/arm/arm.c index 4bffee0f37..7d880dd8e7 100644 --- a/hw/arm/arm.c +++ b/hw/arm/arm.c @@ -508,6 +508,15 @@ void create_virtio_devices(const ArmMachineState *ams) } } +void *machvirt_dtb(const struct arm_boot_info *binfo, int *fdt_size) +{ + const ArmMachineState *board = container_of(binfo, ArmMachineState, + bootinfo); + + *fdt_size = board->fdt_size; + return board->fdt; +} + static char *virt_get_gic_version(Object *obj, Error **errp) { ArmMachineState *ams = ARM_MACHINE(obj); diff --git a/hw/arm/virt.c b/hw/arm/virt.c index 11e753906b..2f498ea687 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -971,16 +971,6 @@ static void create_secure_ram(VirtMachineState *vms, g_free(nodename); } -static void *machvirt_dtb(const struct arm_boot_info *binfo, int *fdt_size) -{ - const VirtMachineState *vms = container_of(binfo, VirtMachineState, - bootinfo); - - ArmMachineState *board = ARM_MACHINE(vms); - *fdt_size = board->fdt_size; - return board->fdt; -} - static void virt_build_smbios(VirtMachineState *vms) { MachineClass *mc = MACHINE_GET_CLASS(vms); @@ -1016,7 +1006,7 @@ void virt_machine_done(Notifier *notifier, void *data) MachineState *ms = MACHINE(vms); ArmMachineState *ams = ARM_MACHINE(vms); ARMCPU *cpu = ARM_CPU(first_cpu); - struct arm_boot_info *info = &vms->bootinfo; + struct arm_boot_info *info = &ams->bootinfo; AddressSpace *as = arm_boot_address_space(cpu, info); /* @@ -1373,14 +1363,14 @@ static void machvirt_init(MachineState *machine) create_platform_bus(vms); - vms->bootinfo.ram_size = machine->ram_size; - vms->bootinfo.nb_cpus = smp_cpus; - vms->bootinfo.board_id = -1; - vms->bootinfo.loader_start = ams->memmap[VIRT_MEM].base; - vms->bootinfo.get_dtb = machvirt_dtb; - vms->bootinfo.skip_dtb_autoload = true; - vms->bootinfo.firmware_loaded = firmware_loaded; - arm_load_kernel(ARM_CPU(first_cpu), machine, &vms->bootinfo); + ams->bootinfo.ram_size = machine->ram_size; + ams->bootinfo.nb_cpus = smp_cpus; + ams->bootinfo.board_id = -1; + ams->bootinfo.loader_start = ams->memmap[VIRT_MEM].base; + ams->bootinfo.get_dtb = machvirt_dtb; + ams->bootinfo.skip_dtb_autoload = true; + ams->bootinfo.firmware_loaded = firmware_loaded; + arm_load_kernel(ARM_CPU(first_cpu), machine, &ams->bootinfo); vms->machine_done.notify = virt_machine_done; qemu_add_machine_init_done_notifier(&vms->machine_done); diff --git a/include/hw/arm/arm.h b/include/hw/arm/arm.h index 743a90ba36..372f4dea28 100644 --- a/include/hw/arm/arm.h +++ b/include/hw/arm/arm.h @@ -92,6 +92,7 @@ typedef struct { typedef struct { MachineState parent; int32_t gic_version; + struct arm_boot_info bootinfo; MemMapEntry *memmap; const int *irqmap; int smp_cpus; @@ -130,6 +131,8 @@ void create_rtc(const ArmMachineState *ams); void create_virtio_devices(const ArmMachineState *ams); +void *machvirt_dtb(const struct arm_boot_info *binfo, int *fdt_size); + /* Return the number of used redistributor regions */ static inline int virt_gicv3_redist_region_count(ArmMachineState *ams) { diff --git a/include/hw/arm/virt.h b/include/hw/arm/virt.h index 086a27682f..8276e2c02c 100644 --- a/include/hw/arm/virt.h +++ b/include/hw/arm/virt.h @@ -68,7 +68,6 @@ typedef struct { bool its; bool virt; VirtIOMMUType iommu; - struct arm_boot_info bootinfo; uint32_t msi_phandle; uint32_t iommu_phandle; hwaddr highest_gpa;