Skip to contentSkip to conversation

hptiop: HighPoint RocketRAID 3xxx controller driver

PATCH HighPoint Linux Team 3 participants 4 messages May 15, 2006 1 message not in the archive SCSI

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

Could you give more explanation about pci posting flush? When (and why) do we need it?
In an old posting (http://lkml.org/lkml/2003/5/8/278) said pci posting flush is unnecessary - is it correct?

Thanks.

Quoted 50 lines
Quoted 4 lines

+ }
+
+ if (req != IOPMU_QUEUE_EMPTY) {

+ writel(req, &iop->outbound_queue);

does this need a PCI posting flush?

Quoted 19 lines
(quoted diff) +15 -0
+
+static int iop_send_sync_msg(struct hptiop_hba * hba, u32 msg, u32 
+millisec) {
+ u32 i;
+
+ hba->msg_done = 0;
+
+ writel(msg, &hba->iop->inbound_msgaddr0);
+
+ for (i = 0; i < millisec; i++) {
+  __iop_intr(hba);
+  if (hba->msg_done)
+   break;
+  mdelay(1);
+ }

and here, but here you're very clearly missing a pci posting flush

+ else

Review

Quoted 4 lines
(quoted diff) +4 -0
+  arg->result = HPT_IOCTL_RESULT_FAILED;
+
+ arg->done(arg);
+ writel(tag, &hba->iop->outbound_queue); }

this looks like it needs a posting flush again

Review

Quoted 4 lines

+ memcpy(req->cdb, scp->cmnd, sizeof(req->cdb));

(quoted diff) +3 -0
+
+ writel(IOPMU_QUEUE_ADDR_HOST_BIT | _req->req_shifted_phy,
+   &hba->iop->inbound_queue);

this needs pci posting flush

Review

Quoted 7 lines
(quoted diff) +7 -0
+
+static int hptiop_reset_hba(struct hptiop_hba * hba) {  if 
+(atomic_xchg(&hba->resetting, 1) == 0) {
+  atomic_inc(&hba->reset_count);
+  writel(IOPMU_INBOUND_MSG0_RESET,
+    &hba->iop->outbound_msgaddr0);
+ }

this needs a pci posting flush

#2 lore raw
Quoted 1 line · HighPoint Linux Team

Could you give more explanation about pci posting flush? When (and why) do we need it?

pci posting is where the chipset internally delays (posts) writes (as done by writel and such) to see if more writes will come that can then be combined into one burst. While in practice these queues are finite (and often have a timeout) it's bad practice to depend on that. The simplest way to flush out this posting is to do a (dummy) readl() from the same device. (alternative is to do dma from the device to ram, but readl() is a lot easier ;)

Quoted 1 line

In an old posting (http://lkml.org/lkml/2003/5/8/278) said pci posting flush is unnecessary - is it correct?

no not really, not as a general statement.

#3 lore raw
Quoted 11 lines · Arjan van de Ven
Quoted 1 line · HighPoint Linux Team

Could you give more explanation about pci posting flush? When (and why) do we need it?

pci posting is where the chipset internally delays (posts) writes (as done by writel and such) to see if more writes will come that can then be combined into one burst. While in practice these queues are finite (and often have a timeout) it's bad practice to depend on that. The simplest way to flush out this posting is to do a (dummy) readl() from the same device. (alternative is to do dma from the device to ram, but readl() is a lot easier ;)

Quoted 3 lines
Quoted 1 line

In an old posting (http://lkml.org/lkml/2003/5/8/278) said pci posting flush is unnecessary - is it correct?

no not really, not as a general statement.

ACK.

Generally speaking, readl() is the best way to ensure that all writes have been flushed across various layers of PCI bridges, etc.

It is particularly important to get this right if you are issuing a delay (i.e. udelay) after a write. If the write is not guaranteed to be flushed at the time the delay begins, then you are no longer truly delaying for the time requested.

Jeff

#4 lore raw
Quoted 18 lines · Jeff Garzik
Quoted 11 lines · Arjan van de Ven
Quoted 1 line · HighPoint Linux Team

Could you give more explanation about pci posting flush? When (and why) do we need it?

pci posting is where the chipset internally delays (posts) writes (as done by writel and such) to see if more writes will come that can then be combined into one burst. While in practice these queues are finite (and often have a timeout) it's bad practice to depend on that. The simplest way to flush out this posting is to do a (dummy) readl() from the same device. (alternative is to do dma from the device to ram, but readl() is a lot easier ;)

Quoted 3 lines
Quoted 1 line

In an old posting (http://lkml.org/lkml/2003/5/8/278) said pci posting flush is unnecessary - is it correct?

no not really, not as a general statement.

ACK.

Quoted 7 lines

Generally speaking, readl() is the best way to ensure that all writes have been flushed across various layers of PCI bridges, etc.

It is particularly important to get this right if you are issuing a delay (i.e. udelay) after a write. If the write is not guaranteed to be flushed at the time the delay begins, then you are no longer truly delaying for the time requested.

another typical case is at io submission or when you disable irqs in the hardware..