aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2018-05-29libnet: Wire up pxelinux.cfg network bootingThomas Huth3-5/+96
In case the normal network loading failed, try to load a pxelinux.cfg config file. If that succeeds, load the kernel and initrd with the information that could be found in this file. Signed-off-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2018-05-29libnet: Add functions for downloading and parsing pxelinux.cfg filesThomas Huth3-1/+246
Booting a kernel via pxelinux.cfg files is common on x86 and also with ppc64 bootloaders like petitboot, so it would be nice to support this in SLOF, too. This patch adds functions for downloading and parsing such pxelinux.cfg files. See this URL for more details on pxelinux.cfg: https://www.syslinux.org/wiki/index.php?title=PXELINUX Signed-off-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2018-05-29libnet: Put code for determing TFTP error strings into a separate functionThomas Huth3-73/+109
This way we can easily re-use the rc --> string translation in later patches. Reviewed-by: Greg Kurz <groug@kaod.org> Signed-off-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2018-05-29libc: Add the snprintf() functionThomas Huth3-1/+30
Code has been taken from the sprintf() function (which is almost the same, except that snprintf calls vsnprintf instead of vsprintf internally). Signed-off-by: Thomas Huth <thuth@redhat.com> [aik: fixed traling spaces] Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2018-05-29libnet: Pass ip_version via struct filename_ipThomas Huth3-12/+13
When we will support loading of pxelinux.cfg files later, we have to call the tftp load function multiple times from different places. To avoid that we've also got to pass around the ip_version information via function para- meters to all spots, let's rather put it into struct filename_ip instead since we've got this struct filename_ip info available everywhere already. While we're at it, also drop the __attribute__((packed)) from the struct. The struct is only used internally, without exchanging it with the outside world, so the attribute is certainly not necessary here. Signed-off-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2018-05-29resolve ihandle and xt handle in the input command (like for the output)Laurent Vivier1-16/+24
Signed-off-by: Laurent Vivier <lvivier@redhat.com> Reviewed-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2018-05-29Fix output wordLaurent Vivier1-5/+31
We can select the console output, but it does not really work Implement term-io-emit, as we have term-io-key to really send characters to the output selected by stdout. Resolve xt and ihandle in the output command. Use them in the new term-io-emit function. Signed-off-by: Laurent Vivier <lvivier@redhat.com> Reviewed-by: Thomas Huth <thuth@redhat.com> [aik: fixed commit log] Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2018-05-25obp-tftp: Make sure to not overwrite paflof in memoryThomas Huth1-1/+7
The obp-tftp package is currently using an arbitrary large value as maximal load size. If the downloaded file is big enough, we can easily erase Paflof in memory this way. Let's make sure that this can not happen by limiting the size to the amount of memory below the Paflof binary (which is close to the end of the RAM) in case of board-qemu, or the amount of memory between the minimum RAM size and the load-base on board-js2x. Signed-off-by: Thomas Huth <thuth@redhat.com> Reviewed-by: Greg Kurz <groug@kaod.org> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2018-05-25libnet: Get rid of unused huge_load and block_size parametersThomas Huth6-26/+10
The blocksize is hard-coded to 1428 bytes in obp-tftp.fs, so instead of hardcoding this in the Forth code, we could also move this into tftp.c directly instead. A similar condition exists with the huge-tftp-load parameter. While this non-standard variable could still be changed in the obp-tftp package, it does not make much sense to set it to zero since you only lose the possibility to do huge TFTP loads with index wrap-around in that case. Signed-off-by: Thomas Huth <thuth@redhat.com> Reviewed-by: Greg Kurz <groug@kaod.org> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2018-05-24libc: Check for NULL pointers in free()Thomas Huth1-1/+3
POSIX says that the free() function should simply do nothing if a NULL pointer argument has been specified. So let's be a little bit more compliant in our libc and add a NULL pointer check here, too. Reviewed-by: Greg Kurz <groug@kaod.org> Signed-off-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2018-05-24libc: Implement strrchr()Thomas Huth2-1/+29
This function will be used in one of the next patches to find the last slash in a file name string. Reviewed-by: Greg Kurz <groug@kaod.org> Signed-off-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2018-05-14libnet: Get rid of unnecessary (char *) castsThomas Huth6-33/+35
For some strange reasons, the libnet code is using int8_t arrays for strings in a couple of places where it really does not make any sense. Therefor a lot of "(char *)" casts are needed when the code is using the string functions from the libc. Let's change the strings to use "char" instead of "int8_t" so we can get rid of a lot of these casts. Signed-off-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2018-04-04broken_sc1: check for H_PRIVILEGENikunj A Dadhania2-5/+6
Recently, found that when DAWR was disabled by linux kernel, the hcall started returning H_UNSUPPORTED, and VM did not boot up as broken_sc1 patched up SC calls falsely. Instead of checking for various returns, check if its not in privilege mode and patch sc1 in that case. CC: Michael Ellerman <michael@ellerman.id.au> CC: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com> Reviewed-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2018-03-05OF: Use new property "stdout-path" for boot consoleNikunj A Dadhania1-1/+11
Linux kernel commit 2a9d832cc9aae21ea827520fef635b6c49a06c6d (of: Add bindings for chosen node, stdout-path) deprecated chosen property "linux,stdout-path" and "stdout". Check for new property "stdout-path" first and as a fallback check "linux,stdout-path". This older property can be deprecated after 5 years. Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2017-12-14version: update to 20171214qemu-slof-20171412qemu-slof-20171214Alexey Kardashevskiy1-1/+1
This is aimed to go to QEMU v2.12. Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2017-12-13boot: use a temporary bootdev-bufNikunj A Dadhania1-3/+38
The catpad size is 1K size, which can overflow easily with around 20 devices having bootindex. Replace usage of $cat with a dynamically allocated buffer(16K) here. Introduce new words to work on the buffer (allocate, free and concatenate) Reported here: https://github.com/qemu/SLOF/issues/3 Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2017-12-13boot: do not concatenate bootdevNikunj A Dadhania1-2/+10
We were concatenating the word " parse-load" and $bootdev list that was input to evaluate. Open code EVALUATE work such that concatenation is not required. "load" and "load-next" does not use $cat anymore. Reported here: https://github.com/qemu/SLOF/issues/3 Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2017-12-11libvirtio: Mark struct virtio_scsi_req_cmd as packedThomas Huth1-1/+1
The struct contains an uneven amount of bytes, so we should use the "packed" attribute to avoid padding problems here. So far the problems did not show up yet since the struct is filled by Forth code only and QEMU seems to be quite forgiving about the length of the descriptor, but anyway, let's better be safe than sorry here. Signed-off-by: Thomas Huth <thuth@redhat.com> Reviewed-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2017-11-06fdt: Implement "fdt-fetch" method for client interfaceAlexey Kardashevskiy1-0/+16
The guest kernel fetches the device tree via the client interface, calling it for every node and property, and traversing the entire tree twice - first to build strings blob, second - to build struct blob. On top of that there is also not so efficient implementation of the "getprop" method - it calls slow "get-property" which does full search for a property. As the result, on a 256 CPU + 256 Intel E1000 virtual devices, the guest's flatten_device_tree() takes roughly 8.5sec. However now we have a FDT rendering helper in SLOF which takes about 350ms to render the FDT. This implements a client interface call to allow the guest to read it during early boot and save time. The produced DTB is almost the same as the guest kernel would have produced itself - the differences are: 1. SLOF creates an empty reserved map; the guest can easily fix it up later; 2. SLOF only reuses 40 most popular strings; the guest reuses everything it can - on a 256CPU + 256 PCI devices guest, the difference is about 20KB for 350KB FDT blob. Note, that the guest also ditches the "name" property just like SLOF does: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/powerpc/kernel/prom_init.c?h=v4.13#n2302 Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru> --- If the guest tries "fdt-fetch" and SLOF does not have it, than SLOF prints an error: === copying OF device tree... fdt-fetch NOT FOUNDBuilding dt strings... Building dt structure... === and the guest continues with the old method. We could suppress SLOF error for such unlikely situation though.
2017-11-06rtas: Store RTAS address and entry in the device treeAlexey Kardashevskiy1-0/+7
At the moment we count on the guest kernel to update or create device tree properties pointing to the instantiated RTAS copy which is not very reliable. This stores rtas-base and rtas-size in the DT at the instantiation point so later on the H_UPDATE_DT hcall can supply QEMU with an updated location of RTAS. This superseeds f9a60de30 "Add private HCALL to inform updated RTAS base and entry". Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru> --- Changes: v5: * ditched rtas-entry, added rtas-size (which is always 20 bytes though)
2017-11-06board-qemu: Fix slof-build-id lengthAlexey Kardashevskiy3-8/+7
The existing code hardcodes the length of /openprom/model to 10 characters even though it is less than that - len("aik")==3. All 10 chars go to the device tree blob and DTC complains on such a property as there are characters after terminating null: aik@fstn1-p1:~$ dtc -f -I dtb -O dts -o dbg.dts dbg.dtb Warning (model_is_string): "model" property in /openprom is not a string This uses the real length and limits it by 10 to avoid breaking something. Since the same code parses the build id field, this moves from-cstring to a common place for both js2x and qemu boards. Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2017-11-06fdt: Pass the resulting device tree to QEMUAlexey Kardashevskiy6-1/+282
This creates flatten device tree and passes it to QEMU via a custom hypercall right before jumping to RTAS. This preloads strings with 40 property names from CPU and PCI device nodes and the strings lookup only searches within these. Test results on a guest with 256 CPUs and 256 virtual Intel E1000 devices running on a POWER8 box: FDTsize=366024 Strings=15888 Struct=350080 Reused str=12457 242 ms A simple guest (one CPU, no PCI) with this patch as is: FDTsize=15940 Strings=3148 Struct=12736 Reused str=84 7 ms While we are here, fix the version handling in fdt-init. It only matters a little for the fdt-debug==1 case though. Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru> --- Changes: v6: * fix memory sizes for free-mem * store correct chosen-cpu to the header (used to be just 0) * fdt-skip-string uses zcount now and works 30% faster * moved to a new file - fdt-fl.fs v5: * applied latest comments from Segher * s/fdt-property/fdt-copy-property/, s/fdt-properties/fdt-copy-properties/ * reduced the temporary buffers to 1MB each as the guest uses 1MB in total anyway * do not pass root phandle to fdt-flatten-tree, it fetches it from device-tree itself * reworked fdt-copy-properties to use for-all-words proposed by Segher v4: * reworked fdt-properties, works lot faster * do not store "name" properties as nodes have names already v3: * fixed stack handling after hcall returned * fixed format versions in both rendering and parsing paths * rebased on top of removed unused hvcalls * renamed used variables to have fdtfl- prefixes as there are already some for parsing the initial dt v2: * fixed comments from review * added strings cache * changed last_compat_vers from 0x17 to 0x16 as suggested by dwg --- I tested the blob by storing it from QEMU to a file and decompiling it.
2017-11-06fdt: Fix version and add a word for FDT header sizeAlexey Kardashevskiy1-2/+2
This fixes the version handling in fdt-init. It only matters a little for the fdt-debug==1 case though. This defines /fdth word for the FDT header size; this will be used in the next patch. Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru> Reviewed-by: Greg Kurz <groug@kaod.org>
2017-11-03tree: Rework set-chosen-cpu and store /chosen ihandle and phandleAlexey Kardashevskiy2-6/+11
This replaces current set-chosen-cpu with a cleaner and faster implementation which does not clobber the current node and stores the chosen CPU phandle/ihandle. This adds a helper to get the chosen CPU unit address. This moves chosen cpu words to root.fs as otherwise it is quite hard to maintain dependencies. Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru> Reviewed-by: Segher Boessenkool <segher@kernel.crashing.org>
2017-10-24node: Add some documentationAlexey Kardashevskiy2-1/+17
This adds some internal structure commented definitions so they won't break things now and grep can find them. Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2017-10-24Revert various SLOF-to-QEMU private hypercallsAlexey Kardashevskiy5-37/+4
This reverts commits: 604d28cc3 "board-qemu: add private hcall to inform host on "phandle" update" 089fc18a9 "libhvcall: drop unused KVMPPC_H_REPORT_MC_ERR and KVMPPC_H_NMI_MCE defines" 1c17c13a5 "rtas: Improve error handling in instantiate-rtas" f9a60de30 "Add private HCALL to inform updated RTAS base and entry" A bigger hammer is coming soon which will pass the entire device tree to QEMU, not just some random bits. Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru> Reviewed-by: Greg Kurz <groug@kaod.org>
2017-10-04Use input-device and output-deviceLaurent Vivier1-0/+14
QEMU can now set environment variables from the command line (with -prom-env). By this means, we can set the output-device and input-device variables, and SLOF can read it and set stdout and stdin accordingly. Signed-off-by: Laurent Vivier <lvivier@redhat.com> Tested-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2017-09-26netboot: Create bootp-response when bootp is usedNikunj A Dadhania6-29/+74
According to TFTP Booting extension, after the success of BOOTP, BOOTREPLY packet should be copied to bootp-response property under "/chosen" While in current case, even when DHCP was used, bootp-response was being set. So set bootp-response when BOOTP is used and dhcp-response for DHCP Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2017-09-26libnet/ipv6: assign times_asked value directlyNikunj A Dadhania1-1/+1
times_asked value remains same as the structure is zeroed, but it makes more sense to do that directly instead of adding with previous value. Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com> Reviewed-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2017-09-12usb-xhci: Reset ERSTSZ together with ERSTBAAlexey Kardashevskiy1-0/+2
When shutting down the adapter, SLOF writes 0 to the Event Ring Segment Table Base Address Register (ERSTBA) but does not reset the Event Ring Segment Table Size Register (ERSTSZ) which makes QEMU do DMA access at zero address which fails in unassigned_mem_accepts. This resets ERSTSZ right before resetting ERSTBA so these 2 registers can stay in sync. Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru> Reviewed-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
2017-08-07virtio-net: rework the driver to support multiple openNikunj A Dadhania6-94/+130
Found that virtio-net is using a around 200K receive buffer per device, if we connect more than 40 virtio-net devices the heap(8MB) gets over. Because of which allocation starts failing and the VM does not boot. Moreover, the driver did not support opening multiple device, which is possible using the OF client interface. As it was using globals to store the state information of the driver. Now the driver allocates a virtio_net structure during device open stage and fills in the state information. This details are used during various device functions and finally for cleaning up on close operation. Now as the buffer memory is allocated during open and freed during the close operations the heap usage is contained. Reported-by: Satheesh Rajendran <sathnaga@linux.vnet.ibm.com> Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com> Reviewed-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2017-07-25board-qemu: add private hcall to inform host on "phandle" updateGreg Kurz4-2/+21
The "interrupt-map" property in each PHB node references the "phandle" property of the "interrupt-controller" node. This is used by the guest OS to setup IRQs for any PCI device plugged into the PHB. QEMU sets this property to an arbitrary value in the flattened DT passed to SLOF. Since commit 82954d4c1088, SLOF has some generic code to convert all references to any "phandle" property to a SLOF specific value. This is is perfectly okay for coldplug devices, since the guest OS only sees the converted value in "interrupt-map". It is a problem though for hotplug devices. Since they don't go through SLOF, the guest OS receives the arbitrary value set by QEMU and fails to setup IRQs. In order to support PHB hotplug, this patch introduces a new private hcall, which allows SLOF to tell QEMU that a "phandle" was converted from an old value to a new value. Suggested-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Greg Kurz <groug@kaod.org> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2017-07-24version: update to 20170724qemu-slof-20170724Alexey Kardashevskiy1-1/+1
This is aimed to go to QEMU v2.10. Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2017-07-24pci-scan: Fix pci-bridge-set-mem-base and pci-bridge-set-mem-limitThomas Huth1-37/+46
The functions used a bogus mixture between programming the registers with pci-next-mem64 and pci-next-mem - the upper register bits were filled with the value from the 64-bit memory space while the lower bits were filled with the bits from the 32-bit memory space variable. This separates handling of pci-{next|max}-mem64 from pci-{next|max}-mem. This zeroes bottom 4 bits of the prefetchable memory limit and prefetchable memory base registers for 32bit windows to enforce that the resources are marked as 32bit. This simplifies updating of the prefetchable memory limit in ci-bridge-set-mem-limit. Signed-off-by: Thomas Huth <thuth@redhat.com> [aik: extended commit log with 32bit window changes] Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru> Reviewed-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
2017-07-21pci: Avoid 32-bit prefetchable memory area if possibleThomas Huth2-6/+17
PCI bridges can only have one prefetchable memory area. If we are already using 64-bit prefetchable memory regions, we can not use a dedicated 32-bit prefetchable memory region anymore. In that case the 32-bit BARs should all be located in the 32-bit non- prefetchable memory space instead. Signed-off-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2017-07-21Remove unused functions ishexdigit and $cat-commaThomas Huth1-10/+2
They are completely unused, and ishexdigit seems even to be implemented in a wrong way, thus let's simply remove them. Signed-off-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2017-07-20pci: Translate PCI addresses to host addresses at the end of map-inThomas Huth1-1/+1
Currently, it is not possible to use VGA devices attached to a PCI bridge on board-qemu, e.g. by starting QEMU like this: qemu-system-ppc64 -nodefaults -device pci-bridge,id=br1,chassis_nr=1 \ -serial mon:stdio -device VGA,id=video,bus=br1,addr=1 One of the problems is the missing translate-address at the end of the map-in function of the bridge - which was already marked as a TODO, but apparently has never been enabled. So let's do that now! Signed-off-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2017-07-20Define 'open' and 'close' words of the /aliases nodes right from the startThomas Huth3-10/+2
It's much easier to do this when we create the node instead of looking up the device node again later in each of the boards. Signed-off-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2017-07-19virtio-scsi: Allow LUNs bigger than 255Thomas Huth1-0/+1
The virtio-scsi device expects LUNs according to a "Single level LUN structure" as defined in the "SCSI Architecture Model" specification. SLOF currently only uses the "Single level LUN structure using peripheral device addressing method" which provides the possibility to specify up to 256 different LUNs. To be able to use LUNs greater than 255, the "Single level LUN structure using flat space addressing method" has to be used instead. This can be done by setting the top-most bits to "01" instead of "00" in the first byte of the two LUN bytes. Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=1431584 Signed-off-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2017-07-19paflof: Silence gcc's -Warray-bounds warning for stack pointersAlexey Kardashevskiy1-2/+2
The SLOF stack pointers - dp/rp - point to the top used element which means for an empty stack they point to an element below the stack. This means that for pushing to the stack we can use a store-with-update instruction (stdu). This generates good code for most primitives, better than the other stack pointer offsets. However, with -Warray-bounds enabled, this produces warnings like below: At the moment SLOF is gcc produces a warning: /home/aik/p/slof/slof/paflof.c: In function ‘engine’: /home/aik/p/slof/slof/paflof.c:84:23: warning: array subscript is below array bounds [-Warray-bounds] dp = the_data_stack - 1; ~~~~~~~~~~~~~~~^~~ This silences gcc by doing c-cast. Suggested-by: Segher Boessenkool <segher@kernel.crashing.org> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru> Reviewed-by: Thomas Huth <thuth@redhat.com> --- uintptr_t is not used anywhere in SLOF, hence type_u.
2017-07-17board_qemu: move code out of fdt-fix-node-phandleGreg Kurz1-14/+22
This patch moves the code that actually alter the device tree to a separate word, for improved readability. While here, it also makes the comment of fdt-replace-all-phandles more accurate. Signed-off-by: Greg Kurz <groug@kaod.org> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2017-07-17board_qemu: drop unused values early in fdt-fix-node-phandleGreg Kurz1-4/+3
These two values are pushed on the stack by decode-int and stay unused until the 2drop line. Let's drop them right away to make it obvious. Signed-off-by: Greg Kurz <groug@kaod.org> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2017-07-17pci: Improve the pci-var-out debug functionThomas Huth2-11/+9
Print all related variables, using the code from phb-parse-ranges in board-qemu/slof/pci-phb.fs, so that we can easily check all the values from the SLOF prompt, too. Signed-off-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2017-07-11libhvcall: drop unused KVMPPC_H_REPORT_MC_ERR and KVMPPC_H_NMI_MCE definesGreg Kurz1-2/+0
These defines were introduced to add support for FWNMI in KVM guests. This has been WIP since 2015 and the KVM part finally made it to kvm-ppc-next. Latest work on the QEMU side [1] no longer needs KVMPPC_H_REPORT_MC_ERR. The KVMPPC_HCALL_MAX define is never used anywhere, and moreover it is bogus since there's no KVMPPC_H_NMI_MCE private hcall. [1] http://lists.nongnu.org/archive/html/qemu-ppc/2015-12/msg00199.html Signed-off-by: Greg Kurz <groug@kaod.org> Reviewed-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2017-07-10libnet: Move parse_tftp_args to tftp.cThomas Huth2-106/+104
To be able to re-use the libnet code in other projects (where the rather Open Firmware specific netload.c can not be used), the function parse_tftp_args() must be moved to another file. The function is related to TFTP, and its prototype is already declared in tftp.h, so the code should reside in tftp.c. Signed-off-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2017-07-07libnet: Make the code compilable with -Wformat-securityThomas Huth2-2/+2
When compiling the libnet code with the -Wformat-security compiler flag, there is a warning in tftp.c that printf is used without format argument. It's not a real problem here, but let's make the code ready for this compiler flag anyway and add a proper format string here, too. Signed-off-by: Thomas Huth <thuth@redhat.com> Reviewed-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2017-07-07libnet: Move the external declaration of send_ip to ethernet.hThomas Huth3-4/+3
When compiling SLOF with the -Wredundant-decls compiler flag, there is currently a warning in the libnet code since the send_ip pointer is currently declared twice, one time in ipv4.h and one time in ipv6.h. To avoid this warning, let's move the declaration to IP-version independent ethernet.h instead. Signed-off-by: Thomas Huth <thuth@redhat.com> Reviewed-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2017-07-07libc: Declare size_t as unsigned longThomas Huth1-2/+1
If size_t is only "int", memset() and friends are limited to 4 GB. And ssize_t is already declared as "long", so it is somewhat inconsequent to define size_t as "int" only. Signed-off-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2017-06-30libnet/netload: Three more minor clean-upsThomas Huth1-12/+13
The error code in netload_error() could be longer than 4 characters, so we should rather use the calculated string length here instead. The tftp_err variable is only used in tftp_load() so it can be moved there. And the icmp_err_str variable only points to constant strings, so it should be marked with "const". Signed-off-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2017-06-30libnet/tftp: Allow loading to address 0Thomas Huth1-5/+6
It's theoretically possible to load a file to address 0, too, so we should use a different marker than NULL to check for a valid buffer. Signed-off-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>