Message ID | quw77kz25yey6pnli7dabf2zuwhfycgil5aajhgmz5f3cxxawz@s4qvuuluu42m (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <intel-gfx-bounces@lists.freedesktop.org> 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 DCE06CEF140 for <intel-gfx@archiver.kernel.org>; Tue, 8 Oct 2024 09:23:04 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B961B10E4B2; Tue, 8 Oct 2024 09:23:02 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="EnFXP7s2"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.14]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3089510E4B2 for <intel-gfx@lists.freedesktop.org>; Tue, 8 Oct 2024 09:23:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1728379382; x=1759915382; h=date:from:to:cc:subject:message-id:mime-version; bh=XSzVHpZcGj5S09A78smc+UcPj9UNcgO7ECs6gxGkLEU=; b=EnFXP7s2olVhuZdh5gRU2PGC0Hah69WS4OLIcmvX79tkj5RrmFuSdCw3 Sbcjx55b9ETXzw9QwjiCUjyXPZ8qjM50447PBogV2+mixqXrlF8ikpXlO +6/q7HvbEaUGPOLeUtZmmAT+NM7pan0BhfA2i5JinTEu4okdD+D1h4pB8 Nc6ptxOW6AfOiEhyLU35rx6WsAHXZ2j8Jq19D7MrSA4euJMkQF+XnHjQn FEsxcFPI2LpNwjxk7OXKT+2sM7PomiGMfZjQXCqUrUd+53phRNSVlwqKW i+ecnPv8GphKK7+CT7R5Gmw1jli+Gh/QBx4SATZ3pp0bTUTFdI+U3ypta A==; X-CSE-ConnectionGUID: s/YktlqRT/CV4MoO6ig+6Q== X-CSE-MsgGUID: Z6wLsjpjQl2wIyzyyhXeCQ== X-IronPort-AV: E=McAfee;i="6700,10204,11218"; a="31345100" X-IronPort-AV: E=Sophos;i="6.11,186,1725346800"; d="scan'208";a="31345100" Received: from fmviesa007.fm.intel.com ([10.60.135.147]) by orvoesa106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Oct 2024 02:23:02 -0700 X-CSE-ConnectionGUID: aKlRr6OcQVWcGHrpnq2wVg== X-CSE-MsgGUID: xwDUg9izQFO83Vr3LJ0MOA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,186,1725346800"; d="scan'208";a="75453003" Received: from orsmsx603.amr.corp.intel.com ([10.22.229.16]) by fmviesa007.fm.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 08 Oct 2024 02:22:59 -0700 Received: from orsmsx610.amr.corp.intel.com (10.22.229.23) by ORSMSX603.amr.corp.intel.com (10.22.229.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Tue, 8 Oct 2024 02:22:56 -0700 Received: from orsmsx610.amr.corp.intel.com (10.22.229.23) by ORSMSX610.amr.corp.intel.com (10.22.229.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Tue, 8 Oct 2024 02:22:56 -0700 Received: from ORSEDG602.ED.cps.intel.com (10.7.248.7) by orsmsx610.amr.corp.intel.com (10.22.229.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39 via Frontend Transport; Tue, 8 Oct 2024 02:22:56 -0700 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (104.47.59.173) 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.2507.39; Tue, 8 Oct 2024 02:22:55 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=bEFQ0JoaW6aPP+oUOM7UjqKQ6SZjPlkWhl8ANfSjJEDCfbYbqEYa9JaQHdq0ED3rmL0NVbMUiZyRb1CfFMg+WR+xyCOIsMS9SjyOduBVfIM61k1XyDbT1kqcsG/ghsmxXKOcugRathZ0c+LHyp14XFee8a4ExJnP/7xirfyjjt2FoViTQq+L0ryxYS5ZbkG9yxLa9/rLkomp3k1n7Jcu2JEBqVoTK0xu7ih4Dmqife4iuCp1p6CBHmIWEpPB5cWHMuHLVU9Tn6sd/YWZbO64SmHPmQCX7VXt25bauYgf1/+TDJk0Xmq0akuyQwhKOGoHKvK/31sFdWer+nkzlg8fdQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=yeSNjo6D8+5Sgm4GKVQpenXsiVIXmvtYQHB59cumIf4=; b=ofVa0UFSekqHx0QJuB/TnoL9RtpeeL0ML3qzJaKBKzFqbAn5NhFLsPD6XdTg5MLs/fE1IK7FLAH0T/X61zg+ZHXVniBEJrloHTdfGlqB+KdA4ZpiKi0IT679c9+TeRcmmvyUTYvSwSTR4aEO3c+/G4miVYPRg8MPGR4jOSVjykFX9w1YYIrGSNJFN5JoEih855p+W2Rd6V3Q/cYd6ttTJldIHQejvAu8uR/BoTmLvsF1jc5o4MgRxhRqbQDWopkMazzUF7I207e4EWCZDuZIPhWhji8+X09pRyLM/mR+Htu+kUvi88a8Z8b5JF4Q1+aT0Q3lFB/d/xzwRhmHKmu84w== 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 CO1PR11MB5057.namprd11.prod.outlook.com (2603:10b6:303:6c::15) by DS0PR11MB7801.namprd11.prod.outlook.com (2603:10b6:8:f2::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.22; Tue, 8 Oct 2024 09:22:53 +0000 Received: from CO1PR11MB5057.namprd11.prod.outlook.com ([fe80::4610:6d6c:9af6:2548]) by CO1PR11MB5057.namprd11.prod.outlook.com ([fe80::4610:6d6c:9af6:2548%6]) with mapi id 15.20.8048.013; Tue, 8 Oct 2024 09:22:53 +0000 Date: Tue, 8 Oct 2024 09:22:43 +0000 From: Krzysztof Karas <krzysztof.karas@intel.com> To: <intel-gfx@lists.freedesktop.org> CC: Andi Shyti <andi.shyti@linux.intel.com>, Nirmoy Das <nirmoy.das@intel.com> Subject: [PATCH] drm/i915: move segment iterator to match current offset Message-ID: <quw77kz25yey6pnli7dabf2zuwhfycgil5aajhgmz5f3cxxawz@s4qvuuluu42m> "Organization: Intel Technology Poland sp. z o.o. - ul. Slowackiego 173, 80-298 Gdansk - KRS 101882 - NIP 957-07-52-316" Content-Type: text/plain; charset="utf-8" Content-Disposition: inline X-ClientProxiedBy: DUZPR01CA0231.eurprd01.prod.exchangelabs.com (2603:10a6:10:4b4::12) To PH0PR11MB5064.namprd11.prod.outlook.com (2603:10b6:510:3b::15) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1PR11MB5057:EE_|DS0PR11MB7801:EE_ X-MS-Office365-Filtering-Correlation-Id: 73af2de3-9ef7-40f2-2813-08dce77ac917 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|376014|1800799024; X-Microsoft-Antispam-Message-Info: =?utf-8?q?wTv6hpSX/8S6xgDCRi91P8UCaRQs5/R?= =?utf-8?q?UdrsgKKKzCifgDDVF+VpOogFR24njmVNGU1PUvQsAqifOSYMDCoi1ZD7L4pWb5Cf/?= =?utf-8?q?PmcKFH7XvvwPUB+oGGV20bsQLox/hQdttz8uGqrjz6hKAmLLrG75IXQMwo+XVd5iu?= =?utf-8?q?EDBmjEH5opbMVr/JR351zF8I7bEDwp2h8J6tNIISa80rJks1jPgCSKdVjrRsSFOJh?= =?utf-8?q?rblyvj6PRk8PSHWQtdc69WX6G8bSGzyIZmIpPANAI4iCKGzu1iWzezuUlcIrkn/u8?= =?utf-8?q?YBSJpI4aHLinyL4meBxx+8WK2HXor/63rqEQn1WUUHdcDG577TXFxCzY4M9E4wDLK?= =?utf-8?q?Gjxddf7JMV4rLkV4zvbThzWpZLRVMnTbCYzP0zu7ysDdO5KYjml5/xe8gaiLVuJvR?= =?utf-8?q?R6Is4SShkh2guv55BbPaWLmbC/bra7KEpQsmSweXnF12BVbe2Lw/adtBXIrj7t+3h?= =?utf-8?q?Z89Um0hWid1OK0ieaEP4VYOH4xrBdmr8boDfOVCColAL+Y1fsWBbS/7dysVjp9LcE?= =?utf-8?q?VGyy2pm0+Xm9LNbIBPccNTDellV4Yhgkibill4DzGwrVg2IV63dG2CUrBqKeE524Y?= =?utf-8?q?Xh+GKa0O7bSxM4Eny5a7bkoO4Wm+/lu93oVKzSpDkGsxX9OwPRtLVy4X5l1lk7kjc?= =?utf-8?q?5axUbJLnzREKYbuTTEjuYn/yh4SqbAhcHv+W6ZOCFIs2YgZAReuVe4HTfJJmhasGf?= =?utf-8?q?20kO2rTpvrCypktKi5vO6dD8tZDVTnHT6J6P1OoAcHVYecUsH85H7ZNlzPf+KjeeH?= =?utf-8?q?t9x8XvkODYsgFw2zXIWHzgYa8gYhjXvyphDVhr9x+VvYKv4ax1QJjfuM6yWmiLlrC?= =?utf-8?q?9+LkrPIprUHLNIgBS0Y6ZH0w+RpjsxJ9YEgOxEjSWDFSL9Ub+2GnutdNRrKV8X2I9?= =?utf-8?q?CHPRw9PRaiDD2ZtDwonhdaNljJiNAKZnAMx0/S0k0VlCHZNBn46Q1f9VEXh9zd0Kc?= =?utf-8?q?+jvVbUm4RgIc7gtg4kAAXzWLcMkvOUfP0Trjc6xniQug0qhQVGpuKP2MNiXySjq4s?= =?utf-8?q?fHjMV9GU8b6Wgw0U5amSi1xeflEK2NsRbdaEYdywvoVv8a4HeJXaE8qymhyeqrRFu?= =?utf-8?q?fMRhW3n1RLFIi90SoZNxF3rfUQ5yT9biZXuu5WNZAeFtjf/0i1/b1rqZVa6GhFU+D?= =?utf-8?q?hSnGihjcrVBX0+DqHIaZso2m3adtalDS2Dlu1nGqHozPhOJbdbSSCr8GTM5jq1+v2?= =?utf-8?q?gCzEylLvgeOg70?= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CO1PR11MB5057.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(366016)(376014)(1800799024); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?x4/iDSfHdXQ0VPB1utPw22JNOze8?= =?utf-8?q?sNTroZvGBFU7on28JMSl+jwpwu44MqU0AnosHDS5+y8v/gaVWtKLn9d4Cg93XhnsJ?= =?utf-8?q?qdXoEm/VjeIIPEOGPNYXHIAGucp4upltp2mZCMUed++FCHss327Jm9EZ5aXiZDob1?= =?utf-8?q?Rp9wtG1GRsqMRnebF8SKyE969n2+pGseGS+b8qrxDdR1HAWEzs+l7pI32XhncZ9Ns?= =?utf-8?q?XNCTDBfKWOUBtM5scLFHPI0hNpVy4etyg6w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M6u48+7D484urb2Fwpzk/5EUY70Mc/ElFTQYDWJGj92?= =?utf-8?q?kRtldRsKBDQ3SfbDM3Eh3s3EiYhkDqAhRelO+34fhcIZYLskMJkLhU88KzhkV+UTn?= =?utf-8?q?11KHfueySZOwS6OcEZWxLzQ4mHhhVO9T5zc/EH5oWALkxbZk+0P0Eolihi7Np1sjU?= =?utf-8?q?QJQWzbbnBaQ/ia9kKhuEVNuG/P+X4VHWj/uSP8Z9SewUQj6INuSKo4YDa0Skc0E8y?= =?utf-8?q?9MsFsFDEwwHBQJQBu4fqQvMhPy6O3o3PJ4k6/jEtUmCL8ix1OonA/v7GV7Wxtl2q/?= =?utf-8?q?dz3gGbV2BplkY5rmMpwUx9ItMjjlHrrnETrCMbfSH6mmm31KwT9pm6SBAlLFo1bYR?= =?utf-8?q?+L+Ya5QtqXm8XvvHEwQO60FZy3rX/6s5FMvfKyma9QfcV0QYL8onO5aP1ObjTXIWc?= =?utf-8?q?wQm4kaDyoDbQ3XoD6KsMJmqKzLa09Cgbvg=3D=3D?= X-MS-Exchange-CrossTenant-Network-Message-Id: 73af2de3-9ef7-40f2-2813-08dce77ac917 X-MS-Exchange-CrossTenant-AuthSource: PH0PR11MB5064.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Oct 2024 09:22:53.7004 (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: d6MOQrQWrnKxQOS8TpMRe5+qvysQ9JTzoefgrAlmWLwZD171ztimkuQJb/Ad4Vd8LKQofqWlU+lbB14kNNoUYJs4BeOep/wGGs9HnW/AgsE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR11MB7801 X-OriginatorOrg: intel.com X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development <intel-gfx.lists.freedesktop.org> List-Unsubscribe: <https://lists.freedesktop.org/mailman/options/intel-gfx>, <mailto:intel-gfx-request@lists.freedesktop.org?subject=unsubscribe> List-Archive: <https://lists.freedesktop.org/archives/intel-gfx> List-Post: <mailto:intel-gfx@lists.freedesktop.org> List-Help: <mailto:intel-gfx-request@lists.freedesktop.org?subject=help> List-Subscribe: <https://lists.freedesktop.org/mailman/listinfo/intel-gfx>, <mailto:intel-gfx-request@lists.freedesktop.org?subject=subscribe> Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" <intel-gfx-bounces@lists.freedesktop.org> |
Series |
drm/i915: move segment iterator to match current offset
|
expand
|
diff --git a/drivers/gpu/drm/i915/i915_mm.c b/drivers/gpu/drm/i915/i915_mm.c index f5c97a620962..9a140840214b 100644 --- a/drivers/gpu/drm/i915/i915_mm.c +++ b/drivers/gpu/drm/i915/i915_mm.c @@ -51,10 +51,22 @@ static inline unsigned long sgt_pfn(const struct remap_pfn *r) static int remap_sg(pte_t *pte, unsigned long addr, void *data) { struct remap_pfn *r = data; + unsigned int sgt_offset; if (GEM_WARN_ON(!r->sgt.sgp)) return -EINVAL; + if (r->sgt.curr == r->sgt.max) { + r->sgt = __sgt_iter(__sg_next(r->sgt.sgp), use_dma(r->iobase)); + } else if (r->sgt.curr > r->sgt.max) { + sgt_offset = r->sgt.curr; + while (sgt_offset >= r->sgt.max) { + sgt_offset -= r->sgt.max; + r->sgt = __sgt_iter(__sg_next(r->sgt.sgp), use_dma(r->iobase)); + } + r->sgt.curr = sgt_offset; + } + /* Special PTE are not associated with any struct page */ set_pte_at(r->mm, addr, pte, pte_mkspecial(pfn_pte(sgt_pfn(r), r->prot)));
Commit 255fc1703e42 ("drm/i915/gem: Calculate object page offset for partial memory mapping") introduced a new offset that affects r.sgt.curr value. This field is used in remap_sg() function, in set_pte_at() call and changing its value causes page table entry to also be affected (see set_ptes() description). Example: 1) upon entering remap_sg() r.sgt.curr could have already been changed to a value equal to or greater than r.sgt.max, 2) set_pte_at() uses r.sgt.curr to map a page entry from another segment to the current one, 3) r->sgt pointer is moved to the next entry returned from __sg_iter() only once, 3) the memory of the mismapped page might become unavailabe (accessing some addresses causes -EFAULT). This patch moves current r->sgt pointer as many segments, as initial r.sgt.curr is still larger than r.sgt.max. Signed-off-by: Krzysztof Karas <krzysztof.karas@intel.com> --- drivers/gpu/drm/i915/i915_mm.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)