* [PATCH v2 0/2] s390/vfio-ccw: addressing fixes
@ 2022-11-21 16:58 Eric Farman
2022-11-21 16:58 ` [PATCH v2 1/2] vfio/ccw: sort out physical vs virtual pointers usage Eric Farman
2022-11-21 16:58 ` [PATCH v2 2/2] vfio/ccw: identify CCW data addresses as physical Eric Farman
0 siblings, 2 replies; 3+ messages in thread
From: Eric Farman @ 2022-11-21 16:58 UTC (permalink / raw)
To: Vineeth Vijayan, Peter Oberparleiter, Heiko Carstens,
Vasily Gorbik, Alexander Gordeev
Cc: Matthew Rosato, Halil Pasic, Christian Borntraeger, Sven Schnelle,
linux-s390, kvm, Eric Farman
Hi everyone,
Here's the update to the couple small addressing fixes
created/used by vfio-ccw, which are shared with hardware,
which I'd sent a week or two ago.
One thing left un-done is a broader rework of the cp_get_orb()
interface that Matthew suggested [1]. I intend to address that
with a larger series that reworks the whole channel program
path in the not-too-distant future; doing it here expands the
otherwise tidy scope of these commits more than I'd like.
[1] https://lore.kernel.org/linux-s390/c9e7229e-a88d-2185-bb6b-a94e9dac7b7a@linux.ibm.com/
v1->v2:
- [MR, NB] Patch 1: Update commit message per suggestions
- [MR, NB] Add reviewed-by tags (thank you!)
v1: https://lore.kernel.org/linux-s390/20221109202157.1050545-1-farman@linux.ibm.com/
Alexander Gordeev (1):
vfio/ccw: sort out physical vs virtual pointers usage
Eric Farman (1):
vfio/ccw: identify CCW data addresses as physical
drivers/s390/cio/vfio_ccw_cp.c | 4 ++--
drivers/s390/cio/vfio_ccw_fsm.c | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
--
2.34.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH v2 1/2] vfio/ccw: sort out physical vs virtual pointers usage
2022-11-21 16:58 [PATCH v2 0/2] s390/vfio-ccw: addressing fixes Eric Farman
@ 2022-11-21 16:58 ` Eric Farman
2022-11-21 16:58 ` [PATCH v2 2/2] vfio/ccw: identify CCW data addresses as physical Eric Farman
1 sibling, 0 replies; 3+ messages in thread
From: Eric Farman @ 2022-11-21 16:58 UTC (permalink / raw)
To: Vineeth Vijayan, Peter Oberparleiter, Heiko Carstens,
Vasily Gorbik, Alexander Gordeev
Cc: Matthew Rosato, Halil Pasic, Christian Borntraeger, Sven Schnelle,
linux-s390, kvm, Eric Farman, Nico Boehr
From: Alexander Gordeev <agordeev@linux.ibm.com>
The ORB's interrupt parameter field is stored unmodified into the
interruption code when an I/O interrupt occurs. As this reflects
a real device, let's store the physical address of the subchannel
struct so it can be used when processing an interrupt.
Note: this currently doesn't fix a real bug, since virtual
addresses are identical to physical ones.
Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
[EF: Updated commit message]
Signed-off-by: Eric Farman <farman@linux.ibm.com>
Reviewed-by: Matthew Rosato <mjrosato@linux.ibm.com>
Reviewed-by: Nico Boehr <nrb@linux.ibm.com>
---
drivers/s390/cio/vfio_ccw_fsm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/s390/cio/vfio_ccw_fsm.c b/drivers/s390/cio/vfio_ccw_fsm.c
index a59c758869f8..0a5e8b4a6743 100644
--- a/drivers/s390/cio/vfio_ccw_fsm.c
+++ b/drivers/s390/cio/vfio_ccw_fsm.c
@@ -29,7 +29,7 @@ static int fsm_io_helper(struct vfio_ccw_private *private)
spin_lock_irqsave(sch->lock, flags);
- orb = cp_get_orb(&private->cp, (u32)(addr_t)sch, sch->lpm);
+ orb = cp_get_orb(&private->cp, (u32)virt_to_phys(sch), sch->lpm);
if (!orb) {
ret = -EIO;
goto out;
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH v2 2/2] vfio/ccw: identify CCW data addresses as physical
2022-11-21 16:58 [PATCH v2 0/2] s390/vfio-ccw: addressing fixes Eric Farman
2022-11-21 16:58 ` [PATCH v2 1/2] vfio/ccw: sort out physical vs virtual pointers usage Eric Farman
@ 2022-11-21 16:58 ` Eric Farman
1 sibling, 0 replies; 3+ messages in thread
From: Eric Farman @ 2022-11-21 16:58 UTC (permalink / raw)
To: Vineeth Vijayan, Peter Oberparleiter, Heiko Carstens,
Vasily Gorbik, Alexander Gordeev
Cc: Matthew Rosato, Halil Pasic, Christian Borntraeger, Sven Schnelle,
linux-s390, kvm, Eric Farman, Nico Boehr
The CCW data address created by vfio-ccw is that of an IDAL
built by this code. Since this address is used by real hardware,
it should be a physical address rather than a virtual one.
Let's clarify it as such in the ORB.
Similarly, once the I/O has completed the memory for that IDAL
needs to be released, so convert the CCW data address back to
a virtual address so that kfree() can process it.
Note: this currently doesn't fix a real bug, since virtual
addresses are identical to physical ones.
Signed-off-by: Eric Farman <farman@linux.ibm.com>
Reviewed-by: Matthew Rosato <mjrosato@linux.ibm.com>
Reviewed-by: Nico Boehr <nrb@linux.ibm.com>
---
drivers/s390/cio/vfio_ccw_cp.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/s390/cio/vfio_ccw_cp.c b/drivers/s390/cio/vfio_ccw_cp.c
index 7b02e97f4b29..c0a09fa8991a 100644
--- a/drivers/s390/cio/vfio_ccw_cp.c
+++ b/drivers/s390/cio/vfio_ccw_cp.c
@@ -394,7 +394,7 @@ static void ccwchain_cda_free(struct ccwchain *chain, int idx)
if (ccw_is_tic(ccw))
return;
- kfree((void *)(u64)ccw->cda);
+ kfree(phys_to_virt(ccw->cda));
}
/**
@@ -845,7 +845,7 @@ union orb *cp_get_orb(struct channel_program *cp, u32 intparm, u8 lpm)
chain = list_first_entry(&cp->ccwchain_list, struct ccwchain, next);
cpa = chain->ch_ccw;
- orb->cmd.cpa = (__u32) __pa(cpa);
+ orb->cmd.cpa = (__u32)virt_to_phys(cpa);
return orb;
}
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-11-21 16:58 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-21 16:58 [PATCH v2 0/2] s390/vfio-ccw: addressing fixes Eric Farman
2022-11-21 16:58 ` [PATCH v2 1/2] vfio/ccw: sort out physical vs virtual pointers usage Eric Farman
2022-11-21 16:58 ` [PATCH v2 2/2] vfio/ccw: identify CCW data addresses as physical Eric Farman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox