From owner-svn-src-all@FreeBSD.ORG Sat Sep 14 17:24:43 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 05F69C45; Sat, 14 Sep 2013 17:24:43 +0000 (UTC) (envelope-from dumbbell@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id E5F4020BA; Sat, 14 Sep 2013 17:24:42 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r8EHOgEY060902; Sat, 14 Sep 2013 17:24:42 GMT (envelope-from dumbbell@svn.freebsd.org) Received: (from dumbbell@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r8EHOgj8060898; Sat, 14 Sep 2013 17:24:42 GMT (envelope-from dumbbell@svn.freebsd.org) Message-Id: <201309141724.r8EHOgj8060898@svn.freebsd.org> From: Jean-Sebastien Pedron Date: Sat, 14 Sep 2013 17:24:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r255573 - head/sys/dev/drm2/radeon X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Sep 2013 17:24:43 -0000 Author: dumbbell Date: Sat Sep 14 17:24:41 2013 New Revision: 255573 URL: http://svnweb.freebsd.org/changeset/base/255573 Log: drm/radeon: Fix usage of pci_save_state() and pci_restore_state() Calling those functions with the drmn device as argument causes a panic, because it's not a direct child of pci$N. They must be called with the vgapci device instead. This fix is not enough to make suspend/resume work reliably. Approved by: re (blanket) Modified: head/sys/dev/drm2/radeon/r100.c head/sys/dev/drm2/radeon/r300.c head/sys/dev/drm2/radeon/radeon_device.c head/sys/dev/drm2/radeon/rs600.c Modified: head/sys/dev/drm2/radeon/r100.c ============================================================================== --- head/sys/dev/drm2/radeon/r100.c Sat Sep 14 17:22:34 2013 (r255572) +++ head/sys/dev/drm2/radeon/r100.c Sat Sep 14 17:24:41 2013 (r255573) @@ -2647,7 +2647,7 @@ int r100_asic_reset(struct radeon_device WREG32(RADEON_CP_RB_WPTR, 0); WREG32(RADEON_CP_RB_CNTL, tmp); /* save PCI state */ - pci_save_state(rdev->dev); + pci_save_state(device_get_parent(rdev->dev)); /* disable bus mastering */ r100_bm_disable(rdev); WREG32(R_0000F0_RBBM_SOFT_RESET, S_0000F0_SOFT_RESET_SE(1) | @@ -2669,7 +2669,7 @@ int r100_asic_reset(struct radeon_device status = RREG32(R_000E40_RBBM_STATUS); dev_info(rdev->dev, "(%s:%d) RBBM_STATUS=0x%08X\n", __func__, __LINE__, status); /* restore PCI & busmastering */ - pci_restore_state(rdev->dev); + pci_restore_state(device_get_parent(rdev->dev)); r100_enable_bm(rdev); /* Check if GPU is idle */ if (G_000E40_SE_BUSY(status) || G_000E40_RE_BUSY(status) || Modified: head/sys/dev/drm2/radeon/r300.c ============================================================================== --- head/sys/dev/drm2/radeon/r300.c Sat Sep 14 17:22:34 2013 (r255572) +++ head/sys/dev/drm2/radeon/r300.c Sat Sep 14 17:24:41 2013 (r255573) @@ -401,7 +401,7 @@ int r300_asic_reset(struct radeon_device WREG32(RADEON_CP_RB_WPTR, 0); WREG32(RADEON_CP_RB_CNTL, tmp); /* save PCI state */ - pci_save_state(rdev->dev); + pci_save_state(device_get_parent(rdev->dev)); /* disable bus mastering */ r100_bm_disable(rdev); WREG32(R_0000F0_RBBM_SOFT_RESET, S_0000F0_SOFT_RESET_VAP(1) | @@ -425,7 +425,7 @@ int r300_asic_reset(struct radeon_device status = RREG32(R_000E40_RBBM_STATUS); dev_info(rdev->dev, "(%s:%d) RBBM_STATUS=0x%08X\n", __func__, __LINE__, status); /* restore PCI & busmastering */ - pci_restore_state(rdev->dev); + pci_restore_state(device_get_parent(rdev->dev)); r100_enable_bm(rdev); /* Check if GPU is idle */ if (G_000E40_GA_BUSY(status) || G_000E40_VAP_BUSY(status)) { Modified: head/sys/dev/drm2/radeon/radeon_device.c ============================================================================== --- head/sys/dev/drm2/radeon/radeon_device.c Sat Sep 14 17:22:34 2013 (r255572) +++ head/sys/dev/drm2/radeon/radeon_device.c Sat Sep 14 17:24:41 2013 (r255573) @@ -1316,7 +1316,7 @@ int radeon_suspend_kms(struct drm_device radeon_agp_suspend(rdev); - pci_save_state(dev->device); + pci_save_state(device_get_parent(rdev->dev)); #ifdef DUMBBELL_WIP if (state.event == PM_EVENT_SUSPEND) { /* Shut down the device */ @@ -1356,7 +1356,7 @@ int radeon_resume_kms(struct drm_device console_lock(); #endif /* DUMBBELL_WIP */ pci_set_powerstate(dev->device, PCI_POWERSTATE_D0); - pci_restore_state(dev->device); + pci_restore_state(device_get_parent(rdev->dev)); #ifdef DUMBBELL_WIP if (pci_enable_device(dev->pdev)) { console_unlock(); Modified: head/sys/dev/drm2/radeon/rs600.c ============================================================================== --- head/sys/dev/drm2/radeon/rs600.c Sat Sep 14 17:22:34 2013 (r255572) +++ head/sys/dev/drm2/radeon/rs600.c Sat Sep 14 17:24:41 2013 (r255573) @@ -373,7 +373,7 @@ int rs600_asic_reset(struct radeon_devic WREG32(RADEON_CP_RB_RPTR_WR, 0); WREG32(RADEON_CP_RB_WPTR, 0); WREG32(RADEON_CP_RB_CNTL, tmp); - pci_save_state(rdev->dev); + pci_save_state(device_get_parent(rdev->dev)); /* disable bus mastering */ pci_disable_busmaster(rdev->dev); DRM_MDELAY(1); @@ -403,7 +403,7 @@ int rs600_asic_reset(struct radeon_devic status = RREG32(R_000E40_RBBM_STATUS); dev_info(rdev->dev, "(%s:%d) RBBM_STATUS=0x%08X\n", __func__, __LINE__, status); /* restore PCI & busmastering */ - pci_restore_state(rdev->dev); + pci_restore_state(device_get_parent(rdev->dev)); /* Check if GPU is idle */ if (G_000E40_GA_BUSY(status) || G_000E40_VAP_BUSY(status)) { dev_err(rdev->dev, "failed to reset GPU\n");