From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3002B2D5957 for ; Thu, 11 Dec 2025 22:09:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765490963; cv=none; b=MiIR5Pvcca8ckUmup1pA4CGzFIRHJhroT3/7tUfAs8cEOAk5PRySTaQekTPVfgPDvO9nTDM6DntJTDHJYpiaNnHjR0PbUdQAotQ5XR3vER7GNO4nQyNrEiM36MJ+xyWte3W1GJ4I5xP9dfrhWNIV6PG3ymasOZfAoo1xvHi+jfI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765490963; c=relaxed/simple; bh=Y1O7V3uHqYBRFQTCFqzVy63thnPnR5+8cC39VQTSAaE=; h=Message-ID:Subject:From:To:Cc:Date:In-Reply-To:References: Content-Type:MIME-Version; b=aSuOnar953XaPQ2g2RwLWTKTha05KwaZOXAAHhJH8cmqImb9L4soobz3JXL7gW94vXQhD8qXhmLO5dZu7I1a1+58g/SN4RSWN5p3WTyh2eL4oVBOda5M7xQZ8TbunSmNLmzE+yym/TcN3iNGMkxr98weY5xvOUTdhvItYcmewKQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=grRkXWuT; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b=iyIcEpXj; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="grRkXWuT"; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b="iyIcEpXj" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1765490960; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Y1O7V3uHqYBRFQTCFqzVy63thnPnR5+8cC39VQTSAaE=; b=grRkXWuTvw0UZ9VP2PpSqo3GvQByZYwsX+0vENI5Cd5Mx3Yb6JZe1sJH5e/SdHb31KHtR7 B501FDX32Mu8Ne+kvH7oSrcnAhzk4HUfyQK0RHThpKYHcUFMVjbAgvEW0xzcvO2nvjhI5i RVOEQehwipv7YBS7e1fZGAb9zNi+jtI= Received: from mail-qt1-f199.google.com (mail-qt1-f199.google.com [209.85.160.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-639-AYa9CSKaP9SKFk2z3VfiSQ-1; Thu, 11 Dec 2025 17:09:19 -0500 X-MC-Unique: AYa9CSKaP9SKFk2z3VfiSQ-1 X-Mimecast-MFC-AGG-ID: AYa9CSKaP9SKFk2z3VfiSQ_1765490958 Received: by mail-qt1-f199.google.com with SMTP id d75a77b69052e-4ee0c1d1b36so11381541cf.0 for ; Thu, 11 Dec 2025 14:09:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1765490958; x=1766095758; darn=vger.kernel.org; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:from:to:cc:subject :date:message-id:reply-to; bh=Y1O7V3uHqYBRFQTCFqzVy63thnPnR5+8cC39VQTSAaE=; b=iyIcEpXjgXFX3kF4DyeubVGG19uYJe2QFn7j7dwZAsbjd6E/eg4NAy6EaiuEMjy9SZ m3C9oLjgi7d1aLhxOMmg982ugjoSz3tG+pg+Uf0fQkVBJEtbvquSum20ZsrhHXF281rD SiqWNNPEZiv4IUQoKNIxRH4kAtoA2H51rs3GELsx55yxg48qg5j7R3bNpfa8ecmfqJeG Kb2sFlu2EY50snorHy7LCqzuqLi5lAvj1awVHBhzIihWTm663bOavV0yof4HVJQBIMBQ DsCVynus3lFVCNNxHBgxYczPsbS5ZayACA9kFh2PF2U33iv+50zO+J7BLKRZ6ADYRDgt UTVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765490958; x=1766095758; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Y1O7V3uHqYBRFQTCFqzVy63thnPnR5+8cC39VQTSAaE=; b=CmV8QNHe4izP4hDLz68rBMiym6uEKzI2BheHm4EaGlJHe8S2WW1K2tjUZZh+Kjb2Ly yb4s/xyB02TuP09ZI5pmjs0vLz5GUC/mJVOo6CX7kjvcTfnL8hq94iDxKxgSePYyD5Kl kpIP6dCx0dzhAUbDWVsUTA8/CmJWTKB+NWvtTyy3HfAD1fBPkUqB+UHVisEdl/dw7teJ Y1jU9M9fEZiW/enero4/9wbIHi4A3izKT6pbEWK2aS+9QmrFBPiotNvRwsb/cfi1f7+/ lLcp8iNbbtXxbrL3TPz0mlmb/ipPFguNvY5UGqDqTMU3jyBcQbRMthnAFSN3epISC2Wp kViQ== X-Forwarded-Encrypted: i=1; AJvYcCXch7h+fsb64FJqbHxblvBJOYr+sopWhxpZJvGK4NdKhhhes6lDPjdt3RcrFp0Unm1OxihV1KNILG9nP2k=@vger.kernel.org X-Gm-Message-State: AOJu0Yx53dD9gbv5Z9XBvxz7Hmwz2jK80phPxCzpxUCJM3QAhAqlJkIJ NYKbt9BAdCup1WliFuM1NB5HSbwOLbYd8Vx4vhObIn3H8VCtvGKwKxdORX1N0rmK7Ry9+r1bjJI gpe1WEQhVMJuh9ZP3ydbxco8ECCPibsNQKvjO5ltL2SISKTbUBCxGiTw37r3wWTd3GQ== X-Gm-Gg: AY/fxX61254MTYGL0RqOeP2m1PGONITIHR8do8GPPVlcIxCX93Pyh5M90VCPWRO4jQO MS8cohWQGRRyArSyFJw6iKsB3tKSRnA8owtA5dWEpM6II/bx84wvwDMkzhpD98yaxFwSrqQq2cE abMDSISWnh+tzdAwN0rTGcXbhOuxfW6ZYtxNsy4eh686b1g7Cb+eA73UdUWslTBHf/2rJOhJ0Vb 6mV04/mqzAyTvcIyoOtEElSA7q63yZ8XQmHCEWdzzL1CpeAjL0W9vmVAzk9pgpmNwO8ob+c+jfy 8mMSD0bpl4yoepPYEQvPOxF/w0+BpWwOUVpgu+9S+pMwEWsvdXMlU9UehJB5RBJYtkyJsurMW+l 282Fwh+3h+kf8nnbgkMRQKYWrVwxpKgzCQ3oBxdKBrLkXnHKXnkIwFZk= X-Received: by 2002:ac8:7d8d:0:b0:4f1:8bfd:bdc2 with SMTP id d75a77b69052e-4f1bfe7d21cmr49692471cf.41.1765490958377; Thu, 11 Dec 2025 14:09:18 -0800 (PST) X-Google-Smtp-Source: AGHT+IEKiMuyVXq1Y18ZPJmxWCrvSzCOmjyB0gpUsQRsIZiL+/Y+mf2tNT73tJxLC2mGV7AoiB82QA== X-Received: by 2002:ac8:7d8d:0:b0:4f1:8bfd:bdc2 with SMTP id d75a77b69052e-4f1bfe7d21cmr49691521cf.41.1765490957363; Thu, 11 Dec 2025 14:09:17 -0800 (PST) Received: from [192.168.8.198] (pool-100-0-77-142.bstnma.fios.verizon.net. [100.0.77.142]) by smtp.gmail.com with ESMTPSA id af79cd13be357-8bab5665b6fsm314872685a.12.2025.12.11.14.09.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Dec 2025 14:09:16 -0800 (PST) Message-ID: <2f4c3d869a1a47c31fe0c1b387511a33836a9647.camel@redhat.com> Subject: Re: [PATCH 8/9] gpu: nova-core: use core library's CStr instead of kernel one From: lyude@redhat.com To: Alexandre Courbot , Danilo Krummrich , Alice Ryhl , David Airlie , Simona Vetter Cc: John Hubbard , Alistair Popple , Joel Fernandes , Timur Tabi , Edwin Peer , nouveau@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org Date: Thu, 11 Dec 2025 17:09:16 -0500 In-Reply-To: <20251208-nova-misc-v1-8-a3ce01376169@nvidia.com> References: <20251208-nova-misc-v1-0-a3ce01376169@nvidia.com> <20251208-nova-misc-v1-8-a3ce01376169@nvidia.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.58.2 (3.58.2-1.fc43) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Reviewed-by: Lyude Paul On Mon, 2025-12-08 at 18:27 +0900, Alexandre Courbot wrote: > The kernel's own CStr type has been replaced by the one in the core > library, and is now an alias to the latter. Change our imports to > directly reference the actual type. >=20 > Signed-off-by: Alexandre Courbot > --- > =C2=A0drivers/gpu/nova-core/firmware.rs=C2=A0=C2=A0=C2=A0=C2=A0 | 2 +- > =C2=A0drivers/gpu/nova-core/firmware/gsp.rs | 6 ++++-- > =C2=A0drivers/gpu/nova-core/nova_core.rs=C2=A0=C2=A0=C2=A0 | 2 +- > =C2=A0drivers/gpu/nova-core/util.rs=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0 | 4 ++-- > =C2=A04 files changed, 8 insertions(+), 6 deletions(-) >=20 > diff --git a/drivers/gpu/nova-core/firmware.rs b/drivers/gpu/nova- > core/firmware.rs > index 2d2008b33fb4..672f6cd24d4b 100644 > --- a/drivers/gpu/nova-core/firmware.rs > +++ b/drivers/gpu/nova-core/firmware.rs > @@ -229,7 +229,7 @@ const fn make_entry_chipset(self, chipset: &str) > -> Self { > =C2=A0=C2=A0=C2=A0=C2=A0 } > =C2=A0 > =C2=A0=C2=A0=C2=A0=C2=A0 pub(crate) const fn create( > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 module_name: &'static kernel:= :str::CStr, > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 module_name: &'static core::f= fi::CStr, > =C2=A0=C2=A0=C2=A0=C2=A0 ) -> firmware::ModInfoBuilder { > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 let mut this =3D > Self(firmware::ModInfoBuilder::new(module_name)); > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 let mut i =3D 0; > diff --git a/drivers/gpu/nova-core/firmware/gsp.rs > b/drivers/gpu/nova-core/firmware/gsp.rs > index 0549805282ab..53fdbf1de27e 100644 > --- a/drivers/gpu/nova-core/firmware/gsp.rs > +++ b/drivers/gpu/nova-core/firmware/gsp.rs > @@ -34,10 +34,12 @@ > =C2=A0/// that scheme before nova-core becomes stable, which means this > module will eventually be > =C2=A0/// removed. > =C2=A0mod elf { > -=C2=A0=C2=A0=C2=A0 use core::mem::size_of; > +=C2=A0=C2=A0=C2=A0 use core::{ > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ffi::CStr, > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 mem::size_of, // > +=C2=A0=C2=A0=C2=A0 }; > =C2=A0 > =C2=A0=C2=A0=C2=A0=C2=A0 use kernel::bindings; > -=C2=A0=C2=A0=C2=A0 use kernel::str::CStr; > =C2=A0=C2=A0=C2=A0=C2=A0 use kernel::transmute::FromBytes; > =C2=A0 > =C2=A0=C2=A0=C2=A0=C2=A0 /// Newtype to provide a [`FromBytes`] implement= ation. > diff --git a/drivers/gpu/nova-core/nova_core.rs b/drivers/gpu/nova- > core/nova_core.rs > index b98a1c03f13d..3c26cf0b7c6e 100644 > --- a/drivers/gpu/nova-core/nova_core.rs > +++ b/drivers/gpu/nova-core/nova_core.rs > @@ -19,7 +19,7 @@ > =C2=A0mod util; > =C2=A0mod vbios; > =C2=A0 > -pub(crate) const MODULE_NAME: &kernel::str::CStr =3D kernel::ModuleMetadata>::NAME; > +pub(crate) const MODULE_NAME: &core::ffi::CStr =3D kernel::ModuleMetadata>::NAME; > =C2=A0 > =C2=A0kernel::module_pci_driver! { > =C2=A0=C2=A0=C2=A0=C2=A0 type: driver::NovaCore, > diff --git a/drivers/gpu/nova-core/util.rs b/drivers/gpu/nova- > core/util.rs > index 4b503249a3ef..8b2a4b99c55b 100644 > --- a/drivers/gpu/nova-core/util.rs > +++ b/drivers/gpu/nova-core/util.rs > @@ -3,10 +3,10 @@ > =C2=A0/// Converts a null-terminated byte slice to a string, or `None` if > the array does not > =C2=A0/// contains any null byte or contains invalid characters. > =C2=A0/// > -/// Contrary to [`kernel::str::CStr::from_bytes_with_nul`], the null > byte can be anywhere in the > +/// Contrary to [`core::ffi::CStr::from_bytes_with_nul`], the null > byte can be anywhere in the > =C2=A0/// slice, and not only in the last position. > =C2=A0pub(crate) fn str_from_null_terminated(bytes: &[u8]) -> Option<&str= > > { > -=C2=A0=C2=A0=C2=A0 use kernel::str::CStr; > +=C2=A0=C2=A0=C2=A0 use core::ffi::CStr; > =C2=A0 > =C2=A0=C2=A0=C2=A0=C2=A0 bytes > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 .iter()