From patchwork Wed Nov 30 13:52:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 629481 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp872623pvb; Wed, 30 Nov 2022 05:54:05 -0800 (PST) X-Google-Smtp-Source: AA0mqf56nG4MCBBDJbOHalJiy5RTO5rL7Xy876hbzIjsLva+DAcdqUYI38NgxKsQUf5Oj34HhjS8 X-Received: by 2002:ac8:4555:0:b0:398:353c:fe2e with SMTP id z21-20020ac84555000000b00398353cfe2emr57274609qtn.507.1669816445580; Wed, 30 Nov 2022 05:54:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669816445; cv=none; d=google.com; s=arc-20160816; b=X4U4AyohQImuvcIo9nquD0GwmoZqPcJJQe2JsRierTzQCpOf+QjCzW97kzUB5dMdWb gYOH3kFlJrnYUvBcDUztgVaHjelImXdjkBQUCWAjwA/Gq5BEgEhbNnTDs3dWwMm6yqBv OcWdaiVyE5FWVRA71TQWQV572Y3GqQPncAaf4duSGimIPrwoNMkGtW4GuoMbfZbxiVcv U9O4ppXJ1hBRNo/H3O3hTar29pouIDd5QZ51pi+LAsCmLH0w4k6rt9VqS6drFm6iIVG0 0AggEQRqjXsq/dInEoZHKbyjoI8rHDvj7RVQJ95CFLncCIL0aQDNpzhWJ9b1InAzyU/E J9Bw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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:cc:to :from:dkim-signature; bh=TjwwaNh2aYs+3FpXFQtWY38JR8kt7/RLknMm10DQ6GY=; b=Ux/nzOg5injWKyvaQos7UiytY0g3zFZjbAL/4MSXlzK+ZRA6U7k07x5YTJaqmmkiPS xjzD5ShvmoSDzMKb6UESiHOcd5pX+ZWRxXxFK4tFSdkz6AEYJ3LXMuVcyBTCAD6HJ7MS 4v9b2A1fsPgNuPD7Sr1HzbJ9Kf4SaSZPexlDELU/UxBP5YdCDoR1B7cK0AqVcXnAkr/N J1CU/VdZ8lkmFD7r5ceotqJJgA5RmYatpwtJBkImfeE1iIa2/K6Fv1fkT1xt5zQBxaLl EYWRhK/y4zqknzz+9Of94hrGXnBA/9PfRR/bhHHx3NrHPOLWUn0brJ/QYM5zehvcgiwZ kXoA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="hmox/PGr"; 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 gf12-20020a056214250c00b004bbd357546fsi828842qvb.347.2022.11.30.05.54.05 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 30 Nov 2022 05:54:05 -0800 (PST) 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="hmox/PGr"; 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] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p0NWr-0004mM-BP; Wed, 30 Nov 2022 08:53:39 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p0NWo-0004km-P1 for qemu-devel@nongnu.org; Wed, 30 Nov 2022 08:53:34 -0500 Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p0NWk-0003bu-Kr for qemu-devel@nongnu.org; Wed, 30 Nov 2022 08:53:34 -0500 Received: by mail-wr1-x430.google.com with SMTP id y16so7442117wrm.2 for ; Wed, 30 Nov 2022 05:52:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=TjwwaNh2aYs+3FpXFQtWY38JR8kt7/RLknMm10DQ6GY=; b=hmox/PGrHmsdiB3XtiKBqkjDJAcsylQAexqdzjEKJ7hHcfhtC2wiQXVDND6/D6AF6R PkGFQJwtSyMik+dCpYisHgrIdqpQ/TETwn7hgTmwUVIYXxRZu5SUOQM9RM/o1z5GTs2V ruv2ZLFTRuVlJ2RvHFNqwwam3vWc2rb10XoWfEVNXEXKSjwWVOptvOzyq2TWmy7psS5x OQw36Yj6g8vKaA9X9Zgp5qvV5O48yhHUgZw4hvUH+3CtTzjBkrzWe+l/Hpa0V0cNsMZi ftpmtkOKX89sfzxsIqI1AbeQSuAO/cBeJo7sCpcnsp+QdEXrkEx9yOlBabIPjPutRQtH RBAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=TjwwaNh2aYs+3FpXFQtWY38JR8kt7/RLknMm10DQ6GY=; b=UTqDrWeQYLKYYGH3qvTiJh4zJ8+mmK4+N92NHO0SQB9aBJ8MpsSxXI2Nv/jZnjy0k3 59TnsmiGC2NY1r8BDDY7Z9NKHnv/twSNJIDULLHkI2TNq3RczJy7GYV01ACx40dozq7w hxxXAvNa3PIskliTaYM2wXR4SXT9P6cgpqs41/4SY0CbDk/Sli/qG2BDDUQLoqOu57kO g8NiDJt5kv36E6POTHI3TwFlf5UeVJwqbsnzG54tnFXcU6doNEkOpJU3OXHeg1bBP4Z6 /gGg6jYwZtqR5KZSIMYg4zQjhMslXJL1JdaTtWtpia13j6m3UdoW5PcgxSRCrJDyBkrG F0uQ== X-Gm-Message-State: ANoB5pkJjZGrRakmnvkrmpJS1Wrmq8S41X4QfGNxEQNhNJWvoabbuu2F 0LZ+LwS2+CXt/ibX6B3ricnUJ7sD/WgKVAbS X-Received: by 2002:a5d:4741:0:b0:242:140d:43be with SMTP id o1-20020a5d4741000000b00242140d43bemr10249704wrs.623.1669816374323; Wed, 30 Nov 2022 05:52:54 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id b4-20020a5d45c4000000b00242209dd1ffsm1761552wrs.41.2022.11.30.05.52.53 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 30 Nov 2022 05:52:53 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Eduardo Habkost , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= , Richard Henderson , Paolo Bonzini , Yanan Wang , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Marcel Apfelbaum , Thomas Huth Subject: [PATCH-for-8.0 2/5] cpu: Move cpu_class_init_props() to common code Date: Wed, 30 Nov 2022 14:52:38 +0100 Message-Id: <20221130135241.85060-3-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221130135241.85060-1-philmd@linaro.org> References: <20221130135241.85060-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::430; envelope-from=philmd@linaro.org; helo=mail-wr1-x430.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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org This code is not target-specific. Signed-off-by: Philippe Mathieu-Daudé --- cpu.c | 53 --------------------------------------------------- cpus-common.c | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+), 53 deletions(-) diff --git a/cpu.c b/cpu.c index 4a7d865427..d4b24ea39a 100644 --- a/cpu.c +++ b/cpu.c @@ -21,8 +21,6 @@ #include "qapi/error.h" #include "exec/target_page.h" -#include "hw/qdev-core.h" -#include "hw/qdev-properties.h" #include "qemu/error-report.h" #include "migration/vmstate.h" #ifdef CONFIG_USER_ONLY @@ -183,57 +181,6 @@ void cpu_exec_unrealizefn(CPUState *cpu) cpu_list_remove(cpu); } -/* - * This can't go in hw/core/cpu.c because that file is compiled only - * once for both user-mode and system builds. - */ -static Property cpu_common_props[] = { -#ifdef CONFIG_USER_ONLY - /* - * Create a property for the user-only object, so users can - * adjust prctl(PR_SET_UNALIGN) from the command-line. - * Has no effect if the target does not support the feature. - */ - DEFINE_PROP_BOOL("prctl-unalign-sigbus", CPUState, - prctl_unalign_sigbus, false), -#else - /* - * Create a memory property for softmmu CPU object, so users can - * wire up its memory. The default if no link is set up is to use - * the system address space. - */ - DEFINE_PROP_LINK("memory", CPUState, memory, TYPE_MEMORY_REGION, - MemoryRegion *), -#endif - DEFINE_PROP_END_OF_LIST(), -}; - -static bool cpu_get_start_powered_off(Object *obj, Error **errp) -{ - CPUState *cpu = CPU(obj); - return cpu->start_powered_off; -} - -static void cpu_set_start_powered_off(Object *obj, bool value, Error **errp) -{ - CPUState *cpu = CPU(obj); - cpu->start_powered_off = value; -} - -void cpu_class_init_props(DeviceClass *dc) -{ - ObjectClass *oc = OBJECT_CLASS(dc); - - device_class_set_props(dc, cpu_common_props); - /* - * We can't use DEFINE_PROP_BOOL in the Property array for this - * property, because we want this to be settable after realize. - */ - object_class_property_add_bool(oc, "start-powered-off", - cpu_get_start_powered_off, - cpu_set_start_powered_off); -} - void cpu_exec_initfn(CPUState *cpu) { cpu->as = NULL; diff --git a/cpus-common.c b/cpus-common.c index 793364dc0e..9151cf4240 100644 --- a/cpus-common.c +++ b/cpus-common.c @@ -20,6 +20,8 @@ #include "qemu/osdep.h" #include "qemu/main-loop.h" #include "exec/cpu-common.h" +#include "exec/memory.h" +#include "hw/qdev-properties.h" #include "hw/core/cpu.h" #include "sysemu/cpus.h" #include "qemu/lockable.h" @@ -360,3 +362,54 @@ void process_queued_cpu_work(CPUState *cpu) qemu_mutex_unlock(&cpu->work_mutex); qemu_cond_broadcast(&qemu_work_cond); } + +/* + * This can't go in hw/core/cpu.c because that file is compiled only + * once for both user-mode and system builds. + */ +static Property cpu_common_props[] = { +#ifdef CONFIG_USER_ONLY + /* + * Create a property for the user-only object, so users can + * adjust prctl(PR_SET_UNALIGN) from the command-line. + * Has no effect if the target does not support the feature. + */ + DEFINE_PROP_BOOL("prctl-unalign-sigbus", CPUState, + prctl_unalign_sigbus, false), +#else + /* + * Create a memory property for softmmu CPU object, so users can + * wire up its memory. The default if no link is set up is to use + * the system address space. + */ + DEFINE_PROP_LINK("memory", CPUState, memory, TYPE_MEMORY_REGION, + MemoryRegion *), +#endif + DEFINE_PROP_END_OF_LIST(), +}; + +static bool cpu_get_start_powered_off(Object *obj, Error **errp) +{ + CPUState *cpu = CPU(obj); + return cpu->start_powered_off; +} + +static void cpu_set_start_powered_off(Object *obj, bool value, Error **errp) +{ + CPUState *cpu = CPU(obj); + cpu->start_powered_off = value; +} + +void cpu_class_init_props(DeviceClass *dc) +{ + ObjectClass *oc = OBJECT_CLASS(dc); + + device_class_set_props(dc, cpu_common_props); + /* + * We can't use DEFINE_PROP_BOOL in the Property array for this + * property, because we want this to be settable after realize. + */ + object_class_property_add_bool(oc, "start-powered-off", + cpu_get_start_powered_off, + cpu_set_start_powered_off); +}