[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] xen: platform_hypercall XSM hook removal


  • To: xen-changelog@xxxxxxxxxxxxxxxxxxx
  • From: Xen patchbot-unstable <patchbot@xxxxxxx>
  • Date: Wed, 16 Jan 2013 08:22:15 +0000
  • Delivery-date: Wed, 16 Jan 2013 08:22:36 +0000
  • List-id: "Change log for Mercurial \(receive only\)" <xen-changelog.lists.xen.org>

# HG changeset patch
# User Daniel De Graaf <dgdegra@xxxxxxxxxxxxx>
# Date 1357900982 0
# Node ID 4b101bfde4ba2568f3359cf27d38f8dbaf52a0d8
# Parent  0bc879ecb8b3ece2fd879578f18c9565e82f175b
xen: platform_hypercall XSM hook removal

A number of the platform_hypercall XSM hooks have no parameters or
only pass the operation ID, making them redundant with the
xsm_platform_op hook. Remove these redundant hooks.

Signed-off-by: Daniel De Graaf <dgdegra@xxxxxxxxxxxxx>
Committed-by: Keir Fraser <keir@xxxxxxx>
---


diff -r 0bc879ecb8b3 -r 4b101bfde4ba xen/arch/x86/platform_hypercall.c
--- a/xen/arch/x86/platform_hypercall.c Fri Jan 11 10:42:30 2013 +0000
+++ b/xen/arch/x86/platform_hypercall.c Fri Jan 11 10:43:02 2013 +0000
@@ -90,10 +90,6 @@ ret_t do_platform_op(XEN_GUEST_HANDLE_PA
     {
     case XENPF_settime:
     {
-        ret = xsm_xen_settime();
-        if ( ret )
-            break;
-
         do_settime(op->u.settime.secs, 
                    op->u.settime.nsecs, 
                    op->u.settime.system_time);
@@ -103,10 +99,6 @@ ret_t do_platform_op(XEN_GUEST_HANDLE_PA
 
     case XENPF_add_memtype:
     {
-        ret = xsm_memtype(op->cmd);
-        if ( ret )
-            break;
-
         ret = mtrr_add_page(
             op->u.add_memtype.mfn,
             op->u.add_memtype.nr_mfns,
@@ -126,10 +118,6 @@ ret_t do_platform_op(XEN_GUEST_HANDLE_PA
 
     case XENPF_del_memtype:
     {
-        ret = xsm_memtype(op->cmd);
-        if ( ret )
-            break;
-
         if (op->u.del_memtype.handle == 0
             /* mtrr/main.c otherwise does a lookup */
             && (int)op->u.del_memtype.reg >= 0)
@@ -148,10 +136,6 @@ ret_t do_platform_op(XEN_GUEST_HANDLE_PA
         unsigned long mfn, nr_mfns;
         mtrr_type     type;
 
-        ret = xsm_memtype(op->cmd);
-        if ( ret )
-            break;
-
         ret = -EINVAL;
         if ( op->u.read_memtype.reg < num_var_ranges )
         {
@@ -169,10 +153,6 @@ ret_t do_platform_op(XEN_GUEST_HANDLE_PA
     {
         XEN_GUEST_HANDLE(const_void) data;
 
-        ret = xsm_microcode();
-        if ( ret )
-            break;
-
         guest_from_compat_handle(data, op->u.microcode.data);
 
         /*
@@ -200,10 +180,6 @@ ret_t do_platform_op(XEN_GUEST_HANDLE_PA
     {
         int quirk_id = op->u.platform_quirk.quirk_id;
 
-        ret = xsm_platform_quirk(quirk_id);
-        if ( ret )
-            break;
-
         switch ( quirk_id )
         {
         case QUIRK_NOIRQBALANCING:
@@ -225,10 +201,6 @@ ret_t do_platform_op(XEN_GUEST_HANDLE_PA
     break;
 
     case XENPF_firmware_info:
-        ret = xsm_firmware_info();
-        if ( ret )
-            break;
-
         switch ( op->u.firmware_info.type )
         {
         case XEN_FW_DISK_INFO: {
@@ -337,10 +309,6 @@ ret_t do_platform_op(XEN_GUEST_HANDLE_PA
         break;
 
     case XENPF_efi_runtime_call:
-        ret = xsm_efi_call();
-        if ( ret )
-            break;
-
         ret = efi_runtime_call(&op->u.efi_runtime_call);
         if ( ret == 0 &&
              __copy_field_to_guest(u_xenpf_op, op, u.efi_runtime_call) )
@@ -348,18 +316,10 @@ ret_t do_platform_op(XEN_GUEST_HANDLE_PA
         break;
 
     case XENPF_enter_acpi_sleep:
-        ret = xsm_acpi_sleep();
-        if ( ret )
-            break;
-
         ret = acpi_enter_sleep(&op->u.enter_acpi_sleep);
         break;
 
     case XENPF_change_freq:
-        ret = xsm_change_freq();
-        if ( ret )
-            break;
-
         ret = -ENOSYS;
         if ( cpufreq_controller != FREQCTL_dom0_kernel )
             break;
@@ -381,10 +341,6 @@ ret_t do_platform_op(XEN_GUEST_HANDLE_PA
         XEN_GUEST_HANDLE(uint8) cpumap_bitmap;
         XEN_GUEST_HANDLE(uint64) idletimes;
 
-        ret = xsm_getidletime();
-        if ( ret )
-            break;
-
         ret = -ENOSYS;
         if ( cpufreq_controller != FREQCTL_dom0_kernel )
             break;
@@ -421,10 +377,6 @@ ret_t do_platform_op(XEN_GUEST_HANDLE_PA
     break;
 
     case XENPF_set_processor_pminfo:
-        ret = xsm_setpminfo();
-        if ( ret )
-            break;
-
         switch ( op->u.set_pminfo.type )
         {
         case XEN_PM_PX:
@@ -477,10 +429,6 @@ ret_t do_platform_op(XEN_GUEST_HANDLE_PA
 
         g_info = &op->u.pcpu_info;
 
-        ret = xsm_getcpuinfo();
-        if ( ret )
-            break;
-
         if ( !get_cpu_maps() )
         {
             ret = -EBUSY;
@@ -514,10 +462,6 @@ ret_t do_platform_op(XEN_GUEST_HANDLE_PA
     {
         struct xenpf_pcpu_version *ver = &op->u.pcpu_version;
 
-        ret = xsm_getcpuinfo();
-        if ( ret )
-            break;
-
         if ( !get_cpu_maps() )
         {
             ret = -EBUSY;
@@ -570,10 +514,6 @@ ret_t do_platform_op(XEN_GUEST_HANDLE_PA
             break;
         }
 
-        ret = xsm_resource_plug_core();
-        if ( ret )
-            break;
-
         ret = continue_hypercall_on_cpu(
             0, cpu_up_helper, (void *)(unsigned long)cpu);
         break;
diff -r 0bc879ecb8b3 -r 4b101bfde4ba xen/include/xsm/dummy.h
--- a/xen/include/xsm/dummy.h   Fri Jan 11 10:42:30 2013 +0000
+++ b/xen/include/xsm/dummy.h   Fri Jan 11 10:43:02 2013 +0000
@@ -63,21 +63,6 @@ static XSM_INLINE int xsm_readconsole(ui
     return 0;
 }
 
-static XSM_INLINE int xsm_getcpuinfo(void)
-{
-    return 0;
-}
-
-static XSM_INLINE int xsm_setpminfo(void)
-{
-    return 0;
-}
-
-static XSM_INLINE int xsm_pm_op(void)
-{
-    return 0;
-}
-
 static XSM_INLINE int xsm_do_mca(void)
 {
     if ( !IS_PRIV(current->domain) )
@@ -436,26 +421,6 @@ static XSM_INLINE int xsm_apic(struct do
     return 0;
 }
 
-static XSM_INLINE int xsm_xen_settime(void)
-{
-    return 0;
-}
-
-static XSM_INLINE int xsm_memtype(uint32_t access)
-{
-    return 0;
-}
-
-static XSM_INLINE int xsm_microcode(void)
-{
-    return 0;
-}
-
-static XSM_INLINE int xsm_platform_quirk(uint32_t quirk)
-{
-    return 0;
-}
-
 static XSM_INLINE int xsm_platform_op(uint32_t op)
 {
     if ( !IS_PRIV(current->domain) )
@@ -463,33 +428,6 @@ static XSM_INLINE int xsm_platform_op(ui
     return 0;
 }
 
-static XSM_INLINE int xsm_firmware_info(void)
-{
-    return 0;
-}
-
-static XSM_INLINE int xsm_efi_call(void)
-{
-    return 0;
-}
-
-static XSM_INLINE int xsm_acpi_sleep(void)
-{
-    if ( !IS_PRIV(current->domain) )
-        return -EPERM;
-    return 0;
-}
-
-static XSM_INLINE int xsm_change_freq(void)
-{
-    return 0;
-}
-
-static XSM_INLINE int xsm_getidletime(void)
-{
-    return 0;
-}
-
 static XSM_INLINE int xsm_machine_memory_map(void)
 {
     if ( !IS_PRIV(current->domain) )
diff -r 0bc879ecb8b3 -r 4b101bfde4ba xen/include/xsm/xsm.h
--- a/xen/include/xsm/xsm.h     Fri Jan 11 10:42:30 2013 +0000
+++ b/xen/include/xsm/xsm.h     Fri Jan 11 10:43:02 2013 +0000
@@ -47,9 +47,6 @@ struct xsm_operations {
     int (*domctl) (struct domain *d, int cmd);
     int (*sysctl) (int cmd);
     int (*readconsole) (uint32_t clear);
-    int (*getcpuinfo) (void);
-    int (*setpminfo) (void);
-    int (*pm_op) (void);
     int (*do_mca) (void);
 
     int (*evtchn_unbound) (struct domain *d, struct evtchn *chn, domid_t id2);
@@ -124,16 +121,8 @@ struct xsm_operations {
     int (*mem_event_op) (struct domain *d, int op);
     int (*mem_sharing_op) (struct domain *d, struct domain *cd, int op);
     int (*apic) (struct domain *d, int cmd);
-    int (*xen_settime) (void);
     int (*memtype) (uint32_t access);
-    int (*microcode) (void);
-    int (*platform_quirk) (uint32_t);
     int (*platform_op) (uint32_t cmd);
-    int (*firmware_info) (void);
-    int (*efi_call) (void);
-    int (*acpi_sleep) (void);
-    int (*change_freq) (void);
-    int (*getidletime) (void);
     int (*machine_memory_map) (void);
     int (*domain_memory_map) (struct domain *d);
 #define XSM_MMU_UPDATE_READ      1
@@ -194,21 +183,6 @@ static inline int xsm_readconsole (uint3
     return xsm_ops->readconsole(clear);
 }
 
-static inline int xsm_getcpuinfo(void)
-{
-    return xsm_ops->getcpuinfo();
-}
-
-static inline int xsm_setpminfo(void)
-{
-    return xsm_ops->setpminfo();
-}
-
-static inline int xsm_pm_op(void)
-{
-    return xsm_ops->pm_op();
-}
-
 static inline int xsm_do_mca(void)
 {
     return xsm_ops->do_mca();
@@ -511,56 +485,16 @@ static inline int xsm_apic (struct domai
     return xsm_ops->apic(d, cmd);
 }
 
-static inline int xsm_xen_settime (void)
-{
-    return xsm_ops->xen_settime();
-}
-
 static inline int xsm_memtype (uint32_t access)
 {
     return xsm_ops->memtype(access);
 }
 
-static inline int xsm_microcode (void)
-{
-    return xsm_ops->microcode();
-}
-
-static inline int xsm_platform_quirk (uint32_t quirk)
-{
-    return xsm_ops->platform_quirk(quirk);
-}
-
 static inline int xsm_platform_op (uint32_t op)
 {
     return xsm_ops->platform_op(op);
 }
 
-static inline int xsm_firmware_info (void)
-{
-    return xsm_ops->firmware_info();
-}
-
-static inline int xsm_efi_call (void)
-{
-    return xsm_ops->efi_call();
-}
-
-static inline int xsm_acpi_sleep (void)
-{
-    return xsm_ops->acpi_sleep();
-}
-
-static inline int xsm_change_freq (void)
-{
-    return xsm_ops->change_freq();
-}
-
-static inline int xsm_getidletime (void)
-{
-    return xsm_ops->getidletime();
-}
-
 static inline int xsm_machine_memory_map(void)
 {
     return xsm_ops->machine_memory_map();
diff -r 0bc879ecb8b3 -r 4b101bfde4ba xen/xsm/dummy.c
--- a/xen/xsm/dummy.c   Fri Jan 11 10:42:30 2013 +0000
+++ b/xen/xsm/dummy.c   Fri Jan 11 10:43:02 2013 +0000
@@ -36,9 +36,6 @@ void xsm_fixup_ops (struct xsm_operation
     set_to_dummy_if_null(ops, domctl);
     set_to_dummy_if_null(ops, sysctl);
     set_to_dummy_if_null(ops, readconsole);
-    set_to_dummy_if_null(ops, getcpuinfo);
-    set_to_dummy_if_null(ops, setpminfo);
-    set_to_dummy_if_null(ops, pm_op);
     set_to_dummy_if_null(ops, do_mca);
 
     set_to_dummy_if_null(ops, evtchn_unbound);
@@ -111,16 +108,7 @@ void xsm_fixup_ops (struct xsm_operation
     set_to_dummy_if_null(ops, mem_event_op);
     set_to_dummy_if_null(ops, mem_sharing_op);
     set_to_dummy_if_null(ops, apic);
-    set_to_dummy_if_null(ops, xen_settime);
-    set_to_dummy_if_null(ops, memtype);
-    set_to_dummy_if_null(ops, microcode);
-    set_to_dummy_if_null(ops, platform_quirk);
     set_to_dummy_if_null(ops, platform_op);
-    set_to_dummy_if_null(ops, firmware_info);
-    set_to_dummy_if_null(ops, efi_call);
-    set_to_dummy_if_null(ops, acpi_sleep);
-    set_to_dummy_if_null(ops, change_freq);
-    set_to_dummy_if_null(ops, getidletime);
     set_to_dummy_if_null(ops, machine_memory_map);
     set_to_dummy_if_null(ops, domain_memory_map);
     set_to_dummy_if_null(ops, mmu_update);
diff -r 0bc879ecb8b3 -r 4b101bfde4ba xen/xsm/flask/hooks.c
--- a/xen/xsm/flask/hooks.c     Fri Jan 11 10:42:30 2013 +0000
+++ b/xen/xsm/flask/hooks.c     Fri Jan 11 10:43:02 2013 +0000
@@ -1177,64 +1177,51 @@ static int flask_apic(struct domain *d, 
     return domain_has_xen(d, perm);
 }
 
-static int flask_xen_settime(void)
-{
-    return domain_has_xen(current->domain, XEN__SETTIME);
-}
-
-static int flask_memtype(uint32_t access)
-{
-    u32 perm;
-
-    switch ( access )
-    {
-    case XENPF_add_memtype:
-        perm = XEN__MTRR_ADD;
-        break;
-    case XENPF_del_memtype:
-        perm = XEN__MTRR_DEL;
-        break;
-    case XENPF_read_memtype:
-        perm = XEN__MTRR_READ;
-        break;
-    default:
-        return -EPERM;
-    }
-
-    return domain_has_xen(current->domain, perm);
-}
-
-static int flask_microcode(void)
-{
-    return domain_has_xen(current->domain, XEN__MICROCODE);
-}
-
-static int flask_platform_quirk(uint32_t quirk)
-{
-    return avc_current_has_perm(SECINITSID_XEN, SECCLASS_XEN, XEN__QUIRK, 
NULL);
-}
-
 static int flask_platform_op(uint32_t op)
 {
     switch ( op )
     {
-    case XENPF_settime:
-    case XENPF_add_memtype:
-    case XENPF_del_memtype:
-    case XENPF_read_memtype:
-    case XENPF_microcode_update:
-    case XENPF_platform_quirk:
-    case XENPF_firmware_info:
-    case XENPF_efi_runtime_call:
-    case XENPF_enter_acpi_sleep:
-    case XENPF_change_freq:
-    case XENPF_getidletime:
+#ifdef CONFIG_X86
+    /* These operations have their own XSM hooks */
     case XENPF_cpu_online:
     case XENPF_cpu_offline:
     case XENPF_cpu_hotadd:
     case XENPF_mem_hotadd:
-        /* These operations have their own XSM hooks */
         return 0;
+#endif
+
+    case XENPF_settime:
+        return domain_has_xen(current->domain, XEN__SETTIME);
+
+    case XENPF_add_memtype:
+        return domain_has_xen(current->domain, XEN__MTRR_ADD);
+
+    case XENPF_del_memtype:
+        return domain_has_xen(current->domain, XEN__MTRR_DEL);
+
+    case XENPF_read_memtype:
+        return domain_has_xen(current->domain, XEN__MTRR_READ);
+
+    case XENPF_microcode_update:
+        return domain_has_xen(current->domain, XEN__MICROCODE);
+
+    case XENPF_platform_quirk:
+        return domain_has_xen(current->domain, XEN__QUIRK);
+
+    case XENPF_firmware_info:
+        return domain_has_xen(current->domain, XEN__FIRMWARE);
+
+    case XENPF_efi_runtime_call:
+        return domain_has_xen(current->domain, XEN__FIRMWARE);
+
+    case XENPF_enter_acpi_sleep:
+        return domain_has_xen(current->domain, XEN__SLEEP);
+
+    case XENPF_change_freq:
+        return domain_has_xen(current->domain, XEN__FREQUENCY);
+
+    case XENPF_getidletime:
+        return domain_has_xen(current->domain, XEN__GETIDLE);
 
     case XENPF_set_processor_pminfo:
     case XENPF_core_parking:
@@ -1250,31 +1237,6 @@ static int flask_platform_op(uint32_t op
     }
 }
 
-static int flask_firmware_info(void)
-{
-    return domain_has_xen(current->domain, XEN__FIRMWARE);
-}
-
-static int flask_efi_call(void)
-{
-    return domain_has_xen(current->domain, XEN__FIRMWARE);
-}
-
-static int flask_acpi_sleep(void)
-{
-    return domain_has_xen(current->domain, XEN__SLEEP);
-}
-
-static int flask_change_freq(void)
-{
-    return domain_has_xen(current->domain, XEN__FREQUENCY);
-}
-
-static int flask_getidletime(void)
-{
-    return domain_has_xen(current->domain, XEN__GETIDLE);
-}
-
 static int flask_machine_memory_map(void)
 {
     return avc_current_has_perm(SECINITSID_XEN, SECCLASS_MMU, MMU__MEMORYMAP, 
NULL);
@@ -1508,16 +1470,7 @@ static struct xsm_operations flask_ops =
     .mem_event_op = flask_mem_event_op,
     .mem_sharing_op = flask_mem_sharing_op,
     .apic = flask_apic,
-    .xen_settime = flask_xen_settime,
-    .memtype = flask_memtype,
-    .microcode = flask_microcode,
-    .platform_quirk = flask_platform_quirk,
     .platform_op = flask_platform_op,
-    .firmware_info = flask_firmware_info,
-    .efi_call = flask_efi_call,
-    .acpi_sleep = flask_acpi_sleep,
-    .change_freq = flask_change_freq,
-    .getidletime = flask_getidletime,
     .machine_memory_map = flask_machine_memory_map,
     .domain_memory_map = flask_domain_memory_map,
     .mmu_update = flask_mmu_update,

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.