From patchwork Tue Apr 26 16:51:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Vivekanandan, Balasubramani" X-Patchwork-Id: 12827551 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 51A32C4332F for ; Tue, 26 Apr 2022 16:49:49 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4F75B10E2FA; Tue, 26 Apr 2022 16:49:48 +0000 (UTC) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by gabe.freedesktop.org (Postfix) with ESMTPS id 40FAB10E1A2; Tue, 26 Apr 2022 16:49:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1650991786; x=1682527786; h=from:to:cc:subject:date:message-id: content-transfer-encoding:mime-version; bh=yGzvo8RV0/MGbHFXhw2a/0h8pKeLAmvB+BJdgRhm1gI=; b=lBvDaYzsYDQm8Ci9JggT81FhkK/154Do2MB7O/jIWEVOmrL+0DcWtv17 Z0noaeeQMOX+OXmSf4OnbGjtkLcNsJIV32EmVTR3SQOhgBFscpyx5y3vV Y1YIf0o5nahjhsvO1rSGf2Nc7Ji5E1HcZAnG/cSbfswCbFRIH308yB099 trh6fVWL+6Tp+66jPhXuT5N7zm/Ky6HrS81vg1vOfRTRu8D2OnHhFnoEu jOTA4Var7a4MTeMkZNU7osVZumlh+xJ2xWr+GMR9sUYaW/IwDGuaDFQZb 4O6PWFlARzffYc96GUH0DpoAzxVi4JMTNK9Ea/w/3222L8X9uNpq8SQU1 w==; X-IronPort-AV: E=McAfee;i="6400,9594,10329"; a="247581610" X-IronPort-AV: E=Sophos;i="5.90,291,1643702400"; d="scan'208";a="247581610" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Apr 2022 09:49:29 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.90,291,1643702400"; d="scan'208";a="513249625" Received: from orsmsx601.amr.corp.intel.com ([10.22.229.14]) by orsmga003.jf.intel.com with ESMTP; 26 Apr 2022 09:49:29 -0700 Received: from orsmsx612.amr.corp.intel.com (10.22.229.25) by ORSMSX601.amr.corp.intel.com (10.22.229.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27; Tue, 26 Apr 2022 09:49:28 -0700 Received: from orsmsx602.amr.corp.intel.com (10.22.229.15) by ORSMSX612.amr.corp.intel.com (10.22.229.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27; Tue, 26 Apr 2022 09:49:28 -0700 Received: from ORSEDG602.ED.cps.intel.com (10.7.248.7) by orsmsx602.amr.corp.intel.com (10.22.229.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27 via Frontend Transport; Tue, 26 Apr 2022 09:49:28 -0700 Received: from NAM04-BN8-obe.outbound.protection.outlook.com (104.47.74.49) by edgegateway.intel.com (134.134.137.103) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2308.27; Tue, 26 Apr 2022 09:49:28 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FLbcQDKK8gVBjznoIJUnsieUB+o/vN28rLoGUsn6cilvD4l/0HB1hhwAcHdLj1g3C53n+yEk9JSszF3arSOjBk70AfEw6/YcfCR16qZHIBaXAV1xHTvikLD3PZunyWxKU7JCxA+ZFG71PkklNYhlw8M2OliwCvYD4HNt76oTJMASccFQxFWeyAp9QeQ4FvKapH1yWULO1AK3+KDmXqgYuh2vbj47g8IQPZzMoc0Ee2NL42oVGYCtILQN12TWKmhEXJEiLmAmUQthJOQcqczgobpYEjy/lyuhuQ77Wlf6X8B9vv+joIMtV2YXA4tHRsq2+iSXS6aaIFRwbsQZtPGQ6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=XAEbb9jUdek40yRhKk7YeMaQ8o602Q5O93ImyRiJYpM=; b=l4t149B0dl0T1I+LiOKEqC4nUcJSarMuGTe3JOFpPD8QFBetYUMsHnJvJQYynVGgIXrlPXpdGdmrsMgF2BJCy2uHnHr9CNknWjL5N7uPm/xcl2alBUy5FG4a5XbRQPKZym9X1kABxDbp5dcMpDH+bl2kuI/5LAtx86kMqh6wZRYxlngfjTAkPaj3QLJFt6pZyiJEh7ZqJ1sc6/X1piiALjbe5F+lWVkqIhavaQnEeJzg4bjrNS9DP6cev8fU39DadkgnX8UXPo5rANy7i/kaQn/7SgD8ETv/P76BWljjOVcsp2KqOLkyjlYnG6PEGX6DnV2T2itRggJCeX8sAdY3hw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from SJ0PR11MB4894.namprd11.prod.outlook.com (2603:10b6:a03:2d4::5) by MN2PR11MB4366.namprd11.prod.outlook.com (2603:10b6:208:190::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5186.15; Tue, 26 Apr 2022 16:49:25 +0000 Received: from SJ0PR11MB4894.namprd11.prod.outlook.com ([fe80::3d83:3af5:c95f:e062]) by SJ0PR11MB4894.namprd11.prod.outlook.com ([fe80::3d83:3af5:c95f:e062%7]) with mapi id 15.20.5186.021; Tue, 26 Apr 2022 16:49:25 +0000 From: Balasubramani Vivekanandan To: , Subject: [PATCH v3 0/7] drm/i915: Use the memcpy_from_wc function from drm Date: Tue, 26 Apr 2022 22:21:41 +0530 Message-ID: <20220426165148.1784-1-balasubramani.vivekanandan@intel.com> X-Mailer: git-send-email 2.25.1 X-ClientProxiedBy: PN0PR01CA0044.INDPRD01.PROD.OUTLOOK.COM (2603:1096:c01:49::19) To SJ0PR11MB4894.namprd11.prod.outlook.com (2603:10b6:a03:2d4::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 53248f0d-d207-49d9-f96c-08da27a4b8c9 X-MS-TrafficTypeDiagnostic: MN2PR11MB4366:EE_ X-LD-Processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtFwd,ExtAddr X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 2KOzUZswzqAGHldHh3s0mAO22LZygihsitHGZMnaJSvdgpMdGZLCQJ5jykZFL5JJhaI9hosazzS0+oLii5NYMWkk6m8Ow1fmQ90y7yDaopQiWlvDRdjdx4B/MpBs88rhOYI+ktyAOuyo/M6TIy5YR8GO1qyQ9EkiKfnP0UgRSMEkCfhVeMke6odbM2EBgJGkwUjynW37yhy/fMS8N8B5wN/oHvxNYMLQfiJpnafTercacT7sC5/HCAvzEjEfFwPBTgYbc9CT76AS6KSA+KRU87/WbvPaXbsEdSXlb8czT0ziDTTpLeGyz2aCIUGaYjbE4qI0j5ofdx+2HluRUQiXwoWaii/GE+nWhfVgz6tJ93Kg+oCNSSa/jtCRc9ZKR9/1fcKtaRS6Yrk1ySDliMKqhbSdFwm7LaV49Wwdy0ZKqZcP7K4uXp+6VFnibe8SFsm7aBx3SsCaWCV3CX1OkmwP8E0e9zhVPVoDqhz0TuZtsF5jNe47+ePuKZCZmccqQHQ9mlDsgeSSQS/kz2vzb0j56AqBRKzn4xbKxpKcZMsEnDw8u0NMcKa/J9qoTU9jUkU0RGtg62k+OWPNQQwbkLN3RK3wuI0mMT60nBXF5M2whS1jyWuYtxM0cQNmJteDKnAuVQdZp4F0YaEAYkGU45XN9g== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SJ0PR11MB4894.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(366004)(6666004)(2616005)(66946007)(6512007)(5660300002)(82960400001)(26005)(8936002)(66556008)(54906003)(316002)(86362001)(2906002)(1076003)(38100700002)(44832011)(6486002)(966005)(508600001)(4326008)(8676002)(66476007)(83380400001)(186003)(6506007)(36756003); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 2 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?MmUsKrkCxDt4Fkv36VenHZ7PSFMq?= =?utf-8?q?Dr2SdZRBlgU1+IVHTWQxMvQqzIpGEcQvBigUgKoYtVJsg+8NgZqGV8ruRFyZvI2G5?= =?utf-8?q?tW/395ocKnAQeAie3D5C1/lSjCbZK1z/8yc/cTOK2vIUIF8kiqmzLcXlCtXkpN2o9?= =?utf-8?q?X85lTXpMH/SsFkJ7QheJBmAQNAyJuIHn4DqK6SDm/FzyjgWEkuGlknHCV3g+SVqdR?= =?utf-8?q?K3fmchm56uGRL7CMI71It/H0McZ8zo3+cgBr1zQfSBwhiO91kgXRw/z4rBIITflnV?= =?utf-8?q?+jlWIl5khmNz/QzG3gTSNKbECIonHdbm0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eT4Gwk3WPQ4l8Ss+hYmL/?= =?utf-8?q?Yhy/WDJb5AAVQLL3mncLhpx6rKYdyHjSWm7XYqu9J2RgkG9Qi5Mov8xKBK2oJIYUt?= =?utf-8?q?cGleqLVUU7lpcBOp5jjwg7bWJOo1Nl2hwnrJNoo05Qmkme4a5cwbGoKT5M4xMJM31?= =?utf-8?q?5XjtHvTsEAEkEcDtXGKJYVSeKKtzqMEftEzjvisUxFbZxYdGeW68eR/C3+SCuE3tS?= =?utf-8?q?sELS9NNXqgx42PoNTwlQT5neyTpbI0Z6SpoJf+oVSA255kkwl0HQDcWoVUohb7fQE?= =?utf-8?q?l2QbuIai4KATIK1Mo1QXZe+20eMGQ2C41r4uHzSp+3hJuohWSOPoOK9xmRZw/5Jk0?= =?utf-8?q?B6v0iP4tSONAUhKNXNqB1maqH9+hUqjKR3Qv4HDm8uusMj3KDatmPCpRYvUuVUKtt?= =?utf-8?q?DnWFwV5vghMSVWlBhT6VqmYDhA8hsYwAZkWPBw4drU/zjCQ6FtyHfXWhJB8fiDylF?= =?utf-8?q?+g4Q3e6xoGbE0dv+uv5j1ScPT3X5xHt7utPfGq5htgq4iSWaDs+jEk8IYa8LV7Tqe?= =?utf-8?q?l5DQ4xqyw9++GX7Zh?= X-MS-Exchange-AntiSpam-MessageData-1: ae408mcj77KMog== X-MS-Exchange-CrossTenant-Network-Message-Id: 53248f0d-d207-49d9-f96c-08da27a4b8c9 X-MS-Exchange-CrossTenant-AuthSource: SJ0PR11MB4894.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Apr 2022 16:49:25.5960 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: QXLMeZGCkAmfvqLmimLFvvODDLviiVNLUPF5ncQSw1vHo/6D2oM+d9DhyY76M8wBUOsxHFRVAeVuGnozsP1P+7jiUlBnS9fa6s8PvE28YNgdhaCicMaLwwL7RZdJHvEK X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR11MB4366 X-OriginatorOrg: intel.com X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Hellstr_m , Balasubramani Vivekanandan , Tvrtko Ursulin , Jani Nikula , lucas.demarchi@intel.com, Chris Wilson , siva.mullati@intel.com, David Airlie , Rodrigo Vivi , Nirmoy Das Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" drm_memcpy_from_wc() performs fast copy from WC memory type using non-temporal instructions. Now there are two similar implementations of this function. One exists in drm_cache.c as drm_memcpy_from_wc() and another implementation in i915/i915_memcpy.c as i915_memcpy_from_wc(). drm_memcpy_from_wc() was the recent addition through the series https://patchwork.freedesktop.org/patch/436276/?series=90681&rev=6 The goal of this patch series is to change all users of i915_memcpy_from_wc() to drm_memcpy_from_wc() and a have common implementation in drm and eventually remove the copy from i915. Another benefit of using memcpy functions from drm is that drm_memcpy_from_wc() is available for non-x86 architectures. i915_memcpy_from_wc() is implemented only for x86 and prevents building i915 for ARM64. drm_memcpy_from_wc() does fast copy using non-temporal instructions for x86 and for other architectures makes use of memcpy() family of functions as fallback. Another major difference is unlike i915_memcpy_from_wc(), drm_memcpy_from_wc() will not fail if the passed address argument is not alignment to be used with non-temporal load instructions or if the platform lacks support for those instructions (non-temporal load instructions are provided through SSE4.1 instruction set extension). Instead drm_memcpy_from_wc() continues with fallback functions to complete the copy. This relieves the caller from checking the return value of i915_memcpy_from_wc() and explicitly using a fallback. Follow up series will be created to remove the memcpy_from_wc functions from i915 once the dependency is completely removed. v2: Fixed missing check to find if the address is from system memory or io memory and use the right initialization function to construct the iosys_map structure (Review feedback from Lucas) v3: "drm/i915/guc: use the memcpy_from_wc call from the drm" replaced by patch "drm/i915/guc: use iosys_map abstraction to access GuC log". New patch does a wider change compared to the old patch. It completely changes the access to GuC log using iosys_map abstraction, in addition to using drm_memcpy_from_wc. Cc: Jani Nikula Cc: Lucas De Marchi Cc: David Airlie Cc: Daniel Vetter Cc: Chris Wilson Cc: Thomas Hellstr_m Cc: Joonas Lahtinen Cc: Rodrigo Vivi Cc: Tvrtko Ursulin Cc: Nirmoy Das Balasubramani Vivekanandan (7): drm: Relax alignment constraint for destination address drm: Add drm_memcpy_from_wc() variant which accepts destination address drm/i915: use the memcpy_from_wc call from the drm drm/i915/guc: use iosys_map abstraction to access GuC log drm/i915/selftests: use the memcpy_from_wc call from the drm drm/i915/gt: Avoid direct dereferencing of io memory drm/i915: Avoid dereferencing io mapped memory drivers/gpu/drm/drm_cache.c | 99 +++++++++++++++++-- drivers/gpu/drm/i915/gem/i915_gem_object.c | 8 +- drivers/gpu/drm/i915/gt/selftest_reset.c | 21 ++-- drivers/gpu/drm/i915/gt/uc/guc_capture_fwif.h | 2 +- .../gpu/drm/i915/gt/uc/intel_guc_capture.c | 52 +++++++--- drivers/gpu/drm/i915/gt/uc/intel_guc_log.c | 77 +++++++++++---- drivers/gpu/drm/i915/gt/uc/intel_guc_log.h | 3 +- drivers/gpu/drm/i915/i915_gpu_error.c | 45 +++++---- .../drm/i915/selftests/intel_memory_region.c | 41 +++++--- include/drm/drm_cache.h | 3 + 10 files changed, 261 insertions(+), 90 deletions(-)