Message ID | 20240112131857.900734-3-nfraprado@collabora.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-24682-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2614:b0:101:6a76:bbe3 with SMTP id mm20csp167792dyc; Fri, 12 Jan 2024 05:22:12 -0800 (PST) X-Google-Smtp-Source: AGHT+IFVTnsV5VpQ/vRj2pntbRgYo+bv4ZAronKm2wjVkvNXPcNIYnGzOMo73+5uwYuIc2mDSFya X-Received: by 2002:a05:6830:114d:b0:6d9:d144:c9a9 with SMTP id x13-20020a056830114d00b006d9d144c9a9mr1660378otq.22.1705065732196; Fri, 12 Jan 2024 05:22:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1705065732; cv=none; d=google.com; s=arc-20160816; b=E6xi2ZR0znyzXTHCiwTSKZlHzWkQdlEpNi4iubVb6ZHLNATnWtMsFKa+plWtTzuVe8 Q8SdVGtjiuJXEq9NAF58QV83xTsxEBm1L8Ps7fj2JStmtI3ufBUdHXFXxKlM6PurWGOg 7uXrZKNotf+07aUzBMLsKf48GXrB0KFaEDNnIQjd/ahs4G1LHmua2LelGXx11KcPay9P 8EDF6RFw3/PTzAfyvDjXkk2Qfaof2HRSlb2n3IxqHX51CxWva/EWFozu6RxGsxcnCPNE txC/RVGyvhav+Xigpjx2u/qDKuNHjnEVvzbOb/h7awfl0NfT5YWcAlf3pjMhylT6bWxI wFww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=TQSQcKMWa33xou7qjuKoh66Qievrc1HiFj3skq9SZYg=; fh=0B+KNpxEWMfZPolgAcIs9ckWcPKfDDiuSohy9Hlc1iw=; b=g/gpnBTg8dnYSLuW98gOIGP2UhT71gJaEKJTY+HcWygu9DgJLGUsgGCkwnrf+Mk97Z m6IfRUdCYsYRndnUuoUNQHwXeSGbrRabrOeJEc8GnyRmWBgFKQH1WIGxc2+MyUCvP6k1 fdhpKPOIs3QFuyaRfxW9gsd5XFYf5/CjXg5JV3780MMrv5UNx4kZH+HorN1BcbAuyQnL 4sc9ehO+bJpmNqXxFUbO5u+R42A4hW/0fi/VK36Oa+4b1oKVVpsmxDo7zwqWguZEXA7s y96wl4s1sLZE6lKQjQpp8hY7y4qDThqk6Yy9L4TqzA0y0uoa1bS5EepIFKO4nqlWfuwu rZww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=T3qA3z5I; spf=pass (google.com: domain of linux-kernel+bounces-24682-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-24682-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id b11-20020a056a000ccb00b006d60c30ba57si3236477pfv.2.2024.01.12.05.22.11 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Jan 2024 05:22:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-24682-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=T3qA3z5I; spf=pass (google.com: domain of linux-kernel+bounces-24682-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-24682-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id B76D7B23738 for <ouuuleilei@gmail.com>; Fri, 12 Jan 2024 13:21:59 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2F2AE6D1DA; Fri, 12 Jan 2024 13:21:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="T3qA3z5I" Received: from madrid.collaboradmins.com (madrid.collaboradmins.com [46.235.227.194]) (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 41A586D1A4; Fri, 12 Jan 2024 13:21:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1705065680; bh=sPz7qlYsrHlq3cCOtHZi7BOxHqEKVr3tJDgaD7Qlm4I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=T3qA3z5IeURvAorefJ8yBC9ViApTUBJv7sEOilZu1dK9dPr99ixr/x5svUv3Yc5xQ j3hW3cAO3CKI73X3LCB6LyfIviNFq8IOOCkJWSj/b2SDVr2KH3hNsm7Ks6P1SZBvK2 sHkvvm2bN8OLRPTVc2UU3pRk+0hveFvAsNqDv5PE7yX+xfeHVsqKVEqCwVLplS2YvO YRFiZbvuNUZ/5cV5CyYuYP1iRikzbXEmE/gwzMfWZr3G2RpxOHEcEgYNDcvvsGWQ3l DmdrGOnVYVpVKwkpAfd/G2poivJI35vMzqBeQl3vaySdsB3fhd/tFdCeVSADM1Ktlk h8PtR3BdBI3RA== Received: from localhost.localdomain (zone.collabora.co.uk [167.235.23.81]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: nfraprado) by madrid.collaboradmins.com (Postfix) with ESMTPSA id 685293782032; Fri, 12 Jan 2024 13:21:15 +0000 (UTC) From: =?utf-8?b?TsOtY29sYXMgRi4gUi4gQS4gUHJhZG8=?= <nfraprado@collabora.com> To: Tzung-Bi Shih <tzungbi@kernel.org> Cc: kernel@collabora.com, AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>, chrome-platform@lists.linux.dev, =?utf-8?b?TsOtY29sYXMgRi4gUi4gQS4gUHJhZG8=?= <nfraprado@collabora.com>, Abhijit Gangurde <abhijit.gangurde@amd.com>, Andy Shevchenko <andriy.shevchenko@linux.intel.com>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Masahiro Yamada <masahiroy@kernel.org>, Nathan Chancellor <nathan@kernel.org>, Nicolas Schier <nicolas@fjasle.eu>, Nipun Gupta <nipun.gupta@amd.com>, Pieter Jansen van Vuuren <pieter.jansen-van-vuuren@amd.com>, Umang Jain <umang.jain@ideasonboard.com>, linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 2/7] firmware: coreboot: Generate aliases for coreboot modules Date: Fri, 12 Jan 2024 10:18:31 -0300 Message-ID: <20240112131857.900734-3-nfraprado@collabora.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240112131857.900734-1-nfraprado@collabora.com> References: <20240112131857.900734-1-nfraprado@collabora.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787891004791253668 X-GMAIL-MSGID: 1787891004791253668 |
Series |
Allow coreboot modules to autoload and enable cbmem in the arm64 defconfig
|
|
Commit Message
Nícolas F. R. A. Prado
Jan. 12, 2024, 1:18 p.m. UTC
Generate aliases for coreboot modules to allow automatic module probing.
Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
---
(no changes since v1)
include/linux/mod_devicetable.h | 8 ++++++++
scripts/mod/devicetable-offsets.c | 3 +++
scripts/mod/file2alias.c | 10 ++++++++++
3 files changed, 21 insertions(+)
Comments
On Fri, Jan 12, 2024 at 10:18:31AM -0300, Nícolas F. R. A. Prado wrote: > Generate aliases for coreboot modules to allow automatic module probing. .. > (no changes since v1) Same Q as per v1.
On Sun, Jan 14, 2024 at 07:09:29PM +0200, Andy Shevchenko wrote: > On Fri, Jan 12, 2024 at 10:18:31AM -0300, Nícolas F. R. A. Prado wrote: > > Generate aliases for coreboot modules to allow automatic module probing. > > ... > > > (no changes since v1) > > Same Q as per v1. I don't have v1 in my inbox, and this wasn't addressed in v3 either. But copy/pasted off the archives: "Don't you want to have a driver data or so associated with this?" These drivers are super simple, and I doubt they will end up with multiple tags per driver, so it seems unlikely we'd ever need it. Additionally, struct coreboot_device already includes the tag information, so anything that could be included in driver data could be parsed out by the driver at probe time, if absolutely needed. Brian
On Tue, Jan 23, 2024 at 02:06:14PM -0800, Brian Norris wrote: > On Sun, Jan 14, 2024 at 07:09:29PM +0200, Andy Shevchenko wrote: > > On Fri, Jan 12, 2024 at 10:18:31AM -0300, Nícolas F. R. A. Prado wrote: > > > Generate aliases for coreboot modules to allow automatic module probing. > > > > ... > > > > > (no changes since v1) > > > > Same Q as per v1. > > I don't have v1 in my inbox, and this wasn't addressed in v3 either. But > copy/pasted off the archives: > > "Don't you want to have a driver data or so associated with this?" > > These drivers are super simple, and I doubt they will end up with > multiple tags per driver, so it seems unlikely we'd ever need it. > Additionally, struct coreboot_device already includes the tag > information, so anything that could be included in driver data could be > parsed out by the driver at probe time, if absolutely needed. But why limit yourself to 32bits now? Why not make it 64? It is going to be sent to userspace, so you have to be very careful about it. thanks, greg k-h
On Tue, Jan 30, 2024 at 3:51 PM Greg Kroah-Hartman <gregkh@linuxfoundation.org> wrote: > On Tue, Jan 23, 2024 at 02:06:14PM -0800, Brian Norris wrote: > > "Don't you want to have a driver data or so associated with this?" .. > But why limit yourself to 32bits now? Why not make it 64? It is going > to be sent to userspace, so you have to be very careful about it. Is that question related to the question I pasted/replied to, about driver data? Or a new topic? Sorry if I'm misunderstanding. Anyway, for the size of the tag field: I don't have a strong opinion. But FWIW, they're coming from this project: https://review.coreboot.org/plugins/gitiles/coreboot/+/269b23280f928510bcadd23182294e5b9dad11ec/payloads/libpayload/include/coreboot_tables.h#36 As you can see there, we're extremely far from exhausting 16 bits, let alone 32. Brian
On Tue, Jan 30, 2024 at 04:01:57PM -0800, Brian Norris wrote: > On Tue, Jan 30, 2024 at 3:51 PM Greg Kroah-Hartman > <gregkh@linuxfoundation.org> wrote: > > On Tue, Jan 23, 2024 at 02:06:14PM -0800, Brian Norris wrote: > > > "Don't you want to have a driver data or so associated with this?" > ... > > But why limit yourself to 32bits now? Why not make it 64? It is going > > to be sent to userspace, so you have to be very careful about it. > > Is that question related to the question I pasted/replied to, about > driver data? Or a new topic? Sorry if I'm misunderstanding. Same question, driver data, you make it 32 bits. > Anyway, for the size of the tag field: I don't have a strong opinion. > But FWIW, they're coming from this project: > > https://review.coreboot.org/plugins/gitiles/coreboot/+/269b23280f928510bcadd23182294e5b9dad11ec/payloads/libpayload/include/coreboot_tables.h#36 > > As you can see there, we're extremely far from exhausting 16 bits, let alone 32. We've run into running out of bits in other subsystems before, it's "free" now, just be safe and make it 64 like I think Andy is suggesting. thanks, greg k-h
On Tue, Jan 30, 2024 at 04:23:02PM -0800, Greg Kroah-Hartman wrote: > On Tue, Jan 30, 2024 at 04:01:57PM -0800, Brian Norris wrote: > > On Tue, Jan 30, 2024 at 3:51 PM Greg Kroah-Hartman > > <gregkh@linuxfoundation.org> wrote: > > > On Tue, Jan 23, 2024 at 02:06:14PM -0800, Brian Norris wrote: > > > > "Don't you want to have a driver data or so associated with this?" > > ... > > > But why limit yourself to 32bits now? Why not make it 64? It is going > > > to be sent to userspace, so you have to be very careful about it. > > > > Is that question related to the question I pasted/replied to, about > > driver data? Or a new topic? Sorry if I'm misunderstanding. > > Same question, driver data, you make it 32 bits. > > > Anyway, for the size of the tag field: I don't have a strong opinion. > > But FWIW, they're coming from this project: > > > > https://review.coreboot.org/plugins/gitiles/coreboot/+/269b23280f928510bcadd23182294e5b9dad11ec/payloads/libpayload/include/coreboot_tables.h#36 > > > > As you can see there, we're extremely far from exhausting 16 bits, let alone 32. > > We've run into running out of bits in other subsystems before, it's > "free" now, just be safe and make it 64 like I think Andy is suggesting. Either you and Andy are suggesting different things, or I still don't quite get what you mean. Andy was suggesting we added a driver_data field, that is: struct coreboot_device_id { __u32 tag; kernel_ulong_t driver_data; }; You're suggesting we make the tag 64 bits long: struct coreboot_device_id { __u64 tag; }; Like Brian, I'm not sure I see the benefit of either change. As he said, it's unlikely that having a driver_data would provide any benefit and won't ever be required anyway, and 32 bits is already a generous space to give to coreboot tags. That said, I'm also not against either change, and can apply both of them to the next version if that's indeed what your experience says will work best. I'll wait another week or so before following up though to make sure we're all on the same page. (To be honest I also still don't see how this struct makes it to userspace and is considered ABI, I only see the generated modalias being ABI and hence 32 vs 64 bit tag is ABI breakage but not adding driver_data, but I'll take your word for it for now) Thanks, Nícolas
On Thu, Feb 01, 2024 at 05:45:19PM -0500, Nícolas F. R. A. Prado wrote: > On Tue, Jan 30, 2024 at 04:23:02PM -0800, Greg Kroah-Hartman wrote: > > On Tue, Jan 30, 2024 at 04:01:57PM -0800, Brian Norris wrote: > > > On Tue, Jan 30, 2024 at 3:51 PM Greg Kroah-Hartman > > > <gregkh@linuxfoundation.org> wrote: > > > > On Tue, Jan 23, 2024 at 02:06:14PM -0800, Brian Norris wrote: > > > > > "Don't you want to have a driver data or so associated with this?" > > > ... > > > > But why limit yourself to 32bits now? Why not make it 64? It is going > > > > to be sent to userspace, so you have to be very careful about it. > > > > > > Is that question related to the question I pasted/replied to, about > > > driver data? Or a new topic? Sorry if I'm misunderstanding. > > > > Same question, driver data, you make it 32 bits. > > > > > Anyway, for the size of the tag field: I don't have a strong opinion. > > > But FWIW, they're coming from this project: > > > > > > https://review.coreboot.org/plugins/gitiles/coreboot/+/269b23280f928510bcadd23182294e5b9dad11ec/payloads/libpayload/include/coreboot_tables.h#36 > > > > > > As you can see there, we're extremely far from exhausting 16 bits, let alone 32. > > > > We've run into running out of bits in other subsystems before, it's > > "free" now, just be safe and make it 64 like I think Andy is suggesting. > > Either you and Andy are suggesting different things, or I still don't quite get > what you mean. > > Andy was suggesting we added a driver_data field, that is: > > struct coreboot_device_id { > __u32 tag; > kernel_ulong_t driver_data; > }; > > You're suggesting we make the tag 64 bits long: > > struct coreboot_device_id { > __u64 tag; > }; Yeah, I'm confused, sorry. Yes, add some driver_data, and if you are SURE your tag will NEVER be larger than 32 bits, stick with that, but really, you are using the space in empty padding anyway, so just make it 64bits please. thanks, greg k-h
On Thu, Feb 01, 2024 at 06:21:03PM -0800, Greg Kroah-Hartman wrote: > On Thu, Feb 01, 2024 at 05:45:19PM -0500, Nícolas F. R. A. Prado wrote: > > On Tue, Jan 30, 2024 at 04:23:02PM -0800, Greg Kroah-Hartman wrote: > > > On Tue, Jan 30, 2024 at 04:01:57PM -0800, Brian Norris wrote: > > > > On Tue, Jan 30, 2024 at 3:51 PM Greg Kroah-Hartman > > > > <gregkh@linuxfoundation.org> wrote: > > > > > On Tue, Jan 23, 2024 at 02:06:14PM -0800, Brian Norris wrote: > > > > > > "Don't you want to have a driver data or so associated with this?" > > > > ... > > > > > But why limit yourself to 32bits now? Why not make it 64? It is going > > > > > to be sent to userspace, so you have to be very careful about it. > > > > > > > > Is that question related to the question I pasted/replied to, about > > > > driver data? Or a new topic? Sorry if I'm misunderstanding. > > > > > > Same question, driver data, you make it 32 bits. > > > > > > > Anyway, for the size of the tag field: I don't have a strong opinion. > > > > But FWIW, they're coming from this project: > > > > > > > > https://review.coreboot.org/plugins/gitiles/coreboot/+/269b23280f928510bcadd23182294e5b9dad11ec/payloads/libpayload/include/coreboot_tables.h#36 > > > > > > > > As you can see there, we're extremely far from exhausting 16 bits, let alone 32. > > > > > > We've run into running out of bits in other subsystems before, it's > > > "free" now, just be safe and make it 64 like I think Andy is suggesting. > > > > Either you and Andy are suggesting different things, or I still don't quite get > > what you mean. > > > > Andy was suggesting we added a driver_data field, that is: > > > > struct coreboot_device_id { > > __u32 tag; > > kernel_ulong_t driver_data; > > }; > > > > You're suggesting we make the tag 64 bits long: > > > > struct coreboot_device_id { > > __u64 tag; > > }; > > Yeah, I'm confused, sorry. > > Yes, add some driver_data, and if you are SURE your tag will NEVER be > larger than 32 bits, stick with that, but really, you are using the > space in empty padding anyway, so just make it 64bits please. Ok, after giving it a closer look, I've decided we really should just stick with 32 bits. More fundamental than the previous argument that we aren't close to exhausting 32 bits for the tag in coreboot, is the fact that tags are literally defined as 32 bits long for the table entries [1]. Meaning, a tag being 32 bits long is part of the coreboot ABI. We have to parse it as 32bits from memory. Representing it as 64 bits internally and exposing it as 64 bits to userspace would not only be unecessarily complicating things, but also misrepresenting the data that we're getting from the firmware. I can add driver_data for v4 no problem, as we can simply not use it while we don't need it, but having tags be 64 bits actively complicates things for no real gain, so it's a no-go. Thanks, Nícolas [1] https://review.coreboot.org/plugins/gitiles/coreboot/+/refs/heads/main/src/commonlib/include/commonlib/coreboot_tables.h#128
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h index f458469c5ce5..24e0dcfde809 100644 --- a/include/linux/mod_devicetable.h +++ b/include/linux/mod_devicetable.h @@ -960,4 +960,12 @@ struct vchiq_device_id { char name[32]; }; +/** + * struct coreboot_device_id - Identifies a coreboot table entry + * @tag: tag ID + */ +struct coreboot_device_id { + __u32 tag; +}; + #endif /* LINUX_MOD_DEVICETABLE_H */ diff --git a/scripts/mod/devicetable-offsets.c b/scripts/mod/devicetable-offsets.c index e91a3c38143b..518200813d4e 100644 --- a/scripts/mod/devicetable-offsets.c +++ b/scripts/mod/devicetable-offsets.c @@ -274,5 +274,8 @@ int main(void) DEVID(vchiq_device_id); DEVID_FIELD(vchiq_device_id, name); + DEVID(coreboot_device_id); + DEVID_FIELD(coreboot_device_id, tag); + return 0; } diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c index 4829680a0a6d..5d1c61fa5a55 100644 --- a/scripts/mod/file2alias.c +++ b/scripts/mod/file2alias.c @@ -1494,6 +1494,15 @@ static int do_vchiq_entry(const char *filename, void *symval, char *alias) return 1; } +/* Looks like: coreboot:tN */ +static int do_coreboot_entry(const char *filename, void *symval, char *alias) +{ + DEF_FIELD(symval, coreboot_device_id, tag); + sprintf(alias, "coreboot:t%08X", tag); + + return 1; +} + /* Does namelen bytes of name exactly match the symbol? */ static bool sym_is(const char *name, unsigned namelen, const char *symbol) { @@ -1575,6 +1584,7 @@ static const struct devtable devtable[] = { {"ishtp", SIZE_ishtp_device_id, do_ishtp_entry}, {"cdx", SIZE_cdx_device_id, do_cdx_entry}, {"vchiq", SIZE_vchiq_device_id, do_vchiq_entry}, + {"coreboot", SIZE_coreboot_device_id, do_coreboot_entry}, }; /* Create MODULE_ALIAS() statements.