linux_dsm_epyc7002/arch/powerpc/include/asm
Wei Yang 2a58222f82 powerpc/eeh: Fix kernel crash when passing through VF
When doing vfio passthrough a VF, the kernel will crash with following
message:

[  442.656459] Unable to handle kernel paging request for data at address 0x00000060
[  442.656593] Faulting instruction address: 0xc000000000038b88
[  442.656706] Oops: Kernel access of bad area, sig: 11 [#1]
[  442.656798] SMP NR_CPUS=1024 NUMA PowerNV
[  442.656890] Modules linked in: vfio_pci mlx4_core nf_conntrack_netbios_ns nf_conntrack_broadcast ipt_MASQUERADE ip6t_REJECT xt_conntrack bnep bluetooth rfkill ebtable_nat ebtable_broute bridge stp llc ebtable_filter ebtables ip6table_nat nf_conntrack_ipv6 nf_defrag_ipv6 nf_nat_ipv6 ip6table_mangle ip6table_security ip6table_raw ip6table_filter ip6_tables iptable_nat nf_conntrack_ipv4 nf_defrag_ipv4 nf_nat_ipv4 nf_nat nf_conntrack iptable_mangle iptable_security iptable_raw tg3 nfsd be2net nfs_acl ses lockd ptp enclosure pps_core kvm_hv kvm_pr shpchp binfmt_misc kvm sunrpc uinput lpfc scsi_transport_fc ipr scsi_tgt [last unloaded: mlx4_core]
[  442.658152] CPU: 40 PID: 14948 Comm: qemu-system-ppc Not tainted 3.10.42yw-pkvm+ #37
[  442.658219] task: c000000f7e2a9a00 ti: c000000f6dc3c000 task.ti: c000000f6dc3c000
[  442.658287] NIP: c000000000038b88 LR: c0000000004435a8 CTR: c000000000455bc0
[  442.658352] REGS: c000000f6dc3f580 TRAP: 0300   Not tainted  (3.10.42yw-pkvm+)
[  442.658419] MSR: 9000000000009032 <SF,HV,EE,ME,IR,DR,RI>  CR: 28004882  XER: 20000000
[  442.658577] CFAR: c00000000000908c DAR: 0000000000000060 DSISR: 40000000 SOFTE: 1
GPR00: c0000000004435a8 c000000f6dc3f800 c0000000012b1c10 c00000000da24000
GPR04: 0000000000000003 0000000000001004 00000000000015b3 000000000000ffff
GPR08: c00000000127f5d8 0000000000000000 000000000000ffff 0000000000000000
GPR12: c000000000068078 c00000000fdd6800 000001003c320c80 000001003c3607f0
GPR16: 0000000000000001 00000000105480c8 000000001055aaa8 000001003c31ab18
GPR20: 000001003c10fb40 000001003c360ae8 000000001063bcf0 000000001063bdb0
GPR24: 000001003c15ed70 0000000010548f40 c000001fe5514c88 c000001fe5514cb0
GPR28: c00000000da24000 0000000000000000 c00000000da24000 0000000000000003
[  442.659471] NIP [c000000000038b88] .pcibios_set_pcie_reset_state+0x28/0x130
[  442.659530] LR [c0000000004435a8] .pci_set_pcie_reset_state+0x28/0x40
[  442.659585] Call Trace:
[  442.659610] [c000000f6dc3f800] [00000000000719e0] 0x719e0 (unreliable)
[  442.659677] [c000000f6dc3f880] [c0000000004435a8] .pci_set_pcie_reset_state+0x28/0x40
[  442.659757] [c000000f6dc3f900] [c000000000455bf8] .reset_fundamental+0x38/0x80
[  442.659835] [c000000f6dc3f980] [c0000000004562a8] .pci_dev_specific_reset+0xa8/0xf0
[  442.659913] [c000000f6dc3fa00] [c0000000004448c4] .__pci_dev_reset+0x44/0x430
[  442.659980] [c000000f6dc3fab0] [c000000000444d5c] .pci_reset_function+0x7c/0xc0
[  442.660059] [c000000f6dc3fb30] [d00000001c141ab8] .vfio_pci_open+0xe8/0x2b0 [vfio_pci]
[  442.660139] [c000000f6dc3fbd0] [c000000000586c30] .vfio_group_fops_unl_ioctl+0x3a0/0x630
[  442.660219] [c000000f6dc3fc90] [c000000000255fbc] .do_vfs_ioctl+0x4ec/0x7c0
[  442.660286] [c000000f6dc3fd80] [c000000000256364] .SyS_ioctl+0xd4/0xf0
[  442.660354] [c000000f6dc3fe30] [c000000000009e54] syscall_exit+0x0/0x98
[  442.660420] Instruction dump:
[  442.660454] 4bfffce9 4bfffee4 7c0802a6 fbc1fff0 fbe1fff8 f8010010 f821ff81 7c7e1b78
[  442.660566] 7c9f2378 60000000 60000000 e93e02c8 <e8690060> 2fa30000 41de00c4 2b9f0002
[  442.660679] ---[ end trace a64ac9546bcf0328 ]---
[  442.660724]

The reason is current VF is not EEH enabled.

This patch introduces a macro to convert eeh_dev to eeh_pe. By doing so, it
will prevent converting with NULL pointer.

Signed-off-by: Wei Yang <weiyang@linux.vnet.ibm.com>
Acked-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
CC: Michael Ellerman <mpe@ellerman.id.au>

V3 -> V4:
   1. move the macro definition from include/linux/pci.h to
      arch/powerpc/include/asm/eeh.h

V2 -> V3:
   1. rebased on 3.17-rc4
   2. introduce a macro
   3. use this macro in several other places

V1 -> V2:
   1. code style and patch subject adjustment

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
2014-09-25 23:14:56 +10:00
..
8xx_immap.h
agp.h
archrandom.h
asm-compat.h PPC: Add asm helpers for BE 32bit load/store 2014-07-28 15:22:21 +02:00
asm-offsets.h
async_tx.h
atomic.h
backlight.h
barrier.h
bitops.h
bootx.h
btext.h
bug.h powerpc: Remove stale function prototypes 2014-09-25 23:14:43 +10:00
bugs.h
cache.h Use the POWER8 Micro Partition Prefetch Engine in KVM HV on POWER8 2014-07-28 15:23:17 +02:00
cacheflush.h
cell-pmu.h
cell-regs.h
checksum.h
cmpxchg.h
code-patching.h powerpc: Add ppc_global_function_entry() 2014-06-24 14:05:32 +10:00
compat.h
context_tracking.h
cpm1.h
cpm2.h powerpc/cpm: Remove duplicate FCC_GFMR_TTX define 2014-06-11 17:03:28 +10:00
cpm.h
cputable.h powerpc: Add POWER8 features to CPU_FTRS_POSSIBLE/ALWAYS 2014-08-13 15:13:43 +10:00
cputhreads.h
cputime.h
current.h
dbdma.h
dbell.h
dcr-generic.h
dcr-mmio.h
dcr-native.h
dcr-regs.h
dcr.h
debug.h
delay.h
device.h
disassemble.h
div64.h
dma-mapping.h
dma.h
edac.h
eeh_event.h powerpc/powernv: Fix killed EEH event 2014-06-11 17:04:33 +10:00
eeh.h powerpc/eeh: Fix kernel crash when passing through VF 2014-09-25 23:14:56 +10:00
ehv_pic.h
elf.h
emergency-restart.h
emulated_ops.h
epapr_hcalls.h
exception-64e.h
exception-64s.h powerpc/book3s: Add basic infrastructure to handle HMI in Linux. 2014-08-05 16:33:48 +10:00
exec.h
fadump.h
fb.h
feature-fixups.h
firmware.h
fixmap.h
floppy.h
fs_pd.h powerpc/8xx: Remove empty asm/mpc8xx.h 2014-06-25 18:49:40 -05:00
fsl_85xx_cache_sram.h
fsl_gtm.h
fsl_guts.h
fsl_hcalls.h
fsl_lbc.h
fsl_pamu_stash.h
ftrace.h
futex.h
gpio.h
grackle.h
hardirq.h powerpc/book3s: Add basic infrastructure to handle HMI in Linux. 2014-08-05 16:33:48 +10:00
heathrow.h
highmem.h
hugetlb.h
hvcall.h KVM: PPC: Book3S HV: Add H_SET_MODE hcall handling 2014-07-28 15:22:19 +02:00
hvconsole.h
hvcserver.h
hvsi.h
hw_breakpoint.h
hw_irq.h powerpc/book3s: Add basic infrastructure to handle HMI in Linux. 2014-08-05 16:33:48 +10:00
hydra.h powerpc: Remove stale function prototypes 2014-09-25 23:14:43 +10:00
i8259.h
ibmebus.h
ide.h
immap_cpm2.h
immap_qe.h
io_event_irq.h
io-defs.h
io-workarounds.h
io.h
iommu.h
ipic.h
irq_regs.h
irq.h powerpc: Remove stale function prototypes 2014-09-25 23:14:43 +10:00
irqflags.h powerpc: Update comments in irqflags.h 2014-07-28 14:11:23 +10:00
jump_label.h powerpc/pseries: Use jump labels for hcall tracepoints 2014-07-11 16:05:58 +10:00
Kbuild lib/scatterlist: make ARCH_HAS_SG_CHAIN an actual Kconfig 2014-08-08 15:57:26 -07:00
kdebug.h
kdump.h
kexec.h powerpc: Remove stale function prototypes 2014-09-25 23:14:43 +10:00
keylargo.h
kgdb.h
kmap_types.h
kprobes.h
kvm_asm.h Here are the PPC and ARM changes for KVM, which I separated because 2014-08-07 11:35:30 -07:00
kvm_book3s_32.h
kvm_book3s_64.h Patch queue for ppc - 2014-08-01 2014-08-05 09:58:11 +02:00
kvm_book3s_asm.h
kvm_book3s.h KVM: PPC: PR: Handle FSCR feature deselects 2014-07-31 10:23:46 +02:00
kvm_booke_hv_asm.h
kvm_booke.h KVM: PPC: Handle magic page in kvmppc_ld/st 2014-07-28 16:35:53 +02:00
kvm_fpu.h
kvm_host.h KVM: PPC: Remove DCR handling 2014-07-28 19:29:15 +02:00
kvm_para.h
kvm_ppc.h KVM: PPC: BOOKEHV: rename e500hv_spr to bookehv_spr 2014-07-30 11:39:52 +02:00
libata-portmap.h
linkage.h
local64.h
local.h
lppaca.h
lv1call.h
machdep.h powerpc/thp: Don't recompute vsid and ssize in loop on invalidate 2014-08-13 18:20:38 +10:00
macio.h
mc146818rtc.h
mce.h
mediabay.h
mman.h
mmu_context.h powerpc: Remove MMU_FTR_SLB 2014-07-28 14:10:23 +10:00
mmu-8xx.h
mmu-40x.h
mmu-44x.h
mmu-book3e.h KVM: PPC: Book3e: Add TLBSEL/TSIZE defines for MAS0/1 2014-07-28 15:23:13 +02:00
mmu-hash32.h
mmu-hash64.h powerpc: Move htab_remove_mapping function prototype into header file 2014-09-25 23:14:44 +10:00
mmu.h powerpc: Remove MMU_FTR_SLB 2014-07-28 14:10:23 +10:00
mmzone.h
module.h
mpc5xxx.h
mpc6xx.h
mpc52xx_psc.h
mpc52xx.h
mpc85xx.h powerpc/fsl-booke: Add support for T2080/T2081 SoC 2014-07-02 17:32:41 -05:00
mpc5121.h
mpc8260.h
mpic_msgr.h
mpic_timer.h
mpic.h
msi_bitmap.h
mutex.h
nvram.h
ohare.h
opal.h powerpc/powernv: Add OPAL check token call 2014-09-25 23:14:35 +10:00
oprofile_impl.h powerpc: Remove oprofile RS64 support 2014-07-28 14:10:25 +10:00
paca.h powerpc/powernv: Invoke opal call to handle hmi. 2014-08-05 16:33:52 +10:00
page_32.h
page_64.h powerpc: Remove stale function prototypes 2014-09-25 23:14:43 +10:00
page.h arm64,ia64,ppc,s390,sh,tile,um,x86,mm: remove default gate area 2014-08-08 15:57:27 -07:00
parport.h
pasemi_dma.h
pci-bridge.h
pci.h
percpu.h
perf_event_fsl_emb.h
perf_event_server.h powerpc/perf: Pass the struct perf_events down to compute_mmcr() 2014-07-28 14:30:47 +10:00
perf_event.h
pgalloc-32.h
pgalloc-64.h
pgalloc.h
pgtable-ppc32.h powerpc: Remove stale function prototypes 2014-09-25 23:14:43 +10:00
pgtable-ppc64-4k.h
pgtable-ppc64-64k.h
pgtable-ppc64.h powerpc/thp: Handle combo pages in invalidate 2014-08-13 18:20:39 +10:00
pgtable.h
plpar_wrappers.h
pmac_feature.h
pmac_low_i2c.h
pmac_pfunc.h
pmc.h
pmi.h
ppc4xx_ocm.h
ppc4xx.h
ppc_asm.h PPC: Add _GLOBAL_TOC for 32bit 2014-06-26 13:19:42 +02:00
ppc-opcode.h Here are the PPC and ARM changes for KVM, which I separated because 2014-08-07 11:35:30 -07:00
ppc-pci.h
probes.h
processor.h arch, locking: Ciao arch_mutex_cpu_relax() 2014-07-17 12:32:47 +02:00
prom.h powerpc: Remove stale function prototypes 2014-09-25 23:14:43 +10:00
ps3.h
ps3av.h
ps3gpu.h
ps3stor.h
pte-8xx.h
pte-40x.h
pte-44x.h
pte-book3e.h
pte-common.h
pte-fsl-booke.h booke/powerpc: define wimge shift mask to fix compilation error 2014-06-25 18:49:39 -05:00
pte-hash32.h
pte-hash64-4k.h
pte-hash64-64k.h powerpc/mm: Use read barrier when creating real_pte 2014-08-13 18:20:41 +10:00
pte-hash64.h
ptrace.h powerpc/perf: Fix ABIv2 kernel backtraces 2014-09-09 19:02:45 +10:00
qe_ic.h
qe.h
reg_8xx.h
reg_a2.h
reg_booke.h powerpc/e6500: Add support for hardware threads 2014-07-29 19:26:20 -05:00
reg_fsl_emb.h
reg.h powerpc: remove duplicate definition of TEXASR_FS 2014-08-13 15:13:47 +10:00
rheap.h
rio.h powerpc: Remove stale function prototypes 2014-09-25 23:14:43 +10:00
rtas.h
rtc.h
runlatch.h
scom.h
sections.h
serial.h
setjmp.h
setup.h
sfp-machine.h
shmparam.h
signal.h
smp.h
smu.h
sparsemem.h
spinlock_types.h
spinlock.h powerpc: Add smp_mb() to arch_spin_is_locked() 2014-08-13 15:13:26 +10:00
spu_csa.h
spu_info.h
spu_priv1.h
spu.h
sstep.h powerpc: Emulate icbi, mcrf and conditional-trap instructions 2014-09-25 23:14:51 +10:00
string.h
swab.h powerpc: Remove __arch_swab* 2014-06-24 12:43:15 +10:00
swiotlb.h
switch_to.h powerpc/perf: Ensure all EBB register state is cleared on fork() 2014-06-11 17:03:41 +10:00
synch.h
syscall.h
syscalls.h
systbl.h powerpc: Wire up sys_seccomp(), sys_getrandom() and sys_memfd_create() 2014-09-09 19:02:47 +10:00
tce.h
termios.h
thread_info.h
time.h KVM: PPC: BOOK3S: PR: Emulate virtual timebase register 2014-07-28 15:21:50 +02:00
timex.h
tlb.h
tlbflush.h
tm.h
topology.h
trace.h powernv: Add OPAL tracepoints 2014-07-11 16:06:08 +10:00
tsi108_irq.h
tsi108_pci.h
tsi108.h powerpc: Remove stale function prototypes 2014-09-25 23:14:43 +10:00
types.h
uaccess.h
ucc_fast.h
ucc_slow.h
ucc.h
udbg.h powerpc: Remove stale function prototypes 2014-09-25 23:14:43 +10:00
uic.h
unaligned.h
uninorth.h
unistd.h powerpc: Wire up sys_seccomp(), sys_getrandom() and sys_memfd_create() 2014-09-09 19:02:47 +10:00
uprobes.h
user.h
vdso_datapage.h
vdso.h
vga.h
vio.h
word-at-a-time.h
xics.h powerpc/powernv: Don't call generic code on offline cpus 2014-09-25 23:14:50 +10:00
xilinx_intc.h
xilinx_pci.h
xmon.h
xor.h