Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/1.1/patches/2229253/?format=api
{ "id": 2229253, "url": "http://patchwork.ozlabs.org/api/1.1/patches/2229253/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-pwm/patch/20260427221155.2144848-23-dakr@kernel.org/", "project": { "id": 38, "url": "http://patchwork.ozlabs.org/api/1.1/projects/38/?format=api", "name": "Linux PWM development", "link_name": "linux-pwm", "list_id": "linux-pwm.vger.kernel.org", "list_email": "linux-pwm@vger.kernel.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20260427221155.2144848-23-dakr@kernel.org>", "date": "2026-04-27T22:11:20", "name": "[REF,22/24] gpu: nova-core: unregister sysmem flush page from Drop", "commit_ref": null, "pull_url": null, "state": "handled-elsewhere", "archived": false, "hash": "bdb43387f4f018fd07d778e8380b9cd14b5fb02a", "submitter": { "id": 89037, "url": "http://patchwork.ozlabs.org/api/1.1/people/89037/?format=api", "name": "Danilo Krummrich", "email": "dakr@kernel.org" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/linux-pwm/patch/20260427221155.2144848-23-dakr@kernel.org/mbox/", "series": [ { "id": 501734, "url": "http://patchwork.ozlabs.org/api/1.1/series/501734/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-pwm/list/?series=501734", "date": "2026-04-27T22:10:58", "name": "rust: device: Higher-Ranked Lifetime Types for device drivers", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/501734/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2229253/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2229253/checks/", "tags": {}, "headers": { "Return-Path": "\n <linux-pwm+bounces-8725-incoming=patchwork.ozlabs.org@vger.kernel.org>", "X-Original-To": [ "incoming@patchwork.ozlabs.org", "linux-pwm@vger.kernel.org" ], "Delivered-To": "patchwork-incoming@legolas.ozlabs.org", "Authentication-Results": [ "legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256\n header.s=k20201202 header.b=BqDRm9LT;\n\tdkim-atps=neutral", "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=2600:3c0a:e001:db::12fc:5321; helo=sea.lore.kernel.org;\n envelope-from=linux-pwm+bounces-8725-incoming=patchwork.ozlabs.org@vger.kernel.org;\n receiver=patchwork.ozlabs.org)", "smtp.subspace.kernel.org;\n\tdkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org\n header.b=\"BqDRm9LT\"", "smtp.subspace.kernel.org;\n arc=none smtp.client-ip=10.30.226.201" ], "Received": [ "from sea.lore.kernel.org (sea.lore.kernel.org\n [IPv6:2600:3c0a:e001:db::12fc:5321])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g4J3m6YfZz1yHX\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 28 Apr 2026 08:23:00 +1000 (AEST)", "from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby sea.lore.kernel.org (Postfix) with ESMTP id E2C86319B1BC\n\tfor <incoming@patchwork.ozlabs.org>; Mon, 27 Apr 2026 22:15:30 +0000 (UTC)", "from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id D1FA6401A09;\n\tMon, 27 Apr 2026 22:14:27 +0000 (UTC)", "from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org\n [10.30.226.201])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby smtp.subspace.kernel.org (Postfix) with ESMTPS id 901EB3B19D4;\n\tMon, 27 Apr 2026 22:14:27 +0000 (UTC)", "by smtp.kernel.org (Postfix) with ESMTPSA id 1AFB6C2BCB5;\n\tMon, 27 Apr 2026 22:14:20 +0000 (UTC)" ], "ARC-Seal": "i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1777328067; cv=none;\n b=hmLKQhSJNr5U/BBAmd4pt6SHrXqIpbXz/j2+cA7Ep1hXbM7clvXTH9GvKqWnbFBSS5NSFM9v2/+V3mGwz2dnCocU4ijXdaXHKMs5ByEygFay/b5GhEfVe2UBV0hj7+E9O0w3GSv6pmS8NzBim001G6lMv2rBVZAMB9TUnRF44jA=", "ARC-Message-Signature": "i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1777328067; c=relaxed/simple;\n\tbh=hYy8LQDnO+hisbOptHtgqKp36k1YyJTGix7eeoo2qKk=;\n\th=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version;\n b=a7auGlE90LnSGD3byLYli0X76YCfzM3JWJzQXPVV4kDrOMfb++w2Ikzj1EQqRn2AhNPCBzhPDFErpZBFykm/hf+k9PMgyCNb/+GK7TviJQL8/myRmYs+vzycU3k/DSWs7aYzew4qmzj3jDzxynj18laNfhCI+HVEnE/LZ1xsVCU=", "ARC-Authentication-Results": "i=1; smtp.subspace.kernel.org;\n dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org\n header.b=BqDRm9LT; arc=none smtp.client-ip=10.30.226.201", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;\n\ts=k20201202; t=1777328067;\n\tbh=hYy8LQDnO+hisbOptHtgqKp36k1YyJTGix7eeoo2qKk=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=BqDRm9LTAxT+LFyHHIuPW75dzJcoI9Ybx7Pav2R3kJM6ezZK8ghNMm+Vgu0kZDyZK\n\t 1LudCaJgONM+Un6S/kbl7SB8Mcga8LywZ7inQvNuX1KcK7KaSNDiyXC7DBPDVdTKor\n\t 0q2svsR7Us01zcKWz6u/qqn6vkMogrDSopGHpgCW5TGai40EemoNAzP0c0nAQAfQN4\n\t l2N+0gniTfMs4GFNXBcrNGkoZtep7KOXCrc+BN9b5PlcSlhqV7AuaookXi4u61d0b9\n\t TflB5dPw/5CUgL0yAScR61V23nWsROYxBmcBHmPPDz34QgZrIkEkjFfH5hf1xXxnE3\n\t DpmWxroqy3GiQ==", "From": "Danilo Krummrich <dakr@kernel.org>", "To": "gregkh@linuxfoundation.org,\n\trafael@kernel.org,\n\tacourbot@nvidia.com,\n\taliceryhl@google.com,\n\tdavid.m.ertman@intel.com,\n\tira.weiny@intel.com,\n\tleon@kernel.org,\n\tviresh.kumar@linaro.org,\n\tm.wilczynski@samsung.com,\n\tukleinek@kernel.org,\n\tbhelgaas@google.com,\n\tkwilczynski@kernel.org,\n\tabdiel.janulgue@gmail.com,\n\trobin.murphy@arm.com,\n\tmarkus.probst@posteo.de,\n\tojeda@kernel.org,\n\tboqun@kernel.org,\n\tgary@garyguo.net,\n\tbjorn3_gh@protonmail.com,\n\tlossin@kernel.org,\n\ta.hindborg@kernel.org,\n\ttmgross@umich.edu", "Cc": "driver-core@lists.linux.dev,\n\tlinux-kernel@vger.kernel.org,\n\tnova-gpu@lists.linux.dev,\n\tdri-devel@lists.freedesktop.org,\n\tlinux-pm@vger.kernel.org,\n\tlinux-pwm@vger.kernel.org,\n\tlinux-pci@vger.kernel.org,\n\trust-for-linux@vger.kernel.org,\n\tDanilo Krummrich <dakr@kernel.org>,\n\tEliot Courtney <ecourtney@nvidia.com>", "Subject": "[PATCH REF 22/24] gpu: nova-core: unregister sysmem flush page from\n Drop", "Date": "Tue, 28 Apr 2026 00:11:20 +0200", "Message-ID": "<20260427221155.2144848-23-dakr@kernel.org>", "X-Mailer": "git-send-email 2.54.0", "In-Reply-To": "<20260427221155.2144848-1-dakr@kernel.org>", "References": "<20260427221155.2144848-1-dakr@kernel.org>", "Precedence": "bulk", "X-Mailing-List": "linux-pwm@vger.kernel.org", "List-Id": "<linux-pwm.vger.kernel.org>", "List-Subscribe": "<mailto:linux-pwm+subscribe@vger.kernel.org>", "List-Unsubscribe": "<mailto:linux-pwm+unsubscribe@vger.kernel.org>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit" }, "content": "Now that SysmemFlush can borrow the Bar via HRT lifetime, store a &'a\nBar0 reference and implement Drop to automatically unregister the\nsysmem flush page. This removes the need for manual unregister() calls\nand the Gpu::unbind() method.\n\nReported-by: Eliot Courtney <ecourtney@nvidia.com>\nCloses: https://lore.kernel.org/all/20260409-fix-systemflush-v1-1-a1d6c968f17c@nvidia.com/\nFixes: 6554ad65b589 (\"gpu: nova-core: register sysmem flush page\")\nSigned-off-by: Danilo Krummrich <dakr@kernel.org>\n---\n drivers/gpu/nova-core/driver.rs | 4 ----\n drivers/gpu/nova-core/fb.rs | 22 ++++++++++------------\n drivers/gpu/nova-core/gpu.rs | 9 +--------\n 3 files changed, 11 insertions(+), 24 deletions(-)", "diff": "diff --git a/drivers/gpu/nova-core/driver.rs b/drivers/gpu/nova-core/driver.rs\nindex ec9cecb30f63..401ae213991f 100644\n--- a/drivers/gpu/nova-core/driver.rs\n+++ b/drivers/gpu/nova-core/driver.rs\n@@ -111,8 +111,4 @@ fn probe(\n }))\n })\n }\n-\n- fn unbind(_pdev: &'a pci::Device<Core>, this: Pin<&'a Self>) {\n- this.gpu.unbind();\n- }\n }\ndiff --git a/drivers/gpu/nova-core/fb.rs b/drivers/gpu/nova-core/fb.rs\nindex bdd5eed760e1..cbc42e98afca 100644\n--- a/drivers/gpu/nova-core/fb.rs\n+++ b/drivers/gpu/nova-core/fb.rs\n@@ -46,21 +46,20 @@\n /// Because of this, the sysmem flush memory page must be registered as early as possible during\n /// driver initialization, and before any falcon is reset.\n ///\n-/// Users are responsible for manually calling [`Self::unregister`] before dropping this object,\n-/// otherwise the GPU might still use it even after it has been freed.\n-pub(crate) struct SysmemFlush {\n+pub(crate) struct SysmemFlush<'a> {\n /// Chipset we are operating on.\n chipset: Chipset,\n device: ARef<device::Device>,\n+ bar: &'a Bar0,\n /// Keep the page alive as long as we need it.\n page: CoherentHandle,\n }\n \n-impl SysmemFlush {\n+impl<'a> SysmemFlush<'a> {\n /// Allocate a memory page and register it as the sysmem flush page.\n pub(crate) fn register(\n dev: &device::Device<device::Bound>,\n- bar: &Bar0,\n+ bar: &'a Bar0,\n chipset: Chipset,\n ) -> Result<Self> {\n let page = CoherentHandle::alloc(dev, kernel::page::PAGE_SIZE, GFP_KERNEL)?;\n@@ -70,19 +69,18 @@ pub(crate) fn register(\n Ok(Self {\n chipset,\n device: dev.into(),\n+ bar,\n page,\n })\n }\n+}\n \n- /// Unregister the managed sysmem flush page.\n- ///\n- /// In order to gracefully tear down the GPU, users must make sure to call this method before\n- /// dropping the object.\n- pub(crate) fn unregister(&self, bar: &Bar0) {\n+impl Drop for SysmemFlush<'_> {\n+ fn drop(&mut self) {\n let hal = hal::fb_hal(self.chipset);\n \n- if hal.read_sysmem_flush_page(bar) == self.page.dma_handle() {\n- let _ = hal.write_sysmem_flush_page(bar, 0).inspect_err(|e| {\n+ if hal.read_sysmem_flush_page(self.bar) == self.page.dma_handle() {\n+ let _ = hal.write_sysmem_flush_page(self.bar, 0).inspect_err(|e| {\n dev_warn!(\n &self.device,\n \"failed to unregister sysmem flush page: {:?}\\n\",\ndiff --git a/drivers/gpu/nova-core/gpu.rs b/drivers/gpu/nova-core/gpu.rs\nindex 922197f2aeef..ff9a90a46609 100644\n--- a/drivers/gpu/nova-core/gpu.rs\n+++ b/drivers/gpu/nova-core/gpu.rs\n@@ -228,7 +228,7 @@ pub(crate) struct Gpu<'a> {\n bar: &'a Bar0,\n /// System memory page required for flushing all pending GPU-side memory writes done through\n /// PCIE into system memory, via sysmembar (A GPU-initiated HW memory-barrier operation).\n- sysmem_flush: SysmemFlush,\n+ sysmem_flush: SysmemFlush<'a>,\n /// GSP falcon instance, used for GSP boot up and cleanup.\n gsp_falcon: Falcon<GspFalcon>,\n /// SEC2 falcon instance, used for GSP boot up and cleanup.\n@@ -271,11 +271,4 @@ pub(crate) fn new(\n _: { gsp.boot(pdev, bar, spec.chipset, gsp_falcon, sec2_falcon)? },\n })\n }\n-\n- /// Called when the corresponding [`Device`](device::Device) is unbound.\n- ///\n- /// Note: This method must only be called from `Driver::unbind`.\n- pub(crate) fn unbind(&self) {\n- self.sysmem_flush.unregister(self.bar);\n- }\n }\n", "prefixes": [ "REF", "22/24" ] }