View Issue Details

IDProjectCategoryView StatusLast Update
0001399channel: elrepo/el8public2024-03-26 16:04
Reportertqhoang Assigned Totqhoang  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Platformx86_64OSRocky LinuxOS Version8.8
Summary0001399: kmod-sata_sis is not adding module symlink to weak-updates folder
DescriptionI did a bulk "dnf install kmod-pata* kmod-sata*" onto a test machine and noticed that the sata_sis module was not symlinked under the "weak-updates" folder.

I manually created the weak-updates symlink and ran depmod. When I ran "modprobe sata_sis" it printed the following error to the console and dmesg.

    sata_sis: no symbol version for sis_info133_for_sata

Also inside the modules.dep file, the sata_sis has a dependency on pata_sis. Is this somehow related to why the symlink is failing to be installed? Does sata_sis need to always be rebuilt against the same kernel as pata_sis (i.e. el8_8)?
TagsNo tags attached.

Activities

tqhoang

2023-10-25 13:23

developer   ~0009398

Sorry, I mistakenly put this under EL7.

Can an admin change this to EL8 and kmod-sata_sis?

toracat

2023-10-25 13:30

administrator   ~0009399

Moved.

toracat

2023-10-25 13:36

administrator   ~0009400

Yes, I think we need to rebuild those kmods for el8_7 against the el8.8 kernel.

toracat

2023-10-25 17:54

administrator   ~0009401

The following packages have been released:

kmod-sata_sis-1.0-9.el8_8.elrepo.x86_64.rpm
kmod-sata_via-2.6-6.el8_8.elrepo.x86_64.rpm

Strangely, they were built together with other kmod-sata packages for el8_8 but somehow were not released to the repo at that time.

tqhoang

2023-10-26 10:53

developer   ~0009405

The updated kmod packages install fine, but the sata_sis still has a problem with the "weak-modules" script. It does not get put into the "weak-updates" folder of any errata kernels, so rebooting to an errata kernel will break.

Ex: echo /lib/modules/4.18.0-477.10.1.el8_8.x86_64/extra/sata_sis/sata_sis.ko | weak-modules --dry-run --verbose --add-modules --no-initramfs

FWIW, the problem is similar to this Red Hat KB article. https://access.redhat.com/solutions/6541701
Note: Re-running the "weak-modules" script does not fix the problem though.

So I made this patch to effectively duplicate the bits from pata_sis.c and put them directly into sata_sis.c...renaming "sis_info133_for_sata" to "sis_info133_for_sata_only". The sata_sis.ko no longer depends on pata_sis.ko and now works correctly with the "weak-modules" script.

Please let me know what you think. I suspect the same would need to be done for an EL9 kmod.
sata_sis-workaround-missing-symbol-version-el8.patch (5,613 bytes)   
diff -Naurp drivers-ata.orig/sata_sis.c drivers-ata.fixsym/sata_sis.c
--- drivers-ata.orig/sata_sis.c	2023-04-05 12:44:47.000000000 -0400
+++ drivers-ata.fixsym/sata_sis.c	2023-10-26 09:54:37.755369028 -0400
@@ -112,6 +112,178 @@ MODULE_LICENSE("GPL");
 MODULE_DEVICE_TABLE(pci, sis_pci_tbl);
 MODULE_VERSION(DRV_VERSION);
 
+/*
+ *    BEGIN - SiS ATA common structs and functions from pata_sis.c
+ */
+struct sis_laptop {
+	u16 device;
+	u16 subvendor;
+	u16 subdevice;
+};
+
+static const struct sis_laptop sis_laptop[] = {
+	/* devid, subvendor, subdev */
+	{ 0x5513, 0x1043, 0x1107 },	/* ASUS A6K */
+	{ 0x5513, 0x1734, 0x105F },	/* FSC Amilo A1630 */
+	{ 0x5513, 0x1071, 0x8640 },	/* EasyNote K5305 */
+	/* end marker */
+	{ 0, }
+};
+
+static int sis_short_ata40(struct pci_dev *dev)
+{
+	const struct sis_laptop *lap = &sis_laptop[0];
+
+	while (lap->device) {
+		if (lap->device == dev->device &&
+		    lap->subvendor == dev->subsystem_vendor &&
+		    lap->subdevice == dev->subsystem_device)
+			return 1;
+		lap++;
+	}
+
+	return 0;
+}
+
+static int sis_port_base(struct ata_device *adev)
+{
+	struct ata_port *ap = adev->link->ap;
+	struct pci_dev *pdev = to_pci_dev(ap->host->dev);
+	int port = 0x40;
+	u32 reg54;
+
+	/* If bit 30 is set then the registers are mapped at 0x70 not 0x40 */
+	pci_read_config_dword(pdev, 0x54, &reg54);
+	if (reg54 & 0x40000000)
+		port = 0x70;
+
+	return port + (8 * ap->port_no) + (4 * adev->devno);
+}
+
+static int sis_133_cable_detect(struct ata_port *ap)
+{
+	struct pci_dev *pdev = to_pci_dev(ap->host->dev);
+	u16 tmp;
+
+	/* The top bit of this register is the cable detect bit */
+	pci_read_config_word(pdev, 0x50 + 2 * ap->port_no, &tmp);
+	if ((tmp & 0x8000) && !sis_short_ata40(pdev))
+		return ATA_CBL_PATA40;
+	return ATA_CBL_PATA80;
+}
+
+static void sis_set_fifo(struct ata_port *ap, struct ata_device *adev)
+{
+	struct pci_dev *pdev = to_pci_dev(ap->host->dev);
+	u8 fifoctrl;
+	u8 mask = 0x11;
+
+	mask <<= (2 * ap->port_no);
+	mask <<= adev->devno;
+
+	/* This holds various bits including the FIFO control */
+	pci_read_config_byte(pdev, 0x4B, &fifoctrl);
+	fifoctrl &= ~mask;
+
+	/* Enable for ATA (disk) only */
+	if (adev->class == ATA_DEV_ATA)
+		fifoctrl |= mask;
+	pci_write_config_byte(pdev, 0x4B, fifoctrl);
+}
+
+static void sis_133_set_piomode (struct ata_port *ap, struct ata_device *adev)
+{
+	struct pci_dev *pdev = to_pci_dev(ap->host->dev);
+	int port;
+	u32 t1;
+	int speed = adev->pio_mode - XFER_PIO_0;
+
+	static const u32 timing133[] = {
+		0x28269000,	/* Recovery << 24 | Act << 16 | Ini << 12 */
+		0x0C266000,
+		0x04263000,
+		0x0C0A3000,
+		0x05093000
+	};
+	static const u32 timing100[] = {
+		0x1E1C6000,	/* Recovery << 24 | Act << 16 | Ini << 12 */
+		0x091C4000,
+		0x031C2000,
+		0x09072000,
+		0x04062000
+	};
+
+	sis_set_fifo(ap, adev);
+
+	port = sis_port_base(adev);
+	pci_read_config_dword(pdev, port, &t1);
+	t1 &= 0xC0C00FFF;	/* Mask out timing */
+
+	if (t1 & 0x08)		/* 100 or 133 ? */
+		t1 |= timing133[speed];
+	else
+		t1 |= timing100[speed];
+	pci_write_config_byte(pdev, port, t1);
+}
+
+static void sis_133_set_dmamode (struct ata_port *ap, struct ata_device *adev)
+{
+	struct pci_dev *pdev = to_pci_dev(ap->host->dev);
+	int port;
+	u32 t1;
+
+	port = sis_port_base(adev);
+	pci_read_config_dword(pdev, port, &t1);
+
+	if (adev->dma_mode < XFER_UDMA_0) {
+		/* Recovery << 24 | Act << 16 | Ini << 12, like PIO modes */
+		static const u32 timing_u100[] = { 0x19154000, 0x06072000, 0x04062000 };
+		static const u32 timing_u133[] = { 0x221C6000, 0x0C0A3000, 0x05093000 };
+		int speed = adev->dma_mode - XFER_MW_DMA_0;
+
+		t1 &= 0xC0C00FFF;
+		/* disable UDMA */
+		t1 &= ~0x00000004;
+		if (t1 & 0x08)
+			t1 |= timing_u133[speed];
+		else
+			t1 |= timing_u100[speed];
+	} else {
+		/* bits 4- cycle time 8 - cvs time */
+		static const u32 timing_u100[] = { 0x6B0, 0x470, 0x350, 0x140, 0x120, 0x110, 0x000 };
+		static const u32 timing_u133[] = { 0x9F0, 0x6A0, 0x470, 0x250, 0x230, 0x220, 0x210 };
+		int speed = adev->dma_mode - XFER_UDMA_0;
+
+		t1 &= ~0x00000FF0;
+		/* enable UDMA */
+		t1 |= 0x00000004;
+		if (t1 & 0x08)
+			t1 |= timing_u133[speed];
+		else
+			t1 |= timing_u100[speed];
+	}
+	pci_write_config_dword(pdev, port, t1);
+}
+
+static struct ata_port_operations sis_133_for_sata_ops = {
+	.inherits		= &ata_bmdma_port_ops,
+	.set_piomode		= sis_133_set_piomode,
+	.set_dmamode		= sis_133_set_dmamode,
+	.cable_detect		= sis_133_cable_detect,
+};
+
+static const struct ata_port_info sis_info133_for_sata_only = {
+	.flags		= ATA_FLAG_SLAVE_POSS,
+	.pio_mask	= ATA_PIO4,
+	/* No MWDMA */
+	.udma_mask	= ATA_UDMA6,
+	.port_ops	= &sis_133_for_sata_ops,
+};
+
+/*
+ *    END - SiS ATA common structs and functions from pata_sis.c
+ */
+
 static unsigned int get_scr_cfg_addr(struct ata_link *link, unsigned int sc_reg)
 {
 	struct ata_port *ap = link->ap;
@@ -234,11 +406,11 @@ static int sis_init_one(struct pci_dev *
 		/* The PATA-handling is provided by pata_sis */
 		switch (pmr & 0x30) {
 		case 0x10:
-			ppi[1] = &sis_info133_for_sata;
+			ppi[1] = &sis_info133_for_sata_only;
 			break;
 
 		case 0x30:
-			ppi[0] = &sis_info133_for_sata;
+			ppi[0] = &sis_info133_for_sata_only;
 			break;
 		}
 		if ((pmr & SIS_PMR_COMBINED) == 0) {
@@ -273,8 +445,8 @@ static int sis_init_one(struct pci_dev *
 	case 0x1183:
 		dev_info(&pdev->dev,
 			 "Detected SiS 1183/966/966L/968/680 controller in PATA mode\n");
-		ppi[0] = &sis_info133_for_sata;
-		ppi[1] = &sis_info133_for_sata;
+		ppi[0] = &sis_info133_for_sata_only;
+		ppi[1] = &sis_info133_for_sata_only;
 		break;
 	}
 

toracat

2023-10-26 12:40

administrator   ~0009408

Thank you for the detailed analysis and the patch to fix the issue. We will look through the details and release an updated version of the kmod.

tqhoang

2023-10-26 19:20

developer   ~0009410

I revised the patch to be a little cleaner.
- remove include "sis.h"
- revert "sis_info133_for_sata_only" back to "sis_info133_for_sata"

Also I compared the EL8.8 and EL9.2 sources and this patch works for both.
Note: I tested by making a kmod-sata_sis for EL9.2.
sata_sis-workaround-missing-symbol-version-el8-el9.patch (5,057 bytes)   
diff -Naurp drivers-ata.orig/sata_sis.c drivers-ata.fixsym/sata_sis.c
--- drivers-ata.orig/sata_sis.c	2023-04-05 12:44:47.000000000 -0400
+++ drivers-ata.fixsym/sata_sis.c	2023-10-26 18:49:21.211953012 -0400
@@ -39,7 +39,6 @@
 #include <linux/device.h>
 #include <scsi/scsi_host.h>
 #include <linux/libata.h>
-#include "sis.h"
 
 #define DRV_NAME	"sata_sis"
 #define DRV_VERSION	"1.0"
@@ -112,6 +111,177 @@ MODULE_LICENSE("GPL");
 MODULE_DEVICE_TABLE(pci, sis_pci_tbl);
 MODULE_VERSION(DRV_VERSION);
 
+/*
+ *    BEGIN - SiS ATA common structs and functions from pata_sis.c
+ */
+struct sis_laptop {
+	u16 device;
+	u16 subvendor;
+	u16 subdevice;
+};
+
+static const struct sis_laptop sis_laptop[] = {
+	/* devid, subvendor, subdev */
+	{ 0x5513, 0x1043, 0x1107 },	/* ASUS A6K */
+	{ 0x5513, 0x1734, 0x105F },	/* FSC Amilo A1630 */
+	{ 0x5513, 0x1071, 0x8640 },	/* EasyNote K5305 */
+	/* end marker */
+	{ 0, }
+};
+
+static int sis_short_ata40(struct pci_dev *dev)
+{
+	const struct sis_laptop *lap = &sis_laptop[0];
+
+	while (lap->device) {
+		if (lap->device == dev->device &&
+		    lap->subvendor == dev->subsystem_vendor &&
+		    lap->subdevice == dev->subsystem_device)
+			return 1;
+		lap++;
+	}
+
+	return 0;
+}
+
+static int sis_port_base(struct ata_device *adev)
+{
+	struct ata_port *ap = adev->link->ap;
+	struct pci_dev *pdev = to_pci_dev(ap->host->dev);
+	int port = 0x40;
+	u32 reg54;
+
+	/* If bit 30 is set then the registers are mapped at 0x70 not 0x40 */
+	pci_read_config_dword(pdev, 0x54, &reg54);
+	if (reg54 & 0x40000000)
+		port = 0x70;
+
+	return port + (8 * ap->port_no) + (4 * adev->devno);
+}
+
+static int sis_133_cable_detect(struct ata_port *ap)
+{
+	struct pci_dev *pdev = to_pci_dev(ap->host->dev);
+	u16 tmp;
+
+	/* The top bit of this register is the cable detect bit */
+	pci_read_config_word(pdev, 0x50 + 2 * ap->port_no, &tmp);
+	if ((tmp & 0x8000) && !sis_short_ata40(pdev))
+		return ATA_CBL_PATA40;
+	return ATA_CBL_PATA80;
+}
+
+static void sis_set_fifo(struct ata_port *ap, struct ata_device *adev)
+{
+	struct pci_dev *pdev = to_pci_dev(ap->host->dev);
+	u8 fifoctrl;
+	u8 mask = 0x11;
+
+	mask <<= (2 * ap->port_no);
+	mask <<= adev->devno;
+
+	/* This holds various bits including the FIFO control */
+	pci_read_config_byte(pdev, 0x4B, &fifoctrl);
+	fifoctrl &= ~mask;
+
+	/* Enable for ATA (disk) only */
+	if (adev->class == ATA_DEV_ATA)
+		fifoctrl |= mask;
+	pci_write_config_byte(pdev, 0x4B, fifoctrl);
+}
+
+static void sis_133_set_piomode (struct ata_port *ap, struct ata_device *adev)
+{
+	struct pci_dev *pdev = to_pci_dev(ap->host->dev);
+	int port;
+	u32 t1;
+	int speed = adev->pio_mode - XFER_PIO_0;
+
+	static const u32 timing133[] = {
+		0x28269000,	/* Recovery << 24 | Act << 16 | Ini << 12 */
+		0x0C266000,
+		0x04263000,
+		0x0C0A3000,
+		0x05093000
+	};
+	static const u32 timing100[] = {
+		0x1E1C6000,	/* Recovery << 24 | Act << 16 | Ini << 12 */
+		0x091C4000,
+		0x031C2000,
+		0x09072000,
+		0x04062000
+	};
+
+	sis_set_fifo(ap, adev);
+
+	port = sis_port_base(adev);
+	pci_read_config_dword(pdev, port, &t1);
+	t1 &= 0xC0C00FFF;	/* Mask out timing */
+
+	if (t1 & 0x08)		/* 100 or 133 ? */
+		t1 |= timing133[speed];
+	else
+		t1 |= timing100[speed];
+	pci_write_config_byte(pdev, port, t1);
+}
+
+static void sis_133_set_dmamode (struct ata_port *ap, struct ata_device *adev)
+{
+	struct pci_dev *pdev = to_pci_dev(ap->host->dev);
+	int port;
+	u32 t1;
+
+	port = sis_port_base(adev);
+	pci_read_config_dword(pdev, port, &t1);
+
+	if (adev->dma_mode < XFER_UDMA_0) {
+		/* Recovery << 24 | Act << 16 | Ini << 12, like PIO modes */
+		static const u32 timing_u100[] = { 0x19154000, 0x06072000, 0x04062000 };
+		static const u32 timing_u133[] = { 0x221C6000, 0x0C0A3000, 0x05093000 };
+		int speed = adev->dma_mode - XFER_MW_DMA_0;
+
+		t1 &= 0xC0C00FFF;
+		/* disable UDMA */
+		t1 &= ~0x00000004;
+		if (t1 & 0x08)
+			t1 |= timing_u133[speed];
+		else
+			t1 |= timing_u100[speed];
+	} else {
+		/* bits 4- cycle time 8 - cvs time */
+		static const u32 timing_u100[] = { 0x6B0, 0x470, 0x350, 0x140, 0x120, 0x110, 0x000 };
+		static const u32 timing_u133[] = { 0x9F0, 0x6A0, 0x470, 0x250, 0x230, 0x220, 0x210 };
+		int speed = adev->dma_mode - XFER_UDMA_0;
+
+		t1 &= ~0x00000FF0;
+		/* enable UDMA */
+		t1 |= 0x00000004;
+		if (t1 & 0x08)
+			t1 |= timing_u133[speed];
+		else
+			t1 |= timing_u100[speed];
+	}
+	pci_write_config_dword(pdev, port, t1);
+}
+
+static struct ata_port_operations sis_133_for_sata_ops = {
+	.inherits		= &ata_bmdma_port_ops,
+	.set_piomode		= sis_133_set_piomode,
+	.set_dmamode		= sis_133_set_dmamode,
+	.cable_detect		= sis_133_cable_detect,
+};
+
+static const struct ata_port_info sis_info133_for_sata = {
+	.flags		= ATA_FLAG_SLAVE_POSS,
+	.pio_mask	= ATA_PIO4,
+	/* No MWDMA */
+	.udma_mask	= ATA_UDMA6,
+	.port_ops	= &sis_133_for_sata_ops,
+};
+/*
+ *    END - SiS ATA common structs and functions from pata_sis.c
+ */
+
 static unsigned int get_scr_cfg_addr(struct ata_link *link, unsigned int sc_reg)
 {
 	struct ata_port *ap = link->ap;

toracat

2023-10-26 20:27

administrator   ~0009411

Thank you for the updated version of the patch.

tqhoang

2023-11-17 09:31

developer   ~0009437

Resolved with kmod-sata_sis-1.0-11.el8_8.elrepo.x86_64.rpm

Issue History

Date Modified Username Field Change
2023-10-25 13:21 tqhoang New Issue
2023-10-25 13:21 tqhoang Status new => assigned
2023-10-25 13:21 tqhoang Assigned To => pperry
2023-10-25 13:23 tqhoang Note Added: 0009398
2023-10-25 13:30 toracat Project channel: elrepo/el7 => channel: elrepo/el8
2023-10-25 13:30 toracat Category kmod-sis900 => General
2023-10-25 13:30 toracat Note Added: 0009399
2023-10-25 13:36 toracat Note Added: 0009400
2023-10-25 17:54 toracat Assigned To pperry => toracat
2023-10-25 17:54 toracat Category General =>
2023-10-25 17:54 toracat Note Added: 0009401
2023-10-26 10:53 tqhoang Note Added: 0009405
2023-10-26 10:53 tqhoang File Added: sata_sis-workaround-missing-symbol-version-el8.patch
2023-10-26 12:40 toracat Note Added: 0009408
2023-10-26 19:20 tqhoang Note Added: 0009410
2023-10-26 19:20 tqhoang File Added: sata_sis-workaround-missing-symbol-version-el8-el9.patch
2023-10-26 20:27 toracat Note Added: 0009411
2023-11-14 16:58 toracat Assigned To toracat => tqhoang
2023-11-17 09:31 tqhoang Note Added: 0009437
2023-11-17 09:32 tqhoang Status assigned => resolved
2023-11-17 09:32 tqhoang Resolution open => fixed
2024-03-26 16:04 tqhoang Status resolved => closed