[PATCH] Fix sn_flush_device_kernel & spinlock initialization
by Prarit Bhargava
This patch fixes BZ 176827.
This patch separates the sn_flush_device_list struct into kernel and
common (both kernel and PROM accessible) structures. As it was, if the
size of a spinlock_t changed (due to additional CONFIG options, etc.) the
sal call which populated the sn_flush_device_list structs would erroneously
write data (and cause memory corruption and/or a panic).
This patch does the following:
1. Removes sn_flush_device_list and adds sn_flush_device_common and
sn_flush_device_kernel.
2. Adds a new SAL call to populate a sn_flush_device_common struct per
device, not per widget as previously done.
3. Correctly initializes each device's sn_flush_device_kernel spinlock_t
struct (before it was only doing each widget's first device).
diff -urNp fedora-orig/arch/ia64/sn/include/xtalk/hubdev.h fedora-work/arch/ia64/sn/include/xtalk/hubdev.h
--- fedora-orig/arch/ia64/sn/include/xtalk/hubdev.h 2006-01-03 10:36:41.000000000 -0500
+++ fedora-work/arch/ia64/sn/include/xtalk/hubdev.h 2006-01-03 10:37:21.000000000 -0500
@@ -26,11 +26,14 @@
#define IIO_NUM_ITTES 7
#define HUB_NUM_BIG_WINDOW (IIO_NUM_ITTES - 1)
-struct sn_flush_device_list {
+/* This struct is shared between the PROM and the kernel.
+ * Changes to this struct will require corresponding changes to the kernel.
+ */
+struct sn_flush_device_common {
int sfdl_bus;
int sfdl_slot;
int sfdl_pin;
- struct bar_list {
+ struct common_bar_list {
unsigned long start;
unsigned long end;
} sfdl_bar_list[6];
@@ -40,14 +43,19 @@ struct sn_flush_device_list {
uint32_t sfdl_persistent_busnum;
uint32_t sfdl_persistent_segment;
struct pcibus_info *sfdl_pcibus_info;
+};
+
+/* This struct is kernel only and is not used by the PROM */
+struct sn_flush_device_kernel {
spinlock_t sfdl_flush_lock;
+ struct sn_flush_device_common *common;
};
/*
- * **widget_p - Used as an array[wid_num][device] of sn_flush_device_list.
+ * **widget_p - Used as an array[wid_num][device] of sn_flush_device_kernel.
*/
struct sn_flush_nasid_entry {
- struct sn_flush_device_list **widget_p; /* Used as a array of wid_num */
+ struct sn_flush_device_kernel **widget_p; // Used as an array of wid_num
uint64_t iio_itte[8];
};
diff -urNp fedora-orig/arch/ia64/sn/kernel/io_init.c fedora-work/arch/ia64/sn/kernel/io_init.c
--- fedora-orig/arch/ia64/sn/kernel/io_init.c 2006-01-03 10:36:41.000000000 -0500
+++ fedora-work/arch/ia64/sn/kernel/io_init.c 2006-01-03 10:37:21.000000000 -0500
@@ -76,11 +76,12 @@ static struct sn_pcibus_provider sn_pci_
};
/*
- * Retrieve the DMA Flush List given nasid. This list is needed
- * to implement the WAR - Flush DMA data on PIO Reads.
+ * Retrieve the DMA Flush List given nasid, widget, and device.
+ * This list is needed to implement the WAR - Flush DMA data on PIO Reads.
*/
-static inline uint64_t
-sal_get_widget_dmaflush_list(u64 nasid, u64 widget_num, u64 address)
+static inline u64
+sal_get_device_dmaflush_list(u64 nasid, u64 widget_num, u64 device_num,
+ u64 address)
{
struct ia64_sal_retval ret_stuff;
@@ -88,17 +89,17 @@ sal_get_widget_dmaflush_list(u64 nasid,
ret_stuff.v0 = 0;
SAL_CALL_NOLOCK(ret_stuff,
- (u64) SN_SAL_IOIF_GET_WIDGET_DMAFLUSH_LIST,
- (u64) nasid, (u64) widget_num, (u64) address, 0, 0, 0,
- 0);
- return ret_stuff.v0;
+ (u64) SN_SAL_IOIF_GET_DEVICE_DMAFLUSH_LIST,
+ (u64) nasid, (u64) widget_num,
+ (u64) device_num, (u64) address, 0, 0, 0);
+ return ret_stuff.status;
}
/*
* Retrieve the hub device info structure for the given nasid.
*/
-static inline uint64_t sal_get_hubdev_info(u64 handle, u64 address)
+static inline u64 sal_get_hubdev_info(u64 handle, u64 address)
{
struct ia64_sal_retval ret_stuff;
@@ -114,7 +115,7 @@ static inline uint64_t sal_get_hubdev_in
/*
* Retrieve the pci bus information given the bus number.
*/
-static inline uint64_t sal_get_pcibus_info(u64 segment, u64 busnum, u64 address)
+static inline u64 sal_get_pcibus_info(u64 segment, u64 busnum, u64 address)
{
struct ia64_sal_retval ret_stuff;
@@ -130,7 +131,7 @@ static inline uint64_t sal_get_pcibus_in
/*
* Retrieve the pci device information given the bus and device|function number.
*/
-static inline uint64_t
+static inline u64
sal_get_pcidev_info(u64 segment, u64 bus_number, u64 devfn, u64 pci_dev,
u64 sn_irq_info)
{
@@ -170,12 +171,12 @@ sn_pcidev_info_get(struct pci_dev *dev)
*/
static void sn_fixup_ionodes(void)
{
-
- struct sn_flush_device_list *sn_flush_device_list;
+ struct sn_flush_device_kernel *sn_flush_device_kernel;
+ struct sn_flush_device_kernel *dev_entry;
struct hubdev_info *hubdev;
- uint64_t status;
- uint64_t nasid;
- int i, widget;
+ u64 status;
+ u64 nasid;
+ int i, widget, device;
/*
* Get SGI Specific HUB chipset information.
@@ -186,7 +187,7 @@ static void sn_fixup_ionodes(void)
nasid = cnodeid_to_nasid(i);
hubdev->max_segment_number = 0xffffffff;
hubdev->max_pcibus_number = 0xff;
- status = sal_get_hubdev_info(nasid, (uint64_t) __pa(hubdev));
+ status = sal_get_hubdev_info(nasid, (u64) __pa(hubdev));
if (status)
continue;
@@ -213,38 +214,49 @@ static void sn_fixup_ionodes(void)
hubdev->hdi_flush_nasid_list.widget_p =
kmalloc((HUB_WIDGET_ID_MAX + 1) *
- sizeof(struct sn_flush_device_list *), GFP_KERNEL);
-
+ sizeof(struct sn_flush_device_kernel *),
+ GFP_KERNEL);
memset(hubdev->hdi_flush_nasid_list.widget_p, 0x0,
(HUB_WIDGET_ID_MAX + 1) *
- sizeof(struct sn_flush_device_list *));
+ sizeof(struct sn_flush_device_kernel *));
for (widget = 0; widget <= HUB_WIDGET_ID_MAX; widget++) {
- sn_flush_device_list = kmalloc(DEV_PER_WIDGET *
- sizeof(struct
- sn_flush_device_list),
- GFP_KERNEL);
- memset(sn_flush_device_list, 0x0,
+ sn_flush_device_kernel = kmalloc(DEV_PER_WIDGET *
+ sizeof(struct
+ sn_flush_device_kernel),
+ GFP_KERNEL);
+ if (!sn_flush_device_kernel)
+ BUG();
+ memset(sn_flush_device_kernel, 0x0,
DEV_PER_WIDGET *
- sizeof(struct sn_flush_device_list));
+ sizeof(struct sn_flush_device_kernel));
- status =
- sal_get_widget_dmaflush_list(nasid, widget,
- (uint64_t)
- __pa
- (sn_flush_device_list));
- if (status) {
- kfree(sn_flush_device_list);
- continue;
- }
+ dev_entry = sn_flush_device_kernel;
+ for (device = 0; device < DEV_PER_WIDGET;
+ device++,dev_entry++) {
+ dev_entry->common = kmalloc(sizeof(struct
+ sn_flush_device_common),
+ GFP_KERNEL);
+ if (!dev_entry->common)
+ BUG();
+ memset(dev_entry->common, 0x0, sizeof(struct
+ sn_flush_device_common));
+
+ status = sal_get_device_dmaflush_list(nasid,
+ widget,
+ device,
+ (u64)(dev_entry->common));
+ if (status)
+ BUG();
- spin_lock_init(&sn_flush_device_list->sfdl_flush_lock);
- hubdev->hdi_flush_nasid_list.widget_p[widget] =
- sn_flush_device_list;
- }
+ spin_lock_init(&dev_entry->sfdl_flush_lock);
+ }
+ if (sn_flush_device_kernel)
+ hubdev->hdi_flush_nasid_list.widget_p[widget] =
+ sn_flush_device_kernel;
+ }
}
-
}
/*
diff -urNp fedora-orig/arch/ia64/sn/pci/pcibr/pcibr_dma.c fedora-work/arch/ia64/sn/pci/pcibr/pcibr_dma.c
--- fedora-orig/arch/ia64/sn/pci/pcibr/pcibr_dma.c 2006-01-03 10:36:41.000000000 -0500
+++ fedora-work/arch/ia64/sn/pci/pcibr/pcibr_dma.c 2006-01-03 10:37:21.000000000 -0500
@@ -218,7 +218,9 @@ void sn_dma_flush(uint64_t addr)
uint64_t flags;
uint64_t itte;
struct hubdev_info *hubinfo;
- volatile struct sn_flush_device_list *p;
+ volatile struct sn_flush_device_kernel *p;
+ volatile struct sn_flush_device_common *common;
+
struct sn_flush_nasid_entry *flush_nasid_list;
if (!sn_ioif_inited)
@@ -268,17 +270,17 @@ void sn_dma_flush(uint64_t addr)
p = &flush_nasid_list->widget_p[wid_num][0];
/* find a matching BAR */
- for (i = 0; i < DEV_PER_WIDGET; i++) {
+ for (i = 0; i < DEV_PER_WIDGET; i++,p++) {
+ common = p->common;
for (j = 0; j < PCI_ROM_RESOURCE; j++) {
- if (p->sfdl_bar_list[j].start == 0)
+ if (common->sfdl_bar_list[j].start == 0)
break;
- if (addr >= p->sfdl_bar_list[j].start
- && addr <= p->sfdl_bar_list[j].end)
+ if (addr >= common->sfdl_bar_list[j].start
+ && addr <= common->sfdl_bar_list[j].end)
break;
}
- if (j < PCI_ROM_RESOURCE && p->sfdl_bar_list[j].start != 0)
+ if (j < PCI_ROM_RESOURCE && common->sfdl_bar_list[j].start != 0)
break;
- p++;
}
/* if no matching BAR, return without doing anything. */
@@ -304,24 +306,24 @@ void sn_dma_flush(uint64_t addr)
if ((1 << XWIDGET_PART_REV_NUM_REV(revnum)) & PV907516) {
return;
} else {
- pcireg_wrb_flush_get(p->sfdl_pcibus_info,
- (p->sfdl_slot - 1));
+ pcireg_wrb_flush_get(common->sfdl_pcibus_info,
+ (common->sfdl_slot - 1));
}
} else {
- spin_lock_irqsave(&((struct sn_flush_device_list *)p)->
- sfdl_flush_lock, flags);
-
- *p->sfdl_flush_addr = 0;
+ spin_lock_irqsave((spinlock_t *)&p->sfdl_flush_lock,
+ flags);
+ *common->sfdl_flush_addr = 0;
/* force an interrupt. */
- *(volatile uint32_t *)(p->sfdl_force_int_addr) = 1;
+ *(volatile uint32_t *)(common->sfdl_force_int_addr) = 1;
/* wait for the interrupt to come back. */
- while (*(p->sfdl_flush_addr) != 0x10f)
+ while (*(common->sfdl_flush_addr) != 0x10f)
cpu_relax();
/* okay, everything is synched up. */
- spin_unlock_irqrestore((spinlock_t *)&p->sfdl_flush_lock, flags);
+ spin_unlock_irqrestore((spinlock_t *)&p->sfdl_flush_lock,
+ flags);
}
return;
}
diff -urNp fedora-orig/arch/ia64/sn/pci/pcibr/pcibr_provider.c fedora-work/arch/ia64/sn/pci/pcibr/pcibr_provider.c
--- fedora-orig/arch/ia64/sn/pci/pcibr/pcibr_provider.c 2006-01-03 10:36:41.000000000 -0500
+++ fedora-work/arch/ia64/sn/pci/pcibr/pcibr_provider.c 2006-01-03 10:37:21.000000000 -0500
@@ -92,7 +92,8 @@ pcibr_bus_fixup(struct pcibus_bussoft *p
cnodeid_t near_cnode;
struct hubdev_info *hubdev_info;
struct pcibus_info *soft;
- struct sn_flush_device_list *sn_flush_device_list;
+ struct sn_flush_device_kernel *sn_flush_device_kernel;
+ struct sn_flush_device_common *common;
if (! IS_PCI_BRIDGE_ASIC(prom_bussoft->bs_asic_type)) {
return NULL;
@@ -137,20 +138,19 @@ pcibr_bus_fixup(struct pcibus_bussoft *p
hubdev_info = (struct hubdev_info *)(NODEPDA(cnode)->pdinfo);
if (hubdev_info->hdi_flush_nasid_list.widget_p) {
- sn_flush_device_list = hubdev_info->hdi_flush_nasid_list.
+ sn_flush_device_kernel = hubdev_info->hdi_flush_nasid_list.
widget_p[(int)soft->pbi_buscommon.bs_xid];
- if (sn_flush_device_list) {
+ if (sn_flush_device_kernel) {
for (j = 0; j < DEV_PER_WIDGET;
- j++, sn_flush_device_list++) {
- if (sn_flush_device_list->sfdl_slot == -1)
+ j++, sn_flush_device_kernel++) {
+ common = sn_flush_device_kernel->common;
+ if (common->sfdl_slot == -1)
continue;
- if ((sn_flush_device_list->
- sfdl_persistent_segment ==
+ if ((common->sfdl_persistent_segment ==
soft->pbi_buscommon.bs_persist_segment) &&
- (sn_flush_device_list->
- sfdl_persistent_busnum ==
+ (common->sfdl_persistent_busnum ==
soft->pbi_buscommon.bs_persist_busnum))
- sn_flush_device_list->sfdl_pcibus_info =
+ common->sfdl_pcibus_info =
soft;
}
}
diff -urNp fedora-orig/include/asm-ia64/sn/sn_sal.h fedora-work/include/asm-ia64/sn/sn_sal.h
--- fedora-orig/include/asm-ia64/sn/sn_sal.h 2006-01-03 10:36:41.000000000 -0500
+++ fedora-work/include/asm-ia64/sn/sn_sal.h 2006-01-03 10:37:21.000000000 -0500
@@ -75,7 +75,8 @@
#define SN_SAL_IOIF_GET_HUBDEV_INFO 0x02000055
#define SN_SAL_IOIF_GET_PCIBUS_INFO 0x02000056
#define SN_SAL_IOIF_GET_PCIDEV_INFO 0x02000057
-#define SN_SAL_IOIF_GET_WIDGET_DMAFLUSH_LIST 0x02000058
+#define SN_SAL_IOIF_GET_WIDGET_DMAFLUSH_LIST 0x02000058 // deprecated
+#define SN_SAL_IOIF_GET_DEVICE_DMAFLUSH_LIST 0x0200005a
#define SN_SAL_HUB_ERROR_INTERRUPT 0x02000060
#define SN_SAL_BTE_RECOVER 0x02000061
18 years, 4 months
Fedora general improvements input survey invitation
by Tim Burke
The Fedora Core team invites you to participate in a survey to help
identify the major ways in which Fedora can be improved for the benefit
of the community. The survey consists of 10 questions involving Fedora
Core and Fedora Extras. We are greatly interested in your views and
hope you can share your thoughts with us. The survey is available at:
http://www.keysurvey.com/survey/85928/1078/
The survey is enabled now and will remain open for input until
Wednesday, November 30.
Thanks in advance for helping us to make Fedora better for all
involved. Upon conclusion of the survey, a summary of the results will
be shared.
18 years, 4 months
Palm sync status?
by David
Hi,
I just bought a Treo 650 and was looking for info about how to use it with
FC4 when I found a posting which says FC4 is "completely broken with respect
to Palm syncronization". Is this supposed to be addressed in FC5, or should
I "downgrade" to FC3? Has anybody synced a Treo with Evolution in
FC5-test1? I asked this message on fedora-list and somebody responded
saying that there was a discussion on this list. But I haven't been able to
find anything definitive that says whether FC5 is supposed to fix the FC4
syncing problems. Does anyone know? Will I be able to sync a Treo 650 with
evolution?
Thanks...
David
_________________________________________________________________
Dont just search. Find. Check out the new MSN Search!
http://search.msn.click-url.com/go/onm00200636ave/direct/01/
18 years, 4 months
Mirrors list needs to be livened up.
by Eric Wood
I've wondered about this for years. I'v already emailed
ftp+fedora(a)redhat.com about this idea.
The mirrors list (http://fedora.redhat.com/Download/mirrors.html) could
be livened up with some sortable stat columns (by country) showing:
1. Link Up/Down
2. Bandwidth
3. Mirrors the FC1,2,3,4,5... Development,etc. directories.
4. The Latest Dev Build Date/Has Lastest Updates
5. Days out of date for each of the sections.
6. Maybe even a torrent seed.
People come and go and they typically *want* to use a mirror if they
could just get a good recomendation of one. I'm just saying that the
mirror pages could be made much more useful.
-eric wood
18 years, 4 months
FC5 and Yum Plugins
by Brian Long (brilong)
I was wondering what folks thought about including a few yum plugins
out-of-the-box on FC5. I've got a MythTV setup a home running FC4, but
I add ATRPMS and FreshRPMs repos to be able to easily install MythTV and
satisfy its requirements. I believe other users of Fedora are in the
same boat; we have to use third-party repos but we don't want them ever
overriding Fedora RPMs.
I've manually installed the "protectbase" and "fastestmirror" plugins
from the yum-utils tarball (they are not included in the yum-utils RPM
or subpackages yet).
I would think installing protectbase by default on FC5 and protecting
all Fedora official repos would be excellent. I added protect=1 to
fedora.repo, fedora-updates.repo and fedora-extras.repo after making
sure the plugin was enabled and yum.conf had "plugins=1". This allows
me to run the following command without AtRPMS changing any RPMs that
are included in [base], [updates] or [extras]:
yum --enablerepo=atrpms --enablerepo=freshrpms update
Normally, I have atrpms and freshrpms disabled; base, updates and extras
are enabled. Without protectbase installed, atrpms wants to provide
updates to xorg-X11 and various other packages which I don't want.
However, it provides a bunch of MythTV updates I do want (about 30 RPMs
or so). Since I don't want to iterate manually through all the MythTV
updates, I find protectbase a good compromise.
I would think it would be in the best interest of the Fedora team to
install protectbase by default, enable it and protect Fedora repos. If
power users want to disable it, it's very easy.
Am I off-base in this request? :)
/Brian/
--
Brian Long | | |
IT Data Center Systems | .|||. .|||.
Cisco Linux Developer | ..:|||||||:...:|||||||:..
Phone: (919) 392-7363 | C i s c o S y s t e m s
18 years, 4 months
Fedora meeting Mono Half-Way
by Benjy Grogan
Hello:
I know this topic has been mentioned over and over, and everyone is
irritated by it. But why not meet the Mono project half-way? Why can't the
hal-sharp and the dbus-sharp, and gtk-sharp add-ons be included in the
fedora packages?
At the moment Fedora seems to want absolutely nothing to do with Mono. Why
not try to go a little farther and include mono interfaces to dbus, hal,
gnome, etc. This means that if someone does install Mono then all the
system libraries are ready to do some C# programming. And if a user doesn't
install Mono, then the interfaces will lie there useless.
Look at it this way, Fedora should try to do the smallest amount possible to
embrace Mono. Make it easier on the repositories that do include Mono, so
that if I want to install Beagle or F-Spot, I can leave the system libraries
on Fedora alone.
There are some killer-apps built using Mono. Fedora should get cheeky and
see what they can get away.
Benjy
18 years, 4 months
Re: FC5 and Yum Plugins
by Horst H. von Brand
Axel Thimm <Axel.Thimm(a)ATrpms.net> wrote:
[...]
> No, seriously. I guess you are a victim of this FUD just like many
> other people, too. There really isn't any correlation between a
> package being replaced/updated and having more bugs for this packages.
Humm... I'd guess you update /because/ there are unfixed bugs in the
vanilla version, so... ;-)
OTOH, I was burned some time back the other way around: On my x86_64 the
kernel wouldn't boot. So (on the suggestion of LKML) I went and tried a
bisection search for the patch which broke the kernel... but it was Fedora
optimizing the kernel for size, which Linus' configuration didn't do. Lots
of wasted time there.
--
Dr. Horst H. von Brand User #22616 counter.li.org
Departamento de Informatica Fono: +56 32 654431
Universidad Tecnica Federico Santa Maria +56 32 654239
Casilla 110-V, Valparaiso, Chile Fax: +56 32 797513
18 years, 4 months
http://conky.sourceforge.net/
by Igor Jagec
http://conky.sourceforge.net/
Seems great monitoring program, but I can't compile it :-/ If it is
stable, it would be very nice if you include it into Fedora Extras. If
someone knows for some rpm package for Fedora, just let me know.
Cheers!
--
Igor Jagec
18 years, 4 months