ppc-for-5.1 queue 20200527
The following changes since commit ddc760832fa8cf5e93b9d9e6e854a5114ac63510:
Merge remote-tracking branch 'remotes/gkurz/tags/9p-next-2020-05-26' into staging (2020-05-26 14:05:53 +0100)
are available in the Git repository at:
git://github.com/dgibson/qemu.git tags/ppc-for-5.1-20200527
for you to fetch changes up to 9c7c0407028355ca83349b8a60fddfad46f2ebd8:
vfio/nvlink: Remove exec permission to avoid SELinux AVCs (2020-05-27 15:29:36 +1000)
----------------------------------------------------------------
ppc patch queue 2020-05-27
Here's the next pull request for qemu-5.1. It includes:
* Support for the scv and rfscv POWER9 instructions in TCG
* Support for the new SPAPR_LMB_FLAGS_HOTREMOVABLE flag, which provides a way for guests to know memory which should be removable (so the guest can avoid putting immovable allocations there).
* Some fixes for the recently added partition scope radix translation in softmmu
* Assorted minor fixes and cleanups
It includes one patch to avoid a clash with SELinux when using NVLink VFIO devices. That's not technically within the files under my maintainership, but it is in a section of the VFIO quirks code that's specific to the POWER-only NVLink devices, and has an ack from Alex Williamson.
----------------------------------------------------------------
Cédric Le Goater (1):
ppc/spapr: add a POWER10 CPU model
Greg Kurz (8):
target/ppc: Untabify excp_helper.c
target/ppc: Pass const pointer to ppc_radix64_get_prot_amr() target/ppc: Pass const pointer to ppc_radix64_get_fully_qualified_addr() target/ppc: Don't initialize some local variables in ppc_radix64_xlate() target/ppc: Add missing braces in ppc_radix64_partition_scoped_xlate() target/ppc: Fix arguments to ppc_radix64_partition_scoped_xlate() target/ppc: Don't update radix PTE R/C bits with gdbstub target/ppc: Fix argument to ppc_radix64_partition_scoped_xlate() again
Leonardo Bras (2):
ppc/spapr: Add hotremovable flag on DIMM LMBs on drmem_v2 vfio/nvlink: Remove exec permission to avoid SELinux AVCs
Nicholas Piggin (2):
ppc/pnv: Fix NMI system reset SRR1 value target/ppc: Add support for scv and rfscv instructions
Philippe Mathieu-Daudé (2):
hw/pci-bridge/dec: Remove dead debug code hw/nvram/mac_nvram: Convert debug printf()s to trace events
hw/nvram/mac_nvram.c | 17 +----- hw/nvram/trace-events | 4 ++ hw/pci-bridge/dec.c | 10 ---- hw/ppc/pnv.c | 26 ++++++-- hw/ppc/spapr.c | 3 +- hw/ppc/spapr_cpu_core.c | 1 + hw/vfio/pci-quirks.c | 4 +- include/hw/ppc/spapr.h | 1 + linux-user/ppc/cpu_loop.c | 1 + target/ppc/cpu.h | 28 ++++++++- target/ppc/excp_helper.c | 130 +++++++++++++++++++++++++++------------- target/ppc/helper.h | 1 + target/ppc/mmu-radix64.c | 53 +++++++++------- target/ppc/mmu-radix64.h | 4 +- target/ppc/translate.c | 53 +++++++++++++++- target/ppc/translate_init.inc.c | 3 +- 16 files changed, 237 insertions(+), 102 deletions(-)
[PULL 02/15] ppc/spapr: add a POWER10 CPU model
From: Cédric Le Goater <[email protected]>
Message-Id: <[email protected]>
--- hw/ppc/spapr_cpu_core.c | 1 + 1 file changed, 1 insertion(+)
hw/ppc/spapr_cpu_core.c +1 -0
@@ -407,6 +407,7 @@ static const TypeInfo spapr_cpu_core_type_infos[] = {DEFINE_SPAPR_CPU_CORE_TYPE ("power8nvl_v1.0" ),DEFINE_SPAPR_CPU_CORE_TYPE ("power9_v1.0" ),DEFINE_SPAPR_CPU_CORE_TYPE ("power9_v2.0" ), +DEFINE_SPAPR_CPU_CORE_TYPE ("power10_v1.0" ), #ifdef CONFIG_KVM DEFINE_SPAPR_CPU_CORE_TYPE("host"), #endif
Signature · 1 line
2.26.2
[PULL 05/15] ppc/spapr: Add hotremovable flag on DIMM LMBs on drmem_v2
In reply to David GibsonFrom: Leonardo Bras <[email protected]>
On reboot, all memory that was previously added using object_add and device_add is placed in this DIMM area.
The new SPAPR_LMB_FLAGS_HOTREMOVABLE flag helps Linux to put this memory in the correct memory zone, so no unmovable allocations are made there, allowing the object to be easily hot-removed by device_del and object_del.
This new flag was accepted in Power Architecture documentation.
Message-Id: <[email protected]>
--- hw/ppc/pnv.c | 8 ++++---- hw/ppc/spapr.c | 3 ++- include/hw/ppc/spapr.h | 1 + target/ppc/cpu.h | 21 +++++++++++++++++++++ target/ppc/excp_helper.c | 16 ++++++++-------- 5 files changed, 36 insertions(+), 13 deletions(-)
hw/ppc/pnv.c +4 -4
@@ -1984,15 +1984,15 @@ static void pnv_cpu_do_nmi_on_cpu(CPUState *cs, run_on_cpu_data arg)cpu_synchronize_state (cs);ppc_cpu_do_system_reset (cs); -if (env->spr[SPR_SRR1 ] &PPC_BITMASK (46 ,47 )) { +if (env->spr[SPR_SRR1 ] &SRR1_WAKESTATE ) {/* * Power-save wakeups, as indicated by non-zero SRR1[46:47] put the * wakeup reason in SRR1[42:45], system reset is indicated with 0b0100 * (PPC_BIT(43)). */ -if (!(env->spr[SPR_SRR1 ] &PPC_BIT (43 ))) { +if (!(env->spr[SPR_SRR1 ] &SRR1_WAKERESET )) {warn_report ("ppc_cpu_do_system_reset does not set system reset wakeup reason" ); - env->spr[SPR_SRR1 ] |=PPC_BIT (43 ); + env->spr[SPR_SRR1 ] |=SRR1_WAKERESET ; } }else {/*
@@ -2002,7 +2002,7 @@ static void pnv_cpu_do_nmi_on_cpu(CPUState *cs, run_on_cpu_data arg)* another CPU requesting a NMI IPI) system reset exception should be * 0b0010 (PPC_BIT(44)). */ - env->spr[SPR_SRR1 ] |=PPC_BIT (44 ); + env->spr[SPR_SRR1 ] |=SRR1_WAKESCOM ; } }
hw/ppc/spapr.c +2 -1
@@ -445,7 +445,8 @@ static int spapr_dt_dynamic_memory_v2(SpaprMachineState *spapr, void *fdt,g_assert (drc); elem =spapr_get_drconf_cell (size / lmb_size, addr,spapr_drc_index (drc), node, -SPAPR_LMB_FLAGS_ASSIGNED ); + (SPAPR_LMB_FLAGS_ASSIGNED | +SPAPR_LMB_FLAGS_HOTREMOVABLE ));QSIMPLEQ_INSERT_TAIL (&drconf_queue, elem, entry); nr_entries++; cur_addr = addr + size;
include/hw/ppc/spapr.h +1 -0
@@ -886,6 +886,7 @@ int spapr_rtc_import_offset(SpaprRtcState *rtc, int64_t legacy_offset);#define SPAPR_LMB_FLAGS_ASSIGNED 0x00000008#define SPAPR_LMB_FLAGS_DRC_INVALID 0x00000020#define SPAPR_LMB_FLAGS_RESERVED 0x00000080 +#define SPAPR_LMB_FLAGS_HOTREMOVABLE 0x00000100void spapr_do_system_reset_on_cpu (CPUState *cs,run_on_cpu_data arg);
target/ppc/cpu.h +21 -0
@@ -476,6 +476,27 @@ typedef struct ppc_v3_pate_t {#define SRR1_PROTFAULT DSISR_PROTFAULT#define SRR1_IAMR DSISR_AMR +/* SRR1[42:45] wakeup fields for System Reset Interrupt */ + +#define SRR1_WAKEMASK 0x003c0000/* reason for wakeup */ + +#define SRR1_WAKEHMI 0x00280000/* Hypervisor maintenance */ +#define SRR1_WAKEHVI 0x00240000/* Hypervisor Virt. Interrupt (P9) */ +#define SRR1_WAKEEE 0x00200000/* External interrupt */ +#define SRR1_WAKEDEC 0x00180000/* Decrementer interrupt */ +#define SRR1_WAKEDBELL 0x00140000/* Privileged doorbell */ +#define SRR1_WAKERESET 0x00100000/* System reset */ +#define SRR1_WAKEHDBELL 0x000c0000/* Hypervisor doorbell */ +#define SRR1_WAKESCOM 0x00080000/* SCOM not in power-saving mode */ + +/* SRR1[46:47] power-saving exit mode */ + +#define SRR1_WAKESTATE 0x00030000/* Powersave exit mask */ + +#define SRR1_WS_HVLOSS 0x00030000/* HV resources not maintained */ +#define SRR1_WS_GPRLOSS 0x00020000/* GPRs not maintained */ +#define SRR1_WS_NOLOSS 0x00010000/* All resources maintained */ +/* Facility Status and Control (FSCR) bits */ #define FSCR_EBB (63 - 56)/* Event-Based Branch Facility */ #define FSCR_TAR (63 - 55)/* Target Address Register */
target/ppc/excp_helper.c +8 -8
@@ -101,7 +101,7 @@ static int powerpc_reset_wakeup(CPUState *cs, CPUPPCState *env, int excp, env->resume_as_sreset = false;/* Pretend to be returning from doze always as we don't lose state */ - *msr |= (0x1ull << (63 -47 )); + *msr |=SRR1_WS_NOLOSS ;/* Machine checks are sent normally */ if (excp ==POWERPC_EXCP_MCHECK ) {
@@ -109,25 +109,25 @@ static int powerpc_reset_wakeup(CPUState *cs, CPUPPCState *env, int excp, }switch (excp) {case POWERPC_EXCP_RESET : - *msr |=0x4ull << (63 -45 ); + *msr |=SRR1_WAKERESET ;break ;case POWERPC_EXCP_EXTERNAL : - *msr |=0x8ull << (63 -45 ); + *msr |=SRR1_WAKEEE ;break ;case POWERPC_EXCP_DECR : - *msr |=0x6ull << (63 -45 ); + *msr |=SRR1_WAKEDEC ;break ;case POWERPC_EXCP_SDOOR : - *msr |=0x5ull << (63 -45 ); + *msr |=SRR1_WAKEDBELL ;break ;case POWERPC_EXCP_SDOOR_HV : - *msr |=0x3ull << (63 -45 ); + *msr |=SRR1_WAKEHDBELL ;break ;case POWERPC_EXCP_HV_MAINT : - *msr |=0xaull << (63 -45 ); + *msr |=SRR1_WAKEHMI ;break ;case POWERPC_EXCP_HVIRT : - *msr |=0x9ull << (63 -45 ); + *msr |=SRR1_WAKEHVI ;break ;default : cpu_abort(cs, "Unsupported exception %d in Power Save mode\n",
Signature · 1 line
2.26.2
[PULL 03/15] target/ppc: Untabify excp_helper.c
In reply to David GibsonFrom: Greg Kurz <[email protected]>
Some tabs crept in with a recent change.
Message-Id: <[email protected]>
--- target/ppc/excp_helper.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
target/ppc/excp_helper.c +8 -8
@@ -70,16 +70,16 @@ static inline void dump_syscall(CPUPPCState *env)static inline void dump_hcall (CPUPPCState *env) {qemu_log_mask (CPU_LOG_INT ,"hypercall r3=%016" PRIx64 -" r4=%016" PRIx64" r5=%016" PRIx64" r6=%016" PRIx64 -" r7=%016" PRIx64" r8=%016" PRIx64" r9=%016" PRIx64 -" r10=%016" PRIx64" r11=%016" PRIx64" r12=%016" PRIx64 +" r4=%016" PRIx64" r5=%016" PRIx64" r6=%016" PRIx64 +" r7=%016" PRIx64" r8=%016" PRIx64" r9=%016" PRIx64 +" r10=%016" PRIx64" r11=%016" PRIx64" r12=%016" PRIx64" nip=" TARGET_FMT_lx"\n" ,ppc_dump_gpr (env,3 ),ppc_dump_gpr (env,4 ), -ppc_dump_gpr (env,5 ),ppc_dump_gpr (env,6 ), -ppc_dump_gpr (env,7 ),ppc_dump_gpr (env,8 ), -ppc_dump_gpr (env,9 ),ppc_dump_gpr (env,10 ), -ppc_dump_gpr (env,11 ),ppc_dump_gpr (env,12 ), - env->nip); +ppc_dump_gpr (env,5 ),ppc_dump_gpr (env,6 ), +ppc_dump_gpr (env,7 ),ppc_dump_gpr (env,8 ), +ppc_dump_gpr (env,9 ),ppc_dump_gpr (env,10 ), +ppc_dump_gpr (env,11 ),ppc_dump_gpr (env,12 ), + env->nip); } static int powerpc_reset_wakeup(CPUState *cs, CPUPPCState *env, int excp,
Signature · 1 line
2.26.2
[PULL 01/15] ppc/pnv: Fix NMI system reset SRR1 value
In reply to David GibsonFrom: Nicholas Piggin <[email protected]>
Commit a77fed5bd926 ("ppc/pnv: Add support for NMI interface") got the SRR1 setting wrong for sresets that hit outside of power-save states.
Fix this, better documenting the source for the bit definitions.
Message-Id: <[email protected]>
--- hw/ppc/pnv.c | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-)
hw/ppc/pnv.c +20 -6
@@ -1984,12 +1984,26 @@ static void pnv_cpu_do_nmi_on_cpu(CPUState *cs, run_on_cpu_data arg)cpu_synchronize_state (cs);ppc_cpu_do_system_reset (cs); -/* -* SRR1[42:45] is set to 0100 which the ISA defines as implementation -* dependent. POWER processors use this for xscom triggered interrupts, -* which come from the BMC or NMI IPIs. -*/ - env->spr[SPR_SRR1 ] |=PPC_BIT (43 ); +if (env->spr[SPR_SRR1 ] &PPC_BITMASK (46 ,47 )) { +/* +* Power-save wakeups, as indicated by non-zero SRR1[46:47] put the +* wakeup reason in SRR1[42:45], system reset is indicated with 0b0100 +* (PPC_BIT(43)). +*/ +if (!(env->spr[SPR_SRR1 ] &PPC_BIT (43 ))) { +warn_report ("ppc_cpu_do_system_reset does not set system reset wakeup reason" ); + env->spr[SPR_SRR1 ] |=PPC_BIT (43 ); + } + }else { +/* +* For non-powersave system resets, SRR1[42:45] are defined to be +* implementation-dependent. The POWER9 User Manual specifies that +* an external (SCOM driven, which may come from a BMC nmi command or +* another CPU requesting a NMI IPI) system reset exception should be +* 0b0010 (PPC_BIT(44)). +*/ + env->spr[SPR_SRR1 ] |=PPC_BIT (44 ); + } }static void pnv_nmi (NMIState *n,int cpu_index,Error **errp)
Signature · 1 line
2.26.2
[PULL 08/15] target/ppc: Don't initialize some local variables in ppc_radix64_xlate()
In reply to David GibsonFrom: Greg Kurz <[email protected]>
It is the job of the ppc_radix64_get_fully_qualified_addr() function which is called at the beginning of ppc_radix64_xlate() to set both lpid *and* pid. It doesn't buy us anything to initialize them first.
Worse, a bug in ppc_radix64_get_fully_qualified_addr(), eg. failing to set either lpid or pid, would be undetectable by static analysis tools like coverity.
Some recent versions of gcc (eg. gcc-9.3.1-2.fc30) may still think that lpid or pid is used uninitialized though, so this also adds default cases in the switch statements to make it clear this cannot happen.
Message-Id: <[email protected]>
--- target/ppc/mmu-radix64.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
target/ppc/mmu-radix64.c +5 -1
@@ -50,6 +50,8 @@ static bool ppc_radix64_get_fully_qualified_addr(const CPUPPCState *env, *lpid =0 ; *pid =0 ;break ; +default : +g_assert_not_reached (); } }else {/* !MSR[HV] -> Guest */ switch (eaddr &R_EADDR_QUADRANT ) {
@@ -64,6 +66,8 @@ static bool ppc_radix64_get_fully_qualified_addr(const CPUPPCState *env, *lpid = env->spr[SPR_LPIDR ]; *pid =0 ;/* pid set to 0 -> addresses guest operating system */ break ; +default : +g_assert_not_reached (); } }
@@ -433,7 +437,7 @@ static int ppc_radix64_xlate(PowerPCCPU *cpu, vaddr eaddr, int rwx, bool cause_excp) {CPUPPCState *env = &cpu->env; -uint64_t lpid =0 , pid =0 ; +uint64_t lpid, pid;ppc_v3_pate_t pate;int psize, prot;hwaddr g_raddr;
Signature · 1 line
2.26.2
[PULL 07/15] target/ppc: Pass const pointer to ppc_radix64_get_fully_qualified_addr()
In reply to David GibsonFrom: Greg Kurz <[email protected]>
This doesn't require write access to the CPU registers.
Message-Id: <[email protected]>
--- target/ppc/mmu-radix64.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
target/ppc/mmu-radix64.c +2 -1
@@ -28,7 +28,8 @@#include "mmu-radix64.h" #include "mmu-book3s-v3.h" -static bool ppc_radix64_get_fully_qualified_addr (CPUPPCState *env,vaddr eaddr, +static bool ppc_radix64_get_fully_qualified_addr (const CPUPPCState *env, +vaddr eaddr,uint64_t *lpid,uint64_t *pid) {if (msr_hv) {/* MSR[HV] -> Hypervisor/bare metal */
Signature · 1 line
2.26.2
[PULL 04/15] target/ppc: Add support for scv and rfscv instructions
In reply to David GibsonFrom: Nicholas Piggin <[email protected]>
POWER9 adds scv and rfscv instructions and the system call vectored interrupt. Linux does not support this instruction yet but it has been tested with a modified kernel that runs on real hardware.
Message-Id: <[email protected]>
--- linux-user/ppc/cpu_loop.c | 1 + target/ppc/cpu.h | 7 ++- target/ppc/excp_helper.c | 98 ++++++++++++++++++++++++--------- target/ppc/helper.h | 1 + target/ppc/translate.c | 53 +++++++++++++++++- target/ppc/translate_init.inc.c | 3 +- 6 files changed, 133 insertions(+), 30 deletions(-)
linux-user/ppc/cpu_loop.c +1 -0
@@ -267,6 +267,7 @@ void cpu_loop(CPUPPCState *env)queue_signal (env, info.si_signo,QEMU_SI_FAULT , &info);break ;case POWERPC_EXCP_SYSCALL :/* System call exception */ +case POWERPC_EXCP_SYSCALL_VECTORED :cpu_abort (cs,"Syscall exception while in user mode. " "Aborting\n" );break ;
target/ppc/cpu.h +6 -1
@@ -127,8 +127,9 @@ enum {POWERPC_EXCP_SDOOR_HV =100 ,/* ISA 3.00 additions */ POWERPC_EXCP_HVIRT =101 , +POWERPC_EXCP_SYSCALL_VECTORED =102 ,/* scv exception */ /* EOL */ -POWERPC_EXCP_NB =102 , +POWERPC_EXCP_NB =103 ,/* QEMU exceptions: used internally during code translation */ POWERPC_EXCP_STOP =0x200 ,/* stop translation */ POWERPC_EXCP_BRANCH = 0x201, /* branch instruction */
@@ -478,6 +479,7 @@ typedef struct ppc_v3_pate_t {/* Facility Status and Control (FSCR) bits */ #define FSCR_EBB (63 - 56)/* Event-Based Branch Facility */ #define FSCR_TAR (63 - 55)/* Target Address Register */ +#define FSCR_SCV (63 - 51)/* System call vectored */ /* Interrupt cause mask and position in FSCR. HFSCR has the same format */ #define FSCR_IC_MASK (0xFFULL)#define FSCR_IC_POS (63 - 7)
@@ -487,6 +489,7 @@ typedef struct ppc_v3_pate_t {#define FSCR_IC_TM 5#define FSCR_IC_EBB 7#define FSCR_IC_TAR 8 +#define FSCR_IC_SCV 12/* Exception state register bits definition */ #define ESR_PIL PPC_BIT(36)/* Illegal Instruction */
@@ -554,6 +557,8 @@ enum {POWERPC_FLAG_VSX =0x00080000 ,/* Has Transaction Memory (ISA 2.07) */ POWERPC_FLAG_TM =0x00100000 , +/* Has SCV (ISA 3.00) */ + POWERPC_FLAG_SCV = 0x00200000, };/*****************************************************************************/
target/ppc/excp_helper.c +71 -27
152 lines not on this page · raw message
target/ppc/helper.h +1 -0
@@ -15,6 +15,7 @@ DEF_HELPER_1(rfmci, void, env)#if defined(TARGET_PPC64 ) DEF_HELPER_2(pminsn, void, env, i32) DEF_HELPER_1(rfid, void, env) +DEF_HELPER_1(rfscv, void, env) DEF_HELPER_1(hrfid, void, env) DEF_HELPER_2(store_lpcr, void, env, tl)DEF_HELPER_2 (store_pcr, void, env, tl)
target/ppc/translate.c +52 -1
95 lines not on this page · raw message
target/ppc/translate_init.inc.c +2 -1
@@ -3382,6 +3382,7 @@ static void init_excp_POWER9(CPUPPCState *env)#if !defined(CONFIG_USER_ONLY ) env->excp_vectors[POWERPC_EXCP_HVIRT ] =0x00000EA0 ; + env->excp_vectors[POWERPC_EXCP_SYSCALL_VECTORED ] =0x00000000 ;#endif }
@@ -9030,7 +9031,7 @@ POWERPC_FAMILY(POWER9)(ObjectClass *oc, void *data) pcc->flags =POWERPC_FLAG_VRE |POWERPC_FLAG_SE |POWERPC_FLAG_BE |POWERPC_FLAG_PMM |POWERPC_FLAG_BUS_CLK |POWERPC_FLAG_CFAR | -POWERPC_FLAG_VSX |POWERPC_FLAG_TM ; +POWERPC_FLAG_VSX |POWERPC_FLAG_TM |POWERPC_FLAG_SCV ; pcc->l1_dcache_size =0x8000 ; pcc->l1_icache_size =0x8000 ; pcc->interrupts_big_endian = ppc_cpu_interrupts_big_endian_lpcr;
Signature · 1 line
2.26.2
[PULL 10/15] target/ppc: Fix arguments to ppc_radix64_partition_scoped_xlate()
In reply to David GibsonFrom: Greg Kurz <[email protected]>
The last two arguments have the bool type. Also, we shouldn't raise an exception when using gdbstub.
This was found while reading the code. Since it only affects the powernv machine, I didn't dig further to find an actual bug.
Message-Id: <[email protected]>
--- target/ppc/mmu-radix64.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
target/ppc/mmu-radix64.c +4 -2
@@ -339,7 +339,8 @@ static int ppc_radix64_process_scoped_xlate(PowerPCCPU *cpu, int rwx,*/ ret =ppc_radix64_partition_scoped_xlate (cpu,0 , eaddr, prtbe_addr, pate, &h_raddr, &h_prot, - &h_page_size,1 ,1 ); + &h_page_size, true, + cause_excp);if (ret) {return ret; }
@@ -378,7 +379,8 @@ static int ppc_radix64_process_scoped_xlate(PowerPCCPU *cpu, int rwx, do { ret = ppc_radix64_partition_scoped_xlate(cpu, 0, eaddr, pte_addr, pate, &h_raddr, &h_prot, - &h_page_size, 1, 1); + &h_page_size, true, + cause_excp); if (ret) { return ret; }
Signature · 1 line
2.26.2
[PULL 06/15] target/ppc: Pass const pointer to ppc_radix64_get_prot_amr()
In reply to David GibsonFrom: Greg Kurz <[email protected]>
This doesn't require write access to the CPU structure.
Message-Id: <[email protected]>
--- target/ppc/mmu-radix64.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
target/ppc/mmu-radix64.h +2 -2
@@ -55,9 +55,9 @@ static inline int ppc_radix64_get_prot_eaa(uint64_t pte) (pte &R_PTE_EAA_X ?PAGE_EXEC :0 ); } -static inline int ppc_radix64_get_prot_amr (PowerPCCPU *cpu) +static inline int ppc_radix64_get_prot_amr (const PowerPCCPU *cpu) { -CPUPPCState *env = &cpu->env; +const CPUPPCState *env = &cpu->env;int amr = env->spr[SPR_AMR ] >>62 ;/* We only care about key0 AMR63:62 */ int iamr = env->spr[SPR_IAMR ] >>62 ;/* We only care about key0 IAMR63:62 */
Signature · 1 line
2.26.2
[PULL 12/15] hw/pci-bridge/dec: Remove dead debug code
In reply to David GibsonFrom: Philippe Mathieu-Daudé <[email protected]>
Remove debug code never used since added in commit e1c6bbabee30.
Message-Id: <[email protected]>
--- hw/pci-bridge/dec.c | 10 ---------- 1 file changed, 10 deletions(-)
hw/pci-bridge/dec.c +0 -10
@@ -32,16 +32,6 @@#include "hw/pci/pci_bridge.h" #include "hw/pci/pci_bus.h" -/* debug DEC */ -//#define DEBUG_DEC - -#ifdef DEBUG_DEC -#define DEC_DPRINTF (fmt, ...) \ - do { printf("DEC: " fmt , ## __VA_ARGS__); } while (0) -#else -#define DEC_DPRINTF (fmt, ...) -#endif -#define DEC_21154 (obj) OBJECT_CHECK(DECState, (obj), TYPE_DEC_21154) typedef struct DECState {
Signature · 1 line
2.26.2
[PULL 11/15] target/ppc: Don't update radix PTE R/C bits with gdbstub
In reply to David GibsonFrom: Greg Kurz <[email protected]>
gdbstub shouldn't silently change guest visible state when doing address translation. Since the R/C bits can only be updated when handling a MMU fault, let's reuse the cause_excp flag and rename it to guest_visible. While here drop a not very useful comment.
This was found while reading the code. I could verify that this affects both powernv and pseries, but I failed to observe any actual bug.
Message-Id: <[email protected]>
--- target/ppc/mmu-radix64.c | 39 +++++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 18 deletions(-)
target/ppc/mmu-radix64.c +21 -18
@@ -274,7 +274,7 @@ static int ppc_radix64_partition_scoped_xlate(PowerPCCPU *cpu, int rwx,ppc_v3_pate_t pate, hwaddr *h_raddr, int *h_prot, int *h_page_size, bool pde_addr, - bool cause_excp) + bool guest_visible) { int fault_cause = 0;hwaddr pte_addr;
@@ -289,14 +289,15 @@ static int ppc_radix64_partition_scoped_xlate(PowerPCCPU *cpu, int rwx,if (pde_addr) {/* address being translated was that of a guest pde */ fault_cause |=DSISR_PRTABLE_FAULT ; } -if (cause_excp) { +if (guest_visible) {ppc_radix64_raise_hsi (cpu, rwx, eaddr, g_raddr, fault_cause); }return 1 ; } -/* Update Reference and Change Bits */ -ppc_radix64_set_rc (cpu, rwx, pte, pte_addr, h_prot); +if (guest_visible) { +ppc_radix64_set_rc (cpu, rwx, pte, pte_addr, h_prot); + }return 0 ; }
@@ -305,7 +306,7 @@ static int ppc_radix64_process_scoped_xlate(PowerPCCPU *cpu, int rwx, vaddr eaddr, uint64_t pid, ppc_v3_pate_t pate, hwaddr *g_raddr, int *g_prot, int *g_page_size, - bool cause_excp) + bool guest_visible) { CPUState *cs = CPU(cpu);CPUPPCState *env = &cpu->env;
@@ -319,7 +320,7 @@ static int ppc_radix64_process_scoped_xlate(PowerPCCPU *cpu, int rwx, size =1ULL << ((pate.dw1 &PATE1_R_PRTS ) +12 );if (offset >= size) {/* offset exceeds size of the process table */ -if (cause_excp) { +if (guest_visible) {ppc_radix64_raise_si (cpu, rwx, eaddr,DSISR_NOPTE ); }return 1 ;
@@ -340,7 +341,7 @@ static int ppc_radix64_process_scoped_xlate(PowerPCCPU *cpu, int rwx, ret =ppc_radix64_partition_scoped_xlate (cpu,0 , eaddr, prtbe_addr, pate, &h_raddr, &h_prot, &h_page_size, true, - cause_excp); + guest_visible);if (ret) {return ret; }
@@ -360,7 +361,7 @@ static int ppc_radix64_process_scoped_xlate(PowerPCCPU *cpu, int rwx, &fault_cause, &pte_addr);if (ret) {/* No valid PTE */ -if (cause_excp) { +if (guest_visible) {ppc_radix64_raise_si (cpu, rwx, eaddr, fault_cause); }return ret;
@@ -380,7 +381,7 @@ static int ppc_radix64_process_scoped_xlate(PowerPCCPU *cpu, int rwx, ret =ppc_radix64_partition_scoped_xlate (cpu,0 , eaddr, pte_addr, pate, &h_raddr, &h_prot, &h_page_size, true, - cause_excp); + guest_visible);if (ret) {return ret; }
@@ -389,7 +390,7 @@ static int ppc_radix64_process_scoped_xlate(PowerPCCPU *cpu, int rwx, &nls, g_page_size, &pte, &fault_cause);if (ret) {/* No valid pte */ -if (cause_excp) { +if (guest_visible) {ppc_radix64_raise_si (cpu, rwx, eaddr, fault_cause); }return ret;
@@ -406,13 +407,15 @@ static int ppc_radix64_process_scoped_xlate(PowerPCCPU *cpu, int rwx,if (ppc_radix64_check_prot (cpu, rwx, pte, &fault_cause, g_prot, false)) {/* Access denied due to protection */ -if (cause_excp) { +if (guest_visible) {ppc_radix64_raise_si (cpu, rwx, eaddr, fault_cause); }return 1 ; } -ppc_radix64_set_rc (cpu, rwx, pte, pte_addr, g_prot); +if (guest_visible) { +ppc_radix64_set_rc (cpu, rwx, pte, pte_addr, g_prot); + }return 0 ; }
@@ -437,7 +440,7 @@ static int ppc_radix64_process_scoped_xlate(PowerPCCPU *cpu, int rwx,static int ppc_radix64_xlate (PowerPCCPU *cpu,vaddr eaddr,int rwx,bool relocation,hwaddr *raddr,int *psizep,int *protp, -bool cause_excp) +bool guest_visible) {CPUPPCState *env = &cpu->env;uint64_t lpid, pid;
@@ -447,7 +450,7 @@ static int ppc_radix64_xlate(PowerPCCPU *cpu, vaddr eaddr, int rwx,/* Virtual Mode Access - get the fully qualified address */ if (!ppc_radix64_get_fully_qualified_addr (&cpu->env, eaddr, &lpid, &pid)) { -if (cause_excp) { +if (guest_visible) {ppc_radix64_raise_segi (cpu, rwx, eaddr); }return 1 ;
@@ -460,13 +463,13 @@ static int ppc_radix64_xlate(PowerPCCPU *cpu, vaddr eaddr, int rwx, vhc->get_pate (cpu->vhyp, &pate); }else {if (!ppc64_v3_get_pate (cpu, lpid, &pate)) { -if (cause_excp) { +if (guest_visible) {ppc_radix64_raise_si (cpu, rwx, eaddr,DSISR_NOPTE ); }return 1 ; }if (!validate_pate (cpu, lpid, &pate)) { -if (cause_excp) { +if (guest_visible) {ppc_radix64_raise_si (cpu, rwx, eaddr,DSISR_R_BADCONFIG ); }return 1 ;
@@ -487,7 +490,7 @@ static int ppc_radix64_xlate(PowerPCCPU *cpu, vaddr eaddr, int rwx,if (relocation) {int ret =ppc_radix64_process_scoped_xlate (cpu, rwx, eaddr, pid, pate, &g_raddr, &prot, - &psize, cause_excp); + &psize, guest_visible);if (ret) {return ret; }
@@ -510,7 +513,7 @@ static int ppc_radix64_xlate(PowerPCCPU *cpu, vaddr eaddr, int rwx, ret =ppc_radix64_partition_scoped_xlate (cpu, rwx, eaddr, g_raddr, pate, raddr, &prot, &psize, -0 , cause_excp); +0 , guest_visible);if (ret) {return ret; }
Signature · 1 line
2.26.2
[PULL 09/15] target/ppc: Add missing braces in ppc_radix64_partition_scoped_xlate()
In reply to David GibsonFrom: Greg Kurz <[email protected]>
As per CODING_STYLE.
Message-Id: <[email protected]>
--- target/ppc/mmu-radix64.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
target/ppc/mmu-radix64.c +2 -1
@@ -286,8 +286,9 @@ static int ppc_radix64_partition_scoped_xlate(PowerPCCPU *cpu, int rwx, pate.dw0 & PRTBE_R_RPDS, h_raddr, h_page_size, &pte, &fault_cause, &pte_addr) || ppc_radix64_check_prot(cpu, rwx, pte, &fault_cause, h_prot, true)) { -if (pde_addr)/* address being translated was that of a guest pde */ +if (pde_addr) {/* address being translated was that of a guest pde */ fault_cause |=DSISR_PRTABLE_FAULT ; + }if (cause_excp) {ppc_radix64_raise_hsi (cpu, rwx, eaddr, g_raddr, fault_cause); }
Signature · 1 line
2.26.2
[PULL 15/15] vfio/nvlink: Remove exec permission to avoid SELinux AVCs
In reply to David GibsonFrom: Leonardo Bras <[email protected]>
If SELinux is setup without 'execmem' permission for qemu, all mmap with (PROT_WRITE | PROT_EXEC) will fail and print a warning in SELinux log.
If "nvlink2-mr" memory allocation fails (fist diff), it will cause guest NUMA nodes to not be correctly configured (V100 memory will not be visible for guest, nor its NUMA nodes).
Not having 'execmem' permission is intesting for virtual machines to avoid buffer-overflow based attacks, and it's adopted in distros like RHEL.
So, removing the PROT_EXEC flag seems the right thing to do.
Browsing some other code that mmaps memory for usage with memory_region_init_ram_device_ptr, I could notice it's usual to not have PROT_EXEC (only PROT_READ | PROT_WRITE), so it should be no problem around this.
Message-Id: <[email protected]>
--- hw/vfio/pci-quirks.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
hw/vfio/pci-quirks.c +2 -2
@@ -1620,7 +1620,7 @@ int vfio_pci_nvidia_v100_ram_init(VFIOPCIDevice *vdev, Error **errp) } cap = (void *) hdr; - p =mmap (NULL , nv2reg->size,PROT_READ |PROT_WRITE |PROT_EXEC , + p =mmap (NULL , nv2reg->size,PROT_READ |PROT_WRITE ,MAP_SHARED , vdev->vbasedev.fd, nv2reg->offset);if (p ==MAP_FAILED ) { ret = -errno;
@@ -1680,7 +1680,7 @@ int vfio_pci_nvlink2_init(VFIOPCIDevice *vdev, Error **errp)/* Some NVLink bridges may not have assigned ATSD */ if (atsdreg->size) { - p =mmap (NULL , atsdreg->size,PROT_READ |PROT_WRITE |PROT_EXEC , + p =mmap (NULL , atsdreg->size,PROT_READ |PROT_WRITE ,MAP_SHARED , vdev->vbasedev.fd, atsdreg->offset);if (p ==MAP_FAILED ) { ret = -errno;
Signature · 1 line
2.26.2
[PULL 13/15] hw/nvram/mac_nvram: Convert debug printf()s to trace events
In reply to David GibsonFrom: Philippe Mathieu-Daudé <[email protected]>
Convert NVR_DPRINTF() to trace events and remove ifdef'ry.
Message-Id: <[email protected]>
--- hw/nvram/mac_nvram.c | 17 +++-------------- hw/nvram/trace-events | 4 ++++ 2 files changed, 7 insertions(+), 14 deletions(-)
hw/nvram/mac_nvram.c +3 -14
@@ -30,18 +30,9 @@#include "migration/vmstate.h" #include "qemu/cutils.h" #include "qemu/module.h" +#include "trace.h" #include <zlib.h> -/* debug NVR */ -//#define DEBUG_NVR - -#ifdef DEBUG_NVR -#define NVR_DPRINTF (fmt, ...) \ - do { printf("NVR: " fmt , ## __VA_ARGS__); } while (0) -#else -#define NVR_DPRINTF (fmt, ...) -#endif -#define DEF_SYSTEM_SIZE 0xc10/* macio style NVRAM device */
@@ -51,9 +42,8 @@ static void macio_nvram_writeb(void *opaque, hwaddr addr,MacIONVRAMState *s = opaque; addr = (addr >> s->it_shift) & (s->size -1 ); +trace_macio_nvram_write (addr, value); s->data[addr] = value; -NVR_DPRINTF ("writeb addr %04" HWADDR_PRIx" val %" PRIx64"\n" , - addr, value); } static uint64_t macio_nvram_readb(void *opaque, hwaddr addr,
@@ -64,8 +54,7 @@ static uint64_t macio_nvram_readb(void *opaque, hwaddr addr, addr = (addr >> s->it_shift) & (s->size -1 ); value = s->data[addr]; -NVR_DPRINTF ("readb addr %04" HWADDR_PRIx" val %" PRIx32"\n" , - addr, value); +trace_macio_nvram_read (addr, value);return value; }
hw/nvram/trace-events +4 -0
@@ -13,3 +13,7 @@ fw_cfg_add_string(uint16_t key_value, const char *key_name, const char *value) " fw_cfg_add_i16(uint16_t key_value, const char *key_name, uint16_t value) "key 0x%04" PRIx16 " '%s', value 0x%" PRIx16 fw_cfg_add_i32(uint16_t key_value, const char *key_name, uint32_t value) "key 0x%04" PRIx16 " '%s', value 0x%" PRIx32 fw_cfg_add_i64(uint16_t key_value, const char *key_name, uint64_t value) "key 0x%04" PRIx16 " '%s', value 0x%" PRIx64 + +# mac_nvram.c +macio_nvram_read(uint32_t addr, uint8_t val) "read addr=0x%04"PRIx32" val=0x%02x" +macio_nvram_write(uint32_t addr, uint8_t val) "write addr=0x%04"PRIx32" val=0x%02x"
Signature · 1 line
2.26.2
[PULL 14/15] target/ppc: Fix argument to ppc_radix64_partition_scoped_xlate() again
In reply to David GibsonFrom: Greg Kurz <[email protected]>
The penultimate argument of function ppc_radix64_partition_scoped_xlate() has the bool type.
Message-Id: <[email protected]>
--- target/ppc/mmu-radix64.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
target/ppc/mmu-radix64.c +1 -1
@@ -513,7 +513,7 @@ static int ppc_radix64_xlate(PowerPCCPU *cpu, vaddr eaddr, int rwx, ret =ppc_radix64_partition_scoped_xlate (cpu, rwx, eaddr, g_raddr, pate, raddr, &prot, &psize, -0 , guest_visible); + false, guest_visible);if (ret) {return ret; }
Signature · 1 line
2.26.2
Patchew URL: https://patchew.org/QEMU/[email protected]/
Patchew URL: https://patchew.org/QEMU/[email protected]/
Hi,
This series seems to have some coding style problems. See output below for more information:
Message-id: [email protected]
Subject: [PULL 00/15] ppc-for-5.1 queue 20200527
Type: series
=== TEST SCRIPT BEGIN ===
#!/bin/bash
git rev-parse base > /dev/null || exit 0
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram./scripts/checkpatch.pl --mailback base..
=== TEST SCRIPT END ===
Switched to a new branch 'test'
d397549 vfio/nvlink: Remove exec permission to avoid SELinux AVCs d4bfe48 target/ppc: Fix argument to ppc_radix64_partition_scoped_xlate() again 0d637cc hw/nvram/mac_nvram: Convert debug printf()s to trace events 026de79 hw/pci-bridge/dec: Remove dead debug code
8ce2429 target/ppc: Don't update radix PTE R/C bits with gdbstub 480bb39 target/ppc: Fix arguments to ppc_radix64_partition_scoped_xlate() 0743dd0 target/ppc: Add missing braces in ppc_radix64_partition_scoped_xlate() 3f0ffb4 target/ppc: Don't initialize some local variables in ppc_radix64_xlate() a043ed5 target/ppc: Pass const pointer to ppc_radix64_get_fully_qualified_addr() 1496e1d target/ppc: Pass const pointer to ppc_radix64_get_prot_amr() 5af285b ppc/spapr: Add hotremovable flag on DIMM LMBs on drmem_v2 5ae07f3 target/ppc: Add support for scv and rfscv instructions cbc4578 target/ppc: Untabify excp_helper.c
43ec675 ppc/spapr: add a POWER10 CPU model
5824cd4 ppc/pnv: Fix NMI system reset SRR1 value
=== OUTPUT BEGIN ===
1/15 Checking commit 5824cd4e989b (ppc/pnv: Fix NMI system reset SRR1 value)
ERROR: line over 90 characters
#43: FILE: hw/ppc/pnv.c:1994:
+ warn_report("ppc_cpu_do_system_reset does not set system reset wakeup reason");
total: 1 errors, 0 warnings, 32 lines checked
Patch 1/15 has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.
2/15 Checking commit 43ec6753d2c0 (ppc/spapr: add a POWER10 CPU model)
3/15 Checking commit cbc4578bc1b3 (target/ppc: Untabify excp_helper.c)
4/15 Checking commit 5ae07f3461d4 (target/ppc: Add support for scv and rfscv instructions) 5/15 Checking commit 5af285b558e5 (ppc/spapr: Add hotremovable flag on DIMM LMBs on drmem_v2) 6/15 Checking commit 1496e1d11c1f (target/ppc: Pass const pointer to ppc_radix64_get_prot_amr()) 7/15 Checking commit a043ed5475f8 (target/ppc: Pass const pointer to ppc_radix64_get_fully_qualified_addr()) 8/15 Checking commit 3f0ffb47931f (target/ppc: Don't initialize some local variables in ppc_radix64_xlate()) 9/15 Checking commit 0743dd041579 (target/ppc: Add missing braces in ppc_radix64_partition_scoped_xlate()) 10/15 Checking commit 480bb3969730 (target/ppc: Fix arguments to ppc_radix64_partition_scoped_xlate()) 11/15 Checking commit 8ce24299a6e4 (target/ppc: Don't update radix PTE R/C bits with gdbstub) 12/15 Checking commit 026de790313f (hw/pci-bridge/dec: Remove dead debug code)
13/15 Checking commit 0d637cc2e445 (hw/nvram/mac_nvram: Convert debug printf()s to trace events) 14/15 Checking commit d4bfe48202fb (target/ppc: Fix argument to ppc_radix64_partition_scoped_xlate() again) 15/15 Checking commit d397549a63a8 (vfio/nvlink: Remove exec permission to avoid SELinux AVCs) === OUTPUT END ===
Test command exited with code: 1
The full log is available at
http://patchew.org/logs/[email protected]/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to [email protected]
Peter Maydell
AppliedQuoted 25 lines · David Gibson
The following changes since commit
ddc760832fa8cf5e93b9d9e6e854a5114ac63510:Merge remote-tracking branch 'remotes/gkurz/tags/9p-next-2020-05-26' into staging (2020-05-26 14:05:53 +0100)
are available in the Git repository at:
git://github.com/dgibson/qemu.gittags/ppc-for-5.1-20200527for you to fetch changes up to
9c7c0407028355ca83349b8a60fddfad46f2ebd8:vfio/nvlink: Remove exec permission to avoid SELinux AVCs (2020-05-27 15:29:36 +1000)
----------------------------------------------------------------
ppc patch queue 2020-05-27Here's the next pull request for qemu-5.1. It includes:
* Support for the scv and rfscv POWER9 instructions in TCG
* Support for the newSPAPR_LMB_FLAGS_HOTREMOVABLEflag, which provides a way for guests to know memory which should be removable (so the guest can avoid putting immovable allocations there).
* Some fixes for the recently added partition scope radix translation in softmmu
* Assorted minor fixes and cleanups
Quoted 5 lines
It includes one patch to avoid a clash with SELinux when using NVLink VFIO devices. That's not technically within the files under my maintainership, but it is in a section of the VFIO quirks code that's specific to the POWER-only NVLink devices, and has an ack from Alex Williamson.
Applied, thanks.
Please update the changelog at https://wiki.qemu.org/ChangeLog/5.1
for any user-visible changes.
-- PMM