[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 9/9] exec/address-spaces: Inline legacy functions
- To: Philippe Mathieu-Daudé <f4bug@xxxxxxxxx>
- From: BALATON Zoltan <balaton@xxxxxxxxxx>
- Date: Tue, 20 Sep 2022 11:02:41 +0200 (CEST)
- Cc: Bernhard Beschow <shentey@xxxxxxxxx>, qemu-devel@xxxxxxxxxx, "Michael S. Tsirkin" <mst@xxxxxxxxxx>, Magnus Damm <magnus.damm@xxxxxxxxx>, Aleksandar Rikalo <aleksandar.rikalo@xxxxxxxxxx>, Bandan Das <bsd@xxxxxxxxxx>, Matthew Rosato <mjrosato@xxxxxxxxxxxxx>, Daniel Henrique Barboza <danielhb413@xxxxxxxxx>, Sergio Lopez <slp@xxxxxxxxxx>, Alexey Kardashevskiy <aik@xxxxxxxxx>, Xiaojuan Yang <yangxiaojuan@xxxxxxxxxxx>, Cameron Esfahani <dirty@xxxxxxxxx>, Michael Rolnik <mrolnik@xxxxxxxxx>, Song Gao <gaosong@xxxxxxxxxxx>, Jagannathan Raman <jag.raman@xxxxxxxxxx>, Greg Kurz <groug@xxxxxxxx>, Kamil Rytarowski <kamil@xxxxxxxxxx>, Peter Xu <peterx@xxxxxxxxxx>, Joel Stanley <joel@xxxxxxxxx>, Alistair Francis <Alistair.Francis@xxxxxxx>, "Dr. David Alan Gilbert" <dgilbert@xxxxxxxxxx>, Paolo Bonzini <pbonzini@xxxxxxxxxx>, haxm-team@xxxxxxxxx, Roman Bolshakov <r.bolshakov@xxxxxxxxx>, Markus Armbruster <armbru@xxxxxxxxxx>, Eric Auger <eric.auger@xxxxxxxxxx>, David Gibson <david@xxxxxxxxxxxxxxxxxxxxx>, Daniel P. Berrangé <berrange@xxxxxxxxxx>, Christian Borntraeger <borntraeger@xxxxxxxxxxxxx>, Cédric Le Goater <clg@xxxxxxxx>, Stefan Hajnoczi <stefanha@xxxxxxxxxx>, qemu-block@xxxxxxxxxx, Eduardo Habkost <eduardo@xxxxxxxxxxx>, Hervé Poussineau <hpoussin@xxxxxxxxxxx>, qemu-ppc@xxxxxxxxxx, Cornelia Huck <cohuck@xxxxxxxxxx>, Palmer Dabbelt <palmer@xxxxxxxxxxx>, Helge Deller <deller@xxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, qemu-riscv@xxxxxxxxxx, Stafford Horne <shorne@xxxxxxxxx>, Paul Durrant <paul@xxxxxxx>, Havard Skinnemoen <hskinnemoen@xxxxxxxxxx>, Elena Ufimtseva <elena.ufimtseva@xxxxxxxxxx>, Alexander Graf <agraf@xxxxxxxxx>, Thomas Huth <thuth@xxxxxxxxxx>, Alex Williamson <alex.williamson@xxxxxxxxxx>, Wenchao Wang <wenchao.wang@xxxxxxxxx>, Tony Krowiak <akrowiak@xxxxxxxxxxxxx>, Marcel Apfelbaum <marcel.apfelbaum@xxxxxxxxx>, qemu-s390x@xxxxxxxxxx, Marc-André Lureau <marcandre.lureau@xxxxxxxxxx>, Mark Cave-Ayland <mark.cave-ayland@xxxxxxxxxxxx>, Eric Farman <farman@xxxxxxxxxxxxx>, Reinoud Zandijk <reinoud@xxxxxxxxxx>, Alexander Bulekov <alxndr@xxxxxx>, Yanan Wang <wangyanan55@xxxxxxxxxx>, "Edgar E. Iglesias" <edgar.iglesias@xxxxxxxxx>, Gerd Hoffmann <kraxel@xxxxxxxxxx>, Tyrone Ting <kfting@xxxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx, Yoshinori Sato <ysato@xxxxxxxxxxxxxxxxxxxx>, John Snow <jsnow@xxxxxxxxxx>, Richard Henderson <richard.henderson@xxxxxxxxxx>, Darren Kenny <darren.kenny@xxxxxxxxxx>, kvm@xxxxxxxxxxxxxxx, Qiuhao Li <Qiuhao.Li@xxxxxxxxxxx>, John G Johnson <john.g.johnson@xxxxxxxxxx>, Bin Meng <bin.meng@xxxxxxxxxxxxx>, Sunil Muthuswamy <sunilmut@xxxxxxxxxxxxx>, Max Filippov <jcmvbkbc@xxxxxxxxx>, qemu-arm@xxxxxxxxxx, Marcelo Tosatti <mtosatti@xxxxxxxxxx>, Peter Maydell <peter.maydell@xxxxxxxxxx>, Anthony Perard <anthony.perard@xxxxxxxxxx>, Andrew Jeffery <andrew@xxxxxxxx>, Artyom Tarasenko <atar4qemu@xxxxxxxxx>, Halil Pasic <pasic@xxxxxxxxxxxxx>, "Maciej S. Szmigiero" <maciej.szmigiero@xxxxxxxxxx>, Jason Wang <jasowang@xxxxxxxxxx>, David Hildenbrand <david@xxxxxxxxxx>, Laurent Vivier <laurent@xxxxxxxxx>, Alistair Francis <alistair@xxxxxxxxxxxxx>, Jason Herne <jjherne@xxxxxxxxxxxxx>
- Delivery-date: Tue, 20 Sep 2022 09:02:51 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On Tue, 20 Sep 2022, Philippe Mathieu-Daudé via wrote:
On 20/9/22 01:17, Bernhard Beschow wrote:
The functions just access a global pointer and perform some pointer
arithmetic on top. Allow the compiler to see through this by inlining.
I thought about this while reviewing the previous patch, ...
Signed-off-by: Bernhard Beschow <shentey@xxxxxxxxx>
---
include/exec/address-spaces.h | 30 ++++++++++++++++++++++++++----
softmmu/physmem.c | 28 ----------------------------
2 files changed, 26 insertions(+), 32 deletions(-)
diff --git a/include/exec/address-spaces.h b/include/exec/address-spaces.h
index b31bd8dcf0..182af27cad 100644
--- a/include/exec/address-spaces.h
+++ b/include/exec/address-spaces.h
@@ -23,29 +23,51 @@
#ifndef CONFIG_USER_ONLY
+#include "hw/boards.h"
... but I'm not a fan of including this header here. It is restricted to
system emulation, but still... Let see what the others think.
Had the same thought first if this would break user emulation but I don't
know how that works (and this include is withing !CONFIG_USER_ONLY). I've
checked in configure now and it seems that softmmu is enabled/disabled
with system, which reminded me to a previous conversation where I've
suggested renaming softmmu to sysemu as that better shows what it's really
used for and maybe the real softmmu part should be split from it but I
don't remember the details. If it still works with --enable-user
--disable-system then maybe it's OK and only confusing because of
misnaming sysemu as softmmu.
Reagrds,
BALATON Zoltan
/**
* Get the root memory region. This is a legacy function, provided for
* compatibility. Prefer using SysBusState::system_memory directly.
*/
-MemoryRegion *get_system_memory(void);
+inline MemoryRegion *get_system_memory(void)
+{
+ assert(current_machine);
+
+ return ¤t_machine->main_system_bus.system_memory;
+}
/**
* Get the root I/O port region. This is a legacy function, provided for
* compatibility. Prefer using SysBusState::system_io directly.
*/
-MemoryRegion *get_system_io(void);
+inline MemoryRegion *get_system_io(void)
+{
+ assert(current_machine);
+
+ return ¤t_machine->main_system_bus.system_io;
+}
/**
* Get the root memory address space. This is a legacy function,
provided for
* compatibility. Prefer using SysBusState::address_space_memory
directly.
*/
-AddressSpace *get_address_space_memory(void);
+inline AddressSpace *get_address_space_memory(void)
+{
+ assert(current_machine);
+
+ return ¤t_machine->main_system_bus.address_space_memory;
+}
/**
* Get the root I/O port address space. This is a legacy function,
provided
* for compatibility. Prefer using SysBusState::address_space_io
directly.
*/
-AddressSpace *get_address_space_io(void);
+inline AddressSpace *get_address_space_io(void)
+{
+ assert(current_machine);
+
+ return ¤t_machine->main_system_bus.address_space_io;
+}
#endif
diff --git a/softmmu/physmem.c b/softmmu/physmem.c
index 07e9a9171c..dce088f55c 100644
--- a/softmmu/physmem.c
+++ b/softmmu/physmem.c
@@ -2674,34 +2674,6 @@ static void memory_map_init(SysBusState *sysbus)
address_space_init(&sysbus->address_space_io, system_io, "I/O");
}
-MemoryRegion *get_system_memory(void)
-{
- assert(current_machine);
-
- return ¤t_machine->main_system_bus.system_memory;
-}
-
-MemoryRegion *get_system_io(void)
-{
- assert(current_machine);
-
- return ¤t_machine->main_system_bus.system_io;
-}
-
-AddressSpace *get_address_space_memory(void)
-{
- assert(current_machine);
-
- return ¤t_machine->main_system_bus.address_space_memory;
-}
-
-AddressSpace *get_address_space_io(void)
-{
- assert(current_machine);
-
- return ¤t_machine->main_system_bus.address_space_io;
-}
-
static void invalidate_and_set_dirty(MemoryRegion *mr, hwaddr addr,
hwaddr length)
{
|