]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
Merge remote-tracking branch 'xen-tip/linux-next'
authorStephen Rothwell <sfr@canb.auug.org.au>
Thu, 9 Apr 2015 06:15:22 +0000 (16:15 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Thu, 9 Apr 2015 06:15:22 +0000 (16:15 +1000)
Conflicts:
drivers/xen/Kconfig

1  2 
arch/x86/xen/enlighten.c
drivers/xen/Kconfig
drivers/xen/Makefile
drivers/xen/xen-scsiback.c

diff --combined arch/x86/xen/enlighten.c
index 81665c9f21327f3e7db5088a94cbcef127bb3d93,b9a227284149b4227904d6066dabc391822c7875..94578efd3067f0a0fd86c36c5b3be07eced3d509
@@@ -912,7 -912,6 +912,7 @@@ static void xen_load_sp0(struct tss_str
        mcs = xen_mc_entry(0);
        MULTI_stack_switch(mcs.mc, __KERNEL_DS, thread->sp0);
        xen_mc_issue(PARAVIRT_LAZY_CPU);
 +      tss->x86_tss.sp0 = thread->sp0;
  }
  
  static void xen_set_iopl_mask(unsigned mask)
@@@ -928,92 -927,6 +928,6 @@@ static void xen_io_delay(void
  {
  }
  
- #ifdef CONFIG_X86_LOCAL_APIC
- static unsigned long xen_set_apic_id(unsigned int x)
- {
-       WARN_ON(1);
-       return x;
- }
- static unsigned int xen_get_apic_id(unsigned long x)
- {
-       return ((x)>>24) & 0xFFu;
- }
- static u32 xen_apic_read(u32 reg)
- {
-       struct xen_platform_op op = {
-               .cmd = XENPF_get_cpuinfo,
-               .interface_version = XENPF_INTERFACE_VERSION,
-               .u.pcpu_info.xen_cpuid = 0,
-       };
-       int ret = 0;
-       /* Shouldn't need this as APIC is turned off for PV, and we only
-        * get called on the bootup processor. But just in case. */
-       if (!xen_initial_domain() || smp_processor_id())
-               return 0;
-       if (reg == APIC_LVR)
-               return 0x10;
-       if (reg != APIC_ID)
-               return 0;
-       ret = HYPERVISOR_dom0_op(&op);
-       if (ret)
-               return 0;
-       return op.u.pcpu_info.apic_id << 24;
- }
- static void xen_apic_write(u32 reg, u32 val)
- {
-       /* Warn to see if there's any stray references */
-       WARN_ON(1);
- }
- static u64 xen_apic_icr_read(void)
- {
-       return 0;
- }
- static void xen_apic_icr_write(u32 low, u32 id)
- {
-       /* Warn to see if there's any stray references */
-       WARN_ON(1);
- }
- static void xen_apic_wait_icr_idle(void)
- {
-         return;
- }
- static u32 xen_safe_apic_wait_icr_idle(void)
- {
-         return 0;
- }
- static void set_xen_basic_apic_ops(void)
- {
-       apic->read = xen_apic_read;
-       apic->write = xen_apic_write;
-       apic->icr_read = xen_apic_icr_read;
-       apic->icr_write = xen_apic_icr_write;
-       apic->wait_icr_idle = xen_apic_wait_icr_idle;
-       apic->safe_wait_icr_idle = xen_safe_apic_wait_icr_idle;
-       apic->set_apic_id = xen_set_apic_id;
-       apic->get_apic_id = xen_get_apic_id;
- #ifdef CONFIG_SMP
-       apic->send_IPI_allbutself = xen_send_IPI_allbutself;
-       apic->send_IPI_mask_allbutself = xen_send_IPI_mask_allbutself;
-       apic->send_IPI_mask = xen_send_IPI_mask;
-       apic->send_IPI_all = xen_send_IPI_all;
-       apic->send_IPI_self = xen_send_IPI_self;
- #endif
- }
- #endif
  static void xen_clts(void)
  {
        struct multicall_space mcs;
@@@ -1619,7 -1532,7 +1533,7 @@@ asmlinkage __visible void __init xen_st
        /*
         * set up the basic apic ops.
         */
-       set_xen_basic_apic_ops();
+       xen_init_apic();
  #endif
  
        if (xen_feature(XENFEAT_mmu_pt_update_preserve_ad)) {
                if (HYPERVISOR_dom0_op(&op) == 0)
                        boot_params.kbd_status = op.u.firmware_info.u.kbd_shift_flags;
  
-               xen_init_apic();
                /* Make sure ACS will be enabled */
                pci_request_acs();
  
diff --combined drivers/xen/Kconfig
index e812c7704c8a8be198398a338d6029a238c8118c,afc39ca5cc4fb11dcf1d185fc8fa50e33d339206..c681adfa778ade3e23e40793ec616a161bfee5bc
@@@ -55,23 -55,6 +55,23 @@@ config XEN_BALLOON_MEMORY_HOTPLU
  
          In that case step 3 should be omitted.
  
 +config XEN_BALLOON_MEMORY_HOTPLUG_LIMIT
 +      int "Hotplugged memory limit (in GiB) for a PV guest"
 +      default 512 if X86_64
 +      default 4 if X86_32
 +      range 0 64 if X86_32
 +      depends on XEN_HAVE_PVMMU
 +      depends on XEN_BALLOON_MEMORY_HOTPLUG
 +      help
 +        Maxmium amount of memory (in GiB) that a PV guest can be
 +        expanded to when using memory hotplug.
 +
 +        A PV guest can have more memory than this limit if is
 +        started with a larger maximum.
 +
 +        This value is used to allocate enough space in internal
 +        tables needed for physical memory administration.
 +
  config XEN_SCRUB_PAGES
        bool "Scrub pages before returning them to system"
        depends on XEN_BALLOON
@@@ -270,8 -253,10 +270,14 @@@ config XEN_EF
        def_bool y
        depends on X86_64 && EFI
  
 +config XEN_ACPI
 +      def_bool y
 +      depends on X86 && ACPI
 +
+ config XEN_AUTO_XLATE
+       def_bool y
+       depends on ARM || ARM64 || XEN_PVHVM
+       help
+         Support for auto-translated physmap guests.
  endmenu
diff --combined drivers/xen/Makefile
index f4622ab1fc3e127edd834f71909eeac85614423c,40edd1cbb60d9abebdc0c372543f516a73caf478..e293bc507cbcb20edbcdc0d3a0807c403de530b3
@@@ -13,7 -13,7 +13,7 @@@ CFLAGS_efi.o                          += -fshort-wcha
  
  dom0-$(CONFIG_PCI) += pci.o
  dom0-$(CONFIG_USB_SUPPORT) += dbgp.o
 -dom0-$(CONFIG_ACPI) += acpi.o $(xen-pad-y)
 +dom0-$(CONFIG_XEN_ACPI) += acpi.o $(xen-pad-y)
  xen-pad-$(CONFIG_X86) += xen-acpi-pad.o
  dom0-$(CONFIG_X86) += pcpu.o
  obj-$(CONFIG_XEN_DOM0)                        += $(dom0-y)
@@@ -37,6 -37,7 +37,7 @@@ obj-$(CONFIG_XEN_ACPI_HOTPLUG_CPU)    += x
  obj-$(CONFIG_XEN_ACPI_PROCESSOR)      += xen-acpi-processor.o
  obj-$(CONFIG_XEN_EFI)                 += efi.o
  obj-$(CONFIG_XEN_SCSI_BACKEND)                += xen-scsiback.o
+ obj-$(CONFIG_XEN_AUTO_XLATE)          += xlate_mmu.o
  xen-evtchn-y                          := evtchn.o
  xen-gntdev-y                          := gntdev.o
  xen-gntalloc-y                                := gntalloc.o
index 42bd55a6c237209c15790876911d8aa31343b043,2eab75892c23b704ba5808ae9efe9cb4d7c75a29..c6ce90693f25e77ca8b479da39c7072a47f91eb5
@@@ -31,6 -31,8 +31,8 @@@
   * IN THE SOFTWARE.
   */
  
+ #define pr_fmt(fmt) "xen-pvscsi: " fmt
  #include <stdarg.h>
  
  #include <linux/module.h>
@@@ -69,9 -71,6 +71,6 @@@
  #include <xen/interface/grant_table.h>
  #include <xen/interface/io/vscsiif.h>
  
- #define DPRINTK(_f, _a...)                    \
-       pr_debug("(file=%s, line=%d) " _f, __FILE__ , __LINE__ , ## _a)
  #define VSCSI_VERSION "v0.1"
  #define VSCSI_NAMELEN 32
  
@@@ -271,7 -270,7 +270,7 @@@ static void scsiback_print_status(char 
  {
        struct scsiback_tpg *tpg = pending_req->v2p->tpg;
  
-       pr_err("xen-pvscsi[%s:%d] cmnd[0]=%02x -> st=%02x msg=%02x host=%02x drv=%02x\n",
+       pr_err("[%s:%d] cmnd[0]=%02x -> st=%02x msg=%02x host=%02x drv=%02x\n",
               tpg->tport->tport_name, pending_req->v2p->lun,
               pending_req->cmnd[0], status_byte(errors), msg_byte(errors),
               host_byte(errors), driver_byte(errors));
@@@ -427,7 -426,7 +426,7 @@@ static int scsiback_gnttab_data_map_bat
        BUG_ON(err);
        for (i = 0; i < cnt; i++) {
                if (unlikely(map[i].status != GNTST_okay)) {
-                       pr_err("xen-pvscsi: invalid buffer -- could not remap it\n");
+                       pr_err("invalid buffer -- could not remap it\n");
                        map[i].handle = SCSIBACK_INVALID_HANDLE;
                        err = -ENOMEM;
                } else {
@@@ -449,7 -448,7 +448,7 @@@ static int scsiback_gnttab_data_map_lis
        for (i = 0; i < cnt; i++) {
                if (get_free_page(pg + mapcount)) {
                        put_free_pages(pg, mapcount);
-                       pr_err("xen-pvscsi: no grant page\n");
+                       pr_err("no grant page\n");
                        return -ENOMEM;
                }
                gnttab_set_map_op(&map[mapcount], vaddr_page(pg[mapcount]),
@@@ -492,7 -491,7 +491,7 @@@ static int scsiback_gnttab_data_map(str
                return 0;
  
        if (nr_segments > VSCSIIF_SG_TABLESIZE) {
-               DPRINTK("xen-pvscsi: invalid parameter nr_seg = %d\n",
+               pr_debug("invalid parameter nr_seg = %d\n",
                        ring_req->nr_segments);
                return -EINVAL;
        }
                        nr_segments += n_segs;
                }
                if (nr_segments > SG_ALL) {
-                       DPRINTK("xen-pvscsi: invalid nr_seg = %d\n",
-                               nr_segments);
+                       pr_debug("invalid nr_seg = %d\n", nr_segments);
                        return -EINVAL;
                }
        }
  
-       /* free of (sgl) in fast_flush_area()*/
+       /* free of (sgl) in fast_flush_area() */
        pending_req->sgl = kmalloc_array(nr_segments,
                                        sizeof(struct scatterlist), GFP_KERNEL);
        if (!pending_req->sgl)
@@@ -679,7 -677,8 +677,8 @@@ static int prepare_pending_reqs(struct 
        v2p = scsiback_do_translation(info, &vir);
        if (!v2p) {
                pending_req->v2p = NULL;
-               DPRINTK("xen-pvscsi: doesn't exist.\n");
+               pr_debug("the v2p of (chn:%d, tgt:%d, lun:%d) doesn't exist.\n",
+                       vir.chn, vir.tgt, vir.lun);
                return -ENODEV;
        }
        pending_req->v2p = v2p;
                (pending_req->sc_data_direction != DMA_TO_DEVICE) &&
                (pending_req->sc_data_direction != DMA_FROM_DEVICE) &&
                (pending_req->sc_data_direction != DMA_NONE)) {
-               DPRINTK("xen-pvscsi: invalid parameter data_dir = %d\n",
+               pr_debug("invalid parameter data_dir = %d\n",
                        pending_req->sc_data_direction);
                return -EINVAL;
        }
  
        pending_req->cmd_len = ring_req->cmd_len;
        if (pending_req->cmd_len > VSCSIIF_MAX_COMMAND_SIZE) {
-               DPRINTK("xen-pvscsi: invalid parameter cmd_len = %d\n",
+               pr_debug("invalid parameter cmd_len = %d\n",
                        pending_req->cmd_len);
                return -EINVAL;
        }
@@@ -721,7 -720,7 +720,7 @@@ static int scsiback_do_cmd_fn(struct vs
  
        if (RING_REQUEST_PROD_OVERFLOW(ring, rp)) {
                rc = ring->rsp_prod_pvt;
-               pr_warn("xen-pvscsi: Dom%d provided bogus ring requests (%#x - %#x = %u). Halting ring processing\n",
+               pr_warn("Dom%d provided bogus ring requests (%#x - %#x = %u). Halting ring processing\n",
                           info->domid, rp, rc, rp - rc);
                info->ring_error = 1;
                return 0;
                        scsiback_device_action(pending_req, TMR_LUN_RESET, 0);
                        break;
                default:
-                       pr_err_ratelimited("xen-pvscsi: invalid request\n");
+                       pr_err_ratelimited("invalid request\n");
                        scsiback_do_resp_with_sense(NULL, DRIVER_ERROR << 24,
                                                    0, pending_req);
                        kmem_cache_free(scsiback_cachep, pending_req);
@@@ -874,14 -873,13 +873,13 @@@ static int scsiback_add_translation_ent
  
        lunp = strrchr(phy, ':');
        if (!lunp) {
-               pr_err("xen-pvscsi: illegal format of physical device %s\n",
-                       phy);
+               pr_err("illegal format of physical device %s\n", phy);
                return -EINVAL;
        }
        *lunp = 0;
        lunp++;
        if (kstrtouint(lunp, 10, &lun) || lun >= TRANSPORT_MAX_LUNS_PER_TPG) {
-               pr_err("xen-pvscsi: lun number not valid: %s\n", lunp);
+               pr_err("lun number not valid: %s\n", lunp);
                return -EINVAL;
        }
  
        mutex_unlock(&scsiback_mutex);
  
        if (!tpg) {
-               pr_err("xen-pvscsi: %s:%d %s\n", phy, lun, error);
+               pr_err("%s:%d %s\n", phy, lun, error);
                return -ENODEV;
        }
  
                if ((entry->v.chn == v->chn) &&
                    (entry->v.tgt == v->tgt) &&
                    (entry->v.lun == v->lun)) {
-                       pr_warn("xen-pvscsi: Virtual ID is already used. Assignment was not performed.\n");
+                       pr_warn("Virtual ID is already used. Assignment was not performed.\n");
                        err = -EEXIST;
                        goto out;
                }
@@@ -992,15 -990,15 +990,15 @@@ found
  }
  
  static void scsiback_do_add_lun(struct vscsibk_info *info, const char *state,
-                               char *phy, struct ids_tuple *vir)
+                               char *phy, struct ids_tuple *vir, int try)
  {
        if (!scsiback_add_translation_entry(info, phy, vir)) {
                if (xenbus_printf(XBT_NIL, info->dev->nodename, state,
                                  "%d", XenbusStateInitialised)) {
-                       pr_err("xen-pvscsi: xenbus_printf error %s\n", state);
+                       pr_err("xenbus_printf error %s\n", state);
                        scsiback_del_translation_entry(info, vir);
                }
-       } else {
+       } else if (!try) {
                xenbus_printf(XBT_NIL, info->dev->nodename, state,
                              "%d", XenbusStateClosed);
        }
@@@ -1012,7 -1010,7 +1010,7 @@@ static void scsiback_do_del_lun(struct 
        if (!scsiback_del_translation_entry(info, vir)) {
                if (xenbus_printf(XBT_NIL, info->dev->nodename, state,
                                  "%d", XenbusStateClosed))
-                       pr_err("xen-pvscsi: xenbus_printf error %s\n", state);
+                       pr_err("xenbus_printf error %s\n", state);
        }
  }
  
@@@ -1060,10 -1058,19 +1058,19 @@@ static void scsiback_do_1lun_hotplug(st
  
        switch (op) {
        case VSCSIBACK_OP_ADD_OR_DEL_LUN:
-               if (device_state == XenbusStateInitialising)
-                       scsiback_do_add_lun(info, state, phy, &vir);
-               if (device_state == XenbusStateClosing)
+               switch (device_state) {
+               case XenbusStateInitialising:
+                       scsiback_do_add_lun(info, state, phy, &vir, 0);
+                       break;
+               case XenbusStateConnected:
+                       scsiback_do_add_lun(info, state, phy, &vir, 1);
+                       break;
+               case XenbusStateClosing:
                        scsiback_do_del_lun(info, state, &vir);
+                       break;
+               default:
+                       break;
+               }
                break;
  
        case VSCSIBACK_OP_UPDATEDEV_STATE:
                        /* modify vscsi-devs/dev-x/state */
                        if (xenbus_printf(XBT_NIL, dev->nodename, state,
                                          "%d", XenbusStateConnected)) {
-                               pr_err("xen-pvscsi: xenbus_printf error %s\n",
-                                      str);
+                               pr_err("xenbus_printf error %s\n", str);
                                scsiback_del_translation_entry(info, &vir);
                                xenbus_printf(XBT_NIL, dev->nodename, state,
                                              "%d", XenbusStateClosed);
                        }
                }
                break;
-       /*When it is necessary, processing is added here.*/
+       /* When it is necessary, processing is added here. */
        default:
                break;
        }
@@@ -1196,7 -1202,7 +1202,7 @@@ static int scsiback_probe(struct xenbus
        struct vscsibk_info *info = kzalloc(sizeof(struct vscsibk_info),
                                            GFP_KERNEL);
  
-       DPRINTK("%p %d\n", dev, dev->otherend_id);
+       pr_debug("%s %p %d\n", __func__, dev, dev->otherend_id);
  
        if (!info) {
                xenbus_dev_fatal(dev, -ENOMEM, "allocating backend structure");
        return 0;
  
  fail:
-       pr_warn("xen-pvscsi: %s failed\n", __func__);
+       pr_warn("%s failed\n", __func__);
        scsiback_remove(dev);
  
        return err;
@@@ -1432,7 -1438,7 +1438,7 @@@ check_len
        }
        snprintf(&tport->tport_name[0], VSCSI_NAMELEN, "%s", &name[off]);
  
-       pr_debug("xen-pvscsi: Allocated emulated Target %s Address: %s\n",
+       pr_debug("Allocated emulated Target %s Address: %s\n",
                 scsiback_dump_proto_id(tport), name);
  
        return &tport->tport_wwn;
@@@ -1443,7 -1449,7 +1449,7 @@@ static void scsiback_drop_tport(struct 
        struct scsiback_tport *tport = container_of(wwn,
                                struct scsiback_tport, tport_wwn);
  
-       pr_debug("xen-pvscsi: Deallocating emulated Target %s Address: %s\n",
+       pr_debug("Deallocating emulated Target %s Address: %s\n",
                 scsiback_dump_proto_id(tport), tport->tport_name);
  
        kfree(tport);
@@@ -1470,8 -1476,8 +1476,8 @@@ static u32 scsiback_tpg_get_inst_index(
  static int scsiback_check_stop_free(struct se_cmd *se_cmd)
  {
        /*
-        * Do not release struct se_cmd's containing a valid TMR
-        * pointer.  These will be released directly in scsiback_device_action()
+        * Do not release struct se_cmd's containing a valid TMR pointer.
+        * These will be released directly in scsiback_device_action()
         * with transport_generic_free_cmd().
         */
        if (se_cmd->se_cmd_flags & SCF_SCSI_TMR_CDB)
@@@ -1637,7 -1643,7 +1643,7 @@@ static int scsiback_make_nexus(struct s
                return -ENOMEM;
        }
        /*
-        *  Initialize the struct se_session pointer
+        * Initialize the struct se_session pointer
         */
        tv_nexus->tvn_se_sess = transport_init_session(TARGET_PROT_NORMAL);
        if (IS_ERR(tv_nexus->tvn_se_sess)) {
                         name);
                goto out;
        }
 -      /*
 -       * Now register the TCM pvscsi virtual I_T Nexus as active with the
 -       * call to __transport_register_session()
 -       */
 -      __transport_register_session(se_tpg, tv_nexus->tvn_se_sess->se_node_acl,
 +      /* Now register the TCM pvscsi virtual I_T Nexus as active. */
 +      transport_register_session(se_tpg, tv_nexus->tvn_se_sess->se_node_acl,
                        tv_nexus->tvn_se_sess, tv_nexus);
        tpg->tpg_nexus = tv_nexus;
  
@@@ -1705,7 -1714,7 +1711,7 @@@ static int scsiback_drop_nexus(struct s
                return -EBUSY;
        }
  
-       pr_debug("xen-pvscsi: Removing I_T Nexus to emulated %s Initiator Port: %s\n",
+       pr_debug("Removing I_T Nexus to emulated %s Initiator Port: %s\n",
                scsiback_dump_proto_id(tpg->tport),
                tv_nexus->tvn_se_sess->se_node_acl->initiatorname);
  
@@@ -1751,7 -1760,7 +1757,7 @@@ static ssize_t scsiback_tpg_store_nexus
        unsigned char i_port[VSCSI_NAMELEN], *ptr, *port_ptr;
        int ret;
        /*
-        * Shutdown the active I_T nexus if 'NULL' is passed..
+        * Shutdown the active I_T nexus if 'NULL' is passed.
         */
        if (!strncmp(page, "NULL", 4)) {
                ret = scsiback_drop_nexus(tpg);
@@@ -1922,7 -1931,7 +1928,7 @@@ static void scsiback_drop_tpg(struct se
         */
        scsiback_drop_nexus(tpg);
        /*
-        * Deregister the se_tpg from TCM..
+        * Deregister the se_tpg from TCM.
         */
        core_tpg_deregister(se_tpg);
        kfree(tpg);
@@@ -1992,7 -2001,7 +1998,7 @@@ static int scsiback_register_configfs(v
        struct target_fabric_configfs *fabric;
        int ret;
  
-       pr_debug("xen-pvscsi: fabric module %s on %s/%s on "UTS_RELEASE"\n",
+       pr_debug("fabric module %s on %s/%s on "UTS_RELEASE"\n",
                 VSCSI_VERSION, utsname()->sysname, utsname()->machine);
        /*
         * Register the top level struct config_item_type with TCM core
         * Setup our local pointer to *fabric
         */
        scsiback_fabric_configfs = fabric;
-       pr_debug("xen-pvscsi: Set fabric -> scsiback_fabric_configfs\n");
+       pr_debug("Set fabric -> scsiback_fabric_configfs\n");
        return 0;
  };
  
@@@ -2040,7 -2049,7 +2046,7 @@@ static void scsiback_deregister_configf
  
        target_fabric_configfs_deregister(scsiback_fabric_configfs);
        scsiback_fabric_configfs = NULL;
-       pr_debug("xen-pvscsi: Cleared scsiback_fabric_configfs\n");
+       pr_debug("Cleared scsiback_fabric_configfs\n");
  };
  
  static const struct xenbus_device_id scsiback_ids[] = {
@@@ -2091,7 -2100,7 +2097,7 @@@ out_unregister_xenbus
        xenbus_unregister_driver(&scsiback_driver);
  out_cache_destroy:
        kmem_cache_destroy(scsiback_cachep);
-       pr_err("xen-pvscsi: %s: error %d\n", __func__, ret);
+       pr_err("%s: error %d\n", __func__, ret);
        return ret;
  }