From nobody Mon May 6 04:34:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org ARC-Seal: i=1; a=rsa-sha256; t=1598583905; cv=none; d=zohomail.com; s=zohoarc; b=BGgx4fpvrgEaq7kpsrc/7adx8NikwjW+F19VslNfRNN7EcSlElluaz83MYwUmmGngG6sfkC4BLA2wSfx96Ihlb/W4Bn5v0S7+tUFhhnih6ZLMi992J+MBUXqx2NQmlWolF+6v7QS/bOVPRhFuJAkZ+uEm12StuJe8ZkHPd1UBrE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1598583905; h=Content-Type:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=Eue+f7wYmyVxxm45MrrEW2aUaFYrLlv04KqPxGWWlw4=; b=F/k9MbGyMB5wgbGfg9uN5e0NJc2RbzjlbobrSxlcGJxykLFVMqLtjZSn9nmKqRTXEODXVSQopmRzsvZAIi3tHLwHy7lnpOvYyhjDtxbbN48GKWjhtGmRo7LcU7LGYgUlxtIqy/sVObP77oCK93bYC0JZNn8uVZz8o0CHo/duzDs= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1598583905697915.2897763246001; Thu, 27 Aug 2020 20:05:05 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kBUgy-0004gF-SV; Fri, 28 Aug 2020 03:04:40 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kBUgx-0004g8-Qa for xen-devel@lists.xenproject.org; Fri, 28 Aug 2020 03:04:39 +0000 Received: from mailhost.m5p.com (unknown [74.104.188.4]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 5c2d0a05-b622-48ad-b3c0-11e2c7173913; Fri, 28 Aug 2020 03:04:38 +0000 (UTC) Received: from m5p.com (mailhost.m5p.com [IPv6:2001:470:1f07:15ff:0:0:0:f7]) by mailhost.m5p.com (8.15.2/8.15.2) with ESMTPS id 07S34Rlc025371 (version=TLSv1.2 cipher=DHE-RSA-AES128-GCM-SHA256 bits=128 verify=NO); Thu, 27 Aug 2020 23:04:33 -0400 (EDT) (envelope-from ehem@m5p.com) Received: (from ehem@localhost) by m5p.com (8.15.2/8.15.2/Submit) id 07S34RXG025370; Thu, 27 Aug 2020 20:04:27 -0700 (PDT) (envelope-from ehem) X-Inumbo-ID: 5c2d0a05-b622-48ad-b3c0-11e2c7173913 Date: Thu, 27 Aug 2020 20:04:27 -0700 From: Elliott Mitchell To: xen-devel@lists.xenproject.org Cc: Stefano Stabellini , Julien Grall , Volodymyr Babchuk Subject: [RFC PATCH] xen/arm: Add Kconfig option for CONFIG_EARLY_PRINTK Message-ID: <20200828030427.GC25246@mattapan.m5p.com> MIME-Version: 1.0 Content-Disposition: inline X-Spam-Status: No, score=0.0 required=10.0 tests=KHOP_HELO_FCRDNS autolearn=unavailable autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on mattapan.m5p.com X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Support for a very early console has existed for ARM for quite some time. Previously EARLY_PRINTK had to be passed in as a Make variable, instead of as a configuration option. Create the option to allow selecting via .config. Signed-off-by: Elliott Mitchell --- This is mostly RFC due to insufficient testing. I am hopeful this successfully changes things to have the Kconfig CONFIG_EARLY_PRINTK option replace the environment/Make variable EARLY_PRINTK. --- xen/arch/arm/Kconfig | 12 ++++++++++++ xen/arch/arm/Makefile | 2 +- xen/arch/arm/Rules.mk | 34 +++++++++++++++------------------- xen/arch/arm/arm32/Makefile | 2 +- xen/arch/arm/arm64/Makefile | 2 +- 5 files changed, 30 insertions(+), 22 deletions(-) diff --git a/xen/arch/arm/Kconfig b/xen/arch/arm/Kconfig index 0ef8a99ad9..a176d42a0c 100644 --- a/xen/arch/arm/Kconfig +++ b/xen/arch/arm/Kconfig @@ -241,3 +241,15 @@ source "arch/arm/platforms/Kconfig" source "common/Kconfig" =20 source "drivers/Kconfig" + +if DEBUG || EXPERT + +config EARLY_PRINTK + string "Enable early hard-coded console for printk" + help + Setup a serial device early during boot for logging message. Us= ed + for very early bring-up. + + See docs/misc/arm/early-printk.txt + +endif diff --git a/xen/arch/arm/Makefile b/xen/arch/arm/Makefile index 70f532e42a..0bf975b44d 100644 --- a/xen/arch/arm/Makefile +++ b/xen/arch/arm/Makefile @@ -16,7 +16,7 @@ obj-y +=3D device.o obj-y +=3D domain.o obj-y +=3D domain_build.init.o obj-y +=3D domctl.o -obj-$(EARLY_PRINTK) +=3D early_printk.o +obj-$(CONFIG_EARLY_PRINTK) +=3D early_printk.o obj-y +=3D gic.o obj-y +=3D gic-v2.o obj-$(CONFIG_GICV3) +=3D gic-v3.o diff --git a/xen/arch/arm/Rules.mk b/xen/arch/arm/Rules.mk index 3d9a0ed357..4aef62cc9c 100644 --- a/xen/arch/arm/Rules.mk +++ b/xen/arch/arm/Rules.mk @@ -22,12 +22,15 @@ ifneq ($(call cc-option,$(CC),-fvisibility=3Dhidden,n),= n) CFLAGS +=3D -DGCC_HAS_VISIBILITY_ATTRIBUTE endif =20 -EARLY_PRINTK :=3D n - -ifeq ($(CONFIG_DEBUG),y) +ifneq ($(CONFIG_EARLY_PRINTK),) =20 # See docs/misc/arm/early-printk.txt for syntax =20 +ifneq ($(CONFIG_DEBUG),y) +# Early printk is dependant on a debug build. +$(error CONFIG_EARLY_PRINTK enabled for non-debug build) +endif + EARLY_PRINTK_brcm :=3D 8250,0xF040AB00,2 EARLY_PRINTK_dra7 :=3D 8250,0x4806A000,2 EARLY_PRINTK_fastmodel :=3D pl011,0x1c090000,115200 @@ -54,6 +57,10 @@ else EARLY_PRINTK_CFG :=3D $(subst $(comma), ,$(CONFIG_EARLY_PRINTK)) endif =20 +ifeq ($(EARLY_PRINTK_CFG),) +$(error Unknown CONFIG_EARLY_PRINTK setting) +endif + # Extract configuration from string EARLY_PRINTK_INC :=3D $(word 1,$(EARLY_PRINTK_CFG)) EARLY_UART_BASE_ADDRESS :=3D $(word 2,$(EARLY_PRINTK_CFG)) @@ -76,22 +83,11 @@ CFLAGS-y +=3D -DEARLY_PRINTK_VERSION_NONE endif endif =20 -ifneq ($(EARLY_PRINTK_INC),) -EARLY_PRINTK :=3D y -endif - -CFLAGS-$(EARLY_PRINTK) +=3D -DCONFIG_EARLY_PRINTK +CFLAGS-y +=3D -DCONFIG_EARLY_PRINTK CFLAGS-$(EARLY_PRINTK_INIT_UART) +=3D -DEARLY_PRINTK_INIT_UART -CFLAGS-$(EARLY_PRINTK) +=3D -DEARLY_PRINTK_INC=3D\"debug-$(EARLY_PRINTK_IN= C).inc\" -CFLAGS-$(EARLY_PRINTK) +=3D -DEARLY_PRINTK_BAUD=3D$(EARLY_PRINTK_BAUD) -CFLAGS-$(EARLY_PRINTK) +=3D -DEARLY_UART_BASE_ADDRESS=3D$(EARLY_UART_BASE_= ADDRESS) -CFLAGS-$(EARLY_PRINTK) +=3D -DEARLY_UART_REG_SHIFT=3D$(EARLY_UART_REG_SHIF= T) - -else # !CONFIG_DEBUG - -ifneq ($(CONFIG_EARLY_PRINTK),) -# Early printk is dependant on a debug build. -$(error CONFIG_EARLY_PRINTK enabled for non-debug build) -endif +CFLAGS-y +=3D -DEARLY_PRINTK_INC=3D\"debug-$(EARLY_PRINTK_INC).inc\" +CFLAGS-y +=3D -DEARLY_PRINTK_BAUD=3D$(EARLY_PRINTK_BAUD) +CFLAGS-y +=3D -DEARLY_UART_BASE_ADDRESS=3D$(EARLY_UART_BASE_ADDRESS) +CFLAGS-y +=3D -DEARLY_UART_REG_SHIFT=3D$(EARLY_UART_REG_SHIFT) =20 endif diff --git a/xen/arch/arm/arm32/Makefile b/xen/arch/arm/arm32/Makefile index 0ac254f347..13eeefae13 100644 --- a/xen/arch/arm/arm32/Makefile +++ b/xen/arch/arm/arm32/Makefile @@ -1,6 +1,6 @@ subdir-y +=3D lib =20 -obj-$(EARLY_PRINTK) +=3D debug.o +obj-$(CONFIG_EARLY_PRINTK) +=3D debug.o obj-y +=3D domctl.o obj-y +=3D domain.o obj-y +=3D entry.o diff --git a/xen/arch/arm/arm64/Makefile b/xen/arch/arm/arm64/Makefile index c4f3a28a0d..86572014d0 100644 --- a/xen/arch/arm/arm64/Makefile +++ b/xen/arch/arm/arm64/Makefile @@ -2,7 +2,7 @@ subdir-y +=3D lib =20 obj-y +=3D cache.o obj-$(CONFIG_HARDEN_BRANCH_PREDICTOR) +=3D bpi.o -obj-$(EARLY_PRINTK) +=3D debug.o +obj-$(CONFIG_EARLY_PRINTK) +=3D debug.o obj-y +=3D domctl.o obj-y +=3D domain.o obj-y +=3D entry.o --=20 --=20 (\___(\___(\______ --=3D> 8-) EHM <=3D-- ______/)___/)___= /) \BS ( | ehem+sigmsg@m5p.com PGP 87145445 | ) / \_CS\ | _____ -O #include O- _____ | / _/ 8A19\___\_|_/58D2 7E3D DDF4 7BA6 <-PGP-> 41D1 B375 37D0 8714\_|_/___/5445