vio cleanups
Subsystems (3)
cover vio cleanups
Hi all,
This series of patches does some cleanups to PowerPC vio especially the legacy iSeries parts of that. The significant change is to do the probing of the virtual cdroms, tapes and disks earlier and create device tree entries for them dynamically so that we only have entries for those that exist (rather than the theoretical maximum number).
Signature · 3 lines
Cheers, Stephen Rothwell [email protected] http://www.canb.auug.org.au/~sfr/
PATCH 1/11 Remove debug printk from vio_bus_init
As it just adds noise to the boot messages.
--- arch/powerpc/kernel/vio.c | 5 +---- 1 files changed, 1 insertions(+), 4 deletions(-)
Signature · 2 lines
Cheers, Stephen Rothwell [email protected]
arch/powerpc/kernel/vio.c +1 -4
@@ -317,11 +317,8 @@ static int __init vio_bus_init(void)* the device tree. Drivers will associate with them later. */ for (of_node = node_vroot->child; of_node !=NULL ; - of_node = of_node->sibling) { -printk (KERN_DEBUG "%s: processing %p\n" , - __FUNCTION__, of_node); + of_node = of_node->sibling)vio_register_device_node (of_node); - }of_node_put (node_vroot); }
Signature · 1 line
1.5.3.2
PATCH 2/11 Simplify vio_bus_init a little for legacy iSeries
iSeries_vio_dev was already statically initialised and we can remove one set of #ifdef CONFIG_PPC_ISERIES guards.
--- arch/powerpc/kernel/vio.c | 14 +++++++------- 1 files changed, 7 insertions(+), 7 deletions(-)
Signature · 2 lines
Cheers, Stephen Rothwell [email protected]
arch/powerpc/kernel/vio.c +7 -7
@@ -64,6 +64,12 @@ static void __init iommu_vio_init(void)printk ("Virtual Bus VETH TCE table failed.\n" );if (!iommu_init_table (&vio_iommu_table,-1 ))printk ("Virtual Bus VIO TCE table failed.\n" ); + vio_bus_device.dev.archdata.dma_ops = &dma_iommu_ops; + vio_bus_device.dev.archdata.dma_data = &vio_iommu_table; +} +#else +static void __init iommu_vio_init (void ) +{ }#endif
@@ -282,14 +288,8 @@ static int __init vio_bus_init(void)int err;struct device_node *node_vroot; -#ifdef CONFIG_PPC_ISERIES -if (firmware_has_feature (FW_FEATURE_ISERIES )) { +if (firmware_has_feature (FW_FEATURE_ISERIES ))iommu_vio_init (); - vio_bus_device.dev.archdata.dma_ops = &dma_iommu_ops; - vio_bus_device.dev.archdata.dma_data = &vio_iommu_table; - iSeries_vio_dev = &vio_bus_device.dev; - } -#endif /* CONFIG_PPC_ISERIES */ err =bus_register (&vio_bus_type);if (err) {
Signature · 1 line
1.5.3.2
PATCH 3/11 Make vio_bus_type static
--- arch/powerpc/kernel/vio.c | 4 +++- include/asm-powerpc/vio.h | 1 - 2 files changed, 3 insertions(+), 2 deletions(-)
Signature · 2 lines
Cheers, Stephen Rothwell [email protected]
arch/powerpc/kernel/vio.c +3 -1
@@ -39,6 +39,8 @@extern struct kset devices_subsys;/* needed for vio_find_name() */ +static struct bus_type vio_bus_type; +static struct vio_dev vio_bus_device = {/* fake "parent" device */ .name = vio_bus_device.dev.bus_id, .type ="" ,
@@ -388,7 +390,7 @@ static int vio_hotplug(struct device *dev, char **envp, int num_envp,return 0 ; } -struct bus_type vio_bus_type = { +static struct bus_type vio_bus_type = { .name ="vio" , .dev_attrs = vio_dev_attrs, .uevent = vio_hotplug,
include/asm-powerpc/vio.h +0 -1
@@ -63,7 +63,6 @@ struct vio_driver { };extern struct dma_mapping_ops vio_dma_ops; -extern struct bus_type vio_bus_type;extern int vio_register_driver (struct vio_driver *drv);extern void vio_unregister_driver (struct vio_driver *drv);
Signature · 1 line
1.5.3.2
PATCH 4/11 iSeries: simplify viocd initialisation
We don't need to keep a lump of dma coherent memory around for the life of the module.
--- drivers/cdrom/viocd.c | 37 +++++++++++++------------------------ 1 files changed, 13 insertions(+), 24 deletions(-)
Signature · 2 lines
Cheers, Stephen Rothwell [email protected]
drivers/cdrom/viocd.c +13 -24
@@ -136,17 +136,12 @@ struct cdrom_info {char type[4 ];char model[3 ]; }; -/* -* This needs to be allocated since it is passed to the -* Hypervisor and we may be a module. -*/ -static struct cdrom_info *viocd_unitinfo; -static dma_addr_t unitinfo_dmaaddr;struct disk_info {struct gendisk *viocd_disk;struct cdrom_device_info viocd_info;struct device *dev; +struct cdrom_info unitinfo; };static struct disk_info viocd_diskinfo[VIOCD_MAX_CD ];
@@ -164,9 +159,9 @@ static int proc_viocd_show(struct seq_file *m, void *v)for (i =0 ; i < viocd_numdev; i++) {seq_printf (m,"viocd device %d is iSeries resource %10.10s" "type %4.4s, model %3.3s\n" , - i, viocd_unitinfo[i].rsrcname, - viocd_unitinfo[i].type, - viocd_unitinfo[i].model); + i, viocd_diskinfo[i].unitinfo.rsrcname, + viocd_diskinfo[i].unitinfo.type, + viocd_diskinfo[i].unitinfo.model); }return 0 ; }
@@ -222,6 +217,8 @@ static void __init get_viocd_info(void)HvLpEvent_Rc hvrc;int i;struct viocd_waitevent we; +struct cdrom_info *viocd_unitinfo; +dma_addr_t unitinfo_dmaaddr; viocd_unitinfo = dma_alloc_coherent(iSeries_vio_dev, sizeof(*viocd_unitinfo) * VIOCD_MAX_CD,
@@ -259,16 +256,15 @@ static void __init get_viocd_info(void) goto error_ret; } -for (i =0 ; (i <VIOCD_MAX_CD ) && viocd_unitinfo[i].rsrcname[0 ]; i++) +for (i =0 ; (i <VIOCD_MAX_CD ) && viocd_unitinfo[i].rsrcname[0 ]; i++) { + viocd_diskinfo[viocd_numdev].unitinfo = viocd_unitinfo[i]; viocd_numdev++; + } error_ret: -if (viocd_numdev ==0 ) { -dma_free_coherent (iSeries_vio_dev, -sizeof (*viocd_unitinfo) *VIOCD_MAX_CD , - viocd_unitinfo, unitinfo_dmaaddr); - viocd_unitinfo =NULL ; - } +dma_free_coherent (iSeries_vio_dev, +sizeof (*viocd_unitinfo) *VIOCD_MAX_CD , + viocd_unitinfo, unitinfo_dmaaddr); }static int viocd_open (struct cdrom_device_info *cdi,int purpose)
@@ -674,7 +670,7 @@ static int viocd_probe(struct vio_dev *vdev, const struct vio_device_id *id) d = &viocd_diskinfo[deviceno]; c = &d->viocd_info; - ci = &viocd_unitinfo[deviceno]; + ci = &d->unitinfo; c->ops = &viocd_dops; c->speed =4 ;
@@ -816,9 +812,6 @@ static int __init viocd_init(void)return 0 ; out_free_info: -dma_free_coherent (iSeries_vio_dev, -sizeof (*viocd_unitinfo) *VIOCD_MAX_CD , - viocd_unitinfo, unitinfo_dmaaddr);vio_clearHandler (viomajorsubtype_cdio);viopath_close (viopath_hostLp, viomajorsubtype_cdio,MAX_CD_REQ +2 ); out_unregister:
@@ -830,10 +823,6 @@ static void __exit viocd_exit(void) {remove_proc_entry ("iSeries/viocd" ,NULL );vio_unregister_driver (&viocd_driver); -if (viocd_unitinfo !=NULL ) -dma_free_coherent (iSeries_vio_dev, -sizeof (*viocd_unitinfo) *VIOCD_MAX_CD , - viocd_unitinfo, unitinfo_dmaaddr);viopath_close (viopath_hostLp, viomajorsubtype_cdio,MAX_CD_REQ +2 );vio_clearHandler (viomajorsubtype_cdio);unregister_blkdev (VIOCD_MAJOR ,VIOCD_DEVICE );
Signature · 1 line
1.5.3.2
PATCH 5/11 remove iSeries_vio_dev
It was only being used to carry around dma_iommu_ops and vio_iommu_table which we can use directly instead. This also means that vio_bus_device doesn't need to refer to them either.
--- arch/powerpc/kernel/vio.c | 7 +----- arch/powerpc/platforms/iseries/iommu.c | 30 +++++++++++++++++++++++++++ arch/powerpc/platforms/iseries/mf.c | 23 ++++++++------------ arch/powerpc/platforms/iseries/viopath.c | 6 +--- drivers/cdrom/viocd.c | 5 +-- drivers/char/viotape.c | 7 ++--- include/asm-powerpc/iseries/hv_call_event.h | 10 +++++++++ include/asm-powerpc/iseries/vio.h | 4 --- 8 files changed, 57 insertions(+), 35 deletions(-)
Signature · 2 lines
Cheers, Stephen Rothwell [email protected]
arch/powerpc/kernel/vio.c +1 -6
@@ -49,11 +49,8 @@ static struct vio_dev vio_bus_device = { /* fake "parent" device */ };#ifdef CONFIG_PPC_ISERIES -struct device *iSeries_vio_dev = &vio_bus_device.dev; -EXPORT_SYMBOL (iSeries_vio_dev); -static struct iommu_table veth_iommu_table; -static struct iommu_table vio_iommu_table; +struct iommu_table vio_iommu_table;static void __init iommu_vio_init (void ) {
@@ -66,8 +63,6 @@ static void __init iommu_vio_init(void)printk ("Virtual Bus VETH TCE table failed.\n" );if (!iommu_init_table (&vio_iommu_table,-1 )) printk("Virtual Bus VIO TCE table failed.\n"); - vio_bus_device.dev.archdata.dma_ops = &dma_iommu_ops; - vio_bus_device.dev.archdata.dma_data = &vio_iommu_table; }#else static void __init iommu_vio_init (void )
arch/powerpc/platforms/iseries/iommu.c +30 -0
@@ -28,6 +28,7 @@#include <linux/dma-mapping.h> #include <linux/list.h> #include <linux/pci.h> +#include <linux/module.h> #include <asm/iommu.h> #include <asm/tce.h>
@@ -36,6 +37,7 @@#include <asm/prom.h> #include <asm/pci-bridge.h> #include <asm/iseries/hv_call_xm.h> +#include <asm/iseries/hv_call_event.h> #include <asm/iseries/iommu.h> static void tce_build_iSeries(struct iommu_table *tbl, long index, long npages,
@@ -189,6 +191,34 @@ void iommu_devnode_init_iSeries(struct pci_dev *pdev, struct device_node *dn) }#endif +extern struct iommu_table vio_iommu_table; + +void *iseries_hv_alloc (size_t size,dma_addr_t *dma_handle,gfp_t flag) +{ +return iommu_alloc_coherent (&vio_iommu_table, size, dma_handle, +DMA_32BIT_MASK , flag,-1 ); +} +EXPORT_SYMBOL_GPL (iseries_hv_alloc); + +void iseries_hv_free (size_t size,void *vaddr,dma_addr_t dma_handle) +{ +iommu_free_coherent (&vio_iommu_table, size, vaddr, dma_handle); +} +EXPORT_SYMBOL_GPL (iseries_hv_free); + +dma_addr_t iseries_hv_map (void *vaddr,size_t size, +enum dma_data_direction direction) +{ +return iommu_map_single (&vio_iommu_table, vaddr, size, +DMA_32BIT_MASK , direction); +} + +void iseries_hv_unmap (dma_addr_t dma_handle,size_t size, +enum dma_data_direction direction) +{ +iommu_unmap_single (&vio_iommu_table, dma_handle, size, direction); +} +void iommu_init_early_iSeries (void ) { ppc_md.tce_build = tce_build_iSeries;
arch/powerpc/platforms/iseries/mf.c +9 -14
@@ -39,9 +39,9 @@#include <asm/paca.h> #include <asm/abs_addr.h> #include <asm/firmware.h> -#include <asm/iseries/vio.h> #include <asm/iseries/mf.h> #include <asm/iseries/hv_lp_config.h> +#include <asm/iseries/hv_lp_event.h> #include <asm/iseries/it_lp_queue.h> #include "setup.h"
@@ -870,8 +870,7 @@ static int proc_mf_dump_cmdline(char *page, char **start, off_t off,if ((off + count) >256 ) count =256 - off; - dma_addr =dma_map_single (iSeries_vio_dev, page, off + count, -DMA_FROM_DEVICE ); + dma_addr =iseries_hv_map (page, off + count,DMA_FROM_DEVICE );if (dma_mapping_error (dma_addr))return -ENOMEM ;memset (page,0 , off + count);
@@ -883,8 +882,7 @@ static int proc_mf_dump_cmdline(char *page, char **start, off_t off, vsp_cmd.sub_data.kern.length = off + count;mb (); rc =signal_vsp_instruction (&vsp_cmd); -dma_unmap_single (iSeries_vio_dev, dma_addr, off + count, -DMA_FROM_DEVICE ); +iseries_hv_unmap (dma_addr, off + count,DMA_FROM_DEVICE );if (rc)return rc;if (vsp_cmd.result_code !=0 )
@@ -919,8 +917,7 @@ static int mf_getVmlinuxChunk(char *buffer, int *size, int offset, u64 side)int len = *size;dma_addr_t dma_addr; - dma_addr =dma_map_single (iSeries_vio_dev, buffer, len, -DMA_FROM_DEVICE ); + dma_addr =iseries_hv_map (buffer, len,DMA_FROM_DEVICE );memset (buffer,0 , len);memset (&vsp_cmd,0 ,sizeof (vsp_cmd)); vsp_cmd.cmd =32 ;
@@ -938,7 +935,7 @@ static int mf_getVmlinuxChunk(char *buffer, int *size, int offset, u64 side) rc = -ENOMEM ; } -dma_unmap_single (iSeries_vio_dev, dma_addr, len,DMA_FROM_DEVICE ); +iseries_hv_unmap (dma_addr, len,DMA_FROM_DEVICE );return rc; }
@@ -1149,8 +1146,7 @@ static int proc_mf_change_cmdline(struct file *file, const char __user *buffer, goto out; dma_addr =0 ; - page =dma_alloc_coherent (iSeries_vio_dev, count, &dma_addr, -GFP_ATOMIC ); + page =iseries_hv_alloc (count, &dma_addr,GFP_ATOMIC ); ret = -ENOMEM ;if (page ==NULL ) goto out;
@@ -1170,7 +1166,7 @@ static int proc_mf_change_cmdline(struct file *file, const char __user *buffer, ret = count; out_free: -dma_free_coherent (iSeries_vio_dev, count, page, dma_addr); +iseries_hv_free (count, page, dma_addr); out:return ret; }
@@ -1190,8 +1186,7 @@ static ssize_t proc_mf_change_vmlinux(struct file *file, goto out; dma_addr =0 ; - page =dma_alloc_coherent (iSeries_vio_dev, count, &dma_addr, -GFP_ATOMIC ); + page =iseries_hv_alloc (count, &dma_addr,GFP_ATOMIC ); rc = -ENOMEM ;if (page ==NULL ) {printk (KERN_ERR "mf.c: couldn't allocate memory to set vmlinux chunk\n" );
@@ -1219,7 +1214,7 @@ static ssize_t proc_mf_change_vmlinux(struct file *file, *ppos += count; rc = count; out_free: -dma_free_coherent (iSeries_vio_dev, count, page, dma_addr); +iseries_hv_free (count, page, dma_addr); out:return rc; }
arch/powerpc/platforms/iseries/viopath.c +2 -4
@@ -124,8 +124,7 @@ static int proc_viopath_show(struct seq_file *m, void *v)if (!buf)return 0 ; - handle =dma_map_single (iSeries_vio_dev, buf,HW_PAGE_SIZE , -DMA_FROM_DEVICE ); + handle =iseries_hv_map (buf,HW_PAGE_SIZE ,DMA_FROM_DEVICE ); hvrc = HvCallEvent_signalLpEventFast(viopath_hostLp, HvLpEvent_Type_VirtualIo,
@@ -146,8 +145,7 @@ static int proc_viopath_show(struct seq_file *m, void *v) buf[HW_PAGE_SIZE -1 ] ='\0' ;seq_printf (m,"%s" , buf); -dma_unmap_single (iSeries_vio_dev, handle,HW_PAGE_SIZE , -DMA_FROM_DEVICE ); +iseries_hv_unmap (handle,HW_PAGE_SIZE ,DMA_FROM_DEVICE );kfree (buf);seq_printf (m,"AVAILABLE_VETH=%x\n" , vlanMap);
drivers/cdrom/viocd.c +2 -3
@@ -220,7 +220,7 @@ static void __init get_viocd_info(void)struct cdrom_info *viocd_unitinfo;dma_addr_t unitinfo_dmaaddr; - viocd_unitinfo =dma_alloc_coherent (iSeries_vio_dev, + viocd_unitinfo =iseries_hv_alloc (sizeof (*viocd_unitinfo) *VIOCD_MAX_CD , &unitinfo_dmaaddr,GFP_ATOMIC );if (viocd_unitinfo ==NULL ) {
@@ -262,8 +262,7 @@ static void __init get_viocd_info(void) } error_ret: -dma_free_coherent (iSeries_vio_dev, -sizeof (*viocd_unitinfo) *VIOCD_MAX_CD , +iseries_hv_free (sizeof (*viocd_unitinfo) *VIOCD_MAX_CD , viocd_unitinfo, unitinfo_dmaaddr); }
drivers/char/viotape.c +3 -4
@@ -392,8 +392,8 @@ static int get_viotape_info(void)if (op ==NULL )return -ENOMEM ; - viotape_unitinfo =dma_alloc_coherent (iSeries_vio_dev, len, - &viotape_unitinfo_token,GFP_ATOMIC ); + viotape_unitinfo =iseries_hv_alloc (len, &viotape_unitinfo_token, +GFP_ATOMIC );if (viotape_unitinfo ==NULL ) {free_op_struct (op);return -ENOMEM ;
@@ -1103,8 +1103,7 @@ static void __exit viotap_exit(void)class_destroy (tape_class);unregister_chrdev (VIOTAPE_MAJOR ,"viotape" );if (viotape_unitinfo) -dma_free_coherent (iSeries_vio_dev, -sizeof (viotape_unitinfo[0 ]) *VIOTAPE_MAX_TAPE , +iseries_hv_free (sizeof (viotape_unitinfo[0 ]) *VIOTAPE_MAX_TAPE , viotape_unitinfo, viotape_unitinfo_token);viopath_close (viopath_hostLp, viomajorsubtype_tape,VIOTAPE_MAXREQ +2 );vio_clearHandler (viomajorsubtype_tape);
include/asm-powerpc/iseries/hv_call_event.h +10 -0
@@ -21,6 +21,9 @@#ifndef _ASM_POWERPC_ISERIES_HV_CALL_EVENT_H#define _ASM_POWERPC_ISERIES_HV_CALL_EVENT_H +#include <linux/types.h> +#include <linux/dma-mapping.h> +#include <asm/iseries/hv_call_sc.h> #include <asm/iseries/hv_types.h> #include <asm/abs_addr.h>
@@ -113,6 +116,13 @@ static inline HvLpEvent_Rc HvCallEvent_signalLpEventFast(HvLpIndex targetLp, eventData3, eventData4, eventData5); } +extern void *iseries_hv_alloc (size_t size,dma_addr_t *dma_handle,gfp_t flag); +extern void iseries_hv_free (size_t size,void *vaddr,dma_addr_t dma_handle); +extern dma_addr_t iseries_hv_map (void *vaddr,size_t size, +enum dma_data_direction direction); +extern void iseries_hv_unmap (dma_addr_t dma_handle,size_t size, +enum dma_data_direction direction); +static inline HvLpEvent_Rc HvCallEvent_ackLpEvent (struct HvLpEvent *event) {return HvCall1 (HvCallEventAckLpEvent,virt_to_abs (event));
include/asm-powerpc/iseries/vio.h +0 -4
@@ -150,8 +150,4 @@ enum viochar_rc { viochar_rc_ebusy =1 }; -struct device ; - -extern struct device *iSeries_vio_dev; -#endif /* _ASM_POWERPC_ISERIES_VIO_H */
Signature · 1 line
1.5.3.2
PATCH 6/11 Remove more iSeries specific stuff from vio.c
--- arch/powerpc/kernel/vio.c | 78 ++++++++++--------------------- arch/powerpc/platforms/iseries/iommu.c | 24 +++++++++- include/asm-powerpc/iseries/iommu.h | 4 ++ 3 files changed, 52 insertions(+), 54 deletions(-)
Signature · 2 lines
Cheers, Stephen Rothwell [email protected]
arch/powerpc/kernel/vio.c +25 -53
@@ -48,61 +48,33 @@ static struct vio_dev vio_bus_device = { /* fake "parent" device */ .dev.bus = &vio_bus_type, }; -#ifdef CONFIG_PPC_ISERIES -static struct iommu_table veth_iommu_table; -struct iommu_table vio_iommu_table; - -static void __init iommu_vio_init (void ) -{ -iommu_table_getparms_iSeries (255 ,0 ,0xff , &veth_iommu_table); - veth_iommu_table.it_size /=2 ; - vio_iommu_table = veth_iommu_table; - vio_iommu_table.it_offset += veth_iommu_table.it_size; - -if (!iommu_init_table (&veth_iommu_table,-1 )) -printk ("Virtual Bus VETH TCE table failed.\n" ); -if (!iommu_init_table (&vio_iommu_table,-1 )) -printk ("Virtual Bus VIO TCE table failed.\n" ); -} -#else -static void __init iommu_vio_init (void ) -{ -} -#endif -static struct iommu_table *vio_build_iommu_table (struct vio_dev *dev) { -#ifdef CONFIG_PPC_ISERIES -if (firmware_has_feature (FW_FEATURE_ISERIES )) { -if (strcmp (dev->type,"network" ) ==0 ) -return &veth_iommu_table; -return &vio_iommu_table; - } else -#endif - { -const unsigned char *dma_window; -struct iommu_table *tbl; -unsigned long offset, size; - - dma_window =of_get_property (dev->dev.archdata.of_node, -"ibm,my-dma-window" ,NULL ); -if (!dma_window) -return NULL ; - - tbl =kmalloc (sizeof (*tbl),GFP_KERNEL ); - -of_parse_dma_window (dev->dev.archdata.of_node, dma_window, - &tbl->it_index, &offset, &size); - -/* TCE table size - measured in tce entries */ - tbl->it_size = size >>IOMMU_PAGE_SHIFT ; -/* offset for VIO should always be 0 */ - tbl->it_offset = offset >>IOMMU_PAGE_SHIFT ; - tbl->it_busno =0 ; - tbl->it_type =TCE_VB ; - -return iommu_init_table (tbl,-1 ); - } +const unsigned char *dma_window; +struct iommu_table *tbl; +unsigned long offset, size; + +if (firmware_has_feature (FW_FEATURE_ISERIES )) +return vio_build_iommu_table_iseries (dev); + + dma_window =of_get_property (dev->dev.archdata.of_node, +"ibm,my-dma-window" ,NULL ); +if (!dma_window) +return NULL ; + + tbl =kmalloc (sizeof (*tbl),GFP_KERNEL ); + +of_parse_dma_window (dev->dev.archdata.of_node, dma_window, + &tbl->it_index, &offset, &size); + +/* TCE table size - measured in tce entries */ + tbl->it_size = size >>IOMMU_PAGE_SHIFT ; +/* offset for VIO should always be 0 */ + tbl->it_offset = offset >>IOMMU_PAGE_SHIFT ; + tbl->it_busno =0 ; + tbl->it_type =TCE_VB ; + +return iommu_init_table (tbl,-1 ); }/**
arch/powerpc/platforms/iseries/iommu.c +23 -1
@@ -31,6 +31,7 @@#include <linux/module.h> #include <asm/iommu.h> +#include <asm/vio.h> #include <asm/tce.h> #include <asm/machdep.h> #include <asm/abs_addr.h>
@@ -191,7 +192,8 @@ void iommu_devnode_init_iSeries(struct pci_dev *pdev, struct device_node *dn) }#endif -extern struct iommu_table vio_iommu_table; +static struct iommu_table veth_iommu_table; +static struct iommu_table vio_iommu_table;void *iseries_hv_alloc (size_t size,dma_addr_t *dma_handle,gfp_t flag) {
@@ -219,6 +221,26 @@ void iseries_hv_unmap(dma_addr_t dma_handle, size_t size,iommu_unmap_single (&vio_iommu_table, dma_handle, size, direction); } +void __init iommu_vio_init (void ) +{ +iommu_table_getparms_iSeries (255 ,0 ,0xff , &veth_iommu_table); + veth_iommu_table.it_size /=2 ; + vio_iommu_table = veth_iommu_table; + vio_iommu_table.it_offset += veth_iommu_table.it_size; + +if (!iommu_init_table (&veth_iommu_table,-1 )) +printk ("Virtual Bus VETH TCE table failed.\n" ); +if (!iommu_init_table (&vio_iommu_table,-1 )) +printk ("Virtual Bus VIO TCE table failed.\n" ); +} + +struct iommu_table *vio_build_iommu_table_iseries (struct vio_dev *dev) +{ +if (strcmp (dev->type,"network" ) ==0 ) +return &veth_iommu_table; +return &vio_iommu_table; +} +void iommu_init_early_iSeries (void ) { ppc_md.tce_build = tce_build_iSeries;
include/asm-powerpc/iseries/iommu.h +4 -0
@@ -22,6 +22,7 @@*/ struct pci_dev ; +struct vio_dev ;struct device_node ;struct iommu_table ;
@@ -34,4 +35,7 @@ extern void iommu_table_getparms_iSeries(unsigned long busno, unsigned char slotno, unsigned char virtbus, struct iommu_table *tbl); +extern struct iommu_table *vio_build_iommu_table_iseries (struct vio_dev *dev); +extern void iommu_vio_init (void ); +#endif /* _ASM_POWERPC_ISERIES_IOMMU_H */
Signature · 1 line
1.5.3.2
PATCH 7/11 iSeries: missing newline in printk
--- arch/powerpc/platforms/iseries/viopath.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
Signature · 2 lines
Cheers, Stephen Rothwell [email protected]
arch/powerpc/platforms/iseries/viopath.c +1 -1
@@ -594,7 +594,7 @@ int viopath_close(HvLpIndex remoteLp, int subtype, int numReq) numOpen += viopathStatus[remoteLp].users[i];if ((viopathStatus[remoteLp].isOpen) && (numOpen ==0 )) { -printk (VIOPATH_KERN_INFO "closing connection to partition %d" , +printk (VIOPATH_KERN_INFO "closing connection to partition %d\n" , remoteLp); HvCallEvent_closeLpEventPath(remoteLp,
Signature · 1 line
1.5.3.2
PATCH 8/11 iSeries: move detection of virtual cdroms
Now we will only have entries in the device tree for the actual existing devices (including their OS/400 properties). This way viocd.c gets all the information about the devices from the device tree.
--- arch/powerpc/kernel/vio.c | 3 - arch/powerpc/platforms/iseries/Makefile | 2 +- arch/powerpc/platforms/iseries/dt.c | 4 - arch/powerpc/platforms/iseries/vio.c | 321 +++++++++++++++++++++++++++++++ drivers/cdrom/viocd.c | 116 ++---------- include/asm-powerpc/iseries/vio.h | 24 +++ 6 files changed, 365 insertions(+), 105 deletions(-) create mode 100644 arch/powerpc/platforms/iseries/vio.c
Signature · 2 lines
Cheers, Stephen Rothwell [email protected]
arch/powerpc/kernel/vio.c +0 -3
@@ -257,9 +257,6 @@ static int __init vio_bus_init(void)int err;struct device_node *node_vroot; -if (firmware_has_feature (FW_FEATURE_ISERIES )) -iommu_vio_init (); - err =bus_register (&vio_bus_type);if (err) {printk (KERN_ERR "failed to register VIO bus\n" );
arch/powerpc/platforms/iseries/Makefile +1 -1
@@ -7,7 +7,7 @@ obj-y += hvlog.o hvlpconfig.o lpardata.o setup.o dt_mod.o mf.o lpevents.o \ hvcall.o proc.o htab.o iommu.o misc.o irq.o obj-$(CONFIG_PCI) += pci.o vpdinfo.o obj-$(CONFIG_SMP) += smp.o -obj-$(CONFIG_VIOPATH) += viopath.o +obj-$(CONFIG_VIOPATH) += viopath.o vio.o obj-$(CONFIG_MODULES) += ksyms.o quiet_cmd_dt_strings = DT_STR $@
arch/powerpc/platforms/iseries/dt.c +0 -4
@@ -381,10 +381,6 @@ static void __init dt_vdevices(struct iseries_flat_dt *dt)dt_do_vdevice (dt,"viodasd" , reg, i, device_type_block,"IBM,iSeries-viodasd" ,1 ); reg +=HVMAXARCHITECTEDVIRTUALDISKS ; - -for (i =0 ; i <HVMAXARCHITECTEDVIRTUALCDROMS ; i++) -dt_do_vdevice (dt,"viocd" , reg, i, device_type_block, -"IBM,iSeries-viocd" ,1 ); reg +=HVMAXARCHITECTEDVIRTUALCDROMS ;for (i =0 ; i <HVMAXARCHITECTEDVIRTUALTAPES ; i++)
arch/powerpc/platforms/iseries/vio.c new file +321 -0
321 lines not on this page · raw message
drivers/cdrom/viocd.c +19 -97
180 lines not on this page · raw message
include/asm-powerpc/iseries/vio.h +24 -0
@@ -51,6 +51,30 @@*/ #define VIO_MAX_SUBTYPES 8 +struct viocdlpevent { +struct HvLpEvent event; +u32 reserved; +u16 version; +u16 sub_result; +u16 disk; +u16 flags; +u32 token; +u64 offset;/* On open, max number of disks */ +u64 len;/* On open, size of the disk */ +u32 block_size;/* Only set on open */ +u32 media_size;/* Only set on open */ +}; + +enum viocdsubtype { + viocdopen =0x0001 , + viocdclose =0x0002 , + viocdread =0x0003 , + viocdwrite =0x0004 , + viocdlockdoor =0x0005 , + viocdgetinfo =0x0006 , + viocdcheck =0x0007 +}; +/* * Each subtype can register a handler to process their events. * The handler must have this interface.
Signature · 1 line
1.5.3.2
PATCH 8/11 iSeries: move detection of virtual cdroms
Now we will only have entries in the device tree for the actual existing devices (including their OS/400 properties). This way viocd.c gets all the information about the devices from the device tree.
--- arch/powerpc/kernel/vio.c | 3 - arch/powerpc/platforms/iseries/Makefile | 2 +- arch/powerpc/platforms/iseries/dt.c | 4 - arch/powerpc/platforms/iseries/vio.c | 317 +++++++++++++++++++++++++++++++ drivers/cdrom/viocd.c | 116 ++---------- include/asm-powerpc/iseries/vio.h | 24 +++ 6 files changed, 361 insertions(+), 105 deletions(-) create mode 100644 arch/powerpc/platforms/iseries/vio.c
This version creates the device tree entries unconditionally.
Signature · 2 lines
Cheers, Stephen Rothwell [email protected]
arch/powerpc/kernel/vio.c +0 -3
@@ -257,9 +257,6 @@ static int __init vio_bus_init(void)int err;struct device_node *node_vroot; -if (firmware_has_feature (FW_FEATURE_ISERIES )) -iommu_vio_init (); - err =bus_register (&vio_bus_type);if (err) {printk (KERN_ERR "failed to register VIO bus\n" );
arch/powerpc/platforms/iseries/Makefile +1 -1
@@ -7,7 +7,7 @@ obj-y += hvlog.o hvlpconfig.o lpardata.o setup.o dt_mod.o mf.o lpevents.o \ hvcall.o proc.o htab.o iommu.o misc.o irq.o obj-$(CONFIG_PCI) += pci.o vpdinfo.o obj-$(CONFIG_SMP) += smp.o -obj-$(CONFIG_VIOPATH) += viopath.o +obj-$(CONFIG_VIOPATH) += viopath.o vio.o obj-$(CONFIG_MODULES) += ksyms.o quiet_cmd_dt_strings = DT_STR $@
arch/powerpc/platforms/iseries/dt.c +0 -4
@@ -381,10 +381,6 @@ static void __init dt_vdevices(struct iseries_flat_dt *dt)dt_do_vdevice (dt,"viodasd" , reg, i, device_type_block,"IBM,iSeries-viodasd" ,1 ); reg +=HVMAXARCHITECTEDVIRTUALDISKS ; - -for (i =0 ; i <HVMAXARCHITECTEDVIRTUALCDROMS ; i++) -dt_do_vdevice (dt,"viocd" , reg, i, device_type_block, -"IBM,iSeries-viocd" ,1 ); reg +=HVMAXARCHITECTEDVIRTUALCDROMS ;for (i =0 ; i <HVMAXARCHITECTEDVIRTUALTAPES ; i++)
arch/powerpc/platforms/iseries/vio.c new file +317 -0
317 lines not on this page · raw message
drivers/cdrom/viocd.c +19 -97
180 lines not on this page · raw message
include/asm-powerpc/iseries/vio.h +24 -0
@@ -51,6 +51,30 @@*/ #define VIO_MAX_SUBTYPES 8 +struct viocdlpevent { +struct HvLpEvent event; +u32 reserved; +u16 version; +u16 sub_result; +u16 disk; +u16 flags; +u32 token; +u64 offset;/* On open, max number of disks */ +u64 len;/* On open, size of the disk */ +u32 block_size;/* Only set on open */ +u32 media_size;/* Only set on open */ +}; + +enum viocdsubtype { + viocdopen =0x0001 , + viocdclose =0x0002 , + viocdread =0x0003 , + viocdwrite =0x0004 , + viocdlockdoor =0x0005 , + viocdgetinfo =0x0006 , + viocdcheck =0x0007 +}; +/* * Each subtype can register a handler to process their events. * The handler must have this interface.
Signature · 1 line
1.5.3.2
PATCH 9/11 iSeries: move detection of virtual tapes
In reply to Stephen RothwellNow we will only have entries in the device tree for the actual existing devices (including their OS/400 properties). This way viotape.c gets all the information about the devices from the device tree.
--- arch/powerpc/platforms/iseries/dt.c | 7 -- arch/powerpc/platforms/iseries/vio.c | 153 ++++++++++++++++++++++++++++++---- drivers/char/viotape.c | 124 ++++----------------------- include/asm-powerpc/iseries/vio.h | 41 +++++++++ 4 files changed, 196 insertions(+), 129 deletions(-)
Signature · 2 lines
Cheers, Stephen Rothwell [email protected]
arch/powerpc/platforms/iseries/dt.c +0 -7
@@ -73,7 +73,6 @@ static char __initdata device_type_memory[] = "memory";static char __initdata device_type_serial[] ="serial" ;static char __initdata device_type_network[] ="network" ;static char __initdata device_type_block[] ="block" ; -static char __initdata device_type_byte[] ="byte" ;static char __initdata device_type_pci[] ="pci" ;static char __initdata device_type_vdevice[] ="vdevice" ;static char __initdata device_type_vscsi[] ="vscsi" ;
@@ -380,12 +379,6 @@ static void __init dt_vdevices(struct iseries_flat_dt *dt)for (i =0 ; i <HVMAXARCHITECTEDVIRTUALDISKS ; i++)dt_do_vdevice (dt,"viodasd" , reg, i, device_type_block,"IBM,iSeries-viodasd" ,1 ); - reg +=HVMAXARCHITECTEDVIRTUALDISKS ; - reg +=HVMAXARCHITECTEDVIRTUALCDROMS ; - -for (i =0 ; i <HVMAXARCHITECTEDVIRTUALTAPES ; i++) -dt_do_vdevice (dt,"viotape" , reg, i, device_type_byte, -"IBM,iSeries-viotape" ,1 );dt_end_node (dt); }
arch/powerpc/platforms/iseries/vio.c +137 -16
192 lines not on this page · raw message
drivers/char/viotape.c +18 -106
170 lines not on this page · raw message
include/asm-powerpc/iseries/vio.h +41 -0
47 lines not on this page · raw message
Signature · 1 line
1.5.3.2
PATCH 9/11 iSeries: move detection of virtual tapes
Now we will only have entries in the device tree for the actual existing devices (including their OS/400 properties). This way viotape.c gets all the information about the devices from the device tree.
--- arch/powerpc/platforms/iseries/dt.c | 7 -- arch/powerpc/platforms/iseries/vio.c | 149 ++++++++++++++++++++++++++++++---- drivers/char/viotape.c | 124 ++++------------------------ include/asm-powerpc/iseries/vio.h | 41 +++++++++ 4 files changed, 192 insertions(+), 129 deletions(-)
This version creates the device tree entries unconditionally.
Signature · 2 lines
Cheers, Stephen Rothwell [email protected]
arch/powerpc/platforms/iseries/dt.c +0 -7
@@ -73,7 +73,6 @@ static char __initdata device_type_memory[] = "memory";static char __initdata device_type_serial[] ="serial" ;static char __initdata device_type_network[] ="network" ;static char __initdata device_type_block[] ="block" ; -static char __initdata device_type_byte[] ="byte" ;static char __initdata device_type_pci[] ="pci" ;static char __initdata device_type_vdevice[] ="vdevice" ;static char __initdata device_type_vscsi[] ="vscsi" ;
@@ -380,12 +379,6 @@ static void __init dt_vdevices(struct iseries_flat_dt *dt)for (i =0 ; i <HVMAXARCHITECTEDVIRTUALDISKS ; i++)dt_do_vdevice (dt,"viodasd" , reg, i, device_type_block,"IBM,iSeries-viodasd" ,1 ); - reg +=HVMAXARCHITECTEDVIRTUALDISKS ; - reg +=HVMAXARCHITECTEDVIRTUALCDROMS ; - -for (i =0 ; i <HVMAXARCHITECTEDVIRTUALTAPES ; i++) -dt_do_vdevice (dt,"viotape" , reg, i, device_type_byte, -"IBM,iSeries-viotape" ,1 );dt_end_node (dt); }
arch/powerpc/platforms/iseries/vio.c +133 -16
188 lines not on this page · raw message
drivers/char/viotape.c +18 -106
170 lines not on this page · raw message
include/asm-powerpc/iseries/vio.h +41 -0
47 lines not on this page · raw message
Signature · 1 line
1.5.3.2
Re: [PATCH 09/11] [POWERPC] iSeries: move detection of virtual tapes
In reply to Stephen Rothwellarch/powerpc/platforms/iseries/vio.c static void __init get_viocd_info(struct device_node *vio_root) · line 296
Quoted 6 lines
arch/powerpc/platforms/iseries/vio.c +6
-0+#if defined(CONFIG_VIOTAPE ) || defined(CONFIG_VIOTAPE_MODULE ) +/* Handle interrupt events for tape */ +static void __init handle_tape_event (struct HvLpEvent *event) +{ +struct vio_waitevent *we; +struct viotapelpevent *tevent = (struct viotapelpevent *)event;
I think we should generate these device tree entires unconditionally. They're just a conversion of what the iseries firmware/hypervisor provides and not dependent on a specific driver.
(dito for the other patches with the same scheme)
Re: [PATCH 09/11] [POWERPC] iSeries: move detection of virtual tapes
Quoted 6 lines · On Fri, 21 Sep 2007 10:29:52 +0200 Christoph Hellwig <[email protected]> wrote:
I think we should generate these device tree entires unconditionally. They're just a conversion of what the iseries
firmware/hypervisorprovides and not dependent on a specific driver.(dito for the other patches with the same scheme)
You are right, of course. I will redo the relevant patches.
Signature · 3 lines
Cheers, Stephen Rothwell [email protected] http://www.canb.auug.org.au/~sfr/
PATCH 10/11 Clean up vio.h
In reply to Stephen RothwellRemove vio_dma_ops declaration (since it no longer exists) and some unused fields from struct vio_driver.
--- arch/powerpc/kernel/vio.c | 11 ----------- include/asm-powerpc/vio.h | 5 ----- 2 files changed, 0 insertions(+), 16 deletions(-)
Signature · 2 lines
Cheers, Stephen Rothwell [email protected]
arch/powerpc/kernel/vio.c +0 -11
@@ -135,16 +135,6 @@ static int vio_bus_remove(struct device *dev)return 1 ; } -/* convert from struct device to struct vio_dev and pass to driver. */ -static void vio_bus_shutdown (struct device *dev) -{ -struct vio_dev *viodev =to_vio_dev (dev); -struct vio_driver *viodrv =to_vio_driver (dev->driver); - -if (dev->driver && viodrv->shutdown) - viodrv->shutdown (viodev); -} -/** * vio_register_driver: - Register a new vio driver * @drv: The vio_driver structure to be registered.
@@ -361,7 +351,6 @@ static struct bus_type vio_bus_type = { .match = vio_bus_match, .probe = vio_bus_probe, .remove = vio_bus_remove, - .shutdown = vio_bus_shutdown, };/**
include/asm-powerpc/vio.h +0 -5
@@ -53,17 +53,12 @@ struct vio_dev { };struct vio_driver { -struct list_head node;const struct vio_device_id *id_table;int (*probe)(struct vio_dev *dev,const struct vio_device_id *id);int (*remove)(struct vio_dev *dev); -void (*shutdown)(struct vio_dev *dev); -unsigned long driver_data;struct device_driver driver; }; -extern struct dma_mapping_ops vio_dma_ops; -extern int vio_register_driver (struct vio_driver *drv);extern void vio_unregister_driver (struct vio_driver *drv);
Signature · 1 line
1.5.3.2
PATCH 11/11 iSeries: move viodasd probing
This way we only have entries in the device tree for disks that actually exist. A slight complication is that disks may be attached to LPARs at runtime.
--- arch/powerpc/platforms/iseries/dt.c | 6 - arch/powerpc/platforms/iseries/vio.c | 305 ++++++++++++++++++++++++---------- drivers/block/viodasd.c | 77 +++------ include/asm-powerpc/iseries/vio.h | 47 +++++ 4 files changed, 286 insertions(+), 149 deletions(-)
Signature · 2 lines
Cheers, Stephen Rothwell [email protected]
arch/powerpc/platforms/iseries/dt.c +0 -6
@@ -72,7 +72,6 @@ static char __initdata device_type_cpu[] = "cpu";static char __initdata device_type_memory[] ="memory" ;static char __initdata device_type_serial[] ="serial" ;static char __initdata device_type_network[] ="network" ; -static char __initdata device_type_block[] ="block" ;static char __initdata device_type_pci[] ="pci" ;static char __initdata device_type_vdevice[] ="vdevice" ;static char __initdata device_type_vscsi[] ="vscsi" ;
@@ -374,11 +373,6 @@ static void __init dt_vdevices(struct iseries_flat_dt *dt)dt_end_node (dt); } - reg +=HVMAXARCHITECTEDVIRTUALLANS ; - -for (i =0 ; i <HVMAXARCHITECTEDVIRTUALDISKS ; i++) -dt_do_vdevice (dt,"viodasd" , reg, i, device_type_block, -"IBM,iSeries-viodasd" ,1 );dt_end_node (dt); }
arch/powerpc/platforms/iseries/vio.c +214 -91
367 lines not on this page · raw message
drivers/block/viodasd.c +25 -52
135 lines not on this page · raw message
include/asm-powerpc/iseries/vio.h +47 -0
59 lines not on this page · raw message
Signature · 1 line
1.5.3.2
PATCH 11/11 iSeries: move viodasd probing
This way we only have entries in the device tree for disks that actually exist. A slight complication is that disks may be attached to LPARs at runtime.
--- arch/powerpc/platforms/iseries/dt.c | 6 - arch/powerpc/platforms/iseries/vio.c | 301 +++++++++++++++++++++++---------- drivers/block/viodasd.c | 77 +++------ include/asm-powerpc/iseries/vio.h | 47 ++++++ 4 files changed, 282 insertions(+), 149 deletions(-)
This version creates the device tree entries unconditionally.
Signature · 2 lines
Cheers, Stephen Rothwell [email protected]
arch/powerpc/platforms/iseries/dt.c +0 -6
@@ -72,7 +72,6 @@ static char __initdata device_type_cpu[] = "cpu";static char __initdata device_type_memory[] ="memory" ;static char __initdata device_type_serial[] ="serial" ;static char __initdata device_type_network[] ="network" ; -static char __initdata device_type_block[] ="block" ;static char __initdata device_type_pci[] ="pci" ;static char __initdata device_type_vdevice[] ="vdevice" ;static char __initdata device_type_vscsi[] ="vscsi" ;
@@ -374,11 +373,6 @@ static void __init dt_vdevices(struct iseries_flat_dt *dt)dt_end_node (dt); } - reg +=HVMAXARCHITECTEDVIRTUALLANS ; - -for (i =0 ; i <HVMAXARCHITECTEDVIRTUALDISKS ; i++) -dt_do_vdevice (dt,"viodasd" , reg, i, device_type_block, -"IBM,iSeries-viodasd" ,1 );dt_end_node (dt); }
arch/powerpc/platforms/iseries/vio.c +210 -91
363 lines not on this page · raw message
drivers/block/viodasd.c +25 -52
135 lines not on this page · raw message
include/asm-powerpc/iseries/vio.h +47 -0
59 lines not on this page · raw message
Signature · 1 line
1.5.3.2