From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 04DE1C47082 for ; Thu, 27 May 2021 00:01:16 +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 53E21613BE for ; Thu, 27 May 2021 00:01:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 53E21613BE Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:37720 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lm3Sc-0006wd-Gv for qemu-devel@archiver.kernel.org; Wed, 26 May 2021 20:01:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35070) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lm3Fg-00068l-Q3 for qemu-devel@nongnu.org; Wed, 26 May 2021 19:47:56 -0400 Received: from mail-pf1-x436.google.com ([2607:f8b0:4864:20::436]:35807) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lm3FU-0004dG-Or for qemu-devel@nongnu.org; Wed, 26 May 2021 19:47:51 -0400 Received: by mail-pf1-x436.google.com with SMTP id g18so2220810pfr.2 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=q34u+TqxTDTJkPHH4qaEih5rVqpqwrjejSIKV+3eh1g=; b=LzzoIrV6ZHodTidA9Ylnb1WWt4YBoVZL1dJD3P2oWgiUTfbVxcxlS/ONg0pJmpOkxU uzRyrsN3wQb7Y97cNExrHzp1SbGbbKUVuQRZv0bvWP0vTRykg2rzILW6fodvAQBGjVu/ fRTqRQzTv+c9HaGSAqNb11OOJCN7UAKbNYIjrnkMfKvjR7aLukKYLOodS09y1TnwgBqK ElGD4EjTjyoG6fy9NiWoVaHiAX0KolPhpbRqwvW5JbbmUoQFK+7wk6QhpmpMCBgOt7g5 42JVrsu39YddcA3qDX6GA0ow9bh/+Y44S12MzNhmnKahq+tHZKThN6THRBkmG9tNbcpR c3bA== 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=q34u+TqxTDTJkPHH4qaEih5rVqpqwrjejSIKV+3eh1g=; b=BiCQLKlcQu6/7Haj43+R6FKUAq1qnP4kw51bDApXet9U2fe1MyqduOpOK5lXdxAh+j 06vH4G7kOmLeWJx36sSS1q9HnBNEvSHR0ERJwaXBhWzL3upKwY8KP6MoypfyvJWKV2eC cP02/Rsy/N3l8Vm4dYR+M49ifRw0Zk/dmuq1ctiGgzKEWq8ogXamIPvPwxkcKTTIX4gK 0f9nfaWeXzAfqgLKuO3kdjN18mBOrHKQW+PPR1/S001O6vmCnl4O06gkQE4OqQYCflmo nj98bqS+a1VbZCEA1/q+8EDIRrapcP7ZC2MNFfmq5FdpaFx1wpUtuUXsOYLXdBrDE8ZW 8fqg== X-Gm-Message-State: AOAM530NZnhVdIS0IJL8Shsihm1pHiCkfQ638XrxZ2Zv7pVvPuZ4EtSc jhoa4e4j6DESiuPzbkfBa8zVuyg2Y83MDQ== X-Google-Smtp-Source: ABdhPJz0A77rYIJzHRrIOX+CVYoluktRqMp5bseyIHW2dZXt0ZGhMjej2Di2Y1JtDT2BNy8W+Jwh1w== X-Received: by 2002:a63:617:: with SMTP id 23mr976042pgg.409.1622072855861; 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.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 May 2021 16:47:35 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 29/31] cpu: Move CPUClass::get_paging_enabled to SysemuCPUOps Date: Wed, 26 May 2021 16:47:08 -0700 Message-Id: <20210526234710.125396-30-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 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2607:f8b0:4864:20::436; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x436.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=unavailable 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=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Philippe Mathieu-Daudé Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Message-Id: <20210517105140.1062037-23-f4bug@amsat.org> Signed-off-by: Richard Henderson --- include/hw/core/cpu.h | 2 -- include/hw/core/sysemu-cpu-ops.h | 4 ++++ hw/core/cpu-sysemu.c | 4 ++-- target/i386/cpu.c | 4 +++- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index 4f6dd24112..e4328de8d4 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -94,7 +94,6 @@ struct SysemuCPUOps; * @dump_state: Callback for dumping state. * @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. * @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; @@ -137,7 +136,6 @@ struct CPUClass { void (*dump_state)(CPUState *cpu, FILE *, int flags); void (*dump_statistics)(CPUState *cpu, int flags); int64_t (*get_arch_id)(CPUState *cpu); - bool (*get_paging_enabled)(const CPUState *cpu); 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 213e5287ab..a9ba39e5f2 100644 --- a/include/hw/core/sysemu-cpu-ops.h +++ b/include/hw/core/sysemu-cpu-ops.h @@ -21,6 +21,10 @@ typedef struct SysemuCPUOps { */ void (*get_memory_mapping)(CPUState *cpu, MemoryMappingList *list, Error **errp); + /** + * @get_paging_enabled: Callback for inquiring whether paging is enabled. + */ + bool (*get_paging_enabled)(const CPUState *cpu); /** * @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 3850fcb27f..00253f8929 100644 --- a/hw/core/cpu-sysemu.c +++ b/hw/core/cpu-sysemu.c @@ -27,8 +27,8 @@ bool cpu_paging_enabled(const CPUState *cpu) { CPUClass *cc = CPU_GET_CLASS(cpu); - if (cc->get_paging_enabled) { - return cc->get_paging_enabled(cpu); + if (cc->sysemu_ops->get_paging_enabled) { + return cc->sysemu_ops->get_paging_enabled(cpu); } return false; diff --git a/target/i386/cpu.c b/target/i386/cpu.c index d400feec8f..744afc0ff2 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -6485,12 +6485,14 @@ static int64_t x86_cpu_get_arch_id(CPUState *cs) return cpu->apic_id; } +#if !defined(CONFIG_USER_ONLY) static bool x86_cpu_get_paging_enabled(const CPUState *cs) { X86CPU *cpu = X86_CPU(cs); return cpu->env.cr[0] & CR0_PG_MASK; } +#endif /* !CONFIG_USER_ONLY */ static void x86_cpu_set_pc(CPUState *cs, vaddr value) { @@ -6719,6 +6721,7 @@ static Property x86_cpu_properties[] = { static const struct SysemuCPUOps i386_sysemu_ops = { .get_memory_mapping = x86_cpu_get_memory_mapping, + .get_paging_enabled = x86_cpu_get_paging_enabled, .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, @@ -6754,7 +6757,6 @@ static void x86_cpu_common_class_init(ObjectClass *oc, void *data) cc->gdb_read_register = x86_cpu_gdb_read_register; cc->gdb_write_register = x86_cpu_gdb_write_register; cc->get_arch_id = x86_cpu_get_arch_id; - cc->get_paging_enabled = x86_cpu_get_paging_enabled; #ifndef CONFIG_USER_ONLY cc->sysemu_ops = &i386_sysemu_ops; -- 2.25.1