Commit 9fbed59f authored by Eric Farman's avatar Eric Farman Committed by Heiko Carstens
Browse files

vfio/ccw: simplify the cp_get_orb interface



There's no need to send in both the address of the subchannel
struct, and an element within it, to populate the ORB.

Pass the whole pointer and let cp_get_orb() take the pieces
that are needed.

Suggested-by: default avatarMatthew Rosato <mjrosato@linux.ibm.com>
Signed-off-by: default avatarEric Farman <farman@linux.ibm.com>
Reviewed-by: default avatarMatthew Rosato <mjrosato@linux.ibm.com>
Signed-off-by: default avatarHeiko Carstens <hca@linux.ibm.com>
parent 8a54e238
Loading
Loading
Loading
Loading
+4 −5
Original line number Original line Diff line number Diff line
@@ -816,14 +816,13 @@ int cp_prefetch(struct channel_program *cp)
/**
/**
 * cp_get_orb() - get the orb of the channel program
 * cp_get_orb() - get the orb of the channel program
 * @cp: channel_program on which to perform the operation
 * @cp: channel_program on which to perform the operation
 * @intparm: new intparm for the returned orb
 * @sch: subchannel the operation will be performed against
 * @lpm: candidate value of the logical-path mask for the returned orb
 *
 *
 * This function returns the address of the updated orb of the channel
 * This function returns the address of the updated orb of the channel
 * program. Channel I/O device drivers could use this orb to issue a
 * program. Channel I/O device drivers could use this orb to issue a
 * ssch.
 * ssch.
 */
 */
union orb *cp_get_orb(struct channel_program *cp, u32 intparm, u8 lpm)
union orb *cp_get_orb(struct channel_program *cp, struct subchannel *sch)
{
{
	union orb *orb;
	union orb *orb;
	struct ccwchain *chain;
	struct ccwchain *chain;
@@ -835,12 +834,12 @@ union orb *cp_get_orb(struct channel_program *cp, u32 intparm, u8 lpm)


	orb = &cp->orb;
	orb = &cp->orb;


	orb->cmd.intparm = intparm;
	orb->cmd.intparm = (u32)virt_to_phys(sch);
	orb->cmd.fmt = 1;
	orb->cmd.fmt = 1;
	orb->cmd.key = PAGE_DEFAULT_KEY >> 4;
	orb->cmd.key = PAGE_DEFAULT_KEY >> 4;


	if (orb->cmd.lpm == 0)
	if (orb->cmd.lpm == 0)
		orb->cmd.lpm = lpm;
		orb->cmd.lpm = sch->lpm;


	chain = list_first_entry(&cp->ccwchain_list, struct ccwchain, next);
	chain = list_first_entry(&cp->ccwchain_list, struct ccwchain, next);
	cpa = chain->ch_ccw;
	cpa = chain->ch_ccw;
+1 −1
Original line number Original line Diff line number Diff line
@@ -43,7 +43,7 @@ struct channel_program {
int cp_init(struct channel_program *cp, union orb *orb);
int cp_init(struct channel_program *cp, union orb *orb);
void cp_free(struct channel_program *cp);
void cp_free(struct channel_program *cp);
int cp_prefetch(struct channel_program *cp);
int cp_prefetch(struct channel_program *cp);
union orb *cp_get_orb(struct channel_program *cp, u32 intparm, u8 lpm);
union orb *cp_get_orb(struct channel_program *cp, struct subchannel *sch);
void cp_update_scsw(struct channel_program *cp, union scsw *scsw);
void cp_update_scsw(struct channel_program *cp, union scsw *scsw);
bool cp_iova_pinned(struct channel_program *cp, u64 iova, u64 length);
bool cp_iova_pinned(struct channel_program *cp, u64 iova, u64 length);


+1 −1
Original line number Original line Diff line number Diff line
@@ -27,7 +27,7 @@ static int fsm_io_helper(struct vfio_ccw_private *private)


	spin_lock_irqsave(sch->lock, flags);
	spin_lock_irqsave(sch->lock, flags);


	orb = cp_get_orb(&private->cp, (u32)virt_to_phys(sch), sch->lpm);
	orb = cp_get_orb(&private->cp, sch);
	if (!orb) {
	if (!orb) {
		ret = -EIO;
		ret = -EIO;
		goto out;
		goto out;