All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: BALATON Zoltan <balaton@eik.bme.hu>
Cc: qemu-block@nongnu.org, philmd@redhat.com,
	Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>,
	qemu-devel@nongnu.org,
	Aleksandar Markovic <amarkovic@wavecomp.com>,
	John Snow <jsnow@redhat.com>,
	Artyom Tarasenko <atar4qemu@gmail.com>,
	Richard Henderson <rth@twiddle.net>
Subject: Re: [PATCH v3 2/3] pci: Honour wmask when resetting PCI_INTERRUPT_LINE
Date: Mon, 9 Mar 2020 23:36:19 -0400	[thread overview]
Message-ID: <20200309233242-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <alpine.BSF.2.22.395.2003092151340.94024@zero.eik.bme.hu>

On Mon, Mar 09, 2020 at 09:54:27PM +0100, BALATON Zoltan wrote:
> On Mon, 9 Mar 2020, Michael S. Tsirkin wrote:
> > On Mon, Mar 09, 2020 at 08:18:13PM +0100, BALATON Zoltan wrote:
> > > The pci_do_device_reset() function (called from pci_device_reset)
> > > clears the PCI_INTERRUPT_LINE config reg of devices on the bus but did
> > > this without taking wmask into account. We'll have a device model now
> > > that needs to set a constant value for this reg and this patch allows
> > > to do that without additional workaround in device emulation to
> > > reverse the effect of this PCI bus reset function.
> > > 
> > > Suggested-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
> > > Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
> > > ---
> > >  hw/pci/pci.c | 4 +++-
> > >  1 file changed, 3 insertions(+), 1 deletion(-)
> > > 
> > > diff --git a/hw/pci/pci.c b/hw/pci/pci.c
> > > index e1ed6677e1..d07e4ed9de 100644
> > > --- a/hw/pci/pci.c
> > > +++ b/hw/pci/pci.c
> > > @@ -302,8 +302,10 @@ static void pci_do_device_reset(PCIDevice *dev)
> > >      pci_word_test_and_clear_mask(dev->config + PCI_STATUS,
> > >                                   pci_get_word(dev->wmask + PCI_STATUS) |
> > >                                   pci_get_word(dev->w1cmask + PCI_STATUS));
> > > +    pci_word_test_and_clear_mask(dev->config + PCI_INTERRUPT_LINE,
> > > +                              pci_get_word(dev->wmask + PCI_INTERRUPT_LINE) |
> > > +                              pci_get_word(dev->w1cmask + PCI_INTERRUPT_LINE));
> > 
> > PCI spec says:
> > 
> > Interrupt Line
> > The Interrupt Line register is an eight-bit register used to communicate interrupt line routing
> > information.
> > 
> > I don't see how it makes sense to access it as a word.
> 
> Patch actually comes from Mark, I don't know. Should we change it to
> pci_byte_test_and_clear_mask or what's the appropriate way here?

Superficially that makes sense. I don't know if that does what
you want to do.


> > 
> > >      dev->config[PCI_CACHE_LINE_SIZE] = 0x0;
> > > -    dev->config[PCI_INTERRUPT_LINE] = 0x0;
> > >      for (r = 0; r < PCI_NUM_REGIONS; ++r) {
> > >          PCIIORegion *region = &dev->io_regions[r];
> > >          if (!region->size) {
> > 
> > Please add comments here explaining that some devices
> > make PCI_INTERRUPT_LINE read-only.
> 
> Something like the commit message would be appropriate?

Code comments are more appropriate when we want to describe why code is
the way it is. commit message is there to describe the change, answering
questions like: why we aren't happy with the old code? why is the new
code is better? etc ...

> Regards,
> BALATON Zoltan



  reply	other threads:[~2020-03-10  3:37 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-09 19:18 [PATCH v3 0/3] Implement "non 100% native mode" in via-ide BALATON Zoltan
2020-03-09 19:18 ` [PATCH v3 2/3] pci: Honour wmask when resetting PCI_INTERRUPT_LINE BALATON Zoltan
2020-03-09 20:39   ` Michael S. Tsirkin
2020-03-09 20:54     ` BALATON Zoltan
2020-03-10  3:36       ` Michael S. Tsirkin [this message]
2020-03-10 18:15       ` Mark Cave-Ayland
2020-03-10 18:20         ` BALATON Zoltan
2020-03-09 19:18 ` [PATCH v3 1/3] ide: Make room for flags in PCIIDEState and add one for legacy IRQ routing BALATON Zoltan
2020-03-09 19:18 ` [PATCH v3 3/3] via-ide: Also emulate non 100% native mode BALATON Zoltan
2020-03-09 20:36   ` Michael S. Tsirkin
2020-03-09 20:50     ` BALATON Zoltan
2020-03-09 21:06       ` BALATON Zoltan
2020-03-10  3:32       ` Michael S. Tsirkin
2020-03-09 21:16 ` [PATCH v3 0/3] Implement "non 100% native mode" in via-ide no-reply
2020-03-10 18:31 ` Mark Cave-Ayland
2020-03-10 18:36   ` BALATON Zoltan

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=20200309233242-mutt-send-email-mst@kernel.org \
    --to=mst@redhat.com \
    --cc=amarkovic@wavecomp.com \
    --cc=atar4qemu@gmail.com \
    --cc=balaton@eik.bme.hu \
    --cc=jsnow@redhat.com \
    --cc=mark.cave-ayland@ilande.co.uk \
    --cc=philmd@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    /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.