Commit Graph

135 Commits

Author SHA1 Message Date
Nikunj A Dadhania 1c17c13a57 rtas: Improve error handling in instantiate-rtas
Error handling, even when the call is not implemented,
code was printing failed.

Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
2014-10-29 15:59:24 +05:30
Nikunj A. Dadhania f9a60de304 Add private HCALL to inform updated RTAS base and entry
This patch adds a private HCALL to inform qemu the updated
rtas-base and rtas-entry address when OS invokes the call
"instantiate-rtas". This is required as qemu allocates the
error reporting structure in RTAS space upon a machine check
exception and hence needs to know the updated RTAS.

Enhancements to qemu to handle the private HCALL, prepare
error log and invoke machine check notification routine
are in a separate patch.

Signed-off-by: Nikunj A. Dadhania <nikunj@linux.vnet.ibm.com>
Signed-off-by: Aravinda Prasad <aravinda@linux.vnet.ibm.com>
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
2014-08-27 11:10:45 +05:30
Avik Sil 6180178869 Add boot menu support
This patch adds boot menu support to SLOF. When boot menu is enabled from qemu
commandline with '-boot menu=on', on pressing F12 key it displays the list of
devices to boot from and waits for user's input. This is in line with x86 qemu
bios feature.

Signed-off-by: Avik Sil <aviksil@linux.vnet.ibm.com>
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
2014-06-13 12:33:54 +05:30
Nikunj A Dadhania 7fb8bdae84 dhcparch define missing in compilation
Include DHCPARCH define  in the FLAG variable
Set the flag, so that dhcp request would contain DHCPARCH

Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
2014-06-12 23:57:12 +05:30
Nikunj A Dadhania 95bc88c53b Set dhcp arch in board-qemu config file
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
2014-04-29 10:19:59 +05:30
Nikunj A Dadhania c365fe0393 virtio-blk: support variable block size
Current code only works with 512 bytes read.

Moreover, Qemu ignores the guest set features request. In the set
features request SLOF indicates to qemu that it is not support
VIRTIO_BLK_F_BLK_SIZE feature. Code in qemu suggests that virtio-blk
is not implementing set_guest_feature.

Tested-by: Bharata B Rao <bharata@linux.ibm.com>
Reviewed-by: Thomas Huth <thuth@linux.vnet.ibm.com>
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
2014-04-25 15:40:13 +05:30
Thomas Huth e1b7b85031 Remove unused SLOF code
This patch removes some code that is obsolete and completely unused
nowadays.

Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
2014-04-25 15:40:12 +05:30
Nikunj A Dadhania 1f30b24cb6 pci: extract dma functions as separate file
DMA alloc/mapping functions needs to be used by pci generic bridge as well.

Reviewed-by: Thomas Huth <thuth@linux.vnet.ibm.com>
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
2014-04-25 15:40:02 +05:30
Nikunj A Dadhania cce8657eaa e1000: fix usage of multiple nics
When using multiple e1000 network interface netboot would fail if we
try to boot from the first interface.

During first e1000 device initialization, m_e1k.m_baseaddr_u64 (static
variable) is set to read/write pci registers. Later the second device
does process. When first e1000 driver tries netboot, it has an
assumption that m_e1k.m_baseaddr_u64 is correct, which is not the
case.

Ensure reinitialization for m_e1k.m_baseaddr_u64 when open interface
of device is called.

Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
Reviewed-by: Thomas Huth <thuth@linux.vnet.ibm.com>
2014-04-08 17:45:09 +05:30
Alexander Graf 9a44f99fa4 Isolate sc 1 detection logic
Under weird circumstances we ended up with unsynchronized data and text
section references between the stage1 and paflof binaries.

This patch moves the initial sc 1 detection logic to work without any
persistent state, making it properly reentrant regardless of the place
we end up hitting the code at.

This fixes broken sc 1 detection for me on PR KVM.

Signed-off-by: Alexander Graf <agraf@suse.de>
[aik: added r0 to clobber list and $(FLAG) to AS1FLAGS as suggested by agraf, tested on pHyp]
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2014-04-04 11:42:20 +11:00
Nikunj A Dadhania e59d25edd0 virtio-scsi: correct srplun comment
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
2014-03-19 13:50:11 +05:30
Nikunj A Dadhania 34db0f6e27 Fix kernel loading
commit 66119a19 changed the stack representation of go-64 calls, this
call site needs update as well. r12 is not passed as an argument
anymore.

Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
2014-03-18 20:17:15 +11:00
Nikunj A Dadhania 5ea509fd12 Introduce dummy console device
Qemu can create console-less machine, aka no output device. And there
are dependencies in the guest which expects a valid output device. Add
this dummy device that gobbles up all the output send, and keeps the
guest happy.

Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
2014-03-04 12:52:03 +11:00
Benjamin Herrenschmidt ae98d1464c vio-vscsi: Fix CRQ allocation alignment
alloc-mem in SLOF does not always return aligned values it
seems, so we need to align it manually. While messing around I
hit a case where after a close and re-open via the client interface
vscsi would fail to initialize without this fix.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
[ free the  allocated size ]
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
2014-03-04 12:52:03 +11:00
Avik Sil 020220e637 Fix virtio device shutdown
The virtio device shutdown method is called during quiesce in order to
reset the device. This implies writing to the I/O region of the device
and this only makes sense if the device is opened, otherwise we hit an
"unassigned write" handler in qemu.

This happens for example while booting a guest from a virtio-blk or
virtio-scsi device, when the guest kernel reaches the end of prom_init().

Reported-by: Greg Kurz <gkurz@linux.vnet.ibm.com>

Signed-off-by: Greg Kurz <gkurz@linux.vnet.ibm.com>
Signed-off-by: Avik Sil <aviksil@linux.vnet.ibm.com>
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
2014-02-04 19:49:46 +11:00
Avik Sil 295a033a25 Change shutdown method name for virtio-scsi
add-quiesce-xt adds a different method virtio-scsi-shutdown which is not intended to
be added, since the intended method shares the same name with the un-intended one.
This makes call to the wrong method with wrong parameter which makes it unable to reset
virtion-scsi device during quiesce. This patch fixes this by renaming the method name.

Signed-off-by: Avik Sil <aviksil@linux.vnet.ibm.com>
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
2014-02-04 19:49:46 +11:00
Nikunj A Dadhania c2358afb40 Add support for 64bit LE ABI v1 and v2 support
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>

--

v2: With the parameters changed for go-64, kernel loading from commandline broke
v3: (client-exec) calls start-elf64 directly, fix args
2014-02-04 19:49:46 +11:00
Nikunj A Dadhania 51802b3dc9 cas: return error when unknown node found
Hypercall for ibm,client-architecture-support could return
nodes that isn't there in the guest DT, in such cases error should
be returned to the guest kernel.

Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
2014-02-04 19:49:46 +11:00
Nikunj A Dadhania a8c1a27c16 Fix shutdown for virtio devices
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
2014-01-20 17:19:47 +05:30
Alexander Graf dd53579ae8 Work around missing sc 1 traps on pHyp
When running a pseries guest in PR KVM on top of pHyp, sc 1 instructions
are handled directly by pHyp, so we don't get to see them.

That means we need to get inventive. Invent a new instruction that behaves
like sc 1, but really is a reserved instruction that traps. This instruction
can be used by KVM to emulate sc 1 behavior.

This patch adds the SLOF support for it. With this, SLOF detects whether
it's running on such a broken setup and if so patches itself to execute
the fake sc 1 instruction instead of the real one.

Furthermore, we also hook into "quiesce" which Linux calls when it boots.
This gives us the chance to also patch Linux when it boots up, so it uses
the fake sc 1 too.

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
2013-12-17 11:01:46 +05:30
Alexander Graf 69c6fc492c fix print_version() to return where it came from
The print_version() is jumping through hoops to get back to where
it was called from, though it actually does get called with "bl"
already, so it knows.

Just return to where we came from after print_version(), making it
a function we can call from other places in the code.

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
2013-12-16 17:04:26 +05:30
Nikunj A Dadhania 79f0600b9a Output banner and initial display output in VNC window
Initial display output does not show up in the VGA/VNC window.
Create replay buffer to store the initial output and when vga/vnc
console starts, dump the buffer there.

Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
2013-12-16 11:56:42 +05:30
Avik Sil 7bc81ba7f4 Fix missing drop in virtio-fs setup-alias
Signed-off-by: Avik Sil <aviksil@linux.vnet.ibm.com>
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
2013-12-06 16:17:26 +05:30
Avik Sil 6f5f30820f Find next available alias name
This patch generaliazes the device alias name enumeration for all scsi disks, virtio-blk
disks and network devices.

Signed-off-by: Avik Sil <aviksil@linux.vnet.ibm.com>
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
2013-12-06 16:16:49 +05:30
Alexey Kardashevskiy ea9eca196d boot: enable support for bootindex
QEMU supports a bootindex property for every device in the command line.
With the respective support from the QEMU side, this change is enough
to make SLOF go through the list and try to boot.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2013-11-26 14:57:51 +11:00
Michael Roth 2f8aa2de30 pci-properties: add properties to enable hotplug for spapr
drmgr expects ibm,my-drc-index and ibm,loc-code OF properties in
the corresponding device tree node to determine whether a
pre-populated slot is hotpluggable/unpluggable. This is also
stated as a boot-time requirement for DR-capable devices in SPAPR,
though it does not specify there how these entries are to be generated.

In the case of QEMU, hotpluggable slots are allocated entries based on
bus/slotno values, so we can determine these entries statically at
boot-time, rather than relying on RTAS calls as we would during
OS-driven configuration.

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2013-11-22 14:45:03 +11:00
Nikunj A Dadhania de0e80e03e e1000: remember node handle
While netbooting with yaboot, code was failing at
dma-map-out.

Remember my-handle and store for further reference,
which is needed for dma-map-out during close. yaboot for
some reason does not set the current-node while calling
close.

Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
2013-11-18 14:53:09 +05:30
Nikunj A Dadhania bbb09e75d8 boot: add net in default boot order
So if there is no boot order from qemu, nvram, the default
boot order will be to try from "disk" aliases, "cdrom" aliases
and lastly "net" aliases

Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
2013-11-15 11:08:01 +05:30
Nikunj A Dadhania f22b96d422 block 0 address in the allocator
PCI window bars sometimes returns 0 as the a start address. This will
be used by the allocator. Devices or Software can take it as null
address.

Mark 0 address as always allocated during initialization.

Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
2013-11-15 10:44:58 +05:30
Avik Sil 8e5245abc8 Avoid veth read/write calls with zero length buffer
This avoids unnecessary libveth-read/write calls in cimod_check_and_install

Signed-off-by: Avik Sil <aviksil@linux.vnet.ibm.com>
2013-11-15 10:36:51 +05:30
Nikunj A Dadhania 193b3a1488 boot: include other aliases
Currently we only boot from " disk" and " cdrom", we can do better by
iterating through the diskN/cdromN aliases created during disk probing.

Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
2013-10-17 13:54:58 +05:30
Nikunj A Dadhania 7761eefbf4 Update device tree returned by CAS hypercall
Add device tree parsing code and setting properties.

Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
2013-10-09 14:07:14 +11:00
Nikunj A Dadhania ee2dfa3086 fdt: introduce fdt-init
Current fdt.fs takes device-tree start address from fdt-start,
this needs to be made generic for parsing device tree at later
point

Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
2013-10-09 14:07:07 +11:00
Avik Sil b30e4a4f8a Allow more than one client to open net devices simultaneously
When multiple clients are active simultaneously, they might open network
devices that is already opened by other clients. This results in failure
to transfer packets since obp-tftp package is not instantiated on each open.
This patch resolves it by instantiating obp-tftp on each open.

Signed-off-by: Avik Sil <aviksil@linux.vnet.ibm.com>
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
2013-10-04 12:01:21 +05:30
Alexey Kardashevskiy 10cc042a95 pci: fix interrupt-map for bridges
The previous scheme always put 0 as a parent slot#. However it is
not always the case and QEMU's PCI bridge does not support putting
device at slot#0 as it claims SHPC support for hotplug.

This modifies the interrups map to let the linux guest resolve XICS
global interrupt number correctly.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
2013-10-04 12:01:21 +05:30
Nikunj A Dadhania 7f5d67ca5f Implement range allocator
Use the allocator with dma-map-in so it does not create duplicate TCE
entries.

Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
2013-10-04 12:01:20 +05:30
Avik Sil d474f35199 Remove e1000 network driver as module
The driver has been moved to libe1k

Signed-off-by: Avik Sil <aviksil@linux.vnet.ibm.com>
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
2013-10-04 12:01:11 +05:30
Avik Sil e5be30744e Remove virtio-net network driver as module
The driver has been moved to libvirtio

Signed-off-by: Avik Sil <aviksil@linux.vnet.ibm.com>
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
2013-10-04 12:01:06 +05:30
Avik Sil c9e1f76d10 Remove veth network driver as module
The driver has been moved to libveth

Signed-off-by: Avik Sil <aviksil@linux.vnet.ibm.com>
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
2013-10-04 12:00:58 +05:30
Avik Sil 9c928cc428 Add e1000 network driver in libe1k
Signed-off-by: Avik Sil <aviksil@linux.vnet.ibm.com>
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
2013-10-04 12:00:18 +05:30
Avik Sil 46a32aa9c7 Add virtio-net driver in libvirtio
Signed-off-by: Avik Sil <aviksil@linux.vnet.ibm.com>
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
2013-10-04 12:00:13 +05:30
Avik Sil eb5994df20 Add veth driver in libveth
Signed-off-by: Avik Sil <aviksil@linux.vnet.ibm.com>
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
2013-10-04 12:00:06 +05:30
Nikunj A Dadhania 85b0956ddb Move hex64-{decode,encode}-unit to node.fs
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
2013-08-21 10:49:58 +05:30
Nikunj A Dadhania a481b1d18a js2x: more fixes
* Build fixes to include scsi files
* Move usb-setup-hcidev out of board-qemu
* Fix pci-bridge-probe to assign temporary ranges

Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
2013-08-21 10:49:32 +05:30
Benjamin Herrenschmidt ec5c9e8bf4 Use root.fs on qemu as well
We had lots of duplication of code between root.fs and fdt.fs

The reason we didn't use root.fs in the first place is that it tried
to create the root node and the chosen node which we already have via
the fdt.

Instead, modify root.fs to check for their presence and only "extend"
them in that case.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
2013-08-06 16:00:30 +10:00
Benjamin Herrenschmidt a0236ff1b1 Use a global definition of sync() and mb()
For memory barriers accross the board. Also move the compiler barrier
to cpu.h

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
2013-07-25 13:54:40 +10:00
Nikunj A Dadhania da1c3fa98a USB generic hub device driver
Support for usb generic hub driver.

Todo: Detect disconnects and remove device

Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
Acked-by: Thomas Huth <thuth@linux.vnet.ibm.com>
2013-07-24 14:46:23 +05:30
Nikunj A Dadhania 6eb646603d USB keyboard driver
Portions of keyboard driver(usb-key.h and usb-hid.c) inherited from
code originally written by former SLOF team

Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
Acked-by: Thomas Huth <thuth@linux.vnet.ibm.com>
2013-07-24 14:46:23 +05:30
Nikunj A Dadhania 2deb222c4c usb-core: setup new device
* Configures the newly found usb devices.

Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
Fixes-by: Avik Sil <aviksil@linux.vnet.ibm.com>
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
Acked-by: Thomas Huth <thuth@linux.vnet.ibm.com>
2013-07-24 14:46:23 +05:30
Nikunj A Dadhania a4e14d308f usb-core: hcd registration and query routines
* usb-core: hcd registration
  	    query hcd operations structure
            hcd controller init routines
* usb-ohci: stub ochi controller init

Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
Acked-by: Thomas Huth <thuth@linux.vnet.ibm.com>
2013-07-24 14:46:22 +05:30