All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Jan Kiszka <jan.kiszka@siemens.com>
Cc: Alex Williamson <alex.williamson@redhat.com>,
	qemu-devel <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH] pci: Error on PCI capability collisions
Date: Wed, 24 Aug 2011 15:39:29 +0300	[thread overview]
Message-ID: <20110824123929.GB18717@redhat.com> (raw)
In-Reply-To: <4E54F04F.2040800@siemens.com>

On Wed, Aug 24, 2011 at 02:36:31PM +0200, Jan Kiszka wrote:
> On 2011-08-24 14:34, Michael S. Tsirkin wrote:
> > On Wed, Aug 24, 2011 at 02:29:36PM +0200, Jan Kiszka wrote:
> >> On 2011-08-24 13:58, Michael S. Tsirkin wrote:
> >>> On Wed, Aug 24, 2011 at 12:10:32PM +0200, Jan Kiszka wrote:
> >>>> On 2011-08-24 12:04, Michael S. Tsirkin wrote:
> >>>>> On Tue, Aug 23, 2011 at 07:28:08PM +0200, Jan Kiszka wrote:
> >>>>>> From: Alex Williamson <alex.williamson@redhat.com>
> >>>>>>
> >>>>>> Nothing good can happen when we overlap capabilities
> >>>>>>
> >>>>>> [ Jan: rebased over qemu, minor formatting ]
> >>>>>>
> >>>>>> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
> >>>>>
> >>>>> This doesn't build for me:
> >>>>>
> >>>>> /scm/qemu/hw/pci.c: In function ‘pci_add_capability’:
> >>>>> /scm/qemu/hw/pci.c:1970:45: error: ‘PCIDevice’ has no member named ‘config_map’
> >>>>
> >>>> Yeah, sorry, forgot to refresh the commit before posting.
> >>>>
> >>>>>
> >>>>> I think that what that includes is the capability including each given
> >>>>> offset, right?  It would be easy to write some code scanning the
> >>>>> capability list to figure this value out.
> >>>>> Something along the lines of (untested):
> >>>>>
> >>>>> static
> >>>>> uint8_t pci_find_capability_at_offset(PCIDevice *pdev, uint8_t offset)
> >>>>> {                                       
> >>>>>     uint8_t next, prev, found = 0;
> >>>>>
> >>>>>     if (!(pdev->config[PCI_STATUS] & PCI_STATUS_CAP_LIST))
> >>>>>         return 0;
> >>>>>
> >>>>>     for (prev = PCI_CAPABILITY_LIST; (next = pdev->config[prev]);
> >>>>>          prev = next + PCI_CAP_LIST_NEXT)
> >>>>>         if (next <= offset && next > found)
> >>>>>             found = next;
> >>>>>
> >>>>>     return found;
> >>>>> }
> >>>>
> >>>> Sounds useful, will enhance the patch.
> >>>>
> >>>> (Originally, I just wanted to reduce the qemu-kvm delta... :) )
> >>>>
> >>>> Jan
> >>>
> >>> Also, let's add a comment documenting the
> >>> reason for this check: device assignment
> >>> depends on this check to verify that the device
> >>> is not broken.
> >>
> >> Based on the previous discussion, I don't think this is accurate as it
> >> will also validate emulated devices.
> >>
> >> Jan
> > 
> > Something like the below is accurate, right?
> > 
> > /* Device assignment depends on this check to verify that the device
> >    is not broken. Should never trigger for emulated devices,
> >    but it's helpful for debugging these.
> >  */
> 
> I've expressed this in the commit message. Unless there is another
> reason to do v3, maybe you can merge the comment on commit.
> 
> Jan

Sure, I can do that, no need with v3. You are fine with the way
it's formulated?

> -- 
> Siemens AG, Corporate Technology, CT T DE IT 1
> Corporate Competence Center Embedded Linux

  reply	other threads:[~2011-08-24 12:38 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-23 17:28 [Qemu-devel] [PATCH] pci: Error on PCI capability collisions Jan Kiszka
2011-08-23 18:17 ` Michael S. Tsirkin
2011-08-23 18:21   ` Alex Williamson
2011-08-23 18:26     ` Michael S. Tsirkin
2011-08-23 19:12       ` Alex Williamson
2011-08-23 19:30         ` Michael S. Tsirkin
2011-08-23 19:38           ` Alex Williamson
2011-08-23 20:59           ` Don Dutile
2011-08-24  9:51             ` Michael S. Tsirkin
2011-08-24 10:04 ` Michael S. Tsirkin
2011-08-24 10:10   ` Jan Kiszka
2011-08-24 11:01     ` Michael S. Tsirkin
2011-08-24 11:58     ` Michael S. Tsirkin
2011-08-24 12:29       ` Jan Kiszka
2011-08-24 12:34         ` Michael S. Tsirkin
2011-08-24 12:36           ` Jan Kiszka
2011-08-24 12:39             ` Michael S. Tsirkin [this message]
2011-08-24 12:39               ` Jan Kiszka
2011-08-24 12:29 ` [Qemu-devel] [PATCH v2] " Jan Kiszka
2011-08-24 12:53   ` Michael S. Tsirkin

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=20110824123929.GB18717@redhat.com \
    --to=mst@redhat.com \
    --cc=alex.williamson@redhat.com \
    --cc=jan.kiszka@siemens.com \
    --cc=qemu-devel@nongnu.org \
    /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.