From patchwork Wed May 26 23:47:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 448338 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp14708jac; Wed, 26 May 2021 16:56:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyLio1/PjPyWYMye4xOUhiq6XBJvpfOtTP1zsXWadjoi1d+xnS+W4iZy38wjZ0AcBCAhfab X-Received: by 2002:a0c:fd8d:: with SMTP id p13mr498899qvr.52.1622073405094; Wed, 26 May 2021 16:56:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622073405; cv=none; d=google.com; s=arc-20160816; b=Qmv4ZY6YxGkJD/mxVtPsXnW+C916d7pVJu6XC8tRN0sUV2xGeTnXNFy3o6SNQ9vAx5 XsBcZ3Wt4y1DAAvLTkgJmk5Uqbb+P3cJeZFaxd3Y3czb0M+ZzF2W8ad13XuxIAr/KfOa gUWttzvHqQ1BariACVEwnYmSThXtNXiqsLSKxAbh2RkF9sv22mh0KAQELcibjEyDKiSa jNsr3Ji7K4rNGBJZCZtWq7o0JPqHy46BZjx9jj32Dk306W8ZYKDwW2G09u/gdc8+hgmO HIkqlv6Zq8uivBFRn5st7PUGpvbKqlDu/Jq6kJEjgMlq2wr37BidbwqtXxQn0fR8HK9D SulA== 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=lMwBO3bp6tNg7j75c27UeW2luvwPir3yOOEl1aaTHG4=; b=ZIcPhmsZ4DLtgp0VbNfTU3G11EVnhi7pgoF3MzFCKzJ1XaTtZvRW10Mk5OeeOjP0og 9BqdKYb9fUk9NxzMwtSPlovOVbwHciHuhpxzf0iIGE6Wm9fOU/M6/o2wPbkY71MfUy2C 0sNyPaPOT4JczyKUQp0s46ni5ctnbNVGQWUGNRlqfBkFTXqADHNstg/upRx20Id5Nr5p Mj522kiOewvh63s8zje/lOrP99uIqvkjHUscw40v9IXY+gWmBQkHEmUHGhYQc+JIeFz7 CJ7OHTGhzTvImQ2/onbHmOYObBqVqMWLHsqejtNOS4RnjP5MjdIaylPOMxgHT2jMdf34 B06Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ztGqTZVk; 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 o13si401715qvh.127.2021.05.26.16.56.44 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 26 May 2021 16:56:45 -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=ztGqTZVk; 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]:53328 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lm3OG-0006sy-DF for patch@linaro.org; Wed, 26 May 2021 19:56:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35018) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lm3FX-00060H-6f for qemu-devel@nongnu.org; Wed, 26 May 2021 19:47:43 -0400 Received: from mail-pf1-x435.google.com ([2607:f8b0:4864:20::435]:45897) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lm3FP-0004bv-5B for qemu-devel@nongnu.org; Wed, 26 May 2021 19:47:42 -0400 Received: by mail-pf1-x435.google.com with SMTP id d16so2191403pfn.12 for ; Wed, 26 May 2021 16:47:34 -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=lMwBO3bp6tNg7j75c27UeW2luvwPir3yOOEl1aaTHG4=; b=ztGqTZVkVfXQ75JTcWEyDz6/QKF0d5hgH28/BWBMQguHq24OKnPxcehpn7rci1T9Pm 4qRvrBJYPO+dlz8oiWbcDQF7zZo/kppHD/Z8PyF325QiKgGyxlmWffjHM9ltt+LmJNGe Oej5jfK5uNwBj8lYvft9jcPyUW9Lb9v8ZnXPM+/5EkdXUL8U5yrWV36Gz/fYDWHjj490 oF1paLunDlsxuR14/Y1WlyoGNlh/JwB+Aak1bPXNbMJsTYdssgrhHGeGIfYm6zNWEigT jaYanlhAZZqbNv+4+ujmLARox4uMj1keYtv7zNu0m7dY08fA57Keo56MrIs/rHjek+0v SNCw== 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=lMwBO3bp6tNg7j75c27UeW2luvwPir3yOOEl1aaTHG4=; b=jUSw8WYOAQFxjg7h+vmOAkRZ0YiJgI4hBZBLKoDrTdU75J0PPuPf9fD0b4tqH5DVGJ 2zGGMxxj7HwErD1QZgpQ5XMA4RuNVD9thZ/HVCwsG9LfA05UAymkfB0ly4mNhPYjzxcB RN1a2VrUFapqUCMCfMOQbbgDXkPdD/oSgI4rD+ntawZFiaMegyh1bJb6VV65I3yFpVWW O7taCvg2hv7quW0ssVa5117FBkJsAioM3x/XZUU1iZWhFpsEHU7100hGOyN5Q4aPULw3 /LT6/3276opRD2XpEH+FZTd05dao729US9B3AovwWaDbloJb6lQU9UoRmUaqUZH1fncv we5g== X-Gm-Message-State: AOAM53311Hy4zHBBzrViC4PSqg+G5C1H+Ul+5iK5yOUT8ADea/U130Pp C32I3V6AFGo4NtkiPQFMiPBEZYUdHEnb9g== X-Received: by 2002:a62:e10e:0:b029:2db:32e7:403f with SMTP id q14-20020a62e10e0000b02902db32e7403fmr925459pfh.61.1622072853854; Wed, 26 May 2021 16:47:33 -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.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 May 2021 16:47:33 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 26/31] cpu: Move CPUClass::asidx_from_attrs to SysemuCPUOps Date: Wed, 26 May 2021 16:47:05 -0700 Message-Id: <20210526234710.125396-27-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::435; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x435.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-20-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/arm/cpu.c | 2 +- target/i386/cpu.c | 2 +- 5 files changed, 9 insertions(+), 7 deletions(-) -- 2.25.1 diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index 15b16d3f6d..af6246c905 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -109,8 +109,6 @@ struct SysemuCPUOps; * associated memory transaction attributes to use for the access. * CPUs which use memory transaction attributes should implement this * instead of get_phys_page_debug. - * @asidx_from_attrs: Callback to return the CPU AddressSpace to use for - * a memory access with the specified memory transaction attributes. * @gdb_read_register: Callback for letting GDB read a register. * @gdb_write_register: Callback for letting GDB write a register. * @gdb_num_core_regs: Number of core registers accessible to GDB. @@ -152,7 +150,6 @@ struct CPUClass { hwaddr (*get_phys_page_debug)(CPUState *cpu, vaddr addr); hwaddr (*get_phys_page_attrs_debug)(CPUState *cpu, vaddr addr, MemTxAttrs *attrs); - int (*asidx_from_attrs)(CPUState *cpu, MemTxAttrs attrs); 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 52ac0ae4e1..8f8326e810 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 { + /** + * @asidx_from_attrs: Callback to return the CPU AddressSpace to use for + * a memory access with the specified memory transaction attributes. + */ + int (*asidx_from_attrs)(CPUState *cpu, MemTxAttrs attrs); /** * @get_crash_info: Callback for reporting guest crash information in * GUEST_PANICKED events. diff --git a/hw/core/cpu-sysemu.c b/hw/core/cpu-sysemu.c index d55ef8d23d..ba53c2eaa8 100644 --- a/hw/core/cpu-sysemu.c +++ b/hw/core/cpu-sysemu.c @@ -72,8 +72,8 @@ int cpu_asidx_from_attrs(CPUState *cpu, MemTxAttrs attrs) CPUClass *cc = CPU_GET_CLASS(cpu); int ret = 0; - if (cc->asidx_from_attrs) { - ret = cc->asidx_from_attrs(cpu, attrs); + if (cc->sysemu_ops->asidx_from_attrs) { + ret = cc->sysemu_ops->asidx_from_attrs(cpu, attrs); assert(ret < cpu->num_ases && ret >= 0); } return ret; diff --git a/target/arm/cpu.c b/target/arm/cpu.c index 18627cc3c6..85666b765f 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -1948,6 +1948,7 @@ static gchar *arm_gdb_arch_name(CPUState *cs) #include "hw/core/sysemu-cpu-ops.h" static const struct SysemuCPUOps arm_sysemu_ops = { + .asidx_from_attrs = arm_asidx_from_attrs, .write_elf32_note = arm_cpu_write_elf32_note, .write_elf64_note = arm_cpu_write_elf64_note, .virtio_is_big_endian = arm_cpu_virtio_is_big_endian, @@ -1993,7 +1994,6 @@ static void arm_cpu_class_init(ObjectClass *oc, void *data) cc->gdb_write_register = arm_cpu_gdb_write_register; #ifndef CONFIG_USER_ONLY cc->get_phys_page_attrs_debug = arm_cpu_get_phys_page_attrs_debug; - cc->asidx_from_attrs = arm_asidx_from_attrs; cc->sysemu_ops = &arm_sysemu_ops; #endif cc->gdb_num_core_regs = 26; diff --git a/target/i386/cpu.c b/target/i386/cpu.c index 2ba82921d6..45e7ded0ce 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 = { + .asidx_from_attrs = x86_asidx_from_attrs, .get_crash_info = x86_cpu_get_crash_info, .write_elf32_note = x86_cpu_write_elf32_note, .write_elf64_note = x86_cpu_write_elf64_note, @@ -6754,7 +6755,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->asidx_from_attrs = x86_asidx_from_attrs; cc->get_memory_mapping = x86_cpu_get_memory_mapping; cc->get_phys_page_attrs_debug = x86_cpu_get_phys_page_attrs_debug; cc->sysemu_ops = &i386_sysemu_ops;