Commit Graph

332 Commits

Author SHA1 Message Date
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 8281a9333c usb-xhci: memory freeing and using returns as bool uniformly
* Fix freeing of memory in error path
* Boolean and int were used interchangebly at various points,
  consolidate it to use boolean

Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
2013-12-16 15:40:04 +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
Alexey Kardashevskiy e086e9992c use VERSION file to generate FW version
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2013-12-09 20:23:28 +11:00
Alexey Kardashevskiy 5354659cf5 cas: remove warning
Since client-architecture-support is not support by the mainline QEMU yet,
this warning might be confusing so remove it.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
2013-12-09 12:21:39 +05:30
Anton Blanchard 7d0c284328 Add support for loading little endian ELF binaries.
We byte swap the entire header in place in elf_check_file.

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
2013-12-06 16:30:34 +05:30
Anton Blanchard dad7598b1b Add bswap_{16,32,64}p
Add byte swap macros that take a pointer and byte swap
in place.

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
2013-12-06 16:30:18 +05:30
Avik Sil 2c5bb18a55 dhcpv6 and other minor net-snk fixes
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:18:57 +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
Nikunj A Dadhania 408b8ec136 SLOF does not exit if given 1KB disk
When passing a 1KB disk, it goes on looping inside the deblocker,
ignoring the unability of driver to read from out-of-bound blocks.

Reviewed-by: Thomas Huth <thuth@linux.vnet.ibm.com>
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
2013-12-06 16:14:22 +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 568af4b578 Increase quiesce tokens array size
16 is too less, push it to 256

Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
2013-11-18 08:22:19 +05:30
Nikunj A Dadhania bca47dc291 virtio: timeout after 5sec
Remove adhoc timer and put 5sec timeout. On a busy host, code hits this.

Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
2013-11-18 07:07:47 +05:30
Avik Sil 10bf23ea7c Enable IPv6 support in dns
Signed-off-by: Avik Sil <aviksil@linux.vnet.ibm.com>
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
2013-11-18 06:50:16 +05:30
Nikunj A Dadhania 32c448bfaf usb-ohci: fix warnings
usb-ohci.c: In function ‘ohci_process_done_head’:
usb-ohci.c:458:4: warning: format ‘%x’ expects argument of type ‘unsigned int’, but argument 2 has type ‘struct ohci_td *’ [-Wformat]
usb-ohci.c:417:20: warning: variable ‘start_frame’ set but not used [-Wunused-but-set-variable]

Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
2013-11-17 16:34:50 +05:30
Avik Sil aee78336b9 Add ipv6 support in net-snk
This patch adds support for booting from a IPv6 network. It gets the boot information
(tftp server, boot file name) from DHCPv6 server or can be specified manually using
obp-tftp arguments. To boot from a IPv6 network, type "boot net:ipv6" from the SLOF
prompt. To specify ipaddresses manually, type "boot net:ipv6,<si6addr>,<filename>,<ci6addr>"
from the SLOF prompt.

This patch is based on the IPv6 code written by the former SLOF team.

Signed-off-by: Avik Sil <aviksil@linux.vnet.ibm.com>
2013-11-17 16:22:03 +05:30
Avik Sil 345a00a3d7 ipv4: fix frame overwriting following arp_send_request
Sometimes before ARP request frame is written to the line by qemu, the data gets overwritten
by next outgoing frame (typically tftp request) since both use the same ARP table index for
the frame buffer. This is fixed by copying the next outgoing packet data to a different
buffer instead of writing it to same ARP table index's frame buffer.

Signed-off-by: Avik Sil <aviksil@linux.vnet.ibm.com>
2013-11-17 16:22:03 +05:30
Avik Sil 69d32fe332 e1000: fix SLOF_dma_map_out arguments
Signed-off-by: Avik Sil <aviksil@linux.vnet.ibm.com>
2013-11-17 16:22:03 +05:30
Avik Sil 7970ccc0dc Maintain single global packet buffer for tftp
Since they were stack variable, chances are that the buffer pointer is invalid
during data transfer

Signed-off-by: Avik Sil <aviksil@linux.vnet.ibm.com>
2013-11-17 16:22:02 +05:30
Avik Sil 7ae768b04e Increase virtio-net receive queue size
Since SLOF is poll based, in a high network traffic zone desired packet might be missed
during receiving. Hence increase the receive queue size.

Signed-off-by: Avik Sil <aviksil@linux.vnet.ibm.com>
2013-11-17 16:22:02 +05:30
Avik Sil 470b817a44 Increase veth receive queue size
Since SLOF is poll based, in a high network traffic zone desired packet might be missed
during receiving. Hence increase the receive queue size.

Signed-off-by: Avik Sil <aviksil@linux.vnet.ibm.com>
2013-11-17 16:22:02 +05:30
Nikunj A Dadhania 7bc3d6b7d7 Fix dprintf macros at various points
Signed-off-by: Avik Sil <aviksil@linux.vnet.ibm.com>
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
2013-11-16 13:59:30 +05:30
Nikunj A Dadhania 7470b17ac4 usb-ohci: rewrite done_head processing code
The routine had got complicated and source of few bugs while using in
pci-passthru and js2x

Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
2013-11-15 15:00:04 +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
Nikunj A Dadhania b5ee6147f3 scsi: make-media-alias fix
* disk alias names are not correct
* also drop stack variable in case we overflow max-alias

Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
2013-11-15 10:36:51 +05:30
Nikunj A Dadhania 32dcbfadcd usb-xhci: add xhci host controller support
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
2013-11-15 10:36:51 +05:30
Nikunj A Dadhania ce91e6a282 usb-xhci: add xhci support
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
2013-11-15 10:36:51 +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 22c4d4b3ae usb-core: disable xhci
Code still does not support xhci, disable creation of xhci node, as it
was causing crash in the quiesce path.

Also check if ops pointer is verified before accessing function
pointers during usb_hcd_exit.

Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
2013-10-15 22:23:28 +05:30
Alexey Kardashevskiy e2e8ac901e client-architecture-support: fix wrong version read
This fixed size of reading the version (which is actually 32bit), this
removes confusing "cas not implemented" message from the guest.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
---
Changes:
v2:
* replaced w@ (16 bit) with l@ (32 bit)
2013-10-15 15:43:38 +11:00
Alexey Kardashevskiy 3b5f2aec1d client-architecture-support: fix redundant stack drop
This removes dropping allocated memory buffer off the stack in the case
when no change to the tree was generated by QEMU.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2013-10-15 13:44:38 +11:00
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
Nikunj A Dadhania 8fa0ee8b2b Add ibm,client-architecture-support method
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
2013-10-09 14:07:02 +11:00
Nikunj A Dadhania 887e3b2089 Kernel parameter passed from qemu commandline ignored
Commit ec5c9e8b (Use root.fs on qemu as well) would set the bootargs/bootpath
to null string even in case when the /chosen node exist, the /chosen and boot
property were populated during fdt parsing so do not change in case its already
set.

Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
2013-10-04 16:41:30 +05:30
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
Nikunj A Dadhania ab29e16279 ci: add missing close in else condition
The code in close for calling quiesce looks if there is stdin and
checks whether is being closed. That condition was being used to call
quiesce.

So in case when the ihandle is not that of stdin, close-dev was missing.

Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
2013-10-04 12:01:21 +05:30
Avik Sil a51e46c238 Add GPT support
Add support for booting from a GPT partitioned disk.

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 5962dbf56d usb-ohci: preserve the toggleCarry bit in ED
Endpoint descriptors toggleCarry bit needs to be preserved when using
DataToggle bit in transfer descriptor is set to 0.

Also zero the bulk_curr_ed

Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
2013-10-04 12:01:21 +05:30
Nikunj A Dadhania 80ba6519d8 usb-ohci: done_head processing fixes
Return error code like STALL back, so it can be handled effectively.

Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
2013-10-04 12:01:21 +05:30
Nikunj A Dadhania a351fc0cbc usb-ohci: update init and rationalize timings
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
2013-10-04 12:01:21 +05:30
Nikunj A Dadhania 2b14fb9a9e usb-msc: handle stall and other fixes
* Add Reset Recovery procedure
* Zero cbw and csw memory everytime
* Add delays during cbw, data and csw stage
* Increment tag after every command

Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
2013-10-04 12:01:21 +05:30
Nikunj A Dadhania 2ddd78d4be scsi: make probe more error resilient
* Some usb devices do not like report-luns, assume it as single lun device
  and move further.
* Make inquiry of the device first for 36bytes and then determine what
  is the additional size to read.

Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
2013-10-04 12:01:20 +05:30