From: Jan Kiszka <[email protected]> When this logic was defined, first_cpu didn't exist yet. It's finally time to renovate it.
Signed-off-by: Jan Kiszka <[email protected]> --- hypervisor/arch/x86/iommu.c | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/hypervisor/arch/x86/iommu.c b/hypervisor/arch/x86/iommu.c index 68ca323f..de17144f 100644 --- a/hypervisor/arch/x86/iommu.c +++ b/hypervisor/arch/x86/iommu.c @@ -1,7 +1,7 @@ /* * Jailhouse, a Linux-based partitioning hypervisor * - * Copyright (c) Siemens AG, 2014, 2015 + * Copyright (c) Siemens AG, 2014-2020 * * Authors: * Jan Kiszka <[email protected]> @@ -27,18 +27,14 @@ unsigned int iommu_count_units(void) struct public_per_cpu *iommu_select_fault_reporting_cpu(void) { - struct public_per_cpu *target_data; - unsigned int n; - - /* This assumes that at least one bit is set somewhere because we - * don't support configurations where Linux is left with no CPUs. */ - for (n = 0; root_cell.cpu_set->bitmap[n] == 0; n++) - /* Empty loop */; - target_data = public_per_cpu(ffsl(root_cell.cpu_set->bitmap[n])); - - /* Save this value globally to avoid multiple reports of the same - * case from different CPUs */ - fault_reporting_cpu_id = target_data->cpu_id; - - return target_data; + /* + * The selection process assumes that at least one bit is set somewhere + * because we don't support configurations where Linux is left with no + * CPUs. + * Save this value globally to avoid multiple reports of the same + * case from different CPUs. + */ + unsigned int fault_reporting_cpu_id = first_cpu(root_cell.cpu_set); + + return public_per_cpu(fault_reporting_cpu_id); } -- 2.16.4 -- You received this message because you are subscribed to the Google Groups "Jailhouse" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/jailhouse-dev/35064003c32d04844334b2607d30bb66aa5222cf.1581770164.git.jan.kiszka%40web.de.
