linux/drivers/video
Konrad Rzeszutek Wilk 51c71a3bba xen/pvhvm: If xen_platform_pci=0 is set don't blow up (v4).
The user has the option of disabling the platform driver:
00:02.0 Unassigned class [ff80]: XenSource, Inc. Xen Platform Device (rev 01)

which is used to unplug the emulated drivers (IDE, Realtek 8169, etc)
and allow the PV drivers to take over. If the user wishes
to disable that they can set:

  xen_platform_pci=0
  (in the guest config file)

or
  xen_emul_unplug=never
  (on the Linux command line)

except it does not work properly. The PV drivers still try to
load and since the Xen platform driver is not run - and it
has not initialized the grant tables, most of the PV drivers
stumble upon:

input: Xen Virtual Keyboard as /devices/virtual/input/input5
input: Xen Virtual Pointer as /devices/virtual/input/input6M
------------[ cut here ]------------
kernel BUG at /home/konrad/ssd/konrad/linux/drivers/xen/grant-table.c:1206!
invalid opcode: 0000 [#1] SMP
Modules linked in: xen_kbdfront(+) xenfs xen_privcmd
CPU: 6 PID: 1389 Comm: modprobe Not tainted 3.13.0-rc1upstream-00021-ga6c892b-dirty #1
Hardware name: Xen HVM domU, BIOS 4.4-unstable 11/26/2013
RIP: 0010:[<ffffffff813ddc40>]  [<ffffffff813ddc40>] get_free_entries+0x2e0/0x300
Call Trace:
 [<ffffffff8150d9a3>] ? evdev_connect+0x1e3/0x240
 [<ffffffff813ddd0e>] gnttab_grant_foreign_access+0x2e/0x70
 [<ffffffffa0010081>] xenkbd_connect_backend+0x41/0x290 [xen_kbdfront]
 [<ffffffffa0010a12>] xenkbd_probe+0x2f2/0x324 [xen_kbdfront]
 [<ffffffff813e5757>] xenbus_dev_probe+0x77/0x130
 [<ffffffff813e7217>] xenbus_frontend_dev_probe+0x47/0x50
 [<ffffffff8145e9a9>] driver_probe_device+0x89/0x230
 [<ffffffff8145ebeb>] __driver_attach+0x9b/0xa0
 [<ffffffff8145eb50>] ? driver_probe_device+0x230/0x230
 [<ffffffff8145eb50>] ? driver_probe_device+0x230/0x230
 [<ffffffff8145cf1c>] bus_for_each_dev+0x8c/0xb0
 [<ffffffff8145e7d9>] driver_attach+0x19/0x20
 [<ffffffff8145e260>] bus_add_driver+0x1a0/0x220
 [<ffffffff8145f1ff>] driver_register+0x5f/0xf0
 [<ffffffff813e55c5>] xenbus_register_driver_common+0x15/0x20
 [<ffffffff813e76b3>] xenbus_register_frontend+0x23/0x40
 [<ffffffffa0015000>] ? 0xffffffffa0014fff
 [<ffffffffa001502b>] xenkbd_init+0x2b/0x1000 [xen_kbdfront]
 [<ffffffff81002049>] do_one_initcall+0x49/0x170

.. snip..

which is hardly nice. This patch fixes this by having each
PV driver check for:
 - if running in PV, then it is fine to execute (as that is their
   native environment).
 - if running in HVM, check if user wanted 'xen_emul_unplug=never',
   in which case bail out and don't load any PV drivers.
 - if running in HVM, and if PCI device 5853:0001 (xen_platform_pci)
   does not exist, then bail out and not load PV drivers.
 - (v2) if running in HVM, and if the user wanted 'xen_emul_unplug=ide-disks',
   then bail out for all PV devices _except_ the block one.
   Ditto for the network one ('nics').
 - (v2) if running in HVM, and if the user wanted 'xen_emul_unplug=unnecessary'
   then load block PV driver, and also setup the legacy IDE paths.
   In (v3) make it actually load PV drivers.

Reported-by: Sander Eikelenboom <linux@eikelenboom.it
Reported-by: Anthony PERARD <anthony.perard@citrix.com>
Reported-and-Tested-by: Fabio Fantoni <fabio.fantoni@m2r.biz>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
[v2: Add extra logic to handle the myrid ways 'xen_emul_unplug'
can be used per Ian and Stefano suggestion]
[v3: Make the unnecessary case work properly]
[v4: s/disks/ide-disks/ spotted by Fabio]
Reviewed-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Bjorn Helgaas <bhelgaas@google.com> [for PCI parts]
CC: stable@vger.kernel.org
2014-01-03 14:54:18 -05:00
..
aty framebuffer: Use fb_<level> 2013-10-29 12:53:07 +02:00
backlight pwm: Changes for v3.13-rc1 2013-11-16 12:21:40 -08:00
console parisc: sticon - unbreak on 64bit kernel 2013-11-07 22:46:20 +01:00
exynos ARM: SoC fixes for 3.13 merge window 2013-11-16 12:45:55 -08:00
geode framebuffer: Use fb_<level> 2013-10-29 12:53:07 +02:00
i810 video: i810fb: remove unnecessary pci_set_drvdata() 2013-09-19 13:30:07 +03:00
intelfb video: intelfb: remove unnecessary pci_set_drvdata() 2013-09-19 13:30:07 +03:00
kyro video: kyro: fix incorrect sizes when copying to userspace 2013-11-26 16:40:14 +02:00
logo Bye, bye, WfW flag 2013-09-11 19:55:12 -07:00
matrox video: Remove unnecessary semicolons 2013-10-30 13:34:52 +02:00
mb862xx video: mb862xx: Remove redundant dev_set_drvdata 2013-09-26 13:49:09 +03:00
mbx framebuffer: Use fb_<level> 2013-10-29 12:53:07 +02:00
mmp fbdev changes for 3.13 2013-11-14 14:44:20 +09:00
msm ARM: msm: Move mach/board.h contents to common.h 2013-08-06 11:18:02 -07:00
nvidia video: Remove unnecessary semicolons 2013-10-30 13:34:52 +02:00
omap video: omapfb: use dev_get_platdata() 2013-09-20 12:22:01 +03:00
omap2 ARM: OMAPFB: panel-sony-acx565akm: fix bad unlock balance 2013-11-26 12:49:17 +02:00
riva video: riva: Remove incorrect checks 2013-09-26 11:52:31 +03:00
savage video: savagefb: remove unnecessary pci_set_drvdata() 2013-09-19 13:30:09 +03:00
sis fbdev changes for 3.13 2013-11-14 14:44:20 +09:00
vermilion fbdev/vermillion: use vm_iomap_memory() 2013-04-24 08:41:42 +03:00
via
68328fb.c framebuffer: Use fb_<level> 2013-10-29 12:53:07 +02:00
Kconfig Merge branch 'drm-next' of git://people.freedesktop.org/~airlied/linux 2013-11-15 14:19:54 +09:00
Makefile lib: Move fonts from drivers/video/console/ to lib/fonts/ 2013-06-28 10:28:22 +02:00
acornfb.c drivers/video/acornfb.c: use __free_reserved_page() to simplify the code 2013-11-13 12:09:03 +09:00
acornfb.h drivers/video/acornfb.c: remove dead code 2013-09-11 15:56:22 -07:00
amba-clcd.c fbdev changes for 3.13 2013-11-14 14:44:20 +09:00
amifb.c framebuffer: Use fb_<level> 2013-10-29 12:53:07 +02:00
arcfb.c framebuffer: Use fb_<level> 2013-10-29 12:53:07 +02:00
arkfb.c framebuffer: Use fb_<level> 2013-10-29 12:53:07 +02:00
asiliantfb.c framebuffer: Use fb_<level> 2013-10-29 12:53:07 +02:00
atafb.c framebuffer: Use fb_<level> 2013-10-29 12:53:07 +02:00
atafb.h
atafb_iplan2p2.c
atafb_iplan2p4.c
atafb_iplan2p8.c
atafb_mfb.c
atafb_utils.h
atmel_lcdfb.c atmel_lcdfb: fix module autoload 2013-12-04 10:48:12 +02:00
au1100fb.c fbdev changes for 3.13 2013-11-14 14:44:20 +09:00
au1100fb.h
au1200fb.c fbdev changes for 3.13 2013-11-14 14:44:20 +09:00
au1200fb.h
auo_k190x.c Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial 2013-04-30 09:36:50 -07:00
auo_k190x.h
auo_k1900fb.c
auo_k1901fb.c
bf54x-lq043fb.c Video / bf54x-lq043fb: Use module_platform_driver() to simplify code 2013-09-30 10:51:09 +03:00
bf537-lq035.c
bfin-lq035q1-fb.c fbdev: bfin-lq035q1-fb: Use dev_pm_ops 2013-06-26 16:16:26 +03:00
bfin-t350mcqb-fb.c Video / bfin-t350mcqb-fb: Use module_platform_driver() to simplify code 2013-09-30 10:51:08 +03:00
bfin_adv7393fb.c
bfin_adv7393fb.h
broadsheetfb.c framebuffer: Use fb_<level> 2013-10-29 12:53:07 +02:00
bt431.h
bt455.h
bw2.c video: bw2: Remove redundant dev_set_drvdata 2013-09-26 13:49:22 +03:00
c2p.h
c2p_core.h
c2p_iplan2.c
c2p_planar.c
carminefb.c framebuffer: Use fb_<level> 2013-10-29 12:53:07 +02:00
carminefb.h
carminefb_regs.h
cfbcopyarea.c
cfbfillrect.c
cfbimgblt.c video: Remove unnecessary semicolons 2013-10-30 13:34:52 +02:00
cg3.c video: cg3: Remove redundant dev_set_drvdata 2013-09-26 13:49:23 +03:00
cg6.c video: Remove unnecessary semicolons 2013-10-30 13:34:52 +02:00
cg14.c video: Remove unnecessary semicolons 2013-10-30 13:34:52 +02:00
chipsfb.c
cirrusfb.c video: cirrusfb: Remove incorrect checks 2013-09-26 11:52:31 +03:00
clps711xfb.c
cobalt_lcdfb.c framebuffer: Use fb_<level> 2013-10-29 12:53:07 +02:00
controlfb.c framebuffer: Use fb_<level> 2013-10-29 12:53:07 +02:00
controlfb.h
cyber2000fb.c fbdev changes for 3.13 2013-11-14 14:44:20 +09:00
cyber2000fb.h
da8xx-fb.c video: da8xx-fb: remove unwanted define 2013-10-30 13:36:48 +02:00
display_timing.c
dnfb.c
edid.h
efifb.c framebuffer: Use fb_<level> 2013-10-29 12:53:07 +02:00
ep93xx-fb.c video: ep93xx-fb: use dev_get_platdata() 2013-09-20 12:22:02 +03:00
fb-puv3.c framebuffer: Use fb_<level> 2013-10-29 12:53:07 +02:00
fb_ddc.c
fb_defio.c
fb_draw.h
fb_notify.c
fb_sys_fops.c
fbcmap.c drivers: video: fbcmap: remove the redundency and incorrect checkings 2013-08-30 11:41:24 +03:00
fbcvt.c
fbmem.c fb: reorder the lock sequence to fix potential dead lock 2013-11-11 15:52:59 +02:00
fbmon.c Merge branch '3.10/fb-mmap' into for-next 2013-04-26 09:14:47 +03:00
fbsysfs.c fb: reorder the lock sequence to fix potential dead lock 2013-11-11 15:52:59 +02:00
ffb.c video: ffb: Remove redundant dev_set_drvdata 2013-09-26 13:49:24 +03:00
fm2fb.c framebuffer: Use fb_<level> 2013-10-29 12:53:07 +02:00
fsl-diu-fb.c fbdev changes for 3.13 2013-11-14 14:44:20 +09:00
g364fb.c
gbefb.c framebuffer: Use fb_<level> 2013-10-29 12:53:07 +02:00
goldfishfb.c
grvga.c video: grvga: Remove redundant dev_set_drvdata 2013-09-26 13:49:07 +03:00
gxt4500.c framebuffer: Use fb_<level> 2013-10-29 12:53:07 +02:00
hdmi.c video/hdmi: Rename HDMI_IDENTIFIER to HDMI_IEEE_OUI 2013-08-30 08:42:01 +10:00
hecubafb.c framebuffer: Use fb_<level> 2013-10-29 12:53:07 +02:00
hgafb.c framebuffer: Use fb_<level> 2013-10-29 12:53:07 +02:00
hitfb.c framebuffer: Use fb_<level> 2013-10-29 12:53:07 +02:00
hpfb.c framebuffer: Use fb_<level> 2013-10-29 12:53:07 +02:00
hyperv_fb.c hyperv-fb: add blanking support 2013-10-09 12:52:50 +03:00
i740_reg.h
i740fb.c framebuffer: Use fb_<level> 2013-10-29 12:53:07 +02:00
igafb.c framebuffer: Use fb_<level> 2013-10-29 12:53:07 +02:00
imsttfb.c framebuffer: Use fb_<level> 2013-10-29 12:53:07 +02:00
imxfb.c video: imxfb: use dev_get_platdata() 2013-09-20 12:22:03 +03:00
jz4740_fb.c Video / jz4740_fb: Use module_platform_driver() to simplify code 2013-09-30 10:51:09 +03:00
leo.c video: Remove unnecessary semicolons 2013-10-30 13:34:52 +02:00
macfb.c framebuffer: Use fb_<level> 2013-10-29 12:53:07 +02:00
macmodes.c
macmodes.h
maxinefb.c
metronomefb.c fbdev: fix error return code in metronomefb_probe() 2013-10-29 12:20:11 +02:00
modedb.c
mx3fb.c video: mx3fb: use dev_get_platdata() 2013-09-20 12:22:01 +03:00
mxsfb.c video: mxsfb: Add missing break 2013-09-26 15:33:23 +03:00
n411.c
neofb.c fbdev changes for 3.13 2013-11-14 14:44:20 +09:00
nuc900fb.c framebuffer: Use fb_<level> 2013-10-29 12:53:07 +02:00
nuc900fb.h
of_display_timing.c video: of: display_timing: correct display-timings node finding 2013-09-26 12:31:42 +03:00
of_videomode.c
offb.c offb: Add palette hack for little endian 2013-12-10 11:25:07 +11:00
output.c video: output: convert class code to use dev_groups 2013-07-26 10:37:02 +03:00
p9100.c video: p9100: Remove redundant dev_set_drvdata 2013-09-26 13:49:25 +03:00
platinumfb.c framebuffer: Use fb_<level> 2013-10-29 12:53:07 +02:00
platinumfb.h
pm2fb.c framebuffer: Use fb_<level> 2013-10-29 12:53:07 +02:00
pm3fb.c framebuffer: Use fb_<level> 2013-10-29 12:53:07 +02:00
pmag-aa-fb.c
pmag-ba-fb.c framebuffer: Use fb_<level> 2013-10-29 12:53:07 +02:00
pmagb-b-fb.c framebuffer: Use fb_<level> 2013-10-29 12:53:07 +02:00
ps3fb.c fbdev/ps3fb: Fix section mismatch warning for ps3fb_probe 2013-09-11 11:39:39 +10:00
pvr2fb.c framebuffer: Use fb_<level> 2013-10-29 12:53:07 +02:00
pxa3xx-gcu.c Various fbdev changes for 3.11 2013-07-09 15:51:32 -07:00
pxa3xx-gcu.h
pxa168fb.c video: pxa168fb: use dev_get_platdata() 2013-09-20 12:22:01 +03:00
pxa168fb.h
pxafb.c video: pxafb: use dev_get_platdata() 2013-09-20 12:22:02 +03:00
pxafb.h
q40fb.c framebuffer: Use fb_<level> 2013-10-29 12:53:07 +02:00
s1d13xxxfb.c framebuffer: Use fb_<level> 2013-10-29 12:53:07 +02:00
s3c-fb.c video: s3c-fb: use dev_get_platdata() 2013-09-20 12:23:21 +03:00
s3c2410fb.c video: s3c2410: use dev_get_platdata() 2013-09-20 12:22:02 +03:00
s3c2410fb.h
s3fb.c fbdev changes for 3.13 2013-11-14 14:44:20 +09:00
sa1100fb.c video: sa1100fb: use dev_get_platdata() 2013-09-20 12:22:02 +03:00
sa1100fb.h
sbuslib.c video: Remove unnecessary semicolons 2013-10-30 13:34:52 +02:00
sbuslib.h
sgivwfb.c framebuffer: Use fb_<level> 2013-10-29 12:53:07 +02:00
sh7760fb.c video: sh7760fb: fix to pass correct device identity to free_irq() 2013-07-29 11:25:03 +03:00
sh_mipi_dsi.c video: remove unnecessary platform_set_drvdata() 2013-06-26 14:44:40 +03:00
sh_mobile_hdmi.c fbdev: shmobile-hdmi: Convert to clk_prepare/unprepare 2013-11-11 15:32:58 +02:00
sh_mobile_lcdcfb.c fb: reorder the lock sequence to fix potential dead lock 2013-11-11 15:52:59 +02:00
sh_mobile_lcdcfb.h
sh_mobile_meram.c fbdev: sh_mobile_meram: Fix defined but not used compiler warnings 2013-11-26 16:59:42 +02:00
simplefb.c simplefb: use write-combined remapping 2013-10-30 12:49:02 +02:00
skeletonfb.c framebuffer: Use fb_<level> 2013-10-29 12:53:07 +02:00
sm501fb.c
smscufx.c video: smscufx: Use NULL instead of 0 2013-09-26 11:50:08 +03:00
ssd1307fb.c video: ssd1307fb: Remove redundant of_match_ptr 2013-10-09 12:35:44 +03:00
sstfb.c framebuffer: Use fb_<level> 2013-10-29 12:53:07 +02:00
sticore.h parisc: sticon - unbreak on 64bit kernel 2013-11-07 22:46:20 +01:00
stifb.c fbdev changes for 3.13 2013-11-14 14:44:20 +09:00
sunxvr500.c
sunxvr1000.c video: sunxvr1000: Remove redundant dev_set_drvdata 2013-09-26 13:49:26 +03:00
sunxvr2500.c
svgalib.c framebuffer: Use fb_<level> 2013-10-29 12:53:07 +02:00
syscopyarea.c
sysfillrect.c
sysimgblt.c video: Remove unnecessary semicolons 2013-10-30 13:34:52 +02:00
tcx.c video: Remove unnecessary semicolons 2013-10-30 13:34:52 +02:00
tdfxfb.c video: tdfxfb: remove unnecessary pci_set_drvdata() 2013-09-19 13:30:10 +03:00
tgafb.c framebuffer: Use fb_<level> 2013-10-29 12:53:07 +02:00
tmiofb.c framebuffer: Use fb_<level> 2013-10-29 12:53:07 +02:00
tridentfb.c video: tridentfb: remove unnecessary pci_set_drvdata() 2013-09-19 13:30:10 +03:00
udlfb.c video: udlfb: Use NULL instead of 0 2013-09-26 11:50:07 +03:00
uvesafb.c framebuffer: Use fb_<level> 2013-10-29 12:53:07 +02:00
valkyriefb.c framebuffer: Use fb_<level> 2013-10-29 12:53:07 +02:00
valkyriefb.h
vesafb.c framebuffer: Use fb_<level> 2013-10-29 12:53:07 +02:00
vfb.c framebuffer: Use fb_<level> 2013-10-29 12:53:07 +02:00
vga16fb.c framebuffer: Use fb_<level> 2013-10-29 12:53:07 +02:00
vgastate.c
videomode.c
vt8500lcdfb.c video: vt8500: fix error handling in probe() 2013-12-04 10:50:16 +02:00
vt8500lcdfb.h
vt8623fb.c framebuffer: Use fb_<level> 2013-10-29 12:53:07 +02:00
w100fb.c framebuffer: Use fb_<level> 2013-10-29 12:53:07 +02:00
w100fb.h
wm8505fb.c framebuffer: Use fb_<level> 2013-10-29 12:53:07 +02:00
wm8505fb_regs.h
wmt_ge_rops.c video: wmt_ge_rops: Fix a trivial typo 2013-10-09 12:35:46 +03:00
wmt_ge_rops.h
xen-fbfront.c xen/pvhvm: If xen_platform_pci=0 is set don't blow up (v4). 2014-01-03 14:54:18 -05:00
xilinxfb.c video: xilinxfb: Fix for "Use standard variable name convention" 2013-10-29 10:49:40 +02:00