From patchwork Wed Jul 5 11:42:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: yunhui cui X-Patchwork-Id: 116082 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f45:0:b0:3ea:f831:8777 with SMTP id v5csp1808232vqx; Wed, 5 Jul 2023 04:52:30 -0700 (PDT) X-Google-Smtp-Source: APBJJlGOfuA/5vII1ZkREvl9ZCI3NvFlpBlMym7YdJ132vyG3rAgBCdBOVX2QDV6G2WaUBzz5eyo X-Received: by 2002:a54:4f08:0:b0:3a3:d153:2723 with SMTP id e8-20020a544f08000000b003a3d1532723mr1454828oiy.29.1688557949751; Wed, 05 Jul 2023 04:52:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688557949; cv=none; d=google.com; s=arc-20160816; b=tev0uVRlwLL/qvxw41xxZRkrgVZcFQ8W/7zbeykXakRIO58tq0XWpbnGFTpXcTKtpw uRK8DdVpLXavxZ9mOvlFsjUHkFSXYv9UGzLLjRiOxfi2KaqU+anNdklIxc54sDFUQmih v7FMrejIvnAGnTKheDwDmjbn5qTho6u6xjGwYOjvYl5Nm4fVOMQQFk82crB2ctdgE9xp fNnhAIf7Xx/Pq261fATXL1syUxoxk2UnidVengqwKhqFqQS0VGj/u5FbAGOjNmhU3Vzp Nja6Bvide4TkwgIE4TWPg8vX8zCfF565wW3mT7LTXECPIMkRxGp88tQXhTUK8Dm3Zwjq UwQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=t2wHvvnZ9EXs4kZ7PH7ZQmrp8wDzjYqwhR8Lb7Z2dm0=; fh=bqWELtRSt3/Ye92QuI4S5cnDBo/muTnlio5y+l0Kv5A=; b=Cgm6O6XySMNjmnmynf4sPDrDoiV5nDpt8kSy6A7d3pQXWnsismnz/qgH9RkXGPmSX/ 6pUXNOhp3il2d9ZdT5r6wmDbE/TmlI25PY9bYDFot32lGJa2BDmvijG7dUU5XGbaLY2B mgp0z/o51ooHC3Gzd+uG757Cr7FoUURpSX0wbynmRmVzCsFSt3Jaf31SEvmR1nIZEZoU hzwXDgMTadAwY2o8vWqlg+ippiKsxxgrbIiBMv4ZNGdz9GMo2wX7MakGJe/oyZut8sff qOTbekXHjyQtdi5p3kOqNHO+Esq0JzqGhbYdbl4ALW1+COrynui5vrGTqBxYZhCCOP8o aRJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance.com header.s=google header.b=jVG4zai1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=bytedance.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j22-20020a17090aeb1600b00262ad7b2341si1460878pjz.127.2023.07.05.04.52.14; Wed, 05 Jul 2023 04:52:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@bytedance.com header.s=google header.b=jVG4zai1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=bytedance.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231535AbjGELpO (ORCPT + 99 others); Wed, 5 Jul 2023 07:45:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48120 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231177AbjGELpL (ORCPT ); Wed, 5 Jul 2023 07:45:11 -0400 Received: from mail-oi1-x233.google.com (mail-oi1-x233.google.com [IPv6:2607:f8b0:4864:20::233]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 39A39172D for ; Wed, 5 Jul 2023 04:44:46 -0700 (PDT) Received: by mail-oi1-x233.google.com with SMTP id 5614622812f47-3942c6584f0so4537431b6e.3 for ; Wed, 05 Jul 2023 04:44:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1688557485; x=1691149485; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=t2wHvvnZ9EXs4kZ7PH7ZQmrp8wDzjYqwhR8Lb7Z2dm0=; b=jVG4zai1xG7MtgnncuyhuPAqUUpjFnE9G3irewRE18y6iFyE/sSIGF23/BN9GqjedI zyE5d5WvPIsC2FoCMXz6YBxr+JP9d4N15NZq5ymkBEZQ9f5R/eqSfpU/6bJ9wyhWX0GY CZn7coRHhPZm1IRexWWv9LxGNpN/kk927lkfVslnarGWO0nM7CTFWJ6ITIo3KHTUnDnf FykR8jIUlH6tBDEJwoMXPppRQhPKve5atGYBKA4SFBp23WeY7rXeoIGbL2Lfb9ToKbu8 gEhKKIYhaaWc9JldVwFllp+Ar8BmfPkSiuuXdmcH5Dd5lugkgvKVkJ8u7MiK/YyWjCVd zxew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688557485; x=1691149485; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=t2wHvvnZ9EXs4kZ7PH7ZQmrp8wDzjYqwhR8Lb7Z2dm0=; b=lOxLoijUhIDQzwxq3gx+E1QQnxy5IAkFP4WjIhakDIRsaQ6vNNOQfJTMFjHmOFNBDq eNM2wqsLQ6r2ULpWX4Iw8apuus613y82w/xSYyIO9xHVlLB/35cueAFfodryCbCfk57K HfkeomG7Lwz4YBgjhyO0/+Kkli+KkHO+VVPSyKwwkNbmdZTn4FUSX7Cc0NqofAAXSYBE vB1D7XWkSHymWkFcSc5v1o6MAMh/ltZRwo42PGMEah90sDuGaJo1fGvqTzQ0aSETywkx EEYEulJQ+2F6AK2smUpHO0Cm1xVrNTceN+KSEF3XvOtjNwZuI+nVBfNU+jgw8b037M/V ORHA== X-Gm-Message-State: AC+VfDy4N0v0x1WseaoLnpLRjwMmvd+1xjG+nh5z/7Njox4VXr0k9Hk4 I66n4lEhBWukWep4skqUwe8TSA== X-Received: by 2002:a05:6808:197:b0:39e:ffc5:c450 with SMTP id w23-20020a056808019700b0039effc5c450mr15121527oic.47.1688557485518; Wed, 05 Jul 2023 04:44:45 -0700 (PDT) Received: from PF2E59YH-BKX.inc.bytedance.com ([61.213.176.5]) by smtp.gmail.com with ESMTPSA id 3-20020a17090a194300b00263f6687690sm1177900pjh.18.2023.07.05.04.44.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jul 2023 04:44:45 -0700 (PDT) From: Yunhui Cui To: conor@kernel.org, sunilvl@ventanamicro.com, ardb@kernel.org, palmer@dabbelt.com, paul.walmsley@sifive.com, aou@eecs.berkeley.edu, linux-riscv@lists.infradead.org, rminnich@gmail.com, mark.rutland@arm.com, lpieralisi@kernel.org, rafael@kernel.org, lenb@kernel.org, jdelvare@suse.com, yc.hung@mediatek.com, angelogioacchino.delregno@collabora.com, allen-kh.cheng@mediatek.com, pierre-louis.bossart@linux.intel.com, tinghan.shen@mediatek.com, linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, geshijian@bytedance.com, weidong.wd@bytedance.com, cuiyunhui@bytedance.com Subject: [PATCH v3 1/4] riscv: obtain ACPI RSDP from devicetree Date: Wed, 5 Jul 2023 19:42:48 +0800 Message-Id: <20230705114251.661-2-cuiyunhui@bytedance.com> X-Mailer: git-send-email 2.37.3.windows.1 In-Reply-To: <20230705114251.661-1-cuiyunhui@bytedance.com> References: <20230705114251.661-1-cuiyunhui@bytedance.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1770581340524182345?= X-GMAIL-MSGID: =?utf-8?q?1770581340524182345?= On RISC-V, Coreboot does not support booting using EFI, only devicetree nor does RISC-V have a reserved address segment. To allow using Coreboot on platforms that require ACPI, the ACPI RSDP needs to be passed to supervisor mode software using devicetree. Add support for parsing the "ffitbl" devicetree node to find the ACPI entry point and use wire up acpi_arch_get_root_pointer(). This feature is known as FDT Firmware Interface (FFI). Signed-off-by: Yunhui Cui --- MAINTAINERS | 6 ++++++ arch/riscv/include/asm/acpi.h | 9 +++++++++ arch/riscv/include/asm/ffi.h | 14 +++++++++++++ arch/riscv/kernel/Makefile | 1 + arch/riscv/kernel/ffi.c | 38 +++++++++++++++++++++++++++++++++++ arch/riscv/kernel/setup.c | 2 ++ 6 files changed, 70 insertions(+) create mode 100644 arch/riscv/include/asm/ffi.h create mode 100644 arch/riscv/kernel/ffi.c diff --git a/MAINTAINERS b/MAINTAINERS index cd5388a33410..e592f489e757 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -18363,6 +18363,12 @@ F: arch/riscv/boot/dts/ X: arch/riscv/boot/dts/allwinner/ X: arch/riscv/boot/dts/renesas/ +RISC-V FDT FIRMWARE INTERFACE (FFI) SUPPORT +M: Yunhui Cui cuiyunhui@bytedance.com +S: Maintained +F: arch/riscv/include/asm/ffi.h +F: arch/riscv/kernel/ffi.c + RISC-V PMU DRIVERS M: Atish Patra R: Anup Patel diff --git a/arch/riscv/include/asm/acpi.h b/arch/riscv/include/asm/acpi.h index f71ce21ff684..5574f9a152f5 100644 --- a/arch/riscv/include/asm/acpi.h +++ b/arch/riscv/include/asm/acpi.h @@ -15,6 +15,8 @@ /* Basic configuration for ACPI */ #ifdef CONFIG_ACPI +#include + typedef u64 phys_cpuid_t; #define PHYS_CPUID_INVALID INVALID_HARTID @@ -66,6 +68,13 @@ int acpi_get_riscv_isa(struct acpi_table_header *table, unsigned int cpu, const char **isa); static inline int acpi_numa_get_nid(unsigned int cpu) { return NUMA_NO_NODE; } + +#define ACPI_HAVE_ARCH_GET_ROOT_POINTER +static inline u64 acpi_arch_get_root_pointer(void) +{ + return riscv_acpi_rsdp(); +} + #else static inline void acpi_init_rintc_map(void) { } static inline struct acpi_madt_rintc *acpi_cpu_get_madt_rintc(int cpu) diff --git a/arch/riscv/include/asm/ffi.h b/arch/riscv/include/asm/ffi.h new file mode 100644 index 000000000000..d5e8309cc06f --- /dev/null +++ b/arch/riscv/include/asm/ffi.h @@ -0,0 +1,14 @@ +/* SPDX-License-Identifier: GPL-2.0 */ + +#ifndef _ASM_FFI_H +#define _ASM_FFI_H + +#ifdef CONFIG_FDT_FW_INTERFACE +extern void ffi_init(void); +extern u64 riscv_acpi_rsdp(void); +#else +#define ffi_init() +static inline u64 riscv_acpi_rsdp(void) { return 0; } +#endif + +#endif /* _ASM_FFI_H */ diff --git a/arch/riscv/kernel/Makefile b/arch/riscv/kernel/Makefile index 506cc4a9a45a..71831cf7f934 100644 --- a/arch/riscv/kernel/Makefile +++ b/arch/riscv/kernel/Makefile @@ -92,6 +92,7 @@ obj-$(CONFIG_CRASH_CORE) += crash_core.o obj-$(CONFIG_JUMP_LABEL) += jump_label.o obj-$(CONFIG_EFI) += efi.o +obj-$(CONFIG_FDT_FW_INTERFACE) += ffi.o obj-$(CONFIG_COMPAT) += compat_syscall_table.o obj-$(CONFIG_COMPAT) += compat_signal.o obj-$(CONFIG_COMPAT) += compat_vdso/ diff --git a/arch/riscv/kernel/ffi.c b/arch/riscv/kernel/ffi.c new file mode 100644 index 000000000000..147d06a5acff --- /dev/null +++ b/arch/riscv/kernel/ffi.c @@ -0,0 +1,38 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * ffi.c - FDT FIRMWARE INTERFACE + */ + +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + +#include +#include +#include + +static u64 acpi_rsdp; + +void __init ffi_acpi_root_pointer(void) +{ + u32 ffitbl, acpi, len; + fdt64_t *prop; + + ffitbl = fdt_subnode_offset(initial_boot_params, 0, "ffitbl"); + acpi = fdt_subnode_offset(initial_boot_params, ffitbl, "acpi"); + prop = fdt_getprop_w(initial_boot_params, acpi, "entry", &len); + if (!prop || len != sizeof(u64)) { + pr_debug("acpi rsdp not found.\n"); + return; + } + acpi_rsdp = fdt64_to_cpu(*prop); + pr_debug("acpi rsdp: %llx\n", acpi_rsdp); +} + +u64 __init riscv_acpi_rsdp(void) +{ + return acpi_rsdp; +} + +void __init ffi_init(void) +{ + ffi_acpi_root_pointer(); +} diff --git a/arch/riscv/kernel/setup.c b/arch/riscv/kernel/setup.c index 971fe776e2f8..5a933d6b6acb 100644 --- a/arch/riscv/kernel/setup.c +++ b/arch/riscv/kernel/setup.c @@ -36,6 +36,7 @@ #include #include #include +#include #include "head.h" @@ -279,6 +280,7 @@ void __init setup_arch(char **cmdline_p) parse_early_param(); efi_init(); + ffi_init(); paging_init(); /* Parse the ACPI tables for possible boot-time configuration */ From patchwork Wed Jul 5 11:42:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: yunhui cui X-Patchwork-Id: 116080 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f45:0:b0:3ea:f831:8777 with SMTP id v5csp1807909vqx; Wed, 5 Jul 2023 04:51:44 -0700 (PDT) X-Google-Smtp-Source: APBJJlH24gKyYIPNJoLazc7U9hEcL3k50wg/389NIcHK/Mnon1yEY9vlJULjDfLia/++MlyXW9K8 X-Received: by 2002:a17:902:cec9:b0:1b8:971c:b7b7 with SMTP id d9-20020a170902cec900b001b8971cb7b7mr9152054plg.56.1688557904556; Wed, 05 Jul 2023 04:51:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688557904; cv=none; d=google.com; s=arc-20160816; b=lhrWVlx7bGs1nuc1YHpoENpnBQgBXYhxQf0Y9Odl6HVrOXs8fb2jqW5765Z5I1KM+F R5IduiU1E+dbadmReal+QcsCwbujZu2DeyHR9D3DrIAa7c1oe6TrwHWE9Q/cQGIlKh7W asC9jwfJlZx9R1bqh7zafnXblZivBx/yR4AeIjvbYsa5hOKWd46gDxHlXE/9R+qV5Zeh rGS2V08XEXeQoId18O8myR0mcW9Z7V6AL4uogU5YR0tlJqoRDmfjKt7UdagNa+oyrGVF +rVCKZB9HVYesnMRsZzbpYg1qCSQYzTWw2gIlhlqSVNQ5pFLdD+xMDCiw3JZwTTVmT9B M+PQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=vxuPbxVgF3zfcM/BRF/LLNBZgbT5czHHRuVcSzACvZ4=; fh=6MypNsR2IyghVjP0g0LAprYETjg4GXMEDvyosK7gBgs=; b=frQEjVXxrRuNqywEwgf2L4FpVyZHIvPN+yDhvNDmzZ4w2U0kJH6Rka/0N2a8cFp2ih bXjnFe3FFGgBVz+gI/eXpbu77H6j4Pfuy6MJOa7uvTF5f609ya3Z+PvanC6w3kQkxegi cum1vs+xYvkL45ZTzH0V32Lak6odp0UCauds4P49OTBCv3WXr+lAfRktxxV4MK4BYQgc 9VJfLKTFc/JWQt9kmIvRieqoWtWIvg9dd4FS34+0rdRld9OqVPpr7oX2qI1WESzGU7LE lBB4NRTk99VD6TkjUA8LgztShmZEAEZZkobyDWPbvlYRzC8QBhkUxykinszQvAjqnUNt Fs/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance.com header.s=google header.b=USieFHEI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=bytedance.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y21-20020a1709029b9500b001b3ada5bbc5si15020895plp.506.2023.07.05.04.51.27; Wed, 05 Jul 2023 04:51:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@bytedance.com header.s=google header.b=USieFHEI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=bytedance.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231315AbjGELpB (ORCPT + 99 others); Wed, 5 Jul 2023 07:45:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48350 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231561AbjGELo5 (ORCPT ); Wed, 5 Jul 2023 07:44:57 -0400 Received: from mail-pj1-x1034.google.com (mail-pj1-x1034.google.com [IPv6:2607:f8b0:4864:20::1034]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BD4A01981 for ; Wed, 5 Jul 2023 04:44:53 -0700 (PDT) Received: by mail-pj1-x1034.google.com with SMTP id 98e67ed59e1d1-262dc1ced40so4739072a91.3 for ; Wed, 05 Jul 2023 04:44:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1688557493; x=1691149493; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=vxuPbxVgF3zfcM/BRF/LLNBZgbT5czHHRuVcSzACvZ4=; b=USieFHEI7eCXkkZlxw91812OEPriTznOhYAAyi2cXQlf49JdMjM71QTNZhPXsv+nhz qj4BRAuXZjJzjZvy0kzeIKh5Hlmy5UmwfmwNgsyAbOWDZkARdCb/7bjGCHW+BaBbgZGt vr9aZZfYLHoDEDPC4mmRW8/GdKX7beelO5Vz4Ex2zA1yD90Qmut/5ZtmWcOo8PTfUPV/ 9wMTOaufrebObZG2kdeeHjoZ4dVZGvqSHK/p3ChlcMXQNJEjW3SUkAXyGAlYSNlUTWhd c9vbIApSePRVpayGJIb4QKHu377JeUxTSSiobs63TsC7Vbfo079dl4/ZzfesOMe4QhJe 4o6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688557493; x=1691149493; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=vxuPbxVgF3zfcM/BRF/LLNBZgbT5czHHRuVcSzACvZ4=; b=NQcrTWdLK/K5yZkbjSok1twjHMqnXbAsOxG2lN36mTBZz4azDb2jTJLdqMHQ6M1w0/ 4moWH+9aaHMrMQpml+8k5s7eh/RMkifdpW4EE3x7lKavnL+stbHXUaeuKmVPngUr/aC9 b4ZXuOl09uuIUTf4pb0FG+1/cGIY6MDoVHgVvdMERb723lM8T0PThFNIe4jD1n2wgFcG NmXrmuvzC4MfbIVyfTs8p9fLXnHnDDqGiZNAfo0eTqaN3zMnzbfsn4n/Td/44/HFIBEd TX8QXRDE8XfhrMnh8n+KkmooUYPJysORfz2Yj4oNzUQkcr81YRNeKt4EPbQtRXWoFJq2 7/FA== X-Gm-Message-State: ABy/qLYIF3AQ4XzS+GJqAsbQmzev27ssanmQYP8eq2pYMCpzzhuBZk4F lAvYVM1oAMYNXa7QV1wGO3Q/sg== X-Received: by 2002:a17:90a:54:b0:261:113e:50d2 with SMTP id 20-20020a17090a005400b00261113e50d2mr16503592pjb.31.1688557493100; Wed, 05 Jul 2023 04:44:53 -0700 (PDT) Received: from PF2E59YH-BKX.inc.bytedance.com ([61.213.176.5]) by smtp.gmail.com with ESMTPSA id 3-20020a17090a194300b00263f6687690sm1177900pjh.18.2023.07.05.04.44.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jul 2023 04:44:52 -0700 (PDT) From: Yunhui Cui To: conor@kernel.org, sunilvl@ventanamicro.com, ardb@kernel.org, palmer@dabbelt.com, paul.walmsley@sifive.com, aou@eecs.berkeley.edu, linux-riscv@lists.infradead.org, rminnich@gmail.com, mark.rutland@arm.com, lpieralisi@kernel.org, rafael@kernel.org, lenb@kernel.org, jdelvare@suse.com, yc.hung@mediatek.com, angelogioacchino.delregno@collabora.com, allen-kh.cheng@mediatek.com, pierre-louis.bossart@linux.intel.com, tinghan.shen@mediatek.com, linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, geshijian@bytedance.com, weidong.wd@bytedance.com, cuiyunhui@bytedance.com Subject: [PATCH v3 2/4] firmware: introduce FFI for SMBIOS entry Date: Wed, 5 Jul 2023 19:42:49 +0800 Message-Id: <20230705114251.661-3-cuiyunhui@bytedance.com> X-Mailer: git-send-email 2.37.3.windows.1 In-Reply-To: <20230705114251.661-1-cuiyunhui@bytedance.com> References: <20230705114251.661-1-cuiyunhui@bytedance.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1770581293508064648?= X-GMAIL-MSGID: =?utf-8?q?1770581293508064648?= To enable DMI functionality on platforms where the bootloader does not support EFI and the architecture does not support reserved addresses. Add a "ffitbl" device tree node to find the SMBIOS entry point and use wire up dmi_scan_machine().This feature is known as the FDT Firmware Interface (FFI). Signed-off-by: Yunhui Cui --- MAINTAINERS | 6 +++ drivers/firmware/Kconfig | 11 +++++ drivers/firmware/Makefile | 1 + drivers/firmware/dmi_scan.c | 97 ++++++++++++++++++++++--------------- drivers/firmware/ffi.c | 42 ++++++++++++++++ include/linux/ffi.h | 29 +++++++++++ 6 files changed, 146 insertions(+), 40 deletions(-) create mode 100644 drivers/firmware/ffi.c create mode 100644 include/linux/ffi.h diff --git a/MAINTAINERS b/MAINTAINERS index e592f489e757..9b886ef36587 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -7871,6 +7871,12 @@ F: arch/x86/platform/efi/ F: drivers/firmware/efi/ F: include/linux/efi*.h +FDT FIRMWARE INTERFACE (FFI) +M: Yunhui Cui cuiyunhui@bytedance.com +S: Maintained +F: drivers/firmware/ffi.c +F: include/linux/ffi.h + EXTERNAL CONNECTOR SUBSYSTEM (EXTCON) M: MyungJoo Ham M: Chanwoo Choi diff --git a/drivers/firmware/Kconfig b/drivers/firmware/Kconfig index b59e3041fd62..3579d9bc22ff 100644 --- a/drivers/firmware/Kconfig +++ b/drivers/firmware/Kconfig @@ -303,6 +303,17 @@ config TURRIS_MOX_RWTM other manufacturing data and also utilize the Entropy Bit Generator for hardware random number generation. +config FDT_FW_INTERFACE + bool "An interface for passing firmware info through FDT" + depends on OF && OF_FLATTREE + default n + help + Enable this option to support the transfer of firmware information, + such as smbios tables, for bootloaders that do not support EFI, such + as coreboot. + + Say Y here if you want to transfer firmware information by FDT. + source "drivers/firmware/arm_ffa/Kconfig" source "drivers/firmware/broadcom/Kconfig" source "drivers/firmware/cirrus/Kconfig" diff --git a/drivers/firmware/Makefile b/drivers/firmware/Makefile index 28fcddcd688f..3b8b5d0868a6 100644 --- a/drivers/firmware/Makefile +++ b/drivers/firmware/Makefile @@ -33,6 +33,7 @@ obj-y += cirrus/ obj-y += meson/ obj-$(CONFIG_GOOGLE_FIRMWARE) += google/ obj-y += efi/ +obj-$(CONFIG_FDT_FW_INTERFACE) += ffi.o obj-y += imx/ obj-y += psci/ obj-y += smccc/ diff --git a/drivers/firmware/dmi_scan.c b/drivers/firmware/dmi_scan.c index 015c95a825d3..c29ea050b5b9 100644 --- a/drivers/firmware/dmi_scan.c +++ b/drivers/firmware/dmi_scan.c @@ -6,6 +6,7 @@ #include #include #include +#include #include #include #include @@ -655,54 +656,70 @@ static int __init dmi_smbios3_present(const u8 *buf) return 1; } -static void __init dmi_scan_machine(void) +/* + * According to the DMTF SMBIOS reference spec v3.0.0, it is + * allowed to define both the 64-bit entry point (smbios3) and + * the 32-bit entry point (smbios), in which case they should + * either both point to the same SMBIOS structure table, or the + * table pointed to by the 64-bit entry point should contain a + * superset of the table contents pointed to by the 32-bit entry + * point (section 5.2) + * This implies that the 64-bit entry point should have + * precedence if it is defined and supported by the OS. If we + * have the 64-bit entry point, but fail to decode it, fall + * back to the legacy one (if available) + */ +static int __init dmi_sacn_smbios(unsigned long smbios3, unsigned long smbios) { - char __iomem *p, *q; + char __iomem *p; char buf[32]; - - if (efi_enabled(EFI_CONFIG_TABLES)) { - /* - * According to the DMTF SMBIOS reference spec v3.0.0, it is - * allowed to define both the 64-bit entry point (smbios3) and - * the 32-bit entry point (smbios), in which case they should - * either both point to the same SMBIOS structure table, or the - * table pointed to by the 64-bit entry point should contain a - * superset of the table contents pointed to by the 32-bit entry - * point (section 5.2) - * This implies that the 64-bit entry point should have - * precedence if it is defined and supported by the OS. If we - * have the 64-bit entry point, but fail to decode it, fall - * back to the legacy one (if available) - */ - if (efi.smbios3 != EFI_INVALID_TABLE_ADDR) { - p = dmi_early_remap(efi.smbios3, 32); - if (p == NULL) - goto error; - memcpy_fromio(buf, p, 32); - dmi_early_unmap(p, 32); - - if (!dmi_smbios3_present(buf)) { - dmi_available = 1; - return; - } - } - if (efi.smbios == EFI_INVALID_TABLE_ADDR) - goto error; - - /* This is called as a core_initcall() because it isn't - * needed during early boot. This also means we can - * iounmap the space when we're done with it. - */ - p = dmi_early_remap(efi.smbios, 32); + #define INVALID_TABLE_ADDR (~0UL) + if (smbios3 != INVALID_TABLE_ADDR) { + p = dmi_early_remap(smbios3, 32); if (p == NULL) - goto error; + return -1; memcpy_fromio(buf, p, 32); dmi_early_unmap(p, 32); - if (!dmi_present(buf)) { + if (!dmi_smbios3_present(buf)) { dmi_available = 1; - return; + return 0; } + } + if (smbios == INVALID_TABLE_ADDR) + return -1; + /* + * This is called as a core_initcall() because it isn't + * needed during early boot. This also means we can + * iounmap the space when we're done with it. + */ + p = dmi_early_remap(smbios, 32); + if (p == NULL) + return -1; + memcpy_fromio(buf, p, 32); + dmi_early_unmap(p, 32); + + if (!dmi_present(buf)) { + dmi_available = 1; + return 0; + } + + return -1; +} + +static void __init dmi_scan_machine(void) +{ + char __iomem *p, *q; + char buf[32]; + + if (ffi_enabled(FFI_CONFIG_TABLES)) { + if (!dmi_sacn_smbios(ffi.smbios3, ffi.smbios)) + return; + } + + if (efi_enabled(EFI_CONFIG_TABLES)) { + if (dmi_sacn_smbios(efi.smbios3, efi.smbios)) + goto error; } else if (IS_ENABLED(CONFIG_DMI_SCAN_MACHINE_NON_EFI_FALLBACK)) { p = dmi_early_remap(SMBIOS_ENTRY_POINT_SCAN_START, 0x10000); if (p == NULL) diff --git a/drivers/firmware/ffi.c b/drivers/firmware/ffi.c new file mode 100644 index 000000000000..d4994a22438b --- /dev/null +++ b/drivers/firmware/ffi.c @@ -0,0 +1,42 @@ +// SPDX-License-Identifier: GPL-2.0-only + +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + +#include +#include +#include +#include + +#define FFI_INVALID_TABLE_ADDR (~0UL) + +struct ffi __read_mostly ffi = { + .smbios = FFI_INVALID_TABLE_ADDR, + .smbios3 = FFI_INVALID_TABLE_ADDR, +}; + +void __init ffi_smbios_root_pointer(void) +{ + u32 ffitbl, smbios, len, ver; + u64 entry; + fdt64_t *prop; + + ffitbl = fdt_subnode_offset(initial_boot_params, 0, "ffitbl"); + smbios = fdt_subnode_offset(initial_boot_params, ffitbl, "smbios"); + prop = fdt_getprop_w(initial_boot_params, smbios, "entry", &len); + if (!prop || len != sizeof(u64)) { + pr_debug("smbios entry not found.\n"); + return; + } + entry = fdt64_to_cpu(*prop); + + prop = fdt_getprop_w(initial_boot_params, smbios, "reg", &len); + if (!prop || len != sizeof(u32)) { + pr_debug("smbios reg not found.\n"); + return; + } + ver = fdt32_to_cpu(*prop); + (ver == 3) ? (ffi.smbios3 = entry) : (ffi.smbios = entry); + set_bit(FFI_CONFIG_TABLES, &ffi.flags); + pr_debug("smbios%d entry: %llx\n", ver, entry); +} + diff --git a/include/linux/ffi.h b/include/linux/ffi.h new file mode 100644 index 000000000000..a99c2a290556 --- /dev/null +++ b/include/linux/ffi.h @@ -0,0 +1,29 @@ +/* SPDX-License-Identifier: GPL-2.0 */ + +#ifndef _LINUX_FFI_H +#define _LINUX_FFI_H + +extern struct ffi { + unsigned long smbios; /* SMBIOS table (32 bit entry point) */ + unsigned long smbios3; /* SMBIOS table (64 bit entry point) */ + unsigned long flags; + +} ffi; + +#define FFI_CONFIG_TABLES 2 /* Can we use FFI config tables? */ + +#ifdef CONFIG_FDT_FW_INTERFACE +extern void ffi_smbios_root_pointer(void); +static inline bool ffi_enabled(int feature) +{ + return test_bit(feature, &ffi.flags) != 0; +} +#else +static inline bool ffi_enabled(int feature) +{ + return false; +} +void ffi_smbios_root_pointer(void) { return; }; +#endif + +#endif /* _LINUX_FFI_H */ From patchwork Wed Jul 5 11:42:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: yunhui cui X-Patchwork-Id: 116086 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f45:0:b0:3ea:f831:8777 with SMTP id v5csp1811281vqx; Wed, 5 Jul 2023 04:59:00 -0700 (PDT) X-Google-Smtp-Source: APBJJlFeFbVley+Zo+38Ogwe963Tpw60oQID9xGC+TLOHhx2tIKpYNmUIjX2VryW6ZVvujjFL/I5 X-Received: by 2002:a05:6a20:3953:b0:119:4141:6989 with SMTP id r19-20020a056a20395300b0011941416989mr2714436pzg.13.1688558339786; Wed, 05 Jul 2023 04:58:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688558339; cv=none; d=google.com; s=arc-20160816; b=BZNypTSkevYCFDxx2jnAewV4h9NiU1sezAGMIfU1zv6pQ+CIEMJ8Uav6Fu7kGIeGJq y5Oir2dxjqslm1JWWNi1SaNCb0CCSjfVKSzfGIFdX05O7CcwkSSMXirsTUHjVpRlZedE 3AQNoCeoz670GL0U1MFt1MiHTpFx23oOeor7bFVCKoWdLCeoW/qlRkSjKYkFwvZu62im wXZY8YWpS/4MFQ6EnLRwDE4uSN3eqBSNQMy6WV4Qq9pzXq+azTgtXLwKR6XtV+z8xums vz8P2deBt+D0tfgu+9zOEJhHY5/jnyMLhe76GO+uYwaMsy2jRV0X6oLWcxjTJ6mwdk3e 3HEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=2/7mU7LG0/LoivTbyL8zN+ZBZKcFo4rglaRaqylxhfQ=; fh=6MypNsR2IyghVjP0g0LAprYETjg4GXMEDvyosK7gBgs=; b=X5YclQ65J/Sd8TkYLF79Eb1TP2hdE3NVpkp2OxUxYoZHFItVXdulPBDgokOI//UMqh xrLCd/DkBd+vnmOkf1AWOK4n2yS8I7r28c7v/PxBZ6GQUy7F4ZwleIAobiNmeMXkbJJR Fim/+fibWuyHfUhXtjDo2MJq9VJyRgRxyFnDgjELaF38fr6up++Kv2aTN6IQrE6GQ7CW yTPeBuRR3/b1IUmOzWVoFX4hgMKxphXN5sY+yDSt2323Oy4kHJxHIli81/mLqYfw81KO zpdcYUn0bogupGRF67Sbc6g3TmnEY1GD95jxJ65f94mcCZr6UPl9/RgEP+xqnkjEBG8b b6Iw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance.com header.s=google header.b="Ltfa/6PM"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=bytedance.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j4-20020a632304000000b0051b65f4d94asi22171196pgj.484.2023.07.05.04.58.44; Wed, 05 Jul 2023 04:58:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@bytedance.com header.s=google header.b="Ltfa/6PM"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=bytedance.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231624AbjGELpP (ORCPT + 99 others); Wed, 5 Jul 2023 07:45:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48652 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231514AbjGELpM (ORCPT ); Wed, 5 Jul 2023 07:45:12 -0400 Received: from mail-pl1-x62b.google.com (mail-pl1-x62b.google.com [IPv6:2607:f8b0:4864:20::62b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D24D01990 for ; Wed, 5 Jul 2023 04:45:00 -0700 (PDT) Received: by mail-pl1-x62b.google.com with SMTP id d9443c01a7336-1b89b75dc1cso4279145ad.1 for ; Wed, 05 Jul 2023 04:45:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1688557500; x=1691149500; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=2/7mU7LG0/LoivTbyL8zN+ZBZKcFo4rglaRaqylxhfQ=; b=Ltfa/6PMTzVFKvupHYoIu25JvZQEj8+TG279VMGSVCFID+E3BGc5M/0cOuZAjs8bL2 z9Cgl0L5iCAGnnQ/SuOGo7Tlk2zQTK9bQPleevr+vBadbtzutwf63D4nRPP3IF+qUaFx EvP//jSB2BrpV79rZnIxTxbFyGU2bFXfQ00+rYLUlKKiHn2sM+6/jwg1lRkSLa9Axgpj Txv/dFC2aNPc+fLwMIpNaBCDQ/ZOdivCtVpmurWLgY2ltsQ8x9kA03yypVf4nBnyOGiw Zc7G9su5n0GMnMCvvb8mRkoltS9mmH76Z7KN16SNl20HeoY+KKNBQTu61nHeHB/My8I5 vr4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688557500; x=1691149500; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=2/7mU7LG0/LoivTbyL8zN+ZBZKcFo4rglaRaqylxhfQ=; b=a/f64R/pLqSG2VpqHHQCr7odyUeWb0fghED8OcBcGR2CEMGog93lxfwi1wM2lg4tBg gyxaCx1LAHuzi/Cs9B8dDOsTn58Hv78Q009k+rp0UOuU/x1xxgz10MhiLHzgA4Sx6s+d LiiROZHcpo3kzAtZ/1P494yXnfjx6yD0w7EizUt3NBFWDjcRVE072uS2RGJo9Ax2UUBj 3EpOM+7OWYEF3phiBtENJWSoDzwYchRbSBBBgu5qQ/o+gR2XYNLDKFueEztwKxmb1RNs s6Z1GHS5v3NMJ0vJ5a7gZ+eolnOiVTAkt7S0+/l52SxM7Fi5P3Bnq3crZOW8C0paNcvV jo1A== X-Gm-Message-State: ABy/qLbEIRLsROh/y6eWNREI/lUZJj7ERuqI+lCzGtsRhZJ0Dpu317gz 2ICagKuIbuwYg9/6SSyVtqFxag== X-Received: by 2002:a17:90a:f40a:b0:263:f674:490e with SMTP id ch10-20020a17090af40a00b00263f674490emr1749692pjb.3.1688557499886; Wed, 05 Jul 2023 04:44:59 -0700 (PDT) Received: from PF2E59YH-BKX.inc.bytedance.com ([61.213.176.5]) by smtp.gmail.com with ESMTPSA id 3-20020a17090a194300b00263f6687690sm1177900pjh.18.2023.07.05.04.44.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jul 2023 04:44:59 -0700 (PDT) From: Yunhui Cui To: conor@kernel.org, sunilvl@ventanamicro.com, ardb@kernel.org, palmer@dabbelt.com, paul.walmsley@sifive.com, aou@eecs.berkeley.edu, linux-riscv@lists.infradead.org, rminnich@gmail.com, mark.rutland@arm.com, lpieralisi@kernel.org, rafael@kernel.org, lenb@kernel.org, jdelvare@suse.com, yc.hung@mediatek.com, angelogioacchino.delregno@collabora.com, allen-kh.cheng@mediatek.com, pierre-louis.bossart@linux.intel.com, tinghan.shen@mediatek.com, linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, geshijian@bytedance.com, weidong.wd@bytedance.com, cuiyunhui@bytedance.com Subject: [PATCH v3 3/4] riscv: obtain SMBIOS entry from FFI Date: Wed, 5 Jul 2023 19:42:50 +0800 Message-Id: <20230705114251.661-4-cuiyunhui@bytedance.com> X-Mailer: git-send-email 2.37.3.windows.1 In-Reply-To: <20230705114251.661-1-cuiyunhui@bytedance.com> References: <20230705114251.661-1-cuiyunhui@bytedance.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1770581749524057415?= X-GMAIL-MSGID: =?utf-8?q?1770581749524057415?= On RISC-V, Coreboot does not support EFI booting, only supports devicetree, and RISC-V does not have reserved address segments. To support Coreboot on RISC-V platforms that require DMI functionality, SMBIOS entry need to be passed through FFI. Signed-off-by: Yunhui Cui --- arch/riscv/kernel/ffi.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/riscv/kernel/ffi.c b/arch/riscv/kernel/ffi.c index 147d06a5acff..b959d16fe0b3 100644 --- a/arch/riscv/kernel/ffi.c +++ b/arch/riscv/kernel/ffi.c @@ -8,6 +8,7 @@ #include #include #include +#include static u64 acpi_rsdp; @@ -35,4 +36,5 @@ u64 __init riscv_acpi_rsdp(void) void __init ffi_init(void) { ffi_acpi_root_pointer(); + ffi_smbios_root_pointer(); } From patchwork Wed Jul 5 11:42:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: yunhui cui X-Patchwork-Id: 116089 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f45:0:b0:3ea:f831:8777 with SMTP id v5csp1817540vqx; Wed, 5 Jul 2023 05:07:13 -0700 (PDT) X-Google-Smtp-Source: APBJJlHnsXvJYNFz5UzMqt4KrNQGsbyY802XqX0HVo1D/3/70MZr3CDzylsV+YDMfRriDJ8hGzqo X-Received: by 2002:a05:6a20:4327:b0:12e:6e0f:535 with SMTP id h39-20020a056a20432700b0012e6e0f0535mr10257563pzk.34.1688558833228; Wed, 05 Jul 2023 05:07:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688558833; cv=none; d=google.com; s=arc-20160816; b=zw08hakzBzkFwYNb+8y13LatJ/rf4fTdxE16sajKlxatcOet3kWvjqP7xOSZG09WaS wENP98XAvtimKOKu/kg/viStdaCqCebnoqQYnUtTAXJ9tH8ViDvNnvoeP/+qRe+M0pn9 iiIL7IMjKS49rip8/PdU7ZCk1zb37rafxw/I3DS+mcaW4ZqxC4fM4ZAMeH3Qa7y8xfCv NJ0YYQ/kSPR/SjUmCbdbCS7JxjgiLwpbtvOG9+e7maSfjXMHW7ouy9wGRFlxp+omPxG8 7/P/uTB+JwsWnn26ue1LwbHOgWAONQArtyQcSMBM7zCi53bXUit+ypcxyxfQAFDYU8hH xpzg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=v+ITQvowAXOXD8H4U5Ak65JYD6vo7/xikUkbFThVisc=; fh=6MypNsR2IyghVjP0g0LAprYETjg4GXMEDvyosK7gBgs=; b=RJmVEz62buWOVBWO7r/Ji1ziR+EwE1kJW6qqCGuSx2jSJ1OuiXGYmO5wqJmifL4gkm zSJllqEuJ6rCGdWdjRX960Cgmnf0nhjx09oZsZV6koF6PpTIZ2moQQfrB+ByYg4jebWI Lo3opbJxSPNllNQANHYahR37c5iykOlZbcbqSG1fDEEfUt9ejn4fYnvYe8zR9o47ns0z 7rTzoqerKVSxVb5XtNzvuNrnx10X43W3wnhsSkNj7PsIL+WrOdSsLU9PBwLB/BOgdi/h ZyRb/c+vviYTh4VOYS57expZyVC5vY56D1UcWSSwM8GQS8qz9qgtgGc7lS0qipPr0ddL 2axw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance.com header.s=google header.b=JdOIUPCc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=bytedance.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z19-20020a63e113000000b00553ced07d15si23693227pgh.368.2023.07.05.05.06.57; Wed, 05 Jul 2023 05:07:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@bytedance.com header.s=google header.b=JdOIUPCc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=bytedance.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231493AbjGELpt (ORCPT + 99 others); Wed, 5 Jul 2023 07:45:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48822 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231488AbjGELps (ORCPT ); Wed, 5 Jul 2023 07:45:48 -0400 Received: from mail-pj1-x102e.google.com (mail-pj1-x102e.google.com [IPv6:2607:f8b0:4864:20::102e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D482E1BC3 for ; Wed, 5 Jul 2023 04:45:07 -0700 (PDT) Received: by mail-pj1-x102e.google.com with SMTP id 98e67ed59e1d1-263121cd04eso2969444a91.2 for ; Wed, 05 Jul 2023 04:45:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1688557507; x=1691149507; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=v+ITQvowAXOXD8H4U5Ak65JYD6vo7/xikUkbFThVisc=; b=JdOIUPCcVgRbkHL6lKC2twEROgaAL4yJ8ZwTGhCaGWbZQF9aFGaRYNPGYzOGyghzhg +xgjWXfn01h1SKYk1tCnUwym7zJigY1FB2L5nLJ9K9xF+V96OcBaG8t1Nvd3B2sJD/Ls 4hF63PIb9gGwLm7I9MhvBmuNYQeSd2x4nd+O5gtyCppqbUmkWKDhM+rfZ0oSgKLAnmyh ef/1usAQUA9CcwFdOCMOZiXTJMrJ22ZEPa8whSjBMypJAPO7J2gk5zs4iFCdj7s8Fcrk ie3LhugAEg6iQhA7aaj/0X0A/wWygp1ho0cDLjVJrYds9JfqZ7MvJZbTR5YNypqp+lHX hrow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688557507; x=1691149507; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=v+ITQvowAXOXD8H4U5Ak65JYD6vo7/xikUkbFThVisc=; b=F5ihyu/b0AJ7qhDa9e53sHnJwTGAtuJxiJEDxjbzZKh3azlLt0Q4605bTxs019pjVV BHG20rUjkHG0CkSyyuFkHY560+ngRJTp+o4dMHeoRweAty2lOVPU/rIblEE4xpRJzGGu hF7gEWiRCkr13OYH7fsWAaWFccPA4vNaev1JTvLU5lhy6PKtsPS/Lb6/eyu/IpLQ3vol AawwTsFWwPwoVYqGQ0cMWbFfdSOukJu8jOEHXnuA95RWpY2GwbxsD6ChL4Objk80yXrw Eg+xuinWu5ImA9uyMzDCLBCi0JH04ZXfUsa8pI0DeNRF1e4NiM8c6KA/hWfomywgvZLE Crkw== X-Gm-Message-State: ABy/qLadAND+okTOFOdlqzcV3nYdJwuvTFsHFK5aj33Q+qY2Zh56+Vrs kNlsQ4bf9YWSp3T6lmz30med5QGOYm5H05dhKb2bjA== X-Received: by 2002:a17:90b:5109:b0:263:5c78:4b63 with SMTP id sc9-20020a17090b510900b002635c784b63mr12763480pjb.45.1688557506871; Wed, 05 Jul 2023 04:45:06 -0700 (PDT) Received: from PF2E59YH-BKX.inc.bytedance.com ([61.213.176.5]) by smtp.gmail.com with ESMTPSA id 3-20020a17090a194300b00263f6687690sm1177900pjh.18.2023.07.05.04.45.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jul 2023 04:45:06 -0700 (PDT) From: Yunhui Cui To: conor@kernel.org, sunilvl@ventanamicro.com, ardb@kernel.org, palmer@dabbelt.com, paul.walmsley@sifive.com, aou@eecs.berkeley.edu, linux-riscv@lists.infradead.org, rminnich@gmail.com, mark.rutland@arm.com, lpieralisi@kernel.org, rafael@kernel.org, lenb@kernel.org, jdelvare@suse.com, yc.hung@mediatek.com, angelogioacchino.delregno@collabora.com, allen-kh.cheng@mediatek.com, pierre-louis.bossart@linux.intel.com, tinghan.shen@mediatek.com, linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, geshijian@bytedance.com, weidong.wd@bytedance.com, cuiyunhui@bytedance.com Subject: [PATCH v3 4/4] dt-bindings: firmware: Document ffitbl binding Date: Wed, 5 Jul 2023 19:42:51 +0800 Message-Id: <20230705114251.661-5-cuiyunhui@bytedance.com> X-Mailer: git-send-email 2.37.3.windows.1 In-Reply-To: <20230705114251.661-1-cuiyunhui@bytedance.com> References: <20230705114251.661-1-cuiyunhui@bytedance.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1770582267482963147?= X-GMAIL-MSGID: =?utf-8?q?1770582267482963147?= Add the description for ffitbl subnode. Signed-off-by: Yunhui Cui --- .../devicetree/bindings/firmware/ffitbl.txt | 27 +++++++++++++++++++ MAINTAINERS | 1 + 2 files changed, 28 insertions(+) create mode 100644 Documentation/devicetree/bindings/firmware/ffitbl.txt diff --git a/Documentation/devicetree/bindings/firmware/ffitbl.txt b/Documentation/devicetree/bindings/firmware/ffitbl.txt new file mode 100644 index 000000000000..c42368626199 --- /dev/null +++ b/Documentation/devicetree/bindings/firmware/ffitbl.txt @@ -0,0 +1,27 @@ +FFI(FDT FIRMWARE INTERFACE) driver + +Required properties: + - entry : acpi or smbios root pointer, u64 + - reg : acpi or smbios version, u32 + +Some bootloaders, such as Coreboot do not support EFI, +only devicetree and some arches do not have a reserved +address segment. Add "ffitbl" subnode to obtain ACPI RSDP +and SMBIOS entry. +This feature is known as FDT Firmware Interface (FFI). + +Example: + ffitbl { + + smbios { + entry = ""; + reg = < 0x03 >; + + } + acpi { + entry = ""; + reg = < 0x06 >; + + } + } + diff --git a/MAINTAINERS b/MAINTAINERS index 9b886ef36587..008257e55062 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -7874,6 +7874,7 @@ F: include/linux/efi*.h FDT FIRMWARE INTERFACE (FFI) M: Yunhui Cui cuiyunhui@bytedance.com S: Maintained +F: Documentation/devicetree/bindings/firmware/ffitbl.txt F: drivers/firmware/ffi.c F: include/linux/ffi.h