diff mbox

Enable module aliases for vio on sparc/sparc64

Message ID 570B52AE.8080603@physik.fu-berlin.de
State RFC
Delegated to: David Miller
Headers show

Commit Message

John Paul Adrian Glaubitz April 11, 2016, 7:30 a.m. UTC
Hi Dave!

We have had issues when installing Debian's sparc64 port on SPARC
machines with virtualization support. In order to be able to install
Linux into an LDOM container, both the modules sunvdc and sunvnet
need to be loaded to enable block device and networking support
within the virtual machine.

Unfortunately, these modules are never loaded automatically despite
being present and the hardware supporting it. After some discussion
in Debian's bug tracker [1], Ben Hutchings, Debian's kernel maintainer,
mentioned that this is a result of the VIO bus implementation on
sparc/sparc64 not supporting module aliases and consequently automatic
loading.

Ben has provided a minimal and dirty patch which enables aliases
for vio on sparc/sparc64, but he says the better solution would
be to merge VIO implementations on both sparc/sparc64 and PowerPC,
the latter already supporting module aliases and auto loading.

A quick hotfix as Ben suggested would be great for the time being
as it would unbreak the Debian installation within LDOMs, so
I was wondering whether you could merge the patch?

Any other suggestion?

Thanks,
Adrian

> [1] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=815977#40

Comments

David Miller April 11, 2016, 7:04 p.m. UTC | #1
From: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
Date: Mon, 11 Apr 2016 09:30:54 +0200

> Hi Dave!
> 
> We have had issues when installing Debian's sparc64 port on SPARC
> machines with virtualization support. In order to be able to install
> Linux into an LDOM container, both the modules sunvdc and sunvnet
> need to be loaded to enable block device and networking support
> within the virtual machine.
> 
> Unfortunately, these modules are never loaded automatically despite
> being present and the hardware supporting it. After some discussion
> in Debian's bug tracker [1], Ben Hutchings, Debian's kernel maintainer,
> mentioned that this is a result of the VIO bus implementation on
> sparc/sparc64 not supporting module aliases and consequently automatic
> loading.
> 
> Ben has provided a minimal and dirty patch which enables aliases
> for vio on sparc/sparc64, but he says the better solution would
> be to merge VIO implementations on both sparc/sparc64 and PowerPC,
> the latter already supporting module aliases and auto loading.
> 
> A quick hotfix as Ben suggested would be great for the time being
> as it would unbreak the Debian installation within LDOMs, so
> I was wondering whether you could merge the patch?
> 
> Any other suggestion?

Thanks for bringing this up.

Although I wonder, I was able to successfully install debian just fine
a couple years ago in LDOM guest nodes without any special changes
whatsoever.  Were there autoload hacks placed in /etc or similar
before?

Either way, I'll look at this patch, thanks.

--
To unsubscribe from this list: send the line "unsubscribe sparclinux" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
John Paul Adrian Glaubitz April 12, 2016, 9:29 a.m. UTC | #2
Hi!

On 04/11/2016 09:04 PM, David Miller wrote:
> Thanks for bringing this up.
> 
> Although I wonder, I was able to successfully install debian just fine
> a couple years ago in LDOM guest nodes without any special changes
> whatsoever.  Were there autoload hacks placed in /etc or similar
> before?

I'm not sure actually but back then you were definitely installing
Debian's sparc port (32-bit userland / 64-bit kernel) which is no
longer part of Debian.

We are now working on a new, full 64-bit SPARC port called "sparc64",
so many things are actually built from scratch. It's therefore not
unlikely that the old installer images contained some work-around
to address the problem, at least initramfs-tools contains one [1]
which is not used in the installer image, however, and people therefore
have to load the modules manually for the installation.

> Either way, I'll look at this patch, thanks.

Great, thanks a lot!

Adrian

> [1]
http://sources.debian.net/src/initramfs-tools/0.123/hook-functions/?hl=478#L478
John Paul Adrian Glaubitz April 13, 2016, 3:33 p.m. UTC | #3
On 04/11/2016 09:04 PM, David Miller wrote:
> Either way, I'll look at this patch, thanks.

Just as a heads-up:

The suggested patch does not work unfortunately. Modules are not
loaded automatically and it seems modaliases are not generated
properly.

It seems that the vio implementation for sparc which you adapted
from powerpc uses a different name to retrieve the device nodes.

Adrian
David Miller April 13, 2016, 10:23 p.m. UTC | #4
From: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
Date: Wed, 13 Apr 2016 17:33:25 +0200

> On 04/11/2016 09:04 PM, David Miller wrote:
>> Either way, I'll look at this patch, thanks.
> 
> Just as a heads-up:
> 
> The suggested patch does not work unfortunately. Modules are not
> loaded automatically and it seems modaliases are not generated
> properly.
> 
> It seems that the vio implementation for sparc which you adapted
> from powerpc uses a different name to retrieve the device nodes.

The missing bit is probably having the individual sparc64 VIO drivers
define proper module aliases.
--
To unsubscribe from this list: send the line "unsubscribe sparclinux" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
John Paul Adrian Glaubitz April 13, 2016, 10:35 p.m. UTC | #5
On 04/14/2016 12:23 AM, David Miller wrote:
> The missing bit is probably having the individual sparc64 VIO drivers
> define proper module aliases.

I'm actually currently working on a patch. The aliases are already
working, now it's just the actual hotplug handler which is missing.

Adrian
David Miller April 13, 2016, 10:36 p.m. UTC | #6
From: David Miller <davem@davemloft.net>
Date: Wed, 13 Apr 2016 18:23:49 -0400 (EDT)

> From: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
> Date: Wed, 13 Apr 2016 17:33:25 +0200
> 
>> On 04/11/2016 09:04 PM, David Miller wrote:
>>> Either way, I'll look at this patch, thanks.
>> 
>> Just as a heads-up:
>> 
>> The suggested patch does not work unfortunately. Modules are not
>> loaded automatically and it seems modaliases are not generated
>> properly.
>> 
>> It seems that the vio implementation for sparc which you adapted
>> from powerpc uses a different name to retrieve the device nodes.
> 
> The missing bit is probably having the individual sparc64 VIO drivers
> define proper module aliases.

Actually there is another, more fundamental, problem.

The VIO devices on sparc64 are not instantiated from openfirmware
device nodes.

They are instead instantiated from nodes in the machine description.

Ben's patch is therefore buggy, he's looking at the of_node but that
will never be filled in for a VIO device on sparc64.

That's why I kinda cringed when it was suggested that the PowerPC and
Sparc64 VIO stuff should be merged together.  They simply can't, as
they are instantiating devices from two different sources.

Does Debian's installer have a machine description counterpart to the
opernfirmware device probing and discovery?  I bet it doesn't, and
that seems to be the first piece of infrastructure that needs to be
added before any of this can work.
--
To unsubscribe from this list: send the line "unsubscribe sparclinux" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller April 13, 2016, 10:37 p.m. UTC | #7
From: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
Date: Thu, 14 Apr 2016 00:35:58 +0200

> On 04/14/2016 12:23 AM, David Miller wrote:
>> The missing bit is probably having the individual sparc64 VIO drivers
>> define proper module aliases.
> 
> I'm actually currently working on a patch. The aliases are already
> working, now it's just the actual hotplug handler which is missing.

Are you sure?  See my other email, VIO devices don't come from the
Openfirmware device tree at all.
--
To unsubscribe from this list: send the line "unsubscribe sparclinux" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
John Paul Adrian Glaubitz April 13, 2016, 10:44 p.m. UTC | #8
On 04/14/2016 12:37 AM, David Miller wrote:
> Are you sure?  See my other email, VIO devices don't come from the
> Openfirmware device tree at all.

Yeah, I modified Ben's patch and it works:

root@deb4g:/sys/devices/channel-devices# cat vdc*/mod*
vio:Tvdc-portSunknown
vio:Tvdc-portSunknown
vio:Tvdc-portSunknown
vio:Tvdc-portSunknown
vio:Tvdc-portSunknown
root@deb4g:/sys/devices/channel-devices#

But I need to do some more clean up. Then I'll send you a patch.

Adrian
David Miller April 13, 2016, 11:01 p.m. UTC | #9
From: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
Date: Thu, 14 Apr 2016 00:44:19 +0200

> Yeah, I modified Ben's patch and it works:
> 
> root@deb4g:/sys/devices/channel-devices# cat vdc*/mod*
> vio:Tvdc-portSunknown
> vio:Tvdc-portSunknown
> vio:Tvdc-portSunknown
> vio:Tvdc-portSunknown
> vio:Tvdc-portSunknown

Ok those are the block devices, where are the networking interfaces?
--
To unsubscribe from this list: send the line "unsubscribe sparclinux" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
John Paul Adrian Glaubitz April 13, 2016, 11:04 p.m. UTC | #10
On 04/14/2016 01:01 AM, David Miller wrote:
> Ok those are the block devices, where are the networking interfaces?

Whoops, sorry:

root@deb4g:/sys/devices/channel-devices# cat vdc*/mod*
vio:Tvdc-portSunknown
vio:Tvdc-portSunknown
vio:Tvdc-portSunknown
vio:Tvdc-portSunknown
vio:Tvdc-portSunknown
root@deb4g:/sys/devices/channel-devices#

Testing a much simpler version now. Second.
David Miller April 14, 2016, 1:52 a.m. UTC | #11
From: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
Date: Thu, 14 Apr 2016 01:04:17 +0200

> On 04/14/2016 01:01 AM, David Miller wrote:
>> Ok those are the block devices, where are the networking interfaces?
> 
> Whoops, sorry:
> 
> root@deb4g:/sys/devices/channel-devices# cat vdc*/mod*
> vio:Tvdc-portSunknown
> vio:Tvdc-portSunknown
> vio:Tvdc-portSunknown
> vio:Tvdc-portSunknown
> vio:Tvdc-portSunknown
> root@deb4g:/sys/devices/channel-devices#
> 
> Testing a much simpler version now. Second.

Those all say "vdc-port", which again is the block device.

Where are the networking devices?

--
To unsubscribe from this list: send the line "unsubscribe sparclinux" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
John Paul Adrian Glaubitz April 14, 2016, 9 a.m. UTC | #12
On 04/14/2016 03:52 AM, David Miller wrote:
>> root@deb4g:/sys/devices/channel-devices# cat vdc*/mod*
>> vio:Tvdc-portSunknown
>> vio:Tvdc-portSunknown
>> vio:Tvdc-portSunknown
>> vio:Tvdc-portSunknown
>> vio:Tvdc-portSunknown
>> root@deb4g:/sys/devices/channel-devices#
>>
>> Testing a much simpler version now. Second.
> 
> Those all say "vdc-port", which again is the block device.
> 
> Where are the networking devices?

Sigh, I shouldn't do such things in the middle of the night, sorry:

root@deb4g:/sys/devices/channel-devices# cat v*/mod*
vio:Tvdc-portS
vio:Tvdc-portS
vio:Tvdc-portS
vio:Tvdc-portS
vio:Tvdc-portS
vio:Tvlds-portS
vio:Tvnet-portS
vio:Tvnet-portS
vio:Tvnet-portS
vio:Tvnet-portS
vio:Tvnet-portS
vio:Tvnet-portS
root@deb4g:/sys/devices/channel-devices#

And, thanks for the comments on the patches. Will fix those, too.

Adrian
David Miller April 14, 2016, 4:02 p.m. UTC | #13
From: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
Date: Thu, 14 Apr 2016 11:00:41 +0200

> Sigh, I shouldn't do such things in the middle of the night, sorry:
> 
> root@deb4g:/sys/devices/channel-devices# cat v*/mod*
> vio:Tvdc-portS
> vio:Tvdc-portS
> vio:Tvdc-portS
> vio:Tvdc-portS
> vio:Tvdc-portS
> vio:Tvlds-portS
> vio:Tvnet-portS
> vio:Tvnet-portS
> vio:Tvnet-portS
> vio:Tvnet-portS
> vio:Tvnet-portS
> vio:Tvnet-portS
> root@deb4g:/sys/devices/channel-devices#

That looks a lot better.
--
To unsubscribe from this list: send the line "unsubscribe sparclinux" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

From: Ben Hutchings <ben@decadent.org.uk>
Date: Mon, 11 Apr 2016 00:30:34 +0100
Subject: sparc: vio: Add modalias attribute to support auto-loading drivers
Bug-Debian: https://bugs.debian.org/815977

Add a modalias attribute for vio devices, matching the syntax
supported by file2alias and the PowerPC vio implementation.

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
--- a/arch/sparc/kernel/vio.c
+++ b/arch/sparc/kernel/vio.c
@@ -105,9 +105,31 @@  static ssize_t type_show(struct device *dev,
 	return sprintf(buf, "%s\n", vdev->type);
 }
 
+static ssize_t modalias_show(struct device *dev, struct device_attribute *attr,
+			     char *buf)
+{
+	const struct vio_dev *vdev = to_vio_dev(dev);
+	struct device_node *dn;
+	const char *cp;
+
+	dn = dev->of_node;
+	if (!dn) {
+		strcpy(buf, "\n");
+		return strlen(buf);
+	}
+	cp = of_get_property(dn, "compatible", NULL);
+	if (!cp) {
+		strcpy(buf, "\n");
+		return strlen(buf);
+	}
+
+	return sprintf(buf, "vio:T%sS%s\n", vdev->type, cp);
+}
+
 static struct device_attribute vio_dev_attrs[] = {
 	__ATTR_RO(devspec),
 	__ATTR_RO(type),
+	__ATTR_RO(modalias),
 	__ATTR_NULL
 };