* [Qemu-devel] [PATCH 1/4] linux-user: Correct AUXV Cache Line Sizes for PowerPC
2014-06-16 16:03 [Qemu-devel] [PATCH 0/4] AUXV Fixes for PowerPC Linux User Mode Tom Musta
@ 2014-06-16 16:03 ` Tom Musta
2014-06-16 16:03 ` [Qemu-devel] [PATCH 2/4] target-ppc: Add DFP to Emulated Instructions Flag Tom Musta
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Tom Musta @ 2014-06-16 16:03 UTC (permalink / raw)
To: qemu-devel; +Cc: tommusta, qemu-ppc
Set the AT_ICACHEBSIZE and AT_DCACHEBSIZE entries of the AUXV to match the
CPU model's cache line sizes. This fixes memory clobbering problems on more
recent Book 3s implementations; memset(p, 0, N) will use the dcbz instruction
when N is sufficiently large and many of the newer server CPUs have cache lines
sizes of 128 bytes.
Signed-off-by: Tom Musta <tommusta@gmail.com>
---
linux-user/elfload.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/linux-user/elfload.c b/linux-user/elfload.c
index 127c565..9a32899 100644
--- a/linux-user/elfload.c
+++ b/linux-user/elfload.c
@@ -767,8 +767,9 @@ static uint32_t get_elf_hwcap(void)
#define DLINFO_ARCH_ITEMS 5
#define ARCH_DLINFO \
do { \
- NEW_AUX_ENT(AT_DCACHEBSIZE, 0x20); \
- NEW_AUX_ENT(AT_ICACHEBSIZE, 0x20); \
+ PowerPCCPU *cpu = POWERPC_CPU(thread_cpu); \
+ NEW_AUX_ENT(AT_DCACHEBSIZE, cpu->env.dcache_line_size); \
+ NEW_AUX_ENT(AT_ICACHEBSIZE, cpu->env.icache_line_size); \
NEW_AUX_ENT(AT_UCACHEBSIZE, 0); \
/* \
* Now handle glibc compatibility. \
--
1.7.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [Qemu-devel] [PATCH 2/4] target-ppc: Add DFP to Emulated Instructions Flag
2014-06-16 16:03 [Qemu-devel] [PATCH 0/4] AUXV Fixes for PowerPC Linux User Mode Tom Musta
2014-06-16 16:03 ` [Qemu-devel] [PATCH 1/4] linux-user: Correct AUXV Cache Line Sizes for PowerPC Tom Musta
@ 2014-06-16 16:03 ` Tom Musta
2014-06-16 16:03 ` [Qemu-devel] [PATCH 3/4] linux-user: Identify Addition Hardware Capabilities for PowerPC Tom Musta
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Tom Musta @ 2014-06-16 16:03 UTC (permalink / raw)
To: qemu-devel; +Cc: tommusta, qemu-ppc
Decimal Floating Point is emulated, so add it the mask. This will
fix the erroneous message:
Warning: Disabling some instructions which are not emulated by TCG (0x0, 0x4)
Signed-off-by: Tom Musta <tommusta@gmail.com>
---
target-ppc/cpu.h | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/target-ppc/cpu.h b/target-ppc/cpu.h
index 74407ee..08ae527 100644
--- a/target-ppc/cpu.h
+++ b/target-ppc/cpu.h
@@ -2012,7 +2012,7 @@ enum {
PPC2_DIVE_ISA206 | PPC2_ATOMIC_ISA206 | \
PPC2_FP_CVT_ISA206 | PPC2_FP_TST_ISA206 | \
PPC2_BCTAR_ISA207 | PPC2_LSQ_ISA207 | \
- PPC2_ALTIVEC_207 | PPC2_ISA207S)
+ PPC2_ALTIVEC_207 | PPC2_ISA207S | PPC2_DFP)
};
/*****************************************************************************/
--
1.7.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [Qemu-devel] [PATCH 3/4] linux-user: Identify Addition Hardware Capabilities for PowerPC
2014-06-16 16:03 [Qemu-devel] [PATCH 0/4] AUXV Fixes for PowerPC Linux User Mode Tom Musta
2014-06-16 16:03 ` [Qemu-devel] [PATCH 1/4] linux-user: Correct AUXV Cache Line Sizes for PowerPC Tom Musta
2014-06-16 16:03 ` [Qemu-devel] [PATCH 2/4] target-ppc: Add DFP to Emulated Instructions Flag Tom Musta
@ 2014-06-16 16:03 ` Tom Musta
2014-06-16 16:03 ` [Qemu-devel] [PATCH 4/4] linux-user: Support HWCAP2 in PowerPC Tom Musta
2014-06-16 22:39 ` [Qemu-devel] [Qemu-ppc] [PATCH 0/4] AUXV Fixes for PowerPC Linux User Mode Alexander Graf
4 siblings, 0 replies; 6+ messages in thread
From: Tom Musta @ 2014-06-16 16:03 UTC (permalink / raw)
To: qemu-devel; +Cc: tommusta, qemu-ppc
Add VSX, DFP and ISA 2.06 to the bits identified in the AT_HWCAP
entry of the AUXV.
Signed-off-by: Tom Musta <tommusta@gmail.com>
---
linux-user/elfload.c | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/linux-user/elfload.c b/linux-user/elfload.c
index 9a32899..ab46695 100644
--- a/linux-user/elfload.c
+++ b/linux-user/elfload.c
@@ -742,6 +742,8 @@ static uint32_t get_elf_hwcap(void)
Altivec/FP/SPE support. Anything else is just a bonus. */
#define GET_FEATURE(flag, feature) \
do { if (cpu->env.insns_flags & flag) { features |= feature; } } while (0)
+#define GET_FEATURE2(flag, feature) \
+ do { if (cpu->env.insns_flags2 & flag) { features |= feature; } } while (0)
GET_FEATURE(PPC_64B, QEMU_PPC_FEATURE_64);
GET_FEATURE(PPC_FLOAT, QEMU_PPC_FEATURE_HAS_FPU);
GET_FEATURE(PPC_ALTIVEC, QEMU_PPC_FEATURE_HAS_ALTIVEC);
@@ -750,7 +752,13 @@ static uint32_t get_elf_hwcap(void)
GET_FEATURE(PPC_SPE_DOUBLE, QEMU_PPC_FEATURE_HAS_EFP_DOUBLE);
GET_FEATURE(PPC_BOOKE, QEMU_PPC_FEATURE_BOOKE);
GET_FEATURE(PPC_405_MAC, QEMU_PPC_FEATURE_HAS_4xxMAC);
+ GET_FEATURE2(PPC2_DFP, QEMU_PPC_FEATURE_HAS_DFP);
+ GET_FEATURE2(PPC2_VSX, QEMU_PPC_FEATURE_HAS_VSX);
+ GET_FEATURE2((PPC2_PERM_ISA206 | PPC2_DIVE_ISA206 | PPC2_ATOMIC_ISA206 |
+ PPC2_FP_CVT_ISA206 | PPC2_FP_TST_ISA206),
+ QEMU_PPC_FEATURE_ARCH_2_06);
#undef GET_FEATURE
+#undef GET_FEATURE2
return features;
}
--
1.7.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [Qemu-devel] [PATCH 4/4] linux-user: Support HWCAP2 in PowerPC
2014-06-16 16:03 [Qemu-devel] [PATCH 0/4] AUXV Fixes for PowerPC Linux User Mode Tom Musta
` (2 preceding siblings ...)
2014-06-16 16:03 ` [Qemu-devel] [PATCH 3/4] linux-user: Identify Addition Hardware Capabilities for PowerPC Tom Musta
@ 2014-06-16 16:03 ` Tom Musta
2014-06-16 22:39 ` [Qemu-devel] [Qemu-ppc] [PATCH 0/4] AUXV Fixes for PowerPC Linux User Mode Alexander Graf
4 siblings, 0 replies; 6+ messages in thread
From: Tom Musta @ 2014-06-16 16:03 UTC (permalink / raw)
To: qemu-devel; +Cc: tommusta, qemu-ppc
Set bits in the AT_HWCAP2 entry of the AUXV. Specifically, detect and set bits
for bctar, ISEL and ISA 2.07.
Signed-off-by: Tom Musta <tommusta@gmail.com>
---
linux-user/elfload.c | 31 +++++++++++++++++++++++++++++++
1 files changed, 31 insertions(+), 0 deletions(-)
diff --git a/linux-user/elfload.c b/linux-user/elfload.c
index ab46695..d661127 100644
--- a/linux-user/elfload.c
+++ b/linux-user/elfload.c
@@ -729,6 +729,14 @@ enum {
QEMU_PPC_FEATURE_TRUE_LE = 0x00000002,
QEMU_PPC_FEATURE_PPC_LE = 0x00000001,
+
+ /* Feature definitions in AT_HWCAP2. */
+ QEMU_PPC_FEATURE2_ARCH_2_07 = 0x80000000, /* ISA 2.07 */
+ QEMU_PPC_FEATURE2_HAS_HTM = 0x40000000, /* Hardware Transactional Memory */
+ QEMU_PPC_FEATURE2_HAS_DSCR = 0x20000000, /* Data Stream Control Register */
+ QEMU_PPC_FEATURE2_HAS_EBB = 0x10000000, /* Event Base Branching */
+ QEMU_PPC_FEATURE2_HAS_ISEL = 0x08000000, /* Integer Select */
+ QEMU_PPC_FEATURE2_HAS_TAR = 0x04000000, /* Target Address Register */
};
#define ELF_HWCAP get_elf_hwcap()
@@ -763,6 +771,29 @@ static uint32_t get_elf_hwcap(void)
return features;
}
+#define ELF_HWCAP2 get_elf_hwcap2()
+
+static uint32_t get_elf_hwcap2(void)
+{
+ PowerPCCPU *cpu = POWERPC_CPU(thread_cpu);
+ uint32_t features = 0;
+
+#define GET_FEATURE(flag, feature) \
+ do { if (cpu->env.insns_flags & flag) { features |= feature; } } while (0)
+#define GET_FEATURE2(flag, feature) \
+ do { if (cpu->env.insns_flags2 & flag) { features |= feature; } } while (0)
+
+ GET_FEATURE(PPC_ISEL, QEMU_PPC_FEATURE2_HAS_ISEL);
+ GET_FEATURE2(PPC2_BCTAR_ISA207, QEMU_PPC_FEATURE2_HAS_TAR);
+ GET_FEATURE2((PPC2_BCTAR_ISA207 | PPC2_LSQ_ISA207 | PPC2_ALTIVEC_207 |
+ PPC2_ISA207S), QEMU_PPC_FEATURE2_ARCH_2_07);
+
+#undef GET_FEATURE
+#undef GET_FEATURE2
+
+ return features;
+}
+
/*
* The requirements here are:
* - keep the final alignment of sp (sp & 0xf)
--
1.7.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [Qemu-ppc] [PATCH 0/4] AUXV Fixes for PowerPC Linux User Mode
2014-06-16 16:03 [Qemu-devel] [PATCH 0/4] AUXV Fixes for PowerPC Linux User Mode Tom Musta
` (3 preceding siblings ...)
2014-06-16 16:03 ` [Qemu-devel] [PATCH 4/4] linux-user: Support HWCAP2 in PowerPC Tom Musta
@ 2014-06-16 22:39 ` Alexander Graf
4 siblings, 0 replies; 6+ messages in thread
From: Alexander Graf @ 2014-06-16 22:39 UTC (permalink / raw)
To: Tom Musta, qemu-devel; +Cc: Riku Voipio, qemu-ppc
On 16.06.14 18:03, Tom Musta wrote:
> These patches improve the fidelity of the AUXV for the Power PC user mode targets.
> Specifically, the cache line sizes and hardware capabilities are improved so that
> they more closely match what would be seen on an actual system.
Thanks, applied all to ppc-next. Next time please CC Riku for linux-user
related patches :).
Alex
^ permalink raw reply [flat|nested] 6+ messages in thread