ia64/xen-unstable

view xen/include/asm-ia64/vmx_platform.h @ 10908:a6cb8ba24a91

[HVM] Place all APIC registers into one page in native format.
With this change we can re-use code at include/asm-x86/apicdef.h,
making the code much cleaner. Also it help for future enhancement.

This patch does not change any logic except the change to
CONTROL_REG_ACCESS_NUM, which should be 0xf for CR8 access.

Signed-off-by: Yunhong Jiang <yunhong.jiang@intel.com
author kfraser@localhost.localdomain
date Wed Aug 02 10:07:03 2006 +0100 (2006-08-02)
parents 1abf3783975d
children d735526b02ec
line source
1 /*
2 * vmx_platform.h: VMX platform support
3 * Copyright (c) 2004, Intel Corporation.
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU General Public License,
7 * version 2, as published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along with
15 * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
16 * Place - Suite 330, Boston, MA 02111-1307 USA.
17 *
18 */
19 #ifndef __ASM_IA64_VMX_PLATFORM_H__
20 #define __ASM_IA64_VMX_PLATFORM_H__
22 #include <public/xen.h>
23 #include <public/arch-ia64.h>
24 #include <asm/hvm/vioapic.h>
25 struct mmio_list;
26 typedef struct virtual_platform_def {
27 unsigned long shared_page_va;
28 unsigned long pib_base;
29 unsigned char xtp;
30 struct mmio_list *mmio;
31 /* One IOSAPIC now... */
32 struct hvm_vioapic vioapic;
33 } vir_plat_t;
35 static inline int __fls(uint32_t word)
36 {
37 long double d = word;
38 long exp;
40 __asm__ __volatile__ ("getf.exp %0=%1" : "=r"(exp) : "f"(d));
41 return word ? (exp - 0xffff) : -1;
42 }
44 /* This is a connect structure between vIOSAPIC model and vLSAPIC model.
45 * vlapic is required by vIOSAPIC model to manipulate pending bits, and
46 * we just map them into vpd here
47 */
48 typedef struct vlapic {
49 struct vcpu *vcpu; /* Link to current vcpu */
50 } vlapic_t;
52 extern uint64_t dummy_tmr[];
53 #define VLAPIC_ID(l) (uint16_t)(((l)->vcpu->arch.privregs->lid) >> 16)
54 #define VLAPIC_IRR(l) ((l)->vcpu->arch.privregs->irr[0])
55 struct vlapic* apic_round_robin(struct domain *d, uint8_t dest_mode, uint8_t vector, uint32_t bitmap);
56 extern int vmx_vcpu_pend_interrupt(struct vcpu *vcpu, uint8_t vector);
57 static inline int vlapic_set_irq(struct vlapic *t, uint8_t vec, uint8_t trig)
58 {
59 return vmx_vcpu_pend_interrupt(t->vcpu, vec);
60 }
62 enum ioapic_irq_destination_types {
63 dest_Fixed = 0,
64 dest_LowestPrio = 1,
65 dest_SMI = 2,
66 dest__reserved_1 = 3,
67 dest_NMI = 4,
68 dest_INIT = 5,
69 dest__reserved_2 = 6,
70 dest_ExtINT = 7
71 };
73 /* As long as we register vlsapic to ioapic controller, it's said enabled */
74 #define vlapic_enabled(l) 1
75 #define hvm_apic_support(d) 1
77 #define VLAPIC_DELIV_MODE_FIXED 0x0
78 #define VLAPIC_DELIV_MODE_REDIR 0x1
79 #define VLAPIC_DELIV_MODE_LPRI VLAPIC_DELIV_MODE_REDIR
80 #define VLAPIC_DELIV_MODE_PMI 0x2
81 #define VLAPIC_DELIV_MODE_SMI 0x2 /* For IA32 */
82 #define VLAPIC_DELIV_MODE_RESERVED 0x3
83 #define VLAPIC_DELIV_MODE_NMI 0x4
84 #define VLAPIC_DELIV_MODE_INIT 0x5
85 #define VLAPIC_DELIV_MODE_STARTUP 0x6 /* For IA32 */
86 #define VLAPIC_DELIV_MODE_EXT 0x7
88 #endif