On Tue, Jan 05, 2010 at 07:10:58AM +1100, Benjamin Herrenschmidt wrote: > On Mon, 2010-01-04 at 13:07 +0200, Michael S. Tsirkin wrote: > > BTW, I think we really should think about the right way to address the > > swap/noswap issue without using a preprocessor. Maybe make pci host > > bridge explicitly specify whether to swap bytes? How about adding a > > field in PCIHostState to make it do this? > > No, this is a non issue if you get your design right. Just abstract out > the reference to a device in a struct like Alex is proposing and have > the host bridge specific code fill that up appropriately. I don't see > why there would be any need for swapping and in any case, this should go > away once the host bridge code knows how to interpret the write to > whatever config access registers it exposes. > > Ben.
Well, the main issue if I understand correcttly is that basically the same hardware bridge can be connected to host in different ways. Yes, we can say "if it's connected differently it's a different device" but this is slightly ugly, device should not have to know how it's connected. It would be cleaner to have a "connector" device in the middle that swaps bytes. Even though yes, what you describe would be less ugly than using proprocessor as we do now. -- MST