From 548d785ec5767f6bd2aeae29b44a0e1a148ba4e5 Mon Sep 17 00:00:00 2001 From: Kip Macy Date: Sun, 26 Nov 2006 04:37:49 +0000 Subject: [PATCH] add interrupt cookie hypervisor functions --- sys/sun4v/include/hv_api.h | 13 ++- sys/sun4v/include/hypervisorvar.h | 10 +++ sys/sun4v/sun4v/hcall.S | 145 ++++++++++++++++++++++++++++++ 3 files changed, 167 insertions(+), 1 deletion(-) diff --git a/sys/sun4v/include/hv_api.h b/sys/sun4v/include/hv_api.h index 62f0b59b02d..b3665075043 100644 --- a/sys/sun4v/include/hv_api.h +++ b/sys/sun4v/include/hv_api.h @@ -52,6 +52,7 @@ typedef uint64_t io_addr_t; * Section 10 Domain Services */ +extern void hv_mach_exit(uint64_t exit_code); extern uint64_t hv_mach_desc(uint64_t buffer_ra, uint64_t *buffer_sizep); extern uint64_t hv_mach_watchdog(uint64_t timeout, uint64_t *time_remaining); @@ -75,7 +76,7 @@ typedef struct hv_tsb_info { uint16_t hti_assoc; /* associativity of TSB */ uint32_t hti_ntte; /* size of TSB in TTEs */ uint32_t hti_ctx_index; /* context index */ - uint32_t hti_pgszs; /* page size bitmasx */ + uint32_t hti_pgszs; /* page size bitmask */ uint64_t hti_ra; /* real address of TSB base */ uint64_t hti_rsvd; /* reserved */ } hv_tsb_info_t; @@ -102,6 +103,16 @@ extern uint64_t hv_intr_setstate(uint64_t sysino, int state); extern uint64_t hv_intr_gettarget(uint64_t sysino, int *cpuid); extern uint64_t hv_intr_settarget(uint64_t sysino, int cpuid); +extern uint64_t hv_vintr_getcookie(devhandle_t dh, uint64_t devino, uint64_t *cookie); +extern uint64_t hv_vintr_setcookie(devhandle_t dh, uint64_t devino, uint64_t cookie); +extern uint64_t hv_vintr_getenabled(devhandle_t dh, uint64_t devino, int *enabled); +extern uint64_t hv_vintr_setenabled(devhandle_t dh, uint64_t devino, int enabled); +extern uint64_t hv_vintr_getstate(devhandle_t dh, uint64_t devino, int *state); +extern uint64_t hv_vintr_setstate(devhandle_t dh, uint64_t devino, int state); +extern uint64_t hv_vintr_gettarget(devhandle_t dh, uint64_t devino, int *cpuid); +extern uint64_t hv_vintr_settarget(devhandle_t dh, uint64_t devino, int cpuid); + + /* * Section 15 Time of Day Services */ diff --git a/sys/sun4v/include/hypervisorvar.h b/sys/sun4v/include/hypervisorvar.h index 87bc20e3cd7..4f5ea7fd1d0 100644 --- a/sys/sun4v/include/hypervisorvar.h +++ b/sys/sun4v/include/hypervisorvar.h @@ -158,6 +158,16 @@ #define INTR_GETTARGET 0xa5 #define INTR_SETTARGET 0xa6 +#define VINTR_GETCOOKIE 0xa7 +#define VINTR_SETCOOKIE 0xa8 +#define VINTR_GETENABLED 0xa9 +#define VINTR_SETENABLED 0xaa +#define VINTR_GETSTATE 0xab +#define VINTR_SETSTATE 0xac +#define VINTR_GETTARGET 0xad +#define VINTR_SETTARGET 0xae + + #define PCI_IOMMU_MAP 0xb0 #define PCI_IOMMU_DEMAP 0xb1 #define PCI_IOMMU_GETMAP 0xb2 diff --git a/sys/sun4v/sun4v/hcall.S b/sys/sun4v/sun4v/hcall.S index c5d2831cb4e..3802dcd02de 100644 --- a/sys/sun4v/sun4v/hcall.S +++ b/sys/sun4v/sun4v/hcall.S @@ -768,6 +768,151 @@ ENTRY(hv_intr_settarget) nop END(hv_intr_settarget) +/* + * get the cookie value that will be delivered + * in word 0 of a dev_mondo packet to a guest + * + * arg0 devhandle (%o0) + * arg1 devino (%o1) + * + * ret0 status (%o0) + * ret1 cookie_value (%o1) + * + */ +ENTRY(hv_vintr_getcookie) + mov VINTR_GETCOOKIE, %o5 + ta FAST_TRAP + retl + stx %o1, [%o2] +END(hv_vintr_getcookie) + +/* + * set the cookie value that will be delivered + * in word 0 of a dev_mondo packet to a guest + * + * arg0 devhandle (%o0) + * arg1 devino (%o1) + * ret2 cookie_value (%o2) + * + * ret0 status (%o0) + * + */ +ENTRY(hv_vintr_setcookie) + mov VINTR_SETCOOKIE, %o5 + ta FAST_TRAP + retl + nop +END(hv_vintr_setcookie) + +/* + * get the enabled status of the interrupt + * defined by devino + * + * arg0 devhandle (%o0) + * arg1 devino (%o1) + * + * ret0 status (%o0) + * ret1 intr_enabled (%o1) + * + */ +ENTRY(hv_vintr_getenabled) + mov VINTR_GETENABLED, %o5 + ta FAST_TRAP + retl + st %o1, [%o2] +END(hv_vintr_getenabled) + +/* + * set the enabled status of the interrupt + * defined by devino + * + * arg0 devhandle (%o0) + * arg1 devino (%o1) + * arg2 intr_enabled (%o2) + * + * ret0 status (%o0) + * + */ +ENTRY(hv_vintr_setenabled) + mov VINTR_SETENABLED, %o5 + ta FAST_TRAP + retl + nop +END(hv_vintr_setenabled) + +/* + * get the current state of the interrupt + * defined by devino + * + * arg0 devhandle (%o0) + * arg1 devino (%o1) + * + * ret0 status (%o0) + * ret1 intr_state (%o1) + * + */ +ENTRY(hv_vintr_getstate) + mov VINTR_GETSTATE, %o5 + ta FAST_TRAP + retl + st %o1, [%o2] +END(hv_vintr_getstate) + +/* + * set the current state of the interrupt + * defined by devino + * + * arg0 devhandle (%o0) + * arg1 devino (%o1) + * arg2 intr_state (%o2) + * + * ret0 status (%o0) + * + */ +ENTRY(hv_vintr_setstate) + mov VINTR_SETSTATE, %o5 + ta FAST_TRAP + retl + nop +END(hv_vintr_setstate) + +/* + * get the cpuid that is the current target + * of the interrupt defined by devino + * + * arg0 devhandle (%o0) + * arg1 devino (%o1) + * + * ret0 status (%o0) + * ret1 cpuid (%o1) + * + */ +ENTRY(hv_vintr_gettarget) + mov VINTR_GETTARGET, %o5 + ta FAST_TRAP + retl + st %o1, [%o2] +END(hv_vintr_gettarget) + +/* + * set the cpuid that is the current target + * of the interrupt defined by devino + * + * arg0 devhandle (%o0) + * arg1 devino (%o1) + * arg2 cpuid (%o2) + * + * ret0 status (%o0) + * + */ +ENTRY(hv_vintr_settarget) + mov VINTR_SETTARGET, %o5 + ta FAST_TRAP + retl + nop +END(hv_vintr_settarget) + + /* * Section 15 Time of Day Services *