aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Ott <sebott@linux.vnet.ibm.com>2013-10-22 09:19:24 -0400
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2013-10-24 11:17:17 -0400
commitcb4deb69624c19980dded34a8cba7b67044c9fa9 (patch)
tree28cf69a0dec257fab89e02bf87da31d3aca56c8a
parentaf0b129294cd715765e81d66000547c4026297c4 (diff)
s390/pci: cleanup function information block
Cleanup function information block used as a modify pci function parameter. Change reserved members to be anonymous. Fix the size of the struct and add proper alignment information. Also put the FIB on the stack. Signed-off-by: Sebastian Ott <sebott@linux.vnet.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
-rw-r--r--arch/s390/include/asm/pci_insn.h15
-rw-r--r--arch/s390/pci/pci.c46
2 files changed, 21 insertions, 40 deletions
diff --git a/arch/s390/include/asm/pci_insn.h b/arch/s390/include/asm/pci_insn.h
index df6eac9f0cb4..649eb62c52b3 100644
--- a/arch/s390/include/asm/pci_insn.h
+++ b/arch/s390/include/asm/pci_insn.h
@@ -54,11 +54,9 @@
54struct zpci_fib { 54struct zpci_fib {
55 u32 fmt : 8; /* format */ 55 u32 fmt : 8; /* format */
56 u32 : 24; 56 u32 : 24;
57 u32 reserved1; 57 u32 : 32;
58 u8 fc; /* function controls */ 58 u8 fc; /* function controls */
59 u8 reserved2; 59 u64 : 56;
60 u16 reserved3;
61 u32 reserved4;
62 u64 pba; /* PCI base address */ 60 u64 pba; /* PCI base address */
63 u64 pal; /* PCI address limit */ 61 u64 pal; /* PCI address limit */
64 u64 iota; /* I/O Translation Anchor */ 62 u64 iota; /* I/O Translation Anchor */
@@ -70,14 +68,13 @@ struct zpci_fib {
70 u32 sum : 1; /* Adapter int summary bit enabled */ 68 u32 sum : 1; /* Adapter int summary bit enabled */
71 u32 : 1; 69 u32 : 1;
72 u32 aisbo : 6; /* Adapter int summary bit offset */ 70 u32 aisbo : 6; /* Adapter int summary bit offset */
73 u32 reserved5; 71 u32 : 32;
74 u64 aibv; /* Adapter int bit vector address */ 72 u64 aibv; /* Adapter int bit vector address */
75 u64 aisb; /* Adapter int summary bit address */ 73 u64 aisb; /* Adapter int summary bit address */
76 u64 fmb_addr; /* Function measurement block address and key */ 74 u64 fmb_addr; /* Function measurement block address and key */
77 u64 reserved6; 75 u32 : 32;
78 u64 reserved7; 76 u32 gd;
79} __packed; 77} __packed __aligned(8);
80
81 78
82int zpci_mod_fc(u64 req, struct zpci_fib *fib); 79int zpci_mod_fc(u64 req, struct zpci_fib *fib);
83int zpci_refresh_trans(u64 fn, u64 addr, u64 range); 80int zpci_refresh_trans(u64 fn, u64 addr, u64 range);
diff --git a/arch/s390/pci/pci.c b/arch/s390/pci/pci.c
index fd6d6ce79439..0c9a17780e4b 100644
--- a/arch/s390/pci/pci.c
+++ b/arch/s390/pci/pci.c
@@ -120,25 +120,17 @@ EXPORT_SYMBOL_GPL(pci_proc_domain);
120static int zpci_set_airq(struct zpci_dev *zdev) 120static int zpci_set_airq(struct zpci_dev *zdev)
121{ 121{
122 u64 req = ZPCI_CREATE_REQ(zdev->fh, 0, ZPCI_MOD_FC_REG_INT); 122 u64 req = ZPCI_CREATE_REQ(zdev->fh, 0, ZPCI_MOD_FC_REG_INT);
123 struct zpci_fib *fib; 123 struct zpci_fib fib = {0};
124 int rc;
125
126 fib = (void *) get_zeroed_page(GFP_KERNEL);
127 if (!fib)
128 return -ENOMEM;
129 124
130 fib->isc = PCI_ISC; 125 fib.isc = PCI_ISC;
131 fib->sum = 1; /* enable summary notifications */ 126 fib.sum = 1; /* enable summary notifications */
132 fib->noi = airq_iv_end(zdev->aibv); 127 fib.noi = airq_iv_end(zdev->aibv);
133 fib->aibv = (unsigned long) zdev->aibv->vector; 128 fib.aibv = (unsigned long) zdev->aibv->vector;
134 fib->aibvo = 0; /* each zdev has its own interrupt vector */ 129 fib.aibvo = 0; /* each zdev has its own interrupt vector */
135 fib->aisb = (unsigned long) zpci_aisb_iv->vector + (zdev->aisb/64)*8; 130 fib.aisb = (unsigned long) zpci_aisb_iv->vector + (zdev->aisb/64)*8;
136 fib->aisbo = zdev->aisb & 63; 131 fib.aisbo = zdev->aisb & 63;
137 132
138 rc = zpci_mod_fc(req, fib); 133 return zpci_mod_fc(req, &fib);
139
140 free_page((unsigned long) fib);
141 return rc;
142} 134}
143 135
144struct mod_pci_args { 136struct mod_pci_args {
@@ -151,22 +143,14 @@ struct mod_pci_args {
151static int mod_pci(struct zpci_dev *zdev, int fn, u8 dmaas, struct mod_pci_args *args) 143static int mod_pci(struct zpci_dev *zdev, int fn, u8 dmaas, struct mod_pci_args *args)
152{ 144{
153 u64 req = ZPCI_CREATE_REQ(zdev->fh, dmaas, fn); 145 u64 req = ZPCI_CREATE_REQ(zdev->fh, dmaas, fn);
154 struct zpci_fib *fib; 146 struct zpci_fib fib = {0};
155 int rc;
156
157 /* The FIB must be available even if it's not used */
158 fib = (void *) get_zeroed_page(GFP_KERNEL);
159 if (!fib)
160 return -ENOMEM;
161 147
162 fib->pba = args->base; 148 fib.pba = args->base;
163 fib->pal = args->limit; 149 fib.pal = args->limit;
164 fib->iota = args->iota; 150 fib.iota = args->iota;
165 fib->fmb_addr = args->fmb_addr; 151 fib.fmb_addr = args->fmb_addr;
166 152
167 rc = zpci_mod_fc(req, fib); 153 return zpci_mod_fc(req, &fib);
168 free_page((unsigned long) fib);
169 return rc;
170} 154}
171 155
172/* Modify PCI: Register I/O address translation parameters */ 156/* Modify PCI: Register I/O address translation parameters */