s390/vfio-ccw: addressing fixes
Subsystems (4)
Eric Farman
maintainerv2 cover s390/vfio-ccw: addressing fixes
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/[email protected]/
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/[email protected]/
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(-)
Signature · 1 line
2.34.1
Eric Farman
maintainerPATCH v2 1/2 vfio/ccw: sort out physical vs virtual pointers usage
From: Alexander Gordeev <[email protected]>
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.
--- drivers/s390/cio/vfio_ccw_fsm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/s390/cio/vfio_ccw_fsm.c +1 -1
@@ -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;
Signature · 1 line
2.34.1
Eric Farman
maintainerPATCH v2 2/2 vfio/ccw: identify CCW data addresses as physical
In reply to Eric FarmanThe 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.
--- drivers/s390/cio/vfio_ccw_cp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/s390/cio/vfio_ccw_cp.c +2 -2
@@ -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; }
Signature · 1 line
2.34.1