qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Farhan Ali <alifm@linux.ibm.com>
To: "Philippe Mathieu-Daudé" <philmd@linaro.org>, qemu-devel@nongnu.org
Cc: qemu-s390x@nongnu.org, mjrosato@linux.ibm.com,
	schnelle@linux.ibm.com, stefanha@redhat.com, kwolf@redhat.com,
	hreitz@redhat.com, thuth@redhat.com, fam@euphon.net,
	alex.williamson@redhat.com
Subject: Re: [PATCH v4 2/3] include: Add a header to define host PCI MMIO functions
Date: Tue, 15 Apr 2025 09:08:32 -0700	[thread overview]
Message-ID: <b8829a9d-8518-4531-ab5a-e46965183398@linux.ibm.com> (raw)
In-Reply-To: <71997461-7470-452b-9df1-3efa6d6f68c4@linaro.org>


On 4/14/2025 11:43 PM, Philippe Mathieu-Daudé wrote:
> Hi,
>
> On 14/4/25 23:36, Farhan Ali wrote:
>> Add a generic API for host PCI MMIO reads/writes
>> (e.g. Linux VFIO BAR accesses). The functions access
>> little endian memory and returns the result in
>> host cpu endianness.
>>
>> Signed-off-by: Farhan Ali <alifm@linux.ibm.com>
>> ---
>>   include/qemu/host-pci-mmio.h | 141 +++++++++++++++++++++++++++++++++++
>>   1 file changed, 141 insertions(+)
>>   create mode 100644 include/qemu/host-pci-mmio.h
>>
>> diff --git a/include/qemu/host-pci-mmio.h b/include/qemu/host-pci-mmio.h
>> new file mode 100644
>> index 0000000000..de17d67e3a
>> --- /dev/null
>> +++ b/include/qemu/host-pci-mmio.h
>> @@ -0,0 +1,141 @@
>> +/*
>> + * API for host PCI MMIO accesses (e.g. Linux VFIO BARs)
>> + *
>> + * Copyright 2025 IBM Corp.
>> + * Author(s): Farhan Ali <alifm@linux.ibm.com>
>> + *
>> + * SPDX-License-Identifier: GPL-2.0-or-later
>> + */
>> +
>> +#ifndef HOST_PCI_MMIO_H
>> +#define HOST_PCI_MMIO_H
>> +
>> +#include "qemu/bswap.h"
>> +#include "qemu/s390x_pci_mmio.h"
>> +
>> +
>> +static inline uint8_t host_pci_ldub_p(const void *ioaddr)
>
> Is it really worth inlining?
>
Hi Philippe,

I think so, we inline the ld/st generic helper functions in bswap.h. 
Curious, why do you think its not necessary?

Thanks

Farhan

>> +{
>> +    uint8_t ret = 0;
>> +#ifdef __s390x__
>> +    ret = s390x_pci_mmio_read_8(ioaddr);
>> +#else
>> +    ret = ldub_he_p(ioaddr);
>> +#endif
>> +
>> +    return ret;
>> +}
>
>


  parent reply	other threads:[~2025-04-15 16:10 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-14 21:36 [PATCH v4 0/3] Enable QEMU NVMe userspace driver on s390x Farhan Ali
2025-04-14 21:36 ` [PATCH v4 1/3] util: Add functions for s390x mmio read/write Farhan Ali
2025-04-14 21:36 ` [PATCH v4 2/3] include: Add a header to define host PCI MMIO functions Farhan Ali
2025-04-14 22:07   ` Farhan Ali
2025-04-15  6:43   ` Philippe Mathieu-Daudé
2025-04-15 14:19     ` Richard Henderson
2025-04-15 16:08     ` Farhan Ali [this message]
2025-04-14 21:36 ` [PATCH v4 3/3] block/nvme: Use host PCI MMIO API Farhan Ali

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=b8829a9d-8518-4531-ab5a-e46965183398@linux.ibm.com \
    --to=alifm@linux.ibm.com \
    --cc=alex.williamson@redhat.com \
    --cc=fam@euphon.net \
    --cc=hreitz@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=mjrosato@linux.ibm.com \
    --cc=philmd@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-s390x@nongnu.org \
    --cc=schnelle@linux.ibm.com \
    --cc=stefanha@redhat.com \
    --cc=thuth@redhat.com \
    /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 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).