Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2480233yba; Mon, 15 Apr 2019 12:31:46 -0700 (PDT) X-Google-Smtp-Source: APXvYqwhVZZg2M4aG25U4N5S7/btWnxFp2bHDErmUAMQRxgSfUqXRdzqnmPqhBjv3agZrFQ/W6eH X-Received: by 2002:a17:902:8ecc:: with SMTP id x12mr77435467plo.0.1555356706615; Mon, 15 Apr 2019 12:31:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555356706; cv=none; d=google.com; s=arc-20160816; b=pZj9vNOItWUmBNyhAsyNj2PHOTqGQwoiMcjheSsnOTNOApbTZVYUqxseIFFXDYOub0 94i0T4oCLuHGl3eRlKgGG+/6upwFkMPlhwuQLlv7l07uVZIp3BVm6AG/JKktWwcdGhj9 dTxkLNynGOmeyHZeB8iLKLGUdkbJOXei5l8QT0WeaqJIZpq5za3aiDX+iE+OS1dAg0sP mibLd8ztZz66af1y8fflWnvI6LdwSrTJqhBpywJjpdyFx7tUW3V2CfVKfV18x3d1ZZbK /m3qljONpsF/b9i+Qaa2AM4ibfvzaNmqZxGoyWTk1kEQJA4lCzzfvco8V0s065ZaLaJa FYeQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=XXzTAUSK1Rkrz3SxkRsGVwMJjlCbultFDukbwW34Fws=; b=oY7pkRd3S8vNMXcCic/Y1UvbbpqW8+TDa8nnKpWFNFuITgyo773L44u66/DW2GR1Tv C8gzGD6HlOBZStZU7JYRIKoj7cqItBJgj1LmYN7z0Frc1Y6GquYR6e20Zy3ZoHW4C9TD cR4F5XJLWADt5d0uHl2fGzZowmY6ayNIgie0lkW+abFu4hy+WAdc0gRTLK0ZByZKabdK IVR49GKes6iOGcp8gVNSmBI3mIEUONlcWA1gbT0ndqmzNUkO4bGobR3t+03HMJiKElUf aMFdOJZjxCwCXEGK3M1tsULTSDy4CO+Al4Uf0Ly0qlS9m5dH0xlI1aQFSy/Qalf5LoeR qXLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=C5+To+Yg; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v20si45331936pfa.224.2019.04.15.12.31.30; Mon, 15 Apr 2019 12:31:46 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=C5+To+Yg; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728391AbfDOTB4 (ORCPT + 99 others); Mon, 15 Apr 2019 15:01:56 -0400 Received: from mail.kernel.org ([198.145.29.99]:60460 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728335AbfDOTBw (ORCPT ); Mon, 15 Apr 2019 15:01:52 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 1D883218D3; Mon, 15 Apr 2019 19:01:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1555354911; bh=22TtPF4sI/bKU7sJXPl65FvIav0uD7OoHgPmcST+5zU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=C5+To+YgQP+hbYXCbqIKbzICol2W8qBxfQ7ozrm7G2O3PaCZhC+IWulprNQf0KSUz lojFvAtG+KpbShEpAt+OiBaZXZdgpxOqbCpVMNX+O/YBrBYIq6Z/RzNakifzti4pjv f0smS/2S2qAoNZBBp+NlhJjNZDsqPWioKTFq76XE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jarkko Nikula , Andy Lutomirski , "Rafael J. Wysocki" , Thomas Gleixner , Borislav Petkov , Josh Poimboeuf , Linus Torvalds , Pavel Machek , Peter Zijlstra , "Rafael J. Wysocki" , Zhang Rui , Ingo Molnar , Sasha Levin Subject: [PATCH 4.14 03/69] x86/power/64: Use struct desc_ptr for the IDT in struct saved_context Date: Mon, 15 Apr 2019 20:58:21 +0200 Message-Id: <20190415183726.883542005@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190415183726.036654568@linuxfoundation.org> References: <20190415183726.036654568@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit 090edbe23ff57940fca7f57d9165ce57a826bd7a ] x86_64's saved_context nonsensically used separate idt_limit and idt_base fields and then cast &idt_limit to struct desc_ptr *. This was correct (with -fno-strict-aliasing), but it's confusing, served no purpose, and required #ifdeffery. Simplify this by using struct desc_ptr directly. No change in functionality. Tested-by: Jarkko Nikula Signed-off-by: Andy Lutomirski Acked-by: Rafael J. Wysocki Acked-by: Thomas Gleixner Cc: Borislav Petkov Cc: Josh Poimboeuf Cc: Linus Torvalds Cc: Pavel Machek Cc: Peter Zijlstra Cc: Rafael J. Wysocki Cc: Zhang Rui Link: http://lkml.kernel.org/r/967909ce38d341b01d45eff53e278e2728a3a93a.1513286253.git.luto@kernel.org Signed-off-by: Ingo Molnar Signed-off-by: Sasha Levin --- arch/x86/include/asm/suspend_64.h | 3 +-- arch/x86/power/cpu.c | 11 +---------- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/arch/x86/include/asm/suspend_64.h b/arch/x86/include/asm/suspend_64.h index 7306e911faee..600e9e0aea51 100644 --- a/arch/x86/include/asm/suspend_64.h +++ b/arch/x86/include/asm/suspend_64.h @@ -30,8 +30,7 @@ struct saved_context { u16 gdt_pad; /* Unused */ struct desc_ptr gdt_desc; u16 idt_pad; - u16 idt_limit; - unsigned long idt_base; + struct desc_ptr idt; u16 ldt; u16 tss; unsigned long tr; diff --git a/arch/x86/power/cpu.c b/arch/x86/power/cpu.c index a51d2dfb57d1..cba2e2c3f89e 100644 --- a/arch/x86/power/cpu.c +++ b/arch/x86/power/cpu.c @@ -82,12 +82,8 @@ static void __save_processor_state(struct saved_context *ctxt) /* * descriptor tables */ -#ifdef CONFIG_X86_32 store_idt(&ctxt->idt); -#else -/* CONFIG_X86_64 */ - store_idt((struct desc_ptr *)&ctxt->idt_limit); -#endif + /* * We save it here, but restore it only in the hibernate case. * For ACPI S3 resume, this is loaded via 'early_gdt_desc' in 64-bit @@ -221,12 +217,7 @@ static void notrace __restore_processor_state(struct saved_context *ctxt) * now restore the descriptor tables to their proper values * ltr is done i fix_processor_context(). */ -#ifdef CONFIG_X86_32 load_idt(&ctxt->idt); -#else -/* CONFIG_X86_64 */ - load_idt((const struct desc_ptr *)&ctxt->idt_limit); -#endif #ifdef CONFIG_X86_64 /* -- 2.19.1