From patchwork Thu Dec 31 04:09:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1421569 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=DqEoDEre; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4D686G1ClZz9sRN for ; Fri, 1 Jan 2021 00:25:17 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 3ECB68250D; Thu, 31 Dec 2020 14:25:07 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="DqEoDEre"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id B2AE0825AA; Thu, 31 Dec 2020 05:10:11 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-io1-xd2f.google.com (mail-io1-xd2f.google.com [IPv6:2607:f8b0:4864:20::d2f]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id C9C4682540 for ; Thu, 31 Dec 2020 05:10:07 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-io1-xd2f.google.com with SMTP id t8so16299867iov.8 for ; Wed, 30 Dec 2020 20:10:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Kl6pbqJYQuVV3svERfqOI1ZsJbgN6N/Wl0IvO7UVuvg=; b=DqEoDEreW9AwnPcpyFT7RQ29VvYTeMJubJfSS4dPjcWqUtOvSThM7G8bVDuRoUt3yg MUyEgDE8s+Q5zCbqRuDXsRiBltc0tvNtHYvmUtNmwAsGye3isnzGZnp5QaCR9w7PFyWT aWq1Sn/awoCcwEK/wFNCxZpSpXQbIwRXtgdYA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Kl6pbqJYQuVV3svERfqOI1ZsJbgN6N/Wl0IvO7UVuvg=; b=PeHhY9PMc2JvkG/+iLh4OeNuqEObemVRwL+5QndiViz15O1cWoSCmr7JLmx2ibSl+3 ky80i7d2glGAnJBTkcp140iUiQOsB0ry2x/PvIu9sHldK+qeaWa8iNAAkHioK+JKsg0/ HO7KCuGpTZZIeQOUCOEwJ9q/E7jl0zghqQm735YmTpSNMumbDbt1Wup6OFGn7rlvWNh3 pIvv8+btRLu4WtNIL/IvAcFShgiTJx+HfPEw66zHnyyL6peLRTSikPE2q/zlK2VqDop1 kb7fitTfvOJHmYrszw844/uPOMAWm3wTsJeOjKFdqqLLDkR0zBvseI+CXCf4A4k/FwR3 Skyg== X-Gm-Message-State: AOAM533hFaZ3te4yw+I6vaxHIEyZ/8tHCJEYkPuu8fZb9YNBikT81KiD QrD7UwzJTQFpr/e7wabJ2bL1tZ59eotWdQKy X-Google-Smtp-Source: ABdhPJzFNs76LafYV8FzfksfvHP2GIE7rrzixaPUvBq4KXJOLJD/tSHVHV2aslkRM7tms0WmRHgJFg== X-Received: by 2002:a6b:d21a:: with SMTP id q26mr45758031iob.128.1609387806093; Wed, 30 Dec 2020 20:10:06 -0800 (PST) Received: from localhost.localdomain (c-67-190-101-114.hsd1.co.comcast.net. [67.190.101.114]) by smtp.gmail.com with ESMTPSA id 14sm31959026ilz.7.2020.12.30.20.10.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Dec 2020 20:10:04 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: Marek Vasut , Walter Lozano , Bernhard Messerklinger , Heinrich Schuchardt , Bin Meng , Tom Rini , Simon Glass , Adam Ford , Anatolij Gustschin , Andy Shevchenko , Baruch Siach , Daniel Schwierzeck , Harald Seiler , Jagan Teki , Jan Kiszka , Jean-Jacques Hiblot , Joel Johnson , Lukasz Majewski , Marek Vasut , Mario Six , Masahiro Yamada , Michal Simek , Ovidiu Panait , Patrick Delaunay , Pavel Herrmann , Peng Fan , Philippe Reynes , Rasmus Villemoes , Reuben Dowle , Samuel Holland , Sean Anderson , Stefan Roese , Wolfgang Wallner Subject: [PATCH 00/30] dm: Implement OF_PLATDATA_INST in driver model (part E) Date: Wed, 30 Dec 2020 21:09:30 -0700 Message-Id: <20201231041000.660925-1-sjg@chromium.org> X-Mailer: git-send-email 2.29.2.729.g45daf8777d-goog MIME-Version: 1.0 X-Mailman-Approved-At: Thu, 31 Dec 2020 14:25:06 +0100 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean This series builds on the recent dtoc implementation of build-time device instantiation. It adds the required driver model support, which is basically a few more data structures. With this, sandbox_spl and chromebook_coral both use the new feature. For coral TPL there is a 1.5KB code-size reduction and a 1.75KB data-size increase: text data bss dec hex 18836 3080 12 21928 55a8 original 17229 4896 12 22137 5679 with OF_PLATDATA_INST 17277 4896 12 22185 56a9 with OF_PLATDATA_RT The extra data size is due to the build-time devices which are now included in the image instead of being built at runtime. Also the private data for each device is allocated in the data region at present, even through much of it is just zeroes. The reduction in code size is due to not needing to bind devices at runtime, as a well as a simplified probe() function. Coral requires that data be copied out to RAM before being updated, so that adds a small amount to size (shown in the third line). Quite a lot of future work is possible, including reducing the size of data structures. See [1] for more ideas. But this series implements the basic feature. To try this out on your board, define CONFIG_SPL_OF_PLATDATA_INST and see what you get. Note: SPL tests do not yet pass with this series. The driver_rt struct is not set up so device_get_by_driver_info_idx() does not work. This means that looking up phandles will fail. This will be addressed in a v2 series, along with documentation updates and a little more information on code-size impact. This series is available at u-boot-dm/tin-working [1] https://lists.denx.de/pipermail/u-boot/2020-July/418433.html Simon Glass (30): sandbox: Drop debug message in os_spl_to_uboot() linker_lists: Allow use in data structures dm: core: Add macros to access the new linker lists dm: core: Allow dropping run-time binding of devices dm: core: Adjust uclass setup with of-platdata dm: core: Set up driver model for OF_PLATDATA_INST dm: core: Skip adding uclasses with OF_PLATDATA_INST dm: Add the new dtoc-generated files to the build dm: core: Include dt-decl.h automatically dm: test: Avoid destroying uclasses with of-platdata-inst clk: sandbox: Move priv/plat data to a header file clk: fixed-rate: Export driver parts for OF_PLATDATA_INST clk: sandbox: Create a special fixed-rate driver sandbox: Create a new sandbox_noinst build test: Run sandbox_spl tests on sandbox_noinst azure/gitlab: Add tests for sandbox_noinst dm: core: Add an option to support SPL in read-only memory dm: core: Create a struct for device runtime info dm: core: Move flags to device-runtime info dm: core: Allow storing priv/plat data separately sandbox: Define a region for device priv/plat data dm: core: Use separate priv/plat data region x86: Define a region for device priv/plat data x86: apl: Fix the header order in pmc x86: apl: Tell of-platdata about a required header file x86: itss: Tidy up bind() for of-platdata-inst x86: Support a fake PCI device with of-platdata-inst x86: Don't include reset driver in SPL x86: coral: Drop ACPI properties from of-platdata x86: apl: Use read-only SPL and new of-platdata .azure-pipelines.yml | 3 + .gitlab-ci.yml | 10 +- arch/sandbox/cpu/os.c | 1 - arch/sandbox/cpu/u-boot-spl.lds | 8 + arch/sandbox/dts/sandbox.dtsi | 2 +- arch/sandbox/include/asm/clk.h | 24 +++ arch/x86/cpu/apollolake/Kconfig | 2 + arch/x86/cpu/apollolake/pmc.c | 2 +- arch/x86/cpu/apollolake/punit.c | 1 + arch/x86/cpu/intel_common/itss.c | 5 +- arch/x86/cpu/u-boot-spl.lds | 8 + arch/x86/dts/reset.dtsi | 2 +- arch/x86/lib/tpl.c | 1 + board/sandbox/MAINTAINERS | 7 + common/spl/Kconfig | 24 +++ configs/chromebook_coral_defconfig | 1 + configs/sandbox_noinst_defconfig | 229 +++++++++++++++++++++++++++++ configs/sandbox_spl_defconfig | 1 + drivers/clk/clk_fixed_rate.c | 14 +- drivers/clk/clk_sandbox.c | 40 ++++- drivers/clk/clk_sandbox_test.c | 6 - drivers/core/device.c | 83 ++++++++--- drivers/core/root.c | 83 +++++++++-- drivers/core/uclass.c | 5 +- dts/Kconfig | 38 +++++ include/asm-generic/global_data.h | 22 +++ include/asm-generic/sections.h | 3 + include/dm/device-internal.h | 26 ++++ include/dm/device.h | 38 ++++- include/dm/root.h | 3 + include/dm/uclass-internal.h | 23 +++ include/dm/uclass.h | 20 +++ include/dm/util.h | 9 ++ include/dt-structs.h | 2 + include/linker_lists.h | 28 ++++ include/linux/clk-provider.h | 5 + scripts/Makefile.spl | 3 +- test/dm/of_platdata.c | 2 +- test/dm/test-main.c | 3 +- test/run | 4 + 40 files changed, 724 insertions(+), 67 deletions(-) create mode 100644 configs/sandbox_noinst_defconfig