From patchwork Wed May 26 23:47:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 448813 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp32673jac; Wed, 26 May 2021 17:26:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx2vIhlgX0qDSnMSBP/Ac9jJbGP8R4XlnOmyverLeJ17jivzVWTVier7prXUIjp5+S0JnPi X-Received: by 2002:ab0:f5:: with SMTP id 108mr412782uaj.106.1622075170937; Wed, 26 May 2021 17:26:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622075170; cv=none; d=google.com; s=arc-20160816; b=VTf4T4iZeD8jUc+hjzsnj5USiifhMrD5aabI53jTQl892utDGSr6yPJhP7PTiuH1WN /LF5HgwUBkyPQiqarnSlzPXeeXXyDggc+rGJrhMTCTnC1p5AMHq6FU7UBh/6XHjVTw2q hjQhyAHBSyEAugsdrBM4xlVzmUakdhlXjyaJRnjKZGnutYiso5tI4UZDKBgHKPaEXMXS oijODqGyyslUdMi1r0QXDFvK714JeYcts/p+omfJS7Wi1o22csn8popeTOC3TRDTMgj/ BSGJS7aCBsgIs6X2CDenvFmzOuH7hSwFdW21RBzxZGtTiGDB58oq9qmCe+tTu+Jz+das yHaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=wdKqjgVc8k1VtRKWlpH/KMPYr5BtQruarC7LkdFcPVk=; b=GlZnQhwlg0GH0D3FnfrfVvaloy92bwtNrceZSVwkMMk7BJegkroi8LQ3IT1oqGNfhl 8XlOGQzzFqBunxi4lD9layoqCcZYUgQCwG7/KcMrJjKpcIIaZ8ur4D1a7aTZ1x3iCiIH uUf5/2gQ7DGRYfBRVkUNZekDAQ4qrbxO3YNOCge0W8f/cJKV9+2D5DVBxF7tZAIT/1ru oKmy94KIiGD8AJrkapFo3L+t37or3SviQblaNfw8lKDv6Tv83lE0elPg+3VZZrNkVVV7 jKs8eohBdtt6QvaDVY7GxNVKx4I9BaXdGugrg/UPdq8wWAgkHpwuyy26aQyB1PkIWqAw iMAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=In+USBX8; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d3si306040vsl.229.2021.05.26.17.26.10 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 26 May 2021 17:26:10 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=In+USBX8; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:40998 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lm3qk-00043F-Bv for patch@linaro.org; Wed, 26 May 2021 20:26:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35054) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lm3Fe-00068Q-DI for qemu-devel@nongnu.org; Wed, 26 May 2021 19:47:56 -0400 Received: from mail-pf1-x433.google.com ([2607:f8b0:4864:20::433]:45010) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lm3FQ-0004cn-Ks for qemu-devel@nongnu.org; Wed, 26 May 2021 19:47:48 -0400 Received: by mail-pf1-x433.google.com with SMTP id 22so2197247pfv.11 for ; Wed, 26 May 2021 16:47:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=wdKqjgVc8k1VtRKWlpH/KMPYr5BtQruarC7LkdFcPVk=; b=In+USBX8lk9SWnWSvkemytgVYNepa+KWAZvv6mBf30hNENUGifkhRd159lPHwW94YB 4LsZtx2ims+t8EbcRnb8Y9/g4+ifzZPLAcD/yvJVZlTBM/tF3H0dgimqc4zWcakkukaC IuslW6IwXm+f6ZhjzQBgYfwPtaAOoiW30mr+clp+kzjKRT8uXv2yYyWVzSSbloVfrEBt 1aUyMEhyX8iM8e3LYs8NFa2tHrtoZl+pLSw4NalhzcGEWq7VmD04nIx27Yvrr6ZTo/bs YiX7/eWq5TgJI5ecmx3dp7wVK87AQK3jpa1p4Pwddhkx1/sdlOcgqsRA7KKpjcCYQ15D DwiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=wdKqjgVc8k1VtRKWlpH/KMPYr5BtQruarC7LkdFcPVk=; b=b6YOtl1iXjBKrjsuGfnyo7+39qCiHFFgvLoxbJ9gx6h69/OgMDa6TAfWkg+cJGR69F BJuVfeXCketjBomA5JMeYtpuKEThcGKvrGS7FBf2MTyVk6hHIyi+creZaLjgC1qQDRSb sIyg/etkbI4mzRkkJdu2E0PRV8Ng5BV+ZUEgPRMLUy27tfXOx3Fymx01c/4AqK4Sbxtr ARbkpCoqvRbMassLZgmiP5tIIKAT8XGUlAnxHQBvQifNXslkQsSr44U5LAywC5bTZFaj 1u0jcWziTwOJ9b6pqTSjUkrMb5EXiks/s4Nwyh7MJkcBj/zJAk85PZ31usukWtZW2c9O KVKQ== X-Gm-Message-State: AOAM532G8XfhPJgTLO+NKOnQ7T/s/WYG+oT9uaHQgQmsS9bKh2bdqqCP v9d3eb/BqmZP/FvgQHyDfcCGMKLgNw6gQQ== X-Received: by 2002:a65:4608:: with SMTP id v8mr977154pgq.435.1622072855215; Wed, 26 May 2021 16:47:35 -0700 (PDT) Received: from localhost.localdomain (174-21-70-228.tukw.qwest.net. [174.21.70.228]) by smtp.gmail.com with ESMTPSA id g13sm285355pfi.18.2021.05.26.16.47.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 May 2021 16:47:34 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 28/31] cpu: Move CPUClass::get_memory_mapping to SysemuCPUOps Date: Wed, 26 May 2021 16:47:07 -0700 Message-Id: <20210526234710.125396-29-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210526234710.125396-1-richard.henderson@linaro.org> References: <20210526234710.125396-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::433; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x433.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Philippe Mathieu-Daudé Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Message-Id: <20210517105140.1062037-22-f4bug@amsat.org> Signed-off-by: Richard Henderson --- include/hw/core/cpu.h | 3 --- include/hw/core/sysemu-cpu-ops.h | 5 +++++ hw/core/cpu-sysemu.c | 4 ++-- target/i386/cpu.c | 2 +- 4 files changed, 8 insertions(+), 6 deletions(-) -- 2.25.1 diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index 405d1f367f..4f6dd24112 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -95,7 +95,6 @@ struct SysemuCPUOps; * @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; @@ -139,8 +138,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 1f249e0f06..213e5287ab 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-sysemu.c b/hw/core/cpu-sysemu.c index b31c33ad2b..3850fcb27f 100644 --- a/hw/core/cpu-sysemu.c +++ b/hw/core/cpu-sysemu.c @@ -39,8 +39,8 @@ void cpu_get_memory_mapping(CPUState *cpu, MemoryMappingList *list, { CPUClass *cc = CPU_GET_CLASS(cpu); - 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; } diff --git a/target/i386/cpu.c b/target/i386/cpu.c index de212a939d..d400feec8f 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -6718,6 +6718,7 @@ static Property x86_cpu_properties[] = { #include "hw/core/sysemu-cpu-ops.h" static const struct SysemuCPUOps i386_sysemu_ops = { + .get_memory_mapping = x86_cpu_get_memory_mapping, .get_phys_page_attrs_debug = x86_cpu_get_phys_page_attrs_debug, .asidx_from_attrs = x86_asidx_from_attrs, .get_crash_info = x86_cpu_get_crash_info, @@ -6756,7 +6757,6 @@ static void x86_cpu_common_class_init(ObjectClass *oc, void *data) cc->get_paging_enabled = x86_cpu_get_paging_enabled; #ifndef CONFIG_USER_ONLY - cc->get_memory_mapping = x86_cpu_get_memory_mapping; cc->sysemu_ops = &i386_sysemu_ops; #endif /* !CONFIG_USER_ONLY */