From mboxrd@z Thu Jan 1 00:00:00 1970 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 D6C1CD33990 for ; Mon, 28 Oct 2024 15:14:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:In-Reply-To:References: Message-ID:Subject:CC:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=G9u1ackf4vrmAPAyfWxCtC+lJhDcHc2s+kQg1Y5FlqM=; b=NXkvTscWt4b2ea iHT1GF/auXGRDyOCepeA21eHx01AxPjFs2CNvUBiK/FGaXHJWo+MFiiNtcVW1e/onUUiQv+GZtN0I 8uON/v0ssFY4LP9sa3YKSjW6tuiizKrc296t46ClKLQShFOx/LaX4FDHBxsEsQ4i4TTcOjwpyh1n1 IacMluvneE1kZ5Lawx3bTPeGphJMWkNBn3kONH4Ne9XYhtcjEYLJ7jrObKwg9tMabAOvJMDsGoiTB nSaaNdjNYl+0JPZ/8Rh6Jp0nnf6/d3GExximckufjv+IvNqXa4/2W+4iI4iNJqbt3wW5q1nEx15Bu vyy47oeLvFK5g7ztWOYg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t5RRK-0000000BGgP-0H5g; Mon, 28 Oct 2024 15:13:54 +0000 Received: from mgamail.intel.com ([192.198.163.11]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t5R3D-0000000BBzu-3LDz for linux-mtd@lists.infradead.org; Mon, 28 Oct 2024 14:49:01 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1730126940; x=1761662940; h=date:from:to:cc:subject:message-id:references: in-reply-to:mime-version; bh=Cw6SAJA5IYUqbKzd1Cx5Vh1JBhS0enu+MZ5+d9UFrHg=; b=bsFeQvM/XwCRqo66ab2RM+YnA86X99ktfTttisVy0QawwvLVsWE3Nu3H XFhUUtGPPMt6hQ9L1dmKfaXq9ykwRPIQL3eY9UucvgH8sWaoPqIS//OOW rnUhT1ugTksJw8fHmHrtz1xXoXo8Fn5CiTteXkmNMkzKqbMzfaN8nDz8N XW/PQXZEi1m9e7Ahb0RwWg9NOs4pbtvvToLO0YLMoDDtm0WlGobDtnL69 7OGow+MySrF4Mf5PtaGnPtHq+3OT8AXR+lPucpNIsnmZ2uxqbBh+1wuGh kS7zH5PXmwUHE0Zv8tyVYMYV8Fst+KSq6CY3Bt7ALidKY50M14k8oozOb g==; X-CSE-ConnectionGUID: qY6f4uGrSfSvXLXwE3o6xQ== X-CSE-MsgGUID: H4SMAJPqTEC5EOLBzXAkZQ== X-IronPort-AV: E=McAfee;i="6700,10204,11238"; a="40302222" X-IronPort-AV: E=Sophos;i="6.11,239,1725346800"; d="scan'208";a="40302222" Received: from orviesa007.jf.intel.com ([10.64.159.147]) by fmvoesa105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Oct 2024 07:48:58 -0700 X-CSE-ConnectionGUID: m6ceXjnaRxKN2eWiYHobwg== X-CSE-MsgGUID: 48WEsU+pQb2LiZdfX37JLQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,239,1725346800"; d="scan'208";a="82066961" Received: from fmsmsx601.amr.corp.intel.com ([10.18.126.81]) by orviesa007.jf.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 28 Oct 2024 07:48:57 -0700 Received: from fmsmsx602.amr.corp.intel.com (10.18.126.82) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Mon, 28 Oct 2024 07:48:56 -0700 Received: from fmsedg602.ED.cps.intel.com (10.1.192.136) by fmsmsx602.amr.corp.intel.com (10.18.126.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39 via Frontend Transport; Mon, 28 Oct 2024 07:48:56 -0700 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (104.47.58.48) by edgegateway.intel.com (192.55.55.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Mon, 28 Oct 2024 07:48:56 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=ANJLsmv7QM6yz9R9NucbhYcg+U3WB6mHhBOHtx3ShwgX50KEbFi7waVYnJALEDCTTEqi6VBSJPlIu5zFMobDKvkCdbFUeWd+6qIxLDmZTNP8xYhBaKRTQ/rYt+Fi1TzWVL7A5VF5I4eEVKWjcNSoDiHqiKphMB4cX4CngnOhfvjnaDLG6Dt9ZLGgvzQZRuhE6aiPXYCtoxE7x8R1Y6ZsPBsh1EVp05szXvjY6chiGeaMTfXoOsjx8E7I2hRT+MfEccQM+3sieBTl6I0GmEdBvqixhEUxEAf99KEIDEABqPzOQ415Cml9sq+oJQKMdDBHqDiHOz3fsJvyGX4kfxz+Dw== 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=O6HxlAA7tBMJLpaOwMyvKZAqTtAJIOw7TD4jbAEasYA=; b=cCNRe7G0giwFVzpvO09kxEKtrP3/KtnahKnkzarnE/qzZbQmhSEwTQLRA2481ObqKACdzEwPUcda1A5TxUlK3kj8YcDXqlHJEqe4YJz3M+cDk2AnKrv8477vxmnqffaF6/KtH7J0iHPukrgcthpzOYgG+86hiEJLKLV/qSv/5bipl+DIutO/Oxv6jg80Ms4t4xV7nVUbIU39Lck38P5dzwcMdcuWEb140yVHqEhdT7JIjL8r0LCkAULtKY/4nYrrRgTUVO7J9Zhq4ot8dnHf9LWwPa3m/+0kiDm/TDrMzucKjkr/4L2BBmnYLih0hAa/OCAXlEhI48aV2dAyvgJKWw== 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 BYAPR11MB2854.namprd11.prod.outlook.com (2603:10b6:a02:c9::12) by SA1PR11MB8280.namprd11.prod.outlook.com (2603:10b6:806:25d::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.23; Mon, 28 Oct 2024 14:48:53 +0000 Received: from BYAPR11MB2854.namprd11.prod.outlook.com ([fe80::8a98:4745:7147:ed42]) by BYAPR11MB2854.namprd11.prod.outlook.com ([fe80::8a98:4745:7147:ed42%7]) with mapi id 15.20.8093.024; Mon, 28 Oct 2024 14:48:53 +0000 Date: Mon, 28 Oct 2024 10:48:48 -0400 From: Rodrigo Vivi To: Alexander Usyskin CC: Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Lucas De Marchi , Thomas =?iso-8859-1?Q?Hellstr=F6m?= , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Jani Nikula , Joonas Lahtinen , Tvrtko Ursulin , Oren Weil , , , , Subject: Re: [PATCH 09/10] drm/xe/nvm: add on-die non-volatile memory device Message-ID: References: <20241022104119.3149051-1-alexander.usyskin@intel.com> <20241022104119.3149051-10-alexander.usyskin@intel.com> Content-Disposition: inline In-Reply-To: <20241022104119.3149051-10-alexander.usyskin@intel.com> X-ClientProxiedBy: MW4PR04CA0320.namprd04.prod.outlook.com (2603:10b6:303:82::25) To BYAPR11MB2854.namprd11.prod.outlook.com (2603:10b6:a02:c9::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BYAPR11MB2854:EE_|SA1PR11MB8280:EE_ X-MS-Office365-Filtering-Correlation-Id: 811e9a82-173a-4bbf-23a8-08dcf75fa479 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|7416014|1800799024|366016; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?Olz4jBmiViYyiUWgpP22e+jvVuzXgnYXln4IJkzdijgHVaiEN4Sdn6Gp4Ket?= =?us-ascii?Q?N0tzOXxvksMUHyJy8DRsi9sa+449v7e6QcwovXUBVKyVgb1d6lJgcMhyWGXA?= =?us-ascii?Q?TuZL19Z9cObmtC9u12U/7/7eJSSzJxbFjAs/dKd+clJIVvr0c++h2ZnmV28k?= =?us-ascii?Q?QbNQwF9vNrzcghucVXZbhgC71M2VAONEUPxHsAEBqIeDwqWDss/uy3KLHnf6?= =?us-ascii?Q?9vXU+xzVF5b6GONloCjFDlb+PSU1Ao0r9JBYAmGcf4Ffama5u96wgrs0aePg?= =?us-ascii?Q?NczddMT0VOSFjDwqUSu7ya8ixbdd8qfHHZZeVVPu4DNb+AfmcLbe1byzd4yw?= =?us-ascii?Q?UneK1rJjvYmvclwT1iLDUY0fS7rwJXVMyZ5j8yi/4rQHTb+0/MyF+FCMtBq/?= =?us-ascii?Q?xkOmlKB1gIJEqNGVkfG946kWpCpu2kozXjlbbgQgeW4xw+5P0A/D0S853wcf?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-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BYAPR11MB2854.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(376014)(7416014)(1800799024)(366016);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?9ytZJS6DDkKhqAGJupcc9TUxoLAoqLUGl2kyJ0EzWvQw+N7sflOaCM0Et0oc?= =?us-ascii?Q?8QuUpPVuy1LCPYak5Ot3vDB5VUkFQdgjtnFgZsSlzs2J5uxi6Mqete5sRDtj?= =?us-ascii?Q?h7S6P8ws1T+8aqf10mtdS3ghxBhcgnY/VEPZvglIPcV73iJc6OcwPonFmnEo?= =?us-ascii?Q?Ft+LRJW/oB7m7z3+AXjp4Tav1/L2qfcnwxl3dn6lwLbQIFhwX5vQXRnD8Yi+?= =?us-ascii?Q?oweuXp4jUO3cWaligQYkV3SLwQbPK9fkkrqwXozdZoGQ1dem53zE0g32fUdv?= =?us-ascii?Q?SGnTBV5o5sqVp5u0n4eq6V5FFBJVsguyHsVJ7889yX0qfkBA1w33HIEhsHNJ?= =?us-ascii?Q?TRVq4hvG7RoLwYq1q7aB379PS4V9LNk+/Eou29yb09QgbAsD09i2/uK/yXlE?= =?us-ascii?Q?W9bknSK0f2bdO1JOkYFkBzmhLTgQI1SVx6F+QipiA74Kjc29evjmVfftx/aD?= =?us-ascii?Q?DalgT006HZOtAo3GN0ZpSDh3QJzVcq1cRxKbtBxDIt4BcdA7Wz2S2KIQuYqx?= =?us-ascii?Q?iyKn3pB8/yOdGhzbYIblENm7HJJSP0Lb+KY/cCc9/Fxr6ryoLPSVGEDu5zh4?= =?us-ascii?Q?t99Jw44j6GTKEsXQ6/L2q7YaWARcyAcd3QVgNFSMweRcTZjU80Y2zb99TRMg?= =?us-ascii?Q?Rv4hN6rO1ODU2sI/AWaqdRMtpo5/5T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oTIRzVvrm3qfq88Zq9b8TdS9Fs4XUYGndemu1oAlQbv/yiinCKeK17KHU5?= =?us-ascii?Q?oA=3D=3D?= X-MS-Exchange-CrossTenant-Network-Message-Id: 811e9a82-173a-4bbf-23a8-08dcf75fa479 X-MS-Exchange-CrossTenant-AuthSource: BYAPR11MB2854.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Oct 2024 14:48:53.6077 (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: F6idXt3g8Me29VP2SRE8USP1yBhVcWMgaBE/GP3LeZR523Zt0+3MveZVKl7xVXI2S3PPOPR//zp9TjVHrpPhOQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR11MB8280 X-OriginatorOrg: intel.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241028_074859_889457_9E32FFD1 X-CRM114-Status: GOOD ( 26.41 ) X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-mtd" Errors-To: linux-mtd-bounces+linux-mtd=archiver.kernel.org@lists.infradead.org On Tue, Oct 22, 2024 at 01:41:18PM +0300, Alexander Usyskin wrote: > Enable access to internal non-volatile memory on DGFX > with GSC/CSC devices via a child device. > The nvm child device is exposed via auxiliary bus. I looked at all of the i915 and xe patches here and everything looks right. Just a few common doubts before I put my rv-b here below... Starting with the one from the other patch. Could you please share some doc where I could confirm HECI_FW_STATUS_2_NVM_ACCESS_MODE bit? more below... > > Signed-off-by: Alexander Usyskin > --- > drivers/gpu/drm/xe/Makefile | 1 + > drivers/gpu/drm/xe/xe_device.c | 3 + > drivers/gpu/drm/xe/xe_device_types.h | 8 +++ > drivers/gpu/drm/xe/xe_nvm.c | 100 +++++++++++++++++++++++++++ > drivers/gpu/drm/xe/xe_nvm.h | 15 ++++ > drivers/gpu/drm/xe/xe_pci.c | 5 ++ > 6 files changed, 132 insertions(+) > create mode 100644 drivers/gpu/drm/xe/xe_nvm.c > create mode 100644 drivers/gpu/drm/xe/xe_nvm.h > > diff --git a/drivers/gpu/drm/xe/Makefile b/drivers/gpu/drm/xe/Makefile > index cb6c625bdef0..4225a654a937 100644 > --- a/drivers/gpu/drm/xe/Makefile > +++ b/drivers/gpu/drm/xe/Makefile > @@ -94,6 +94,7 @@ xe-y += xe_bb.o \ > xe_ring_ops.o \ > xe_sa.o \ > xe_sched_job.o \ > + xe_nvm.o \ > xe_step.o \ > xe_sync.o \ > xe_tile.o \ > diff --git a/drivers/gpu/drm/xe/xe_device.c b/drivers/gpu/drm/xe/xe_device.c > index 962751c966d1..844697f79eee 100644 > --- a/drivers/gpu/drm/xe/xe_device.c > +++ b/drivers/gpu/drm/xe/xe_device.c > @@ -49,6 +49,7 @@ > #include "xe_pcode.h" > #include "xe_pm.h" > #include "xe_query.h" > +#include "xe_nvm.h" > #include "xe_sriov.h" > #include "xe_tile.h" > #include "xe_ttm_stolen_mgr.h" > @@ -743,6 +744,7 @@ int xe_device_probe(struct xe_device *xe) > goto err_fini_gt; > } > > + xe_nvm_init(xe); > xe_heci_gsc_init(xe); > > err = xe_oa_init(xe); > @@ -811,6 +813,7 @@ void xe_device_remove(struct xe_device *xe) > xe_oa_fini(xe); > > xe_heci_gsc_fini(xe); > + xe_nvm_fini(xe); > > for_each_gt(gt, xe, id) > xe_gt_remove(gt); > diff --git a/drivers/gpu/drm/xe/xe_device_types.h b/drivers/gpu/drm/xe/xe_device_types.h > index 85bede4dd646..ec3d82f05519 100644 > --- a/drivers/gpu/drm/xe/xe_device_types.h > +++ b/drivers/gpu/drm/xe/xe_device_types.h > @@ -35,6 +35,8 @@ > struct xe_ggtt; > struct xe_pat_ops; > > +struct intel_dg_nvm_dev; > + > #define XE_BO_INVALID_OFFSET LONG_MAX > > #define GRAPHICS_VER(xe) ((xe)->info.graphics_verx100 / 100) > @@ -44,6 +46,7 @@ struct xe_pat_ops; > #define IS_DGFX(xe) ((xe)->info.is_dgfx) > #define HAS_HECI_GSCFI(xe) ((xe)->info.has_heci_gscfi) > #define HAS_HECI_CSCFI(xe) ((xe)->info.has_heci_cscfi) > +#define HAS_GSC_NVM(xe) ((xe)->info.has_gsc_nvm) > > #define XE_VRAM_FLAGS_NEED64K BIT(0) > > @@ -331,6 +334,8 @@ struct xe_device { > u8 has_heci_gscfi:1; > /** @info.has_heci_cscfi: device has heci cscfi */ > u8 has_heci_cscfi:1; > + /** @info.has_gsc_nvm: device has gsc non-volatile memory */ > + u8 has_gsc_nvm:1; > /** @info.skip_guc_pc: Skip GuC based PM feature init */ > u8 skip_guc_pc:1; > /** @info.has_atomic_enable_pte_bit: Device has atomic enable PTE bit */ > @@ -502,6 +507,9 @@ struct xe_device { > /** @heci_gsc: graphics security controller */ > struct xe_heci_gsc heci_gsc; > > + /** @nvm: discrete graphics non-volatile memory */ > + struct intel_dg_nvm_dev *nvm; > + > /** @oa: oa observation subsystem */ > struct xe_oa oa; > > diff --git a/drivers/gpu/drm/xe/xe_nvm.c b/drivers/gpu/drm/xe/xe_nvm.c > new file mode 100644 > index 000000000000..ce56bff1268b > --- /dev/null > +++ b/drivers/gpu/drm/xe/xe_nvm.c > @@ -0,0 +1,100 @@ > +// SPDX-License-Identifier: MIT > +/* > + * Copyright(c) 2019-2024, Intel Corporation. All rights reserved. > + */ > + > +#include > +#include > +#include "xe_device_types.h" > +#include "xe_nvm.h" > +#include "xe_sriov.h" > + > +#define GEN12_GUNIT_NVM_BASE 0x00102040 > +#define GEN12_GUNIT_NVM_SIZE 0x80 > +#define HECI_FW_STATUS_2_NVM_ACCESS_MODE BIT(3) > + > +static const struct intel_dg_nvm_region regions[INTEL_DG_NVM_REGIONS] = { > + [0] = { .name = "DESCRIPTOR", }, > + [2] = { .name = "GSC", }, > + [11] = { .name = "OptionROM", }, > + [12] = { .name = "DAM", }, Could you please give some pointers to confirm this base and these regions? > +}; > + > +static void xe_nvm_release_dev(struct device *dev) > +{ > +} > + > +void xe_nvm_init(struct xe_device *xe) > +{ > + struct pci_dev *pdev = to_pci_dev(xe->drm.dev); > + struct intel_dg_nvm_dev *nvm; > + struct auxiliary_device *aux_dev; > + int ret; > + > + if (!HAS_GSC_NVM(xe)) > + return; > + > + /* No access to internal NVM from VFs */ > + if (IS_SRIOV_VF(xe)) > + return; > + > + /* Nvm pointer should be NULL here */ > + if (WARN_ON(xe->nvm)) > + return; > + > + xe->nvm = kzalloc(sizeof(*nvm), GFP_KERNEL); > + if (!xe->nvm) > + return; > + > + nvm = xe->nvm; > + > + nvm->writeable_override = false; > + nvm->bar.parent = &pdev->resource[0]; > + nvm->bar.start = GEN12_GUNIT_NVM_BASE + pdev->resource[0].start; > + nvm->bar.end = nvm->bar.start + GEN12_GUNIT_NVM_SIZE - 1; > + nvm->bar.flags = IORESOURCE_MEM; > + nvm->bar.desc = IORES_DESC_NONE; > + nvm->regions = regions; > + > + aux_dev = &nvm->aux_dev; > + > + aux_dev->name = "nvm"; > + aux_dev->id = (pci_domain_nr(pdev->bus) << 16) | > + PCI_DEVID(pdev->bus->number, pdev->devfn); > + aux_dev->dev.parent = &pdev->dev; > + aux_dev->dev.release = xe_nvm_release_dev; > + > + ret = auxiliary_device_init(aux_dev); > + if (ret) { > + dev_err(&pdev->dev, "xe-nvm aux init failed %d\n", ret); Since these are inside the i915 and xe and you have our drm private device, I believe it would be better if we would use the drm_err and other drm debug variants here, below and also in the i915 patch. Thank you so much, Rodrigo. > + return; > + } > + > + ret = auxiliary_device_add(aux_dev); > + if (ret) { > + dev_err(&pdev->dev, "xe-nvm aux add failed %d\n", ret); > + auxiliary_device_uninit(aux_dev); > + return; > + } > +} > + > +void xe_nvm_fini(struct xe_device *xe) > +{ > + struct intel_dg_nvm_dev *nvm = xe->nvm; > + > + if (!HAS_GSC_NVM(xe)) > + return; > + > + /* No access to internal NVM from VFs */ > + if (IS_SRIOV_VF(xe)) > + return; > + > + /* Nvm pointer should not be NULL here */ > + if (WARN_ON(!nvm)) > + return; > + > + auxiliary_device_delete(&nvm->aux_dev); > + auxiliary_device_uninit(&nvm->aux_dev); > + kfree(nvm); > + xe->nvm = NULL; > +} > diff --git a/drivers/gpu/drm/xe/xe_nvm.h b/drivers/gpu/drm/xe/xe_nvm.h > new file mode 100644 > index 000000000000..068695447913 > --- /dev/null > +++ b/drivers/gpu/drm/xe/xe_nvm.h > @@ -0,0 +1,15 @@ > +/* SPDX-License-Identifier: MIT */ > +/* > + * Copyright(c) 2019-2024 Intel Corporation. All rights reserved. > + */ > + > +#ifndef __XE_NVM_H__ > +#define __XE_NVM_H__ > + > +struct xe_device; > + > +void xe_nvm_init(struct xe_device *xe); > + > +void xe_nvm_fini(struct xe_device *xe); > + > +#endif /* __XE_NVM_H__ */ > diff --git a/drivers/gpu/drm/xe/xe_pci.c b/drivers/gpu/drm/xe/xe_pci.c > index 64a8336ca437..85c419eea710 100644 > --- a/drivers/gpu/drm/xe/xe_pci.c > +++ b/drivers/gpu/drm/xe/xe_pci.c > @@ -60,6 +60,7 @@ struct xe_device_desc { > u8 has_display:1; > u8 has_heci_gscfi:1; > u8 has_heci_cscfi:1; > + u8 has_gsc_nvm:1; > u8 has_llc:1; > u8 has_mmio_ext:1; > u8 has_sriov:1; > @@ -282,6 +283,7 @@ static const struct xe_device_desc dg1_desc = { > PLATFORM(DG1), > .has_display = true, > .has_heci_gscfi = 1, > + .has_gsc_nvm = 1, > .require_force_probe = true, > }; > > @@ -293,6 +295,7 @@ static const u16 dg2_g12_ids[] = { XE_DG2_G12_IDS(NOP), 0 }; > DGFX_FEATURES, \ > PLATFORM(DG2), \ > .has_heci_gscfi = 1, \ > + .has_gsc_nvm = 1, \ > .subplatforms = (const struct xe_subplatform_desc[]) { \ > { XE_SUBPLATFORM_DG2_G10, "G10", dg2_g10_ids }, \ > { XE_SUBPLATFORM_DG2_G11, "G11", dg2_g11_ids }, \ > @@ -324,6 +327,7 @@ static const __maybe_unused struct xe_device_desc pvc_desc = { > PLATFORM(PVC), > .has_display = false, > .has_heci_gscfi = 1, > + .has_gsc_nvm = 1, > .require_force_probe = true, > }; > > @@ -623,6 +627,7 @@ static int xe_info_init_early(struct xe_device *xe, > xe->info.is_dgfx = desc->is_dgfx; > xe->info.has_heci_gscfi = desc->has_heci_gscfi; > xe->info.has_heci_cscfi = desc->has_heci_cscfi; > + xe->info.has_gsc_nvm = desc->has_gsc_nvm; > xe->info.has_llc = desc->has_llc; > xe->info.has_mmio_ext = desc->has_mmio_ext; > xe->info.has_sriov = desc->has_sriov; > -- > 2.43.0 > ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/