From patchwork Wed May 26 23:46:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 448360 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp15382jac; Wed, 26 May 2021 16:57:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxVcL9vUkGwonvTVicrXKbLkg9I3vzQZrhSHcGjBFSoqGb6FA2XxqUrezpoZrCmv11nca+I X-Received: by 2002:ac8:5fc1:: with SMTP id k1mr662873qta.275.1622073479373; Wed, 26 May 2021 16:57:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622073479; cv=none; d=google.com; s=arc-20160816; b=cQkCLvS12HJd9BVAd9HxNnLsxX7DPM8UMmXCQUtbiD598uG6G0fuS2a7MBzee3kUUM e2zmhyeIdNlktsmMCqZXEBlQysvHOmJdyEsa4JmIX/FhbvTjPnJvTIGrDEAj/u6wQOjv D/x4TySmIRhuetn5T9Z6AGZGM+GcWkAefzODMST/sH2xhhOythEF+FFLjCOG1Xx4LY2f MKmEKq7ShIR1jOf0+MGPeNu+TTW7frWO7ex6JP6EqeAklhoock9j3w970Glp1OE76W12 J5umNe6LYcYUMY8aT1yEL5Ii8dLQJ72VQLzjxV6IvW9+jY5zHbywnH7PG/u9Y9fyz8d2 gH9w== 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=GkrUlbYQvGIINdckDDsYyRJMGvt/rK6bUqzfCARWGa8=; b=uAiZEtxA3kGLmMxBTor8tG5NI3aSlXaOreWBR+J/ZjLqR0cylimRjhvK1PIX0FkJlG Eh0EcP82KuvMp9IuvQCzr3F0p4n4/a6zs4m9DyFTKQm1Tzz5EMbnAVyLSVBhGsTGznUt E2SU9gATxvv1Dvvd0QbPOkhPJScjdTPnlbFdo8Emda7Q/54xqsvN+hHldUvTtogp38A5 umVErhqggXxmzoTqmMVUxU0fQ4Ruqe0xDIX7p0gllvEJ/TG+W97y0fJJThn3QwTypokA dnw4lj4STzAVkdGhEigNx3qc3fAmck6fvIL14wq/KUKfok6WbQ22V9aIa4D76R7T+mVj liLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=iCsNwRvc; 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 r4si480992qtc.60.2021.05.26.16.57.59 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 26 May 2021 16:57:59 -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=iCsNwRvc; 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]:57668 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lm3PS-0001KL-Qc for patch@linaro.org; Wed, 26 May 2021 19:57:58 -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) 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-Received: by 2002:a63:f749:: with SMTP id f9mr960181pgk.369.1622072845823; Wed, 26 May 2021 16:47:25 -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) 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 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_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Philippe Mathieu-Daudé 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 = cpu_common_get_paging_enabled; target/i386/cpu.c:7418: cc->get_paging_enabled = x86_cpu_get_paging_enabled; Check the handler presence in place and remove the common fallback code. Signed-off-by: Philippe Mathieu-Daudé 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(-) -- 2.25.1 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; } -bool cpu_paging_enabled(const CPUState *cpu) -{ - CPUClass *cc = 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 *data) k->parse_features = cpu_common_parse_features; k->get_arch_id = cpu_common_get_arch_id; k->has_work = cpu_common_has_work; - k->get_paging_enabled = cpu_common_get_paging_enabled; k->get_memory_mapping = cpu_common_get_memory_mapping; k->gdb_read_register = cpu_common_gdb_read_register; k->gdb_write_register = 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" +bool cpu_paging_enabled(const CPUState *cpu) +{ + CPUClass *cc = 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) {