All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] hw/arm/virt: Allow zero address for PCI IO space
@ 2015-10-12 20:55 Alexander Gordeev
  2015-10-12 21:03 ` Peter Maydell
  0 siblings, 1 reply; 18+ messages in thread
From: Alexander Gordeev @ 2015-10-12 20:55 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Andrew Jones, Alexander Gordeev

Currently PCI IO address 0 is not allowed even though
the IO space starts from 0. As result, PCI IO is not
possible to use at all.

CC: Peter Maydell <peter.maydell@linaro.org>
CC: Andrew Jones <drjones@redhat.com>
Signed-off-by: Alexander Gordeev <agordeev@redhat.com>
---
 hw/arm/virt.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/hw/arm/virt.c b/hw/arm/virt.c
index d25d6cf..3620489 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
@@ -1157,6 +1157,7 @@ static void virt_class_init(ObjectClass *oc, void *data)
     mc->has_dynamic_sysbus = true;
     mc->block_default_type = IF_VIRTIO;
     mc->no_cdrom = 1;
+    mc->pci_allow_0_address = true;
 }
 
 static const TypeInfo machvirt_info = {
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* Re: [Qemu-devel] [PATCH] hw/arm/virt: Allow zero address for PCI IO space
  2015-10-12 20:55 [Qemu-devel] [PATCH] hw/arm/virt: Allow zero address for PCI IO space Alexander Gordeev
@ 2015-10-12 21:03 ` Peter Maydell
  2015-10-13  6:31   ` Alexander Gordeev
  0 siblings, 1 reply; 18+ messages in thread
From: Peter Maydell @ 2015-10-12 21:03 UTC (permalink / raw)
  To: Alexander Gordeev; +Cc: Andrew Jones, QEMU Developers

On 12 October 2015 at 21:55, Alexander Gordeev <agordeev@redhat.com> wrote:
> Currently PCI IO address 0 is not allowed even though
> the IO space starts from 0. As result, PCI IO is not
> possible to use at all.

I don't see any reason for us not to allow 0 IO addresses,
but I'm not sure how your your conclusion follows. It
should be entirely possible to map PCI IO to some other
address than zero in the IO window, which is what I would
have expected the guest to do.

thanks
-- PMM

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [Qemu-devel] [PATCH] hw/arm/virt: Allow zero address for PCI IO space
  2015-10-12 21:03 ` Peter Maydell
@ 2015-10-13  6:31   ` Alexander Gordeev
  2015-10-13  8:16     ` Peter Maydell
  0 siblings, 1 reply; 18+ messages in thread
From: Alexander Gordeev @ 2015-10-13  6:31 UTC (permalink / raw)
  To: Peter Maydell; +Cc: Andrew Jones, QEMU Developers

On Mon, Oct 12, 2015 at 10:03:03PM +0100, Peter Maydell wrote:
> On 12 October 2015 at 21:55, Alexander Gordeev <agordeev@redhat.com> wrote:
> > Currently PCI IO address 0 is not allowed even though
> > the IO space starts from 0. As result, PCI IO is not
> > possible to use at all.
> 
> I don't see any reason for us not to allow 0 IO addresses,
> but I'm not sure how your your conclusion follows. It
> should be entirely possible to map PCI IO to some other
> address than zero in the IO window, which is what I would
> have expected the guest to do.

You are right - my changelog is incorrect. The rest of IO
space should be alright.

However, as 0 IO address is exposed via "ranges" to the guest,
it must be usable - isn't it? So it either should be allowed
or the range should be different.

Thanks!

> thanks
> -- PMM

-- 
Regards,
Alexander Gordeev
agordeev@redhat.com

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [Qemu-devel] [PATCH] hw/arm/virt: Allow zero address for PCI IO space
  2015-10-13  6:31   ` Alexander Gordeev
@ 2015-10-13  8:16     ` Peter Maydell
  2015-10-13 12:48       ` Alexander Gordeev
  2015-10-13 14:35       ` [Qemu-devel] [PATCH v2] " Alexander Gordeev
  0 siblings, 2 replies; 18+ messages in thread
From: Peter Maydell @ 2015-10-13  8:16 UTC (permalink / raw)
  To: Alexander Gordeev; +Cc: Andrew Jones, QEMU Developers

On 13 October 2015 at 07:31, Alexander Gordeev <agordeev@redhat.com> wrote:
> On Mon, Oct 12, 2015 at 10:03:03PM +0100, Peter Maydell wrote:
>> On 12 October 2015 at 21:55, Alexander Gordeev <agordeev@redhat.com> wrote:
>> > Currently PCI IO address 0 is not allowed even though
>> > the IO space starts from 0. As result, PCI IO is not
>> > possible to use at all.
>>
>> I don't see any reason for us not to allow 0 IO addresses,
>> but I'm not sure how your your conclusion follows. It
>> should be entirely possible to map PCI IO to some other
>> address than zero in the IO window, which is what I would
>> have expected the guest to do.
>
> You are right - my changelog is incorrect. The rest of IO
> space should be alright.
>
> However, as 0 IO address is exposed via "ranges" to the guest,
> it must be usable - isn't it? So it either should be allowed
> or the range should be different.

Depends on your point of view. If you take the Linus Torvalds
view that 0 is always an invalid PCI address, then you'll
never try to use it anyway.

In any case, setting pci_allow_0_address is the right thing,
so we can just change the commit message in this patch.

Incidentally, why is this a property on the machine
and not on the PCI controller device?

thanks
-- PMM

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [Qemu-devel] [PATCH] hw/arm/virt: Allow zero address for PCI IO space
  2015-10-13 12:48       ` Alexander Gordeev
@ 2015-10-13 12:33         ` Peter Maydell
  2015-10-13 12:47           ` Laurent Vivier
  0 siblings, 1 reply; 18+ messages in thread
From: Peter Maydell @ 2015-10-13 12:33 UTC (permalink / raw)
  To: Alexander Gordeev; +Cc: Laurent Vivier, Andrew Jones, QEMU Developers

On 13 October 2015 at 13:48, Alexander Gordeev <agordeev@redhat.com> wrote:
> On Tue, Oct 13, 2015 at 09:16:34AM +0100, Peter Maydell wrote:
>> In any case, setting pci_allow_0_address is the right thing,
>> so we can just change the commit message in this patch.
>
> I will post v2 with an updated changelog then.
>
>> Incidentally, why is this a property on the machine
>> and not on the PCI controller device?
>
> I am CC-ing Laurent Vivier who introduced the flag.
>
> But IMO it *is* a machine property, not PCI controller's
> one, unless I am missing something.

I think "does this PCI controller handle BARs with
zero addresses, or does it treat them as if the BAR
was unmapped" is definitely a controller property...
you might have in theory a machine with two PCI
controllers, one of which could deal with zero-addresses
and one of which could not.

thanks
-- PMM

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [Qemu-devel] [PATCH] hw/arm/virt: Allow zero address for PCI IO space
  2015-10-13 12:33         ` Peter Maydell
@ 2015-10-13 12:47           ` Laurent Vivier
  2015-10-13 13:04             ` Michael S. Tsirkin
  0 siblings, 1 reply; 18+ messages in thread
From: Laurent Vivier @ 2015-10-13 12:47 UTC (permalink / raw)
  To: Peter Maydell, Alexander Gordeev
  Cc: Andrew Jones, QEMU Developers, Michael S. Tsirkin



On 13/10/2015 14:33, Peter Maydell wrote:
> On 13 October 2015 at 13:48, Alexander Gordeev <agordeev@redhat.com> wrote:
>> On Tue, Oct 13, 2015 at 09:16:34AM +0100, Peter Maydell wrote:
>>> In any case, setting pci_allow_0_address is the right thing,
>>> so we can just change the commit message in this patch.
>>
>> I will post v2 with an updated changelog then.
>>
>>> Incidentally, why is this a property on the machine
>>> and not on the PCI controller device?
>>
>> I am CC-ing Laurent Vivier who introduced the flag.
>>
>> But IMO it *is* a machine property, not PCI controller's
>> one, unless I am missing something.
> 
> I think "does this PCI controller handle BARs with
> zero addresses, or does it treat them as if the BAR
> was unmapped" is definitely a controller property...
> you might have in theory a machine with two PCI
> controllers, one of which could deal with zero-addresses
> and one of which could not.

MST asked for a global flag:

https://lists.gnu.org/archive/html/qemu-ppc/2015-07/msg00364.html

But perhaps the machine is not the good place for this global flag ?

CC: Michael for that.

> thanks
> -- PMM
> 

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [Qemu-devel] [PATCH] hw/arm/virt: Allow zero address for PCI IO space
  2015-10-13  8:16     ` Peter Maydell
@ 2015-10-13 12:48       ` Alexander Gordeev
  2015-10-13 12:33         ` Peter Maydell
  2015-10-13 14:35       ` [Qemu-devel] [PATCH v2] " Alexander Gordeev
  1 sibling, 1 reply; 18+ messages in thread
From: Alexander Gordeev @ 2015-10-13 12:48 UTC (permalink / raw)
  To: Peter Maydell; +Cc: Laurent Vivier, Andrew Jones, QEMU Developers

On Tue, Oct 13, 2015 at 09:16:34AM +0100, Peter Maydell wrote:
> On 13 October 2015 at 07:31, Alexander Gordeev <agordeev@redhat.com> wrote:
> > On Mon, Oct 12, 2015 at 10:03:03PM +0100, Peter Maydell wrote:
> >> On 12 October 2015 at 21:55, Alexander Gordeev <agordeev@redhat.com> wrote:
> >> > Currently PCI IO address 0 is not allowed even though
> >> > the IO space starts from 0. As result, PCI IO is not
> >> > possible to use at all.
> >>
> >> I don't see any reason for us not to allow 0 IO addresses,
> >> but I'm not sure how your your conclusion follows. It
> >> should be entirely possible to map PCI IO to some other
> >> address than zero in the IO window, which is what I would
> >> have expected the guest to do.
> >
> > You are right - my changelog is incorrect. The rest of IO
> > space should be alright.
> >
> > However, as 0 IO address is exposed via "ranges" to the guest,
> > it must be usable - isn't it? So it either should be allowed
> > or the range should be different.
> 
> Depends on your point of view. If you take the Linus Torvalds
> view that 0 is always an invalid PCI address, then you'll
> never try to use it anyway.
> 
> In any case, setting pci_allow_0_address is the right thing,
> so we can just change the commit message in this patch.

I will post v2 with an updated changelog then.

> Incidentally, why is this a property on the machine
> and not on the PCI controller device?

I am CC-ing Laurent Vivier who introduced the flag.

But IMO it *is* a machine property, not PCI controller's
one, unless I am missing something.

Thanks!

> thanks
> -- PMM

-- 
Regards,
Alexander Gordeev
agordeev@redhat.com

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [Qemu-devel] [PATCH] hw/arm/virt: Allow zero address for PCI IO space
  2015-10-13 12:47           ` Laurent Vivier
@ 2015-10-13 13:04             ` Michael S. Tsirkin
  2015-10-13 13:12               ` Peter Maydell
  0 siblings, 1 reply; 18+ messages in thread
From: Michael S. Tsirkin @ 2015-10-13 13:04 UTC (permalink / raw)
  To: Laurent Vivier
  Cc: Peter Maydell, Andrew Jones, Alexander Gordeev, QEMU Developers

On Tue, Oct 13, 2015 at 02:47:33PM +0200, Laurent Vivier wrote:
> 
> 
> On 13/10/2015 14:33, Peter Maydell wrote:
> > On 13 October 2015 at 13:48, Alexander Gordeev <agordeev@redhat.com> wrote:
> >> On Tue, Oct 13, 2015 at 09:16:34AM +0100, Peter Maydell wrote:
> >>> In any case, setting pci_allow_0_address is the right thing,
> >>> so we can just change the commit message in this patch.
> >>
> >> I will post v2 with an updated changelog then.
> >>
> >>> Incidentally, why is this a property on the machine
> >>> and not on the PCI controller device?
> >>
> >> I am CC-ing Laurent Vivier who introduced the flag.
> >>
> >> But IMO it *is* a machine property, not PCI controller's
> >> one, unless I am missing something.
> > 
> > I think "does this PCI controller handle BARs with
> > zero addresses, or does it treat them as if the BAR
> > was unmapped" is definitely a controller property...
> > you might have in theory a machine with two PCI
> > controllers, one of which could deal with zero-addresses
> > and one of which could not.
> 
> MST asked for a global flag:
> 
> https://lists.gnu.org/archive/html/qemu-ppc/2015-07/msg00364.html
> 
> But perhaps the machine is not the good place for this global flag ?
> 
> CC: Michael for that.

Whether controllers treat zero specially should be expressed
using priorities in memory APIs.
This is just about buggy machine types that do
not specify priority for overlapping regions correctly.

As a temporary hacky work-around, a global seems sufficient.

> > thanks
> > -- PMM
> > 

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [Qemu-devel] [PATCH] hw/arm/virt: Allow zero address for PCI IO space
  2015-10-13 13:04             ` Michael S. Tsirkin
@ 2015-10-13 13:12               ` Peter Maydell
  2015-10-13 13:19                 ` Michael S. Tsirkin
  0 siblings, 1 reply; 18+ messages in thread
From: Peter Maydell @ 2015-10-13 13:12 UTC (permalink / raw)
  To: Michael S. Tsirkin
  Cc: Laurent Vivier, Andrew Jones, Alexander Gordeev, QEMU Developers

On 13 October 2015 at 14:04, Michael S. Tsirkin <mst@redhat.com> wrote:
> On Tue, Oct 13, 2015 at 02:47:33PM +0200, Laurent Vivier wrote:
>> MST asked for a global flag:
>>
>> https://lists.gnu.org/archive/html/qemu-ppc/2015-07/msg00364.html
>>
>> But perhaps the machine is not the good place for this global flag ?
>>
>> CC: Michael for that.
>
> Whether controllers treat zero specially should be expressed
> using priorities in memory APIs.

Mmm, I guess it's a bug in how the machine model
wires up the controller rather than in the controller
model itself.

> This is just about buggy machine types that do
> not specify priority for overlapping regions correctly.
>
> As a temporary hacky work-around, a global seems sufficient.

Well, if we're going to go around and fix the machines which
don't get things right, I guess. It's a shame the default for
the global is "this machine is broken", because now every
new machine will default unnecessarily to broken, and there's
no way to grep the source tree for machines which need fixing.

-- PMM

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [Qemu-devel] [PATCH] hw/arm/virt: Allow zero address for PCI IO space
  2015-10-13 13:12               ` Peter Maydell
@ 2015-10-13 13:19                 ` Michael S. Tsirkin
  2015-10-13 13:25                   ` Peter Maydell
  0 siblings, 1 reply; 18+ messages in thread
From: Michael S. Tsirkin @ 2015-10-13 13:19 UTC (permalink / raw)
  To: Peter Maydell
  Cc: Laurent Vivier, Andrew Jones, Alexander Gordeev, QEMU Developers

On Tue, Oct 13, 2015 at 02:12:34PM +0100, Peter Maydell wrote:
> On 13 October 2015 at 14:04, Michael S. Tsirkin <mst@redhat.com> wrote:
> > On Tue, Oct 13, 2015 at 02:47:33PM +0200, Laurent Vivier wrote:
> >> MST asked for a global flag:
> >>
> >> https://lists.gnu.org/archive/html/qemu-ppc/2015-07/msg00364.html
> >>
> >> But perhaps the machine is not the good place for this global flag ?
> >>
> >> CC: Michael for that.
> >
> > Whether controllers treat zero specially should be expressed
> > using priorities in memory APIs.
> 
> Mmm, I guess it's a bug in how the machine model
> wires up the controller rather than in the controller
> model itself.
> 
> > This is just about buggy machine types that do
> > not specify priority for overlapping regions correctly.
> >
> > As a temporary hacky work-around, a global seems sufficient.
> 
> Well, if we're going to go around and fix the machines which
> don't get things right, I guess. It's a shame the default for
> the global is "this machine is broken", because now every
> new machine will default unnecessarily to broken, and there's
> no way to grep the source tree for machines which need fixing.
> 
> -- PMM

It'd be easy enough to revert the logic if someone's willing to start on
this.  I'm reluctant to make this patchset depend on changing all
machines, but if you think I'm wrong, pls let me know.

-- 
MST

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [Qemu-devel] [PATCH] hw/arm/virt: Allow zero address for PCI IO space
  2015-10-13 13:19                 ` Michael S. Tsirkin
@ 2015-10-13 13:25                   ` Peter Maydell
  2015-10-13 13:55                     ` Peter Maydell
  0 siblings, 1 reply; 18+ messages in thread
From: Peter Maydell @ 2015-10-13 13:25 UTC (permalink / raw)
  To: Michael S. Tsirkin
  Cc: Laurent Vivier, Andrew Jones, Alexander Gordeev, QEMU Developers

On 13 October 2015 at 14:19, Michael S. Tsirkin <mst@redhat.com> wrote:
> On Tue, Oct 13, 2015 at 02:12:34PM +0100, Peter Maydell wrote:
>> Well, if we're going to go around and fix the machines which
>> don't get things right, I guess. It's a shame the default for
>> the global is "this machine is broken", because now every
>> new machine will default unnecessarily to broken, and there's
>> no way to grep the source tree for machines which need fixing.

> It'd be easy enough to revert the logic if someone's willing to start on
> this.  I'm reluctant to make this patchset depend on changing all
> machines, but if you think I'm wrong, pls let me know.

Most machines don't have a PCI controller, luckily.
I'll have a look at how many files it would touch...

-- PMM

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [Qemu-devel] [PATCH] hw/arm/virt: Allow zero address for PCI IO space
  2015-10-13 13:25                   ` Peter Maydell
@ 2015-10-13 13:55                     ` Peter Maydell
  2015-10-16  8:52                       ` Laurent Vivier
  0 siblings, 1 reply; 18+ messages in thread
From: Peter Maydell @ 2015-10-13 13:55 UTC (permalink / raw)
  To: Michael S. Tsirkin
  Cc: Laurent Vivier, Andrew Jones, Alexander Gordeev, QEMU Developers

On 13 October 2015 at 14:25, Peter Maydell <peter.maydell@linaro.org> wrote:
> On 13 October 2015 at 14:19, Michael S. Tsirkin <mst@redhat.com> wrote:
>> On Tue, Oct 13, 2015 at 02:12:34PM +0100, Peter Maydell wrote:
>>> Well, if we're going to go around and fix the machines which
>>> don't get things right, I guess. It's a shame the default for
>>> the global is "this machine is broken", because now every
>>> new machine will default unnecessarily to broken, and there's
>>> no way to grep the source tree for machines which need fixing.
>
>> It'd be easy enough to revert the logic if someone's willing to start on
>> this.  I'm reluctant to make this patchset depend on changing all
>> machines, but if you think I'm wrong, pls let me know.
>
> Most machines don't have a PCI controller, luckily.
> I'll have a look at how many files it would touch...

So, first up I'm happy that the gpex and versatile
pci controllers don't have this problem (the way they
set up the mmio and io windows means there won't be
overlaps). That leaves the following pci controllers,
which I've listed with the source files which define machines
that use them:

hw/pci-host/pbm
 hw/sparc64/sun4u.c
hw/pci-host/bonito
 hw/mips/mips_fulong2e.c
hw/pci-host/grackle
 hw/pc/mac_oldworld.c
hw/pci-host/piix
 [the x86 systems]
hw/pci-host/ppce500
 hw/ppc/e500.c
hw/pci-host/prep
 hw/ppc/prep.c
hw/pci-host/q35
 [x86 systems]
hw/pci-host/uninorth
 hw/ppc/mac_newworld.c
hw/alpha/typhoon
 used in hw/alpha/dp264.c
hw/mips/gt64xxx_pci
 hw/mips/mips_malta.c
hw/ppc/ppc4xx_pci
 hw/ppc/ppc440_bamboo.c
hw/ppc/spapr_pci
 hw/ppc/spapr.c [already marked as '0 addrs ok']
hw/s390/s390-pci-bus
 hw/s390/s390-virtio-ccw.c
hw/sh4/sh_pci
 hw/sh4/rd2.c

So we'd need to touch perhaps fifteen files in total.

I don't insist we do that rather than applying this particular
patch, but I don't think it's a huge effort.

thanks
-- PMM

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [Qemu-devel] [PATCH v2] hw/arm/virt: Allow zero address for PCI IO space
  2015-10-13  8:16     ` Peter Maydell
  2015-10-13 12:48       ` Alexander Gordeev
@ 2015-10-13 14:35       ` Alexander Gordeev
  2015-10-13 17:36         ` Peter Maydell
  1 sibling, 1 reply; 18+ messages in thread
From: Alexander Gordeev @ 2015-10-13 14:35 UTC (permalink / raw)
  To: Peter Maydell; +Cc: Andrew Jones, QEMU Developers

Currently PCI IO address 0 is not allowed even though
the IO space starts from 0. This update makes  PCI IO
address 0 usable.

CC: Peter Maydell <peter.maydell@linaro.org>
CC: Andrew Jones <drjones@redhat.com>
Signed-off-by: Alexander Gordeev <agordeev@redhat.com>
---
 hw/arm/virt.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/hw/arm/virt.c b/hw/arm/virt.c
index d25d6cf..3620489 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
@@ -1157,6 +1157,7 @@ static void virt_class_init(ObjectClass *oc, void *data)
     mc->has_dynamic_sysbus = true;
     mc->block_default_type = IF_VIRTIO;
     mc->no_cdrom = 1;
+    mc->pci_allow_0_address = true;
 }
 
 static const TypeInfo machvirt_info = {
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* Re: [Qemu-devel] [PATCH v2] hw/arm/virt: Allow zero address for PCI IO space
  2015-10-13 14:35       ` [Qemu-devel] [PATCH v2] " Alexander Gordeev
@ 2015-10-13 17:36         ` Peter Maydell
  0 siblings, 0 replies; 18+ messages in thread
From: Peter Maydell @ 2015-10-13 17:36 UTC (permalink / raw)
  To: Alexander Gordeev; +Cc: Andrew Jones, QEMU Developers

On 13 October 2015 at 15:35, Alexander Gordeev <agordeev@redhat.com> wrote:
> Currently PCI IO address 0 is not allowed even though
> the IO space starts from 0. This update makes  PCI IO
> address 0 usable.
>
> CC: Peter Maydell <peter.maydell@linaro.org>
> CC: Andrew Jones <drjones@redhat.com>
> Signed-off-by: Alexander Gordeev <agordeev@redhat.com>
> ---
>  hw/arm/virt.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/hw/arm/virt.c b/hw/arm/virt.c
> index d25d6cf..3620489 100644
> --- a/hw/arm/virt.c
> +++ b/hw/arm/virt.c
> @@ -1157,6 +1157,7 @@ static void virt_class_init(ObjectClass *oc, void *data)
>      mc->has_dynamic_sysbus = true;
>      mc->block_default_type = IF_VIRTIO;
>      mc->no_cdrom = 1;
> +    mc->pci_allow_0_address = true;
>  }
>
>  static const TypeInfo machvirt_info = {

Applied to target-arm.next, thanks.

-- PMM

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [Qemu-devel] [PATCH] hw/arm/virt: Allow zero address for PCI IO space
  2015-10-13 13:55                     ` Peter Maydell
@ 2015-10-16  8:52                       ` Laurent Vivier
  2015-10-16  9:13                         ` Michael S. Tsirkin
  2015-10-16  9:32                         ` Peter Maydell
  0 siblings, 2 replies; 18+ messages in thread
From: Laurent Vivier @ 2015-10-16  8:52 UTC (permalink / raw)
  To: Peter Maydell, Michael S. Tsirkin
  Cc: Andrew Jones, Alexander Gordeev, QEMU Developers



On 13/10/2015 15:55, Peter Maydell wrote:
> On 13 October 2015 at 14:25, Peter Maydell <peter.maydell@linaro.org> wrote:
>> On 13 October 2015 at 14:19, Michael S. Tsirkin <mst@redhat.com> wrote:
>>> On Tue, Oct 13, 2015 at 02:12:34PM +0100, Peter Maydell wrote:
>>>> Well, if we're going to go around and fix the machines which
>>>> don't get things right, I guess. It's a shame the default for
>>>> the global is "this machine is broken", because now every
>>>> new machine will default unnecessarily to broken, and there's
>>>> no way to grep the source tree for machines which need fixing.
>>
>>> It'd be easy enough to revert the logic if someone's willing to start on
>>> this.  I'm reluctant to make this patchset depend on changing all
>>> machines, but if you think I'm wrong, pls let me know.
>>
>> Most machines don't have a PCI controller, luckily.
>> I'll have a look at how many files it would touch...
> 
> So, first up I'm happy that the gpex and versatile
> pci controllers don't have this problem (the way they
> set up the mmio and io windows means there won't be
> overlaps). That leaves the following pci controllers,
> which I've listed with the source files which define machines
> that use them:
> 
> hw/pci-host/pbm
>  hw/sparc64/sun4u.c
> hw/pci-host/bonito
>  hw/mips/mips_fulong2e.c
> hw/pci-host/grackle
>  hw/pc/mac_oldworld.c
> hw/pci-host/piix
>  [the x86 systems]
> hw/pci-host/ppce500
>  hw/ppc/e500.c
> hw/pci-host/prep
>  hw/ppc/prep.c
> hw/pci-host/q35
>  [x86 systems]
> hw/pci-host/uninorth
>  hw/ppc/mac_newworld.c
> hw/alpha/typhoon
>  used in hw/alpha/dp264.c
> hw/mips/gt64xxx_pci
>  hw/mips/mips_malta.c
> hw/ppc/ppc4xx_pci
>  hw/ppc/ppc440_bamboo.c
> hw/ppc/spapr_pci
>  hw/ppc/spapr.c [already marked as '0 addrs ok']
> hw/s390/s390-pci-bus
>  hw/s390/s390-virtio-ccw.c
> hw/sh4/sh_pci
>  hw/sh4/rd2.c
> 
> So we'd need to touch perhaps fifteen files in total.
> 
> I don't insist we do that rather than applying this particular
> patch, but I don't think it's a huge effort.

I'm going to remove the zero address checking and try to start a qemu
for each of them to see which ones are broken.
I remember from a previous discussion on my initial patch that x86
should be ok.

> thanks
> -- PMM
> 
Laurent

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [Qemu-devel] [PATCH] hw/arm/virt: Allow zero address for PCI IO space
  2015-10-16  8:52                       ` Laurent Vivier
@ 2015-10-16  9:13                         ` Michael S. Tsirkin
  2015-10-16  9:32                         ` Peter Maydell
  1 sibling, 0 replies; 18+ messages in thread
From: Michael S. Tsirkin @ 2015-10-16  9:13 UTC (permalink / raw)
  To: Laurent Vivier
  Cc: Peter Maydell, Andrew Jones, Alexander Gordeev, QEMU Developers

On Fri, Oct 16, 2015 at 10:52:00AM +0200, Laurent Vivier wrote:
> 
> 
> On 13/10/2015 15:55, Peter Maydell wrote:
> > On 13 October 2015 at 14:25, Peter Maydell <peter.maydell@linaro.org> wrote:
> >> On 13 October 2015 at 14:19, Michael S. Tsirkin <mst@redhat.com> wrote:
> >>> On Tue, Oct 13, 2015 at 02:12:34PM +0100, Peter Maydell wrote:
> >>>> Well, if we're going to go around and fix the machines which
> >>>> don't get things right, I guess. It's a shame the default for
> >>>> the global is "this machine is broken", because now every
> >>>> new machine will default unnecessarily to broken, and there's
> >>>> no way to grep the source tree for machines which need fixing.
> >>
> >>> It'd be easy enough to revert the logic if someone's willing to start on
> >>> this.  I'm reluctant to make this patchset depend on changing all
> >>> machines, but if you think I'm wrong, pls let me know.
> >>
> >> Most machines don't have a PCI controller, luckily.
> >> I'll have a look at how many files it would touch...
> > 
> > So, first up I'm happy that the gpex and versatile
> > pci controllers don't have this problem (the way they
> > set up the mmio and io windows means there won't be
> > overlaps). That leaves the following pci controllers,
> > which I've listed with the source files which define machines
> > that use them:
> > 
> > hw/pci-host/pbm
> >  hw/sparc64/sun4u.c
> > hw/pci-host/bonito
> >  hw/mips/mips_fulong2e.c
> > hw/pci-host/grackle
> >  hw/pc/mac_oldworld.c
> > hw/pci-host/piix
> >  [the x86 systems]
> > hw/pci-host/ppce500
> >  hw/ppc/e500.c
> > hw/pci-host/prep
> >  hw/ppc/prep.c
> > hw/pci-host/q35
> >  [x86 systems]
> > hw/pci-host/uninorth
> >  hw/ppc/mac_newworld.c
> > hw/alpha/typhoon
> >  used in hw/alpha/dp264.c
> > hw/mips/gt64xxx_pci
> >  hw/mips/mips_malta.c
> > hw/ppc/ppc4xx_pci
> >  hw/ppc/ppc440_bamboo.c
> > hw/ppc/spapr_pci
> >  hw/ppc/spapr.c [already marked as '0 addrs ok']
> > hw/s390/s390-pci-bus
> >  hw/s390/s390-virtio-ccw.c
> > hw/sh4/sh_pci
> >  hw/sh4/rd2.c
> > 
> > So we'd need to touch perhaps fifteen files in total.
> > 
> > I don't insist we do that rather than applying this particular
> > patch, but I don't think it's a huge effort.
> 
> I'm going to remove the zero address checking and try to start a qemu
> for each of them to see which ones are broken.

Can't hurt, but I'm not sure that will be enough,
as overlaps might depend on what does the guest do.
It's a question of looking at how are mmio and
io windows for pci set up.

> I remember from a previous discussion on my initial patch that x86
> should be ok.

Yes because on x86 PCI has priority -1 - lower than all other
system devices.

That was handled by this patch:

commit 83d08f2673504a299194dcac1657a13754b5932a
Author: Michael S. Tsirkin <mst@redhat.com>
Date:   Tue Oct 29 13:57:34 2013 +0100

    pc: map PCI address space as catchall region for not mapped addresses

> > thanks
> > -- PMM
> > 
> Laurent

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [Qemu-devel] [PATCH] hw/arm/virt: Allow zero address for PCI IO space
  2015-10-16  8:52                       ` Laurent Vivier
  2015-10-16  9:13                         ` Michael S. Tsirkin
@ 2015-10-16  9:32                         ` Peter Maydell
  2015-10-16  9:59                           ` Laurent Vivier
  1 sibling, 1 reply; 18+ messages in thread
From: Peter Maydell @ 2015-10-16  9:32 UTC (permalink / raw)
  To: Laurent Vivier
  Cc: Andrew Jones, Alexander Gordeev, QEMU Developers, Michael S. Tsirkin

On 16 October 2015 at 09:52, Laurent Vivier <lvivier@redhat.com> wrote:
> I'm going to remove the zero address checking and try to start a qemu
> for each of them to see which ones are broken.

You need to also make sure there's a PCI card in there
and that the guest maps it with a BAR at address zero
(testing both MMIO BARs and IO BARs), and then exercise
the guest sufficiently to check that behaviour of whatever
it might be overlapping is still OK.

You might find it easier to do by code inspection in
some cases (boards which implement PCI as a simple
"memory window into the PCI space" rather than with
x86-style "anything in the background not covered by
another device is PCI space" should be ok).

thanks
-- PMM

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [Qemu-devel] [PATCH] hw/arm/virt: Allow zero address for PCI IO space
  2015-10-16  9:32                         ` Peter Maydell
@ 2015-10-16  9:59                           ` Laurent Vivier
  0 siblings, 0 replies; 18+ messages in thread
From: Laurent Vivier @ 2015-10-16  9:59 UTC (permalink / raw)
  To: Peter Maydell
  Cc: Andrew Jones, Alexander Gordeev, QEMU Developers, Michael S. Tsirkin



On 16/10/2015 11:32, Peter Maydell wrote:
> On 16 October 2015 at 09:52, Laurent Vivier <lvivier@redhat.com> wrote:
>> I'm going to remove the zero address checking and try to start a qemu
>> for each of them to see which ones are broken.
> 
> You need to also make sure there's a PCI card in there
> and that the guest maps it with a BAR at address zero
> (testing both MMIO BARs and IO BARs), and then exercise
> the guest sufficiently to check that behaviour of whatever
> it might be overlapping is still OK.

I think it will be hard to trigger this case. :(

For instance, on pseries, the card is put at address 0 only when it is
hotplugged, and on reboot it is moved to another address.

> You might find it easier to do by code inspection in
> some cases (boards which implement PCI as a simple
> "memory window into the PCI space" rather than with
> x86-style "anything in the background not covered by
> another device is PCI space" should be ok).

OK, I will...

Laurent

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2015-10-16  9:59 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-12 20:55 [Qemu-devel] [PATCH] hw/arm/virt: Allow zero address for PCI IO space Alexander Gordeev
2015-10-12 21:03 ` Peter Maydell
2015-10-13  6:31   ` Alexander Gordeev
2015-10-13  8:16     ` Peter Maydell
2015-10-13 12:48       ` Alexander Gordeev
2015-10-13 12:33         ` Peter Maydell
2015-10-13 12:47           ` Laurent Vivier
2015-10-13 13:04             ` Michael S. Tsirkin
2015-10-13 13:12               ` Peter Maydell
2015-10-13 13:19                 ` Michael S. Tsirkin
2015-10-13 13:25                   ` Peter Maydell
2015-10-13 13:55                     ` Peter Maydell
2015-10-16  8:52                       ` Laurent Vivier
2015-10-16  9:13                         ` Michael S. Tsirkin
2015-10-16  9:32                         ` Peter Maydell
2015-10-16  9:59                           ` Laurent Vivier
2015-10-13 14:35       ` [Qemu-devel] [PATCH v2] " Alexander Gordeev
2015-10-13 17:36         ` Peter Maydell

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.