linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Bartlomiej Zolnierkiewicz <B.Zolnierkiewicz@elka.pw.edu.pl>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>,
	linux-kernel mailing list <linux-kernel@vger.kernel.org>
Subject: Re: Reserving an ATA interface
Date: 03 May 2003 18:59:28 +0200	[thread overview]
Message-ID: <1051981168.4107.58.camel@gaston> (raw)
In-Reply-To: <Pine.SOL.4.30.0305031805170.10296-100000@mion.elka.pw.edu.pl>


> Yesterday I was thinking about:
> - default arch hwifs, added/probed in ide_init_defult_hwifs() if no
>   IDE PCI/PCI (depends on arch, should be IDE PCI?) support is compiled in
> - PCI hwifs
> - legacy hwifs probed in ide_setup()
> - legacy hwifs probed after PCI
> and about ide_register_hw() + initializing flag.
> 
> What a mess... ordering issues can make you crazy.

Yup, I'd suggest we think about re-writing all that stuff for 2.7 :)
 
> > The simplest solution I have in mind is to add an hwif flag,
> > called "hold" (or whatever better name you find). Drivers like
> > ide/ppc/pmac.c would set this flag for the "hotswap" media bay
> > interface, and not for others.
> 
> This change is obviously correct and it doesn't have influence on
> any existing code.
> 
> > The only change to the core code would then be for ide_register_hw
> > to 'skip' those when searching for an available slot, and to call
> > init_hwif_data when (!hwif->present && !hwif->hold) to handle case 2
> > where the iops & other hwif fields (mmio among others) need to be
> > reset to initial/legacy state.
> 
> Less safe change but also okay, as callers .
> btw, Can't "ghost ides" be dealed inside ppc specific code?
>      Do you know when interface is valid and when it is "ghost",
>      and what other OS-es do in this case?

Not re-using the slot for an interface with the "hold" bit won't
affect anybody but setters of that bit, so we are ok. The act of
calling init_hwif_data when !present && !hold is the one bringing
a possible change of behaviour to existing code.

However, who calls ide_register_hw() dynamically ? ide-cs and ?
I don't think there would much harm in re-calling init_hwif_data
at this point since hwif->present is not set, we _are_ re-using
the hwif, wether it was previously initialized or not by somebody
else. In this case, we really want to "clean" it, don't we ?

Right now, the only problem with re-initializing this way that
I've found is with hotswap interfaces like ide-pmac, because
they will have preset special MMIO ops etc... and that call
would revert that pre-setting. That's exactly why such interfaces
should set the "hold" bit to "reserve" the hwif slot. You see
the point ? I don't think there are much drivers aroung playing
with such tricks though.

All I can do within ide pmac itself is set or not that "hold"
bit for those interfaces. I just need to set it on the hotswap
ones (wthr they have devices connected or not) that way they
stay around "reserved" for when a device gets plugged. Other
"fixed" interfaces will have hwif->present cleared automatically
by the probe code, and thus will be "freed" for other uses, if
they don't have any device attached.
(Which is why that init_hwif_data is needed to reset their hwif
to something good default, and not whatever ide pmac have set).

In 2.5, I can be slightly smarted since I'm calling the probe
myself and no longer rely on the automatic initial probe done
by the IDE layer, like for PCI devices, so I can actually 
"clear" those "empty" interfaces myself after they are probed.
But still, it makes sense to have this "hold" flag to let a
hotswap interface reserve a slot, and it makes sense when the
interface isn't held by anybody to "clean it up" before giving
it to somebody else.

The only problem I see right now is for a dynamic interface
(like ide-cs) where the _controller_ itself is hotswap, so
the hwif slot cannot be reserved in advance _and_ that interface
needs special IOps (which is fortunately not the case of ide-cs)

Such an interface can't really know what slot will be
picked by ide_register_hw() and can't "prepare" the HWIF with
special iops, so it won't be much harmed by the fact we are
calling init_hwif_data, but still, we should ultimately think
about splitting completely the fact of allocating an hwif slot,
setting it up, and triggering a probe on it. Those are 3 different
things that are currently mixed in bad ways. I don't beleive
fixing that fits in the 2.6 timeframe though.

Ben.

  reply	other threads:[~2003-05-03 16:48 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-05-03  9:33 Reserving an ATA interface Benjamin Herrenschmidt
2003-05-03 16:42 ` Bartlomiej Zolnierkiewicz
2003-05-03 16:59   ` Benjamin Herrenschmidt [this message]
2003-05-03 17:08     ` Benjamin Herrenschmidt
2003-05-03 17:21       ` Bartlomiej Zolnierkiewicz
2003-05-03 18:39         ` Benjamin Herrenschmidt
2003-05-03 19:31           ` Bartlomiej Zolnierkiewicz
2003-05-03 19:40             ` Benjamin Herrenschmidt
2003-05-03 17:12     ` Bartlomiej Zolnierkiewicz
2003-05-04  1:28       ` Andre Hedrick
2003-05-03 21:24 Chuck Ebbert

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1051981168.4107.58.camel@gaston \
    --to=benh@kernel.crashing.org \
    --cc=B.Zolnierkiewicz@elka.pw.edu.pl \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).