* [PATCH 0/2] hw/pci/pci_host: Small cleanups
@ 2019-12-16 0:21 Philippe Mathieu-Daudé
2019-12-16 0:21 ` [PATCH 1/2] hw/pci/pci_host: Remove redundant PCI_DPRINTF() Philippe Mathieu-Daudé
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-12-16 0:21 UTC (permalink / raw)
To: qemu-devel; +Cc: Philippe Mathieu-Daudé, Michael S. Tsirkin
- Use unsigned 'size' argument
- Remove unuseful DPRINTF()
Philippe Mathieu-Daudé (2):
hw/pci/pci_host: Remove redundant PCI_DPRINTF()
hw/pci/pci_host: Let pci_data_[read/write] use unsigned 'size'
argument
include/hw/pci/pci_host.h | 4 ++--
hw/pci/pci_host.c | 25 +++++++------------------
2 files changed, 9 insertions(+), 20 deletions(-)
--
2.21.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/2] hw/pci/pci_host: Remove redundant PCI_DPRINTF()
2019-12-16 0:21 [PATCH 0/2] hw/pci/pci_host: Small cleanups Philippe Mathieu-Daudé
@ 2019-12-16 0:21 ` Philippe Mathieu-Daudé
2019-12-16 0:21 ` [PATCH 2/2] hw/pci/pci_host: Let pci_data_[read/write] use unsigned 'size' argument Philippe Mathieu-Daudé
2019-12-16 15:10 ` [PATCH 0/2] hw/pci/pci_host: Small cleanups Michael S. Tsirkin
2 siblings, 0 replies; 4+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-12-16 0:21 UTC (permalink / raw)
To: qemu-devel; +Cc: Philippe Mathieu-Daudé, Michael S. Tsirkin
In commit 3bf4dfdd111 we introduced the pci_cfg_[read/write]
trace events in pci_host_config_[read/write]_common().
We have the following call trace:
pci_host_data_[read/write]()
- PCI_DPRINTF()
- pci_data_[read/write]()
- PCI_DPRINTF()
- pci_host_config_[read/write]_common()
trace_pci_cfg_[read/write]()
Since the PCI_DPRINTF() calls are redundant with the trace
events, remove them.
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
hw/pci/pci_host.c | 21 +++++----------------
1 file changed, 5 insertions(+), 16 deletions(-)
diff --git a/hw/pci/pci_host.c b/hw/pci/pci_host.c
index c5f9244934..0958d157de 100644
--- a/hw/pci/pci_host.c
+++ b/hw/pci/pci_host.c
@@ -115,8 +115,6 @@ void pci_data_write(PCIBus *s, uint32_t addr, uint32_t val, int len)
return;
}
- PCI_DPRINTF("%s: %s: addr=%02" PRIx32 " val=%08" PRIx32 " len=%d\n",
- __func__, pci_dev->name, config_addr, val, len);
pci_host_config_write_common(pci_dev, config_addr, PCI_CONFIG_SPACE_SIZE,
val, len);
}
@@ -125,18 +123,13 @@ uint32_t pci_data_read(PCIBus *s, uint32_t addr, int len)
{
PCIDevice *pci_dev = pci_dev_find_by_addr(s, addr);
uint32_t config_addr = addr & (PCI_CONFIG_SPACE_SIZE - 1);
- uint32_t val;
if (!pci_dev) {
return ~0x0;
}
- val = pci_host_config_read_common(pci_dev, config_addr,
- PCI_CONFIG_SPACE_SIZE, len);
- PCI_DPRINTF("%s: %s: addr=%02"PRIx32" val=%08"PRIx32" len=%d\n",
- __func__, pci_dev->name, config_addr, val, len);
-
- return val;
+ return pci_host_config_read_common(pci_dev, config_addr,
+ PCI_CONFIG_SPACE_SIZE, len);
}
static void pci_host_config_write(void *opaque, hwaddr addr,
@@ -167,8 +160,7 @@ static void pci_host_data_write(void *opaque, hwaddr addr,
uint64_t val, unsigned len)
{
PCIHostState *s = opaque;
- PCI_DPRINTF("write addr " TARGET_FMT_plx " len %d val %x\n",
- addr, len, (unsigned)val);
+
if (s->config_reg & (1u << 31))
pci_data_write(s->bus, s->config_reg | (addr & 3), val, len);
}
@@ -177,14 +169,11 @@ static uint64_t pci_host_data_read(void *opaque,
hwaddr addr, unsigned len)
{
PCIHostState *s = opaque;
- uint32_t val;
+
if (!(s->config_reg & (1U << 31))) {
return 0xffffffff;
}
- val = pci_data_read(s->bus, s->config_reg | (addr & 3), len);
- PCI_DPRINTF("read addr " TARGET_FMT_plx " len %d val %x\n",
- addr, len, val);
- return val;
+ return pci_data_read(s->bus, s->config_reg | (addr & 3), len);
}
const MemoryRegionOps pci_host_conf_le_ops = {
--
2.21.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] hw/pci/pci_host: Let pci_data_[read/write] use unsigned 'size' argument
2019-12-16 0:21 [PATCH 0/2] hw/pci/pci_host: Small cleanups Philippe Mathieu-Daudé
2019-12-16 0:21 ` [PATCH 1/2] hw/pci/pci_host: Remove redundant PCI_DPRINTF() Philippe Mathieu-Daudé
@ 2019-12-16 0:21 ` Philippe Mathieu-Daudé
2019-12-16 15:10 ` [PATCH 0/2] hw/pci/pci_host: Small cleanups Michael S. Tsirkin
2 siblings, 0 replies; 4+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-12-16 0:21 UTC (permalink / raw)
To: qemu-devel; +Cc: Philippe Mathieu-Daudé, Michael S. Tsirkin
Both functions are called by MemoryRegionOps.[read/write] handlers
with unsigned 'size' argument. Both functions call
pci_host_config_[read/write]_common() which expect a uint32_t 'len'
parameter (also unsigned).
Since it is pointless (and confuse) to use a signed value, use a
unsigned type.
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
include/hw/pci/pci_host.h | 4 ++--
hw/pci/pci_host.c | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/include/hw/pci/pci_host.h b/include/hw/pci/pci_host.h
index ba31595fc7..9ce088bd13 100644
--- a/include/hw/pci/pci_host.h
+++ b/include/hw/pci/pci_host.h
@@ -62,8 +62,8 @@ void pci_host_config_write_common(PCIDevice *pci_dev, uint32_t addr,
uint32_t pci_host_config_read_common(PCIDevice *pci_dev, uint32_t addr,
uint32_t limit, uint32_t len);
-void pci_data_write(PCIBus *s, uint32_t addr, uint32_t val, int len);
-uint32_t pci_data_read(PCIBus *s, uint32_t addr, int len);
+void pci_data_write(PCIBus *s, uint32_t addr, uint32_t val, unsigned len);
+uint32_t pci_data_read(PCIBus *s, uint32_t addr, unsigned len);
extern const MemoryRegionOps pci_host_conf_le_ops;
extern const MemoryRegionOps pci_host_conf_be_ops;
diff --git a/hw/pci/pci_host.c b/hw/pci/pci_host.c
index 0958d157de..ce7bcdb1d5 100644
--- a/hw/pci/pci_host.c
+++ b/hw/pci/pci_host.c
@@ -106,7 +106,7 @@ uint32_t pci_host_config_read_common(PCIDevice *pci_dev, uint32_t addr,
return ret;
}
-void pci_data_write(PCIBus *s, uint32_t addr, uint32_t val, int len)
+void pci_data_write(PCIBus *s, uint32_t addr, uint32_t val, unsigned len)
{
PCIDevice *pci_dev = pci_dev_find_by_addr(s, addr);
uint32_t config_addr = addr & (PCI_CONFIG_SPACE_SIZE - 1);
@@ -119,7 +119,7 @@ void pci_data_write(PCIBus *s, uint32_t addr, uint32_t val, int len)
val, len);
}
-uint32_t pci_data_read(PCIBus *s, uint32_t addr, int len)
+uint32_t pci_data_read(PCIBus *s, uint32_t addr, unsigned len)
{
PCIDevice *pci_dev = pci_dev_find_by_addr(s, addr);
uint32_t config_addr = addr & (PCI_CONFIG_SPACE_SIZE - 1);
--
2.21.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 0/2] hw/pci/pci_host: Small cleanups
2019-12-16 0:21 [PATCH 0/2] hw/pci/pci_host: Small cleanups Philippe Mathieu-Daudé
2019-12-16 0:21 ` [PATCH 1/2] hw/pci/pci_host: Remove redundant PCI_DPRINTF() Philippe Mathieu-Daudé
2019-12-16 0:21 ` [PATCH 2/2] hw/pci/pci_host: Let pci_data_[read/write] use unsigned 'size' argument Philippe Mathieu-Daudé
@ 2019-12-16 15:10 ` Michael S. Tsirkin
2 siblings, 0 replies; 4+ messages in thread
From: Michael S. Tsirkin @ 2019-12-16 15:10 UTC (permalink / raw)
To: Philippe Mathieu-Daudé; +Cc: qemu-devel
On Mon, Dec 16, 2019 at 01:21:32AM +0100, Philippe Mathieu-Daudé wrote:
> - Use unsigned 'size' argument
> - Remove unuseful DPRINTF()
Thanks!
I'll queue it for merge after the release. If possible please ping me
after the release to help make sure it didn't get dropped.
> Philippe Mathieu-Daudé (2):
> hw/pci/pci_host: Remove redundant PCI_DPRINTF()
> hw/pci/pci_host: Let pci_data_[read/write] use unsigned 'size'
> argument
>
> include/hw/pci/pci_host.h | 4 ++--
> hw/pci/pci_host.c | 25 +++++++------------------
> 2 files changed, 9 insertions(+), 20 deletions(-)
>
> --
> 2.21.0
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-12-16 15:11 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-16 0:21 [PATCH 0/2] hw/pci/pci_host: Small cleanups Philippe Mathieu-Daudé
2019-12-16 0:21 ` [PATCH 1/2] hw/pci/pci_host: Remove redundant PCI_DPRINTF() Philippe Mathieu-Daudé
2019-12-16 0:21 ` [PATCH 2/2] hw/pci/pci_host: Let pci_data_[read/write] use unsigned 'size' argument Philippe Mathieu-Daudé
2019-12-16 15:10 ` [PATCH 0/2] hw/pci/pci_host: Small cleanups Michael S. Tsirkin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).