Patchwork [V12,5/9] Revert "pci: don't export an internal function"

login
register
mail settings
Submitter Anthony PERARD
Date June 12, 2012, 3:05 p.m.
Message ID <1339513523-1699-6-git-send-email-anthony.perard@citrix.com>
Download mbox | patch
Permalink /patch/164429/
State New
Headers show

Comments

Anthony PERARD - June 12, 2012, 3:05 p.m.
This reverts commit 94a09e2c846374a96719cda2b4e1312d8c4b08a7.

This function is used by a later patch to parse the BDF of the device to
passthrough.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
---
 hw/pci.c |    2 +-
 hw/pci.h |    2 ++
 2 files changed, 3 insertions(+), 1 deletions(-)
Michael S. Tsirkin - June 12, 2012, 3:15 p.m.
On Tue, Jun 12, 2012 at 04:05:19PM +0100, Anthony PERARD wrote:
> This reverts commit 94a09e2c846374a96719cda2b4e1312d8c4b08a7.
> 
> This function is used by a later patch to parse the BDF of the device to
> passthrough.
> 
> Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>

You probably want to parse the host address?  You don't want to copy the
bugs in pci_parse_devaddr - write your own that has sane semantics
for host. E.g. you need to support ARI etc.

> ---
>  hw/pci.c |    2 +-
>  hw/pci.h |    2 ++
>  2 files changed, 3 insertions(+), 1 deletions(-)
> 
> diff --git a/hw/pci.c b/hw/pci.c
> index eec106a..5bddf7a 100644
> --- a/hw/pci.c
> +++ b/hw/pci.c
> @@ -479,7 +479,7 @@ static void pci_set_default_subsystem_id(PCIDevice *pci_dev)
>   * Parse [[<domain>:]<bus>:]<slot>, return -1 on error if funcp == NULL
>   *       [[<domain>:]<bus>:]<slot>.<func>, return -1 on error
>   */
> -static int pci_parse_devaddr(const char *addr, int *domp, int *busp,
> +int pci_parse_devaddr(const char *addr, int *domp, int *busp,
>                        unsigned int *slotp, unsigned int *funcp)
>  {
>      const char *p;
> diff --git a/hw/pci.h b/hw/pci.h
> index ecf37fd..b169c0b 100644
> --- a/hw/pci.h
> +++ b/hw/pci.h
> @@ -321,6 +321,8 @@ PCIDevice *pci_find_device(PCIBus *bus, int bus_num, uint8_t devfn);
>  int pci_qdev_find_device(const char *id, PCIDevice **pdev);
>  PCIBus *pci_get_bus_devfn(int *devfnp, const char *devaddr);
>  
> +int pci_parse_devaddr(const char *addr, int *domp, int *busp,
> +                      unsigned int *slotp, unsigned int *funcp);
>  int pci_read_devaddr(Monitor *mon, const char *addr, int *domp, int *busp,
>                       unsigned *slotp);
>  
> -- 
> Anthony PERARD
Stefano Stabellini - June 13, 2012, 10:56 a.m.
On Tue, 12 Jun 2012, Michael S. Tsirkin wrote:
> On Tue, Jun 12, 2012 at 04:05:19PM +0100, Anthony PERARD wrote:
> > This reverts commit 94a09e2c846374a96719cda2b4e1312d8c4b08a7.
> > 
> > This function is used by a later patch to parse the BDF of the device to
> > passthrough.
> > 
> > Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
> 
> You probably want to parse the host address?  You don't want to copy the
> bugs in pci_parse_devaddr - write your own that has sane semantics
> for host. E.g. you need to support ARI etc.

Aside from this minor comment, do you have any objections to this series?

It has been outstanding for 9 months now, and the last few versions have
been without any major changes.
Considering that a new QEMU release cycle has just opened, I think that
now would be the perfect time to get the series in.
Michael S. Tsirkin - June 13, 2012, 11:06 a.m.
On Wed, Jun 13, 2012 at 11:56:34AM +0100, Stefano Stabellini wrote:
> On Tue, 12 Jun 2012, Michael S. Tsirkin wrote:
> > On Tue, Jun 12, 2012 at 04:05:19PM +0100, Anthony PERARD wrote:
> > > This reverts commit 94a09e2c846374a96719cda2b4e1312d8c4b08a7.
> > > 
> > > This function is used by a later patch to parse the BDF of the device to
> > > passthrough.
> > > 
> > > Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
> > 
> > You probably want to parse the host address?  You don't want to copy the
> > bugs in pci_parse_devaddr - write your own that has sane semantics
> > for host. E.g. you need to support ARI etc.
> 
> Aside from this minor comment, do you have any objections to this series?

Aside from this, there are minor pci core changes and these are all
fine.
I can't say I looked at the device itself too deeply
but seems mergeable.

> It has been outstanding for 9 months now, and the last few versions have
> been without any major changes.
> Considering that a new QEMU release cycle has just opened, I think that
> now would be the perfect time to get the series in.
Jan Kiszka - June 13, 2012, 11:15 a.m.
On 2012-06-12 17:15, Michael S. Tsirkin wrote:
> On Tue, Jun 12, 2012 at 04:05:19PM +0100, Anthony PERARD wrote:
>> This reverts commit 94a09e2c846374a96719cda2b4e1312d8c4b08a7.
>>
>> This function is used by a later patch to parse the BDF of the device to
>> passthrough.
>>
>> Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
> 
> You probably want to parse the host address?  You don't want to copy the
> bugs in pci_parse_devaddr - write your own that has sane semantics
> for host. E.g. you need to support ARI etc.

We should really consolidate over one parser for Xen, KVM device
assignment and VFIO. It looks like they all have very similar requirements.

For those how didn't follow the discussion, see patches 10-13 in
http://thread.gmane.org/gmane.comp.emulators.qemu/153728.

Jan
Stefano Stabellini - June 13, 2012, 11:22 a.m.
On Wed, 13 Jun 2012, Jan Kiszka wrote:
> On 2012-06-12 17:15, Michael S. Tsirkin wrote:
> > On Tue, Jun 12, 2012 at 04:05:19PM +0100, Anthony PERARD wrote:
> >> This reverts commit 94a09e2c846374a96719cda2b4e1312d8c4b08a7.
> >>
> >> This function is used by a later patch to parse the BDF of the device to
> >> passthrough.
> >>
> >> Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
> > 
> > You probably want to parse the host address?  You don't want to copy the
> > bugs in pci_parse_devaddr - write your own that has sane semantics
> > for host. E.g. you need to support ARI etc.
> 
> We should really consolidate over one parser for Xen, KVM device
> assignment and VFIO. It looks like they all have very similar requirements.
> 
> For those how didn't follow the discussion, see patches 10-13 in
> http://thread.gmane.org/gmane.comp.emulators.qemu/153728.

I agree, actually it looks like patch 10 and 11 would be enough.

Maybe you could extract them and send them out separately?
Michael S. Tsirkin - June 13, 2012, 11:22 a.m.
On Wed, Jun 13, 2012 at 01:15:23PM +0200, Jan Kiszka wrote:
> On 2012-06-12 17:15, Michael S. Tsirkin wrote:
> > On Tue, Jun 12, 2012 at 04:05:19PM +0100, Anthony PERARD wrote:
> >> This reverts commit 94a09e2c846374a96719cda2b4e1312d8c4b08a7.
> >>
> >> This function is used by a later patch to parse the BDF of the device to
> >> passthrough.
> >>
> >> Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
> > 
> > You probably want to parse the host address?  You don't want to copy the
> > bugs in pci_parse_devaddr - write your own that has sane semantics
> > for host. E.g. you need to support ARI etc.
> 
> We should really consolidate over one parser for Xen, KVM device
> assignment and VFIO. It looks like they all have very similar requirements.

Also rename pci_parse_devaddr to pci_parse_legacy_devaddr
to stress it's not something others should reuse.

> For those how didn't follow the discussion, see patches 10-13 in
> http://thread.gmane.org/gmane.comp.emulators.qemu/153728.
> 
> Jan
> 
> -- 
> Siemens AG, Corporate Technology, CT T DE IT 1
> Corporate Competence Center Embedded Linux
Jan Kiszka - June 13, 2012, 11:48 a.m.
On 2012-06-13 13:22, Michael S. Tsirkin wrote:
> On Wed, Jun 13, 2012 at 01:15:23PM +0200, Jan Kiszka wrote:
>> On 2012-06-12 17:15, Michael S. Tsirkin wrote:
>>> On Tue, Jun 12, 2012 at 04:05:19PM +0100, Anthony PERARD wrote:
>>>> This reverts commit 94a09e2c846374a96719cda2b4e1312d8c4b08a7.
>>>>
>>>> This function is used by a later patch to parse the BDF of the device to
>>>> passthrough.
>>>>
>>>> Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
>>>
>>> You probably want to parse the host address?  You don't want to copy the
>>> bugs in pci_parse_devaddr - write your own that has sane semantics
>>> for host. E.g. you need to support ARI etc.
>>
>> We should really consolidate over one parser for Xen, KVM device
>> assignment and VFIO. It looks like they all have very similar requirements.
> 
> Also rename pci_parse_devaddr to pci_parse_legacy_devaddr
> to stress it's not something others should reuse.

That depends on what pci_parse_devaddr will do in the end. If it will
become as general as my qemu_parse_pci_devaddr, "legacy" would be
inappropriate.

Jan
Jan Kiszka - June 13, 2012, noon
On 2012-06-13 13:22, Stefano Stabellini wrote:
> On Wed, 13 Jun 2012, Jan Kiszka wrote:
>> On 2012-06-12 17:15, Michael S. Tsirkin wrote:
>>> On Tue, Jun 12, 2012 at 04:05:19PM +0100, Anthony PERARD wrote:
>>>> This reverts commit 94a09e2c846374a96719cda2b4e1312d8c4b08a7.
>>>>
>>>> This function is used by a later patch to parse the BDF of the device to
>>>> passthrough.
>>>>
>>>> Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
>>>
>>> You probably want to parse the host address?  You don't want to copy the
>>> bugs in pci_parse_devaddr - write your own that has sane semantics
>>> for host. E.g. you need to support ARI etc.
>>
>> We should really consolidate over one parser for Xen, KVM device
>> assignment and VFIO. It looks like they all have very similar requirements.
>>
>> For those how didn't follow the discussion, see patches 10-13 in
>> http://thread.gmane.org/gmane.comp.emulators.qemu/153728.
> 
> I agree, actually it looks like patch 10 and 11 would be enough.
> 
> Maybe you could extract them and send them out separately?

They are still under discussion and waiting for some QOM refactorings to
be merged.

Will you be able to use an address parser via some device property?

Jan
Andreas Färber - June 13, 2012, 12:22 p.m.
Am 13.06.2012 14:00, schrieb Jan Kiszka:
> On 2012-06-13 13:22, Stefano Stabellini wrote:
>> On Wed, 13 Jun 2012, Jan Kiszka wrote:
>>> We should really consolidate over one parser for Xen, KVM device
>>> assignment and VFIO. It looks like they all have very similar requirements.
>>>
>>> For those how didn't follow the discussion, see patches 10-13 in
>>> http://thread.gmane.org/gmane.comp.emulators.qemu/153728.
>>
>> I agree, actually it looks like patch 10 and 11 would be enough.
>>
>> Maybe you could extract them and send them out separately?
> 
> They are still under discussion and waiting for some QOM refactorings to
> be merged.

The first qom-next PULL is already merged into qemu.git (you should've
been cc'ed) and I'm actually waiting for you to rebase and send out a v2
and/or to let me know what your/mst's merge time frame is so that we can
coordinate the next PULLs.
Currently the semantics discussion looks like we won't merge Paolo's
qdev-properties.c movement, so the preview I posted is all that one of
us will have to rebase (on).

Andreas
Anthony PERARD - June 13, 2012, 12:40 p.m.
On 13/06/12 13:00, Jan Kiszka wrote:
> On 2012-06-13 13:22, Stefano Stabellini wrote:
>> On Wed, 13 Jun 2012, Jan Kiszka wrote:
>>> On 2012-06-12 17:15, Michael S. Tsirkin wrote:
>>>> On Tue, Jun 12, 2012 at 04:05:19PM +0100, Anthony PERARD wrote:
>>>>> This reverts commit 94a09e2c846374a96719cda2b4e1312d8c4b08a7.
>>>>>
>>>>> This function is used by a later patch to parse the BDF of the device to
>>>>> passthrough.
>>>>>
>>>>> Signed-off-by: Anthony PERARD<anthony.perard@citrix.com>
>>>>
>>>> You probably want to parse the host address?  You don't want to copy the
>>>> bugs in pci_parse_devaddr - write your own that has sane semantics
>>>> for host. E.g. you need to support ARI etc.
>>>
>>> We should really consolidate over one parser for Xen, KVM device
>>> assignment and VFIO. It looks like they all have very similar requirements.
>>>
>>> For those how didn't follow the discussion, see patches 10-13 in
>>> http://thread.gmane.org/gmane.comp.emulators.qemu/153728.
>>
>> I agree, actually it looks like patch 10 and 11 would be enough.
>>
>> Maybe you could extract them and send them out separately?
>
> They are still under discussion and waiting for some QOM refactorings to
> be merged.
>
> Will you be able to use an address parser via some device property?

Yes. Actually, the address is already a device property.
Jan Kiszka - June 13, 2012, 12:48 p.m.
On 2012-06-13 14:40, Anthony PERARD wrote:
> On 13/06/12 13:00, Jan Kiszka wrote:
>> On 2012-06-13 13:22, Stefano Stabellini wrote:
>>> On Wed, 13 Jun 2012, Jan Kiszka wrote:
>>>> On 2012-06-12 17:15, Michael S. Tsirkin wrote:
>>>>> On Tue, Jun 12, 2012 at 04:05:19PM +0100, Anthony PERARD wrote:
>>>>>> This reverts commit 94a09e2c846374a96719cda2b4e1312d8c4b08a7.
>>>>>>
>>>>>> This function is used by a later patch to parse the BDF of the device to
>>>>>> passthrough.
>>>>>>
>>>>>> Signed-off-by: Anthony PERARD<anthony.perard@citrix.com>
>>>>>
>>>>> You probably want to parse the host address?  You don't want to copy the
>>>>> bugs in pci_parse_devaddr - write your own that has sane semantics
>>>>> for host. E.g. you need to support ARI etc.
>>>>
>>>> We should really consolidate over one parser for Xen, KVM device
>>>> assignment and VFIO. It looks like they all have very similar requirements.
>>>>
>>>> For those how didn't follow the discussion, see patches 10-13 in
>>>> http://thread.gmane.org/gmane.comp.emulators.qemu/153728.
>>>
>>> I agree, actually it looks like patch 10 and 11 would be enough.
>>>
>>> Maybe you could extract them and send them out separately?
>>
>> They are still under discussion and waiting for some QOM refactorings to
>> be merged.
>>
>> Will you be able to use an address parser via some device property?
> 
> Yes. Actually, the address is already a device property.
> 

Great. Then we should try to come up with a common pci-host-devaddr
property everyone can use.

Jan
Jan Kiszka - June 13, 2012, 12:48 p.m.
On 2012-06-13 14:22, Andreas Färber wrote:
> Am 13.06.2012 14:00, schrieb Jan Kiszka:
>> On 2012-06-13 13:22, Stefano Stabellini wrote:
>>> On Wed, 13 Jun 2012, Jan Kiszka wrote:
>>>> We should really consolidate over one parser for Xen, KVM device
>>>> assignment and VFIO. It looks like they all have very similar requirements.
>>>>
>>>> For those how didn't follow the discussion, see patches 10-13 in
>>>> http://thread.gmane.org/gmane.comp.emulators.qemu/153728.
>>>
>>> I agree, actually it looks like patch 10 and 11 would be enough.
>>>
>>> Maybe you could extract them and send them out separately?
>>
>> They are still under discussion and waiting for some QOM refactorings to
>> be merged.
> 
> The first qom-next PULL is already merged into qemu.git (you should've
> been cc'ed) and I'm actually waiting for you to rebase and send out a v2
> and/or to let me know what your/mst's merge time frame is so that we can
> coordinate the next PULLs.
> Currently the semantics discussion looks like we won't merge Paolo's
> qdev-properties.c movement, so the preview I posted is all that one of
> us will have to rebase (on).

Thanks for the update! I didn't follow the latest details due to local
overload.

I would say, give us one or two days to define how v2 of that pci
address property should look like. If we cannot agree, you should bypass
with your next step.

Jan
Michael S. Tsirkin - June 13, 2012, 2:04 p.m.
On Wed, Jun 13, 2012 at 01:48:14PM +0200, Jan Kiszka wrote:
> On 2012-06-13 13:22, Michael S. Tsirkin wrote:
> > On Wed, Jun 13, 2012 at 01:15:23PM +0200, Jan Kiszka wrote:
> >> On 2012-06-12 17:15, Michael S. Tsirkin wrote:
> >>> On Tue, Jun 12, 2012 at 04:05:19PM +0100, Anthony PERARD wrote:
> >>>> This reverts commit 94a09e2c846374a96719cda2b4e1312d8c4b08a7.
> >>>>
> >>>> This function is used by a later patch to parse the BDF of the device to
> >>>> passthrough.
> >>>>
> >>>> Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
> >>>
> >>> You probably want to parse the host address?  You don't want to copy the
> >>> bugs in pci_parse_devaddr - write your own that has sane semantics
> >>> for host. E.g. you need to support ARI etc.
> >>
> >> We should really consolidate over one parser for Xen, KVM device
> >> assignment and VFIO. It looks like they all have very similar requirements.
> > 
> > Also rename pci_parse_devaddr to pci_parse_legacy_devaddr
> > to stress it's not something others should reuse.
> 
> That depends on what pci_parse_devaddr will do in the end. If it will
> become as general as my qemu_parse_pci_devaddr, "legacy" would be
> inappropriate.
> 
> Jan

I'd rather keep it separate than adding OPT_LEGACY.

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

Patch

diff --git a/hw/pci.c b/hw/pci.c
index eec106a..5bddf7a 100644
--- a/hw/pci.c
+++ b/hw/pci.c
@@ -479,7 +479,7 @@  static void pci_set_default_subsystem_id(PCIDevice *pci_dev)
  * Parse [[<domain>:]<bus>:]<slot>, return -1 on error if funcp == NULL
  *       [[<domain>:]<bus>:]<slot>.<func>, return -1 on error
  */
-static int pci_parse_devaddr(const char *addr, int *domp, int *busp,
+int pci_parse_devaddr(const char *addr, int *domp, int *busp,
                       unsigned int *slotp, unsigned int *funcp)
 {
     const char *p;
diff --git a/hw/pci.h b/hw/pci.h
index ecf37fd..b169c0b 100644
--- a/hw/pci.h
+++ b/hw/pci.h
@@ -321,6 +321,8 @@  PCIDevice *pci_find_device(PCIBus *bus, int bus_num, uint8_t devfn);
 int pci_qdev_find_device(const char *id, PCIDevice **pdev);
 PCIBus *pci_get_bus_devfn(int *devfnp, const char *devaddr);
 
+int pci_parse_devaddr(const char *addr, int *domp, int *busp,
+                      unsigned int *slotp, unsigned int *funcp);
 int pci_read_devaddr(Monitor *mon, const char *addr, int *domp, int *busp,
                      unsigned *slotp);