From nobody Fri Nov 29 20:58:19 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; dkim=pass; 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; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1629318656; cv=none; d=zohomail.com; s=zohoarc; b=kZkpYe4I2YSBZzN051sV3c6pNMoWd9iAISePCuFwjYvDiESBolagroxbtl19465hb9BIoMYIH3tbHZGk4JDNjvzvSA4S59nPbGvQjd22KlZe9iv3ufVcBAgOLoyzXYQeaOEqbENvfMxOckO86TP47DVZZIe0e2No4esTKA/Sf1w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1629318656; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=mzhpzYQx8peh1hdfIxEJjNatsuoe8FeZa6ijWCK1xjE=; b=MVsvxKR7hjJRMTfPpG4WHex84u0ueg7nUK1C6GEyY6seUdDSvu604OnL6wy3UfxJNnxMFLopL7OqqOFcL60pracngHLn84C/XH8QgdNMrjDQXq/S61eIC7BkBCFZQAUaypr57Dr3AiugtY5P6Phka97ULepmPzwvVtwizFJFXcs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1629318656422256.19816617019967; Wed, 18 Aug 2021 13:30:56 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.168323.307383 (Exim 4.92) (envelope-from ) id 1mGSCf-0001cD-Da; Wed, 18 Aug 2021 20:30:25 +0000 Received: by outflank-mailman (output) from mailman id 168323.307383; Wed, 18 Aug 2021 20:30:25 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mGSCf-0001c2-8s; Wed, 18 Aug 2021 20:30:25 +0000 Received: by outflank-mailman (input) for mailman id 168323; Wed, 18 Aug 2021 20:30:24 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mGSCe-000714-Nn for xen-devel@lists.xenproject.org; Wed, 18 Aug 2021 20:30:24 +0000 Received: from mail-pf1-x432.google.com (unknown [2607:f8b0:4864:20::432]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 987880ea-60b2-4804-8cff-7b21d3fb1597; Wed, 18 Aug 2021 20:29:55 +0000 (UTC) Received: by mail-pf1-x432.google.com with SMTP id 7so3368494pfl.10 for ; Wed, 18 Aug 2021 13:29:55 -0700 (PDT) Received: from localhost.localdomain ([2601:1c2:4c02:4c00::1]) by smtp.gmail.com with ESMTPSA id h25sm663775pfo.68.2021.08.18.13.29.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Aug 2021 13:29:53 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list X-Inumbo-ID: 987880ea-60b2-4804-8cff-7b21d3fb1597 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=mzhpzYQx8peh1hdfIxEJjNatsuoe8FeZa6ijWCK1xjE=; b=h4CssbkPRxoitKam7/BAJ4YSIkbQ5wgEJmqRDamJcE7VRRfD3gKOIrhe8dba7nvdcG JO/OTO50Hhffn4Umpq9ojl3V03aoRR1GNGIxxFq9zvKKj4mRLIimKh6SCJk4KwbIgT67 jg1h4NTO/yhv4RRs8TDmaogpTJx6qx8SV7ijUXV2UmX34ROA2Nvugc451XcdHP3zShf0 gdyLMDdgCehTZ4oNytgVAXoEo3NMB2lGpGW/fRzLDhPq/V+6xHB9mzSURLPWWeAtWUMm Isf6PRsLvjb3cKOacE8R4KxzyqDHnrPs/r0bEs25a371/Qnw6QqLu2WH7dGOLSWfGav+ qcDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=mzhpzYQx8peh1hdfIxEJjNatsuoe8FeZa6ijWCK1xjE=; b=tJdtfGvHFiqW6y4EYvjPRHZY58ccai7zuQLGKBhq0A8AywChA5Q8JDiwBVc+O2KAjA jkb6/UswL/P48+UwrQaZfSf/6HANWbBh1RxXdlEHRgOGA0bp1DBKwtTQpMD401UljInV nfSvr8VB92OK85hsZN7/XqRS04litUXs7KGn9NW6cn6wa1bD8lfgU8dW29o5fwuYVGc2 xDD5951DC+X6o3AO7BHANUVUdQyH2Nk/ZIagP9UmiJ5CbHys60xQ+IABbkaWWbl+R1kk UtpfnV/FzvrVBnDB2W3vzhbmT3jcQpg9BblU6HvS6xKjl5ybXHFWSrURo6I7IILVjtU+ KhWA== X-Gm-Message-State: AOAM532WiHJAW4BiaA48KfEBQlYalERvmtilS1/pXZ3c+mN9QBdJOuld cK81hqMfz/YvWP2qR+jp+76wmnwt+E1aCWnd X-Google-Smtp-Source: ABdhPJzSC9bUuemsB4if7L49hfh2BOsBCLPEaZDrpMrX0BOd6P+1gfwEGSXAxdUsbBvPto83tIMMEQ== X-Received: by 2002:a62:87c5:0:b029:3b5:f90f:c2eb with SMTP id i188-20020a6287c50000b02903b5f90fc2ebmr11339383pfe.28.1629318594044; Wed, 18 Aug 2021 13:29:54 -0700 (PDT) Sender: Bobby Eshleman From: Bobby Eshleman To: xen-devel@lists.xenproject.org Cc: Bobby Eshleman , Stefano Stabellini , Julien Grall , Volodymyr Babchuk , Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Wei Liu , Elena Ufimtseva , Jun Nakajima , Kevin Tian , George Dunlap , Ian Jackson Subject: [PATCH v3 6/6] x86: change asm/debugger.h to xen/debugger.h Date: Wed, 18 Aug 2021 13:29:07 -0700 Message-Id: X-Mailer: git-send-email 2.32.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1629318657599100001 Content-Type: text/plain; charset="utf-8" This commit allows non-x86 architecture to omit the file asm/debugger.h if they do not require it. It changes debugger.h to be a general xen/debugger.h which, if CONFIG_CRASH_DEBUG, resolves to include asm/debugger.h. It also changes all asm/debugger.h includes to xen/debugger.h. Because it is no longer required, arm/debugger.h is removed. Signed-off-by: Bobby Eshleman Acked-by: Julien Grall --- Changes in v3: - No longer introduces a fake TRAP_invalid_op for arm to consume, it is not necessary given the removal of the arm calls now precedes this patch. - Instead of defining prototypes that arch/ is expected to implement, this version simply #includes when CONFIG_CRASH_DEBUG. xen/arch/x86/traps.c | 2 +- xen/common/domain.c | 2 +- xen/common/gdbstub.c | 2 +- xen/common/keyhandler.c | 2 +- xen/common/shutdown.c | 2 +- xen/drivers/char/console.c | 2 +- xen/include/asm-arm/debugger.h | 15 ---------- xen/include/asm-x86/debugger.h | 15 ---------- xen/include/xen/debugger.h | 51 ++++++++++++++++++++++++++++++++++ 9 files changed, 57 insertions(+), 36 deletions(-) delete mode 100644 xen/include/asm-arm/debugger.h create mode 100644 xen/include/xen/debugger.h diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c index 5947ed25d6..a540f0832e 100644 --- a/xen/arch/x86/traps.c +++ b/xen/arch/x86/traps.c @@ -35,6 +35,7 @@ #include #include #include +#include #include #include #include @@ -62,7 +63,6 @@ #include #include #include -#include #include #include #include diff --git a/xen/common/domain.c b/xen/common/domain.c index 6b71c6d6a9..a87d814b38 100644 --- a/xen/common/domain.c +++ b/xen/common/domain.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -33,7 +34,6 @@ #include #include #include -#include #include #include #include diff --git a/xen/common/gdbstub.c b/xen/common/gdbstub.c index 848c1f4327..1d7b98cdac 100644 --- a/xen/common/gdbstub.c +++ b/xen/common/gdbstub.c @@ -38,12 +38,12 @@ #include #include #include -#include #include #include #include #include #include +#include #include #include =20 diff --git a/xen/common/keyhandler.c b/xen/common/keyhandler.c index 8b9f378371..1eafaef9b2 100644 --- a/xen/common/keyhandler.c +++ b/xen/common/keyhandler.c @@ -3,6 +3,7 @@ */ =20 #include +#include #include #include #include @@ -20,7 +21,6 @@ #include #include #include -#include #include =20 static unsigned char keypress_key; diff --git a/xen/common/shutdown.c b/xen/common/shutdown.c index abde48aa4c..a933ee001e 100644 --- a/xen/common/shutdown.c +++ b/xen/common/shutdown.c @@ -2,13 +2,13 @@ #include #include #include +#include #include #include #include #include #include #include -#include #include =20 /* opt_noreboot: If true, machine will need manual reset on error. */ diff --git a/xen/drivers/char/console.c b/xen/drivers/char/console.c index 7d0a603d03..3d1cdde821 100644 --- a/xen/drivers/char/console.c +++ b/xen/drivers/char/console.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -26,7 +27,6 @@ #include #include #include -#include #include #include /* for do_console_io */ #include diff --git a/xen/include/asm-arm/debugger.h b/xen/include/asm-arm/debugger.h deleted file mode 100644 index ac776efa78..0000000000 --- a/xen/include/asm-arm/debugger.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef __ARM_DEBUGGER_H__ -#define __ARM_DEBUGGER_H__ - -#define debugger_trap_fatal(v, r) (0) -#define debugger_trap_immediate() ((void) 0) - -#endif /* __ARM_DEBUGGER_H__ */ -/* - * Local variables: - * mode: C - * c-file-style: "BSD" - * c-basic-offset: 4 - * indent-tabs-mode: nil - * End: - */ diff --git a/xen/include/asm-x86/debugger.h b/xen/include/asm-x86/debugger.h index 8f6222956e..b9eeed395c 100644 --- a/xen/include/asm-x86/debugger.h +++ b/xen/include/asm-x86/debugger.h @@ -25,9 +25,6 @@ #include #include #include - -#ifdef CONFIG_CRASH_DEBUG - #include =20 static inline bool debugger_trap_fatal( @@ -40,16 +37,4 @@ static inline bool debugger_trap_fatal( /* Int3 is a trivial way to gather cpu_user_regs context. */ #define debugger_trap_immediate() __asm__ __volatile__ ( "int3" ); =20 -#else - -static inline bool debugger_trap_fatal( - unsigned int vector, struct cpu_user_regs *regs) -{ - return false; -} - -#define debugger_trap_immediate() ((void)0) - -#endif - #endif /* __X86_DEBUGGER_H__ */ diff --git a/xen/include/xen/debugger.h b/xen/include/xen/debugger.h new file mode 100644 index 0000000000..166fad9d2e --- /dev/null +++ b/xen/include/xen/debugger.h @@ -0,0 +1,51 @@ +/*************************************************************************= ***** + * Generic hooks into arch-dependent Xen. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; If not, see . + * + * Each debugger should define two functions here: + * + * 1. debugger_trap_fatal(): + * Called when Xen is about to give up and crash. Typically you will use = this + * hook to drop into a debug session. It can also be used to hook off + * deliberately caused traps (which you then handle and return non-zero). + * + * 2. debugger_trap_immediate(): + * Called if we want to drop into a debugger now. This is essentially the + * same as debugger_trap_fatal, except that we use the current register s= tate + * rather than the state which was in effect when we took the trap. + * For example: if we're dying because of an unhandled exception, we call + * debugger_trap_fatal; if we're dying because of a panic() we call + * debugger_trap_immediate(). + */ + +#ifndef __XEN_DEBUGGER_H__ +#define __XEN_DEBUGGER_H__ + +#ifdef CONFIG_CRASH_DEBUG + +#include + +#else + +#include + +static inline bool debugger_trap_fatal( + unsigned int vector, const struct cpu_user_regs *regs) +{ + return false; +} + +static inline void debugger_trap_immediate(void) +{ +} + +#endif /* CONFIG_CRASH_DEBUG */ + +#endif /* __XEN_DEBUGGER_H__ */ --=20 2.32.0