From nobody Tue Apr 15 10:54:05 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1622073587; cv=none; d=zohomail.com; s=zohoarc; b=YQ7QpuDNWDilAmwYWe3Vlpm3NWYRjBZNU+KoNX+zUo2m3ZP8uPz+WUSzcMTn6YEFy6LcQajDYxrZuNVXlYZ0dNEYYSxYh3Nxl73NtAnrjR+NUysSah7VQtq+OmdxhtLpQJzHJ4Cp+o1YO9nqCwcRixc0Y6gQqqumloKh7h74n78= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1622073587; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=GkrUlbYQvGIINdckDDsYyRJMGvt/rK6bUqzfCARWGa8=; b=Eu386xv3SYijAZ/joQ0HjPeQ5FVVaz6rwSxIEHUALRVG4Q7PXGBEG9Ug47oJCqbuiqSjfwhxUOhE8Smjeiasq1ZxB87kDcVR1sCoqN12M3oIXMf3un9wScUqjX1UpMdh2tRjgCJDRLiEX9Mb3hPY9XZlcGKutZHErbkqT/trk8g= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1622073587512876.3836179538847; Wed, 26 May 2021 16:59:47 -0700 (PDT) Received: from localhost ([::1]:33418 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lm3RC-00040u-AM for importer@patchew.org; Wed, 26 May 2021 19:59:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34856) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lm3FM-0005fe-RK for qemu-devel@nongnu.org; Wed, 26 May 2021 19:47:32 -0400 Received: from mail-pg1-x530.google.com ([2607:f8b0:4864:20::530]:38815) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lm3FH-0004Vf-DX for qemu-devel@nongnu.org; Wed, 26 May 2021 19:47:32 -0400 Received: by mail-pg1-x530.google.com with SMTP id 6so2296486pgk.5 for ; Wed, 26 May 2021 16:47:26 -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.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 May 2021 16:47:25 -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=GkrUlbYQvGIINdckDDsYyRJMGvt/rK6bUqzfCARWGa8=; b=iCsNwRvcCioueGeYWNuJsqJSOwa3ScHuIZ4CeFf50nirxzCq/jX7J+G1NnLy1/yY+a 8QVz++voVTDqyOTzar9YNnBkcMAmQJCjyveSGx+4GEQmuj7voXPsIH3iekLD1pPkR+D7 FU6TFAuJOie+NoV1d095RGYkW7hLbUehynDHIyAnwdKymYtVSnSwJdlRTsUYO5gl+51H v5SA1tDQ6nY7LBQHGy6Z4kbi/XhydLUtqZPLqayU4Mv55IYeL0sqGhhCnN/XLofVOnOv Um0bNyMH22GQ0JLRqJK+NvAiMap86GoihFBxzvNXmmgPtAXtDm0/tCJvdD1oW2EKN3Zx c3wg== 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=GkrUlbYQvGIINdckDDsYyRJMGvt/rK6bUqzfCARWGa8=; b=cfhoD0eWTfD2wfR+yfMNGThdIggonKbmPCZZOtwvZvetjO8Dihn9fgGMT8XKzrTboW RjrzT8Ap0fBP+teTD/BUpPn3TQXvslxXDp6hcGyS8rJgyDi8S28Vc1MMjxyuO2wDEJbd 4+Y7wmRxSXifO5cnUeyEyMkWAneVvIoSdt1ev2A8viMqBBA3eEOWmyDunCEEb3X3CdW7 uVb81il60nG5aXl3fp/lI9C4ObQ4rOa9q4K8WqNb7fSLQWTXkkPEn5rHI9X4WIEnpwFA mmNxWkEi0DyZ92Oj+KXIZTDpoRgDElHlwEWEJniE8BiMMVeNhSJt1TommzKho3zUG8NG /SNA== X-Gm-Message-State: AOAM532D2UiAAZnvTv6yKP7qPgPMZhzOfyre17nH+k5YFoZqhb651mua /9jksKUaz7spHEdT+U4ri890N52z7KZ82Q== X-Google-Smtp-Source: ABdhPJzSQgxrhOM2Lx1mNGx/8ohfvqpJzshAAPCJulD9CSXT5TNZaCQHk5NAPB3IJB0vcQW5oQtr/w== X-Received: by 2002:a63:f749:: with SMTP id f9mr960181pgk.369.1622072845823; Wed, 26 May 2021 16:47:25 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 16/31] cpu: Directly use get_paging_enabled() fallback handlers in place Date: Wed, 26 May 2021 16:46:55 -0700 Message-Id: <20210526234710.125396-17-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: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::530; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x530.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=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) From: Philippe Mathieu-Daud=C3=A9 No code uses CPUClass::get_paging_enabled() outside of hw/core/cpu.c: $ git grep -F -- '->get_paging_enabled' hw/core/cpu.c:74: return cc->get_paging_enabled(cpu); hw/core/cpu.c:438: k->get_paging_enabled =3D cpu_common_get_paging_ena= bled; target/i386/cpu.c:7418: cc->get_paging_enabled =3D x86_cpu_get_paging_= enabled; Check the handler presence in place and remove the common fallback code. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson Message-Id: <20210517105140.1062037-10-f4bug@amsat.org> Signed-off-by: Richard Henderson --- hw/core/cpu-common.c | 13 ------------- hw/core/cpu-sysemu.c | 11 +++++++++++ 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/hw/core/cpu-common.c b/hw/core/cpu-common.c index 5913ffe22b..2aa6b8cffc 100644 --- a/hw/core/cpu-common.c +++ b/hw/core/cpu-common.c @@ -66,18 +66,6 @@ CPUState *cpu_create(const char *typename) return cpu; } =20 -bool cpu_paging_enabled(const CPUState *cpu) -{ - CPUClass *cc =3D CPU_GET_CLASS(cpu); - - return cc->get_paging_enabled(cpu); -} - -static bool cpu_common_get_paging_enabled(const CPUState *cpu) -{ - return false; -} - void cpu_get_memory_mapping(CPUState *cpu, MemoryMappingList *list, Error **errp) { @@ -316,7 +304,6 @@ static void cpu_class_init(ObjectClass *klass, void *da= ta) k->parse_features =3D cpu_common_parse_features; k->get_arch_id =3D cpu_common_get_arch_id; k->has_work =3D cpu_common_has_work; - k->get_paging_enabled =3D cpu_common_get_paging_enabled; k->get_memory_mapping =3D cpu_common_get_memory_mapping; k->gdb_read_register =3D cpu_common_gdb_read_register; k->gdb_write_register =3D cpu_common_gdb_write_register; diff --git a/hw/core/cpu-sysemu.c b/hw/core/cpu-sysemu.c index 7f3a357494..931ba46354 100644 --- a/hw/core/cpu-sysemu.c +++ b/hw/core/cpu-sysemu.c @@ -22,6 +22,17 @@ #include "qapi/error.h" #include "hw/core/cpu.h" =20 +bool cpu_paging_enabled(const CPUState *cpu) +{ + CPUClass *cc =3D CPU_GET_CLASS(cpu); + + if (cc->get_paging_enabled) { + return cc->get_paging_enabled(cpu); + } + + return false; +} + hwaddr cpu_get_phys_page_attrs_debug(CPUState *cpu, vaddr addr, MemTxAttrs *attrs) { --=20 2.25.1