Commit c68468ed authored by Matthew Rosato's avatar Matthew Rosato Committed by Christian Borntraeger

s390/pci: stash associated GISA designation

For passthrough devices, we will need to know the GISA designation of the
guest if interpretation facilities are to be used.  Setup to stash this in
the zdev and set a default of 0 (no GISA designation) for now; a subsequent
patch will set a valid GISA designation for passthrough devices.
Also, extend mpcific routines to specify this stashed designation as part
of the mpcific command.
Reviewed-by: default avatarPierre Morel <pmorel@linux.ibm.com>
Reviewed-by: default avatarNiklas Schnelle <schnelle@linux.ibm.com>
Reviewed-by: default avatarChristian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: default avatarMatthew Rosato <mjrosato@linux.ibm.com>
Link: https://lore.kernel.org/r/20220606203325.110625-9-mjrosato@linux.ibm.comSigned-off-by: default avatarChristian Borntraeger <borntraeger@linux.ibm.com>
parent 062f0024
...@@ -123,6 +123,7 @@ struct zpci_dev { ...@@ -123,6 +123,7 @@ struct zpci_dev {
enum zpci_state state; enum zpci_state state;
u32 fid; /* function ID, used by sclp */ u32 fid; /* function ID, used by sclp */
u32 fh; /* function handle, used by insn's */ u32 fh; /* function handle, used by insn's */
u32 gisa; /* GISA designation for passthrough */
u16 vfn; /* virtual function number */ u16 vfn; /* virtual function number */
u16 pchid; /* physical channel ID */ u16 pchid; /* physical channel ID */
u8 pfgid; /* function group ID */ u8 pfgid; /* function group ID */
......
...@@ -173,7 +173,8 @@ struct clp_req_set_pci { ...@@ -173,7 +173,8 @@ struct clp_req_set_pci {
u16 reserved2; u16 reserved2;
u8 oc; /* operation controls */ u8 oc; /* operation controls */
u8 ndas; /* number of dma spaces */ u8 ndas; /* number of dma spaces */
u64 reserved3; u32 reserved3;
u32 gisa; /* GISA designation */
} __packed; } __packed;
/* Set PCI function response */ /* Set PCI function response */
......
...@@ -120,6 +120,7 @@ int zpci_register_ioat(struct zpci_dev *zdev, u8 dmaas, ...@@ -120,6 +120,7 @@ int zpci_register_ioat(struct zpci_dev *zdev, u8 dmaas,
fib.pba = base; fib.pba = base;
fib.pal = limit; fib.pal = limit;
fib.iota = iota | ZPCI_IOTA_RTTO_FLAG; fib.iota = iota | ZPCI_IOTA_RTTO_FLAG;
fib.gd = zdev->gisa;
cc = zpci_mod_fc(req, &fib, &status); cc = zpci_mod_fc(req, &fib, &status);
if (cc) if (cc)
zpci_dbg(3, "reg ioat fid:%x, cc:%d, status:%d\n", zdev->fid, cc, status); zpci_dbg(3, "reg ioat fid:%x, cc:%d, status:%d\n", zdev->fid, cc, status);
...@@ -133,6 +134,8 @@ int zpci_unregister_ioat(struct zpci_dev *zdev, u8 dmaas) ...@@ -133,6 +134,8 @@ int zpci_unregister_ioat(struct zpci_dev *zdev, u8 dmaas)
struct zpci_fib fib = {0}; struct zpci_fib fib = {0};
u8 cc, status; u8 cc, status;
fib.gd = zdev->gisa;
cc = zpci_mod_fc(req, &fib, &status); cc = zpci_mod_fc(req, &fib, &status);
if (cc) if (cc)
zpci_dbg(3, "unreg ioat fid:%x, cc:%d, status:%d\n", zdev->fid, cc, status); zpci_dbg(3, "unreg ioat fid:%x, cc:%d, status:%d\n", zdev->fid, cc, status);
...@@ -160,6 +163,7 @@ int zpci_fmb_enable_device(struct zpci_dev *zdev) ...@@ -160,6 +163,7 @@ int zpci_fmb_enable_device(struct zpci_dev *zdev)
atomic64_set(&zdev->unmapped_pages, 0); atomic64_set(&zdev->unmapped_pages, 0);
fib.fmb_addr = virt_to_phys(zdev->fmb); fib.fmb_addr = virt_to_phys(zdev->fmb);
fib.gd = zdev->gisa;
cc = zpci_mod_fc(req, &fib, &status); cc = zpci_mod_fc(req, &fib, &status);
if (cc) { if (cc) {
kmem_cache_free(zdev_fmb_cache, zdev->fmb); kmem_cache_free(zdev_fmb_cache, zdev->fmb);
...@@ -178,6 +182,8 @@ int zpci_fmb_disable_device(struct zpci_dev *zdev) ...@@ -178,6 +182,8 @@ int zpci_fmb_disable_device(struct zpci_dev *zdev)
if (!zdev->fmb) if (!zdev->fmb)
return -EINVAL; return -EINVAL;
fib.gd = zdev->gisa;
/* Function measurement is disabled if fmb address is zero */ /* Function measurement is disabled if fmb address is zero */
cc = zpci_mod_fc(req, &fib, &status); cc = zpci_mod_fc(req, &fib, &status);
if (cc == 3) /* Function already gone. */ if (cc == 3) /* Function already gone. */
......
...@@ -229,12 +229,16 @@ static int clp_set_pci_fn(struct zpci_dev *zdev, u32 *fh, u8 nr_dma_as, u8 comma ...@@ -229,12 +229,16 @@ static int clp_set_pci_fn(struct zpci_dev *zdev, u32 *fh, u8 nr_dma_as, u8 comma
{ {
struct clp_req_rsp_set_pci *rrb; struct clp_req_rsp_set_pci *rrb;
int rc, retries = 100; int rc, retries = 100;
u32 gisa = 0;
*fh = 0; *fh = 0;
rrb = clp_alloc_block(GFP_KERNEL); rrb = clp_alloc_block(GFP_KERNEL);
if (!rrb) if (!rrb)
return -ENOMEM; return -ENOMEM;
if (command != CLP_SET_DISABLE_PCI_FN)
gisa = zdev->gisa;
do { do {
memset(rrb, 0, sizeof(*rrb)); memset(rrb, 0, sizeof(*rrb));
rrb->request.hdr.len = sizeof(rrb->request); rrb->request.hdr.len = sizeof(rrb->request);
...@@ -243,6 +247,7 @@ static int clp_set_pci_fn(struct zpci_dev *zdev, u32 *fh, u8 nr_dma_as, u8 comma ...@@ -243,6 +247,7 @@ static int clp_set_pci_fn(struct zpci_dev *zdev, u32 *fh, u8 nr_dma_as, u8 comma
rrb->request.fh = zdev->fh; rrb->request.fh = zdev->fh;
rrb->request.oc = command; rrb->request.oc = command;
rrb->request.ndas = nr_dma_as; rrb->request.ndas = nr_dma_as;
rrb->request.gisa = gisa;
rc = clp_req(rrb, CLP_LPS_PCI); rc = clp_req(rrb, CLP_LPS_PCI);
if (rrb->response.hdr.rsp == CLP_RC_SETPCIFN_BUSY) { if (rrb->response.hdr.rsp == CLP_RC_SETPCIFN_BUSY) {
......
...@@ -43,6 +43,7 @@ static int zpci_set_airq(struct zpci_dev *zdev) ...@@ -43,6 +43,7 @@ static int zpci_set_airq(struct zpci_dev *zdev)
fib.fmt0.aibvo = 0; /* each zdev has its own interrupt vector */ fib.fmt0.aibvo = 0; /* each zdev has its own interrupt vector */
fib.fmt0.aisb = virt_to_phys(zpci_sbv->vector) + (zdev->aisb / 64) * 8; fib.fmt0.aisb = virt_to_phys(zpci_sbv->vector) + (zdev->aisb / 64) * 8;
fib.fmt0.aisbo = zdev->aisb & 63; fib.fmt0.aisbo = zdev->aisb & 63;
fib.gd = zdev->gisa;
return zpci_mod_fc(req, &fib, &status) ? -EIO : 0; return zpci_mod_fc(req, &fib, &status) ? -EIO : 0;
} }
...@@ -54,6 +55,8 @@ static int zpci_clear_airq(struct zpci_dev *zdev) ...@@ -54,6 +55,8 @@ static int zpci_clear_airq(struct zpci_dev *zdev)
struct zpci_fib fib = {0}; struct zpci_fib fib = {0};
u8 cc, status; u8 cc, status;
fib.gd = zdev->gisa;
cc = zpci_mod_fc(req, &fib, &status); cc = zpci_mod_fc(req, &fib, &status);
if (cc == 3 || (cc == 1 && status == 24)) if (cc == 3 || (cc == 1 && status == 24))
/* Function already gone or IRQs already deregistered. */ /* Function already gone or IRQs already deregistered. */
...@@ -72,6 +75,7 @@ static int zpci_set_directed_irq(struct zpci_dev *zdev) ...@@ -72,6 +75,7 @@ static int zpci_set_directed_irq(struct zpci_dev *zdev)
fib.fmt = 1; fib.fmt = 1;
fib.fmt1.noi = zdev->msi_nr_irqs; fib.fmt1.noi = zdev->msi_nr_irqs;
fib.fmt1.dibvo = zdev->msi_first_bit; fib.fmt1.dibvo = zdev->msi_first_bit;
fib.gd = zdev->gisa;
return zpci_mod_fc(req, &fib, &status) ? -EIO : 0; return zpci_mod_fc(req, &fib, &status) ? -EIO : 0;
} }
...@@ -84,6 +88,7 @@ static int zpci_clear_directed_irq(struct zpci_dev *zdev) ...@@ -84,6 +88,7 @@ static int zpci_clear_directed_irq(struct zpci_dev *zdev)
u8 cc, status; u8 cc, status;
fib.fmt = 1; fib.fmt = 1;
fib.gd = zdev->gisa;
cc = zpci_mod_fc(req, &fib, &status); cc = zpci_mod_fc(req, &fib, &status);
if (cc == 3 || (cc == 1 && status == 24)) if (cc == 3 || (cc == 1 && status == 24))
/* Function already gone or IRQs already deregistered. */ /* Function already gone or IRQs already deregistered. */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment