lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <7d69fac0-4cd1-4db6-b19f-fb5a418549ab@rivosinc.com>
Date: Tue, 19 Mar 2024 12:46:20 -0700
From: Atish Patra <atishp@...osinc.com>
To: Haibo Xu <haibo1.xu@...el.com>, linux-kernel@...r.kernel.org,
 linux-riscv@...ts.infradead.org, linux-efi@...r.kernel.org
Cc: aou@...s.berkeley.edu, palmer@...belt.com, paul.walmsley@...ive.com,
 xiaobo55x@...il.com, ardb@...nel.org
Subject: Re: [PATCH v2] riscv: dmi: Add SMBIOS/DMI support

On 3/17/24 19:09, Haibo Xu wrote:
> Enable the dmi driver for riscv which would allow access the
> SMBIOS info through some userspace file(/sys/firmware/dmi/*).
> 
> The change was based on that of arm64 and has been verified
> by dmidecode tool.
> 
> Signed-off-by: Haibo Xu <haibo1.xu@...el.com>
> ---
> Changes since v1
>    - Change to use memremap/memunmap for dmi_(early)_remap/unmap
>      definition(suggested by Ard)
>    - Minor clean up for comments (Ard)
> ---
>   arch/riscv/Kconfig                   | 11 +++++++++++
>   arch/riscv/include/asm/dmi.h         | 24 ++++++++++++++++++++++++
>   drivers/firmware/efi/riscv-runtime.c | 13 +++++++++++++
>   3 files changed, 48 insertions(+)
>   create mode 100644 arch/riscv/include/asm/dmi.h
> 
> diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
> index 8ebafe337eac..3639151cb4ef 100644
> --- a/arch/riscv/Kconfig
> +++ b/arch/riscv/Kconfig
> @@ -952,6 +952,17 @@ config EFI
>   	  allow the kernel to be booted as an EFI application. This
>   	  is only useful on systems that have UEFI firmware.
>   
> +config DMI
> +	bool "Enable support for SMBIOS (DMI) tables"
> +	depends on EFI
> +	default y
> +	help
> +	  This enables SMBIOS/DMI feature for systems.
> +
> +	  This option is only useful on systems that have UEFI firmware.
> +	  However, even with this option, the resultant kernel should
> +	  continue to boot on existing non-UEFI platforms.
> +
>   config CC_HAVE_STACKPROTECTOR_TLS
>   	def_bool $(cc-option,-mstack-protector-guard=tls -mstack-protector-guard-reg=tp -mstack-protector-guard-offset=0)
>   
> diff --git a/arch/riscv/include/asm/dmi.h b/arch/riscv/include/asm/dmi.h
> new file mode 100644
> index 000000000000..ca7cce557ef7
> --- /dev/null
> +++ b/arch/riscv/include/asm/dmi.h
> @@ -0,0 +1,24 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
> +/*
> + * Copyright (C) 2024 Intel Corporation
> + *
> + * based on arch/arm64/include/asm/dmi.h
> + *
> + * This file is subject to the terms and conditions of the GNU General Public
> + * License.  See the file "COPYING" in the main directory of this archive
> + * for more details.
> + */
> +
> +#ifndef __ASM_DMI_H
> +#define __ASM_DMI_H
> +
> +#include <linux/io.h>
> +#include <linux/slab.h>
> +
> +#define dmi_early_remap(x, l)		memremap(x, l, MEMREMAP_WB)
> +#define dmi_early_unmap(x, l)		memunmap(x)
> +#define dmi_remap(x, l)			memremap(x, l, MEMREMAP_WB)
> +#define dmi_unmap(x)			memunmap(x)
> +#define dmi_alloc(l)			kzalloc(l, GFP_KERNEL)
> +
> +#endif
> diff --git a/drivers/firmware/efi/riscv-runtime.c b/drivers/firmware/efi/riscv-runtime.c
> index 09525fb5c240..c3bfb9e77e02 100644
> --- a/drivers/firmware/efi/riscv-runtime.c
> +++ b/drivers/firmware/efi/riscv-runtime.c
> @@ -152,3 +152,16 @@ void arch_efi_call_virt_teardown(void)
>   {
>   	efi_virtmap_unload();
>   }
> +
> +static int __init riscv_dmi_init(void)
> +{
> +	/*
> +	 * On riscv, DMI depends on UEFI, and dmi_setup() needs to
> +	 * be called early because dmi_id_init(), which is an arch_initcall
> +	 * itself, depends on dmi_scan_machine() having been called already.
> +	 */
> +	dmi_setup();
> +
> +	return 0;
> +}
> +core_initcall(riscv_dmi_init);

Reviewed-by: Atish Patra <atishp@...osinc.com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ