All of lore.kernel.org
 help / color / mirror / Atom feed
From: George Dunlap <george.dunlap@citrix.com>
To: Stefano Stabellini <Stefano.Stabellini@eu.citrix.com>
Cc: George Dunlap <George.Dunlap@eu.citrix.com>,
	"xen-devel@lists.xensource.com" <xen-devel@lists.xensource.com>,
	Ian Jackson <ian.jackson@xen.org>
Subject: Re: [PATCH] qemu: Don't access /proc/bus/pci unless graphics pass-thru is enabled
Date: Fri, 10 Feb 2012 14:08:02 +0000	[thread overview]
Message-ID: <1328882882.3480.16.camel@elijah> (raw)
In-Reply-To: <alpine.DEB.2.00.1202101123160.7456@kaball-desktop>

On Fri, 2012-02-10 at 11:28 +0000, Stefano Stabellini wrote:
> could you please send patches inline?

I'll see what I can do. :-)

> > diff -r 6efeff914609 hw/pt-graphics.c
> > --- a/hw/pt-graphics.c	Fri Feb 10 11:02:25 2012 +0000
> > +++ b/hw/pt-graphics.c	Fri Feb 10 11:04:01 2012 +0000
> > @@ -23,9 +23,9 @@ void intel_pch_init(PCIBus *bus)
> >  {
> >      uint16_t vid, did;
> >      uint8_t  rid;
> > -    struct pci_dev *pci_dev_1f = pt_pci_get_dev(0, 0x1f, 0);
> > +    struct pci_dev *pci_dev_1f;
> >  
> > -    if ( !gfx_passthru || !pci_dev_1f )
> > +    if ( !gfx_passthru || !(pci_dev_1f=pt_pci_get_dev(0, 0x1f, 0)) )
> >          return;
> 
> I would rather have it as a seprate test after if ( !gfx_passthru ),
> same for the others below

Sure.

> 
> 
> >      vid = pt_pci_host_read(pci_dev_1f, PCI_VENDOR_ID, 2);
> > @@ -39,9 +39,9 @@ void intel_pch_init(PCIBus *bus)
> >  
> >  void igd_pci_write(PCIDevice *pci_dev, uint32_t config_addr, uint32_t val, int len)
> >  {
> > -    struct pci_dev *pci_dev_host_bridge = pt_pci_get_dev(0, 0, 0);
> > +    struct pci_dev *pci_dev_host_bridge;
> >      assert(pci_dev->devfn == 0x00);
> > -    if ( !igd_passthru ) {
> > +    if ( !igd_passthru || !(pci_dev_host_bridge = pt_pci_get_dev(0, 0, 0))) {
> >          pci_default_write_config(pci_dev, config_addr, val, len);
> >          return;
> >      }
> 
> Why are you adding this test (!(pci_dev_host_bridge = pt_pci_get_dev(0, 0, 0)) ?
> 
> If you are worried that pci_dev_host_bridge could be NULL, shouldn't you
> also remove the assert?

The assert is about pci_dev, but the check is about the return value of
pci_host_bridge() (to which pci_dev_host_bridge is set).  If there's an
expected relationship between them, it wasn't immediately clear from the
code.  

Are you saying that if the assert passes, that the function will never
return NULL?

 -George

  reply	other threads:[~2012-02-10 14:08 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-10 11:06 [PATCH] qemu: Don't access /proc/bus/pci unless graphics pass-thru is enabled George Dunlap
2012-02-10 11:28 ` Stefano Stabellini
2012-02-10 14:08   ` George Dunlap [this message]
2012-02-10 14:41     ` Stefano Stabellini
2012-02-10 14:41       ` George Dunlap
2012-02-10 15:02         ` Stefano Stabellini
  -- strict thread matches above, loose matches on Subject: below --
2012-02-10 15:56 George Dunlap
2012-02-10 16:05 ` George Dunlap
2012-02-10 17:14 ` Stefano Stabellini
2012-02-13 17:00   ` Ian Jackson

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=1328882882.3480.16.camel@elijah \
    --to=george.dunlap@citrix.com \
    --cc=George.Dunlap@eu.citrix.com \
    --cc=Stefano.Stabellini@eu.citrix.com \
    --cc=ian.jackson@xen.org \
    --cc=xen-devel@lists.xensource.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.