All of lore.kernel.org
 help / color / mirror / Atom feed
From: Heiko Carstens <hca@linux.ibm.com>
To: Eric Farman <farman@linux.ibm.com>
Cc: Matthew Rosato <mjrosato@linux.ibm.com>,
	Halil Pasic <pasic@linux.ibm.com>,
	Vineeth Vijayan <vneethv@linux.ibm.com>,
	Peter Oberparleiter <oberpar@linux.ibm.com>,
	Vasily Gorbik <gor@linux.ibm.com>,
	Alexander Gordeev <agordeev@linux.ibm.com>,
	linux-s390@vger.kernel.org, kvm@vger.kernel.org
Subject: Re: [PATCH] s390/vfio_ccw: Fix target addresses of TIC CCWs
Date: Fri, 28 Jun 2024 15:40:08 +0200	[thread overview]
Message-ID: <20240628134008.14360-G-hca@linux.ibm.com> (raw)
In-Reply-To: <0f7db180c7f3ece66685c50df7ef38ab81cac03b.camel@linux.ibm.com>

On Fri, Jun 28, 2024 at 09:31:56AM -0400, Eric Farman wrote:
> > > dma32_to_u32(ccw->cda) - ccw_head;
> > > -			ccw->cda = u32_to_dma32(cda);
> > > +			/* Calculate offset of TIC target */
> > > +			cda = dma32_to_u32(ccw->cda) - ccw_head;
> > > +			ccw->cda = virt_to_dma32(iter->ch_ccw) +
> > > cda;
> > 
> > I would suggest to rename cda to "offset", since that reflects what
> > it is
> > now. Also this code needs to take care of type checking, which will
> > fail now
> > due to dma32_t type (try "make C=1 drivers/s390/cio/vfio_ccw_cp.o).

...

> I was poking at that code yesterday because it seemed suspect, but as I
> wasn't getting an explicit failure (versus the CPC generated by hw), I
> opted to leave it for now. I agree they should both be fixed up.

...

> > I guess
> > you could add this hunk to your patch:
> > 
> > @@ -915,7 +915,7 @@ void cp_update_scsw(struct channel_program *cp,
> > union scsw *scsw)
> >  	 * in the ioctl directly. Path status changes etc.
> >  	 */
> >  	list_for_each_entry(chain, &cp->ccwchain_list, next) {
> > -		ccw_head = (u32)(u64)chain->ch_ccw;
> > +		ccw_head = (__force u32)virt_to_dma32(chain-
> > >ch_ccw);
> >  		/*
> >  		 * On successful execution, cpa points just beyond
> > the end
> >  		 * of the chain.

...

> > Furthermore it looks to me like the ch_iova member of struct ccwchain
> > should
> > get a dma32_t type instead of u64. The same applies to quite a few
> > variables
> > to the code. 
> 
> Agreed. I started this some time back after the IDAW code got reworked,
> but have been sidetracked. The problem with ch_iova is more apparent
> after the dma32 stuff.
> 
> > I could give this a try, but I think it would be better if
> > somebody who knows what he is doing would address this :)
> 
> I'll finish them up. But v2 will have to wait until after my holiday.
> Thanks for reminding me of the typechecking!

I hope you didn't get me wrong: from my point of view we want one or
two small patches (the above hunks), which fix the bugs, if you
agree.

And then address the type checking stuff at a later point in time.

(btw: your mailer adds lot's of extra line wraps)

  reply	other threads:[~2024-06-28 13:40 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-27 20:07 [PATCH] s390/vfio_ccw: Fix target addresses of TIC CCWs Eric Farman
2024-06-28 12:17 ` Heiko Carstens
2024-06-28 13:31   ` Eric Farman
2024-06-28 13:40     ` Heiko Carstens [this message]
2024-06-28 14:01       ` Eric Farman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240628134008.14360-G-hca@linux.ibm.com \
    --to=hca@linux.ibm.com \
    --cc=agordeev@linux.ibm.com \
    --cc=farman@linux.ibm.com \
    --cc=gor@linux.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=mjrosato@linux.ibm.com \
    --cc=oberpar@linux.ibm.com \
    --cc=pasic@linux.ibm.com \
    --cc=vneethv@linux.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.