* About invalidate cache of SH4
@ 2008-01-08 7:59 Yoshihiro Shimoda
2008-01-08 8:08 ` Paul Mundt
0 siblings, 1 reply; 2+ messages in thread
From: Yoshihiro Shimoda @ 2008-01-08 7:59 UTC (permalink / raw)
To: linux-sh
Hi, Paul,
When start or size of __flush_invalidate_region() is not cache
alignment, enlarge the range to match it. However, the data is
lost if there are the data which should write-back in there.
For example, struct scsi_cmnd has sense_buffer[]. sense_buffer
is not cache alignment. When there is invalidated sense_buffer,
struct request *request of struct scsi_cmnd may be invalidated.
Connection of the USB memory sometimes fails and cannnot mount
USB-CDROM(oops occured) for this processing.
I made a patch, but this implementation may not be good...
Thanks,
Yoshihiro Shimoda
---
diff --git a/arch/sh/mm/cache-sh4.c b/arch/sh/mm/cache-sh4.c
index 43d7ff6..cc1751d 100644
--- a/arch/sh/mm/cache-sh4.c
+++ b/arch/sh/mm/cache-sh4.c
@@ -164,15 +164,37 @@ void __flush_invalidate_region(void *start, int size)
{
unsigned long v;
unsigned long begin, end;
+ int no_align = 0;
begin = (unsigned long)start & ~(L1_CACHE_BYTES-1);
end = ((unsigned long)start + size + L1_CACHE_BYTES-1)
& ~(L1_CACHE_BYTES-1);
+
+ if ((unsigned long)start & (L1_CACHE_BYTES - 1) ||
+ size & (L1_CACHE_BYTES - 1)) {
+ if (size <= (L1_CACHE_BYTES << 1)) {
+ __flush_purge_region(start, size);
+ return;
+ } else {
+ no_align = 1;
+ begin += L1_CACHE_BYTES;
+ end -= L1_CACHE_BYTES;
+ }
+ }
+
+ if (no_align)
+ __flush_purge_region((void *)(begin - L1_CACHE_BYTES),
+ L1_CACHE_BYTES);
+
for (v = begin; v < end; v+=L1_CACHE_BYTES) {
asm volatile("ocbi %0"
: /* no output */
: "m" (__m(v)));
}
+
+ if (no_align)
+ __flush_purge_region((void *)(end + L1_CACHE_BYTES),
+ L1_CACHE_BYTES);
}
/*
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: About invalidate cache of SH4
2008-01-08 7:59 About invalidate cache of SH4 Yoshihiro Shimoda
@ 2008-01-08 8:08 ` Paul Mundt
0 siblings, 0 replies; 2+ messages in thread
From: Paul Mundt @ 2008-01-08 8:08 UTC (permalink / raw)
To: linux-sh
On Tue, Jan 08, 2008 at 05:00:30PM +0900, Yoshihiro Shimoda wrote:
> For example, struct scsi_cmnd has sense_buffer[]. sense_buffer
> is not cache alignment. When there is invalidated sense_buffer,
> struct request *request of struct scsi_cmnd may be invalidated.
> Connection of the USB memory sometimes fails and cannnot mount
> USB-CDROM(oops occured) for this processing.
>
This is a known issue, and is currently being debated on l-k:
http://lkml.org/lkml/2007/12/20/660
Once there's a resolution, the driver will either be fixed, or we set up
the minimum alignment to a cacheline boundary.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-01-08 8:08 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-08 7:59 About invalidate cache of SH4 Yoshihiro Shimoda
2008-01-08 8:08 ` Paul Mundt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox