Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

s390/qdio: avoid allocating the qdio_irq with GFP_DMA

The qdio_irq contains only two fields that are directly exposed to the
HW (ccw and qib). And only the ccw needs to reside in 31-bit memory. So
allocate it separately, and remove the GFP_DMA constraint from the
qdio_irq allocation.

Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com>
Reviewed-by: Benjamin Block <bblock@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>

authored by

Julian Wiedmann and committed by
Heiko Carstens
718ce9e1 bd3a025d

+23 -14
+1 -1
drivers/s390/cio/qdio.h
··· 236 236 int nr_input_qs; 237 237 int nr_output_qs; 238 238 239 - struct ccw1 ccw; 239 + struct ccw1 *ccw; 240 240 241 241 struct qdio_ssqd_desc ssqd_desc; 242 242 void (*orig_handler) (struct ccw_device *, unsigned long, struct irb *);
+22 -12
drivers/s390/cio/qdio_main.c
··· 10 10 #include <linux/module.h> 11 11 #include <linux/init.h> 12 12 #include <linux/kernel.h> 13 + #include <linux/kmemleak.h> 13 14 #include <linux/delay.h> 14 15 #include <linux/gfp.h> 15 16 #include <linux/io.h> ··· 875 874 qdio_free_queues(irq_ptr); 876 875 free_page((unsigned long) irq_ptr->qdr); 877 876 free_page(irq_ptr->chsc_page); 877 + kfree(irq_ptr->ccw); 878 878 free_page((unsigned long) irq_ptr); 879 879 return 0; 880 880 } ··· 901 899 no_output_qs > QDIO_MAX_QUEUES_PER_IRQ) 902 900 return -EINVAL; 903 901 904 - /* irq_ptr must be in GFP_DMA since it contains ccw1.cda */ 905 - irq_ptr = (void *) get_zeroed_page(GFP_KERNEL | GFP_DMA); 902 + irq_ptr = (void *) get_zeroed_page(GFP_KERNEL); 906 903 if (!irq_ptr) 907 904 return -ENOMEM; 905 + 906 + irq_ptr->ccw = kmalloc(sizeof(*irq_ptr->ccw), GFP_KERNEL | GFP_DMA); 907 + if (!irq_ptr->ccw) 908 + goto err_ccw; 909 + 910 + /* kmemleak doesn't scan the page-allocated irq_ptr: */ 911 + kmemleak_not_leak(irq_ptr->ccw); 908 912 909 913 irq_ptr->cdev = cdev; 910 914 mutex_init(&irq_ptr->setup_mutex); ··· 949 941 free_page(irq_ptr->chsc_page); 950 942 err_chsc: 951 943 err_dbf: 944 + kfree(irq_ptr->ccw); 945 + err_ccw: 952 946 free_page((unsigned long) irq_ptr); 953 947 return rc; 954 948 } ··· 1022 1012 goto err_thinint; 1023 1013 1024 1014 /* establish q */ 1025 - irq_ptr->ccw.cmd_code = ciw->cmd; 1026 - irq_ptr->ccw.flags = CCW_FLAG_SLI; 1027 - irq_ptr->ccw.count = ciw->count; 1028 - irq_ptr->ccw.cda = (u32) virt_to_phys(irq_ptr->qdr); 1015 + irq_ptr->ccw->cmd_code = ciw->cmd; 1016 + irq_ptr->ccw->flags = CCW_FLAG_SLI; 1017 + irq_ptr->ccw->count = ciw->count; 1018 + irq_ptr->ccw->cda = (u32) virt_to_phys(irq_ptr->qdr); 1029 1019 1030 1020 spin_lock_irq(get_ccwdev_lock(cdev)); 1031 1021 ccw_device_set_options_mask(cdev, 0); 1032 1022 1033 - rc = ccw_device_start(cdev, &irq_ptr->ccw, QDIO_DOING_ESTABLISH, 0, 0); 1023 + rc = ccw_device_start(cdev, irq_ptr->ccw, QDIO_DOING_ESTABLISH, 0, 0); 1034 1024 spin_unlock_irq(get_ccwdev_lock(cdev)); 1035 1025 if (rc) { 1036 1026 DBF_ERROR("%4x est IO ERR", irq_ptr->schid.sch_no); ··· 1103 1093 goto out; 1104 1094 } 1105 1095 1106 - irq_ptr->ccw.cmd_code = ciw->cmd; 1107 - irq_ptr->ccw.flags = CCW_FLAG_SLI; 1108 - irq_ptr->ccw.count = ciw->count; 1109 - irq_ptr->ccw.cda = 0; 1096 + irq_ptr->ccw->cmd_code = ciw->cmd; 1097 + irq_ptr->ccw->flags = CCW_FLAG_SLI; 1098 + irq_ptr->ccw->count = ciw->count; 1099 + irq_ptr->ccw->cda = 0; 1110 1100 1111 1101 spin_lock_irq(get_ccwdev_lock(cdev)); 1112 1102 ccw_device_set_options(cdev, CCWDEV_REPORT_ALL); 1113 1103 1114 - rc = ccw_device_start(cdev, &irq_ptr->ccw, QDIO_DOING_ACTIVATE, 1104 + rc = ccw_device_start(cdev, irq_ptr->ccw, QDIO_DOING_ACTIVATE, 1115 1105 0, DOIO_DENY_PREFETCH); 1116 1106 spin_unlock_irq(get_ccwdev_lock(cdev)); 1117 1107 if (rc) {
-1
drivers/s390/cio/qdio_setup.c
··· 356 356 struct ccw_device *cdev = irq_ptr->cdev; 357 357 358 358 irq_ptr->qdioac1 = 0; 359 - memset(&irq_ptr->ccw, 0, sizeof(irq_ptr->ccw)); 360 359 memset(&irq_ptr->ssqd_desc, 0, sizeof(irq_ptr->ssqd_desc)); 361 360 memset(&irq_ptr->perf_stat, 0, sizeof(irq_ptr->perf_stat)); 362 361