From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>, qemu-devel@nongnu.org
Cc: "Edgar E. Iglesias" <edgar.iglesias@gmail.com>,
"Anthony Perard" <anthony.perard@citrix.com>,
"Fam Zheng" <fam@euphon.net>,
"Hervé Poussineau" <hpoussin@reactos.org>,
"Philippe Mathieu-Daudé" <philmd@redhat.com>,
kvm@vger.kernel.org, "Laurent Vivier" <lvivier@redhat.com>,
"Thomas Huth" <thuth@redhat.com>, "Stefan Weil" <sw@weilnetz.de>,
"Eric Auger" <eric.auger@redhat.com>,
"Halil Pasic" <pasic@linux.ibm.com>,
"Marcel Apfelbaum" <marcel.apfelbaum@gmail.com>,
qemu-s390x@nongnu.org,
"Aleksandar Rikalo" <aleksandar.rikalo@rt-rk.com>,
"David Gibson" <david@gibson.dropbear.id.au>,
"Michael Walle" <michael@walle.cc>,
qemu-ppc@nongnu.org, "Gerd Hoffmann" <kraxel@redhat.com>,
"Cornelia Huck" <cohuck@redhat.com>,
qemu-arm@nongnu.org, "Alistair Francis" <alistair@alistair23.me>,
qemu-block@nongnu.org, "Cédric Le Goater" <clg@kaod.org>,
"Jason Wang" <jasowang@redhat.com>,
xen-devel@lists.xenproject.org,
"Christian Borntraeger" <borntraeger@de.ibm.com>,
"Dmitry Fleytman" <dmitry.fleytman@gmail.com>,
"Matthew Rosato" <mjrosato@linux.ibm.com>,
"Eduardo Habkost" <ehabkost@redhat.com>,
"Richard Henderson" <richard.henderson@linaro.org>,
"Michael S. Tsirkin" <mst@redhat.com>,
"David Hildenbrand" <david@redhat.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Stefano Stabellini" <sstabellini@kernel.org>,
"Igor Mitsyanko" <i.mitsyanko@gmail.com>,
"Paul Durrant" <paul@xen.org>,
"Richard Henderson" <rth@twiddle.net>,
"John Snow" <jsnow@redhat.com>
Subject: [PATCH v3 02/20] hw: Remove unnecessary cast when calling dma_memory_read()
Date: Thu, 20 Feb 2020 14:05:30 +0100 [thread overview]
Message-ID: <20200220130548.29974-3-philmd@redhat.com> (raw)
In-Reply-To: <20200220130548.29974-1-philmd@redhat.com>
Since its introduction in commit d86a77f8abb, dma_memory_read()
always accepted void pointer argument. Remove the unnecessary
casts.
This commit was produced with the included Coccinelle script
scripts/coccinelle/exec_rw_const.
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
scripts/coccinelle/exec_rw_const.cocci | 15 +++++++++++++++
hw/arm/smmu-common.c | 3 +--
hw/arm/smmuv3.c | 10 ++++------
hw/sd/sdhci.c | 15 +++++----------
4 files changed, 25 insertions(+), 18 deletions(-)
create mode 100644 scripts/coccinelle/exec_rw_const.cocci
diff --git a/scripts/coccinelle/exec_rw_const.cocci b/scripts/coccinelle/exec_rw_const.cocci
new file mode 100644
index 0000000000..a0054f009d
--- /dev/null
+++ b/scripts/coccinelle/exec_rw_const.cocci
@@ -0,0 +1,15 @@
+// Usage:
+// spatch --sp-file scripts/coccinelle/exec_rw_const.cocci --dir . --in-place
+
+// Remove useless cast
+@@
+expression E1, E2, E3, E4;
+type T;
+@@
+(
+- dma_memory_read(E1, E2, (T *)E3, E4)
++ dma_memory_read(E1, E2, E3, E4)
+|
+- dma_memory_write(E1, E2, (T *)E3, E4)
++ dma_memory_write(E1, E2, E3, E4)
+)
diff --git a/hw/arm/smmu-common.c b/hw/arm/smmu-common.c
index 23eb117041..0f2573f004 100644
--- a/hw/arm/smmu-common.c
+++ b/hw/arm/smmu-common.c
@@ -74,8 +74,7 @@ static int get_pte(dma_addr_t baseaddr, uint32_t index, uint64_t *pte,
dma_addr_t addr = baseaddr + index * sizeof(*pte);
/* TODO: guarantee 64-bit single-copy atomicity */
- ret = dma_memory_read(&address_space_memory, addr,
- (uint8_t *)pte, sizeof(*pte));
+ ret = dma_memory_read(&address_space_memory, addr, pte, sizeof(*pte));
if (ret != MEMTX_OK) {
info->type = SMMU_PTW_ERR_WALK_EABT;
diff --git a/hw/arm/smmuv3.c b/hw/arm/smmuv3.c
index 8b5f157dc7..57a79df55b 100644
--- a/hw/arm/smmuv3.c
+++ b/hw/arm/smmuv3.c
@@ -279,8 +279,7 @@ static int smmu_get_ste(SMMUv3State *s, dma_addr_t addr, STE *buf,
trace_smmuv3_get_ste(addr);
/* TODO: guarantee 64-bit single-copy atomicity */
- ret = dma_memory_read(&address_space_memory, addr,
- (void *)buf, sizeof(*buf));
+ ret = dma_memory_read(&address_space_memory, addr, buf, sizeof(*buf));
if (ret != MEMTX_OK) {
qemu_log_mask(LOG_GUEST_ERROR,
"Cannot fetch pte at address=0x%"PRIx64"\n", addr);
@@ -301,8 +300,7 @@ static int smmu_get_cd(SMMUv3State *s, STE *ste, uint32_t ssid,
trace_smmuv3_get_cd(addr);
/* TODO: guarantee 64-bit single-copy atomicity */
- ret = dma_memory_read(&address_space_memory, addr,
- (void *)buf, sizeof(*buf));
+ ret = dma_memory_read(&address_space_memory, addr, buf, sizeof(*buf));
if (ret != MEMTX_OK) {
qemu_log_mask(LOG_GUEST_ERROR,
"Cannot fetch pte at address=0x%"PRIx64"\n", addr);
@@ -406,8 +404,8 @@ static int smmu_find_ste(SMMUv3State *s, uint32_t sid, STE *ste,
l2_ste_offset = sid & ((1 << s->sid_split) - 1);
l1ptr = (dma_addr_t)(strtab_base + l1_ste_offset * sizeof(l1std));
/* TODO: guarantee 64-bit single-copy atomicity */
- ret = dma_memory_read(&address_space_memory, l1ptr,
- (uint8_t *)&l1std, sizeof(l1std));
+ ret = dma_memory_read(&address_space_memory, l1ptr, &l1std,
+ sizeof(l1std));
if (ret != MEMTX_OK) {
qemu_log_mask(LOG_GUEST_ERROR,
"Could not read L1PTR at 0X%"PRIx64"\n", l1ptr);
diff --git a/hw/sd/sdhci.c b/hw/sd/sdhci.c
index 69dc3e6b90..d5abdaad41 100644
--- a/hw/sd/sdhci.c
+++ b/hw/sd/sdhci.c
@@ -701,8 +701,7 @@ static void get_adma_description(SDHCIState *s, ADMADescr *dscr)
hwaddr entry_addr = (hwaddr)s->admasysaddr;
switch (SDHC_DMA_TYPE(s->hostctl1)) {
case SDHC_CTRL_ADMA2_32:
- dma_memory_read(s->dma_as, entry_addr, (uint8_t *)&adma2,
- sizeof(adma2));
+ dma_memory_read(s->dma_as, entry_addr, &adma2, sizeof(adma2));
adma2 = le64_to_cpu(adma2);
/* The spec does not specify endianness of descriptor table.
* We currently assume that it is LE.
@@ -713,8 +712,7 @@ static void get_adma_description(SDHCIState *s, ADMADescr *dscr)
dscr->incr = 8;
break;
case SDHC_CTRL_ADMA1_32:
- dma_memory_read(s->dma_as, entry_addr, (uint8_t *)&adma1,
- sizeof(adma1));
+ dma_memory_read(s->dma_as, entry_addr, &adma1, sizeof(adma1));
adma1 = le32_to_cpu(adma1);
dscr->addr = (hwaddr)(adma1 & 0xFFFFF000);
dscr->attr = (uint8_t)extract32(adma1, 0, 7);
@@ -726,13 +724,10 @@ static void get_adma_description(SDHCIState *s, ADMADescr *dscr)
}
break;
case SDHC_CTRL_ADMA2_64:
- dma_memory_read(s->dma_as, entry_addr,
- (uint8_t *)(&dscr->attr), 1);
- dma_memory_read(s->dma_as, entry_addr + 2,
- (uint8_t *)(&dscr->length), 2);
+ dma_memory_read(s->dma_as, entry_addr, (&dscr->attr), 1);
+ dma_memory_read(s->dma_as, entry_addr + 2, (&dscr->length), 2);
dscr->length = le16_to_cpu(dscr->length);
- dma_memory_read(s->dma_as, entry_addr + 4,
- (uint8_t *)(&dscr->addr), 8);
+ dma_memory_read(s->dma_as, entry_addr + 4, (&dscr->addr), 8);
dscr->addr = le64_to_cpu(dscr->addr);
dscr->attr &= (uint8_t) ~0xC0;
dscr->incr = 12;
--
2.21.1
WARNING: multiple messages have this Message-ID (diff)
From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>, qemu-devel@nongnu.org
Cc: "Fam Zheng" <fam@euphon.net>,
"Dmitry Fleytman" <dmitry.fleytman@gmail.com>,
kvm@vger.kernel.org, "Michael S. Tsirkin" <mst@redhat.com>,
"Jason Wang" <jasowang@redhat.com>,
"Gerd Hoffmann" <kraxel@redhat.com>,
"Edgar E. Iglesias" <edgar.iglesias@gmail.com>,
"Stefano Stabellini" <sstabellini@kernel.org>,
"Matthew Rosato" <mjrosato@linux.ibm.com>,
qemu-block@nongnu.org, "David Hildenbrand" <david@redhat.com>,
"Halil Pasic" <pasic@linux.ibm.com>,
"Christian Borntraeger" <borntraeger@de.ibm.com>,
"Hervé Poussineau" <hpoussin@reactos.org>,
"Marcel Apfelbaum" <marcel.apfelbaum@gmail.com>,
"Anthony Perard" <anthony.perard@citrix.com>,
xen-devel@lists.xenproject.org,
"Aleksandar Rikalo" <aleksandar.rikalo@rt-rk.com>,
"Richard Henderson" <rth@twiddle.net>,
"Philippe Mathieu-Daudé" <philmd@redhat.com>,
"Laurent Vivier" <lvivier@redhat.com>,
"Thomas Huth" <thuth@redhat.com>,
"Eduardo Habkost" <ehabkost@redhat.com>,
"Stefan Weil" <sw@weilnetz.de>,
"Alistair Francis" <alistair@alistair23.me>,
"Richard Henderson" <richard.henderson@linaro.org>,
"Paul Durrant" <paul@xen.org>,
"Eric Auger" <eric.auger@redhat.com>,
qemu-s390x@nongnu.org, qemu-arm@nongnu.org,
"Cédric Le Goater" <clg@kaod.org>, "John Snow" <jsnow@redhat.com>,
"David Gibson" <david@gibson.dropbear.id.au>,
"Igor Mitsyanko" <i.mitsyanko@gmail.com>,
"Cornelia Huck" <cohuck@redhat.com>,
"Michael Walle" <michael@walle.cc>,
qemu-ppc@nongnu.org, "Paolo Bonzini" <pbonzini@redhat.com>
Subject: [Xen-devel] [PATCH v3 02/20] hw: Remove unnecessary cast when calling dma_memory_read()
Date: Thu, 20 Feb 2020 14:05:30 +0100 [thread overview]
Message-ID: <20200220130548.29974-3-philmd@redhat.com> (raw)
In-Reply-To: <20200220130548.29974-1-philmd@redhat.com>
Since its introduction in commit d86a77f8abb, dma_memory_read()
always accepted void pointer argument. Remove the unnecessary
casts.
This commit was produced with the included Coccinelle script
scripts/coccinelle/exec_rw_const.
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
scripts/coccinelle/exec_rw_const.cocci | 15 +++++++++++++++
hw/arm/smmu-common.c | 3 +--
hw/arm/smmuv3.c | 10 ++++------
hw/sd/sdhci.c | 15 +++++----------
4 files changed, 25 insertions(+), 18 deletions(-)
create mode 100644 scripts/coccinelle/exec_rw_const.cocci
diff --git a/scripts/coccinelle/exec_rw_const.cocci b/scripts/coccinelle/exec_rw_const.cocci
new file mode 100644
index 0000000000..a0054f009d
--- /dev/null
+++ b/scripts/coccinelle/exec_rw_const.cocci
@@ -0,0 +1,15 @@
+// Usage:
+// spatch --sp-file scripts/coccinelle/exec_rw_const.cocci --dir . --in-place
+
+// Remove useless cast
+@@
+expression E1, E2, E3, E4;
+type T;
+@@
+(
+- dma_memory_read(E1, E2, (T *)E3, E4)
++ dma_memory_read(E1, E2, E3, E4)
+|
+- dma_memory_write(E1, E2, (T *)E3, E4)
++ dma_memory_write(E1, E2, E3, E4)
+)
diff --git a/hw/arm/smmu-common.c b/hw/arm/smmu-common.c
index 23eb117041..0f2573f004 100644
--- a/hw/arm/smmu-common.c
+++ b/hw/arm/smmu-common.c
@@ -74,8 +74,7 @@ static int get_pte(dma_addr_t baseaddr, uint32_t index, uint64_t *pte,
dma_addr_t addr = baseaddr + index * sizeof(*pte);
/* TODO: guarantee 64-bit single-copy atomicity */
- ret = dma_memory_read(&address_space_memory, addr,
- (uint8_t *)pte, sizeof(*pte));
+ ret = dma_memory_read(&address_space_memory, addr, pte, sizeof(*pte));
if (ret != MEMTX_OK) {
info->type = SMMU_PTW_ERR_WALK_EABT;
diff --git a/hw/arm/smmuv3.c b/hw/arm/smmuv3.c
index 8b5f157dc7..57a79df55b 100644
--- a/hw/arm/smmuv3.c
+++ b/hw/arm/smmuv3.c
@@ -279,8 +279,7 @@ static int smmu_get_ste(SMMUv3State *s, dma_addr_t addr, STE *buf,
trace_smmuv3_get_ste(addr);
/* TODO: guarantee 64-bit single-copy atomicity */
- ret = dma_memory_read(&address_space_memory, addr,
- (void *)buf, sizeof(*buf));
+ ret = dma_memory_read(&address_space_memory, addr, buf, sizeof(*buf));
if (ret != MEMTX_OK) {
qemu_log_mask(LOG_GUEST_ERROR,
"Cannot fetch pte at address=0x%"PRIx64"\n", addr);
@@ -301,8 +300,7 @@ static int smmu_get_cd(SMMUv3State *s, STE *ste, uint32_t ssid,
trace_smmuv3_get_cd(addr);
/* TODO: guarantee 64-bit single-copy atomicity */
- ret = dma_memory_read(&address_space_memory, addr,
- (void *)buf, sizeof(*buf));
+ ret = dma_memory_read(&address_space_memory, addr, buf, sizeof(*buf));
if (ret != MEMTX_OK) {
qemu_log_mask(LOG_GUEST_ERROR,
"Cannot fetch pte at address=0x%"PRIx64"\n", addr);
@@ -406,8 +404,8 @@ static int smmu_find_ste(SMMUv3State *s, uint32_t sid, STE *ste,
l2_ste_offset = sid & ((1 << s->sid_split) - 1);
l1ptr = (dma_addr_t)(strtab_base + l1_ste_offset * sizeof(l1std));
/* TODO: guarantee 64-bit single-copy atomicity */
- ret = dma_memory_read(&address_space_memory, l1ptr,
- (uint8_t *)&l1std, sizeof(l1std));
+ ret = dma_memory_read(&address_space_memory, l1ptr, &l1std,
+ sizeof(l1std));
if (ret != MEMTX_OK) {
qemu_log_mask(LOG_GUEST_ERROR,
"Could not read L1PTR at 0X%"PRIx64"\n", l1ptr);
diff --git a/hw/sd/sdhci.c b/hw/sd/sdhci.c
index 69dc3e6b90..d5abdaad41 100644
--- a/hw/sd/sdhci.c
+++ b/hw/sd/sdhci.c
@@ -701,8 +701,7 @@ static void get_adma_description(SDHCIState *s, ADMADescr *dscr)
hwaddr entry_addr = (hwaddr)s->admasysaddr;
switch (SDHC_DMA_TYPE(s->hostctl1)) {
case SDHC_CTRL_ADMA2_32:
- dma_memory_read(s->dma_as, entry_addr, (uint8_t *)&adma2,
- sizeof(adma2));
+ dma_memory_read(s->dma_as, entry_addr, &adma2, sizeof(adma2));
adma2 = le64_to_cpu(adma2);
/* The spec does not specify endianness of descriptor table.
* We currently assume that it is LE.
@@ -713,8 +712,7 @@ static void get_adma_description(SDHCIState *s, ADMADescr *dscr)
dscr->incr = 8;
break;
case SDHC_CTRL_ADMA1_32:
- dma_memory_read(s->dma_as, entry_addr, (uint8_t *)&adma1,
- sizeof(adma1));
+ dma_memory_read(s->dma_as, entry_addr, &adma1, sizeof(adma1));
adma1 = le32_to_cpu(adma1);
dscr->addr = (hwaddr)(adma1 & 0xFFFFF000);
dscr->attr = (uint8_t)extract32(adma1, 0, 7);
@@ -726,13 +724,10 @@ static void get_adma_description(SDHCIState *s, ADMADescr *dscr)
}
break;
case SDHC_CTRL_ADMA2_64:
- dma_memory_read(s->dma_as, entry_addr,
- (uint8_t *)(&dscr->attr), 1);
- dma_memory_read(s->dma_as, entry_addr + 2,
- (uint8_t *)(&dscr->length), 2);
+ dma_memory_read(s->dma_as, entry_addr, (&dscr->attr), 1);
+ dma_memory_read(s->dma_as, entry_addr + 2, (&dscr->length), 2);
dscr->length = le16_to_cpu(dscr->length);
- dma_memory_read(s->dma_as, entry_addr + 4,
- (uint8_t *)(&dscr->addr), 8);
+ dma_memory_read(s->dma_as, entry_addr + 4, (&dscr->addr), 8);
dscr->addr = le64_to_cpu(dscr->addr);
dscr->attr &= (uint8_t) ~0xC0;
dscr->incr = 12;
--
2.21.1
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
WARNING: multiple messages have this Message-ID (diff)
From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>, qemu-devel@nongnu.org
Cc: "Fam Zheng" <fam@euphon.net>,
"Dmitry Fleytman" <dmitry.fleytman@gmail.com>,
kvm@vger.kernel.org, "Michael S. Tsirkin" <mst@redhat.com>,
"Jason Wang" <jasowang@redhat.com>,
"Gerd Hoffmann" <kraxel@redhat.com>,
"Edgar E. Iglesias" <edgar.iglesias@gmail.com>,
"Stefano Stabellini" <sstabellini@kernel.org>,
"Matthew Rosato" <mjrosato@linux.ibm.com>,
qemu-block@nongnu.org, "David Hildenbrand" <david@redhat.com>,
"Halil Pasic" <pasic@linux.ibm.com>,
"Christian Borntraeger" <borntraeger@de.ibm.com>,
"Hervé Poussineau" <hpoussin@reactos.org>,
"Anthony Perard" <anthony.perard@citrix.com>,
xen-devel@lists.xenproject.org,
"Aleksandar Rikalo" <aleksandar.rikalo@rt-rk.com>,
"Richard Henderson" <rth@twiddle.net>,
"Philippe Mathieu-Daudé" <philmd@redhat.com>,
"Laurent Vivier" <lvivier@redhat.com>,
"Thomas Huth" <thuth@redhat.com>,
"Eduardo Habkost" <ehabkost@redhat.com>,
"Stefan Weil" <sw@weilnetz.de>,
"Alistair Francis" <alistair@alistair23.me>,
"Richard Henderson" <richard.henderson@linaro.org>,
"Paul Durrant" <paul@xen.org>,
"Eric Auger" <eric.auger@redhat.com>,
qemu-s390x@nongnu.org, qemu-arm@nongnu.org,
"Cédric Le Goater" <clg@kaod.org>, "John Snow" <jsnow@redhat.com>,
"David Gibson" <david@gibson.dropbear.id.au>,
"Igor Mitsyanko" <i.mitsyanko@gmail.com>,
"Cornelia Huck" <cohuck@redhat.com>,
"Michael Walle" <michael@walle.cc>,
qemu-ppc@nongnu.org, "Paolo Bonzini" <pbonzini@redhat.com>
Subject: [PATCH v3 02/20] hw: Remove unnecessary cast when calling dma_memory_read()
Date: Thu, 20 Feb 2020 14:05:30 +0100 [thread overview]
Message-ID: <20200220130548.29974-3-philmd@redhat.com> (raw)
In-Reply-To: <20200220130548.29974-1-philmd@redhat.com>
Since its introduction in commit d86a77f8abb, dma_memory_read()
always accepted void pointer argument. Remove the unnecessary
casts.
This commit was produced with the included Coccinelle script
scripts/coccinelle/exec_rw_const.
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
scripts/coccinelle/exec_rw_const.cocci | 15 +++++++++++++++
hw/arm/smmu-common.c | 3 +--
hw/arm/smmuv3.c | 10 ++++------
hw/sd/sdhci.c | 15 +++++----------
4 files changed, 25 insertions(+), 18 deletions(-)
create mode 100644 scripts/coccinelle/exec_rw_const.cocci
diff --git a/scripts/coccinelle/exec_rw_const.cocci b/scripts/coccinelle/exec_rw_const.cocci
new file mode 100644
index 0000000000..a0054f009d
--- /dev/null
+++ b/scripts/coccinelle/exec_rw_const.cocci
@@ -0,0 +1,15 @@
+// Usage:
+// spatch --sp-file scripts/coccinelle/exec_rw_const.cocci --dir . --in-place
+
+// Remove useless cast
+@@
+expression E1, E2, E3, E4;
+type T;
+@@
+(
+- dma_memory_read(E1, E2, (T *)E3, E4)
++ dma_memory_read(E1, E2, E3, E4)
+|
+- dma_memory_write(E1, E2, (T *)E3, E4)
++ dma_memory_write(E1, E2, E3, E4)
+)
diff --git a/hw/arm/smmu-common.c b/hw/arm/smmu-common.c
index 23eb117041..0f2573f004 100644
--- a/hw/arm/smmu-common.c
+++ b/hw/arm/smmu-common.c
@@ -74,8 +74,7 @@ static int get_pte(dma_addr_t baseaddr, uint32_t index, uint64_t *pte,
dma_addr_t addr = baseaddr + index * sizeof(*pte);
/* TODO: guarantee 64-bit single-copy atomicity */
- ret = dma_memory_read(&address_space_memory, addr,
- (uint8_t *)pte, sizeof(*pte));
+ ret = dma_memory_read(&address_space_memory, addr, pte, sizeof(*pte));
if (ret != MEMTX_OK) {
info->type = SMMU_PTW_ERR_WALK_EABT;
diff --git a/hw/arm/smmuv3.c b/hw/arm/smmuv3.c
index 8b5f157dc7..57a79df55b 100644
--- a/hw/arm/smmuv3.c
+++ b/hw/arm/smmuv3.c
@@ -279,8 +279,7 @@ static int smmu_get_ste(SMMUv3State *s, dma_addr_t addr, STE *buf,
trace_smmuv3_get_ste(addr);
/* TODO: guarantee 64-bit single-copy atomicity */
- ret = dma_memory_read(&address_space_memory, addr,
- (void *)buf, sizeof(*buf));
+ ret = dma_memory_read(&address_space_memory, addr, buf, sizeof(*buf));
if (ret != MEMTX_OK) {
qemu_log_mask(LOG_GUEST_ERROR,
"Cannot fetch pte at address=0x%"PRIx64"\n", addr);
@@ -301,8 +300,7 @@ static int smmu_get_cd(SMMUv3State *s, STE *ste, uint32_t ssid,
trace_smmuv3_get_cd(addr);
/* TODO: guarantee 64-bit single-copy atomicity */
- ret = dma_memory_read(&address_space_memory, addr,
- (void *)buf, sizeof(*buf));
+ ret = dma_memory_read(&address_space_memory, addr, buf, sizeof(*buf));
if (ret != MEMTX_OK) {
qemu_log_mask(LOG_GUEST_ERROR,
"Cannot fetch pte at address=0x%"PRIx64"\n", addr);
@@ -406,8 +404,8 @@ static int smmu_find_ste(SMMUv3State *s, uint32_t sid, STE *ste,
l2_ste_offset = sid & ((1 << s->sid_split) - 1);
l1ptr = (dma_addr_t)(strtab_base + l1_ste_offset * sizeof(l1std));
/* TODO: guarantee 64-bit single-copy atomicity */
- ret = dma_memory_read(&address_space_memory, l1ptr,
- (uint8_t *)&l1std, sizeof(l1std));
+ ret = dma_memory_read(&address_space_memory, l1ptr, &l1std,
+ sizeof(l1std));
if (ret != MEMTX_OK) {
qemu_log_mask(LOG_GUEST_ERROR,
"Could not read L1PTR at 0X%"PRIx64"\n", l1ptr);
diff --git a/hw/sd/sdhci.c b/hw/sd/sdhci.c
index 69dc3e6b90..d5abdaad41 100644
--- a/hw/sd/sdhci.c
+++ b/hw/sd/sdhci.c
@@ -701,8 +701,7 @@ static void get_adma_description(SDHCIState *s, ADMADescr *dscr)
hwaddr entry_addr = (hwaddr)s->admasysaddr;
switch (SDHC_DMA_TYPE(s->hostctl1)) {
case SDHC_CTRL_ADMA2_32:
- dma_memory_read(s->dma_as, entry_addr, (uint8_t *)&adma2,
- sizeof(adma2));
+ dma_memory_read(s->dma_as, entry_addr, &adma2, sizeof(adma2));
adma2 = le64_to_cpu(adma2);
/* The spec does not specify endianness of descriptor table.
* We currently assume that it is LE.
@@ -713,8 +712,7 @@ static void get_adma_description(SDHCIState *s, ADMADescr *dscr)
dscr->incr = 8;
break;
case SDHC_CTRL_ADMA1_32:
- dma_memory_read(s->dma_as, entry_addr, (uint8_t *)&adma1,
- sizeof(adma1));
+ dma_memory_read(s->dma_as, entry_addr, &adma1, sizeof(adma1));
adma1 = le32_to_cpu(adma1);
dscr->addr = (hwaddr)(adma1 & 0xFFFFF000);
dscr->attr = (uint8_t)extract32(adma1, 0, 7);
@@ -726,13 +724,10 @@ static void get_adma_description(SDHCIState *s, ADMADescr *dscr)
}
break;
case SDHC_CTRL_ADMA2_64:
- dma_memory_read(s->dma_as, entry_addr,
- (uint8_t *)(&dscr->attr), 1);
- dma_memory_read(s->dma_as, entry_addr + 2,
- (uint8_t *)(&dscr->length), 2);
+ dma_memory_read(s->dma_as, entry_addr, (&dscr->attr), 1);
+ dma_memory_read(s->dma_as, entry_addr + 2, (&dscr->length), 2);
dscr->length = le16_to_cpu(dscr->length);
- dma_memory_read(s->dma_as, entry_addr + 4,
- (uint8_t *)(&dscr->addr), 8);
+ dma_memory_read(s->dma_as, entry_addr + 4, (&dscr->addr), 8);
dscr->addr = le64_to_cpu(dscr->addr);
dscr->attr &= (uint8_t) ~0xC0;
dscr->incr = 12;
--
2.21.1
next prev parent reply other threads:[~2020-02-20 13:06 UTC|newest]
Thread overview: 103+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-20 13:05 [PATCH v3 00/20] global exec/memory/dma APIs cleanup Philippe Mathieu-Daudé
2020-02-20 13:05 ` Philippe Mathieu-Daudé
2020-02-20 13:05 ` [Xen-devel] " Philippe Mathieu-Daudé
2020-02-20 13:05 ` [PATCH v3 01/20] scripts/git.orderfile: Display Cocci scripts before code modifications Philippe Mathieu-Daudé
2020-02-20 13:05 ` Philippe Mathieu-Daudé
2020-02-20 13:05 ` [Xen-devel] " Philippe Mathieu-Daudé
2020-02-20 13:10 ` Laurent Vivier
2020-02-20 13:10 ` Laurent Vivier
2020-02-20 13:10 ` [Xen-devel] " Laurent Vivier
2020-02-20 13:12 ` Eric Blake
2020-02-20 13:12 ` Eric Blake
2020-02-20 13:12 ` [Xen-devel] " Eric Blake
2020-02-20 20:36 ` Michael S. Tsirkin
2020-02-20 20:36 ` Michael S. Tsirkin
2020-02-20 20:36 ` [Xen-devel] " Michael S. Tsirkin
2020-02-20 13:05 ` Philippe Mathieu-Daudé [this message]
2020-02-20 13:05 ` [PATCH v3 02/20] hw: Remove unnecessary cast when calling dma_memory_read() Philippe Mathieu-Daudé
2020-02-20 13:05 ` [Xen-devel] " Philippe Mathieu-Daudé
2020-02-20 13:16 ` Eric Blake
2020-02-20 13:16 ` Eric Blake
2020-02-20 13:16 ` [Xen-devel] " Eric Blake
2020-02-20 13:43 ` Philippe Mathieu-Daudé
2020-02-20 13:43 ` Philippe Mathieu-Daudé
2020-02-20 13:43 ` [Xen-devel] " Philippe Mathieu-Daudé
2020-02-20 13:51 ` Philippe Mathieu-Daudé
2020-02-20 13:51 ` Philippe Mathieu-Daudé
2020-02-20 13:51 ` [Xen-devel] " Philippe Mathieu-Daudé
2020-02-20 13:05 ` [PATCH v3 03/20] exec: Let qemu_ram_*() functions take a const pointer argument Philippe Mathieu-Daudé
2020-02-20 13:05 ` Philippe Mathieu-Daudé
2020-02-20 13:05 ` [Xen-devel] " Philippe Mathieu-Daudé
2020-02-20 13:21 ` Paolo Bonzini
2020-02-20 13:21 ` Paolo Bonzini
2020-02-20 13:21 ` [Xen-devel] " Paolo Bonzini
2020-02-20 13:23 ` Philippe Mathieu-Daudé
2020-02-20 13:23 ` Philippe Mathieu-Daudé
2020-02-20 13:23 ` [Xen-devel] " Philippe Mathieu-Daudé
2020-02-20 13:56 ` Durrant, Paul
2020-02-20 13:56 ` Durrant, Paul
2020-02-20 13:05 ` [PATCH v3 04/20] exec: Rename ram_ptr variable Philippe Mathieu-Daudé
2020-02-20 13:05 ` Philippe Mathieu-Daudé
2020-02-20 13:05 ` [Xen-devel] " Philippe Mathieu-Daudé
2020-02-20 13:05 ` [PATCH v3 05/20] exec: Let flatview API take void pointer arguments Philippe Mathieu-Daudé
2020-02-20 13:05 ` Philippe Mathieu-Daudé
2020-02-20 13:05 ` [Xen-devel] " Philippe Mathieu-Daudé
2020-02-20 13:05 ` [PATCH v3 06/20] exec: Let the address_space API use " Philippe Mathieu-Daudé
2020-02-20 13:05 ` Philippe Mathieu-Daudé
2020-02-20 13:05 ` [Xen-devel] " Philippe Mathieu-Daudé
2020-02-20 13:05 ` [PATCH v3 07/20] hw/net: Avoid casting non-const pointer, use address_space_write() Philippe Mathieu-Daudé
2020-02-20 13:05 ` Philippe Mathieu-Daudé
2020-02-20 13:05 ` [Xen-devel] " Philippe Mathieu-Daudé
2020-02-20 13:05 ` [PATCH v3 08/20] Remove unnecessary cast when using the address_space API Philippe Mathieu-Daudé
2020-02-20 13:05 ` Philippe Mathieu-Daudé
2020-02-20 13:05 ` [Xen-devel] " Philippe Mathieu-Daudé
2020-02-21 8:38 ` Cornelia Huck
2020-02-21 8:38 ` Cornelia Huck
2020-02-21 8:38 ` [Xen-devel] " Cornelia Huck
2020-02-20 13:05 ` [PATCH v3 09/20] exec: Let the cpu_[physical]_memory API use void pointer arguments Philippe Mathieu-Daudé
2020-02-20 13:05 ` Philippe Mathieu-Daudé
2020-02-20 13:05 ` [Xen-devel] " Philippe Mathieu-Daudé
2020-02-20 13:05 ` [PATCH v3 10/20] Remove unnecessary cast when using the cpu_[physical]_memory API Philippe Mathieu-Daudé
2020-02-20 13:05 ` Philippe Mathieu-Daudé
2020-02-20 13:05 ` [Xen-devel] " Philippe Mathieu-Daudé
2020-02-20 13:05 ` [PATCH v3 11/20] hw/ide/internal: Remove unused DMARestartFunc typedef Philippe Mathieu-Daudé
2020-02-20 13:05 ` Philippe Mathieu-Daudé
2020-02-20 13:05 ` [Xen-devel] " Philippe Mathieu-Daudé
2020-03-05 0:36 ` John Snow
2020-03-05 0:36 ` John Snow
2020-03-05 0:36 ` [Xen-devel] " John Snow
2020-02-20 13:05 ` [PATCH v3 12/20] hw/ide: Let the DMAIntFunc prototype use a boolean 'is_write' argument Philippe Mathieu-Daudé
2020-02-20 13:05 ` Philippe Mathieu-Daudé
2020-02-20 13:05 ` [Xen-devel] " Philippe Mathieu-Daudé
2020-03-05 0:37 ` John Snow
2020-03-05 0:37 ` John Snow
2020-03-05 0:37 ` [Xen-devel] " John Snow
2020-02-20 13:05 ` [PATCH v3 13/20] hw/virtio: Let virtqueue_map_iovec() " Philippe Mathieu-Daudé
2020-02-20 13:05 ` Philippe Mathieu-Daudé
2020-02-20 13:05 ` [Xen-devel] " Philippe Mathieu-Daudé
2020-02-20 13:05 ` [PATCH v3 14/20] hw/virtio: Let vhost_memory_map() " Philippe Mathieu-Daudé
2020-02-20 13:05 ` Philippe Mathieu-Daudé
2020-02-20 13:05 ` [Xen-devel] " Philippe Mathieu-Daudé
2020-02-20 13:05 ` [PATCH v3 15/20] exec: Let address_space_unmap() " Philippe Mathieu-Daudé
2020-02-20 13:05 ` Philippe Mathieu-Daudé
2020-02-20 13:05 ` [Xen-devel] " Philippe Mathieu-Daudé
2020-02-20 13:05 ` [PATCH v3 16/20] Let address_space_rw() calls pass " Philippe Mathieu-Daudé
2020-02-20 13:05 ` Philippe Mathieu-Daudé
2020-02-20 13:05 ` [Xen-devel] " Philippe Mathieu-Daudé
2020-02-20 13:05 ` [PATCH v3 17/20] Avoid address_space_rw() with a constant is_write argument Philippe Mathieu-Daudé
2020-02-20 13:05 ` Philippe Mathieu-Daudé
2020-02-20 13:05 ` [Xen-devel] " Philippe Mathieu-Daudé
2020-02-20 13:05 ` [PATCH v3 18/20] exec: Let cpu_[physical]_memory API use a boolean 'is_write' argument Philippe Mathieu-Daudé
2020-02-20 13:05 ` Philippe Mathieu-Daudé
2020-02-20 13:05 ` [Xen-devel] " Philippe Mathieu-Daudé
2020-02-20 13:05 ` [PATCH v3 19/20] Let cpu_[physical]_memory() calls pass " Philippe Mathieu-Daudé
2020-02-20 13:05 ` Philippe Mathieu-Daudé
2020-02-20 13:05 ` [Xen-devel] " Philippe Mathieu-Daudé
2020-02-20 13:54 ` Durrant, Paul
2020-02-20 13:54 ` Durrant, Paul
2020-02-20 21:46 ` David Gibson
2020-02-20 21:46 ` David Gibson
2020-02-20 21:46 ` [Xen-devel] " David Gibson
2020-02-21 8:41 ` Cornelia Huck
2020-02-21 8:41 ` Cornelia Huck
2020-02-21 8:41 ` [Xen-devel] " Cornelia Huck
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200220130548.29974-3-philmd@redhat.com \
--to=philmd@redhat.com \
--cc=aleksandar.rikalo@rt-rk.com \
--cc=alistair@alistair23.me \
--cc=anthony.perard@citrix.com \
--cc=borntraeger@de.ibm.com \
--cc=clg@kaod.org \
--cc=cohuck@redhat.com \
--cc=david@gibson.dropbear.id.au \
--cc=david@redhat.com \
--cc=dmitry.fleytman@gmail.com \
--cc=edgar.iglesias@gmail.com \
--cc=ehabkost@redhat.com \
--cc=eric.auger@redhat.com \
--cc=fam@euphon.net \
--cc=hpoussin@reactos.org \
--cc=i.mitsyanko@gmail.com \
--cc=jasowang@redhat.com \
--cc=jsnow@redhat.com \
--cc=kraxel@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=lvivier@redhat.com \
--cc=marcel.apfelbaum@gmail.com \
--cc=michael@walle.cc \
--cc=mjrosato@linux.ibm.com \
--cc=mst@redhat.com \
--cc=pasic@linux.ibm.com \
--cc=paul@xen.org \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
--cc=qemu-s390x@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=rth@twiddle.net \
--cc=sstabellini@kernel.org \
--cc=sw@weilnetz.de \
--cc=thuth@redhat.com \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.