[PATCH] docs/system: Remove ADC from raspi documentation

2024-05-12 Thread Rayhan Faizel
None of the RPi boards have ADC on-board. In real life, an external ADC chip is required to operate on analog signals. Signed-off-by: Rayhan Faizel --- docs/system/arm/raspi.rst | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/system/arm/raspi.rst b/docs/system/arm/raspi.rst index fbec1da

target/ppc: Move VMX int add/sub saturate insns to decodetree.

2024-05-12 Thread Chinmay Rath
Moving the following instructions to decodetree : v{add,sub}{u,s}{b,h,w}s : VX-form However, the following instructions were paired using the GEN_VXFORM_DUAL macros in the vmx-impl and vmx-ops files : vaddubs and vmul10uq vadduhs and vmul10euq vaddshs and bcdcpsgn vsububs and bcdadd

[PATCH 1/1] target/ppc: Move VMX integer add/sub saturate insns to decodetree.

2024-05-12 Thread Chinmay Rath
Moving the following instructions to decodetree specification : v{add,sub}{u,s}{b,h,w}s : VX-form The changes were verified by validating that the tcg ops generated by those instructions remain the same, which were captured with the '-d in_asm,op' flag. Signed-off-by: Chinmay Rat

[PATCH] ui/sdl2: Allow host to power down screen

2024-05-12 Thread Bernhard Beschow
By default, SDL disables the screen saver which prevents the host from powering down the screen even if the screen is locked. This results in draining the battery needlessly when the host isn't connected to a wall charger. Fix that by enabling the screen saver. Signed-off-by: Bernhard Beschow ---

[PATCH 1/3] hw/misc: In STM32L4x5 EXTI, consolidate 2 constants

2024-05-12 Thread Inès Varhol
Up until now, the EXTI implementation had 16 inbound GPIOs connected to the 16 outbound GPIOs of STM32L4x5 SYSCFG. The EXTI actually handles 40 lines (namely 5 from STM32L4x5 USART devices which are already implemented in QEMU). In order to connect USART devices to EXTI, this commit consolidates co

[PATCH 2/3] hw/misc: In STM32L4x5 EXTI, handle direct line interrupts

2024-05-12 Thread Inès Varhol
The previous implementation for EXTI interrupts only handled "configurable" interrupts, like those originating from STM32L4x5 SYSCFG (the only device currently connected to the EXTI up until now). In order to connect STM32L4x5 USART to the EXTI, this commit adds handling for direct interrupts (inte

[PATCH 3/3] hw/arm: In STM32L4x5 SOC, connect USART devices to EXTI

2024-05-12 Thread Inès Varhol
The USART devices were previously connecting their outbound IRQs directly to the CPU because the EXTI wasn't handling direct lines interrupts. Now the USART connects to the EXTI inbound GPIOs, and the EXTI connects its IRQs to the CPU. The existing QTest for the USART (tests/qtest/stm32l4x5_usart-t

[PATCH 0/3] Connect STM32L4x5 USART devices to the EXTI

2024-05-12 Thread Inès Varhol
STM32L4x5 EXTI was handling only configurable interrupts (such as those coming from STM32L4x5 SYSCFG which was the only device connected to the EXTI). This patch adds support for direct line interrupts and connects the existing STM32L4x5 USART devices to the EXTI. Signed-off-by: Inès Varhol Inès

Re: target/ppc: Move VMX int add/sub saturate insns to decodetree.

2024-05-12 Thread Richard Henderson
On 5/12/24 11:38, Chinmay Rath wrote: 1. vsubsbs and bcdtrunc : In this pair, bcdtrunc has the insn flag check PPC2_ISA300 in the vmx-impl file, within the GEN_VXFORM_DUAL macro, which does this flag check. However it also has this flag check in the vmx-ops file. Hence I have retained the same i

[PULL 04/27] target/i386: move prefetch and multi-byte UD/NOP to new decoder

2024-05-12 Thread Paolo Bonzini
These are trivial to add, and moving them to the new decoder fixes some corner cases: raising #UD instead of an instruction fetch page fault for the undefined opcodes, and incorrectly rejecting 0F 18 prefetches with register operands (which are treated as reserved NOPs). Reviewed-by: Richard Hende

[PULL 19/27] hw/i386: move rtc-reset-reinjection command out of hw/rtc

2024-05-12 Thread Paolo Bonzini
The rtc-reset-reinjection QMP command is specific to x86, other boards do not have the ACK tracking functionality that is needed for RTC interrupt reinjection. Therefore the QMP command is only included in x86, but qmp_rtc_reset_reinjection() is implemented by hw/rtc/mc146818rtc.c and requires tra

[PULL 13/27] tests/qtest: s390x: fix operation in a build without any boards or devices

2024-05-12 Thread Paolo Bonzini
Do the bare minimum to ensure that at least a vanilla --without-default-devices build works for all targets except i386, x86_64 and ppc64. In particular this fixes s390x-softmmu; i386 and x86_64 have about a dozen failing tests that do not pass -M and therefore require a default machine type; ppc6

[PULL 14/27] xen: initialize legacy backends from xen_bus_init()

2024-05-12 Thread Paolo Bonzini
Prepare for moving the calls to xen_be_register() under the control of xen_bus_init(), using the normal xen_backend_init() method that is used by the "modern" backends. This requires the xenstore global variable to be initialized, which is done by xen_be_init(). To ensure that everything is ready

[PULL 17/27] i386: pc: remove unnecessary MachineClass overrides

2024-05-12 Thread Paolo Bonzini
There is no need to override these fields of MachineClass because they are already set to the right value in the superclass. Signed-off-by: Paolo Bonzini Reviewed-by: Zhao Liu Message-ID: <20240509170044.190795-10-pbonz...@redhat.com> Signed-off-by: Paolo Bonzini --- include/hw/i386/x86.h | 4

[PULL 11/27] s390: move css_migration_enabled from machine to css.c

2024-05-12 Thread Paolo Bonzini
The CSS subsystem uses global variables, just face the truth and use a variable also for whether the CSS vmstate is in use; remove the indirection of fetching it from the machine type, which makes the TCG code depend unnecessarily on the virtio-ccw machine. Signed-off-by: Paolo Bonzini Message-ID

[PULL 07/27] configure: quote -D options that are passed through to meson

2024-05-12 Thread Paolo Bonzini
Ensure that they go through unmodified, instead of removing one layer of quoting. -D is a pretty specialized option and most options that can have spaces do not need it (for example, c_args is covered by --extra-cflags). Therefore it's unlikely that this causes actual trouble. However, a somewhat

[PULL 23/27] meson: move libfdt together with other dependencies

2024-05-12 Thread Paolo Bonzini
Move the libfdt detection code together with other dependencies instead of keeping it with subprojects. This has the disadvantage of performing the detection even if no target requires libfdt; but it has the advantage that Kconfig will be able to observe the availability of the library. Reviewed-

[PULL 18/27] hw/i386: split x86.c in multiple parts

2024-05-12 Thread Paolo Bonzini
Keep the basic X86MachineState definition in x86.c. Move out functions that are only needed by other files: x86-common.c for the pc and microvm machines, x86-cpu.c for those used by accelerator code. Signed-off-by: Paolo Bonzini Reviewed-by: Zhao Liu Message-ID: <20240509170044.190795-11-pbonz.

[PULL 25/27] kconfig: express dependency of individual boards on libfdt

2024-05-12 Thread Paolo Bonzini
Now that boards are enabled by default and the "CONFIG_FOO=y" entries are gone from configs/devices/, there cannot be any more a conflicts between the default contents of configs/devices/ and a failed "depends on" clause. With this change, each individual board or target can express whether it nee

[PULL 09/27] s390x: move s390_cpu_addr2state to target/s390x/sigp.c

2024-05-12 Thread Paolo Bonzini
This function has no dependency on the virtio-ccw machine type, though it assumes that the CPU address corresponds to the core_id and the index. If there is any need of something different or more fancy (unlikely) S390 can include a MachineClass subclass and implement it there. For now, move it t

[PULL 22/27] meson: pick libfdt from common_ss when building target-specific files

2024-05-12 Thread Paolo Bonzini
Avoid having to list dependencies such as libfdt twice, both on common_ss and specific_ss. Instead, just take all the dependencies in common_ss and allow the target-specific libqemu-*.fa library to use them. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Paolo Bonzini --- meson.build

[PULL 16/27] i386: correctly select code in hw/i386 that depends on other components

2024-05-12 Thread Paolo Bonzini
fw_cfg.c and vapic.c are currently included unconditionally but depend on other components. vapic.c depends on the local APIC, while fw_cfg.c includes a piece of AML builder code that depends on CONFIG_ACPI. Signed-off-by: Paolo Bonzini Reviewed-by: Zhao Liu Message-ID: <20240509170044.190795-9

[PULL 12/27] s390x: select correct components for no-board build

2024-05-12 Thread Paolo Bonzini
Signed-off-by: Paolo Bonzini Reviewed-by: Thomas Huth Message-ID: <20240509170044.190795-5-pbonz...@redhat.com> Signed-off-by: Paolo Bonzini --- .gitlab-ci.d/buildtest.yml | 4 ++-- target/s390x/Kconfig | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.d/bu

[PULL 10/27] s390_flic: add migration-enabled property

2024-05-12 Thread Paolo Bonzini
Instead of mucking with css_migration_enabled(), add a property specific to the FLIC device, similar to what is done for TYPE_S390_STATTRIB. Signed-off-by: Paolo Bonzini Reviewed-by: Thomas Huth Message-ID: <20240509170044.190795-3-pbonz...@redhat.com> Signed-off-by: Paolo Bonzini --- include/

[PULL 24/27] kconfig: allow compiling out QEMU device tree code per target

2024-05-12 Thread Paolo Bonzini
Introduce a new Kconfig symbol, CONFIG_DEVICE_TREE, that specifies whether to include the common device tree code in system/device_tree.c and to link to libfdt. For now, include it unconditionally if libfdt is available. Signed-off-by: Paolo Bonzini --- meson.build | 1 + incl

[PULL 08/27] sh4: select correct components for no-board build

2024-05-12 Thread Paolo Bonzini
Acked-by: Alex Bennée Signed-off-by: Paolo Bonzini --- .gitlab-ci.d/buildtest.yml | 5 +++-- hw/sh4/meson.build | 2 +- target/sh4/Kconfig | 2 ++ 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.gitlab-ci.d/buildtest.yml b/.gitlab-ci.d/buildtest.yml index 9836d81c

[PULL 05/27] target/i386: fix feature dependency for WAITPKG

2024-05-12 Thread Paolo Bonzini
The VMX feature bit depends on general availability of WAITPKG, not the other way round. Fixes: 33cc88261c3 ("target/i386: add support for VMX_SECONDARY_EXEC_ENABLE_USER_WAIT_PAUSE", 2023-08-28) Cc: qemu-sta...@nongnu.org Reviewed-by: Zhao Liu Signed-off-by: Paolo Bonzini --- target/i386/cpu.c

[PULL 20/27] i386: select correct components for no-board build

2024-05-12 Thread Paolo Bonzini
The local APIC is a part of the CPU and has callbacks that are invoked from multiple accelerators. The IOAPIC on the other hand is optional, but ioapic_eoi_broadcast is used by common x86 code to implement the IOAPIC's implicit EOI mode. Add a stub in case the IOAPIC device is not included but the

[PULL 02/27] target/i386: fix operand size for DATA16 REX.W POPCNT

2024-05-12 Thread Paolo Bonzini
According to the manual, 32-bit vs 64-bit is governed by REX.W and REX ignores the 0x66 prefix. This can be confirmed with this program: #include int main() { int x = 0x1234; int y; asm("popcntl %1, %0" : "=r" (y) : "r" (x)); printf("%x\n", y); asm("mo

[PULL 15/27] xen: register legacy backends via xen_backend_init

2024-05-12 Thread Paolo Bonzini
It is okay to register legacy backends in the middle of xen_bus_init(). All that the registration does is record the existence of the backend in xenstore. This makes it possible to remove them from the build without introducing undefined symbols in xen_be_init(). It also removes the need for the

[PULL 21/27] tests/qtest: arm: fix operation in a build without any boards or devices

2024-05-12 Thread Paolo Bonzini
ARM/aarch64 are easy to fix because they already have to pass a machine type by hand. Just guard the tests with a check that the machine actually exists. Signed-off-by: Paolo Bonzini Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Thomas Huth Message-ID: <20240509170044.190795-14-pbonz...@red

[PULL 03/27] target/i386: rdpkru/wrpkru are no-prefix instructions

2024-05-12 Thread Paolo Bonzini
Reject 0x66/0xf3/0xf2 in front of them. Cc: qemu-sta...@nongnu.org Reviewed-by: Richard Henderson Signed-off-by: Paolo Bonzini --- target/i386/tcg/translate.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/target/i386/tcg/translate.c b/target/i386/tcg/translate.c inde

[PULL 26/27] hw/xtensa: require libfdt

2024-05-12 Thread Paolo Bonzini
All other boards require libfdt if it can be used (including for example i386/x86_64), so change the "imply" to "select" and always allow -dtb in qemu-system-xtensa. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Paolo Bonzini --- hw/xtensa/xtfpga.c | 9 - hw/xtensa/Kconfig | 4 ++-

[PULL 27/27] configs: disable emulators that require it if libfdt is not found

2024-05-12 Thread Paolo Bonzini
Since boards can express their dependency on libfdt and system/device_tree.c, only leave TARGET_NEED_FDT if the target has a hard dependency. Those emulators will be skipped if libfdt is disabled, or if it is "auto" and not found and --disable-download is passed; unless the target is mentioned exp

[PULL 00/27] Build/arch cleanups, target/i386 fixes for 2024-05-10

2024-05-12 Thread Paolo Bonzini
The following changes since commit dafec285bdbfe415ac6823abdc510e0b92c3f094: Merge tag 'pull-request-2024-05-10' of https://gitlab.com/thuth/qemu into staging (2024-05-10 09:41:35 +0200) are available in the Git repository at: https://gitlab.com/bonzini/qemu.git tags/for-upstream for you t

[PULL 06/27] tests/tcg: cover lzcnt/tzcnt/popcnt

2024-05-12 Thread Paolo Bonzini
Reviewed-by: Zhao Liu Signed-off-by: Paolo Bonzini --- tests/tcg/i386/test-i386.c | 25 + 1 file changed, 25 insertions(+) diff --git a/tests/tcg/i386/test-i386.c b/tests/tcg/i386/test-i386.c index 864c4e620d5..ce3bf74b5a8 100644 --- a/tests/tcg/i386/test-i386.c +++ b/te

[PULL 01/27] target/i386: remove PCOMMIT from TCG, deprecate property

2024-05-12 Thread Paolo Bonzini
The PCOMMIT instruction was never included in any physical processor. TCG implements it as a no-op instruction, but its utility is debatable to say the least. Drop it from the decoder since it is only available with "-cpu max", which does not guarantee migration compatibility across versions, and

[PATCH v2 0/2] ui/gtk: Fix motion event scaling issue

2024-05-12 Thread hikalium
Hi there, This is a v2 of the previous series with nit fixes (fixing typo, adding component prefix for each patch subjects, and adding a cover letter). Please take a look. Thank you! hikalium (2): ui/gtk: Add gd_motion_event trace event ui/gtk: Fix mouse/motion event scaling issue with GTK d

[PATCH v2 1/2] ui/gtk: Add gd_motion_event trace event

2024-05-12 Thread hikalium
Add gd_motion_event trace event for making it easy to debug gd_motion_event related issues. Signed-off-by: hikalium --- ui/gtk.c| 2 ++ ui/trace-events | 1 + 2 files changed, 3 insertions(+) diff --git a/ui/gtk.c b/ui/gtk.c index 810d7fc796..ebae888d4f 100644 --- a/ui/gtk.c +++ b/ui/gt

[PATCH v2 2/2] ui/gtk: Fix mouse/motion event scaling issue with GTK display backend

2024-05-12 Thread hikalium
Remove gtk_widget_get_scale_factor() usage from the calculation of the motion events in the GTK backend to make it work correctly on environments that have `gtk_widget_get_scale_factor() != 1`. This scale factor usage had been introduced in the commit f14aab420c and at that time the window size wa

Re: [PATCH 1/1] target/ppc: Move VMX integer add/sub saturate insns to decodetree.

2024-05-12 Thread Richard Henderson
On 5/12/24 11:38, Chinmay Rath wrote: @@ -2934,6 +2870,184 @@ static bool do_vx_vaddsubcuw(DisasContext *ctx, arg_VX *a, int add) return true; } +static inline void do_vadd_vsub_sat +( +unsigned vece, TCGv_vec t, TCGv_vec sat, TCGv_vec a, TCGv_vec b, +void (*norm_op)(unsigned

[PATCH] hw/mips/loongson3_virt: Implement node counter timer

2024-05-12 Thread Jiaxun Yang
Node counter is a timer presents on Loongson-3 chips, which runs as fast as CPU clock. It's being mapped into a MMIO location. Emulate this for loongson3_virt machine, in hope that kernel can use it as a better clock source. Hardware's behavior on 32-bit read/write is also emulated in case legacy

[PATCH 1/2] Add gd_motion_event trace event

2024-05-12 Thread hikalium
Add gd_motion_event trace event for making it easy to debug gd_motion_event related issues. Signed-off-by: hikalium --- ui/gtk.c| 2 ++ ui/trace-events | 1 + 2 files changed, 3 insertions(+) diff --git a/ui/gtk.c b/ui/gtk.c index 810d7fc796..ebae888d4f 100644 --- a/ui/gtk.c +++ b/ui/gt

[PATCH 2/2] Fix mouse/motion event scaling issue with GTK display backend

2024-05-12 Thread hikalium
Remove gtk_widget_get_scale_factor() usage from the calculation of the motion events in the GTK backend to make it work correctly on environments that have `gtk_widget_get_scale_factor() != 1`. This scale factor usage had been introduced in the commit f14aab420c and at that time the window size wa

Re: [PATCH 00/45] target/hppa: Misc improvements

2024-05-12 Thread Sven Schnelle
Philippe Mathieu-Daudé writes: > Cc'ing Helge & Sven as I'm going to skip this series. > > Suggestion: > > -- >8 -- > diff --git a/MAINTAINERS b/MAINTAINERS > index 1b79767d61..be7535b55e 100644 > --- a/MAINTAINERS > +++ b/MAINTAINERS > @@ -254,6 +254,8 @@ F: target/hexagon/gen_idef_parser_funcs.

Re: hw/usb/hcd-ohci: Fix #1510, #303: pid not IN or OUT

2024-05-12 Thread Cord Amfmgm
On Sat, May 11, 2024 at 5:25 AM Peter Maydell wrote: > On Thu, 9 May 2024 at 19:17, Cord Amfmgm wrote: > > > > > > > > On Thu, May 9, 2024 at 12:48 PM Peter Maydell > wrote: > >> > >> On Wed, 8 May 2024 at 16:29, Cord Amfmgm wrote: > >> > On Wed, May 8, 2024 at 3:45 AM Thomas Huth wrote: > >>

[PATCH v7 01/61] target/ppc: Remove unused struct 'mmu_ctx_hash32'

2024-05-12 Thread BALATON Zoltan
From: "Dr. David Alan Gilbert" I think it's use was removed by Commit 5883d8b296 ("mmu-hash*: Don't use full ppc_hash{32, 64}_translate() path for get_phys_page_debug()") Signed-off-by: Dr. David Alan Gilbert Reviewed-by: BALATON Zoltan Signed-off-by: BALATON Zoltan --- target/ppc/mmu-hash32

[PATCH v7 02/61] target/ppc: Remove unused helper

2024-05-12 Thread BALATON Zoltan
The helper_rac function is defined but not used, remove it. Fixes: 005b69fdcc (target/ppc: Remove PowerPC 601 CPUs) Signed-off-by: BALATON Zoltan Reviwed-by: Nicholas Piggin --- target/ppc/helper.h | 2 -- target/ppc/mmu_helper.c | 24 2 files changed, 26 deletions

[PATCH v7 20/61] target/ppc/mmu_common.c: Remove BookE from direct store handling

2024-05-12 Thread BALATON Zoltan
As BookE never returns -4 we can drop BookE from the direct store case in ppc_jumbo_xlate(). Signed-off-by: BALATON Zoltan Reviewed-by: Nicholas Piggin --- target/ppc/mmu_common.c | 7 +-- 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/target/ppc/mmu_common.c b/target/ppc/mmu_

[PATCH v7 22/61] target/ppc/mmu_common.c: Simplify ppc_booke_xlate() part 1

2024-05-12 Thread BALATON Zoltan
Move setting error_code that appears in every case out in front and hoist the common fall through case for BOOKE206 as well which allows removing the nested switches. Signed-off-by: BALATON Zoltan Reviewed-by: Nicholas Piggin --- target/ppc/mmu_common.c | 41

[PATCH v7 35/61] target/ppc: Remove pp_check() and reuse ppc_hash32_pp_prot()

2024-05-12 Thread BALATON Zoltan
The ppc_hash32_pp_prot() function in mmu-hash32.c is the same as pp_check() in mmu_common.c, merge these to remove duplicated code. Define the common function as static lnline otherwise exporting the function from mmu-hash32.c would stop the compiler inlining it which results in slightly lower perf

[PATCH v7 26/61] target/ppc/mmu_common.c: Transform ppc_jumbo_xlate() into ppc_6xx_xlate()

2024-05-12 Thread BALATON Zoltan
Now that only 6xx cases left in ppc_jumbo_xlate() we can change it to ppc_6xx_xlate() also removing get_physical_address_wtlb(). Signed-off-by: BALATON Zoltan --- target/ppc/internal.h | 5 + target/ppc/mmu_common.c | 38 -- 2 files changed, 13 insertio

[PATCH v7 24/61] target/ppc/mmu_common.c: Split off real mode handling from get_physical_address_wtlb()

2024-05-12 Thread BALATON Zoltan
Add ppc_real_mode_xlate() to handle real mode translation and allow removing this case from ppc_jumbo_xlate(). Signed-off-by: BALATON Zoltan --- target/ppc/mmu_common.c | 46 - 1 file changed, 27 insertions(+), 19 deletions(-) diff --git a/target/ppc/mmu_

[PATCH v7 07/61] target/ppc/mmu_common.c: Introduce mmu6xx_get_physical_address()

2024-05-12 Thread BALATON Zoltan
Repurpose get_segment_6xx_tlb() to do the whole address translation for POWERPC_MMU_SOFT_6xx MMU model by moving the BAT check there and renaming it to match other similar functions. These are only called once together so no need to keep these separate functions and combining them simplifies the ca

[PATCH v7 55/61] target/ppc/mmu_common.c: Stop using ctx in ppc6xx_tlb_check()

2024-05-12 Thread BALATON Zoltan
Pass raddr and prot in function parameters instead. Signed-off-by: BALATON Zoltan --- target/ppc/mmu_common.c | 26 +- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/target/ppc/mmu_common.c b/target/ppc/mmu_common.c index 331e00b71c..1137ec197b 100644 ---

[PATCH v7 10/61] target/ppc/mmu_common.c: Eliminate ret from mmu6xx_get_physical_address()

2024-05-12 Thread BALATON Zoltan
Return directly, which is simpler than dragging a return value through multpile if and else blocks. Signed-off-by: BALATON Zoltan Reviewed-by: Nicholas Piggin --- target/ppc/mmu_common.c | 84 +++-- 1 file changed, 39 insertions(+), 45 deletions(-) diff --gi

[PATCH v7 28/61] target/ppc/mmu_common.c: Remove pte_update_flags()

2024-05-12 Thread BALATON Zoltan
This function is used only once, its return value is ignored and one of its parameter is a return value from a previous call. It is better to inline it in the caller and remove it. Signed-off-by: BALATON Zoltan --- target/ppc/mmu_common.c | 41 + 1 file ch

[PATCH v7 40/61] target/ppc/mmu_common.c: Remove yet another single use local

2024-05-12 Thread BALATON Zoltan
In ppc6xx_tlb_pte_check() the pp variable is used only once to pass it to a function parameter with the same name. Remove the local and inline the value. Also use named constant for the hex value to make it clearer. Signed-off-by: BALATON Zoltan --- target/ppc/mmu_common.c | 6 +++--- 1 file cha

[PATCH v7 18/61] target/ppc/mmu_common.c: Don't use mmu_ctx_t in mmubooke_get_physical_address()

2024-05-12 Thread BALATON Zoltan
mmubooke_get_physical_address() only uses the raddr and prot fields from mmu_ctx_t. Pass these directly instead of using a ctx struct. Signed-off-by: BALATON Zoltan Reviewed-by: Nicholas Piggin --- target/ppc/mmu_common.c | 30 ++ 1 file changed, 10 insertions(+), 20

[PATCH v7 09/61] target/ppc/mmu_common.c: Move some debug logging

2024-05-12 Thread BALATON Zoltan
Move the debug logging within ppc6xx_tlb_check() from after its only call to simplify the caller. Signed-off-by: BALATON Zoltan Reviewed-by: Nicholas Piggin --- target/ppc/mmu_common.c | 54 ++--- 1 file changed, 24 insertions(+), 30 deletions(-) diff --git

[PATCH v7 42/61] target/ppc/mmu_common.c: Simplify ppc6xx_tlb_pte_check()

2024-05-12 Thread BALATON Zoltan
Invert conditions to avoid deep nested ifs and return early instead. Remove some obvious comments that don't add more clarity. Signed-off-by: BALATON Zoltan --- target/ppc/mmu_common.c | 44 ++--- 1 file changed, 19 insertions(+), 25 deletions(-) diff --git a

[PATCH v7 31/61] target/ppc/mmu-hash32.c: Drop a local variable

2024-05-12 Thread BALATON Zoltan
In ppc_hash32_xlate() the value of need_prop is checked in two places but precalculating it does not help because when we reach the first check we always return and not reach the second place so the value will only be used once. We can drop the local variable and calculate it when needed, which mak

[PATCH v7 27/61] target/ppc/mmu_common.c: Move mmu_ctx_t type to mmu_common.c

2024-05-12 Thread BALATON Zoltan
Remove mmu_ctx_t definition from internal.h as this type is only used within mmu_common.c. Signed-off-by: BALATON Zoltan Reviewed-by: Nicholas Piggin --- target/ppc/internal.h | 12 target/ppc/mmu_common.c | 11 +++ 2 files changed, 11 insertions(+), 12 deletions(-) diff

[PATCH v7 06/61] target/ppc/mmu_common.c: Drop cases for unimplemented MPC8xx MMU

2024-05-12 Thread BALATON Zoltan
Drop MPC8xx cases from get_physical_address_wtlb() and ppc_jumbo_xlate(). The default case would still catch this and abort the same way and there is still a warning about it in ppc_tlb_invalidate_all() which is called in ppc_cpu_reset_hold() so likely we never get here but to make sure add a case

[PATCH v7 49/61] target/ppc/mmu_common.c: Inline and remove ppc6xx_tlb_pte_check()

2024-05-12 Thread BALATON Zoltan
This function is only called once and we can make the caller simpler by inlining it. Signed-off-by: BALATON Zoltan --- target/ppc/mmu_common.c | 71 + 1 file changed, 22 insertions(+), 49 deletions(-) diff --git a/target/ppc/mmu_common.c b/target/ppc/mmu_

[PATCH v7 53/61] target/ppc/mmu_common.c: Init variable in function that relies on it

2024-05-12 Thread BALATON Zoltan
The ppc6xx_tlb_check() relies on the caller to initialise raddr field in ctx. Move this init from the only caller into the function. Signed-off-by: BALATON Zoltan --- target/ppc/mmu_common.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/ppc/mmu_common.c b/target/

[PATCH v7 30/61] target/ppc: Split off common embedded TLB init

2024-05-12 Thread BALATON Zoltan
Several 4xx CPUs and e200 share the same TLB settings enclosed in an ifdef. Split it off in a common function to reduce code duplication and the number of ifdefs. Signed-off-by: BALATON Zoltan Reviewed-by: Nicholas Piggin --- target/ppc/cpu_init.c | 46 --

[PATCH v7 15/61] target/ppc/mmu_common.c: Deindent ppc_jumbo_xlate()

2024-05-12 Thread BALATON Zoltan
Instead of putting a large block of code in an if, invert the condition and return early to be able to deindent the code block. Signed-off-by: BALATON Zoltan Acked-by: Nicholas Piggin --- target/ppc/mmu_common.c | 319 1 file changed, 159 insertions(+),

[PATCH v7 41/61] target/ppc/mmu_common.c: Return directly in ppc6xx_tlb_pte_check()

2024-05-12 Thread BALATON Zoltan
Instead of using a local ret variable return directly and remove the local. Signed-off-by: BALATON Zoltan --- target/ppc/mmu_common.c | 10 +++--- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/target/ppc/mmu_common.c b/target/ppc/mmu_common.c index 0c7cbab2bc..a035cefcad 1006

[PATCH v7 00/61] Misc PPC exception and BookE MMU clean ups

2024-05-12 Thread BALATON Zoltan
This series does some further clean up mostly around BookE MMU to untangle it from other MMU models. It also contains some other changes that I've come up with while working on this. The Simplify ppc_booke_xlate() part 1 and part 2 patches could be squashed together but left them separate for easie

[PATCH v7 11/61] target/ppc/mmu_common.c: Split out BookE cases before checking real mode

2024-05-12 Thread BALATON Zoltan
BookE does not have real mode so split off and handle it first in get_physical_address_wtlb() before checking for real mode for other MMU models. Signed-off-by: BALATON Zoltan Reviewed-by: Nicholas Piggin --- target/ppc/mmu_common.c | 14 +++--- 1 file changed, 7 insertions(+), 7 deleti

[PATCH v7 46/61] target/ppc/mmu_common.c: Convert local variable to bool

2024-05-12 Thread BALATON Zoltan
In mmu6xx_get_physical_address() ds is used as bool, declare it as such. Also use named constant instead of hex value. Signed-off-by: BALATON Zoltan --- target/ppc/mmu_common.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/target/ppc/mmu_common.c b/target/ppc/mmu_comm

[PATCH v7 13/61] target/ppc/mmu_common.c: Inline and remove check_physical()

2024-05-12 Thread BALATON Zoltan
This function just does two assignments and and unnecessary check that is always true so inline it in the only caller left and remove it. Signed-off-by: BALATON Zoltan Reviewed-by: Nicholas Piggin --- target/ppc/mmu_common.c | 26 +++--- 1 file changed, 3 insertions(+), 23 d

[PATCH v7 29/61] target/ppc: Remove id_tlbs flag from CPU env

2024-05-12 Thread BALATON Zoltan
This flag for split instruction/data TLBs is only set for 6xx soft TLB MMU model and not used otherwise so no need to have a separate flag for that. Signed-off-by: BALATON Zoltan Reviewed-by: Nicholas Piggin --- hw/ppc/pegasos2.c| 2 +- target/ppc/cpu.h | 5 - target/ppc/c

[PATCH v7 43/61] target/ppc/mmu_common.c: Remove unused field from mmu_ctx_t

2024-05-12 Thread BALATON Zoltan
The eaddr field of mmu_ctx_t is set once but never used so can be removed. Signed-off-by: BALATON Zoltan --- target/ppc/mmu_common.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/target/ppc/mmu_common.c b/target/ppc/mmu_common.c index 564fcc7cfb..07c127d673 100644 --- a/target/ppc/mmu_com

[PATCH v7 34/61] target/ppc: Move out BookE and related MMU functions from mmu_common.c

2024-05-12 Thread BALATON Zoltan
Add a new mmu-booke.c file for BookE and related MMU bits from mmu_common.c. Signed-off-by: BALATON Zoltan Acked-by: Nicholas Piggin --- target/ppc/cpu.h| 4 - target/ppc/meson.build | 1 + target/ppc/mmu-booke.c | 531 target/ppc/mmu-booke

[PATCH v7 45/61] target/ppc/mmu_common.c: Remove nx field from mmu_ctx_t

2024-05-12 Thread BALATON Zoltan
Pass it as a parameter instead. Also use named constants instead of hex values when extracting bits from SR. Signed-off-by: BALATON Zoltan --- target/ppc/mmu_common.c | 24 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/target/ppc/mmu_common.c b/target/p

[PATCH v7 19/61] target/ppc/mmu_common.c: Don't use mmu_ctx_t in mmubooke206_get_physical_address()

2024-05-12 Thread BALATON Zoltan
mmubooke206_get_physical_address() only uses the raddr and prot fields from mmu_ctx_t. Pass these directly instead of using a ctx struct. Signed-off-by: BALATON Zoltan Reviewed-by: Nicholas Piggin --- target/ppc/mmu_common.c | 32 ++-- 1 file changed, 10 insertions(+

[PATCH v7 39/61] target/ppc/mmu_common.c: Remove another single use local

2024-05-12 Thread BALATON Zoltan
In ppc6xx_tlb_pte_check() the pteh variable is used only once to compare to the h parameter of the function. Inline its value and use pteh name for the function parameter which is more descriptive. Signed-off-by: BALATON Zoltan --- target/ppc/mmu_common.c | 7 +++ 1 file changed, 3 insertion

[PATCH v7 47/61] target/ppc/mmu_common.c: Remove single use local variable

2024-05-12 Thread BALATON Zoltan
In mmu6xx_get_physical_address() tagtet_page_bits local is declared only to use TARGET_PAGE_BITS once. Drop the unneeded variable. Signed-off-by: BALATON Zoltan --- target/ppc/mmu_common.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/target/ppc/mmu_common.c b/target/ppc

[PATCH v7 08/61] target/ppc/mmu_common.c: Move else branch to avoid large if block

2024-05-12 Thread BALATON Zoltan
In mmu6xx_get_physical_address() we have a large if block with a two line else branch that effectively returns. Invert the condition and move the else there to allow deindenting the large if block to make the flow easier to follow. Signed-off-by: BALATON Zoltan Reviewed-by: Nicholas Piggin ---

[PATCH v7 38/61] target/ppc/mmu_common.c: Remove single use local variable

2024-05-12 Thread BALATON Zoltan
The ptev variable in ppc6xx_tlb_pte_check() is used only once and just obfuscates an otherwise clear value. Get rid of it. Signed-off-by: BALATON Zoltan --- target/ppc/mmu_common.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/target/ppc/mmu_common.c b/target/ppc/mmu_c

[PATCH v7 12/61] target/ppc/mmu_common.c: Split off real mode cases in get_physical_address_wtlb()

2024-05-12 Thread BALATON Zoltan
The real mode handling is identical in the remaining switch cases. Split off these common real mode cases into a separate conditional to leave only the else branches in the switch that are different. Signed-off-by: BALATON Zoltan Reviewed-by: Nicholas Piggin --- target/ppc/mmu_common.c | 34 +++

[PATCH v7 60/61] target/ppc/mmu_common.c: Remove mmu_ctx_t

2024-05-12 Thread BALATON Zoltan
Completely get rid of mmu_ctx_t after converting the remaining functions to pass raddr and prot without the context struct. Signed-off-by: BALATON Zoltan --- target/ppc/mmu_common.c | 25 +++-- 1 file changed, 7 insertions(+), 18 deletions(-) diff --git a/target/ppc/mmu_comm

[PATCH v7 23/61] target/ppc/mmu_common.c: Simplify ppc_booke_xlate() part 2

2024-05-12 Thread BALATON Zoltan
Merge the code fetch and data access cases in a common switch. Signed-off-by: BALATON Zoltan Reviewed-by: Nicholas Piggin --- target/ppc/mmu_common.c | 52 - 1 file changed, 20 insertions(+), 32 deletions(-) diff --git a/target/ppc/mmu_common.c b/target/

[PATCH v7 50/61] target/ppc/mmu_common.c: Remove ptem field from mmu_ctx_t

2024-05-12 Thread BALATON Zoltan
Instead of passing around ptem in context use it once in the same function so it can be removed from mmu_ctx_t. Signed-off-by: BALATON Zoltan --- target/ppc/mmu_common.c | 23 ++- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/target/ppc/mmu_common.c b/target/

[PATCH v7 54/61] target/ppc/mmu_common.c: Remove key field from mmu_ctx_t

2024-05-12 Thread BALATON Zoltan
Pass it as a function argument and remove it from mmu_ctx_t. Signed-off-by: BALATON Zoltan --- target/ppc/mmu_common.c | 26 ++ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/target/ppc/mmu_common.c b/target/ppc/mmu_common.c index ccc1c76a06..331e00b71c 1

[PATCH v7 52/61] target/ppc/mmu-hash32.c: Inline and remove ppc_hash32_pte_prot()

2024-05-12 Thread BALATON Zoltan
This is used only once and can be inlined. Signed-off-by: BALATON Zoltan --- target/ppc/mmu-hash32.c | 19 --- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/target/ppc/mmu-hash32.c b/target/ppc/mmu-hash32.c index 8e5e83f46a..9de42713b3 100644 --- a/target/ppc/mmu

[PATCH v7 51/61] target/ppc: Add function to get protection key for hash32 MMU

2024-05-12 Thread BALATON Zoltan
Add a function to get key bit from SR and use it instead of open coded version. Signed-off-by: BALATON Zoltan --- target/ppc/mmu-hash32.c | 9 ++--- target/ppc/mmu-hash32.h | 5 + target/ppc/mmu_common.c | 3 +-- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/target/ppc/

[PATCH v7 16/61] target/ppc/mmu_common.c: Replace hard coded constants in ppc_jumbo_xlate()

2024-05-12 Thread BALATON Zoltan
The "2" in booke206_update_mas_tlb_miss() call corresponds to MMU_INST_FETCH which is the value of access_type in this branch; mmubooke206_esr() only checks for MMU_DATA_STORE and it's called from code access so using MMU_DATA_LOAD here seems wrong so replace it with access_type here as well that y

[PATCH v7 58/61] target/ppc: Remove bat_size_prot()

2024-05-12 Thread BALATON Zoltan
There is already a hash32_bat_prot() function that does most if this and the rest can be inlined. Export hash32_bat_prot() and rename it to ppc_hash32_bat_prot() to match other functions and use it in get_bat_6xx_tlb(). Signed-off-by: BALATON Zoltan --- target/ppc/mmu-hash32.c | 18 +

[PATCH v7 03/61] target/ppc/mmu_common.c: Move calculation of a value closer to its usage

2024-05-12 Thread BALATON Zoltan
In mmubooke_check_tlb() and mmubooke206_check_tlb() prot2 is calculated first but only used after an unrelated check that can return before tha value is used. Move the calculation after the check, closer to where it is used, to keep them together and avoid computing it when not needed. Signed-off-

[PATCH v7 57/61] targe/ppc/mmu_common.c: Use defines instead of numeric constants

2024-05-12 Thread BALATON Zoltan
Replace some BAT related constants with defines from mmu-hash32.h Signed-off-by: BALATON Zoltan --- target/ppc/mmu_common.c | 26 +- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/target/ppc/mmu_common.c b/target/ppc/mmu_common.c index fd8767879d..bfd3787

[PATCH v7 56/61] target/ppc/mmu_common.c: Rename function parameter

2024-05-12 Thread BALATON Zoltan
Rename parameter of get_bat_6xx_tlb() from virtual to eaddr to match other functions. Signed-off-by: BALATON Zoltan --- target/ppc/mmu_common.c | 18 +- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/target/ppc/mmu_common.c b/target/ppc/mmu_common.c index 1137ec197

[PATCH v7 48/61] target/ppc/mmu_common.c: Simplify a switch statement

2024-05-12 Thread BALATON Zoltan
In mmu6xx_get_physical_address() the switch handles all cases so the default is never reached and can be dropped. Also group together cases which just return -4. Signed-off-by: BALATON Zoltan --- target/ppc/mmu_common.c | 19 --- 1 file changed, 4 insertions(+), 15 deletions(-)

[PATCH v7 33/61] target/ppc: Add a function to check for page protection bit

2024-05-12 Thread BALATON Zoltan
Checking if a page protection bit is set for a given access type is a common operation. Add a function to avoid repeating the same check at multiple places. As this relies on access type and page protection bit values having certain relation also add an assert to ensure that this assumption holds.

[PATCH v7 61/61] target/ppc/mmu_common.c: Remove a local variable

2024-05-12 Thread BALATON Zoltan
In mmu6xx_get_physical_address() the cpu variable is only used for debug logging which is normally disabled. Inline the value and remove local variable to avoid computing it when not needed. Signed-off-by: BALATON Zoltan --- target/ppc/mmu_common.c | 4 ++-- 1 file changed, 2 insertions(+), 2 de

[PATCH v7 32/61] target/ppc/mmu-radix64.c: Drop a local variable

2024-05-12 Thread BALATON Zoltan
The value is only used once so no need to introduce a local variable for it. Signed-off-by: BALATON Zoltan Reviewed-by: Nicholas Piggin --- target/ppc/mmu-radix64.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/target/ppc/mmu-radix64.c b/target/ppc/mmu-radix64.c index

[PATCH v7 25/61] target/ppc/mmu_common.c: Split off 40x cases from ppc_jumbo_xlate()

2024-05-12 Thread BALATON Zoltan
Introduce ppc_40x_xlate() to split off 40x handlning leaving only 6xx in ppc_jumbo_xlate() now. Signed-off-by: BALATON Zoltan --- target/ppc/mmu_common.c | 150 +--- 1 file changed, 93 insertions(+), 57 deletions(-) diff --git a/target/ppc/mmu_common.c b/targ

[PATCH v7 59/61] target/ppc/mmu_common.c: Stop using ctx in get_bat_6xx_tlb()

2024-05-12 Thread BALATON Zoltan
Pass raddr and prot in function parameters instead Signed-off-by: BALATON Zoltan --- target/ppc/mmu_common.c | 17 + 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/target/ppc/mmu_common.c b/target/ppc/mmu_common.c index ba54c40048..6d588b6795 100644 --- a/target/pp

  1   2   >