All of lore.kernel.org
 help / color / mirror / Atom feed
* [parisc-linux] bad news, good news, unkown (Temp CR used as permanent storage)
@ 1999-12-03 20:52 Frank Rowand
  1999-12-03 22:15 ` John David Anglin
  1999-12-04 20:26 ` Philipp Rumpf
  0 siblings, 2 replies; 6+ messages in thread
From: Frank Rowand @ 1999-12-03 20:52 UTC (permalink / raw)
  To: parisc-linux

Philipp kindly documented the Control Register usage a while ago...

> register  today           soon
> CR24      unused          what CR26 is today (I thought CR2[45] were readable
> CR25      unused          what CR25 is today  from userspace. stupid prumpf)
> CR26      used in head.S  unused
> CR27      used in head.S  unused
> CR28      temporary usage in interruption handlers [GR1  saved here]
> CR29      temporary usage in interruption handlers [arg0 (for the interruption
>                   handler, NOT GR26) saved here]
> CR30      current, 0 if in kernel mode (this might not work for syscalls yet)
> CR31      temporary usage in interruption handlers [GR29 saved here]


THE BAD NEWS

The bad news is that the PA-RISC architecture allows PDC to modify the
contents of the "Temporary" Control Registers, CR 24 - 31 (see "PA-RISC
1.1 Firmware Architecture Reference Specification: Processor Dependent
Code (PDC) Procedures" at
http://thepuffingroup.com/parisc/documentation.html, the table and
Note 5 on page 1-4).  If PDC does change the contents of these registers
then they cannot be used for permanent storage by the kernel unless the
kernel saves the registers before calling PDC and restores them after
the return from PDC.


THE GOOD NEWS

I have started the process of changing the architecture to require PDC
to preserve the state of the "Temporary" Control Registers.  So far,
there have been no objections to the change, but there is still some
time left for HP engineers to object (like if a current PDC implementation
violates the new architecture).  This means that implementations of
PDC for *future* machines should preserve the state of the Temporary
Control Registers.


THE UNKNOWN

Even if no one in HP objects to the new constraint on PDC, there is no
guarantee that existing PDC doesn't modify the Temporary Control
Registers.  No one is checking all the PDC implementations that have
ever shipped to ensure that they meet the new restriction.

However, there is a chance that existing PDC does not modify the
Temporary Control Registers, based on conversations with some
relevent engineers, and some theorizing.

(Of course, the obvious exception is that the Temporary Control
Registers are undefined when the kernel's HPMC handler is called.)

HP-UX does use some Temporary Control Registers for permanent
storage.  It saves the values of these registers before calling
PDC, and restores them when PDC returns.  I would recommend that
Linux follow this practice.


-Frank

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [parisc-linux] bad news, good news, unkown (Temp CR used as permanent storage)
  1999-12-03 20:52 [parisc-linux] bad news, good news, unkown (Temp CR used as permanent storage) Frank Rowand
@ 1999-12-03 22:15 ` John David Anglin
  1999-12-04 20:35   ` Philipp Rumpf
  1999-12-04 20:26 ` Philipp Rumpf
  1 sibling, 1 reply; 6+ messages in thread
From: John David Anglin @ 1999-12-03 22:15 UTC (permalink / raw)
  To: Frank Rowand; +Cc: parisc-linux

On the subject of things possibly getting clobbered in PDC/IODC calls,
I think the variable real_routine can get clobbered since it is used
for more than one type of call.

The good news is that I have made some improvement to the PDC/IODC
console.  I have eliminated the double lines, and when the IODC console
is configured, the system can now successfully print all stored
messages and open /dev/console.  However, in making changes to iodccon.c,
I realized that the IODC console is a really bad video console since you
can't do cursor addressing.  I think it would better to use the serial
driver.

Thoughts?

Dave
-- 
J. David Anglin                                  dave.anglin@nrc.ca
National Research Council of Canada              (613) 990-0752 (FAX: 952-6605)

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [parisc-linux] bad news, good news, unkown (Temp CR used as permanent storage)
  1999-12-03 20:52 [parisc-linux] bad news, good news, unkown (Temp CR used as permanent storage) Frank Rowand
  1999-12-03 22:15 ` John David Anglin
@ 1999-12-04 20:26 ` Philipp Rumpf
  1999-12-06 18:50   ` Frank Rowand
  1 sibling, 1 reply; 6+ messages in thread
From: Philipp Rumpf @ 1999-12-04 20:26 UTC (permalink / raw)
  To: Frank Rowand; +Cc: parisc-linux

> The bad news is that the PA-RISC architecture allows PDC to modify the
> contents of the "Temporary" Control Registers, CR 24 - 31 (see "PA-RISC
> 1.1 Firmware Architecture Reference Specification: Processor Dependent
> Code (PDC) Procedures" at
> http://thepuffingroup.com/parisc/documentation.html, the table and
> Note 5 on page 1-4).  If PDC does change the contents of these registers
> then they cannot be used for permanent storage by the kernel unless the
> kernel saves the registers before calling PDC and restores them after
> the return from PDC.

Right, we should save/restore them.

> THE GOOD NEWS
> 
> I have started the process of changing the architecture to require PDC
> to preserve the state of the "Temporary" Control Registers.  So far,
> there have been no objections to the change, but there is still some
> time left for HP engineers to object (like if a current PDC implementation
> violates the new architecture).  This means that implementations of
> PDC for *future* machines should preserve the state of the Temporary
> Control Registers.

How much of the PDC code actually uses interruptions ?

> THE UNKNOWN
> 
> Even if no one in HP objects to the new constraint on PDC, there is no
> guarantee that existing PDC doesn't modify the Temporary Control
> Registers.  No one is checking all the PDC implementations that have
> ever shipped to ensure that they meet the new restriction.
> 
> However, there is a chance that existing PDC does not modify the
> Temporary Control Registers, based on conversations with some
> relevent engineers, and some theorizing.
> 
> (Of course, the obvious exception is that the Temporary Control
> Registers are undefined when the kernel's HPMC handler is called.)

How is that obvious ?  I would have expected the firmware HPMC handler
to use some sort of temporary storage in the 0xffffe000 - 0xffffffff
range (which can be accessed using an immediate offset and GR0), in
the debug registers or something similar (probably it could even use
undefined spots in page zero).

> HP-UX does use some Temporary Control Registers for permanent
> storage.  It saves the values of these registers before calling
> PDC, and restores them when PDC returns.  I would recommend that
> Linux follow this practice.

Agreed.


	Philipp Rumpf

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [parisc-linux] bad news, good news, unkown (Temp CR used as permanent storage)
  1999-12-03 22:15 ` John David Anglin
@ 1999-12-04 20:35   ` Philipp Rumpf
  0 siblings, 0 replies; 6+ messages in thread
From: Philipp Rumpf @ 1999-12-04 20:35 UTC (permalink / raw)
  To: John David Anglin; +Cc: Frank Rowand, parisc-linux

> On the subject of things possibly getting clobbered in PDC/IODC calls,
> I think the variable real_routine can get clobbered since it is used
> for more than one type of call.

Fixed by now.

> The good news is that I have made some improvement to the PDC/IODC
> console.  I have eliminated the double lines, 

How ?  There are quite a lot of ways to solve the two-consoles-which-are-
really-the-same problem, some of them just aren't very clean.  (Probably
the cleanest is to merge arch/parisc/kernel/pdc_cons.c and drivers/video/
iodccon.c into one file).

> and when the IODC console is configured, the system can now successfully
> print all stored messages and open /dev/console.

This was there before, wasn't it ?

> However, in making changes to iodccon.c, I realized that the IODC console
> is a really bad video console since you can't do cursor addressing.
> I think it would better to use the serial
> driver.

Sure it would, and I encourage everyone with a box using serial console to
clean up drivers/char/serial.c (it already should do everything you want,
it's just not clean) and use that.  The problem is there are boxes with
graphical consoles as well.

> Thoughts?

Where's the patch ;) ?


	Philipp Rumpf

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [parisc-linux] bad news, good news, unkown (Temp CR used as permanent storage)
  1999-12-04 20:26 ` Philipp Rumpf
@ 1999-12-06 18:50   ` Frank Rowand
  1999-12-09  5:03     ` Philipp Rumpf
  0 siblings, 1 reply; 6+ messages in thread
From: Frank Rowand @ 1999-12-06 18:50 UTC (permalink / raw)
  To: parisc-linux

Philipp Rumpf wrote:

< stuff deleted >

> > (Of course, the obvious exception is that the Temporary Control
> > Registers are undefined when the kernel's HPMC handler is called.)
> 
> How is that obvious ?  I would have expected the firmware HPMC handler

Ahhh, obvious if one had read the comments at the beginning of the basic
hpmc handler that I submitted.  Or read p. 1-16 of pdce.pdf, "PA-RISC 2.0
Formware Architecture Reference Specification: Processor Dependent Code
(PDC) Procedures (Part 2/2)" at
http://thepuffingroup.com/parisc/documentation.html

OK, so it's not so obvious....

-Frank

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [parisc-linux] bad news, good news, unkown (Temp CR used as permanent storage)
  1999-12-06 18:50   ` Frank Rowand
@ 1999-12-09  5:03     ` Philipp Rumpf
  0 siblings, 0 replies; 6+ messages in thread
From: Philipp Rumpf @ 1999-12-09  5:03 UTC (permalink / raw)
  To: frowand; +Cc: parisc-linux

> However, there is a chance that existing PDC does not modify the
> Temporary Control Registers, based on conversations with some
> relevent engineers, and some theorizing.
>
> (Of course, the obvious exception is that the Temporary Control
> Registers are undefined when the kernel's HPMC handler is called.)

In this context I interpreted the last paragraph as saying that even if
firmware is nice and doesn't modify the temporary registers during PDC
calls, there is no chance whatsoever that the temporary registers contain
useful values after every HPMC on a certain firmware implementation.
(Now I don't see how HPMC's are an exception to the more general rule
that some firmware implementations might preserve the temporary registers).

> Ahhh, obvious if one had read the comments at the beginning of the basic
> hpmc handler that I submitted.
> Or read p. 1-16 of pdce.pdf, "PA-RISC 2.0
> Formware Architecture Reference Specification: Processor Dependent Code
> (PDC) Procedures (Part 2/2)" at
> http://thepuffingroup.com/parisc/documentation.html

Which contradict each other wrt the PSW W and E bits (E isn't going to
concern us but W might), btw.

	Philipp Rumpf

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~1999-12-09  5:03 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1999-12-03 20:52 [parisc-linux] bad news, good news, unkown (Temp CR used as permanent storage) Frank Rowand
1999-12-03 22:15 ` John David Anglin
1999-12-04 20:35   ` Philipp Rumpf
1999-12-04 20:26 ` Philipp Rumpf
1999-12-06 18:50   ` Frank Rowand
1999-12-09  5:03     ` Philipp Rumpf

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.