core: Account for 64-bit overflow in open-coded div_u64_u64

We run into an endless loop when trying to divide something which has
bit 63 set. In this case, tmp_div will overrun and never become larger
than the dividend. Detect this case and terminate the inner loop
properly.

Reported-by: Henning Schild <henning.schild@siemens.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
driver: Catch unconfigured CPUs earlier

As the driver allocates per-CPU buffers according to the system
configuration, calling into the hypervisor with a CPU outside that range
can cause a crash instead of a proper error return. Catch this case
earlier, already in the driver.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Revert "core: Validate CPU ID before using it"

This reverts commit c1eb94e35d03a71bb528fe1a6ab5304e840f91b0.

This attempt to protect us from out-of-bounds CPU IDs is futile: already
arch_entry requires a usable per-cpu data structure to save and - in
case of an error - restore Linux state. It's the driver's duty to
prevent hypervisor invocations on out-of-bounds CPUs.

Moreover the patch contained a regression as it passed an uninitialized
member of cpu_data to cpu_id_valid.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>