The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Avi Kivity <avi@qumranet.com>
To: kvm@vger.kernel.org
Cc: linux-kernel@vger.kernel.org,
	Guillaume Thouvenin <guillaume.thouvenin@ext.bull.net>
Subject: [PATCH 22/50] KVM: Prefixes segment functions that will be exported with "kvm_"
Date: Thu, 26 Jun 2008 15:28:04 +0300	[thread overview]
Message-ID: <1214483312-9265-23-git-send-email-avi@qumranet.com> (raw)
In-Reply-To: <1214483312-9265-1-git-send-email-avi@qumranet.com>

From: Guillaume Thouvenin <guillaume.thouvenin@ext.bull.net>

Prefixes functions that will be exported with kvm_.
We also prefixed set_segment() even if it still static
to be coherent.

signed-off-by: Guillaume Thouvenin <guillaume.thouvenin@ext.bull.net>
Signed-off-by: Laurent Vivier <laurent.vivier@bull.net>
Signed-off-by: Avi Kivity <avi@qumranet.com>
---
 arch/x86/kvm/x86.c         |   78 ++++++++++++++++++++++----------------------
 include/asm-x86/kvm_host.h |    4 ++
 2 files changed, 43 insertions(+), 39 deletions(-)

diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 2095e79..51810d8 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -3100,8 +3100,8 @@ int kvm_arch_vcpu_ioctl_set_regs(struct kvm_vcpu *vcpu, struct kvm_regs *regs)
 	return 0;
 }
 
-static void get_segment(struct kvm_vcpu *vcpu,
-			struct kvm_segment *var, int seg)
+void kvm_get_segment(struct kvm_vcpu *vcpu,
+		     struct kvm_segment *var, int seg)
 {
 	kvm_x86_ops->get_segment(vcpu, var, seg);
 }
@@ -3110,7 +3110,7 @@ void kvm_get_cs_db_l_bits(struct kvm_vcpu *vcpu, int *db, int *l)
 {
 	struct kvm_segment cs;
 
-	get_segment(vcpu, &cs, VCPU_SREG_CS);
+	kvm_get_segment(vcpu, &cs, VCPU_SREG_CS);
 	*db = cs.db;
 	*l = cs.l;
 }
@@ -3124,15 +3124,15 @@ int kvm_arch_vcpu_ioctl_get_sregs(struct kvm_vcpu *vcpu,
 
 	vcpu_load(vcpu);
 
-	get_segment(vcpu, &sregs->cs, VCPU_SREG_CS);
-	get_segment(vcpu, &sregs->ds, VCPU_SREG_DS);
-	get_segment(vcpu, &sregs->es, VCPU_SREG_ES);
-	get_segment(vcpu, &sregs->fs, VCPU_SREG_FS);
-	get_segment(vcpu, &sregs->gs, VCPU_SREG_GS);
-	get_segment(vcpu, &sregs->ss, VCPU_SREG_SS);
+	kvm_get_segment(vcpu, &sregs->cs, VCPU_SREG_CS);
+	kvm_get_segment(vcpu, &sregs->ds, VCPU_SREG_DS);
+	kvm_get_segment(vcpu, &sregs->es, VCPU_SREG_ES);
+	kvm_get_segment(vcpu, &sregs->fs, VCPU_SREG_FS);
+	kvm_get_segment(vcpu, &sregs->gs, VCPU_SREG_GS);
+	kvm_get_segment(vcpu, &sregs->ss, VCPU_SREG_SS);
 
-	get_segment(vcpu, &sregs->tr, VCPU_SREG_TR);
-	get_segment(vcpu, &sregs->ldt, VCPU_SREG_LDTR);
+	kvm_get_segment(vcpu, &sregs->tr, VCPU_SREG_TR);
+	kvm_get_segment(vcpu, &sregs->ldt, VCPU_SREG_LDTR);
 
 	kvm_x86_ops->get_idt(vcpu, &dt);
 	sregs->idt.limit = dt.limit;
@@ -3184,7 +3184,7 @@ int kvm_arch_vcpu_ioctl_set_mpstate(struct kvm_vcpu *vcpu,
 	return 0;
 }
 
-static void set_segment(struct kvm_vcpu *vcpu,
+static void kvm_set_segment(struct kvm_vcpu *vcpu,
 			struct kvm_segment *var, int seg)
 {
 	kvm_x86_ops->set_segment(vcpu, var, seg);
@@ -3221,7 +3221,7 @@ static void get_segment_descritptor_dtable(struct kvm_vcpu *vcpu,
 	if (selector & 1 << 2) {
 		struct kvm_segment kvm_seg;
 
-		get_segment(vcpu, &kvm_seg, VCPU_SREG_LDTR);
+		kvm_get_segment(vcpu, &kvm_seg, VCPU_SREG_LDTR);
 
 		if (kvm_seg.unusable)
 			dtable->limit = 0;
@@ -3327,7 +3327,7 @@ static u16 get_segment_selector(struct kvm_vcpu *vcpu, int seg)
 {
 	struct kvm_segment kvm_seg;
 
-	get_segment(vcpu, &kvm_seg, seg);
+	kvm_get_segment(vcpu, &kvm_seg, seg);
 	return kvm_seg.selector;
 }
 
@@ -3343,8 +3343,8 @@ static int load_segment_descriptor_to_kvm_desct(struct kvm_vcpu *vcpu,
 	return 0;
 }
 
-static int load_segment_descriptor(struct kvm_vcpu *vcpu, u16 selector,
-				   int type_bits, int seg)
+int kvm_load_segment_descriptor(struct kvm_vcpu *vcpu, u16 selector,
+				int type_bits, int seg)
 {
 	struct kvm_segment kvm_seg;
 
@@ -3357,7 +3357,7 @@ static int load_segment_descriptor(struct kvm_vcpu *vcpu, u16 selector,
 		if (!kvm_seg.s)
 			kvm_seg.unusable = 1;
 
-	set_segment(vcpu, &kvm_seg, seg);
+	kvm_set_segment(vcpu, &kvm_seg, seg);
 	return 0;
 }
 
@@ -3403,25 +3403,25 @@ static int load_state_from_tss32(struct kvm_vcpu *vcpu,
 	vcpu->arch.regs[VCPU_REGS_RSI] = tss->esi;
 	vcpu->arch.regs[VCPU_REGS_RDI] = tss->edi;
 
-	if (load_segment_descriptor(vcpu, tss->ldt_selector, 0, VCPU_SREG_LDTR))
+	if (kvm_load_segment_descriptor(vcpu, tss->ldt_selector, 0, VCPU_SREG_LDTR))
 		return 1;
 
-	if (load_segment_descriptor(vcpu, tss->es, 1, VCPU_SREG_ES))
+	if (kvm_load_segment_descriptor(vcpu, tss->es, 1, VCPU_SREG_ES))
 		return 1;
 
-	if (load_segment_descriptor(vcpu, tss->cs, 9, VCPU_SREG_CS))
+	if (kvm_load_segment_descriptor(vcpu, tss->cs, 9, VCPU_SREG_CS))
 		return 1;
 
-	if (load_segment_descriptor(vcpu, tss->ss, 1, VCPU_SREG_SS))
+	if (kvm_load_segment_descriptor(vcpu, tss->ss, 1, VCPU_SREG_SS))
 		return 1;
 
-	if (load_segment_descriptor(vcpu, tss->ds, 1, VCPU_SREG_DS))
+	if (kvm_load_segment_descriptor(vcpu, tss->ds, 1, VCPU_SREG_DS))
 		return 1;
 
-	if (load_segment_descriptor(vcpu, tss->fs, 1, VCPU_SREG_FS))
+	if (kvm_load_segment_descriptor(vcpu, tss->fs, 1, VCPU_SREG_FS))
 		return 1;
 
-	if (load_segment_descriptor(vcpu, tss->gs, 1, VCPU_SREG_GS))
+	if (kvm_load_segment_descriptor(vcpu, tss->gs, 1, VCPU_SREG_GS))
 		return 1;
 	return 0;
 }
@@ -3462,19 +3462,19 @@ static int load_state_from_tss16(struct kvm_vcpu *vcpu,
 	vcpu->arch.regs[VCPU_REGS_RSI] = tss->si;
 	vcpu->arch.regs[VCPU_REGS_RDI] = tss->di;
 
-	if (load_segment_descriptor(vcpu, tss->ldt, 0, VCPU_SREG_LDTR))
+	if (kvm_load_segment_descriptor(vcpu, tss->ldt, 0, VCPU_SREG_LDTR))
 		return 1;
 
-	if (load_segment_descriptor(vcpu, tss->es, 1, VCPU_SREG_ES))
+	if (kvm_load_segment_descriptor(vcpu, tss->es, 1, VCPU_SREG_ES))
 		return 1;
 
-	if (load_segment_descriptor(vcpu, tss->cs, 9, VCPU_SREG_CS))
+	if (kvm_load_segment_descriptor(vcpu, tss->cs, 9, VCPU_SREG_CS))
 		return 1;
 
-	if (load_segment_descriptor(vcpu, tss->ss, 1, VCPU_SREG_SS))
+	if (kvm_load_segment_descriptor(vcpu, tss->ss, 1, VCPU_SREG_SS))
 		return 1;
 
-	if (load_segment_descriptor(vcpu, tss->ds, 1, VCPU_SREG_DS))
+	if (kvm_load_segment_descriptor(vcpu, tss->ds, 1, VCPU_SREG_DS))
 		return 1;
 	return 0;
 }
@@ -3532,7 +3532,7 @@ int kvm_task_switch(struct kvm_vcpu *vcpu, u16 tss_selector, int reason)
 	struct desc_struct nseg_desc;
 	int ret = 0;
 
-	get_segment(vcpu, &tr_seg, VCPU_SREG_TR);
+	kvm_get_segment(vcpu, &tr_seg, VCPU_SREG_TR);
 
 	if (load_guest_segment_descriptor(vcpu, tss_selector, &nseg_desc))
 		goto out;
@@ -3591,7 +3591,7 @@ int kvm_task_switch(struct kvm_vcpu *vcpu, u16 tss_selector, int reason)
 	kvm_x86_ops->set_cr0(vcpu, vcpu->arch.cr0 | X86_CR0_TS);
 	seg_desct_to_kvm_desct(&nseg_desc, tss_selector, &tr_seg);
 	tr_seg.type = 11;
-	set_segment(vcpu, &tr_seg, VCPU_SREG_TR);
+	kvm_set_segment(vcpu, &tr_seg, VCPU_SREG_TR);
 out:
 	kvm_x86_ops->decache_regs(vcpu);
 	return ret;
@@ -3658,15 +3658,15 @@ int kvm_arch_vcpu_ioctl_set_sregs(struct kvm_vcpu *vcpu,
 		}
 	}
 
-	set_segment(vcpu, &sregs->cs, VCPU_SREG_CS);
-	set_segment(vcpu, &sregs->ds, VCPU_SREG_DS);
-	set_segment(vcpu, &sregs->es, VCPU_SREG_ES);
-	set_segment(vcpu, &sregs->fs, VCPU_SREG_FS);
-	set_segment(vcpu, &sregs->gs, VCPU_SREG_GS);
-	set_segment(vcpu, &sregs->ss, VCPU_SREG_SS);
+	kvm_set_segment(vcpu, &sregs->cs, VCPU_SREG_CS);
+	kvm_set_segment(vcpu, &sregs->ds, VCPU_SREG_DS);
+	kvm_set_segment(vcpu, &sregs->es, VCPU_SREG_ES);
+	kvm_set_segment(vcpu, &sregs->fs, VCPU_SREG_FS);
+	kvm_set_segment(vcpu, &sregs->gs, VCPU_SREG_GS);
+	kvm_set_segment(vcpu, &sregs->ss, VCPU_SREG_SS);
 
-	set_segment(vcpu, &sregs->tr, VCPU_SREG_TR);
-	set_segment(vcpu, &sregs->ldt, VCPU_SREG_LDTR);
+	kvm_set_segment(vcpu, &sregs->tr, VCPU_SREG_TR);
+	kvm_set_segment(vcpu, &sregs->ldt, VCPU_SREG_LDTR);
 
 	vcpu_put(vcpu);
 
diff --git a/include/asm-x86/kvm_host.h b/include/asm-x86/kvm_host.h
index fc72bad..cd6a4bb 100644
--- a/include/asm-x86/kvm_host.h
+++ b/include/asm-x86/kvm_host.h
@@ -503,6 +503,10 @@ int emulator_get_dr(struct x86_emulate_ctxt *ctxt, int dr,
 int emulator_set_dr(struct x86_emulate_ctxt *ctxt, int dr,
 		    unsigned long value);
 
+void kvm_get_segment(struct kvm_vcpu *vcpu, struct kvm_segment *var, int seg);
+int kvm_load_segment_descriptor(struct kvm_vcpu *vcpu, u16 selector,
+				int type_bits, int seg);
+
 int kvm_task_switch(struct kvm_vcpu *vcpu, u16 tss_selector, int reason);
 
 void kvm_set_cr0(struct kvm_vcpu *vcpu, unsigned long cr0);
-- 
1.5.6


  parent reply	other threads:[~2008-06-26 12:42 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-26 12:27 [PATCH 00/50] KVM patches review for the 2.6.27 merge window Avi Kivity
2008-06-26 12:27 ` [PATCH 01/50] KVM: remove long -> void *user -> long cast Avi Kivity
2008-06-26 12:27 ` [PATCH 02/50] KVM: add statics were possible, function definition in lapic.h Avi Kivity
2008-06-26 12:27 ` [PATCH 03/50] KVM: VMX: move APIC_ACCESS trace entry to generic code Avi Kivity
2008-06-26 12:27 ` [PATCH 04/50] KVM: SVM: implement dedicated NMI exit handler Avi Kivity
2008-06-26 12:27 ` [PATCH 05/50] KVM: SVM: implement dedicated INTR " Avi Kivity
2008-06-26 12:27 ` [PATCH 06/50] KVM: add missing kvmtrace bits Avi Kivity
2008-06-26 12:27 ` [PATCH 07/50] KVM: SVM: add missing kvmtrace markers Avi Kivity
2008-06-26 12:27 ` [PATCH 08/50] KVM: SVM: add tracing support for TDP page faults Avi Kivity
2008-06-26 12:27 ` [PATCH 09/50] KVM: Handle vma regions with no backing page Avi Kivity
2008-06-26 12:27 ` [PATCH 10/50] KVM: PIT: support mode 3 Avi Kivity
2008-06-26 12:27 ` [PATCH 11/50] KVM: SVM: Fake MSR_K7 performance counters Avi Kivity
2008-06-26 12:27 ` [PATCH 12/50] KVM: VMX: Trivial vmcs_write64() code simplification Avi Kivity
2008-06-26 12:27 ` [PATCH 13/50] KVM: MMU: Fix false flooding when a pte points to page table Avi Kivity
2008-06-26 12:27 ` [PATCH 14/50] KVM: Handle virtualization instruction #UD faults during reboot Avi Kivity
2008-06-26 12:27 ` [PATCH 15/50] KVM: VMX: Add list of potentially locally cached vcpus Avi Kivity
2008-06-26 12:27 ` [PATCH 16/50] KVM: Remove decache_vcpus_on_cpu() and related callbacks Avi Kivity
2008-06-26 12:27 ` [PATCH 17/50] KVM: Remove unnecessary ->decache_regs() call Avi Kivity
2008-06-26 12:28 ` [PATCH 18/50] KVM: IOAPIC/LAPIC: Enable NMI support Avi Kivity
2008-06-26 12:28 ` [PATCH 19/50] KVM: VMX: Enable NMI with in-kernel irqchip Avi Kivity
2008-06-26 12:28 ` [PATCH 20/50] KVM: Order segment register constants in the same way as cpu operand encoding Avi Kivity
2008-06-26 12:28 ` [PATCH 21/50] KVM: MTRR support Avi Kivity
2008-06-26 12:28 ` Avi Kivity [this message]
2008-06-26 12:28 ` [PATCH 23/50] KVM: x86 emulator: Update c->dst.bytes in decode instruction Avi Kivity
2008-06-26 12:28 ` [PATCH 24/50] KVM: x86 emulator: add support for jmp far 0xea Avi Kivity
2008-06-26 12:28 ` [PATCH 25/50] KVM: x86 emulator: adds support to mov r,imm (opcode 0xb8) instruction Avi Kivity
2008-06-26 12:28 ` [PATCH 26/50] KVM: x86 emulator: Add support for mov seg, r (0x8e) instruction Avi Kivity
2008-06-26 12:28 ` [PATCH 27/50] KVM: x86 emulator: Add support for mov r, sreg (0x8c) instruction Avi Kivity
2008-06-26 12:28 ` [PATCH 28/50] KVM: MMU: Optimize prefetch_page() Avi Kivity
2008-06-26 12:28 ` [PATCH 29/50] KVM: x86 emulator: simplify push imm8 emulation Avi Kivity
2008-06-26 12:28 ` [PATCH 30/50] KVM: x86 emulator: implement 'push imm' (opcode 0x68) Avi Kivity
2008-06-26 12:28 ` [PATCH 31/50] KVM: MMU: Move nonpaging_prefetch_page() Avi Kivity
2008-06-26 12:28 ` [PATCH 32/50] KVM: MMU: Avoid page prefetch on SVM Avi Kivity
2008-06-26 12:28 ` [PATCH 33/50] KVM: kvm_io_device: extend in_range() to manage len and write attribute Avi Kivity
2008-06-26 12:28 ` [PATCH 34/50] KVM: Add coalesced MMIO support (common part) Avi Kivity
2008-06-26 12:28 ` [PATCH 35/50] KVM: Add coalesced MMIO support (x86 part) Avi Kivity
2008-06-26 12:28 ` [PATCH 36/50] KVM: Add coalesced MMIO support (powerpc part) Avi Kivity
2008-06-26 12:28 ` [PATCH 37/50] KVM: Add coalesced MMIO support (ia64 part) Avi Kivity
2008-06-26 12:28 ` [PATCH 38/50] KVM: only abort guest entry if timer count goes from 0->1 Avi Kivity
2008-06-26 12:28 ` [PATCH 39/50] KVM: Do not calculate linear rip in emulation failure report Avi Kivity
2008-06-26 12:28 ` [PATCH 40/50] KVM: Support mixed endian machines Avi Kivity
2008-06-26 12:28 ` [PATCH 41/50] KVM: Use printk_rlimit() instead of reporting emulation failures just once Avi Kivity
2008-06-26 12:28 ` [PATCH 42/50] KVM: x86 emulator: emulate nop and xchg reg, acc (opcodes 0x90 - 0x97) Avi Kivity
2008-06-26 12:28 ` [PATCH 43/50] KVM: x86 emulator: handle undecoded rex.b with r/m = 5 in certain cases Avi Kivity
2008-06-26 12:28 ` [PATCH 44/50] KVM: x86 emulator: simplify sib decoding Avi Kivity
2008-06-26 12:28 ` [PATCH 45/50] KVM: x86 emulator: simplify r/m decoding Avi Kivity
2008-06-26 12:28 ` [PATCH 46/50] KVM: x86 emulator: simplify rip relative decoding Avi Kivity
2008-06-26 12:28 ` [PATCH 47/50] KVM: x86 emulator: avoid segment base adjust for lea Avi Kivity
2008-06-26 12:28 ` [PATCH 48/50] KVM: x86 emulator: lazily evaluate segment registers Avi Kivity
2008-06-26 12:28 ` [PATCH 49/50] KVM: MMU: When debug is enabled, make it a run-time parameter Avi Kivity
2008-06-26 12:28 ` [PATCH 50/50] KVM: MMU: Fix printk format Avi Kivity

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1214483312-9265-23-git-send-email-avi@qumranet.com \
    --to=avi@qumranet.com \
    --cc=guillaume.thouvenin@ext.bull.net \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox