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 2B812C61DA4 for ; Wed, 15 Mar 2023 15:28:26 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 026C810E2F8; Wed, 15 Mar 2023 15:28:26 +0000 (UTC) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by gabe.freedesktop.org (Postfix) with ESMTPS id CE6EB10E2F8 for ; Wed, 15 Mar 2023 15:28:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1678894102; x=1710430102; h=date:from:to:cc:subject:message-id:references: content-transfer-encoding:in-reply-to:mime-version; bh=p1gip2qfBMcTZ1mYUEs6het+FYUpPW//uiGZoK90gUo=; b=lVs5pMP9dvxQpcL1llgI72diCvIHy1M1CYk3/8vj5CYPkK4Uqcw9F7lL MTvXYhZp+zipgMknmrcV/1zUjTt1Zj+fiQPv/pdVuf26+1sDlr3FDcwLi zrNtSQdNmhxBTdy/pIk48fM+1sRQBFp3Djy47RlLIZp+XA4mBTLgtJXRS gdZkhNAeVB96wxS+JSIvnjgvumtrEX7Zki4IkYQQIWUv6QiDCOKWtPTTU W6FiB58mawb77almkgTleTwo0rD5eg+14gt1Gl3w4brpResamDNjpyoSP szfdkGmMOvh/5od0E6vBsYNwyOvFGp2MpXJrEq8lC/W8z9D8i7CMqc9jR w==; X-IronPort-AV: E=McAfee;i="6500,9779,10650"; a="402606393" X-IronPort-AV: E=Sophos;i="5.98,262,1673942400"; d="scan'208";a="402606393" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Mar 2023 08:28:22 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10650"; a="672788601" X-IronPort-AV: E=Sophos;i="5.98,262,1673942400"; d="scan'208";a="672788601" Received: from orsmsx603.amr.corp.intel.com ([10.22.229.16]) by orsmga007.jf.intel.com with ESMTP; 15 Mar 2023 08:27:19 -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.21; Wed, 15 Mar 2023 08:27:19 -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.21; Wed, 15 Mar 2023 08:27:18 -0700 Received: from ORSEDG601.ED.cps.intel.com (10.7.248.6) 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.21 via Frontend Transport; Wed, 15 Mar 2023 08:27:18 -0700 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (104.47.58.102) by edgegateway.intel.com (134.134.137.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.21; Wed, 15 Mar 2023 08:27:17 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eju5jTnMkIUytBtl2fjAwnzn+9k6B6WA/Mb7TZU+5LuTBQSxBraNEAosGn4YGdTDjz3xHnaSr2BzhLWy0VqmksQAIc+4b4zoe6kZh34Q+jkkIkNuME0tHe+9Ona6tRMOEFeHVMlVrVvmP5H7pn5jlnRRCcLrm5vbqUhQD4eAftxhKYU5HYh3TfEv8fxxJamsQyL5q+F4ZivLswMWkDMHD5DvBYRCGB1l3Oc1/fCHj9YXWTmkMFrB9DW5orokytWat1dEelHOw3rOrK3y9p+RcPlUtxIKYhA2E10fZO518rmW0KCroLm4md8M3klUodmFdpdINvEs82khMNp32KauUg== 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=Ija+a6bPUPGbz5upRPzCsXs0kLffWYm/6TAhe4TNYQs=; b=nYOkYcYO9/RAFPWanqc5Uqw0eyprNrrIRSK9t/UevK1W9Jf+R1a3aq+4mqYaAOR+pWfXtE4ghfFax/uyUeCS2GZPXNw49lce0N8ei8rBzIUQJ4wX0SCBCMU6J3EbZJvIZIBy1AHPbjDVKE1dbw5TJi9Stc6PEo5etQOzLhQJLKEyHDJf4I8a7tJIZAaPVGZQm3/LZfYl3rzyN4dpoxqy3Rq9v23s9JEjFCOAme7cDg3bYi77eJRxliRxvBtijKCVIQRMmmSo85/uSQeqEGEXDXsEcG5hqp3dgfZ4qpjmDMCwXnF/cLH1MPE5MYD4HK7O4o/CpC0a3ZD7tKd3O1rGzQ== 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 PH7PR11MB6522.namprd11.prod.outlook.com (2603:10b6:510:212::12) by SA0PR11MB4525.namprd11.prod.outlook.com (2603:10b6:806:9d::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.29; Wed, 15 Mar 2023 15:27:16 +0000 Received: from PH7PR11MB6522.namprd11.prod.outlook.com ([fe80::fc88:c65f:4ef5:c3da]) by PH7PR11MB6522.namprd11.prod.outlook.com ([fe80::fc88:c65f:4ef5:c3da%5]) with mapi id 15.20.6178.025; Wed, 15 Mar 2023 15:27:16 +0000 Date: Wed, 15 Mar 2023 15:26:40 +0000 From: Matthew Brost To: Matthew Auld Message-ID: References: <20230313204519.158888-1-thomas.hellstrom@linux.intel.com> <20230313204519.158888-2-thomas.hellstrom@linux.intel.com> Content-Type: text/plain; charset="iso-8859-1" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-ClientProxiedBy: BY3PR03CA0005.namprd03.prod.outlook.com (2603:10b6:a03:39a::10) To PH7PR11MB6522.namprd11.prod.outlook.com (2603:10b6:510:212::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH7PR11MB6522:EE_|SA0PR11MB4525:EE_ X-MS-Office365-Filtering-Correlation-Id: cfd8756d-426d-4648-42bc-08db2569c1b7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: u7Vy3TulJswxoXbIQmlKcKHxbKtmWDxCmLmtOFqHmi2I1UqashoqCwzNsaxK+weunSli9jRnN37VMlNSsTMLwo+0hN0tCn9SzdP/XG1loGGlPYwek1LuSlEhcq6pndRsUABtfmCqJjG09ydzvMSpm0FldsbVuZhA9ADFCiIviBJv1LH9cTsx/zvOVr0M8PBJ/ynlGn+ZzmeLTYSkvPkXL1bAhf5tumtTMcRmnFfODTP+Da0FKLalV8KQvhXdRIZQeHiRKPUqg8+nmd8yn6jZmvb/9DFF963p502AR3r0pYLdWsoWdcjJTsajVYkdPpH/ZwOinRSVNhViLjejxrSgMONw653CzF5WcYjvw43pDw9rLawJGjqT6gn85oSHjrUR5nmVEp5zfQFDb5bX/VNG/BJ0xe9ZSwKDRQH0VVj4I/owgSxAfdVV98U9MJuXaXry28CTzq63Lk4DR7H/wSUJ8O3MDCi75KuhfII5Qir9R7I9snzgB362PxzTq33/LuLIti9lVi853J6rQ6iHD/AM35Pqj9wrZ3ouUTPDv75IOW0PMLAPJ3sUiCCIdJnAEEd7S5Z9VZfm9yLL90ejRqxhM0ikdnYzcaTxJU1SJeog9wpD+SrkLN8PyxKPBPtP+/HU9KkPSK2SSeIIdyT9xlQT7w== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PH7PR11MB6522.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230025)(396003)(376002)(366004)(346002)(39860400002)(136003)(451199018)(82960400001)(5660300002)(2906002)(44832011)(86362001)(8936002)(41300700001)(66476007)(66556008)(66946007)(8676002)(38100700002)(316002)(6916009)(4326008)(478600001)(83380400001)(186003)(6666004)(6506007)(6512007)(26005)(6486002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?iso-8859-1?Q?bbapt2ADnjxsP83Au1xpqxKhHxZRlFIByZ3X2m3f0nRaBC/uUpwvvfeAok?= =?iso-8859-1?Q?r/E2TAwLlKT3ltk9DgsZpgk8UPm58/ZEzZmr/4uWSb/Xa8ryJLoBbX5R+o?= =?iso-8859-1?Q?nN9y3pUYsdp7LI733uO+Kk3TjA/nBwrQIbLX2z05RrWZc3xt0fr4tdZ5PM?= =?iso-8859-1?Q?V6Vqe6hiJXsYzexhiRRv0OSeGxXHtRNvuIb1xbjUsThC1LWduTO4qyz8O7?= =?iso-8859-1?Q?zPbqw7UrstGNGX6P/ARkYgX7LHBO/HaTu7rwt6wCpGvWC0ElAQFy1Ecztw?= =?iso-8859-1?Q?wG/+jzpRnb3t91xdgYeY7ECl/bAAKiZZMoulp+stRr3mLkLGi8UxIPwV3q?= =?iso-8859-1?Q?CT/cq2YiGrT/is+uMtvjpZYGf2J5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-1?Q?fRovvO+Wk/CNrM7NBnrL8A8MBUzl8l3/N9NyDfct5OajtDv9PlJMnpegvy?= =?iso-8859-1?Q?P7goSTQUPjKI4CThbGE/WUM853CH63Mt3UHcn7hFx2mKx20zrKUa8MsoXO?= =?iso-8859-1?Q?nKYWOHsNxbA+S/GWNz9XB4ZaOoO4qa42RTfZyADh2SWk9MrzjD0IERsA0d?= =?iso-8859-1?Q?HGE7zg+44wsUYrdWG7ZHkVdmbmAe4WRATXAffNP2JGmNrEqvNs3RpMn+P1?= =?iso-8859-1?Q?Uo8I12bsTgTh+/Fmk8sAj1VcysCYPQ+AchP+Brqo/REy9+4nYXLv8+h6ST?= =?iso-8859-1?Q?5v8Nr7SCc5jUUeRyWtlbQUVV91yCMDtozeHVOHjni2K4/xodL6GYGsV4hI?= =?iso-8859-1?Q?B1wHGdY5abjsv3wxCTPFiXP6Xfc56w6MrAyJ55oPZI0ovxwbcKRnmeSQ?= =?iso-8859-1?Q?=3D=3D?= X-MS-Exchange-CrossTenant-Network-Message-Id: cfd8756d-426d-4648-42bc-08db2569c1b7 X-MS-Exchange-CrossTenant-AuthSource: PH7PR11MB6522.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Mar 2023 15:27:15.6738 (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: wlceBGKIBM0YHgouZKxNfalba4npubkE8AmhYUxpZSHttAehykb+BA8qRzfSVQ4UsCUsdMG2bm58NwYV/0VHqw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR11MB4525 X-OriginatorOrg: intel.com Subject: Re: [Intel-xe] [PATCH 1/6] drm/xe: Use a define to set initial seqno for fences X-BeenThere: intel-xe@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel Xe graphics driver List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: intel-xe@lists.freedesktop.org Errors-To: intel-xe-bounces@lists.freedesktop.org Sender: "Intel-xe" On Tue, Mar 14, 2023 at 11:54:29AM +0000, Matthew Auld wrote: > On Mon, 13 Mar 2023 at 20:46, Thomas Hellström > wrote: > > > > Also for HW fences, write the initial seqno - 1 to the HW completed > > seqno to initialize. > > > > Signed-off-by: Thomas Hellström > > --- > > drivers/gpu/drm/xe/xe_engine.c | 5 +++-- > > drivers/gpu/drm/xe/xe_hw_fence.c | 5 ++--- > > drivers/gpu/drm/xe/xe_hw_fence.h | 2 ++ > > drivers/gpu/drm/xe/xe_lrc.c | 3 +++ > > 4 files changed, 10 insertions(+), 5 deletions(-) > > > > diff --git a/drivers/gpu/drm/xe/xe_engine.c b/drivers/gpu/drm/xe/xe_engine.c > > index 3b6f8a25112a..7e6367a84f1f 100644 > > --- a/drivers/gpu/drm/xe/xe_engine.c > > +++ b/drivers/gpu/drm/xe/xe_engine.c > > @@ -13,6 +13,7 @@ > > > > #include "xe_device.h" > > #include "xe_gt.h" > > +#include "xe_hw_fence.h" > > #include "xe_lrc.h" > > #include "xe_macros.h" > > #include "xe_migrate.h" > > @@ -57,11 +58,11 @@ static struct xe_engine *__xe_engine_create(struct xe_device *xe, > > > > if (xe_engine_is_parallel(e)) { > > e->parallel.composite_fence_ctx = dma_fence_context_alloc(1); > > - e->parallel.composite_fence_seqno = 1; > > + e->parallel.composite_fence_seqno = XE_FENCE_INITIAL_SEQNO; > > } > > if (e->flags & ENGINE_FLAG_VM) { > > e->bind.fence_ctx = dma_fence_context_alloc(1); > > - e->bind.fence_seqno = 1; > > + e->bind.fence_seqno = XE_FENCE_INITIAL_SEQNO; > > } > > > > for (i = 0; i < width; ++i) { > > diff --git a/drivers/gpu/drm/xe/xe_hw_fence.c b/drivers/gpu/drm/xe/xe_hw_fence.c > > index e56ca2867545..ca8304650713 100644 > > --- a/drivers/gpu/drm/xe/xe_hw_fence.c > > +++ b/drivers/gpu/drm/xe/xe_hw_fence.c > > @@ -129,7 +129,7 @@ void xe_hw_fence_ctx_init(struct xe_hw_fence_ctx *ctx, struct xe_gt *gt, > > ctx->gt = gt; > > ctx->irq = irq; > > ctx->dma_fence_ctx = dma_fence_context_alloc(1); > > - ctx->next_seqno = 1; > > + ctx->next_seqno = XE_FENCE_INITIAL_SEQNO; > > sprintf(ctx->name, "%s", name); > > } > > > > @@ -164,8 +164,7 @@ static bool xe_hw_fence_signaled(struct dma_fence *dma_fence) > > struct xe_device *xe = gt_to_xe(fence->ctx->gt); > > u32 seqno = xe_map_rd(xe, &fence->seqno_map, 0, u32); > > > > - return dma_fence->error || > > - (s32)fence->dma.seqno <= (s32)seqno; > > + return dma_fence->error || (s32)(u32)fence->dma.seqno <= (s32)seqno; > > Why do we need this change? Also the hw fence dma.seqno should always > be u32, right? > Not exactly on topic but we should change the seqno to u64 both dma-fences and our hardware supports this. Matt > > } > > > > static bool xe_hw_fence_enable_signaling(struct dma_fence *dma_fence) > > diff --git a/drivers/gpu/drm/xe/xe_hw_fence.h b/drivers/gpu/drm/xe/xe_hw_fence.h > > index 07f202db6526..523c2611ef5d 100644 > > --- a/drivers/gpu/drm/xe/xe_hw_fence.h > > +++ b/drivers/gpu/drm/xe/xe_hw_fence.h > > @@ -8,6 +8,8 @@ > > > > #include "xe_hw_fence_types.h" > > > > +#define XE_FENCE_INITIAL_SEQNO 1 > > + > > int xe_hw_fence_module_init(void); > > void xe_hw_fence_module_exit(void); > > > > diff --git a/drivers/gpu/drm/xe/xe_lrc.c b/drivers/gpu/drm/xe/xe_lrc.c > > index 9140b057a5ba..fb8c6f7d6528 100644 > > --- a/drivers/gpu/drm/xe/xe_lrc.c > > +++ b/drivers/gpu/drm/xe/xe_lrc.c > > @@ -697,6 +697,9 @@ int xe_lrc_init(struct xe_lrc *lrc, struct xe_hw_engine *hwe, > > arb_enable = MI_ARB_ON_OFF | MI_ARB_ENABLE; > > xe_lrc_write_ring(lrc, &arb_enable, sizeof(arb_enable)); > > > > + map = __xe_lrc_seqno_map(lrc); > > + xe_map_write32(lrc_to_xe(lrc), &map, lrc->fence_ctx.next_seqno - 1); > > + > > return 0; > > > > err_lrc_finish: > > -- > > 2.39.2 > >