From patchwork Wed Mar 22 14:26:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 13184164 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 5BE05C6FD1C for ; Wed, 22 Mar 2023 14:27:36 +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:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=cRUTpXARpY462Y/qA9fFUw1qMgMzLgT62X6O8EswZ54=; b=O2V/YTH6QT5ETO XDELcOyK3c2IslZ+nW1E/h9OKkh6HoqYQSrgOglAtQB0TZu3FcztN5VB1rDdthpDBpWrT6LEoS3PP s38ncFS7JWfxkfqQYDQSJqdsp2SVSH/PTBVeUSYrNv40wbx6R8y+js74ap/ihCStRglDZCv9a+M54 0v4pVdl+mie0p6mqdbg9+c1hN8vDkwHjq3I//jUcffcK+q7iGvKvhM44twR16JAbEE5yc5h3RsHqr 8PW7wGycvFQLuZ+vw9zGM02kjmIUGFN9/OLRkxPGR3sH8jkv2Jaa46HDqll3s6SMTJDf+Z+jPBswl EGsZkV2rehQtla9lazvQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pezQL-00GHri-2h; Wed, 22 Mar 2023 14:26:45 +0000 Received: from ams.source.kernel.org ([2604:1380:4601:e00::1]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pezQ9-00GHnV-1r for linux-arm-kernel@lists.infradead.org; Wed, 22 Mar 2023 14:26:36 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 5464AB81D07; Wed, 22 Mar 2023 14:26:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D6CFBC4339B; Wed, 22 Mar 2023 14:26:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1679495191; bh=/pQl1T/l+bkRAhDaMaRrFUb1vkonMeAYR0omTnvlKko=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=d4GxiiM8EbOLGONlgb8ht8bNuGR65CpQ6PmZxseV/QEwpCy9T9prJyxfLTsZQu6BL A7Ez6CFlGYzk3OWYNnkmg3DvKczLdlBfR2cTIRBXGXRAQELMZqLz9rZfCNKMqgqJ1i YIl22knKo6pEUaaWMauMd5vmwDiSI/FXk1x/Vc+yhmBg/FfDcfvsk83kgSFnFAD47j PFSt+83XK3FcUd6r3dUNqhoW58qYU9jcnRtIqjVDXoHpqFiXe5+XS8hCfrtDOkhl2c XcbJhQbikWDm6o/RMqJ22P7oCzb/GqRzONs6N5l/IF8G4XI2B8NiJdzyxQWbcCAE7K 5wey3pZ4M1Xqg== From: Ard Biesheuvel To: linux-efi@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, Ard Biesheuvel , Darren Hart , Andrea Righi Subject: [PATCH 1/3] efi/libstub: smbios: Use length member instead of record struct size Date: Wed, 22 Mar 2023 15:26:19 +0100 Message-Id: <20230322142621.3685058-2-ardb@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230322142621.3685058-1-ardb@kernel.org> References: <20230322142621.3685058-1-ardb@kernel.org> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1003; i=ardb@kernel.org; h=from:subject; bh=/pQl1T/l+bkRAhDaMaRrFUb1vkonMeAYR0omTnvlKko=; b=owGbwMvMwCFmkMcZplerG8N4Wi2JIUVagOvs/4sTZurG/6i/YXdjvYRX5CNN5e3BB5U/J2+36 HCP0BPsKGVhEONgkBVTZBGY/ffdztMTpWqdZ8nCzGFlAhnCwMUpABOJSmD477koyyjKNfZe0EmG wy+LgvpOzWjft8uJJfnDj6Iy4VbGNkaGA5Y5Ehb389t7kxpuPvb4dk938wanuvASvZ+FTMxbagW YAA== X-Developer-Key: i=ardb@kernel.org; a=openpgp; fpr=F43D03328115A198C90016883D200E9CA6329909 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230322_072633_767563_893716F3 X-CRM114-Status: GOOD ( 14.58 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The type 1 SMBIOS record happens to always be the same size, but there are other record types which have been augmented over time, and so we should really use the length field in the header to decide where the string table starts. Fixes: 550b33cfd4452968 ("arm64: efi: Force the use of ...") Signed-off-by: Ard Biesheuvel --- drivers/firmware/efi/libstub/smbios.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/firmware/efi/libstub/smbios.c b/drivers/firmware/efi/libstub/smbios.c index 460418b7f5f5e9ab..aadb422b9637dfc0 100644 --- a/drivers/firmware/efi/libstub/smbios.c +++ b/drivers/firmware/efi/libstub/smbios.c @@ -36,7 +36,7 @@ const u8 *__efi_get_smbios_string(u8 type, int offset, int recsize) if (status != EFI_SUCCESS) return NULL; - strtable = (u8 *)record + recsize; + strtable = (u8 *)record + record->length; for (int i = 1; i < ((u8 *)record)[offset]; i++) { int len = strlen(strtable); From patchwork Wed Mar 22 14:26:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 13184165 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 7B648C74A5B for ; Wed, 22 Mar 2023 14:27:37 +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:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=myTQBEv+Mxcb94RLFBI+lWzElzg/cBsolxVW7RKrsuY=; b=foQn0RsAUfPMEQ a659TucgziOPYR0mT9GjFGUpUGhqoZ1gcvpP5Q7VTShuaaDsfeTNJIjqu16xaev5djVRva2XWFAXY IoSu5xfrPcd0ltNBb1mE2Gn5Hzys6khjh+xP34BrI9KcrM8BBoJ62f6zaC2hkdgsCWISscxlYug74 pVToR9QVVaKLILabaCimlceyEAj8I5FDdL+upXx5htkt1V0EQ8ctqIuPyYgmT8dxHpRyXQOuyYqLc YdAU6Qgty8i9+pbW5h5ectXcEpPNtP3SN23m7hJEfWvE9CaK/h2GnjWxjSG4RALdoGhlsRbsgJnCD JxOf50ZIVWbLEqo5O3og==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pezQN-00GHsA-06; Wed, 22 Mar 2023 14:26:47 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pezQ9-00GHnb-2G for linux-arm-kernel@lists.infradead.org; Wed, 22 Mar 2023 14:26:36 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3A8D26214F; Wed, 22 Mar 2023 14:26:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7698FC433D2; Wed, 22 Mar 2023 14:26:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1679495192; bh=QfbAXXI8CQI4lKeH2ucjox+6Wzik8ACTtzOT/sXNRwQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iDbYhSImC9a0nsH65/zc0A6t29bRZd2JJ1KYb21KsafZqdgPSSNurErharQcB6YSW UggTESqGQ/Y2qvyEGYZgRGWeHmZBTLXSdy9hf3D2zLUjejiTBEa3NzC88gVc4LTiTS YetvKNwf+2ZZrnXRWjxfqfqZn/1vN3RjFodNufZBV4p7zGXa3AnjmAayJaYbBhY7Pi 3CvjFzClnxUbzsFHyYW5A615QWKbbiAAC3nxltkNyCWehSUIN7gwlZoAQ1oijc46OM SOVtJwBvw+o9D6xEJFSNzh7PI9h+hQ2wMvEE2giwzilUlvuyRsbpfoDZpK0x51PCtJ +0d2JoI/1Xdpg== From: Ard Biesheuvel To: linux-efi@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, Ard Biesheuvel , Darren Hart , Andrea Righi Subject: [PATCH 2/3] arm64: efi: Use SMBIOS processor version to key off Ampere quirk Date: Wed, 22 Mar 2023 15:26:20 +0100 Message-Id: <20230322142621.3685058-3-ardb@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230322142621.3685058-1-ardb@kernel.org> References: <20230322142621.3685058-1-ardb@kernel.org> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=5710; i=ardb@kernel.org; h=from:subject; bh=QfbAXXI8CQI4lKeH2ucjox+6Wzik8ACTtzOT/sXNRwQ=; b=owGbwMvMwCFmkMcZplerG8N4Wi2JIUVagCdgrY3r3Ts7DSeW2V6TPevQrzRXo9msUn8Dgyf/m y/TPfd0lLIwiHEwyIopsgjM/vtu5+mJUrXOs2Rh5rAygQxh4OIUgInUVDAyXChS2eH5JH1FPA/H NpY7vE8le+wUFk/a84G/+UKvhcPn6YwMD95V21r/FnpsMGO7z7HX2x+ZPF2XkedsvtXFy7GwcZU pMwA= X-Developer-Key: i=ardb@kernel.org; a=openpgp; fpr=F43D03328115A198C90016883D200E9CA6329909 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230322_072633_817051_A00F076D X-CRM114-Status: GOOD ( 18.61 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Instead of using the SMBIOS type 1 record 'family' field, which is often modified by OEMs, use the type 4 'processor ID' and 'processor version' fields, which are set to a small set of probe-able values on all known Ampere EFI systems in the field. Fixes: 550b33cfd4452968 ("arm64: efi: Force the use of ...") Tested-by: Andrea Righi Signed-off-by: Ard Biesheuvel --- drivers/firmware/efi/libstub/arm64.c | 39 +++++++++++++++---- drivers/firmware/efi/libstub/efistub.h | 41 ++++++++++++++++++-- drivers/firmware/efi/libstub/smbios.c | 13 ++++++- 3 files changed, 80 insertions(+), 13 deletions(-) diff --git a/drivers/firmware/efi/libstub/arm64.c b/drivers/firmware/efi/libstub/arm64.c index 3997702663727e30..8aad8c49d43f18e0 100644 --- a/drivers/firmware/efi/libstub/arm64.c +++ b/drivers/firmware/efi/libstub/arm64.c @@ -16,20 +16,43 @@ static bool system_needs_vamap(void) { - const u8 *type1_family = efi_get_smbios_string(1, family); + const struct efi_smbios_type4_record *record; + const u32 __aligned(1) *socid; + const u8 *version; /* * Ampere eMAG, Altra, and Altra Max machines crash in SetTime() if - * SetVirtualAddressMap() has not been called prior. + * SetVirtualAddressMap() has not been called prior. Most Altra systems + * can be identified by the SMCCC soc ID, which is conveniently exposed + * via the type 4 SMBIOS records. Otherwise, test the processor version + * field. eMAG systems all appear to have the processor version field + * set to "eMAG". */ - if (!type1_family || ( - strcmp(type1_family, "eMAG") && - strcmp(type1_family, "Altra") && - strcmp(type1_family, "Altra Max"))) + record = (struct efi_smbios_type4_record *)efi_get_smbios_record(4); + if (!record) return false; - efi_warn("Working around broken SetVirtualAddressMap()\n"); - return true; + socid = (u32 *)record->processor_id; + switch (*socid & 0xffff000f) { + static char const altra[] = "Ampere(TM) Altra(TM) Processor"; + static char const emag[] = "eMAG"; + + default: + version = efi_get_smbios_string(&record->header, 4, + processor_version); + if (!version || (strncmp(version, altra, sizeof(altra) - 1) && + strncmp(version, emag, sizeof(emag) - 1))) + break; + + fallthrough; + + case 0x0a160001: // Altra + case 0x0a160002: // Altra Max + efi_warn("Working around broken SetVirtualAddressMap()\n"); + return true; + } + + return false; } efi_status_t check_platform_features(void) diff --git a/drivers/firmware/efi/libstub/efistub.h b/drivers/firmware/efi/libstub/efistub.h index 6bd3bb86d9679a1c..330565b9263a6b01 100644 --- a/drivers/firmware/efi/libstub/efistub.h +++ b/drivers/firmware/efi/libstub/efistub.h @@ -1074,6 +1074,8 @@ struct efi_smbios_record { u16 handle; }; +const struct efi_smbios_record *efi_get_smbios_record(u8 type); + struct efi_smbios_type1_record { struct efi_smbios_record header; @@ -1087,14 +1089,47 @@ struct efi_smbios_type1_record { u8 family; }; -#define efi_get_smbios_string(__type, __name) ({ \ +struct efi_smbios_type4_record { + struct efi_smbios_record header; + + u8 socket; + u8 processor_type; + u8 processor_family; + u8 processor_manufacturer; + u8 processor_id[8]; + u8 processor_version; + u8 voltage; + u16 external_clock; + u16 max_speed; + u16 current_speed; + u8 status; + u8 processor_upgrade; + u16 l1_cache_handle; + u16 l2_cache_handle; + u16 l3_cache_handle; + u8 serial_number; + u8 asset_tag; + u8 part_number; + u8 core_count; + u8 enabled_core_count; + u8 thread_count; + u16 processor_characteristics; + u16 processor_family2; + u16 core_count2; + u16 enabled_core_count2; + u16 thread_count2; + u16 thread_enabled; +}; + +#define efi_get_smbios_string(__record, __type, __name) ({ \ int size = sizeof(struct efi_smbios_type ## __type ## _record); \ int off = offsetof(struct efi_smbios_type ## __type ## _record, \ __name); \ - __efi_get_smbios_string(__type, off, size); \ + __efi_get_smbios_string((__record), __type, off, size); \ }) -const u8 *__efi_get_smbios_string(u8 type, int offset, int recsize); +const u8 *__efi_get_smbios_string(const struct efi_smbios_record *record, + u8 type, int offset, int recsize); void efi_remap_image(unsigned long image_base, unsigned alloc_size, unsigned long code_size); diff --git a/drivers/firmware/efi/libstub/smbios.c b/drivers/firmware/efi/libstub/smbios.c index aadb422b9637dfc0..f9c159c28f4613f8 100644 --- a/drivers/firmware/efi/libstub/smbios.c +++ b/drivers/firmware/efi/libstub/smbios.c @@ -22,19 +22,28 @@ struct efi_smbios_protocol { u8 minor_version; }; -const u8 *__efi_get_smbios_string(u8 type, int offset, int recsize) +const struct efi_smbios_record *efi_get_smbios_record(u8 type) { struct efi_smbios_record *record; efi_smbios_protocol_t *smbios; efi_status_t status; u16 handle = 0xfffe; - const u8 *strtable; status = efi_bs_call(locate_protocol, &EFI_SMBIOS_PROTOCOL_GUID, NULL, (void **)&smbios) ?: efi_call_proto(smbios, get_next, &handle, &type, &record, NULL); if (status != EFI_SUCCESS) return NULL; + return record; +} + +const u8 *__efi_get_smbios_string(const struct efi_smbios_record *record, + u8 type, int offset, int recsize) +{ + const u8 *strtable; + + if (!record) + return NULL; strtable = (u8 *)record + record->length; for (int i = 1; i < ((u8 *)record)[offset]; i++) { From patchwork Wed Mar 22 14:26:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 13184163 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 D5240C6FD1F for ; Wed, 22 Mar 2023 14:27:32 +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:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=cJbBCd7H0cEFCjrznuH/UeV5CZlosATCnTMlR2gpwmE=; b=Lq6sSiddscRmyk /q9z2XjA0CuunyKpxSKGrjDn2P06b6HJ66C3gQ5WUcUJfWXJtv3YFuNITM2nbK99YsFfq8LIj7qTS tdo2WEc/+6S5AICFUvJi62hS4ZxKjoQ9PhvIv1mjaYpIzG0PyCnMVMc0Vy8MIk2vzCKdY1vMecRh7 e7X+G1mWGNl2dlLp2yMB6dIn2ohJjGfMWt071cspMoYYh2JQIUlfO5bKjfR/M0TF9/5jIhmSeakuO 0HRI0KXayVjav17aU0MC0O+XPxyokACRlFtLBGZsvRPQM/t66RMZXOE8oBfugnpgxYEurYdXR0CTS tT58w8NPB5IGGdX5brJQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pezQO-00GHsv-1X; Wed, 22 Mar 2023 14:26:48 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pezQB-00GHoT-0i for linux-arm-kernel@lists.infradead.org; Wed, 22 Mar 2023 14:26:39 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id CED3662152; Wed, 22 Mar 2023 14:26:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 16655C4339B; Wed, 22 Mar 2023 14:26:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1679495194; bh=6MMyawK3cuIV7u8JeTYNZqikb/f8vmsPIr1K+3RBRFg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Z72X9xlk4EjMWDlKIxQ4vWUXJ/1DffqbFdJnm1cblCGuojcGuhDi2oms3g1ltElJC kHqAO4A2hPndgLVgP6bjoqnEiFvzShJFkEpFr3ZYZ+vEug8WeC7lkeXGshKuYgATTh 5/Aw4Fj2Y1fDH8czqFFNu7+VV9IieJMr5nMyX7UKHsCJ42IP+NHb1XJm7jAIFe5do5 mazkflleRh6pvL597lL7A/ew843BinCNTQkBuHiqQ59sfMGgF2fXrgH3M5RffltR1Y 4wI8zMig7xBWF6TX2XgNo43ANUSQBOBJmtOPbE1oqtSujDVix+/q0HxGXPJxV4filL N4r0grBNklIRg== From: Ard Biesheuvel To: linux-efi@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, Ard Biesheuvel , Darren Hart , Andrea Righi Subject: [PATCH 3/3] efi/libstub: smbios: Drop unused 'recsize' parameter Date: Wed, 22 Mar 2023 15:26:21 +0100 Message-Id: <20230322142621.3685058-4-ardb@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230322142621.3685058-1-ardb@kernel.org> References: <20230322142621.3685058-1-ardb@kernel.org> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1759; i=ardb@kernel.org; h=from:subject; bh=6MMyawK3cuIV7u8JeTYNZqikb/f8vmsPIr1K+3RBRFg=; b=owGbwMvMwCFmkMcZplerG8N4Wi2JIUVagNdnz6RVvJeW5QU9cU8LOp/CcntS4a1NK/x27O58m B98U/d7RykLgxgHg6yYIovA7L/vdp6eKFXrPEsWZg4rE8gQBi5OAZjIPEGG/xmXE/YsMGw2f7D4 1w/9lifKhSvc9tvNF4xZzbg8y3j/7gsM/9MCOvQmPpi97z3bC93aoOYU7U9Lixvct4o/LRF+vnh 5Ph8A X-Developer-Key: i=ardb@kernel.org; a=openpgp; fpr=F43D03328115A198C90016883D200E9CA6329909 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230322_072635_340273_6EF92FB7 X-CRM114-Status: GOOD ( 12.67 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org We no longer use the recsize argument for locating the string table in an SMBIOS record, so we can drop it from the internal API. Signed-off-by: Ard Biesheuvel --- drivers/firmware/efi/libstub/efistub.h | 5 ++--- drivers/firmware/efi/libstub/smbios.c | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/firmware/efi/libstub/efistub.h b/drivers/firmware/efi/libstub/efistub.h index 330565b9263a6b01..bd9c38a93bbce09c 100644 --- a/drivers/firmware/efi/libstub/efistub.h +++ b/drivers/firmware/efi/libstub/efistub.h @@ -1122,14 +1122,13 @@ struct efi_smbios_type4_record { }; #define efi_get_smbios_string(__record, __type, __name) ({ \ - int size = sizeof(struct efi_smbios_type ## __type ## _record); \ int off = offsetof(struct efi_smbios_type ## __type ## _record, \ __name); \ - __efi_get_smbios_string((__record), __type, off, size); \ + __efi_get_smbios_string((__record), __type, off); \ }) const u8 *__efi_get_smbios_string(const struct efi_smbios_record *record, - u8 type, int offset, int recsize); + u8 type, int offset); void efi_remap_image(unsigned long image_base, unsigned alloc_size, unsigned long code_size); diff --git a/drivers/firmware/efi/libstub/smbios.c b/drivers/firmware/efi/libstub/smbios.c index f9c159c28f4613f8..c217de2cc8d56dc2 100644 --- a/drivers/firmware/efi/libstub/smbios.c +++ b/drivers/firmware/efi/libstub/smbios.c @@ -38,7 +38,7 @@ const struct efi_smbios_record *efi_get_smbios_record(u8 type) } const u8 *__efi_get_smbios_string(const struct efi_smbios_record *record, - u8 type, int offset, int recsize) + u8 type, int offset) { const u8 *strtable;