All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
To: Jason Chien <jason.chien@sifive.com>,
	qemu-devel@nongnu.org, qemu-riscv@nongnu.org
Cc: Palmer Dabbelt <palmer@dabbelt.com>,
	Alistair Francis <alistair.francis@wdc.com>,
	Weiwei Li <liwei1518@gmail.com>,
	Liu Zhiwei <zhiwei_liu@linux.alibaba.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
Subject: Re: [PATCH 1/3] include/hw/pci: Attach BDF to Memory Attributes
Date: Fri, 7 Mar 2025 09:39:56 -0300	[thread overview]
Message-ID: <0464a115-fbfe-4038-9e2d-409ad133647e@ventanamicro.com> (raw)
In-Reply-To: <20250302091209.20063-2-jason.chien@sifive.com>



On 3/2/25 6:12 AM, Jason Chien wrote:
> This commit adds the BDF to the memory attributes for DMA operations.
> 
> Signed-off-by: Jason Chien <jason.chien@sifive.com>
> ---

This looks sensible but I'll feel more comfortable if Michael/Marcel also
takes a look. Thanks,


Daniel

>   include/hw/pci/pci_device.h | 10 ++++++++--
>   1 file changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/include/hw/pci/pci_device.h b/include/hw/pci/pci_device.h
> index add208edfa..968f1ba3e9 100644
> --- a/include/hw/pci/pci_device.h
> +++ b/include/hw/pci/pci_device.h
> @@ -244,6 +244,8 @@ static inline MemTxResult pci_dma_rw(PCIDevice *dev, dma_addr_t addr,
>                                        void *buf, dma_addr_t len,
>                                        DMADirection dir, MemTxAttrs attrs)
>   {
> +    attrs.unspecified = 0;
> +    attrs.requester_id = pci_requester_id(dev);
>       return dma_memory_rw(pci_get_address_space(dev), addr, buf, len,
>                            dir, attrs);
>   }
> @@ -292,6 +294,8 @@ static inline MemTxResult pci_dma_write(PCIDevice *dev, dma_addr_t addr,
>                                                  uint##_bits##_t *val, \
>                                                  MemTxAttrs attrs) \
>       { \
> +        attrs.unspecified = 0; \
> +        attrs.requester_id = pci_requester_id(dev); \
>           return ld##_l##_dma(pci_get_address_space(dev), addr, val, attrs); \
>       } \
>       static inline MemTxResult st##_s##_pci_dma(PCIDevice *dev, \
> @@ -299,6 +303,8 @@ static inline MemTxResult pci_dma_write(PCIDevice *dev, dma_addr_t addr,
>                                                  uint##_bits##_t val, \
>                                                  MemTxAttrs attrs) \
>       { \
> +        attrs.unspecified = 0; \
> +        attrs.requester_id = pci_requester_id(dev); \
>           return st##_s##_dma(pci_get_address_space(dev), addr, val, attrs); \
>       }
>   
> @@ -327,8 +333,8 @@ PCI_DMA_DEFINE_LDST(q_be, q_be, 64);
>   static inline void *pci_dma_map(PCIDevice *dev, dma_addr_t addr,
>                                   dma_addr_t *plen, DMADirection dir)
>   {
> -    return dma_memory_map(pci_get_address_space(dev), addr, plen, dir,
> -                          MEMTXATTRS_UNSPECIFIED);
> +    MemTxAttrs attrs = {.requester_id = pci_requester_id(dev)};
> +    return dma_memory_map(pci_get_address_space(dev), addr, plen, dir, attrs);
>   }
>   
>   static inline void pci_dma_unmap(PCIDevice *dev, void *buffer, dma_addr_t len,



  reply	other threads:[~2025-03-07 12:40 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-02  9:12 [PATCH 0/3] Enhancing Device Identification in RISC-V IOMMU Using Memory Attributes Jason Chien
2025-03-02  9:12 ` [PATCH 1/3] include/hw/pci: Attach BDF to " Jason Chien
2025-03-07 12:39   ` Daniel Henrique Barboza [this message]
2025-03-12 16:59     ` Jason Chien
2025-03-19 16:40       ` Jason Chien
2025-04-14 15:10         ` Jason Chien
2025-04-14 15:28   ` Michael S. Tsirkin
2025-04-24  7:57     ` Jason Chien
2025-03-02  9:12 ` [PATCH 2/3] hw/riscv/riscv-iommu: Obtain Device IDs from " Jason Chien
2025-03-07 12:35   ` Daniel Henrique Barboza
2025-03-02  9:12 ` [PATCH 3/3] hw/riscv/riscv_iommu: Remove the "bus" property Jason Chien
2025-03-07 12:36   ` Daniel Henrique Barboza
2025-04-04  1:43   ` Alistair Francis

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=0464a115-fbfe-4038-9e2d-409ad133647e@ventanamicro.com \
    --to=dbarboza@ventanamicro.com \
    --cc=alistair.francis@wdc.com \
    --cc=jason.chien@sifive.com \
    --cc=liwei1518@gmail.com \
    --cc=marcel.apfelbaum@gmail.com \
    --cc=mst@redhat.com \
    --cc=palmer@dabbelt.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-riscv@nongnu.org \
    --cc=zhiwei_liu@linux.alibaba.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 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.