Received: by 2002:a19:6d5:0:0:0:0:0 with SMTP id 204csp5706277lfg; Wed, 3 Mar 2021 13:48:16 -0800 (PST) X-Received: by 2002:a05:600c:1553:: with SMTP id f19mr834171wmg.33.1614808096306; Wed, 03 Mar 2021 13:48:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614808096; cv=none; d=google.com; s=arc-20160816; b=c+yIZlKjuXkFUiCHLq3hT4DHNe828uu05FThe1CZPT7IQ8XdpKBokXQkEhKlfZ9ZX0 +yPQvi0FFqTPk1CmEj+bulpyIDKth/HlTXrTZKKjB/hiztQNVDk+UqB+uOK649SauxV4 kOg1rupFVCUrYWFEpgCvaVrtv8NtCdkO7oVySmsmgwdHj4zqHidk+PX1+dZrZnHjVZnt mvEd2nJzC1wtdqMz8GDi7l9CJwfzNBan543UQQG3istG0DE1sH2gb0VrlG6/W/dDsZlk psgWTsNNOEIa13gUOBel1i5Hw/GajUkrv3fsDIjUWGehZqFiZ69hD2jpxDW9aH4k5dNk iWKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:dkim-signature; bh=SGgvJvthMXD03HaoXNm8wXH0XCzERc2USBOw0EtbwiA=; b=YzzEArLWAgSA7/UR3IYUNK5a71B7903dBWlImLPX7gVsE9ZEaZz/W33uPT1jf6PKh2 SqWIGIG1t4RtKe6cbbDdR/7mvllLrNVzuO3iQD4mUkHISGcI+UgULj7gTRB80Nfv9d3b OyTHuyZZZ0x7RhOuLGsNmfJ6Wp+WxVPpuNGgwcKtnGq1HDOdEHySC0h3z0Vdv0IPHRl6 ODeSNYeX+MTeuQENWzmPwf8iopB7SF60RQOo0ZhMGn7OWmOsZnFwK+8m/meV3KcKq2zR GxcGyh4kZy7kfzjJspUBgQrnSZG7DRTcsOx7KJhz8p63UwdqR3Ne6gIqGMXH/5Y8rwxO 5nOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="Mc4d/acA"; spf=pass (google.com: domain of philippe.mathieu.daude@gmail.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=amsat.org Return-Path: Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id o13sor12684968wry.0.2021.03.03.13.48.16 (Google Transport Security); Wed, 03 Mar 2021 13:48:16 -0800 (PST) Received-SPF: pass (google.com: domain of philippe.mathieu.daude@gmail.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="Mc4d/acA"; spf=pass (google.com: domain of philippe.mathieu.daude@gmail.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=amsat.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=SGgvJvthMXD03HaoXNm8wXH0XCzERc2USBOw0EtbwiA=; b=Mc4d/acAmB+6BqJYXabbkaPu4sAg7su+vbKRsuJpl28QVvFI2w48rM+a6juPZXFknq cLCJ+zVdFbjIFyr9FKEjIGqw4Gcjo0LpyJNKu55vG8glS1GrM1RGJYqZH8SlSaQUtPZV /ell4udmI49GNj3Zv9jgDa8tOH2YE6pSGRcTdiYMUABCI48c9OczNnox7cQ445VnEXxD sHkue5Xo4hVndVoUg5cPRcUmyrvm4h8ORizDW1xq4769FaAZev8Cm9XadvWNw0L8LF5o jQuJpggthS7vkv2oe82rW9E1xVajhoGoikVmbO7PcbVay14cng3zrJaS3aNqpqy+IpIH wHxg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=SGgvJvthMXD03HaoXNm8wXH0XCzERc2USBOw0EtbwiA=; b=Qm8PapbTbLnbpn52Cu9Cuk4Pen9/LOW1SZDwSemStZwoozWliVXwY+3ElsWuIuFdep K365dQP1X+WHEG3M/gcnKyNmpsoc/sNM7ufetAt1Vxl1Q7EchMSpGTdSO5/l9bpsOK9o hkptEp4rCinpBukuwuD9s2HgPqM60C7/i2+CBTTTUddgzaNORLXSrYHGpSTPHuAlWK9I BwbeGQKLdFFsCtgDzp3Zc5Sply5jE3LPO0FflP10Tg4vGCCO50IKTcw4t0uCbOTr79QZ NBGFMj0qqFCxqfm0iLUgkIflt5/vUA9aJlDRebPfLkVUFMiKLMEki6WoQhhBdfFbIePD nfug== X-Gm-Message-State: AOAM532Ek1DOrUG6JvaAGjnplguG4lG+eBkr9rNWl4PtLRokFIQjxJff gtv0DnWE+wdOOJD3R8G8RZ0r95tNmoM= X-Google-Smtp-Source: ABdhPJxy6nmNPxPJ4qgF5x2edIw+9apnghtsUsx1OJKtIU9w7yoRpaOD+eauKex9Y1vj4ZL0oU7IsQ== X-Received: by 2002:a5d:6b0a:: with SMTP id v10mr668671wrw.183.1614808096132; Wed, 03 Mar 2021 13:48:16 -0800 (PST) Return-Path: Received: from x1w.redhat.com (68.red-83-57-175.dynamicip.rima-tde.net. [83.57.175.68]) by smtp.gmail.com with ESMTPSA id p17sm6567070wmq.47.2021.03.03.13.48.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Mar 2021 13:48:15 -0800 (PST) Sender: =?UTF-8?Q?Philippe_Mathieu=2DDaud=C3=A9?= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Claudio Fontana , qemu-arm@nongnu.org, Peter Maydell , Paolo Bonzini , Richard Henderson , qemu-s390x@nongnu.org, Thomas Huth , qemu-ppc@nongnu.org, Laurent Vivier , Cornelia Huck , =?UTF-8?q?Alex=20Benn=C3=A9e?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Eduardo Habkost , Marcel Apfelbaum Subject: [PATCH v4 12/28] cpu: Move CPUClass::asidx_from_attrs to SysemuCPUOps Date: Wed, 3 Mar 2021 22:46:52 +0100 Message-Id: <20210303214708.1727801-13-f4bug@amsat.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210303214708.1727801-1-f4bug@amsat.org> References: <20210303214708.1727801-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-TUID: N7sJULsBKVhV Signed-off-by: Philippe Mathieu-Daudé --- include/hw/core/cpu.h | 3 --- include/hw/core/sysemu-cpu-ops.h | 5 +++++ hw/core/cpu.c | 4 ++-- target/arm/cpu.c | 2 +- target/i386/cpu.c | 2 +- 5 files changed, 9 insertions(+), 7 deletions(-) diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index 0a2c29c3735..6713a615916 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -108,8 +108,6 @@ struct AccelCPUClass; * 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. @@ -151,7 +149,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 60c667801ef..3c3f211136d 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.c b/hw/core/cpu.c index c74390aafbf..c44229205ff 100644 --- a/hw/core/cpu.c +++ b/hw/core/cpu.c @@ -116,8 +116,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 0c06b9b1758..7edb9f581bc 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -2262,6 +2262,7 @@ static gchar *arm_gdb_arch_name(CPUState *cs) #ifndef CONFIG_USER_ONLY 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, @@ -2307,7 +2308,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 403ed65fc61..4f64f9c2d68 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -7388,6 +7388,7 @@ static Property x86_cpu_properties[] = { #ifndef CONFIG_USER_ONLY 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, @@ -7429,7 +7430,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; -- 2.26.2