From nobody Wed Nov 5 23:59:51 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of _spf.google.com designates 209.85.221.53 as permitted sender) client-ip=209.85.221.53; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wr1-f53.google.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.221.53 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1619120433; cv=none; d=zohomail.com; s=zohoarc; b=Paq9mA90kBjhy0e4Ki5rYA6dskBirw8TsS6cyUO2T3UF11BEwIwZlYOJ7uk9+ctUeZETZpaCWQffAmYLHzUNsMUjJQ/hGpxjjTYpMdETMxGOc5CV/drgQWaPrhvGPZ3sfndIxbe78soczIbw1JaYqKT4koGpZQnEjewekZdglU8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619120433; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Sender:Subject:To; bh=m966GbKrCJcUqO+fuAnWPPht7OR9OhPJulfZwNFNX4c=; b=aSmutDN6GTOkTalyIfUWQ8/WFGYcYvSmiZgSnMvSVfYdH4bdG6NsspVG8SbYMxiEBI1mmCX31gccOT3bEMLcpQaqXJCy9Cs9Y0j7ZOc7u7LFE301JcKSIkkCdGngUD2aUpNcE+S6RYXODWb5PecLcawhXxc+7PVH74zUN3W2FJw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.221.53 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com Received: from mail-wr1-f53.google.com (mail-wr1-f53.google.com [209.85.221.53]) by mx.zohomail.com with SMTPS id 161912043327962.59519456423209; Thu, 22 Apr 2021 12:40:33 -0700 (PDT) Received: by mail-wr1-f53.google.com with SMTP id c15so37004394wro.13 for ; Thu, 22 Apr 2021 12:40:32 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.redhat.com (39.red-81-40-121.staticip.rima-tde.net. [81.40.121.39]) by smtp.gmail.com with ESMTPSA id g84sm4533927wmf.30.2021.04.22.12.40.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Apr 2021 12:40:31 -0700 (PDT) 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=m966GbKrCJcUqO+fuAnWPPht7OR9OhPJulfZwNFNX4c=; b=e6U+4JX0OOSuZd5s37c90oS/hEFKgL+Mydprc08dVIouGDXcVIF4FJYImOSsqVwdL1 6nuEokgLBiQl7DROmN6ueqsi62r9bWGvMzKzoIipXBVdVbpcHOf1KsiiHB47SOlzGbDn 2m5ee4P7mpmVqhr/oSEYFdOrzQqWXrln6z5J3Yip0C2usN1oB+fez6pIMjb65zZHfNW6 UvORWtKZmC9rO7NDsRf78I3JcN16zW0gk3Uu4pp9ex8wAs5mEaNtEpwj/bwKvz1rkcOP ViSf6oNR+VrrvroLmz4wQqdSwo4ED/FBVplt4ebv66PZQjExlDjGCbLgVpKMGYccY8Uv A9Zg== 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=m966GbKrCJcUqO+fuAnWPPht7OR9OhPJulfZwNFNX4c=; b=Fhochku1Rh6+2pTt9ZCqOnIALPpHNzJ248ARiyQmQuEI7rtewuakckBGc3C53NlIYw MwhE48bt12LhQeM4elOZsgXf1holhYgsojkvmLV0oSn6vT3jO0Tcsv77X2gv7s25YJkG krSBS3TUusbpQjAvEWuZWsn760WFYl00zTHZ6l8RTgoLiHFUwEGbNeZCZ0Hd5ZZ4NOAZ QsVMvzgFDZ8dsU6cE2mUrXx16GPzfpkvO0PWjiDn9qQ349m9izIi7+VuImg+wyUadfJQ qdV6DhtbRyYoqs7b8ENw+OmoXXGsl+2ebwT3tYgav1aQ5HsMl+jkw8q3MAGGY4kzmeLM EqgA== X-Gm-Message-State: AOAM532EJy64pFGgeCJ0uLzca2lLdfQAg2q5jFRBd6cCKhSp+L/2l+Z2 tj+B5qRP3NKIssq8zvLQnG4= X-Google-Smtp-Source: ABdhPJw50THXM5vmBB6WPRjlXV3QXpGKmaOufqJPEXTArEXJvrP3c0c6JEYOIs33fplRxA/TMGBi5A== X-Received: by 2002:a5d:534e:: with SMTP id t14mr5965958wrv.239.1619120431581; Thu, 22 Apr 2021 12:40:31 -0700 (PDT) Sender: =?UTF-8?Q?Philippe_Mathieu=2DDaud=C3=A9?= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: "Dr. David Alan Gilbert" , qemu-riscv@nongnu.org, Juan Quintela , Peter Maydell , Claudio Fontana , qemu-arm@nongnu.org, Eduardo Habkost , qemu-ppc@nongnu.org, Richard Henderson , Laurent Vivier , qemu-s390x@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Marcel Apfelbaum , Paolo Bonzini Subject: [PATCH v6 16/18] cpu: Move CPUClass::get_memory_mapping to SysemuCPUOps Date: Thu, 22 Apr 2021 21:39:00 +0200 Message-Id: <20210422193902.2644064-17-f4bug@amsat.org> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20210422193902.2644064-1-f4bug@amsat.org> References: <20210422193902.2644064-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) Reviewed-by: Richard Henderson 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 88a0a90ac7b..6dd60c3ada4 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 4be4a4b4da7..344561b7827 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 ead0aafd9d1..5d35d8e329f 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -7393,6 +7393,7 @@ static Property x86_cpu_properties[] =3D { =20 #ifndef CONFIG_USER_ONLY static const 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, @@ -7436,7 +7437,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.3