From patchwork Wed Feb 19 09:47:23 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiang Liu X-Patchwork-Id: 3683821 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 7927EBF13A for ; Thu, 20 Feb 2014 00:49:34 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A63DD201BA for ; Thu, 20 Feb 2014 00:49:33 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id C4B762016C for ; Thu, 20 Feb 2014 00:49:32 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 19083FB001; Wed, 19 Feb 2014 16:49:22 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by gabe.freedesktop.org (Postfix) with ESMTP id 13592F9E99 for ; Wed, 19 Feb 2014 01:47:28 -0800 (PST) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP; 19 Feb 2014 01:47:26 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.97,504,1389772800"; d="scan'208";a="483952340" Received: from jliu23-mobl.ccr.corp.intel.com (HELO [10.238.130.144]) ([10.238.130.144]) by fmsmga002.fm.intel.com with ESMTP; 19 Feb 2014 01:47:24 -0800 Message-ID: <53047DAB.10200@linux.intel.com> Date: Wed, 19 Feb 2014 17:47:23 +0800 From: Jiang Liu Organization: Intel User-Agent: Mozilla/5.0 (Windows NT 6.2; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.3.0 MIME-Version: 1.0 To: Maarten Lankhorst , David Airlie , "Rafael J. Wysocki" , Dave Airlie , Emil Velikov Subject: Re: [PATCH] nouveau, ACPI: fix regression caused by b072e53 References: <1392785628-30633-1-git-send-email-jiang.liu@linux.intel.com> In-Reply-To: <1392785628-30633-1-git-send-email-jiang.liu@linux.intel.com> X-Mailman-Approved-At: Wed, 19 Feb 2014 16:49:17 -0800 Cc: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dri-devel-bounces@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org X-Spam-Status: No, score=-4.8 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Hi Maarten, Forgot to refresh my working tree. Please help to apply this patch on top of previous one to solve a compilation bug. On 2014/2/19 12:53, Jiang Liu wrote: > On some platforms, ACPI _DSM method (nouveau_op_dsm_muid, function 0) > has special requirements on the fourth parameter, which is different > from ACPI specifications. So revert to the private implementation > to check availability of _DSM functions instead of using common > acpi_check_dsm() interface. > > Signed-off-by: Jiang Liu > --- > Hi Maarten, > Thanks for bisecting. Could you please help to verify whether > this patch fixes the regression? > > Thanks! > Gerry > --- > drivers/gpu/drm/nouveau/nouveau_acpi.c | 26 ++++++++++++++++++++++++-- > 1 file changed, 24 insertions(+), 2 deletions(-) > > diff --git a/drivers/gpu/drm/nouveau/nouveau_acpi.c b/drivers/gpu/drm/nouveau/nouveau_acpi.c > index 4ef83df..c6c7d0d 100644 > --- a/drivers/gpu/drm/nouveau/nouveau_acpi.c > +++ b/drivers/gpu/drm/nouveau/nouveau_acpi.c > @@ -106,6 +106,29 @@ static int nouveau_optimus_dsm(acpi_handle handle, int func, int arg, uint32_t * > return 0; > } > > +/* > + * On some platforms, _DSM(nouveau_op_dsm_muid, func0) has special > + * requirements on the fourth parameter, so a private implementation > + * instead of using acpi_check_dsm(). > + */ > +static int nouveau_check_optimus_dsm(acpi_handle handle) > +{ > + int result; > + > + /* > + * Function 0 returns a Buffer containing available functions. > + * The args parameter is ignored for function 0, so just put 0 in it > + */ > + if (nouveau_optimus_dsm(handle, 0, 0, &result) > + return 0; > + > + /* > + * ACPI Spec v4 9.14.1: if bit 0 is zero, no function is supported. > + * If the n-th bit is enabled, function n is supported > + */ > + return result & 1 && result & (1 << NOUVEAU_DSM_OPTIMUS_CAPS); > +} > + > static int nouveau_dsm(acpi_handle handle, int func, int arg) > { > int ret = 0; > @@ -207,8 +230,7 @@ static int nouveau_dsm_pci_probe(struct pci_dev *pdev) > 1 << NOUVEAU_DSM_POWER)) > retval |= NOUVEAU_DSM_HAS_MUX; > > - if (acpi_check_dsm(dhandle, nouveau_op_dsm_muid, 0x00000100, > - 1 << NOUVEAU_DSM_OPTIMUS_CAPS)) > + if (nouveau_check_optimus_dsm(dhandle)) > retval |= NOUVEAU_DSM_HAS_OPT; > > if (retval & NOUVEAU_DSM_HAS_OPT) { > diff --git a/drivers/gpu/drm/nouveau/nouveau_acpi.c b/drivers/gpu/drm/nouveau/no index c6c7d0d..83face3 100644 --- a/drivers/gpu/drm/nouveau/nouveau_acpi.c +++ b/drivers/gpu/drm/nouveau/nouveau_acpi.c @@ -119,7 +119,7 @@ static int nouveau_check_optimus_dsm(acpi_handle handle) * Function 0 returns a Buffer containing available functions. * The args parameter is ignored for function 0, so just put 0 in it */ - if (nouveau_optimus_dsm(handle, 0, 0, &result) + if (nouveau_optimus_dsm(handle, 0, 0, &result)) return 0;