From nobody Tue Feb 10 23:13:24 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of _spf.google.com designates 209.85.208.51 as permitted sender) client-ip=209.85.208.51; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-ed1-f51.google.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.208.51 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1614697205; cv=none; d=zohomail.com; s=zohoarc; b=NHRECIo4Gl2krprOWOx8TcIw9wz19Lj8zrF2TbVWmX1VFbfDFcjIlRCWMhjbzef7wdH6dljNE0xJmD6BSOajOKbXbkbny7ccIzd8wf7ZzpZ3DJnZeFiXfJJUkIcXmVTogH0I+lRULHtXr5gpGD3qAYPq2xwAaGe1HHQT6A/etsk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1614697205; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Sender:Subject:To; bh=80i+luS2gU1nZWsoBAiYbRUL/K5YnYdp7E5uXZjJBL4=; b=ESmsQGld4FZpGSngHAsWqEZCV6hp6APPzFz3SIrzy27PFTdRWHrGxJy61GUHnV7Ktd39DC8NLAwrMl62w7L1nwuE7HJu4T8LH2/p1lftjOf2pIeouYG1c0mGvWrtQDoKnUDvYyWsr04Q+hyAlMP4x8gkoWGlM60n7pNmF5XO/lQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.208.51 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com Received: from mail-ed1-f51.google.com (mail-ed1-f51.google.com [209.85.208.51]) by mx.zohomail.com with SMTPS id 1614697205824183.0278253123762; Tue, 2 Mar 2021 07:00:05 -0800 (PST) Received: by mail-ed1-f51.google.com with SMTP id bd6so12318088edb.10 for ; Tue, 02 Mar 2021 07:00:04 -0800 (PST) Return-Path: Return-Path: Received: from x1w.redhat.com (68.red-83-57-175.dynamicip.rima-tde.net. [83.57.175.68]) by smtp.gmail.com with ESMTPSA id p25sm18624983eds.55.2021.03.02.07.00.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Mar 2021 07:00:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=80i+luS2gU1nZWsoBAiYbRUL/K5YnYdp7E5uXZjJBL4=; b=dpGwCF6rebaENcMlefxhPfnkG83niqll8GFUGNLSSk8S7EFiaz4tXcPgz1/bHzD/LG ySvI+vtZvFfOwKSfOyCwAOHdWro9HLaYSOVTUxfM0qXytAzCGZY/nOxz6r7wz4w6RxgS P3jtRjV0jIHhTtPTqTebeL0RhUPGgmkABM7OMFbp5k4mboy/vKFeqliQ5CQUAzYq8q/x 2OFd7nr215d/UNsF3OF0FPoEliX9ng6XE4ZfumA/SLowiAyOqLIB5llWH5H489asaxSG ENsWhrR2IsMbVeRTxhN8DlSc8SLFzjg/o/winpzAwheC9289Q3m/3AsJQfU2nvJZOaqF gvwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=80i+luS2gU1nZWsoBAiYbRUL/K5YnYdp7E5uXZjJBL4=; b=Oo/dDjzJoIHkXceFv8POGGjPA4vbuRYlmMan3dzhUfEJ2Qvvonr5s6sLi1Qhts4SAP J87h6jziTAb6xrLDpqc7yw62wQ+J4tSZIZChEfAbSO0egbyBWkn19zMPcYFmDKrqYJ+K 0yUwVovoHqniQxn4g2tIcaAQgoQUTG4Vs/p0SZLDZaMV+axrgCNNiJqRFa5fZLTRtB4J eTp/FWbZS9Wldfqd/Q/2Y8+ILBx3pwvvEWLYTPfTjhIMw60X13p0UnkGLoW0QRwARIBS MkTJzYcnPnYQdyO5d5pImZ+LYy4AeYjpyuBrGoA8Qtayu07DAMW4OHnOFT1EFkkR+QYV Gabg== X-Gm-Message-State: AOAM530wSo3ejsqG1/Uete8tUrfN0xy1lB0jk6vViG1+pYj3uY4lx9fp bPz6GCsXVepBnJspnVUw5Tg= X-Google-Smtp-Source: ABdhPJyXQFUGRRxV54Xm/zg4k3LV8CQ/B3gXnhCbP+IjO4+X69LJTqe/h1Q4Rh1dH6mRTY7/JWneNw== X-Received: by 2002:aa7:c150:: with SMTP id r16mr20556346edp.96.1614697203386; Tue, 02 Mar 2021 07:00:03 -0800 (PST) Sender: =?UTF-8?Q?Philippe_Mathieu=2DDaud=C3=A9?= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Thomas Huth , qemu-arm@nongnu.org, Max Filippov , David Gibson , "Edgar E. Iglesias" , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Guan Xuetao , Alistair Francis , Michael Rolnik , Palmer Dabbelt , Richard Henderson , Laurent Vivier , Paolo Bonzini , Greg Kurz , Stafford Horne , qemu-ppc@nongnu.org, Anthony Green , Aurelien Jarno , Jiaxun Yang , Cornelia Huck , Claudio Fontana , Sagar Karandikar , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Michael Walle , Marek Vasut , Marcel Apfelbaum , Artyom Tarasenko , Peter Maydell , Aleksandar Rikalo , Chris Wulff , David Hildenbrand , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-s390x@nongnu.org, Sarah Harris , Eduardo Habkost , Bastian Koppelmann , qemu-riscv@nongnu.org, Mark Cave-Ayland , "Michael S. Tsirkin" , Yoshinori Sato , Taylor Simpson Subject: [PATCH v3 14/27] cpu: Move CPUClass::get_memory_mapping to SysemuCPUOps Date: Tue, 2 Mar 2021 15:58:05 +0100 Message-Id: <20210302145818.1161461-15-f4bug@amsat.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210302145818.1161461-1-f4bug@amsat.org> References: <20210302145818.1161461-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- include/hw/core/cpu.h | 3 --- include/hw/core/sysemu-cpu-ops.h | 5 +++++ hw/core/cpu.c | 4 ++-- target/i386/cpu.c | 2 +- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index 9a86c707cf7..8af78cdde23 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -94,7 +94,6 @@ struct AccelCPUClass; * @dump_statistics: Callback for dumping statistics. * @get_arch_id: Callback for getting architecture-dependent CPU ID. * @get_paging_enabled: Callback for inquiring whether paging is enabled. - * @get_memory_mapping: Callback for obtaining the memory mappings. * @set_pc: Callback for setting the Program Counter register. This * should have the semantics used by the target architecture when * setting the PC from a source such as an ELF file entry point; @@ -138,8 +137,6 @@ struct CPUClass { void (*dump_statistics)(CPUState *cpu, int flags); int64_t (*get_arch_id)(CPUState *cpu); bool (*get_paging_enabled)(const CPUState *cpu); - void (*get_memory_mapping)(CPUState *cpu, MemoryMappingList *list, - Error **errp); void (*set_pc)(CPUState *cpu, vaddr value); int (*gdb_read_register)(CPUState *cpu, GByteArray *buf, int reg); int (*gdb_write_register)(CPUState *cpu, uint8_t *buf, int reg); diff --git a/include/hw/core/sysemu-cpu-ops.h b/include/hw/core/sysemu-cpu-= ops.h index 0c8f616a565..460e7d63b0c 100644 --- a/include/hw/core/sysemu-cpu-ops.h +++ b/include/hw/core/sysemu-cpu-ops.h @@ -16,6 +16,11 @@ * struct SysemuCPUOps: System operations specific to a CPU class */ typedef struct SysemuCPUOps { + /** + * @get_memory_mapping: Callback for obtaining the memory mappings. + */ + void (*get_memory_mapping)(CPUState *cpu, MemoryMappingList *list, + Error **errp); /** * @get_phys_page_debug: Callback for obtaining a physical address. */ diff --git a/hw/core/cpu.c b/hw/core/cpu.c index 6932781425a..339bdfadd7a 100644 --- a/hw/core/cpu.c +++ b/hw/core/cpu.c @@ -83,8 +83,8 @@ void cpu_get_memory_mapping(CPUState *cpu, MemoryMappingL= ist *list, { CPUClass *cc =3D CPU_GET_CLASS(cpu); =20 - if (cc->get_memory_mapping) { - cc->get_memory_mapping(cpu, list, errp); + if (cc->sysemu_ops->get_memory_mapping) { + cc->sysemu_ops->get_memory_mapping(cpu, list, errp); return; } =20 diff --git a/target/i386/cpu.c b/target/i386/cpu.c index c7a18cd8e4f..d33ee9f831e 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -7388,6 +7388,7 @@ static Property x86_cpu_properties[] =3D { =20 #ifndef CONFIG_USER_ONLY static struct SysemuCPUOps i386_sysemu_ops =3D { + .get_memory_mapping =3D x86_cpu_get_memory_mapping, .get_phys_page_attrs_debug =3D x86_cpu_get_phys_page_attrs_debug, .asidx_from_attrs =3D x86_asidx_from_attrs, .get_crash_info =3D x86_cpu_get_crash_info, @@ -7431,7 +7432,6 @@ static void x86_cpu_common_class_init(ObjectClass *oc= , void *data) cc->get_paging_enabled =3D x86_cpu_get_paging_enabled; =20 #ifndef CONFIG_USER_ONLY - cc->get_memory_mapping =3D x86_cpu_get_memory_mapping; cc->sysemu_ops =3D &i386_sysemu_ops; #endif /* !CONFIG_USER_ONLY */ =20 --=20 2.26.2