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.133.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 BE9C62D5957 for ; Thu, 11 Dec 2025 22:07:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765490841; cv=none; b=pInjgmDpGKDjIE85eU2fCa3qLsJs/HLqmF5jpCbyWxt1oYz6B+2I2G9GW/es9zRHBjxqCzHojoSAEk1b2r1yhNqX+CDv4UGgH0nTqpNABaNow7HKfqJmf7Jq9073GxkedXCMDhRTEVv7vMPXG7ZD22/olzTpu931oynvxPFs5SM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765490841; c=relaxed/simple; bh=S/yt3h0LA2CQSgeXoj4ym7AxrOljIdTgGQSxKRVOCsQ=; h=Message-ID:Subject:From:To:Cc:Date:In-Reply-To:References: Content-Type:MIME-Version; b=qVNJDuRrpGmG4xjOClmKeI9m2Eo/ZEgbK4bPNu3F2ljOyECUsc5XC1G8f7yOFnaaGTyBTk8GqhnGZyc+meqacrQVpxArGIELiwhYG/MawOwrrImSTl/HkiGCv3sb9rxw5X7XtGTAZNKG53rgevZNQsWaor8NHtJxsTkocnIeuAw= 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=TwHsRSIs; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b=hd6mxwfi; arc=none smtp.client-ip=170.10.133.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="TwHsRSIs"; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b="hd6mxwfi" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1765490838; 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=S/yt3h0LA2CQSgeXoj4ym7AxrOljIdTgGQSxKRVOCsQ=; b=TwHsRSIsJ6s9Kt5a+slTqyEicycgAovhxYryD6RFK6t6FA7lm3km1WjGUk9l/DfM+VKecs W7ZmVmafXBnblVboPWtA/Fz2jAHSwOSMsxnBC0fe9eHi3jlfh+NKIGMHt4Y0o/srqY+y0Y 5/t2bYq5P50FYJbLxtaZ9Qg7gI5YxdI= Received: from mail-qv1-f71.google.com (mail-qv1-f71.google.com [209.85.219.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-452-jXd-BNQXNmCt-vY7aGNjTA-1; Thu, 11 Dec 2025 17:07:17 -0500 X-MC-Unique: jXd-BNQXNmCt-vY7aGNjTA-1 X-Mimecast-MFC-AGG-ID: jXd-BNQXNmCt-vY7aGNjTA_1765490837 Received: by mail-qv1-f71.google.com with SMTP id 6a1803df08f44-88041f9e686so13770956d6.1 for ; Thu, 11 Dec 2025 14:07:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1765490837; x=1766095637; 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=S/yt3h0LA2CQSgeXoj4ym7AxrOljIdTgGQSxKRVOCsQ=; b=hd6mxwfivAQ5+mXSwykp4XlNPYDJqlWHouFn+fhKwhGwX6mCVk/QolzseHw9X6w+im VNUwzYpfx+fwXnW2+y94oXqZW1k1Pd8QNts3ADjCjkhmQABdASVuRuOS8I3pahdjUwjK +u27jboiwpmQxQrTM8I2HVv10fW6jMJTXoEIOmuxb7fu+daEPemR2CwbiEq+fs9l6bZk ISIcbX3EdaWiUxpu1bNhzdbHq03Of/z3Ootkaxzhnu4rRdEPEDNGPkAL3qb1LvD16THr HLcnRl3bf/XU/6kZpEPkflEXrDf+RntNVxuC1ThDusqsJ8p+ISDNJMJzS1su99v+eld5 X7Jg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765490837; x=1766095637; 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=S/yt3h0LA2CQSgeXoj4ym7AxrOljIdTgGQSxKRVOCsQ=; b=iCWj7LwrrikuvbSQCPGDNlBxNZB6Q4RlnU69jPIj3+baWOW6QRvRvhgwqTsOFFHY7u fF3UKuYXM33sDx4mjdyAY4FvNE7wCJOIO2Nk2wFJ0LBth+jD6n5IofGmjTZcANeCivcJ 1bfusSIuPSpbnHd0lhSk0yoe6tfImRijuy7C9XHuJS9kJtFiuzHGc2cL2y4kiV7dbkQ9 swYWN0er+rgBIJHACk9QvEtP/tI7i/gIDnp86NK70PgJOQhm/wd9622amN1NPS1jCvQk D18MbZMYEMDp/phJupgUpDVzk1KzRapevYEqHcKdIfwDVbFRFOTKUB6HkHLQSWNt0qKL UbnA== X-Forwarded-Encrypted: i=1; AJvYcCU8t1DOnyRjjtZ4jxSDN797CSjhvsC3xOWisTfTda9rPdzhADJVtdfp/KzWdNuOk8omyGoESVNrbrIOOGc=@vger.kernel.org X-Gm-Message-State: AOJu0YyjkXQfujoZzjKLxw3yQ6au/V4qtynvD+CPUNrsbCvYFoZVKloe +ysyAb06EAS8cBC3VG8+2SX8RJM61keREG4FXlMLhfOsuOSDzxWAJ8Pkd18pHt026sVYrhC20is xNaNdKXqa6A7AsSnN8K3gGr9NV34K72KXToH5sjz2zV6fcpf1U1Y3aVwQKXmThsmXGA== X-Gm-Gg: AY/fxX4U2YUMLQmBBOK4/8FYY119vTQsTFMWyRZS3sBqVirc/gQw8gLfpPKRDudvjEO ZZSa9kfkJGomqbLMvrm1malEW6fXhmSQOTucvxqpUqEUwFOoOvSBn3094y/MA5jAs0DRx1g6ZQ+ HaBctXdsGNYzr1s/M/dGJIGMMw2r/Uxb3u2+ocSpuuzJlmfrKlZzGweCll9XjoN40lXf0s322mJ f8RycLYWiPkJD8Z3M27ESAcvMckUI4G57hbwJP/Klm1R9vFuTEW5fYKCUtC4eMyyUWnbmT9vCRa HtBNtL8f4oiIh028xP3HLEhEcD5Z+CNTbZuFttm/cNRjYiZeXomdFusBidMTE8rBENDeQuXhVhf oOC39ID8Xub5LIm4QIaT/fIqoeVoFKWiZiL3E1EEiVbNefg4ea6AFz08= X-Received: by 2002:a05:6214:1247:b0:87c:27c2:2c0e with SMTP id 6a1803df08f44-8887e7f4717mr2002886d6.59.1765490836917; Thu, 11 Dec 2025 14:07:16 -0800 (PST) X-Google-Smtp-Source: AGHT+IFpL7P109j0TrrJ6OMch/eU/9skpG1csWeSXfbkzBfpFzWr1R23nHPE1F9w7iK8jbzWzXkOng== X-Received: by 2002:a05:6214:1247:b0:87c:27c2:2c0e with SMTP id 6a1803df08f44-8887e7f4717mr2002536d6.59.1765490836603; Thu, 11 Dec 2025 14:07:16 -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 6a1803df08f44-8886ec56964sm31777496d6.21.2025.12.11.14.07.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Dec 2025 14:07:16 -0800 (PST) Message-ID: Subject: Re: [PATCH 6/9] gpu: nova-core: gsp: derive Zeroable for GspStaticConfigInfo 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:07:15 -0500 In-Reply-To: <20251208-nova-misc-v1-6-a3ce01376169@nvidia.com> References: <20251208-nova-misc-v1-0-a3ce01376169@nvidia.com> <20251208-nova-misc-v1-6-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:26 +0900, Alexandre Courbot wrote: > We can derive `Zeroable` automatically instead of implementing it > ourselves if we convert it from a tuple struct into a regular one. > This > removes an `unsafe` statement. >=20 > Signed-off-by: Alexandre Courbot > --- > =C2=A0drivers/gpu/nova-core/gsp/fw/commands.rs | 11 +++++------ > =C2=A01 file changed, 5 insertions(+), 6 deletions(-) >=20 > diff --git a/drivers/gpu/nova-core/gsp/fw/commands.rs > b/drivers/gpu/nova-core/gsp/fw/commands.rs > index 21be44199693..85465521de32 100644 > --- a/drivers/gpu/nova-core/gsp/fw/commands.rs > +++ b/drivers/gpu/nova-core/gsp/fw/commands.rs > @@ -107,12 +107,15 @@ unsafe impl FromBytes for PackedRegistryTable > {} > =C2=A0 > =C2=A0/// Payload of the `GetGspStaticInfo` command and message. > =C2=A0#[repr(transparent)] > -pub(crate) struct > GspStaticConfigInfo(bindings::GspStaticConfigInfo_t); > +#[derive(Zeroable)] > +pub(crate) struct GspStaticConfigInfo { > +=C2=A0=C2=A0=C2=A0 inner: bindings::GspStaticConfigInfo_t, > +} > =C2=A0 > =C2=A0impl GspStaticConfigInfo { > =C2=A0=C2=A0=C2=A0=C2=A0 /// Returns a bytes array containing the (hopefu= lly) zero- > terminated name of this GPU. > =C2=A0=C2=A0=C2=A0=C2=A0 pub(crate) fn gpu_name_str(&self) -> [u8; 64] { > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 self.0.gpuNameString > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 self.inner.gpuNameString > =C2=A0=C2=A0=C2=A0=C2=A0 } > =C2=A0} > =C2=A0 > @@ -122,7 +125,3 @@ unsafe impl AsBytes for GspStaticConfigInfo {} > =C2=A0// SAFETY: This struct only contains integer types for which all bi= t > patterns > =C2=A0// are valid. > =C2=A0unsafe impl FromBytes for GspStaticConfigInfo {} > - > -// SAFETY: This struct only contains integer types and fixed-size > arrays for which > -// all bit patterns are valid. > -unsafe impl Zeroable for GspStaticConfigInfo {}