[PATCH xserver v2] xfree86: recognize primary BUS_PCI device in xf86IsPrimaryPlatform()

Laszlo Ersek lersek at redhat.com
Wed Sep 14 19:53:28 UTC 2016


On 09/07/16 17:15, Hans de Goede wrote:
> Hi,
> 
> On 07-09-16 15:08, Laszlo Ersek wrote:
>> The new platform bus code and the old PCI bus code overlap. Platform bus
>> can handle any type of device, including PCI devices, whereas the PCI
>> code
>> can only handle PCI devices. Some drivers only support the old style
>> PCI-probe methods, but the primary device detection code is server based,
>> not driver based; so we might end up with a primary device which only has
>> a PCI bus-capable driver, but was detected as primary by the platform
>> code, or the other way around.
>>
>> (The above paragraph was shamelessly stolen from Hans de Goede, and
>> customized.)
>>
>> The latter case applies to QEMU's virtio-gpu-pci device: it is
>> detected as
>> a BUS_PCI primary device, but we actually probe it first (with the
>> modesetting driver) through xf86platformProbeDev(). The
>> xf86IsPrimaryPlatform() function doesn't recognize the device as primary
>> (it bails out as soon as it sees BUS_PCI); instead, we add the device
>> as a
>> secondary graphics card under "autoAddGPU". In turn, the success of this
>> automatic probing-as-GPU prevents xf86CallDriverProbe() from
>> proceeding to
>> the PCI probing.
>>
>> The result is that the server exits with no primary devices detected.
>>
>> Commit cf66471353ac ("xfree86: use udev to provide device enumeration for
>> kms devices (v10)") added "cross-bus" matching to xf86IsPrimaryPci().
>> Port
>> that now to xf86IsPrimaryPlatform(), so that we can probe virtio-gpu-pci
>> as a primary card in platform bus code.
>>
>> Cc: Adam Jackson <ajax at redhat.com>
>> Cc: Dave Airlie <airlied at redhat.com>
>> Cc: Hans de Goede <hdegoede at redhat.com>
>> Cc: Keith Packard <keithp at keithp.com>
>> Cc: Marcin Juszkiewicz <mjuszkiewicz at redhat.com>
>> Signed-off-by: Laszlo Ersek <lersek at redhat.com>
> 
> Patch looks good to me:
> 
> Reviewed-by: Hans de Goede <hdegoede at redhat.com>

Many kudos to you Hans and Marcin (and everyone else who participated)
for your continued help / support / testing with this issue.

Since it's been one week since the last message in this thread, and the
v2 patch is both reviewed and tested, I thought I'd send a ping about
merging the patch. (I checked both the master branch in git and the pull
requests in the September ML archive; I don't see the patch in either.)

I hope it's not too early (other projects I'm involved with accept /
encourage a ping after a week of silence). Apologies if it's too early.

So, "ping" :)

Thanks!
Laszlo


>> ---
>>
>> Notes:
>>     - F24 scratch build:
>>       <http://arm.koji.fedoraproject.org/koji/taskinfo?taskID=3710269>
>>
>>     - Marcin, can you please test this too on your phys hw setup? Thanks!
>>
>>  hw/xfree86/common/xf86platformBus.c | 10 +++++++++-
>>  1 file changed, 9 insertions(+), 1 deletion(-)
>>
>> diff --git a/hw/xfree86/common/xf86platformBus.c
>> b/hw/xfree86/common/xf86platformBus.c
>> index 96895a6e17f4..71f8df1d7681 100644
>> --- a/hw/xfree86/common/xf86platformBus.c
>> +++ b/hw/xfree86/common/xf86platformBus.c
>> @@ -114,7 +114,15 @@ xf86_find_platform_device_by_devnum(int major,
>> int minor)
>>  static Bool
>>  xf86IsPrimaryPlatform(struct xf86_platform_device *plat)
>>  {
>> -    return ((primaryBus.type == BUS_PLATFORM) && (plat ==
>> primaryBus.id.plat));
>> +    if (primaryBus.type == BUS_PLATFORM)
>> +        return plat == primaryBus.id.plat;
>> +#ifdef XSERVER_LIBPCIACCESS
>> +    if (primaryBus.type == BUS_PCI)
>> +        if (plat->pdev)
>> +            if (MATCH_PCI_DEVICES(primaryBus.id.pci, plat->pdev))
>> +                return TRUE;
>> +#endif
>> +    return FALSE;
>>  }
>>
>>  static void
>>



More information about the xorg-devel mailing list