* [PATCH v2] riscv: dmi: Add SMBIOS/DMI support
@ 2024-03-18 2:09 Haibo Xu
2024-03-19 17:14 ` Ard Biesheuvel
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Haibo Xu @ 2024-03-18 2:09 UTC (permalink / raw)
To: linux-kernel, linux-riscv, linux-efi
Cc: paul.walmsley, palmer, aou, ardb, sunilvl, xiaobo55x, Haibo Xu
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@intel.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);
--
2.34.1
^ permalink raw reply related [flat|nested] 8+ messages in thread* Re: [PATCH v2] riscv: dmi: Add SMBIOS/DMI support
2024-03-18 2:09 [PATCH v2] riscv: dmi: Add SMBIOS/DMI support Haibo Xu
@ 2024-03-19 17:14 ` Ard Biesheuvel
2024-03-19 19:46 ` Atish Patra
2024-06-27 17:50 ` patchwork-bot+linux-riscv
2 siblings, 0 replies; 8+ messages in thread
From: Ard Biesheuvel @ 2024-03-19 17:14 UTC (permalink / raw)
To: Haibo Xu
Cc: linux-kernel, linux-riscv, linux-efi, paul.walmsley, palmer, aou,
sunilvl, xiaobo55x
On Mon, 18 Mar 2024 at 02:55, Haibo Xu <haibo1.xu@intel.com> 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@intel.com>
Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
> ---
> 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);
> --
> 2.34.1
>
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [PATCH v2] riscv: dmi: Add SMBIOS/DMI support
2024-03-18 2:09 [PATCH v2] riscv: dmi: Add SMBIOS/DMI support Haibo Xu
2024-03-19 17:14 ` Ard Biesheuvel
@ 2024-03-19 19:46 ` Atish Patra
2024-04-29 14:22 ` Haibo Xu
2024-06-27 17:50 ` patchwork-bot+linux-riscv
2 siblings, 1 reply; 8+ messages in thread
From: Atish Patra @ 2024-03-19 19:46 UTC (permalink / raw)
To: Haibo Xu, linux-kernel, linux-riscv, linux-efi
Cc: aou, palmer, paul.walmsley, xiaobo55x, ardb
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@intel.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@rivosinc.com>
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [PATCH v2] riscv: dmi: Add SMBIOS/DMI support
2024-03-19 19:46 ` Atish Patra
@ 2024-04-29 14:22 ` Haibo Xu
2024-05-26 9:17 ` Haibo Xu
0 siblings, 1 reply; 8+ messages in thread
From: Haibo Xu @ 2024-04-29 14:22 UTC (permalink / raw)
To: Atish Patra
Cc: Haibo Xu, linux-kernel, linux-riscv, linux-efi, aou, palmer,
paul.walmsley, ardb
Hi @Palmer,
Could you please let me know whether this patch was OK for the next RISC-V PULL?
Thanks,
Haibo
On Wed, Mar 20, 2024 at 3:46 AM Atish Patra <atishp@rivosinc.com> wrote:
>
> 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@intel.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@rivosinc.com>
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [PATCH v2] riscv: dmi: Add SMBIOS/DMI support
2024-04-29 14:22 ` Haibo Xu
@ 2024-05-26 9:17 ` Haibo Xu
2024-06-26 15:03 ` Palmer Dabbelt
0 siblings, 1 reply; 8+ messages in thread
From: Haibo Xu @ 2024-05-26 9:17 UTC (permalink / raw)
To: Atish Patra
Cc: Haibo Xu, linux-kernel, linux-riscv, linux-efi, aou, palmer,
paul.walmsley, ardb
kindly ping!
Any more comments on this patch?
Thanks,
Haibo
On Mon, Apr 29, 2024 at 10:22 PM Haibo Xu <xiaobo55x@gmail.com> wrote:
>
> Hi @Palmer,
>
> Could you please let me know whether this patch was OK for the next RISC-V PULL?
>
> Thanks,
> Haibo
>
> On Wed, Mar 20, 2024 at 3:46 AM Atish Patra <atishp@rivosinc.com> wrote:
> >
> > 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@intel.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@rivosinc.com>
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [PATCH v2] riscv: dmi: Add SMBIOS/DMI support
2024-05-26 9:17 ` Haibo Xu
@ 2024-06-26 15:03 ` Palmer Dabbelt
2024-06-26 15:46 ` Haibo Xu
0 siblings, 1 reply; 8+ messages in thread
From: Palmer Dabbelt @ 2024-06-26 15:03 UTC (permalink / raw)
To: xiaobo55x
Cc: Atish Patra, haibo1.xu, linux-kernel, linux-riscv, linux-efi, aou,
Paul Walmsley, Ard Biesheuvel
On Sun, 26 May 2024 02:17:40 PDT (-0700), xiaobo55x@gmail.com wrote:
> kindly ping!
>
> Any more comments on this patch?
Sorry I dropped the ball on this one, it's queued up for staging and
should show up on for-next assuming it passes the tests.
>
> Thanks,
> Haibo
>
> On Mon, Apr 29, 2024 at 10:22 PM Haibo Xu <xiaobo55x@gmail.com> wrote:
>>
>> Hi @Palmer,
>>
>> Could you please let me know whether this patch was OK for the next RISC-V PULL?
>>
>> Thanks,
>> Haibo
>>
>> On Wed, Mar 20, 2024 at 3:46 AM Atish Patra <atishp@rivosinc.com> wrote:
>> >
>> > 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@intel.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@rivosinc.com>
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [PATCH v2] riscv: dmi: Add SMBIOS/DMI support
2024-06-26 15:03 ` Palmer Dabbelt
@ 2024-06-26 15:46 ` Haibo Xu
0 siblings, 0 replies; 8+ messages in thread
From: Haibo Xu @ 2024-06-26 15:46 UTC (permalink / raw)
To: Palmer Dabbelt
Cc: Atish Patra, haibo1.xu, linux-kernel, linux-riscv, linux-efi, aou,
Paul Walmsley, Ard Biesheuvel
On Wed, Jun 26, 2024 at 11:03 PM Palmer Dabbelt <palmer@dabbelt.com> wrote:
>
> On Sun, 26 May 2024 02:17:40 PDT (-0700), xiaobo55x@gmail.com wrote:
> > kindly ping!
> >
> > Any more comments on this patch?
>
> Sorry I dropped the ball on this one, it's queued up for staging and
> should show up on for-next assuming it passes the tests.
>
Thanks!
> >
> > Thanks,
> > Haibo
> >
> > On Mon, Apr 29, 2024 at 10:22 PM Haibo Xu <xiaobo55x@gmail.com> wrote:
> >>
> >> Hi @Palmer,
> >>
> >> Could you please let me know whether this patch was OK for the next RISC-V PULL?
> >>
> >> Thanks,
> >> Haibo
> >>
> >> On Wed, Mar 20, 2024 at 3:46 AM Atish Patra <atishp@rivosinc.com> wrote:
> >> >
> >> > 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@intel.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@rivosinc.com>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2] riscv: dmi: Add SMBIOS/DMI support
2024-03-18 2:09 [PATCH v2] riscv: dmi: Add SMBIOS/DMI support Haibo Xu
2024-03-19 17:14 ` Ard Biesheuvel
2024-03-19 19:46 ` Atish Patra
@ 2024-06-27 17:50 ` patchwork-bot+linux-riscv
2 siblings, 0 replies; 8+ messages in thread
From: patchwork-bot+linux-riscv @ 2024-06-27 17:50 UTC (permalink / raw)
To: Haibo Xu
Cc: linux-riscv, linux-kernel, linux-efi, aou, palmer, paul.walmsley,
xiaobo55x, ardb
Hello:
This patch was applied to riscv/linux.git (for-next)
by Palmer Dabbelt <palmer@rivosinc.com>:
On Mon, 18 Mar 2024 10:09:16 +0800 you 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@intel.com>
>
> [...]
Here is the summary with links:
- [v2] riscv: dmi: Add SMBIOS/DMI support
https://git.kernel.org/riscv/c/d6ecd188937f
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2024-06-27 17:50 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-18 2:09 [PATCH v2] riscv: dmi: Add SMBIOS/DMI support Haibo Xu
2024-03-19 17:14 ` Ard Biesheuvel
2024-03-19 19:46 ` Atish Patra
2024-04-29 14:22 ` Haibo Xu
2024-05-26 9:17 ` Haibo Xu
2024-06-26 15:03 ` Palmer Dabbelt
2024-06-26 15:46 ` Haibo Xu
2024-06-27 17:50 ` patchwork-bot+linux-riscv
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).