A bit operation bug left the controller in the running state causing
PCI EEH in the host when using pci-passthru for USB3 device.
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
Added support for the DHCP request to include the code 93 architecture
code. This is needed so the responding dhcp server, knows what
filename it should return for the system to netboot. Set the
qemu-board DHCPARCH type to 0x0c which is the correct value for slof.
Signed-off-by: Blake Rouse <blake.rouse@canonical.com>
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
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>
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>
With a generic pci bridge and a pci device on that bridge, any call to
dma functions would fail as generic pci-bridge does not support
them. This would result in TCE entries not getting populated either in
the host(vfio) or qemu.
Reviewed-by: Thomas Huth <thuth@linux.vnet.ibm.com>
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
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>
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>
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>
Remove the silliness of running make on powerpc like this;
$ CROSS= make
The default value of CROSS prevented this, detect the architecture in
the makefile and sent the CROSS accordingly.
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
It is seen that guests booting in compatibility mode (like Power7)
will issue a client-architecture-service call which will result in
QEMU rebuilding the device tree. The size of the device tree to be
built, which is passed from SLOF is currently 4 kB. This is
insufficient to contain more than 48 CPU nodes. Increase this size in
SLOF so that 255 CPUs (max limit in QEMU) can be supported.
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
Qemu ignores the controller type while coding the bootindex. Changing
the representation of name accordingly.
Earlier a USB controller device representation was:
/pci@800000020000000/ohci@1/usb-storage@1/disk@101000000000000
/pci@800000020000000/ehci@2/usb-storage@1/disk@101000000000000
/pci@800000020000000/xhci@3/usb-storage@1/disk@101000000000000
The patch changes this to:
/pci@800000020000000/usb@1/storage@1/disk@101000000000000
/pci@800000020000000/usb@2/storage@1/disk@101000000000000
/pci@800000020000000/usb@3/storage@1/disk@101000000000000
Controller name is preserved in " device_type" property in the node.
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
There is a mismatch between the port number between qemu and slof. Was
unearthed while using bootindex.
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
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>
Sometimes the bootp reply message from a dhcp nak packet is passed to bootloader
(grub2) through "bootp-response" property. Grub2 does not verify if it is an
ack or nak packet and goes on picking up the server ip address from the message.
This makes grub2 unable to make further communication. The workaround here is
made to avoid this situation by copying the bootp reply message only when it is
from dhcp ack packet.
Signed-off-by: Avik Sil <aviksil@linux.vnet.ibm.com>
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
Trampoline code in the LE binary were helping fix this. This patch now
takes care of switching the mode to LE for LE elf binaries.
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
Prevent loading of elf files which does not have virtual address same
as physical address.
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
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>
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>
In file included from ./board.code:140:0,
from /home/nikunj/work/power/code/slof/SLOF/slof/paflof.c:106:
/home/nikunj/work/power/code/slof/SLOF/slof/paflof.c: In function ‘engine’:
/home/nikunj/work/power/code/slof/SLOF/lib/libvirtio/virtio-9p.h:23:3: warning: typedef ‘virtio_9p_config_t’ locally defined but not used [-Wunused-local-typedefs]
} virtio_9p_config_t;
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
The default network boot method "boot net" tries to boot from both IPv4 and IPv6
networks. The "boot net:ipv6" allows to boot from IPv6 network only. But there
is no option for booting from IPv4 network only. This patch addresses this issue.
Signed-off-by: Avik Sil <aviksil@linux.vnet.ibm.com>
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
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>
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>
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
Currently strings are stored in the dictionary using "string," which
stores the length as a byte. This brings in the limitation of only 255
byte string. The issue got exposed when using "boot-device" which was
more than 256 bytes, and the string length was equal to (length & 0xFF)
With this patch, we are storing the length in dictionary in a cell and
copying the string after that.
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
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>
To boot from an IPv6 network user has to type "boot net:ipv6" from SLOF prompt. This
is inconvenient in auto-install environment. This patch addresses this issue by falling
back to IPv6 booting in case IPv4 booting fails (No DHCPv4 response).
Signed-off-by: Avik Sil <aviksil@linux.vnet.ibm.com>
As per RFC 768 (UDP), if the computed checksum is zero, it is transmitted as all ones
(the equivalent in one's complement arithmetic).
Signed-off-by: Avik Sil <aviksil@linux.vnet.ibm.com>
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
process_ra_options was going through infinite loop due to improper handling of option_length.
Also introduction of is_ra_received() makes booting time faster since it returns as soon as
router advertisement mesage is received.
Signed-off-by: Avik Sil <aviksil@linux.vnet.ibm.com>
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
While doing cleanup of the allocated memory, make sure addresses being
unmapped/free were really allocated. During error conditions, some
address would not have been.
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
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>
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>
* 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>
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>
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>
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>