]> git.proxmox.com Git - mirror_qemu.git/commit
target/ppc: Introduce ppc_interrupts_little_endian()
authorGreg Kurz <groug@kaod.org>
Tue, 22 Jun 2021 14:09:25 +0000 (16:09 +0200)
committerDavid Gibson <david@gibson.dropbear.id.au>
Fri, 9 Jul 2021 00:38:18 +0000 (10:38 +1000)
commitc11dc15d3aabb9dab04d9d2767e1b227d2b9085d
treea6c6040013c01fa9d784ad82977ec6a19c606253
parent9db3065c62a983286d06c207f4981408cf42184d
target/ppc: Introduce ppc_interrupts_little_endian()

PowerPC CPUs use big endian by default but starting with POWER7,
server grade CPUs use the ILE bit of the LPCR special purpose
register to decide on the endianness to use when handling
interrupts. This gives a clue to QEMU on the endianness the
guest kernel is running, which is needed when generating an
ELF dump of the guest or when delivering an FWNMI machine
check interrupt.

Commit 382d2db62bcb ("target-ppc: Introduce callback for interrupt
endianness") added a class method to PowerPCCPUClass to modelize
this : default implementation returns a fixed "big endian" value,
while POWER7 and newer do the LPCR_ILE check. This is suboptimal
as it forces to implement the method for every new CPU family, and
it is very unlikely that this will ever be different than what we
have today.

We basically only have three cases to consider:
a) CPU doesn't have an LPCR => big endian
b) CPU has an LPCR but doesn't support the ILE bit => big endian
c) CPU has an LPCR and supports the ILE bit => little or big endian

Instead of class methods, introduce an inline helper that checks the
ILE bit in the LPCR_MASK to decide on the outcome. The new helper
words little endian instead of big endian. This allows to drop a !
operator in ppc_cpu_do_fwnmi_machine_check().

Signed-off-by: Greg Kurz <groug@kaod.org>
Message-Id: <20210622140926.677618-2-groug@kaod.org>
Reviewed-by: Fabiano Rosas <farosas@linux.ibm.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
target/ppc/arch_dump.c
target/ppc/cpu.h
target/ppc/excp_helper.c