Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp1704454ybh; Tue, 14 Jul 2020 05:17:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxZj262D0gfJluIo7ewEEFexjBbvdtVJuGU7uitc0e0tp86FDuLtZOuARcASDbFscnXWhIZ X-Received: by 2002:a17:906:7d90:: with SMTP id v16mr4157740ejo.27.1594729064217; Tue, 14 Jul 2020 05:17:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594729064; cv=none; d=google.com; s=arc-20160816; b=ro6q2vu4k/pundCkJV9FRxcsGkXPZ9V3+s9aXKktccgEi1rw2n3y3wghF/14ReoF+P u3sjtb0pXFo2vkIi8t5HNvQVmfLX55NDsEqkZiVVfxdc5xmSb751sYJqnob0KvvFIoKt zBsnguACb+33UK9p3xSSfTMZzZGk8l3o3zUstpAfHsXq5DVARr1yVGttRlCeTF5HVliu zNi3bVaE+KWMavZ1ww9QbVcN3Yoz9z1RPtRtZUKRF1KUuyRJXYVTarYmvmv6FfebWuAt xyZ6n1B5cdrCPq5F93660BHW5CiNNYPerLuL7owYN0BGSlC0bn4oPGWx751ysdZoyTLo nC8Q== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=p3m8IdL4gncNByAyjoUrdaGghsIOomZYSR8k1QBJjnw=; b=HOEvTTgw0+o0Z5cvevgz/nm549RIVKVe7djHRzwZK83LwVIT2qjJXC/EqcdzvoxqEm j7S0i9eU5yNQT5SFaxfxR7VzKwlyfgJjavo2BvlYrqFPS0TbdgIFGjdjPcuMcSPGiNA5 LSDhCTTyMWZRKRvlufNbsyLfO5Q13B7lReK1Ir2rmUVyjo0ITip0G7gox8FFeJRkzjOn cyAs/h7xmKTzkenH/1bZRMwsZV7CUFTvLfpyirUuIVyOIzyA7nd1hYH97NP3JMLCfHWj aywy//ApU6ruNlosKR+RbCg/gue5PN6Ug4Qe6wtI7Av8U8W1wtlFWKbuiP+gq6bBb0wH vilQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=8bytes.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id lu24si10547015ejb.477.2020.07.14.05.17.19; Tue, 14 Jul 2020 05:17:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=8bytes.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728696AbgGNMP7 (ORCPT + 99 others); Tue, 14 Jul 2020 08:15:59 -0400 Received: from 8bytes.org ([81.169.241.247]:52918 "EHLO theia.8bytes.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728284AbgGNMKv (ORCPT ); Tue, 14 Jul 2020 08:10:51 -0400 Received: from cap.home.8bytes.org (p5b006776.dip0.t-ipconnect.de [91.0.103.118]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by theia.8bytes.org (Postfix) with ESMTPSA id 233E6B70; Tue, 14 Jul 2020 14:10:48 +0200 (CEST) From: Joerg Roedel To: x86@kernel.org Cc: Joerg Roedel , Joerg Roedel , hpa@zytor.com, Andy Lutomirski , Dave Hansen , Peter Zijlstra , Jiri Slaby , Dan Williams , Tom Lendacky , Juergen Gross , Kees Cook , David Rientjes , Cfir Cohen , Erdem Aktas , Masami Hiramatsu , Mike Stunes , Sean Christopherson , Martin Radev , linux-kernel@vger.kernel.org, kvm@vger.kernel.org, virtualization@lists.linux-foundation.org Subject: [PATCH v4 28/75] x86/idt: Split idt_data setup out of set_intr_gate() Date: Tue, 14 Jul 2020 14:08:30 +0200 Message-Id: <20200714120917.11253-29-joro@8bytes.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200714120917.11253-1-joro@8bytes.org> References: <20200714120917.11253-1-joro@8bytes.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Joerg Roedel The code to setup idt_data is needed for early exception handling, but set_intr_gate() can't be used that early because it has pv-ops in its code path, which don't work that early. Split out the idt_data initialization part from set_intr_gate() so that it can be used separatly. Signed-off-by: Joerg Roedel --- arch/x86/kernel/idt.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/arch/x86/kernel/idt.c b/arch/x86/kernel/idt.c index b920f2352df5..367eb6a593dd 100644 --- a/arch/x86/kernel/idt.c +++ b/arch/x86/kernel/idt.c @@ -205,18 +205,24 @@ idt_setup_from_table(gate_desc *idt, const struct idt_data *t, int size, bool sy } } +static void init_idt_data(struct idt_data *data, unsigned int n, + const void *addr) +{ + BUG_ON(n > 0xFF); + + memset(data, 0, sizeof(*data)); + data->vector = n; + data->addr = addr; + data->segment = __KERNEL_CS; + data->bits.type = GATE_INTERRUPT; + data->bits.p = 1; +} + static __init void set_intr_gate(unsigned int n, const void *addr) { struct idt_data data; - BUG_ON(n > 0xFF); - - memset(&data, 0, sizeof(data)); - data.vector = n; - data.addr = addr; - data.segment = __KERNEL_CS; - data.bits.type = GATE_INTERRUPT; - data.bits.p = 1; + init_idt_data(&data, n, addr); idt_setup_from_table(idt_table, &data, 1, false); } -- 2.27.0