From patchwork Thu Oct 18 20:43:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Ehrhardt X-Patchwork-Id: 10648169 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id AEE0817D4 for ; Thu, 18 Oct 2018 20:43:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9C8DD28DF4 for ; Thu, 18 Oct 2018 20:43:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9090F28E24; Thu, 18 Oct 2018 20:43:08 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 316B228DF4 for ; Thu, 18 Oct 2018 20:43:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726733AbeJSEpw (ORCPT ); Fri, 19 Oct 2018 00:45:52 -0400 Received: from smtp.in-ulm.de ([217.10.8.16]:46629 "EHLO smtp.in-ulm.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725934AbeJSEpw (ORCPT ); Fri, 19 Oct 2018 00:45:52 -0400 X-Virus-Scanned: Debian amavisd-new at smtp.in-ulm.de DKIM-Filter: OpenDKIM Filter v2.9.1 smtp.in-ulm.de D2FAB40B97 Received: from mail.in-ulm.de (unknown [217.10.8.10]) by smtp.in-ulm.de (Postfix) with SMTP id 6E5A340B82 for ; Thu, 18 Oct 2018 22:44:01 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.9.1 smtp.in-ulm.de 6E5A340B82 Received: (qmail 507451 invoked by uid 10524); 18 Oct 2018 20:43:03 -0000 Date: Thu, 18 Oct 2018 22:43:03 +0200 From: Christian Ehrhardt To: kvm@vger.kernel.org Subject: [PATCH] x86: Fix definition and use of DR6_RESERVED Message-ID: <20181018204303.GO573482@lisa.in-ulm.de> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Bit 16 in %dr6 (RTM) is no longer reserved. Adjust the definition of DR6_RESERVED and provide new constants DR6_INIT (moved from kvm_host.h) and DR_RTM. Fix existing users of DR6_RESERVED that want DR6_INIT instead. Signed-off-by: Christian Ehrhardt --- arch/x86/include/asm/kvm_host.h | 1 - arch/x86/include/uapi/asm/debugreg.h | 5 ++++- arch/x86/kernel/process_32.c | 2 +- arch/x86/kernel/process_64.c | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h index 09b2e3e2cf1b..4e686713c45f 100644 --- a/arch/x86/include/asm/kvm_host.h +++ b/arch/x86/include/asm/kvm_host.h @@ -179,7 +179,6 @@ enum { #define DR6_BS (1 << 14) #define DR6_RTM (1 << 16) #define DR6_FIXED_1 0xfffe0ff0 -#define DR6_INIT 0xffff0ff0 #define DR6_VOLATILE 0x0001e00f #define DR7_BP_EN_MASK 0x000000ff diff --git a/arch/x86/include/uapi/asm/debugreg.h b/arch/x86/include/uapi/asm/debugreg.h index d95d080b30e3..bba5b98fbd46 100644 --- a/arch/x86/include/uapi/asm/debugreg.h +++ b/arch/x86/include/uapi/asm/debugreg.h @@ -16,7 +16,9 @@ are either reserved or not of interest to us. */ /* Define reserved bits in DR6 which are always set to 1 */ -#define DR6_RESERVED (0xFFFF0FF0) +#define DR6_RESERVED (0xFFFE0FF0) +/* Initial (reset) value of DR6 */ +#define DR6_INIT (0xFFFF0FF0) #define DR_TRAP0 (0x1) /* db0 */ #define DR_TRAP1 (0x2) /* db1 */ @@ -26,6 +28,7 @@ #define DR_STEP (0x4000) /* single-step */ #define DR_SWITCH (0x8000) /* task switch */ +#define DR_RTM (0x10000) /* #DB/#BP in RTM region */ /* Now define a bunch of things for manipulating the control register. The top two bytes of the control register consist of 4 fields of 4 diff --git a/arch/x86/kernel/process_32.c b/arch/x86/kernel/process_32.c index 5046a3c9dec2..8b39b6155ff8 100644 --- a/arch/x86/kernel/process_32.c +++ b/arch/x86/kernel/process_32.c @@ -104,7 +104,7 @@ void __show_regs(struct pt_regs *regs, enum show_regs_mode mode) /* Only print out debug registers if they are in their non-default state. */ if ((d0 == 0) && (d1 == 0) && (d2 == 0) && (d3 == 0) && - (d6 == DR6_RESERVED) && (d7 == 0x400)) + (d6 == DR6_INIT) && (d7 == 0x400)) return; printk(KERN_DEFAULT "DR0: %08lx DR1: %08lx DR2: %08lx DR3: %08lx\n", diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c index ea5ea850348d..25de610826a8 100644 --- a/arch/x86/kernel/process_64.c +++ b/arch/x86/kernel/process_64.c @@ -129,7 +129,7 @@ void __show_regs(struct pt_regs *regs, enum show_regs_mode mode) /* Only print out debug registers if they are in their non-default state. */ if (!((d0 == 0) && (d1 == 0) && (d2 == 0) && (d3 == 0) && - (d6 == DR6_RESERVED) && (d7 == 0x400))) { + (d6 == DR6_INIT) && (d7 == 0x400))) { printk(KERN_DEFAULT "DR0: %016lx DR1: %016lx DR2: %016lx\n", d0, d1, d2); printk(KERN_DEFAULT "DR3: %016lx DR6: %016lx DR7: %016lx\n",