From patchwork Thu Jul 12 14:07:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Bartminski, Jakub" X-Patchwork-Id: 10521747 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id E6684602B3 for ; Thu, 12 Jul 2018 14:08:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D1FE229A77 for ; Thu, 12 Jul 2018 14:08:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C685E29A7D; Thu, 12 Jul 2018 14:08:19 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4742529A77 for ; Thu, 12 Jul 2018 14:08:19 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 942B16EFF4; Thu, 12 Jul 2018 14:08:18 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by gabe.freedesktop.org (Postfix) with ESMTPS id 5CC596EFF4 for ; Thu, 12 Jul 2018 14:08:17 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 12 Jul 2018 07:08:17 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,343,1526367600"; d="scan'208";a="54521078" Received: from jbartmin-desk.igk.intel.com ([172.28.181.141]) by fmsmga008.fm.intel.com with ESMTP; 12 Jul 2018 07:08:15 -0700 From: =?UTF-8?q?Jakub=20Bartmi=C5=84ski?= To: intel-gfx@lists.freedesktop.org Date: Thu, 12 Jul 2018 16:07:18 +0200 Message-Id: <20180712140719.14215-1-jakub.bartminski@intel.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH 1/2] drm/i915: Keep local modparams copy for mock selftests X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Jakub=20Bartmi=C5=84ski?= Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP Some functions used within mock selftests may expect platform-dependent automatic modparams parameters to have already been resolved, resulting in failed assertions. Backing up the modparams before mock selftests and manually setting offending parameters inside the affected selftests should fix the issue. Signed-off-by: Jakub Bartmiński Cc: Chris Wilson Cc: Michał Winiarski --- drivers/gpu/drm/i915/i915_pci.c | 10 ++++++++++ drivers/gpu/drm/i915/selftests/i915_gem_context.c | 6 ++++++ 2 files changed, 16 insertions(+) diff --git a/drivers/gpu/drm/i915/i915_pci.c b/drivers/gpu/drm/i915/i915_pci.c index 55543f1b0236..9e41851f5ca2 100644 --- a/drivers/gpu/drm/i915/i915_pci.c +++ b/drivers/gpu/drm/i915/i915_pci.c @@ -733,11 +733,21 @@ static int __init i915_init(void) { bool use_kms = true; int err; + struct i915_params *backup_modparams; + + backup_modparams = kmalloc(sizeof(*backup_modparams), GFP_KERNEL); + if (!backup_modparams) + return -ENOMEM; + memcpy(backup_modparams, &i915_modparams, sizeof(*backup_modparams)); err = i915_mock_selftests(); if (err) return err > 0 ? 0 : err; + /* Revert any modparams modifications made inside mock selftests */ + memcpy(&i915_modparams, backup_modparams, sizeof(*backup_modparams)); + kfree(backup_modparams); + /* * Enable KMS by default, unless explicitly overriden by * either the i915.modeset prarameter or by the diff --git a/drivers/gpu/drm/i915/selftests/i915_gem_context.c b/drivers/gpu/drm/i915/selftests/i915_gem_context.c index ab2590242033..de6aad832ac9 100644 --- a/drivers/gpu/drm/i915/selftests/i915_gem_context.c +++ b/drivers/gpu/drm/i915/selftests/i915_gem_context.c @@ -597,6 +597,12 @@ int i915_gem_context_mock_selftests(void) if (!i915) return -ENOMEM; + /* + * Platform defaults have not been resolved yet, so we need to prevent + * assertion failure on an unresolved enable_guc. + */ + i915_modparams.enable_guc = 0; + err = i915_subtests(tests, i915); drm_dev_put(&i915->drm);