hw/i386: changes towards enabling -Wshadow=local
PATCH v2 1/1 hw/i386: changes towards enabling -Wshadow=local
Code changes that addresses all compiler complaints coming from enabling -Wshadow flags. Enabling -Wshadow catches cases of local variables shadowing other local variables or parameters. These makes the code confusing and/or adds bugs that are difficult to catch.
CC: Markus Armbruster <[email protected]>
CC: Philippe Mathieu-Daude <[email protected]>
CC: [email protected]
Message-Id: <[email protected]>
--- hw/i386/acpi-microvm.c | 12 ++++++------ hw/i386/intel_iommu.c | 8 ++++---- hw/i386/pc.c | 1 - hw/i386/x86.c | 2 -- 4 files changed, 10 insertions(+), 13 deletions(-)
changelog:
v2: kept Peter's changes from https://lore.kernel.org/r/[email protected]
and removed mine.
hw/i386/acpi-microvm.c +6 -6
@@ -78,18 +78,18 @@ static void acpi_dsdt_add_virtio(Aml *scope,hwaddr base =VIRTIO_MMIO_BASE + index *512 ;hwaddr size =512 ; -Aml *dev =aml_device ("VR%02u" , (unsigned )index); -aml_append (dev,aml_name_decl ("_HID" ,aml_string ("LNRO0005" ))); -aml_append (dev,aml_name_decl ("_UID" ,aml_int (index))); -aml_append (dev,aml_name_decl ("_CCA" ,aml_int (1 ))); +Aml *adev =aml_device ("VR%02u" , (unsigned )index); +aml_append (adev,aml_name_decl ("_HID" ,aml_string ("LNRO0005" ))); +aml_append (adev,aml_name_decl ("_UID" ,aml_int (index))); +aml_append (adev,aml_name_decl ("_CCA" ,aml_int (1 )));Aml *crs =aml_resource_template ();aml_append (crs,aml_memory32_fixed (base, size,AML_READ_WRITE ));aml_append (crs,aml_interrupt (AML_CONSUMER ,AML_LEVEL ,AML_ACTIVE_HIGH ,AML_EXCLUSIVE , &irq,1 )); -aml_append (dev,aml_name_decl ("_CRS" , crs)); -aml_append (scope, dev); +aml_append (adev,aml_name_decl ("_CRS" , crs)); +aml_append (scope, adev); } } }
hw/i386/intel_iommu.c +4 -4
@@ -3744,7 +3744,7 @@ VTDAddressSpace *vtd_find_add_as(IntelIOMMUState *s, PCIBus *bus,/* Unmap the whole range in the notifier's scope. */ static void vtd_address_space_unmap (VTDAddressSpace *as,IOMMUNotifier *n) { -hwaddr size, remain; +hwaddr total, remain;hwaddr start = n->start;hwaddr end = n->end;IntelIOMMUState *s = as->iommu_state;
@@ -3765,7 +3765,7 @@ static void vtd_address_space_unmap(VTDAddressSpace *as, IOMMUNotifier *n) }assert (start <= end); - size = remain = end - start +1 ; + total = remain = end - start +1 ;while (remain >=VTD_PAGE_SIZE ) {IOMMUTLBEvent event;
@@ -3793,10 +3793,10 @@ static void vtd_address_space_unmap(VTDAddressSpace *as, IOMMUNotifier *n)trace_vtd_as_unmap_whole (pci_bus_num (as->bus),VTD_PCI_SLOT (as->devfn),VTD_PCI_FUNC (as->devfn), - n->start, size); + n->start, total); map.iova = n->start; - map.size = size -1 ;/* Inclusive */ + map.size = total -1 ;/* Inclusive */ iova_tree_remove (as->iova_tree, map); }
hw/i386/pc.c +0 -1
@@ -1116,7 +1116,6 @@ void pc_memory_init(PCMachineState *pcms,if (machine->device_memory) {uint64_t *val =g_malloc (sizeof (*val)); -PCMachineClass *pcmc =PC_MACHINE_GET_CLASS (pcms);uint64_t res_mem_end = machine->device_memory->base;if (!pcmc->broken_reserved_end) {
hw/i386/x86.c +0 -2
@@ -365,8 +365,6 @@ void x86_cpu_pre_plug(HotplugHandler *hotplug_dev, cpu_slot =x86_find_cpu_slot (MACHINE (x86ms), cpu->apic_id, &idx);if (!cpu_slot) { -MachineState *ms =MACHINE (x86ms); -x86_topo_ids_from_apicid (cpu->apic_id, &topo_info, &topo_ids);error_setg (errp, "Invalid CPU [socket: %u, die: %u, core: %u, thread: %u] with"
Signature · 1 line
2.39.3
Quoted 3 lines · Ani Sinha
Code changes that addresses all compiler complaints coming from enabling -Wshadow flags. Enabling -Wshadow catches cases of local variables shadowing other local variables or parameters. These makes the code confusing and/or adds
These make
Quoted 10 lines
bugs that are difficult to catch.
CC: Markus Armbruster <[email protected]>
CC: Philippe Mathieu-Daude <[email protected]>
CC: [email protected]
Message-Id: <[email protected]>Signed-off-by Ani Sinha <[email protected]>Reviewed-by Daniel P. Berrangé <[email protected]>Reviewed-by Peter Xu <[email protected]>---
chunks seem unrelated. why not split them up?
Quoted 29 lines
hw/i386/acpi-microvm.c | 12 ++++++------ hw/i386/intel_iommu.c | 8 ++++---- hw/i386/pc.c | 1 - hw/i386/x86.c | 2 -- 4 files changed, 10 insertions(+), 13 deletions(-)changelog:
v2: kept Peter's changes from https://lore.kernel.org/r/[email protected]
and removed mine.hw/i386/acpi-microvm.c +4
-4@@ -78,18 +78,18 @@ static void acpi_dsdt_add_virtio(Aml *scope,hwaddr base =VIRTIO_MMIO_BASE + index *512 ;hwaddr size =512 ; -Aml *dev =aml_device ("VR%02u" , (unsigned )index); -aml_append (dev,aml_name_decl ("_HID" ,aml_string ("LNRO0005" ))); -aml_append (dev,aml_name_decl ("_UID" ,aml_int (index))); -aml_append (dev,aml_name_decl ("_CCA" ,aml_int (1 ))); +Aml *adev =aml_device ("VR%02u" , (unsigned )index); +aml_append (adev,aml_name_decl ("_HID" ,aml_string ("LNRO0005" ))); +aml_append (adev,aml_name_decl ("_UID" ,aml_int (index))); +aml_append (adev,aml_name_decl ("_CCA" ,aml_int (1 )));Aml *crs =aml_resource_template ();aml_append (crs,aml_memory32_fixed (base, size,AML_READ_WRITE ));
hw/i386/acpi-microvm.c static void acpi_dsdt_add_virtio(Aml *scope, · line 95
Quoted 10 lines
hw/i386/acpi-microvm.c +2
-2aml_append (crs,aml_interrupt (AML_CONSUMER ,AML_LEVEL ,AML_ACTIVE_HIGH ,AML_EXCLUSIVE , &irq,1 )); -aml_append (dev,aml_name_decl ("_CRS" , crs)); -aml_append (scope, dev); +aml_append (adev,aml_name_decl ("_CRS" , crs)); +aml_append (scope, adev); } } }
I would prefer to just drop the devicestate dev pointer, use kid->child inside the macro.
Quoted 25 lines
hw/i386/intel_iommu.c +2
-2@@ -3744,7 +3744,7 @@ VTDAddressSpace *vtd_find_add_as(IntelIOMMUState *s, PCIBus *bus,/* Unmap the whole range in the notifier's scope. */ static void vtd_address_space_unmap (VTDAddressSpace *as,IOMMUNotifier *n) { -hwaddr size, remain; +hwaddr total, remain;hwaddr start = n->start;hwaddr end = n->end;IntelIOMMUState *s = as->iommu_state;@@ -3765,7 +3765,7 @@ static void vtd_address_space_unmap(VTDAddressSpace *as, IOMMUNotifier *n) }assert (start <= end); - size = remain = end - start +1 ; + total = remain = end - start +1 ;while (remain >=VTD_PAGE_SIZE ) {IOMMUTLBEvent event;@@ -3793,10 +3793,10 @@ static void vtd_address_space_unmap(VTDAddressSpace *as, IOMMUNotifier *n) trace_vtd_as_unmap_whole(pci_bus_num(as->bus), VTD_PCI_SLOT(as->devfn),
hw/i386/intel_iommu.c static void vtd_address_space_unmap(VTDAddressSpace *as, IOMMUNotifier *n) · line 3802
Quoted 10 lines
hw/i386/intel_iommu.c +2
-2VTD_PCI_FUNC (as->devfn), - n->start, size); + n->start, total); map.iova = n->start; - map.size = size -1 ;/* Inclusive */ + map.size = total -1 ;/* Inclusive */ iova_tree_remove (as->iova_tree, map); }
arguably an improvement
Quoted 17 lines
hw/i386/pc.c +0
-1@@ -1116,7 +1116,6 @@ void pc_memory_init(PCMachineState *pcms,if (machine->device_memory) {uint64_t *val =g_malloc (sizeof (*val)); -PCMachineClass *pcmc =PC_MACHINE_GET_CLASS (pcms);uint64_t res_mem_end = machine->device_memory->base;if (!pcmc->broken_reserved_end) {hw/i386/x86.c +0
-0
hw/i386/x86.c void x86_cpu_pre_plug(HotplugHandler *hotplug_dev, · line 370
Quoted 8 lines
hw/i386/x86.c +0
-2@@ -365,8 +365,6 @@ void x86_cpu_pre_plug(HotplugHandler *hotplug_dev, cpu_slot =x86_find_cpu_slot (MACHINE (x86ms), cpu->apic_id, &idx);if (!cpu_slot) { -MachineState *ms =MACHINE (x86ms); -x86_topo_ids_from_apicid (cpu->apic_id, &topo_info, &topo_ids);error_setg (errp, "Invalid CPU [socket: %u, die: %u, core: %u, thread: %u] with"
killing dead code, nice
Quoted 2 lines
Signature · 1 line
2.39.3
Quoted 23 lines · Michael S. Tsirkin
Quoted 3 lines · Ani Sinha
Code changes that addresses all compiler complaints coming from enabling -Wshadow flags. Enabling -Wshadow catches cases of local variables shadowing other local variables or parameters. These makes the code confusing and/or adds
These make
Quoted 10 lines
bugs that are difficult to catch.
CC: Markus Armbruster <[email protected]>
CC: Philippe Mathieu-Daude <[email protected]>
CC: [email protected]
Message-Id: <[email protected]>Signed-off-by Ani Sinha <[email protected]>Reviewed-by Daniel P. Berrangé <[email protected]>Reviewed-by Peter Xu <[email protected]>---
Quoted 1 line
chunks seem unrelated. why not split them up?
? No idea what you talking about. Here and ...
Quoted 28 lines
Quoted 28 lines
hw/i386/acpi-microvm.c | 12 ++++++------ hw/i386/intel_iommu.c | 8 ++++---- hw/i386/pc.c | 1 - hw/i386/x86.c | 2 -- 4 files changed, 10 insertions(+), 13 deletions(-)changelog:
v2: kept Peter's changes from https://lore.kernel.org/r/[email protected]
and removed mine.hw/i386/acpi-microvm.c +4
-4@@ -78,18 +78,18 @@ static void acpi_dsdt_add_virtio(Aml *scope,hwaddr base =VIRTIO_MMIO_BASE + index *512 ;hwaddr size =512 ; -Aml *dev =aml_device ("VR%02u" , (unsigned )index); -aml_append (dev,aml_name_decl ("_HID" ,aml_string ("LNRO0005" ))); -aml_append (dev,aml_name_decl ("_UID" ,aml_int (index))); -aml_append (dev,aml_name_decl ("_CCA" ,aml_int (1 ))); +Aml *adev =aml_device ("VR%02u" , (unsigned )index); +aml_append (adev,aml_name_decl ("_HID" ,aml_string ("LNRO0005" ))); +aml_append (adev,aml_name_decl ("_UID" ,aml_int (index))); +aml_append (adev,aml_name_decl ("_CCA" ,aml_int (1 )));
Quoted 15 lines
hw/i386/acpi-microvm.c static void acpi_dsdt_add_virtio(Aml *scope, · line 95
Quoted 12 lines
hw/i386/acpi-microvm.c +2
-2Aml *crs =aml_resource_template ();aml_append (crs,aml_memory32_fixed (base, size,AML_READ_WRITE ));aml_append (crs,aml_interrupt (AML_CONSUMER ,AML_LEVEL ,AML_ACTIVE_HIGH ,AML_EXCLUSIVE , &irq,1 )); -aml_append (dev,aml_name_decl ("_CRS" , crs)); -aml_append (scope, dev); +aml_append (adev,aml_name_decl ("_CRS" , crs)); +aml_append (scope, adev); } } }I would prefer to just drop the devicestate dev pointer, use
kid->childinside the macro.
Here …
Quoted 72 lines
Quoted 26 lines
hw/i386/intel_iommu.c +2
-2@@ -3744,7 +3744,7 @@ VTDAddressSpace *vtd_find_add_as(IntelIOMMUState *s, PCIBus *bus,/* Unmap the whole range in the notifier's scope. */ static void vtd_address_space_unmap (VTDAddressSpace *as,IOMMUNotifier *n) { -hwaddr size, remain; +hwaddr total, remain;hwaddr start = n->start;hwaddr end = n->end;IntelIOMMUState *s = as->iommu_state;@@ -3765,7 +3765,7 @@ static void vtd_address_space_unmap(VTDAddressSpace *as, IOMMUNotifier *n) }assert (start <= end); - size = remain = end - start +1 ; + total = remain = end - start +1 ;while (remain >=VTD_PAGE_SIZE ) {IOMMUTLBEvent event;@@ -3793,10 +3793,10 @@ static void vtd_address_space_unmap(VTDAddressSpace *as, IOMMUNotifier *n) trace_vtd_as_unmap_whole(pci_bus_num(as->bus), VTD_PCI_SLOT(as->devfn),hw/i386/intel_iommu.c static void vtd_address_space_unmap(VTDAddressSpace *as, IOMMUNotifier *n) · line 3802
Quoted 10 lines
hw/i386/intel_iommu.c +2
-2VTD_PCI_FUNC (as->devfn), - n->start, size); + n->start, total); map.iova = n->start; - map.size = size -1 ;/* Inclusive */ + map.size = total -1 ;/* Inclusive */ iova_tree_remove (as->iova_tree, map); }arguably an improvement
Quoted 17 lines
hw/i386/pc.c +0
-1@@ -1116,7 +1116,6 @@ void pc_memory_init(PCMachineState *pcms,if (machine->device_memory) {uint64_t *val =g_malloc (sizeof (*val)); -PCMachineClass *pcmc =PC_MACHINE_GET_CLASS (pcms);uint64_t res_mem_end = machine->device_memory->base;if (!pcmc->broken_reserved_end) {hw/i386/x86.c +0
-0hw/i386/x86.c void x86_cpu_pre_plug(HotplugHandler *hotplug_dev, · line 370
Quoted 8 lines
hw/i386/x86.c +0
-2@@ -365,8 +365,6 @@ void x86_cpu_pre_plug(HotplugHandler *hotplug_dev, cpu_slot =x86_find_cpu_slot (MACHINE (x86ms), cpu->apic_id, &idx);if (!cpu_slot) { -MachineState *ms =MACHINE (x86ms); -x86_topo_ids_from_apicid (cpu->apic_id, &topo_info, &topo_ids);error_setg (errp, "Invalid CPU [socket: %u, die: %u, core: %u, thread: %u] with"killing dead code, nice
Quoted 2 lines
Signature · 1 line
2.39.3
Quoted 23 lines · Ani Sinha
Quoted 23 lines · Michael S. Tsirkin
Quoted 3 lines · Ani Sinha
Code changes that addresses all compiler complaints coming from enabling -Wshadow flags. Enabling -Wshadow catches cases of local variables shadowing other local variables or parameters. These makes the code confusing and/or adds
These make
Quoted 10 lines
bugs that are difficult to catch.
CC: Markus Armbruster <[email protected]>
CC: Philippe Mathieu-Daude <[email protected]>
CC: [email protected]
Message-Id: <[email protected]>Signed-off-by Ani Sinha <[email protected]>Reviewed-by Daniel P. Berrangé <[email protected]>Reviewed-by Peter Xu <[email protected]>---
Quoted 3 lines
Quoted 1 line
chunks seem unrelated. why not split them up?
? No idea what you talking about. Here and ...
you patch 4 files in a single patch. intel_iommu is part of vtd emulation and
has separate maintainers. Slightly better to split up to have each maintainer get just the patches he cares about.
Not critical, for sure.
Quoted 44 lines
Quoted 28 lines
Quoted 28 lines
hw/i386/acpi-microvm.c | 12 ++++++------ hw/i386/intel_iommu.c | 8 ++++---- hw/i386/pc.c | 1 - hw/i386/x86.c | 2 -- 4 files changed, 10 insertions(+), 13 deletions(-)changelog:
v2: kept Peter's changes from https://lore.kernel.org/r/[email protected]
and removed mine.hw/i386/acpi-microvm.c +4
-4@@ -78,18 +78,18 @@ static void acpi_dsdt_add_virtio(Aml *scope,hwaddr base =VIRTIO_MMIO_BASE + index *512 ;hwaddr size =512 ; -Aml *dev =aml_device ("VR%02u" , (unsigned )index); -aml_append (dev,aml_name_decl ("_HID" ,aml_string ("LNRO0005" ))); -aml_append (dev,aml_name_decl ("_UID" ,aml_int (index))); -aml_append (dev,aml_name_decl ("_CCA" ,aml_int (1 ))); +Aml *adev =aml_device ("VR%02u" , (unsigned )index); +aml_append (adev,aml_name_decl ("_HID" ,aml_string ("LNRO0005" ))); +aml_append (adev,aml_name_decl ("_UID" ,aml_int (index))); +aml_append (adev,aml_name_decl ("_CCA" ,aml_int (1 )));Quoted 15 lines
hw/i386/acpi-microvm.c static void acpi_dsdt_add_virtio(Aml *scope, · line 95
Quoted 12 lines
hw/i386/acpi-microvm.c +2
-2Aml *crs =aml_resource_template ();aml_append (crs,aml_memory32_fixed (base, size,AML_READ_WRITE ));aml_append (crs,aml_interrupt (AML_CONSUMER ,AML_LEVEL ,AML_ACTIVE_HIGH ,AML_EXCLUSIVE , &irq,1 )); -aml_append (dev,aml_name_decl ("_CRS" , crs)); -aml_append (scope, dev); +aml_append (adev,aml_name_decl ("_CRS" , crs)); +aml_append (scope, adev); } } }I would prefer to just drop the devicestate dev pointer, use
kid->childinside the macro.
Quoted 2 lines
Here …
Well, you renamed dev to adev because there's another dev at an outer scope which is set to kid->child, and only used once. I suggest just dropping that one instead of removing this one.
Quoted 72 lines
Quoted 72 lines
Quoted 26 lines
hw/i386/intel_iommu.c +2
-2@@ -3744,7 +3744,7 @@ VTDAddressSpace *vtd_find_add_as(IntelIOMMUState *s, PCIBus *bus,/* Unmap the whole range in the notifier's scope. */ static void vtd_address_space_unmap (VTDAddressSpace *as,IOMMUNotifier *n) { -hwaddr size, remain; +hwaddr total, remain;hwaddr start = n->start;hwaddr end = n->end;IntelIOMMUState *s = as->iommu_state;@@ -3765,7 +3765,7 @@ static void vtd_address_space_unmap(VTDAddressSpace *as, IOMMUNotifier *n) }assert (start <= end); - size = remain = end - start +1 ; + total = remain = end - start +1 ;while (remain >=VTD_PAGE_SIZE ) {IOMMUTLBEvent event;@@ -3793,10 +3793,10 @@ static void vtd_address_space_unmap(VTDAddressSpace *as, IOMMUNotifier *n) trace_vtd_as_unmap_whole(pci_bus_num(as->bus), VTD_PCI_SLOT(as->devfn),hw/i386/intel_iommu.c static void vtd_address_space_unmap(VTDAddressSpace *as, IOMMUNotifier *n) · line 3802
Quoted 10 lines
hw/i386/intel_iommu.c +2
-2VTD_PCI_FUNC (as->devfn), - n->start, size); + n->start, total); map.iova = n->start; - map.size = size -1 ;/* Inclusive */ + map.size = total -1 ;/* Inclusive */ iova_tree_remove (as->iova_tree, map); }arguably an improvement
Quoted 17 lines
hw/i386/pc.c +0
-1@@ -1116,7 +1116,6 @@ void pc_memory_init(PCMachineState *pcms,if (machine->device_memory) {uint64_t *val =g_malloc (sizeof (*val)); -PCMachineClass *pcmc =PC_MACHINE_GET_CLASS (pcms);uint64_t res_mem_end = machine->device_memory->base;if (!pcmc->broken_reserved_end) {hw/i386/x86.c +0
-0hw/i386/x86.c void x86_cpu_pre_plug(HotplugHandler *hotplug_dev, · line 370
Quoted 8 lines
hw/i386/x86.c +0
-2@@ -365,8 +365,6 @@ void x86_cpu_pre_plug(HotplugHandler *hotplug_dev, cpu_slot =x86_find_cpu_slot (MACHINE (x86ms), cpu->apic_id, &idx);if (!cpu_slot) { -MachineState *ms =MACHINE (x86ms); -x86_topo_ids_from_apicid (cpu->apic_id, &topo_info, &topo_ids);error_setg (errp, "Invalid CPU [socket: %u, die: %u, core: %u, thread: %u] with"killing dead code, nice
Quoted 2 lines
Signature · 1 line
2.39.3
Quoted 27 lines · Michael S. Tsirkin
Quoted 25 lines · Ani Sinha
Quoted 24 lines · Michael S. Tsirkin
Quoted 3 lines · Ani Sinha
Code changes that addresses all compiler complaints coming from enabling -Wshadow flags. Enabling -Wshadow catches cases of local variables shadowing other local variables or parameters. These makes the code confusing and/or adds
These make
Quoted 10 lines
bugs that are difficult to catch.
CC: Markus Armbruster <[email protected]>
CC: Philippe Mathieu-Daude <[email protected]>
CC: [email protected]
Message-Id: <[email protected]>Signed-off-by Ani Sinha <[email protected]>Reviewed-by Daniel P. Berrangé <[email protected]>Reviewed-by Peter Xu <[email protected]>---
chunks seem unrelated. why not split them up?
Quoted 8 lines
Quoted 1 line
? No idea what you talking about. Here and ...
you patch 4 files in a single patch.
intel_iommuis part of vtd emulation and
has separate maintainers. Slightly better to split up to have each maintainer get just the patches he cares about.
Not critical, for sure.
this was from the original email that Markus sent that had this group:
X86 Machines
------------
PC
M: Michael S. Tsirkin <[email protected]>
M: Marcel Apfelbaum <[email protected]>
hw/i386/acpi-build.c(*3*)
hw/i386/acpi-microvm.c(*2*)
hw/i386/intel_iommu.c(*3*)
hw/i386/pc.c(*2*)
hw/i386/x86.c(*2*)
Not sure why it was clubbed with others.
Quoted 30 lines
Quoted 30 lines
Quoted 30 lines
Quoted 30 lines
hw/i386/acpi-microvm.c | 12 ++++++------ hw/i386/intel_iommu.c | 8 ++++---- hw/i386/pc.c | 1 - hw/i386/x86.c | 2 -- 4 files changed, 10 insertions(+), 13 deletions(-)changelog:
v2: kept Peter's changes from https://lore.kernel.org/r/[email protected]
and removed mine.hw/i386/acpi-microvm.c +4
-4@@ -78,18 +78,18 @@ static void acpi_dsdt_add_virtio(Aml *scope,hwaddr base =VIRTIO_MMIO_BASE + index *512 ;hwaddr size =512 ; -Aml *dev =aml_device ("VR%02u" , (unsigned )index); -aml_append (dev,aml_name_decl ("_HID" ,aml_string ("LNRO0005" ))); -aml_append (dev,aml_name_decl ("_UID" ,aml_int (index))); -aml_append (dev,aml_name_decl ("_CCA" ,aml_int (1 ))); +Aml *adev =aml_device ("VR%02u" , (unsigned )index); +aml_append (adev,aml_name_decl ("_HID" ,aml_string ("LNRO0005" ))); +aml_append (adev,aml_name_decl ("_UID" ,aml_int (index))); +aml_append (adev,aml_name_decl ("_CCA" ,aml_int (1 )));
Quoted 15 lines
Quoted 13 lines
Quoted 13 lines
Quoted 12 lines
hw/i386/acpi-microvm.c +2
-2Aml *crs =aml_resource_template ();aml_append (crs,aml_memory32_fixed (base, size,AML_READ_WRITE ));aml_append (crs,aml_interrupt (AML_CONSUMER ,AML_LEVEL ,AML_ACTIVE_HIGH ,AML_EXCLUSIVE , &irq,1 )); -aml_append (dev,aml_name_decl ("_CRS" , crs)); -aml_append (scope, dev); +aml_append (adev,aml_name_decl ("_CRS" , crs)); +aml_append (scope, adev); } } }Quoted 2 lines
Quoted 2 lines
I would prefer to just drop the devicestate dev pointer, use
kid->childinside the macro.
good idea. addressed in v2.
Quoted 83 lines
Quoted 3 lines
Here …
Well, you renamed dev to adev because there's another dev at an outer scope which is set to
kid->child, and only used once. I suggest just dropping that one instead of removing this one.Quoted 72 lines
Quoted 72 lines
Quoted 26 lines
hw/i386/intel_iommu.c +2
-2@@ -3744,7 +3744,7 @@ VTDAddressSpace *vtd_find_add_as(IntelIOMMUState *s, PCIBus *bus,/* Unmap the whole range in the notifier's scope. */ static void vtd_address_space_unmap (VTDAddressSpace *as,IOMMUNotifier *n) { -hwaddr size, remain; +hwaddr total, remain;hwaddr start = n->start;hwaddr end = n->end;IntelIOMMUState *s = as->iommu_state;@@ -3765,7 +3765,7 @@ static void vtd_address_space_unmap(VTDAddressSpace *as, IOMMUNotifier *n) }assert (start <= end); - size = remain = end - start +1 ; + total = remain = end - start +1 ;while (remain >=VTD_PAGE_SIZE ) {IOMMUTLBEvent event;@@ -3793,10 +3793,10 @@ static void vtd_address_space_unmap(VTDAddressSpace *as, IOMMUNotifier *n) trace_vtd_as_unmap_whole(pci_bus_num(as->bus), VTD_PCI_SLOT(as->devfn),hw/i386/intel_iommu.c static void vtd_address_space_unmap(VTDAddressSpace *as, IOMMUNotifier *n) · line 3802
Quoted 10 lines
hw/i386/intel_iommu.c +2
-2VTD_PCI_FUNC (as->devfn), - n->start, size); + n->start, total); map.iova = n->start; - map.size = size -1 ;/* Inclusive */ + map.size = total -1 ;/* Inclusive */ iova_tree_remove (as->iova_tree, map); }arguably an improvement
Quoted 17 lines
hw/i386/pc.c +0
-1@@ -1116,7 +1116,6 @@ void pc_memory_init(PCMachineState *pcms,if (machine->device_memory) {uint64_t *val =g_malloc (sizeof (*val)); -PCMachineClass *pcmc =PC_MACHINE_GET_CLASS (pcms);uint64_t res_mem_end = machine->device_memory->base;if (!pcmc->broken_reserved_end) {hw/i386/x86.c +0
-0hw/i386/x86.c void x86_cpu_pre_plug(HotplugHandler *hotplug_dev, · line 370
Quoted 8 lines
hw/i386/x86.c +0
-2@@ -365,8 +365,6 @@ void x86_cpu_pre_plug(HotplugHandler *hotplug_dev, cpu_slot =x86_find_cpu_slot (MACHINE (x86ms), cpu->apic_id, &idx);if (!cpu_slot) { -MachineState *ms =MACHINE (x86ms); -x86_topo_ids_from_apicid (cpu->apic_id, &topo_info, &topo_ids);error_setg (errp, "Invalid CPU [socket: %u, die: %u, core: %u, thread: %u] with"killing dead code, nice
Quoted 2 lines
--
2.39.3