From 2f906ed085328557f63bd2a5eb29153176af05da Mon Sep 17 00:00:00 2001 From: Ben Skeggs Date: Thu, 28 Jul 2011 10:17:40 +1000 Subject: [PATCH] --- yaml --- r: 282558 b: refs/heads/master c: 0c101461e267850925218d6a6872c379f2498b16 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/MAINTAINERS | 13 +- trunk/drivers/gpu/drm/exynos/Makefile | 3 +- .../drivers/gpu/drm/exynos/exynos_drm_crtc.c | 59 +- trunk/drivers/gpu/drm/exynos/exynos_drm_drv.c | 29 +- trunk/drivers/gpu/drm/exynos/exynos_drm_drv.h | 14 +- .../gpu/drm/exynos/exynos_drm_encoder.c | 135 +- .../gpu/drm/exynos/exynos_drm_encoder.h | 5 - trunk/drivers/gpu/drm/exynos/exynos_drm_fb.c | 20 +- trunk/drivers/gpu/drm/exynos/exynos_drm_fb.h | 4 +- .../drivers/gpu/drm/exynos/exynos_drm_fbdev.c | 14 +- .../drivers/gpu/drm/exynos/exynos_drm_fimd.c | 216 +--- .../drivers/gpu/drm/exynos/exynos_drm_plane.c | 163 --- .../drivers/gpu/drm/exynos/exynos_drm_plane.h | 14 - trunk/drivers/gpu/drm/nouveau/nouveau_drv.h | 1 + trunk/drivers/gpu/drm/nouveau/nouveau_perf.c | 4 +- trunk/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h | 5 - trunk/drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c | 8 +- trunk/drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c | 16 +- trunk/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 390 +++--- trunk/drivers/gpu/drm/vmwgfx/vmwgfx_kms.h | 5 - trunk/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c | 22 +- .../drivers/gpu/drm/vmwgfx/vmwgfx_resource.c | 23 - trunk/drivers/i2c/busses/i2c-eg20t.c | 22 +- trunk/drivers/i2c/busses/i2c-omap.c | 11 +- trunk/drivers/i2c/busses/i2c-s3c2410.c | 3 +- trunk/drivers/pci/ats.c | 1 - trunk/drivers/pci/hotplug/acpiphp_glue.c | 30 +- trunk/drivers/pci/iov.c | 7 - trunk/drivers/pci/pci.c | 9 +- trunk/drivers/s390/scsi/zfcp_scsi.c | 4 - trunk/drivers/scsi/bnx2i/bnx2i_hwi.c | 5 +- trunk/drivers/scsi/fcoe/fcoe.c | 116 -- trunk/drivers/scsi/fcoe/fcoe_ctlr.c | 4 - trunk/drivers/scsi/mpt2sas/mpt2sas_scsih.c | 2 +- trunk/drivers/scsi/qla2xxx/qla_attr.c | 27 +- trunk/drivers/scsi/qla2xxx/qla_dbg.c | 8 +- trunk/drivers/scsi/qla2xxx/qla_gbl.h | 1 - trunk/drivers/scsi/qla2xxx/qla_init.c | 3 +- trunk/drivers/scsi/qla2xxx/qla_iocb.c | 14 +- trunk/drivers/scsi/qla2xxx/qla_isr.c | 2 +- trunk/drivers/scsi/qla2xxx/qla_mbx.c | 25 +- trunk/drivers/scsi/qla2xxx/qla_nx.c | 42 +- trunk/drivers/scsi/qla2xxx/qla_nx.h | 4 - trunk/drivers/scsi/qla2xxx/qla_os.c | 86 +- trunk/drivers/scsi/qla2xxx/qla_version.h | 2 +- trunk/drivers/scsi/qla4xxx/ql4_def.h | 55 +- trunk/drivers/scsi/qla4xxx/ql4_fw.h | 8 - trunk/drivers/scsi/qla4xxx/ql4_glbl.h | 16 +- trunk/drivers/scsi/qla4xxx/ql4_init.c | 243 +--- trunk/drivers/scsi/qla4xxx/ql4_mbx.c | 11 - trunk/drivers/scsi/qla4xxx/ql4_os.c | 1084 +---------------- trunk/drivers/scsi/qla4xxx/ql4_version.h | 2 +- trunk/include/drm/exynos_drm.h | 10 - trunk/include/scsi/libfcoe.h | 3 - trunk/kernel/events/core.c | 8 +- trunk/kernel/sched_fair.c | 14 +- 57 files changed, 539 insertions(+), 2508 deletions(-) delete mode 100644 trunk/drivers/gpu/drm/exynos/exynos_drm_plane.c delete mode 100644 trunk/drivers/gpu/drm/exynos/exynos_drm_plane.h diff --git a/[refs] b/[refs] index fc609e63490b..6ed36a731454 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 4cf73129cbe001b41be2f8b56f763fbf3acaa4ce +refs/heads/master: 0c101461e267850925218d6a6872c379f2498b16 diff --git a/trunk/MAINTAINERS b/trunk/MAINTAINERS index 855afd479156..b9db108f01c8 100644 --- a/trunk/MAINTAINERS +++ b/trunk/MAINTAINERS @@ -3101,7 +3101,6 @@ F: include/linux/hid* HIGH-RESOLUTION TIMERS, CLOCKEVENTS, DYNTICKS M: Thomas Gleixner -T: git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git timers/core S: Maintained F: Documentation/timers/ F: kernel/hrtimer.c @@ -3611,7 +3610,7 @@ F: net/irda/ IRQ SUBSYSTEM M: Thomas Gleixner S: Maintained -T: git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git irq/core +T: git git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip.git irq/core F: kernel/irq/ ISAPNP @@ -4099,7 +4098,7 @@ F: drivers/hwmon/lm90.c LOCKDEP AND LOCKSTAT M: Peter Zijlstra M: Ingo Molnar -T: git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git core/locking +T: git git://git.kernel.org/pub/scm/linux/kernel/git/peterz/linux-2.6-lockdep.git S: Maintained F: Documentation/lockdep*.txt F: Documentation/lockstat.txt @@ -5087,7 +5086,6 @@ M: Peter Zijlstra M: Paul Mackerras M: Ingo Molnar M: Arnaldo Carvalho de Melo -T: git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf/core S: Supported F: kernel/events/* F: include/linux/perf_event.h @@ -5167,7 +5165,6 @@ F: drivers/scsi/pm8001/ POSIX CLOCKS and TIMERS M: Thomas Gleixner -T: git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git timers/core S: Supported F: fs/timerfd.c F: include/linux/timer* @@ -5683,7 +5680,6 @@ F: drivers/dma/dw_dmac.c TIMEKEEPING, NTP M: John Stultz M: Thomas Gleixner -T: git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git timers/core S: Supported F: include/linux/clocksource.h F: include/linux/time.h @@ -5708,7 +5704,6 @@ F: drivers/watchdog/sc1200wdt.c SCHEDULER M: Ingo Molnar M: Peter Zijlstra -T: git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git sched/core S: Maintained F: kernel/sched* F: include/linux/sched.h @@ -6636,7 +6631,7 @@ TRACING M: Steven Rostedt M: Frederic Weisbecker M: Ingo Molnar -T: git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf/core +T: git git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip.git perf/core S: Maintained F: Documentation/trace/ftrace.txt F: arch/*/*/*/ftrace.h @@ -7386,7 +7381,7 @@ M: Thomas Gleixner M: Ingo Molnar M: "H. Peter Anvin" M: x86@kernel.org -T: git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86/core +T: git git://git.kernel.org/pub/scm/linux/kernel/git/x86/linux-2.6-x86.git S: Maintained F: Documentation/x86/ F: arch/x86/ diff --git a/trunk/drivers/gpu/drm/exynos/Makefile b/trunk/drivers/gpu/drm/exynos/Makefile index c99127214f8e..0496d3ff2683 100644 --- a/trunk/drivers/gpu/drm/exynos/Makefile +++ b/trunk/drivers/gpu/drm/exynos/Makefile @@ -5,8 +5,7 @@ ccflags-y := -Iinclude/drm -Idrivers/gpu/drm/exynos exynosdrm-y := exynos_drm_drv.o exynos_drm_encoder.o exynos_drm_connector.o \ exynos_drm_crtc.o exynos_drm_fbdev.o exynos_drm_fb.o \ - exynos_drm_buf.o exynos_drm_gem.o exynos_drm_core.o \ - exynos_drm_plane.o + exynos_drm_buf.o exynos_drm_gem.o exynos_drm_core.o obj-$(CONFIG_DRM_EXYNOS) += exynosdrm.o obj-$(CONFIG_DRM_EXYNOS_FIMD) += exynos_drm_fimd.o diff --git a/trunk/drivers/gpu/drm/exynos/exynos_drm_crtc.c b/trunk/drivers/gpu/drm/exynos/exynos_drm_crtc.c index e1ce9fd5a160..7777d41d1cda 100644 --- a/trunk/drivers/gpu/drm/exynos/exynos_drm_crtc.c +++ b/trunk/drivers/gpu/drm/exynos/exynos_drm_crtc.c @@ -52,13 +52,11 @@ * drm framework doesn't support multiple irq yet. * we can refer to the crtc to current hardware interrupt occured through * this pipe value. - * @dpms: store the crtc dpms value */ struct exynos_drm_crtc { struct drm_crtc drm_crtc; struct exynos_drm_overlay overlay; unsigned int pipe; - unsigned int dpms; }; static void exynos_drm_crtc_apply(struct drm_crtc *crtc) @@ -155,37 +153,26 @@ static int exynos_drm_crtc_update(struct drm_crtc *crtc) static void exynos_drm_crtc_dpms(struct drm_crtc *crtc, int mode) { - struct drm_device *dev = crtc->dev; struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc); DRM_DEBUG_KMS("crtc[%d] mode[%d]\n", crtc->base.id, mode); - if (exynos_crtc->dpms == mode) { - DRM_DEBUG_KMS("desired dpms mode is same as previous one.\n"); - return; - } - - mutex_lock(&dev->struct_mutex); - switch (mode) { case DRM_MODE_DPMS_ON: - exynos_drm_fn_encoder(crtc, &mode, - exynos_drm_encoder_crtc_dpms); - exynos_crtc->dpms = mode; + exynos_drm_fn_encoder(crtc, &exynos_crtc->pipe, + exynos_drm_encoder_crtc_commit); break; case DRM_MODE_DPMS_STANDBY: case DRM_MODE_DPMS_SUSPEND: case DRM_MODE_DPMS_OFF: - exynos_drm_fn_encoder(crtc, &mode, - exynos_drm_encoder_crtc_dpms); - exynos_crtc->dpms = mode; + /* TODO */ + exynos_drm_fn_encoder(crtc, NULL, + exynos_drm_encoder_crtc_disable); break; default: - DRM_ERROR("unspecified mode %d\n", mode); + DRM_DEBUG_KMS("unspecified mode %d\n", mode); break; } - - mutex_unlock(&dev->struct_mutex); } static void exynos_drm_crtc_prepare(struct drm_crtc *crtc) @@ -201,28 +188,6 @@ static void exynos_drm_crtc_commit(struct drm_crtc *crtc) DRM_DEBUG_KMS("%s\n", __FILE__); - /* - * when set_crtc is requested from user or at booting time, - * crtc->commit would be called without dpms call so if dpms is - * no power on then crtc->dpms should be called - * with DRM_MODE_DPMS_ON for the hardware power to be on. - */ - if (exynos_crtc->dpms != DRM_MODE_DPMS_ON) { - int mode = DRM_MODE_DPMS_ON; - - /* - * enable hardware(power on) to all encoders hdmi connected - * to current crtc. - */ - exynos_drm_crtc_dpms(crtc, mode); - /* - * enable dma to all encoders connected to current crtc and - * lcd panel. - */ - exynos_drm_fn_encoder(crtc, &mode, - exynos_drm_encoder_dpms_from_crtc); - } - exynos_drm_fn_encoder(crtc, &exynos_crtc->pipe, exynos_drm_encoder_crtc_commit); } @@ -379,8 +344,6 @@ int exynos_drm_crtc_create(struct drm_device *dev, unsigned int nr) } exynos_crtc->pipe = nr; - exynos_crtc->dpms = DRM_MODE_DPMS_OFF; - exynos_crtc->overlay.zpos = DEFAULT_ZPOS; crtc = &exynos_crtc->drm_crtc; private->crtc[nr] = crtc; @@ -394,14 +357,9 @@ int exynos_drm_crtc_create(struct drm_device *dev, unsigned int nr) int exynos_drm_crtc_enable_vblank(struct drm_device *dev, int crtc) { struct exynos_drm_private *private = dev->dev_private; - struct exynos_drm_crtc *exynos_crtc = - to_exynos_crtc(private->crtc[crtc]); DRM_DEBUG_KMS("%s\n", __FILE__); - if (exynos_crtc->dpms != DRM_MODE_DPMS_ON) - return -EPERM; - exynos_drm_fn_encoder(private->crtc[crtc], &crtc, exynos_drm_enable_vblank); @@ -411,14 +369,9 @@ int exynos_drm_crtc_enable_vblank(struct drm_device *dev, int crtc) void exynos_drm_crtc_disable_vblank(struct drm_device *dev, int crtc) { struct exynos_drm_private *private = dev->dev_private; - struct exynos_drm_crtc *exynos_crtc = - to_exynos_crtc(private->crtc[crtc]); DRM_DEBUG_KMS("%s\n", __FILE__); - if (exynos_crtc->dpms != DRM_MODE_DPMS_ON) - return; - exynos_drm_fn_encoder(private->crtc[crtc], &crtc, exynos_drm_disable_vblank); } diff --git a/trunk/drivers/gpu/drm/exynos/exynos_drm_drv.c b/trunk/drivers/gpu/drm/exynos/exynos_drm_drv.c index 050684ceab9d..53e2216de61d 100644 --- a/trunk/drivers/gpu/drm/exynos/exynos_drm_drv.c +++ b/trunk/drivers/gpu/drm/exynos/exynos_drm_drv.c @@ -36,7 +36,6 @@ #include "exynos_drm_fbdev.h" #include "exynos_drm_fb.h" #include "exynos_drm_gem.h" -#include "exynos_drm_plane.h" #define DRIVER_NAME "exynos-drm" #define DRIVER_DESC "Samsung SoC DRM" @@ -78,12 +77,6 @@ static int exynos_drm_load(struct drm_device *dev, unsigned long flags) goto err_crtc; } - for (nr = 0; nr < MAX_PLANE; nr++) { - ret = exynos_plane_init(dev, nr); - if (ret) - goto err_crtc; - } - ret = drm_vblank_init(dev, MAX_CRTC); if (ret) goto err_crtc; @@ -170,18 +163,6 @@ static struct drm_ioctl_desc exynos_ioctls[] = { DRM_AUTH), DRM_IOCTL_DEF_DRV(EXYNOS_GEM_MMAP, exynos_drm_gem_mmap_ioctl, DRM_UNLOCKED | DRM_AUTH), - DRM_IOCTL_DEF_DRV(EXYNOS_PLANE_SET_ZPOS, exynos_plane_set_zpos_ioctl, - DRM_UNLOCKED | DRM_AUTH), -}; - -static const struct file_operations exynos_drm_driver_fops = { - .owner = THIS_MODULE, - .open = drm_open, - .mmap = exynos_drm_gem_mmap, - .poll = drm_poll, - .read = drm_read, - .unlocked_ioctl = drm_ioctl, - .release = drm_release, }; static struct drm_driver exynos_drm_driver = { @@ -201,7 +182,15 @@ static struct drm_driver exynos_drm_driver = { .dumb_map_offset = exynos_drm_gem_dumb_map_offset, .dumb_destroy = exynos_drm_gem_dumb_destroy, .ioctls = exynos_ioctls, - .fops = &exynos_drm_driver_fops, + .fops = { + .owner = THIS_MODULE, + .open = drm_open, + .mmap = exynos_drm_gem_mmap, + .poll = drm_poll, + .read = drm_read, + .unlocked_ioctl = drm_ioctl, + .release = drm_release, + }, .name = DRIVER_NAME, .desc = DRIVER_DESC, .date = DRIVER_DATE, diff --git a/trunk/drivers/gpu/drm/exynos/exynos_drm_drv.h b/trunk/drivers/gpu/drm/exynos/exynos_drm_drv.h index 8e8d8f0f8f33..5e02e6ecc2e0 100644 --- a/trunk/drivers/gpu/drm/exynos/exynos_drm_drv.h +++ b/trunk/drivers/gpu/drm/exynos/exynos_drm_drv.h @@ -33,8 +33,6 @@ #include "drm.h" #define MAX_CRTC 2 -#define MAX_PLANE 5 -#define DEFAULT_ZPOS -1 struct drm_device; struct exynos_drm_overlay; @@ -59,8 +57,8 @@ enum exynos_drm_output_type { struct exynos_drm_overlay_ops { void (*mode_set)(struct device *subdrv_dev, struct exynos_drm_overlay *overlay); - void (*commit)(struct device *subdrv_dev, int zpos); - void (*disable)(struct device *subdrv_dev, int zpos); + void (*commit)(struct device *subdrv_dev); + void (*disable)(struct device *subdrv_dev); }; /* @@ -85,7 +83,6 @@ struct exynos_drm_overlay_ops { * @dma_addr: bus(accessed by dma) address to the memory region allocated * for a overlay. * @vaddr: virtual memory addresss to this overlay. - * @zpos: order of overlay layer(z position). * @default_win: a window to be enabled. * @color_key: color key on or off. * @index_color: if using color key feature then this value would be used @@ -114,7 +111,6 @@ struct exynos_drm_overlay { unsigned int pitch; dma_addr_t dma_addr; void __iomem *vaddr; - int zpos; bool default_win; bool color_key; @@ -148,19 +144,17 @@ struct exynos_drm_display_ops { /* * Exynos drm manager ops * - * @dpms: control device power. - * @apply: set timing, vblank and overlay data to registers. * @mode_set: convert drm_display_mode to hw specific display mode and * would be called by encoder->mode_set(). * @commit: set current hw specific display mode to hw. + * @disable: disable hardware specific display mode. * @enable_vblank: specific driver callback for enabling vblank interrupt. * @disable_vblank: specific driver callback for disabling vblank interrupt. */ struct exynos_drm_manager_ops { - void (*dpms)(struct device *subdrv_dev, int mode); - void (*apply)(struct device *subdrv_dev); void (*mode_set)(struct device *subdrv_dev, void *mode); void (*commit)(struct device *subdrv_dev); + void (*disable)(struct device *subdrv_dev); int (*enable_vblank)(struct device *subdrv_dev); void (*disable_vblank)(struct device *subdrv_dev); }; diff --git a/trunk/drivers/gpu/drm/exynos/exynos_drm_encoder.c b/trunk/drivers/gpu/drm/exynos/exynos_drm_encoder.c index 86b93dde219a..153061415baf 100644 --- a/trunk/drivers/gpu/drm/exynos/exynos_drm_encoder.c +++ b/trunk/drivers/gpu/drm/exynos/exynos_drm_encoder.c @@ -42,68 +42,49 @@ * @drm_encoder: encoder object. * @manager: specific encoder has its own manager to control a hardware * appropriately and we can access a hardware drawing on this manager. - * @dpms: store the encoder dpms value. */ struct exynos_drm_encoder { struct drm_encoder drm_encoder; struct exynos_drm_manager *manager; - int dpms; }; -static void exynos_drm_display_power(struct drm_encoder *encoder, int mode) -{ - struct drm_device *dev = encoder->dev; - struct drm_connector *connector; - struct exynos_drm_manager *manager = exynos_drm_get_manager(encoder); - - list_for_each_entry(connector, &dev->mode_config.connector_list, head) { - if (connector->encoder == encoder) { - struct exynos_drm_display_ops *display_ops = - manager->display_ops; - - DRM_DEBUG_KMS("connector[%d] dpms[%d]\n", - connector->base.id, mode); - if (display_ops && display_ops->power_on) - display_ops->power_on(manager->dev, mode); - } - } -} - static void exynos_drm_encoder_dpms(struct drm_encoder *encoder, int mode) { struct drm_device *dev = encoder->dev; + struct drm_connector *connector; struct exynos_drm_manager *manager = exynos_drm_get_manager(encoder); struct exynos_drm_manager_ops *manager_ops = manager->ops; - struct exynos_drm_encoder *exynos_encoder = to_exynos_encoder(encoder); DRM_DEBUG_KMS("%s, encoder dpms: %d\n", __FILE__, mode); - if (exynos_encoder->dpms == mode) { - DRM_DEBUG_KMS("desired dpms mode is same as previous one.\n"); - return; - } - - mutex_lock(&dev->struct_mutex); - switch (mode) { case DRM_MODE_DPMS_ON: - if (manager_ops && manager_ops->apply) - manager_ops->apply(manager->dev); - exynos_drm_display_power(encoder, mode); - exynos_encoder->dpms = mode; + if (manager_ops && manager_ops->commit) + manager_ops->commit(manager->dev); break; case DRM_MODE_DPMS_STANDBY: case DRM_MODE_DPMS_SUSPEND: case DRM_MODE_DPMS_OFF: - exynos_drm_display_power(encoder, mode); - exynos_encoder->dpms = mode; + /* TODO */ + if (manager_ops && manager_ops->disable) + manager_ops->disable(manager->dev); break; default: DRM_ERROR("unspecified mode %d\n", mode); break; } - mutex_unlock(&dev->struct_mutex); + list_for_each_entry(connector, &dev->mode_config.connector_list, head) { + if (connector->encoder == encoder) { + struct exynos_drm_display_ops *display_ops = + manager->display_ops; + + DRM_DEBUG_KMS("connector[%d] dpms[%d]\n", + connector->base.id, mode); + if (display_ops && display_ops->power_on) + display_ops->power_on(manager->dev, mode); + } + } } static bool @@ -188,6 +169,7 @@ static void exynos_drm_encoder_destroy(struct drm_encoder *encoder) exynos_encoder->manager->pipe = -1; drm_encoder_cleanup(encoder); + encoder->dev->mode_config.num_encoder--; kfree(exynos_encoder); } @@ -217,7 +199,6 @@ exynos_drm_encoder_create(struct drm_device *dev, return NULL; } - exynos_encoder->dpms = DRM_MODE_DPMS_OFF; exynos_encoder->manager = manager; encoder = &exynos_encoder->drm_encoder; encoder->possible_crtcs = possible_crtcs; @@ -294,27 +275,12 @@ void exynos_drm_disable_vblank(struct drm_encoder *encoder, void *data) manager_ops->disable_vblank(manager->dev); } -void exynos_drm_encoder_crtc_plane_commit(struct drm_encoder *encoder, - void *data) -{ - struct exynos_drm_manager *manager = - to_exynos_encoder(encoder)->manager; - struct exynos_drm_overlay_ops *overlay_ops = manager->overlay_ops; - int zpos = DEFAULT_ZPOS; - - if (data) - zpos = *(int *)data; - - if (overlay_ops && overlay_ops->commit) - overlay_ops->commit(manager->dev, zpos); -} - void exynos_drm_encoder_crtc_commit(struct drm_encoder *encoder, void *data) { struct exynos_drm_manager *manager = to_exynos_encoder(encoder)->manager; + struct exynos_drm_overlay_ops *overlay_ops = manager->overlay_ops; int crtc = *(int *)data; - int zpos = DEFAULT_ZPOS; DRM_DEBUG_KMS("%s\n", __FILE__); @@ -324,53 +290,8 @@ void exynos_drm_encoder_crtc_commit(struct drm_encoder *encoder, void *data) */ manager->pipe = crtc; - exynos_drm_encoder_crtc_plane_commit(encoder, &zpos); -} - -void exynos_drm_encoder_dpms_from_crtc(struct drm_encoder *encoder, void *data) -{ - struct exynos_drm_encoder *exynos_encoder = to_exynos_encoder(encoder); - int mode = *(int *)data; - - DRM_DEBUG_KMS("%s\n", __FILE__); - - exynos_drm_encoder_dpms(encoder, mode); - - exynos_encoder->dpms = mode; -} - -void exynos_drm_encoder_crtc_dpms(struct drm_encoder *encoder, void *data) -{ - struct drm_device *dev = encoder->dev; - struct exynos_drm_encoder *exynos_encoder = to_exynos_encoder(encoder); - struct exynos_drm_manager *manager = exynos_encoder->manager; - struct exynos_drm_manager_ops *manager_ops = manager->ops; - struct drm_connector *connector; - int mode = *(int *)data; - - DRM_DEBUG_KMS("%s\n", __FILE__); - - if (manager_ops && manager_ops->dpms) - manager_ops->dpms(manager->dev, mode); - - /* - * set current dpms mode to the connector connected to - * current encoder. connector->dpms would be checked - * at drm_helper_connector_dpms() - */ - list_for_each_entry(connector, &dev->mode_config.connector_list, head) - if (connector->encoder == encoder) - connector->dpms = mode; - - /* - * if this condition is ok then it means that the crtc is already - * detached from encoder and last function for detaching is properly - * done, so clear pipe from manager to prevent repeated call. - */ - if (mode > DRM_MODE_DPMS_ON) { - if (!encoder->crtc) - manager->pipe = -1; - } + if (overlay_ops && overlay_ops->commit) + overlay_ops->commit(manager->dev); } void exynos_drm_encoder_crtc_mode_set(struct drm_encoder *encoder, void *data) @@ -389,15 +310,19 @@ void exynos_drm_encoder_crtc_disable(struct drm_encoder *encoder, void *data) struct exynos_drm_manager *manager = to_exynos_encoder(encoder)->manager; struct exynos_drm_overlay_ops *overlay_ops = manager->overlay_ops; - int zpos = DEFAULT_ZPOS; DRM_DEBUG_KMS("\n"); - if (data) - zpos = *(int *)data; - if (overlay_ops && overlay_ops->disable) - overlay_ops->disable(manager->dev, zpos); + overlay_ops->disable(manager->dev); + + /* + * crtc is already detached from encoder and last + * function for detaching is properly done, so + * clear pipe from manager to prevent repeated call + */ + if (!encoder->crtc) + manager->pipe = -1; } MODULE_AUTHOR("Inki Dae "); diff --git a/trunk/drivers/gpu/drm/exynos/exynos_drm_encoder.h b/trunk/drivers/gpu/drm/exynos/exynos_drm_encoder.h index 97b087a51cb6..a22acfbf0e4e 100644 --- a/trunk/drivers/gpu/drm/exynos/exynos_drm_encoder.h +++ b/trunk/drivers/gpu/drm/exynos/exynos_drm_encoder.h @@ -39,12 +39,7 @@ void exynos_drm_fn_encoder(struct drm_crtc *crtc, void *data, void (*fn)(struct drm_encoder *, void *)); void exynos_drm_enable_vblank(struct drm_encoder *encoder, void *data); void exynos_drm_disable_vblank(struct drm_encoder *encoder, void *data); -void exynos_drm_encoder_crtc_plane_commit(struct drm_encoder *encoder, - void *data); void exynos_drm_encoder_crtc_commit(struct drm_encoder *encoder, void *data); -void exynos_drm_encoder_dpms_from_crtc(struct drm_encoder *encoder, - void *data); -void exynos_drm_encoder_crtc_dpms(struct drm_encoder *encoder, void *data); void exynos_drm_encoder_crtc_mode_set(struct drm_encoder *encoder, void *data); void exynos_drm_encoder_crtc_disable(struct drm_encoder *encoder, void *data); diff --git a/trunk/drivers/gpu/drm/exynos/exynos_drm_fb.c b/trunk/drivers/gpu/drm/exynos/exynos_drm_fb.c index df5eec6c1aba..5bf4a1ac7f82 100644 --- a/trunk/drivers/gpu/drm/exynos/exynos_drm_fb.c +++ b/trunk/drivers/gpu/drm/exynos/exynos_drm_fb.c @@ -104,7 +104,7 @@ static struct drm_framebuffer_funcs exynos_drm_fb_funcs = { static struct drm_framebuffer * exynos_drm_fb_init(struct drm_file *file_priv, struct drm_device *dev, - struct drm_mode_fb_cmd2 *mode_cmd) + struct drm_mode_fb_cmd *mode_cmd) { struct exynos_drm_fb *exynos_fb; struct drm_framebuffer *fb; @@ -115,6 +115,9 @@ exynos_drm_fb_init(struct drm_file *file_priv, struct drm_device *dev, DRM_DEBUG_KMS("%s\n", __FILE__); + mode_cmd->pitch = max(mode_cmd->pitch, + mode_cmd->width * (mode_cmd->bpp >> 3)); + DRM_LOG_KMS("drm fb create(%dx%d)\n", mode_cmd->width, mode_cmd->height); @@ -133,14 +136,14 @@ exynos_drm_fb_init(struct drm_file *file_priv, struct drm_device *dev, DRM_LOG_KMS("create: fb id: %d\n", fb->base.id); - size = mode_cmd->pitches[0] * mode_cmd->height; + size = mode_cmd->pitch * mode_cmd->height; /* - * mode_cmd->handles[0] could be NULL at booting time or + * mode_cmd->handle could be NULL at booting time or * with user request. if NULL, a new buffer or a gem object * would be allocated. */ - if (!mode_cmd->handles[0]) { + if (!mode_cmd->handle) { if (!file_priv) { struct exynos_drm_gem_buf *buffer; @@ -163,7 +166,7 @@ exynos_drm_fb_init(struct drm_file *file_priv, struct drm_device *dev, goto out; } else { exynos_gem_obj = exynos_drm_gem_create(dev, file_priv, - &mode_cmd->handles[0], + &mode_cmd->handle, size); if (IS_ERR(exynos_gem_obj)) { ret = PTR_ERR(exynos_gem_obj); @@ -171,8 +174,7 @@ exynos_drm_fb_init(struct drm_file *file_priv, struct drm_device *dev, } } } else { - obj = drm_gem_object_lookup(dev, file_priv, - mode_cmd->handles[0]); + obj = drm_gem_object_lookup(dev, file_priv, mode_cmd->handle); if (!obj) { DRM_ERROR("failed to lookup gem object.\n"); goto err_buffer; @@ -212,8 +214,8 @@ exynos_drm_fb_init(struct drm_file *file_priv, struct drm_device *dev, } struct drm_framebuffer *exynos_drm_fb_create(struct drm_device *dev, - struct drm_file *file_priv, - struct drm_mode_fb_cmd2 *mode_cmd) + struct drm_file *file_priv, + struct drm_mode_fb_cmd *mode_cmd) { DRM_DEBUG_KMS("%s\n", __FILE__); diff --git a/trunk/drivers/gpu/drm/exynos/exynos_drm_fb.h b/trunk/drivers/gpu/drm/exynos/exynos_drm_fb.h index 52c5982bdbbc..eb35931d302c 100644 --- a/trunk/drivers/gpu/drm/exynos/exynos_drm_fb.h +++ b/trunk/drivers/gpu/drm/exynos/exynos_drm_fb.h @@ -29,8 +29,8 @@ #define _EXYNOS_DRM_FB_H struct drm_framebuffer *exynos_drm_fb_create(struct drm_device *dev, - struct drm_file *filp, - struct drm_mode_fb_cmd2 *mode_cmd); + struct drm_file *filp, + struct drm_mode_fb_cmd *mode_cmd); void exynos_drm_mode_config_init(struct drm_device *dev); diff --git a/trunk/drivers/gpu/drm/exynos/exynos_drm_fbdev.c b/trunk/drivers/gpu/drm/exynos/exynos_drm_fbdev.c index c8b278447c4f..f79f768a56ca 100644 --- a/trunk/drivers/gpu/drm/exynos/exynos_drm_fbdev.c +++ b/trunk/drivers/gpu/drm/exynos/exynos_drm_fbdev.c @@ -126,7 +126,7 @@ static int exynos_drm_fbdev_create(struct drm_fb_helper *helper, struct exynos_drm_fbdev *exynos_fbdev = to_exynos_fbdev(helper); struct drm_device *dev = helper->dev; struct fb_info *fbi; - struct drm_mode_fb_cmd2 mode_cmd = { 0 }; + struct drm_mode_fb_cmd mode_cmd = { 0 }; struct platform_device *pdev = dev->platformdev; int ret; @@ -138,9 +138,8 @@ static int exynos_drm_fbdev_create(struct drm_fb_helper *helper, mode_cmd.width = sizes->surface_width; mode_cmd.height = sizes->surface_height; - mode_cmd.pitches[0] = sizes->surface_width * (sizes->surface_bpp >> 3); - mode_cmd.pixel_format = drm_mode_legacy_fb_format(sizes->surface_bpp, - sizes->surface_depth); + mode_cmd.bpp = sizes->surface_bpp; + mode_cmd.depth = sizes->surface_depth; mutex_lock(&dev->struct_mutex); @@ -207,7 +206,7 @@ static int exynos_drm_fbdev_recreate(struct drm_fb_helper *helper, struct drm_device *dev = helper->dev; struct exynos_drm_fbdev *exynos_fbdev = to_exynos_fbdev(helper); struct drm_framebuffer *fb = exynos_fbdev->fb; - struct drm_mode_fb_cmd2 mode_cmd = { 0 }; + struct drm_mode_fb_cmd mode_cmd = { 0 }; DRM_DEBUG_KMS("%s\n", __FILE__); @@ -221,9 +220,8 @@ static int exynos_drm_fbdev_recreate(struct drm_fb_helper *helper, mode_cmd.width = sizes->surface_width; mode_cmd.height = sizes->surface_height; - mode_cmd.pitches[0] = sizes->surface_width * (sizes->surface_bpp >> 3); - mode_cmd.pixel_format = drm_mode_legacy_fb_format(sizes->surface_bpp, - sizes->surface_depth); + mode_cmd.bpp = sizes->surface_bpp; + mode_cmd.depth = sizes->surface_depth; if (fb->funcs->destroy) fb->funcs->destroy(fb); diff --git a/trunk/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/trunk/drivers/gpu/drm/exynos/exynos_drm_fimd.c index fe4172e48ad2..db3b3d9e731d 100644 --- a/trunk/drivers/gpu/drm/exynos/exynos_drm_fimd.c +++ b/trunk/drivers/gpu/drm/exynos/exynos_drm_fimd.c @@ -17,7 +17,6 @@ #include #include #include -#include #include #include @@ -69,7 +68,6 @@ struct fimd_win_data { void __iomem *vaddr; unsigned int buf_offsize; unsigned int line_size; /* bytes */ - bool enabled; }; struct fimd_context { @@ -86,7 +84,6 @@ struct fimd_context { unsigned long irq_flags; u32 vidcon0; u32 vidcon1; - bool suspended; struct fb_videomode *timing; }; @@ -122,7 +119,7 @@ static int fimd_display_power_on(struct device *dev, int mode) { DRM_DEBUG_KMS("%s\n", __FILE__); - /* TODO */ + /* TODO. */ return 0; } @@ -135,46 +132,6 @@ static struct exynos_drm_display_ops fimd_display_ops = { .power_on = fimd_display_power_on, }; -static void fimd_dpms(struct device *subdrv_dev, int mode) -{ - DRM_DEBUG_KMS("%s, %d\n", __FILE__, mode); - - switch (mode) { - case DRM_MODE_DPMS_ON: - pm_runtime_get_sync(subdrv_dev); - break; - case DRM_MODE_DPMS_STANDBY: - case DRM_MODE_DPMS_SUSPEND: - case DRM_MODE_DPMS_OFF: - pm_runtime_put_sync(subdrv_dev); - break; - default: - DRM_DEBUG_KMS("unspecified mode %d\n", mode); - break; - } -} - -static void fimd_apply(struct device *subdrv_dev) -{ - struct fimd_context *ctx = get_fimd_context(subdrv_dev); - struct exynos_drm_manager *mgr = &ctx->subdrv.manager; - struct exynos_drm_manager_ops *mgr_ops = mgr->ops; - struct exynos_drm_overlay_ops *ovl_ops = mgr->overlay_ops; - struct fimd_win_data *win_data; - int i; - - DRM_DEBUG_KMS("%s\n", __FILE__); - - for (i = 0; i < WINDOWS_NR; i++) { - win_data = &ctx->win_data[i]; - if (win_data->enabled && (ovl_ops && ovl_ops->commit)) - ovl_ops->commit(subdrv_dev, i); - } - - if (mgr_ops && mgr_ops->commit) - mgr_ops->commit(subdrv_dev); -} - static void fimd_commit(struct device *dev) { struct fimd_context *ctx = get_fimd_context(dev); @@ -220,15 +177,46 @@ static void fimd_commit(struct device *dev) writel(val, ctx->regs + VIDCON0); } -static int fimd_enable_vblank(struct device *dev) +static void fimd_disable(struct device *dev) { struct fimd_context *ctx = get_fimd_context(dev); + struct exynos_drm_subdrv *subdrv = &ctx->subdrv; + struct drm_device *drm_dev = subdrv->drm_dev; + struct exynos_drm_manager *manager = &subdrv->manager; u32 val; DRM_DEBUG_KMS("%s\n", __FILE__); - if (ctx->suspended) - return -EPERM; + /* fimd dma off */ + val = readl(ctx->regs + VIDCON0); + val &= ~(VIDCON0_ENVID | VIDCON0_ENVID_F); + writel(val, ctx->regs + VIDCON0); + + /* + * if vblank is enabled status with dma off then + * it disables vsync interrupt. + */ + if (drm_dev->vblank_enabled[manager->pipe] && + atomic_read(&drm_dev->vblank_refcount[manager->pipe])) { + drm_vblank_put(drm_dev, manager->pipe); + + /* + * if vblank_disable_allowed is 0 then disable + * vsync interrupt right now else the vsync interrupt + * would be disabled by drm timer once a current process + * gives up ownershop of vblank event. + */ + if (!drm_dev->vblank_disable_allowed) + drm_vblank_off(drm_dev, manager->pipe); + } +} + +static int fimd_enable_vblank(struct device *dev) +{ + struct fimd_context *ctx = get_fimd_context(dev); + u32 val; + + DRM_DEBUG_KMS("%s\n", __FILE__); if (!test_and_set_bit(0, &ctx->irq_flags)) { val = readl(ctx->regs + VIDINTCON0); @@ -254,9 +242,6 @@ static void fimd_disable_vblank(struct device *dev) DRM_DEBUG_KMS("%s\n", __FILE__); - if (ctx->suspended) - return; - if (test_and_clear_bit(0, &ctx->irq_flags)) { val = readl(ctx->regs + VIDINTCON0); @@ -268,9 +253,8 @@ static void fimd_disable_vblank(struct device *dev) } static struct exynos_drm_manager_ops fimd_manager_ops = { - .dpms = fimd_dpms, - .apply = fimd_apply, .commit = fimd_commit, + .disable = fimd_disable, .enable_vblank = fimd_enable_vblank, .disable_vblank = fimd_disable_vblank, }; @@ -280,7 +264,6 @@ static void fimd_win_mode_set(struct device *dev, { struct fimd_context *ctx = get_fimd_context(dev); struct fimd_win_data *win_data; - int win; unsigned long offset; DRM_DEBUG_KMS("%s\n", __FILE__); @@ -290,19 +273,12 @@ static void fimd_win_mode_set(struct device *dev, return; } - win = overlay->zpos; - if (win == DEFAULT_ZPOS) - win = ctx->default_win; - - if (win < 0 || win > WINDOWS_NR) - return; - offset = overlay->fb_x * (overlay->bpp >> 3); offset += overlay->fb_y * overlay->pitch; DRM_DEBUG_KMS("offset = 0x%lx, pitch = %x\n", offset, overlay->pitch); - win_data = &ctx->win_data[win]; + win_data = &ctx->win_data[ctx->default_win]; win_data->offset_x = overlay->crtc_x; win_data->offset_y = overlay->crtc_y; @@ -405,18 +381,15 @@ static void fimd_win_set_colkey(struct device *dev, unsigned int win) writel(keycon1, ctx->regs + WKEYCON1_BASE(win)); } -static void fimd_win_commit(struct device *dev, int zpos) +static void fimd_win_commit(struct device *dev) { struct fimd_context *ctx = get_fimd_context(dev); struct fimd_win_data *win_data; - int win = zpos; + int win = ctx->default_win; unsigned long val, alpha, size; DRM_DEBUG_KMS("%s\n", __FILE__); - if (win == DEFAULT_ZPOS) - win = ctx->default_win; - if (win < 0 || win > WINDOWS_NR) return; @@ -499,37 +472,24 @@ static void fimd_win_commit(struct device *dev, int zpos) if (win != 0) fimd_win_set_colkey(dev, win); - /* wincon */ - val = readl(ctx->regs + WINCON(win)); - val |= WINCONx_ENWIN; - writel(val, ctx->regs + WINCON(win)); - /* Enable DMA channel and unprotect windows */ val = readl(ctx->regs + SHADOWCON); val |= SHADOWCON_CHx_ENABLE(win); val &= ~SHADOWCON_WINx_PROTECT(win); writel(val, ctx->regs + SHADOWCON); - - win_data->enabled = true; } -static void fimd_win_disable(struct device *dev, int zpos) +static void fimd_win_disable(struct device *dev) { struct fimd_context *ctx = get_fimd_context(dev); - struct fimd_win_data *win_data; - int win = zpos; + int win = ctx->default_win; u32 val; DRM_DEBUG_KMS("%s\n", __FILE__); - if (win == DEFAULT_ZPOS) - win = ctx->default_win; - if (win < 0 || win > WINDOWS_NR) return; - win_data = &ctx->win_data[win]; - /* protect windows */ val = readl(ctx->regs + SHADOWCON); val |= SHADOWCON_WINx_PROTECT(win); @@ -545,8 +505,6 @@ static void fimd_win_disable(struct device *dev, int zpos) val &= ~SHADOWCON_CHx_ENABLE(win); val &= ~SHADOWCON_WINx_PROTECT(win); writel(val, ctx->regs + SHADOWCON); - - win_data->enabled = false; } static struct exynos_drm_overlay_ops fimd_overlay_ops = { @@ -582,17 +540,9 @@ static void fimd_finish_pageflip(struct drm_device *drm_dev, int crtc) wake_up_interruptible(&e->base.file_priv->event_wait); } - if (is_checked) { + if (is_checked) drm_vblank_put(drm_dev, crtc); - /* - * don't off vblank if vblank_disable_allowed is 1, - * because vblank would be off by timer handler. - */ - if (!drm_dev->vblank_disable_allowed) - drm_vblank_off(drm_dev, crtc); - } - spin_unlock_irqrestore(&drm_dev->event_lock, flags); } @@ -610,14 +560,19 @@ static irqreturn_t fimd_irq_handler(int irq, void *dev_id) /* VSYNC interrupt */ writel(VIDINTCON1_INT_FRAME, ctx->regs + VIDINTCON1); - /* check the crtc is detached already from encoder */ - if (manager->pipe < 0) - goto out; + /* + * in case that vblank_disable_allowed is 1, it could induce + * the problem that manager->pipe could be -1 because with + * disable callback, vsync interrupt isn't disabled and at this moment, + * vsync interrupt could occur. the vsync interrupt would be disabled + * by timer handler later. + */ + if (manager->pipe == -1) + return IRQ_HANDLED; drm_handle_vblank(drm_dev, manager->pipe); fimd_finish_pageflip(drm_dev, manager->pipe); -out: return IRQ_HANDLED; } @@ -635,13 +590,6 @@ static int fimd_subdrv_probe(struct drm_device *drm_dev, struct device *dev) */ drm_dev->irq_enabled = 1; - /* - * with vblank_disable_allowed = 1, vblank interrupt will be disabled - * by drm timer once a current process gives up ownership of - * vblank event.(after drm_vblank_put function is called) - */ - drm_dev->vblank_disable_allowed = 1; - return 0; } @@ -791,19 +739,15 @@ static int __devinit fimd_probe(struct platform_device *pdev) ctx->irq = res->start; + for (win = 0; win < WINDOWS_NR; win++) + fimd_clear_win(ctx, win); + ret = request_irq(ctx->irq, fimd_irq_handler, 0, "drm_fimd", ctx); if (ret < 0) { dev_err(dev, "irq request failed.\n"); goto err_req_irq; } - pm_runtime_set_active(dev); - pm_runtime_enable(dev); - pm_runtime_get_sync(dev); - - for (win = 0; win < WINDOWS_NR; win++) - fimd_clear_win(ctx, win); - ctx->clkdiv = fimd_calc_clkdiv(ctx, timing); ctx->vidcon0 = pdata->vidcon0; ctx->vidcon1 = pdata->vidcon1; @@ -853,25 +797,14 @@ static int __devinit fimd_probe(struct platform_device *pdev) static int __devexit fimd_remove(struct platform_device *pdev) { - struct device *dev = &pdev->dev; struct fimd_context *ctx = platform_get_drvdata(pdev); DRM_DEBUG_KMS("%s\n", __FILE__); exynos_drm_subdrv_unregister(&ctx->subdrv); - if (ctx->suspended) - goto out; - clk_disable(ctx->lcd_clk); clk_disable(ctx->bus_clk); - - pm_runtime_set_suspended(dev); - pm_runtime_put_sync(dev); - -out: - pm_runtime_disable(dev); - clk_put(ctx->lcd_clk); clk_put(ctx->bus_clk); @@ -885,53 +818,12 @@ static int __devexit fimd_remove(struct platform_device *pdev) return 0; } -#ifdef CONFIG_PM_RUNTIME -static int fimd_runtime_suspend(struct device *dev) -{ - struct fimd_context *ctx = get_fimd_context(dev); - - DRM_DEBUG_KMS("%s\n", __FILE__); - - clk_disable(ctx->lcd_clk); - clk_disable(ctx->bus_clk); - - ctx->suspended = true; - return 0; -} - -static int fimd_runtime_resume(struct device *dev) -{ - struct fimd_context *ctx = get_fimd_context(dev); - int ret; - - DRM_DEBUG_KMS("%s\n", __FILE__); - - ret = clk_enable(ctx->bus_clk); - if (ret < 0) - return ret; - - ret = clk_enable(ctx->lcd_clk); - if (ret < 0) { - clk_disable(ctx->bus_clk); - return ret; - } - - ctx->suspended = false; - return 0; -} -#endif - -static const struct dev_pm_ops fimd_pm_ops = { - SET_RUNTIME_PM_OPS(fimd_runtime_suspend, fimd_runtime_resume, NULL) -}; - static struct platform_driver fimd_driver = { .probe = fimd_probe, .remove = __devexit_p(fimd_remove), .driver = { .name = "exynos4-fb", .owner = THIS_MODULE, - .pm = &fimd_pm_ops, }, }; diff --git a/trunk/drivers/gpu/drm/exynos/exynos_drm_plane.c b/trunk/drivers/gpu/drm/exynos/exynos_drm_plane.c deleted file mode 100644 index c785e34ccff9..000000000000 --- a/trunk/drivers/gpu/drm/exynos/exynos_drm_plane.c +++ /dev/null @@ -1,163 +0,0 @@ -/* - * Copyright (C) 2011 Samsung Electronics Co.Ltd - * Authors: Joonyoung Shim - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - */ - -#include "drmP.h" - -#include "exynos_drm.h" -#include "exynos_drm_crtc.h" -#include "exynos_drm_drv.h" -#include "exynos_drm_encoder.h" - -struct exynos_plane { - struct drm_plane base; - struct exynos_drm_overlay overlay; - bool enabled; -}; - -static int -exynos_update_plane(struct drm_plane *plane, struct drm_crtc *crtc, - struct drm_framebuffer *fb, int crtc_x, int crtc_y, - unsigned int crtc_w, unsigned int crtc_h, - uint32_t src_x, uint32_t src_y, - uint32_t src_w, uint32_t src_h) -{ - struct exynos_plane *exynos_plane = - container_of(plane, struct exynos_plane, base); - struct exynos_drm_overlay *overlay = &exynos_plane->overlay; - struct exynos_drm_crtc_pos pos; - unsigned int x = src_x >> 16; - unsigned int y = src_y >> 16; - int ret; - - DRM_DEBUG_KMS("[%d] %s\n", __LINE__, __func__); - - memset(&pos, 0, sizeof(struct exynos_drm_crtc_pos)); - pos.crtc_x = crtc_x; - pos.crtc_y = crtc_y; - pos.crtc_w = crtc_w; - pos.crtc_h = crtc_h; - - pos.fb_x = x; - pos.fb_y = y; - - /* TODO: scale feature */ - ret = exynos_drm_overlay_update(overlay, fb, &crtc->mode, &pos); - if (ret < 0) - return ret; - - exynos_drm_fn_encoder(crtc, overlay, - exynos_drm_encoder_crtc_mode_set); - exynos_drm_fn_encoder(crtc, &overlay->zpos, - exynos_drm_encoder_crtc_plane_commit); - - exynos_plane->enabled = true; - - return 0; -} - -static int exynos_disable_plane(struct drm_plane *plane) -{ - struct exynos_plane *exynos_plane = - container_of(plane, struct exynos_plane, base); - struct exynos_drm_overlay *overlay = &exynos_plane->overlay; - - DRM_DEBUG_KMS("[%d] %s\n", __LINE__, __func__); - - if (!exynos_plane->enabled) - return 0; - - exynos_drm_fn_encoder(plane->crtc, &overlay->zpos, - exynos_drm_encoder_crtc_disable); - - exynos_plane->enabled = false; - exynos_plane->overlay.zpos = DEFAULT_ZPOS; - - return 0; -} - -static void exynos_plane_destroy(struct drm_plane *plane) -{ - struct exynos_plane *exynos_plane = - container_of(plane, struct exynos_plane, base); - - DRM_DEBUG_KMS("[%d] %s\n", __LINE__, __func__); - - exynos_disable_plane(plane); - drm_plane_cleanup(plane); - kfree(exynos_plane); -} - -static struct drm_plane_funcs exynos_plane_funcs = { - .update_plane = exynos_update_plane, - .disable_plane = exynos_disable_plane, - .destroy = exynos_plane_destroy, -}; - -int exynos_plane_init(struct drm_device *dev, unsigned int nr) -{ - struct exynos_plane *exynos_plane; - uint32_t possible_crtcs; - - exynos_plane = kzalloc(sizeof(struct exynos_plane), GFP_KERNEL); - if (!exynos_plane) - return -ENOMEM; - - /* all CRTCs are available */ - possible_crtcs = (1 << MAX_CRTC) - 1; - - exynos_plane->overlay.zpos = DEFAULT_ZPOS; - - /* TODO: format */ - return drm_plane_init(dev, &exynos_plane->base, possible_crtcs, - &exynos_plane_funcs, NULL, 0); -} - -int exynos_plane_set_zpos_ioctl(struct drm_device *dev, void *data, - struct drm_file *file_priv) -{ - struct drm_exynos_plane_set_zpos *zpos_req = data; - struct drm_mode_object *obj; - struct drm_plane *plane; - struct exynos_plane *exynos_plane; - int ret = 0; - - DRM_DEBUG_KMS("[%d] %s\n", __LINE__, __func__); - - if (!drm_core_check_feature(dev, DRIVER_MODESET)) - return -EINVAL; - - if (zpos_req->zpos < 0 || zpos_req->zpos >= MAX_PLANE) { - if (zpos_req->zpos != DEFAULT_ZPOS) { - DRM_ERROR("zpos not within limits\n"); - return -EINVAL; - } - } - - mutex_lock(&dev->mode_config.mutex); - - obj = drm_mode_object_find(dev, zpos_req->plane_id, - DRM_MODE_OBJECT_PLANE); - if (!obj) { - DRM_DEBUG_KMS("Unknown plane ID %d\n", - zpos_req->plane_id); - ret = -EINVAL; - goto out; - } - - plane = obj_to_plane(obj); - exynos_plane = container_of(plane, struct exynos_plane, base); - - exynos_plane->overlay.zpos = zpos_req->zpos; - -out: - mutex_unlock(&dev->mode_config.mutex); - return ret; -} diff --git a/trunk/drivers/gpu/drm/exynos/exynos_drm_plane.h b/trunk/drivers/gpu/drm/exynos/exynos_drm_plane.h deleted file mode 100644 index 16b71f8217e7..000000000000 --- a/trunk/drivers/gpu/drm/exynos/exynos_drm_plane.h +++ /dev/null @@ -1,14 +0,0 @@ -/* - * Copyright (C) 2011 Samsung Electronics Co.Ltd - * Authors: Joonyoung Shim - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - */ - -int exynos_plane_init(struct drm_device *dev, unsigned int nr); -int exynos_plane_set_zpos_ioctl(struct drm_device *dev, void *data, - struct drm_file *file_priv); diff --git a/trunk/drivers/gpu/drm/nouveau/nouveau_drv.h b/trunk/drivers/gpu/drm/nouveau/nouveau_drv.h index dfddb7e078a1..999bcb6a20b8 100644 --- a/trunk/drivers/gpu/drm/nouveau/nouveau_drv.h +++ b/trunk/drivers/gpu/drm/nouveau/nouveau_drv.h @@ -525,6 +525,7 @@ struct nouveau_pm_engine { struct nouveau_pm_memtimings memtimings; struct nouveau_pm_temp_sensor_constants sensor_constants; struct nouveau_pm_threshold_temp threshold_temp; + u32 pwm_divisor; struct nouveau_pm_level boot; struct nouveau_pm_level *cur; diff --git a/trunk/drivers/gpu/drm/nouveau/nouveau_perf.c b/trunk/drivers/gpu/drm/nouveau/nouveau_perf.c index 33d03fbf00df..3d20dca08fe8 100644 --- a/trunk/drivers/gpu/drm/nouveau/nouveau_perf.c +++ b/trunk/drivers/gpu/drm/nouveau/nouveau_perf.c @@ -210,6 +210,9 @@ nouveau_perf_init(struct drm_device *dev) recordlen = perf[2] + (perf[3] * perf[4]); entries = perf[5]; } + + if (version < 0x30) + pm->pwm_divisor = ROM16(perf[6]); } else { if (bios->data[bios->offset + 6] < 0x25) { legacy_perf_init(dev); @@ -283,7 +286,6 @@ nouveau_perf_init(struct drm_device *dev) perflvl->memory = ROM16(entry[11]) * 1000; else perflvl->memory = ROM16(entry[11]) * 2000; - break; case 0x25: perflvl->fanspeed = entry[4]; diff --git a/trunk/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h b/trunk/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h index dc279706ca70..8cca91a93bde 100644 --- a/trunk/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h +++ b/trunk/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h @@ -390,11 +390,6 @@ extern int vmw_context_check(struct vmw_private *dev_priv, struct ttm_object_file *tfile, int id, struct vmw_resource **p_res); -extern int vmw_user_lookup_handle(struct vmw_private *dev_priv, - struct ttm_object_file *tfile, - uint32_t handle, - struct vmw_surface **out_surf, - struct vmw_dma_buffer **out_buf); extern void vmw_surface_res_free(struct vmw_resource *res); extern int vmw_surface_init(struct vmw_private *dev_priv, struct vmw_surface *srf, diff --git a/trunk/drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c b/trunk/drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c index a0c2f12b1e1b..03bbc2a6f9a7 100644 --- a/trunk/drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c +++ b/trunk/drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c @@ -33,7 +33,6 @@ bool vmw_fifo_have_3d(struct vmw_private *dev_priv) { __le32 __iomem *fifo_mem = dev_priv->mmio_virt; uint32_t fifo_min, hwversion; - const struct vmw_fifo_state *fifo = &dev_priv->fifo; if (!(dev_priv->capabilities & SVGA_CAP_EXTENDED_FIFO)) return false; @@ -42,12 +41,7 @@ bool vmw_fifo_have_3d(struct vmw_private *dev_priv) if (fifo_min <= SVGA_FIFO_3D_HWVERSION * sizeof(unsigned int)) return false; - hwversion = ioread32(fifo_mem + - ((fifo->capabilities & - SVGA_FIFO_CAP_3D_HWVERSION_REVISED) ? - SVGA_FIFO_3D_HWVERSION_REVISED : - SVGA_FIFO_3D_HWVERSION)); - + hwversion = ioread32(fifo_mem + SVGA_FIFO_3D_HWVERSION); if (hwversion == 0) return false; diff --git a/trunk/drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c b/trunk/drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c index 66917c6c3813..5ff561d4e0b4 100644 --- a/trunk/drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c +++ b/trunk/drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c @@ -58,14 +58,8 @@ int vmw_getparam_ioctl(struct drm_device *dev, void *data, case DRM_VMW_PARAM_FIFO_HW_VERSION: { __le32 __iomem *fifo_mem = dev_priv->mmio_virt; - const struct vmw_fifo_state *fifo = &dev_priv->fifo; - - param->value = - ioread32(fifo_mem + - ((fifo->capabilities & - SVGA_FIFO_CAP_3D_HWVERSION_REVISED) ? - SVGA_FIFO_3D_HWVERSION_REVISED : - SVGA_FIFO_3D_HWVERSION)); + + param->value = ioread32(fifo_mem + SVGA_FIFO_3D_HWVERSION); break; } default: @@ -172,7 +166,13 @@ int vmw_present_ioctl(struct drm_device *dev, void *data, ret = -EINVAL; goto out_no_fb; } + vfb = vmw_framebuffer_to_vfb(obj_to_fb(obj)); + if (!vfb->dmabuf) { + DRM_ERROR("Framebuffer not dmabuf backed.\n"); + ret = -EINVAL; + goto out_no_fb; + } ret = ttm_read_lock(&vmaster->lock, true); if (unlikely(ret != 0)) diff --git a/trunk/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c b/trunk/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c index c4bdef3062c7..1748a7142aca 100644 --- a/trunk/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +++ b/trunk/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c @@ -31,44 +31,6 @@ /* Might need a hrtimer here? */ #define VMWGFX_PRESENT_RATE ((HZ / 60 > 0) ? HZ / 60 : 1) - -struct vmw_clip_rect { - int x1, x2, y1, y2; -}; - -/** - * Clip @num_rects number of @rects against @clip storing the - * results in @out_rects and the number of passed rects in @out_num. - */ -void vmw_clip_cliprects(struct drm_clip_rect *rects, - int num_rects, - struct vmw_clip_rect clip, - SVGASignedRect *out_rects, - int *out_num) -{ - int i, k; - - for (i = 0, k = 0; i < num_rects; i++) { - int x1 = max_t(int, clip.x1, rects[i].x1); - int y1 = max_t(int, clip.y1, rects[i].y1); - int x2 = min_t(int, clip.x2, rects[i].x2); - int y2 = min_t(int, clip.y2, rects[i].y2); - - if (x1 >= x2) - continue; - if (y1 >= y2) - continue; - - out_rects[k].left = x1; - out_rects[k].top = y1; - out_rects[k].right = x2; - out_rects[k].bottom = y2; - k++; - } - - *out_num = k; -} - void vmw_display_unit_cleanup(struct vmw_display_unit *du) { if (du->cursor_surface) @@ -120,43 +82,6 @@ int vmw_cursor_update_image(struct vmw_private *dev_priv, return 0; } -int vmw_cursor_update_dmabuf(struct vmw_private *dev_priv, - struct vmw_dma_buffer *dmabuf, - u32 width, u32 height, - u32 hotspotX, u32 hotspotY) -{ - struct ttm_bo_kmap_obj map; - unsigned long kmap_offset; - unsigned long kmap_num; - void *virtual; - bool dummy; - int ret; - - kmap_offset = 0; - kmap_num = (width*height*4 + PAGE_SIZE - 1) >> PAGE_SHIFT; - - ret = ttm_bo_reserve(&dmabuf->base, true, false, false, 0); - if (unlikely(ret != 0)) { - DRM_ERROR("reserve failed\n"); - return -EINVAL; - } - - ret = ttm_bo_kmap(&dmabuf->base, kmap_offset, kmap_num, &map); - if (unlikely(ret != 0)) - goto err_unreserve; - - virtual = ttm_kmap_obj_virtual(&map, &dummy); - ret = vmw_cursor_update_image(dev_priv, virtual, width, height, - hotspotX, hotspotY); - - ttm_bo_kunmap(&map); -err_unreserve: - ttm_bo_unreserve(&dmabuf->base); - - return ret; -} - - void vmw_cursor_update_position(struct vmw_private *dev_priv, bool show, int x, int y) { @@ -185,21 +110,24 @@ int vmw_du_crtc_cursor_set(struct drm_crtc *crtc, struct drm_file *file_priv, return -EINVAL; if (handle) { - ret = vmw_user_lookup_handle(dev_priv, tfile, - handle, &surface, &dmabuf); - if (ret) { - DRM_ERROR("failed to find surface or dmabuf: %i\n", ret); - return -EINVAL; + ret = vmw_user_surface_lookup_handle(dev_priv, tfile, + handle, &surface); + if (!ret) { + if (!surface->snooper.image) { + DRM_ERROR("surface not suitable for cursor\n"); + vmw_surface_unreference(&surface); + return -EINVAL; + } + } else { + ret = vmw_user_dmabuf_lookup(tfile, + handle, &dmabuf); + if (ret) { + DRM_ERROR("failed to find surface or dmabuf: %i\n", ret); + return -EINVAL; + } } } - /* need to do this before taking down old image */ - if (surface && !surface->snooper.image) { - DRM_ERROR("surface not suitable for cursor\n"); - vmw_surface_unreference(&surface); - return -EINVAL; - } - /* takedown old cursor */ if (du->cursor_surface) { du->cursor_surface->snooper.crtc = NULL; @@ -218,11 +146,36 @@ int vmw_du_crtc_cursor_set(struct drm_crtc *crtc, struct drm_file *file_priv, vmw_cursor_update_image(dev_priv, surface->snooper.image, 64, 64, du->hotspot_x, du->hotspot_y); } else if (dmabuf) { + struct ttm_bo_kmap_obj map; + unsigned long kmap_offset; + unsigned long kmap_num; + void *virtual; + bool dummy; + /* vmw_user_surface_lookup takes one reference */ du->cursor_dmabuf = dmabuf; - ret = vmw_cursor_update_dmabuf(dev_priv, dmabuf, width, height, - du->hotspot_x, du->hotspot_y); + kmap_offset = 0; + kmap_num = (64*64*4) >> PAGE_SHIFT; + + ret = ttm_bo_reserve(&dmabuf->base, true, false, false, 0); + if (unlikely(ret != 0)) { + DRM_ERROR("reserve failed\n"); + return -EINVAL; + } + + ret = ttm_bo_kmap(&dmabuf->base, kmap_offset, kmap_num, &map); + if (unlikely(ret != 0)) + goto err_unreserve; + + virtual = ttm_kmap_obj_virtual(&map, &dummy); + vmw_cursor_update_image(dev_priv, virtual, 64, 64, + du->hotspot_x, du->hotspot_y); + + ttm_bo_kunmap(&map); +err_unreserve: + ttm_bo_unreserve(&dmabuf->base); + } else { vmw_cursor_update_position(dev_priv, false, 0, 0); return 0; @@ -424,9 +377,8 @@ static int do_surface_dirty_sou(struct vmw_private *dev_priv, struct drm_clip_rect *clips, unsigned num_clips, int inc) { - struct vmw_display_unit *units[VMWGFX_NUM_DISPLAY_UNITS]; struct drm_clip_rect *clips_ptr; - struct drm_clip_rect *tmp; + struct vmw_display_unit *units[VMWGFX_NUM_DISPLAY_UNITS]; struct drm_crtc *crtc; size_t fifo_size; int i, num_units; @@ -439,6 +391,7 @@ static int do_surface_dirty_sou(struct vmw_private *dev_priv, } *cmd; SVGASignedRect *blits; + num_units = 0; list_for_each_entry(crtc, &dev_priv->dev->mode_config.crtc_list, head) { @@ -449,24 +402,13 @@ static int do_surface_dirty_sou(struct vmw_private *dev_priv, BUG_ON(!clips || !num_clips); - tmp = kzalloc(sizeof(*tmp) * num_clips, GFP_KERNEL); - if (unlikely(tmp == NULL)) { - DRM_ERROR("Temporary cliprect memory alloc failed.\n"); - return -ENOMEM; - } - fifo_size = sizeof(*cmd) + sizeof(SVGASignedRect) * num_clips; cmd = kzalloc(fifo_size, GFP_KERNEL); if (unlikely(cmd == NULL)) { DRM_ERROR("Temporary fifo memory alloc failed.\n"); - ret = -ENOMEM; - goto out_free_tmp; + return -ENOMEM; } - /* setup blits pointer */ - blits = (SVGASignedRect *)&cmd[1]; - - /* initial clip region */ left = clips->x1; right = clips->x2; top = clips->y1; @@ -492,60 +434,45 @@ static int do_surface_dirty_sou(struct vmw_private *dev_priv, cmd->body.srcRect.bottom = bottom; clips_ptr = clips; + blits = (SVGASignedRect *)&cmd[1]; for (i = 0; i < num_clips; i++, clips_ptr += inc) { - tmp[i].x1 = clips_ptr->x1 - left; - tmp[i].x2 = clips_ptr->x2 - left; - tmp[i].y1 = clips_ptr->y1 - top; - tmp[i].y2 = clips_ptr->y2 - top; + blits[i].left = clips_ptr->x1 - left; + blits[i].right = clips_ptr->x2 - left; + blits[i].top = clips_ptr->y1 - top; + blits[i].bottom = clips_ptr->y2 - top; } /* do per unit writing, reuse fifo for each */ for (i = 0; i < num_units; i++) { struct vmw_display_unit *unit = units[i]; - struct vmw_clip_rect clip; - int num; - - clip.x1 = left - unit->crtc.x; - clip.y1 = top - unit->crtc.y; - clip.x2 = right - unit->crtc.x; - clip.y2 = bottom - unit->crtc.y; + int clip_x1 = left - unit->crtc.x; + int clip_y1 = top - unit->crtc.y; + int clip_x2 = right - unit->crtc.x; + int clip_y2 = bottom - unit->crtc.y; /* skip any crtcs that misses the clip region */ - if (clip.x1 >= unit->crtc.mode.hdisplay || - clip.y1 >= unit->crtc.mode.vdisplay || - clip.x2 <= 0 || clip.y2 <= 0) + if (clip_x1 >= unit->crtc.mode.hdisplay || + clip_y1 >= unit->crtc.mode.vdisplay || + clip_x2 <= 0 || clip_y2 <= 0) continue; - /* - * In order for the clip rects to be correctly scaled - * the src and dest rects needs to be the same size. - */ - cmd->body.destRect.left = clip.x1; - cmd->body.destRect.right = clip.x2; - cmd->body.destRect.top = clip.y1; - cmd->body.destRect.bottom = clip.y2; - - /* create a clip rect of the crtc in dest coords */ - clip.x2 = unit->crtc.mode.hdisplay - clip.x1; - clip.y2 = unit->crtc.mode.vdisplay - clip.y1; - clip.x1 = 0 - clip.x1; - clip.y1 = 0 - clip.y1; - /* need to reset sid as it is changed by execbuf */ cmd->body.srcImage.sid = cpu_to_le32(framebuffer->user_handle); + cmd->body.destScreenId = unit->unit; - /* clip and write blits to cmd stream */ - vmw_clip_cliprects(tmp, num_clips, clip, blits, &num); + /* + * The blit command is a lot more resilient then the + * readback command when it comes to clip rects. So its + * okay to go out of bounds. + */ - /* if no cliprects hit skip this */ - if (num == 0) - continue; + cmd->body.destRect.left = clip_x1; + cmd->body.destRect.right = clip_x2; + cmd->body.destRect.top = clip_y1; + cmd->body.destRect.bottom = clip_y2; - /* recalculate package length */ - fifo_size = sizeof(*cmd) + sizeof(SVGASignedRect) * num; - cmd->header.size = cpu_to_le32(fifo_size - sizeof(cmd->header)); ret = vmw_execbuf_process(file_priv, dev_priv, NULL, cmd, fifo_size, 0, NULL); @@ -553,10 +480,7 @@ static int do_surface_dirty_sou(struct vmw_private *dev_priv, break; } - kfree(cmd); -out_free_tmp: - kfree(tmp); return ret; } @@ -632,10 +556,6 @@ static int vmw_kms_new_framebuffer_surface(struct vmw_private *dev_priv, * Sanity checks. */ - /* Surface must be marked as a scanout. */ - if (unlikely(!surface->scanout)) - return -EINVAL; - if (unlikely(surface->mip_levels[0] != 1 || surface->num_sizes != 1 || surface->sizes[0].width < mode_cmd->width || @@ -862,7 +782,6 @@ static int do_dmabuf_dirty_sou(struct drm_file *file_priv, int clip_y1 = clips_ptr->y1 - unit->crtc.y; int clip_x2 = clips_ptr->x2 - unit->crtc.x; int clip_y2 = clips_ptr->y2 - unit->crtc.y; - int move_x, move_y; /* skip any crtcs that misses the clip region */ if (clip_x1 >= unit->crtc.mode.hdisplay || @@ -870,21 +789,12 @@ static int do_dmabuf_dirty_sou(struct drm_file *file_priv, clip_x2 <= 0 || clip_y2 <= 0) continue; - /* clip size to crtc size */ - clip_x2 = min_t(int, clip_x2, unit->crtc.mode.hdisplay); - clip_y2 = min_t(int, clip_y2, unit->crtc.mode.vdisplay); - - /* translate both src and dest to bring clip into screen */ - move_x = min_t(int, clip_x1, 0); - move_y = min_t(int, clip_y1, 0); - - /* actual translate done here */ blits[hit_num].header = SVGA_CMD_BLIT_GMRFB_TO_SCREEN; blits[hit_num].body.destScreenId = unit->unit; - blits[hit_num].body.srcOrigin.x = clips_ptr->x1 - move_x; - blits[hit_num].body.srcOrigin.y = clips_ptr->y1 - move_y; - blits[hit_num].body.destRect.left = clip_x1 - move_x; - blits[hit_num].body.destRect.top = clip_y1 - move_y; + blits[hit_num].body.srcOrigin.x = clips_ptr->x1; + blits[hit_num].body.srcOrigin.y = clips_ptr->y1; + blits[hit_num].body.destRect.left = clip_x1; + blits[hit_num].body.destRect.top = clip_y1; blits[hit_num].body.destRect.right = clip_x2; blits[hit_num].body.destRect.bottom = clip_y2; hit_num++; @@ -1135,29 +1045,42 @@ static struct drm_framebuffer *vmw_kms_fb_create(struct drm_device *dev, * End conditioned code. */ - /* returns either a dmabuf or surface */ - ret = vmw_user_lookup_handle(dev_priv, tfile, - mode_cmd.handle, - &surface, &bo); + ret = vmw_user_surface_lookup_handle(dev_priv, tfile, + mode_cmd.handle, &surface); if (ret) - goto err_out; - - /* Create the new framebuffer depending one what we got back */ - if (bo) - ret = vmw_kms_new_framebuffer_dmabuf(dev_priv, bo, &vfb, - &mode_cmd); - else if (surface) - ret = vmw_kms_new_framebuffer_surface(dev_priv, file_priv, - surface, &vfb, &mode_cmd); - else - BUG(); + goto try_dmabuf; + + if (!surface->scanout) + goto err_not_scanout; + + ret = vmw_kms_new_framebuffer_surface(dev_priv, file_priv, surface, + &vfb, &mode_cmd); -err_out: - /* vmw_user_lookup_handle takes one ref so does new_fb */ - if (bo) - vmw_dmabuf_unreference(&bo); - if (surface) - vmw_surface_unreference(&surface); + /* vmw_user_surface_lookup takes one ref so does new_fb */ + vmw_surface_unreference(&surface); + + if (ret) { + DRM_ERROR("failed to create vmw_framebuffer: %i\n", ret); + ttm_base_object_unref(&user_obj); + return ERR_PTR(ret); + } else + vfb->user_obj = user_obj; + return &vfb->base; + +try_dmabuf: + DRM_INFO("%s: trying buffer\n", __func__); + + ret = vmw_user_dmabuf_lookup(tfile, mode_cmd.handle, &bo); + if (ret) { + DRM_ERROR("failed to find buffer: %i\n", ret); + return ERR_PTR(-ENOENT); + } + + ret = vmw_kms_new_framebuffer_dmabuf(dev_priv, bo, &vfb, + &mode_cmd); + + /* vmw_user_dmabuf_lookup takes one ref so does new_fb */ + vmw_dmabuf_unreference(&bo); if (ret) { DRM_ERROR("failed to create vmw_framebuffer: %i\n", ret); @@ -1167,6 +1090,14 @@ static struct drm_framebuffer *vmw_kms_fb_create(struct drm_device *dev, vfb->user_obj = user_obj; return &vfb->base; + +err_not_scanout: + DRM_ERROR("surface not marked as scanout\n"); + /* vmw_user_surface_lookup takes one ref */ + vmw_surface_unreference(&surface); + ttm_base_object_unref(&user_obj); + + return ERR_PTR(-EINVAL); } static struct drm_mode_config_funcs vmw_kms_funcs = { @@ -1183,12 +1114,10 @@ int vmw_kms_present(struct vmw_private *dev_priv, uint32_t num_clips) { struct vmw_display_unit *units[VMWGFX_NUM_DISPLAY_UNITS]; - struct drm_clip_rect *tmp; struct drm_crtc *crtc; size_t fifo_size; int i, k, num_units; int ret = 0; /* silence warning */ - int left, right, top, bottom; struct { SVGA3dCmdHeader header; @@ -1206,95 +1135,60 @@ int vmw_kms_present(struct vmw_private *dev_priv, BUG_ON(surface == NULL); BUG_ON(!clips || !num_clips); - tmp = kzalloc(sizeof(*tmp) * num_clips, GFP_KERNEL); - if (unlikely(tmp == NULL)) { - DRM_ERROR("Temporary cliprect memory alloc failed.\n"); - return -ENOMEM; - } - fifo_size = sizeof(*cmd) + sizeof(SVGASignedRect) * num_clips; cmd = kmalloc(fifo_size, GFP_KERNEL); if (unlikely(cmd == NULL)) { DRM_ERROR("Failed to allocate temporary fifo memory.\n"); - ret = -ENOMEM; - goto out_free_tmp; - } - - left = clips->x; - right = clips->x + clips->w; - top = clips->y; - bottom = clips->y + clips->h; - - for (i = 1; i < num_clips; i++) { - left = min_t(int, left, (int)clips[i].x); - right = max_t(int, right, (int)clips[i].x + clips[i].w); - top = min_t(int, top, (int)clips[i].y); - bottom = max_t(int, bottom, (int)clips[i].y + clips[i].h); + return -ENOMEM; } /* only need to do this once */ memset(cmd, 0, fifo_size); cmd->header.id = cpu_to_le32(SVGA_3D_CMD_BLIT_SURFACE_TO_SCREEN); + cmd->header.size = cpu_to_le32(fifo_size - sizeof(cmd->header)); - blits = (SVGASignedRect *)&cmd[1]; - - cmd->body.srcRect.left = left; - cmd->body.srcRect.right = right; - cmd->body.srcRect.top = top; - cmd->body.srcRect.bottom = bottom; + cmd->body.srcRect.left = 0; + cmd->body.srcRect.right = surface->sizes[0].width; + cmd->body.srcRect.top = 0; + cmd->body.srcRect.bottom = surface->sizes[0].height; + blits = (SVGASignedRect *)&cmd[1]; for (i = 0; i < num_clips; i++) { - tmp[i].x1 = clips[i].x - left; - tmp[i].x2 = clips[i].x + clips[i].w - left; - tmp[i].y1 = clips[i].y - top; - tmp[i].y2 = clips[i].y + clips[i].h - top; + blits[i].left = clips[i].x; + blits[i].right = clips[i].x + clips[i].w; + blits[i].top = clips[i].y; + blits[i].bottom = clips[i].y + clips[i].h; } for (k = 0; k < num_units; k++) { struct vmw_display_unit *unit = units[k]; - struct vmw_clip_rect clip; - int num; - - clip.x1 = left + destX - unit->crtc.x; - clip.y1 = top + destY - unit->crtc.y; - clip.x2 = right + destX - unit->crtc.x; - clip.y2 = bottom + destY - unit->crtc.y; + int clip_x1 = destX - unit->crtc.x; + int clip_y1 = destY - unit->crtc.y; + int clip_x2 = clip_x1 + surface->sizes[0].width; + int clip_y2 = clip_y1 + surface->sizes[0].height; /* skip any crtcs that misses the clip region */ - if (clip.x1 >= unit->crtc.mode.hdisplay || - clip.y1 >= unit->crtc.mode.vdisplay || - clip.x2 <= 0 || clip.y2 <= 0) + if (clip_x1 >= unit->crtc.mode.hdisplay || + clip_y1 >= unit->crtc.mode.vdisplay || + clip_x2 <= 0 || clip_y2 <= 0) continue; - /* - * In order for the clip rects to be correctly scaled - * the src and dest rects needs to be the same size. - */ - cmd->body.destRect.left = clip.x1; - cmd->body.destRect.right = clip.x2; - cmd->body.destRect.top = clip.y1; - cmd->body.destRect.bottom = clip.y2; - - /* create a clip rect of the crtc in dest coords */ - clip.x2 = unit->crtc.mode.hdisplay - clip.x1; - clip.y2 = unit->crtc.mode.vdisplay - clip.y1; - clip.x1 = 0 - clip.x1; - clip.y1 = 0 - clip.y1; - /* need to reset sid as it is changed by execbuf */ cmd->body.srcImage.sid = sid; + cmd->body.destScreenId = unit->unit; - /* clip and write blits to cmd stream */ - vmw_clip_cliprects(tmp, num_clips, clip, blits, &num); + /* + * The blit command is a lot more resilient then the + * readback command when it comes to clip rects. So its + * okay to go out of bounds. + */ - /* if no cliprects hit skip this */ - if (num == 0) - continue; + cmd->body.destRect.left = clip_x1; + cmd->body.destRect.right = clip_x2; + cmd->body.destRect.top = clip_y1; + cmd->body.destRect.bottom = clip_y2; - /* recalculate package length */ - fifo_size = sizeof(*cmd) + sizeof(SVGASignedRect) * num; - cmd->header.size = cpu_to_le32(fifo_size - sizeof(cmd->header)); ret = vmw_execbuf_process(file_priv, dev_priv, NULL, cmd, fifo_size, 0, NULL); @@ -1303,8 +1197,6 @@ int vmw_kms_present(struct vmw_private *dev_priv, } kfree(cmd); -out_free_tmp: - kfree(tmp); return ret; } diff --git a/trunk/drivers/gpu/drm/vmwgfx/vmwgfx_kms.h b/trunk/drivers/gpu/drm/vmwgfx/vmwgfx_kms.h index a4f7f034996a..055b844bd80f 100644 --- a/trunk/drivers/gpu/drm/vmwgfx/vmwgfx_kms.h +++ b/trunk/drivers/gpu/drm/vmwgfx/vmwgfx_kms.h @@ -63,14 +63,9 @@ struct vmw_framebuffer { int vmw_cursor_update_image(struct vmw_private *dev_priv, u32 *image, u32 width, u32 height, u32 hotspotX, u32 hotspotY); -int vmw_cursor_update_dmabuf(struct vmw_private *dev_priv, - struct vmw_dma_buffer *dmabuf, - u32 width, u32 height, - u32 hotspotX, u32 hotspotY); void vmw_cursor_update_position(struct vmw_private *dev_priv, bool show, int x, int y); - /** * Base class display unit. * diff --git a/trunk/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c b/trunk/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c index f77b184be807..15a6805e48b0 100644 --- a/trunk/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c +++ b/trunk/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c @@ -74,10 +74,9 @@ static int vmw_ldu_commit_list(struct vmw_private *dev_priv) { struct vmw_legacy_display *lds = dev_priv->ldu_priv; struct vmw_legacy_display_unit *entry; - struct vmw_display_unit *du = NULL; struct drm_framebuffer *fb = NULL; struct drm_crtc *crtc = NULL; - int i = 0, ret; + int i = 0; /* If there is no display topology the host just assumes * that the guest will set the same layout as the host. @@ -130,25 +129,6 @@ static int vmw_ldu_commit_list(struct vmw_private *dev_priv) lds->last_num_active = lds->num_active; - - /* Find the first du with a cursor. */ - list_for_each_entry(entry, &lds->active, active) { - du = &entry->base; - - if (!du->cursor_dmabuf) - continue; - - ret = vmw_cursor_update_dmabuf(dev_priv, - du->cursor_dmabuf, - 64, 64, - du->hotspot_x, - du->hotspot_y); - if (ret == 0) - break; - - DRM_ERROR("Could not update cursor image\n"); - } - return 0; } diff --git a/trunk/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c b/trunk/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c index a37abb581cbb..2eb84a55aee7 100644 --- a/trunk/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c +++ b/trunk/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c @@ -1190,29 +1190,6 @@ void vmw_resource_unreserve(struct list_head *list) write_unlock(lock); } -/** - * Helper function that looks either a surface or dmabuf. - * - * The pointer this pointed at by out_surf and out_buf needs to be null. - */ -int vmw_user_lookup_handle(struct vmw_private *dev_priv, - struct ttm_object_file *tfile, - uint32_t handle, - struct vmw_surface **out_surf, - struct vmw_dma_buffer **out_buf) -{ - int ret; - - BUG_ON(*out_surf || *out_buf); - - ret = vmw_user_surface_lookup_handle(dev_priv, tfile, handle, out_surf); - if (!ret) - return 0; - - ret = vmw_user_dmabuf_lookup(tfile, handle, out_buf); - return ret; -} - int vmw_user_surface_lookup_handle(struct vmw_private *dev_priv, struct ttm_object_file *tfile, diff --git a/trunk/drivers/i2c/busses/i2c-eg20t.c b/trunk/drivers/i2c/busses/i2c-eg20t.c index 18936ac9d51c..8cebef49aeac 100644 --- a/trunk/drivers/i2c/busses/i2c-eg20t.c +++ b/trunk/drivers/i2c/busses/i2c-eg20t.c @@ -893,13 +893,6 @@ static int __devinit pch_i2c_probe(struct pci_dev *pdev, /* Set the number of I2C channel instance */ adap_info->ch_num = id->driver_data; - ret = request_irq(pdev->irq, pch_i2c_handler, IRQF_SHARED, - KBUILD_MODNAME, adap_info); - if (ret) { - pch_pci_err(pdev, "request_irq FAILED\n"); - goto err_request_irq; - } - for (i = 0; i < adap_info->ch_num; i++) { pch_adap = &adap_info->pch_data[i].pch_adapter; adap_info->pch_i2c_suspended = false; @@ -917,23 +910,28 @@ static int __devinit pch_i2c_probe(struct pci_dev *pdev, pch_adap->dev.parent = &pdev->dev; - pch_i2c_init(&adap_info->pch_data[i]); ret = i2c_add_adapter(pch_adap); if (ret) { pch_pci_err(pdev, "i2c_add_adapter[ch:%d] FAILED\n", i); - goto err_add_adapter; + goto err_i2c_add_adapter; } + + pch_i2c_init(&adap_info->pch_data[i]); + } + ret = request_irq(pdev->irq, pch_i2c_handler, IRQF_SHARED, + KBUILD_MODNAME, adap_info); + if (ret) { + pch_pci_err(pdev, "request_irq FAILED\n"); + goto err_i2c_add_adapter; } pci_set_drvdata(pdev, adap_info); pch_pci_dbg(pdev, "returns %d.\n", ret); return 0; -err_add_adapter: +err_i2c_add_adapter: for (j = 0; j < i; j++) i2c_del_adapter(&adap_info->pch_data[j].pch_adapter); - free_irq(pdev->irq, adap_info); -err_request_irq: pci_iounmap(pdev, base_addr); err_pci_iomap: pci_release_regions(pdev); diff --git a/trunk/drivers/i2c/busses/i2c-omap.c b/trunk/drivers/i2c/busses/i2c-omap.c index fa23faa20f0e..a43d0023446a 100644 --- a/trunk/drivers/i2c/busses/i2c-omap.c +++ b/trunk/drivers/i2c/busses/i2c-omap.c @@ -1047,14 +1047,13 @@ omap_i2c_probe(struct platform_device *pdev) * size. This is to ensure that we can handle the status on int * call back latencies. */ - - dev->fifo_size = (dev->fifo_size / 2); - - if (dev->rev >= OMAP_I2C_REV_ON_3530_4430) + if (dev->rev >= OMAP_I2C_REV_ON_3530_4430) { + dev->fifo_size = 0; dev->b_hw = 0; /* Disable hardware fixes */ - else + } else { + dev->fifo_size = (dev->fifo_size / 2); dev->b_hw = 1; /* Enable hardware fixes */ - + } /* calculate wakeup latency constraint for MPU */ if (dev->set_mpu_wkup_lat != NULL) dev->latency = (1000000 * dev->fifo_size) / diff --git a/trunk/drivers/i2c/busses/i2c-s3c2410.c b/trunk/drivers/i2c/busses/i2c-s3c2410.c index 4c1718081685..2754cef86a06 100644 --- a/trunk/drivers/i2c/busses/i2c-s3c2410.c +++ b/trunk/drivers/i2c/busses/i2c-s3c2410.c @@ -534,7 +534,6 @@ static int s3c24xx_i2c_doxfer(struct s3c24xx_i2c *i2c, /* first, try busy waiting briefly */ do { - cpu_relax(); iicstat = readl(i2c->regs + S3C2410_IICSTAT); } while ((iicstat & S3C2410_IICSTAT_START) && --spins); @@ -787,7 +786,7 @@ static void s3c24xx_i2c_dt_gpio_free(struct s3c24xx_i2c *i2c) #else static int s3c24xx_i2c_parse_dt_gpio(struct s3c24xx_i2c *i2c) { - return 0; + return -EINVAL; } static void s3c24xx_i2c_dt_gpio_free(struct s3c24xx_i2c *i2c) diff --git a/trunk/drivers/pci/ats.c b/trunk/drivers/pci/ats.c index b0dd08e6a9da..7ec56fb0bd78 100644 --- a/trunk/drivers/pci/ats.c +++ b/trunk/drivers/pci/ats.c @@ -13,7 +13,6 @@ #include #include #include -#include #include "pci.h" diff --git a/trunk/drivers/pci/hotplug/acpiphp_glue.c b/trunk/drivers/pci/hotplug/acpiphp_glue.c index 9ddf69e3bbef..fce1c54a0c8d 100644 --- a/trunk/drivers/pci/hotplug/acpiphp_glue.c +++ b/trunk/drivers/pci/hotplug/acpiphp_glue.c @@ -132,18 +132,6 @@ register_slot(acpi_handle handle, u32 lvl, void *context, void **rv) if (!acpi_pci_check_ejectable(pbus, handle) && !is_dock_device(handle)) return AE_OK; - pdev = pbus->self; - if (pdev && pci_is_pcie(pdev)) { - tmp = acpi_find_root_bridge_handle(pdev); - if (tmp) { - struct acpi_pci_root *root = acpi_pci_find_root(tmp); - - if (root && (root->osc_control_set & - OSC_PCI_EXPRESS_NATIVE_HP_CONTROL)) - return AE_OK; - } - } - acpi_evaluate_integer(handle, "_ADR", NULL, &adr); device = (adr >> 16) & 0xffff; function = adr & 0xffff; @@ -225,6 +213,7 @@ register_slot(acpi_handle handle, u32 lvl, void *context, void **rv) pdev = pci_get_slot(pbus, PCI_DEVFN(device, function)); if (pdev) { + pdev->current_state = PCI_D0; slot->flags |= (SLOT_ENABLED | SLOT_POWEREDON); pci_dev_put(pdev); } @@ -470,8 +459,17 @@ static int add_bridge(acpi_handle handle) { acpi_status status; unsigned long long tmp; + struct acpi_pci_root *root; acpi_handle dummy_handle; + /* + * We shouldn't use this bridge if PCIe native hotplug control has been + * granted by the BIOS for it. + */ + root = acpi_pci_find_root(handle); + if (root && (root->osc_control_set & OSC_PCI_EXPRESS_NATIVE_HP_CONTROL)) + return -ENODEV; + /* if the bridge doesn't have _STA, we assume it is always there */ status = acpi_get_handle(handle, "_STA", &dummy_handle); if (ACPI_SUCCESS(status)) { @@ -1387,11 +1385,19 @@ static void handle_hotplug_event_func(acpi_handle handle, u32 type, static acpi_status find_root_bridges(acpi_handle handle, u32 lvl, void *context, void **rv) { + struct acpi_pci_root *root; int *count = (int *)context; if (!acpi_is_root_bridge(handle)) return AE_OK; + root = acpi_pci_find_root(handle); + if (!root) + return AE_OK; + + if (root->osc_control_set & OSC_PCI_EXPRESS_NATIVE_HP_CONTROL) + return AE_OK; + (*count)++; acpi_install_notify_handler(handle, ACPI_SYSTEM_NOTIFY, handle_hotplug_event_bridge, NULL); diff --git a/trunk/drivers/pci/iov.c b/trunk/drivers/pci/iov.c index 1969a3ee3058..b82c155d7b37 100644 --- a/trunk/drivers/pci/iov.c +++ b/trunk/drivers/pci/iov.c @@ -283,7 +283,6 @@ static int sriov_enable(struct pci_dev *dev, int nr_virtfn) struct resource *res; struct pci_dev *pdev; struct pci_sriov *iov = dev->sriov; - int bars = 0; if (!nr_virtfn) return 0; @@ -308,7 +307,6 @@ static int sriov_enable(struct pci_dev *dev, int nr_virtfn) nres = 0; for (i = 0; i < PCI_SRIOV_NUM_BARS; i++) { - bars |= (1 << (i + PCI_IOV_RESOURCES)); res = dev->resource + PCI_IOV_RESOURCES + i; if (res->parent) nres++; @@ -326,11 +324,6 @@ static int sriov_enable(struct pci_dev *dev, int nr_virtfn) return -ENOMEM; } - if (pci_enable_resources(dev, bars)) { - dev_err(&dev->dev, "SR-IOV: IOV BARS not allocated\n"); - return -ENOMEM; - } - if (iov->link != dev->devfn) { pdev = pci_get_slot(dev->bus, iov->link); if (!pdev) diff --git a/trunk/drivers/pci/pci.c b/trunk/drivers/pci/pci.c index 6d4a5319148d..6f45a73c6e9f 100644 --- a/trunk/drivers/pci/pci.c +++ b/trunk/drivers/pci/pci.c @@ -664,9 +664,6 @@ static int pci_platform_power_transition(struct pci_dev *dev, pci_power_t state) error = platform_pci_set_power_state(dev, state); if (!error) pci_update_current_state(dev, state); - /* Fall back to PCI_D0 if native PM is not supported */ - if (!dev->pm_cap) - dev->current_state = PCI_D0; } else { error = -ENODEV; /* Fall back to PCI_D0 if native PM is not supported */ @@ -1129,11 +1126,7 @@ static int __pci_enable_device_flags(struct pci_dev *dev, if (atomic_add_return(1, &dev->enable_cnt) > 1) return 0; /* already enabled */ - /* only skip sriov related */ - for (i = 0; i <= PCI_ROM_RESOURCE; i++) - if (dev->resource[i].flags & flags) - bars |= (1 << i); - for (i = PCI_BRIDGE_RESOURCES; i < DEVICE_COUNT_RESOURCE; i++) + for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) if (dev->resource[i].flags & flags) bars |= (1 << i); diff --git a/trunk/drivers/s390/scsi/zfcp_scsi.c b/trunk/drivers/s390/scsi/zfcp_scsi.c index b79576b64f45..11f07f888223 100644 --- a/trunk/drivers/s390/scsi/zfcp_scsi.c +++ b/trunk/drivers/s390/scsi/zfcp_scsi.c @@ -55,10 +55,6 @@ static void zfcp_scsi_slave_destroy(struct scsi_device *sdev) { struct zfcp_scsi_dev *zfcp_sdev = sdev_to_zfcp(sdev); - /* if previous slave_alloc returned early, there is nothing to do */ - if (!zfcp_sdev->port) - return; - zfcp_erp_lun_shutdown_wait(sdev, "scssd_1"); put_device(&zfcp_sdev->port->dev); } diff --git a/trunk/drivers/scsi/bnx2i/bnx2i_hwi.c b/trunk/drivers/scsi/bnx2i/bnx2i_hwi.c index 1ad0b8225560..dba72a4e6a1c 100644 --- a/trunk/drivers/scsi/bnx2i/bnx2i_hwi.c +++ b/trunk/drivers/scsi/bnx2i/bnx2i_hwi.c @@ -1906,19 +1906,18 @@ static int bnx2i_queue_scsi_cmd_resp(struct iscsi_session *session, spin_lock(&session->lock); task = iscsi_itt_to_task(bnx2i_conn->cls_conn->dd_data, cqe->itt & ISCSI_CMD_RESPONSE_INDEX); - if (!task || !task->sc) { + if (!task) { spin_unlock(&session->lock); return -EINVAL; } sc = task->sc; + spin_unlock(&session->lock); if (!blk_rq_cpu_valid(sc->request)) cpu = smp_processor_id(); else cpu = sc->request->cpu; - spin_unlock(&session->lock); - p = &per_cpu(bnx2i_percpu, cpu); spin_lock(&p->p_work_lock); if (unlikely(!p->iothread)) { diff --git a/trunk/drivers/scsi/fcoe/fcoe.c b/trunk/drivers/scsi/fcoe/fcoe.c index 8d67467dd9ce..cefbe44bb84a 100644 --- a/trunk/drivers/scsi/fcoe/fcoe.c +++ b/trunk/drivers/scsi/fcoe/fcoe.c @@ -31,8 +31,6 @@ #include #include #include -#include -#include #include #include #include @@ -103,8 +101,6 @@ static int fcoe_ddp_done(struct fc_lport *, u16); static int fcoe_ddp_target(struct fc_lport *, u16, struct scatterlist *, unsigned int); static int fcoe_cpu_callback(struct notifier_block *, unsigned long, void *); -static int fcoe_dcb_app_notification(struct notifier_block *notifier, - ulong event, void *ptr); static bool fcoe_match(struct net_device *netdev); static int fcoe_create(struct net_device *netdev, enum fip_state fip_mode); @@ -133,11 +129,6 @@ static struct notifier_block fcoe_cpu_notifier = { .notifier_call = fcoe_cpu_callback, }; -/* notification function for DCB events */ -static struct notifier_block dcb_notifier = { - .notifier_call = fcoe_dcb_app_notification, -}; - static struct scsi_transport_template *fcoe_nport_scsi_transport; static struct scsi_transport_template *fcoe_vport_scsi_transport; @@ -1531,8 +1522,6 @@ int fcoe_xmit(struct fc_lport *lport, struct fc_frame *fp) skb_reset_network_header(skb); skb->mac_len = elen; skb->protocol = htons(ETH_P_FCOE); - skb->priority = port->priority; - if (fcoe->netdev->priv_flags & IFF_802_1Q_VLAN && fcoe->realdev->features & NETIF_F_HW_VLAN_TX) { skb->vlan_tci = VLAN_TAG_PRESENT | @@ -1635,7 +1624,6 @@ static inline int fcoe_filter_frames(struct fc_lport *lport, stats->InvalidCRCCount++; if (stats->InvalidCRCCount < 5) printk(KERN_WARNING "fcoe: dropping frame with CRC error\n"); - put_cpu(); return -EINVAL; } @@ -1758,7 +1746,6 @@ int fcoe_percpu_receive_thread(void *arg) */ static void fcoe_dev_setup(void) { - register_dcbevent_notifier(&dcb_notifier); register_netdevice_notifier(&fcoe_notifier); } @@ -1767,69 +1754,9 @@ static void fcoe_dev_setup(void) */ static void fcoe_dev_cleanup(void) { - unregister_dcbevent_notifier(&dcb_notifier); unregister_netdevice_notifier(&fcoe_notifier); } -static struct fcoe_interface * -fcoe_hostlist_lookup_realdev_port(struct net_device *netdev) -{ - struct fcoe_interface *fcoe; - struct net_device *real_dev; - - list_for_each_entry(fcoe, &fcoe_hostlist, list) { - if (fcoe->netdev->priv_flags & IFF_802_1Q_VLAN) - real_dev = vlan_dev_real_dev(fcoe->netdev); - else - real_dev = fcoe->netdev; - - if (netdev == real_dev) - return fcoe; - } - return NULL; -} - -static int fcoe_dcb_app_notification(struct notifier_block *notifier, - ulong event, void *ptr) -{ - struct dcb_app_type *entry = ptr; - struct fcoe_interface *fcoe; - struct net_device *netdev; - struct fcoe_port *port; - int prio; - - if (entry->app.selector != DCB_APP_IDTYPE_ETHTYPE) - return NOTIFY_OK; - - netdev = dev_get_by_index(&init_net, entry->ifindex); - if (!netdev) - return NOTIFY_OK; - - fcoe = fcoe_hostlist_lookup_realdev_port(netdev); - dev_put(netdev); - if (!fcoe) - return NOTIFY_OK; - - if (entry->dcbx & DCB_CAP_DCBX_VER_CEE) - prio = ffs(entry->app.priority) - 1; - else - prio = entry->app.priority; - - if (prio < 0) - return NOTIFY_OK; - - if (entry->app.protocol == ETH_P_FIP || - entry->app.protocol == ETH_P_FCOE) - fcoe->ctlr.priority = prio; - - if (entry->app.protocol == ETH_P_FCOE) { - port = lport_priv(fcoe->ctlr.lp); - port->priority = prio; - } - - return NOTIFY_OK; -} - /** * fcoe_device_notification() - Handler for net device events * @notifier: The context of the notification @@ -2037,46 +1964,6 @@ static bool fcoe_match(struct net_device *netdev) return true; } -/** - * fcoe_dcb_create() - Initialize DCB attributes and hooks - * @netdev: The net_device object of the L2 link that should be queried - * @port: The fcoe_port to bind FCoE APP priority with - * @ - */ -static void fcoe_dcb_create(struct fcoe_interface *fcoe) -{ -#ifdef CONFIG_DCB - int dcbx; - u8 fup, up; - struct net_device *netdev = fcoe->realdev; - struct fcoe_port *port = lport_priv(fcoe->ctlr.lp); - struct dcb_app app = { - .priority = 0, - .protocol = ETH_P_FCOE - }; - - /* setup DCB priority attributes. */ - if (netdev && netdev->dcbnl_ops && netdev->dcbnl_ops->getdcbx) { - dcbx = netdev->dcbnl_ops->getdcbx(netdev); - - if (dcbx & DCB_CAP_DCBX_VER_IEEE) { - app.selector = IEEE_8021QAZ_APP_SEL_ETHERTYPE; - up = dcb_ieee_getapp_mask(netdev, &app); - app.protocol = ETH_P_FIP; - fup = dcb_ieee_getapp_mask(netdev, &app); - } else { - app.selector = DCB_APP_IDTYPE_ETHTYPE; - up = dcb_getapp(netdev, &app); - app.protocol = ETH_P_FIP; - fup = dcb_getapp(netdev, &app); - } - - port->priority = ffs(up) ? ffs(up) - 1 : 0; - fcoe->ctlr.priority = ffs(fup) ? ffs(fup) - 1 : port->priority; - } -#endif -} - /** * fcoe_create() - Create a fcoe interface * @netdev : The net_device object the Ethernet interface to create on @@ -2120,9 +2007,6 @@ static int fcoe_create(struct net_device *netdev, enum fip_state fip_mode) /* Make this the "master" N_Port */ fcoe->ctlr.lp = lport; - /* setup DCB priority attributes. */ - fcoe_dcb_create(fcoe); - /* add to lports list */ fcoe_hostlist_add(lport); diff --git a/trunk/drivers/scsi/fcoe/fcoe_ctlr.c b/trunk/drivers/scsi/fcoe/fcoe_ctlr.c index e7522dcc296e..c74c4b8e71ef 100644 --- a/trunk/drivers/scsi/fcoe/fcoe_ctlr.c +++ b/trunk/drivers/scsi/fcoe/fcoe_ctlr.c @@ -320,7 +320,6 @@ static void fcoe_ctlr_solicit(struct fcoe_ctlr *fip, struct fcoe_fcf *fcf) skb_put(skb, sizeof(*sol)); skb->protocol = htons(ETH_P_FIP); - skb->priority = fip->priority; skb_reset_mac_header(skb); skb_reset_network_header(skb); fip->send(fip, skb); @@ -475,7 +474,6 @@ static void fcoe_ctlr_send_keep_alive(struct fcoe_ctlr *fip, } skb_put(skb, len); skb->protocol = htons(ETH_P_FIP); - skb->priority = fip->priority; skb_reset_mac_header(skb); skb_reset_network_header(skb); fip->send(fip, skb); @@ -568,7 +566,6 @@ static int fcoe_ctlr_encaps(struct fcoe_ctlr *fip, struct fc_lport *lport, cap->fip.fip_dl_len = htons(dlen / FIP_BPW); skb->protocol = htons(ETH_P_FIP); - skb->priority = fip->priority; skb_reset_mac_header(skb); skb_reset_network_header(skb); return 0; @@ -1914,7 +1911,6 @@ static void fcoe_ctlr_vn_send(struct fcoe_ctlr *fip, skb_put(skb, len); skb->protocol = htons(ETH_P_FIP); - skb->priority = fip->priority; skb_reset_mac_header(skb); skb_reset_network_header(skb); diff --git a/trunk/drivers/scsi/mpt2sas/mpt2sas_scsih.c b/trunk/drivers/scsi/mpt2sas/mpt2sas_scsih.c index d570573b7963..4e041f6d808c 100644 --- a/trunk/drivers/scsi/mpt2sas/mpt2sas_scsih.c +++ b/trunk/drivers/scsi/mpt2sas/mpt2sas_scsih.c @@ -4335,7 +4335,7 @@ _scsih_smart_predicted_fault(struct MPT2SAS_ADAPTER *ioc, u16 handle) /* insert into event log */ sz = offsetof(Mpi2EventNotificationReply_t, EventData) + sizeof(Mpi2EventDataSasDeviceStatusChange_t); - event_reply = kzalloc(sz, GFP_ATOMIC); + event_reply = kzalloc(sz, GFP_KERNEL); if (!event_reply) { printk(MPT2SAS_ERR_FMT "failure at %s:%d/%s()!\n", ioc->name, __FILE__, __LINE__, __func__); diff --git a/trunk/drivers/scsi/qla2xxx/qla_attr.c b/trunk/drivers/scsi/qla2xxx/qla_attr.c index 6465dae5883a..ac326c41e931 100644 --- a/trunk/drivers/scsi/qla2xxx/qla_attr.c +++ b/trunk/drivers/scsi/qla2xxx/qla_attr.c @@ -1762,31 +1762,12 @@ qla2x00_get_host_port_state(struct Scsi_Host *shost) scsi_qla_host_t *vha = shost_priv(shost); struct scsi_qla_host *base_vha = pci_get_drvdata(vha->hw->pdev); - if (!base_vha->flags.online) { + if (!base_vha->flags.online) fc_host_port_state(shost) = FC_PORTSTATE_OFFLINE; - return; - } - - switch (atomic_read(&base_vha->loop_state)) { - case LOOP_UPDATE: - fc_host_port_state(shost) = FC_PORTSTATE_DIAGNOSTICS; - break; - case LOOP_DOWN: - if (test_bit(LOOP_RESYNC_NEEDED, &base_vha->dpc_flags)) - fc_host_port_state(shost) = FC_PORTSTATE_DIAGNOSTICS; - else - fc_host_port_state(shost) = FC_PORTSTATE_LINKDOWN; - break; - case LOOP_DEAD: - fc_host_port_state(shost) = FC_PORTSTATE_LINKDOWN; - break; - case LOOP_READY: - fc_host_port_state(shost) = FC_PORTSTATE_ONLINE; - break; - default: + else if (atomic_read(&base_vha->loop_state) == LOOP_TIMEOUT) fc_host_port_state(shost) = FC_PORTSTATE_UNKNOWN; - break; - } + else + fc_host_port_state(shost) = FC_PORTSTATE_ONLINE; } static int diff --git a/trunk/drivers/scsi/qla2xxx/qla_dbg.c b/trunk/drivers/scsi/qla2xxx/qla_dbg.c index f3cddd5800c3..9df4787715c0 100644 --- a/trunk/drivers/scsi/qla2xxx/qla_dbg.c +++ b/trunk/drivers/scsi/qla2xxx/qla_dbg.c @@ -12,17 +12,17 @@ * | Level | Last Value Used | Holes | * ---------------------------------------------------------------------- * | Module Init and Probe | 0x0116 | | - * | Mailbox commands | 0x112b | | + * | Mailbox commands | 0x1129 | | * | Device Discovery | 0x2083 | | * | Queue Command and IO tracing | 0x302e | 0x3008 | * | DPC Thread | 0x401c | | * | Async Events | 0x5059 | | - * | Timer Routines | 0x6010 | 0x600e,0x600f | + * | Timer Routines | 0x600d | | * | User Space Interactions | 0x709d | | - * | Task Management | 0x8041 | 0x800b | + * | Task Management | 0x8041 | | * | AER/EEH | 0x900f | | * | Virtual Port | 0xa007 | | - * | ISP82XX Specific | 0xb052 | | + * | ISP82XX Specific | 0xb051 | | * | MultiQ | 0xc00b | | * | Misc | 0xd00b | | * ---------------------------------------------------------------------- diff --git a/trunk/drivers/scsi/qla2xxx/qla_gbl.h b/trunk/drivers/scsi/qla2xxx/qla_gbl.h index c0c11afb685c..ce32d8135c9e 100644 --- a/trunk/drivers/scsi/qla2xxx/qla_gbl.h +++ b/trunk/drivers/scsi/qla2xxx/qla_gbl.h @@ -578,7 +578,6 @@ extern int qla82xx_check_md_needed(scsi_qla_host_t *); extern void qla82xx_chip_reset_cleanup(scsi_qla_host_t *); extern int qla82xx_mbx_beacon_ctl(scsi_qla_host_t *, int); extern char *qdev_state(uint32_t); -extern void qla82xx_clear_pending_mbx(scsi_qla_host_t *); /* BSG related functions */ extern int qla24xx_bsg_request(struct fc_bsg_job *); diff --git a/trunk/drivers/scsi/qla2xxx/qla_init.c b/trunk/drivers/scsi/qla2xxx/qla_init.c index 54ea68cec4c5..f03e915f1877 100644 --- a/trunk/drivers/scsi/qla2xxx/qla_init.c +++ b/trunk/drivers/scsi/qla2xxx/qla_init.c @@ -1509,8 +1509,7 @@ qla2x00_setup_chip(scsi_qla_host_t *vha) &ha->fw_xcb_count, NULL, NULL, &ha->max_npiv_vports, NULL); - if (!fw_major_version && ql2xallocfwdump - && !IS_QLA82XX(ha)) + if (!fw_major_version && ql2xallocfwdump) qla2x00_alloc_fw_dump(vha); } } else { diff --git a/trunk/drivers/scsi/qla2xxx/qla_iocb.c b/trunk/drivers/scsi/qla2xxx/qla_iocb.c index a4b267e60a35..dbec89622a0f 100644 --- a/trunk/drivers/scsi/qla2xxx/qla_iocb.c +++ b/trunk/drivers/scsi/qla2xxx/qla_iocb.c @@ -120,10 +120,11 @@ qla2x00_prep_cont_type0_iocb(struct scsi_qla_host *vha) * Returns a pointer to the continuation type 1 IOCB packet. */ static inline cont_a64_entry_t * -qla2x00_prep_cont_type1_iocb(scsi_qla_host_t *vha, struct req_que *req) +qla2x00_prep_cont_type1_iocb(scsi_qla_host_t *vha) { cont_a64_entry_t *cont_pkt; + struct req_que *req = vha->req; /* Adjust ring index. */ req->ring_index++; if (req->ring_index == req->length) { @@ -291,7 +292,7 @@ void qla2x00_build_scsi_iocbs_64(srb_t *sp, cmd_entry_t *cmd_pkt, * Five DSDs are available in the Continuation * Type 1 IOCB. */ - cont_pkt = qla2x00_prep_cont_type1_iocb(vha, vha->req); + cont_pkt = qla2x00_prep_cont_type1_iocb(vha); cur_dsd = (uint32_t *)cont_pkt->dseg_0_address; avail_dsds = 5; } @@ -683,7 +684,7 @@ qla24xx_build_scsi_iocbs(srb_t *sp, struct cmd_type_7 *cmd_pkt, * Five DSDs are available in the Continuation * Type 1 IOCB. */ - cont_pkt = qla2x00_prep_cont_type1_iocb(vha, vha->req); + cont_pkt = qla2x00_prep_cont_type1_iocb(vha); cur_dsd = (uint32_t *)cont_pkt->dseg_0_address; avail_dsds = 5; } @@ -2069,8 +2070,7 @@ qla2x00_ct_iocb(srb_t *sp, ms_iocb_entry_t *ct_iocb) * Five DSDs are available in the Cont. * Type 1 IOCB. */ - cont_pkt = qla2x00_prep_cont_type1_iocb(vha, - vha->hw->req_q_map[0]); + cont_pkt = qla2x00_prep_cont_type1_iocb(vha); cur_dsd = (uint32_t *) cont_pkt->dseg_0_address; avail_dsds = 5; cont_iocb_prsnt = 1; @@ -2096,7 +2096,6 @@ qla24xx_ct_iocb(srb_t *sp, struct ct_entry_24xx *ct_iocb) int index; uint16_t tot_dsds; scsi_qla_host_t *vha = sp->fcport->vha; - struct qla_hw_data *ha = vha->hw; struct fc_bsg_job *bsg_job = ((struct srb_ctx *)sp->ctx)->u.bsg_job; int loop_iterartion = 0; int cont_iocb_prsnt = 0; @@ -2142,8 +2141,7 @@ qla24xx_ct_iocb(srb_t *sp, struct ct_entry_24xx *ct_iocb) * Five DSDs are available in the Cont. * Type 1 IOCB. */ - cont_pkt = qla2x00_prep_cont_type1_iocb(vha, - ha->req_q_map[0]); + cont_pkt = qla2x00_prep_cont_type1_iocb(vha); cur_dsd = (uint32_t *) cont_pkt->dseg_0_address; avail_dsds = 5; cont_iocb_prsnt = 1; diff --git a/trunk/drivers/scsi/qla2xxx/qla_isr.c b/trunk/drivers/scsi/qla2xxx/qla_isr.c index 7b91b290ffd6..2516adf1aeea 100644 --- a/trunk/drivers/scsi/qla2xxx/qla_isr.c +++ b/trunk/drivers/scsi/qla2xxx/qla_isr.c @@ -1741,7 +1741,7 @@ qla2x00_status_entry(scsi_qla_host_t *vha, struct rsp_que *rsp, void *pkt) resid, scsi_bufflen(cp)); cp->result = DID_ERROR << 16 | lscsi_status; - goto check_scsi_status; + break; } if (!lscsi_status && diff --git a/trunk/drivers/scsi/qla2xxx/qla_mbx.c b/trunk/drivers/scsi/qla2xxx/qla_mbx.c index 82a33533ed26..3b3cec9f6ac2 100644 --- a/trunk/drivers/scsi/qla2xxx/qla_mbx.c +++ b/trunk/drivers/scsi/qla2xxx/qla_mbx.c @@ -79,7 +79,8 @@ qla2x00_mailbox_command(scsi_qla_host_t *vha, mbx_cmd_t *mcp) mcp->mb[0] = MBS_LINK_DOWN_ERROR; ql_log(ql_log_warn, base_vha, 0x1004, "FW hung = %d.\n", ha->flags.isp82xx_fw_hung); - return QLA_FUNCTION_TIMEOUT; + rval = QLA_FUNCTION_FAILED; + goto premature_exit; } /* @@ -162,7 +163,6 @@ qla2x00_mailbox_command(scsi_qla_host_t *vha, mbx_cmd_t *mcp) HINT_MBX_INT_PENDING) { spin_unlock_irqrestore(&ha->hardware_lock, flags); - ha->flags.mbox_busy = 0; ql_dbg(ql_dbg_mbx, base_vha, 0x1010, "Pending mailbox timeout, exiting.\n"); rval = QLA_FUNCTION_TIMEOUT; @@ -188,7 +188,6 @@ qla2x00_mailbox_command(scsi_qla_host_t *vha, mbx_cmd_t *mcp) HINT_MBX_INT_PENDING) { spin_unlock_irqrestore(&ha->hardware_lock, flags); - ha->flags.mbox_busy = 0; ql_dbg(ql_dbg_mbx, base_vha, 0x1012, "Pending mailbox timeout, exiting.\n"); rval = QLA_FUNCTION_TIMEOUT; @@ -303,15 +302,7 @@ qla2x00_mailbox_command(scsi_qla_host_t *vha, mbx_cmd_t *mcp) if (!test_bit(ISP_ABORT_NEEDED, &vha->dpc_flags) && !test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags) && !test_bit(ISP_ABORT_RETRY, &vha->dpc_flags)) { - if (IS_QLA82XX(ha)) { - ql_dbg(ql_dbg_mbx, vha, 0x112a, - "disabling pause transmit on port " - "0 & 1.\n"); - qla82xx_wr_32(ha, - QLA82XX_CRB_NIU + 0x98, - CRB_NIU_XG_PAUSE_CTL_P0| - CRB_NIU_XG_PAUSE_CTL_P1); - } + ql_log(ql_log_info, base_vha, 0x101c, "Mailbox cmd timeout occured. " "Scheduling ISP abort eeh_busy=0x%x.\n", @@ -327,15 +318,7 @@ qla2x00_mailbox_command(scsi_qla_host_t *vha, mbx_cmd_t *mcp) if (!test_bit(ISP_ABORT_NEEDED, &vha->dpc_flags) && !test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags) && !test_bit(ISP_ABORT_RETRY, &vha->dpc_flags)) { - if (IS_QLA82XX(ha)) { - ql_dbg(ql_dbg_mbx, vha, 0x112b, - "disabling pause transmit on port " - "0 & 1.\n"); - qla82xx_wr_32(ha, - QLA82XX_CRB_NIU + 0x98, - CRB_NIU_XG_PAUSE_CTL_P0| - CRB_NIU_XG_PAUSE_CTL_P1); - } + ql_log(ql_log_info, base_vha, 0x101e, "Mailbox cmd timeout occured. " "Scheduling ISP abort.\n"); diff --git a/trunk/drivers/scsi/qla2xxx/qla_nx.c b/trunk/drivers/scsi/qla2xxx/qla_nx.c index 03554934b0a5..94bded5ddce4 100644 --- a/trunk/drivers/scsi/qla2xxx/qla_nx.c +++ b/trunk/drivers/scsi/qla2xxx/qla_nx.c @@ -3817,20 +3817,6 @@ qla82xx_device_state_handler(scsi_qla_host_t *vha) return rval; } -void qla82xx_clear_pending_mbx(scsi_qla_host_t *vha) -{ - struct qla_hw_data *ha = vha->hw; - - if (ha->flags.mbox_busy) { - ha->flags.mbox_int = 1; - ha->flags.mbox_busy = 0; - ql_log(ql_log_warn, vha, 0x6010, - "Doing premature completion of mbx command.\n"); - if (test_bit(MBX_INTR_WAIT, &ha->mbx_cmd_flags)) - complete(&ha->mbx_intr_comp); - } -} - void qla82xx_watchdog(scsi_qla_host_t *vha) { uint32_t dev_state, halt_status; @@ -3853,13 +3839,9 @@ void qla82xx_watchdog(scsi_qla_host_t *vha) qla2xxx_wake_dpc(vha); } else { if (qla82xx_check_fw_alive(vha)) { - ql_dbg(ql_dbg_timer, vha, 0x6011, - "disabling pause transmit on port 0 & 1.\n"); - qla82xx_wr_32(ha, QLA82XX_CRB_NIU + 0x98, - CRB_NIU_XG_PAUSE_CTL_P0|CRB_NIU_XG_PAUSE_CTL_P1); halt_status = qla82xx_rd_32(ha, QLA82XX_PEG_HALT_STATUS1); - ql_log(ql_log_info, vha, 0x6005, + ql_dbg(ql_dbg_timer, vha, 0x6005, "dumping hw/fw registers:.\n " " PEG_HALT_STATUS1: 0x%x, PEG_HALT_STATUS2: 0x%x,.\n " " PEG_NET_0_PC: 0x%x, PEG_NET_1_PC: 0x%x,.\n " @@ -3876,11 +3858,6 @@ void qla82xx_watchdog(scsi_qla_host_t *vha) QLA82XX_CRB_PEG_NET_3 + 0x3c), qla82xx_rd_32(ha, QLA82XX_CRB_PEG_NET_4 + 0x3c)); - if (LSW(MSB(halt_status)) == 0x67) - ql_log(ql_log_warn, vha, 0xb052, - "Firmware aborted with " - "error code 0x00006700. Device is " - "being reset.\n"); if (halt_status & HALT_STATUS_UNRECOVERABLE) { set_bit(ISP_UNRECOVERABLE, &vha->dpc_flags); @@ -3892,8 +3869,16 @@ void qla82xx_watchdog(scsi_qla_host_t *vha) } qla2xxx_wake_dpc(vha); ha->flags.isp82xx_fw_hung = 1; - ql_log(ql_log_warn, vha, 0x6007, "Firmware hung.\n"); - qla82xx_clear_pending_mbx(vha); + if (ha->flags.mbox_busy) { + ha->flags.mbox_int = 1; + ql_log(ql_log_warn, vha, 0x6007, + "Due to FW hung, doing " + "premature completion of mbx " + "command.\n"); + if (test_bit(MBX_INTR_WAIT, + &ha->mbx_cmd_flags)) + complete(&ha->mbx_intr_comp); + } } } } @@ -4088,7 +4073,10 @@ qla82xx_chip_reset_cleanup(scsi_qla_host_t *vha) msleep(1000); if (qla82xx_check_fw_alive(vha)) { ha->flags.isp82xx_fw_hung = 1; - qla82xx_clear_pending_mbx(vha); + if (ha->flags.mbox_busy) { + ha->flags.mbox_int = 1; + complete(&ha->mbx_intr_comp); + } break; } } diff --git a/trunk/drivers/scsi/qla2xxx/qla_nx.h b/trunk/drivers/scsi/qla2xxx/qla_nx.h index 57a226be339a..57820c199bc2 100644 --- a/trunk/drivers/scsi/qla2xxx/qla_nx.h +++ b/trunk/drivers/scsi/qla2xxx/qla_nx.h @@ -1173,8 +1173,4 @@ struct qla82xx_md_entry_queue { static const int MD_MIU_TEST_AGT_RDDATA[] = { 0x410000A8, 0x410000AC, 0x410000B8, 0x410000BC }; - -#define CRB_NIU_XG_PAUSE_CTL_P0 0x1 -#define CRB_NIU_XG_PAUSE_CTL_P1 0x8 - #endif diff --git a/trunk/drivers/scsi/qla2xxx/qla_os.c b/trunk/drivers/scsi/qla2xxx/qla_os.c index f9e5b85e84d8..fd14c7bfc626 100644 --- a/trunk/drivers/scsi/qla2xxx/qla_os.c +++ b/trunk/drivers/scsi/qla2xxx/qla_os.c @@ -201,12 +201,12 @@ MODULE_PARM_DESC(ql2xmdcapmask, "Set the Minidump driver capture mask level. " "Default is 0x7F - Can be set to 0x3, 0x7, 0xF, 0x1F, 0x7F."); -int ql2xmdenable = 1; +int ql2xmdenable; module_param(ql2xmdenable, int, S_IRUGO); MODULE_PARM_DESC(ql2xmdenable, "Enable/disable MiniDump. " - "0 - MiniDump disabled. " - "1 (Default) - MiniDump enabled."); + "0 (Default) - MiniDump disabled. " + "1 - MiniDump enabled."); /* * SCSI host template entry points @@ -423,7 +423,6 @@ static int qla25xx_setup_mode(struct scsi_qla_host *vha) qla25xx_delete_queues(vha); destroy_workqueue(ha->wq); ha->wq = NULL; - vha->req = ha->req_q_map[0]; fail: ha->mqenable = 0; kfree(ha->req_q_map); @@ -815,6 +814,49 @@ qla2x00_wait_for_chip_reset(scsi_qla_host_t *vha) return return_status; } +/* + * qla2x00_wait_for_loop_ready + * Wait for MAX_LOOP_TIMEOUT(5 min) value for loop + * to be in LOOP_READY state. + * Input: + * ha - pointer to host adapter structure + * + * Note: + * Does context switching-Release SPIN_LOCK + * (if any) before calling this routine. + * + * + * Return: + * Success (LOOP_READY) : 0 + * Failed (LOOP_NOT_READY) : 1 + */ +static inline int +qla2x00_wait_for_loop_ready(scsi_qla_host_t *vha) +{ + int return_status = QLA_SUCCESS; + unsigned long loop_timeout ; + struct qla_hw_data *ha = vha->hw; + scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev); + + /* wait for 5 min at the max for loop to be ready */ + loop_timeout = jiffies + (MAX_LOOP_TIMEOUT * HZ); + + while ((!atomic_read(&base_vha->loop_down_timer) && + atomic_read(&base_vha->loop_state) == LOOP_DOWN) || + atomic_read(&base_vha->loop_state) != LOOP_READY) { + if (atomic_read(&base_vha->loop_state) == LOOP_DEAD) { + return_status = QLA_FUNCTION_FAILED; + break; + } + msleep(1000); + if (time_after_eq(jiffies, loop_timeout)) { + return_status = QLA_FUNCTION_FAILED; + break; + } + } + return (return_status); +} + static void sp_get(struct srb *sp) { @@ -993,6 +1035,12 @@ __qla2xxx_eh_generic_reset(char *name, enum nexus_wait_type type, "Wait for hba online failed for cmd=%p.\n", cmd); goto eh_reset_failed; } + err = 1; + if (qla2x00_wait_for_loop_ready(vha) != QLA_SUCCESS) { + ql_log(ql_log_warn, vha, 0x800b, + "Wait for loop ready failed for cmd=%p.\n", cmd); + goto eh_reset_failed; + } err = 2; if (do_reset(fcport, cmd->device->lun, cmd->request->cpu + 1) != QLA_SUCCESS) { @@ -1089,9 +1137,10 @@ qla2xxx_eh_bus_reset(struct scsi_cmnd *cmd) goto eh_bus_reset_done; } - if (qla2x00_loop_reset(vha) == QLA_SUCCESS) - ret = SUCCESS; - + if (qla2x00_wait_for_loop_ready(vha) == QLA_SUCCESS) { + if (qla2x00_loop_reset(vha) == QLA_SUCCESS) + ret = SUCCESS; + } if (ret == FAILED) goto eh_bus_reset_done; @@ -1157,6 +1206,15 @@ qla2xxx_eh_host_reset(struct scsi_cmnd *cmd) if (qla2x00_wait_for_reset_ready(vha) != QLA_SUCCESS) goto eh_host_reset_lock; + /* + * Fixme-may be dpc thread is active and processing + * loop_resync,so wait a while for it to + * be completed and then issue big hammer.Otherwise + * it may cause I/O failure as big hammer marks the + * devices as lost kicking of the port_down_timer + * while dpc is stuck for the mailbox to complete. + */ + qla2x00_wait_for_loop_ready(vha); if (vha != base_vha) { if (qla2x00_vp_abort_isp(vha)) goto eh_host_reset_lock; @@ -1239,13 +1297,16 @@ qla2x00_loop_reset(scsi_qla_host_t *vha) atomic_set(&vha->loop_state, LOOP_DOWN); atomic_set(&vha->loop_down_timer, LOOP_DOWN_TIME); qla2x00_mark_all_devices_lost(vha, 0); + qla2x00_wait_for_loop_ready(vha); } if (ha->flags.enable_lip_reset) { ret = qla2x00_lip_reset(vha); - if (ret != QLA_SUCCESS) + if (ret != QLA_SUCCESS) { ql_dbg(ql_dbg_taskm, vha, 0x802e, "lip_reset failed (%d).\n", ret); + } else + qla2x00_wait_for_loop_ready(vha); } /* Issue marker command only when we are going to start the I/O */ @@ -4009,8 +4070,13 @@ qla2xxx_pci_error_detected(struct pci_dev *pdev, pci_channel_state_t state) /* For ISP82XX complete any pending mailbox cmd */ if (IS_QLA82XX(ha)) { ha->flags.isp82xx_fw_hung = 1; - ql_dbg(ql_dbg_aer, vha, 0x9001, "Pci channel io frozen\n"); - qla82xx_clear_pending_mbx(vha); + if (ha->flags.mbox_busy) { + ha->flags.mbox_int = 1; + ql_dbg(ql_dbg_aer, vha, 0x9001, + "Due to pci channel io frozen, doing premature " + "completion of mbx command.\n"); + complete(&ha->mbx_intr_comp); + } } qla2x00_free_irqs(vha); pci_disable_device(pdev); diff --git a/trunk/drivers/scsi/qla2xxx/qla_version.h b/trunk/drivers/scsi/qla2xxx/qla_version.h index 23f33a6d52d7..13b6357c1fa2 100644 --- a/trunk/drivers/scsi/qla2xxx/qla_version.h +++ b/trunk/drivers/scsi/qla2xxx/qla_version.h @@ -7,7 +7,7 @@ /* * Driver version */ -#define QLA2XXX_VERSION "8.03.07.12-k" +#define QLA2XXX_VERSION "8.03.07.07-k" #define QLA_DRIVER_MAJOR_VER 8 #define QLA_DRIVER_MINOR_VER 3 diff --git a/trunk/drivers/scsi/qla4xxx/ql4_def.h b/trunk/drivers/scsi/qla4xxx/ql4_def.h index fd5edc6e166d..ace637bf254e 100644 --- a/trunk/drivers/scsi/qla4xxx/ql4_def.h +++ b/trunk/drivers/scsi/qla4xxx/ql4_def.h @@ -147,7 +147,7 @@ #define ISCSI_ALIAS_SIZE 32 /* ISCSI Alias name size */ #define ISCSI_NAME_SIZE 0xE0 /* ISCSI Name size */ -#define QL4_SESS_RECOVERY_TMO 120 /* iSCSI session */ +#define QL4_SESS_RECOVERY_TMO 30 /* iSCSI session */ /* recovery timeout */ #define LSDW(x) ((u32)((u64)(x))) @@ -173,8 +173,6 @@ #define ISNS_DEREG_TOV 5 #define HBA_ONLINE_TOV 30 #define DISABLE_ACB_TOV 30 -#define IP_CONFIG_TOV 30 -#define LOGIN_TOV 12 #define MAX_RESET_HA_RETRIES 2 @@ -242,45 +240,6 @@ struct ddb_entry { uint16_t fw_ddb_index; /* DDB firmware index */ uint32_t fw_ddb_device_state; /* F/W Device State -- see ql4_fw.h */ - uint16_t ddb_type; -#define FLASH_DDB 0x01 - - struct dev_db_entry fw_ddb_entry; - int (*unblock_sess)(struct iscsi_cls_session *cls_session); - int (*ddb_change)(struct scsi_qla_host *ha, uint32_t fw_ddb_index, - struct ddb_entry *ddb_entry, uint32_t state); - - /* Driver Re-login */ - unsigned long flags; /* DDB Flags */ - uint16_t default_relogin_timeout; /* Max time to wait for - * relogin to complete */ - atomic_t retry_relogin_timer; /* Min Time between relogins - * (4000 only) */ - atomic_t relogin_timer; /* Max Time to wait for - * relogin to complete */ - atomic_t relogin_retry_count; /* Num of times relogin has been - * retried */ - uint32_t default_time2wait; /* Default Min time between - * relogins (+aens) */ - -}; - -struct qla_ddb_index { - struct list_head list; - uint16_t fw_ddb_idx; - struct dev_db_entry fw_ddb; -}; - -#define DDB_IPADDR_LEN 64 - -struct ql4_tuple_ddb { - int port; - int tpgt; - char ip_addr[DDB_IPADDR_LEN]; - char iscsi_name[ISCSI_NAME_SIZE]; - uint16_t options; -#define DDB_OPT_IPV6 0x0e0e -#define DDB_OPT_IPV4 0x0f0f }; /* @@ -452,7 +411,7 @@ struct scsi_qla_host { #define AF_FW_RECOVERY 19 /* 0x00080000 */ #define AF_EEH_BUSY 20 /* 0x00100000 */ #define AF_PCI_CHANNEL_IO_PERM_FAILURE 21 /* 0x00200000 */ -#define AF_BUILD_DDB_LIST 22 /* 0x00400000 */ + unsigned long dpc_flags; #define DPC_RESET_HA 1 /* 0x00000002 */ @@ -645,7 +604,6 @@ struct scsi_qla_host { uint16_t bootload_minor; uint16_t bootload_patch; uint16_t bootload_build; - uint16_t def_timeout; /* Default login timeout */ uint32_t flash_state; #define QLFLASH_WAITING 0 @@ -665,11 +623,6 @@ struct scsi_qla_host { uint16_t iscsi_pci_func_cnt; uint8_t model_name[16]; struct completion disable_acb_comp; - struct dma_pool *fw_ddb_dma_pool; -#define DDB_DMA_BLOCK_SIZE 512 - uint16_t pri_ddb_idx; - uint16_t sec_ddb_idx; - int is_reset; }; struct ql4_task_data { @@ -882,10 +835,6 @@ static inline int ql4xxx_reset_active(struct scsi_qla_host *ha) /*---------------------------------------------------------------------------*/ /* Defines for qla4xxx_initialize_adapter() and qla4xxx_recover_adapter() */ - -#define INIT_ADAPTER 0 -#define RESET_ADAPTER 1 - #define PRESERVE_DDB_LIST 0 #define REBUILD_DDB_LIST 1 diff --git a/trunk/drivers/scsi/qla4xxx/ql4_fw.h b/trunk/drivers/scsi/qla4xxx/ql4_fw.h index 4ac07f882521..cbd5a20dbbd1 100644 --- a/trunk/drivers/scsi/qla4xxx/ql4_fw.h +++ b/trunk/drivers/scsi/qla4xxx/ql4_fw.h @@ -12,7 +12,6 @@ #define MAX_PRST_DEV_DB_ENTRIES 64 #define MIN_DISC_DEV_DB_ENTRY MAX_PRST_DEV_DB_ENTRIES #define MAX_DEV_DB_ENTRIES 512 -#define MAX_DEV_DB_ENTRIES_40XX 256 /************************************************************************* * @@ -605,13 +604,6 @@ struct addr_ctrl_blk { uint8_t res14[140]; /* 274-2FF */ }; -#define IP_ADDR_COUNT 4 /* Total 4 IP address supported in one interface - * One IPv4, one IPv6 link local and 2 IPv6 - */ - -#define IP_STATE_MASK 0x0F000000 -#define IP_STATE_SHIFT 24 - struct init_fw_ctrl_blk { struct addr_ctrl_blk pri; /* struct addr_ctrl_blk sec;*/ diff --git a/trunk/drivers/scsi/qla4xxx/ql4_glbl.h b/trunk/drivers/scsi/qla4xxx/ql4_glbl.h index d0dd4b330206..160db9d5ea21 100644 --- a/trunk/drivers/scsi/qla4xxx/ql4_glbl.h +++ b/trunk/drivers/scsi/qla4xxx/ql4_glbl.h @@ -13,7 +13,7 @@ struct iscsi_cls_conn; int qla4xxx_hw_reset(struct scsi_qla_host *ha); int ql4xxx_lock_drvr_wait(struct scsi_qla_host *a); int qla4xxx_send_command_to_isp(struct scsi_qla_host *ha, struct srb *srb); -int qla4xxx_initialize_adapter(struct scsi_qla_host *ha, int is_reset); +int qla4xxx_initialize_adapter(struct scsi_qla_host *ha); int qla4xxx_soft_reset(struct scsi_qla_host *ha); irqreturn_t qla4xxx_intr_handler(int irq, void *dev_id); @@ -153,13 +153,10 @@ int qla4xxx_req_ddb_entry(struct scsi_qla_host *ha, uint32_t fw_ddb_index, uint32_t *mbx_sts); int qla4xxx_clear_ddb_entry(struct scsi_qla_host *ha, uint32_t fw_ddb_index); int qla4xxx_send_passthru0(struct iscsi_task *task); -void qla4xxx_free_ddb_index(struct scsi_qla_host *ha); int qla4xxx_get_mgmt_data(struct scsi_qla_host *ha, uint16_t fw_ddb_index, uint16_t stats_size, dma_addr_t stats_dma); void qla4xxx_update_session_conn_param(struct scsi_qla_host *ha, struct ddb_entry *ddb_entry); -void qla4xxx_update_session_conn_fwddb_param(struct scsi_qla_host *ha, - struct ddb_entry *ddb_entry); int qla4xxx_bootdb_by_index(struct scsi_qla_host *ha, struct dev_db_entry *fw_ddb_entry, dma_addr_t fw_ddb_entry_dma, uint16_t ddb_index); @@ -172,22 +169,11 @@ int qla4xxx_set_nvram(struct scsi_qla_host *ha, dma_addr_t nvram_dma, int qla4xxx_restore_factory_defaults(struct scsi_qla_host *ha, uint32_t region, uint32_t field0, uint32_t field1); -int qla4xxx_get_ddb_index(struct scsi_qla_host *ha, uint16_t *ddb_index); -void qla4xxx_login_flash_ddb(struct iscsi_cls_session *cls_session); -int qla4xxx_unblock_ddb(struct iscsi_cls_session *cls_session); -int qla4xxx_unblock_flash_ddb(struct iscsi_cls_session *cls_session); -int qla4xxx_flash_ddb_change(struct scsi_qla_host *ha, uint32_t fw_ddb_index, - struct ddb_entry *ddb_entry, uint32_t state); -int qla4xxx_ddb_change(struct scsi_qla_host *ha, uint32_t fw_ddb_index, - struct ddb_entry *ddb_entry, uint32_t state); -void qla4xxx_build_ddb_list(struct scsi_qla_host *ha, int is_reset); /* BSG Functions */ int qla4xxx_bsg_request(struct bsg_job *bsg_job); int qla4xxx_process_vendor_specific(struct bsg_job *bsg_job); -void qla4xxx_arm_relogin_timer(struct ddb_entry *ddb_entry); - extern int ql4xextended_error_logging; extern int ql4xdontresethba; extern int ql4xenablemsix; diff --git a/trunk/drivers/scsi/qla4xxx/ql4_init.c b/trunk/drivers/scsi/qla4xxx/ql4_init.c index 1bdfa8120ac8..3075fbaef553 100644 --- a/trunk/drivers/scsi/qla4xxx/ql4_init.c +++ b/trunk/drivers/scsi/qla4xxx/ql4_init.c @@ -773,24 +773,22 @@ int qla4xxx_start_firmware(struct scsi_qla_host *ha) * be freed so that when login happens from user space there are free DDB * indices available. **/ -void qla4xxx_free_ddb_index(struct scsi_qla_host *ha) +static void qla4xxx_free_ddb_index(struct scsi_qla_host *ha) { int max_ddbs; int ret; uint32_t idx = 0, next_idx = 0; uint32_t state = 0, conn_err = 0; - max_ddbs = is_qla40XX(ha) ? MAX_DEV_DB_ENTRIES_40XX : + max_ddbs = is_qla40XX(ha) ? MAX_PRST_DEV_DB_ENTRIES : MAX_DEV_DB_ENTRIES; for (idx = 0; idx < max_ddbs; idx = next_idx) { ret = qla4xxx_get_fwddb_entry(ha, idx, NULL, 0, NULL, &next_idx, &state, &conn_err, NULL, NULL); - if (ret == QLA_ERROR) { - next_idx++; + if (ret == QLA_ERROR) continue; - } if (state == DDB_DS_NO_CONNECTION_ACTIVE || state == DDB_DS_SESSION_FAILED) { DEBUG2(ql4_printk(KERN_INFO, ha, @@ -806,6 +804,7 @@ void qla4xxx_free_ddb_index(struct scsi_qla_host *ha) } } + /** * qla4xxx_initialize_adapter - initiailizes hba * @ha: Pointer to host adapter structure. @@ -813,7 +812,7 @@ void qla4xxx_free_ddb_index(struct scsi_qla_host *ha) * This routine parforms all of the steps necessary to initialize the adapter. * **/ -int qla4xxx_initialize_adapter(struct scsi_qla_host *ha, int is_reset) +int qla4xxx_initialize_adapter(struct scsi_qla_host *ha) { int status = QLA_ERROR; @@ -841,8 +840,7 @@ int qla4xxx_initialize_adapter(struct scsi_qla_host *ha, int is_reset) if (status == QLA_ERROR) goto exit_init_hba; - if (is_reset == RESET_ADAPTER) - qla4xxx_build_ddb_list(ha, is_reset); + qla4xxx_free_ddb_index(ha); set_bit(AF_ONLINE, &ha->flags); exit_init_hba: @@ -857,12 +855,38 @@ int qla4xxx_initialize_adapter(struct scsi_qla_host *ha, int is_reset) return status; } -int qla4xxx_ddb_change(struct scsi_qla_host *ha, uint32_t fw_ddb_index, - struct ddb_entry *ddb_entry, uint32_t state) +/** + * qla4xxx_process_ddb_changed - process ddb state change + * @ha - Pointer to host adapter structure. + * @fw_ddb_index - Firmware's device database index + * @state - Device state + * + * This routine processes a Decive Database Changed AEN Event. + **/ +int qla4xxx_process_ddb_changed(struct scsi_qla_host *ha, uint32_t fw_ddb_index, + uint32_t state, uint32_t conn_err) { + struct ddb_entry * ddb_entry; uint32_t old_fw_ddb_device_state; int status = QLA_ERROR; + /* check for out of range index */ + if (fw_ddb_index >= MAX_DDB_ENTRIES) + goto exit_ddb_event; + + /* Get the corresponging ddb entry */ + ddb_entry = qla4xxx_lookup_ddb_by_fw_index(ha, fw_ddb_index); + /* Device does not currently exist in our database. */ + if (ddb_entry == NULL) { + ql4_printk(KERN_ERR, ha, "%s: No ddb_entry at FW index [%d]\n", + __func__, fw_ddb_index); + + if (state == DDB_DS_NO_CONNECTION_ACTIVE) + clear_bit(fw_ddb_index, ha->ddb_idx_map); + + goto exit_ddb_event; + } + old_fw_ddb_device_state = ddb_entry->fw_ddb_device_state; DEBUG2(ql4_printk(KERN_INFO, ha, "%s: DDB - old state = 0x%x, new state = 0x%x for " @@ -876,7 +900,9 @@ int qla4xxx_ddb_change(struct scsi_qla_host *ha, uint32_t fw_ddb_index, switch (state) { case DDB_DS_SESSION_ACTIVE: case DDB_DS_DISCOVERY: - ddb_entry->unblock_sess(ddb_entry->sess); + iscsi_conn_start(ddb_entry->conn); + iscsi_conn_login_event(ddb_entry->conn, + ISCSI_CONN_STATE_LOGGED_IN); qla4xxx_update_session_conn_param(ha, ddb_entry); status = QLA_SUCCESS; break; @@ -910,7 +936,9 @@ int qla4xxx_ddb_change(struct scsi_qla_host *ha, uint32_t fw_ddb_index, switch (state) { case DDB_DS_SESSION_ACTIVE: case DDB_DS_DISCOVERY: - ddb_entry->unblock_sess(ddb_entry->sess); + iscsi_conn_start(ddb_entry->conn); + iscsi_conn_login_event(ddb_entry->conn, + ISCSI_CONN_STATE_LOGGED_IN); qla4xxx_update_session_conn_param(ha, ddb_entry); status = QLA_SUCCESS; break; @@ -926,198 +954,7 @@ int qla4xxx_ddb_change(struct scsi_qla_host *ha, uint32_t fw_ddb_index, __func__)); break; } - return status; -} - -void qla4xxx_arm_relogin_timer(struct ddb_entry *ddb_entry) -{ - /* - * This triggers a relogin. After the relogin_timer - * expires, the relogin gets scheduled. We must wait a - * minimum amount of time since receiving an 0x8014 AEN - * with failed device_state or a logout response before - * we can issue another relogin. - * - * Firmware pads this timeout: (time2wait +1). - * Driver retry to login should be longer than F/W. - * Otherwise F/W will fail - * set_ddb() mbx cmd with 0x4005 since it still - * counting down its time2wait. - */ - atomic_set(&ddb_entry->relogin_timer, 0); - atomic_set(&ddb_entry->retry_relogin_timer, - ddb_entry->default_time2wait + 4); - -} - -int qla4xxx_flash_ddb_change(struct scsi_qla_host *ha, uint32_t fw_ddb_index, - struct ddb_entry *ddb_entry, uint32_t state) -{ - uint32_t old_fw_ddb_device_state; - int status = QLA_ERROR; - - old_fw_ddb_device_state = ddb_entry->fw_ddb_device_state; - DEBUG2(ql4_printk(KERN_INFO, ha, - "%s: DDB - old state = 0x%x, new state = 0x%x for " - "index [%d]\n", __func__, - ddb_entry->fw_ddb_device_state, state, fw_ddb_index)); - - ddb_entry->fw_ddb_device_state = state; - - switch (old_fw_ddb_device_state) { - case DDB_DS_LOGIN_IN_PROCESS: - case DDB_DS_NO_CONNECTION_ACTIVE: - switch (state) { - case DDB_DS_SESSION_ACTIVE: - ddb_entry->unblock_sess(ddb_entry->sess); - qla4xxx_update_session_conn_fwddb_param(ha, ddb_entry); - status = QLA_SUCCESS; - break; - case DDB_DS_SESSION_FAILED: - iscsi_block_session(ddb_entry->sess); - if (!test_bit(DF_RELOGIN, &ddb_entry->flags)) - qla4xxx_arm_relogin_timer(ddb_entry); - status = QLA_SUCCESS; - break; - } - break; - case DDB_DS_SESSION_ACTIVE: - switch (state) { - case DDB_DS_SESSION_FAILED: - iscsi_block_session(ddb_entry->sess); - if (!test_bit(DF_RELOGIN, &ddb_entry->flags)) - qla4xxx_arm_relogin_timer(ddb_entry); - status = QLA_SUCCESS; - break; - } - break; - case DDB_DS_SESSION_FAILED: - switch (state) { - case DDB_DS_SESSION_ACTIVE: - ddb_entry->unblock_sess(ddb_entry->sess); - qla4xxx_update_session_conn_fwddb_param(ha, ddb_entry); - status = QLA_SUCCESS; - break; - case DDB_DS_SESSION_FAILED: - if (!test_bit(DF_RELOGIN, &ddb_entry->flags)) - qla4xxx_arm_relogin_timer(ddb_entry); - status = QLA_SUCCESS; - break; - } - break; - default: - DEBUG2(ql4_printk(KERN_INFO, ha, "%s: Unknown Event\n", - __func__)); - break; - } - return status; -} - -/** - * qla4xxx_process_ddb_changed - process ddb state change - * @ha - Pointer to host adapter structure. - * @fw_ddb_index - Firmware's device database index - * @state - Device state - * - * This routine processes a Decive Database Changed AEN Event. - **/ -int qla4xxx_process_ddb_changed(struct scsi_qla_host *ha, - uint32_t fw_ddb_index, - uint32_t state, uint32_t conn_err) -{ - struct ddb_entry *ddb_entry; - int status = QLA_ERROR; - - /* check for out of range index */ - if (fw_ddb_index >= MAX_DDB_ENTRIES) - goto exit_ddb_event; - - /* Get the corresponging ddb entry */ - ddb_entry = qla4xxx_lookup_ddb_by_fw_index(ha, fw_ddb_index); - /* Device does not currently exist in our database. */ - if (ddb_entry == NULL) { - ql4_printk(KERN_ERR, ha, "%s: No ddb_entry at FW index [%d]\n", - __func__, fw_ddb_index); - - if (state == DDB_DS_NO_CONNECTION_ACTIVE) - clear_bit(fw_ddb_index, ha->ddb_idx_map); - - goto exit_ddb_event; - } - - ddb_entry->ddb_change(ha, fw_ddb_index, ddb_entry, state); exit_ddb_event: return status; } - -/** - * qla4xxx_login_flash_ddb - Login to target (DDB) - * @cls_session: Pointer to the session to login - * - * This routine logins to the target. - * Issues setddb and conn open mbx - **/ -void qla4xxx_login_flash_ddb(struct iscsi_cls_session *cls_session) -{ - struct iscsi_session *sess; - struct ddb_entry *ddb_entry; - struct scsi_qla_host *ha; - struct dev_db_entry *fw_ddb_entry = NULL; - dma_addr_t fw_ddb_dma; - uint32_t mbx_sts = 0; - int ret; - - sess = cls_session->dd_data; - ddb_entry = sess->dd_data; - ha = ddb_entry->ha; - - if (!test_bit(AF_LINK_UP, &ha->flags)) - return; - - if (ddb_entry->ddb_type != FLASH_DDB) { - DEBUG2(ql4_printk(KERN_INFO, ha, - "Skipping login to non FLASH DB")); - goto exit_login; - } - - fw_ddb_entry = dma_pool_alloc(ha->fw_ddb_dma_pool, GFP_KERNEL, - &fw_ddb_dma); - if (fw_ddb_entry == NULL) { - DEBUG2(ql4_printk(KERN_ERR, ha, "Out of memory\n")); - goto exit_login; - } - - if (ddb_entry->fw_ddb_index == INVALID_ENTRY) { - ret = qla4xxx_get_ddb_index(ha, &ddb_entry->fw_ddb_index); - if (ret == QLA_ERROR) - goto exit_login; - - ha->fw_ddb_index_map[ddb_entry->fw_ddb_index] = ddb_entry; - ha->tot_ddbs++; - } - - memcpy(fw_ddb_entry, &ddb_entry->fw_ddb_entry, - sizeof(struct dev_db_entry)); - ddb_entry->sess->target_id = ddb_entry->fw_ddb_index; - - ret = qla4xxx_set_ddb_entry(ha, ddb_entry->fw_ddb_index, - fw_ddb_dma, &mbx_sts); - if (ret == QLA_ERROR) { - DEBUG2(ql4_printk(KERN_ERR, ha, "Set DDB failed\n")); - goto exit_login; - } - - ddb_entry->fw_ddb_device_state = DDB_DS_LOGIN_IN_PROCESS; - ret = qla4xxx_conn_open(ha, ddb_entry->fw_ddb_index); - if (ret == QLA_ERROR) { - ql4_printk(KERN_ERR, ha, "%s: Login failed: %s\n", __func__, - sess->targetname); - goto exit_login; - } - -exit_login: - if (fw_ddb_entry) - dma_pool_free(ha->fw_ddb_dma_pool, fw_ddb_entry, fw_ddb_dma); -} - diff --git a/trunk/drivers/scsi/qla4xxx/ql4_mbx.c b/trunk/drivers/scsi/qla4xxx/ql4_mbx.c index c2593782fbbe..4c2b84870392 100644 --- a/trunk/drivers/scsi/qla4xxx/ql4_mbx.c +++ b/trunk/drivers/scsi/qla4xxx/ql4_mbx.c @@ -41,16 +41,6 @@ int qla4xxx_mailbox_command(struct scsi_qla_host *ha, uint8_t inCount, return status; } - if (is_qla40XX(ha)) { - if (test_bit(AF_HA_REMOVAL, &ha->flags)) { - DEBUG2(ql4_printk(KERN_WARNING, ha, "scsi%ld: %s: " - "prematurely completing mbx cmd as " - "adapter removal detected\n", - ha->host_no, __func__)); - return status; - } - } - if (is_qla8022(ha)) { if (test_bit(AF_FW_RECOVERY, &ha->flags)) { DEBUG2(ql4_printk(KERN_WARNING, ha, "scsi%ld: %s: " @@ -423,7 +413,6 @@ qla4xxx_update_local_ifcb(struct scsi_qla_host *ha, memcpy(ha->name_string, init_fw_cb->iscsi_name, min(sizeof(ha->name_string), sizeof(init_fw_cb->iscsi_name))); - ha->def_timeout = le16_to_cpu(init_fw_cb->def_timeout); /*memcpy(ha->alias, init_fw_cb->Alias, min(sizeof(ha->alias), sizeof(init_fw_cb->Alias)));*/ diff --git a/trunk/drivers/scsi/qla4xxx/ql4_os.c b/trunk/drivers/scsi/qla4xxx/ql4_os.c index 4169c8baa112..30f31b127f33 100644 --- a/trunk/drivers/scsi/qla4xxx/ql4_os.c +++ b/trunk/drivers/scsi/qla4xxx/ql4_os.c @@ -8,7 +8,6 @@ #include #include #include -#include #include #include @@ -32,13 +31,6 @@ static struct kmem_cache *srb_cachep; /* * Module parameter information and variables */ -int ql4xdisablesysfsboot = 1; -module_param(ql4xdisablesysfsboot, int, S_IRUGO | S_IWUSR); -MODULE_PARM_DESC(ql4xdisablesysfsboot, - "Set to disable exporting boot targets to sysfs\n" - " 0 - Export boot targets\n" - " 1 - Do not export boot targets (Default)"); - int ql4xdontresethba = 0; module_param(ql4xdontresethba, int, S_IRUGO | S_IWUSR); MODULE_PARM_DESC(ql4xdontresethba, @@ -71,7 +63,7 @@ static int ql4xsess_recovery_tmo = QL4_SESS_RECOVERY_TMO; module_param(ql4xsess_recovery_tmo, int, S_IRUGO); MODULE_PARM_DESC(ql4xsess_recovery_tmo, "Target Session Recovery Timeout.\n" - " Default: 120 sec."); + " Default: 30 sec."); static int qla4xxx_wait_for_hba_online(struct scsi_qla_host *ha); /* @@ -423,7 +415,7 @@ static int qla4xxx_ep_poll(struct iscsi_endpoint *ep, int timeout_ms) qla_ep = ep->dd_data; ha = to_qla_host(qla_ep->host); - if (adapter_up(ha) && !test_bit(AF_BUILD_DDB_LIST, &ha->flags)) + if (adapter_up(ha)) ret = 1; return ret; @@ -983,150 +975,6 @@ static int qla4xxx_conn_get_param(struct iscsi_cls_conn *cls_conn, } -int qla4xxx_get_ddb_index(struct scsi_qla_host *ha, uint16_t *ddb_index) -{ - uint32_t mbx_sts = 0; - uint16_t tmp_ddb_index; - int ret; - -get_ddb_index: - tmp_ddb_index = find_first_zero_bit(ha->ddb_idx_map, MAX_DDB_ENTRIES); - - if (tmp_ddb_index >= MAX_DDB_ENTRIES) { - DEBUG2(ql4_printk(KERN_INFO, ha, - "Free DDB index not available\n")); - ret = QLA_ERROR; - goto exit_get_ddb_index; - } - - if (test_and_set_bit(tmp_ddb_index, ha->ddb_idx_map)) - goto get_ddb_index; - - DEBUG2(ql4_printk(KERN_INFO, ha, - "Found a free DDB index at %d\n", tmp_ddb_index)); - ret = qla4xxx_req_ddb_entry(ha, tmp_ddb_index, &mbx_sts); - if (ret == QLA_ERROR) { - if (mbx_sts == MBOX_STS_COMMAND_ERROR) { - ql4_printk(KERN_INFO, ha, - "DDB index = %d not available trying next\n", - tmp_ddb_index); - goto get_ddb_index; - } - DEBUG2(ql4_printk(KERN_INFO, ha, - "Free FW DDB not available\n")); - } - - *ddb_index = tmp_ddb_index; - -exit_get_ddb_index: - return ret; -} - -static int qla4xxx_match_ipaddress(struct scsi_qla_host *ha, - struct ddb_entry *ddb_entry, - char *existing_ipaddr, - char *user_ipaddr) -{ - uint8_t dst_ipaddr[IPv6_ADDR_LEN]; - char formatted_ipaddr[DDB_IPADDR_LEN]; - int status = QLA_SUCCESS, ret = 0; - - if (ddb_entry->fw_ddb_entry.options & DDB_OPT_IPV6_DEVICE) { - ret = in6_pton(user_ipaddr, strlen(user_ipaddr), dst_ipaddr, - '\0', NULL); - if (ret == 0) { - status = QLA_ERROR; - goto out_match; - } - ret = sprintf(formatted_ipaddr, "%pI6", dst_ipaddr); - } else { - ret = in4_pton(user_ipaddr, strlen(user_ipaddr), dst_ipaddr, - '\0', NULL); - if (ret == 0) { - status = QLA_ERROR; - goto out_match; - } - ret = sprintf(formatted_ipaddr, "%pI4", dst_ipaddr); - } - - if (strcmp(existing_ipaddr, formatted_ipaddr)) - status = QLA_ERROR; - -out_match: - return status; -} - -static int qla4xxx_match_fwdb_session(struct scsi_qla_host *ha, - struct iscsi_cls_conn *cls_conn) -{ - int idx = 0, max_ddbs, rval; - struct iscsi_cls_session *cls_sess = iscsi_conn_to_session(cls_conn); - struct iscsi_session *sess, *existing_sess; - struct iscsi_conn *conn, *existing_conn; - struct ddb_entry *ddb_entry; - - sess = cls_sess->dd_data; - conn = cls_conn->dd_data; - - if (sess->targetname == NULL || - conn->persistent_address == NULL || - conn->persistent_port == 0) - return QLA_ERROR; - - max_ddbs = is_qla40XX(ha) ? MAX_DEV_DB_ENTRIES_40XX : - MAX_DEV_DB_ENTRIES; - - for (idx = 0; idx < max_ddbs; idx++) { - ddb_entry = qla4xxx_lookup_ddb_by_fw_index(ha, idx); - if (ddb_entry == NULL) - continue; - - if (ddb_entry->ddb_type != FLASH_DDB) - continue; - - existing_sess = ddb_entry->sess->dd_data; - existing_conn = ddb_entry->conn->dd_data; - - if (existing_sess->targetname == NULL || - existing_conn->persistent_address == NULL || - existing_conn->persistent_port == 0) - continue; - - DEBUG2(ql4_printk(KERN_INFO, ha, - "IQN = %s User IQN = %s\n", - existing_sess->targetname, - sess->targetname)); - - DEBUG2(ql4_printk(KERN_INFO, ha, - "IP = %s User IP = %s\n", - existing_conn->persistent_address, - conn->persistent_address)); - - DEBUG2(ql4_printk(KERN_INFO, ha, - "Port = %d User Port = %d\n", - existing_conn->persistent_port, - conn->persistent_port)); - - if (strcmp(existing_sess->targetname, sess->targetname)) - continue; - rval = qla4xxx_match_ipaddress(ha, ddb_entry, - existing_conn->persistent_address, - conn->persistent_address); - if (rval == QLA_ERROR) - continue; - if (existing_conn->persistent_port != conn->persistent_port) - continue; - break; - } - - if (idx == max_ddbs) - return QLA_ERROR; - - DEBUG2(ql4_printk(KERN_INFO, ha, - "Match found in fwdb sessions\n")); - return QLA_SUCCESS; -} - static struct iscsi_cls_session * qla4xxx_session_create(struct iscsi_endpoint *ep, uint16_t cmds_max, uint16_t qdepth, @@ -1136,7 +984,8 @@ qla4xxx_session_create(struct iscsi_endpoint *ep, struct scsi_qla_host *ha; struct qla_endpoint *qla_ep; struct ddb_entry *ddb_entry; - uint16_t ddb_index; + uint32_t ddb_index; + uint32_t mbx_sts = 0; struct iscsi_session *sess; struct sockaddr *dst_addr; int ret; @@ -1151,9 +1000,32 @@ qla4xxx_session_create(struct iscsi_endpoint *ep, dst_addr = (struct sockaddr *)&qla_ep->dst_addr; ha = to_qla_host(qla_ep->host); - ret = qla4xxx_get_ddb_index(ha, &ddb_index); - if (ret == QLA_ERROR) +get_ddb_index: + ddb_index = find_first_zero_bit(ha->ddb_idx_map, MAX_DDB_ENTRIES); + + if (ddb_index >= MAX_DDB_ENTRIES) { + DEBUG2(ql4_printk(KERN_INFO, ha, + "Free DDB index not available\n")); + return NULL; + } + + if (test_and_set_bit(ddb_index, ha->ddb_idx_map)) + goto get_ddb_index; + + DEBUG2(ql4_printk(KERN_INFO, ha, + "Found a free DDB index at %d\n", ddb_index)); + ret = qla4xxx_req_ddb_entry(ha, ddb_index, &mbx_sts); + if (ret == QLA_ERROR) { + if (mbx_sts == MBOX_STS_COMMAND_ERROR) { + ql4_printk(KERN_INFO, ha, + "DDB index = %d not available trying next\n", + ddb_index); + goto get_ddb_index; + } + DEBUG2(ql4_printk(KERN_INFO, ha, + "Free FW DDB not available\n")); return NULL; + } cls_sess = iscsi_session_setup(&qla4xxx_iscsi_transport, qla_ep->host, cmds_max, sizeof(struct ddb_entry), @@ -1168,8 +1040,6 @@ qla4xxx_session_create(struct iscsi_endpoint *ep, ddb_entry->fw_ddb_device_state = DDB_DS_NO_CONNECTION_ACTIVE; ddb_entry->ha = ha; ddb_entry->sess = cls_sess; - ddb_entry->unblock_sess = qla4xxx_unblock_ddb; - ddb_entry->ddb_change = qla4xxx_ddb_change; cls_sess->recovery_tmo = ql4xsess_recovery_tmo; ha->fw_ddb_index_map[ddb_entry->fw_ddb_index] = ddb_entry; ha->tot_ddbs++; @@ -1207,9 +1077,6 @@ qla4xxx_conn_create(struct iscsi_cls_session *cls_sess, uint32_t conn_idx) DEBUG2(printk(KERN_INFO "Func: %s\n", __func__)); cls_conn = iscsi_conn_setup(cls_sess, sizeof(struct qla_conn), conn_idx); - if (!cls_conn) - return NULL; - sess = cls_sess->dd_data; ddb_entry = sess->dd_data; ddb_entry->conn = cls_conn; @@ -1242,7 +1109,7 @@ static int qla4xxx_conn_start(struct iscsi_cls_conn *cls_conn) struct iscsi_session *sess; struct ddb_entry *ddb_entry; struct scsi_qla_host *ha; - struct dev_db_entry *fw_ddb_entry = NULL; + struct dev_db_entry *fw_ddb_entry; dma_addr_t fw_ddb_entry_dma; uint32_t mbx_sts = 0; int ret = 0; @@ -1253,25 +1120,12 @@ static int qla4xxx_conn_start(struct iscsi_cls_conn *cls_conn) ddb_entry = sess->dd_data; ha = ddb_entry->ha; - /* Check if we have matching FW DDB, if yes then do not - * login to this target. This could cause target to logout previous - * connection - */ - ret = qla4xxx_match_fwdb_session(ha, cls_conn); - if (ret == QLA_SUCCESS) { - ql4_printk(KERN_INFO, ha, - "Session already exist in FW.\n"); - ret = -EEXIST; - goto exit_conn_start; - } - fw_ddb_entry = dma_alloc_coherent(&ha->pdev->dev, sizeof(*fw_ddb_entry), &fw_ddb_entry_dma, GFP_KERNEL); if (!fw_ddb_entry) { ql4_printk(KERN_ERR, ha, "%s: Unable to allocate dma buffer\n", __func__); - ret = -ENOMEM; - goto exit_conn_start; + return -ENOMEM; } ret = qla4xxx_set_param_ddbentry(ha, ddb_entry, cls_conn, &mbx_sts); @@ -1284,7 +1138,9 @@ static int qla4xxx_conn_start(struct iscsi_cls_conn *cls_conn) if (mbx_sts) if (ddb_entry->fw_ddb_device_state == DDB_DS_SESSION_ACTIVE) { - ddb_entry->unblock_sess(ddb_entry->sess); + iscsi_conn_start(ddb_entry->conn); + iscsi_conn_login_event(ddb_entry->conn, + ISCSI_CONN_STATE_LOGGED_IN); goto exit_set_param; } @@ -1311,9 +1167,8 @@ static int qla4xxx_conn_start(struct iscsi_cls_conn *cls_conn) ret = 0; exit_conn_start: - if (fw_ddb_entry) - dma_free_coherent(&ha->pdev->dev, sizeof(*fw_ddb_entry), - fw_ddb_entry, fw_ddb_entry_dma); + dma_free_coherent(&ha->pdev->dev, sizeof(*fw_ddb_entry), + fw_ddb_entry, fw_ddb_entry_dma); return ret; } @@ -1489,101 +1344,6 @@ static int qla4xxx_task_xmit(struct iscsi_task *task) return -ENOSYS; } -static void qla4xxx_copy_fwddb_param(struct scsi_qla_host *ha, - struct dev_db_entry *fw_ddb_entry, - struct iscsi_cls_session *cls_sess, - struct iscsi_cls_conn *cls_conn) -{ - int buflen = 0; - struct iscsi_session *sess; - struct iscsi_conn *conn; - char ip_addr[DDB_IPADDR_LEN]; - uint16_t options = 0; - - sess = cls_sess->dd_data; - conn = cls_conn->dd_data; - - conn->max_recv_dlength = BYTE_UNITS * - le16_to_cpu(fw_ddb_entry->iscsi_max_rcv_data_seg_len); - - conn->max_xmit_dlength = BYTE_UNITS * - le16_to_cpu(fw_ddb_entry->iscsi_max_snd_data_seg_len); - - sess->initial_r2t_en = - (BIT_10 & le16_to_cpu(fw_ddb_entry->iscsi_options)); - - sess->max_r2t = le16_to_cpu(fw_ddb_entry->iscsi_max_outsnd_r2t); - - sess->imm_data_en = (BIT_11 & le16_to_cpu(fw_ddb_entry->iscsi_options)); - - sess->first_burst = BYTE_UNITS * - le16_to_cpu(fw_ddb_entry->iscsi_first_burst_len); - - sess->max_burst = BYTE_UNITS * - le16_to_cpu(fw_ddb_entry->iscsi_max_burst_len); - - sess->time2wait = le16_to_cpu(fw_ddb_entry->iscsi_def_time2wait); - - sess->time2retain = le16_to_cpu(fw_ddb_entry->iscsi_def_time2retain); - - conn->persistent_port = le16_to_cpu(fw_ddb_entry->port); - - sess->tpgt = le32_to_cpu(fw_ddb_entry->tgt_portal_grp); - - options = le16_to_cpu(fw_ddb_entry->options); - if (options & DDB_OPT_IPV6_DEVICE) - sprintf(ip_addr, "%pI6", fw_ddb_entry->ip_addr); - else - sprintf(ip_addr, "%pI4", fw_ddb_entry->ip_addr); - - iscsi_set_param(cls_conn, ISCSI_PARAM_TARGET_NAME, - (char *)fw_ddb_entry->iscsi_name, buflen); - iscsi_set_param(cls_conn, ISCSI_PARAM_INITIATOR_NAME, - (char *)ha->name_string, buflen); - iscsi_set_param(cls_conn, ISCSI_PARAM_PERSISTENT_ADDRESS, - (char *)ip_addr, buflen); -} - -void qla4xxx_update_session_conn_fwddb_param(struct scsi_qla_host *ha, - struct ddb_entry *ddb_entry) -{ - struct iscsi_cls_session *cls_sess; - struct iscsi_cls_conn *cls_conn; - uint32_t ddb_state; - dma_addr_t fw_ddb_entry_dma; - struct dev_db_entry *fw_ddb_entry; - - fw_ddb_entry = dma_alloc_coherent(&ha->pdev->dev, sizeof(*fw_ddb_entry), - &fw_ddb_entry_dma, GFP_KERNEL); - if (!fw_ddb_entry) { - ql4_printk(KERN_ERR, ha, - "%s: Unable to allocate dma buffer\n", __func__); - goto exit_session_conn_fwddb_param; - } - - if (qla4xxx_get_fwddb_entry(ha, ddb_entry->fw_ddb_index, fw_ddb_entry, - fw_ddb_entry_dma, NULL, NULL, &ddb_state, - NULL, NULL, NULL) == QLA_ERROR) { - DEBUG2(ql4_printk(KERN_ERR, ha, "scsi%ld: %s: failed " - "get_ddb_entry for fw_ddb_index %d\n", - ha->host_no, __func__, - ddb_entry->fw_ddb_index)); - goto exit_session_conn_fwddb_param; - } - - cls_sess = ddb_entry->sess; - - cls_conn = ddb_entry->conn; - - /* Update params */ - qla4xxx_copy_fwddb_param(ha, fw_ddb_entry, cls_sess, cls_conn); - -exit_session_conn_fwddb_param: - if (fw_ddb_entry) - dma_free_coherent(&ha->pdev->dev, sizeof(*fw_ddb_entry), - fw_ddb_entry, fw_ddb_entry_dma); -} - void qla4xxx_update_session_conn_param(struct scsi_qla_host *ha, struct ddb_entry *ddb_entry) { @@ -1600,7 +1360,7 @@ void qla4xxx_update_session_conn_param(struct scsi_qla_host *ha, if (!fw_ddb_entry) { ql4_printk(KERN_ERR, ha, "%s: Unable to allocate dma buffer\n", __func__); - goto exit_session_conn_param; + return; } if (qla4xxx_get_fwddb_entry(ha, ddb_entry->fw_ddb_index, fw_ddb_entry, @@ -1610,7 +1370,7 @@ void qla4xxx_update_session_conn_param(struct scsi_qla_host *ha, "get_ddb_entry for fw_ddb_index %d\n", ha->host_no, __func__, ddb_entry->fw_ddb_index)); - goto exit_session_conn_param; + return; } cls_sess = ddb_entry->sess; @@ -1619,12 +1379,6 @@ void qla4xxx_update_session_conn_param(struct scsi_qla_host *ha, cls_conn = ddb_entry->conn; conn = cls_conn->dd_data; - /* Update timers after login */ - ddb_entry->default_relogin_timeout = - le16_to_cpu(fw_ddb_entry->def_timeout); - ddb_entry->default_time2wait = - le16_to_cpu(fw_ddb_entry->iscsi_def_time2wait); - /* Update params */ conn->max_recv_dlength = BYTE_UNITS * le16_to_cpu(fw_ddb_entry->iscsi_max_rcv_data_seg_len); @@ -1653,11 +1407,6 @@ void qla4xxx_update_session_conn_param(struct scsi_qla_host *ha, memcpy(sess->initiatorname, ha->name_string, min(sizeof(ha->name_string), sizeof(sess->initiatorname))); - -exit_session_conn_param: - if (fw_ddb_entry) - dma_free_coherent(&ha->pdev->dev, sizeof(*fw_ddb_entry), - fw_ddb_entry, fw_ddb_entry_dma); } /* @@ -1858,9 +1607,6 @@ static void qla4xxx_mem_free(struct scsi_qla_host *ha) vfree(ha->chap_list); ha->chap_list = NULL; - if (ha->fw_ddb_dma_pool) - dma_pool_destroy(ha->fw_ddb_dma_pool); - /* release io space registers */ if (is_qla8022(ha)) { if (ha->nx_pcibase) @@ -1943,16 +1689,6 @@ static int qla4xxx_mem_alloc(struct scsi_qla_host *ha) goto mem_alloc_error_exit; } - ha->fw_ddb_dma_pool = dma_pool_create("ql4_fw_ddb", &ha->pdev->dev, - DDB_DMA_BLOCK_SIZE, 8, 0); - - if (ha->fw_ddb_dma_pool == NULL) { - ql4_printk(KERN_WARNING, ha, - "%s: fw_ddb_dma_pool allocation failed..\n", - __func__); - goto mem_alloc_error_exit; - } - return QLA_SUCCESS; mem_alloc_error_exit: @@ -2064,60 +1800,6 @@ void qla4_8xxx_watchdog(struct scsi_qla_host *ha) } } -void qla4xxx_check_relogin_flash_ddb(struct iscsi_cls_session *cls_sess) -{ - struct iscsi_session *sess; - struct ddb_entry *ddb_entry; - struct scsi_qla_host *ha; - - sess = cls_sess->dd_data; - ddb_entry = sess->dd_data; - ha = ddb_entry->ha; - - if (!(ddb_entry->ddb_type == FLASH_DDB)) - return; - - if (adapter_up(ha) && !test_bit(DF_RELOGIN, &ddb_entry->flags) && - !iscsi_is_session_online(cls_sess)) { - if (atomic_read(&ddb_entry->retry_relogin_timer) != - INVALID_ENTRY) { - if (atomic_read(&ddb_entry->retry_relogin_timer) == - 0) { - atomic_set(&ddb_entry->retry_relogin_timer, - INVALID_ENTRY); - set_bit(DPC_RELOGIN_DEVICE, &ha->dpc_flags); - set_bit(DF_RELOGIN, &ddb_entry->flags); - DEBUG2(ql4_printk(KERN_INFO, ha, - "%s: index [%d] login device\n", - __func__, ddb_entry->fw_ddb_index)); - } else - atomic_dec(&ddb_entry->retry_relogin_timer); - } - } - - /* Wait for relogin to timeout */ - if (atomic_read(&ddb_entry->relogin_timer) && - (atomic_dec_and_test(&ddb_entry->relogin_timer) != 0)) { - /* - * If the relogin times out and the device is - * still NOT ONLINE then try and relogin again. - */ - if (!iscsi_is_session_online(cls_sess)) { - /* Reset retry relogin timer */ - atomic_inc(&ddb_entry->relogin_retry_count); - DEBUG2(ql4_printk(KERN_INFO, ha, - "%s: index[%d] relogin timed out-retrying" - " relogin (%d), retry (%d)\n", __func__, - ddb_entry->fw_ddb_index, - atomic_read(&ddb_entry->relogin_retry_count), - ddb_entry->default_time2wait + 4)); - set_bit(DPC_RELOGIN_DEVICE, &ha->dpc_flags); - atomic_set(&ddb_entry->retry_relogin_timer, - ddb_entry->default_time2wait + 4); - } - } -} - /** * qla4xxx_timer - checks every second for work to do. * @ha: Pointer to host adapter structure. @@ -2127,8 +1809,6 @@ static void qla4xxx_timer(struct scsi_qla_host *ha) int start_dpc = 0; uint16_t w; - iscsi_host_for_each_session(ha->host, qla4xxx_check_relogin_flash_ddb); - /* If we are in the middle of AER/EEH processing * skip any processing and reschedule the timer */ @@ -2398,12 +2078,7 @@ static void qla4xxx_fail_session(struct iscsi_cls_session *cls_session) sess = cls_session->dd_data; ddb_entry = sess->dd_data; ddb_entry->fw_ddb_device_state = DDB_DS_SESSION_FAILED; - - if (ddb_entry->ddb_type == FLASH_DDB) - iscsi_block_session(ddb_entry->sess); - else - iscsi_session_failure(cls_session->dd_data, - ISCSI_ERR_CONN_FAILED); + iscsi_session_failure(cls_session->dd_data, ISCSI_ERR_CONN_FAILED); } /** @@ -2488,7 +2163,7 @@ static int qla4xxx_recover_adapter(struct scsi_qla_host *ha) /* NOTE: AF_ONLINE flag set upon successful completion of * qla4xxx_initialize_adapter */ - status = qla4xxx_initialize_adapter(ha, RESET_ADAPTER); + status = qla4xxx_initialize_adapter(ha); } /* Retry failed adapter initialization, if necessary @@ -2570,108 +2245,17 @@ static void qla4xxx_relogin_devices(struct iscsi_cls_session *cls_session) iscsi_unblock_session(ddb_entry->sess); } else { /* Trigger relogin */ - if (ddb_entry->ddb_type == FLASH_DDB) { - if (!test_bit(DF_RELOGIN, &ddb_entry->flags)) - qla4xxx_arm_relogin_timer(ddb_entry); - } else - iscsi_session_failure(cls_session->dd_data, - ISCSI_ERR_CONN_FAILED); + iscsi_session_failure(cls_session->dd_data, + ISCSI_ERR_CONN_FAILED); } } } -int qla4xxx_unblock_flash_ddb(struct iscsi_cls_session *cls_session) -{ - struct iscsi_session *sess; - struct ddb_entry *ddb_entry; - struct scsi_qla_host *ha; - - sess = cls_session->dd_data; - ddb_entry = sess->dd_data; - ha = ddb_entry->ha; - ql4_printk(KERN_INFO, ha, "scsi%ld: %s: ddb[%d]" - " unblock session\n", ha->host_no, __func__, - ddb_entry->fw_ddb_index); - - iscsi_unblock_session(ddb_entry->sess); - - /* Start scan target */ - if (test_bit(AF_ONLINE, &ha->flags)) { - ql4_printk(KERN_INFO, ha, "scsi%ld: %s: ddb[%d]" - " start scan\n", ha->host_no, __func__, - ddb_entry->fw_ddb_index); - scsi_queue_work(ha->host, &ddb_entry->sess->scan_work); - } - return QLA_SUCCESS; -} - -int qla4xxx_unblock_ddb(struct iscsi_cls_session *cls_session) -{ - struct iscsi_session *sess; - struct ddb_entry *ddb_entry; - struct scsi_qla_host *ha; - - sess = cls_session->dd_data; - ddb_entry = sess->dd_data; - ha = ddb_entry->ha; - ql4_printk(KERN_INFO, ha, "scsi%ld: %s: ddb[%d]" - " unblock user space session\n", ha->host_no, __func__, - ddb_entry->fw_ddb_index); - iscsi_conn_start(ddb_entry->conn); - iscsi_conn_login_event(ddb_entry->conn, - ISCSI_CONN_STATE_LOGGED_IN); - - return QLA_SUCCESS; -} - static void qla4xxx_relogin_all_devices(struct scsi_qla_host *ha) { iscsi_host_for_each_session(ha->host, qla4xxx_relogin_devices); } -static void qla4xxx_relogin_flash_ddb(struct iscsi_cls_session *cls_sess) -{ - uint16_t relogin_timer; - struct iscsi_session *sess; - struct ddb_entry *ddb_entry; - struct scsi_qla_host *ha; - - sess = cls_sess->dd_data; - ddb_entry = sess->dd_data; - ha = ddb_entry->ha; - - relogin_timer = max(ddb_entry->default_relogin_timeout, - (uint16_t)RELOGIN_TOV); - atomic_set(&ddb_entry->relogin_timer, relogin_timer); - - DEBUG2(ql4_printk(KERN_INFO, ha, - "scsi%ld: Relogin index [%d]. TOV=%d\n", ha->host_no, - ddb_entry->fw_ddb_index, relogin_timer)); - - qla4xxx_login_flash_ddb(cls_sess); -} - -static void qla4xxx_dpc_relogin(struct iscsi_cls_session *cls_sess) -{ - struct iscsi_session *sess; - struct ddb_entry *ddb_entry; - struct scsi_qla_host *ha; - - sess = cls_sess->dd_data; - ddb_entry = sess->dd_data; - ha = ddb_entry->ha; - - if (!(ddb_entry->ddb_type == FLASH_DDB)) - return; - - if (test_and_clear_bit(DF_RELOGIN, &ddb_entry->flags) && - !iscsi_is_session_online(cls_sess)) { - DEBUG2(ql4_printk(KERN_INFO, ha, - "relogin issued\n")); - qla4xxx_relogin_flash_ddb(cls_sess); - } -} - void qla4xxx_wake_dpc(struct scsi_qla_host *ha) { if (ha->dpc_thread) @@ -2772,12 +2356,6 @@ static void qla4xxx_do_dpc(struct work_struct *work) if (test_and_clear_bit(DPC_GET_DHCP_IP_ADDR, &ha->dpc_flags)) qla4xxx_get_dhcp_ip_address(ha); - /* ---- relogin device? --- */ - if (adapter_up(ha) && - test_and_clear_bit(DPC_RELOGIN_DEVICE, &ha->dpc_flags)) { - iscsi_host_for_each_session(ha->host, qla4xxx_dpc_relogin); - } - /* ---- link change? --- */ if (test_and_clear_bit(DPC_LINK_CHANGED, &ha->dpc_flags)) { if (!test_bit(AF_LINK_UP, &ha->flags)) { @@ -2790,12 +2368,8 @@ static void qla4xxx_do_dpc(struct work_struct *work) * fatal error recovery. Therefore, the driver must * manually relogin to devices when recovering from * connection failures, logouts, expired KATO, etc. */ - if (test_and_clear_bit(AF_BUILD_DDB_LIST, &ha->flags)) { - qla4xxx_build_ddb_list(ha, ha->is_reset); - iscsi_host_for_each_session(ha->host, - qla4xxx_login_flash_ddb); - } else - qla4xxx_relogin_all_devices(ha); + + qla4xxx_relogin_all_devices(ha); } } } @@ -3293,9 +2867,6 @@ static int get_fw_boot_info(struct scsi_qla_host *ha, uint16_t ddb_index[]) " target ID %d\n", __func__, ddb_index[0], ddb_index[1])); - ha->pri_ddb_idx = ddb_index[0]; - ha->sec_ddb_idx = ddb_index[1]; - exit_boot_info_free: dma_free_coherent(&ha->pdev->dev, size, buf, buf_dma); exit_boot_info: @@ -3463,9 +3034,6 @@ static int qla4xxx_get_boot_info(struct scsi_qla_host *ha) return ret; } - if (ql4xdisablesysfsboot) - return QLA_SUCCESS; - if (ddb_index[0] == 0xffff) goto sec_target; @@ -3498,15 +3066,7 @@ static int qla4xxx_setup_boot_info(struct scsi_qla_host *ha) struct iscsi_boot_kobj *boot_kobj; if (qla4xxx_get_boot_info(ha) != QLA_SUCCESS) - return QLA_ERROR; - - if (ql4xdisablesysfsboot) { - ql4_printk(KERN_INFO, ha, - "%s: syfsboot disabled - driver will trigger login" - "and publish session for discovery .\n", __func__); - return QLA_SUCCESS; - } - + return 0; ha->boot_kset = iscsi_boot_create_host_kset(ha->host->host_no); if (!ha->boot_kset) @@ -3548,7 +3108,7 @@ static int qla4xxx_setup_boot_info(struct scsi_qla_host *ha) if (!boot_kobj) goto put_host; - return QLA_SUCCESS; + return 0; put_host: scsi_host_put(ha->host); @@ -3614,507 +3174,9 @@ static void qla4xxx_create_chap_list(struct scsi_qla_host *ha) exit_chap_list: dma_free_coherent(&ha->pdev->dev, chap_size, chap_flash_data, chap_dma); + return; } -static void qla4xxx_get_param_ddb(struct ddb_entry *ddb_entry, - struct ql4_tuple_ddb *tddb) -{ - struct scsi_qla_host *ha; - struct iscsi_cls_session *cls_sess; - struct iscsi_cls_conn *cls_conn; - struct iscsi_session *sess; - struct iscsi_conn *conn; - - DEBUG2(printk(KERN_INFO "Func: %s\n", __func__)); - ha = ddb_entry->ha; - cls_sess = ddb_entry->sess; - sess = cls_sess->dd_data; - cls_conn = ddb_entry->conn; - conn = cls_conn->dd_data; - - tddb->tpgt = sess->tpgt; - tddb->port = conn->persistent_port; - strncpy(tddb->iscsi_name, sess->targetname, ISCSI_NAME_SIZE); - strncpy(tddb->ip_addr, conn->persistent_address, DDB_IPADDR_LEN); -} - -static void qla4xxx_convert_param_ddb(struct dev_db_entry *fw_ddb_entry, - struct ql4_tuple_ddb *tddb) -{ - uint16_t options = 0; - - tddb->tpgt = le32_to_cpu(fw_ddb_entry->tgt_portal_grp); - memcpy(&tddb->iscsi_name[0], &fw_ddb_entry->iscsi_name[0], - min(sizeof(tddb->iscsi_name), sizeof(fw_ddb_entry->iscsi_name))); - - options = le16_to_cpu(fw_ddb_entry->options); - if (options & DDB_OPT_IPV6_DEVICE) - sprintf(tddb->ip_addr, "%pI6", fw_ddb_entry->ip_addr); - else - sprintf(tddb->ip_addr, "%pI4", fw_ddb_entry->ip_addr); - - tddb->port = le16_to_cpu(fw_ddb_entry->port); -} - -static int qla4xxx_compare_tuple_ddb(struct scsi_qla_host *ha, - struct ql4_tuple_ddb *old_tddb, - struct ql4_tuple_ddb *new_tddb) -{ - if (strcmp(old_tddb->iscsi_name, new_tddb->iscsi_name)) - return QLA_ERROR; - - if (strcmp(old_tddb->ip_addr, new_tddb->ip_addr)) - return QLA_ERROR; - - if (old_tddb->port != new_tddb->port) - return QLA_ERROR; - - DEBUG2(ql4_printk(KERN_INFO, ha, - "Match Found, fw[%d,%d,%s,%s], [%d,%d,%s,%s]", - old_tddb->port, old_tddb->tpgt, old_tddb->ip_addr, - old_tddb->iscsi_name, new_tddb->port, new_tddb->tpgt, - new_tddb->ip_addr, new_tddb->iscsi_name)); - - return QLA_SUCCESS; -} - -static int qla4xxx_is_session_exists(struct scsi_qla_host *ha, - struct dev_db_entry *fw_ddb_entry) -{ - struct ddb_entry *ddb_entry; - struct ql4_tuple_ddb *fw_tddb = NULL; - struct ql4_tuple_ddb *tmp_tddb = NULL; - int idx; - int ret = QLA_ERROR; - - fw_tddb = vzalloc(sizeof(*fw_tddb)); - if (!fw_tddb) { - DEBUG2(ql4_printk(KERN_WARNING, ha, - "Memory Allocation failed.\n")); - ret = QLA_SUCCESS; - goto exit_check; - } - - tmp_tddb = vzalloc(sizeof(*tmp_tddb)); - if (!tmp_tddb) { - DEBUG2(ql4_printk(KERN_WARNING, ha, - "Memory Allocation failed.\n")); - ret = QLA_SUCCESS; - goto exit_check; - } - - qla4xxx_convert_param_ddb(fw_ddb_entry, fw_tddb); - - for (idx = 0; idx < MAX_DDB_ENTRIES; idx++) { - ddb_entry = qla4xxx_lookup_ddb_by_fw_index(ha, idx); - if (ddb_entry == NULL) - continue; - - qla4xxx_get_param_ddb(ddb_entry, tmp_tddb); - if (!qla4xxx_compare_tuple_ddb(ha, fw_tddb, tmp_tddb)) { - ret = QLA_SUCCESS; /* found */ - goto exit_check; - } - } - -exit_check: - if (fw_tddb) - vfree(fw_tddb); - if (tmp_tddb) - vfree(tmp_tddb); - return ret; -} - -static int qla4xxx_is_flash_ddb_exists(struct scsi_qla_host *ha, - struct list_head *list_nt, - struct dev_db_entry *fw_ddb_entry) -{ - struct qla_ddb_index *nt_ddb_idx, *nt_ddb_idx_tmp; - struct ql4_tuple_ddb *fw_tddb = NULL; - struct ql4_tuple_ddb *tmp_tddb = NULL; - int ret = QLA_ERROR; - - fw_tddb = vzalloc(sizeof(*fw_tddb)); - if (!fw_tddb) { - DEBUG2(ql4_printk(KERN_WARNING, ha, - "Memory Allocation failed.\n")); - ret = QLA_SUCCESS; - goto exit_check; - } - - tmp_tddb = vzalloc(sizeof(*tmp_tddb)); - if (!tmp_tddb) { - DEBUG2(ql4_printk(KERN_WARNING, ha, - "Memory Allocation failed.\n")); - ret = QLA_SUCCESS; - goto exit_check; - } - - qla4xxx_convert_param_ddb(fw_ddb_entry, fw_tddb); - - list_for_each_entry_safe(nt_ddb_idx, nt_ddb_idx_tmp, list_nt, list) { - qla4xxx_convert_param_ddb(&nt_ddb_idx->fw_ddb, tmp_tddb); - if (!qla4xxx_compare_tuple_ddb(ha, fw_tddb, tmp_tddb)) { - ret = QLA_SUCCESS; /* found */ - goto exit_check; - } - } - -exit_check: - if (fw_tddb) - vfree(fw_tddb); - if (tmp_tddb) - vfree(tmp_tddb); - return ret; -} - -static void qla4xxx_free_nt_list(struct list_head *list_nt) -{ - struct qla_ddb_index *nt_ddb_idx, *nt_ddb_idx_tmp; - - /* Free up the normaltargets list */ - list_for_each_entry_safe(nt_ddb_idx, nt_ddb_idx_tmp, list_nt, list) { - list_del_init(&nt_ddb_idx->list); - vfree(nt_ddb_idx); - } - -} - -static struct iscsi_endpoint *qla4xxx_get_ep_fwdb(struct scsi_qla_host *ha, - struct dev_db_entry *fw_ddb_entry) -{ - struct iscsi_endpoint *ep; - struct sockaddr_in *addr; - struct sockaddr_in6 *addr6; - struct sockaddr *dst_addr; - char *ip; - - /* TODO: need to destroy on unload iscsi_endpoint*/ - dst_addr = vmalloc(sizeof(*dst_addr)); - if (!dst_addr) - return NULL; - - if (fw_ddb_entry->options & DDB_OPT_IPV6_DEVICE) { - dst_addr->sa_family = AF_INET6; - addr6 = (struct sockaddr_in6 *)dst_addr; - ip = (char *)&addr6->sin6_addr; - memcpy(ip, fw_ddb_entry->ip_addr, IPv6_ADDR_LEN); - addr6->sin6_port = htons(le16_to_cpu(fw_ddb_entry->port)); - - } else { - dst_addr->sa_family = AF_INET; - addr = (struct sockaddr_in *)dst_addr; - ip = (char *)&addr->sin_addr; - memcpy(ip, fw_ddb_entry->ip_addr, IP_ADDR_LEN); - addr->sin_port = htons(le16_to_cpu(fw_ddb_entry->port)); - } - - ep = qla4xxx_ep_connect(ha->host, dst_addr, 0); - vfree(dst_addr); - return ep; -} - -static int qla4xxx_verify_boot_idx(struct scsi_qla_host *ha, uint16_t idx) -{ - if (ql4xdisablesysfsboot) - return QLA_SUCCESS; - if (idx == ha->pri_ddb_idx || idx == ha->sec_ddb_idx) - return QLA_ERROR; - return QLA_SUCCESS; -} - -static void qla4xxx_setup_flash_ddb_entry(struct scsi_qla_host *ha, - struct ddb_entry *ddb_entry) -{ - ddb_entry->ddb_type = FLASH_DDB; - ddb_entry->fw_ddb_index = INVALID_ENTRY; - ddb_entry->fw_ddb_device_state = DDB_DS_NO_CONNECTION_ACTIVE; - ddb_entry->ha = ha; - ddb_entry->unblock_sess = qla4xxx_unblock_flash_ddb; - ddb_entry->ddb_change = qla4xxx_flash_ddb_change; - - atomic_set(&ddb_entry->retry_relogin_timer, INVALID_ENTRY); - atomic_set(&ddb_entry->relogin_timer, 0); - atomic_set(&ddb_entry->relogin_retry_count, 0); - - ddb_entry->default_relogin_timeout = - le16_to_cpu(ddb_entry->fw_ddb_entry.def_timeout); - ddb_entry->default_time2wait = - le16_to_cpu(ddb_entry->fw_ddb_entry.iscsi_def_time2wait); -} - -static void qla4xxx_wait_for_ip_configuration(struct scsi_qla_host *ha) -{ - uint32_t idx = 0; - uint32_t ip_idx[IP_ADDR_COUNT] = {0, 1, 2, 3}; /* 4 IP interfaces */ - uint32_t sts[MBOX_REG_COUNT]; - uint32_t ip_state; - unsigned long wtime; - int ret; - - wtime = jiffies + (HZ * IP_CONFIG_TOV); - do { - for (idx = 0; idx < IP_ADDR_COUNT; idx++) { - if (ip_idx[idx] == -1) - continue; - - ret = qla4xxx_get_ip_state(ha, 0, ip_idx[idx], sts); - - if (ret == QLA_ERROR) { - ip_idx[idx] = -1; - continue; - } - - ip_state = (sts[1] & IP_STATE_MASK) >> IP_STATE_SHIFT; - - DEBUG2(ql4_printk(KERN_INFO, ha, - "Waiting for IP state for idx = %d, state = 0x%x\n", - ip_idx[idx], ip_state)); - if (ip_state == IP_ADDRSTATE_UNCONFIGURED || - ip_state == IP_ADDRSTATE_INVALID || - ip_state == IP_ADDRSTATE_PREFERRED || - ip_state == IP_ADDRSTATE_DEPRICATED || - ip_state == IP_ADDRSTATE_DISABLING) - ip_idx[idx] = -1; - - } - - /* Break if all IP states checked */ - if ((ip_idx[0] == -1) && - (ip_idx[1] == -1) && - (ip_idx[2] == -1) && - (ip_idx[3] == -1)) - break; - schedule_timeout_uninterruptible(HZ); - } while (time_after(wtime, jiffies)); -} - -void qla4xxx_build_ddb_list(struct scsi_qla_host *ha, int is_reset) -{ - int max_ddbs; - int ret; - uint32_t idx = 0, next_idx = 0; - uint32_t state = 0, conn_err = 0; - uint16_t conn_id; - struct dev_db_entry *fw_ddb_entry; - struct ddb_entry *ddb_entry = NULL; - dma_addr_t fw_ddb_dma; - struct iscsi_cls_session *cls_sess; - struct iscsi_session *sess; - struct iscsi_cls_conn *cls_conn; - struct iscsi_endpoint *ep; - uint16_t cmds_max = 32, tmo = 0; - uint32_t initial_cmdsn = 0; - struct list_head list_st, list_nt; /* List of sendtargets */ - struct qla_ddb_index *st_ddb_idx, *st_ddb_idx_tmp; - int fw_idx_size; - unsigned long wtime; - struct qla_ddb_index *nt_ddb_idx; - - if (!test_bit(AF_LINK_UP, &ha->flags)) { - set_bit(AF_BUILD_DDB_LIST, &ha->flags); - ha->is_reset = is_reset; - return; - } - max_ddbs = is_qla40XX(ha) ? MAX_DEV_DB_ENTRIES_40XX : - MAX_DEV_DB_ENTRIES; - - fw_ddb_entry = dma_pool_alloc(ha->fw_ddb_dma_pool, GFP_KERNEL, - &fw_ddb_dma); - if (fw_ddb_entry == NULL) { - DEBUG2(ql4_printk(KERN_ERR, ha, "Out of memory\n")); - goto exit_ddb_list; - } - - INIT_LIST_HEAD(&list_st); - INIT_LIST_HEAD(&list_nt); - fw_idx_size = sizeof(struct qla_ddb_index); - - for (idx = 0; idx < max_ddbs; idx = next_idx) { - ret = qla4xxx_get_fwddb_entry(ha, idx, fw_ddb_entry, - fw_ddb_dma, NULL, - &next_idx, &state, &conn_err, - NULL, &conn_id); - if (ret == QLA_ERROR) - break; - - if (qla4xxx_verify_boot_idx(ha, idx) != QLA_SUCCESS) - goto continue_next_st; - - /* Check if ST, add to the list_st */ - if (strlen((char *) fw_ddb_entry->iscsi_name) != 0) - goto continue_next_st; - - st_ddb_idx = vzalloc(fw_idx_size); - if (!st_ddb_idx) - break; - - st_ddb_idx->fw_ddb_idx = idx; - - list_add_tail(&st_ddb_idx->list, &list_st); -continue_next_st: - if (next_idx == 0) - break; - } - - /* Before issuing conn open mbox, ensure all IPs states are configured - * Note, conn open fails if IPs are not configured - */ - qla4xxx_wait_for_ip_configuration(ha); - - /* Go thru the STs and fire the sendtargets by issuing conn open mbx */ - list_for_each_entry_safe(st_ddb_idx, st_ddb_idx_tmp, &list_st, list) { - qla4xxx_conn_open(ha, st_ddb_idx->fw_ddb_idx); - } - - /* Wait to ensure all sendtargets are done for min 12 sec wait */ - tmo = ((ha->def_timeout < LOGIN_TOV) ? LOGIN_TOV : ha->def_timeout); - DEBUG2(ql4_printk(KERN_INFO, ha, - "Default time to wait for build ddb %d\n", tmo)); - - wtime = jiffies + (HZ * tmo); - do { - list_for_each_entry_safe(st_ddb_idx, st_ddb_idx_tmp, &list_st, - list) { - ret = qla4xxx_get_fwddb_entry(ha, - st_ddb_idx->fw_ddb_idx, - NULL, 0, NULL, &next_idx, - &state, &conn_err, NULL, - NULL); - if (ret == QLA_ERROR) - continue; - - if (state == DDB_DS_NO_CONNECTION_ACTIVE || - state == DDB_DS_SESSION_FAILED) { - list_del_init(&st_ddb_idx->list); - vfree(st_ddb_idx); - } - } - schedule_timeout_uninterruptible(HZ / 10); - } while (time_after(wtime, jiffies)); - - /* Free up the sendtargets list */ - list_for_each_entry_safe(st_ddb_idx, st_ddb_idx_tmp, &list_st, list) { - list_del_init(&st_ddb_idx->list); - vfree(st_ddb_idx); - } - - for (idx = 0; idx < max_ddbs; idx = next_idx) { - ret = qla4xxx_get_fwddb_entry(ha, idx, fw_ddb_entry, - fw_ddb_dma, NULL, - &next_idx, &state, &conn_err, - NULL, &conn_id); - if (ret == QLA_ERROR) - break; - - if (qla4xxx_verify_boot_idx(ha, idx) != QLA_SUCCESS) - goto continue_next_nt; - - /* Check if NT, then add to list it */ - if (strlen((char *) fw_ddb_entry->iscsi_name) == 0) - goto continue_next_nt; - - if (state == DDB_DS_NO_CONNECTION_ACTIVE || - state == DDB_DS_SESSION_FAILED) { - DEBUG2(ql4_printk(KERN_INFO, ha, - "Adding DDB to session = 0x%x\n", - idx)); - if (is_reset == INIT_ADAPTER) { - nt_ddb_idx = vmalloc(fw_idx_size); - if (!nt_ddb_idx) - break; - - nt_ddb_idx->fw_ddb_idx = idx; - - memcpy(&nt_ddb_idx->fw_ddb, fw_ddb_entry, - sizeof(struct dev_db_entry)); - - if (qla4xxx_is_flash_ddb_exists(ha, &list_nt, - fw_ddb_entry) == QLA_SUCCESS) { - vfree(nt_ddb_idx); - goto continue_next_nt; - } - list_add_tail(&nt_ddb_idx->list, &list_nt); - } else if (is_reset == RESET_ADAPTER) { - if (qla4xxx_is_session_exists(ha, - fw_ddb_entry) == QLA_SUCCESS) - goto continue_next_nt; - } - - /* Create session object, with INVALID_ENTRY, - * the targer_id would get set when we issue the login - */ - cls_sess = iscsi_session_setup(&qla4xxx_iscsi_transport, - ha->host, cmds_max, - sizeof(struct ddb_entry), - sizeof(struct ql4_task_data), - initial_cmdsn, INVALID_ENTRY); - if (!cls_sess) - goto exit_ddb_list; - - /* - * iscsi_session_setup increments the driver reference - * count which wouldn't let the driver to be unloaded. - * so calling module_put function to decrement the - * reference count. - **/ - module_put(qla4xxx_iscsi_transport.owner); - sess = cls_sess->dd_data; - ddb_entry = sess->dd_data; - ddb_entry->sess = cls_sess; - - cls_sess->recovery_tmo = ql4xsess_recovery_tmo; - memcpy(&ddb_entry->fw_ddb_entry, fw_ddb_entry, - sizeof(struct dev_db_entry)); - - qla4xxx_setup_flash_ddb_entry(ha, ddb_entry); - - cls_conn = iscsi_conn_setup(cls_sess, - sizeof(struct qla_conn), - conn_id); - if (!cls_conn) - goto exit_ddb_list; - - ddb_entry->conn = cls_conn; - - /* Setup ep, for displaying attributes in sysfs */ - ep = qla4xxx_get_ep_fwdb(ha, fw_ddb_entry); - if (ep) { - ep->conn = cls_conn; - cls_conn->ep = ep; - } else { - DEBUG2(ql4_printk(KERN_ERR, ha, - "Unable to get ep\n")); - } - - /* Update sess/conn params */ - qla4xxx_copy_fwddb_param(ha, fw_ddb_entry, cls_sess, - cls_conn); - - if (is_reset == RESET_ADAPTER) { - iscsi_block_session(cls_sess); - /* Use the relogin path to discover new devices - * by short-circuting the logic of setting - * timer to relogin - instead set the flags - * to initiate login right away. - */ - set_bit(DPC_RELOGIN_DEVICE, &ha->dpc_flags); - set_bit(DF_RELOGIN, &ddb_entry->flags); - } - } -continue_next_nt: - if (next_idx == 0) - break; - } -exit_ddb_list: - qla4xxx_free_nt_list(&list_nt); - if (fw_ddb_entry) - dma_pool_free(ha->fw_ddb_dma_pool, fw_ddb_entry, fw_ddb_dma); - - qla4xxx_free_ddb_index(ha); -} - - /** * qla4xxx_probe_adapter - callback function to probe HBA * @pdev: pointer to pci_dev structure @@ -4236,7 +3298,7 @@ static int __devinit qla4xxx_probe_adapter(struct pci_dev *pdev, * firmware * NOTE: interrupts enabled upon successful completion */ - status = qla4xxx_initialize_adapter(ha, INIT_ADAPTER); + status = qla4xxx_initialize_adapter(ha); while ((!test_bit(AF_ONLINE, &ha->flags)) && init_retry_count++ < MAX_INIT_RETRIES) { @@ -4257,7 +3319,7 @@ static int __devinit qla4xxx_probe_adapter(struct pci_dev *pdev, if (ha->isp_ops->reset_chip(ha) == QLA_ERROR) continue; - status = qla4xxx_initialize_adapter(ha, INIT_ADAPTER); + status = qla4xxx_initialize_adapter(ha); } if (!test_bit(AF_ONLINE, &ha->flags)) { @@ -4324,16 +3386,12 @@ static int __devinit qla4xxx_probe_adapter(struct pci_dev *pdev, ha->host_no, ha->firmware_version[0], ha->firmware_version[1], ha->patch_number, ha->build_number); + qla4xxx_create_chap_list(ha); + if (qla4xxx_setup_boot_info(ha)) ql4_printk(KERN_ERR, ha, "%s:ISCSI boot info setup failed\n", __func__); - /* Perform the build ddb list and login to each */ - qla4xxx_build_ddb_list(ha, INIT_ADAPTER); - iscsi_host_for_each_session(ha->host, qla4xxx_login_flash_ddb); - - qla4xxx_create_chap_list(ha); - qla4xxx_create_ifaces(ha); return 0; @@ -4391,38 +3449,6 @@ static void qla4xxx_prevent_other_port_reinit(struct scsi_qla_host *ha) } } -static void qla4xxx_destroy_fw_ddb_session(struct scsi_qla_host *ha) -{ - struct ddb_entry *ddb_entry; - int options; - int idx; - - for (idx = 0; idx < MAX_DDB_ENTRIES; idx++) { - - ddb_entry = qla4xxx_lookup_ddb_by_fw_index(ha, idx); - if ((ddb_entry != NULL) && - (ddb_entry->ddb_type == FLASH_DDB)) { - - options = LOGOUT_OPTION_CLOSE_SESSION; - if (qla4xxx_session_logout_ddb(ha, ddb_entry, options) - == QLA_ERROR) - ql4_printk(KERN_ERR, ha, "%s: Logout failed\n", - __func__); - - qla4xxx_clear_ddb_entry(ha, ddb_entry->fw_ddb_index); - /* - * we have decremented the reference count of the driver - * when we setup the session to have the driver unload - * to be seamless without actually destroying the - * session - **/ - try_module_get(qla4xxx_iscsi_transport.owner); - iscsi_destroy_endpoint(ddb_entry->conn->ep); - qla4xxx_free_ddb(ha, ddb_entry); - iscsi_session_teardown(ddb_entry->sess); - } - } -} /** * qla4xxx_remove_adapter - calback function to remove adapter. * @pci_dev: PCI device pointer @@ -4439,11 +3465,9 @@ static void __devexit qla4xxx_remove_adapter(struct pci_dev *pdev) /* destroy iface from sysfs */ qla4xxx_destroy_ifaces(ha); - if ((!ql4xdisablesysfsboot) && ha->boot_kset) + if (ha->boot_kset) iscsi_boot_destroy_kset(ha->boot_kset); - qla4xxx_destroy_fw_ddb_session(ha); - scsi_remove_host(ha->host); qla4xxx_free_adapter(ha); @@ -5091,7 +4115,7 @@ static uint32_t qla4_8xxx_error_recovery(struct scsi_qla_host *ha) qla4_8xxx_idc_unlock(ha); clear_bit(AF_FW_RECOVERY, &ha->flags); - rval = qla4xxx_initialize_adapter(ha, RESET_ADAPTER); + rval = qla4xxx_initialize_adapter(ha); qla4_8xxx_idc_lock(ha); if (rval != QLA_SUCCESS) { @@ -5127,7 +4151,7 @@ static uint32_t qla4_8xxx_error_recovery(struct scsi_qla_host *ha) if ((qla4_8xxx_rd_32(ha, QLA82XX_CRB_DEV_STATE) == QLA82XX_DEV_READY)) { clear_bit(AF_FW_RECOVERY, &ha->flags); - rval = qla4xxx_initialize_adapter(ha, RESET_ADAPTER); + rval = qla4xxx_initialize_adapter(ha); if (rval == QLA_SUCCESS) { ret = qla4xxx_request_irqs(ha); if (ret) { diff --git a/trunk/drivers/scsi/qla4xxx/ql4_version.h b/trunk/drivers/scsi/qla4xxx/ql4_version.h index 5254e57968f5..c15347d3f532 100644 --- a/trunk/drivers/scsi/qla4xxx/ql4_version.h +++ b/trunk/drivers/scsi/qla4xxx/ql4_version.h @@ -5,4 +5,4 @@ * See LICENSE.qla4xxx for copyright and licensing details. */ -#define QLA4XXX_DRIVER_VERSION "5.02.00-k9" +#define QLA4XXX_DRIVER_VERSION "5.02.00-k8" diff --git a/trunk/include/drm/exynos_drm.h b/trunk/include/drm/exynos_drm.h index 7a2262a7689f..12050434d57a 100644 --- a/trunk/include/drm/exynos_drm.h +++ b/trunk/include/drm/exynos_drm.h @@ -74,16 +74,9 @@ struct drm_exynos_gem_mmap { uint64_t mapped; }; -struct drm_exynos_plane_set_zpos { - __u32 plane_id; - __s32 zpos; -}; - #define DRM_EXYNOS_GEM_CREATE 0x00 #define DRM_EXYNOS_GEM_MAP_OFFSET 0x01 #define DRM_EXYNOS_GEM_MMAP 0x02 -/* Reserved 0x03 ~ 0x05 for exynos specific gem ioctl */ -#define DRM_EXYNOS_PLANE_SET_ZPOS 0x06 #define DRM_IOCTL_EXYNOS_GEM_CREATE DRM_IOWR(DRM_COMMAND_BASE + \ DRM_EXYNOS_GEM_CREATE, struct drm_exynos_gem_create) @@ -94,9 +87,6 @@ struct drm_exynos_plane_set_zpos { #define DRM_IOCTL_EXYNOS_GEM_MMAP DRM_IOWR(DRM_COMMAND_BASE + \ DRM_EXYNOS_GEM_MMAP, struct drm_exynos_gem_mmap) -#define DRM_IOCTL_EXYNOS_PLANE_SET_ZPOS DRM_IOWR(DRM_COMMAND_BASE + \ - DRM_EXYNOS_PLANE_SET_ZPOS, struct drm_exynos_plane_set_zpos) - /** * Platform Specific Structure for DRM based FIMD. * diff --git a/trunk/include/scsi/libfcoe.h b/trunk/include/scsi/libfcoe.h index 5a35a2a2d3c5..d1e95c6ac776 100644 --- a/trunk/include/scsi/libfcoe.h +++ b/trunk/include/scsi/libfcoe.h @@ -147,7 +147,6 @@ struct fcoe_ctlr { u8 map_dest; u8 spma; u8 probe_tries; - u8 priority; u8 dest_addr[ETH_ALEN]; u8 ctl_src_addr[ETH_ALEN]; @@ -302,7 +301,6 @@ struct fcoe_percpu_s { * @lport: The associated local port * @fcoe_pending_queue: The pending Rx queue of skbs * @fcoe_pending_queue_active: Indicates if the pending queue is active - * @priority: Packet priority (DCB) * @max_queue_depth: Max queue depth of pending queue * @min_queue_depth: Min queue depth of pending queue * @timer: The queue timer @@ -318,7 +316,6 @@ struct fcoe_port { struct fc_lport *lport; struct sk_buff_head fcoe_pending_queue; u8 fcoe_pending_queue_active; - u8 priority; u32 max_queue_depth; u32 min_queue_depth; struct timer_list timer; diff --git a/trunk/kernel/events/core.c b/trunk/kernel/events/core.c index 58690af323e4..d3b9df5962c2 100644 --- a/trunk/kernel/events/core.c +++ b/trunk/kernel/events/core.c @@ -3558,13 +3558,9 @@ static void ring_buffer_wakeup(struct perf_event *event) rcu_read_lock(); rb = rcu_dereference(event->rb); - if (!rb) - goto unlock; - - list_for_each_entry_rcu(event, &rb->event_list, rb_entry) + list_for_each_entry_rcu(event, &rb->event_list, rb_entry) { wake_up_all(&event->waitq); - -unlock: + } rcu_read_unlock(); } diff --git a/trunk/kernel/sched_fair.c b/trunk/kernel/sched_fair.c index 8a39fa3e3c6c..a78ed2736ba7 100644 --- a/trunk/kernel/sched_fair.c +++ b/trunk/kernel/sched_fair.c @@ -2352,11 +2352,13 @@ static int select_idle_sibling(struct task_struct *p, int target) if (!smt && (sd->flags & SD_SHARE_CPUPOWER)) continue; - if (smt && !(sd->flags & SD_SHARE_CPUPOWER)) - break; - - if (!(sd->flags & SD_SHARE_PKG_RESOURCES)) + if (!(sd->flags & SD_SHARE_PKG_RESOURCES)) { + if (!smt) { + smt = 1; + goto again; + } break; + } sg = sd->groups; do { @@ -2376,10 +2378,6 @@ static int select_idle_sibling(struct task_struct *p, int target) sg = sg->next; } while (sg != sd->groups); } - if (!smt) { - smt = 1; - goto again; - } done: rcu_read_unlock();